@fin.cx/einvoice 8.0.0 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist_ts/00_commitinfo_data.js +1 -1
  2. package/dist_ts/einvoice.d.ts +14 -1
  3. package/dist_ts/einvoice.js +48 -3
  4. package/dist_ts/formats/base/base.encoder.d.ts +1 -1
  5. package/dist_ts/formats/base/base.validator.d.ts +5 -0
  6. package/dist_ts/formats/base/base.validator.js +28 -1
  7. package/dist_ts/formats/cii/cii.decoder.d.ts +12 -1
  8. package/dist_ts/formats/cii/cii.decoder.js +34 -1
  9. package/dist_ts/formats/cii/cii.encoder.d.ts +14 -3
  10. package/dist_ts/formats/cii/cii.encoder.js +58 -6
  11. package/dist_ts/formats/cii/cii.types.d.ts +1 -0
  12. package/dist_ts/formats/cii/cii.types.js +3 -2
  13. package/dist_ts/formats/cii/cii.validator.d.ts +11 -0
  14. package/dist_ts/formats/cii/cii.validator.js +35 -1
  15. package/dist_ts/formats/cii/facturx/facturx.decoder.d.ts +1 -1
  16. package/dist_ts/formats/cii/facturx/facturx.decoder.js +11 -5
  17. package/dist_ts/formats/cii/facturx/facturx.encoder.d.ts +2 -2
  18. package/dist_ts/formats/cii/facturx/facturx.encoder.js +17 -11
  19. package/dist_ts/formats/cii/facturx/facturx.validator.js +8 -4
  20. package/dist_ts/formats/cii/zugferd/zugferd.decoder.d.ts +1 -1
  21. package/dist_ts/formats/cii/zugferd/zugferd.decoder.js +11 -5
  22. package/dist_ts/formats/cii/zugferd/zugferd.encoder.d.ts +1 -1
  23. package/dist_ts/formats/cii/zugferd/zugferd.encoder.js +20 -14
  24. package/dist_ts/formats/cii/zugferd/zugferd.v1.decoder.d.ts +7 -1
  25. package/dist_ts/formats/cii/zugferd/zugferd.v1.decoder.js +29 -5
  26. package/dist_ts/formats/cii/zugferd/zugferd.validator.js +5 -4
  27. package/dist_ts/formats/converters/xml-to-einvoice.converter.d.ts +5 -0
  28. package/dist_ts/formats/converters/xml-to-einvoice.converter.js +11 -2
  29. package/dist_ts/formats/semantic/semantic.adapter.js +2 -2
  30. package/dist_ts/formats/ubl/en16931.ubl.validator.js +5 -1
  31. package/dist_ts/formats/ubl/generic/ubl.encoder.d.ts +23 -1
  32. package/dist_ts/formats/ubl/generic/ubl.encoder.js +71 -12
  33. package/dist_ts/formats/ubl/ubl.decoder.d.ts +1 -1
  34. package/dist_ts/formats/ubl/ubl.encoder.d.ts +16 -3
  35. package/dist_ts/formats/ubl/ubl.encoder.js +75 -13
  36. package/dist_ts/formats/ubl/ubl.validator.d.ts +11 -0
  37. package/dist_ts/formats/ubl/ubl.validator.js +35 -1
  38. package/dist_ts/formats/ubl/xrechnung/xrechnung.decoder.d.ts +6 -1
  39. package/dist_ts/formats/ubl/xrechnung/xrechnung.decoder.js +39 -8
  40. package/dist_ts/formats/ubl/xrechnung/xrechnung.encoder.d.ts +1 -1
  41. package/dist_ts/formats/ubl/xrechnung/xrechnung.encoder.js +4 -2
  42. package/dist_ts/formats/utils/date.value.d.ts +10 -0
  43. package/dist_ts/formats/utils/date.value.js +21 -0
  44. package/dist_ts/formats/utils/document.typecode.d.ts +3 -3
  45. package/dist_ts/formats/utils/document.typecode.js +8 -4
  46. package/dist_ts/formats/utils/preceding.invoice.d.ts +26 -0
  47. package/dist_ts/formats/utils/preceding.invoice.js +52 -0
  48. package/dist_ts/formats/utils/unit.codes.d.ts +40 -0
  49. package/dist_ts/formats/utils/unit.codes.js +193 -0
  50. package/dist_ts/formats/validation/codelist.validator.d.ts +1 -1
  51. package/dist_ts/formats/validation/codelist.validator.js +7 -9
  52. package/dist_ts/formats/validation/en16931.business-rules.validator.js +13 -13
  53. package/dist_ts/formats/validation/validation.types.d.ts +0 -4
  54. package/dist_ts/formats/validation/validation.types.js +1 -28
  55. package/dist_ts/index.d.ts +5 -1
  56. package/dist_ts/index.js +6 -1
  57. package/dist_ts/interfaces/common.d.ts +6 -2
  58. package/dist_ts_install/download-schematron.js +3 -5
  59. package/package.json +8 -8
  60. package/readme.md +103 -10
  61. package/ts/00_commitinfo_data.ts +1 -1
  62. package/ts/einvoice.ts +51 -2
  63. package/ts/formats/base/base.encoder.ts +1 -1
  64. package/ts/formats/base/base.validator.ts +28 -0
  65. package/ts/formats/cii/cii.decoder.ts +43 -1
  66. package/ts/formats/cii/cii.encoder.ts +62 -6
  67. package/ts/formats/cii/cii.types.ts +2 -1
  68. package/ts/formats/cii/cii.validator.ts +47 -0
  69. package/ts/formats/cii/facturx/facturx.decoder.ts +11 -4
  70. package/ts/formats/cii/facturx/facturx.encoder.ts +17 -10
  71. package/ts/formats/cii/facturx/facturx.validator.ts +9 -3
  72. package/ts/formats/cii/zugferd/zugferd.decoder.ts +11 -4
  73. package/ts/formats/cii/zugferd/zugferd.encoder.ts +20 -13
  74. package/ts/formats/cii/zugferd/zugferd.v1.decoder.ts +32 -4
  75. package/ts/formats/cii/zugferd/zugferd.validator.ts +4 -3
  76. package/ts/formats/converters/xml-to-einvoice.converter.ts +11 -1
  77. package/ts/formats/semantic/semantic.adapter.ts +1 -1
  78. package/ts/formats/ubl/en16931.ubl.validator.ts +6 -0
  79. package/ts/formats/ubl/generic/ubl.encoder.ts +78 -11
  80. package/ts/formats/ubl/ubl.decoder.ts +1 -1
  81. package/ts/formats/ubl/ubl.encoder.ts +77 -13
  82. package/ts/formats/ubl/ubl.validator.ts +47 -0
  83. package/ts/formats/ubl/xrechnung/xrechnung.decoder.ts +47 -7
  84. package/ts/formats/ubl/xrechnung/xrechnung.encoder.ts +4 -1
  85. package/ts/formats/utils/date.value.ts +21 -0
  86. package/ts/formats/utils/document.typecode.ts +7 -3
  87. package/ts/formats/utils/preceding.invoice.ts +74 -0
  88. package/ts/formats/utils/unit.codes.ts +215 -0
  89. package/ts/formats/validation/codelist.validator.ts +8 -19
  90. package/ts/formats/validation/en16931.business-rules.validator.ts +13 -13
  91. package/ts/formats/validation/validation.types.ts +0 -28
  92. package/ts/index.ts +12 -0
  93. package/ts/interfaces/common.ts +6 -1
