@financica/ubl 0.7.0 → 0.9.0

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.
@@ -1,3 +1,4 @@
1
+ //#region src/build/ubl/constants.d.ts
1
2
  /** Peppol BIS Billing 3.0 / EN 16931 identifiers and fixed code values. */
2
3
  /** EN 16931 + Peppol BIS Billing 3.0 customization (BT-24). */
3
4
  declare const UBL_CUSTOMIZATION_ID = "urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0";
@@ -17,7 +18,8 @@ declare const NS_INVOICE = "urn:oasis:names:specification:ubl:schema:xsd:Invoice
17
18
  declare const NS_CREDIT_NOTE = "urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2";
18
19
  declare const NS_CAC = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2";
19
20
  declare const NS_CBC = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2";
20
-
21
+ //#endregion
22
+ //#region src/build/ubl/types.d.ts
21
23
  /**
22
24
  * A vendor-neutral model of a Peppol BIS Billing 3.0 document.
23
25
  *
@@ -27,42 +29,42 @@ declare const NS_CBC = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasic
27
29
  * populate — not a full UBL object graph.
28
30
  */
29
31
  interface UblAddress {
30
- /** `cbc:StreetName` (BT-35). */
31
- street: string | null;
32
- /** `cbc:AdditionalStreetName` (BT-36). */
33
- additionalStreet: string | null;
34
- /** `cbc:CityName` (BT-37). */
35
- city: string | null;
36
- /** `cbc:PostalZone` (BT-38). */
37
- postalZone: string | null;
38
- /** `cbc:CountrySubentity` (BT-39). */
39
- countrySubentity: string | null;
40
- /** `cac:Country/cbc:IdentificationCode` (BT-40) — ISO 3166-1 alpha-2. */
41
- countryCode: string | null;
32
+ /** `cbc:StreetName` (BT-35). */
33
+ street: string | null;
34
+ /** `cbc:AdditionalStreetName` (BT-36). */
35
+ additionalStreet: string | null;
36
+ /** `cbc:CityName` (BT-37). */
37
+ city: string | null;
38
+ /** `cbc:PostalZone` (BT-38). */
39
+ postalZone: string | null;
40
+ /** `cbc:CountrySubentity` (BT-39). */
41
+ countrySubentity: string | null;
42
+ /** `cac:Country/cbc:IdentificationCode` (BT-40) — ISO 3166-1 alpha-2. */
43
+ countryCode: string | null;
42
44
  }
43
45
  /** Peppol participant identifier, e.g. scheme `0208`, value `0800279001`. */
44
46
  interface UblEndpoint {
45
- scheme: string;
46
- value: string;
47
+ scheme: string;
48
+ value: string;
47
49
  }
48
50
  /** Legal registration identifier, e.g. a Belgian enterprise number. */
49
51
  interface UblCompanyId {
50
- value: string;
51
- /** ICD scheme (e.g. `0208` for the Belgian CBE), when known. */
52
- scheme?: string | null;
52
+ value: string;
53
+ /** ICD scheme (e.g. `0208` for the Belgian CBE), when known. */
54
+ scheme?: string | null;
53
55
  }
54
56
  interface UblParty {
55
- /** `cbc:EndpointID` (BT-49/BT-34) — the Peppol routing identifier. */
56
- endpoint: UblEndpoint | null;
57
- /** `cac:PartyName/cbc:Name` (BT-27/BT-44). */
58
- name: string;
59
- address: UblAddress;
60
- /** `cac:PartyTaxScheme/cbc:CompanyID` with `VAT` scheme (BT-31/BT-48). */
61
- vatNumber: string | null;
62
- /** `cac:PartyLegalEntity/cbc:RegistrationName` (BT-27/BT-44). Defaults to `name`. */
63
- legalName: string | null;
64
- /** `cac:PartyLegalEntity/cbc:CompanyID` (BT-30/BT-47). */
65
- companyId: UblCompanyId | null;
57
+ /** `cbc:EndpointID` (BT-49/BT-34) — the Peppol routing identifier. */
58
+ endpoint: UblEndpoint | null;
59
+ /** `cac:PartyName/cbc:Name` (BT-27/BT-44). */
60
+ name: string;
61
+ address: UblAddress;
62
+ /** `cac:PartyTaxScheme/cbc:CompanyID` with `VAT` scheme (BT-31/BT-48). */
63
+ vatNumber: string | null;
64
+ /** `cac:PartyLegalEntity/cbc:RegistrationName` (BT-27/BT-44). Defaults to `name`. */
65
+ legalName: string | null;
66
+ /** `cac:PartyLegalEntity/cbc:CompanyID` (BT-30/BT-47). */
67
+ companyId: UblCompanyId | null;
66
68
  }
