@endevops/peppol-schema 0.1.3 → 0.1.4

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 (174) hide show
  1. package/README.md +5 -5
  2. package/dist/constants.d.ts +131 -0
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +114 -1
  5. package/dist/constants.js.map +1 -1
  6. package/dist/{index-BBzPjq7o.d.ts → index-CILtZytZ.d.ts} +1710 -669
  7. package/dist/index-CILtZytZ.d.ts.map +1 -0
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +1234 -187
  10. package/dist/index.js.map +1 -1
  11. package/dist/invoice-response-code-not-needs-schema-DNrfKYLh.js +36 -0
  12. package/dist/invoice-response-code-not-needs-schema-DNrfKYLh.js.map +1 -0
  13. package/dist/invoice-response-codes.d.ts +28 -0
  14. package/dist/invoice-response-codes.d.ts.map +1 -1
  15. package/dist/invoice-response-codes.js +11 -1
  16. package/dist/invoice-response-codes.js.map +1 -1
  17. package/dist/{is-valid-abn-160i38PG.js → is-valid-abn-D7eSygBG.js} +115 -2
  18. package/dist/is-valid-abn-D7eSygBG.js.map +1 -0
  19. package/dist/{is-valid-mod97-0208-CzMOXMO-.js → is-valid-mod97-0208-CjR324eG.js} +11 -1
  20. package/dist/is-valid-mod97-0208-CjR324eG.js.map +1 -0
  21. package/dist/message-level-response-profile-id-B9c0A7S_.js +27 -0
  22. package/dist/message-level-response-profile-id-B9c0A7S_.js.map +1 -0
  23. package/dist/{nodable-parser-CyDZtLCK.js → nodable-parser-CupS2H55.js} +31 -1
  24. package/dist/nodable-parser-CupS2H55.js.map +1 -0
  25. package/dist/schematron.d.ts +57 -1
  26. package/dist/schematron.d.ts.map +1 -1
  27. package/dist/schematron.js +453 -2
  28. package/dist/schematron.js.map +1 -1
  29. package/dist/validations.d.ts +132 -0
  30. package/dist/validations.d.ts.map +1 -1
  31. package/dist/validations.js +11 -2
  32. package/dist/validations.js.map +1 -1
  33. package/dist/values.d.ts +67 -2
  34. package/dist/values.d.ts.map +1 -1
  35. package/dist/xml.d.ts +30 -0
  36. package/dist/xml.d.ts.map +1 -1
  37. package/dist/xml.js +10 -1
  38. package/dist/xml.js.map +1 -1
  39. package/package.json +1 -1
  40. package/src/constants/credit-note-doctype-id.ts +9 -0
  41. package/src/constants/credit-note-process-id.ts +9 -0
  42. package/src/constants/document-scheme.ts +9 -0
  43. package/src/constants/invoice-doctype-id.ts +9 -0
  44. package/src/constants/invoice-process-id.ts +10 -0
  45. package/src/constants/invoice-response-doctype-id.ts +10 -0
  46. package/src/constants/invoice-response-process-id.ts +9 -0
  47. package/src/constants/invoice-response-profile-id.ts +9 -0
  48. package/src/constants/message-level-response-doctype-id.ts +10 -0
  49. package/src/constants/message-level-response-process-id.ts +9 -0
  50. package/src/constants/message-level-response-profile-id.ts +9 -0
  51. package/src/constants/participant-scheme.ts +10 -0
  52. package/src/constants/process-scheme.ts +9 -0
  53. package/src/constants/transport-profile.ts +10 -0
  54. package/src/invoice-response-codes/invoice-response-code-needs-schema.ts +9 -0
  55. package/src/invoice-response-codes/invoice-response-code-not-needs-schema.ts +9 -0
  56. package/src/invoice-response-codes/invoice-response-codes-order.ts +10 -0
  57. package/src/peppol-validations/add-piva.ts +12 -0
  58. package/src/peppol-validations/check-cf.ts +11 -0
  59. package/src/peppol-validations/check-cf16.ts +12 -0
  60. package/src/peppol-validations/check-piva-se-it.ts +11 -0
  61. package/src/peppol-validations/check-piva.ts +11 -0
  62. package/src/peppol-validations/check-se-orgnr.ts +9 -0
  63. package/src/peppol-validations/greek-tin-verification.ts +9 -0
  64. package/src/peppol-validations/is-valid-abn.ts +9 -0
  65. package/src/peppol-validations/is-valid-gln.ts +10 -0
  66. package/src/peppol-validations/is-valid-iban.ts +10 -0
  67. package/src/peppol-validations/is-valid-mod11.ts +9 -0
  68. package/src/peppol-validations/is-valid-mod97-0208.ts +10 -0
  69. package/src/peppol-validations/luhn-check.ts +9 -0
  70. package/src/schemas/fields/default-customization-id.ts +9 -0
  71. package/src/schemas/fields/default-profile-id.ts +9 -0
  72. package/src/schemas/fields/peppol-additional-document-reference-schema.ts +41 -2
  73. package/src/schemas/fields/peppol-address-schema.ts +25 -2
  74. package/src/schemas/fields/peppol-allowance-charge-schema.ts +65 -9
  75. package/src/schemas/fields/peppol-amount-schema.ts +15 -2
  76. package/src/schemas/fields/peppol-base-line-schema.ts +12 -2
  77. package/src/schemas/fields/peppol-billing-reference-schema.ts +13 -0
  78. package/src/schemas/fields/peppol-binary-object-schema.ts +12 -4
  79. package/src/schemas/fields/peppol-contact-schema.ts +11 -0
  80. package/src/schemas/fields/peppol-credit-note-line-schema.ts +7 -2
  81. package/src/schemas/fields/peppol-delivery-schema.ts +44 -2
  82. package/src/schemas/fields/peppol-identifier-schema.ts +8 -0
  83. package/src/schemas/fields/peppol-invoice-line-period-schema.ts +11 -0
  84. package/src/schemas/fields/peppol-invoice-line-schema.ts +9 -2
  85. package/src/schemas/fields/peppol-invoice-period-schema.ts +2 -2
  86. package/src/schemas/fields/peppol-item-classification-schema.ts +2 -2
  87. package/src/schemas/fields/peppol-line-allowance-charge-schema.ts +57 -9
  88. package/src/schemas/fields/peppol-line-item-schema.ts +69 -4
  89. package/src/schemas/fields/peppol-line-price-allowance-charge-schema.ts +20 -0
  90. package/src/schemas/fields/peppol-line-price-schema.ts +2 -0
  91. package/src/schemas/fields/peppol-order-reference-schema.ts +2 -0
  92. package/src/schemas/fields/peppol-party-base-schema.ts +36 -4
  93. package/src/schemas/fields/peppol-party-legal-entity-schema.ts +13 -0
  94. package/src/schemas/fields/peppol-party-tax-scheme-schema.ts +5 -0
  95. package/src/schemas/fields/peppol-payee-party-schema.ts +2 -2
  96. package/src/schemas/fields/peppol-payment-means-schema.ts +62 -2
  97. package/src/schemas/fields/peppol-payment-terms-schema.ts +2 -0
  98. package/src/schemas/fields/peppol-quantity-schema.ts +4 -2
  99. package/src/schemas/fields/peppol-reference-schema.ts +20 -1
  100. package/src/schemas/fields/peppol-tax-category-schema.ts +12 -2
  101. package/src/schemas/fields/peppol-tax-representative-schema.ts +5 -0
  102. package/src/schemas/fields/peppol-tax-subtotal-category-schema.ts +3 -0
  103. package/src/schemas/fields/peppol-tax-subtotal-schema.ts +2 -0
  104. package/src/schemas/fields/peppol-tax-totals-base-schema.ts +5 -0
  105. package/src/schemas/peppol-billing-base-schema.ts +47 -7
  106. package/src/schemas/peppol-credit-note-schema.ts +2 -2
  107. package/src/schemas/peppol-document-response-document-reference-schema.ts +15 -2
  108. package/src/schemas/peppol-document-response-document-schema.ts +8 -3
  109. package/src/schemas/peppol-document-response-line-response-content-schema.ts +22 -2
  110. package/src/schemas/peppol-document-response-line-response-schema.ts +26 -0
  111. package/src/schemas/peppol-document-schema.ts +74 -9
  112. package/src/schemas/peppol-invoice-response-document-actual-response-schema.ts +58 -5
  113. package/src/schemas/peppol-invoice-response-document-actual-response-status-schema.ts +25 -2
  114. package/src/schemas/peppol-invoice-response-schema.ts +57 -4
  115. package/src/schemas/peppol-invoice-response-status-reason-code-schema.ts +37 -10
  116. package/src/schemas/peppol-invoice-schema.ts +30 -2
  117. package/src/schemas/peppol-message-level-response-document-response-schema.ts +10 -0
  118. package/src/schemas/peppol-message-level-response-party-schema.ts +10 -0
  119. package/src/schemas/peppol-message-level-response-schema.ts +18 -0
  120. package/src/schemas/utils/format-quantity-with-unit.ts +19 -0
  121. package/src/schemas/utils/get-credit-note-type-code-description.ts +12 -0
  122. package/src/schemas/utils/get-invoice-type-code-description.ts +12 -0
  123. package/src/schemas/utils/is-valid-credit-note-type-code.ts +13 -0
  124. package/src/schemas/utils/is-valid-invoice-type-code.ts +13 -0
  125. package/src/schemas/utils/is-valid-process.ts +13 -0
  126. package/src/schemas/utils/peppol-base-64-schema.ts +14 -4
  127. package/src/schemas/utils/peppol-vat-regex-schema.ts +38 -30
  128. package/src/schemas/utils/peppol-xsd-time-schema.ts +12 -2
  129. package/src/schemas/utils/quantity-unit-code-to-intl-unit.ts +34 -0
  130. package/src/schemas/values/additional-document-reference-code-schema.ts +9 -15
  131. package/src/schemas/values/allowance-charge-reason-code-schema.ts +12 -14
  132. package/src/schemas/values/application-response-type-code-schema.ts +10 -14
  133. package/src/schemas/values/charge-reason-code-schema.ts +12 -14
  134. package/src/schemas/values/credit-note-type-code-schema.ts +8 -14
  135. package/src/schemas/values/currency-code-schema.ts +13 -16
  136. package/src/schemas/values/document-type-schemes-schema.ts +9 -5
  137. package/src/schemas/values/document-type-values-schema.ts +5 -6
  138. package/src/schemas/values/duty-tax-fee-category-schema.ts +15 -13
  139. package/src/schemas/values/electronic-codes-schema.ts +10 -12
  140. package/src/schemas/values/icd-codes-schema.ts +8 -12
  141. package/src/schemas/values/invoice-status-code-schema.ts +10 -12
  142. package/src/schemas/values/invoice-type-code-schema.ts +10 -12
  143. package/src/schemas/values/item-classification-codes-schema.ts +10 -12
  144. package/src/schemas/values/mime-codes-schema.ts +12 -14
  145. package/src/schemas/values/op-status-action-schema.ts +10 -12
  146. package/src/schemas/values/op-status-reason-schema.ts +10 -12
  147. package/src/schemas/values/participant-identifier-code-schema.ts +10 -13
  148. package/src/schemas/values/payment-means-code-schema.ts +10 -12
  149. package/src/schemas/values/peppol-country-code-schema.ts +10 -9
  150. package/src/schemas/values/peppol-document-type-code-schema.ts +10 -12
  151. package/src/schemas/values/peppol-document-type-schema.ts +12 -21
  152. package/src/schemas/values/peppol-process-schema.ts +19 -15
  153. package/src/schemas/values/process-from-document-type-schema.ts +3 -3
  154. package/src/schemas/values/quantity-unit-codes-schema.ts +10 -12
  155. package/src/schemas/values/vat-date-code-schema.ts +12 -5
  156. package/src/schemas/values/vatex-code-schema.ts +8 -12
  157. package/src/schematron/errors.ts +14 -0
  158. package/src/schematron/helpers.ts +451 -0
  159. package/src/schematron/run-all-rules.ts +10 -0
  160. package/src/schematron/schematron.ts +25 -0
  161. package/src/xml/builder-options.ts +9 -0
  162. package/src/xml/common-xml-options.ts +9 -0
  163. package/src/xml/nodable-parser.ts +12 -0
  164. package/src/xml/parser-options.ts +9 -0
  165. package/dist/index-BBzPjq7o.d.ts.map +0 -1
  166. package/dist/invoice-response-code-not-needs-schema-p_RKKNLc.js +0 -18
  167. package/dist/invoice-response-code-not-needs-schema-p_RKKNLc.js.map +0 -1
  168. package/dist/is-valid-abn-160i38PG.js.map +0 -1
  169. package/dist/is-valid-mod97-0208-CzMOXMO-.js.map +0 -1
  170. package/dist/message-level-response-profile-id-DBpOW91B.js +0 -9
  171. package/dist/message-level-response-profile-id-DBpOW91B.js.map +0 -1
  172. package/dist/nodable-parser-CyDZtLCK.js.map +0 -1
  173. package/dist/vat-dates.generated-CxFvt7m3.d.ts +0 -68
  174. package/dist/vat-dates.generated-CxFvt7m3.d.ts.map +0 -1
