// SPDX-License-Identifier: EUPL-1.2 import { validateInvoiceXml } from "./validate"; // A small synthetic invoice that touches every rule family. Running it once when the // Worker starts lets the JavaScript engine compile the hot paths during start-up, which // has its own time allowance, instead of during the first customer request. const WARMUP_INVOICE = '' + "urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0" + "urn:fdc:peppol.eu:2017:poacc:billing:01:1.0W-12026-01-01" + "380EURR" + '0123456749BE' + "BE0123456749VAT" + "S" + '0876543270BE' + "B" + 'trueFreight10.00' + "S21VAT" + '23.10110.0023.10' + "S21VAT" + '100.00110.00' + '133.1010.00133.10' + '12100.00' + "ItemS21VAT" + '50.00'; /** Returns the number of findings so callers and tests can see that the run happened. */ export function warmUpEngine(rounds = 3): number { let findings = 0; for (let round = 0; round < rounds; round += 1) findings = validateInvoiceXml(WARMUP_INVOICE).findings.length; return findings; }