@ripwords/myinvois-client 0.3.1 → 0.3.3

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 (103) hide show
  1. package/dist/api/documentManagement.d.ts +2 -2
  2. package/dist/api/documentManagement.js +1 -1
  3. package/dist/api/documentSubmission.d.ts +2 -2
  4. package/dist/api/documentSubmission.js +2 -2
  5. package/dist/api/documentTypeManagement.d.ts +2 -2
  6. package/dist/api/notificationManagement.d.ts +2 -2
  7. package/dist/api/platformLogin.d.ts +2 -2
  8. package/dist/api/taxpayerValidation.d.ts +2 -2
  9. package/dist/{document-DoQEvmcK.cjs → document-B6ab06s1.cjs} +9 -1
  10. package/dist/document-B6ab06s1.cjs.map +1 -0
  11. package/dist/{document-D4O7JY0G.js → document-Bb5WkhRe.js} +8 -0
  12. package/dist/{documentManagement-CyPwiyP4.cjs → documentManagement-BviJDtf2.cjs} +5 -1
  13. package/dist/documentManagement-BviJDtf2.cjs.map +1 -0
  14. package/dist/{documentManagement-CeNbp3qm.js → documentManagement-lPm8Gziu.js} +4 -0
  15. package/dist/{documentSubmission-DUsjqWhR.cjs → documentSubmission-9uGz-31K.cjs} +2 -2
  16. package/dist/{documentSubmission-DUsjqWhR.cjs.map → documentSubmission-9uGz-31K.cjs.map} +1 -1
  17. package/dist/{documentSubmission-uJ7yPWub.js → documentSubmission-BerP4Snv.js} +1 -1
  18. package/dist/{documents-Dp19RgNX.d.ts → documents-BYV12TVt.d.ts} +16 -0
  19. package/dist/{documents-BECak3KN.d.cts → documents-D_V38Q_U.d.cts} +17 -1
  20. package/dist/index.cjs +3 -3
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +3 -3
  23. package/dist/index10.cjs +4 -24
  24. package/dist/index11.cjs +22 -0
  25. package/dist/index12.cjs +2 -33
  26. package/dist/index13.cjs +2 -23
  27. package/dist/index14.cjs +330 -0
  28. package/dist/index14.cjs.map +1 -0
  29. package/dist/index15.cjs +193 -0
  30. package/dist/index15.cjs.map +1 -0
  31. package/dist/index16.cjs +62 -0
  32. package/dist/index16.cjs.map +1 -0
  33. package/dist/index17.cjs +531 -4
  34. package/dist/index17.cjs.map +1 -0
  35. package/dist/index18.cjs +195 -6
  36. package/dist/index18.cjs.map +1 -0
  37. package/dist/index19.cjs +0 -5
  38. package/dist/index2.cjs +4 -61
  39. package/dist/index20.cjs +24 -2
  40. package/dist/index20.cjs.map +1 -0
  41. package/dist/index21.cjs +0 -3
  42. package/dist/index22.cjs +0 -6
  43. package/dist/index23.cjs +24 -203
  44. package/dist/index23.cjs.map +1 -1
  45. package/dist/index24.cjs +20 -104
  46. package/dist/index24.cjs.map +1 -1
  47. package/dist/index25.cjs +0 -137
  48. package/dist/index26.cjs +29 -59
  49. package/dist/index26.cjs.map +1 -1
  50. package/dist/index27.cjs +19 -262
  51. package/dist/index27.cjs.map +1 -1
  52. package/dist/index28.cjs +0 -79
  53. package/dist/index29.cjs +0 -107
  54. package/dist/index3.cjs +6 -531
  55. package/dist/index30.cjs +0 -73
  56. package/dist/index31.cjs +203 -107
  57. package/dist/index31.cjs.map +1 -1
  58. package/dist/index32.cjs +104 -95
  59. package/dist/index32.cjs.map +1 -1
  60. package/dist/index33.cjs +136 -4
  61. package/dist/{index25.cjs.map → index33.cjs.map} +1 -1
  62. package/dist/index34.cjs +60 -9
  63. package/dist/index34.cjs.map +1 -1
  64. package/dist/index35.cjs +266 -4
  65. package/dist/index35.cjs.map +1 -0
  66. package/dist/index36.cjs +78 -21
  67. package/dist/{index28.cjs.map → index36.cjs.map} +1 -1
  68. package/dist/index37.cjs +106 -2
  69. package/dist/{index29.cjs.map → index37.cjs.map} +1 -1
  70. package/dist/index38.cjs +72 -2
  71. package/dist/{index30.cjs.map → index38.cjs.map} +1 -1
  72. package/dist/index39.cjs +108 -326
  73. package/dist/index39.cjs.map +1 -1
  74. package/dist/index4.cjs +4 -195
  75. package/dist/index40.cjs +96 -189
  76. package/dist/index40.cjs.map +1 -1
  77. package/dist/index5.cjs +3 -0
  78. package/dist/index6.cjs +2 -24
  79. package/dist/index7.cjs +6 -0
  80. package/dist/index71.cts.map +1 -1
  81. package/dist/index8.cjs +5 -0
  82. package/dist/index9.cjs +9 -25
  83. package/dist/index9.cjs.map +1 -1
  84. package/dist/{taxpayer-BdvCGHHC.d.ts → taxpayer-BWpQOlug.d.ts} +1 -1
  85. package/dist/{taxpayer-CaDfslWB.d.cts → taxpayer-DUFUvBKi.d.cts} +2 -2
  86. package/dist/types/documents.d.ts +1 -1
  87. package/dist/types/index.d.ts +2 -2
  88. package/dist/types/taxpayer.d.ts +2 -2
  89. package/dist/utils/document.d.ts +4 -2
  90. package/dist/utils/document.js +1 -1
  91. package/dist/utils/signature-diagnostics.d.ts +2 -2
  92. package/dist/utils/signature-diagnostics.js +1 -1
  93. package/dist/utils/validation.d.ts +2 -2
  94. package/package.json +1 -1
  95. package/dist/document-DoQEvmcK.cjs.map +0 -1
  96. package/dist/documentManagement-CyPwiyP4.cjs.map +0 -1
  97. package/dist/index10.cjs.map +0 -1
  98. package/dist/index12.cjs.map +0 -1
  99. package/dist/index13.cjs.map +0 -1
  100. package/dist/index2.cjs.map +0 -1
  101. package/dist/index3.cjs.map +0 -1
  102. package/dist/index4.cjs.map +0 -1
  103. package/dist/index6.cjs.map +0 -1
package/dist/index4.cjs CHANGED
@@ -1,196 +1,5 @@
1
+ const require_documentTypeManagement = require('./documentTypeManagement-D_-LiQVg.cjs');
1
2
 
