@formfeed/engine 0.3.19 → 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -47,10 +47,12 @@ __export(index_exports, {
47
47
  DefaultHelperRegistry: () => DefaultHelperRegistry,
48
48
  EINVOICE_FLAVOURS: () => EINVOICE_FLAVOURS,
49
49
  EINVOICE_FLAVOUR_NAMES: () => EINVOICE_FLAVOUR_NAMES,
50
+ EINVOICE_HEADER_LENGTH: () => EINVOICE_HEADER_LENGTH,
50
51
  EINVOICE_MAX_MESSAGES: () => EINVOICE_MAX_MESSAGES,
51
52
  EINVOICE_PROFILES: () => EINVOICE_PROFILES,
52
53
  EINVOICE_PROFILE_NAMES: () => EINVOICE_PROFILE_NAMES,
53
54
  EINVOICE_SPEC_VERSIONS: () => EINVOICE_SPEC_VERSIONS,
55
+ EINVOICE_TEST_NOTE: () => EINVOICE_TEST_NOTE,
54
56
  EINVOICE_XML_NAME: () => EINVOICE_XML_NAME,
55
57
  EN16931_TERMS: () => EN16931_TERMS,
56
58
  EPC_MAX_BYTES: () => EPC_MAX_BYTES,
@@ -106,6 +108,7 @@ __export(index_exports, {
106
108
  editAttribute: () => editAttribute,
107
109
  editableRegion: () => editableRegion,
108
110
  editableRegionAt: () => editableRegionAt,
111
+ einvoiceHeaderValue: () => einvoiceHeaderValue,
109
112
  einvoiceOptionsSchema: () => einvoiceOptionsSchema,
110
113
  einvoiceResult: () => einvoiceResult,
111
114
  einvoiceXml: () => einvoiceXml,
@@ -9785,6 +9788,7 @@ var CII_GUIDELINES = {
9785
9788
  en16931: "urn:cen.eu:en16931:2017"
9786
9789
  };
9787
9790
  var EINVOICE_XML_NAME = "factur-x.xml";
9791
+ var EINVOICE_TEST_NOTE = "TEST \u2013 keine Rechnung / test render, not an invoice";
9788
9792
  function leaf(name, text4, attributes) {
9789
9793
  if (text4 === void 0 || text4 === "") return void 0;
9790
9794
  const kept = Object.entries(attributes ?? {}).filter(
@@ -10030,6 +10034,7 @@ function invoiceToCii(invoice, options) {
10030
10034
  leaf("ram:ID", invoice.number),
10031
10035
  leaf("ram:TypeCode", invoice.type_code),
10032
10036
  date("ram:IssueDateTime", invoice.issue_date),
10037
+ options.test ? group2("ram:IncludedNote", [leaf("ram:Content", EINVOICE_TEST_NOTE)]) : void 0,
10033
10038
  ...invoice.notes.map(
10034
10039
  (note2) => group2("ram:IncludedNote", [
10035
10040
  leaf("ram:Content", note2.text),
@@ -10943,6 +10948,33 @@ function einvoiceResult(options, specVersion, validation, display) {
10943
10948
  display: display ? { checked: display.checked, missing: display.missing } : null
10944
10949
  };
10945
10950
  }
10951
+ var EINVOICE_HEADER_LENGTH = 8e3;
10952
+ function einvoiceHeaderValue(result, limit = EINVOICE_HEADER_LENGTH) {
10953
+ const encode = (report) => encodeURIComponent(JSON.stringify(report));
10954
+ const full = encode(result);
10955
+ const validation = result.validation;
10956
+ if (full.length <= limit || !validation) return full;
10957
+ let messages = validation.messages.map((message) => ({
10958
+ ...message,
10959
+ location: null
10960
+ }));
10961
+ const cut = () => ({
10962
+ ...result,
10963
+ validation: { ...validation, messages, truncated: true }
10964
+ });
10965
+ let value = encode(cut());
10966
+ while (value.length > limit && messages.length > 0) {
10967
+ let last = messages.length - 1;
10968
+ for (let i = messages.length - 1; i >= 0; i--)
10969
+ if (messages[i].severity !== "error") {
10970
+ last = i;
10971
+ break;
10972
+ }
10973
+ messages = messages.filter((_, i) => i !== last);
10974
+ value = encode(cut());
10975
+ }
10976
+ return value;
10977
+ }
10946
10978
  var EINVOICE_FLAVOUR_NAMES = {
10947
10979
  "factur-x": "Factur-X",
10948
10980
  zugferd: "ZUGFeRD"
@@ -11146,7 +11178,7 @@ function einvoiceXml(data, options) {
11146
11178
  }
11147
11179
  ]
11148
11180
  };
11149
- const check = checkInvoice(block, options);
11181
+ const check = checkInvoice(block, { profile: options.profile });
11150
11182
  if (!check.ok) return { ok: false, problems: check.problems };
11151
11183
  return {
11152
11184
  ok: true,
package/index.js CHANGED
@@ -9565,6 +9565,7 @@ var CII_GUIDELINES = {
9565
9565
  en16931: "urn:cen.eu:en16931:2017"
9566
9566
  };
9567
9567
  var EINVOICE_XML_NAME = "factur-x.xml";
9568
+ var EINVOICE_TEST_NOTE = "TEST \u2013 keine Rechnung / test render, not an invoice";
9568
9569
  function leaf(name, text4, attributes) {
9569
9570
  if (text4 === void 0 || text4 === "") return void 0;
9570
9571
  const kept = Object.entries(attributes ?? {}).filter(
@@ -9810,6 +9811,7 @@ function invoiceToCii(invoice, options) {
9810
9811
  leaf("ram:ID", invoice.number),
9811
9812
  leaf("ram:TypeCode", invoice.type_code),
9812
9813
  date("ram:IssueDateTime", invoice.issue_date),
9814
+ options.test ? group2("ram:IncludedNote", [leaf("ram:Content", EINVOICE_TEST_NOTE)]) : void 0,
9813
9815
  ...invoice.notes.map(
9814
9816
  (note2) => group2("ram:IncludedNote", [
9815
9817
  leaf("ram:Content", note2.text),
@@ -10723,6 +10725,33 @@ function einvoiceResult(options, specVersion, validation, display) {
10723
10725
  display: display ? { checked: display.checked, missing: display.missing } : null
10724
10726
  };
10725
10727
  }
10728
+ var EINVOICE_HEADER_LENGTH = 8e3;
10729
+ function einvoiceHeaderValue(result, limit = EINVOICE_HEADER_LENGTH) {
10730
+ const encode = (report) => encodeURIComponent(JSON.stringify(report));
10731
+ const full = encode(result);
10732
+ const validation = result.validation;
10733
+ if (full.length <= limit || !validation) return full;
10734
+ let messages = validation.messages.map((message) => ({
10735
+ ...message,
10736
+ location: null
10737
+ }));
10738
+ const cut = () => ({
10739
+ ...result,
10740
+ validation: { ...validation, messages, truncated: true }
10741
+ });
10742
+ let value = encode(cut());
10743
+ while (value.length > limit && messages.length > 0) {
10744
+ let last = messages.length - 1;
10745
+ for (let i = messages.length - 1; i >= 0; i--)
10746
+ if (messages[i].severity !== "error") {
10747
+ last = i;
10748
+ break;
10749
+ }
10750
+ messages = messages.filter((_, i) => i !== last);
10751
+ value = encode(cut());
10752
+ }
10753
+ return value;
10754
+ }
10726
10755
  var EINVOICE_FLAVOUR_NAMES = {
10727
10756
  "factur-x": "Factur-X",
10728
10757
  zugferd: "ZUGFeRD"
@@ -10926,7 +10955,7 @@ function einvoiceXml(data, options) {
10926
10955
  }
10927
10956
  ]
10928
10957
  };
10929
- const check = checkInvoice(block, options);
10958
+ const check = checkInvoice(block, { profile: options.profile });
10930
10959
  if (!check.ok) return { ok: false, problems: check.problems };
10931
10960
  return {
10932
10961
  ok: true,
@@ -14159,10 +14188,12 @@ export {
14159
14188
  DefaultHelperRegistry,
14160
14189
  EINVOICE_FLAVOURS,
14161
14190
  EINVOICE_FLAVOUR_NAMES,
14191
+ EINVOICE_HEADER_LENGTH,
14162
14192
  EINVOICE_MAX_MESSAGES,
14163
14193
  EINVOICE_PROFILES,
14164
14194
  EINVOICE_PROFILE_NAMES,
14165
14195
  EINVOICE_SPEC_VERSIONS,
14196
+ EINVOICE_TEST_NOTE,
14166
14197
  EINVOICE_XML_NAME,
14167
14198
  EN16931_TERMS,
14168
14199
  EPC_MAX_BYTES,
@@ -14218,6 +14249,7 @@ export {
14218
14249
  editAttribute,
14219
14250
  editableRegion,
14220
14251
  editableRegionAt,
14252
+ einvoiceHeaderValue,
14221
14253
  einvoiceOptionsSchema,
14222
14254
  einvoiceResult,
14223
14255
  einvoiceXml,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formfeed/engine",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "The Formfeed template engine (Jinja2, Liquid, Handlebars) for the browser and Node.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/types/index.d.cts CHANGED
@@ -30,7 +30,7 @@ export type { ApplyResult, ChipKind, EditableRegion, EditItem, RegionChip, Regio
30
30
  export { resolveTranslation, translationTarget } from './lib/translation.cjs';
31
31
  export { DESIGN_LIMITS, DESIGN_VERSION, dataPathPattern, defaultLayer, designBytes, designOutputHash, designStarters, emitDesign, emptyDesign, genericFamily, googleFont, googleFonts, googleFontsUrl, imageIsEmpty, layerIdPattern, nearestWeight, nextLayerId, parseDesign, } from './lib/design/index.cjs';
32
32
  export type { BarcodeLayer, BarcodeSymbology, Binding, CanvasSize, DesignDocument, DesignLayer, DesignStarter, EmittedDesign, FontChoice, GoogleFont, ImageLayer, ImageSource, LayerBase, LayerType, Paint, ParsedDesign, QrLayer, Shadow, ShapeLayer, Stroke, TextFormat, TextItem, TextLayer, TextStyle, } from './lib/design/index.cjs';
33
- export { CII_GUIDELINES, CODE_LIST_RELEASE, DISPLAY_TERMS, EINVOICE_FLAVOURS, EINVOICE_FLAVOUR_NAMES, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILES, EINVOICE_PROFILE_NAMES, EINVOICE_SPEC_VERSIONS, EINVOICE_XML_NAME, EN16931_TERMS, INVOICE_DATA_KEY, VAT_CATEGORIES, capMessages, carriesTerm, checkInvoice, defaultEinvoiceOptions, displayCheck, displayMissingText, einvoiceOptionsSchema, einvoiceResult, einvoiceXml, htmlText, invoiceAmountText, invoiceLineOf, invoicePathSegments, invoiceSchema, invoiceSkeleton, invoiceToCii, locateJsonPath, resolveEinvoiceOptions, shownAmounts, } from './lib/einvoice/index.cjs';
33
+ export { CII_GUIDELINES, CODE_LIST_RELEASE, DISPLAY_TERMS, EINVOICE_FLAVOURS, EINVOICE_FLAVOUR_NAMES, EINVOICE_HEADER_LENGTH, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILES, EINVOICE_PROFILE_NAMES, EINVOICE_SPEC_VERSIONS, EINVOICE_TEST_NOTE, EINVOICE_XML_NAME, EN16931_TERMS, INVOICE_DATA_KEY, VAT_CATEGORIES, capMessages, carriesTerm, checkInvoice, defaultEinvoiceOptions, displayCheck, displayMissingText, einvoiceHeaderValue, einvoiceOptionsSchema, einvoiceResult, einvoiceXml, htmlText, invoiceAmountText, invoiceLineOf, invoicePathSegments, invoiceSchema, invoiceSkeleton, invoiceToCii, locateJsonPath, resolveEinvoiceOptions, shownAmounts, } from './lib/einvoice/index.cjs';
34
34
  export type { CheckOptions, DisplayCheck, DisplayValue, EinvoiceDisplay, EinvoiceFlavour, EinvoiceMessage, EinvoiceOptions, EinvoiceOptionsInput, EinvoiceProfile, EinvoiceResult, EinvoiceTerm, EinvoiceValidation, EinvoiceXml, Identifier, Invoice, InvoiceAddress, InvoiceAllowance, InvoiceBreakdown, InvoiceCheck, InvoiceInput, InvoiceLine, InvoiceParty, InvoiceProblem, InvoiceProblemCode, InvoiceTax, JsonLocation, ResolvedEinvoice, VatCategory, } from './lib/einvoice/index.cjs';
35
35
  export { ACCESSIBILITY_HEADER_LENGTH, ACCESSIBILITY_MAX_ELEMENTS, ACCESSIBILITY_MAX_FAILURES, AUDIT_CODES, AUDIT_RULES, AUDIT_SEVERITY, AUDIT_SNIPPET_LENGTH, AUDIT_TITLES, PDFUA_STANDARD, UA_CHECKS, UA_REFUSALS, accessibilityHeader, accessibilityHeaderValue, accessibilityResult, auditMessage, isUaSetting, resolveUa, } from './lib/accessibility/index.cjs';
36
36
  export type { AccessibilityFailure, AccessibilityResult, AccessibilityWarning, AuditArgs, AuditCode, AuditFinding, AuditLink, AuditOptions, AuditReport, AuditSeverity, UaCheck, UaOptions, UaSetting, ValidatorFailure, ValidatorVerdict, } from './lib/accessibility/index.cjs';
package/types/index.d.ts CHANGED
@@ -30,7 +30,7 @@ export type { ApplyResult, ChipKind, EditableRegion, EditItem, RegionChip, Regio
30
30
  export { resolveTranslation, translationTarget } from './lib/translation.js';
31
31
  export { DESIGN_LIMITS, DESIGN_VERSION, dataPathPattern, defaultLayer, designBytes, designOutputHash, designStarters, emitDesign, emptyDesign, genericFamily, googleFont, googleFonts, googleFontsUrl, imageIsEmpty, layerIdPattern, nearestWeight, nextLayerId, parseDesign, } from './lib/design/index.js';
32
32
  export type { BarcodeLayer, BarcodeSymbology, Binding, CanvasSize, DesignDocument, DesignLayer, DesignStarter, EmittedDesign, FontChoice, GoogleFont, ImageLayer, ImageSource, LayerBase, LayerType, Paint, ParsedDesign, QrLayer, Shadow, ShapeLayer, Stroke, TextFormat, TextItem, TextLayer, TextStyle, } from './lib/design/index.js';
33
- export { CII_GUIDELINES, CODE_LIST_RELEASE, DISPLAY_TERMS, EINVOICE_FLAVOURS, EINVOICE_FLAVOUR_NAMES, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILES, EINVOICE_PROFILE_NAMES, EINVOICE_SPEC_VERSIONS, EINVOICE_XML_NAME, EN16931_TERMS, INVOICE_DATA_KEY, VAT_CATEGORIES, capMessages, carriesTerm, checkInvoice, defaultEinvoiceOptions, displayCheck, displayMissingText, einvoiceOptionsSchema, einvoiceResult, einvoiceXml, htmlText, invoiceAmountText, invoiceLineOf, invoicePathSegments, invoiceSchema, invoiceSkeleton, invoiceToCii, locateJsonPath, resolveEinvoiceOptions, shownAmounts, } from './lib/einvoice/index.js';
33
+ export { CII_GUIDELINES, CODE_LIST_RELEASE, DISPLAY_TERMS, EINVOICE_FLAVOURS, EINVOICE_FLAVOUR_NAMES, EINVOICE_HEADER_LENGTH, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILES, EINVOICE_PROFILE_NAMES, EINVOICE_SPEC_VERSIONS, EINVOICE_TEST_NOTE, EINVOICE_XML_NAME, EN16931_TERMS, INVOICE_DATA_KEY, VAT_CATEGORIES, capMessages, carriesTerm, checkInvoice, defaultEinvoiceOptions, displayCheck, displayMissingText, einvoiceHeaderValue, einvoiceOptionsSchema, einvoiceResult, einvoiceXml, htmlText, invoiceAmountText, invoiceLineOf, invoicePathSegments, invoiceSchema, invoiceSkeleton, invoiceToCii, locateJsonPath, resolveEinvoiceOptions, shownAmounts, } from './lib/einvoice/index.js';
34
34
  export type { CheckOptions, DisplayCheck, DisplayValue, EinvoiceDisplay, EinvoiceFlavour, EinvoiceMessage, EinvoiceOptions, EinvoiceOptionsInput, EinvoiceProfile, EinvoiceResult, EinvoiceTerm, EinvoiceValidation, EinvoiceXml, Identifier, Invoice, InvoiceAddress, InvoiceAllowance, InvoiceBreakdown, InvoiceCheck, InvoiceInput, InvoiceLine, InvoiceParty, InvoiceProblem, InvoiceProblemCode, InvoiceTax, JsonLocation, ResolvedEinvoice, VatCategory, } from './lib/einvoice/index.js';
35
35
  export { ACCESSIBILITY_HEADER_LENGTH, ACCESSIBILITY_MAX_ELEMENTS, ACCESSIBILITY_MAX_FAILURES, AUDIT_CODES, AUDIT_RULES, AUDIT_SEVERITY, AUDIT_SNIPPET_LENGTH, AUDIT_TITLES, PDFUA_STANDARD, UA_CHECKS, UA_REFUSALS, accessibilityHeader, accessibilityHeaderValue, accessibilityResult, auditMessage, isUaSetting, resolveUa, } from './lib/accessibility/index.js';
36
36
  export type { AccessibilityFailure, AccessibilityResult, AccessibilityWarning, AuditArgs, AuditCode, AuditFinding, AuditLink, AuditOptions, AuditReport, AuditSeverity, UaCheck, UaOptions, UaSetting, ValidatorFailure, ValidatorVerdict, } from './lib/accessibility/index.js';
@@ -13,6 +13,15 @@ import type { EinvoiceProfile } from './schema.cjs';
13
13
  export declare const CII_GUIDELINES: Record<EinvoiceProfile, string>;
14
14
  /** The name the XML has inside the PDF, under either of the specification's two names. */
15
15
  export declare const EINVOICE_XML_NAME = "factur-x.xml";
16
+ /**
17
+ * The first note (BT-22) of a test render's invoice, on every plan (plan 25 §5.2): an XML carries
18
+ * no page mark, so the invoice says it of itself. No subject code: France's rules, which hold the
19
+ * subject codes of an invoice between French businesses, accept the note without one (measured
20
+ * with the sidecar on 2026-10-27). The wording waits for the Steuerberater (plan 25 §5.5).
21
+ */
22
+ export declare const EINVOICE_TEST_NOTE = "TEST \u2013 keine Rechnung / test render, not an invoice";
16
23
  export declare function invoiceToCii(invoice: Invoice, options: {
17
24
  profile: EinvoiceProfile;
25
+ /** A test render's invoice: its first note says it is none (`EINVOICE_TEST_NOTE`). */
26
+ test?: boolean;
18
27
  }): string;
@@ -13,6 +13,15 @@ import type { EinvoiceProfile } from './schema.js';
13
13
  export declare const CII_GUIDELINES: Record<EinvoiceProfile, string>;
14
14
  /** The name the XML has inside the PDF, under either of the specification's two names. */
15
15
  export declare const EINVOICE_XML_NAME = "factur-x.xml";
16
+ /**
17
+ * The first note (BT-22) of a test render's invoice, on every plan (plan 25 §5.2): an XML carries
18
+ * no page mark, so the invoice says it of itself. No subject code: France's rules, which hold the
19
+ * subject codes of an invoice between French businesses, accept the note without one (measured
20
+ * with the sidecar on 2026-10-27). The wording waits for the Steuerberater (plan 25 §5.5).
21
+ */
22
+ export declare const EINVOICE_TEST_NOTE = "TEST \u2013 keine Rechnung / test render, not an invoice";
16
23
  export declare function invoiceToCii(invoice: Invoice, options: {
17
24
  profile: EinvoiceProfile;
25
+ /** A test render's invoice: its first note says it is none (`EINVOICE_TEST_NOTE`). */
26
+ test?: boolean;
18
27
  }): string;
@@ -7,13 +7,13 @@
7
7
  import { type Invoice, type InvoiceProblem } from './check.cjs';
8
8
  import type { EinvoiceFlavour, EinvoiceProfile } from './schema.cjs';
9
9
  export { checkInvoice, type CheckOptions, type Identifier, type Invoice, type InvoiceAddress, type InvoiceAllowance, type InvoiceBreakdown, type InvoiceCheck, type InvoiceLine, type InvoiceParty, type InvoiceProblem, type InvoiceProblemCode, type InvoiceTax, } from './check.cjs';
10
- export { CII_GUIDELINES, EINVOICE_XML_NAME, invoiceToCii } from './cii.cjs';
10
+ export { CII_GUIDELINES, EINVOICE_TEST_NOTE, EINVOICE_XML_NAME, invoiceToCii, } from './cii.cjs';
11
11
  export { EN16931_TERMS, carriesTerm, type EinvoiceTerm } from './coverage.cjs';
12
12
  export { CODE_LIST_RELEASE } from './codes.generated.cjs';
13
13
  export { DISPLAY_TERMS, displayCheck, displayMissingText, shownAmounts, type DisplayCheck, type DisplayValue, } from './display.cjs';
14
14
  export { EINVOICE_FLAVOURS, EINVOICE_PROFILES, VAT_CATEGORIES, defaultEinvoiceOptions, einvoiceOptionsSchema, invoiceSchema, resolveEinvoiceOptions, type EinvoiceFlavour, type EinvoiceOptions, type EinvoiceOptionsInput, type EinvoiceProfile, type InvoiceInput, type ResolvedEinvoice, type VatCategory, } from './schema.cjs';
15
15
  export { invoicePathSegments, locateJsonPath, type JsonLocation, } from './locate.cjs';
16
- export { EINVOICE_FLAVOUR_NAMES, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILE_NAMES, capMessages, einvoiceResult, invoiceLineOf, type EinvoiceDisplay, type EinvoiceMessage, type EinvoiceResult, type EinvoiceValidation, } from './report.cjs';
16
+ export { EINVOICE_FLAVOUR_NAMES, EINVOICE_HEADER_LENGTH, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILE_NAMES, capMessages, einvoiceHeaderValue, einvoiceResult, invoiceLineOf, type EinvoiceDisplay, type EinvoiceMessage, type EinvoiceResult, type EinvoiceValidation, } from './report.cjs';
17
17
  export { htmlText } from './html-text.cjs';
18
18
  export { invoiceSkeleton } from './skeleton.cjs';
19
19
  /** Where the invoice sits in the render data. */
@@ -43,4 +43,6 @@ export type EinvoiceXml = {
43
43
  */
44
44
  export declare function einvoiceXml(data: unknown, options: {
45
45
  profile: EinvoiceProfile;
46
+ /** A test render's invoice, whose first note says it is none (`EINVOICE_TEST_NOTE`). */
47
+ test?: boolean;
46
48
  }): EinvoiceXml;
@@ -7,13 +7,13 @@
7
7
  import { type Invoice, type InvoiceProblem } from './check.js';
8
8
  import type { EinvoiceFlavour, EinvoiceProfile } from './schema.js';
9
9
  export { checkInvoice, type CheckOptions, type Identifier, type Invoice, type InvoiceAddress, type InvoiceAllowance, type InvoiceBreakdown, type InvoiceCheck, type InvoiceLine, type InvoiceParty, type InvoiceProblem, type InvoiceProblemCode, type InvoiceTax, } from './check.js';
10
- export { CII_GUIDELINES, EINVOICE_XML_NAME, invoiceToCii } from './cii.js';
10
+ export { CII_GUIDELINES, EINVOICE_TEST_NOTE, EINVOICE_XML_NAME, invoiceToCii, } from './cii.js';
11
11
  export { EN16931_TERMS, carriesTerm, type EinvoiceTerm } from './coverage.js';
12
12
  export { CODE_LIST_RELEASE } from './codes.generated.js';
13
13
  export { DISPLAY_TERMS, displayCheck, displayMissingText, shownAmounts, type DisplayCheck, type DisplayValue, } from './display.js';
14
14
  export { EINVOICE_FLAVOURS, EINVOICE_PROFILES, VAT_CATEGORIES, defaultEinvoiceOptions, einvoiceOptionsSchema, invoiceSchema, resolveEinvoiceOptions, type EinvoiceFlavour, type EinvoiceOptions, type EinvoiceOptionsInput, type EinvoiceProfile, type InvoiceInput, type ResolvedEinvoice, type VatCategory, } from './schema.js';
15
15
  export { invoicePathSegments, locateJsonPath, type JsonLocation, } from './locate.js';
16
- export { EINVOICE_FLAVOUR_NAMES, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILE_NAMES, capMessages, einvoiceResult, invoiceLineOf, type EinvoiceDisplay, type EinvoiceMessage, type EinvoiceResult, type EinvoiceValidation, } from './report.js';
16
+ export { EINVOICE_FLAVOUR_NAMES, EINVOICE_HEADER_LENGTH, EINVOICE_MAX_MESSAGES, EINVOICE_PROFILE_NAMES, capMessages, einvoiceHeaderValue, einvoiceResult, invoiceLineOf, type EinvoiceDisplay, type EinvoiceMessage, type EinvoiceResult, type EinvoiceValidation, } from './report.js';
17
17
  export { htmlText } from './html-text.js';
18
18
  export { invoiceSkeleton } from './skeleton.js';
19
19
  /** Where the invoice sits in the render data. */
@@ -43,4 +43,6 @@ export type EinvoiceXml = {
43
43
  */
44
44
  export declare function einvoiceXml(data: unknown, options: {
45
45
  profile: EinvoiceProfile;
46
+ /** A test render's invoice, whose first note says it is none (`EINVOICE_TEST_NOTE`). */
47
+ test?: boolean;
46
48
  }): EinvoiceXml;
@@ -62,6 +62,21 @@ export declare const EINVOICE_MAX_MESSAGES = 50;
62
62
  export declare function capMessages(messages: readonly EinvoiceMessage[], max?: number): Pick<EinvoiceValidation, 'messages' | 'truncated'>;
63
63
  /** The result of a render that got as far as `validation` and `display` say. */
64
64
  export declare function einvoiceResult(options: Pick<EinvoiceOptions, 'profile' | 'flavour'>, specVersion: string, validation: EinvoiceValidation | null, display: DisplayCheck | null): EinvoiceResult;
65
+ /**
66
+ * How long the report may be as a header value. A proxy answers a response whose headers grow past a
67
+ * few kilobytes with 502, and the e-invoice's report shares this room with a PDF/UA verdict
68
+ * (`ACCESSIBILITY_HEADER_LENGTH`) where a render made both.
69
+ */
70
+ export declare const EINVOICE_HEADER_LENGTH = 8000;
71
+ /**
72
+ * The report as a response header carries it: the editor's true render reads the file from the body
73
+ * and the report from `X-Formfeed-Einvoice`, percent-encoded because a validator's message is not
74
+ * always ASCII. A report too long for `limit` loses, in this order, every finding's place, then the
75
+ * findings from the last, warnings before errors, and says so in `truncated` (plan 25 §5.5). What
76
+ * makes it a verdict always arrives: whether the file is valid, the rule set, the validator's id and
77
+ * versions, the hashes of the bytes it judged, and the display check.
78
+ */
79
+ export declare function einvoiceHeaderValue(result: EinvoiceResult, limit?: number): string;
65
80
  /** The names a person reads: `Factur-X` and `EN 16931` for `factur-x` and `en16931`. */
66
81
  export declare const EINVOICE_FLAVOUR_NAMES: Record<EinvoiceFlavour, string>;
67
82
  export declare const EINVOICE_PROFILE_NAMES: Record<EinvoiceProfile, string>;
@@ -62,6 +62,21 @@ export declare const EINVOICE_MAX_MESSAGES = 50;
62
62
  export declare function capMessages(messages: readonly EinvoiceMessage[], max?: number): Pick<EinvoiceValidation, 'messages' | 'truncated'>;
63
63
  /** The result of a render that got as far as `validation` and `display` say. */
64
64
  export declare function einvoiceResult(options: Pick<EinvoiceOptions, 'profile' | 'flavour'>, specVersion: string, validation: EinvoiceValidation | null, display: DisplayCheck | null): EinvoiceResult;
65
+ /**
66
+ * How long the report may be as a header value. A proxy answers a response whose headers grow past a
67
+ * few kilobytes with 502, and the e-invoice's report shares this room with a PDF/UA verdict
68
+ * (`ACCESSIBILITY_HEADER_LENGTH`) where a render made both.
69
+ */
70
+ export declare const EINVOICE_HEADER_LENGTH = 8000;
71
+ /**
72
+ * The report as a response header carries it: the editor's true render reads the file from the body
73
+ * and the report from `X-Formfeed-Einvoice`, percent-encoded because a validator's message is not
74
+ * always ASCII. A report too long for `limit` loses, in this order, every finding's place, then the
75
+ * findings from the last, warnings before errors, and says so in `truncated` (plan 25 §5.5). What
76
+ * makes it a verdict always arrives: whether the file is valid, the rule set, the validator's id and
77
+ * versions, the hashes of the bytes it judged, and the display check.
78
+ */
79
+ export declare function einvoiceHeaderValue(result: EinvoiceResult, limit?: number): string;
65
80
  /** The names a person reads: `Factur-X` and `EN 16931` for `factur-x` and `en16931`. */
66
81
  export declare const EINVOICE_FLAVOUR_NAMES: Record<EinvoiceFlavour, string>;
67
82
  export declare const EINVOICE_PROFILE_NAMES: Record<EinvoiceProfile, string>;