67
69
  /**
68
70
  * VAT breakdown category. `id` is a UNCL5305 code:
@@ -75,86 +77,88 @@ interface UblParty {
75
77
  * - `G` Export outside the EU
76
78
  */
77
79
  interface UblTaxCategory {
78
- id: string;
79
- percent: number;
80
- /** Required by EN 16931 (BR-E-10/BR-AE-10/…) for non-`S`/`Z` categories. */
81
- exemptionReason?: string | null;
80
+ id: string;
81
+ percent: number;
82
+ /** Required by EN 16931 (BR-E-10/BR-AE-10/…) for non-`S`/`Z` categories. */
83
+ exemptionReason?: string | null;
82
84
  }
83
85
  interface UblLine {
84
- /** `cbc:ID` (BT-126) — line identifier. */
85
- id: string;
86
- /** `cac:Item/cbc:Name` (BT-153). */
87
- name: string;
88
- /** `cbc:InvoicedQuantity` / `cbc:CreditedQuantity` (BT-129). */
89
- quantity: number;
90
- /** UN/ECE Rec 20 unit code (BT-130). */
91
- unitCode: string;
92
- /** `cbc:LineExtensionAmount` (BT-131) — net of VAT, after line discounts. */
93
- lineExtensionAmount: number;
94
- /** `cac:Price/cbc:PriceAmount` (BT-146) — net unit price. */
95
- priceAmount: number;
96
- taxCategory: UblTaxCategory;
86
+ /** `cbc:ID` (BT-126) — line identifier. */
87
+ id: string;
88
+ /** `cac:Item/cbc:Name` (BT-153). */
89
+ name: string;
90
+ /** `cbc:InvoicedQuantity` / `cbc:CreditedQuantity` (BT-129). */
91
+ quantity: number;
92
+ /** UN/ECE Rec 20 unit code (BT-130). */
93
+ unitCode: string;
94
+ /** `cbc:LineExtensionAmount` (BT-131) — net of VAT, after line discounts. */
95
+ lineExtensionAmount: number;
96
+ /** `cac:Price/cbc:PriceAmount` (BT-146) — net unit price. */
97
+ priceAmount: number;
98
+ taxCategory: UblTaxCategory;
97
99
  }
98
100
  interface UblTaxSubtotal {
99
- /** `cbc:TaxableAmount` (BT-116). */
100
- taxableAmount: number;
101
- /** `cbc:TaxAmount` (BT-117). */
102
- taxAmount: number;
103
- category: UblTaxCategory;
101
+ /** `cbc:TaxableAmount` (BT-116). */
102
+ taxableAmount: number;
103
+ /** `cbc:TaxAmount` (BT-117). */
104
+ taxAmount: number;
105
+ category: UblTaxCategory;
104
106
  }
105
107
  interface UblTaxTotal {
106
- /** `cbc:TaxAmount` (BT-110) — sum of subtotal tax amounts. */
107
- taxAmount: number;
108
- subtotals: UblTaxSubtotal[];
108
+ /** `cbc:TaxAmount` (BT-110) — sum of subtotal tax amounts. */
109
+ taxAmount: number;
110
+ subtotals: UblTaxSubtotal[];
109
111
  }
