fatoority 0.5.0 → 0.6.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.
Files changed (95) hide show
  1. package/README.md +9 -9
  2. package/errors.d.mts +67 -0
  3. package/errors.mjs +94 -0
  4. package/fatoora_ffi.wasm +0 -0
  5. package/generated/Adjustment.d.mts +9 -3
  6. package/generated/Adjustment.mjs +12 -6
  7. package/generated/AdjustmentKind.d.mts +24 -0
  8. package/generated/AdjustmentKind.mjs +72 -0
  9. package/generated/AllowanceCharge.d.mts +6 -4
  10. package/generated/AllowanceCharge.mjs +10 -8
  11. package/generated/ClearanceMode.d.mts +30 -0
  12. package/generated/ClearanceMode.mjs +78 -0
  13. package/generated/ClearanceStatus.d.mts +34 -0
  14. package/generated/ClearanceStatus.mjs +84 -0
  15. package/generated/{CsidCompliance.d.mts → ComplianceCsid.d.mts} +4 -3
  16. package/generated/{CsidCompliance.mjs → ComplianceCsid.mjs} +21 -13
  17. package/generated/ComplianceRequest.d.mts +2 -2
  18. package/generated/ComplianceRequest.mjs +2 -2
  19. package/generated/Config.d.mts +3 -2
  20. package/generated/Config.mjs +11 -3
  21. package/generated/CsrProperties.d.mts +6 -2
  22. package/generated/CsrProperties.mjs +7 -3
  23. package/generated/Environment.d.mts +28 -0
  24. package/generated/Environment.mjs +78 -0
  25. package/generated/FinalizedInvoice.d.mts +1 -1
  26. package/generated/FinalizedInvoice.mjs +2 -2
  27. package/generated/InvoiceBuilder.d.mts +18 -21
  28. package/generated/InvoiceBuilder.mjs +31 -168
  29. package/generated/InvoiceData.d.mts +7 -4
  30. package/generated/InvoiceData.mjs +8 -5
  31. package/generated/InvoiceFlag.d.mts +36 -0
  32. package/generated/InvoiceFlag.mjs +105 -0
  33. package/generated/InvoiceLineItem.d.mts +5 -3
  34. package/generated/InvoiceLineItem.mjs +8 -6
  35. package/generated/{Signer.d.mts → InvoiceSigner.d.mts} +3 -3
  36. package/generated/{Signer.mjs → InvoiceSigner.mjs} +13 -13
  37. package/generated/InvoiceSubType.d.mts +26 -0
  38. package/generated/InvoiceSubType.mjs +74 -0
  39. package/generated/InvoiceTypeKind.d.mts +40 -0
  40. package/generated/InvoiceTypeKind.mjs +92 -0
  41. package/generated/LineItemBuilder.d.mts +2 -1
  42. package/generated/LineItemBuilder.mjs +2 -1
  43. package/generated/MessageType.d.mts +38 -0
  44. package/generated/MessageType.mjs +90 -0
  45. package/generated/{CsidProduction.d.mts → ProductionCsid.d.mts} +4 -3
  46. package/generated/{CsidProduction.mjs → ProductionCsid.mjs} +21 -13
  47. package/generated/ProductionRequest.d.mts +2 -2
  48. package/generated/ProductionRequest.mjs +2 -2
  49. package/generated/ReportingStatus.d.mts +34 -0
  50. package/generated/ReportingStatus.mjs +84 -0
  51. package/generated/Severity.d.mts +30 -0
  52. package/generated/Severity.mjs +78 -0
  53. package/generated/SignedInvoice.d.mts +1 -1
  54. package/generated/SignedInvoice.mjs +2 -2
  55. package/generated/ValidationLayer.d.mts +49 -0
  56. package/generated/ValidationLayer.mjs +107 -0
  57. package/generated/ValidationLocationKind.d.mts +37 -0
  58. package/generated/ValidationLocationKind.mjs +89 -0
  59. package/generated/ValidationMessage.d.mts +20 -2
  60. package/generated/ValidationMessage.mjs +52 -0
  61. package/generated/ValidationResponse.d.mts +21 -3
  62. package/generated/ValidationResponse.mjs +52 -0
  63. package/generated/ValidationResults.d.mts +10 -1
  64. package/generated/ValidationResults.mjs +26 -0
  65. package/generated/ValidationStatus.d.mts +38 -0
  66. package/generated/ValidationStatus.mjs +90 -0
  67. package/generated/VatBreakdown.d.mts +4 -3
  68. package/generated/VatBreakdown.mjs +5 -4
  69. package/generated/VatCategory.d.mts +40 -0
  70. package/generated/VatCategory.mjs +92 -0
  71. package/generated/Xml.d.mts +12 -5
  72. package/generated/Xml.mjs +15 -11
  73. package/generated/ZatcaClient.d.mts +10 -9
  74. package/generated/ZatcaClient.mjs +15 -14
  75. package/generated/ZatcaFinding.d.mts +59 -0
  76. package/generated/ZatcaFinding.mjs +239 -0
  77. package/generated/ZatcaRuleSource.d.mts +26 -0
  78. package/generated/ZatcaRuleSource.mjs +97 -0
  79. package/generated/ZatcaStage.d.mts +49 -0
  80. package/generated/ZatcaStage.mjs +107 -0
  81. package/generated/ZatcaStageReport.d.mts +41 -0
  82. package/generated/ZatcaStageReport.mjs +168 -0
  83. package/generated/ZatcaStageStatus.d.mts +45 -0
  84. package/generated/ZatcaStageStatus.mjs +101 -0
  85. package/generated/ZatcaValidationReport.d.mts +63 -0
  86. package/generated/ZatcaValidationReport.mjs +228 -0
  87. package/generated/index.d.mts +45 -5
  88. package/generated/index.mjs +45 -5
  89. package/index.d.mts +131 -15
  90. package/index.mjs +111 -33
  91. package/members.mjs +67 -0
  92. package/package.json +11 -5
  93. package/patch.mjs +121 -0
  94. package/raw.d.mts +731 -0
  95. package/raw.mjs +4 -0
