fatoority 0.0.0-stage → 0.4.1

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 (80) hide show
  1. package/LICENSE-APACHE +201 -0
  2. package/LICENSE-MIT +22 -0
  3. package/README.md +75 -2
  4. package/THIRD_PARTY_NOTICES.md +311 -0
  5. package/fatoora_ffi.wasm +0 -0
  6. package/generated/Address.d.mts +32 -0
  7. package/generated/Address.mjs +247 -0
  8. package/generated/BindingError.d.mts +18 -0
  9. package/generated/BindingError.mjs +84 -0
  10. package/generated/Bytes.d.mts +17 -0
  11. package/generated/Bytes.mjs +63 -0
  12. package/generated/BytesList.d.mts +20 -0
  13. package/generated/BytesList.mjs +89 -0
  14. package/generated/ComplianceRequest.d.mts +28 -0
  15. package/generated/ComplianceRequest.mjs +161 -0
  16. package/generated/Config.d.mts +17 -0
  17. package/generated/Config.mjs +75 -0
  18. package/generated/CsidCompliance.d.mts +24 -0
  19. package/generated/CsidCompliance.mjs +148 -0
  20. package/generated/CsidProduction.d.mts +24 -0
  21. package/generated/CsidProduction.mjs +148 -0
  22. package/generated/Csr.d.mts +29 -0
  23. package/generated/Csr.mjs +201 -0
  24. package/generated/CsrProperties.d.mts +21 -0
  25. package/generated/CsrProperties.mjs +122 -0
  26. package/generated/FinalizedInvoice.d.mts +25 -0
  27. package/generated/FinalizedInvoice.mjs +155 -0
  28. package/generated/InvoiceBuilder.d.mts +53 -0
  29. package/generated/InvoiceBuilder.mjs +488 -0
  30. package/generated/InvoiceData.d.mts +60 -0
  31. package/generated/InvoiceData.mjs +449 -0
  32. package/generated/InvoiceLineItem.d.mts +29 -0
  33. package/generated/InvoiceLineItem.mjs +216 -0
  34. package/generated/InvoiceNote.d.mts +17 -0
  35. package/generated/InvoiceNote.mjs +88 -0
  36. package/generated/InvoiceOutcome.d.mts +22 -0
  37. package/generated/InvoiceOutcome.mjs +72 -0
  38. package/generated/InvoiceRequest.d.mts +28 -0
  39. package/generated/InvoiceRequest.mjs +161 -0
  40. package/generated/InvoiceTotals.d.mts +31 -0
  41. package/generated/InvoiceTotals.mjs +249 -0
  42. package/generated/OriginalInvoiceRef.d.mts +20 -0
  43. package/generated/OriginalInvoiceRef.mjs +106 -0
  44. package/generated/OtherId.d.mts +18 -0
  45. package/generated/OtherId.mjs +86 -0
  46. package/generated/Party.d.mts +24 -0
  47. package/generated/Party.mjs +128 -0
  48. package/generated/ProductionRequest.d.mts +28 -0
  49. package/generated/ProductionRequest.mjs +161 -0
  50. package/generated/SignedInvoice.d.mts +50 -0
  51. package/generated/SignedInvoice.mjs +429 -0
  52. package/generated/Signer.d.mts +28 -0
  53. package/generated/Signer.mjs +188 -0
  54. package/generated/SigningKey.d.mts +24 -0
  55. package/generated/SigningKey.mjs +156 -0
  56. package/generated/Text.d.mts +15 -0
  57. package/generated/Text.mjs +65 -0
  58. package/generated/ValidationMessage.d.mts +24 -0
  59. package/generated/ValidationMessage.mjs +143 -0
  60. package/generated/ValidationResponse.d.mts +36 -0
  61. package/generated/ValidationResponse.mjs +236 -0
  62. package/generated/ValidationResults.d.mts +29 -0
  63. package/generated/ValidationResults.mjs +163 -0
  64. package/generated/VatId.d.mts +15 -0
  65. package/generated/VatId.mjs +65 -0
  66. package/generated/Xml.d.mts +24 -0
  67. package/generated/Xml.mjs +128 -0
  68. package/generated/ZatcaClient.d.mts +35 -0
  69. package/generated/ZatcaClient.mjs +208 -0
  70. package/generated/diplomat-runtime.d.mts +15 -0
  71. package/generated/diplomat-runtime.mjs +778 -0
  72. package/generated/diplomat-wasm.mjs +29 -0
  73. package/generated/index.d.mts +67 -0
  74. package/generated/index.mjs +70 -0
  75. package/index.d.mts +21 -0
  76. package/index.mjs +77 -0
  77. package/licenses/zatca/LICENSE-GPL-3.0.txt +674 -0
  78. package/licenses/zatca/LICENSE-LGPL-3.0.txt +56 -0
  79. package/licenses/zatca/NOTICE.md +33 -0
  80. package/package.json +40 -4