110
112
  interface UblMonetaryTotal {
111
- /** BT-106 — sum of line net amounts. */
112
- lineExtensionAmount: number;
113
- /** BT-109 — total without VAT. */
114
- taxExclusiveAmount: number;
115
- /** BT-112 — total with VAT. */
116
- taxInclusiveAmount: number;
117
- /** BT-115 — amount due for payment. */
118
- payableAmount: number;
113
+ /** BT-106 — sum of line net amounts. */
114
+ lineExtensionAmount: number;
115
+ /** BT-109 — total without VAT. */
116
+ taxExclusiveAmount: number;
117
+ /** BT-112 — total with VAT. */
118
+ taxInclusiveAmount: number;
119
+ /** BT-115 — amount due for payment. */
120
+ payableAmount: number;
119
121
  }
120
122
  /** An embedded supporting document (BG-24), e.g. the rendered PDF. */
121
123
  interface UblAttachment {
122
- /** `cac:AdditionalDocumentReference/cbc:ID` (BT-122). */
123
- id: string;
124
- /** `cbc:EmbeddedDocumentBinaryObject/@filename`. */
125
- filename: string;
126
- /** MIME type, e.g. `application/pdf`. */
127
- mimeCode: string;
128
- /** Base64-encoded document bytes. */
129
- base64: string;
124
+ /** `cac:AdditionalDocumentReference/cbc:ID` (BT-122). */
125
+ id: string;
126
+ /** `cbc:EmbeddedDocumentBinaryObject/@filename`. */
127
+ filename: string;
128
+ /** MIME type, e.g. `application/pdf`. */
129
+ mimeCode: string;
130
+ /** Base64-encoded document bytes. */
131
+ base64: string;
130
132
  }
131
133
  interface UblDocument {
132
- documentType: "invoice" | "creditNote";
133
- /** Invoice / credit note number (BT-1). */
134
- id: string;
135
- /** Issue date (BT-2), `YYYY-MM-DD`. */
136
- issueDate: string;
137
- /** Payment due date (BT-9). Invoices only. */
138
- dueDate: string | null;
139
- /** Free-text note (BT-22). */
140
- note: string | null;
141
- /** Document currency (BT-5). */
142
- currency: string;
143
- /** Buyer reference (BT-10). */
144
- buyerReference: string | null;
145
- /** For credit notes: the referenced original invoice number (BT-25). */
146
- precedingInvoiceId: string | null;
147
- supplier: UblParty;
148
- customer: UblParty;
149
- lines: UblLine[];
150
- taxTotal: UblTaxTotal;
151
- monetaryTotal: UblMonetaryTotal;
152
- attachments: UblAttachment[];
134
+ documentType: "invoice" | "creditNote";
135
+ /** Invoice / credit note number (BT-1). */
136
+ id: string;
137
+ /** Issue date (BT-2), `YYYY-MM-DD`. */
138
+ issueDate: string;
139
+ /** Payment due date (BT-9). Invoices only. */
140
+ dueDate: string | null;
141
+ /** Free-text note (BT-22). */
142
+ note: string | null;
143
+ /** Document currency (BT-5). */
144
+ currency: string;
145
+ /** Buyer reference (BT-10). */
146
+ buyerReference: string | null;
147
+ /** For credit notes: the referenced original invoice number (BT-25). */
148
+ precedingInvoiceId: string | null;
149
+ supplier: UblParty;
150
+ customer: UblParty;
151
+ lines: UblLine[];
152
+ taxTotal: UblTaxTotal;
153
+ monetaryTotal: UblMonetaryTotal;
154
+ attachments: UblAttachment[];
153
155
  }
154
-
156
+ //#endregion
157
+ //#region src/build/ubl/serialize.d.ts
155
158
  /** Serialize a {@link UblDocument} into a Peppol BIS Billing 3.0 XML string. */
156
159
  declare const serializeUblDocument: (doc: UblDocument) => string;
157
-
160
+ //#endregion
161
+ //#region src/build/party.d.ts
158
162
  /**
159
163
  * Supplier (seller) VAT status. Drives how zero-VAT lines are reported when the
160
164
  * seller does not charge VAT:
@@ -174,23 +178,23 @@ type SupplierVatStatus = 1 | 2 | 3;
174
178
  * exists, the party builder no longer needs to know where it came from.
175
179
  */