@@ -150,34 +150,6 @@ export const CodeLists = {
150
150
  ['58', 'SEPA credit transfer'],
151
151
  ['59', 'SEPA direct debit']
152
152
  ])
153
- },
154
-
155
- // UNECE Rec 20 Unit codes (subset)
156
- UNECERec20: {
157
- version: '2021',
158
- codes: new Map([
159
- ['C62', 'One (unit)'],
160
- ['DAY', 'Day'],
161
- ['HAR', 'Hectare'],
162
- ['HUR', 'Hour'],
163
- ['KGM', 'Kilogram'],
164
- ['KTM', 'Kilometre'],
165
- ['KWH', 'Kilowatt hour'],
166
- ['LS', 'Lump sum'],
167
- ['LTR', 'Litre'],
168
- ['MIN', 'Minute'],
169
- ['MMT', 'Millimetre'],
170
- ['MON', 'Month'],
171
- ['MTK', 'Square metre'],
172
- ['MTQ', 'Cubic metre'],
173
- ['MTR', 'Metre'],
174
- ['NAR', 'Number of articles'],
175
- ['NPR', 'Number of pairs'],
176
- ['P1', 'Percent'],
177
- ['SET', 'Set'],
178
- ['TNE', 'Tonne (metric ton)'],
179
- ['WEE', 'Week']
180
- ])
181
153
  }