2
- //#region src/types/currencies.d.ts
3
- /**
4
- * Enum representing the allowed ISO-4217 3-letter currency codes.
5
- * Provides a more readable way to reference currency codes.
6
- *
7
- * @example
8
- * const currency = CurrencyCodeEnum.MYR;
9
- * console.log(currency); // Output: "MYR"
10
- */
11
- let CurrencyCodeEnum = /* @__PURE__ */ function(CurrencyCodeEnum$1) {
12
- CurrencyCodeEnum$1["AED"] = "AED";
13
- CurrencyCodeEnum$1["AFN"] = "AFN";
14
- CurrencyCodeEnum$1["ALL"] = "ALL";
15
- CurrencyCodeEnum$1["AMD"] = "AMD";
16
- CurrencyCodeEnum$1["ANG"] = "ANG";
17
- CurrencyCodeEnum$1["AOA"] = "AOA";
18
- CurrencyCodeEnum$1["ARS"] = "ARS";
19
- CurrencyCodeEnum$1["AUD"] = "AUD";
20
- CurrencyCodeEnum$1["AWG"] = "AWG";
21
- CurrencyCodeEnum$1["AZN"] = "AZN";
22
- CurrencyCodeEnum$1["BAM"] = "BAM";
23
- CurrencyCodeEnum$1["BBD"] = "BBD";
24
- CurrencyCodeEnum$1["BDT"] = "BDT";
25
- CurrencyCodeEnum$1["BGN"] = "BGN";
26
- CurrencyCodeEnum$1["BHD"] = "BHD";
27
- CurrencyCodeEnum$1["BIF"] = "BIF";
28
- CurrencyCodeEnum$1["BMD"] = "BMD";
29
- CurrencyCodeEnum$1["BND"] = "BND";
30
- CurrencyCodeEnum$1["BOB"] = "BOB";
31
- CurrencyCodeEnum$1["BOV"] = "BOV";
32
- CurrencyCodeEnum$1["BRL"] = "BRL";
33
- CurrencyCodeEnum$1["BSD"] = "BSD";
34
- CurrencyCodeEnum$1["BTN"] = "BTN";
35
- CurrencyCodeEnum$1["BWP"] = "BWP";
36
- CurrencyCodeEnum$1["BYN"] = "BYN";
37
- CurrencyCodeEnum$1["BZD"] = "BZD";
38
- CurrencyCodeEnum$1["CAD"] = "CAD";
39
- CurrencyCodeEnum$1["CDF"] = "CDF";
40
- CurrencyCodeEnum$1["CHE"] = "CHE";
41
- CurrencyCodeEnum$1["CHF"] = "CHF";
42
- CurrencyCodeEnum$1["CHW"] = "CHW";
43
- CurrencyCodeEnum$1["CLF"] = "CLF";
44
- CurrencyCodeEnum$1["CLP"] = "CLP";
45
- CurrencyCodeEnum$1["CNY"] = "CNY";
46
- CurrencyCodeEnum$1["COP"] = "COP";
47
- CurrencyCodeEnum$1["COU"] = "COU";
48
- CurrencyCodeEnum$1["CRC"] = "CRC";
49
- CurrencyCodeEnum$1["CUC"] = "CUC";
50
- CurrencyCodeEnum$1["CUP"] = "CUP";
51
- CurrencyCodeEnum$1["CVE"] = "CVE";
52
- CurrencyCodeEnum$1["CZK"] = "CZK";
53
- CurrencyCodeEnum$1["DJF"] = "DJF";
54
- CurrencyCodeEnum$1["DKK"] = "DKK";
55
- CurrencyCodeEnum$1["DOP"] = "DOP";
56
- CurrencyCodeEnum$1["DZD"] = "DZD";
57
- CurrencyCodeEnum$1["EGP"] = "EGP";
58
- CurrencyCodeEnum$1["ERN"] = "ERN";
59
- CurrencyCodeEnum$1["ETB"] = "ETB";
60
- CurrencyCodeEnum$1["EUR"] = "EUR";
61
- CurrencyCodeEnum$1["FJD"] = "FJD";
62
- CurrencyCodeEnum$1["FKP"] = "FKP";
63
- CurrencyCodeEnum$1["GBP"] = "GBP";
64
- CurrencyCodeEnum$1["GEL"] = "GEL";
65
- CurrencyCodeEnum$1["GHS"] = "GHS";
66
- CurrencyCodeEnum$1["GIP"] = "GIP";
67
- CurrencyCodeEnum$1["GMD"] = "GMD";
68
- CurrencyCodeEnum$1["GNF"] = "GNF";
69
- CurrencyCodeEnum$1["GTQ"] = "GTQ";
70
- CurrencyCodeEnum$1["GYD"] = "GYD";
71
- CurrencyCodeEnum$1["HKD"] = "HKD";
72
- CurrencyCodeEnum$1["HNL"] = "HNL";
73
- CurrencyCodeEnum$1["HRK"] = "HRK";
74
- CurrencyCodeEnum$1["HTG"] = "HTG";
75
- CurrencyCodeEnum$1["HUF"] = "HUF";
76
- CurrencyCodeEnum$1["IDR"] = "IDR";
77
- CurrencyCodeEnum$1["ILS"] = "ILS";
78
- CurrencyCodeEnum$1["INR"] = "INR";
79
- CurrencyCodeEnum$1["IQD"] = "IQD";
80
- CurrencyCodeEnum$1["IRR"] = "IRR";
81
- CurrencyCodeEnum$1["ISK"] = "ISK";
82
- CurrencyCodeEnum$1["JMD"] = "JMD";
83
- CurrencyCodeEnum$1["JOD"] = "JOD";
84
- CurrencyCodeEnum$1["JPY"] = "JPY";
85
- CurrencyCodeEnum$1["KES"] = "KES";
86
- CurrencyCodeEnum$1["KGS"] = "KGS";
87
- CurrencyCodeEnum$1["KHR"] = "KHR";
88
- CurrencyCodeEnum$1["KMF"] = "KMF";
89
- CurrencyCodeEnum$1["KPW"] = "KPW";
90
- CurrencyCodeEnum$1["KRW"] = "KRW";
91
- CurrencyCodeEnum$1["KWD"] = "KWD";
92
- CurrencyCodeEnum$1["KYD"] = "KYD";
93
- CurrencyCodeEnum$1["KZT"] = "KZT";
94
- CurrencyCodeEnum$1["LAK"] = "LAK";
95
- CurrencyCodeEnum$1["LBP"] = "LBP";
96
- CurrencyCodeEnum$1["LKR"] = "LKR";
97
- CurrencyCodeEnum$1["LRD"] = "LRD";
98
- CurrencyCodeEnum$1["LSL"] = "LSL";
99
- CurrencyCodeEnum$1["LYD"] = "LYD";
100
- CurrencyCodeEnum$1["MAD"] = "MAD";
101
- CurrencyCodeEnum$1["MDL"] = "MDL";
102
- CurrencyCodeEnum$1["MGA"] = "MGA";
103
- CurrencyCodeEnum$1["MKD"] = "MKD";
104
- CurrencyCodeEnum$1["MMK"] = "MMK";
105
- CurrencyCodeEnum$1["MNT"] = "MNT";
106
- CurrencyCodeEnum$1["MOP"] = "MOP";
107
- CurrencyCodeEnum$1["MRU"] = "MRU";
108
- CurrencyCodeEnum$1["MUR"] = "MUR";
109
- CurrencyCodeEnum$1["MVR"] = "MVR";
110
- CurrencyCodeEnum$1["MWK"] = "MWK";
111
- CurrencyCodeEnum$1["MXN"] = "MXN";
112
- CurrencyCodeEnum$1["MXV"] = "MXV";
113
- CurrencyCodeEnum$1["MYR"] = "MYR";
114
- CurrencyCodeEnum$1["MZN"] = "MZN";
115
- CurrencyCodeEnum$1["NAD"] = "NAD";
116
- CurrencyCodeEnum$1["NGN"] = "NGN";
117
- CurrencyCodeEnum$1["NIO"] = "NIO";
118
- CurrencyCodeEnum$1["NOK"] = "NOK";
119
- CurrencyCodeEnum$1["NPR"] = "NPR";
120
- CurrencyCodeEnum$1["NZD"] = "NZD";
121
- CurrencyCodeEnum$1["OMR"] = "OMR";
122
- CurrencyCodeEnum$1["PAB"] = "PAB";
123
- CurrencyCodeEnum$1["PEN"] = "PEN";
124
- CurrencyCodeEnum$1["PGK"] = "PGK";
125
- CurrencyCodeEnum$1["PHP"] = "PHP";
126
- CurrencyCodeEnum$1["PKR"] = "PKR";
127
- CurrencyCodeEnum$1["PLN"] = "PLN";
128
- CurrencyCodeEnum$1["PYG"] = "PYG";
129
- CurrencyCodeEnum$1["QAR"] = "QAR";
130
- CurrencyCodeEnum$1["RON"] = "RON";
131
- CurrencyCodeEnum$1["RSD"] = "RSD";
132
- CurrencyCodeEnum$1["RUB"] = "RUB";
133
- CurrencyCodeEnum$1["RWF"] = "RWF";
134
- CurrencyCodeEnum$1["SAR"] = "SAR";
135
- CurrencyCodeEnum$1["SBD"] = "SBD";
136
- CurrencyCodeEnum$1["SCR"] = "SCR";
137
- CurrencyCodeEnum$1["SDG"] = "SDG";
138
- CurrencyCodeEnum$1["SEK"] = "SEK";
139
- CurrencyCodeEnum$1["SGD"] = "SGD";
140
- CurrencyCodeEnum$1["SHP"] = "SHP";
141
- CurrencyCodeEnum$1["SLL"] = "SLL";
142
- CurrencyCodeEnum$1["SOS"] = "SOS";
143
- CurrencyCodeEnum$1["SRD"] = "SRD";
144
- CurrencyCodeEnum$1["SSP"] = "SSP";
145
- CurrencyCodeEnum$1["STN"] = "STN";
146
- CurrencyCodeEnum$1["SVC"] = "SVC";
147
- CurrencyCodeEnum$1["SYP"] = "SYP";
148
- CurrencyCodeEnum$1["SZL"] = "SZL";
149
- CurrencyCodeEnum$1["THB"] = "THB";
150
- CurrencyCodeEnum$1["TJS"] = "TJS";
151
- CurrencyCodeEnum$1["TMT"] = "TMT";
152
- CurrencyCodeEnum$1["TND"] = "TND";
153
- CurrencyCodeEnum$1["TOP"] = "TOP";
154
- CurrencyCodeEnum$1["TRY"] = "TRY";
155
- CurrencyCodeEnum$1["TTD"] = "TTD";
156
- CurrencyCodeEnum$1["TWD"] = "TWD";
157
- CurrencyCodeEnum$1["TZS"] = "TZS";
158
- CurrencyCodeEnum$1["UAH"] = "UAH";
159
- CurrencyCodeEnum$1["UGX"] = "UGX";
160
- CurrencyCodeEnum$1["USD"] = "USD";
161
- CurrencyCodeEnum$1["USN"] = "USN";
162
- CurrencyCodeEnum$1["UYI"] = "UYI";
163
- CurrencyCodeEnum$1["UYU"] = "UYU";
164
- CurrencyCodeEnum$1["UYW"] = "UYW";
165
- CurrencyCodeEnum$1["UZS"] = "UZS";
166
- CurrencyCodeEnum$1["VED"] = "VED";
167
- CurrencyCodeEnum$1["VES"] = "VES";
168
- CurrencyCodeEnum$1["VND"] = "VND";
169
- CurrencyCodeEnum$1["VUV"] = "VUV";
170
- CurrencyCodeEnum$1["WST"] = "WST";
171
- CurrencyCodeEnum$1["XAF"] = "XAF";
172
- CurrencyCodeEnum$1["XAG"] = "XAG";
173
- CurrencyCodeEnum$1["XAU"] = "XAU";
174
- CurrencyCodeEnum$1["XBA"] = "XBA";
175
- CurrencyCodeEnum$1["XBB"] = "XBB";
176
- CurrencyCodeEnum$1["XBC"] = "XBC";
177
- CurrencyCodeEnum$1["XBD"] = "XBD";
178
- CurrencyCodeEnum$1["XCD"] = "XCD";
179
- CurrencyCodeEnum$1["XDR"] = "XDR";
180
- CurrencyCodeEnum$1["XOF"] = "XOF";
181
- CurrencyCodeEnum$1["XPD"] = "XPD";
182
- CurrencyCodeEnum$1["XPF"] = "XPF";
183
- CurrencyCodeEnum$1["XPT"] = "XPT";
184
- CurrencyCodeEnum$1["XSU"] = "XSU";
185
- CurrencyCodeEnum$1["XUA"] = "XUA";
186
- CurrencyCodeEnum$1["XXX"] = "XXX";
187
- CurrencyCodeEnum$1["YER"] = "YER";
188
- CurrencyCodeEnum$1["ZAR"] = "ZAR";
189
- CurrencyCodeEnum$1["ZMW"] = "ZMW";
190
- CurrencyCodeEnum$1["ZWL"] = "ZWL";
191
- return CurrencyCodeEnum$1;
192
- }({});
193
-
194
- //#endregion
195
- exports.CurrencyCodeEnum = CurrencyCodeEnum;
196
- //# sourceMappingURL=index4.cjs.map
3
+ exports.getDocumentType = require_documentTypeManagement.getDocumentType;
4
+ exports.getDocumentTypeVersion = require_documentTypeManagement.getDocumentTypeVersion;
5
+ exports.getDocumentTypes = require_documentTypeManagement.getDocumentTypes;
package/dist/index40.cjs CHANGED
@@ -1,193 +1,100 @@
1
1
 