176
180
  interface UblSupplier {
177
- /** Display + legal name shown on the invoice. */
178
- name: string;
179
- /** ISO 3166-1 alpha-2 country code (e.g. `"BE"`). */
180
- countryCode: string;
181
- /**
182
- * Free-form address. Stripe-style fields (`line1`, `postal_code`, `country`)
183
- * and legacy/internal fields (`street`, `zip_code`) are both accepted.
184
- */
185
- address: unknown;
186
- /** Country-specific company/registration number (e.g. BE enterprise number). */
187
- companyNumber?: string | null;
188
- /** VAT number with country prefix (e.g. `"BE0793904121"`). */
189
- vatNumber?: string | null;
190
- /** Whether the supplier charges VAT. See {@link SupplierVatStatus}. */
191
- vatStatus: SupplierVatStatus;
192
- /** Peppol participant identifier in `scheme:value` form (e.g. `"0208:0793904121"`). */
193
- peppolID?: string | null;
181
+ /** Display + legal name shown on the invoice. */
182
+ name: string;
183
+ /** ISO 3166-1 alpha-2 country code (e.g. `"BE"`). */
184
+ countryCode: string;
185
+ /**
186
+ * Free-form address. Stripe-style fields (`line1`, `postal_code`, `country`)
187
+ * and legacy/internal fields (`street`, `zip_code`) are both accepted.
188
+ */
189
+ address: unknown;
190
+ /** Country-specific company/registration number (e.g. BE enterprise number). */
191
+ companyNumber?: string | null;
192
+ /** VAT number with country prefix (e.g. `"BE0793904121"`). */
193
+ vatNumber?: string | null;
194
+ /** Whether the supplier charges VAT. See {@link SupplierVatStatus}. */
195
+ vatStatus: SupplierVatStatus;
196
+ /** Peppol participant identifier in `scheme:value` form (e.g. `"0208:0793904121"`). */
197
+ peppolID?: string | null;
194
198
  }
195
199
  /** Convert a {@link UblSupplier} into the supplier (seller) party. */
196
200
  declare const buildSupplierParty: (supplier: UblSupplier) => UblParty;
@@ -202,25 +206,25 @@ declare const buildSupplierParty: (supplier: UblSupplier) => UblParty;
202
206
  * {@link buildCustomerParty}, so the Peppol routing logic lives in one place.
203
207
  */
204
208
  interface UblCustomer {
205
- /** Display + legal name shown on the invoice. */
206
- name: string;
207
- /** Customer address, already normalized by the caller. */
208
- address: UblAddress;
209
- /**
210
- * The customer's ISO 3166-1 alpha-2 country, used to resolve VAT/registration
211
- * schemes for identifiers that don't carry a country prefix. Pass the
212
- * customer's *own* country (never the supplier's) so the document is not
213
- * mis-routed; falls back to the address country when omitted.
214
- */
215
- countryCode?: string | null;
216
- /** Peppol participant identifier in `scheme:value` form (e.g. `"0208:0793904121"`). */
217
- peppolID?: string | null;
218
- /** Global Location Number (resolved under EAS `0088`). */
219
- glnNumber?: string | null;
220
- /** Generic tax/registration number (no VAT prefix). */
221
- taxNumber?: string | null;
222
- /** VAT number with country prefix (e.g. `"BE0793904121"`). */
223
- vatNumber?: string | null;
209
+ /** Display + legal name shown on the invoice. */
210
+ name: string;
211
+ /** Customer address, already normalized by the caller. */
212
+ address: UblAddress;
213
+ /**
214
+ * The customer's ISO 3166-1 alpha-2 country, used to resolve VAT/registration
215
+ * schemes for identifiers that don't carry a country prefix. Pass the
216
+ * customer's *own* country (never the supplier's) so the document is not
217
+ * mis-routed; falls back to the address country when omitted.
218
+ */
219
+ countryCode?: string | null;
220
+ /** Peppol participant identifier in `scheme:value` form (e.g. `"0208:0793904121"`). */
221
+ peppolID?: string | null;
222
+ /** Global Location Number (resolved under EAS `0088`). */
223
+ glnNumber?: string | null;
224
+ /** Generic tax/registration number (no VAT prefix). */
225
+ taxNumber?: string | null;
226
+ /** VAT number with country prefix (e.g. `"BE0793904121"`). */
227
+ vatNumber?: string | null;
224
228
  }