182
154
  };
183
155
 
package/ts/index.ts CHANGED
@@ -44,6 +44,10 @@ import {
44
44
  isAccountingDocType
45
45
  } from './formats/utils/document.typecode.js';
46
46
 
47
+ // Import the EN 16931 unit code list (BR-CL-23)
48
+ import { en16931UnitCodeList, isEn16931UnitCode } from './formats/utils/unit.codes.js';
49
+ import type { IEn16931UnitCodeList } from './formats/utils/unit.codes.js';
50
+
47
51
  // Import error classes
48
52
  import {
49
53
  EInvoiceError,
@@ -70,6 +74,9 @@ import { ZUGFeRDV1Decoder } from './formats/cii/zugferd/zugferd.v1.decoder.js';
70
74
  export type {
71
75
  // Common interfaces
72
76
  TInvoice,
77
+ TCorrectedInvoice,
78
+ TCorrectedInvoiceReference,
79
+ TInvoiceCorrection,
73
80
  TCreditNote,
74
81
  TDebitNote,
75
82
  TSelfBilledInvoice,
@@ -135,6 +142,11 @@ export { FormatDetector };
135
142
  // itself does not need a second copy of it
136
143
  export { getAccountingDocType, getDocumentTypeCode, isAccountingDocType };
137
144
 
145
+ // Export the EN 16931 unit code list (BR-CL-23: UN/ECE Recommendation 20 with the
146
+ // Recommendation 21 extension), so a consumer can check a unit before it builds a document
147
+ export { en16931UnitCodeList, isEn16931UnitCode };
148
+ export type { IEn16931UnitCodeList };
149
+
138
150
  // Export error classes
139
151
  export {
140
152
  EInvoiceError,
@@ -83,11 +83,16 @@ export interface IPdf {
83
83
  // Re-export types from tsclass for convenience
84
84
  import type {
85
85
  TInvoice,
86
+ TCorrectedInvoice,
86
87
  TDebitNote,
87
88
  TSelfBilledInvoice,
88
89
  } from '@tsclass/tsclass/dist_ts/finance/index.js';
89
90
 
90
91
  export type { TInvoice } from '@tsclass/tsclass/dist_ts/finance/index.js';
92
+ export type { TCorrectedInvoice } from '@tsclass/tsclass/dist_ts/finance/index.js';
93
+ export type { TCorrectedInvoiceReference } from '@tsclass/tsclass/dist_ts/finance/index.js';
94
+ export type { TInvoiceCorrection } from '@tsclass/tsclass/dist_ts/finance/index.js';
95
+ export type { TRelatedDocument } from '@tsclass/tsclass/dist_ts/finance/index.js';
91
96
  export type { TCreditNote } from '@tsclass/tsclass/dist_ts/finance/index.js';
92
97
  export type { TDebitNote } from '@tsclass/tsclass/dist_ts/finance/index.js';
93
98
  export type { TSelfBilledInvoice } from '@tsclass/tsclass/dist_ts/finance/index.js';
@@ -100,7 +105,7 @@ export type { TAccountingDocEnvelope } from '@tsclass/tsclass/dist_ts/finance/in
100
105
  * `Invoice` root and the CII type codes of the invoice family. Only a credit
101
106
  * note has a document shape of its own.
102
107
  */
103
- export type TInvoiceDocument = TInvoice | TDebitNote | TSelfBilledInvoice;
108
+ export type TInvoiceDocument = TInvoice | TCorrectedInvoice | TDebitNote | TSelfBilledInvoice;
104
109
  export type { TContact } from '@tsclass/tsclass/dist_ts/business/index.js';
105
110
  export type { TLetterEnvelope } from '@tsclass/tsclass/dist_ts/business/index.js';
106
111
  export type { TDocumentEnvelope } from '@tsclass/tsclass/dist_ts/business/index.js';