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.
- package/README.md +9 -9
- package/errors.d.mts +67 -0
- package/errors.mjs +94 -0
- package/fatoora_ffi.wasm +0 -0
- package/generated/Adjustment.d.mts +9 -3
- package/generated/Adjustment.mjs +12 -6
- package/generated/AdjustmentKind.d.mts +24 -0
- package/generated/AdjustmentKind.mjs +72 -0
- package/generated/AllowanceCharge.d.mts +6 -4
- package/generated/AllowanceCharge.mjs +10 -8
- package/generated/ClearanceMode.d.mts +30 -0
- package/generated/ClearanceMode.mjs +78 -0
- package/generated/ClearanceStatus.d.mts +34 -0
- package/generated/ClearanceStatus.mjs +84 -0
- package/generated/{CsidCompliance.d.mts → ComplianceCsid.d.mts} +4 -3
- package/generated/{CsidCompliance.mjs → ComplianceCsid.mjs} +21 -13
- package/generated/ComplianceRequest.d.mts +2 -2
- package/generated/ComplianceRequest.mjs +2 -2
- package/generated/Config.d.mts +3 -2
- package/generated/Config.mjs +11 -3
- package/generated/CsrProperties.d.mts +6 -2
- package/generated/CsrProperties.mjs +7 -3
- package/generated/Environment.d.mts +28 -0
- package/generated/Environment.mjs +78 -0
- package/generated/FinalizedInvoice.d.mts +1 -1
- package/generated/FinalizedInvoice.mjs +2 -2
- package/generated/InvoiceBuilder.d.mts +18 -21
- package/generated/InvoiceBuilder.mjs +31 -168
- package/generated/InvoiceData.d.mts +7 -4
- package/generated/InvoiceData.mjs +8 -5
- package/generated/InvoiceFlag.d.mts +36 -0
- package/generated/InvoiceFlag.mjs +105 -0
- package/generated/InvoiceLineItem.d.mts +5 -3
- package/generated/InvoiceLineItem.mjs +8 -6
- package/generated/{Signer.d.mts → InvoiceSigner.d.mts} +3 -3
- package/generated/{Signer.mjs → InvoiceSigner.mjs} +13 -13
- package/generated/InvoiceSubType.d.mts +26 -0
- package/generated/InvoiceSubType.mjs +74 -0
- package/generated/InvoiceTypeKind.d.mts +40 -0
- package/generated/InvoiceTypeKind.mjs +92 -0
- package/generated/LineItemBuilder.d.mts +2 -1
- package/generated/LineItemBuilder.mjs +2 -1
- package/generated/MessageType.d.mts +38 -0
- package/generated/MessageType.mjs +90 -0
- package/generated/{CsidProduction.d.mts → ProductionCsid.d.mts} +4 -3
- package/generated/{CsidProduction.mjs → ProductionCsid.mjs} +21 -13
- package/generated/ProductionRequest.d.mts +2 -2
- package/generated/ProductionRequest.mjs +2 -2
- package/generated/ReportingStatus.d.mts +34 -0
- package/generated/ReportingStatus.mjs +84 -0
- package/generated/Severity.d.mts +30 -0
- package/generated/Severity.mjs +78 -0
- package/generated/SignedInvoice.d.mts +1 -1
- package/generated/SignedInvoice.mjs +2 -2
- package/generated/ValidationLayer.d.mts +49 -0
- package/generated/ValidationLayer.mjs +107 -0
- package/generated/ValidationLocationKind.d.mts +37 -0
- package/generated/ValidationLocationKind.mjs +89 -0
- package/generated/ValidationMessage.d.mts +20 -2
- package/generated/ValidationMessage.mjs +52 -0
- package/generated/ValidationResponse.d.mts +21 -3
- package/generated/ValidationResponse.mjs +52 -0
- package/generated/ValidationResults.d.mts +10 -1
- package/generated/ValidationResults.mjs +26 -0
- package/generated/ValidationStatus.d.mts +38 -0
- package/generated/ValidationStatus.mjs +90 -0
- package/generated/VatBreakdown.d.mts +4 -3
- package/generated/VatBreakdown.mjs +5 -4
- package/generated/VatCategory.d.mts +40 -0
- package/generated/VatCategory.mjs +92 -0
- package/generated/Xml.d.mts +12 -5
- package/generated/Xml.mjs +15 -11
- package/generated/ZatcaClient.d.mts +10 -9
- package/generated/ZatcaClient.mjs +15 -14
- package/generated/ZatcaFinding.d.mts +59 -0
- package/generated/ZatcaFinding.mjs +239 -0
- package/generated/ZatcaRuleSource.d.mts +26 -0
- package/generated/ZatcaRuleSource.mjs +97 -0
- package/generated/ZatcaStage.d.mts +49 -0
- package/generated/ZatcaStage.mjs +107 -0
- package/generated/ZatcaStageReport.d.mts +41 -0
- package/generated/ZatcaStageReport.mjs +168 -0
- package/generated/ZatcaStageStatus.d.mts +45 -0
- package/generated/ZatcaStageStatus.mjs +101 -0
- package/generated/ZatcaValidationReport.d.mts +63 -0
- package/generated/ZatcaValidationReport.mjs +228 -0
- package/generated/index.d.mts +45 -5
- package/generated/index.mjs +45 -5
- package/index.d.mts +131 -15
- package/index.mjs +111 -33
- package/members.mjs +67 -0
- package/package.json +11 -5
- package/patch.mjs +121 -0
- package/raw.d.mts +731 -0
- package/raw.mjs +4 -0
|
@@ -6,11 +6,11 @@ import { SignedInvoice } from "./SignedInvoice.mjs"
|
|
|
6
6
|
import wasm from "./diplomat-wasm.mjs";
|
|
7
7
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
wasm.
|
|
9
|
+
const InvoiceSigner_box_destroy_registry = new FinalizationRegistry((ptr) => {
|
|
10
|
+
wasm.fatoora_InvoiceSigner_destroy(ptr);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
export class
|
|
13
|
+
export class InvoiceSigner {
|
|
14
14
|
// Internal ptr reference:
|
|
15
15
|
#ptr = null;
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ export class Signer {
|
|
|
20
20
|
|
|
21
21
|
#internalConstructor(symbol, ptr, selfEdge) {
|
|
22
22
|
if (symbol !== diplomatRuntime.internalConstructor) {
|
|
23
|
-
console.error("
|
|
23
|
+
console.error("InvoiceSigner is an Opaque type. You cannot call its constructor.");
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
this.#ptr = ptr;
|
|
@@ -28,7 +28,7 @@ export class Signer {
|
|
|
28
28
|
|
|
29
29
|
// Are we being borrowed? If not, we can register.
|
|
30
30
|
if (this.#selfEdge.length === 0) {
|
|
31
|
-
|
|
31
|
+
InvoiceSigner_box_destroy_registry.register(this, this.#ptr);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
return this;
|
|
@@ -47,14 +47,14 @@ export class Signer {
|
|
|
47
47
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
const result = wasm.
|
|
50
|
+
const result = wasm.fatoora_InvoiceSigner_from_pem(diplomatReceive.buffer, certPemSlice.ptr, keyPemSlice.ptr);
|
|
51
51
|
|
|
52
52
|
try {
|
|
53
53
|
if (!diplomatReceive.resultFlag) {
|
|
54
54
|
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
55
55
|
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
56
56
|
}
|
|
57
|
-
return new
|
|
57
|
+
return new InvoiceSigner(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
finally {
|
|
@@ -73,14 +73,14 @@ export class Signer {
|
|
|
73
73
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
const result = wasm.
|
|
76
|
+
const result = wasm.fatoora_InvoiceSigner_from_der(diplomatReceive.buffer, certDerSlice.ptr, keyDerSlice.ptr);
|
|
77
77
|
|
|
78
78
|
try {
|
|
79
79
|
if (!diplomatReceive.resultFlag) {
|
|
80
80
|
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
81
81
|
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
82
82
|
}
|
|
83
|
-
return new
|
|
83
|
+
return new InvoiceSigner(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
finally {
|
|
@@ -95,7 +95,7 @@ export class Signer {
|
|
|
95
95
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
const result = wasm.
|
|
98
|
+
const result = wasm.fatoora_InvoiceSigner_certificate_der(diplomatReceive.buffer, this.ffiValue);
|
|
99
99
|
|
|
100
100
|
try {
|
|
101
101
|
if (!diplomatReceive.resultFlag) {
|
|
@@ -117,7 +117,7 @@ export class Signer {
|
|
|
117
117
|
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
const result = wasm.
|
|
120
|
+
const result = wasm.fatoora_InvoiceSigner_certificate_pem(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
121
121
|
|
|
122
122
|
try {
|
|
123
123
|
if (!diplomatReceive.resultFlag) {
|
|
@@ -138,7 +138,7 @@ export class Signer {
|
|
|
138
138
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
const result = wasm.
|
|
141
|
+
const result = wasm.fatoora_InvoiceSigner_sign(diplomatReceive.buffer, this.ffiValue, invoice instanceof FinalizedInvoice ? invoice.ffiValue : typeError('invoice', 'FinalizedInvoice'));
|
|
142
142
|
|
|
143
143
|
try {
|
|
144
144
|
if (!diplomatReceive.resultFlag) {
|
|
@@ -163,7 +163,7 @@ export class Signer {
|
|
|
163
163
|
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
const result = wasm.
|
|
166
|
+
const result = wasm.fatoora_InvoiceSigner_sign_xml(diplomatReceive.buffer, this.ffiValue, xmlSlice.ptr, write.buffer);
|
|
167
167
|
|
|
168
168
|
try {
|
|
169
169
|
if (!diplomatReceive.resultFlag) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Standard (B2B, cleared) or simplified (B2C, reported) invoice.
|
|
8
|
+
*
|
|
9
|
+
* Discriminants match the `u8` codes used before 0.6.
|
|
10
|
+
*/
|
|
11
|
+
export class InvoiceSubType {
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
static fromValue(value: InvoiceSubType | string): InvoiceSubType;
|
|
15
|
+
|
|
16
|
+
get value(): string;
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
get ffiValue(): number;
|
|
20
|
+
|
|
21
|
+
static Standard : InvoiceSubType;
|
|
22
|
+
static Simplified : InvoiceSubType;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
constructor(value: InvoiceSubType | string );
|
|
26
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import wasm from "./diplomat-wasm.mjs";
|
|
3
|
+
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Standard (B2B, cleared) or simplified (B2C, reported) invoice.
|
|
9
|
+
*
|
|
10
|
+
* Discriminants match the `u8` codes used before 0.6.
|
|
11
|
+
*/
|
|
12
|
+
export class InvoiceSubType {
|
|
13
|
+
#value = undefined;
|
|
14
|
+
|
|
15
|
+
static #values = new Map([
|
|
16
|
+
["Standard", 0],
|
|
17
|
+
["Simplified", 1]
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
static getAllEntries() {
|
|
21
|
+
return InvoiceSubType.#values.entries();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#internalConstructor(value) {
|
|
25
|
+
if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
|
|
26
|
+
// We pass in two internalConstructor arguments to create *new*
|
|
27
|
+
// instances of this type, otherwise the enums are treated as singletons.
|
|
28
|
+
if (arguments[1] === diplomatRuntime.internalConstructor ) {
|
|
29
|
+
this.#value = arguments[2];
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
return InvoiceSubType.#objectValues[arguments[1]];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (value instanceof InvoiceSubType) {
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let intVal = InvoiceSubType.#values.get(value);
|
|
40
|
+
|
|
41
|
+
// Nullish check, checks for null or undefined
|
|
42
|
+
if (intVal != null) {
|
|
43
|
+
return InvoiceSubType.#objectValues[intVal];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
throw TypeError(value + " is not a InvoiceSubType and does not correspond to any of its enumerator values.");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @internal */
|
|
50
|
+
static fromValue(value) {
|
|
51
|
+
return new InvoiceSubType(value);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get value(){
|
|
55
|
+
return [...InvoiceSubType.#values.keys()][this.#value];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
get ffiValue(){
|
|
60
|
+
return this.#value;
|
|
61
|
+
}
|
|
62
|
+
static #objectValues = [
|
|
63
|
+
new InvoiceSubType(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
|
|
64
|
+
new InvoiceSubType(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
static Standard = InvoiceSubType.#objectValues[0];
|
|
68
|
+
static Simplified = InvoiceSubType.#objectValues[1];
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
constructor(value) {
|
|
72
|
+
return this.#internalConstructor(...arguments)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Kind of invoice document (UNCL1001 type code).
|
|
8
|
+
*
|
|
9
|
+
* Discriminants match the `u8` codes used before 0.6.
|
|
10
|
+
*/
|
|
11
|
+
export class InvoiceTypeKind {
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
static fromValue(value: InvoiceTypeKind | string): InvoiceTypeKind;
|
|
15
|
+
|
|
16
|
+
get value(): string;
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
get ffiValue(): number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Tax invoice (`388`).
|
|
23
|
+
*/
|
|
24
|
+
static Tax : InvoiceTypeKind;
|
|
25
|
+
/**
|
|
26
|
+
* Prepayment invoice (`386`).
|
|
27
|
+
*/
|
|
28
|
+
static Prepayment : InvoiceTypeKind;
|
|
29
|
+
/**
|
|
30
|
+
* Credit note (`381`).
|
|
31
|
+
*/
|
|
32
|
+
static CreditNote : InvoiceTypeKind;
|
|
33
|
+
/**
|
|
34
|
+
* Debit note (`383`).
|
|
35
|
+
*/
|
|
36
|
+
static DebitNote : InvoiceTypeKind;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
constructor(value: InvoiceTypeKind | string );
|
|
40
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import wasm from "./diplomat-wasm.mjs";
|
|
3
|
+
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Kind of invoice document (UNCL1001 type code).
|
|
9
|
+
*
|
|
10
|
+
* Discriminants match the `u8` codes used before 0.6.
|
|
11
|
+
*/
|
|
12
|
+
export class InvoiceTypeKind {
|
|
13
|
+
#value = undefined;
|
|
14
|
+
|
|
15
|
+
static #values = new Map([
|
|
16
|
+
["Tax", 0],
|
|
17
|
+
["Prepayment", 1],
|
|
18
|
+
["CreditNote", 2],
|
|
19
|
+
["DebitNote", 3]
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
static getAllEntries() {
|
|
23
|
+
return InvoiceTypeKind.#values.entries();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#internalConstructor(value) {
|
|
27
|
+
if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
|
|
28
|
+
// We pass in two internalConstructor arguments to create *new*
|
|
29
|
+
// instances of this type, otherwise the enums are treated as singletons.
|
|
30
|
+
if (arguments[1] === diplomatRuntime.internalConstructor ) {
|
|
31
|
+
this.#value = arguments[2];
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
return InvoiceTypeKind.#objectValues[arguments[1]];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (value instanceof InvoiceTypeKind) {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let intVal = InvoiceTypeKind.#values.get(value);
|
|
42
|
+
|
|
43
|
+
// Nullish check, checks for null or undefined
|
|
44
|
+
if (intVal != null) {
|
|
45
|
+
return InvoiceTypeKind.#objectValues[intVal];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
throw TypeError(value + " is not a InvoiceTypeKind and does not correspond to any of its enumerator values.");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** @internal */
|
|
52
|
+
static fromValue(value) {
|
|
53
|
+
return new InvoiceTypeKind(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get value(){
|
|
57
|
+
return [...InvoiceTypeKind.#values.keys()][this.#value];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
get ffiValue(){
|
|
62
|
+
return this.#value;
|
|
63
|
+
}
|
|
64
|
+
static #objectValues = [
|
|
65
|
+
new InvoiceTypeKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
|
|
66
|
+
new InvoiceTypeKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
|
|
67
|
+
new InvoiceTypeKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
|
|
68
|
+
new InvoiceTypeKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Tax invoice (`388`).
|
|
73
|
+
*/
|
|
74
|
+
static Tax = InvoiceTypeKind.#objectValues[0];
|
|
75
|
+
/**
|
|
76
|
+
* Prepayment invoice (`386`).
|
|
77
|
+
*/
|
|
78
|
+
static Prepayment = InvoiceTypeKind.#objectValues[1];
|
|
79
|
+
/**
|
|
80
|
+
* Credit note (`381`).
|
|
81
|
+
*/
|
|
82
|
+
static CreditNote = InvoiceTypeKind.#objectValues[2];
|
|
83
|
+
/**
|
|
84
|
+
* Debit note (`383`).
|
|
85
|
+
*/
|
|
86
|
+
static DebitNote = InvoiceTypeKind.#objectValues[3];
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
constructor(value) {
|
|
90
|
+
return this.#internalConstructor(...arguments)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -5,6 +5,7 @@ import type { InvoiceLineItem } from "./InvoiceLineItem.mjs"
|
|
|
5
5
|
import type { OriginalInvoiceRef } from "./OriginalInvoiceRef.mjs"
|
|
6
6
|
import type { TaxExemption } from "./TaxExemption.mjs"
|
|
7
7
|
import type { VatBreakdown } from "./VatBreakdown.mjs"
|
|
8
|
+
import type { VatCategory } from "./VatCategory.mjs"
|
|
8
9
|
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
9
10
|
|
|
10
11
|
|
|
@@ -50,7 +51,7 @@ export class LineItemBuilder {
|
|
|
50
51
|
|
|
51
52
|
setVatRate(value: string): void;
|
|
52
53
|
|
|
53
|
-
setVatCategory(value:
|
|
54
|
+
setVatCategory(value: VatCategory): void;
|
|
54
55
|
|
|
55
56
|
setExemption(value: TaxExemption): void;
|
|
56
57
|
|
|
@@ -5,6 +5,7 @@ import { InvoiceLineItem } from "./InvoiceLineItem.mjs"
|
|
|
5
5
|
import { OriginalInvoiceRef } from "./OriginalInvoiceRef.mjs"
|
|
6
6
|
import { TaxExemption } from "./TaxExemption.mjs"
|
|
7
7
|
import { VatBreakdown } from "./VatBreakdown.mjs"
|
|
8
|
+
import { VatCategory } from "./VatCategory.mjs"
|
|
8
9
|
import wasm from "./diplomat-wasm.mjs";
|
|
9
10
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
10
11
|
|
|
@@ -428,7 +429,7 @@ export class LineItemBuilder {
|
|
|
428
429
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
429
430
|
|
|
430
431
|
|
|
431
|
-
const result = wasm.fatoora_LineItemBuilder_set_vat_category(diplomatReceive.buffer, this.ffiValue, value);
|
|
432
|
+
const result = wasm.fatoora_LineItemBuilder_set_vat_category(diplomatReceive.buffer, this.ffiValue, new VatCategory(value).ffiValue);
|
|
432
433
|
|
|
433
434
|
try {
|
|
434
435
|
if (!diplomatReceive.resultFlag) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `type` of a validation message.
|
|
8
|
+
*
|
|
9
|
+
* `Unknown` marks a value this binding version does not recognize; read the
|
|
10
|
+
* verbatim wire value with the sibling `*_raw` getter.
|
|
11
|
+
*/
|
|
12
|
+
export class MessageType {
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
static fromValue(value: MessageType | string): MessageType;
|
|
16
|
+
|
|
17
|
+
get value(): string;
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
get ffiValue(): number;
|
|
21
|
+
|
|
22
|
+
static Unknown : MessageType;
|
|
23
|
+
/**
|
|
24
|
+
* Wire value `INFO`.
|
|
25
|
+
*/
|
|
26
|
+
static Info : MessageType;
|
|
27
|
+
/**
|
|
28
|
+
* Wire value `WARNING`.
|
|
29
|
+
*/
|
|
30
|
+
static Warning : MessageType;
|
|
31
|
+
/**
|
|
32
|
+
* Wire value `ERROR`.
|
|
33
|
+
*/
|
|
34
|
+
static Error : MessageType;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
constructor(value: MessageType | string );
|
|
38
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import wasm from "./diplomat-wasm.mjs";
|
|
3
|
+
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The `type` of a validation message.
|
|
9
|
+
*
|
|
10
|
+
* `Unknown` marks a value this binding version does not recognize; read the
|
|
11
|
+
* verbatim wire value with the sibling `*_raw` getter.
|
|
12
|
+
*/
|
|
13
|
+
export class MessageType {
|
|
14
|
+
#value = undefined;
|
|
15
|
+
|
|
16
|
+
static #values = new Map([
|
|
17
|
+
["Unknown", 0],
|
|
18
|
+
["Info", 1],
|
|
19
|
+
["Warning", 2],
|
|
20
|
+
["Error", 3]
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
static getAllEntries() {
|
|
24
|
+
return MessageType.#values.entries();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#internalConstructor(value) {
|
|
28
|
+
if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
|
|
29
|
+
// We pass in two internalConstructor arguments to create *new*
|
|
30
|
+
// instances of this type, otherwise the enums are treated as singletons.
|
|
31
|
+
if (arguments[1] === diplomatRuntime.internalConstructor ) {
|
|
32
|
+
this.#value = arguments[2];
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
return MessageType.#objectValues[arguments[1]];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (value instanceof MessageType) {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let intVal = MessageType.#values.get(value);
|
|
43
|
+
|
|
44
|
+
// Nullish check, checks for null or undefined
|
|
45
|
+
if (intVal != null) {
|
|
46
|
+
return MessageType.#objectValues[intVal];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
throw TypeError(value + " is not a MessageType and does not correspond to any of its enumerator values.");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
static fromValue(value) {
|
|
54
|
+
return new MessageType(value);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get value(){
|
|
58
|
+
return [...MessageType.#values.keys()][this.#value];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** @internal */
|
|
62
|
+
get ffiValue(){
|
|
63
|
+
return this.#value;
|
|
64
|
+
}
|
|
65
|
+
static #objectValues = [
|
|
66
|
+
new MessageType(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
|
|
67
|
+
new MessageType(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
|
|
68
|
+
new MessageType(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
|
|
69
|
+
new MessageType(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
static Unknown = MessageType.#objectValues[0];
|
|
73
|
+
/**
|
|
74
|
+
* Wire value `INFO`.
|
|
75
|
+
*/
|
|
76
|
+
static Info = MessageType.#objectValues[1];
|
|
77
|
+
/**
|
|
78
|
+
* Wire value `WARNING`.
|
|
79
|
+
*/
|
|
80
|
+
static Warning = MessageType.#objectValues[2];
|
|
81
|
+
/**
|
|
82
|
+
* Wire value `ERROR`.
|
|
83
|
+
*/
|
|
84
|
+
static Error = MessageType.#objectValues[3];
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
constructor(value) {
|
|
88
|
+
return this.#internalConstructor(...arguments)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import type { BindingError } from "./BindingError.mjs"
|
|
3
|
+
import type { Environment } from "./Environment.mjs"
|
|
3
4
|
import type { Text } from "./Text.mjs"
|
|
4
5
|
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
export class
|
|
9
|
+
export class ProductionCsid {
|
|
9
10
|
/** @internal */
|
|
10
11
|
get ffiValue(): pointer;
|
|
11
12
|
/** @internal */
|
|
12
13
|
constructor();
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
static
|
|
16
|
+
static new_(environment: Environment, requestId: string | null, token: string, secret: string): ProductionCsid;
|
|
16
17
|
|
|
17
|
-
env():
|
|
18
|
+
env(): Environment;
|
|
18
19
|
|
|
19
20
|
requestId(): Text | null;
|
|
20
21
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import { BindingError } from "./BindingError.mjs"
|
|
3
|
+
import { Environment } from "./Environment.mjs"
|
|
3
4
|
import { Text } from "./Text.mjs"
|
|
4
5
|
import wasm from "./diplomat-wasm.mjs";
|
|
5
6
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
-
wasm.
|
|
8
|
+
const ProductionCsid_box_destroy_registry = new FinalizationRegistry((ptr) => {
|
|
9
|
+
wasm.fatoora_ProductionCsid_destroy(ptr);
|
|
9
10
|
});
|
|
10
11
|
|
|
11
|
-
export class
|
|
12
|
+
export class ProductionCsid {
|
|
12
13
|
// Internal ptr reference:
|
|
13
14
|
#ptr = null;
|
|
14
15
|
|
|
@@ -18,7 +19,7 @@ export class CsidProduction {
|
|
|
18
19
|
|
|
19
20
|
#internalConstructor(symbol, ptr, selfEdge) {
|
|
20
21
|
if (symbol !== diplomatRuntime.internalConstructor) {
|
|
21
|
-
console.error("
|
|
22
|
+
console.error("ProductionCsid is an Opaque type. You cannot call its constructor.");
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
25
|
this.#ptr = ptr;
|
|
@@ -26,7 +27,7 @@ export class CsidProduction {
|
|
|
26
27
|
|
|
27
28
|
// Are we being borrowed? If not, we can register.
|
|
28
29
|
if (this.#selfEdge.length === 0) {
|
|
29
|
-
|
|
30
|
+
ProductionCsid_box_destroy_registry.register(this, this.#ptr);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
return this;
|
|
@@ -37,7 +38,7 @@ export class CsidProduction {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
|
|
40
|
-
static
|
|
41
|
+
static new_(environment, requestId, token, secret) {
|
|
41
42
|
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
42
43
|
|
|
43
44
|
const tokenSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, token)));
|
|
@@ -45,14 +46,14 @@ export class CsidProduction {
|
|
|
45
46
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
46
47
|
|
|
47
48
|
|
|
48
|
-
const result = wasm.
|
|
49
|
+
const result = wasm.fatoora_ProductionCsid_new(diplomatReceive.buffer, new Environment(environment).ffiValue, diplomatRuntime.optionToBufferForCalling(wasm, requestId, 8, 4, functionCleanupArena, (arrayBuffer, offset, jsValue) => [functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.str8(wasm, jsValue)).writePtrLenToArrayBuffer(arrayBuffer, offset + 0)]), tokenSlice.ptr, secretSlice.ptr);
|
|
49
50
|
|
|
50
51
|
try {
|
|
51
52
|
if (!diplomatReceive.resultFlag) {
|
|
52
53
|
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
53
54
|
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
54
55
|
}
|
|
55
|
-
return new
|
|
56
|
+
return new ProductionCsid(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
finally {
|
|
@@ -64,15 +65,22 @@ export class CsidProduction {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
env() {
|
|
68
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
69
|
+
|
|
67
70
|
|
|
68
|
-
const result = wasm.
|
|
71
|
+
const result = wasm.fatoora_ProductionCsid_env(diplomatReceive.buffer, this.ffiValue);
|
|
69
72
|
|
|
70
73
|
try {
|
|
71
|
-
|
|
74
|
+
if (!diplomatReceive.resultFlag) {
|
|
75
|
+
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
76
|
+
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
77
|
+
}
|
|
78
|
+
return new Environment(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
finally {
|
|
75
82
|
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
83
|
+
diplomatReceive.free();
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
|
|
@@ -80,7 +88,7 @@ export class CsidProduction {
|
|
|
80
88
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
81
89
|
|
|
82
90
|
|
|
83
|
-
const result = wasm.
|
|
91
|
+
const result = wasm.fatoora_ProductionCsid_request_id(diplomatReceive.buffer, this.ffiValue);
|
|
84
92
|
|
|
85
93
|
try {
|
|
86
94
|
if (!diplomatReceive.resultFlag) {
|
|
@@ -102,7 +110,7 @@ export class CsidProduction {
|
|
|
102
110
|
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
103
111
|
|
|
104
112
|
|
|
105
|
-
const result = wasm.
|
|
113
|
+
const result = wasm.fatoora_ProductionCsid_binary_security_token(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
106
114
|
|
|
107
115
|
try {
|
|
108
116
|
if (!diplomatReceive.resultFlag) {
|
|
@@ -125,7 +133,7 @@ export class CsidProduction {
|
|
|
125
133
|
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
126
134
|
|
|
127
135
|
|
|
128
|
-
const result = wasm.
|
|
136
|
+
const result = wasm.fatoora_ProductionCsid_secret(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
129
137
|
|
|
130
138
|
try {
|
|
131
139
|
if (!diplomatReceive.resultFlag) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import type { BindingError } from "./BindingError.mjs"
|
|
3
3
|
import type { Bytes } from "./Bytes.mjs"
|
|
4
|
-
import type {
|
|
4
|
+
import type { ProductionCsid } from "./ProductionCsid.mjs"
|
|
5
5
|
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
6
6
|
|
|
7
7
|
|
|
@@ -24,5 +24,5 @@ export class ProductionRequest {
|
|
|
24
24
|
|
|
25
25
|
body(): Bytes;
|
|
26
26
|
|
|
27
|
-
decode(status: number, body: Array<number>):
|
|
27
|
+
decode(status: number, body: Array<number>): ProductionCsid;
|
|
28
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import { BindingError } from "./BindingError.mjs"
|
|
3
3
|
import { Bytes } from "./Bytes.mjs"
|
|
4
|
-
import {
|
|
4
|
+
import { ProductionCsid } from "./ProductionCsid.mjs"
|
|
5
5
|
import wasm from "./diplomat-wasm.mjs";
|
|
6
6
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
7
7
|
|
|
@@ -144,7 +144,7 @@ export class ProductionRequest {
|
|
|
144
144
|
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
145
145
|
throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
|
|
146
146
|
}
|
|
147
|
-
return new
|
|
147
|
+
return new ProductionCsid(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
finally {
|