225
229
  /**
226
230
  * Convert a {@link UblCustomer} into the customer (buyer) party.
@@ -234,7 +238,8 @@ interface UblCustomer {
234
238
  * document would be unroutable.
235
239
  */
236
240
  declare const buildCustomerParty: (customer: UblCustomer, endpointOverride?: UblEndpoint | null) => UblParty;
237
-
241
+ //#endregion
242
+ //#region src/build/address.d.ts
238
243
  /**
239
244
  * Normalize a free-form address (Stripe shape, custom shape, or an internal
240
245
  * shape) into a {@link UblAddress}.
@@ -245,24 +250,26 @@ declare const buildCustomerParty: (customer: UblCustomer, endpointOverride?: Ubl
245
250
  * `null` when "no country" is the right answer.
246
251
  */
247
252
  declare const normalizeAddress: (address: unknown, fallbackCountryCode: string | null, fallbackLine?: string | null) => UblAddress;
248
-
253
+ //#endregion
254
+ //#region src/build/attachment.d.ts
249
255
  /**
250
256
  * Build a UBL embedded-document attachment (BG-24) from raw bytes — e.g. the
251
257
  * rendered PDF of the invoice. Emitted as a `cac:AdditionalDocumentReference`
252
258
  * with an inline base64 `cbc:EmbeddedDocumentBinaryObject`.
253
259
  */
254
260
  declare const buildPdfAttachment: (params: {
255
- filename: string;
256
- bytes: Uint8Array;
257
- /** Document reference ID (BT-122). Defaults to the filename. */
258
- id?: string;
261
+ filename: string;
262
+ bytes: Uint8Array;
263
+ /** Document reference ID (BT-122). Defaults to the filename. */
264
+ id?: string;
259
265
  }) => UblAttachment;
260
266
  /**
261
267
  * Replace each attachment's base64 payload with `[omitted]` plus a length, so a
262
268
  * {@link UblDocument} is safe to log or persist for audit.
263
269
  */
264
270
  declare const sanitizeUblDocumentForAudit: (doc: UblDocument) => UblDocument;
265
-
271
+ //#endregion
272
+ //#region src/build/identifiers.d.ts
266
273
  /**
267
274
  * Strip whitespace/punctuation from a country-specific company number.
268
275
  * For Belgium, also strips an optional `BE` prefix.
@@ -281,8 +288,8 @@ declare const normalizeCompanyNumberForCountry: (countryCode: string | null | un
281
288
  * CompanyID is emitted without a `schemeID` attribute.
282
289
  */
283
290
  declare const resolveCompanyIdScheme: (params: {
284
- countryCode: string | null;
285
- companyNumber: string | null;
291
+ countryCode: string | null;
292
+ companyNumber: string | null;
286
293
  }) => string | null;
287
294
  /**
288
295
  * Build the `cac:PartyLegalEntity/cbc:CompanyID` value for a party, with the
@@ -290,8 +297,8 @@ declare const resolveCompanyIdScheme: (params: {
290
297
  * company number.
291
298
  */
292
299
  declare const buildCompanyId: (params: {
293
- countryCode: string | null;
294
- companyNumber: string | null;
300
+ countryCode: string | null;
301
+ companyNumber: string | null;
295
302
  }) => UblCompanyId | null;
296
303
  /**
297
304
  * Resolve the Peppol participant identifier for a VAT number, deriving the EAS
@@ -304,8 +311,8 @@ declare const buildCompanyId: (params: {
304
311
  * when the country has no VAT EAS scheme or the input is empty.
305
312
  */
306
313
  declare const resolveVatEndpoint: (params: {
307
- vatNumber: string | null | undefined;
308
- countryCode?: string | null;
314
+ vatNumber: string | null | undefined;
315
+ countryCode?: string | null;
309
316
  }) => UblEndpoint | null;
