@endevops/peppol-schema 0.1.0-beta.4 → 0.1.0-beta.5

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 (751) hide show
  1. package/README.md +9 -6
  2. package/dist/constants.d.ts +51 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +48 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/eas-codes.generated-D8jjHFij.js.map +1 -1
  7. package/dist/index-CfjMSrpQ.d.ts +3508 -0
  8. package/dist/index-CfjMSrpQ.d.ts.map +1 -0
  9. package/dist/index.d.ts +2 -2613
  10. package/dist/index.js +3121 -1563
  11. package/dist/index.js.map +1 -1
  12. package/dist/invoice-response-code-not-needs-schema-p_RKKNLc.js +18 -0
  13. package/dist/invoice-response-code-not-needs-schema-p_RKKNLc.js.map +1 -0
  14. package/dist/invoice-response-codes.d.ts +11 -0
  15. package/dist/invoice-response-codes.d.ts.map +1 -0
  16. package/dist/invoice-response-codes.js +32 -0
  17. package/dist/invoice-response-codes.js.map +1 -0
  18. package/dist/invoice-status-codes.generated-DL-agLdx.d.ts +24 -0
  19. package/dist/invoice-status-codes.generated-DL-agLdx.d.ts.map +1 -0
  20. package/dist/message-level-response-profile-id-DBpOW91B.js +9 -0
  21. package/dist/message-level-response-profile-id-DBpOW91B.js.map +1 -0
  22. package/dist/peppol-iso-date-string-BXLxzxdz.js +30 -0
  23. package/dist/peppol-iso-date-string-BXLxzxdz.js.map +1 -0
  24. package/dist/schematron.d.ts +408 -365
  25. package/dist/schematron.d.ts.map +1 -1
  26. package/dist/schematron.js +1975 -1501
  27. package/dist/schematron.js.map +1 -1
  28. package/dist/values.d.ts +95 -13218
  29. package/dist/values.d.ts.map +1 -1
  30. package/dist/values.js +1 -1
  31. package/dist/vat-dates.generated-CxFvt7m3.d.ts +68 -0
  32. package/dist/vat-dates.generated-CxFvt7m3.d.ts.map +1 -0
  33. package/dist/{vatex-codes.generated-BSgP3n5t.js → vatex-codes.generated-N7wsUrLh.js} +8 -9
  34. package/dist/vatex-codes.generated-N7wsUrLh.js.map +1 -0
  35. package/package.json +16 -18
  36. package/src/constants/transport-profile.ts +5 -1
  37. package/src/decoders/decode-billing.ts +1 -1
  38. package/src/decoders/decode-credit-note.ts +2 -4
  39. package/src/decoders/decode-invoice-response.ts +15 -37
  40. package/src/decoders/decode-invoice.ts +2 -4
  41. package/src/decoders/decode-message-level-response.ts +21 -48
  42. package/src/decoders/encode-credit-note.ts +1 -1
  43. package/src/decoders/encode-invoice-response.ts +7 -4
  44. package/src/decoders/encode-invoice.ts +1 -1
  45. package/src/decoders/encode-message-level-response.ts +4 -10
  46. package/src/decoders/fields/decode-additional-document-references.ts +1 -1
  47. package/src/decoders/fields/decode-address.ts +1 -1
  48. package/src/decoders/fields/decode-allowance-charges.ts +7 -15
  49. package/src/decoders/fields/decode-amount.ts +2 -2
  50. package/src/decoders/fields/decode-application-response.ts +21 -0
  51. package/src/decoders/fields/decode-billing-references.ts +1 -1
  52. package/src/decoders/fields/decode-contact.ts +1 -1
  53. package/src/decoders/fields/decode-credit-note-lines.ts +7 -15
  54. package/src/decoders/fields/decode-delivery.ts +1 -1
  55. package/src/decoders/fields/decode-electronic-address.ts +1 -1
  56. package/src/decoders/fields/decode-identifier.ts +1 -1
  57. package/src/decoders/fields/decode-invoice-line-period.ts +1 -1
  58. package/src/decoders/fields/decode-invoice-lines.ts +6 -14
  59. package/src/decoders/fields/decode-invoice-message-document-party.ts +2 -2
  60. package/src/decoders/fields/decode-invoice-message-party.ts +1 -6
  61. package/src/decoders/fields/decode-invoice-period.ts +7 -13
  62. package/src/decoders/fields/decode-legal-monetary-total.ts +1 -1
  63. package/src/decoders/fields/decode-line-allowance-charges.ts +7 -14
  64. package/src/decoders/fields/decode-line-price.ts +1 -7
  65. package/src/decoders/fields/decode-line-shared.ts +2 -4
  66. package/src/decoders/fields/decode-message-level-party.ts +1 -1
  67. package/src/decoders/fields/decode-node-list.ts +15 -0
  68. package/src/decoders/fields/decode-order-reference.ts +1 -1
  69. package/src/decoders/fields/decode-parties-tax-scheme.ts +1 -1
  70. package/src/decoders/fields/decode-party-legal-entity.ts +1 -1
  71. package/src/decoders/fields/decode-party-tax-scheme.ts +1 -1
  72. package/src/decoders/fields/decode-party.ts +3 -14
  73. package/src/decoders/fields/decode-payee-party.ts +1 -1
  74. package/src/decoders/fields/decode-payment-means.ts +2 -2
  75. package/src/decoders/fields/decode-payment-terms.ts +1 -1
  76. package/src/decoders/fields/decode-price-allowance-charge.ts +1 -7
  77. package/src/decoders/fields/decode-quantity.ts +1 -6
  78. package/src/decoders/fields/decode-simple-identifier.ts +1 -1
  79. package/src/decoders/fields/decode-tax-category.ts +1 -1
  80. package/src/decoders/fields/decode-tax-representative-party.ts +1 -1
  81. package/src/decoders/fields/decode-tax-totals.ts +2 -2
  82. package/src/decoders/fields/encode-additional-document-references.ts +3 -2
  83. package/src/decoders/fields/encode-address.ts +1 -1
  84. package/src/decoders/fields/encode-allowance-charges.ts +3 -2
  85. package/src/decoders/fields/encode-amount.ts +1 -1
  86. package/src/decoders/fields/encode-billing-references.ts +2 -2
  87. package/src/decoders/fields/encode-contact.ts +1 -1
  88. package/src/decoders/fields/encode-credit-note-lines.ts +2 -2
  89. package/src/decoders/fields/encode-delivery.ts +1 -1
  90. package/src/decoders/fields/encode-identifier.ts +1 -1
  91. package/src/decoders/fields/encode-invoice-line-period.ts +1 -1
  92. package/src/decoders/fields/encode-invoice-lines.ts +2 -2
  93. package/src/decoders/fields/encode-invoice-period.ts +1 -1
  94. package/src/decoders/fields/encode-legal-monetary-total.ts +1 -1
  95. package/src/decoders/fields/encode-line-allowance-charges.ts +2 -2
  96. package/src/decoders/fields/encode-line-price.ts +1 -1
  97. package/src/decoders/fields/encode-line-shared.ts +1 -1
  98. package/src/decoders/fields/encode-message-party.ts +3 -3
  99. package/src/decoders/fields/encode-order-reference.ts +1 -1
  100. package/src/decoders/fields/encode-parties-tax-scheme.ts +1 -1
  101. package/src/decoders/fields/encode-party-tax-scheme.ts +1 -1
  102. package/src/decoders/fields/encode-party.ts +1 -1
  103. package/src/decoders/fields/encode-payee-party.ts +1 -1
  104. package/src/decoders/fields/encode-payment-means.ts +2 -2
  105. package/src/decoders/fields/encode-payment-terms.ts +1 -1
  106. package/src/decoders/fields/encode-price-allowance-charges.ts +1 -1
  107. package/src/decoders/fields/encode-quantity.ts +1 -1
  108. package/src/decoders/fields/encode-tax-category.ts +1 -1
  109. package/src/decoders/fields/encode-tax-representative-party.ts +1 -1
  110. package/src/decoders/fields/encode-tax-totals.ts +4 -4
  111. package/src/helpers/bool.ts +9 -12
  112. package/src/helpers/get-prop.ts +2 -4
  113. package/src/helpers/str-or-und.ts +3 -4
  114. package/src/helpers/str.ts +12 -8
  115. package/src/index.ts +56 -6
  116. package/src/schemas/fields/peppol-additional-document-reference-schema.ts +123 -0
  117. package/src/schemas/fields/peppol-address-schema.ts +112 -0
  118. package/src/schemas/fields/peppol-allowance-charge-schema.ts +104 -0
  119. package/src/schemas/fields/peppol-amount-schema.ts +23 -0
  120. package/src/schemas/fields/peppol-base-line-schema.ts +141 -0
  121. package/src/{effect → schemas}/fields/peppol-billing-reference-schema.ts +25 -20
  122. package/src/schemas/fields/peppol-binary-object-schema.ts +52 -0
  123. package/src/schemas/fields/peppol-contact-schema.ts +20 -0
  124. package/src/schemas/fields/peppol-credit-note-line-schema.ts +44 -0
  125. package/src/schemas/fields/peppol-delivery-schema.ts +109 -0
  126. package/src/schemas/fields/peppol-identifier-schema.ts +21 -0
  127. package/src/schemas/fields/peppol-invoice-line-period-schema.ts +35 -0
  128. package/src/{effect → schemas}/fields/peppol-invoice-line-schema.ts +10 -10
  129. package/src/schemas/fields/peppol-invoice-period-schema.ts +31 -0
  130. package/src/schemas/fields/peppol-item-classification-schema.ts +46 -0
  131. package/src/schemas/fields/peppol-legal-monetary-total-schema.ts +127 -0
  132. package/src/schemas/fields/peppol-line-allowance-charge-schema.ts +68 -0
  133. package/src/schemas/fields/peppol-line-item-schema.ts +196 -0
  134. package/src/schemas/fields/peppol-line-price-allowance-charge-schema.ts +41 -0
  135. package/src/schemas/fields/peppol-line-price-schema.ts +32 -0
  136. package/src/schemas/fields/peppol-order-reference-schema.ts +38 -0
  137. package/src/schemas/fields/peppol-party-base-schema.ts +145 -0
  138. package/src/schemas/fields/peppol-party-legal-entity-schema.ts +32 -0
  139. package/src/schemas/fields/peppol-party-tax-scheme-schema.ts +41 -0
  140. package/src/schemas/fields/peppol-payee-party-schema.ts +119 -0
  141. package/src/schemas/fields/peppol-payment-means-schema.ts +224 -0
  142. package/src/schemas/fields/peppol-payment-terms-schema.ts +25 -0
  143. package/src/schemas/fields/peppol-quantity-schema.ts +22 -0
  144. package/src/schemas/fields/peppol-reference-schema.ts +9 -0
  145. package/src/schemas/fields/peppol-tax-category-schema.ts +47 -0
  146. package/src/schemas/fields/peppol-tax-representative-schema.ts +26 -0
  147. package/src/{effect → schemas}/fields/peppol-tax-subtotal-category-schema.ts +7 -6
  148. package/src/schemas/fields/peppol-tax-subtotal-schema.ts +33 -0
  149. package/src/schemas/fields/peppol-tax-totals-base-schema.ts +28 -0
  150. package/src/schemas/peppol-billing-base-schema.ts +366 -0
  151. package/src/schemas/peppol-credit-note-schema.ts +31 -0
  152. package/src/schemas/peppol-document-response-document-reference-schema.ts +41 -0
  153. package/src/schemas/peppol-document-response-document-schema.ts +38 -0
  154. package/src/schemas/peppol-document-response-line-response-content-schema.ts +49 -0
  155. package/src/schemas/peppol-document-response-line-response-schema.ts +40 -0
  156. package/src/schemas/peppol-document-schema.ts +120 -0
  157. package/src/{effect → schemas}/peppol-invoice-response-document-actual-response-schema.ts +25 -16
  158. package/src/schemas/peppol-invoice-response-document-actual-response-status-schema.ts +63 -0
  159. package/src/schemas/peppol-invoice-response-schema.ts +176 -0
  160. package/src/schemas/peppol-invoice-response-status-reason-code-schema.ts +40 -0
  161. package/src/schemas/peppol-invoice-schema.ts +45 -0
  162. package/src/schemas/peppol-iso-date-string.ts +20 -0
  163. package/src/schemas/peppol-message-level-response-document-response-schema.ts +35 -0
  164. package/src/schemas/peppol-message-level-response-party-schema.ts +20 -0
  165. package/src/schemas/peppol-message-level-response-schema.ts +98 -0
  166. package/src/schemas/utils/format-xsd-time.ts +80 -0
  167. package/src/{effect → schemas}/utils/index.ts +1 -1
  168. package/src/schemas/utils/is-valid-process.ts +1 -1
  169. package/src/schemas/utils/opaque.ts +19 -0
  170. package/src/schemas/utils/peppol-xsd-time-schema.ts +79 -0
  171. package/src/schemas/utils/quantity-unit-code-to-intl-unit.ts +2 -2
  172. package/src/schemas/values/credit-note-type-code-schema.ts +3 -5
  173. package/src/schemas/values/document-type-schemes-schema.ts +3 -5
  174. package/src/schemas/values/document-type-values-schema.ts +4 -7
  175. package/src/{effect → schemas}/values/duty-tax-fee-category-schema.ts +3 -3
  176. package/src/schemas/values/invoice-type-code-schema.ts +4 -8
  177. package/src/schemas/values/process-from-document-type-schema.ts +10 -12
  178. package/src/schemas/values/quantity-unit-codes-schema.ts +4 -8
  179. package/src/schematron/cen/ae/cen-en16931-br-ae-01.ts +6 -5
  180. package/src/schematron/cen/ae/cen-en16931-br-ae-02.ts +6 -5
  181. package/src/schematron/cen/ae/cen-en16931-br-ae-03.ts +6 -5
  182. package/src/schematron/cen/ae/cen-en16931-br-ae-04.ts +6 -5
  183. package/src/schematron/cen/ae/cen-en16931-br-ae-05.ts +6 -5
  184. package/src/schematron/cen/ae/cen-en16931-br-ae-06.ts +6 -5
  185. package/src/schematron/cen/ae/cen-en16931-br-ae-07.ts +6 -5
  186. package/src/schematron/cen/ae/cen-en16931-br-ae-08.ts +6 -5
  187. package/src/schematron/cen/ae/cen-en16931-br-ae-09.ts +6 -5
  188. package/src/schematron/cen/ae/cen-en16931-br-ae-10.ts +6 -5
  189. package/src/schematron/cen/af/cen-en16931-br-af-01.ts +6 -5
  190. package/src/schematron/cen/af/cen-en16931-br-af-02.ts +6 -5
  191. package/src/schematron/cen/af/cen-en16931-br-af-03.ts +6 -10
  192. package/src/schematron/cen/af/cen-en16931-br-af-04.ts +6 -5
  193. package/src/schematron/cen/af/cen-en16931-br-af-05.ts +6 -5
  194. package/src/schematron/cen/af/cen-en16931-br-af-06.ts +6 -5
  195. package/src/schematron/cen/af/cen-en16931-br-af-07.ts +6 -5
  196. package/src/schematron/cen/af/cen-en16931-br-af-08.ts +6 -5
  197. package/src/schematron/cen/af/cen-en16931-br-af-09.ts +6 -5
  198. package/src/schematron/cen/af/cen-en16931-br-af-10.ts +6 -5
  199. package/src/schematron/cen/ag/cen-en16931-br-ag-01.ts +6 -5
  200. package/src/schematron/cen/ag/cen-en16931-br-ag-02.ts +6 -5
  201. package/src/schematron/cen/ag/cen-en16931-br-ag-03.ts +6 -10
  202. package/src/schematron/cen/ag/cen-en16931-br-ag-04.ts +6 -5
  203. package/src/schematron/cen/ag/cen-en16931-br-ag-05.ts +6 -5
  204. package/src/schematron/cen/ag/cen-en16931-br-ag-06.ts +6 -5
  205. package/src/schematron/cen/ag/cen-en16931-br-ag-07.ts +6 -5
  206. package/src/schematron/cen/ag/cen-en16931-br-ag-08.ts +6 -5
  207. package/src/schematron/cen/ag/cen-en16931-br-ag-09.ts +6 -5
  208. package/src/schematron/cen/ag/cen-en16931-br-ag-10.ts +6 -5
  209. package/src/schematron/cen/b/cen-en16931-br-b-01.ts +6 -5
  210. package/src/schematron/cen/b/cen-en16931-br-b-02.ts +6 -5
  211. package/src/schematron/cen/cen-en16931-br-01.ts +6 -5
  212. package/src/schematron/cen/cen-en16931-br-02.ts +6 -5
  213. package/src/schematron/cen/cen-en16931-br-03.ts +9 -6
  214. package/src/schematron/cen/cen-en16931-br-04.ts +6 -5
  215. package/src/schematron/cen/cen-en16931-br-05.ts +6 -5
  216. package/src/schematron/cen/cen-en16931-br-06.ts +6 -5
  217. package/src/schematron/cen/cen-en16931-br-07.ts +6 -5
  218. package/src/schematron/cen/cen-en16931-br-08.ts +6 -5
  219. package/src/schematron/cen/cen-en16931-br-09.ts +6 -5
  220. package/src/schematron/cen/cen-en16931-br-10.ts +6 -5
  221. package/src/schematron/cen/cen-en16931-br-11.ts +6 -5
  222. package/src/schematron/cen/cen-en16931-br-12.ts +6 -5
  223. package/src/schematron/cen/cen-en16931-br-13.ts +6 -5
  224. package/src/schematron/cen/cen-en16931-br-14.ts +6 -5
  225. package/src/schematron/cen/cen-en16931-br-15.ts +6 -5
  226. package/src/schematron/cen/cen-en16931-br-16.ts +6 -5
  227. package/src/schematron/cen/cen-en16931-br-17.ts +6 -5
  228. package/src/schematron/cen/cen-en16931-br-18.ts +6 -5
  229. package/src/schematron/cen/cen-en16931-br-19.ts +6 -5
  230. package/src/schematron/cen/cen-en16931-br-20.ts +6 -5
  231. package/src/schematron/cen/cen-en16931-br-21.ts +6 -5
  232. package/src/schematron/cen/cen-en16931-br-22.ts +6 -5
  233. package/src/schematron/cen/cen-en16931-br-23.ts +6 -5
  234. package/src/schematron/cen/cen-en16931-br-24.ts +6 -5
  235. package/src/schematron/cen/cen-en16931-br-25.ts +6 -5
  236. package/src/schematron/cen/cen-en16931-br-26.ts +6 -5
  237. package/src/schematron/cen/cen-en16931-br-27.ts +6 -5
  238. package/src/schematron/cen/cen-en16931-br-28.ts +6 -5
  239. package/src/schematron/cen/cen-en16931-br-29.ts +6 -5
  240. package/src/schematron/cen/cen-en16931-br-30.ts +6 -5
  241. package/src/schematron/cen/cen-en16931-br-31.ts +6 -5
  242. package/src/schematron/cen/cen-en16931-br-32.ts +6 -5
  243. package/src/schematron/cen/cen-en16931-br-33.ts +6 -5
  244. package/src/schematron/cen/cen-en16931-br-36.ts +6 -5
  245. package/src/schematron/cen/cen-en16931-br-37.ts +6 -5
  246. package/src/schematron/cen/cen-en16931-br-38.ts +6 -5
  247. package/src/schematron/cen/cen-en16931-br-41.ts +6 -5
  248. package/src/schematron/cen/cen-en16931-br-42.ts +6 -5
  249. package/src/schematron/cen/cen-en16931-br-43.ts +6 -5
  250. package/src/schematron/cen/cen-en16931-br-44.ts +6 -5
  251. package/src/schematron/cen/cen-en16931-br-45.ts +6 -5
  252. package/src/schematron/cen/cen-en16931-br-46.ts +6 -5
  253. package/src/schematron/cen/cen-en16931-br-47.ts +6 -5
  254. package/src/schematron/cen/cen-en16931-br-48.ts +6 -5
  255. package/src/schematron/cen/cen-en16931-br-49.ts +6 -5
  256. package/src/schematron/cen/cen-en16931-br-50.ts +6 -5
  257. package/src/schematron/cen/cen-en16931-br-51.ts +6 -5
  258. package/src/schematron/cen/cen-en16931-br-52.ts +6 -5
  259. package/src/schematron/cen/cen-en16931-br-53.ts +6 -5
  260. package/src/schematron/cen/cen-en16931-br-54.ts +6 -5
  261. package/src/schematron/cen/cen-en16931-br-55.ts +6 -5
  262. package/src/schematron/cen/cen-en16931-br-56.ts +6 -5
  263. package/src/schematron/cen/cen-en16931-br-57.ts +6 -5
  264. package/src/schematron/cen/cen-en16931-br-61.ts +6 -5
  265. package/src/schematron/cen/cen-en16931-br-62.ts +6 -5
  266. package/src/schematron/cen/cen-en16931-br-63.ts +6 -5
  267. package/src/schematron/cen/cen-en16931-br-64.ts +6 -5
  268. package/src/schematron/cen/cen-en16931-br-65.ts +6 -5
  269. package/src/schematron/cen/cl/cen-en16931-br-cl-08.ts +6 -5
  270. package/src/schematron/cen/co/cen-en16931-br-co-03.ts +6 -5
  271. package/src/schematron/cen/co/cen-en16931-br-co-04.ts +6 -5
  272. package/src/schematron/cen/co/cen-en16931-br-co-05.ts +6 -5
  273. package/src/schematron/cen/co/cen-en16931-br-co-06.ts +6 -5
  274. package/src/schematron/cen/co/cen-en16931-br-co-07.ts +6 -5
  275. package/src/schematron/cen/co/cen-en16931-br-co-08.ts +6 -5
  276. package/src/schematron/cen/co/cen-en16931-br-co-09.ts +6 -5
  277. package/src/schematron/cen/co/cen-en16931-br-co-10.ts +6 -5
  278. package/src/schematron/cen/co/cen-en16931-br-co-11.ts +6 -5
  279. package/src/schematron/cen/co/cen-en16931-br-co-12.ts +6 -5
  280. package/src/schematron/cen/co/cen-en16931-br-co-13.ts +6 -5
  281. package/src/schematron/cen/co/cen-en16931-br-co-14.ts +6 -5
  282. package/src/schematron/cen/co/cen-en16931-br-co-15.ts +6 -5
  283. package/src/schematron/cen/co/cen-en16931-br-co-16.ts +6 -5
  284. package/src/schematron/cen/co/cen-en16931-br-co-17.ts +6 -5
  285. package/src/schematron/cen/co/cen-en16931-br-co-18.ts +6 -5
  286. package/src/schematron/cen/co/cen-en16931-br-co-19.ts +6 -5
  287. package/src/schematron/cen/co/cen-en16931-br-co-20.ts +6 -5
  288. package/src/schematron/cen/co/cen-en16931-br-co-21.ts +6 -5
  289. package/src/schematron/cen/co/cen-en16931-br-co-22.ts +6 -5
  290. package/src/schematron/cen/co/cen-en16931-br-co-23.ts +6 -5
  291. package/src/schematron/cen/co/cen-en16931-br-co-24.ts +6 -5
  292. package/src/schematron/cen/co/cen-en16931-br-co-25.ts +6 -5
  293. package/src/schematron/cen/co/cen-en16931-br-co-26.ts +6 -5
  294. package/src/schematron/cen/dec/cen-en16931-br-dec-01.ts +6 -5
  295. package/src/schematron/cen/dec/cen-en16931-br-dec-02.ts +6 -5
  296. package/src/schematron/cen/dec/cen-en16931-br-dec-05.ts +6 -5
  297. package/src/schematron/cen/dec/cen-en16931-br-dec-06.ts +6 -5
  298. package/src/schematron/cen/dec/cen-en16931-br-dec-09.ts +6 -5
  299. package/src/schematron/cen/dec/cen-en16931-br-dec-10.ts +6 -5
  300. package/src/schematron/cen/dec/cen-en16931-br-dec-11.ts +6 -5
  301. package/src/schematron/cen/dec/cen-en16931-br-dec-12.ts +6 -5
  302. package/src/schematron/cen/dec/cen-en16931-br-dec-13.ts +6 -5
  303. package/src/schematron/cen/dec/cen-en16931-br-dec-14.ts +6 -5
  304. package/src/schematron/cen/dec/cen-en16931-br-dec-15.ts +6 -5
  305. package/src/schematron/cen/dec/cen-en16931-br-dec-16.ts +6 -5
  306. package/src/schematron/cen/dec/cen-en16931-br-dec-17.ts +6 -5
  307. package/src/schematron/cen/dec/cen-en16931-br-dec-18.ts +6 -5
  308. package/src/schematron/cen/dec/cen-en16931-br-dec-19.ts +6 -5
  309. package/src/schematron/cen/dec/cen-en16931-br-dec-20.ts +6 -5
  310. package/src/schematron/cen/dec/cen-en16931-br-dec-23.ts +6 -5
  311. package/src/schematron/cen/dec/cen-en16931-br-dec-24.ts +6 -5
  312. package/src/schematron/cen/dec/cen-en16931-br-dec-25.ts +6 -5
  313. package/src/schematron/cen/dec/cen-en16931-br-dec-27.ts +6 -5
  314. package/src/schematron/cen/dec/cen-en16931-br-dec-28.ts +6 -5
  315. package/src/schematron/cen/e/cen-en16931-br-e-01.ts +6 -5
  316. package/src/schematron/cen/e/cen-en16931-br-e-02.ts +6 -5
  317. package/src/schematron/cen/e/cen-en16931-br-e-03.ts +6 -10
  318. package/src/schematron/cen/e/cen-en16931-br-e-04.ts +6 -5
  319. package/src/schematron/cen/e/cen-en16931-br-e-05.ts +6 -5
  320. package/src/schematron/cen/e/cen-en16931-br-e-06.ts +6 -5
  321. package/src/schematron/cen/e/cen-en16931-br-e-07.ts +6 -5
  322. package/src/schematron/cen/e/cen-en16931-br-e-08.ts +6 -5
  323. package/src/schematron/cen/e/cen-en16931-br-e-09.ts +6 -5
  324. package/src/schematron/cen/e/cen-en16931-br-e-10.ts +6 -5
  325. package/src/schematron/cen/g/cen-en16931-br-g-01.ts +6 -5
  326. package/src/schematron/cen/g/cen-en16931-br-g-02.ts +6 -5
  327. package/src/schematron/cen/g/cen-en16931-br-g-03.ts +6 -5
  328. package/src/schematron/cen/g/cen-en16931-br-g-04.ts +6 -5
  329. package/src/schematron/cen/g/cen-en16931-br-g-05.ts +6 -5
  330. package/src/schematron/cen/g/cen-en16931-br-g-06.ts +6 -5
  331. package/src/schematron/cen/g/cen-en16931-br-g-07.ts +6 -5
  332. package/src/schematron/cen/g/cen-en16931-br-g-08.ts +6 -5
  333. package/src/schematron/cen/g/cen-en16931-br-g-09.ts +6 -5
  334. package/src/schematron/cen/g/cen-en16931-br-g-10.ts +6 -5
  335. package/src/schematron/cen/ic/cen-en16931-br-ic-01.ts +6 -5
  336. package/src/schematron/cen/ic/cen-en16931-br-ic-02.ts +6 -5
  337. package/src/schematron/cen/ic/cen-en16931-br-ic-03.ts +6 -5
  338. package/src/schematron/cen/ic/cen-en16931-br-ic-04.ts +6 -5
  339. package/src/schematron/cen/ic/cen-en16931-br-ic-05.ts +6 -5
  340. package/src/schematron/cen/ic/cen-en16931-br-ic-06.ts +6 -5
  341. package/src/schematron/cen/ic/cen-en16931-br-ic-07.ts +6 -5
  342. package/src/schematron/cen/ic/cen-en16931-br-ic-08.ts +6 -5
  343. package/src/schematron/cen/ic/cen-en16931-br-ic-09.ts +6 -5
  344. package/src/schematron/cen/ic/cen-en16931-br-ic-10.ts +6 -5
  345. package/src/schematron/cen/ic/cen-en16931-br-ic-11.ts +6 -5
  346. package/src/schematron/cen/ic/cen-en16931-br-ic-12.ts +6 -5
  347. package/src/schematron/cen/o/cen-en16931-br-o-01.ts +6 -5
  348. package/src/schematron/cen/o/cen-en16931-br-o-02.ts +6 -5
  349. package/src/schematron/cen/o/cen-en16931-br-o-03.ts +6 -5
  350. package/src/schematron/cen/o/cen-en16931-br-o-04.ts +6 -5
  351. package/src/schematron/cen/o/cen-en16931-br-o-05.ts +6 -5
  352. package/src/schematron/cen/o/cen-en16931-br-o-06.ts +6 -5
  353. package/src/schematron/cen/o/cen-en16931-br-o-07.ts +6 -5
  354. package/src/schematron/cen/o/cen-en16931-br-o-08.ts +6 -5
  355. package/src/schematron/cen/o/cen-en16931-br-o-09.ts +6 -5
  356. package/src/schematron/cen/o/cen-en16931-br-o-10.ts +6 -5
  357. package/src/schematron/cen/o/cen-en16931-br-o-11.ts +6 -5
  358. package/src/schematron/cen/o/cen-en16931-br-o-12.ts +6 -5
  359. package/src/schematron/cen/o/cen-en16931-br-o-13.ts +6 -5
  360. package/src/schematron/cen/o/cen-en16931-br-o-14.ts +6 -5
  361. package/src/schematron/cen/s/cen-en16931-br-s-01.ts +6 -5
  362. package/src/schematron/cen/s/cen-en16931-br-s-02.ts +6 -5
  363. package/src/schematron/cen/s/cen-en16931-br-s-03.ts +6 -10
  364. package/src/schematron/cen/s/cen-en16931-br-s-04.ts +6 -5
  365. package/src/schematron/cen/s/cen-en16931-br-s-05.ts +6 -5
  366. package/src/schematron/cen/s/cen-en16931-br-s-06.ts +6 -5
  367. package/src/schematron/cen/s/cen-en16931-br-s-07.ts +6 -5
  368. package/src/schematron/cen/s/cen-en16931-br-s-08.ts +6 -5
  369. package/src/schematron/cen/s/cen-en16931-br-s-09.ts +6 -5
  370. package/src/schematron/cen/s/cen-en16931-br-s-10.ts +6 -5
  371. package/src/schematron/cen/z/cen-en16931-br-z-01.ts +6 -5
  372. package/src/schematron/cen/z/cen-en16931-br-z-02.ts +6 -5
  373. package/src/schematron/cen/z/cen-en16931-br-z-03.ts +6 -10
  374. package/src/schematron/cen/z/cen-en16931-br-z-04.ts +6 -5
  375. package/src/schematron/cen/z/cen-en16931-br-z-05.ts +6 -5
  376. package/src/schematron/cen/z/cen-en16931-br-z-06.ts +6 -5
  377. package/src/schematron/cen/z/cen-en16931-br-z-07.ts +6 -5
  378. package/src/schematron/cen/z/cen-en16931-br-z-08.ts +6 -5
  379. package/src/schematron/cen/z/cen-en16931-br-z-09.ts +6 -5
  380. package/src/schematron/cen/z/cen-en16931-br-z-10.ts +6 -5
  381. package/src/schematron/de/de-r-001.ts +8 -7
  382. package/src/schematron/de/de-r-002.ts +8 -7
  383. package/src/schematron/de/de-r-003.ts +8 -7
  384. package/src/schematron/de/de-r-004.ts +8 -7
  385. package/src/schematron/de/de-r-005.ts +8 -7
  386. package/src/schematron/de/de-r-006.ts +8 -7
  387. package/src/schematron/de/de-r-007.ts +8 -7
  388. package/src/schematron/de/de-r-008.ts +8 -7
  389. package/src/schematron/de/de-r-009.ts +8 -7
  390. package/src/schematron/de/de-r-010.ts +9 -8
  391. package/src/schematron/de/de-r-011.ts +9 -8
  392. package/src/schematron/de/de-r-014.ts +8 -7
  393. package/src/schematron/de/de-r-015.ts +8 -7
  394. package/src/schematron/de/de-r-016.ts +9 -8
  395. package/src/schematron/de/de-r-017.ts +8 -7
  396. package/src/schematron/de/de-r-018.ts +10 -9
  397. package/src/schematron/de/de-r-019.ts +8 -7
  398. package/src/schematron/de/de-r-020.ts +8 -7
  399. package/src/schematron/de/de-r-022.ts +8 -7
  400. package/src/schematron/de/de-r-023-1.ts +8 -7
  401. package/src/schematron/de/de-r-023-2.ts +8 -7
  402. package/src/schematron/de/de-r-024-1.ts +8 -7
  403. package/src/schematron/de/de-r-024-2.ts +8 -7
  404. package/src/schematron/de/de-r-025-1.ts +8 -7
  405. package/src/schematron/de/de-r-025-2.ts +8 -7
  406. package/src/schematron/de/de-r-026.ts +9 -8
  407. package/src/schematron/de/de-r-027.ts +8 -7
  408. package/src/schematron/de/de-r-028.ts +8 -7
  409. package/src/schematron/de/de-r-030.ts +9 -8
  410. package/src/schematron/de/de-r-031.ts +8 -7
  411. package/src/schematron/dk/dk-r-002.ts +7 -6
  412. package/src/schematron/dk/dk-r-003.ts +8 -7
  413. package/src/schematron/dk/dk-r-004.ts +8 -7
  414. package/src/schematron/dk/dk-r-005.ts +8 -7
  415. package/src/schematron/dk/dk-r-006.ts +8 -7
  416. package/src/schematron/dk/dk-r-007.ts +8 -7
  417. package/src/schematron/dk/dk-r-008.ts +8 -7
  418. package/src/schematron/dk/dk-r-009.ts +8 -7
  419. package/src/schematron/dk/dk-r-010.ts +8 -7
  420. package/src/schematron/dk/dk-r-011.ts +8 -7
  421. package/src/schematron/dk/dk-r-013.ts +8 -7
  422. package/src/schematron/dk/dk-r-014.ts +7 -6
  423. package/src/schematron/dk/dk-r-016.ts +8 -7
  424. package/src/schematron/dk/dk-r-017.ts +8 -7
  425. package/src/schematron/errors.ts +17 -0
  426. package/src/schematron/gr/gr-r-001-1.ts +7 -6
  427. package/src/schematron/gr/gr-r-001-2.ts +8 -7
  428. package/src/schematron/gr/gr-r-001-3.ts +14 -9
  429. package/src/schematron/gr/gr-r-001-4.ts +8 -7
  430. package/src/schematron/gr/gr-r-001-5.ts +8 -7
  431. package/src/schematron/gr/gr-r-001-6.ts +7 -6
  432. package/src/schematron/gr/gr-r-001-7.ts +7 -6
  433. package/src/schematron/gr/gr-r-002.ts +7 -6
  434. package/src/schematron/gr/gr-r-003.ts +8 -7
  435. package/src/schematron/gr/gr-r-004-1.ts +7 -6
  436. package/src/schematron/gr/gr-r-004-2.ts +7 -6
  437. package/src/schematron/gr/gr-r-005.ts +7 -6
  438. package/src/schematron/gr/gr-r-006.ts +8 -7
  439. package/src/schematron/gr/gr-r-008-2.ts +7 -6
  440. package/src/schematron/gr/gr-r-008-3.ts +7 -6
  441. package/src/schematron/gr/gr-r-009.ts +7 -6
  442. package/src/schematron/gr/gr-r-010.ts +7 -6
  443. package/src/schematron/gr/gr-s-008-1.ts +7 -6
  444. package/src/schematron/gr/gr-s-011.ts +8 -7
  445. package/src/schematron/helpers.ts +36 -11
  446. package/src/schematron/index.ts +6 -1
  447. package/src/schematron/is/is-r-001.ts +7 -6
  448. package/src/schematron/is/is-r-002.ts +7 -6
  449. package/src/schematron/is/is-r-003.ts +7 -6
  450. package/src/schematron/is/is-r-004.ts +7 -6
  451. package/src/schematron/is/is-r-005.ts +7 -6
  452. package/src/schematron/is/is-r-006.ts +8 -7
  453. package/src/schematron/is/is-r-007.ts +8 -7
  454. package/src/schematron/is/is-r-008.ts +8 -7
  455. package/src/schematron/is/is-r-009.ts +8 -7
  456. package/src/schematron/is/is-r-010.ts +9 -8
  457. package/src/schematron/it/it-r-001.ts +7 -6
  458. package/src/schematron/it/it-r-002.ts +7 -6
  459. package/src/schematron/it/it-r-003.ts +7 -6
  460. package/src/schematron/it/it-r-004.ts +7 -6
  461. package/src/schematron/nl/nl-r-001.ts +7 -6
  462. package/src/schematron/nl/nl-r-002.ts +7 -6
  463. package/src/schematron/nl/nl-r-003.ts +8 -7
  464. package/src/schematron/nl/nl-r-004.ts +7 -6
  465. package/src/schematron/nl/nl-r-005.ts +8 -7
  466. package/src/schematron/nl/nl-r-006.ts +8 -7
  467. package/src/schematron/nl/nl-r-007.ts +8 -7
  468. package/src/schematron/nl/nl-r-008.ts +7 -6
  469. package/src/schematron/nl/nl-r-009.ts +8 -7
  470. package/src/schematron/no/no-r-001.ts +8 -7
  471. package/src/schematron/no/no-r-002.ts +7 -6
  472. package/src/schematron/peppol/cl/peppol-en16931-cl001.ts +6 -5
  473. package/src/schematron/peppol/cl/peppol-en16931-cl002.ts +6 -5
  474. package/src/schematron/peppol/cl/peppol-en16931-cl003.ts +6 -5
  475. package/src/schematron/peppol/cl/peppol-en16931-cl006.ts +7 -6
  476. package/src/schematron/peppol/cl/peppol-en16931-cl007.ts +6 -5
  477. package/src/schematron/peppol/cl/peppol-en16931-cl008.ts +6 -5
  478. package/src/schematron/peppol/common/peppol-common-r040.ts +6 -5
  479. package/src/schematron/peppol/common/peppol-common-r041.ts +6 -5
  480. package/src/schematron/peppol/common/peppol-common-r042.ts +6 -5
  481. package/src/schematron/peppol/common/peppol-common-r043.ts +6 -5
  482. package/src/schematron/peppol/common/peppol-common-r044.ts +6 -5
  483. package/src/schematron/peppol/common/peppol-common-r045.ts +6 -5
  484. package/src/schematron/peppol/common/peppol-common-r046.ts +6 -5
  485. package/src/schematron/peppol/common/peppol-common-r047.ts +6 -5
  486. package/src/schematron/peppol/common/peppol-common-r049.ts +6 -5
  487. package/src/schematron/peppol/common/peppol-common-r050.ts +6 -5
  488. package/src/schematron/peppol/common/peppol-common-r052.ts +6 -5
  489. package/src/schematron/peppol/common/peppol-common-r053.ts +6 -5
  490. package/src/schematron/peppol/f/peppol-en16931-f001.ts +20 -13
  491. package/src/schematron/peppol/p/peppol-en16931-p0100.ts +8 -7
  492. package/src/schematron/peppol/p/peppol-en16931-p0101.ts +8 -7
  493. package/src/schematron/peppol/p/peppol-en16931-p0104.ts +6 -5
  494. package/src/schematron/peppol/p/peppol-en16931-p0105.ts +6 -5
  495. package/src/schematron/peppol/p/peppol-en16931-p0106.ts +6 -5
  496. package/src/schematron/peppol/p/peppol-en16931-p0107.ts +6 -5
  497. package/src/schematron/peppol/p/peppol-en16931-p0108.ts +6 -5
  498. package/src/schematron/peppol/p/peppol-en16931-p0109.ts +6 -5
  499. package/src/schematron/peppol/p/peppol-en16931-p0110.ts +6 -5
  500. package/src/schematron/peppol/p/peppol-en16931-p0111.ts +6 -5
  501. package/src/schematron/peppol/p/peppol-en16931-p0112.ts +7 -6
  502. package/src/schematron/peppol/r/peppol-en16931-r001.ts +11 -13
  503. package/src/schematron/peppol/r/peppol-en16931-r002.ts +6 -5
  504. package/src/schematron/peppol/r/peppol-en16931-r003.ts +6 -5
  505. package/src/schematron/peppol/r/peppol-en16931-r004.ts +6 -5
  506. package/src/schematron/peppol/r/peppol-en16931-r005.ts +7 -6
  507. package/src/schematron/peppol/r/peppol-en16931-r007.ts +6 -5
  508. package/src/schematron/peppol/r/peppol-en16931-r008.ts +6 -5
  509. package/src/schematron/peppol/r/peppol-en16931-r010.ts +6 -5
  510. package/src/schematron/peppol/r/peppol-en16931-r020.ts +6 -5
  511. package/src/schematron/peppol/r/peppol-en16931-r040.ts +6 -5
  512. package/src/schematron/peppol/r/peppol-en16931-r041.ts +6 -5
  513. package/src/schematron/peppol/r/peppol-en16931-r042.ts +6 -5
  514. package/src/schematron/peppol/r/peppol-en16931-r043.ts +6 -5
  515. package/src/schematron/peppol/r/peppol-en16931-r044.ts +6 -5
  516. package/src/schematron/peppol/r/peppol-en16931-r046.ts +6 -5
  517. package/src/schematron/peppol/r/peppol-en16931-r051.ts +6 -5
  518. package/src/schematron/peppol/r/peppol-en16931-r053.ts +6 -5
  519. package/src/schematron/peppol/r/peppol-en16931-r054.ts +6 -5
  520. package/src/schematron/peppol/r/peppol-en16931-r055.ts +8 -7
  521. package/src/schematron/peppol/r/peppol-en16931-r061.ts +6 -5
  522. package/src/schematron/peppol/r/peppol-en16931-r100.ts +6 -5
  523. package/src/schematron/peppol/r/peppol-en16931-r101.ts +6 -5
  524. package/src/schematron/peppol/r/peppol-en16931-r110.ts +7 -6
  525. package/src/schematron/peppol/r/peppol-en16931-r111.ts +7 -6
  526. package/src/schematron/peppol/r/peppol-en16931-r120.ts +6 -5
  527. package/src/schematron/peppol/r/peppol-en16931-r121.ts +6 -5
  528. package/src/schematron/peppol/r/peppol-en16931-r130.ts +6 -5
  529. package/src/schematron/run-all-rules.ts +2 -7
  530. package/src/schematron/schematron.ts +36 -0
  531. package/src/schematron/se/se-r-001.ts +7 -6
  532. package/src/schematron/se/se-r-002.ts +7 -6
  533. package/src/schematron/se/se-r-003.ts +7 -6
  534. package/src/schematron/se/se-r-004.ts +7 -6
  535. package/src/schematron/se/se-r-005.ts +8 -7
  536. package/src/schematron/se/se-r-006.ts +7 -6
  537. package/src/schematron/se/se-r-007.ts +7 -6
  538. package/src/schematron/se/se-r-008.ts +7 -6
  539. package/src/schematron/se/se-r-009.ts +7 -6
  540. package/src/schematron/se/se-r-010.ts +7 -6
  541. package/src/schematron/se/se-r-011.ts +7 -6
  542. package/src/schematron/se/se-r-012.ts +7 -6
  543. package/src/schematron/se/se-r-013.ts +7 -6
  544. package/src/values/additional-document-reference-codes.generated.ts +2 -3
  545. package/src/values/allowance-charge-reason-codes.generated.ts +1 -1
  546. package/src/values/application-response-type-codes.generated.ts +1 -1
  547. package/src/values/charge-reason-codes.generated.ts +1 -1
  548. package/src/values/country-code.generated.ts +1 -1
  549. package/src/values/credit-notes-type-codes.generated.ts +1 -1
  550. package/src/values/currency-code.generated.ts +1 -1
  551. package/src/values/document-type-codes.generated.ts +1 -1
  552. package/src/values/document-type.generated.ts +2 -2
  553. package/src/values/duty-tax-fee-categories.generated.ts +1 -1
  554. package/src/values/eas-codes.generated.ts +1 -1
  555. package/src/values/icd-codes.generated.ts +7 -7
  556. package/src/values/invoice-status-codes.generated.ts +1 -1
  557. package/src/values/invoice-type-codes.generated.ts +1 -1
  558. package/src/values/item-classification-code.generated.ts +1 -1
  559. package/src/values/mime-codes.generated.ts +1 -1
  560. package/src/values/op-status-action.generated.ts +1 -1
  561. package/src/values/op-status-reason.generated.ts +1 -1
  562. package/src/values/participant-identifier-schemes.generated.ts +2 -2
  563. package/src/values/payment-means-codes.generated.ts +1 -1
  564. package/src/values/processes.generated.ts +1 -1
  565. package/src/values/quantity-unit-codes.generated.ts +1 -1
  566. package/src/values/vat-dates.generated.ts +1 -1
  567. package/src/values/vatex-codes.generated.ts +1 -1
  568. package/dist/all-union-fields-CxoyKBpI.d.ts +0 -445
  569. package/dist/all-union-fields-CxoyKBpI.d.ts.map +0 -1
  570. package/dist/document-DCcObB-a.d.ts +0 -1466
  571. package/dist/document-DCcObB-a.d.ts.map +0 -1
  572. package/dist/effect.d.ts +0 -6291
  573. package/dist/effect.d.ts.map +0 -1
  574. package/dist/effect.js +0 -3240
  575. package/dist/effect.js.map +0 -1
  576. package/dist/index.d.ts.map +0 -1
  577. package/dist/is-valid-process-CSWL-q9f.js +0 -1590
  578. package/dist/is-valid-process-CSWL-q9f.js.map +0 -1
  579. package/dist/quantity-unit-code-to-intl-unit-15EykjMe.d.ts +0 -168
  580. package/dist/quantity-unit-code-to-intl-unit-15EykjMe.d.ts.map +0 -1
  581. package/dist/vat-dates.generated-DTVWQAdn.d.ts +0 -4812
  582. package/dist/vat-dates.generated-DTVWQAdn.d.ts.map +0 -1
  583. package/dist/vatex-codes.generated-BSgP3n5t.js.map +0 -1
  584. package/src/decoders/errors.ts +0 -11
  585. package/src/document-parser.ts +0 -70
  586. package/src/document.ts +0 -19
  587. package/src/effect/fields/default-customization-id.ts +0 -1
  588. package/src/effect/fields/default-profile-id.ts +0 -1
  589. package/src/effect/fields/peppol-additional-document-reference-schema.ts +0 -114
  590. package/src/effect/fields/peppol-address-schema.ts +0 -105
  591. package/src/effect/fields/peppol-allowance-charge-schema.ts +0 -95
  592. package/src/effect/fields/peppol-amount-schema.ts +0 -22
  593. package/src/effect/fields/peppol-base-line-schema.ts +0 -138
  594. package/src/effect/fields/peppol-binary-object-schema.ts +0 -51
  595. package/src/effect/fields/peppol-contact-schema.ts +0 -18
  596. package/src/effect/fields/peppol-credit-note-line-schema.ts +0 -42
  597. package/src/effect/fields/peppol-delivery-schema.ts +0 -100
  598. package/src/effect/fields/peppol-identifier-schema.ts +0 -19
  599. package/src/effect/fields/peppol-invoice-line-period-schema.ts +0 -34
  600. package/src/effect/fields/peppol-invoice-period-schema.ts +0 -30
  601. package/src/effect/fields/peppol-item-classification-schema.ts +0 -45
  602. package/src/effect/fields/peppol-legal-monetary-total-schema.ts +0 -126
  603. package/src/effect/fields/peppol-line-allowance-charge-schema.ts +0 -64
  604. package/src/effect/fields/peppol-line-item-schema.ts +0 -185
  605. package/src/effect/fields/peppol-line-price-allowance-charge-schema.ts +0 -38
  606. package/src/effect/fields/peppol-line-price-schema.ts +0 -31
  607. package/src/effect/fields/peppol-order-reference-schema.ts +0 -36
  608. package/src/effect/fields/peppol-party-base-schema.ts +0 -138
  609. package/src/effect/fields/peppol-party-legal-entity-schema.ts +0 -29
  610. package/src/effect/fields/peppol-party-tax-scheme-schema.ts +0 -33
  611. package/src/effect/fields/peppol-payee-party-schema.ts +0 -112
  612. package/src/effect/fields/peppol-payment-means-schema.ts +0 -210
  613. package/src/effect/fields/peppol-payment-terms-schema.ts +0 -23
  614. package/src/effect/fields/peppol-quantity-schema.ts +0 -21
  615. package/src/effect/fields/peppol-reference-schema.ts +0 -5
  616. package/src/effect/fields/peppol-tax-category-schema.ts +0 -42
  617. package/src/effect/fields/peppol-tax-representative-schema.ts +0 -23
  618. package/src/effect/fields/peppol-tax-subtotal-schema.ts +0 -32
  619. package/src/effect/fields/peppol-tax-totals-base-schema.ts +0 -25
  620. package/src/effect/index.ts +0 -56
  621. package/src/effect/peppol-billing-base-schema.ts +0 -355
  622. package/src/effect/peppol-credit-note-schema.ts +0 -30
  623. package/src/effect/peppol-document-response-document-reference-schema.ts +0 -38
  624. package/src/effect/peppol-document-response-document-schema.ts +0 -35
  625. package/src/effect/peppol-document-response-line-response-content-schema.ts +0 -44
  626. package/src/effect/peppol-document-response-line-response-schema.ts +0 -33
  627. package/src/effect/peppol-document-schema.ts +0 -142
  628. package/src/effect/peppol-invoice-response-document-actual-response-status-schema.ts +0 -60
  629. package/src/effect/peppol-invoice-response-schema.ts +0 -168
  630. package/src/effect/peppol-invoice-response-status-reason-code-schema.ts +0 -31
  631. package/src/effect/peppol-invoice-schema.ts +0 -42
  632. package/src/effect/peppol-iso-date-string-schema.ts +0 -19
  633. package/src/effect/peppol-message-level-response-document-response-schema.ts +0 -33
  634. package/src/effect/peppol-message-level-response-party-schema.ts +0 -19
  635. package/src/effect/peppol-message-level-response-schema.ts +0 -97
  636. package/src/effect/utils/format-quantity-with-unit.ts +0 -1
  637. package/src/effect/utils/get-credit-note-type-code-description.ts +0 -1
  638. package/src/effect/utils/get-invoice-type-code-description.ts +0 -1
  639. package/src/effect/utils/is-valid-credit-note-type-code.ts +0 -1
  640. package/src/effect/utils/is-valid-invoice-type-code.ts +0 -1
  641. package/src/effect/utils/is-valid-process.ts +0 -1
  642. package/src/effect/utils/peppol-xsd-time-schema.ts +0 -13
  643. package/src/effect/utils/quantity-unit-code-to-intl-unit.ts +0 -2
  644. package/src/effect/values/credit-note-type-code-schema.ts +0 -23
  645. package/src/effect/values/document-type-schemes-schema.ts +0 -14
  646. package/src/effect/values/document-type-values-schema.ts +0 -16
  647. package/src/effect/values/invoice-type-code-schema.ts +0 -21
  648. package/src/effect/values/process-from-document-type-schema.ts +0 -26
  649. package/src/effect/values/quantity-unit-codes-schema.ts +0 -24
  650. package/src/helpers/errors.ts +0 -6
  651. package/src/helpers/is-defined.ts +0 -3
  652. package/src/schemas/billing-base.ts +0 -362
  653. package/src/schemas/credit-note.ts +0 -28
  654. package/src/schemas/document-response-document-reference-schema.ts +0 -37
  655. package/src/schemas/document-response-document-schema.ts +0 -34
  656. package/src/schemas/document-response-line-response-content.ts +0 -43
  657. package/src/schemas/document-response-line-response-schema.ts +0 -33
  658. package/src/schemas/fields/additional-document-reference-schema.ts +0 -112
  659. package/src/schemas/fields/address-schema.ts +0 -105
  660. package/src/schemas/fields/allowance-charge-schema.ts +0 -86
  661. package/src/schemas/fields/amount-schema.ts +0 -21
  662. package/src/schemas/fields/base-line-schema.ts +0 -136
  663. package/src/schemas/fields/billing-references-schema.ts +0 -44
  664. package/src/schemas/fields/binary-object-schema.ts +0 -45
  665. package/src/schemas/fields/contact-schema.ts +0 -18
  666. package/src/schemas/fields/credit-note-line-schema.ts +0 -37
  667. package/src/schemas/fields/date-only-fn.ts +0 -6
  668. package/src/schemas/fields/date-only-parser.ts +0 -20
  669. package/src/schemas/fields/delivery-schema.ts +0 -95
  670. package/src/schemas/fields/identifier-schema.ts +0 -24
  671. package/src/schemas/fields/invoice-line-period-schema.ts +0 -31
  672. package/src/schemas/fields/invoice-line-schema.ts +0 -41
  673. package/src/schemas/fields/invoice-period-schema.ts +0 -27
  674. package/src/schemas/fields/legal-monetary-total-schema.ts +0 -125
  675. package/src/schemas/fields/line-allowance-charge-schema.ts +0 -59
  676. package/src/schemas/fields/line-item-schema.ts +0 -183
  677. package/src/schemas/fields/line-price-allowance-charge-schema.ts +0 -33
  678. package/src/schemas/fields/list-identifier-schema.ts +0 -43
  679. package/src/schemas/fields/order-reference-schema.ts +0 -36
  680. package/src/schemas/fields/party-base-schema.ts +0 -131
  681. package/src/schemas/fields/party-legal-entity-schema.ts +0 -29
  682. package/src/schemas/fields/party-tax-schema.ts +0 -33
  683. package/src/schemas/fields/payee-party.ts +0 -107
  684. package/src/schemas/fields/payment-means-schema.ts +0 -209
  685. package/src/schemas/fields/payment-terms-schema.ts +0 -23
  686. package/src/schemas/fields/price-schema.ts +0 -31
  687. package/src/schemas/fields/quantity-schema.ts +0 -21
  688. package/src/schemas/fields/reference-schema.ts +0 -4
  689. package/src/schemas/fields/tax-category-schema.ts +0 -41
  690. package/src/schemas/fields/tax-representative-party-schema.ts +0 -23
  691. package/src/schemas/fields/tax-subtotal-category-schema.ts +0 -26
  692. package/src/schemas/fields/tax-subtotal-schema.ts +0 -32
  693. package/src/schemas/fields/tax-totals.ts +0 -25
  694. package/src/schemas/fields/time-only.ts +0 -23
  695. package/src/schemas/invoice-response-document-actual-response-status.ts +0 -58
  696. package/src/schemas/invoice-response-document-actual-response.ts +0 -73
  697. package/src/schemas/invoice-response-schema.ts +0 -155
  698. package/src/schemas/invoice-response-status-reason-code.ts +0 -30
  699. package/src/schemas/invoice.ts +0 -43
  700. package/src/schemas/message-level-response-document-response-schema.ts +0 -33
  701. package/src/schemas/message-level-response-party-schema.ts +0 -18
  702. package/src/schemas/message-level-response-schema.ts +0 -96
  703. package/src/schemas/utils/base-64.ts +0 -34
  704. package/src/schemas/utils/vat-regex.ts +0 -51
  705. package/src/schemas/utils/xsd-time.ts +0 -9
  706. package/src/schemas/values/additional-document-reference-code.ts +0 -27
  707. package/src/schemas/values/allowance-charge-reason-code.ts +0 -29
  708. package/src/schemas/values/application-response-type-codes.ts +0 -25
  709. package/src/schemas/values/charge-reason-code.ts +0 -29
  710. package/src/schemas/values/country-code.ts +0 -36
  711. package/src/schemas/values/currency-codes.ts +0 -35
  712. package/src/schemas/values/document-type-codes.ts +0 -25
  713. package/src/schemas/values/document-type-schema.ts +0 -49
  714. package/src/schemas/values/duty-tax-fee-cateogries.ts +0 -28
  715. package/src/schemas/values/eas-codes.ts +0 -35
  716. package/src/schemas/values/icd-codes.ts +0 -28
  717. package/src/schemas/values/invoice-status-codes.ts +0 -25
  718. package/src/schemas/values/item-classification-code-schema.ts +0 -28
  719. package/src/schemas/values/mime-code.ts +0 -28
  720. package/src/schemas/values/op-status-action.ts +0 -25
  721. package/src/schemas/values/op-status-reason.ts +0 -25
  722. package/src/schemas/values/participant-identifier-code.ts +0 -25
  723. package/src/schemas/values/payment-means-codes-schema.ts +0 -36
  724. package/src/schemas/values/process-schema.ts +0 -41
  725. package/src/schemas/values/process-xml-identifier-schema.ts +0 -27
  726. package/src/schemas/values/vat-date-code.ts +0 -15
  727. package/src/schemas/values/vatex-code.ts +0 -28
  728. package/src/schemas.ts +0 -97
  729. /package/src/{effect → schemas}/utils/peppol-base-64-schema.ts +0 -0
  730. /package/src/{effect → schemas}/utils/peppol-vat-regex-schema.ts +0 -0
  731. /package/src/{effect → schemas}/values/additional-document-reference-code-schema.ts +0 -0
  732. /package/src/{effect → schemas}/values/allowance-charge-reason-code-schema.ts +0 -0
  733. /package/src/{effect → schemas}/values/application-response-type-code-schema.ts +0 -0
  734. /package/src/{effect → schemas}/values/charge-reason-code-schema.ts +0 -0
  735. /package/src/{effect → schemas}/values/currency-code-schema.ts +0 -0
  736. /package/src/{effect → schemas}/values/electronic-codes-schema.ts +0 -0
  737. /package/src/{effect → schemas}/values/icd-codes-schema.ts +0 -0
  738. /package/src/{effect → schemas}/values/index.ts +0 -0
  739. /package/src/{effect → schemas}/values/invoice-status-code-schema.ts +0 -0
  740. /package/src/{effect → schemas}/values/item-classification-codes-schema.ts +0 -0
  741. /package/src/{effect → schemas}/values/mime-codes-schema.ts +0 -0
  742. /package/src/{effect → schemas}/values/op-status-action-schema.ts +0 -0
  743. /package/src/{effect → schemas}/values/op-status-reason-schema.ts +0 -0
  744. /package/src/{effect → schemas}/values/participant-identifier-code-schema.ts +0 -0
  745. /package/src/{effect → schemas}/values/payment-means-code-schema.ts +0 -0
  746. /package/src/{effect → schemas}/values/peppol-country-code-schema.ts +0 -0
  747. /package/src/{effect → schemas}/values/peppol-document-type-code-schema.ts +0 -0
  748. /package/src/{effect → schemas}/values/peppol-document-type-schema.ts +0 -0
  749. /package/src/{effect → schemas}/values/peppol-process-schema.ts +0 -0
  750. /package/src/{effect → schemas}/values/vat-date-code-schema.ts +0 -0
  751. /package/src/{effect → schemas}/values/vatex-code-schema.ts +0 -0