2
- //#region src/utils/validation.ts
3
- /**
4
- * Validates TIN format based on registration type
5
- */
6
- const validateTIN = (tin, registrationType) => {
7
- const errors = [];
8
- if (!tin) {
9
- errors.push({
10
- field: "tin",
11
- code: "TIN_REQUIRED",
12
- message: "TIN is required",
13
- severity: "error"
14
- });
15
- return errors;
16
- }
17
- if (registrationType === "BRN" && !tin.startsWith("C")) errors.push({
18
- field: "tin",
19
- code: "TIN_FORMAT_INVALID",
20
- message: "Company TIN should start with \"C\" for BRN registration",
21
- severity: "warning"
22
- });
23
- if (registrationType === "NRIC" && !tin.startsWith("IG")) errors.push({
24
- field: "tin",
25
- code: "TIN_FORMAT_INVALID",
26
- message: "Individual TIN should start with \"IG\" for NRIC registration",
27
- severity: "warning"
28
- });
29
- if (tin.length > 14) errors.push({
30
- field: "tin",
31
- code: "TIN_LENGTH_INVALID",
32
- message: "TIN cannot exceed 14 characters",
33
- severity: "error"
34
- });
35
- return errors;
36
- };
37
- /**
38
- * Validates contact number format (E.164 standard)
39
- */
40
- const validateContactNumber = (contactNumber) => {
41
- const errors = [];
42
- if (!contactNumber || contactNumber === "NA") return errors;
43
- const e164Regex = /^\+[1-9]\d{1,14}$/;
44
- if (!e164Regex.test(contactNumber)) errors.push({
45
- field: "contactNumber",
46
- code: "CONTACT_FORMAT_INVALID",
47
- message: "Contact number must be in E.164 format (e.g., +60123456789)",
48
- severity: "error"
49
- });
50
- if (contactNumber.length < 8) errors.push({
51
- field: "contactNumber",
52
- code: "CONTACT_LENGTH_INVALID",
53
- message: "Contact number must be at least 8 characters",
54
- severity: "error"
55
- });
56
- return errors;
57
- };
58
- /**
59
- * Validates monetary amounts
60
- */
61
- const validateMonetaryAmount = (amount, fieldName, maxDigits = 18, maxDecimals = 2) => {
62
- const errors = [];
63
- if (amount < 0) errors.push({
64
- field: fieldName,
65
- code: "AMOUNT_NEGATIVE",
66
- message: `${fieldName} cannot be negative`,
67
- severity: "error"
68
- });
69
- const amountStr = amount.toString();
70
- const [integerPart, decimalPart] = amountStr.split(".");
71
- if (integerPart && integerPart.length > maxDigits - maxDecimals) errors.push({
72
- field: fieldName,
73
- code: "AMOUNT_DIGITS_EXCEEDED",
74
- message: `${fieldName} exceeds maximum ${maxDigits} digits`,
75
- severity: "error"
76
- });
77
- if (decimalPart && decimalPart.length > maxDecimals) errors.push({
78
- field: fieldName,
79
- code: "AMOUNT_DECIMALS_EXCEEDED",
80
- message: `${fieldName} exceeds maximum ${maxDecimals} decimal places`,
81
- severity: "error"
82
- });
83
- return errors;
84
- };
85
- /**
86
- * Validates line item tax calculation consistency for both fixed rate and percentage taxation
87
- */
88
- const validateLineItemTax = (item, index) => {
89
- const errors = [];
90
- const tolerance = .01;
91
- const hasFixedRate = item.taxPerUnitAmount !== void 0 && item.baseUnitMeasure !== void 0;
92
- const hasPercentageRate = item.taxRate !== void 0;
93
- if (!hasFixedRate && !hasPercentageRate) {
94
- errors.push({
95
- field: `lineItem[${index}]`,
96
- code: "TAX_METHOD_MISSING",
97
- message: `Line item ${index + 1} must specify either taxRate (for percentage) or taxPerUnitAmount + baseUnitMeasure (for fixed rate)`,
98
- severity: "error"
99
- });
100
- return errors;
101
- }
102
- if (hasFixedRate && hasPercentageRate) errors.push({
103
- field: `lineItem[${index}]`,
104
- code: "TAX_METHOD_CONFLICT",
105
- message: `Line item ${index + 1} cannot have both percentage and fixed rate tax methods`,
106
- severity: "error"
107
- });
108
- if (hasFixedRate) {
109
- if (item.baseUnitMeasureCode === void 0) errors.push({
110
- field: `lineItem[${index}].baseUnitMeasureCode`,
111
- code: "UNIT_CODE_MISSING",
112
- message: `Line item ${index + 1} with fixed rate tax must specify baseUnitMeasureCode`,
113
- severity: "error"
114
- });
115
- const expectedTaxAmount = item.taxPerUnitAmount * item.baseUnitMeasure;
116
- if (Math.abs(item.taxAmount - expectedTaxAmount) > tolerance) errors.push({
117
- field: `lineItem[${index}].taxAmount`,
118
- code: "FIXED_TAX_CALCULATION_MISMATCH",
119
- message: `Line item ${index + 1} tax amount (${item.taxAmount}) doesn't match fixed rate calculation (${item.taxPerUnitAmount} × ${item.baseUnitMeasure} = ${expectedTaxAmount})`,
120
- severity: "error"
121
- });
122
- }
123
- if (hasPercentageRate && !hasFixedRate) {
124
- const expectedTaxAmount = item.totalTaxableAmountPerLine * item.taxRate / 100;
125
- if (Math.abs(item.taxAmount - expectedTaxAmount) > tolerance) errors.push({
126
- field: `lineItem[${index}].taxAmount`,
127
- code: "PERCENTAGE_TAX_CALCULATION_MISMATCH",
128
- message: `Line item ${index + 1} tax amount (${item.taxAmount}) doesn't match percentage calculation (${item.totalTaxableAmountPerLine} × ${item.taxRate}% = ${expectedTaxAmount})`,
129
- severity: "error"
130
- });
131
- }
132
- return errors;
133
- };
134
- /**
135
- * Validates tax calculation consistency
136
- */
137
- const validateTaxCalculations = (invoice) => {
138
- const errors = [];
139
- invoice.invoiceLineItems.forEach((item, index) => {
140
- errors.push(...validateLineItemTax(item, index));
141
- });
142
- const expectedTaxExclusive = invoice.invoiceLineItems.reduce((sum, item) => sum + item.totalTaxableAmountPerLine, 0);
143
- const expectedTaxAmount = invoice.invoiceLineItems.reduce((sum, item) => sum + item.taxAmount, 0);
144
- const tolerance = .01;
145
- if (Math.abs(invoice.legalMonetaryTotal.taxExclusiveAmount - expectedTaxExclusive) > tolerance) errors.push({
146
- field: "legalMonetaryTotal.taxExclusiveAmount",
147
- code: "TAX_EXCLUSIVE_MISMATCH",
148
- message: `Tax exclusive amount (${invoice.legalMonetaryTotal.taxExclusiveAmount}) doesn't match sum of line items (${expectedTaxExclusive})`,
149
- severity: "error"
150
- });
151
- if (Math.abs(invoice.taxTotal.taxAmount - expectedTaxAmount) > tolerance) errors.push({
152
- field: "taxTotal.taxAmount",
153
- code: "TAX_AMOUNT_MISMATCH",
154
- message: `Tax amount (${invoice.taxTotal.taxAmount}) doesn't match sum of line item taxes (${expectedTaxAmount})`,
155
- severity: "error"
156
- });
157
- return errors;
158
- };
159
- /**
160
- * Main validation function for complete invoice
161
- */
162
- const validateInvoice = (invoice) => {
163
- const allErrors = [];
164
- allErrors.push(...validateTIN(invoice.supplier.tin, invoice.supplier.registrationType));
165
- allErrors.push(...validateTIN(invoice.buyer.tin, invoice.buyer.registrationType));
166
- allErrors.push(...validateContactNumber(invoice.supplier.contactNumber));
167
- allErrors.push(...validateContactNumber(invoice.buyer.contactNumber));
168
- allErrors.push(...validateMonetaryAmount(invoice.legalMonetaryTotal.taxExclusiveAmount, "taxExclusiveAmount"));
169
- allErrors.push(...validateMonetaryAmount(invoice.legalMonetaryTotal.payableAmount, "payableAmount"));
170
- allErrors.push(...validateMonetaryAmount(invoice.taxTotal.taxAmount, "taxAmount"));
171
- invoice.invoiceLineItems.forEach((item, index) => {
172
- allErrors.push(...validateMonetaryAmount(item.unitPrice, `lineItem[${index}].unitPrice`));
173
- allErrors.push(...validateMonetaryAmount(item.taxAmount, `lineItem[${index}].taxAmount`));
174
- allErrors.push(...validateMonetaryAmount(item.totalTaxableAmountPerLine, `lineItem[${index}].totalTaxableAmountPerLine`));
175
- });
176
- allErrors.push(...validateTaxCalculations(invoice));
177
- const errors = allErrors.filter((e) => e.severity === "error");
178
- const warnings = allErrors.filter((e) => e.severity === "warning");
179
- return {
180
- isValid: errors.length === 0,
181
- errors,
182
- warnings
183
- };
184
- };
2
+ //#region src/types/msic/9X.d.ts
3
+ let MSIC_9X = /* @__PURE__ */ function(MSIC_9X$1) {
4
+ MSIC_9X$1["THEATRICAL_PRODUCTION"] = "90001";
5
+ MSIC_9X$1["CONCERT_HALLS"] = "90002";
6
+ MSIC_9X$1["VISUAL_ARTISTS"] = "90003";
7
+ MSIC_9X$1["WRITERS"] = "90004";
8
+ MSIC_9X$1["JOURNALISTS"] = "90005";
9
+ MSIC_9X$1["ART_RESTORATION"] = "90006";
10
+ MSIC_9X$1["ARTS_EVENT_PRODUCTION"] = "90007";
11
+ MSIC_9X$1["OTHER_CREATIVE_ARTS"] = "90009";
12
+ MSIC_9X$1["LIBRARIES"] = "91011";
13
+ MSIC_9X$1["PHOTO_LIBRARIES"] = "91012";
14
+ MSIC_9X$1["MUSEUMS"] = "91021";
15
+ MSIC_9X$1["HISTORICAL_SITES"] = "91022";
16
+ MSIC_9X$1["BOTANICAL_ZOOLOGICAL"] = "91031";
17
+ MSIC_9X$1["NATURE_RESERVES"] = "91032";
18
+ MSIC_9X$1["GAMBLING"] = "92000";
19
+ MSIC_9X$1["SPORTS_FACILITIES"] = "93111";
20
+ MSIC_9X$1["AUTO_RACING"] = "93112";
21
+ MSIC_9X$1["EQUESTRIAN"] = "93113";
22
+ MSIC_9X$1["SWIMMING_FACILITIES"] = "93114";
23
+ MSIC_9X$1["ATHLETICS_FACILITIES"] = "93115";
24
+ MSIC_9X$1["GOLF_COURSES"] = "93116";
25
+ MSIC_9X$1["BOWLING_CENTRES"] = "93117";
26
+ MSIC_9X$1["FITNESS_CENTRES"] = "93118";
27
+ MSIC_9X$1["SPORTS_EVENTS"] = "93119";
28
+ MSIC_9X$1["SPORTS_CLUBS"] = "93120";
29
+ MSIC_9X$1["SPORTS_PROMOTERS"] = "93191";
30
+ MSIC_9X$1["SPORTS_REGULATORS"] = "93192";
31
+ MSIC_9X$1["SPORTS_PROMOTION"] = "93193";
32
+ MSIC_9X$1["OTHER_SPORTS"] = "93199";
33
+ MSIC_9X$1["AMUSEMENT_PARKS"] = "93210";
34
+ MSIC_9X$1["RECREATION_PARKS"] = "93291";
35
+ MSIC_9X$1["RECREATIONAL_TRANSPORT"] = "93292";
36
+ MSIC_9X$1["LEISURE_EQUIPMENT_RENTAL"] = "93293";
37
+ MSIC_9X$1["RECREATIONAL_FAIRS"] = "93294";
38
+ MSIC_9X$1["DISCOTHEQUES"] = "93295";
39
+ MSIC_9X$1["EVENT_PRODUCTION"] = "93296";
40
+ MSIC_9X$1["CYBER_CAFE"] = "93297";
41
+ MSIC_9X$1["OTHER_RECREATION"] = "93299";
42
+ MSIC_9X$1["BUSINESS_ORGANIZATIONS"] = "94110";
43
+ MSIC_9X$1["PROFESSIONAL_ORGANIZATIONS"] = "94120";
44
+ MSIC_9X$1["TRADE_UNIONS"] = "94200";
45
+ MSIC_9X$1["RELIGIOUS_ORGANIZATIONS"] = "94910";
46
+ MSIC_9X$1["POLITICAL_ORGANIZATIONS"] = "94920";
47
+ MSIC_9X$1["OTHER_ORGANIZATIONS"] = "94990";
48
+ MSIC_9X$1["ELECTRONIC_REPAIR"] = "95111";
49
+ MSIC_9X$1["COMPUTER_REPAIR"] = "95112";
50
+ MSIC_9X$1["PDA_REPAIR"] = "95113";
51
+ MSIC_9X$1["CORDLESS_PHONE_REPAIR"] = "95121";
52
+ MSIC_9X$1["MOBILE_PHONE_REPAIR"] = "95122";
53
+ MSIC_9X$1["MODEM_REPAIR"] = "95123";
54
+ MSIC_9X$1["FAX_REPAIR"] = "95124";
55
+ MSIC_9X$1["COMMUNICATIONS_REPAIR"] = "95125";
56
+ MSIC_9X$1["RADIO_REPAIR"] = "95126";
57
+ MSIC_9X$1["CAMERA_REPAIR"] = "95127";
58
+ MSIC_9X$1["TV_REPAIR"] = "95211";
59
+ MSIC_9X$1["VIDEO_PLAYER_REPAIR"] = "95212";
60
+ MSIC_9X$1["CD_PLAYER_REPAIR"] = "95213";
61
+ MSIC_9X$1["VIDEO_CAMERA_REPAIR"] = "95214";
62
+ MSIC_9X$1["APPLIANCE_REPAIR"] = "95221";
63
+ MSIC_9X$1["GARDEN_EQUIPMENT_REPAIR"] = "95222";
64
+ MSIC_9X$1["FOOTWEAR_REPAIR"] = "95230";
65
+ MSIC_9X$1["FURNITURE_REPAIR"] = "95240";
66
+ MSIC_9X$1["BICYCLE_REPAIR"] = "95291";
67
+ MSIC_9X$1["CLOTHING_REPAIR"] = "95292";
68
+ MSIC_9X$1["JEWELRY_REPAIR"] = "95293";
69
+ MSIC_9X$1["WATCH_REPAIR"] = "95294";
70
+ MSIC_9X$1["SPORTS_EQUIPMENT_REPAIR"] = "95295";
71
+ MSIC_9X$1["MUSICAL_INSTRUMENT_REPAIR"] = "95296";
72
+ MSIC_9X$1["OTHER_REPAIRS"] = "95299";
73
+ MSIC_9X$1["LAUNDRY"] = "96011";
74
+ MSIC_9X$1["CARPET_CLEANING"] = "96012";
75
+ MSIC_9X$1["UNIFORM_RENTAL"] = "96013";
76
+ MSIC_9X$1["DIAPER_SERVICE"] = "96014";
77
+ MSIC_9X$1["BEAUTY_SERVICES"] = "96020";
78
+ MSIC_9X$1["MORTUARY_SERVICES"] = "96031";
79
+ MSIC_9X$1["FUNERAL_SERVICES"] = "96032";
80
+ MSIC_9X$1["FUNERAL_PARLOUR_RENTAL"] = "96033";
81
+ MSIC_9X$1["GRAVE_SALES"] = "96034";
82
+ MSIC_9X$1["GRAVE_MAINTENANCE"] = "96035";
83
+ MSIC_9X$1["WELLNESS_SERVICES"] = "96091";
84
+ MSIC_9X$1["ASTROLOGY_SERVICES"] = "96092";
85
+ MSIC_9X$1["DATING_SERVICES"] = "96093";
86
+ MSIC_9X$1["PET_CARE"] = "96094";
87
+ MSIC_9X$1["GENEALOGY"] = "96095";
88
+ MSIC_9X$1["PERSONAL_SERVICES"] = "96096";
89
+ MSIC_9X$1["VENDING_MACHINES"] = "96097";
90
+ MSIC_9X$1["OTHER_SERVICES"] = "96099";
91
+ MSIC_9X$1["DOMESTIC_PERSONNEL"] = "97000";
92
+ MSIC_9X$1["HOUSEHOLD_GOODS_PRODUCTION"] = "98100";
93
+ MSIC_9X$1["HOUSEHOLD_SERVICES"] = "98200";
94
+ MSIC_9X$1["EXTRATERRITORIAL_ORGANIZATIONS"] = "99000";
95
+ return MSIC_9X$1;
96
+ }({});
185
97
 