310
317
  /**
311
318
  * Parse a Peppol participant identifier into a {@link UblEndpoint}.
@@ -316,10 +323,10 @@ declare const resolveVatEndpoint: (params: {
316
323
  */
317
324
  declare const parsePeppolEndpoint: (peppolId: string | null | undefined) => UblEndpoint | null;
318
325
  interface CustomerTaxIdentifiers {
319
- peppolID: string | null;
320
- glnNumber: string | null;
321
- taxNumber: string | null;
322
- vatNumber: string | null;
326
+ peppolID: string | null;
327
+ glnNumber: string | null;
328
+ taxNumber: string | null;
329
+ vatNumber: string | null;
323
330
  }
324
331
  /**
325
332
  * Pick the first usable Peppol identifier, GLN, VAT number, and tax number
@@ -349,40 +356,44 @@ declare const extractCustomerTaxIdentifiers: (taxIds: unknown) => CustomerTaxIde
349
356
  * identifiers that don't carry a country prefix (GLN, plain tax numbers).
350
357
  */
351
358
  declare const listPeppolReceiverIdentifierCandidates: (customer: {
352
- peppolID?: string | null;
353
- glnNumber?: string | null;
354
- taxNumber?: string | null;
355
- vatNumber?: string | null;
359
+ peppolID?: string | null;
360
+ glnNumber?: string | null;
361
+ taxNumber?: string | null;
362
+ vatNumber?: string | null;
356
363
  }, countryCode?: string | null) => string[];
357
-
364
+ //#endregion
365
+ //#region src/build/numeric.d.ts
358
366
  /** Round a number to 2 decimal places (cents). */
359
367
  declare const roundCurrency: (value: number) => number;
360
368
  /** Convert an integer cent amount into a 2-decimal currency value. */
361
369
  declare const centsToDecimal: (cents: number) => number;
362
-
370
+ //#endregion
371
+ //#region src/build/tax-category.d.ts
363
372
  /**
364
373
  * Stripe Tax `taxability_reason` values that map to a VAT-exempt UBL category
365
374
  * (`E`). Reverse charge is handled separately (category `AE`).
366
375
  */
367
376
  declare const EXEMPT_TAXABILITY_REASONS: Set<string>;
368
377
  interface TaxAmountInfo {
369
- amount: number;
370
- taxability_reason?: string | null;
371
- tax_rate_percentage?: number | null;
378
+ amount: number;
379
+ taxability_reason?: string | null;
380
+ tax_rate_percentage?: number | null;
372
381
  }
373
382
  /**
374
383
  * Map an explicit UBL category hint, a Stripe `taxability_reason`, and/or a
375
384
  * numeric rate into a {@link UblTaxCategory}.
376
385
  *
377
386
  * - Reverse charge → `AE` (0%, with exemption reason)
387
+ * - Intra-community supply → `K` (0%, with exemption reason)
388
+ * - Export outside the EU → `G` (0%, with exemption reason)
378
389
  * - Any other exempt reason → `E` (0%, with exemption reason)
379
390
  * - Category `Z` / rate ≤ 0 → `Z` (zero-rated, 0%)
380
391
  * - Otherwise → `S` (standard, the line's rate)
381
392
  */
382
393
  declare const taxCategoryFromReasonOrRate: (params: {
383
- taxCategoryId?: string | null;
384
- taxabilityReason: string | null;
385
- rate: number;
394
+ taxCategoryId?: string | null;
395
+ taxabilityReason: string | null;
396
+ rate: number;
386
397
  }) => UblTaxCategory;
387
398
  /**
388
399
  * Resolve a {@link UblTaxCategory} from a line's Stripe tax info.
@@ -391,7 +402,8 @@ declare const taxCategoryFromReasonOrRate: (params: {
391
402
  * otherwise the rate decides standard (`S`) vs zero-rated (`Z`).
392
403
  */
393
404
  declare const resolveTaxCategoryFromTaxAmounts: (taxAmounts: TaxAmountInfo[], rate: number) => UblTaxCategory;