@@ -1,1590 +0,0 @@
1
- import { A as invoiceTypeCodes, M as quantityUnitCodes, O as creditNoteTypeCodes, v as processesList } from "./vatex-codes.generated-BSgP3n5t.js";
2
- import { Effect, Predicate, Schema } from "effect";
3
- //#region src/constants/message-level-response-profile-id.ts
4
- const MESSAGE_LEVEL_RESPONSE_PROFILE_ID = "urn:fdc:peppol.eu:poacc:bis:mlr:3";
5
- //#endregion
6
- //#region src/invoice-response-codes/invoice-response-code-needs-schema.ts
7
- const invoiceResponseCodeNeedsSchema = [
8
- "UQ",
9
- "RE",
10
- "CA"
11
- ];
12
- //#endregion
13
- //#region src/invoice-response-codes/invoice-response-code-not-needs-schema.ts
14
- const invoiceResponseCodeNotNeedsSchema = [
15
- "AB",
16
- "AP",
17
- "IP",
18
- "PD"
19
- ];
20
- //#endregion
21
- //#region src/constants/invoice-response-profile-id.ts
22
- const INVOICE_RESPONSE_PROFILE_ID = "urn:fdc:peppol.eu:poacc:bis:invoice_response:3";
23
- //#endregion
24
- //#region src/helpers/is-defined.ts
25
- function isDefined(value) {
26
- return typeof value !== "undefined" && value !== null;
27
- }
28
- //#endregion
29
- //#region src/helpers/get-prop.ts
30
- const getProp = Effect.fn(function* (node, ...path) {
31
- if (!Predicate.isTruthy(node)) return;
32
- if (path.length === 0) return node;
33
- let currentNode = node;
34
- for (const key of path) {
35
- const newNode = currentNode[key];
36
- if (isDefined(newNode)) {
37
- currentNode = newNode;
38
- continue;
39
- }
40
- if (key.includes(":")) {
41
- const [, localKey] = key.split(":");
42
- currentNode = currentNode[localKey];
43
- if (!isDefined(currentNode)) return;
44
- } else return;
45
- }
46
- return currentNode;
47
- });
48
- //#endregion
49
- //#region src/helpers/str-or-und.ts
50
- const strOrUnd = Effect.fn(function* (node, ...path) {
51
- const val = yield* getProp(node, ...path);
52
- if (!isDefined(val)) return void 0;
53
- if (!Predicate.isObject(val)) return val.toString();
54
- const raw = val;
55
- if (Predicate.isUndefined(raw["#text"])) return void 0;
56
- return raw["#text"].toString();
57
- });
58
- //#endregion
59
- //#region src/decoders/fields/decode-identifier.ts
60
- const decodeIdentifier = Effect.fn(function* (node, ...path) {
61
- const val = yield* getProp(node, ...path);
62
- if (!Predicate.isTruthy(val) && val !== 0) return void 0;
63
- const id = yield* strOrUnd(val);
64
- if ((Predicate.isString(val) || Predicate.isNumber(val)) && Predicate.isTruthy(id)) return { id };
65
- if (!Predicate.isTruthy(id)) return void 0;
66
- return {
67
- id,
68
- schemeId: yield* strOrUnd(val, "@schemeID")
69
- };
70
- });
71
- //#endregion
72
- //#region src/helpers/get-array.ts
73
- const getArray = Effect.fn(function* (node, ...path) {
74
- if (!Predicate.isTruthy(node)) return [];
75
- let currentNode = node;
76
- for (const key of path) {
77
- if (!Predicate.isTruthy(currentNode)) return [];
78
- if (Array.isArray(currentNode)) currentNode = (yield* Effect.forEach(currentNode, Effect.fn(function* (n) {
79
- return (yield* getProp(n, key)) || [];
80
- }))).flat();
81
- else currentNode = yield* getProp(currentNode, key);
82
- }
83
- if (!Predicate.isTruthy(currentNode)) return [];
84
- return Array.isArray(currentNode) ? currentNode : [currentNode];
85
- });
86
- //#endregion
87
- //#region src/decoders/fields/decode-additional-document-references.ts
88
- const decodeAdditionalDocumentReferences = Effect.fn(function* (doc) {
89
- const arr = yield* getArray(doc, "cac:AdditionalDocumentReference");
90
- if (arr.length === 0) return;
91
- return yield* Effect.forEach(arr, Effect.fn(function* (additionalDocumentReference) {
92
- const attachment = yield* getProp(additionalDocumentReference, "cac:Attachment");
93
- const embeddedDocumentBinaryObject = yield* getProp(attachment, "cbc:EmbeddedDocumentBinaryObject");
94
- const externalReference = yield* getProp(attachment, "cac:ExternalReference");
95
- return {
96
- attachment: Predicate.isNotNullish(attachment) ? {
97
- embeddedDocumentBinaryObject: Predicate.isNotNullish(embeddedDocumentBinaryObject) ? {
98
- content: yield* strOrUnd(embeddedDocumentBinaryObject),
99
- filename: yield* strOrUnd(embeddedDocumentBinaryObject, "@filename"),
100
- mimeCode: yield* strOrUnd(embeddedDocumentBinaryObject, "@mimeCode")
101
- } : void 0,
102
- externalReference: Predicate.isNotNullish(externalReference) ? { uri: yield* strOrUnd(externalReference, "cbc:URI") } : void 0
103
- } : void 0,
104
- documentDescription: yield* strOrUnd(additionalDocumentReference, "cbc:DocumentDescription"),
105
- documentTypeCode: yield* strOrUnd(additionalDocumentReference, "cbc:DocumentTypeCode"),
106
- id: yield* decodeIdentifier(additionalDocumentReference, "cbc:ID")
107
- };
108
- }));
109
- });
110
- //#endregion
111
- //#region src/decoders/fields/decode-amount.ts
112
- const decodeAmount = Effect.fn(function* (amount, ...path) {
113
- const val = yield* getProp(amount, ...path);
114
- if (!Predicate.isTruthy(val) && val !== 0) return void 0;
115
- if (Predicate.isObject(val)) {
116
- const raw = val;
117
- return {
118
- currencyId: String(raw["@currencyID"]),
119
- value: parseFloat(String(raw["#text"] ?? raw))
120
- };
121
- }
122
- return {
123
- currencyId: "",
124
- value: parseFloat(String(val))
125
- };
126
- });
127
- //#endregion
128
- //#region src/helpers/errors.ts
129
- /**
130
- * @description Raised when a value cannot be found at the requested XML node path.
131
- */
132
- var PeppolNodeError = class extends Schema.TaggedError()("PeppolNodeError", { message: Schema.String }) {};
133
- //#endregion
134
- //#region src/helpers/bool.ts
135
- const bool = Effect.fn(function* (node, ...path) {
136
- const val = yield* getProp(node, ...path);
137
- if (!isDefined(val)) return yield* new PeppolNodeError({ message: `Unable to find ${path.join("->")} into ${node}` });
138
- if (Predicate.isBoolean(val)) return val;
139
- if (Predicate.isObject(val) && Predicate.hasProperty(val, "#text") && Predicate.isNotUndefined(val["#text"])) return val["#text"];
140
- return yield* new PeppolNodeError({ message: `Unable to find ${path.join("->")} into ${node}` });
141
- });
142
- //#endregion
143
- //#region src/helpers/num-or-und.ts
144
- const numOrUnd = Effect.fn(function* (node, ...path) {
145
- const val = yield* strOrUnd(node, ...path);
146
- return Predicate.isNotUndefined(val) ? parseFloat(val) : void 0;
147
- });
148
- //#endregion
149
- //#region src/decoders/fields/decode-base-allowance-charge.ts
150
- const decodeBaseAllowanceCharge = Effect.fn(function* (allowanceCharge) {
151
- return {
152
- allowanceChargeReason: yield* strOrUnd(allowanceCharge, "cbc:AllowanceChargeReason"),
153
- allowanceChargeReasonCode: yield* strOrUnd(allowanceCharge, "cbc:AllowanceChargeReasonCode"),
154
- amount: yield* decodeAmount(allowanceCharge, "cbc:Amount"),
155
- baseAmount: yield* decodeAmount(allowanceCharge, "cbc:BaseAmount"),
156
- chargeIndicator: yield* bool(allowanceCharge, "cbc:ChargeIndicator"),
157
- multiplierFactorNumeric: yield* numOrUnd(allowanceCharge, "cbc:MultiplierFactorNumeric")
158
- };
159
- });
160
- //#endregion
161
- //#region src/decoders/fields/decode-simple-identifier.ts
162
- const decodeSimpleIdentifer = Effect.fn(function* (doc, ...path) {
163
- const node = yield* getProp(doc, ...path);
164
- if (Predicate.isNullish(node)) return void 0;
165
- return { id: yield* strOrUnd(node, "cbc:ID") };
166
- });
167
- //#endregion
168
- //#region src/decoders/fields/decode-tax-category.ts
169
- const decodeTaxCategory$1 = Effect.fn(function* (doc, ...path) {
170
- const taxCategory = yield* getProp(doc, ...path);
171
- if (Predicate.isNullish(taxCategory)) return;
172
- return {
173
- id: yield* strOrUnd(taxCategory, "cbc:ID"),
174
- percent: yield* numOrUnd(taxCategory, "cbc:Percent"),
175
- taxSchemeId: yield* decodeSimpleIdentifer(taxCategory, "cac:TaxScheme")
176
- };
177
- });
178
- //#endregion
179
- //#region src/decoders/fields/decode-allowance-charges.ts
180
- const decodeAllowanceCharges = Effect.fn(function* (allowanceCharges, ...path) {
181
- const arr = yield* getArray(allowanceCharges, ...path);
182
- if (arr.length === 0) return;
183
- return yield* Effect.forEach(arr, Effect.fn(function* (allowanceCharge) {
184
- return {
185
- ...yield* decodeBaseAllowanceCharge(allowanceCharge),
186
- taxCategory: yield* decodeTaxCategory$1(allowanceCharge, "cac:TaxCategory")
187
- };
188
- }));
189
- });
190
- //#endregion
191
- //#region src/decoders/fields/decode-billing-references.ts
192
- const decodeBillingReferences = Effect.fn(function* (doc, ...path) {
193
- const arr = yield* getArray(doc, ...path);
194
- if (arr.length === 0) return void 0;
195
- return yield* Effect.forEach(arr, Effect.fn(function* (billingReference) {
196
- return { invoiceDocumentReference: {
197
- id: yield* strOrUnd(billingReference, "cac:InvoiceDocumentReference", "cbc:ID"),
198
- issueDate: yield* strOrUnd(billingReference, "cac:InvoiceDocumentReference", "cbc:IssueDate")
199
- } };
200
- }));
201
- });
202
- //#endregion
203
- //#region src/decoders/fields/decode-address.ts
204
- const decodeAddress = Effect.fn(function* (address, ...path) {
205
- const val = yield* getProp(address, ...path);
206
- if (Predicate.isNullish(val)) return void 0;
207
- return {
208
- additionalStreetName: yield* strOrUnd(val, "cbc:AdditionalStreetName"),
209
- addressLine: yield* decodeAddressLine(val, "cac:AddressLine"),
210
- cityName: yield* strOrUnd(val, "cbc:CityName"),
211
- countryCode: yield* decodeCountryCode(val, "cac:Country"),
212
- countrySubentity: yield* strOrUnd(val, "cbc:CountrySubentity"),
213
- postalZone: yield* strOrUnd(val, "cbc:PostalZone"),
214
- streetName: yield* strOrUnd(val, "cbc:StreetName")
215
- };
216
- });
217
- const decodeAddressLine = Effect.fn(function* (address, ...path) {
218
- const val = yield* getProp(address, ...path);
219
- if (Predicate.isNullish(val)) return void 0;
220
- return { line: yield* strOrUnd(val, "cbc:Line") };
221
- });
222
- const decodeCountryCode = Effect.fn(function* (node, ...path) {
223
- const country = yield* getProp(node, ...path);
224
- if (Predicate.isNullish(country)) return void 0;
225
- return { identificationCode: yield* strOrUnd(country, "cbc:IdentificationCode") };
226
- });
227
- //#endregion
228
- //#region src/decoders/fields/decode-delivery.ts
229
- const decodeDelivery = Effect.fn(function* (node, ...path) {
230
- const val = yield* getProp(node, ...path);
231
- if (Predicate.isNullish(val)) return void 0;
232
- return {
233
- actualDeliveryDate: yield* strOrUnd(val, "cbc:ActualDeliveryDate"),
234
- deliveryLocation: yield* decodeDeliveryLocation(val, "cac:DeliveryLocation"),
235
- deliveryParty: yield* decodeDeliveryParty(val, "cac:DeliveryParty")
236
- };
237
- });
238
- const decodeDeliveryLocation = Effect.fn(function* (node, ...path) {
239
- const val = yield* getProp(node, ...path);
240
- if (Predicate.isNullish(val)) return void 0;
241
- return {
242
- address: yield* decodeAddress(val, "cac:Address"),
243
- id: yield* decodeIdentifier(val, "cbc:ID")
244
- };
245
- });
246
- const decodeDeliveryParty = Effect.fn(function* (node, ...path) {
247
- const val = yield* getProp(node, ...path);
248
- if (Predicate.isNullish(val)) return void 0;
249
- const name = yield* strOrUnd(val, "cac:PartyName", "cbc:Name");
250
- if (!Predicate.isTruthy(name)) return void 0;
251
- return { partyName: { name } };
252
- });
253
- //#endregion
254
- //#region src/decoders/fields/decode-invoice-period.ts
255
- const decodeInvoicePeriod = Effect.fn(function* (doc, ...path) {
256
- const invoicePeriod = yield* getProp(doc, ...path);
257
- return Predicate.isNotNullish(invoicePeriod) ? {
258
- descriptionCode: yield* strOrUnd(invoicePeriod, "cbc:DescriptionCode"),
259
- endDate: yield* strOrUnd(invoicePeriod, "cbc:EndDate"),
260
- startDate: yield* strOrUnd(invoicePeriod, "cbc:StartDate")
261
- } : void 0;
262
- });
263
- //#endregion
264
- //#region src/decoders/fields/decode-legal-monetary-total.ts
265
- const decodeLegalMonetaryTotal = Effect.fn(function* (node, ...path) {
266
- const val = yield* getProp(node, ...path);
267
- if (Predicate.isNullish(val)) return void 0;
268
- return {
269
- allowanceTotalAmount: yield* decodeAmount(val, "cbc:AllowanceTotalAmount"),
270
- chargeTotalAmount: yield* decodeAmount(val, "cbc:ChargeTotalAmount"),
271
- lineExtensionAmount: yield* decodeAmount(val, "cbc:LineExtensionAmount"),
272
- payableAmount: yield* decodeAmount(val, "cbc:PayableAmount"),
273
- payableRoundingAmount: yield* decodeAmount(val, "cbc:PayableRoundingAmount"),
274
- prepaidAmount: yield* decodeAmount(val, "cbc:PrepaidAmount"),
275
- taxExclusiveAmount: yield* decodeAmount(val, "cbc:TaxExclusiveAmount"),
276
- taxInclusiveAmount: yield* decodeAmount(val, "cbc:TaxInclusiveAmount")
277
- };
278
- });
279
- //#endregion
280
- //#region src/decoders/fields/decode-order-reference.ts
281
- const decodeOrderReference = Effect.fn(function* (node, ...path) {
282
- const val = yield* getProp(node, ...path);
283
- if (Predicate.isNullish(val)) return void 0;
284
- return {
285
- id: yield* strOrUnd(val, "cbc:ID"),
286
- salesOrderId: yield* strOrUnd(val, "cbc:SalesOrderID")
287
- };
288
- });
289
- //#endregion
290
- //#region src/decoders/fields/decode-contact.ts
291
- const decodeContact = Effect.fn(function* (node, ...path) {
292
- const contactNode = yield* getProp(node, ...path);
293
- if (Predicate.isNullish(contactNode)) return void 0;
294
- return {
295
- electronicMail: yield* strOrUnd(contactNode, "cbc:ElectronicMail"),
296
- name: yield* strOrUnd(contactNode, "cbc:Name"),
297
- telephone: yield* strOrUnd(contactNode, "cbc:Telephone")
298
- };
299
- });
300
- //#endregion
301
- //#region src/decoders/fields/decode-electronic-address.ts
302
- const decodeElectronicAddress = Effect.fn(function* (node, ...path) {
303
- const value = yield* decodeIdentifier(node, ...path);
304
- if (Predicate.isTruthy(value?.schemeId)) value.schemeId = value.schemeId.padStart(4, "0");
305
- return value;
306
- });
307
- //#endregion
308
- //#region src/decoders/fields/decode-party-tax-scheme.ts
309
- const decodePartyTaxScheme = Effect.fn(function* (doc, ...path) {
310
- const node = yield* getProp(doc, ...path);
311
- if (Predicate.isNullish(node)) return void 0;
312
- return {
313
- companyId: yield* strOrUnd(node, "cbc:CompanyID"),
314
- taxSchemeId: yield* decodeSimpleIdentifer(node, "cac:TaxScheme")
315
- };
316
- });
317
- //#endregion
318
- //#region src/decoders/fields/decode-parties-tax-scheme.ts
319
- const decodePartiesTaxScheme = Effect.fn(function* (doc, ...path) {
320
- const node = yield* getArray(doc, ...path);
321
- if (node.length === 0) return void 0;
322
- return (yield* Effect.forEach(node, Effect.fn(function* (n) {
323
- return yield* decodePartyTaxScheme(n);
324
- }))).filter(Predicate.isNotNullish);
325
- });
326
- //#endregion
327
- //#region src/decoders/fields/decode-party-legal-entity.ts
328
- const decodePartyLegalEntity$1 = Effect.fn(function* (node, ...path) {
329
- const partyLegalEntityNode = yield* getProp(node, ...path);
330
- if (Predicate.isNullish(partyLegalEntityNode)) return void 0;
331
- return {
332
- companyId: yield* decodeIdentifier(partyLegalEntityNode, "cbc:CompanyID"),
333
- companyLegalForm: yield* strOrUnd(partyLegalEntityNode, "cbc:CompanyLegalForm"),
334
- registrationName: yield* strOrUnd(partyLegalEntityNode, "cbc:RegistrationName")
335
- };
336
- });
337
- //#endregion
338
- //#region src/decoders/fields/decode-party.ts
339
- const decodeParty = Effect.fn(function* (party, ...path) {
340
- const val = yield* getProp(party, ...path);
341
- if (Predicate.isNullish(val)) return void 0;
342
- return {
343
- contact: yield* decodeContact(val, "cac:Contact"),
344
- endpointId: yield* decodeElectronicAddress(val, "cbc:EndpointID"),
345
- partyIdentification: yield* decodeAdditionalIdentifiers(val, "cac:PartyIdentification"),
346
- partyLegalEntity: yield* decodePartyLegalEntity$1(val, "cac:PartyLegalEntity"),
347
- partyName: yield* decodePartyName$1(val, "cac:PartyName"),
348
- partyTaxSchemes: yield* decodePartiesTaxScheme(val, "cac:PartyTaxScheme"),
349
- postalAddress: yield* decodeAddress(val, "cac:PostalAddress")
350
- };
351
- });
352
- const decodePartyName$1 = Effect.fn(function* (node, ...path) {
353
- const partyNameNode = yield* getProp(node, ...path);
354
- if (Predicate.isNullish(partyNameNode)) return void 0;
355
- return { name: yield* strOrUnd(partyNameNode, "cbc:Name") };
356
- });
357
- const decodeAdditionalIdentifiers = Effect.fn(function* (node, ...path) {
358
- const val = yield* getProp(node, ...path);
359
- if (Predicate.isNullish(val)) return void 0;
360
- return { id: yield* decodeIdentifier(val, "cbc:ID") };
361
- });
362
- //#endregion
363
- //#region src/decoders/fields/decode-payee-party.ts
364
- const decodePayeeParty = Effect.fn(function* (payee, ...path) {
365
- const node = yield* getProp(payee, ...path);
366
- if (Predicate.isNullish(node)) return void 0;
367
- return {
368
- partyIdentification: yield* decodePartyIdentification(node, "cac:PartyIdentification"),
369
- partyLegalEntity: yield* decodePartyLegalEntity(node, "cac:PartyLegalEntity"),
370
- partyName: yield* decodePartyName(node, "cac:PartyName")
371
- };
372
- });
373
- const decodePartyLegalEntity = Effect.fn(function* (party, ...path) {
374
- const node = yield* getProp(party, ...path);
375
- if (Predicate.isNullish(node)) return void 0;
376
- return { companyId: yield* decodeIdentifier(node, "cbc:CompanyID") };
377
- });
378
- const decodePartyName = Effect.fn(function* (party, ...path) {
379
- const node = yield* getProp(party, ...path);
380
- if (Predicate.isNullish(node)) return void 0;
381
- return { name: yield* strOrUnd(node, "cbc:Name") };
382
- });
383
- const decodePartyIdentification = Effect.fn(function* (party, ...path) {
384
- const node = yield* getProp(party, ...path);
385
- if (Predicate.isNullish(node)) return void 0;
386
- return { id: yield* decodeIdentifier(node, "cbc:ID") };
387
- });
388
- //#endregion
389
- //#region src/decoders/fields/decode-payment-means.ts
390
- const decodePaymentMeans = Effect.fn(function* (doc, ...path) {
391
- const arr = yield* getArray(doc, ...path);
392
- if (arr.length === 0) return void 0;
393
- return yield* Effect.forEach(arr, Effect.fn(function* (paymentMeans) {
394
- const cardAccount = yield* getProp(paymentMeans, "cac:CardAccount");
395
- return {
396
- cardAccount: Predicate.isNotNullish(cardAccount) ? {
397
- holderName: yield* strOrUnd(cardAccount, "cbc:HolderName"),
398
- networkId: yield* strOrUnd(cardAccount, "cbc:NetworkID"),
399
- primaryAccountNumberId: yield* strOrUnd(cardAccount, "cbc:PrimaryAccountNumberID")
400
- } : void 0,
401
- payeeFinancialAccount: yield* decodePayeeFinancialAccount(paymentMeans, "cac:PayeeFinancialAccount"),
402
- paymentDueDate: yield* strOrUnd(paymentMeans, "cbc:PaymentDueDate"),
403
- paymentId: yield* strOrUnd(paymentMeans, "cbc:PaymentID"),
404
- paymentMandate: yield* decodePaymentMendates(paymentMeans, "cac:PaymentMandate"),
405
- paymentMeansCode: yield* decodePaymentMeansCodes(paymentMeans, "cbc:PaymentMeansCode")
406
- };
407
- }));
408
- });
409
- const decodePayeeFinancialAccount = Effect.fn(function* (doc, ...path) {
410
- const node = yield* getProp(doc, ...path);
411
- if (Predicate.isNullish(node)) return void 0;
412
- let financialInstitutionBranch = yield* decodeSimpleIdentifer(node, "cac:FinancialInstitutionBranch");
413
- if (Predicate.isNotUndefined(financialInstitutionBranch) && !Predicate.isTruthy(financialInstitutionBranch?.id)) financialInstitutionBranch = yield* decodeSimpleIdentifer(node, "cac:FinancialInstitutionBranch", "ns0:FinancialInstitution");
414
- return {
415
- financialInstitutionBranch,
416
- id: yield* strOrUnd(node, "cbc:ID"),
417
- name: yield* strOrUnd(node, "cbc:Name")
418
- };
419
- });
420
- const decodePaymentMendates = Effect.fn(function* (doc, ...path) {
421
- const node = yield* getProp(doc, ...path);
422
- if (Predicate.isNullish(node)) return void 0;
423
- return {
424
- id: yield* strOrUnd(node, "cbc:ID"),
425
- payerFinancialAccountId: yield* decodeSimpleIdentifer(node, "cac:PayerFinancialAccount")
426
- };
427
- });
428
- const decodePaymentMeansCodes = Effect.fn(function* (doc, ...path) {
429
- const node = yield* getProp(doc, ...path);
430
- if (Predicate.isNullish(node)) return void 0;
431
- return {
432
- code: yield* strOrUnd(node),
433
- name: yield* strOrUnd(node, "@name")
434
- };
435
- });
436
- //#endregion
437
- //#region src/decoders/fields/decode-payment-terms.ts
438
- const decodePaymentTerms = Effect.fn(function* (doc, ...path) {
439
- const terms = yield* getProp(doc, ...path);
440
- if (Predicate.isNullish(terms)) return void 0;
441
- const note = yield* getProp(terms, "cbc:Note");
442
- return Predicate.isNotNullish(note) ? { note: yield* strOrUnd(note) } : void 0;
443
- });
444
- //#endregion
445
- //#region src/decoders/fields/decode-tax-representative-party.ts
446
- const decodeTaxRepresentativeParty = Effect.fn(function* (doc, ...path) {
447
- const taxRepresentative = yield* getProp(doc, ...path);
448
- if (Predicate.isNullish(taxRepresentative)) return void 0;
449
- return {
450
- name: yield* strOrUnd(taxRepresentative, "cac:PartyName", "cbc:Name"),
451
- partyTaxScheme: yield* decodePartyTaxScheme(taxRepresentative, "cac:PartyTaxScheme"),
452
- postalAddress: yield* decodeAddress(taxRepresentative, "cac:PostalAddress")
453
- };
454
- });
455
- //#endregion
456
- //#region src/decoders/fields/decode-tax-totals.ts
457
- const decodeTaxTotals = Effect.fn(function* (doc, ...path) {
458
- const arr = yield* getArray(doc, ...path);
459
- if (arr.length === 0) return void 0;
460
- return yield* Effect.forEach(arr, Effect.fn(function* (n) {
461
- return {
462
- taxAmount: yield* decodeAmount(n, "cbc:TaxAmount"),
463
- taxSubtotals: yield* decodeTaxSubTotal(n, "cac:TaxSubtotal")
464
- };
465
- }));
466
- });
467
- const decodeTaxSubTotal = Effect.fn(function* (doc, ...path) {
468
- const arr = yield* getArray(doc, ...path);
469
- if (arr.length === 0) return void 0;
470
- return yield* Effect.forEach(arr, Effect.fn(function* (node) {
471
- return {
472
- taxAmount: yield* decodeAmount(node, "cbc:TaxAmount"),
473
- taxCategory: yield* decodeTaxCategory(node, "cac:TaxCategory"),
474
- taxableAmount: yield* decodeAmount(node, "cbc:TaxableAmount")
475
- };
476
- }));
477
- });
478
- const decodeTaxCategory = Effect.fn(function* (doc, ...path) {
479
- const node = yield* getProp(doc, ...path);
480
- if (Predicate.isNullish(node)) return;
481
- return {
482
- id: yield* strOrUnd(node, "cbc:ID"),
483
- percent: yield* numOrUnd(node, "cbc:Percent"),
484
- taxExemptionReason: yield* strOrUnd(node, "cbc:TaxExemptionReason"),
485
- taxExemptionReasonCode: yield* strOrUnd(node, "cbc:TaxExemptionReasonCode"),
486
- taxSchemeId: yield* decodeSimpleIdentifer(node, "cac:TaxScheme")
487
- };
488
- });
489
- //#endregion
490
- //#region src/decoders/decode-billing.ts
491
- const decodeBilling = Effect.fn(function* (doc) {
492
- return {
493
- accountingCost: yield* strOrUnd(doc, "cbc:AccountingCost"),
494
- accountingCustomerParty: yield* decodeParty(doc, "cac:AccountingCustomerParty", "cac:Party"),
495
- accountingSupplierParty: yield* decodeParty(doc, "cac:AccountingSupplierParty", "cac:Party"),
496
- additionalDocumentReferences: yield* decodeAdditionalDocumentReferences(doc),
497
- allowanceCharges: yield* decodeAllowanceCharges(doc, "cac:AllowanceCharge"),
498
- billingReferences: yield* decodeBillingReferences(doc, "cac:BillingReference"),
499
- buyerReference: yield* strOrUnd(doc, "cbc:BuyerReference"),
500
- contractDocumentReference: yield* decodeSimpleIdentifer(doc, "cac:ContractDocumentReference"),
501
- customizationId: yield* strOrUnd(doc, "cbc:CustomizationID"),
502
- delivery: yield* decodeDelivery(doc, "cac:Delivery"),
503
- despatchDocumentReference: yield* decodeSimpleIdentifer(doc, "cac:DespatchDocumentReference"),
504
- documentCurrencyCode: yield* strOrUnd(doc, "cbc:DocumentCurrencyCode"),
505
- id: yield* strOrUnd(doc, "cbc:ID"),
506
- invoicePeriod: yield* decodeInvoicePeriod(doc, "cac:InvoicePeriod"),
507
- issueDate: yield* strOrUnd(doc, "cbc:IssueDate"),
508
- legalMonetaryTotal: yield* decodeLegalMonetaryTotal(doc, "cac:LegalMonetaryTotal"),
509
- note: yield* strOrUnd(doc, "cbc:Note"),
510
- orderReference: yield* decodeOrderReference(doc, "cac:OrderReference"),
511
- originatorDocumentReference: yield* decodeSimpleIdentifer(doc, "cac:OriginatorDocumentReference"),
512
- payeeParty: yield* decodePayeeParty(doc, "cac:PayeeParty"),
513
- paymentMeans: yield* decodePaymentMeans(doc, "cac:PaymentMeans"),
514
- paymentTerms: yield* decodePaymentTerms(doc, "cac:PaymentTerms"),
515
- profileId: yield* strOrUnd(doc, "cbc:ProfileID"),
516
- receiptDocumentReference: yield* decodeSimpleIdentifer(doc, "cac:ReceiptDocumentReference"),
517
- taxCurrencyCode: yield* strOrUnd(doc, "cbc:TaxCurrencyCode"),
518
- taxPointDate: yield* strOrUnd(doc, "cbc:TaxPointDate"),
519
- taxRepresentativeParty: yield* decodeTaxRepresentativeParty(doc, "cac:TaxRepresentativeParty"),
520
- taxTotals: yield* decodeTaxTotals(doc, "cac:TaxTotal")
521
- };
522
- });
523
- //#endregion
524
- //#region src/decoders/fields/decode-invoice-line-period.ts
525
- const decodeInvoiceLinePeriod = Effect.fn(function* (doc, ...path) {
526
- const invoicePeriod = yield* getProp(doc, ...path);
527
- return Predicate.isNotNullish(invoicePeriod) ? {
528
- endDate: yield* strOrUnd(invoicePeriod, "cbc:EndDate"),
529
- startDate: yield* strOrUnd(invoicePeriod, "cbc:StartDate")
530
- } : void 0;
531
- });
532
- //#endregion
533
- //#region src/decoders/fields/decode-line-allowance-charges.ts
534
- const decodeLineAllowanceCharges = Effect.fn(function* (allowanceCharges, ...path) {
535
- const arr = yield* getArray(allowanceCharges, ...path);
536
- if (arr.length === 0) return;
537
- return yield* Effect.forEach(arr, Effect.fn(function* (allowanceCharge) {
538
- return { ...yield* decodeBaseAllowanceCharge(allowanceCharge) };
539
- }));
540
- });
541
- //#endregion
542
- //#region src/decoders/fields/decode-price-allowance-charge.ts
543
- const decodePriceAllowanceCharge = Effect.fn(function* (allowanceCharges, ...path) {
544
- const allowanceCharge = yield* getProp(allowanceCharges, ...path);
545
- if (Predicate.isNullish(allowanceCharge)) return;
546
- return {
547
- amount: yield* decodeAmount(allowanceCharge, "cbc:Amount"),
548
- baseAmount: yield* decodeAmount(allowanceCharge, "cbc:BaseAmount"),
549
- chargeIndicator: yield* bool(allowanceCharge, "cbc:ChargeIndicator")
550
- };
551
- });
552
- //#endregion
553
- //#region src/decoders/fields/decode-quantity.ts
554
- const decodeQuantity = Effect.fn(function* (quantity, ...path) {
555
- const val = yield* getProp(quantity, ...path);
556
- if (!Predicate.isTruthy(val) && val !== 0) return void 0;
557
- if (Predicate.isObject(val)) return {
558
- unitCode: yield* getProp(val, "@unitCode"),
559
- value: yield* numOrUnd(val)
560
- };
561
- return { value: yield* numOrUnd(val) };
562
- });
563
- //#endregion
564
- //#region src/decoders/fields/decode-line-price.ts
565
- const decodeLinePrice = Effect.fn(function* (price, ...path) {
566
- const node = yield* getProp(price, ...path);
567
- if (Predicate.isNullish(node)) return void 0;
568
- return {
569
- allowanceCharge: yield* decodePriceAllowanceCharge(node, "cac:AllowanceCharge"),
570
- baseQuantity: yield* decodeQuantity(node, "cbc:BaseQuantity"),
571
- priceAmount: yield* decodeAmount(node, "cbc:PriceAmount")
572
- };
573
- });
574
- //#endregion
575
- //#region src/decoders/fields/decode-line-shared.ts
576
- const decodeLineShared = Effect.fn(function* (lineShared) {
577
- const item = yield* getProp(lineShared, "cac:Item");
578
- const orderLineReference = yield* getProp(lineShared, "cac:OrderLineReference");
579
- return {
580
- accountingCost: yield* strOrUnd(lineShared, "cbc:AccountingCost"),
581
- allowanceCharges: yield* decodeLineAllowanceCharges(lineShared, "cac:AllowanceCharge"),
582
- documentReference: yield* Effect.forEach(yield* getArray(lineShared, "cac:DocumentReference"), Effect.fn(function* (documentReference) {
583
- return {
584
- documentTypeCode: yield* strOrUnd(documentReference, "cbc:DocumentTypeCode"),
585
- id: yield* strOrUnd(documentReference, "cbc:ID"),
586
- schemeId: yield* strOrUnd(documentReference, "cbc:ID", "@schemeID")
587
- };
588
- })),
589
- id: yield* strOrUnd(lineShared, "cbc:ID"),
590
- invoicePeriod: yield* decodeInvoiceLinePeriod(lineShared, "cac:InvoicePeriod"),
591
- item: {
592
- additionalItemProperties: yield* Effect.forEach(yield* getArray(item, "cac:AdditionalItemProperty"), Effect.fn(function* (n) {
593
- return {
594
- name: yield* strOrUnd(n, "cbc:Name"),
595
- value: yield* strOrUnd(n, "cbc:Value")
596
- };
597
- })),
598
- buyersItemIdentification: yield* decodeSimpleIdentifer(item, "cac:BuyersItemIdentification"),
599
- classifiedTaxCategory: yield* decodeTaxCategory$1(item, "cac:ClassifiedTaxCategory"),
600
- commodityClassifications: yield* Effect.forEach(yield* getArray(item, "cac:CommodityClassification"), Effect.fn(function* (commodityClassification) {
601
- return { itemClassification: {
602
- id: yield* strOrUnd(commodityClassification, "cbc:ItemClassificationCode"),
603
- listId: yield* strOrUnd(commodityClassification, "cbc:ItemClassificationCode", "@listID"),
604
- listVersionId: yield* strOrUnd(commodityClassification, "cbc:ItemClassificationCode", "@listVersionID")
605
- } };
606
- })),
607
- description: yield* strOrUnd(item, "cbc:Description"),
608
- name: yield* strOrUnd(item, "cbc:Name"),
609
- originCountryCode: yield* decodeOriginCountryCode(item, "cac:OriginCountry"),
610
- sellersItemIdentification: yield* decodeSimpleIdentifer(item, "cac:SellersItemIdentification"),
611
- standardItemIdentification: yield* decodeStandardItem(item, "cac:StandardItemIdentification")
612
- },
613
- lineExtensionAmount: yield* decodeAmount(lineShared, "cbc:LineExtensionAmount"),
614
- note: yield* strOrUnd(lineShared, "cbc:Note"),
615
- orderLineReference: Predicate.isNotNullish(orderLineReference) ? { lineId: yield* strOrUnd(orderLineReference, "cbc:LineID") } : void 0,
616
- price: yield* decodeLinePrice(lineShared, "cac:Price")
617
- };
618
- });
619
- const decodeStandardItem = Effect.fn(function* (node, ...path) {
620
- const val = yield* getProp(node, ...path);
621
- if (Predicate.isNullish(val)) return void 0;
622
- return { id: yield* decodeIdentifier(val, "cbc:ID") };
623
- });
624
- const decodeOriginCountryCode = Effect.fn(function* (node, ...path) {
625
- const country = yield* getProp(node, ...path);
626
- if (Predicate.isNullish(country)) return void 0;
627
- return { identificationCode: yield* strOrUnd(country, "cbc:IdentificationCode") };
628
- });
629
- //#endregion
630
- //#region src/decoders/fields/decode-credit-note-lines.ts
631
- const decodeCreditNoteLines = Effect.fn(function* (doc, ...path) {
632
- const arr = yield* getArray(doc, ...path);
633
- if (arr.length === 0) return void 0;
634
- return yield* Effect.forEach(arr, Effect.fn(function* (lineNode) {
635
- return {
636
- ...yield* decodeLineShared(lineNode),
637
- creditedQuantity: yield* decodeQuantity(lineNode, "cbc:CreditedQuantity")
638
- };
639
- }));
640
- });
641
- //#endregion
642
- //#region src/decoders/decode-credit-note.ts
643
- const decodeCreditNote = Effect.fn(function* (value) {
644
- const root = value || {};
645
- const doc = (yield* getProp(root, "ubl:CreditNote")) ?? root;
646
- return {
647
- ...yield* decodeBilling(doc),
648
- creditNoteLines: yield* decodeCreditNoteLines(doc, "cac:CreditNoteLine"),
649
- creditNoteTypeCode: yield* strOrUnd(doc, "cbc:CreditNoteTypeCode")
650
- };
651
- });
652
- //#endregion
653
- //#region src/decoders/fields/decode-invoice-lines.ts
654
- const decodeInvoiceLines = Effect.fn(function* (doc, ...path) {
655
- const arr = yield* getArray(doc, ...path);
656
- if (arr.length === 0) return void 0;
657
- return yield* Effect.forEach(arr, Effect.fn(function* (lineNode) {
658
- return {
659
- ...yield* decodeLineShared(lineNode),
660
- invoicedQuantity: yield* decodeQuantity(lineNode, "cbc:InvoicedQuantity")
661
- };
662
- }));
663
- });
664
- //#endregion
665
- //#region src/decoders/decode-invoice.ts
666
- const decodeInvoice = Effect.fn(function* (value) {
667
- const root = value || {};
668
- const doc = (yield* getProp(root, "ubl:Invoice")) ?? root;
669
- return {
670
- ...yield* decodeBilling(doc),
671
- dueDate: yield* strOrUnd(doc, "cbc:DueDate"),
672
- invoiceLines: yield* decodeInvoiceLines(doc, "cac:InvoiceLine"),
673
- invoiceTypeCode: yield* strOrUnd(doc, "cbc:InvoiceTypeCode"),
674
- projectReference: yield* decodeSimpleIdentifer(doc, "cac:ProjectReference")
675
- };
676
- });
677
- //#endregion
678
- //#region src/decoders/fields/decode-invoice-message-document-party.ts
679
- const decodeInvoiceMessageDocumentParty = Effect.fn(function* (party, ...path) {
680
- const val = yield* getProp(party, ...path);
681
- if (Predicate.isNullish(val)) return void 0;
682
- const partyName = yield* getProp(val, "cac:PartyName");
683
- return {
684
- partyIdentification: yield* decodeIdentifier(val, "cac:PartyIdentification", "cbc:ID"),
685
- partyName: Predicate.isNotNullish(partyName) ? { name: yield* strOrUnd(partyName, "cbc:Name") } : void 0
686
- };
687
- });
688
- //#endregion
689
- //#region src/decoders/fields/decode-invoice-message-party.ts
690
- const decodeInvoiceMessageParty = Effect.fn(function* (party, ...path) {
691
- const val = yield* getProp(party, ...path);
692
- if (Predicate.isNullish(val)) return void 0;
693
- return {
694
- contact: yield* decodeContact(val, "cac:Contact"),
695
- endpointId: yield* decodeElectronicAddress(val, "cbc:EndpointID"),
696
- partyIdentification: yield* decodeIdentifier(val, "cac:PartyIdentification", "cbc:ID"),
697
- partyLegalEntity: yield* decodePartyLegalEntity$1(val, "cac:PartyLegalEntity")
698
- };
699
- });
700
- //#endregion
701
- //#region src/decoders/decode-invoice-response.ts
702
- const decodeStatusReasonCode = Effect.fn(function* (doc, ...path) {
703
- const val = yield* getProp(doc, ...path);
704
- if (!Predicate.isTruthy(val) && val !== 0) return void 0;
705
- const value = yield* strOrUnd(val);
706
- if (Predicate.isString(val) || Predicate.isNumber(val)) return { value };
707
- if (!Predicate.isTruthy(value)) return void 0;
708
- return {
709
- listId: yield* strOrUnd(val, "@listID"),
710
- value
711
- };
712
- });
713
- const decodeCondition = Effect.fn(function* (doc, ...path) {
714
- const val = yield* getArray(doc, ...path);
715
- /* istanbul ignore next -- getArray never returns a falsy value */
716
- if (Predicate.isNullish(val)) return void 0;
717
- return yield* Effect.forEach(val, Effect.fn(function* (item) {
718
- return {
719
- attributeId: yield* strOrUnd(item, "cbc:AttributeID"),
720
- description: yield* strOrUnd(item, "cbc:Description")
721
- };
722
- }));
723
- });
724
- const decodeDocumentResponseStatus = Effect.fn(function* (doc, ...path) {
725
- const val = yield* getArray(doc, ...path);
726
- /* istanbul ignore next -- getArray never returns a falsy value */
727
- if (Predicate.isNullish(val)) return void 0;
728
- return yield* Effect.forEach(val, Effect.fn(function* (item) {
729
- return {
730
- condition: yield* decodeCondition(item, "cac:Condition"),
731
- statusReason: yield* strOrUnd(item, "cbc:StatusReason"),
732
- statusReasonCode: yield* decodeStatusReasonCode(item, "cbc:StatusReasonCode")
733
- };
734
- }));
735
- });
736
- const decodeDocumentActualResponse = Effect.fn(function* (doc, ...path) {
737
- const val = yield* getProp(doc, ...path);
738
- if (Predicate.isNullish(val)) return void 0;
739
- return {
740
- effectiveDate: yield* strOrUnd(val, "cbc:EffectiveDate"),
741
- responseCode: yield* strOrUnd(val, "cbc:ResponseCode"),
742
- status: yield* decodeDocumentResponseStatus(val, "cac:Status")
743
- };
744
- });
745
- const decodeDocumentReference$1 = Effect.fn(function* (doc, ...path) {
746
- const val = yield* getProp(doc, ...path);
747
- if (Predicate.isNullish(val)) return void 0;
748
- return {
749
- documentTypeCode: yield* strOrUnd(val, "cbc:DocumentTypeCode"),
750
- id: yield* strOrUnd(val, "cbc:ID"),
751
- issueDate: yield* strOrUnd(val, "cbc:IssueDate")
752
- };
753
- });
754
- const decodeDocumentResponse$1 = Effect.fn(function* (doc, ...path) {
755
- const val = yield* getProp(doc, ...path);
756
- if (Predicate.isNullish(val)) return void 0;
757
- return {
758
- documentReference: yield* decodeDocumentReference$1(val, "cac:DocumentReference"),
759
- issuerParty: yield* decodeInvoiceMessageDocumentParty(val, "cac:IssuerParty"),
760
- recipientParty: yield* decodeInvoiceMessageDocumentParty(val, "cac:RecipientParty"),
761
- response: yield* decodeDocumentActualResponse(val, "cac:Response")
762
- };
763
- });
764
- const decodeInvoiceResponse = Effect.fn(function* (value) {
765
- const doc = yield* getProp(value || {}, "ubl:ApplicationResponse");
766
- return {
767
- customizationId: yield* strOrUnd(doc, "cbc:CustomizationID"),
768
- documentResponse: yield* decodeDocumentResponse$1(doc, "cac:DocumentResponse"),
769
- id: yield* strOrUnd(doc, "cbc:ID"),
770
- issueDate: yield* strOrUnd(doc, "cbc:IssueDate"),
771
- issueTime: yield* strOrUnd(doc, "cbc:IssueTime"),
772
- note: yield* strOrUnd(doc, "cbc:Note"),
773
- profileId: yield* strOrUnd(doc, "cbc:ProfileID"),
774
- receiverParty: yield* decodeInvoiceMessageParty(doc, "cac:ReceiverParty"),
775
- senderParty: yield* decodeInvoiceMessageParty(doc, "cac:SenderParty")
776
- };
777
- });
778
- //#endregion
779
- //#region src/decoders/fields/decode-message-level-party.ts
780
- const decodeMessageLevelParty = Effect.fn(function* (party, ...path) {
781
- const val = yield* getProp(party, ...path);
782
- if (Predicate.isNullish(val)) return void 0;
783
- return { endpointId: yield* decodeElectronicAddress(val, "cbc:EndpointID") };
784
- });
785
- //#endregion
786
- //#region src/decoders/decode-message-level-response.ts
787
- const decodeDocumentResponse = Effect.fn(function* (doc, ...path) {
788
- const val = yield* getProp(doc, ...path);
789
- if (Predicate.isNullish(val)) return void 0;
790
- return {
791
- documentReference: yield* decodeDocumentReference(val, "cac:DocumentReference"),
792
- lineResponse: yield* decodeLineResponse(val, "cac:LineResponse"),
793
- response: yield* decodeResponse(val, "cac:Response")
794
- };
795
- });
796
- const decodeLineResponse = Effect.fn(function* (doc, ...path) {
797
- const val = yield* getArray(doc, ...path);
798
- /* istanbul ignore next -- getArray never returns a falsy value */
799
- if (Predicate.isNullish(val)) return void 0;
800
- return yield* Effect.forEach(val, Effect.fn(function* (line) {
801
- return {
802
- lineReference: { lineId: yield* strOrUnd(line, "cac:LineReference", "cbc:LineID") },
803
- response: yield* decodeLineResponseContent(line, "cac:Response")
804
- };
805
- }));
806
- });
807
- const decodeLineResponseContent = Effect.fn(function* (doc, ...path) {
808
- const val = yield* getProp(doc, ...path);
809
- if (Predicate.isNullish(val)) return void 0;
810
- return {
811
- description: yield* strOrUnd(val, "cbc:Description"),
812
- responseCode: yield* strOrUnd(val, "cbc:ResponseCode"),
813
- status: { statusReasonCode: yield* strOrUnd(val, "cac:Status", "cbc:StatusReasonCode") }
814
- };
815
- });
816
- const decodeDocumentReference = Effect.fn(function* (doc, ...path) {
817
- const val = yield* getProp(doc, ...path);
818
- if (Predicate.isNullish(val)) return void 0;
819
- return {
820
- documentTypeCode: yield* strOrUnd(val, "cbc:DocumentTypeCode"),
821
- id: yield* strOrUnd(val, "cbc:ID"),
822
- versionId: yield* strOrUnd(val, "cbc:VersionID")
823
- };
824
- });
825
- const decodeResponse = Effect.fn(function* (doc, ...path) {
826
- const val = yield* getProp(doc, ...path);
827
- if (Predicate.isNullish(val)) return void 0;
828
- return {
829
- description: yield* strOrUnd(val, "cbc:Description"),
830
- responseCode: yield* strOrUnd(val, "cbc:ResponseCode")
831
- };
832
- });
833
- const decodeMessageLevelResponse = Effect.fn(function* (value) {
834
- const doc = yield* getProp(value || {}, "ubl:ApplicationResponse");
835
- return {
836
- customizationId: yield* strOrUnd(doc, "cbc:CustomizationID"),
837
- documentResponse: yield* decodeDocumentResponse(doc, "cac:DocumentResponse"),
838
- id: yield* strOrUnd(doc, "cbc:ID"),
839
- issueDate: yield* strOrUnd(doc, "cbc:IssueDate"),
840
- issueTime: yield* strOrUnd(doc, "cbc:IssueTime"),
841
- profileId: yield* strOrUnd(doc, "cbc:ProfileID"),
842
- receiverParty: yield* decodeMessageLevelParty(doc, "cac:ReceiverParty"),
843
- senderParty: yield* decodeMessageLevelParty(doc, "cac:SenderParty")
844
- };
845
- });
846
- //#endregion
847
- //#region src/decoders/fields/encode-identifier.ts
848
- const encodeIdentifier = Effect.fn(function* (id) {
849
- if (Predicate.isNullish(id)) return void 0;
850
- if (Predicate.isNullish(id.schemeId) || id.schemeId === "") return id.id;
851
- return {
852
- "#text": id.id,
853
- "@schemeID": id.schemeId
854
- };
855
- });
856
- //#endregion
857
- //#region src/decoders/fields/encode-additional-document-references.ts
858
- const encodeAdditionalDocumentReferences = Effect.fn(function* (refs) {
859
- if (Predicate.isNullish(refs)) return void 0;
860
- return yield* Effect.forEach(refs, Effect.fn(function* (ref) {
861
- return {
862
- "cbc:ID": yield* encodeIdentifier(ref.id),
863
- "cbc:DocumentTypeCode": ref.documentTypeCode,
864
- "cbc:DocumentDescription": ref.documentDescription,
865
- "cac:Attachment": yield* encodeAttachment(ref.attachment)
866
- };
867
- }));
868
- });
869
- const encodeAttachment = Effect.fn(function* (attachment) {
870
- if (Predicate.isNullish(attachment)) return void 0;
871
- return {
872
- "cac:ExternalReference": Predicate.isNotNullish(attachment.externalReference) ? { "cbc:URI": attachment.externalReference.uri } : void 0,
873
- "cbc:EmbeddedDocumentBinaryObject": Predicate.isNotNullish(attachment.embeddedDocumentBinaryObject) ? {
874
- "#text": attachment.embeddedDocumentBinaryObject.content,
875
- "@filename": attachment.embeddedDocumentBinaryObject.filename,
876
- "@mimeCode": attachment.embeddedDocumentBinaryObject.mimeCode
877
- } : void 0
878
- };
879
- });
880
- //#endregion
881
- //#region src/decoders/fields/encode-amount.ts
882
- const encodeAmount = Effect.fn(function* (amount) {
883
- if (Predicate.isNullish(amount)) return void 0;
884
- return {
885
- "#text": amount.value,
886
- "@currencyID": amount.currencyId
887
- };
888
- });
889
- //#endregion
890
- //#region src/decoders/fields/encode-simple-identifier.ts
891
- const encodeSimpleIdentifier = Effect.fn(function* (identifier) {
892
- if (Predicate.isNullish(identifier)) return void 0;
893
- return { "cbc:ID": identifier.id };
894
- });
895
- //#endregion
896
- //#region src/decoders/fields/encode-tax-category.ts
897
- const encodeTaxCategory = Effect.fn(function* (taxCategory) {
898
- if (Predicate.isNullish(taxCategory)) return;
899
- return {
900
- "cbc:ID": taxCategory.id,
901
- "cbc:Percent": taxCategory.percent,
902
- "cac:TaxScheme": yield* encodeSimpleIdentifier(taxCategory.taxSchemeId)
903
- };
904
- });
905
- //#endregion
906
- //#region src/decoders/fields/encode-allowance-charges.ts
907
- const encodeAllowanceCharges = Effect.fn(function* (allowanceCharges) {
908
- if (Predicate.isNullish(allowanceCharges)) return void 0;
909
- return yield* Effect.forEach(allowanceCharges, Effect.fn(function* (allowanceCharge) {
910
- return {
911
- "cbc:ChargeIndicator": allowanceCharge.chargeIndicator,
912
- "cbc:AllowanceChargeReasonCode": allowanceCharge.allowanceChargeReasonCode,
913
- "cbc:AllowanceChargeReason": allowanceCharge.allowanceChargeReason,
914
- "cbc:MultiplierFactorNumeric": allowanceCharge.multiplierFactorNumeric,
915
- "cbc:Amount": yield* encodeAmount(allowanceCharge.amount),
916
- "cbc:BaseAmount": yield* encodeAmount(allowanceCharge.baseAmount),
917
- "cac:TaxCategory": yield* encodeTaxCategory(allowanceCharge.taxCategory)
918
- };
919
- }));
920
- });
921
- //#endregion
922
- //#region src/decoders/fields/encode-billing-references.ts
923
- const encodeBillingReferences = Effect.fn(function* (billingReferences) {
924
- return billingReferences?.map((billingReference) => ({ "cac:InvoiceDocumentReference": {
925
- "cbc:ID": billingReference.invoiceDocumentReference.id,
926
- "cbc:IssueDate": billingReference.invoiceDocumentReference.issueDate
927
- } }));
928
- });
929
- //#endregion
930
- //#region src/decoders/fields/encode-invoice-line-period.ts
931
- const encodeInvoiceLinePeriod = Effect.fn(function* (invoicePeriod) {
932
- return Predicate.isNotNullish(invoicePeriod) ? {
933
- "cbc:StartDate": invoicePeriod.startDate,
934
- "cbc:EndDate": invoicePeriod.endDate
935
- } : void 0;
936
- });
937
- //#endregion
938
- //#region src/decoders/fields/encode-line-allowance-charges.ts
939
- const encodeLineAllowanceCharges = Effect.fn(function* (allowanceCharges) {
940
- if (Predicate.isNullish(allowanceCharges)) return void 0;
941
- return yield* Effect.forEach(allowanceCharges, Effect.fn(function* (allowanceCharge) {
942
- return {
943
- "cbc:ChargeIndicator": allowanceCharge.chargeIndicator,
944
- "cbc:AllowanceChargeReasonCode": allowanceCharge.allowanceChargeReasonCode,
945
- "cbc:AllowanceChargeReason": allowanceCharge.allowanceChargeReason,
946
- "cbc:MultiplierFactorNumeric": allowanceCharge.multiplierFactorNumeric,
947
- "cbc:Amount": yield* encodeAmount(allowanceCharge.amount),
948
- "cbc:BaseAmount": yield* encodeAmount(allowanceCharge.baseAmount)
949
- };
950
- }));
951
- });
952
- //#endregion
953
- //#region src/decoders/fields/encode-price-allowance-charges.ts
954
- const encodePriceAllowanceCharges = Effect.fn(function* (allowanceCharge) {
955
- if (Predicate.isNullish(allowanceCharge)) return;
956
- return {
957
- "cbc:ChargeIndicator": allowanceCharge.chargeIndicator,
958
- "cbc:Amount": yield* encodeAmount(allowanceCharge.amount),
959
- "cbc:BaseAmount": yield* encodeAmount(allowanceCharge.baseAmount)
960
- };
961
- });
962
- //#endregion
963
- //#region src/decoders/fields/encode-quantity.ts
964
- const encodeQuantity = Effect.fn(function* (quantity) {
965
- if (Predicate.isNullish(quantity)) return void 0;
966
- return {
967
- "#text": quantity.value,
968
- "@unitCode": quantity.unitCode
969
- };
970
- });
971
- //#endregion
972
- //#region src/decoders/fields/encode-line-price.ts
973
- const encodeLinePrice = Effect.fn(function* (price) {
974
- if (Predicate.isNullish(price)) return;
975
- return {
976
- "cbc:PriceAmount": yield* encodeAmount(price.priceAmount),
977
- "cbc:BaseQuantity": yield* encodeQuantity(price.baseQuantity),
978
- "cac:AllowanceCharge": yield* encodePriceAllowanceCharges(price.allowanceCharge)
979
- };
980
- });
981
- //#endregion
982
- //#region src/decoders/fields/encode-line-shared.ts
983
- const encodeLineShared = Effect.fn(function* (lineShared) {
984
- return {
985
- "cbc:ID": lineShared.id,
986
- "cbc:Note": lineShared.note,
987
- "cbc:InvoicedQuantity": "invoicedQuantity" in lineShared ? yield* encodeQuantity(lineShared.invoicedQuantity) : void 0,
988
- "cbc:CreditedQuantity": "creditedQuantity" in lineShared ? yield* encodeQuantity(lineShared.creditedQuantity) : void 0,
989
- "cbc:LineExtensionAmount": yield* encodeAmount(lineShared.lineExtensionAmount),
990
- "cbc:AccountingCost": lineShared.accountingCost,
991
- "cac:InvoicePeriod": yield* encodeInvoiceLinePeriod(lineShared.invoicePeriod),
992
- "cac:OrderLineReference": lineShared.orderLineReference ? { "cbc:LineID": lineShared.orderLineReference.lineId } : void 0,
993
- "cac:DocumentReference": Predicate.isNullish(lineShared.documentReference) ? void 0 : yield* Effect.forEach(lineShared.documentReference, Effect.fn(function* (documentReference) {
994
- return {
995
- "cbc:DocumentTypeCode": documentReference.documentTypeCode,
996
- "cbc:ID": yield* encodeIdentifier(documentReference)
997
- };
998
- })),
999
- "cac:AllowanceCharge": yield* encodeLineAllowanceCharges(lineShared.allowanceCharges),
1000
- "cac:Item": {
1001
- "cbc:Description": lineShared.item.description,
1002
- "cbc:Name": lineShared.item.name,
1003
- "cac:BuyersItemIdentification": yield* encodeSimpleIdentifier(lineShared.item.buyersItemIdentification),
1004
- "cac:SellersItemIdentification": yield* encodeSimpleIdentifier(lineShared.item.sellersItemIdentification),
1005
- "cac:StandardItemIdentification": lineShared.item.standardItemIdentification ? { "cbc:ID": yield* encodeIdentifier(lineShared.item.standardItemIdentification.id) } : void 0,
1006
- "cac:OriginCountry": lineShared.item.originCountryCode ? { "cbc:IdentificationCode": lineShared.item.originCountryCode.identificationCode } : void 0,
1007
- "cac:CommodityClassification": lineShared.item.commodityClassifications?.map((c) => ({ "cbc:ItemClassificationCode": {
1008
- "#text": c.itemClassification.id,
1009
- "@listID": c.itemClassification.listId,
1010
- "@listVersionID": c.itemClassification.listVersionId
1011
- } })),
1012
- "cac:ClassifiedTaxCategory": yield* encodeTaxCategory(lineShared.item.classifiedTaxCategory),
1013
- "cac:AdditionalItemProperty": lineShared.item.additionalItemProperties?.map((p) => ({
1014
- "cbc:Name": p.name,
1015
- "cbc:Value": p.value
1016
- }))
1017
- },
1018
- "cac:Price": yield* encodeLinePrice(lineShared.price)
1019
- };
1020
- });
1021
- //#endregion
1022
- //#region src/decoders/fields/encode-credit-note-lines.ts
1023
- const encodeCreditNoteLines = Effect.fn(function* (creditNoteLines) {
1024
- if (creditNoteLines.length === 0) return void 0;
1025
- return yield* Effect.forEach(creditNoteLines, encodeLineShared);
1026
- });
1027
- //#endregion
1028
- //#region src/decoders/fields/encode-address.ts
1029
- const encodeAddress = Effect.fn(function* (address) {
1030
- if (Predicate.isNullish(address)) return void 0;
1031
- return {
1032
- "cbc:StreetName": address.streetName,
1033
- "cbc:AdditionalStreetName": address.additionalStreetName,
1034
- "cbc:CityName": address.cityName,
1035
- "cbc:PostalZone": address.postalZone,
1036
- "cbc:CountrySubentity": address.countrySubentity,
1037
- "cac:AddressLine": address.addressLine?.line ? { "cbc:Line": address.addressLine.line } : void 0,
1038
- "cac:Country": { "cbc:IdentificationCode": address.countryCode.identificationCode }
1039
- };
1040
- });
1041
- //#endregion
1042
- //#region src/decoders/fields/encode-delivery.ts
1043
- const encodeDelivery = Effect.fn(function* (delivery) {
1044
- if (Predicate.isNullish(delivery)) return void 0;
1045
- return {
1046
- "cbc:ActualDeliveryDate": delivery.actualDeliveryDate,
1047
- "cac:DeliveryLocation": yield* encodeDeliveryLocation(delivery.deliveryLocation),
1048
- "cac:DeliveryParty": Predicate.isTruthy(delivery.deliveryParty?.partyName.name) ? { "cac:PartyName": { "cbc:Name": delivery.deliveryParty?.partyName.name } } : void 0
1049
- };
1050
- });
1051
- const encodeDeliveryLocation = Effect.fn(function* (location) {
1052
- if (Predicate.isNullish(location)) return void 0;
1053
- return {
1054
- "cbc:ID": yield* encodeIdentifier(location.id),
1055
- "cac:Address": yield* encodeAddress(location.address)
1056
- };
1057
- });
1058
- //#endregion
1059
- //#region src/decoders/fields/encode-invoice-period.ts
1060
- const encodeInvoicePeriod = Effect.fn(function* (invoicePeriod) {
1061
- return Predicate.isNotNullish(invoicePeriod) ? {
1062
- "cbc:StartDate": invoicePeriod.startDate,
1063
- "cbc:EndDate": invoicePeriod.endDate,
1064
- "cbc:DescriptionCode": invoicePeriod.descriptionCode
1065
- } : void 0;
1066
- });
1067
- //#endregion
1068
- //#region src/decoders/fields/encode-legal-monetary-total.ts
1069
- const encodeLegalMonetaryTotal = Effect.fn(function* (legalMonetaryTotal) {
1070
- return {
1071
- "cbc:LineExtensionAmount": yield* encodeAmount(legalMonetaryTotal.lineExtensionAmount),
1072
- "cbc:TaxExclusiveAmount": yield* encodeAmount(legalMonetaryTotal.taxExclusiveAmount),
1073
- "cbc:TaxInclusiveAmount": yield* encodeAmount(legalMonetaryTotal.taxInclusiveAmount),
1074
- "cbc:AllowanceTotalAmount": yield* encodeAmount(legalMonetaryTotal.allowanceTotalAmount),
1075
- "cbc:ChargeTotalAmount": yield* encodeAmount(legalMonetaryTotal.chargeTotalAmount),
1076
- "cbc:PrepaidAmount": yield* encodeAmount(legalMonetaryTotal.prepaidAmount),
1077
- "cbc:PayableRoundingAmount": yield* encodeAmount(legalMonetaryTotal.payableRoundingAmount),
1078
- "cbc:PayableAmount": yield* encodeAmount(legalMonetaryTotal.payableAmount)
1079
- };
1080
- });
1081
- //#endregion
1082
- //#region src/decoders/fields/encode-order-reference.ts
1083
- const encodeOrderReference = Effect.fn(function* (orderReference) {
1084
- if (Predicate.isNullish(orderReference)) return void 0;
1085
- return {
1086
- "cbc:ID": orderReference.id,
1087
- "cbc:SalesOrderID": orderReference.salesOrderId
1088
- };
1089
- });
1090
- //#endregion
1091
- //#region src/decoders/fields/encode-contact.ts
1092
- const encodeContact = Effect.fn(function* (contact) {
1093
- if (Predicate.isNullish(contact)) return void 0;
1094
- return {
1095
- "cbc:Name": contact.name,
1096
- "cbc:Telephone": contact.telephone,
1097
- "cbc:ElectronicMail": contact.electronicMail
1098
- };
1099
- });
1100
- //#endregion
1101
- //#region src/decoders/fields/encode-party-tax-scheme.ts
1102
- const encodePartyTaxScheme = Effect.fn(function* (partyTaxScheme) {
1103
- if (Predicate.isNullish(partyTaxScheme)) return void 0;
1104
- return {
1105
- "cbc:CompanyID": partyTaxScheme.companyId,
1106
- "cac:TaxScheme": yield* encodeSimpleIdentifier(partyTaxScheme.taxSchemeId)
1107
- };
1108
- });
1109
- //#endregion
1110
- //#region src/decoders/fields/encode-parties-tax-scheme.ts
1111
- const encodePartiesTaxScheme = Effect.fn(function* (partiesTaxScheme) {
1112
- if (Predicate.isNullish(partiesTaxScheme) || partiesTaxScheme.length === 0) return void 0;
1113
- return yield* Effect.forEach(partiesTaxScheme, Effect.fn(function* (partyTaxScheme) {
1114
- return yield* encodePartyTaxScheme(partyTaxScheme);
1115
- }));
1116
- });
1117
- //#endregion
1118
- //#region src/decoders/fields/encode-party-legal-entity.ts
1119
- const encodePartyLegalEntity$1 = Effect.fn(function* (legalEntity) {
1120
- return {
1121
- "cbc:RegistrationName": legalEntity.registrationName,
1122
- "cbc:CompanyID": yield* encodeIdentifier(legalEntity.companyId),
1123
- "cbc:CompanyLegalForm": legalEntity.companyLegalForm
1124
- };
1125
- });
1126
- //#endregion
1127
- //#region src/decoders/fields/encode-party.ts
1128
- const encodeParty = Effect.fn(function* (party) {
1129
- if (Predicate.isNullish(party)) return void 0;
1130
- return { "cac:Party": {
1131
- "cbc:EndpointID": yield* encodeIdentifier(party.endpointId),
1132
- "cac:PartyIdentification": yield* encodeAdditionalIdentifiers(party.partyIdentification),
1133
- "cac:PartyName": yield* encodePartyName$1(party.partyName),
1134
- "cac:PostalAddress": yield* encodeAddress(party.postalAddress),
1135
- "cac:PartyTaxScheme": yield* encodePartiesTaxScheme(party.partyTaxSchemes),
1136
- "cac:PartyLegalEntity": yield* encodePartyLegalEntity$1(party.partyLegalEntity),
1137
- "cac:Contact": yield* encodeContact(party.contact)
1138
- } };
1139
- });
1140
- const encodePartyName$1 = Effect.fn(function* (partyName) {
1141
- if (Predicate.isNullish(partyName)) return void 0;
1142
- return { "cbc:Name": partyName.name };
1143
- });
1144
- const encodeAdditionalIdentifiers = Effect.fn(function* (identifiers) {
1145
- if (Predicate.isNullish(identifiers)) return void 0;
1146
- return { "cbc:ID": yield* encodeIdentifier(identifiers?.id) };
1147
- });
1148
- //#endregion
1149
- //#region src/decoders/fields/encode-payee-party.ts
1150
- const encodePayeeParty = Effect.fn(function* (payeeParty) {
1151
- if (Predicate.isNullish(payeeParty)) return void 0;
1152
- return {
1153
- "cac:PartyIdentification": yield* encodePartyIdentification(payeeParty.partyIdentification),
1154
- "cac:PartyName": yield* encodePartyName(payeeParty.partyName),
1155
- "cac:PartyLegalEntity": yield* encodePartyLegalEntity(payeeParty.partyLegalEntity)
1156
- };
1157
- });
1158
- const encodePartyName = Effect.fn(function* (partyName) {
1159
- return { "cbc:Name": partyName.name };
1160
- });
1161
- const encodePartyLegalEntity = Effect.fn(function* (partyLegalEntity) {
1162
- if (Predicate.isNullish(partyLegalEntity)) return void 0;
1163
- return { "cbc:CompanyId": Predicate.isTruthy(partyLegalEntity?.companyId) ? yield* encodeIdentifier(partyLegalEntity?.companyId) : void 0 };
1164
- });
1165
- const encodePartyIdentification = Effect.fn(function* (partyIdentification) {
1166
- if (Predicate.isNullish(partyIdentification)) return void 0;
1167
- return { "cbc:ID": Predicate.isTruthy(partyIdentification.id) ? yield* encodeIdentifier(partyIdentification.id) : void 0 };
1168
- });
1169
- //#endregion
1170
- //#region src/decoders/fields/encode-payment-means.ts
1171
- const encodePaymentMeans = Effect.fn(function* (pms) {
1172
- if (Predicate.isNullish(pms)) return void 0;
1173
- return yield* Effect.forEach(pms, Effect.fn(function* (pm) {
1174
- return {
1175
- "cbc:PaymentMeansCode": yield* encodePaymentMeansCode(pm.paymentMeansCode),
1176
- "cbc:PaymentID": pm.paymentId,
1177
- "cbc:PaymentDueDate": pm.paymentDueDate,
1178
- "cac:CardAccount": Predicate.isNotNullish(pm.cardAccount) ? {
1179
- "cbc:PrimaryAccountNumberID": pm.cardAccount.primaryAccountNumberId,
1180
- "cbc:NetworkID": pm.cardAccount.networkId,
1181
- "cbc:HolderName": pm.cardAccount.holderName
1182
- } : void 0,
1183
- "cac:PayeeFinancialAccount": yield* encodePayeeFinancialAccount(pm.payeeFinancialAccount),
1184
- "cac:PaymentMandate": yield* encodePaymentMendate(pm.paymentMandate)
1185
- };
1186
- }));
1187
- });
1188
- const encodePaymentMeansCode = Effect.fn(function* (code) {
1189
- if (Predicate.isNullish(code)) return void 0;
1190
- return {
1191
- "#text": code.code,
1192
- "@name": code.name
1193
- };
1194
- });
1195
- const encodePaymentMendate = Effect.fn(function* (mendate) {
1196
- if (Predicate.isNullish(mendate)) return void 0;
1197
- return {
1198
- "cbc:Id": mendate.id,
1199
- "cac:PayerFinancialAccount": yield* encodeSimpleIdentifier(mendate.payerFinancialAccountId)
1200
- };
1201
- });
1202
- const encodePayeeFinancialAccount = Effect.fn(function* (account) {
1203
- if (Predicate.isNullish(account)) return void 0;
1204
- return {
1205
- "cbc:ID": account.id,
1206
- "cbc:Name": account.name,
1207
- "cac:FinancialInstitutionBranch": yield* encodeSimpleIdentifier(account.financialInstitutionBranch)
1208
- };
1209
- });
1210
- //#endregion
1211
- //#region src/decoders/fields/encode-payment-terms.ts
1212
- const encodePaymentTerms = Effect.fn(function* (paymentTerms) {
1213
- if (Predicate.isNullish(paymentTerms)) return void 0;
1214
- return { "cbc:Note": paymentTerms.note };
1215
- });
1216
- //#endregion
1217
- //#region src/decoders/fields/encode-tax-representative-party.ts
1218
- const encodeTaxRepresentativeParty = Effect.fn(function* (taxRepresentativeParty) {
1219
- if (Predicate.isNullish(taxRepresentativeParty)) return;
1220
- return {
1221
- "cac:PartyName": { "cbc:Name": taxRepresentativeParty.name },
1222
- "cac:PostalAddress": yield* encodeAddress(taxRepresentativeParty.postalAddress),
1223
- "cac:PartyTaxScheme": yield* encodePartyTaxScheme(taxRepresentativeParty.partyTaxScheme)
1224
- };
1225
- });
1226
- //#endregion
1227
- //#region src/decoders/fields/encode-tax-totals.ts
1228
- const encodeTaxTotals = Effect.fn(function* (taxTotals) {
1229
- return yield* Effect.forEach(taxTotals, Effect.fn(function* (taxTotal) {
1230
- return {
1231
- "cbc:TaxAmount": yield* encodeAmount(taxTotal.taxAmount),
1232
- "cac:TaxSubtotal": yield* encodeTaxSubtotals(taxTotal.taxSubtotals)
1233
- };
1234
- }));
1235
- });
1236
- const encodeTaxSubtotals = Effect.fn(function* (taxSubtotals) {
1237
- if (Predicate.isNullish(taxSubtotals)) return void 0;
1238
- return yield* Effect.forEach(taxSubtotals, Effect.fn(function* (taxSubTotal) {
1239
- return {
1240
- "cbc:TaxableAmount": yield* encodeAmount(taxSubTotal.taxableAmount),
1241
- "cbc:TaxAmount": yield* encodeAmount(taxSubTotal.taxAmount),
1242
- "cac:TaxCategory": {
1243
- "cbc:ID": taxSubTotal.taxCategory.id,
1244
- "cbc:Percent": taxSubTotal.taxCategory.percent,
1245
- "cbc:TaxExemptionReasonCode": taxSubTotal.taxCategory.taxExemptionReasonCode,
1246
- "cbc:TaxExemptionReason": taxSubTotal.taxCategory.taxExemptionReason,
1247
- "cac:TaxScheme": yield* encodeSimpleIdentifier(taxSubTotal.taxCategory.taxSchemeId)
1248
- }
1249
- };
1250
- }));
1251
- });
1252
- //#endregion
1253
- //#region src/decoders/encode-credit-note.ts
1254
- const encodeCreditNote = Effect.fn(function* (creditNote) {
1255
- return {
1256
- "?xml": {
1257
- "@version": "1.0",
1258
- "@encoding": "UTF-8"
1259
- },
1260
- CreditNote: {
1261
- "@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
1262
- "@xsi:schemaLocation": import.meta.env["MODE"] === "test" ? "urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2 https://docs.oasis-open.org/ubl/os-UBL-2.4/xsd/maindoc/UBL-CreditNote-2.4.xsd urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 https://docs.oasis-open.org/ubl/os-UBL-2.4/xsd/common/UBL-CommonAggregateComponents-2.4.xsd urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 https://docs.oasis-open.org/ubl/os-UBL-2.4/xsd/common/UBL-CommonBasicComponents-2.4.xsd" : void 0,
1263
- "@xmlns:cac": "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
1264
- "@xmlns:cbc": "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
1265
- "@xmlns": "urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2",
1266
- "cbc:CustomizationID": creditNote.customizationId,
1267
- "cbc:ProfileID": creditNote.profileId,
1268
- "cbc:ID": creditNote.id,
1269
- "cbc:IssueDate": creditNote.issueDate,
1270
- "cbc:CreditNoteTypeCode": creditNote.creditNoteTypeCode,
1271
- "cbc:Note": creditNote.note,
1272
- "cbc:TaxPointDate": creditNote.taxPointDate,
1273
- "cbc:DocumentCurrencyCode": creditNote.documentCurrencyCode,
1274
- "cbc:TaxCurrencyCode": creditNote.taxCurrencyCode,
1275
- "cbc:AccountingCost": creditNote.accountingCost,
1276
- "cbc:BuyerReference": creditNote.buyerReference,
1277
- "cac:InvoicePeriod": yield* encodeInvoicePeriod(creditNote.invoicePeriod),
1278
- "cac:OrderReference": yield* encodeOrderReference(creditNote.orderReference),
1279
- "cac:BillingReference": yield* encodeBillingReferences(creditNote.billingReferences),
1280
- "cac:DespatchDocumentReference": yield* encodeSimpleIdentifier(creditNote.despatchDocumentReference),
1281
- "cac:ReceiptDocumentReference": yield* encodeSimpleIdentifier(creditNote.receiptDocumentReference),
1282
- "cac:OriginatorDocumentReference": yield* encodeSimpleIdentifier(creditNote.originatorDocumentReference),
1283
- "cac:ContractDocumentReference": yield* encodeSimpleIdentifier(creditNote.contractDocumentReference),
1284
- "cac:AdditionalDocumentReference": yield* encodeAdditionalDocumentReferences(creditNote.additionalDocumentReferences),
1285
- "cac:AccountingSupplierParty": yield* encodeParty(creditNote.accountingSupplierParty),
1286
- "cac:AccountingCustomerParty": yield* encodeParty(creditNote.accountingCustomerParty),
1287
- "cac:PayeeParty": yield* encodePayeeParty(creditNote.payeeParty),
1288
- "cac:TaxRepresentativeParty": yield* encodeTaxRepresentativeParty(creditNote.taxRepresentativeParty),
1289
- "cac:Delivery": yield* encodeDelivery(creditNote.delivery),
1290
- "cac:PaymentMeans": yield* encodePaymentMeans(creditNote.paymentMeans),
1291
- "cac:PaymentTerms": yield* encodePaymentTerms(creditNote.paymentTerms),
1292
- "cac:AllowanceCharge": yield* encodeAllowanceCharges(creditNote.allowanceCharges),
1293
- "cac:TaxTotal": yield* encodeTaxTotals(creditNote.taxTotals),
1294
- "cac:LegalMonetaryTotal": yield* encodeLegalMonetaryTotal(creditNote.legalMonetaryTotal),
1295
- "cac:CreditNoteLine": yield* encodeCreditNoteLines(creditNote.creditNoteLines)
1296
- }
1297
- };
1298
- });
1299
- //#endregion
1300
- //#region src/decoders/fields/encode-invoice-lines.ts
1301
- const encodeInvoiceLines = Effect.fn(function* (invoiceLines) {
1302
- if (invoiceLines.length === 0) return void 0;
1303
- return yield* Effect.forEach(invoiceLines, encodeLineShared);
1304
- });
1305
- //#endregion
1306
- //#region src/decoders/encode-invoice.ts
1307
- const encodeInvoice = Effect.fn(function* (invoice) {
1308
- return {
1309
- "?xml": {
1310
- "@version": "1.0",
1311
- "@encoding": "UTF-8"
1312
- },
1313
- Invoice: {
1314
- "@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
1315
- "@xmlns:cac": "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
1316
- "@xmlns:cbc": "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
1317
- "@xmlns": "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2",
1318
- "cbc:CustomizationID": invoice.customizationId,
1319
- "cbc:ProfileID": invoice.profileId,
1320
- "cbc:ID": invoice.id,
1321
- "cbc:IssueDate": invoice.issueDate,
1322
- "cbc:DueDate": invoice.dueDate,
1323
- "cbc:InvoiceTypeCode": invoice.invoiceTypeCode,
1324
- "cbc:Note": invoice.note,
1325
- "cbc:TaxPointDate": invoice.taxPointDate,
1326
- "cbc:DocumentCurrencyCode": invoice.documentCurrencyCode,
1327
- "cbc:TaxCurrencyCode": invoice.taxCurrencyCode,
1328
- "cbc:AccountingCost": invoice.accountingCost,
1329
- "cbc:BuyerReference": invoice.buyerReference,
1330
- "cac:InvoicePeriod": yield* encodeInvoicePeriod(invoice.invoicePeriod),
1331
- "cac:OrderReference": yield* encodeOrderReference(invoice.orderReference),
1332
- "cac:BillingReference": yield* encodeBillingReferences(invoice.billingReferences),
1333
- "cac:DespatchDocumentReference": yield* encodeSimpleIdentifier(invoice.despatchDocumentReference),
1334
- "cac:ReceiptDocumentReference": yield* encodeSimpleIdentifier(invoice.receiptDocumentReference),
1335
- "cac:OriginatorDocumentReference": yield* encodeSimpleIdentifier(invoice.originatorDocumentReference),
1336
- "cac:ContractDocumentReference": yield* encodeSimpleIdentifier(invoice.contractDocumentReference),
1337
- "cac:AdditionalDocumentReference": yield* encodeAdditionalDocumentReferences(invoice.additionalDocumentReferences),
1338
- "cac:ProjectReference": yield* encodeSimpleIdentifier(invoice.projectReference),
1339
- "cac:AccountingSupplierParty": yield* encodeParty(invoice.accountingSupplierParty),
1340
- "cac:AccountingCustomerParty": yield* encodeParty(invoice.accountingCustomerParty),
1341
- "cac:PayeeParty": yield* encodePayeeParty(invoice.payeeParty),
1342
- "cac:TaxRepresentativeParty": yield* encodeTaxRepresentativeParty(invoice.taxRepresentativeParty),
1343
- "cac:Delivery": yield* encodeDelivery(invoice.delivery),
1344
- "cac:PaymentMeans": yield* encodePaymentMeans(invoice.paymentMeans),
1345
- "cac:PaymentTerms": yield* encodePaymentTerms(invoice.paymentTerms),
1346
- "cac:AllowanceCharge": yield* encodeAllowanceCharges(invoice.allowanceCharges),
1347
- "cac:TaxTotal": yield* encodeTaxTotals(invoice.taxTotals),
1348
- "cac:LegalMonetaryTotal": yield* encodeLegalMonetaryTotal(invoice.legalMonetaryTotal),
1349
- "cac:InvoiceLine": yield* encodeInvoiceLines(invoice.invoiceLines)
1350
- }
1351
- };
1352
- });
1353
- //#endregion
1354
- //#region src/decoders/fields/encode-message-party.ts
1355
- const encodeMessageParty = Effect.fn(function* (party) {
1356
- if (Predicate.isNullish(party)) return void 0;
1357
- return {
1358
- "cbc:EndpointID": "endpointId" in party && Predicate.isNotNullish(party.endpointId) ? yield* encodeIdentifier(party.endpointId) : void 0,
1359
- "cac:PartyIdentification": "partyIdentification" in party && Predicate.isNotNullish(party.partyIdentification) ? { "cbc:ID": yield* encodeIdentifier(party.partyIdentification) } : void 0,
1360
- "cac:PartyName": "partyName" in party && Predicate.isNotNullish(party.partyName) ? { "cbc:Name": party.partyName.name } : void 0,
1361
- "cac:PartyLegalEntity": "partyLegalEntity" in party ? yield* encodePartyLegalEntity$1(party.partyLegalEntity) : void 0,
1362
- "cac:Contact": "contact" in party ? yield* encodeContact(party.contact) : void 0
1363
- };
1364
- });
1365
- //#endregion
1366
- //#region src/decoders/encode-invoice-response.ts
1367
- const encodeInvoiceResponse = Effect.fn(function* (invoiceResponse) {
1368
- return {
1369
- "?xml": {
1370
- "@version": "1.0",
1371
- "@encoding": "UTF-8"
1372
- },
1373
- ApplicationResponse: {
1374
- "@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
1375
- "@xsi:schemaLocation": import.meta.env["MODE"] === "test" ? "urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2 https://docs.oasis-open.org/ubl/os-UBL-2.4/xsd/maindoc/UBL-ApplicationResponse-2.4.xsd urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 https://docs.oasis-open.org/ubl/os-UBL-2.4/xsd/common/UBL-CommonAggregateComponents-2.4.xsd urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 https://docs.oasis-open.org/ubl/os-UBL-2.4/xsd/common/UBL-CommonBasicComponents-2.4.xsd" : void 0,
1376
- "@xmlns:cac": "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
1377
- "@xmlns:cbc": "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
1378
- "@xmlns": "urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2",
1379
- "cbc:CustomizationID": invoiceResponse.customizationId,
1380
- "cbc:ProfileID": invoiceResponse.profileId,
1381
- "cbc:ID": invoiceResponse.id,
1382
- "cbc:IssueDate": invoiceResponse.issueDate,
1383
- "cbc:IssueTime": invoiceResponse.issueTime,
1384
- "cbc:Note": invoiceResponse.note,
1385
- "cac:SenderParty": yield* encodeMessageParty(invoiceResponse.senderParty),
1386
- "cac:ReceiverParty": yield* encodeMessageParty(invoiceResponse.receiverParty),
1387
- "cac:DocumentResponse": yield* encodeDocumentResponse(invoiceResponse.documentResponse)
1388
- }
1389
- };
1390
- });
1391
- const encodeDocumentResponse = Effect.fn(function* (documentResponse) {
1392
- if (Predicate.isNullish(documentResponse)) return;
1393
- return {
1394
- "cac:Response": {
1395
- "cbc:ResponseCode": documentResponse.response.responseCode,
1396
- "cbc:EffectiveDate": documentResponse.response.effectiveDate,
1397
- "cac:Status": documentResponse.response.status?.map((status) => ({
1398
- "cbc:StatusReasonCode": Predicate.isNotNullish(status.statusReasonCode) ? {
1399
- "#text": status.statusReasonCode.value,
1400
- "@listID": status.statusReasonCode.listId
1401
- } : void 0,
1402
- "cbc:StatusReason": status.statusReason,
1403
- "cac:Condition": status.condition?.map((condition) => ({
1404
- "cbc:AttributeID": condition.attributeId,
1405
- "cbc:Description": condition.description
1406
- }))
1407
- }))
1408
- },
1409
- "cac:DocumentReference": yield* encodeDocumentReference(documentResponse.documentReference),
1410
- "cac:IssuerParty": yield* encodeMessageParty(documentResponse.issuerParty),
1411
- "cac:RecipientParty": yield* encodeMessageParty(documentResponse.recipientParty)
1412
- };
1413
- });
1414
- const encodeDocumentReference = Effect.fn(function* (documentReference) {
1415
- if (Predicate.isNullish(documentReference)) return void 0;
1416
- return {
1417
- "cbc:ID": documentReference.id,
1418
- "cbc:IssueDate": documentReference.issueDate,
1419
- "cbc:DocumentTypeCode": documentReference.documentTypeCode
1420
- };
1421
- });
1422
- //#endregion
1423
- //#region src/decoders/errors.ts
1424
- /**
1425
- * @description Raised when a PEPPOL document cannot be decoded from its XML node representation.
1426
- */
1427
- var PeppolDecodeError = class extends Schema.TaggedError()("PeppolDecodeError", { message: Schema.String }) {};
1428
- /**
1429
- * @description Raised when a PEPPOL document cannot be encoded into its XML node representation.
1430
- */
1431
- var PeppolEncodeError = class extends Schema.TaggedError()("PeppolEncodeError", { message: Schema.String }) {};
1432
- //#endregion
1433
- //#region src/decoders/encode-message-level-response.ts
1434
- const encodeMessageLevelResponse = Effect.fn(function* (messageResponse) {
1435
- return {
1436
- "?xml": {
1437
- "@version": "1.0",
1438
- "@encoding": "UTF-8"
1439
- },
1440
- ApplicationResponse: {
1441
- "@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
1442
- "@xsi:schemaLocation": import.meta.env["MODE"] === "test" ? "urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2 https://docs.oasis-open.org/ubl/os-UBL-2.4/xsd/maindoc/UBL-ApplicationResponse-2.4.xsd urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 https://docs.oasis-open.org/ubl/os-UBL-2.4/xsd/common/UBL-CommonAggregateComponents-2.4.xsd urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2 https://docs.oasis-open.org/ubl/os-UBL-2.4/xsd/common/UBL-CommonBasicComponents-2.4.xsd" : void 0,
1443
- "@xmlns:cac": "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2",
1444
- "@xmlns:cbc": "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2",
1445
- "@xmlns": "urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2",
1446
- "cbc:CustomizationID": messageResponse.customizationId,
1447
- "cbc:ProfileID": messageResponse.profileId,
1448
- "cbc:ID": messageResponse.id,
1449
- "cbc:IssueDate": messageResponse.issueDate,
1450
- "cbc:IssueTime": messageResponse.issueTime,
1451
- "cac:SenderParty": yield* encodeMessageParty(messageResponse.senderParty),
1452
- "cac:ReceiverParty": yield* encodeMessageParty(messageResponse.receiverParty),
1453
- "cac:DocumentResponse": yield* encodeMessageLevelDocumentResponse(messageResponse.documentResponse)
1454
- }
1455
- };
1456
- });
1457
- const encodeMessageLevelDocumentResponse = Effect.fn(function* (documentResponse) {
1458
- if (Predicate.isNullish(documentResponse)) return yield* new PeppolEncodeError({ message: "Cannot encode a message level response without a document response" });
1459
- return {
1460
- "cac:Response": {
1461
- "cbc:ResponseCode": documentResponse.response.responseCode,
1462
- "cbc:Description": documentResponse.response.description
1463
- },
1464
- "cac:DocumentReference": {
1465
- "cbc:ID": documentResponse.documentReference.id,
1466
- "cbc:DocumentTypeCode": documentResponse.documentReference.documentTypeCode,
1467
- "cbc:VersionID": documentResponse.documentReference.versionId
1468
- },
1469
- "cac:LineResponse": documentResponse.lineResponse.map((line) => ({
1470
- "cac:LineReference": { "cbc:LineID": line.lineReference.lineId },
1471
- "cac:Response": {
1472
- "cbc:ResponseCode": line.response.responseCode,
1473
- "cbc:Description": line.response.description,
1474
- "cac:Status": { "cbc:StatusReasonCode": line.response.status.statusReasonCode }
1475
- }
1476
- }))
1477
- };
1478
- });
1479
- //#endregion
1480
- //#region src/schemas/utils/quantity-unit-code-to-intl-unit.ts
1481
- const quantityToIntlUnitMap = {
1482
- CMT: "centimeter",
1483
- MTR: "meter",
1484
- MMT: "millimeter",
1485
- KMT: "kilometer",
1486
- INH: "inch",
1487
- FOT: "foot",
1488
- YRD: "yard",
1489
- SMI: "mile",
1490
- F49: "mile-scandinavian",
1491
- ACR: "acre",
1492
- H18: "hectare",
1493
- LTR: "liter",
1494
- MLT: "milliliter",
1495
- GLI: "gallon",
1496
- GLL: "gallon",
1497
- OZA: "fluid-ounce",
1498
- GRM: "gram",
1499
- KGM: "kilogram",
1500
- LBR: "pound",
1501
- ONZ: "ounce",
1502
- STI: "stone",
1503
- STN: "stone",
1504
- SEC: "second",
1505
- MIN: "minute",
1506
- HUR: "hour",
1507
- DAY: "day",
1508
- WEE: "week",
1509
- MON: "month",
1510
- ANN: "year",
1511
- B98: "microsecond",
1512
- C26: "millisecond",
1513
- C47: "nanosecond",
1514
- CEL: "celsius",
1515
- FAH: "fahrenheit",
1516
- A99: "bit",
1517
- AD: "byte",
1518
- "2P": "kilobyte",
1519
- "4L": "megabyte",
1520
- E34: "gigabyte",
1521
- E35: "terabyte",
1522
- E36: "petabyte",
1523
- B68: "gigabit",
1524
- B80: "gigabit",
1525
- C21: "kilobit",
1526
- B10: "bit",
1527
- DD: "degree",
1528
- P1: "percent",
1529
- KMH: "kilometer-per-hour",
1530
- MTS: "meter-per-second",
1531
- HM: "mile-per-hour",
1532
- KNT: "kilometer-per-hour",
1533
- "2X": "meter-per-minute",
1534
- "40": "milliliter-per-second",
1535
- "41": "milliliter-per-minute",
1536
- "4G": "milliliter",
1537
- "4H": "micrometer",
1538
- A44: "liter",
1539
- A45: "meter",
1540
- A11: "meter",
1541
- A12: "kilometer",
1542
- B57: "kilometer",
1543
- "4U": "pound-per-hour",
1544
- "4M": "gram-per-hour"
1545
- };
1546
- function quantityUnitCodeToIntlUnit(code) {
1547
- return quantityToIntlUnitMap[code];
1548
- }
1549
- //#endregion
1550
- //#region src/schemas/utils/format-quantity-with-unit.ts
1551
- function formatQuantityWithUnit(value, code, locale = "en-US", unitDisplay = "short") {
1552
- const intlUnit = quantityToIntlUnitMap[code];
1553
- if (intlUnit) try {
1554
- return new Intl.NumberFormat(locale, {
1555
- style: "unit",
1556
- unit: intlUnit,
1557
- unitDisplay
1558
- }).format(value);
1559
- } catch {}
1560
- return `${new Intl.NumberFormat(locale).format(value)} ${quantityUnitCodes[code]}`;
1561
- }
1562
- //#endregion
1563
- //#region src/schemas/utils/get-credit-note-type-code-description.ts
1564
- function getCreditNoteTypeCodeDescription(code) {
1565
- return creditNoteTypeCodes[code];
1566
- }
1567
- //#endregion
1568
- //#region src/schemas/utils/get-invoice-type-code-description.ts
1569
- function getInvoiceTypeCodeDescription(code) {
1570
- return invoiceTypeCodes[code];
1571
- }
1572
- //#endregion
1573
- //#region src/schemas/utils/is-valid-credit-note-type-code.ts
1574
- function isValidCreditNoteTypeCode(code) {
1575
- return code in creditNoteTypeCodes;
1576
- }
1577
- //#endregion
1578
- //#region src/schemas/utils/is-valid-invoice-type-code.ts
1579
- function isValidInvoiceTypeCode(code) {
1580
- return code in invoiceTypeCodes;
1581
- }
1582
- //#endregion
1583
- //#region src/schemas/utils/is-valid-process.ts
1584
- function isValidProcess(code) {
1585
- return processesList.includes(code);
1586
- }
1587
- //#endregion
1588
- export { MESSAGE_LEVEL_RESPONSE_PROFILE_ID as S, decodeCreditNote as _, getCreditNoteTypeCodeDescription as a, invoiceResponseCodeNotNeedsSchema as b, quantityUnitCodeToIntlUnit as c, encodeInvoiceResponse as d, encodeInvoice as f, decodeInvoice as g, decodeInvoiceResponse as h, getInvoiceTypeCodeDescription as i, encodeMessageLevelResponse as l, decodeMessageLevelResponse as m, isValidInvoiceTypeCode as n, formatQuantityWithUnit as o, encodeCreditNote as p, isValidCreditNoteTypeCode as r, quantityToIntlUnitMap as s, isValidProcess as t, PeppolDecodeError as u, strOrUnd as v, invoiceResponseCodeNeedsSchema as x, INVOICE_RESPONSE_PROFILE_ID as y };
1589
-
1590
- //# sourceMappingURL=is-valid-process-CSWL-q9f.js.map