@@ -361,6 +361,16 @@ import { validateSeR011 } from '#/schematron/se/se-r-011.ts';
361
361
  import { validateSeR012 } from '#/schematron/se/se-r-012.ts';
362
362
  import { validateSeR013 } from '#/schematron/se/se-r-013.ts';
363
363
 
364
+ /**
365
+ * @description Every schematron rule validator of this library, in evaluation order.
366
+ *
367
+ * @example
368
+ * ```ts
369
+ * ruleValidators.length; // 360
370
+ * ```;
371
+ *
372
+ * @see {@link SchematronDocumentValidator}
373
+ */
364
374
  export const ruleValidators: ReadonlyArray<SchematronDocumentValidator> = [
365
375
  validateCenEn16931BrAe01,
366
376
  validateCenEn16931BrAe02,
@@ -13,14 +13,39 @@ import { ruleValidators } from '#/schematron/run-all-rules.ts';
13
13
  export interface SchematronShape {
14
14
  /**
15
15
  * @description Runs every schematron rule against the document, failing with a single `SchematronValidationError` that wraps each failed rule.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const program = Effect.gen(function* () {
20
+ * const schematron = yield* Schematron;
21
+ * return yield* schematron.run(document);
22
+ * });
23
+ * ```;
24
+ *
25
+ * @param document - The PEPPOL invoice or credit note to validate.
26
+ *
27
+ * @returns An `Effect` that succeeds with a `Result` holding `void`, or fails with the wrapped rule failures.
16
28
  */
17
29
  readonly run: (document: PeppolDocument) => Effect.Effect<Result.Result<void, SchematronValidationError>>;
18
30
  }
19
31
 
20
32
  /**
21
33
  * @description Runs the schematron rules of this library against a PEPPOL document.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const program = Effect.gen(function* () {
38
+ * const schematron = yield* Schematron;
39
+ * return yield* schematron.run(document);
40
+ * });
41
+ * ```;
42
+ *
43
+ * @see {@link SchematronShape}
22
44
  */
23
45
  export class Schematron extends Context.Service<Schematron, SchematronShape>()('@endevops/peppol-schema/schematron/Schematron') {
46
+ /**
47
+ * @description Layer that builds the {@link Schematron} service from the rule validators in `ruleValidators`.
48
+ */
24
49
  static readonly layer = Layer.effect(
25
50
  Schematron,
26
51
  Effect.gen(function* () {
@@ -2,4 +2,13 @@ import type { XmlBuilderOptions } from 'fast-xml-builder';
2
2
 
3
3
  import { commonXmlOptions } from '#/xml/common-xml-options.ts';
4
4
 
5
+ /**
6
+ * @description Default `fast-xml-builder` options for serialising PEPPOL documents: {@link commonXmlOptions} with `suppressEmptyNode` forced on.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * builderOptions.attributeNamePrefix; // '@'
11
+ * builderOptions.suppressEmptyNode; // true
12
+ * ```;
13
+ */
5
14
  export const builderOptions = { ...commonXmlOptions, suppressEmptyNode: true } satisfies XmlBuilderOptions;
@@ -1,6 +1,15 @@
1
1
  import type { XmlBuilderOptions } from 'fast-xml-builder';
2
2
  import type { X2jOptions } from 'fast-xml-parser';
3
3
 
4
+ /**
5
+ * @description Options shared by the XML parser and builder so documents round-trip: `@` attributes, coerced values, trimmed values.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * commonXmlOptions.attributeNamePrefix; // '@'
10
+ * commonXmlOptions.parseAttributeValue; // true
11
+ * ```;
12
+ */
4
13
  export const commonXmlOptions = {
5
14
  attributeNamePrefix: '@',
6
15
  format: false,
@@ -19,6 +19,18 @@ const nodableParser = new XMLParser({
19
19
  skip: { attributes: false, nsPrefix: true },
20
20
  });
21
21
 
22
+ /**
23
+ * @description Parses an XML string into an {@link XmlNode} tree with the nodable compact builder, coercing values and removing `@xmlns`.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * parseXmlNodable('<root xmlns="urn:x"><a>1</a></root>'); // { root: { a: 1 } }
28
+ * ```;
29
+ *
30
+ * @param value - The XML document to parse.
31
+ *
32
+ * @returns The parsed {@link XmlNode} tree with `@xmlns` stripped.
33
+ */
22
34
  export function parseXmlNodable(value: string): XmlNode {
23
35
  const parsed = nodableParser.parse(value) as XmlNode;
24
36
  stripDefaultXmlns(parsed);
@@ -2,4 +2,13 @@ import type { X2jOptions } from 'fast-xml-parser';
2
2
 
3
3
  import { commonXmlOptions } from '#/xml/common-xml-options.ts';
4
4
 
5
+ /**
6
+ * @description Default `fast-xml-parser` options for parsing PEPPOL documents. Equal to {@link commonXmlOptions}.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * parserOptions.attributeNamePrefix; // '@'
11
+ * parserOptions.ignoreAttributes; // false
12
+ * ```;
13
+ */
5
14
  export const parserOptions = { ...commonXmlOptions } satisfies X2jOptions;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-BBzPjq7o.d.ts","names":[],"sources":["../src/schemas/utils/opaque.ts","../src/schemas/peppol-iso-date-string.ts","../src/schemas/fields/peppol-amount-schema.ts","../src/schemas/fields/peppol-allowance-charge-schema.ts","../src/schemas/fields/peppol-binary-object-schema.ts","../src/schemas/fields/peppol-additional-document-reference-schema.ts","../src/schemas/fields/peppol-billing-reference-schema.ts","../src/schemas/fields/peppol-address-schema.ts","../src/schemas/fields/peppol-delivery-schema.ts","../src/schemas/fields/peppol-invoice-period-schema.ts","../src/schemas/fields/peppol-legal-monetary-total-schema.ts","../src/schemas/fields/peppol-order-reference-schema.ts","../src/schemas/fields/peppol-contact-schema.ts","../src/schemas/fields/peppol-identifier-schema.ts","../src/schemas/fields/peppol-party-legal-entity-schema.ts","../src/schemas/fields/peppol-party-tax-scheme-schema.ts","../src/schemas/fields/peppol-party-base-schema.ts","../src/schemas/fields/peppol-payee-party-schema.ts","../src/schemas/fields/peppol-payment-means-schema.ts","../src/schemas/fields/peppol-payment-terms-schema.ts","../src/schemas/fields/peppol-tax-representative-schema.ts","../src/schemas/fields/peppol-tax-category-schema.ts","../src/schemas/fields/peppol-tax-subtotal-category-schema.ts","../src/schemas/fields/peppol-tax-subtotal-schema.ts","../src/schemas/fields/peppol-tax-totals-base-schema.ts","../src/schemas/peppol-billing-base-schema.ts","../src/schemas/fields/peppol-line-allowance-charge-schema.ts","../src/schemas/fields/peppol-invoice-line-period-schema.ts","../src/schemas/fields/peppol-item-classification-schema.ts","../src/schemas/fields/peppol-line-item-schema.ts","../src/schemas/fields/peppol-line-price-allowance-charge-schema.ts","../src/schemas/fields/peppol-quantity-schema.ts","../src/schemas/fields/peppol-line-price-schema.ts","../src/schemas/fields/peppol-base-line-schema.ts","../src/schemas/fields/peppol-invoice-line-schema.ts","../src/schemas/peppol-invoice-schema.ts","../src/schemas/fields/peppol-credit-note-line-schema.ts","../src/schemas/peppol-credit-note-schema.ts","../src/schemas/peppol-message-level-response-party-schema.ts","../src/schemas/peppol-document-response-document-reference-schema.ts","../src/schemas/peppol-document-response-document-schema.ts","../src/schemas/peppol-document-response-line-response-content-schema.ts","../src/schemas/peppol-document-response-line-response-schema.ts","../src/schemas/peppol-message-level-response-document-response-schema.ts","../src/schemas/utils/peppol-xsd-time-schema.ts","../src/schemas/peppol-message-level-response-schema.ts","../src/schemas/peppol-invoice-response-status-reason-code-schema.ts","../src/schemas/peppol-invoice-response-document-actual-response-status-schema.ts","../src/schemas/peppol-invoice-response-document-actual-response-schema.ts","../src/schemas/utils/peppol-base-64-schema.ts","../src/schemas/utils/format-quantity-with-unit.ts","../src/schemas/values/credit-note-type-code-schema.ts","../src/schemas/utils/get-credit-note-type-code-description.ts","../src/schemas/values/invoice-type-code-schema.ts","../src/schemas/utils/get-invoice-type-code-description.ts","../src/schemas/utils/is-valid-credit-note-type-code.ts","../src/schemas/utils/is-valid-invoice-type-code.ts","../src/schemas/values/peppol-process-schema.ts","../src/schemas/utils/is-valid-process.ts","../src/schemas/values/quantity-unit-codes-schema.ts","../src/schemas/utils/quantity-unit-code-to-intl-unit.ts","../src/schemas/utils/peppol-vat-regex-schema.ts","../src/schemas/peppol-invoice-response-schema.ts","../src/schemas/peppol-document-schema.ts","../src/schemas/fields/default-customization-id.ts","../src/schemas/fields/default-profile-id.ts","../src/schemas/fields/peppol-reference-schema.ts","../src/schemas/values/additional-document-reference-code-schema.ts","../src/schemas/values/allowance-charge-reason-code-schema.ts","../src/schemas/values/application-response-type-code-schema.ts","../src/schemas/values/charge-reason-code-schema.ts","../src/schemas/values/peppol-country-code-schema.ts","../src/schemas/values/currency-code-schema.ts","../src/schemas/values/peppol-document-type-code-schema.ts","../src/schemas/values/peppol-document-type-schema.ts","../src/schemas/values/document-type-schemes-schema.ts","../src/schemas/values/document-type-values-schema.ts","../src/schemas/values/duty-tax-fee-category-schema.ts","../src/schemas/values/electronic-codes-schema.ts","../src/schemas/values/icd-codes-schema.ts","../src/schemas/values/invoice-status-code-schema.ts","../src/schemas/values/item-classification-codes-schema.ts","../src/schemas/values/mime-codes-schema.ts","../src/schemas/values/op-status-action-schema.ts","../src/schemas/values/op-status-reason-schema.ts","../src/schemas/values/participant-identifier-code-schema.ts","../src/schemas/values/payment-means-code-schema.ts","../src/schemas/values/process-from-document-type-schema.ts","../src/schemas/values/vatex-code-schema.ts","../src/schemas/values/vat-date-code-schema.ts"],"mappings":";;;;;;;;KAOY,aAAa,MAAM,UAAU,OAAO,OAAO,OAAO,OAAO,MAAM,SAAS,KAAK,SAAS,OAAO;;;;;;;;;;;;cCK5F,4BAA4B;;;;;;;;;;;;;;;;;;cCF5B,qBAAqB;UAYjB,4BAA4B,OAAO,MAAM,eAAe;;;;;;;;;;;cCb5D,qCAAqC;;;;;;;;;;;;;;;;;;cAWrC,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuC5B,wBAAwB;;;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H,yBAAyB,gBAAgB;;;;;;;;;;;;;cAcxC,iBAAe,OAAA,MAAA,OAAA;;;KCjBhB,oBAAoB;;;;;cAMnB,mBAAiB,OAAA"}
@@ -1,18 +0,0 @@
1
- //#region src/invoice-response-codes/invoice-response-code-needs-schema.ts
2
- const invoiceResponseCodeNeedsSchema = [
3
- "UQ",
4
- "RE",
5
- "CA"
6
- ];
7
- //#endregion
8
- //#region src/invoice-response-codes/invoice-response-code-not-needs-schema.ts
9
- const invoiceResponseCodeNotNeedsSchema = [
10
- "AB",
11
- "AP",
12
- "IP",
13
- "PD"
14
- ];
15
- //#endregion
16
- export { invoiceResponseCodeNeedsSchema as n, invoiceResponseCodeNotNeedsSchema as t };
17
-
18
- //# sourceMappingURL=invoice-response-code-not-needs-schema-p_RKKNLc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invoice-response-code-not-needs-schema-p_RKKNLc.js","names":[],"sources":["../src/invoice-response-codes/invoice-response-code-needs-schema.ts","../src/invoice-response-codes/invoice-response-code-not-needs-schema.ts"],"sourcesContent":["export const invoiceResponseCodeNeedsSchema = ['UQ', 'RE', 'CA'] as const;\n","export const invoiceResponseCodeNotNeedsSchema = ['AB', 'AP', 'IP', 'PD'] as const;\n"],"mappings":";AAAA,MAAa,iCAAiC;CAAC;CAAM;CAAM;AAAI;;;ACA/D,MAAa,oCAAoC;CAAC;CAAM;CAAM;CAAM;AAAI"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-valid-abn-160i38PG.js","names":[],"sources":["../src/peppol-validations/is-valid-iban.ts","../src/peppol-validations/greek-tin-verification.ts","../src/peppol-validations/is-valid-mod11.ts","../src/peppol-validations/is-valid-gln.ts","../src/peppol-validations/check-cf16.ts","../src/peppol-validations/check-cf.ts","../src/peppol-validations/add-piva.ts","../src/peppol-validations/check-piva.ts","../src/peppol-validations/check-piva-se-it.ts","../src/peppol-validations/check-se-orgnr.ts","../src/peppol-validations/is-valid-abn.ts"],"sourcesContent":["import { normalizeSpace } from './normalize-space.ts';\n\n/**\n * @description IBAN validation using mod 97 algorithm.\n */\nexport function isValidIBAN(iban: string): boolean {\n const s = normalizeSpace(iban).replace(/[ \\t\\r\\n]/g, '');\n if (!/^[A-Z]{2}\\d{2}[A-Za-z0-9]{0,30}$/.test(s)) return false;\n const rearranged = s.slice(4) + s.slice(0, 4);\n const converted = rearranged\n .split('')\n .map(ch => {\n const code = ch.charCodeAt(0);\n // A=10..Z=35, digits 0..9\n return code >= 65 && code <= 90 ? String(code - 55) : ch;\n })\n .join('');\n // mod 97 calculation on big integer string\n let remainder = 0;\n for (const c of converted) {\n remainder = (remainder * 10 + (c.charCodeAt(0) - 48)) % 97;\n }\n return remainder === 1;\n}\n","/**\n * @description Greek TIN verification.\n */\nexport function greekTinVerification(val: string): boolean {\n if (!/^\\d{9}$/.test(val)) return false;\n const digits = val.split('').map(Number) as [number, number, number, number, number, number, number, number, number];\n const checksum =\n digits[7] * 2 + digits[6] * 4 + digits[5] * 8 + digits[4] * 16 + digits[3] * 32 + digits[2] * 64 + digits[1] * 128 + digits[0] * 256;\n\n return (checksum % 11) % 10 === digits[8];\n}\n","import { normalizeSpace } from './normalize-space.ts';\n\n/**\n * @description Validates Norwegian organization numbers using mod11 algorithm.\n */\nexport function isValidMod11(val: string): boolean {\n const s = normalizeSpace(val);\n if (!/^\\d+$/.test(s) || s.length < 2) return false;\n const length = s.length - 1;\n let weightedSum = 0;\n // weights 2..7 repeated\n for (let i = 0; i < length; i += 1) {\n const digit = s.charCodeAt(length - 1 - i) - 48; // reverse to match XSLT reverse\n const weight = (i % 6) + 2;\n weightedSum += digit * weight;\n }\n const check = (11 - (weightedSum % 11)) % 11;\n return check === Number(s[length]);\n}\n","/**\n * @description [GLN](https://en.wikipedia.org/wiki/Global_Location_Number) check (GS1)\n */\nexport function isValidGLN(val: string): { success: true } | { success: false; expected: number; actual: number } {\n const value = (val ?? '').replace(/\\s+/g, '');\n const len = value.length - 1;\n\n const digits = value\n .slice(0, len)\n .split('')\n .map(c => c.charCodeAt(0) - 48)\n .reverse();\n\n const weightedSum = digits.reduce((sum, d, i) => sum + d * (1 + ((i + 1) % 2) * 2), 0);\n const check = (10 - (weightedSum % 10)) % 10;\n const success = check === Number(value[len]);\n if (success) {\n return { success: true };\n }\n return { actual: Number(value[len]), expected: check, success: false };\n}\n","import { normalizeSpace } from './normalize-space.ts';\n\n/**\n * @description Validates 16-character Italian fiscal codes.\n */\nexport function checkCF16(arg: string): boolean {\n const s = normalizeSpace(arg);\n if (s.length !== 16) return false;\n if (!/^[A-Za-z]{6}\\d{2}[A-Za-z]\\d{2}[A-Za-z]\\d{3}[A-Za-z]$/.test(s)) return false;\n return true;\n}\n","import { checkCF16 } from './check-cf16.ts';\nimport { normalizeSpace } from './normalize-space.ts';\n\n/**\n * @description Validates both 16 and 11 character Italian fiscal codes.\n */\nexport function checkCF(arg: string): boolean {\n const s = normalizeSpace(arg);\n if (s.length === 16) return checkCF16(s);\n if (s.length === 11) return /^\\d{11}$/.test(s);\n return false;\n}\n","// NOTE: check and add valid values for the tests in `add-piva.spec.ts`\n\n/**\n * @description Helper function for calculating weighted sum for Italian PIVA validation.\n */\nexport function addPIVA(arg: string, pari: number): number {\n if (!/^\\d+$/.test(arg)) return 0;\n const first = Number(arg[0]);\n const mapper = pari === 1 ? Number('0246813579'[first]) : first;\n if (arg.length === 1) return mapper;\n return mapper + addPIVA(arg.slice(1), pari === 0 ? 1 : 0);\n}\n","import { addPIVA } from './add-piva.ts';\n\n/**\n * @description Validates Italian VAT numbers (PIVA)\n */\nexport function checkPIVA(arg: string): number {\n if (!/^\\d+$/.test(arg)) return 1;\n return addPIVA(arg, 0) % 10;\n}\n","import { checkPIVA } from './check-piva.ts';\n\n/**\n * @description Validates Italian VAT numbers with IT prefix.\n */\nexport function checkPIVAseIT(arg: string): boolean {\n const paese = arg.substring(0, 2);\n const codice = arg.substring(2);\n if (paese.toUpperCase() !== 'IT') return true;\n return codice.length === 11 && checkPIVA(codice) === 0;\n}\n","import { normalizeSpace } from './normalize-space.ts';\n\n/**\n * @description Validates Swedish organization numbers (0007)\n */\nexport function checkSEOrgnr(number: string): boolean {\n const s = normalizeSpace(number);\n if (!/^\\d+$/.test(s) || s.length !== 10) return false;\n const main = s.substring(0, 9);\n const checkDigit = Number(s[9]);\n let sum = 0;\n for (let pos = 1; pos <= main.length; pos += 1) {\n const digit = Number(main[main.length - pos]);\n if (pos % 2 === 1) {\n const dbl = ((digit * 2) % 10) + Math.floor((digit * 2) / 10);\n sum += dbl;\n } else {\n sum += digit;\n }\n }\n const calculated = (10 - (sum % 10)) % 10;\n return calculated === checkDigit;\n}\n","import { normalizeSpace } from './normalize-space.ts';\n\n/**\n * @description Australian Business Number (ABN) validation.\n */\nexport function isValidABN(val: string): boolean {\n const s = normalizeSpace(val);\n if (!/^\\d{11}$/.test(s)) return false;\n const weights = [10, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19];\n let sum = (s.charCodeAt(0) - 49) * 10; // (first digit -1)*10\n for (let i = 1; i < 11; i += 1) {\n sum += (s.charCodeAt(i) - 48) * weights[i]!;\n }\n return sum % 89 === 0;\n}\n"],"mappings":";;;;;AAKA,SAAgB,YAAY,MAAuB;CACjD,MAAM,IAAI,eAAe,IAAI,CAAC,CAAC,QAAQ,cAAc,EAAE;CACvD,IAAI,CAAC,mCAAmC,KAAK,CAAC,GAAG,OAAO;CAExD,MAAM,aADa,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,EAAA,CAEzC,MAAM,EAAE,CAAC,CACT,KAAI,OAAM;EACT,MAAM,OAAO,GAAG,WAAW,CAAC;EAE5B,OAAO,QAAQ,MAAM,QAAQ,KAAK,OAAO,OAAO,EAAE,IAAI;CACxD,CAAC,CAAC,CACD,KAAK,EAAE;CAEV,IAAI,YAAY;CAChB,KAAK,MAAM,KAAK,WACd,aAAa,YAAY,MAAM,EAAE,WAAW,CAAC,IAAI,OAAO;CAE1D,OAAO,cAAc;AACvB;;;;;;ACpBA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ACV,KAAK,IAAI,MAAM,GAAG,OAAO,KAAK,QAAQ,OAAO,GAAG;EAC9C,MAAM,QAAQ,OAAO,KAAK,KAAK,SAAS,IAAI;EAC5C,IAAI,MAAM,MAAM,GAAG;GACjB,MAAM,MAAQ,QAAQ,IAAK,KAAM,KAAK,MAAO,QAAQ,IAAK,EAAE;GAC5D,OAAO;EACT,OACE,OAAO;CAEX;CAEA,QADoB,KAAM,MAAM,MAAO,OACjB;AACxB;;;;;;ACjBA,SAAgB,WAAW,KAAsB;CAC/C,MAAM,IAAI,eAAe,GAAG;CAC5B,IAAI,CAAC,WAAW,KAAK,CAAC,GAAG,OAAO;CAChC,MAAM,UAAU;EAAC;EAAI;EAAG;EAAG;EAAG;EAAG;EAAG;EAAI;EAAI;EAAI;EAAI;CAAE;CACtD,IAAI,OAAO,EAAE,WAAW,CAAC,IAAI,MAAM;CACnC,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK,GAC3B,QAAQ,EAAE,WAAW,CAAC,IAAI,MAAM,QAAQ;CAE1C,OAAO,MAAM,OAAO;AACtB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-valid-mod97-0208-CzMOXMO-.js","names":[],"sources":["../src/peppol-validations/normalize-space.ts","../src/peppol-validations/is-valid-mod97-0208.ts"],"sourcesContent":["/**\n * @description Normalize whitespace in a string by replacing multiple whitespace characters with a single space and trimming.\n */\nexport function normalizeSpace(input: string): string {\n const s = typeof input === 'string' ? input : input == null ? '' : String(input);\n return s.replace(/\\s+/g, ' ').trim();\n}\n","import { normalizeSpace } from './normalize-space.ts';\n\n/**\n * @description Belgian enterprise number validation (mod 97-0208)\n */\nexport function isValidMod97_0208(val: string): { success: true } | { success: false; expected: number; actual: number } {\n const s = normalizeSpace(val);\n const checkdigits = Number(s.substring(8, 10));\n const main = Number(s.substring(0, 8));\n const calculated = 97 - (main % 97);\n const success = checkdigits === calculated;\n if (success) {\n return { success: true };\n }\n return { actual: checkdigits, expected: calculated, success: false };\n}\n"],"mappings":";;;;AAGA,SAAgB,eAAe,OAAuB;CAEpD,QADU,OAAO,UAAU,WAAW,QAAQ,SAAS,OAAO,KAAK,OAAO,KAAK,EAAA,CACtE,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK;AACrC;;;;;;ACDA,SAAgB,kBAAkB,KAAuF;CACvH,MAAM,IAAI,eAAe,GAAG;CAC5B,MAAM,cAAc,OAAO,EAAE,UAAU,GAAG,EAAE,CAAC;CAE7C,MAAM,aAAa,KADN,OAAO,EAAE,UAAU,GAAG,CAAC,CACR,IAAI;CAEhC,IADgB,gBAAgB,YAE9B,OAAO,EAAE,SAAS,KAAK;CAEzB,OAAO;EAAE,QAAQ;EAAa,UAAU;EAAY,SAAS;CAAM;AACrE"}
@@ -1,9 +0,0 @@
1
- //#region src/constants/invoice-response-profile-id.ts
2
- const INVOICE_RESPONSE_PROFILE_ID = "urn:fdc:peppol.eu:poacc:bis:invoice_response:3";
3
- //#endregion
4
- //#region src/constants/message-level-response-profile-id.ts
5
- const MESSAGE_LEVEL_RESPONSE_PROFILE_ID = "urn:fdc:peppol.eu:poacc:bis:mlr:3";
6
- //#endregion
7
- export { INVOICE_RESPONSE_PROFILE_ID as n, MESSAGE_LEVEL_RESPONSE_PROFILE_ID as t };
8
-
9
- //# sourceMappingURL=message-level-response-profile-id-DBpOW91B.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"message-level-response-profile-id-DBpOW91B.js","names":[],"sources":["../src/constants/invoice-response-profile-id.ts","../src/constants/message-level-response-profile-id.ts"],"sourcesContent":["export const INVOICE_RESPONSE_PROFILE_ID = 'urn:fdc:peppol.eu:poacc:bis:invoice_response:3' as const;\n","export const MESSAGE_LEVEL_RESPONSE_PROFILE_ID = 'urn:fdc:peppol.eu:poacc:bis:mlr:3' as const;\n"],"mappings":";AAAA,MAAa,8BAA8B;;;ACA3C,MAAa,oCAAoC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodable-parser-CyDZtLCK.js","names":[],"sources":["../src/xml/common-xml-options.ts","../src/xml/builder-options.ts","../src/xml/nodable-parser.ts"],"sourcesContent":["import type { XmlBuilderOptions } from 'fast-xml-builder';\nimport type { X2jOptions } from 'fast-xml-parser';\n\nexport const commonXmlOptions = {\n attributeNamePrefix: '@',\n format: false,\n ignoreAttributes: false,\n numberParseOptions: { hex: false, leadingZeros: false },\n parseAttributeValue: true,\n suppressBooleanAttributes: true,\n suppressEmptyNode: true,\n trimValues: true,\n} satisfies X2jOptions & XmlBuilderOptions;\n","import type { XmlBuilderOptions } from 'fast-xml-builder';\n\nimport { commonXmlOptions } from '#/xml/common-xml-options.ts';\n\nexport const builderOptions = { ...commonXmlOptions, suppressEmptyNode: true } satisfies XmlBuilderOptions;\n","import { NumberValueParser } from '@nodable/base-output-builder';\nimport { CompactBuilderFactory } from '@nodable/compact-builder';\nimport { XMLParser } from '@nodable/flexible-xml-parser';\n\nimport type { XmlNode } from '#/helpers/get-prop.ts';\n\nexport type { XmlNode } from '#/helpers/get-prop.ts';\n\nconst numberParser = new NumberValueParser({ eNotation: true, hex: false, leadingZeros: false });\n\nconst compactFactory = new CompactBuilderFactory({\n attributes: { valueParsers: ['entity', numberParser, 'boolean'] },\n tags: { valueParsers: ['trim', 'entity', 'boolean', numberParser] },\n});\n\nconst nodableParser = new XMLParser({\n OutputBuilder: compactFactory,\n attributes: { booleanType: 'allow', prefix: '@' },\n skip: { attributes: false, nsPrefix: true },\n});\n\nexport function parseXmlNodable(value: string): XmlNode {\n const parsed = nodableParser.parse(value) as XmlNode;\n stripDefaultXmlns(parsed);\n return parsed;\n}\n\nfunction stripDefaultXmlns(node: unknown): void {\n if (Array.isArray(node)) {\n for (const item of node) stripDefaultXmlns(item);\n return;\n }\n if (typeof node === 'object' && node !== null) {\n const record = node as Record<string, unknown>;\n delete record['@xmlns'];\n for (const key of Object.keys(record)) stripDefaultXmlns(record[key]);\n }\n}\n"],"mappings":";;;;AAGA,MAAa,mBAAmB;CAC9B,qBAAqB;CACrB,QAAQ;CACR,kBAAkB;CAClB,oBAAoB;EAAE,KAAK;EAAO,cAAc;CAAM;CACtD,qBAAqB;CACrB,2BAA2B;CAC3B,mBAAmB;CACnB,YAAY;AACd;;;ACRA,MAAa,iBAAiB;CAAE,GAAG;CAAkB,mBAAmB;AAAK;;;ACI7E,MAAM,eAAe,IAAI,kBAAkB;CAAE,WAAW;CAAM,KAAK;CAAO,cAAc;AAAM,CAAC;AAE/F,MAAM,iBAAiB,IAAI,sBAAsB;CAC/C,YAAY,EAAE,cAAc;EAAC;EAAU;EAAc;CAAS,EAAE;CAChE,MAAM,EAAE,cAAc;EAAC;EAAQ;EAAU;EAAW;CAAY,EAAE;AACpE,CAAC;AAED,MAAM,gBAAgB,IAAI,UAAU;CAClC,eAAe;CACf,YAAY;EAAE,aAAa;EAAS,QAAQ;CAAI;CAChD,MAAM;EAAE,YAAY;EAAO,UAAU;CAAK;AAC5C,CAAC;AAED,SAAgB,gBAAgB,OAAwB;CACtD,MAAM,SAAS,cAAc,MAAM,KAAK;CACxC,kBAAkB,MAAM;CACxB,OAAO;AACT;AAEA,SAAS,kBAAkB,MAAqB;CAC9C,IAAI,MAAM,QAAQ,IAAI,GAAG;EACvB,KAAK,MAAM,QAAQ,MAAM,kBAAkB,IAAI;EAC/C;CACF;CACA,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM;EAC7C,MAAM,SAAS;EACf,OAAO,OAAO;EACd,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAAG,kBAAkB,OAAO,IAAI;CACtE;AACF"}
@@ -1,68 +0,0 @@
1
- //#region src/values/credit-notes-type-codes.generated.d.ts
2
- /**
3
- * @version D.16B
4
- *
5
- * @category Peppol Values
6
- *
7
- * @title Credit note type code (UNCL1001 subset)
8
- *
9
- * @enum
10
- *
11
- * @see https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL1001-cn/
12
- */
13
- declare const creditNoteTypeCodes: Record<CreditNoteTypeCodesKeys, string>;
14
- /**
15
- * @description Keys of {@link creditNoteTypeCodes}.
16
- */
17
- type CreditNoteTypeCodesKeys = '81' | '83' | '381' | '396' | '532';
18
- /**
19
- * @description Keys of {@link creditNoteTypeCodes}.
20
- */
21
- declare const creditNoteTypeCodesKeys: readonly ['81', '83', '381', '396', '532'];
22
- //#endregion
23
- //#region src/values/application-response-type-codes.generated.d.ts
24
- /**
25
- * @version D.17A
26
- *
27
- * @category Peppol Values
28
- *
29
- * @title Application Response type code (UNCL4343 Subset)
30
- *
31
- * @enum
32
- *
33
- * @see https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL4343/
34
- */
35
- declare const applicationResponseTypeCodes: Record<ApplicationResponseTypeCodesKeys, string>;
36
- /**
37
- * @description Keys of {@link applicationResponseTypeCodes}.
38
- */
39
- type ApplicationResponseTypeCodesKeys = 'AB' | 'AP' | 'RE';
40
- /**
41
- * @description Keys of {@link applicationResponseTypeCodes}.
42
- */
43
- declare const applicationResponseTypeCodesKeys: readonly ['AB', 'AP', 'RE'];
44
- //#endregion
45
- //#region src/values/vat-dates.generated.d.ts
46
- /**
47
- * @version D.16B
48
- *
49
- * @category Peppol Values
50
- *
51
- * @title VAT date code (UNCL2005 subset)
52
- *
53
- * @enum
54
- *
55
- * @see https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL2005/
56
- */
57
- declare const vatDateCodes: Record<VatDateCodesKeys, string>;
58
- /**
59
- * @description Keys of {@link vatDateCodes}.
60
- */
61
- type VatDateCodesKeys = '3' | '35' | '432';
62
- /**
63
- * @description Keys of {@link vatDateCodes}.
64
- */
65
- declare const vatDateCodesKeys: readonly ['3', '35', '432'];
66
- //#endregion
67
- export { applicationResponseTypeCodes as a, creditNoteTypeCodes as c, ApplicationResponseTypeCodesKeys as i, creditNoteTypeCodesKeys as l, vatDateCodes as n, applicationResponseTypeCodesKeys as o, vatDateCodesKeys as r, CreditNoteTypeCodesKeys as s, VatDateCodesKeys as t };
68
- //# sourceMappingURL=vat-dates.generated-CxFvt7m3.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vat-dates.generated-CxFvt7m3.d.ts","names":[],"sources":["../src/values/credit-notes-type-codes.generated.ts","../src/values/application-response-type-codes.generated.ts","../src/values/vat-dates.generated.ts"],"mappings":";;;;;;;;;;;;cAca,qBAAqB,OAAO;;;;KA0B7B;;;;cAKC;;;;;;;;;;;;;;cC/BA,8BAA8B,OAAO;;;;KAWtC;;;;cAKC;;;;;;;;;;;;;;cChBA,cAAc,OAAO;;;;KAWtB;;;;cAKC"}