394
-
405
+ //#endregion
406
+ //#region src/build/tax-totals.d.ts
395
407
  /**
396
408
  * Adjust the largest line's net amount so the line nets sum to the
397
409
  * authoritative document total (e.g. Stripe's `invoice.total_excluding_tax`).
@@ -404,8 +416,8 @@ declare const resolveTaxCategoryFromTaxAmounts: (taxAmounts: TaxAmountInfo[], ra
404
416
  */
405
417
  declare const reconcileLinesToExclTotal: (lines: UblLine[], authoritativeTotalExclVat: number) => UblLine[];
406
418
  interface BuildTaxTotalsResult {
407
- taxTotal: UblTaxTotal;
408
- monetaryTotal: UblMonetaryTotal;
419
+ taxTotal: UblTaxTotal;
420
+ monetaryTotal: UblMonetaryTotal;
409
421
  }
410
422
  /**
411
423
  * Group lines by `(category, percent)` into a VAT breakdown and compute the
@@ -419,7 +431,8 @@ interface BuildTaxTotalsResult {
419
431
  * a cents-rounded system as a rate-based VAT breakdown.
420
432
  */
421
433
  declare const buildTaxTotals: (lines: UblLine[]) => BuildTaxTotalsResult;
422
-
434
+ //#endregion
435
+ //#region src/build/xml.d.ts
423
436
  /**
424
437
  * Minimal, dependency-free XML builder + serializer.
425
438
  *
@@ -430,12 +443,12 @@ declare const buildTaxTotals: (lines: UblLine[]) => BuildTaxTotalsResult;
430
443
  */
431
444
  type XmlAttrs = Record<string, string | number | null | undefined>;
432
445
  interface XmlElement {
433
- name: string;
434
- attrs?: XmlAttrs;
435
- /** Leaf text content. Mutually exclusive with `children`. */
436
- text?: string | number | null;
437
- /** Child elements. Mutually exclusive with `text`. */
438
- children?: XmlElement[];
446
+ name: string;
447
+ attrs?: XmlAttrs;
448
+ /** Leaf text content. Mutually exclusive with `children`. */
449
+ text?: string | number | null;
450
+ /** Child elements. Mutually exclusive with `text`. */
451
+ children?: XmlElement[];
439
452
  }
440
453
  /** Falsy children are dropped, so callers can write `cond && el(...)`. */
441
454
  type ChildSpec = XmlElement | null | undefined | false;
@@ -449,5 +462,6 @@ type ChildSpec = XmlElement | null | undefined | false;
449
462
  declare const el: (name: string, attrs?: XmlAttrs | null, content?: string | number | null | ChildSpec[]) => XmlElement;
450
463
  /** Serialize a root element into a UTF-8 XML document string. */
451
464
  declare const serializeDocument: (root: XmlElement) => string;
452
-
465
+ //#endregion
453
466
  export { type BuildTaxTotalsResult, COUNTRY_CODE_LIST_ID, CREDIT_NOTE_TYPE_CODE, type CustomerTaxIdentifiers, DEFAULT_UNIT_CODE, EXEMPT_TAXABILITY_REASONS, INVOICE_TYPE_CODE, NS_CAC, NS_CBC, NS_CREDIT_NOTE, NS_INVOICE, type SupplierVatStatus, type TaxAmountInfo, UBL_CUSTOMIZATION_ID, UBL_PROFILE_ID, type UblAddress, type UblAttachment, type UblCompanyId, type UblCustomer, type UblDocument, type UblEndpoint, type UblLine, type UblMonetaryTotal, type UblParty, type UblSupplier, type UblTaxCategory, type UblTaxSubtotal, type UblTaxTotal, VAT_TAX_SCHEME_ID, type XmlAttrs, type XmlElement, buildCompanyId, buildCustomerParty, buildPdfAttachment, buildSupplierParty, buildTaxTotals, centsToDecimal, el, extractCustomerTaxIdentifiers, listPeppolReceiverIdentifierCandidates, normalizeAddress, normalizeCompanyNumberForCountry, parsePeppolEndpoint, reconcileLinesToExclTotal, resolveCompanyIdScheme, resolveTaxCategoryFromTaxAmounts, resolveVatEndpoint, roundCurrency, sanitizeUblDocumentForAudit, serializeDocument, serializeUblDocument, taxCategoryFromReasonOrRate };