186
98
  //#endregion
187
- exports.validateContactNumber = validateContactNumber;
188
- exports.validateInvoice = validateInvoice;
189
- exports.validateLineItemTax = validateLineItemTax;
190
- exports.validateMonetaryAmount = validateMonetaryAmount;
191
- exports.validateTIN = validateTIN;
192
- exports.validateTaxCalculations = validateTaxCalculations;
99
+ exports.MSIC_9X = MSIC_9X;
193
100
  //# sourceMappingURL=index40.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index40.cjs","names":["tin: string","registrationType?: string","errors: ValidationError[]","contactNumber: string","amount: number","fieldName: string","item: InvoiceLineItem","index: number","invoice: InvoiceV1_1","allErrors: ValidationError[]"],"sources":["../src/utils/validation.ts"],"sourcesContent":["import type { InvoiceV1_1, InvoiceLineItem } from '../types'\n\n/**\n * MyInvois Invoice Validation Utilities\n *\n * Provides comprehensive validation for invoice data before document generation\n * and submission to ensure compliance with MyInvois business rules and format requirements.\n */\n\nexport interface ValidationResult {\n isValid: boolean\n errors: ValidationError[]\n warnings: ValidationWarning[]\n}\n\nexport interface ValidationError {\n field: string\n code: string\n message: string\n severity: 'error' | 'warning'\n}\n\nexport interface ValidationWarning extends ValidationError {\n severity: 'warning'\n}\n\n/**\n * Validates TIN format based on registration type\n */\nexport const validateTIN = (\n tin: string,\n registrationType?: string,\n): ValidationError[] => {\n const errors: ValidationError[] = []\n\n if (!tin) {\n errors.push({\n field: 'tin',\n code: 'TIN_REQUIRED',\n message: 'TIN is required',\n severity: 'error',\n })\n return errors\n }\n\n // TIN format validation based on type\n if (registrationType === 'BRN' && !tin.startsWith('C')) {\n errors.push({\n field: 'tin',\n code: 'TIN_FORMAT_INVALID',\n message: 'Company TIN should start with \"C\" for BRN registration',\n severity: 'warning',\n })\n }\n\n if (registrationType === 'NRIC' && !tin.startsWith('IG')) {\n errors.push({\n field: 'tin',\n code: 'TIN_FORMAT_INVALID',\n message: 'Individual TIN should start with \"IG\" for NRIC registration',\n severity: 'warning',\n })\n }\n\n // Length validation\n if (tin.length > 14) {\n errors.push({\n field: 'tin',\n code: 'TIN_LENGTH_INVALID',\n message: 'TIN cannot exceed 14 characters',\n severity: 'error',\n })\n }\n\n return errors\n}\n\n/**\n * Validates contact number format (E.164 standard)\n */\nexport const validateContactNumber = (\n contactNumber: string,\n): ValidationError[] => {\n const errors: ValidationError[] = []\n\n if (!contactNumber || contactNumber === 'NA') {\n return errors // Allow NA for consolidated e-invoices\n }\n\n // E.164 format validation\n const e164Regex = /^\\+[1-9]\\d{1,14}$/\n if (!e164Regex.test(contactNumber)) {\n errors.push({\n field: 'contactNumber',\n code: 'CONTACT_FORMAT_INVALID',\n message: 'Contact number must be in E.164 format (e.g., +60123456789)',\n severity: 'error',\n })\n }\n\n if (contactNumber.length < 8) {\n errors.push({\n field: 'contactNumber',\n code: 'CONTACT_LENGTH_INVALID',\n message: 'Contact number must be at least 8 characters',\n severity: 'error',\n })\n }\n\n return errors\n}\n\n/**\n * Validates monetary amounts\n */\nexport const validateMonetaryAmount = (\n amount: number,\n fieldName: string,\n maxDigits = 18,\n maxDecimals = 2,\n): ValidationError[] => {\n const errors: ValidationError[] = []\n\n if (amount < 0) {\n errors.push({\n field: fieldName,\n code: 'AMOUNT_NEGATIVE',\n message: `${fieldName} cannot be negative`,\n severity: 'error',\n })\n }\n\n // Check total digits\n const amountStr = amount.toString()\n const [integerPart, decimalPart] = amountStr.split('.')\n\n if (integerPart && integerPart.length > maxDigits - maxDecimals) {\n errors.push({\n field: fieldName,\n code: 'AMOUNT_DIGITS_EXCEEDED',\n message: `${fieldName} exceeds maximum ${maxDigits} digits`,\n severity: 'error',\n })\n }\n\n if (decimalPart && decimalPart.length > maxDecimals) {\n errors.push({\n field: fieldName,\n code: 'AMOUNT_DECIMALS_EXCEEDED',\n message: `${fieldName} exceeds maximum ${maxDecimals} decimal places`,\n severity: 'error',\n })\n }\n\n return errors\n}\n\n/**\n * Validates line item tax calculation consistency for both fixed rate and percentage taxation\n */\nexport const validateLineItemTax = (\n item: InvoiceLineItem,\n index: number,\n): ValidationError[] => {\n const errors: ValidationError[] = []\n const tolerance = 0.01\n\n // Check if tax calculation method is specified\n const hasFixedRate =\n item.taxPerUnitAmount !== undefined && item.baseUnitMeasure !== undefined\n const hasPercentageRate = item.taxRate !== undefined\n\n if (!hasFixedRate && !hasPercentageRate) {\n errors.push({\n field: `lineItem[${index}]`,\n code: 'TAX_METHOD_MISSING',\n message: `Line item ${index + 1} must specify either taxRate (for percentage) or taxPerUnitAmount + baseUnitMeasure (for fixed rate)`,\n severity: 'error',\n })\n return errors\n }\n\n if (hasFixedRate && hasPercentageRate) {\n errors.push({\n field: `lineItem[${index}]`,\n code: 'TAX_METHOD_CONFLICT',\n message: `Line item ${index + 1} cannot have both percentage and fixed rate tax methods`,\n severity: 'error',\n })\n }\n\n // Validate fixed rate tax calculation\n if (hasFixedRate) {\n if (item.baseUnitMeasureCode === undefined) {\n errors.push({\n field: `lineItem[${index}].baseUnitMeasureCode`,\n code: 'UNIT_CODE_MISSING',\n message: `Line item ${index + 1} with fixed rate tax must specify baseUnitMeasureCode`,\n severity: 'error',\n })\n }\n\n const expectedTaxAmount = item.taxPerUnitAmount! * item.baseUnitMeasure!\n if (Math.abs(item.taxAmount - expectedTaxAmount) > tolerance) {\n errors.push({\n field: `lineItem[${index}].taxAmount`,\n code: 'FIXED_TAX_CALCULATION_MISMATCH',\n message: `Line item ${index + 1} tax amount (${item.taxAmount}) doesn't match fixed rate calculation (${item.taxPerUnitAmount} × ${item.baseUnitMeasure} = ${expectedTaxAmount})`,\n severity: 'error',\n })\n }\n }\n\n // Validate percentage tax calculation\n if (hasPercentageRate && !hasFixedRate) {\n const expectedTaxAmount =\n (item.totalTaxableAmountPerLine * item.taxRate!) / 100\n if (Math.abs(item.taxAmount - expectedTaxAmount) > tolerance) {\n errors.push({\n field: `lineItem[${index}].taxAmount`,\n code: 'PERCENTAGE_TAX_CALCULATION_MISMATCH',\n message: `Line item ${index + 1} tax amount (${item.taxAmount}) doesn't match percentage calculation (${item.totalTaxableAmountPerLine} × ${item.taxRate}% = ${expectedTaxAmount})`,\n severity: 'error',\n })\n }\n }\n\n return errors\n}\n\n/**\n * Validates tax calculation consistency\n */\nexport const validateTaxCalculations = (\n invoice: InvoiceV1_1,\n): ValidationError[] => {\n const errors: ValidationError[] = []\n\n // Validate individual line item tax calculations\n invoice.invoiceLineItems.forEach((item, index) => {\n errors.push(...validateLineItemTax(item, index))\n })\n\n // Calculate expected totals from line items\n const expectedTaxExclusive = invoice.invoiceLineItems.reduce(\n (sum, item) => sum + item.totalTaxableAmountPerLine,\n 0,\n )\n const expectedTaxAmount = invoice.invoiceLineItems.reduce(\n (sum, item) => sum + item.taxAmount,\n 0,\n )\n\n // Allow small rounding differences (0.01)\n const tolerance = 0.01\n\n if (\n Math.abs(\n invoice.legalMonetaryTotal.taxExclusiveAmount - expectedTaxExclusive,\n ) > tolerance\n ) {\n errors.push({\n field: 'legalMonetaryTotal.taxExclusiveAmount',\n code: 'TAX_EXCLUSIVE_MISMATCH',\n message: `Tax exclusive amount (${invoice.legalMonetaryTotal.taxExclusiveAmount}) doesn't match sum of line items (${expectedTaxExclusive})`,\n severity: 'error',\n })\n }\n\n if (Math.abs(invoice.taxTotal.taxAmount - expectedTaxAmount) > tolerance) {\n errors.push({\n field: 'taxTotal.taxAmount',\n code: 'TAX_AMOUNT_MISMATCH',\n message: `Tax amount (${invoice.taxTotal.taxAmount}) doesn't match sum of line item taxes (${expectedTaxAmount})`,\n severity: 'error',\n })\n }\n\n return errors\n}\n\n/**\n * Main validation function for complete invoice\n */\nexport const validateInvoice = (invoice: InvoiceV1_1): ValidationResult => {\n const allErrors: ValidationError[] = []\n\n // Core field validations\n allErrors.push(\n ...validateTIN(invoice.supplier.tin, invoice.supplier.registrationType),\n )\n allErrors.push(\n ...validateTIN(invoice.buyer.tin, invoice.buyer.registrationType),\n )\n\n allErrors.push(...validateContactNumber(invoice.supplier.contactNumber))\n allErrors.push(...validateContactNumber(invoice.buyer.contactNumber))\n\n // Monetary validations\n allErrors.push(\n ...validateMonetaryAmount(\n invoice.legalMonetaryTotal.taxExclusiveAmount,\n 'taxExclusiveAmount',\n ),\n )\n allErrors.push(\n ...validateMonetaryAmount(\n invoice.legalMonetaryTotal.payableAmount,\n 'payableAmount',\n ),\n )\n allErrors.push(\n ...validateMonetaryAmount(invoice.taxTotal.taxAmount, 'taxAmount'),\n )\n\n // Line item validations\n invoice.invoiceLineItems.forEach((item, index) => {\n allErrors.push(\n ...validateMonetaryAmount(item.unitPrice, `lineItem[${index}].unitPrice`),\n )\n allErrors.push(\n ...validateMonetaryAmount(item.taxAmount, `lineItem[${index}].taxAmount`),\n )\n allErrors.push(\n ...validateMonetaryAmount(\n item.totalTaxableAmountPerLine,\n `lineItem[${index}].totalTaxableAmountPerLine`,\n ),\n )\n })\n\n // Business rule validations\n allErrors.push(...validateTaxCalculations(invoice))\n\n // Separate errors and warnings\n const errors = allErrors.filter(e => e.severity === 'error')\n const warnings = allErrors.filter(\n e => e.severity === 'warning',\n ) as ValidationWarning[]\n\n return {\n isValid: errors.length === 0,\n errors,\n warnings,\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"index40.cjs","names":[],"sources":["../src/types/msic/9X.d.ts"],"sourcesContent":["export type MSIC_9X_CODE =\n | '90001'\n | '90002'\n | '90003'\n | '90004'\n | '90005'\n | '90006'\n | '90007'\n | '90009'\n | '91011'\n | '91012'\n | '91021'\n | '91022'\n | '91031'\n | '91032'\n | '92000'\n | '93111'\n | '93112'\n | '93113'\n | '93114'\n | '93115'\n | '93116'\n | '93117'\n | '93118'\n | '93119'\n | '93120'\n | '93191'\n | '93192'\n | '93193'\n | '93199'\n | '93210'\n | '93291'\n | '93292'\n | '93293'\n | '93294'\n | '93295'\n | '93296'\n | '93297'\n | '93299'\n | '94110'\n | '94120'\n | '94200'\n | '94910'\n | '94920'\n | '94990'\n | '95111'\n | '95112'\n | '95113'\n | '95121'\n | '95122'\n | '95123'\n | '95124'\n | '95125'\n | '95126'\n | '95127'\n | '95211'\n | '95212'\n | '95213'\n | '95214'\n | '95221'\n | '95222'\n | '95230'\n | '95240'\n | '95291'\n | '95292'\n | '95293'\n | '95294'\n | '95295'\n | '95296'\n | '95299'\n | '96011'\n | '96012'\n | '96013'\n | '96014'\n | '96020'\n | '96031'\n | '96032'\n | '96033'\n | '96034'\n | '96035'\n | '96091'\n | '96092'\n | '96093'\n | '96094'\n | '96095'\n | '96096'\n | '96097'\n | '96099'\n | '97000'\n | '98100'\n | '98200'\n | '99000'\n\nexport enum MSIC_9X {\n THEATRICAL_PRODUCTION = '90001',\n CONCERT_HALLS = '90002',\n VISUAL_ARTISTS = '90003',\n WRITERS = '90004',\n JOURNALISTS = '90005',\n ART_RESTORATION = '90006',\n ARTS_EVENT_PRODUCTION = '90007',\n OTHER_CREATIVE_ARTS = '90009',\n LIBRARIES = '91011',\n PHOTO_LIBRARIES = '91012',\n MUSEUMS = '91021',\n HISTORICAL_SITES = '91022',\n BOTANICAL_ZOOLOGICAL = '91031',\n NATURE_RESERVES = '91032',\n GAMBLING = '92000',\n SPORTS_FACILITIES = '93111',\n AUTO_RACING = '93112',\n EQUESTRIAN = '93113',\n SWIMMING_FACILITIES = '93114',\n ATHLETICS_FACILITIES = '93115',\n GOLF_COURSES = '93116',\n BOWLING_CENTRES = '93117',\n FITNESS_CENTRES = '93118',\n SPORTS_EVENTS = '93119',\n SPORTS_CLUBS = '93120',\n SPORTS_PROMOTERS = '93191',\n SPORTS_REGULATORS = '93192',\n SPORTS_PROMOTION = '93193',\n OTHER_SPORTS = '93199',\n AMUSEMENT_PARKS = '93210',\n RECREATION_PARKS = '93291',\n RECREATIONAL_TRANSPORT = '93292',\n LEISURE_EQUIPMENT_RENTAL = '93293',\n RECREATIONAL_FAIRS = '93294',\n DISCOTHEQUES = '93295',\n EVENT_PRODUCTION = '93296',\n CYBER_CAFE = '93297',\n OTHER_RECREATION = '93299',\n BUSINESS_ORGANIZATIONS = '94110',\n PROFESSIONAL_ORGANIZATIONS = '94120',\n TRADE_UNIONS = '94200',\n RELIGIOUS_ORGANIZATIONS = '94910',\n POLITICAL_ORGANIZATIONS = '94920',\n OTHER_ORGANIZATIONS = '94990',\n ELECTRONIC_REPAIR = '95111',\n COMPUTER_REPAIR = '95112',\n PDA_REPAIR = '95113',\n CORDLESS_PHONE_REPAIR = '95121',\n MOBILE_PHONE_REPAIR = '95122',\n MODEM_REPAIR = '95123',\n FAX_REPAIR = '95124',\n COMMUNICATIONS_REPAIR = '95125',\n RADIO_REPAIR = '95126',\n CAMERA_REPAIR = '95127',\n TV_REPAIR = '95211',\n VIDEO_PLAYER_REPAIR = '95212',\n CD_PLAYER_REPAIR = '95213',\n VIDEO_CAMERA_REPAIR = '95214',\n APPLIANCE_REPAIR = '95221',\n GARDEN_EQUIPMENT_REPAIR = '95222',\n FOOTWEAR_REPAIR = '95230',\n FURNITURE_REPAIR = '95240',\n BICYCLE_REPAIR = '95291',\n CLOTHING_REPAIR = '95292',\n JEWELRY_REPAIR = '95293',\n WATCH_REPAIR = '95294',\n SPORTS_EQUIPMENT_REPAIR = '95295',\n MUSICAL_INSTRUMENT_REPAIR = '95296',\n OTHER_REPAIRS = '95299',\n LAUNDRY = '96011',\n CARPET_CLEANING = '96012',\n UNIFORM_RENTAL = '96013',\n DIAPER_SERVICE = '96014',\n BEAUTY_SERVICES = '96020',\n MORTUARY_SERVICES = '96031',\n FUNERAL_SERVICES = '96032',\n FUNERAL_PARLOUR_RENTAL = '96033',\n GRAVE_SALES = '96034',\n GRAVE_MAINTENANCE = '96035',\n WELLNESS_SERVICES = '96091',\n ASTROLOGY_SERVICES = '96092',\n DATING_SERVICES = '96093',\n PET_CARE = '96094',\n GENEALOGY = '96095',\n PERSONAL_SERVICES = '96096',\n VENDING_MACHINES = '96097',\n OTHER_SERVICES = '96099',\n DOMESTIC_PERSONNEL = '97000',\n HOUSEHOLD_GOODS_PRODUCTION = '98100',\n HOUSEHOLD_SERVICES = '98200',\n EXTRATERRITORIAL_ORGANIZATIONS = '99000',\n}\n"],"mappings":";;AA6FA,IAAY,8CAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
