fatoority 0.5.1 → 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 +10 -4
- package/patch.mjs +121 -0
- package/raw.d.mts +731 -0
- package/raw.mjs +4 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `reportingStatus` of a reporting response.
|
|
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 ReportingStatus {
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
static fromValue(value: ReportingStatus | string): ReportingStatus;
|
|
16
|
+
|
|
17
|
+
get value(): string;
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
get ffiValue(): number;
|
|
21
|
+
|
|
22
|
+
static Unknown : ReportingStatus;
|
|
23
|
+
/**
|
|
24
|
+
* Wire value `REPORTED`.
|
|
25
|
+
*/
|
|
26
|
+
static Reported : ReportingStatus;
|
|
27
|
+
/**
|
|
28
|
+
* Wire value `NOT_REPORTED`.
|
|
29
|
+
*/
|
|
30
|
+
static NotReported : ReportingStatus;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
constructor(value: ReportingStatus | string );
|
|
34
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
* `reportingStatus` of a reporting response.
|
|
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 ReportingStatus {
|
|
14
|
+
#value = undefined;
|
|
15
|
+
|
|
16
|
+
static #values = new Map([
|
|
17
|
+
["Unknown", 0],
|
|
18
|
+
["Reported", 1],
|
|
19
|
+
["NotReported", 2]
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
static getAllEntries() {
|
|
23
|
+
return ReportingStatus.#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 ReportingStatus.#objectValues[arguments[1]];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (value instanceof ReportingStatus) {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let intVal = ReportingStatus.#values.get(value);
|
|
42
|
+
|
|
43
|
+
// Nullish check, checks for null or undefined
|
|
44
|
+
if (intVal != null) {
|
|
45
|
+
return ReportingStatus.#objectValues[intVal];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
throw TypeError(value + " is not a ReportingStatus and does not correspond to any of its enumerator values.");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** @internal */
|
|
52
|
+
static fromValue(value) {
|
|
53
|
+
return new ReportingStatus(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get value(){
|
|
57
|
+
return [...ReportingStatus.#values.keys()][this.#value];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
get ffiValue(){
|
|
62
|
+
return this.#value;
|
|
63
|
+
}
|
|
64
|
+
static #objectValues = [
|
|
65
|
+
new ReportingStatus(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
|
|
66
|
+
new ReportingStatus(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
|
|
67
|
+
new ReportingStatus(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
static Unknown = ReportingStatus.#objectValues[0];
|
|
71
|
+
/**
|
|
72
|
+
* Wire value `REPORTED`.
|
|
73
|
+
*/
|
|
74
|
+
static Reported = ReportingStatus.#objectValues[1];
|
|
75
|
+
/**
|
|
76
|
+
* Wire value `NOT_REPORTED`.
|
|
77
|
+
*/
|
|
78
|
+
static NotReported = ReportingStatus.#objectValues[2];
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
constructor(value) {
|
|
82
|
+
return this.#internalConstructor(...arguments)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Severity of a validation finding.
|
|
8
|
+
*/
|
|
9
|
+
export class Severity {
|
|
10
|
+
|
|
11
|
+
/** @internal */
|
|
12
|
+
static fromValue(value: Severity | string): Severity;
|
|
13
|
+
|
|
14
|
+
get value(): string;
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
get ffiValue(): number;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Reported but does not make the document invalid.
|
|
21
|
+
*/
|
|
22
|
+
static Warning : Severity;
|
|
23
|
+
/**
|
|
24
|
+
* Makes the document invalid.
|
|
25
|
+
*/
|
|
26
|
+
static Error : Severity;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
constructor(value: Severity | string );
|
|
30
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
* Severity of a validation finding.
|
|
9
|
+
*/
|
|
10
|
+
export class Severity {
|
|
11
|
+
#value = undefined;
|
|
12
|
+
|
|
13
|
+
static #values = new Map([
|
|
14
|
+
["Warning", 0],
|
|
15
|
+
["Error", 1]
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
static getAllEntries() {
|
|
19
|
+
return Severity.#values.entries();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#internalConstructor(value) {
|
|
23
|
+
if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
|
|
24
|
+
// We pass in two internalConstructor arguments to create *new*
|
|
25
|
+
// instances of this type, otherwise the enums are treated as singletons.
|
|
26
|
+
if (arguments[1] === diplomatRuntime.internalConstructor ) {
|
|
27
|
+
this.#value = arguments[2];
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
return Severity.#objectValues[arguments[1]];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (value instanceof Severity) {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let intVal = Severity.#values.get(value);
|
|
38
|
+
|
|
39
|
+
// Nullish check, checks for null or undefined
|
|
40
|
+
if (intVal != null) {
|
|
41
|
+
return Severity.#objectValues[intVal];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
throw TypeError(value + " is not a Severity and does not correspond to any of its enumerator values.");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** @internal */
|
|
48
|
+
static fromValue(value) {
|
|
49
|
+
return new Severity(value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get value(){
|
|
53
|
+
return [...Severity.#values.keys()][this.#value];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** @internal */
|
|
57
|
+
get ffiValue(){
|
|
58
|
+
return this.#value;
|
|
59
|
+
}
|
|
60
|
+
static #objectValues = [
|
|
61
|
+
new Severity(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
|
|
62
|
+
new Severity(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Reported but does not make the document invalid.
|
|
67
|
+
*/
|
|
68
|
+
static Warning = Severity.#objectValues[0];
|
|
69
|
+
/**
|
|
70
|
+
* Makes the document invalid.
|
|
71
|
+
*/
|
|
72
|
+
static Error = Severity.#objectValues[1];
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
constructor(value) {
|
|
76
|
+
return this.#internalConstructor(...arguments)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -104,13 +104,13 @@ export class SignedInvoice {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
hash() {
|
|
108
108
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
109
109
|
|
|
110
110
|
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
const result = wasm.
|
|
113
|
+
const result = wasm.fatoora_SignedInvoice_hash(diplomatReceive.buffer, this.ffiValue, write.buffer);
|
|
114
114
|
|
|
115
115
|
try {
|
|
116
116
|
if (!diplomatReceive.resultFlag) {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The validation layer that produced a finding.
|
|
8
|
+
*
|
|
9
|
+
* `Unknown` marks a layer this binding version does not recognize.
|
|
10
|
+
*/
|
|
11
|
+
export class ValidationLayer {
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
static fromValue(value: ValidationLayer | string): ValidationLayer;
|
|
15
|
+
|
|
16
|
+
get value(): string;
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
get ffiValue(): number;
|
|
20
|
+
|
|
21
|
+
static Unknown : ValidationLayer;
|
|
22
|
+
/**
|
|
23
|
+
* Builder/model field checks.
|
|
24
|
+
*/
|
|
25
|
+
static FieldChecks : ValidationLayer;
|
|
26
|
+
/**
|
|
27
|
+
* UBL XML schema (XSD) validation.
|
|
28
|
+
*/
|
|
29
|
+
static Xsd : ValidationLayer;
|
|
30
|
+
/**
|
|
31
|
+
* CEN EN 16931 and KSA business rules.
|
|
32
|
+
*/
|
|
33
|
+
static BusinessRules : ValidationLayer;
|
|
34
|
+
/**
|
|
35
|
+
* Cryptographic signature, digest and certificate checks.
|
|
36
|
+
*/
|
|
37
|
+
static Signature : ValidationLayer;
|
|
38
|
+
/**
|
|
39
|
+
* QR payload consistency.
|
|
40
|
+
*/
|
|
41
|
+
static Qr : ValidationLayer;
|
|
42
|
+
/**
|
|
43
|
+
* Previous invoice hash comparison.
|
|
44
|
+
*/
|
|
45
|
+
static PreviousInvoiceHash : ValidationLayer;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
constructor(value: ValidationLayer | string );
|
|
49
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
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 validation layer that produced a finding.
|
|
9
|
+
*
|
|
10
|
+
* `Unknown` marks a layer this binding version does not recognize.
|
|
11
|
+
*/
|
|
12
|
+
export class ValidationLayer {
|
|
13
|
+
#value = undefined;
|
|
14
|
+
|
|
15
|
+
static #values = new Map([
|
|
16
|
+
["Unknown", 0],
|
|
17
|
+
["FieldChecks", 1],
|
|
18
|
+
["Xsd", 2],
|
|
19
|
+
["BusinessRules", 3],
|
|
20
|
+
["Signature", 4],
|
|
21
|
+
["Qr", 5],
|
|
22
|
+
["PreviousInvoiceHash", 6]
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
static getAllEntries() {
|
|
26
|
+
return ValidationLayer.#values.entries();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#internalConstructor(value) {
|
|
30
|
+
if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
|
|
31
|
+
// We pass in two internalConstructor arguments to create *new*
|
|
32
|
+
// instances of this type, otherwise the enums are treated as singletons.
|
|
33
|
+
if (arguments[1] === diplomatRuntime.internalConstructor ) {
|
|
34
|
+
this.#value = arguments[2];
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
return ValidationLayer.#objectValues[arguments[1]];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (value instanceof ValidationLayer) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let intVal = ValidationLayer.#values.get(value);
|
|
45
|
+
|
|
46
|
+
// Nullish check, checks for null or undefined
|
|
47
|
+
if (intVal != null) {
|
|
48
|
+
return ValidationLayer.#objectValues[intVal];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
throw TypeError(value + " is not a ValidationLayer and does not correspond to any of its enumerator values.");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
static fromValue(value) {
|
|
56
|
+
return new ValidationLayer(value);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get value(){
|
|
60
|
+
return [...ValidationLayer.#values.keys()][this.#value];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
get ffiValue(){
|
|
65
|
+
return this.#value;
|
|
66
|
+
}
|
|
67
|
+
static #objectValues = [
|
|
68
|
+
new ValidationLayer(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
|
|
69
|
+
new ValidationLayer(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
|
|
70
|
+
new ValidationLayer(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
|
|
71
|
+
new ValidationLayer(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
|
|
72
|
+
new ValidationLayer(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
|
|
73
|
+
new ValidationLayer(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
|
|
74
|
+
new ValidationLayer(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 6),
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
static Unknown = ValidationLayer.#objectValues[0];
|
|
78
|
+
/**
|
|
79
|
+
* Builder/model field checks.
|
|
80
|
+
*/
|
|
81
|
+
static FieldChecks = ValidationLayer.#objectValues[1];
|
|
82
|
+
/**
|
|
83
|
+
* UBL XML schema (XSD) validation.
|
|
84
|
+
*/
|
|
85
|
+
static Xsd = ValidationLayer.#objectValues[2];
|
|
86
|
+
/**
|
|
87
|
+
* CEN EN 16931 and KSA business rules.
|
|
88
|
+
*/
|
|
89
|
+
static BusinessRules = ValidationLayer.#objectValues[3];
|
|
90
|
+
/**
|
|
91
|
+
* Cryptographic signature, digest and certificate checks.
|
|
92
|
+
*/
|
|
93
|
+
static Signature = ValidationLayer.#objectValues[4];
|
|
94
|
+
/**
|
|
95
|
+
* QR payload consistency.
|
|
96
|
+
*/
|
|
97
|
+
static Qr = ValidationLayer.#objectValues[5];
|
|
98
|
+
/**
|
|
99
|
+
* Previous invoice hash comparison.
|
|
100
|
+
*/
|
|
101
|
+
static PreviousInvoiceHash = ValidationLayer.#objectValues[6];
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
constructor(value) {
|
|
105
|
+
return this.#internalConstructor(...arguments)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Which kind of location a finding carries.
|
|
8
|
+
*
|
|
9
|
+
* `Unknown` marks a location kind this binding version does not recognize.
|
|
10
|
+
*/
|
|
11
|
+
export class ValidationLocationKind {
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
static fromValue(value: ValidationLocationKind | string): ValidationLocationKind;
|
|
15
|
+
|
|
16
|
+
get value(): string;
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
get ffiValue(): number;
|
|
20
|
+
|
|
21
|
+
static Unknown : ValidationLocationKind;
|
|
22
|
+
/**
|
|
23
|
+
* A model field path such as `line_items[0].quantity`; see `location_path`.
|
|
24
|
+
*/
|
|
25
|
+
static Field : ValidationLocationKind;
|
|
26
|
+
/**
|
|
27
|
+
* A namespace-independent XPath; see `location_path`.
|
|
28
|
+
*/
|
|
29
|
+
static XPath : ValidationLocationKind;
|
|
30
|
+
/**
|
|
31
|
+
* One-based XML source coordinates; see `location_line`/`location_column`.
|
|
32
|
+
*/
|
|
33
|
+
static Xml : ValidationLocationKind;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
constructor(value: ValidationLocationKind | string );
|
|
37
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
* Which kind of location a finding carries.
|
|
9
|
+
*
|
|
10
|
+
* `Unknown` marks a location kind this binding version does not recognize.
|
|
11
|
+
*/
|
|
12
|
+
export class ValidationLocationKind {
|
|
13
|
+
#value = undefined;
|
|
14
|
+
|
|
15
|
+
static #values = new Map([
|
|
16
|
+
["Unknown", 0],
|
|
17
|
+
["Field", 1],
|
|
18
|
+
["XPath", 2],
|
|
19
|
+
["Xml", 3]
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
static getAllEntries() {
|
|
23
|
+
return ValidationLocationKind.#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 ValidationLocationKind.#objectValues[arguments[1]];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (value instanceof ValidationLocationKind) {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let intVal = ValidationLocationKind.#values.get(value);
|
|
42
|
+
|
|
43
|
+
// Nullish check, checks for null or undefined
|
|
44
|
+
if (intVal != null) {
|
|
45
|
+
return ValidationLocationKind.#objectValues[intVal];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
throw TypeError(value + " is not a ValidationLocationKind and does not correspond to any of its enumerator values.");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** @internal */
|
|
52
|
+
static fromValue(value) {
|
|
53
|
+
return new ValidationLocationKind(value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get value(){
|
|
57
|
+
return [...ValidationLocationKind.#values.keys()][this.#value];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
get ffiValue(){
|
|
62
|
+
return this.#value;
|
|
63
|
+
}
|
|
64
|
+
static #objectValues = [
|
|
65
|
+
new ValidationLocationKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
|
|
66
|
+
new ValidationLocationKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
|
|
67
|
+
new ValidationLocationKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
|
|
68
|
+
new ValidationLocationKind(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
static Unknown = ValidationLocationKind.#objectValues[0];
|
|
72
|
+
/**
|
|
73
|
+
* A model field path such as `line_items[0].quantity`; see `location_path`.
|
|
74
|
+
*/
|
|
75
|
+
static Field = ValidationLocationKind.#objectValues[1];
|
|
76
|
+
/**
|
|
77
|
+
* A namespace-independent XPath; see `location_path`.
|
|
78
|
+
*/
|
|
79
|
+
static XPath = ValidationLocationKind.#objectValues[2];
|
|
80
|
+
/**
|
|
81
|
+
* One-based XML source coordinates; see `location_line`/`location_column`.
|
|
82
|
+
*/
|
|
83
|
+
static Xml = ValidationLocationKind.#objectValues[3];
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
constructor(value) {
|
|
87
|
+
return this.#internalConstructor(...arguments)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import type { BindingError } from "./BindingError.mjs"
|
|
3
|
+
import type { MessageType } from "./MessageType.mjs"
|
|
3
4
|
import type { Text } from "./Text.mjs"
|
|
5
|
+
import type { ValidationStatus } from "./ValidationStatus.mjs"
|
|
4
6
|
import type { pointer, codepoint } from "./diplomat-runtime.mjs";
|
|
5
7
|
|
|
6
8
|
|
|
@@ -12,7 +14,15 @@ export class ValidationMessage {
|
|
|
12
14
|
constructor();
|
|
13
15
|
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The parsed message `type`, or null when the message has none.
|
|
19
|
+
*/
|
|
20
|
+
messageType(): MessageType | null;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The message `type` exactly as ZATCA sent it, or null when absent.
|
|
24
|
+
*/
|
|
25
|
+
messageTypeRaw(): Text | null;
|
|
16
26
|
|
|
17
27
|
code(): Text | null;
|
|
18
28
|
|
|
@@ -20,5 +30,13 @@ export class ValidationMessage {
|
|
|
20
30
|
|
|
21
31
|
message(): Text | null;
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The parsed message `status`, or null when the message has none.
|
|
35
|
+
*/
|
|
36
|
+
status(): ValidationStatus | null;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The message `status` exactly as ZATCA sent it, or null when absent.
|
|
40
|
+
*/
|
|
41
|
+
statusRaw(): Text | null;
|
|
24
42
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// generated by diplomat-tool
|
|
2
2
|
import { BindingError } from "./BindingError.mjs"
|
|
3
|
+
import { MessageType } from "./MessageType.mjs"
|
|
3
4
|
import { Text } from "./Text.mjs"
|
|
5
|
+
import { ValidationStatus } from "./ValidationStatus.mjs"
|
|
4
6
|
import wasm from "./diplomat-wasm.mjs";
|
|
5
7
|
import * as diplomatRuntime from "./diplomat-runtime.mjs";
|
|
6
8
|
|
|
@@ -37,12 +39,37 @@ export class ValidationMessage {
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
|
|
42
|
+
/**
|
|
43
|
+
* The parsed message `type`, or null when the message has none.
|
|
44
|
+
*/
|
|
40
45
|
messageType() {
|
|
41
46
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
42
47
|
|
|
43
48
|
|
|
44
49
|
const result = wasm.fatoora_ValidationMessage_message_type(diplomatReceive.buffer, this.ffiValue);
|
|
45
50
|
|
|
51
|
+
try {
|
|
52
|
+
if (!diplomatReceive.resultFlag) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return new MessageType(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
finally {
|
|
59
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
60
|
+
diplomatReceive.free();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The message `type` exactly as ZATCA sent it, or null when absent.
|
|
66
|
+
*/
|
|
67
|
+
messageTypeRaw() {
|
|
68
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
const result = wasm.fatoora_ValidationMessage_message_type_raw(diplomatReceive.buffer, this.ffiValue);
|
|
72
|
+
|
|
46
73
|
try {
|
|
47
74
|
if (!diplomatReceive.resultFlag) {
|
|
48
75
|
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|
|
@@ -117,12 +144,37 @@ export class ValidationMessage {
|
|
|
117
144
|
}
|
|
118
145
|
}
|
|
119
146
|
|
|
147
|
+
/**
|
|
148
|
+
* The parsed message `status`, or null when the message has none.
|
|
149
|
+
*/
|
|
120
150
|
status() {
|
|
121
151
|
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
122
152
|
|
|
123
153
|
|
|
124
154
|
const result = wasm.fatoora_ValidationMessage_status(diplomatReceive.buffer, this.ffiValue);
|
|
125
155
|
|
|
156
|
+
try {
|
|
157
|
+
if (!diplomatReceive.resultFlag) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
return new ValidationStatus(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
finally {
|
|
164
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
165
|
+
diplomatReceive.free();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The message `status` exactly as ZATCA sent it, or null when absent.
|
|
171
|
+
*/
|
|
172
|
+
statusRaw() {
|
|
173
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
const result = wasm.fatoora_ValidationMessage_status_raw(diplomatReceive.buffer, this.ffiValue);
|
|
177
|
+
|
|
126
178
|
try {
|
|
127
179
|
if (!diplomatReceive.resultFlag) {
|
|
128
180
|
const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
|