package/raw.d.mts ADDED
@@ -0,0 +1,731 @@
1
+ // Generated by scripts/generate_js_facade.py; do not edit.
2
+ // The generated classes as adapted by patch.mjs: value getters are properties,
3
+ // text results are strings and failures throw the classes from errors.mjs.
4
+ import type { AdjustmentKind, ClearanceMode, ClearanceStatus, Environment, InvoiceOutcome, InvoiceSubType, InvoiceTypeKind, MessageType, ReportingStatus, Severity, Text, ValidationLayer, ValidationLocationKind, ValidationStatus, VatCategory, ZatcaStage, ZatcaStageStatus } from './generated/index.mjs';
5
+ export { codepoint } from './generated/index.mjs';
6
+ export { AdjustmentKind, ClearanceMode, ClearanceStatus, Environment, InvoiceOutcome, InvoiceSubType, InvoiceTypeKind, MessageType, ReportingStatus, Severity, ValidationLayer, ValidationLocationKind, ValidationStatus, VatCategory, ZatcaStage, ZatcaStageStatus, BindingError, Text } from './generated/index.mjs';
7
+
8
+ /**
9
+ * Named bits of the `u8` invoice flag mask accepted by
10
+ * `InvoiceBuilder::set_flags` and returned by `InvoiceData::flags`.
11
+ *
12
+ * Each discriminant is the flag's bit value; `bit()` returns it as a `u8`
13
+ * for languages whose enums do not expose their discriminant.
14
+ */
15
+ export declare class InvoiceFlag {
16
+ /** @internal */
17
+ static fromValue(value: InvoiceFlag | string): InvoiceFlag;
18
+
19
+ get value(): string;
20
+
21
+ /** @internal */
22
+ get ffiValue(): number;
23
+
24
+ static ThirdParty : InvoiceFlag;
25
+ static Nominal : InvoiceFlag;
26
+ static Export : InvoiceFlag;
27
+ static Summary : InvoiceFlag;
28
+ static SelfBilled : InvoiceFlag;
29
+
30
+ /**
31
+ * The flag's bit within the invoice flag mask.
32
+ */
33
+ get bit(): number;
34
+
35
+ constructor(value: InvoiceFlag | string );
36
+ }
37
+
38
+ export declare class Address {
39
+ private constructor();
40
+ withProvince(value: string): Address;
41
+ get province(): string | null;
42
+ static create(countryCode: string, city: string, street: string, buildingNumber: string, postalCode: string, additionalStreet: string | null, additionalNumber: string | null, district: string | null): Address;
43
+ /** @deprecated Use `Address.create`; `new_` will be removed from the package root. */
44
+ static new_(countryCode: string, city: string, street: string, buildingNumber: string, postalCode: string, additionalStreet: string | null, additionalNumber: string | null, district: string | null): Address;
45
+ get city(): string;
46
+ get street(): string;
47
+ get buildingNumber(): string;
48
+ get postalCode(): string;
49
+ get countryCode(): string;
50
+ get additionalStreet(): string | null;
51
+ get additionalNumber(): string | null;
52
+ get district(): string | null;
53
+ }
54
+
55
+ export declare class Adjustment {
56
+ private constructor();
57
+ static amount(value: string): Adjustment;
58
+ /**
59
+ * Create an adjustment of `percent` percent of `base`.
60
+ */
61
+ static percentOf(base: string, percent: string): Adjustment;
62
+ /** @deprecated Use `percentOf`; removed in 0.7. */
63
+ static percentage(base: string, percent: string): Adjustment;
64
+ /**
65
+ * Return a copy with an explicit amount, checked against the percentage calculation.
66
+ */
67
+ suppliedAmount(value: string): Adjustment;
68
+ /** @deprecated Use `suppliedAmount`; removed in 0.7. */
69
+ withSuppliedAmount(value: string): Adjustment;
70
+ withReason(reason: string | null, code: string | null): Adjustment;
71
+ get value(): string;
72
+ get baseAmount(): string | null;
73
+ get percentage(): string | null;
74
+ /** @deprecated Use the `percentage` property; removed in 0.7. */
75
+ percent(): Text | null;
76
+ get reason(): string | null;
77
+ get reasonCode(): string | null;
78
+ }
79
+
80
+ export declare class AllowanceCharge {
81
+ private constructor();
82
+ get hasVatRate(): boolean;
83
+ omitVatRate(): AllowanceCharge;
84
+ /** @deprecated Use `omitVatRate`; removed in 0.7. */
85
+ withoutVatRate(): AllowanceCharge;
86
+ /**
87
+ * Retain this adjustment's metadata and check its percentage calculation.
88
+ */
89
+ withPercentage(base: string, percent: string): AllowanceCharge;
90
+ get baseAmount(): string | null;
91
+ get percentage(): string | null;
92
+ static create(kind: AdjustmentKind, amount: string, reason: string | null, reasonCode: string | null, category: VatCategory, rate: string, exemption: TaxExemption): AllowanceCharge;
93
+ /** @deprecated Use `AllowanceCharge.create`; `new_` will be removed from the package root. */
94
+ static new_(kind: AdjustmentKind, amount: string, reason: string | null, reasonCode: string | null, category: VatCategory, rate: string, exemption: TaxExemption): AllowanceCharge;
95
+ get kind(): AdjustmentKind;
96
+ get amount(): string;
97
+ get rate(): string;
98
+ get category(): VatCategory;
99
+ /**
100
+ * Return an independent adjustment with the given number of identical tax classifications.
101
+ */
102
+ withTaxCategoryCount(count: number): AllowanceCharge;
103
+ get taxCategoryCount(): number;
104
+ get reason(): string | null;
105
+ get reasonCode(): string | null;
106
+ exemption(): TaxExemption;
107
+ }
108
+
109
+ export declare class Bytes {
110
+ private constructor();
111
+ /**
112
+ * The view is valid while this immutable owner remains alive.
113
+ */
114
+ asSlice(): Array<number>;
115
+ }
116
+
117
+ export declare class BytesList {
118
+ private constructor();
119
+ len(): number;
120
+ isEmpty(): boolean;
121
+ get(index: number): Bytes;
122
+ }
123
+
124
+ export declare class ComplianceCsid {
125
+ private constructor();
126
+ static create(environment: Environment, requestId: string | null, token: string, secret: string): ComplianceCsid;
127
+ /** @deprecated Use `ComplianceCsid.create`; `new_` will be removed from the package root. */
128
+ static new_(environment: Environment, requestId: string | null, token: string, secret: string): ComplianceCsid;
129
+ get env(): Environment;
130
+ get requestId(): string | null;
131
+ get binarySecurityToken(): string;
132
+ get secret(): string;
133
+ }
134
+
135
+ /**
136
+ * Owned request and decoding context; contains credentials.
137
+ */
138
+ export declare class ComplianceRequest {
139
+ private constructor();
140
+ get method(): string;
141
+ get url(): string;
142
+ get headersJson(): string;
143
+ body(): Bytes;
144
+ decode(status: number, body: Array<number>): ComplianceCsid;
145
+ }
146
+
147
+ export declare class Config {
148
+ private constructor();
149
+ static create(env: Environment): Config;
150
+ /** @deprecated Use `Config.create`; `new_` will be removed from the package root. */
151
+ static new_(env: Environment): Config;
152
+ get env(): Environment;
153
+ }
154
+
155
+ export declare class Csr {
156
+ private constructor();
157
+ static fromDer(der: Array<number>): Csr;
158
+ toDer(): Bytes;
159
+ toPem(): string;
160
+ toBase64(): string;
161
+ toPemBase64(): string;
162
+ get subjectString(): string;
163
+ extensionValuesDer(): BytesList;
164
+ }
165
+
166
+ export declare class CsrProperties {
167
+ private constructor();
168
+ static create(commonName: string, serialNumber: string, organizationIdentifier: string, organizationUnitName: string, organizationName: string, countryName: string, invoiceType: string, locationAddress: string, industryBusinessCategory: string): CsrProperties;
169
+ /** @deprecated Use `CsrProperties.create`; `new_` will be removed from the package root. */
170
+ static new_(commonName: string, serialNumber: string, organizationIdentifier: string, organizationUnitName: string, organizationName: string, countryName: string, invoiceType: string, locationAddress: string, industryBusinessCategory: string): CsrProperties;
171
+ /**
172
+ * Parse `csr.*` properties text, mirroring core `CsrProperties::from_str`.
173
+ */
174
+ static fromStr(properties: string): CsrProperties;
175
+ build(key: SigningKey, env: Environment): Csr;
176
+ }
177
+
178
+ export declare class FinalizedInvoice {
179
+ private constructor();
180
+ static fromXml(value: string): FinalizedInvoice;
181
+ data(): InvoiceData;
182
+ totals(): InvoiceTotals;
183
+ get hash(): string;
184
+ get xml(): string;
185
+ }
186
+
187
+ export declare class InvoiceBuilder {
188
+ private constructor();
189
+ addSellerIdentifier(value: string, scheme: string | null): void;
190
+ addBuyerIdentifier(value: string, scheme: string | null): void;
191
+ addVatBreakdown(value: VatBreakdown): void;
192
+ addPaymentMeans(value: PaymentMeans): void;
193
+ addNote(language: string | null, value: string): void;
194
+ /**
195
+ * Append a document-level allowance (discount), mirroring core `InvoiceBuilder::allowance`.
196
+ */
197
+ addAllowance(value: Adjustment, category: VatCategory, rate: string, exemption: TaxExemption): void;
198
+ /**
199
+ * Append a document-level charge, mirroring core `InvoiceBuilder::charge`.
200
+ */
201
+ addCharge(value: Adjustment, category: VatCategory, rate: string, exemption: TaxExemption): void;
202
+ setBuyerWithoutAddress(name: string, vatId: string | null, otherId: string | null, scheme: string | null): void;
203
+ /**
204
+ * Construct a credit or debit note with a complete billing reference.
205
+ */
206
+ static newWithReference(kind: InvoiceTypeKind, subtype: InvoiceSubType, reference: OriginalInvoiceRef, reason: string): InvoiceBuilder;
207
+ setPaymentInstruction(instruction: string): void;
208
+ setPrepaidAmount(amount: string): void;
209
+ setPayableRoundingAmount(amount: string): void;
210
+ setDelivery(actual: string | null, latest: string | null): void;
211
+ setTaxCurrency(currency: string, amount: string): void;
212
+ addTaxExemption(category: VatCategory, rate: string, exemption: TaxExemption): void;
213
+ addAdjustment(adjustment: AllowanceCharge): void;
214
+ addItem(item: InvoiceLineItem): void;
215
+ static create(kind: InvoiceTypeKind, subtype: InvoiceSubType, originalId: string | null, originalUuid: string | null, originalDate: string | null, reason: string | null): InvoiceBuilder;
216
+ /** @deprecated Use `InvoiceBuilder.create`; `new_` will be removed from the package root. */
217
+ static new_(kind: InvoiceTypeKind, subtype: InvoiceSubType, originalId: string | null, originalUuid: string | null, originalDate: string | null, reason: string | null): InvoiceBuilder;
218
+ addBillingReference(value: OriginalInvoiceRef): void;
219
+ setPurchaseOrderId(value: string): void;
220
+ setContractId(value: string): void;
221
+ setId(value: string): void;
222
+ setUuid(value: string): void;
223
+ setIssueDatetime(value: string): void;
224
+ setCurrency(value: string): void;
225
+ setPreviousInvoiceHash(value: string): void;
226
+ setInvoiceCounter(value: bigint): void;
227
+ setVatCategory(value: VatCategory): void;
228
+ setFlags(value: number): void;
229
+ setSeller(name: string, address: Address, vatId: string, otherId: string | null, scheme: string | null): void;
230
+ setBuyer(name: string, address: Address, vatId: string | null, otherId: string | null, scheme: string | null): void;
231
+ addLineItem(description: string, quantity: string, unitCode: string, unitPrice: string, vatRate: string, category: VatCategory): void;
232
+ build(): FinalizedInvoice;
233
+ }
234
+
235
+ export declare class InvoiceData {
236
+ private constructor();
237
+ get issueTime(): string;
238
+ get issueDate(): string;
239
+ get paymentMeansLen(): number;
240
+ paymentMeans(index: number): PaymentMeans;
241
+ get purchaseOrderId(): string | null;
242
+ get contractId(): string | null;
243
+ get paymentInstruction(): string | null;
244
+ get actualDeliveryDate(): string | null;
245
+ get latestDeliveryDate(): string | null;
246
+ get taxCurrency(): string | null;
247
+ get taxCurrencyAmount(): string | null;
248
+ get adjustmentsLen(): number;
249
+ adjustment(index: number): AllowanceCharge;
250
+ get id(): string;
251
+ get uuid(): string;
252
+ get previousInvoiceHash(): string;
253
+ get paymentMeansCode(): string;
254
+ get currency(): string;
255
+ get issueDatetime(): string;
256
+ get invoiceLevelCharge(): string;
257
+ get invoiceLevelDiscount(): string;
258
+ get allowanceReason(): string | null;
259
+ get invoiceCounter(): bigint;
260
+ get vatCategory(): VatCategory;
261
+ get flags(): number;
262
+ get invoiceTypeKind(): InvoiceTypeKind;
263
+ get invoiceSubType(): InvoiceSubType;
264
+ seller(): Party;
265
+ buyer(): Party | null;
266
+ note(): InvoiceNote | null;
267
+ get lineItemsLen(): number;
268
+ lineItem(index: number): InvoiceLineItem;
269
+ originalInvoiceRef(): OriginalInvoiceRef | null;
270
+ get originalInvoiceReason(): string | null;
271
+ get notesLen(): number;
272
+ noteAt(index: number): InvoiceNote;
273
+ get billingReferencesLen(): number;
274
+ billingReference(index: number): OriginalInvoiceRef;
275
+ }
276
+
277
+ export declare class InvoiceLineItem {
278
+ private constructor();
279
+ get itemGrossPrice(): string | null;
280
+ get itemPriceDiscount(): string | null;
281
+ get itemPriceBaseQuantity(): string | null;
282
+ get itemPriceBaseQuantityUnitCode(): string | null;
283
+ get adjustmentsLen(): number;
284
+ adjustment(index: number): Adjustment;
285
+ adjustmentKind(index: number): AdjustmentKind;
286
+ itemSellerIdentifier(): OtherId | null;
287
+ itemBuyerIdentifier(): OtherId | null;
288
+ itemStandardIdentifier(): OtherId | null;
289
+ withDocumentReference(reference: OriginalInvoiceRef): InvoiceLineItem;
290
+ withTaxSubtotal(subtotal: VatBreakdown): InvoiceLineItem;
291
+ get documentReferencesLen(): number;
292
+ documentReference(index: number): OriginalInvoiceRef;
293
+ get taxSubtotalsLen(): number;
294
+ taxSubtotal(index: number): VatBreakdown;
295
+ static create(description: string, quantity: string, unitCode: string, unitPrice: string, rate: string, category: VatCategory): InvoiceLineItem;
296
+ /** @deprecated Use `InvoiceLineItem.create`; `new_` will be removed from the package root. */
297
+ static new_(description: string, quantity: string, unitCode: string, unitPrice: string, rate: string, category: VatCategory): InvoiceLineItem;
298
+ withMetadata(id: string | null, exemption: TaxExemption): InvoiceLineItem;
299
+ get id(): string | null;
300
+ exemption(): TaxExemption;
301
+ get description(): string;
302
+ get unitCode(): string;
303
+ get quantity(): string;
304
+ get unitPrice(): string;
305
+ get totalAmount(): string;
306
+ get vatRate(): string;
307
+ get vatAmount(): string;
308
+ get hasVatRate(): boolean;
309
+ get hasTaxTotal(): boolean;
310
+ get hasGrossAmount(): boolean;
311
+ get vatCategory(): VatCategory;
312
+ }
313
+
314
+ export declare class InvoiceNote {
315
+ private constructor();
316
+ get languageId(): string | null;
317
+ get language(): string;
318
+ get text(): string;
319
+ }
320
+
321
+ /**
322
+ * Owned request and decoding context; contains credentials.
323
+ */
324
+ export declare class InvoiceRequest {
325
+ private constructor();
326
+ get method(): string;
327
+ get url(): string;
328
+ get headersJson(): string;
329
+ body(): Bytes;
330
+ decode(status: number, body: Array<number>): ValidationResponse;
331
+ }
332
+
333
+ export declare class InvoiceSigner {
334
+ private constructor();
335
+ static fromPem(certPem: string, keyPem: string): InvoiceSigner;
336
+ static fromDer(certDer: Array<number>, keyDer: Array<number>): InvoiceSigner;
337
+ certificateDer(): Bytes;
338
+ get certificatePem(): string;
339
+ sign(invoice: FinalizedInvoice): SignedInvoice;
340
+ signXml(xml: string): string;
341
+ }
342
+
343
+ export declare class InvoiceTotals {
344
+ private constructor();
345
+ get vatBreakdownLen(): number;
346
+ vatBreakdown(index: number): VatBreakdown;
347
+ get taxInclusive(): string;
348
+ get taxAmount(): string;
349
+ get lineExtension(): string;
350
+ get allowanceTotal(): string;
351
+ get chargeTotal(): string;
352
+ get taxableAmount(): string;
353
+ get prepaidAmount(): string;
354
+ get payableRoundingAmount(): string;
355
+ get payableAmount(): string;
356
+ }
357
+
358
+ export declare class LineItemBuilder {
359
+ private constructor();
360
+ setTaxTotalPresent(present: boolean): void;
361
+ setGrossAmountPresent(present: boolean): void;
362
+ static create(): LineItemBuilder;
363
+ /** @deprecated Use `LineItemBuilder.create`; `new_` will be removed from the package root. */
364
+ static new_(): LineItemBuilder;
365
+ build(): InvoiceLineItem;
366
+ setItemName(value: string): void;
367
+ setInvoicedQuantityUnitCode(value: string): void;
368
+ setItemPriceBaseQuantityUnitCode(value: string): void;
369
+ setId(value: string): void;
370
+ setInvoicedQuantity(value: string): void;
371
+ setItemNetPrice(value: string): void;
372
+ setItemGrossPrice(value: string): void;
373
+ setItemPriceDiscount(value: string): void;
374
+ setItemPriceBaseQuantity(value: string): void;
375
+ setLineNetAmount(value: string): void;
376
+ setLineVatAmount(value: string): void;
377
+ setLineAmountWithVat(value: string): void;
378
+ setVatRate(value: string): void;
379
+ setVatCategory(value: VatCategory): void;
380
+ setExemption(value: TaxExemption): void;
381
+ addAllowance(value: Adjustment): void;
382
+ addCharge(value: Adjustment): void;
383
+ addDocumentReference(value: OriginalInvoiceRef): void;
384
+ addTaxSubtotal(value: VatBreakdown): void;
385
+ setItemSellerIdentifier(value: string, scheme: string | null): void;
386
+ setItemBuyerIdentifier(value: string, scheme: string | null): void;
387
+ setItemStandardIdentifier(value: string, scheme: string | null): void;
388
+ }
389
+
390
+ export declare class OriginalInvoiceRef {
391
+ private constructor();
392
+ static create(id: string, uuid: string | null, date: string | null, time: string | null, typeCode: string | null): OriginalInvoiceRef;
393
+ /** @deprecated Use `OriginalInvoiceRef.create`; `new_` will be removed from the package root. */
394
+ static new_(id: string, uuid: string | null, date: string | null, time: string | null, typeCode: string | null): OriginalInvoiceRef;
395
+ get issueTime(): string | null;
396
+ get documentTypeCode(): string | null;
397
+ get id(): string;
398
+ get uuid(): string | null;
399
+ get issueDate(): string | null;
400
+ }
401
+
402
+ export declare class OtherId {
403
+ private constructor();
404
+ get value(): string;
405
+ get scheme(): string | null;
406
+ }
407
+
408
+ export declare class Party {
409
+ private constructor();
410
+ get identifiersLen(): number;
411
+ identifier(index: number): OtherId;
412
+ address(): Address | null;
413
+ vatId(): VatId | null;
414
+ otherId(): OtherId | null;
415
+ get name(): string;
416
+ }
417
+
418
+ export declare class PaymentMeans {
419
+ private constructor();
420
+ withInstructionNote(value: string): PaymentMeans;
421
+ get instructionNotesLen(): number;
422
+ instructionNoteAt(index: number): string;
423
+ static create(code: string, instruction: string | null): PaymentMeans;
424
+ /** @deprecated Use `PaymentMeans.create`; `new_` will be removed from the package root. */
425
+ static new_(code: string, instruction: string | null): PaymentMeans;
426
+ withAccount(id: string | null, terms: string | null): PaymentMeans;
427
+ get code(): string;
428
+ get instructionNote(): string | null;
429
+ get hasAccount(): boolean;
430
+ get accountIdentifier(): string | null;
431
+ get paymentTerms(): string | null;
432
+ }
433
+
434
+ export declare class ProductionCsid {
435
+ private constructor();
436
+ static create(environment: Environment, requestId: string | null, token: string, secret: string): ProductionCsid;
437
+ /** @deprecated Use `ProductionCsid.create`; `new_` will be removed from the package root. */
438
+ static new_(environment: Environment, requestId: string | null, token: string, secret: string): ProductionCsid;
439
+ get env(): Environment;
440
+ get requestId(): string | null;
441
+ get binarySecurityToken(): string;
442
+ get secret(): string;
443
+ }
444
+
445
+ /**
446
+ * Owned request and decoding context; contains credentials.
447
+ */
448
+ export declare class ProductionRequest {
449
+ private constructor();
450
+ get method(): string;
451
+ get url(): string;
452
+ get headersJson(): string;
453
+ body(): Bytes;
454
+ decode(status: number, body: Array<number>): ProductionCsid;
455
+ }
456
+
457
+ export declare class SignedInvoice {
458
+ private constructor();
459
+ static fromXml(value: string): SignedInvoice;
460
+ data(): InvoiceData;
461
+ totals(): InvoiceTotals;
462
+ get hash(): string;
463
+ get xml(): string;
464
+ get qrCode(): string;
465
+ get signature(): string;
466
+ get publicKey(): string;
467
+ get invoiceHash(): string;
468
+ toXmlBase64(): string;
469
+ get issuer(): string;
470
+ get serial(): string;
471
+ get certHash(): string;
472
+ get signedPropsHash(): string;
473
+ get signingTime(): string;
474
+ get zatcaKeySignature(): string | null;
475
+ intoXml(): string;
476
+ }
477
+
478
+ export declare class SigningKey {
479
+ private constructor();
480
+ static generate(): SigningKey;
481
+ static fromPem(pem: string): SigningKey;
482
+ static fromDer(der: Array<number>): SigningKey;
483
+ toPem(): string;
484
+ toDer(): Bytes;
485
+ }
486
+
487
+ export declare class TaxExemption {
488
+ private constructor();
489
+ static create(code: string | null, reason: string | null): TaxExemption;
490
+ /** @deprecated Use `TaxExemption.create`; `new_` will be removed from the package root. */
491
+ static new_(code: string | null, reason: string | null): TaxExemption;
492
+ get reasonCode(): string | null;
493
+ get reason(): string | null;
494
+ }
495
+
496
+ export declare class ValidationMessage {
497
+ private constructor();
498
+ /**
499
+ * The parsed message `type`, or null when the message has none.
500
+ */
501
+ get messageType(): MessageType | null;
502
+ /**
503
+ * The message `type` exactly as ZATCA sent it, or null when absent.
504
+ */
505
+ get messageTypeRaw(): string | null;
506
+ get code(): string | null;
507
+ get category(): string | null;
508
+ get message(): string | null;
509
+ /**
510
+ * The parsed message `status`, or null when the message has none.
511
+ */
512
+ get status(): ValidationStatus | null;
513
+ /**
514
+ * The message `status` exactly as ZATCA sent it, or null when absent.
515
+ */
516
+ get statusRaw(): string | null;
517
+ }
518
+
519
+ export declare class ValidationResponse {
520
+ private constructor();
521
+ get httpStatus(): number | null;
522
+ get outcome(): InvoiceOutcome;
523
+ ensureAccepted(): void;
524
+ get clearedInvoiceXml(): string | null;
525
+ validationResults(): ValidationResults;
526
+ get clearedInvoiceBase64(): string | null;
527
+ /**
528
+ * The parsed `reportingStatus`, or null when the response has none.
529
+ */
530
+ get reportingStatus(): ReportingStatus | null;
531
+ /**
532
+ * The `reportingStatus` exactly as ZATCA sent it, or null when absent.
533
+ */
534
+ get reportingStatusRaw(): string | null;
535
+ /**
536
+ * The parsed `clearanceStatus`, or null when the response has none.
537
+ */
538
+ get clearanceStatus(): ClearanceStatus | null;
539
+ /**
540
+ * The `clearanceStatus` exactly as ZATCA sent it, or null when absent.
541
+ */
542
+ get clearanceStatusRaw(): string | null;
543
+ get qrSellerStatus(): string | null;
544
+ get qrBuyerStatus(): string | null;
545
+ }
546
+
547
+ export declare class ValidationResults {
548
+ private constructor();
549
+ /**
550
+ * The parsed overall status, or null when the response has none.
551
+ */
552
+ get status(): ValidationStatus | null;
553
+ /**
554
+ * The overall status exactly as ZATCA sent it, or null when absent.
555
+ */
556
+ get statusRaw(): string | null;
557
+ get infoLen(): number;
558
+ infoMessage(index: number): ValidationMessage;
559
+ get warningLen(): number;
560
+ warningMessage(index: number): ValidationMessage;
561
+ get errorLen(): number;
562
+ errorMessage(index: number): ValidationMessage;
563
+ }
564
+
565
+ export declare class VatBreakdown {
566
+ private constructor();
567
+ get hasVatRate(): boolean;
568
+ omitVatRate(): VatBreakdown;
569
+ /** @deprecated Use `omitVatRate`; removed in 0.7. */
570
+ withoutVatRate(): VatBreakdown;
571
+ static create(category: VatCategory, rate: string, taxableAmount: string, taxAmount: string, exemption: TaxExemption): VatBreakdown;
572
+ /** @deprecated Use `VatBreakdown.create`; `new_` will be removed from the package root. */
573
+ static new_(category: VatCategory, rate: string, taxableAmount: string, taxAmount: string, exemption: TaxExemption): VatBreakdown;
574
+ get category(): VatCategory;
575
+ get rate(): string;
576
+ get taxableAmount(): string;
577
+ get taxAmount(): string;
578
+ exemption(): TaxExemption;
579
+ }
580
+
581
+ export declare class VatId {
582
+ private constructor();
583
+ get value(): string;
584
+ }
585
+
586
+ export declare class Xml {
587
+ private constructor();
588
+ /**
589
+ * Run the local ZATCA validation profile and return its owned report.
590
+ *
591
+ * Inspect `is_valid` before acceptance. Options default when absent;
592
+ * `options_json` is limited to 4 KiB. Validation needs no configuration:
593
+ * it mirrors the stateless core `Validator::validate_zatca`.
594
+ */
595
+ static validateZatca(xml: string, optionsJson: string | null): ZatcaValidationReport;
596
+ /**
597
+ * Check the XML against the UBL schema and business rules, mirroring core
598
+ * `Validator::validate_xml`. Returns true or a validation error.
599
+ */
600
+ static validate(xml: string): boolean;
601
+ static hash(xml: string): string;
602
+ }
603
+
604
+ export declare class ZatcaClient {
605
+ private constructor();
606
+ static create(config: Config): ZatcaClient;
607
+ /** @deprecated Use `ZatcaClient.create`; `new_` will be removed from the package root. */
608
+ static new_(config: Config): ZatcaClient;
609
+ prepareRequestComplianceCsid(csr: Csr, otp: string): ComplianceRequest;
610
+ prepareRequestProductionCsid(credentials: ComplianceCsid): ProductionRequest;
611
+ prepareRenewCsid(credentials: ProductionCsid, csr: Csr, otp: string, acceptLanguage: string | null): ProductionRequest;
612
+ prepareCheckInvoiceCompliance(invoice: SignedInvoice, credentials: ComplianceCsid): InvoiceRequest;
613
+ prepareReportSimplifiedInvoice(invoice: SignedInvoice, credentials: ProductionCsid, clearanceMode: ClearanceMode, acceptLanguage: string | null): InvoiceRequest;
614
+ prepareClearStandardInvoice(invoice: SignedInvoice, credentials: ProductionCsid, clearanceMode: ClearanceMode, acceptLanguage: string | null): InvoiceRequest;
615
+ }
616
+
617
+ /**
618
+ * One validation finding with its source assertion, when applicable.
619
+ */
620
+ export declare class ZatcaFinding {
621
+ private constructor();
622
+ /**
623
+ * Rule assertion that produced the finding, for business-rule findings.
624
+ */
625
+ get assertionSite(): string | null;
626
+ get layer(): ValidationLayer;
627
+ /**
628
+ * Library-owned rule identifier, independent of message wording.
629
+ */
630
+ get code(): string;
631
+ get severity(): Severity;
632
+ /**
633
+ * Human-readable text; the wording is not a stable API.
634
+ */
635
+ get message(): string;
636
+ /**
637
+ * The kind of location, or null when the source cannot locate the finding.
638
+ */
639
+ get locationKind(): ValidationLocationKind | null;
640
+ /**
641
+ * The field path or XPath, or null for other location kinds.
642
+ */
643
+ get locationPath(): string | null;
644
+ /**
645
+ * One-based XML line, or null when the location is not XML coordinates.
646
+ */
647
+ get locationLine(): number | null;
648
+ /**
649
+ * One-based XML column, or null when unknown.
650
+ */
651
+ get locationColumn(): number | null;
652
+ }
653
+
654
+ /**
655
+ * Pinned upstream rule source of a business-rule stage.
656
+ */
657
+ export declare class ZatcaRuleSource {
658
+ private constructor();
659
+ /**
660
+ * File name of the upstream rule stylesheet.
661
+ */
662
+ get stylesheet(): string;
663
+ /**
664
+ * Hex SHA-256 digest of the pinned stylesheet.
665
+ */
666
+ get sha256(): string;
667
+ }
668
+
669
+ /**
670
+ * Coverage and findings from one validation stage.
671
+ */
672
+ export declare class ZatcaStageReport {
673
+ private constructor();
674
+ get stage(): ZatcaStage;
675
+ get status(): ZatcaStageStatus;
676
+ /**
677
+ * Pinned rule source, for the CEN and KSA business-rule stages.
678
+ */
679
+ provenance(): ZatcaRuleSource | null;
680
+ get evaluatedAssertionsLen(): number;
681
+ /**
682
+ * Assertion site at `index` whose selected contexts were all evaluated.
683
+ */
684
+ evaluatedAssertion(index: number): string;
685
+ get findingsLen(): number;
686
+ finding(index: number): ZatcaFinding;
687
+ }
688
+
689
+ /**
690
+ * Owned results of local ZATCA validation with explicit stage coverage.
691
+ *
692
+ * Completion and validity describe only the local profile; they do not
693
+ * establish acceptance by ZATCA or certificate issuer trust.
694
+ */
695
+ export declare class ZatcaValidationReport {
696
+ private constructor();
697
+ /**
698
+ * Version of the report's serialized format.
699
+ */
700
+ get schemaVersion(): number;
701
+ /**
702
+ * Identifier of the validation profile (the ZATCA SDK release it mirrors).
703
+ */
704
+ get profile(): string;
705
+ /**
706
+ * RFC 3339 instant used for time-dependent rules.
707
+ */
708
+ get evaluatedAt(): string;
709
+ /**
710
+ * Whether every required stage finished exactly once.
711
+ */
712
+ get isComplete(): boolean;
713
+ /**
714
+ * Whether any stage, including an incomplete stage, reported an error.
715
+ */
716
+ get hasErrors(): boolean;
717
+ /**
718
+ * Whether validation is complete and contains no error findings.
719
+ */
720
+ get isValid(): boolean;
721
+ get stagesLen(): number;
722
+ /**
723
+ * The stage report at `index`, in stage order.
724
+ */
725
+ stage(index: number): ZatcaStageReport;
726
+ /**
727
+ * The report serialized as JSON, including the derived `is_complete`,
728
+ * `has_errors` and `is_valid` fields.
729
+ */
730
+ toJson(): string;
731
+ }