467
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/build/ubl/constants.ts","../../src/build/ubl/types.ts","../../src/build/ubl/serialize.ts","../../src/build/party.ts","../../src/build/address.ts","../../src/build/attachment.ts","../../src/build/identifiers.ts","../../src/build/numeric.ts","../../src/build/tax-category.ts","../../src/build/tax-totals.ts","../../src/build/xml.ts"],"mappings":";;;cAGa;;cAIA;;cAGA;;cAEA;;cAGA;;cAGA;;cAGA;cAEA;cACA;cAEA;cAEA;;;;;;;;;;;UCnBI;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIgB;EAChB;EACA;;;UAIgB;EAChB;;EAEA;;UAGgB;;EAEhB,UAAU;;EAEV;EACA,SAAS;;EAET;;EAEA;;EAEA,WAAW;;;;;;;;;;;;UAaK;EAChB;EACA;;EAEA;;UAGgB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,aAAa;;UAGG;;EAEhB;;EAEA;EACA,UAAU;;UAGM;;EAEhB;EACA,WAAW;;UAGK;;EAEhB;;EAEA;;EAEA;;EAEA;;;UAIgB;;EAEhB;;EAEA;;EAEA;;EAEA;;UAGgB;EAChB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,UAAU;EACV,UAAU;EACV,OAAO;EACP,UAAU;EACV,eAAe;EACf,aAAa;;;;;cCaD,uBAAoB,KAAS;;;;;;;;;;;;;;KC3I9B;;;;;;;UAQK;;EAEhB;;EAEA;;;;;EAKA;;EAEA;;EAEA;;EAEA,WAAW;;EAEX;;;cAIY,qBAAkB,UAAc,gBAAc;;;;;;;;UAsB1C;;EAEhB;;EAEA,SAAS;;;;;;;EAOT;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;cAcY,qBAAkB,UACpB,aAAW,mBACF,uBACjB;;;;;;;;;;;;cCrFU,mBAAgB,kBACZ,oCACkB,iCAEhC;;;;;;;;cCfU,qBAAkB;EAC9B;EACA,OAAO;;EAEP;MACG;;;;;cAWS,8BAA2B,KAAS,gBAAc;;;;;;;cCLlD,mCAAgC,wCACN;;;;;;;;;;;;;cAqB1B,yBAAsB;EAClC;EACA;;;;;;;cA0BY,iBAAc;EAC1B;EACA;MACG;;;;;;;;;;;cAkFS,qBAAkB;EAC9B;EACA;MACG;;;;;;;;cA2BS,sBAAmB,wCAE7B;UAWc;EAChB;EACA;EACA;EACA;;;;;;;;;cAaY,gCAA6B,oBAEvC;;;;;;;;;;;;;;;;;;;;cAwDU,yCAAsC;EAEjD;EACA;EACA;EACA;GACA;;;;cCpRW,gBAAa;;cAIb,iBAAc;;;;;;;cCCd,2BAAyB;UAsBrB;EAChB;EACA;EACA;;;;;;;;;;;;;cAoBY,8BAA2B;EACvC;EACA;EACA;MACG;;;;;;;cA6CS,mCAAgC,YAChC,iBAAe,iBAEzB;;;;;;;;;;;;;cCpFU,4BAAyB,OAC9B,WAAS,sCAEd;UA8Bc;EAChB,UAAU;EACV,eAAe;;;;;;;;;;;;;cAcH,iBAAc,OAAW,cAAY;;;;;;;;;;;KC3DtC,WAAW;UAEN;EAChB;EACA,QAAQ;;EAER;;EAEA,WAAW;;;KAIP,YAAY;;;;;;;;cASJ,KAAE,cACF,QACJ,iBAAe,mCACY,gBACjC;;cA4CU,oBAAiB,MAAU"}