package/dist/index5.cjs CHANGED
@@ -0,0 +1,3 @@
1
+ const require_notificationManagement = require('./notificationManagement-DLBDn77E.cjs');
2
+
3
+ exports.getNotifications = require_notificationManagement.getNotifications;
package/dist/index6.cjs CHANGED
@@ -1,25 +1,3 @@
1
+ const require_platformLogin = require('./platformLogin-Ch6hFKoU.cjs');
1
2
 
2
- //#region src/types/e-invoice.d.ts
3
- /**
4
- * Enum representing the allowed codes for e-Invoice types with descriptive names.
5
- * Provides a more readable way to reference e-Invoice types compared to using raw codes.
6
- *
7
- * @example
8
- * const invoiceCode = EInvoiceTypeCodeEnum.Invoice;
9
- * console.log(invoiceCode); // Output: "01"
10
- */
11
- let EInvoiceTypeCodeEnum = /* @__PURE__ */ function(EInvoiceTypeCodeEnum$1) {
12
- EInvoiceTypeCodeEnum$1["Invoice"] = "01";
13
- EInvoiceTypeCodeEnum$1["CreditNote"] = "02";
14
- EInvoiceTypeCodeEnum$1["DebitNote"] = "03";
15
- EInvoiceTypeCodeEnum$1["RefundNote"] = "04";
16
- EInvoiceTypeCodeEnum$1["SelfBilledInvoice"] = "11";
17
- EInvoiceTypeCodeEnum$1["SelfBilledCreditNote"] = "12";
18
- EInvoiceTypeCodeEnum$1["SelfBilledDebitNote"] = "13";
19
- EInvoiceTypeCodeEnum$1["SelfBilledRefundNote"] = "14";
20
- return EInvoiceTypeCodeEnum$1;
21
- }({});
22
-
23
- //#endregion
24
- exports.EInvoiceTypeCodeEnum = EInvoiceTypeCodeEnum;
25
- //# sourceMappingURL=index6.cjs.map
3
+ exports.platformLogin = require_platformLogin.platformLogin;
package/dist/index7.cjs CHANGED
@@ -0,0 +1,6 @@
1
+ require('./formatIdValue-i67o4kyD.cjs');
2
+ const require_taxpayerValidation = require('./taxpayerValidation-D_jGaVty.cjs');
3
+
4
+ exports.taxpayerQRCode = require_taxpayerValidation.taxpayerQRCode;
5
+ exports.tinSearch = require_taxpayerValidation.tinSearch;
6
+ exports.verifyTin = require_taxpayerValidation.verifyTin;
@@ -1 +1 @@
1
- {"version":3,"file":"index71.cts","names":[],"sources":["../src/utils/document.d.ts"],"sourcesContent":["import { InvoiceSubmission, AllDocumentsV1_1, SigningCredentials, SignedPropertiesObject, UBLDocument, CompleteInvoice, SignedInfoObject, UnitTypeCode, InvoiceLineItem } from '../types';\nimport type { ClassificationCode } from '../types';\nimport type { TaxTypeCode } from '../types';\n/**\n * MyInvois v1.1 Document Generation and Signing Utilities\n * Strictly follows: https://sdk.myinvois.hasil.gov.my/documents/invoice-v1-1\n * JSON Signature Guide: https://sdk.myinvois.hasil.gov.my/signature-creation-json/\n */\n/**\n * Determines if a line item uses fixed rate taxation\n */\nexport declare const isFixedRateTax: (item: InvoiceLineItem) => boolean;\n/**\n * Determines if a line item uses percentage taxation\n */\nexport declare const isPercentageTax: (item: InvoiceLineItem) => boolean;\n/**\n * Calculates expected tax amount for a line item based on its tax type\n */\nexport declare const calculateExpectedTaxAmount: (item: InvoiceLineItem) => number;\n/**\n * Helper function to recursively sort object keys for JSON canonicalization\n */\nexport declare function sortObjectKeys(obj: unknown): unknown;\n/**\n * Enhanced canonicalization following MyInvois specification exactly\n * Key changes: ensure consistent ordering and formatting\n */\nexport declare const canonicalizeJSON: (obj: unknown) => string;\n/**\n * Generates a clean invoice object following MyInvois v1.1 specification exactly\n * This is the base invoice structure WITHOUT signature elements (for hash calculation)\n *\n * Key requirements from working documents:\n * - All mandatory fields must be present\n * - Many optional fields must be present even if empty\n * - Specific field ordering and structure\n * - Correct listID values (e.g., \"3166-1\" not \"ISO3166-1\")\n */\nexport declare const generateCleanInvoiceObject: (invoice: AllDocumentsV1_1) => InvoiceSubmission;\n/**\n * Generates the complete UBL document structure with namespace declarations\n */\nexport declare const generateCleanUBLDocument: (invoices: AllDocumentsV1_1[]) => UBLDocument;\n/**\n * Step 1: Transform the document for hashing or transmission\n * Removes UBLExtensions and Signature, and minifies the JSON\n * Returns the minified, cleaned JSON string\n *\n * FIXED: Use regex-based minification to match PowerShell script exactly\n */\nexport declare const transformDocumentForHashing: (invoices: AllDocumentsV1_1[]) => string;\n/**\n * Step 2: Calculate Document Digest\n * FIXED: Remove UBLExtensions and Signature before hashing (DS322)\n * Based on working implementation pattern\n */\nexport declare const calculateDocumentDigest: (invoices: AllDocumentsV1_1[]) => string;\n/**\n * Step 4: Calculate Certificate Digest\n * Enhanced to handle certificate content properly\n * FIXED: Match PowerShell script exactly - use raw certificate data like $cert.RawData\n */\nexport declare const calculateCertificateDigest: (certificatePem: string) => string;\n/**\n * Enhanced certificate info extraction with better error handling\n * FIXED: Normalize issuer name format to match MyInvois expectations (DS326)\n */\nexport declare const extractCertificateInfo: (certificatePem: string) => {\n issuerName: string;\n serialNumber: string;\n subjectName: string;\n};\n/**\n * Step 5: Create SignedProperties with enhanced structure\n * FIXED: Simplified structure to match MyInvois expectations (DS320)\n * Following MyInvois JSON signature specification exactly\n */\nexport declare const createSignedProperties: (certificateDigest: string, signingTime: string, issuerName: string, serialNumber: string) => SignedPropertiesObject;\n/**\n * Step 6: Calculate SignedProperties Digest\n * Calculates the digest over the correct structure for validator compliance.\n * FIXED: Calculate digest from SignedProperties only (without Target wrapper)\n */\nexport declare const calculateSignedPropertiesDigest: (signedProperties: SignedPropertiesObject, useTargetWrapper?: boolean) => string;\n/**\n * Step 3: Create SignedInfo and calculate signature\n * Enhanced with better structure and signature generation\n */\nexport declare const createSignedInfoAndSign: (docDigest: string, propsDigest: string, privateKeyPem: string) => {\n signedInfo: SignedInfoObject;\n signatureValue: string;\n};\n/**\n * Signs the minified document string using the provided private key PEM\n * Returns the signature as a base64 string\n * FIXED: Match PowerShell script exactly - first compute hash, then sign the hash\n */\nexport declare const signDocumentString: (documentString: string, privateKeyPem: string) => string;\n/**\n * Complete document generation with signatures\n * Follows the complete MyInvois JSON signature creation process (Steps 1-7)\n */\nexport declare const generateCompleteDocument: (invoices: AllDocumentsV1_1[], signingCredentials: SigningCredentials) => CompleteInvoice;\n/**\n * Creates a line item with percentage-based taxation (e.g., SST, GST)\n */\nexport declare const createPercentageTaxLineItem: (params: {\n itemClassificationCode: ClassificationCode;\n itemDescription: string;\n unitPrice: number;\n quantity?: number;\n taxType: TaxTypeCode;\n taxRate: number;\n totalTaxableAmountPerLine?: number;\n discountAmount?: number;\n discountRate?: number;\n}) => InvoiceLineItem;\n/**\n * Creates a line item with fixed rate taxation (e.g., Tourism Tax)\n */\nexport declare const createFixedRateTaxLineItem: (params: {\n itemClassificationCode: ClassificationCode;\n itemDescription: string;\n unitPrice: number;\n quantity?: number;\n taxType: TaxTypeCode;\n taxPerUnitAmount: number;\n baseUnitMeasure: number;\n baseUnitMeasureCode: UnitTypeCode;\n totalTaxableAmountPerLine?: number;\n discountAmount?: number;\n discountRate?: number;\n}) => InvoiceLineItem;\n/**\n * Calculates invoice totals from line items\n */\nexport declare const calculateInvoiceTotals: (lineItems: InvoiceLineItem[], payableRoundingAmount?: number) => {\n legalMonetaryTotal: {\n taxExclusiveAmount: number;\n taxInclusiveAmount: number;\n payableRoundingAmount: number;\n payableAmount: number;\n };\n taxTotal: {\n taxAmount: number;\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAE,iBAAA,CAAA,KAAA,MAAA,eAAA;AACF,IAAW,kBAAkB,CAAC,KAAK,MAAM,eAAgB;AACzD,IAAW,6BAA6B,CAAC,KAAK,MAAM,eAAgB;AACpE,IAAW,iBAAiB,CAAC,GAAI;AACjC,IAAE,mBAAA,CAAA,GAAA;AACF,IAAE,6BAAA;CAAA;CAAA,MAAA;CAAA,MAAA;AAAA;AACF,IAAW,2BAA2B;CAAC;CAAK,MAAM;CAAE,MAAA;AAAA;AACpD,IAAE,8BAAA,CAAA,KAAA,MAAA,gBAAA;AACF,IAAW,0BAA0B,CAAC,KAAK,MAAM,gBAAiB;AAClE,IAAE,6BAAA,CAAA,GAAA;AACF,IAAW,yBAAyB,CAAC,GAAI;AACzC,IAAE,yBAAA,CAAA,KAAA,MAAA,sBAAA;AACF,IAAW,kCAAkC,CAAC,KAAK,MAAM,sBAAe;AACxE,IAAE,0BAAA,CAAA,KAAA,MAAA,gBAAA;AACF,IAAW,qBAAqB,CAAC,GAAI;AACrC,IAAE,2BAAA;CAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;AAAA;AACF,IAAW,8BAA8B;CAAC;CAAK,MAAM;CAAoB,MAAM;CAAG,MAAA;AAAA;AAClF,IAAE,6BAAA;CAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;AAAA;AACF,IAAW,yBAAyB,CAAC,KAAK,MAAM,eAAgB"}
1
+ {"version":3,"file":"index71.cts","names":[],"sources":["../src/utils/document.d.ts"],"sourcesContent":["import { InvoiceSubmission, AllDocumentsV1_1, SigningCredentials, SignedPropertiesObject, UBLDocument, CompleteInvoice, SignedInfoObject, UnitTypeCode, InvoiceLineItem } from '../types';\nimport type { ClassificationCode } from '../types';\nimport type { TaxTypeCode } from '../types';\n/**\n * MyInvois v1.1 Document Generation and Signing Utilities\n * Strictly follows: https://sdk.myinvois.hasil.gov.my/documents/invoice-v1-1\n * JSON Signature Guide: https://sdk.myinvois.hasil.gov.my/signature-creation-json/\n */\n/**\n * Determines if a line item uses fixed rate taxation\n */\nexport declare const isFixedRateTax: (item: InvoiceLineItem) => boolean;\n/**\n * Determines if a line item uses percentage taxation\n */\nexport declare const isPercentageTax: (item: InvoiceLineItem) => boolean;\n/**\n * Calculates expected tax amount for a line item based on its tax type\n */\nexport declare const calculateExpectedTaxAmount: (item: InvoiceLineItem) => number;\n/**\n * Helper function to recursively sort object keys for JSON canonicalization\n */\nexport declare function sortObjectKeys(obj: unknown): unknown;\n/**\n * Enhanced canonicalization following MyInvois specification exactly\n * Key changes: ensure consistent ordering and formatting\n */\nexport declare const canonicalizeJSON: (obj: unknown) => string;\n/**\n * Generates a clean invoice object following MyInvois v1.1 specification exactly\n * This is the base invoice structure WITHOUT signature elements (for hash calculation)\n *\n * Key requirements from working documents:\n * - All mandatory fields must be present\n * - Many optional fields must be present even if empty\n * - Specific field ordering and structure\n * - Correct listID values (e.g., \"3166-1\" not \"ISO3166-1\")\n */\nexport declare const generateCleanInvoiceObject: (invoice: AllDocumentsV1_1) => InvoiceSubmission;\n/**\n * Generates the complete UBL document structure with namespace declarations\n */\nexport declare const generateCleanUBLDocument: (invoices: AllDocumentsV1_1[]) => UBLDocument;\n/**\n * Step 1: Transform the document for hashing or transmission\n * Removes UBLExtensions and Signature, and minifies the JSON\n * Returns the minified, cleaned JSON string\n *\n * FIXED: Use regex-based minification to match PowerShell script exactly\n */\nexport declare const transformDocumentForHashing: (invoices: AllDocumentsV1_1[]) => string;\n/**\n * Step 2: Calculate Document Digest\n * FIXED: Remove UBLExtensions and Signature before hashing (DS322)\n * Based on working implementation pattern\n */\nexport declare const calculateDocumentDigest: (invoices: AllDocumentsV1_1[]) => string;\n/**\n * Step 4: Calculate Certificate Digest\n * Enhanced to handle certificate content properly\n * FIXED: Match PowerShell script exactly - use raw certificate data like $cert.RawData\n */\nexport declare const calculateCertificateDigest: (certificatePem: string) => string;\n/**\n * Enhanced certificate info extraction with better error handling\n * FIXED: Normalize issuer name format to match MyInvois expectations (DS326)\n */\nexport declare const extractCertificateInfo: (certificatePem: string) => {\n issuerName: string;\n serialNumber: string;\n subjectName: string;\n};\n/**\n * Step 5: Create SignedProperties with enhanced structure\n * FIXED: Simplified structure to match MyInvois expectations (DS320)\n * Following MyInvois JSON signature specification exactly\n */\nexport declare const createSignedProperties: (certificateDigest: string, signingTime: string, issuerName: string, serialNumber: string) => SignedPropertiesObject;\n/**\n * Step 6: Calculate SignedProperties Digest\n * Calculates the digest over the correct structure for validator compliance.\n * FIXED: Calculate digest from SignedProperties only (without Target wrapper)\n */\nexport declare const calculateSignedPropertiesDigest: (signedProperties: SignedPropertiesObject, useTargetWrapper?: boolean) => string;\n/**\n * Step 3: Create SignedInfo and calculate signature\n * Enhanced with better structure and signature generation\n */\nexport declare const createSignedInfoAndSign: (docDigest: string, propsDigest: string, privateKeyPem: string) => {\n signedInfo: SignedInfoObject;\n signatureValue: string;\n};\n/**\n * Signs the minified document string using the provided private key PEM\n * Returns the signature as a base64 string\n * FIXED: Match PowerShell script exactly - first compute hash, then sign the hash\n */\nexport declare const signDocumentString: (documentString: string, privateKeyPem: string) => string;\n/**\n * Complete document generation with signatures\n * Follows the complete MyInvois JSON signature creation process (Steps 1-7)\n */\nexport declare const generateCompleteDocument: (invoices: AllDocumentsV1_1[], signingCredentials: SigningCredentials) => CompleteInvoice;\n/**\n * Creates a line item with percentage-based taxation (e.g., SST, GST)\n */\nexport declare const createPercentageTaxLineItem: (params: {\n itemClassificationCode: ClassificationCode;\n itemDescription: string;\n unitPrice: number;\n quantity?: number;\n measurement?: string;\n taxType: TaxTypeCode;\n taxRate: number;\n totalTaxableAmountPerLine?: number;\n discountAmount?: number;\n discountRate?: number;\n}) => InvoiceLineItem;\n/**\n * Creates a line item with fixed rate taxation (e.g., Tourism Tax)\n */\nexport declare const createFixedRateTaxLineItem: (params: {\n itemClassificationCode: ClassificationCode;\n itemDescription: string;\n unitPrice: number;\n quantity?: number;\n measurement?: string;\n taxType: TaxTypeCode;\n taxPerUnitAmount: number;\n baseUnitMeasure: number;\n baseUnitMeasureCode: UnitTypeCode;\n totalTaxableAmountPerLine?: number;\n discountAmount?: number;\n discountRate?: number;\n}) => InvoiceLineItem;\n/**\n * Calculates invoice totals from line items\n */\nexport declare const calculateInvoiceTotals: (lineItems: InvoiceLineItem[], payableRoundingAmount?: number) => {\n legalMonetaryTotal: {\n taxExclusiveAmount: number;\n taxInclusiveAmount: number;\n payableRoundingAmount: number;\n payableAmount: number;\n };\n taxTotal: {\n taxAmount: number;\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAE,iBAAA,CAAA,KAAA,MAAA,eAAA;AACF,IAAW,kBAAkB,CAAC,KAAK,MAAM,eAAgB;AACzD,IAAW,6BAA6B,CAAC,KAAK,MAAM,eAAgB;AACpE,IAAW,iBAAiB,CAAC,GAAI;AACjC,IAAE,mBAAA,CAAA,GAAA;AACF,IAAE,6BAAA;CAAA;CAAA,MAAA;CAAA,MAAA;AAAA;AACF,IAAW,2BAA2B;CAAC;CAAK,MAAM;CAAE,MAAA;AAAA;AACpD,IAAE,8BAAA,CAAA,KAAA,MAAA,gBAAA;AACF,IAAW,0BAA0B,CAAC,KAAK,MAAM,gBAAiB;AAClE,IAAE,6BAAA,CAAA,GAAA;AACF,IAAW,yBAAyB,CAAC,GAAI;AACzC,IAAE,yBAAA,CAAA,KAAA,MAAA,sBAAA;AACF,IAAW,kCAAkC,CAAC,KAAK,MAAM,sBAAe;AACxE,IAAE,0BAAA,CAAA,KAAA,MAAA,gBAAA;AACF,IAAW,qBAAqB,CAAC,GAAI;AACrC,IAAE,2BAAA;CAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;AAAA;AACF,IAAW,8BAA8B;CAAC;CAAK,MAAM;CAAoB,MAAM;CAAG,MAAA;AAAA;AAClF,IAAE,6BAAA;CAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;AAAA;AACF,IAAW,yBAAyB,CAAC,KAAK,MAAM,eAAgB"}
package/dist/index8.cjs CHANGED
@@ -0,0 +1,5 @@
1
+ const require_apiQueue = require('./apiQueue-DgKWaQDS.cjs');
2
+
3
+ exports.categorizeRequest = require_apiQueue.categorizeRequest;
4
+ exports.clearQueue = require_apiQueue.clearQueue;
5
+ exports.queueRequest = require_apiQueue.queueRequest;