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.
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 +10 -4
  93. package/patch.mjs +121 -0
  94. package/raw.d.mts +731 -0
  95. package/raw.mjs +4 -0
@@ -0,0 +1,41 @@
1
+ // generated by diplomat-tool
2
+ import type { BindingError } from "./BindingError.mjs"
3
+ import type { Text } from "./Text.mjs"
4
+ import type { ZatcaFinding } from "./ZatcaFinding.mjs"
5
+ import type { ZatcaRuleSource } from "./ZatcaRuleSource.mjs"
6
+ import type { ZatcaStage } from "./ZatcaStage.mjs"
7
+ import type { ZatcaStageStatus } from "./ZatcaStageStatus.mjs"
8
+ import type { pointer, codepoint } from "./diplomat-runtime.mjs";
9
+
10
+
11
+
12
+ /**
13
+ * Coverage and findings from one validation stage.
14
+ */
15
+ export class ZatcaStageReport {
16
+ /** @internal */
17
+ get ffiValue(): pointer;
18
+ /** @internal */
19
+ constructor();
20
+
21
+
22
+ stage(): ZatcaStage;
23
+
24
+ status(): ZatcaStageStatus;
25
+
26
+ /**
27
+ * Pinned rule source, for the CEN and KSA business-rule stages.
28
+ */
29
+ provenance(): ZatcaRuleSource | null;
30
+
31
+ evaluatedAssertionsLen(): number;
32
+
33
+ /**
34
+ * Assertion site at `index` whose selected contexts were all evaluated.
35
+ */
36
+ evaluatedAssertion(index: number): Text;
37
+
38
+ findingsLen(): number;
39
+
40
+ finding(index: number): ZatcaFinding;
41
+ }
@@ -0,0 +1,168 @@
1
+ // generated by diplomat-tool
2
+ import { BindingError } from "./BindingError.mjs"
3
+ import { Text } from "./Text.mjs"
4
+ import { ZatcaFinding } from "./ZatcaFinding.mjs"
5
+ import { ZatcaRuleSource } from "./ZatcaRuleSource.mjs"
6
+ import { ZatcaStage } from "./ZatcaStage.mjs"
7
+ import { ZatcaStageStatus } from "./ZatcaStageStatus.mjs"
8
+ import wasm from "./diplomat-wasm.mjs";
9
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
10
+
11
+ const ZatcaStageReport_box_destroy_registry = new FinalizationRegistry((ptr) => {
12
+ wasm.fatoora_ZatcaStageReport_destroy(ptr);
13
+ });
14
+
15
+ /**
16
+ * Coverage and findings from one validation stage.
17
+ */
18
+ export class ZatcaStageReport {
19
+ // Internal ptr reference:
20
+ #ptr = null;
21
+
22
+ // Lifetimes are only to keep dependencies alive.
23
+ // Since JS won't garbage collect until there are no incoming edges.
24
+ #selfEdge = [];
25
+
26
+ #internalConstructor(symbol, ptr, selfEdge) {
27
+ if (symbol !== diplomatRuntime.internalConstructor) {
28
+ console.error("ZatcaStageReport is an Opaque type. You cannot call its constructor.");
29
+ return;
30
+ }
31
+ this.#ptr = ptr;
32
+ this.#selfEdge = selfEdge;
33
+
34
+ // Are we being borrowed? If not, we can register.
35
+ if (this.#selfEdge.length === 0) {
36
+ ZatcaStageReport_box_destroy_registry.register(this, this.#ptr);
37
+ }
38
+
39
+ return this;
40
+ }
41
+ /** @internal */
42
+ get ffiValue() {
43
+ return this.#ptr;
44
+ }
45
+
46
+
47
+ stage() {
48
+
49
+ const result = wasm.fatoora_ZatcaStageReport_stage(this.ffiValue);
50
+
51
+ try {
52
+ return new ZatcaStage(diplomatRuntime.internalConstructor, result);
53
+ }
54
+
55
+ finally {
56
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
57
+ }
58
+ }
59
+
60
+ status() {
61
+
62
+ const result = wasm.fatoora_ZatcaStageReport_status(this.ffiValue);
63
+
64
+ try {
65
+ return new ZatcaStageStatus(diplomatRuntime.internalConstructor, result);
66
+ }
67
+
68
+ finally {
69
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Pinned rule source, for the CEN and KSA business-rule stages.
75
+ */
76
+ provenance() {
77
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
78
+
79
+
80
+ const result = wasm.fatoora_ZatcaStageReport_provenance(diplomatReceive.buffer, this.ffiValue);
81
+
82
+ try {
83
+ if (!diplomatReceive.resultFlag) {
84
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
85
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
86
+ }
87
+ return diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer) === 0 ? null : new ZatcaRuleSource(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
88
+ }
89
+
90
+ finally {
91
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
92
+ diplomatReceive.free();
93
+ }
94
+ }
95
+
96
+ evaluatedAssertionsLen() {
97
+
98
+ const result = wasm.fatoora_ZatcaStageReport_evaluated_assertions_len(this.ffiValue);
99
+
100
+ try {
101
+ return result;
102
+ }
103
+
104
+ finally {
105
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Assertion site at `index` whose selected contexts were all evaluated.
111
+ */
112
+ evaluatedAssertion(index) {
113
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
114
+
115
+
116
+ const result = wasm.fatoora_ZatcaStageReport_evaluated_assertion(diplomatReceive.buffer, this.ffiValue, index);
117
+
118
+ try {
119
+ if (!diplomatReceive.resultFlag) {
120
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
121
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
122
+ }
123
+ return new Text(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
124
+ }
125
+
126
+ finally {
127
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
128
+ diplomatReceive.free();
129
+ }
130
+ }
131
+
132
+ findingsLen() {
133
+
134
+ const result = wasm.fatoora_ZatcaStageReport_findings_len(this.ffiValue);
135
+
136
+ try {
137
+ return result;
138
+ }
139
+
140
+ finally {
141
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
142
+ }
143
+ }
144
+
145
+ finding(index) {
146
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
147
+
148
+
149
+ const result = wasm.fatoora_ZatcaStageReport_finding(diplomatReceive.buffer, this.ffiValue, index);
150
+
151
+ try {
152
+ if (!diplomatReceive.resultFlag) {
153
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
154
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
155
+ }
156
+ return new ZatcaFinding(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
157
+ }
158
+
159
+ finally {
160
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
161
+ diplomatReceive.free();
162
+ }
163
+ }
164
+
165
+ constructor(symbol, ptr, selfEdge) {
166
+ return this.#internalConstructor(...arguments)
167
+ }
168
+ }
@@ -0,0 +1,45 @@
1
+ // generated by diplomat-tool
2
+ import type { pointer, codepoint } from "./diplomat-runtime.mjs";
3
+
4
+
5
+
6
+ /**
7
+ * Whether a stage ran and produced a complete result.
8
+ *
9
+ * `Unknown` marks a status this binding version does not recognize.
10
+ */
11
+ export class ZatcaStageStatus {
12
+
13
+ /** @internal */
14
+ static fromValue(value: ZatcaStageStatus | string): ZatcaStageStatus;
15
+
16
+ get value(): string;
17
+
18
+ /** @internal */
19
+ get ffiValue(): number;
20
+
21
+ static Unknown : ZatcaStageStatus;
22
+ /**
23
+ * The stage did not start, typically because an earlier stage failed.
24
+ */
25
+ static NotRun : ZatcaStageStatus;
26
+ /**
27
+ * All checks finished; findings can still contain validation errors.
28
+ */
29
+ static Completed : ZatcaStageStatus;
30
+ /**
31
+ * The profile does not require this stage for the document.
32
+ */
33
+ static NotApplicable : ZatcaStageStatus;
34
+ /**
35
+ * Required caller context was unavailable.
36
+ */
37
+ static ContextRequired : ZatcaStageStatus;
38
+ /**
39
+ * Execution stopped before the stage completed; findings may be partial.
40
+ */
41
+ static EvaluationFailed : ZatcaStageStatus;
42
+
43
+
44
+ constructor(value: ZatcaStageStatus | string );
45
+ }
@@ -0,0 +1,101 @@
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
+ * Whether a stage ran and produced a complete result.
9
+ *
10
+ * `Unknown` marks a status this binding version does not recognize.
11
+ */
12
+ export class ZatcaStageStatus {
13
+ #value = undefined;
14
+
15
+ static #values = new Map([
16
+ ["Unknown", 0],
17
+ ["NotRun", 1],
18
+ ["Completed", 2],
19
+ ["NotApplicable", 3],
20
+ ["ContextRequired", 4],
21
+ ["EvaluationFailed", 5]
22
+ ]);
23
+
24
+ static getAllEntries() {
25
+ return ZatcaStageStatus.#values.entries();
26
+ }
27
+
28
+ #internalConstructor(value) {
29
+ if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
30
+ // We pass in two internalConstructor arguments to create *new*
31
+ // instances of this type, otherwise the enums are treated as singletons.
32
+ if (arguments[1] === diplomatRuntime.internalConstructor ) {
33
+ this.#value = arguments[2];
34
+ return this;
35
+ }
36
+ return ZatcaStageStatus.#objectValues[arguments[1]];
37
+ }
38
+
39
+ if (value instanceof ZatcaStageStatus) {
40
+ return value;
41
+ }
42
+
43
+ let intVal = ZatcaStageStatus.#values.get(value);
44
+
45
+ // Nullish check, checks for null or undefined
46
+ if (intVal != null) {
47
+ return ZatcaStageStatus.#objectValues[intVal];
48
+ }
49
+
50
+ throw TypeError(value + " is not a ZatcaStageStatus and does not correspond to any of its enumerator values.");
51
+ }
52
+
53
+ /** @internal */
54
+ static fromValue(value) {
55
+ return new ZatcaStageStatus(value);
56
+ }
57
+
58
+ get value(){
59
+ return [...ZatcaStageStatus.#values.keys()][this.#value];
60
+ }
61
+
62
+ /** @internal */
63
+ get ffiValue(){
64
+ return this.#value;
65
+ }
66
+ static #objectValues = [
67
+ new ZatcaStageStatus(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
68
+ new ZatcaStageStatus(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
69
+ new ZatcaStageStatus(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
70
+ new ZatcaStageStatus(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
71
+ new ZatcaStageStatus(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
72
+ new ZatcaStageStatus(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
73
+ ];
74
+
75
+ static Unknown = ZatcaStageStatus.#objectValues[0];
76
+ /**
77
+ * The stage did not start, typically because an earlier stage failed.
78
+ */
79
+ static NotRun = ZatcaStageStatus.#objectValues[1];
80
+ /**
81
+ * All checks finished; findings can still contain validation errors.
82
+ */
83
+ static Completed = ZatcaStageStatus.#objectValues[2];
84
+ /**
85
+ * The profile does not require this stage for the document.
86
+ */
87
+ static NotApplicable = ZatcaStageStatus.#objectValues[3];
88
+ /**
89
+ * Required caller context was unavailable.
90
+ */
91
+ static ContextRequired = ZatcaStageStatus.#objectValues[4];
92
+ /**
93
+ * Execution stopped before the stage completed; findings may be partial.
94
+ */
95
+ static EvaluationFailed = ZatcaStageStatus.#objectValues[5];
96
+
97
+
98
+ constructor(value) {
99
+ return this.#internalConstructor(...arguments)
100
+ }
101
+ }
@@ -0,0 +1,63 @@
1
+ // generated by diplomat-tool
2
+ import type { BindingError } from "./BindingError.mjs"
3
+ import type { ZatcaStageReport } from "./ZatcaStageReport.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.mjs";
5
+
6
+
7
+
8
+ /**
9
+ * Owned results of local ZATCA validation with explicit stage coverage.
10
+ *
11
+ * Completion and validity describe only the local profile; they do not
12
+ * establish acceptance by ZATCA or certificate issuer trust.
13
+ */
14
+ export class ZatcaValidationReport {
15
+ /** @internal */
16
+ get ffiValue(): pointer;
17
+ /** @internal */
18
+ constructor();
19
+
20
+
21
+ /**
22
+ * Version of the report's serialized format.
23
+ */
24
+ schemaVersion(): number;
25
+
26
+ /**
27
+ * Identifier of the validation profile (the ZATCA SDK release it mirrors).
28
+ */
29
+ profile(): string;
30
+
31
+ /**
32
+ * RFC 3339 instant used for time-dependent rules.
33
+ */
34
+ evaluatedAt(): string;
35
+
36
+ /**
37
+ * Whether every required stage finished exactly once.
38
+ */
39
+ isComplete(): boolean;
40
+
41
+ /**
42
+ * Whether any stage, including an incomplete stage, reported an error.
43
+ */
44
+ hasErrors(): boolean;
45
+
46
+ /**
47
+ * Whether validation is complete and contains no error findings.
48
+ */
49
+ isValid(): boolean;
50
+
51
+ stagesLen(): number;
52
+
53
+ /**
54
+ * The stage report at `index`, in stage order.
55
+ */
56
+ stage(index: number): ZatcaStageReport;
57
+
58
+ /**
59
+ * The report serialized as JSON, including the derived `is_complete`,
60
+ * `has_errors` and `is_valid` fields.
61
+ */
62
+ toJson(): string;
63
+ }
@@ -0,0 +1,228 @@
1
+ // generated by diplomat-tool
2
+ import { BindingError } from "./BindingError.mjs"
3
+ import { ZatcaStageReport } from "./ZatcaStageReport.mjs"
4
+ import wasm from "./diplomat-wasm.mjs";
5
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
6
+
7
+ const ZatcaValidationReport_box_destroy_registry = new FinalizationRegistry((ptr) => {
8
+ wasm.fatoora_ZatcaValidationReport_destroy(ptr);
9
+ });
10
+
11
+ /**
12
+ * Owned results of local ZATCA validation with explicit stage coverage.
13
+ *
14
+ * Completion and validity describe only the local profile; they do not
15
+ * establish acceptance by ZATCA or certificate issuer trust.
16
+ */
17
+ export class ZatcaValidationReport {
18
+ // Internal ptr reference:
19
+ #ptr = null;
20
+
21
+ // Lifetimes are only to keep dependencies alive.
22
+ // Since JS won't garbage collect until there are no incoming edges.
23
+ #selfEdge = [];
24
+
25
+ #internalConstructor(symbol, ptr, selfEdge) {
26
+ if (symbol !== diplomatRuntime.internalConstructor) {
27
+ console.error("ZatcaValidationReport is an Opaque type. You cannot call its constructor.");
28
+ return;
29
+ }
30
+ this.#ptr = ptr;
31
+ this.#selfEdge = selfEdge;
32
+
33
+ // Are we being borrowed? If not, we can register.
34
+ if (this.#selfEdge.length === 0) {
35
+ ZatcaValidationReport_box_destroy_registry.register(this, this.#ptr);
36
+ }
37
+
38
+ return this;
39
+ }
40
+ /** @internal */
41
+ get ffiValue() {
42
+ return this.#ptr;
43
+ }
44
+
45
+
46
+ /**
47
+ * Version of the report's serialized format.
48
+ */
49
+ schemaVersion() {
50
+
51
+ const result = wasm.fatoora_ZatcaValidationReport_schema_version(this.ffiValue);
52
+
53
+ try {
54
+ return result;
55
+ }
56
+
57
+ finally {
58
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Identifier of the validation profile (the ZATCA SDK release it mirrors).
64
+ */
65
+ profile() {
66
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
67
+
68
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
69
+
70
+
71
+ const result = wasm.fatoora_ZatcaValidationReport_profile(diplomatReceive.buffer, this.ffiValue, write.buffer);
72
+
73
+ try {
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 write.readString8();
79
+ }
80
+
81
+ finally {
82
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
83
+ diplomatReceive.free();
84
+ write.free();
85
+ }
86
+ }
87
+
88
+ /**
89
+ * RFC 3339 instant used for time-dependent rules.
90
+ */
91
+ evaluatedAt() {
92
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
93
+
94
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
95
+
96
+
97
+ const result = wasm.fatoora_ZatcaValidationReport_evaluated_at(diplomatReceive.buffer, this.ffiValue, write.buffer);
98
+
99
+ try {
100
+ if (!diplomatReceive.resultFlag) {
101
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
102
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
103
+ }
104
+ return write.readString8();
105
+ }
106
+
107
+ finally {
108
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
109
+ diplomatReceive.free();
110
+ write.free();
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Whether every required stage finished exactly once.
116
+ */
117
+ isComplete() {
118
+
119
+ const result = wasm.fatoora_ZatcaValidationReport_is_complete(this.ffiValue);
120
+
121
+ try {
122
+ return result;
123
+ }
124
+
125
+ finally {
126
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Whether any stage, including an incomplete stage, reported an error.
132
+ */
133
+ hasErrors() {
134
+
135
+ const result = wasm.fatoora_ZatcaValidationReport_has_errors(this.ffiValue);
136
+
137
+ try {
138
+ return result;
139
+ }
140
+
141
+ finally {
142
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Whether validation is complete and contains no error findings.
148
+ */
149
+ isValid() {
150
+
151
+ const result = wasm.fatoora_ZatcaValidationReport_is_valid(this.ffiValue);
152
+
153
+ try {
154
+ return result;
155
+ }
156
+
157
+ finally {
158
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
159
+ }
160
+ }
161
+
162
+ stagesLen() {
163
+
164
+ const result = wasm.fatoora_ZatcaValidationReport_stages_len(this.ffiValue);
165
+
166
+ try {
167
+ return result;
168
+ }
169
+
170
+ finally {
171
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
172
+ }
173
+ }
174
+
175
+ /**
176
+ * The stage report at `index`, in stage order.
177
+ */
178
+ stage(index) {
179
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
180
+
181
+
182
+ const result = wasm.fatoora_ZatcaValidationReport_stage(diplomatReceive.buffer, this.ffiValue, index);
183
+
184
+ try {
185
+ if (!diplomatReceive.resultFlag) {
186
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
187
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
188
+ }
189
+ return new ZatcaStageReport(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
190
+ }
191
+
192
+ finally {
193
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
194
+ diplomatReceive.free();
195
+ }
196
+ }
197
+
198
+ /**
199
+ * The report serialized as JSON, including the derived `is_complete`,
200
+ * `has_errors` and `is_valid` fields.
201
+ */
202
+ toJson() {
203
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
204
+
205
+ const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
206
+
207
+
208
+ const result = wasm.fatoora_ZatcaValidationReport_to_json(diplomatReceive.buffer, this.ffiValue, write.buffer);
209
+
210
+ try {
211
+ if (!diplomatReceive.resultFlag) {
212
+ const cause = new BindingError(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
213
+ throw new globalThis.Error('BindingError: ' + cause.toString(), { cause });
214
+ }
215
+ return write.readString8();
216
+ }
217
+
218
+ finally {
219
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
220
+ diplomatReceive.free();
221
+ write.free();
222
+ }
223
+ }
224
+
225
+ constructor(symbol, ptr, selfEdge) {
226
+ return this.#internalConstructor(...arguments)
227
+ }
228
+ }