package/LICENSE-APACHE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/LICENSE-MIT ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mohamad Alsadhan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,3 +1,76 @@
1
- # Temporary Holding Version
1
+ # Fatoority JavaScript / TypeScript
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ES modules backed by Diplomat 0.16.1 and WebAssembly. Supports Node 22+ and modern browsers with WebAssembly, Web Crypto, FinalizationRegistry and top-level await.
4
+
5
+ Build from the repository root:
6
+
7
+ ```sh
8
+ rustup target add wasm32-unknown-unknown
9
+ cargo install diplomat-tool --version 0.16.1 --locked
10
+ npm ci --prefix bindings/js
11
+ python3 scripts/generate_bindings.py
12
+ python3 scripts/build_js.py
13
+ npm run check --prefix bindings/js
14
+ node bindings/js/tests/runtime.test.mjs
15
+ python3 scripts/check_js_package.py
16
+ ```
17
+
18
+ Build a local tarball with `npm pack` in `bindings/js`. Version tags publish the tested package to npm through GitHub Actions.
19
+
20
+ See the [JS/TS reference](https://docs.fatoority.com/reference/bindings/javascript/) for complete installation, browser deployment and API examples.
21
+
22
+ ```js
23
+ import { Config, SigningKey, CsidCompliance, ZatcaClient } from 'fatoority';
24
+
25
+ const key = SigningKey.generate();
26
+ const config = Config.new_(0); // 0: nonproduction, 1: simulation, 2: production
27
+ const client = new ZatcaClient(config);
28
+ const compliance = CsidCompliance.create(0, 'request-id', 'token', 'secret');
29
+ const production = await client.postCcsidForPcsid(compliance, {
30
+ signal: AbortSignal.timeout(30_000),
31
+ });
32
+ ```
33
+
34
+ API methods prepare requests and decode responses in Rust; the facade calls `fetch`. Inject a fetch implementation with `new ZatcaClient(config, {fetch})`. Requests refuse redirects. HTTP errors go to Rust decoding, and a successful invoice HTTP response still requires `response.ensureAccepted()` or inspection of `response.outcome()`.
35
+
36
+ For your own transport, import `ZatcaClient` from `fatoority/raw`, call a `prepare*` method, and read `method()`, `url()`, `headersJson()` (an array of header pairs), and `body().asSlice()`. Complete with `request.decode(status, bytes)`, or use `sendPrepared(request, {fetch, signal})`. The request owns its data and the operation/environment needed for decoding. It contains authorization headers and must not be logged.
37
+
38
+ The generated API preserves Rust names in camelCase; a Rust `new` constructor is `new_`. Decimal arguments and outputs are strings, and invoice counters are `bigint`. Optional strings use `null`, distinct from `''`. Consuming operations such as `build()`, signing and `intoXml()` reject reuse. Generated owners are released by FinalizationRegistry; do not manually free pointers or share handles between workers. Byte slices returned by the generated JS are copies. The facade snapshots outgoing bytes before awaiting the network.
39
+
40
+ Generated Rust errors are JavaScript `Error` objects whose `cause` is a `BindingError`. Inspect `error.cause.code()`, `.message()` and `.detailsJson()`. Network, cancellation and response-body read failures throw `TransportError`, retaining the original cause and, when available, `httpStatus`.
41
+
42
+ `Xml.validateZatca(config, xml, optionsJson)` supplies the host clock when `evaluated_at` is absent. An explicit timestamp makes validation reproducible. The raw API requires `evaluated_at` on WASM. Filesystem helpers are excluded from JS; read files in the host and pass their contents.
43
+
44
+ The browser loader resolves `fatoora_ffi.wasm` relative to the package modules. Deploy the generated modules and WASM together, or configure the bundler to copy the WASM at that URL. Direct gateway requests depend on the gateway's CORS policy. Keep signing keys and credentials in the host environment appropriate to your application.
45
+
46
+ If you set `RUSTFLAGS` or `CARGO_ENCODED_RUSTFLAGS`, retain `--cfg getrandom_backend="custom"`: these override `.cargo/config.toml` and otherwise break the WASM random backend.
47
+
48
+ The WASM build uses getrandom's custom backend with Web Crypto. `xsd-schema` transitively enables Chrono's wasm-bindgen features; the pinned Binaryen step removes unused descriptor exports and maps its retained UTF-8 throw helper to Diplomat's equivalent host import. The build fails if any unsupported import remains, including a JS clock or wasm-bindgen object runtime. Native transport and clock behavior use the normal Rust dependencies.
49
+
50
+ ## Licensing
51
+
52
+ This package follows the native CLI/FFI archives and Python wheels: the compiled
53
+ validator includes SDK-derived rule predicates and messages, and the upstream
54
+ notices are distributed with it. This is not an entirely MIT/Apache-2.0 artifact.
55
+
56
+ Original project code is `MIT OR Apache-2.0`. The 257 translated assertion sites
57
+ and imported messages retain the terms recorded for ZATCA SDK `238-R3.4.8`,
58
+ including LGPL v3. The included GPL v3 text is incorporated by LGPL v3; its
59
+ presence is not a separate relicensing of all project code. The SDK's CEN
60
+ stylesheet claims LGPL v3 through EUPL compatibility; the exact upstream revision
61
+ and conversion basis remain unverified, as recorded in the existing native notices.
62
+
63
+ The npm `license` field points to [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
64
+ Read that file and [licenses/zatca/NOTICE.md](licenses/zatca/NOTICE.md), alongside
65
+ [LGPL v3](licenses/zatca/LICENSE-LGPL-3.0.txt) and
66
+ [GPL v3](licenses/zatca/LICENSE-GPL-3.0.txt). Copying notices alone does not resolve
67
+ all distribution obligations; downstream distribution must account for the
68
+ applicable source and relinking requirements. The source and build instructions
69
+ are in the [Fatoority repository](https://github.com/mqqz/fatoority), with versioned
70
+ source under the corresponding release tag. No ZATCA SDK JAR is bundled.
71
+
72
+ ## WASM size
73
+
74
+ The measured package is 3.525 MB raw and 1.512 MB gzipped, down from an 8.974 MB Rust release artifact. `scripts/build_js.py` selects `wasm-release` (`opt-level = "z"`, LTO, one codegen unit and symbol stripping), runs pinned Binaryen `wasm-opt -Oz`, and rejects artifacts above 4 MB raw or 1.8 MB gzip.
75
+
76
+ The 15 UBL schemas originally totalled 2,996,782 bytes. WASM embeds them with lossless compression; each build verifies that decompression reproduces every source byte. Unicode regex behavior remains enabled. Run `python3 scripts/check_wasm_size.py --json` to inspect code/data sections and transfer size. Schema compilation still requires decompressed data in memory.
@@ -0,0 +1,311 @@
1
+ # Third-party notices
2
+
3
+ Original fatoority code is available under `MIT OR Apache-2.0`. The materials
4
+ below retain their applicable upstream terms. Paths are relative to the repository
5
+ root; a package may contain only a subset. Existing file notices must be retained.
6
+
7
+ Source comparisons used ZATCA Java SDK `238-R3.4.8` on 2026-09-11. The source
8
+ references below identify upstream materials and distinguish project changes.
9
+
10
+ ## UBL schemas
11
+
12
+ Files: `fatoora-core/assets/schemas/UBL2.1/xsd/`.
13
+ Source: [OASIS UBL 2.1 OS, 4 November 2013](https://docs.oasis-open.org/ubl/os-UBL-2.1/),
14
+ obtained through the [ZATCA SDK](https://zatca.gov.sa/en/E-Invoicing/SystemsDevelopers/ComplianceEnablementToolbox/Pages/DownloadSDK.aspx).
15
+
16
+ The eleven OASIS schemas carry Copyright (c) OASIS Open 2013 and their full
17
+ permission notices. They match the SDK copies without modification. The four
18
+ files below have separate upstream origins:
19
+
20
+ - `common/CCTS_CCT_SchemaModule-2.1.xsd`: Copyright (C) UN/CEFACT (2006).
21
+ Unmodified SDK copy; the full permission notice is embedded in the file.
22
+ - `common/UBL-XAdESv132-2.1.xsd` and `common/UBL-XAdESv141-2.1.xsd`: OASIS adaptations
23
+ of [ETSI XAdES v1.3.2](https://uri.etsi.org/01903/v1.3.2/XAdES.xsd) and
24
+ [v1.4.1](https://uri.etsi.org/01903/v1.4.1/XAdESv141.xsd). Our copies match the
25
+ official OASIS UBL 2.1 files byte-for-byte:
26
+ [v1.3.2](https://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/common/UBL-XAdESv132-2.1.xsd)
27
+ and [v1.4.1](https://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/common/UBL-XAdESv141-2.1.xsd).
28
+ The OASIS headers are retained. ETSI publishes BSD-3-Clause terms with its
29
+ XAdES repository; that notice is reproduced below with its source version.
30
+ - `common/UBL-xmldsig-core-schema-2.1.xsd`: derived from the W3C XML Signature
31
+ schema. Copyright 2001 The Internet Society and W3C (Massachusetts Institute
32
+ of Technology, Institut National de Recherche en Informatique et en
33
+ Automatique, Keio University). All Rights Reserved. OASIS's DOCTYPE changes
34
+ are described in the file header. Mohamad Alsadhan modified the serial-number
35
+ type on 2025-12-18 (commit `1fc08cdcfc5d34bda07b56aba4c9dd1aa7a63d6d`), adding
36
+ `X509SerialNumberString` with pattern `[0-9]+` and using it instead of `integer`
37
+ for `X509SerialNumber`. The applicable W3C notice follows.
38
+
39
+ ### ETSI XAdES repository notice (BSD-3-Clause)
40
+
41
+ Source: [ETSI XAdES repository, tag v1.3.1](https://forge.etsi.org/rep/esi/x19_13201_xades/-/raw/v1.3.1/LICENSE).
42
+ This notice comes from the 2024 repository release; the bundled schemas remain
43
+ the unchanged OASIS UBL 2.1 copies from 2013.
44
+
45
+ Copyright 2024 ETSI
46
+
47
+ Redistribution and use in source and binary forms, with or without
48
+ modification, are permitted provided that the following conditions are met:
49
+
50
+ 1. Redistributions of source code must retain the above copyright notice,
51
+ this list of conditions and the following disclaimer.
52
+ 2. Redistributions in binary form must reproduce the above copyright notice,
53
+ this list of conditions and the following disclaimer in the documentation
54
+ and/or other materials provided with the distribution.
55
+ 3. Neither the name of the copyright holder nor the names of its contributors
56
+ may be used to endorse or promote products derived from this software without
57
+ specific prior written permission.
58
+
59
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
60
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
61
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
62
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
63
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
64
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
65
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
66
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
67
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
68
+ OF THE POSSIBILITY OF SUCH DAMAGE.
69
+
70
+ ### W3C SOFTWARE NOTICE AND LICENSE
71
+
72
+ Source: <https://www.w3.org/Consortium/Legal/copyright-software-19980720>.
73
+
74
+ Copyright © 1994-2002 World Wide Web Consortium, (Massachusetts Institute of
75
+ Technology, Institut National de Recherche en Informatique et en Automatique,
76
+ Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/
77
+
78
+ This W3C work (including software, documents, or other related items) is being
79
+ provided by the copyright holders under the following license. By obtaining,
80
+ using and/or copying this work, you (the licensee) agree that you have read,
81
+ understood, and will comply with the following terms and conditions:
82
+
83
+ Permission to use, copy, modify, and distribute this software and its
84
+ documentation, with or without modification, for any purpose and without fee or
85
+ royalty is hereby granted, provided that you include the following on ALL copies
86
+ of the software and documentation or portions thereof, including modifications,
87
+ that you make:
88
+
89
+ 1. The full text of this NOTICE in a location viewable to users of the
90
+ redistributed or derivative work.
91
+ 2. Any pre-existing intellectual property disclaimers, notices, or terms and
92
+ conditions. If none exist, a short notice of the following form (hypertext
93
+ is preferred, text is permitted) should be used within the body of any
94
+ redistributed or derivative code: "Copyright © [$date-of-software] World Wide
95
+ Web Consortium, (Massachusetts Institute of Technology, Institut National de
96
+ Recherche en Informatique et en Automatique, Keio University). All Rights
97
+ Reserved. http://www.w3.org/Consortium/Legal/"
98
+ 3. Notice of any changes or modifications to the W3C files, including the date
99
+ changes were made. (We recommend you provide URIs to the location from which
100
+ the code is derived.)
101
+
102
+ THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
103
+ NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
104
+ TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
105
+ THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
106
+ PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
107
+
108
+ COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
109
+ CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
110
+
111
+ The name and trademarks of copyright holders may NOT be used in advertising or
112
+ publicity pertaining to the software without specific, written prior permission.
113
+ Title to copyright in this software and any associated documentation will at all
114
+ times remain with copyright holders.
115
+
116
+ ## ZATCA test samples
117
+
118
+ Source: ZATCA Java SDK `238-R3.4.8`, linked above.
119
+
120
+ | Repository files under `fatoora-core/tests/fixtures/` | SDK source | Changes |
121
+ | --- | --- | --- |
122
+ | `invoices/Standard/**` and `invoices/Simplified/**` (19 XML files) | Corresponding paths under `Data/Samples/` | None |
123
+ | `invoices/sample-simplified-invoice.xml` | `Data/Samples/Simplified/Invoice/Simplified_Invoice.xml` | Added final newline |
124
+ | `csr-configs/*.properties` (5 files) | Corresponding files under `Data/Input/` | None |
125
+ | `certs/zatca_cert_b64.txt` | `Data/Certificates/cert.pem` | Local double-base64 and SDK single-base64 decode to identical certificate DER |
126
+ | `pkeys/test_zatca_pkey.der` | `Data/Certificates/ec-secp256k1-priv-key.pem` | Local DER and SDK base64-encoded PEM have the same public-key identity |
127
+
128
+ The SDK ships `LICENSE.txt` containing the
129
+ [GNU Lesser General Public License, version 3](https://www.gnu.org/licenses/lgpl-3.0.html),
130
+ which incorporates the [GNU GPL, version 3](https://www.gnu.org/licenses/gpl-3.0.html).
131
+ The sample files carry no separate file-specific license notice. These links
132
+ record the license supplied with the source SDK; the samples are not relicensed
133
+ under the project's MIT/Apache-2.0 terms.
134
+
135
+ The SDK parity corpus under `fatoora-core/tests/fixtures/sdk-parity/` additionally
136
+ records CLI outputs, signed XML, generated test CSRs/keys, canonical bytes, and
137
+ SignedProperties preimages produced by SDK `238-R3.4.8`. Each case's manifest
138
+ entry identifies its input source. The payable-rounding, exempt, zero-rated,
139
+ and document-charge inputs reuse the existing SDK XML samples; CSR inputs reuse
140
+ its English/Arabic properties. The certificate/key are the existing dummy test
141
+ credentials in decoded DER form. The upstream attribution and SDK license
142
+ reference above also apply to these source materials. No SDK JAR or executable
143
+ is bundled.
144
+ The Java adapters in `scripts/sdk-parity/` are repository-authored test tooling.
145
+
146
+ The business-rule development corpus under
147
+ `fatoora-core/tests/fixtures/business-rules/` includes structured extractions of
148
+ the SDK's CEN and Saudi rule stylesheets, findings extracted from the parity logs,
149
+ and targeted invoice mutations with official SDK validation output. Its
150
+ `NOTICE.md` identifies the exact source files and representation changes; source
151
+ hashes are recorded in `catalog.json`. The SDK's LGPL v3 text and the incorporated
152
+ GPL v3 text accompany those materials. Imported rules and messages retain their
153
+ upstream terms. Extraction and capture scripts are repository-authored. No SDK
154
+ JAR or executable is included.
155
+
156
+ The rule-family modules in
157
+ `fatoora-core/src/invoice/validation/business_rules/` translate all 257 assertion
158
+ sites from those pinned SDK stylesheets into Rust. Its `metadata.rs` retains
159
+ the corresponding rule identifiers and messages. The source-site mapping and
160
+ tests are recorded in the corpus coverage ledger. The imported predicates and
161
+ messages retain the upstream terms described above; the general XML, numeric,
162
+ and reporting infrastructure is project-authored. Python wheels include the SDK
163
+ rule notices and LGPL/GPL texts under `fatoora/licenses/zatca/`. Native CLI and FFI
164
+ archives include the same files under `licenses/zatca/`. The npm WASM package
165
+ compiles these rule predicates and messages too and includes the same files under
166
+ `licenses/zatca/`. Its package license field points to this notice because the
167
+ project license does not replace these upstream terms.
168
+
169
+ ## Templates
170
+
171
+ `fatoora-core/assets/templates/*.xml` (3 files) were made by Mohamad Alsadhan,
172
+ adapted from ZATCA examples, as confirmed by the author on 2026-09-18. Related
173
+ XML fragments are used in `fatoora-core/src/invoice/sign.rs`. The author's
174
+ project contributions use the project's `MIT OR Apache-2.0` terms; the ZATCA
175
+ source attribution and upstream terms above are retained for adapted material.
176
+
177
+ ## Other repository materials
178
+
179
+ - `fatoora-core/tests/fixtures/csrs/test_zatca_en1.csr`: base64-encoded DER test
180
+ CSR, checked into the project by Mohamad Alsadhan. Its public key differs
181
+ from the SDK sample key; the original generation command was not recorded.
182
+ - `docs/assets/images/crab-logo.{svg,png,webp}`: project artwork adapting
183
+ [Ferris](https://www.rustacean.net/) by Karen Rustad Tölva. The upstream author
184
+ has waived all copyright and related or neighboring rights to Ferris to the
185
+ extent possible under law. The project artwork was added by Mohamad Alsadhan
186
+ in commit `f442a3e`; the exact base-image variant was not recorded.
187
+ - `CODE_OF_CONDUCT.md`: adapted from
188
+ [Contributor Covenant version 2.0](https://www.contributor-covenant.org/version/2/0/code_of_conduct/),
189
+ originally authored by Coraline Ada Ehmke, under
190
+ [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
191
+ The [upstream license before version 3](https://github.com/EthicalSource/contributor_covenant/blob/91532d80ea5f39b6685aff4892bc6854bf2f6d6f/LICENSE.md)
192
+ records that grant. The enforcement contact was set for this project.
193
+ Existing attribution, including the Mozilla enforcement-ladder reference,
194
+ is retained.
195
+
196
+ ## Native dependencies
197
+
198
+ Native binaries and Python wheels use the Rust XML implementations and do not
199
+ link or bundle libxml2. The isolated compatibility maintenance tools under
200
+ `scripts/xml-reference` and `scripts/xsd-compat` retain libxml2 as a reference
201
+ oracle; they are not distributed with the library.
202
+
203
+ ## Historical files
204
+
205
+ The current tree contains no Schematron XSL files or PDF-A3 invoice samples.
206
+ The following source notes concern files retained only in Git history:
207
+
208
+ - `fatoora-core/assets/schematrons/CEN-EN16931-UBL.xsl`: matches SDK `238-R3.4.8`;
209
+ its header claims LGPL v3 through EUPL 1.2 compatibility. The exact upstream
210
+ revision and basis for that conversion remain unverified.
211
+ - `fatoora-core/assets/schematrons/20210819_ZATCA_E-invoice_Validation_Rules.xsl`:
212
+ header declares Copyright 2021 ZATCA, LGPL v3; differs from SDK `238-R3.4.8`.
213
+ Both XSL files were removed in commit `8ffeccf153428f262c56c256046416b67fda0d42`.
214
+ - `fatoora-core/tests/fixtures/invoices/PDF-A3/*.pdf` (16 files): exact SDK sample
215
+ copies removed in commit `bb473ec`; see the SDK license reference above.
216
+
217
+ For old distributions containing the stylesheets, review the applicable LGPL/GPL
218
+ texts and source requirements. This notice does not retroactively update those
219
+ archives.
220
+
221
+ ## Diplomat runtime and generated bindings
222
+
223
+ Diplomat macro/tool 0.16.1 and runtime 0.16.0: https://github.com/rust-diplomat/diplomat.
224
+ The generated C/C++ runtime headers and Rust runtime retain these MIT terms.
225
+
226
+ MIT License
227
+
228
+ Copyright (c) 2022 The Diplomat Developers
229
+
230
+ Permission is hereby granted, free of charge, to any
231
+ person obtaining a copy of this software and associated
232
+ documentation files (the "Software"), to deal in the
233
+ Software without restriction, including without
234
+ limitation the rights to use, copy, modify, merge,
235
+ publish, distribute, sublicense, and/or sell copies of
236
+ the Software, and to permit persons to whom the Software
237
+ is furnished to do so, subject to the following
238
+ conditions:
239
+
240
+ The above copyright notice and this permission notice
241
+ shall be included in all copies or substantial portions
242
+ of the Software.
243
+
244
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
245
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
246
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
247
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
248
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
249
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
250
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
251
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
252
+ DEALINGS IN THE SOFTWARE.
253
+
254
+ ## Python native extension
255
+
256
+ The Python wheel links Nanobind 2.12.0 (https://github.com/wjakob/nanobind)
257
+ and its bundled robin-map headers (https://github.com/Tessil/robin-map).
258
+ The following notices are copied from that Nanobind distribution.
259
+
260
+ ### Nanobind
261
+
262
+ Copyright (c) 2022 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved.
263
+
264
+ Redistribution and use in source and binary forms, with or without
265
+ modification, are permitted provided that the following conditions are met:
266
+
267
+ 1. Redistributions of source code must retain the above copyright notice, this
268
+ list of conditions and the following disclaimer.
269
+
270
+ 2. Redistributions in binary form must reproduce the above copyright notice,
271
+ this list of conditions and the following disclaimer in the documentation
272
+ and/or other materials provided with the distribution.
273
+
274
+ 3. Neither the name of the copyright holder nor the names of its contributors
275
+ may be used to endorse or promote products derived from this software
276
+ without specific prior written permission.
277
+
278
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
279
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
280
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
281
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
282
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
283
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
284
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
285
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
286
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
287
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
288
+
289
+ ### robin-map
290
+
291
+ MIT License
292
+
293
+ Copyright (c) 2017 Thibaut Goetghebuer-Planchon <tessil@gmx.com>
294
+
295
+ Permission is hereby granted, free of charge, to any person obtaining a copy
296
+ of this software and associated documentation files (the "Software"), to deal
297
+ in the Software without restriction, including without limitation the rights
298
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
299
+ copies of the Software, and to permit persons to whom the Software is
300
+ furnished to do so, subject to the following conditions:
301
+
302
+ The above copyright notice and this permission notice shall be included in
303
+ all copies or substantial portions of the Software.
304
+
305
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
306
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
307
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
308
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
309
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
310
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
311
+ SOFTWARE.
Binary file
@@ -0,0 +1,32 @@
1
+ // generated by diplomat-tool
2
+ import type { BindingError } from "./BindingError.mjs"
3
+ import type { Text } from "./Text.mjs"
4
+ import type { pointer, codepoint } from "./diplomat-runtime.mjs";
5
+
6
+
7
+
8
+ export class Address {
9
+ /** @internal */
10
+ get ffiValue(): pointer;
11
+ /** @internal */
12
+ constructor();
13
+
14
+
15
+ static new_(countryCode: string, city: string, street: string, buildingNumber: string, postalCode: string, additionalStreet: string | null, additionalNumber: string | null, district: string | null): Address;
16
+
17
+ city(): string;
18
+
19
+ street(): string;
20
+
21
+ buildingNumber(): string;
22
+
23
+ postalCode(): string;
24
+
25
+ countryCode(): string;
26
+
27
+ additionalStreet(): Text | null;
28
+
29
+ additionalNumber(): Text | null;
30
+
31
+ district(): Text | null;
32
+ }