@ripwords/myinvois-client 0.2.11 → 0.2.13
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.
- package/dist/api/documentManagement.d.ts +60 -60
- package/dist/api/documentSubmission.d.ts +60 -60
- package/dist/api/documentSubmission.js +1 -1
- package/dist/api/documentTypeManagement.d.ts +60 -60
- package/dist/api/notificationManagement.d.ts +60 -60
- package/dist/api/platformLogin.d.ts +60 -60
- package/dist/api/taxpayerValidation.d.ts +60 -60
- package/dist/apiQueue-4pQwCc0e.js +138 -0
- package/dist/apiQueue-sL4mNlVz.cjs +151 -0
- package/dist/apiQueue-sL4mNlVz.cjs.map +1 -0
- package/dist/{documentSubmission-BPDiODUd.js → documentSubmission-BsLKf-L-.js} +6 -8
- package/dist/{documentSubmission-DvCgvq28.cjs → documentSubmission-ys1hH7jn.cjs} +7 -9
- package/dist/documentSubmission-ys1hH7jn.cjs.map +1 -0
- package/dist/{documents-ByWRZZfd.d.ts → documents-BPawWCi-.d.ts} +8 -8
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +60 -60
- package/dist/index.js +5 -3
- package/dist/index23.cjs +3 -207
- package/dist/index24.cjs +9 -105
- package/dist/index24.cjs.map +1 -1
- package/dist/index25.cjs +3 -136
- package/dist/index26.cjs +19 -63
- package/dist/index27.cjs +2 -266
- package/dist/index28.cjs +2 -78
- package/dist/index29.cjs +326 -103
- package/dist/index29.cjs.map +1 -1
- package/dist/index3.cjs +1 -1
- package/dist/index30.cjs +189 -69
- package/dist/index30.cjs.map +1 -1
- package/dist/index31.cjs +203 -107
- package/dist/index31.cjs.map +1 -1
- package/dist/index32.cjs +104 -95
- package/dist/index32.cjs.map +1 -1
- package/dist/index33.cjs +133 -9
- package/dist/index33.cjs.map +1 -1
- package/dist/index34.cjs +63 -3
- package/dist/{index26.cjs.map → index34.cjs.map} +1 -1
- package/dist/index35.cjs +266 -19
- package/dist/{index27.cjs.map → index35.cjs.map} +1 -1
- package/dist/index36.cjs +78 -2
- package/dist/{index28.cjs.map → index36.cjs.map} +1 -1
- package/dist/index37.cjs +106 -2
- package/dist/index37.cjs.map +1 -0
- package/dist/index38.cjs +69 -326
- package/dist/index38.cjs.map +1 -1
- package/dist/index39.cjs +108 -189
- package/dist/index39.cjs.map +1 -1
- package/dist/index40.cjs +95 -13
- package/dist/index40.cjs.map +1 -1
- package/dist/index41.cjs +11 -31
- package/dist/index41.cjs.map +1 -1
- package/dist/index42.cjs +31 -12
- package/dist/index42.cjs.map +1 -1
- package/dist/index43.cjs +12 -22
- package/dist/index43.cjs.map +1 -1
- package/dist/index44.cjs +22 -13
- package/dist/index44.cjs.map +1 -1
- package/dist/index45.cjs +13 -7
- package/dist/index45.cjs.map +1 -1
- package/dist/index46.cjs +7 -7
- package/dist/index46.cjs.map +1 -1
- package/dist/index47.cjs +7 -10
- package/dist/index47.cjs.map +1 -1
- package/dist/index48.cjs +10 -6
- package/dist/index48.cjs.map +1 -1
- package/dist/index49.cjs +6 -101
- package/dist/index49.cjs.map +1 -1
- package/dist/index50.cjs +101 -106
- package/dist/index50.cjs.map +1 -1
- package/dist/index51.cjs +106 -119
- package/dist/index51.cjs.map +1 -1
- package/dist/index52.cjs +119 -106
- package/dist/index52.cjs.map +1 -1
- package/dist/index53.cjs +106 -98
- package/dist/index53.cjs.map +1 -1
- package/dist/index54.cjs +98 -118
- package/dist/index54.cjs.map +1 -1
- package/dist/index55.cjs +118 -127
- package/dist/index55.cjs.map +1 -1
- package/dist/index56.cjs +127 -117
- package/dist/index56.cjs.map +1 -1
- package/dist/index57.cjs +117 -14
- package/dist/index57.cjs.map +1 -1
- package/dist/index58.cjs +14 -95
- package/dist/index58.cjs.map +1 -1
- package/dist/index59.cjs +95 -142
- package/dist/index59.cjs.map +1 -1
- package/dist/index60.cjs +142 -114
- package/dist/index60.cjs.map +1 -1
- package/dist/index61.cjs +114 -144
- package/dist/index61.cjs.map +1 -1
- package/dist/index62.cjs +144 -113
- package/dist/index62.cjs.map +1 -1
- package/dist/index63.cjs +113 -17
- package/dist/index63.cjs.map +1 -1
- package/dist/index64.cjs +17 -112
- package/dist/index64.cjs.map +1 -1
- package/dist/index65.cjs +112 -47
- package/dist/index65.cjs.map +1 -1
- package/dist/index66.cjs +47 -14
- package/dist/index66.cjs.map +1 -1
- package/dist/index67.cjs +14 -28
- package/dist/index67.cjs.map +1 -1
- package/dist/index68.cjs +28 -22
- package/dist/index68.cjs.map +1 -1
- package/dist/index68.cts.map +1 -1
- package/dist/index69.cjs +22 -9
- package/dist/index69.cjs.map +1 -1
- package/dist/index69.cts.map +1 -1
- package/dist/index70.cjs +9 -8
- package/dist/index70.cjs.map +1 -1
- package/dist/index70.cts.map +1 -1
- package/dist/index71.cjs +8 -17
- package/dist/index71.cjs.map +1 -1
- package/dist/index71.cts.map +1 -1
- package/dist/index72.cjs +17 -412
- package/dist/index72.cjs.map +1 -1
- package/dist/index72.cts.map +1 -1
- package/dist/index73.cjs +412 -8
- package/dist/index73.cjs.map +1 -1
- package/dist/index73.cts.map +1 -1
- package/dist/index74.cjs +8 -9
- package/dist/index74.cjs.map +1 -1
- package/dist/index74.cts.map +1 -1
- package/dist/index75.cjs +16 -0
- package/dist/index75.cjs.map +1 -0
- package/dist/index75.cts.map +1 -0
- package/dist/{msic-codes-bYv0T5WJ.d.ts → msic-codes-CjrrJmzb.d.ts} +10 -10
- package/dist/{taxpayer-yqCbpaJy.d.ts → taxpayer-SC6Tu_nN.d.ts} +2 -2
- package/dist/types/classification-codes.d.ts +1 -1
- package/dist/types/country-code.d.ts +1 -1
- package/dist/types/currencies.d.ts +1 -1
- package/dist/types/documents.d.ts +54 -54
- package/dist/types/e-invoice.d.ts +1 -1
- package/dist/types/index.d.ts +60 -60
- package/dist/types/msic/0X.d.ts +1 -1
- package/dist/types/msic/1X.d.ts +1 -1
- package/dist/types/msic/2X.d.ts +1 -1
- package/dist/types/msic/3X.d.ts +1 -1
- package/dist/types/msic/4X.d.ts +1 -1
- package/dist/types/msic/5X.d.ts +1 -1
- package/dist/types/msic/6X.d.ts +1 -1
- package/dist/types/msic/7X.d.ts +1 -1
- package/dist/types/msic/8X.d.ts +1 -1
- package/dist/types/msic/9X.d.ts +1 -1
- package/dist/types/msic-codes.d.ts +11 -11
- package/dist/types/notifications.d.ts +1 -1
- package/dist/types/payment-modes.d.ts +1 -1
- package/dist/types/signatures.d.ts +1 -1
- package/dist/types/state-codes.d.ts +1 -1
- package/dist/types/tax-types.d.ts +1 -1
- package/dist/types/taxpayer.d.ts +55 -55
- package/dist/types/unit/1X.d.ts +1 -1
- package/dist/types/unit/2X.d.ts +1 -1
- package/dist/types/unit/3X.d.ts +1 -1
- package/dist/types/unit/4X.d.ts +1 -1
- package/dist/types/unit/5X.d.ts +1 -1
- package/dist/types/unit/6X.d.ts +1 -1
- package/dist/types/unit/7X.d.ts +1 -1
- package/dist/types/unit/8X.d.ts +1 -1
- package/dist/types/unit/9X.d.ts +1 -1
- package/dist/types/unit/AX.d.ts +1 -1
- package/dist/types/unit/BX.d.ts +1 -1
- package/dist/types/unit/CX.d.ts +1 -1
- package/dist/types/unit/DX.d.ts +1 -1
- package/dist/types/unit/EX.d.ts +1 -1
- package/dist/types/unit/FX.d.ts +1 -1
- package/dist/types/unit/GX.d.ts +1 -1
- package/dist/types/unit/HX.d.ts +1 -1
- package/dist/types/unit/IX.d.ts +1 -1
- package/dist/types/unit/JX.d.ts +1 -1
- package/dist/types/unit/KX.d.ts +1 -1
- package/dist/types/unit/LX.d.ts +1 -1
- package/dist/types/unit/MX.d.ts +1 -1
- package/dist/types/unit/NX.d.ts +1 -1
- package/dist/types/unit/OX.d.ts +1 -1
- package/dist/types/unit/PX.d.ts +1 -1
- package/dist/types/unit/QX.d.ts +1 -1
- package/dist/types/unit/RX.d.ts +1 -1
- package/dist/types/unit/SX.d.ts +1 -1
- package/dist/types/unit/TX.d.ts +1 -1
- package/dist/types/unit/UX.d.ts +1 -1
- package/dist/types/unit/VX.d.ts +1 -1
- package/dist/types/unit/WX.d.ts +1 -1
- package/dist/types/unit/XX.d.ts +1 -1
- package/dist/types/unit/YX.d.ts +1 -1
- package/dist/types/unit/ZX.d.ts +1 -1
- package/dist/types/unit-types.d.ts +36 -36
- package/dist/types/utils.d.ts +1 -1
- package/dist/unit-types-VgYXIwTT.d.ts +55 -0
- package/dist/utils/apiQueue.d.ts +35 -0
- package/dist/utils/apiQueue.js +3 -0
- package/dist/utils/document.d.ts +60 -60
- package/dist/utils/signature-diagnostics.d.ts +60 -60
- package/dist/utils/validation.d.ts +60 -60
- package/package.json +1 -1
- package/dist/documentSubmission-DvCgvq28.cjs.map +0 -1
- package/dist/index23.cjs.map +0 -1
- package/dist/index25.cjs.map +0 -1
- package/dist/unit-types-BDqcMY-6.d.ts +0 -55
- /package/dist/{0X-Dd1CNvh-.d.ts → 0X-qj3c_vAo.d.ts} +0 -0
- /package/dist/{1X-CCvwRRue.d.ts → 1X-B-lyAVC4.d.ts} +0 -0
- /package/dist/{1X-tlQZHXWg.d.ts → 1X-C72Wa4pk.d.ts} +0 -0
- /package/dist/{2X-BNzH9sOi.d.ts → 2X-BfCK614i.d.ts} +0 -0
- /package/dist/{2X-Dpj2ruTC.d.ts → 2X-CH89y3Af.d.ts} +0 -0
- /package/dist/{3X-DGRZOL1h.d.ts → 3X-DryrwYRf.d.ts} +0 -0
- /package/dist/{3X-Dgh7ek-L.d.ts → 3X-Du10Ix_V.d.ts} +0 -0
- /package/dist/{4X-C2YvBCto.d.ts → 4X-BPMLRoDv.d.ts} +0 -0
- /package/dist/{4X-JEzpzgfD.d.ts → 4X-x3cRFuSM.d.ts} +0 -0
- /package/dist/{5X-Dh-FPoAo.d.ts → 5X-B52AKeTz.d.ts} +0 -0
- /package/dist/{5X-CLwXLO_A.d.ts → 5X-Bv7M6KyG.d.ts} +0 -0
- /package/dist/{6X-Bj2BTA-B.d.ts → 6X-DBwpWPQ6.d.ts} +0 -0
- /package/dist/{6X-DKI9x-xV.d.ts → 6X-ZeZ8OB57.d.ts} +0 -0
- /package/dist/{7X-CqUyxXiA.d.ts → 7X-C_XGDSpE.d.ts} +0 -0
- /package/dist/{7X-CfbV7a2x.d.ts → 7X-Dvw2Z2VN.d.ts} +0 -0
- /package/dist/{8X-LeWjhVT-.d.ts → 8X-BkgoX8dg.d.ts} +0 -0
- /package/dist/{8X-BiBd9Sgc.d.ts → 8X-Di_0wuRX.d.ts} +0 -0
- /package/dist/{9X-CPUAZZzu.d.ts → 9X-8ZnvvViY.d.ts} +0 -0
- /package/dist/{9X-DlQI2H7P.d.ts → 9X-Du0e44cq.d.ts} +0 -0
- /package/dist/{AX-LnjRRsXP.d.ts → AX-BSPLpkVT.d.ts} +0 -0
- /package/dist/{BX-BEB5dvmG.d.ts → BX-u4yMaIkz.d.ts} +0 -0
- /package/dist/{CX-DbUPhejT.d.ts → CX-BKZG0pVE.d.ts} +0 -0
- /package/dist/{DX-CQQRUzAX.d.ts → DX-CwA9WJAf.d.ts} +0 -0
- /package/dist/{EX-mr76RLy0.d.ts → EX-BRNu1Ooi.d.ts} +0 -0
- /package/dist/{FX-CsnNcgsB.d.ts → FX-DBxjq6xY.d.ts} +0 -0
- /package/dist/{GX-BdkB6I_6.d.ts → GX-B3CvWNrP.d.ts} +0 -0
- /package/dist/{HX-GMf5i5So.d.ts → HX-D7FABgTv.d.ts} +0 -0
- /package/dist/{IX-Duj6eppk.d.ts → IX-D3ZknsAB.d.ts} +0 -0
- /package/dist/{JX-Daa9spZ7.d.ts → JX-BRaZM3Gc.d.ts} +0 -0
- /package/dist/{KX-tnQXTKgl.d.ts → KX-B1K0OWoi.d.ts} +0 -0
- /package/dist/{LX-DZobJ-WG.d.ts → LX-CKRefinL.d.ts} +0 -0
- /package/dist/{MX-BVPhHIvx.d.ts → MX-DKmaeO9r.d.ts} +0 -0
- /package/dist/{NX-DEc1tsw0.d.ts → NX-CJL2Gn1U.d.ts} +0 -0
- /package/dist/{OX-CT_Dg5Xc.d.ts → OX-Do2ap5v_.d.ts} +0 -0
- /package/dist/{PX-BqEPcioe.d.ts → PX-_DOr_rm9.d.ts} +0 -0
- /package/dist/{QX-PkkdCvsL.d.ts → QX-HlXLkIki.d.ts} +0 -0
- /package/dist/{RX-DCff5kVD.d.ts → RX-DVPGOVES.d.ts} +0 -0
- /package/dist/{SX-B0U-jv6V.d.ts → SX-OGT3qwlS.d.ts} +0 -0
- /package/dist/{TX-UoXkAqwz.d.ts → TX-cPDINmZ5.d.ts} +0 -0
- /package/dist/{UX-CCbo58UC.d.ts → UX-Be3sqvPV.d.ts} +0 -0
- /package/dist/{VX-DhNvZGZW.d.ts → VX-CoEuBNDK.d.ts} +0 -0
- /package/dist/{WX-BNhx__qq.d.ts → WX-DMvw__jH.d.ts} +0 -0
- /package/dist/{XX-BohzIxEW.d.ts → XX-DOA-10JW.d.ts} +0 -0
- /package/dist/{YX-DNZeyxw3.d.ts → YX-F34sJ7Ik.d.ts} +0 -0
- /package/dist/{ZX-CLCrJ7Mg.d.ts → ZX-CDQOfsHh.d.ts} +0 -0
- /package/dist/{classification-codes-DLO4QazM.d.ts → classification-codes-C2X4xW5-.d.ts} +0 -0
- /package/dist/{country-code-DqhONNiC.d.ts → country-code-DsI8Mbzx.d.ts} +0 -0
- /package/dist/{currencies-Dgzd5iCT.d.ts → currencies-DKuDflOO.d.ts} +0 -0
- /package/dist/{e-invoice-Bbd2oyzZ.d.ts → e-invoice-C2TxhyrK.d.ts} +0 -0
- /package/dist/{index-Cvns0Vxq.d.ts → index-CygwSf0x.d.ts} +0 -0
- /package/dist/{notifications-CBKMhBtd.d.ts → notifications-sFhgh3rJ.d.ts} +0 -0
- /package/dist/{payment-modes-SbrTHOfF.d.ts → payment-modes-g3DzLmWb.d.ts} +0 -0
- /package/dist/{signatures-BjqNaINR.d.ts → signatures-CerHUrj3.d.ts} +0 -0
- /package/dist/{state-codes-B9___UB-.d.ts → state-codes-Ow4oehYT.d.ts} +0 -0
- /package/dist/{tax-types-ieqw5Ze7.d.ts → tax-types-ClyLgydM.d.ts} +0 -0
- /package/dist/{utils-BTAitDVa.d.ts → utils-C4FoVKLq.d.ts} +0 -0
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import "../classification-codes-
|
|
2
|
-
import "../country-code-
|
|
3
|
-
import "../currencies-
|
|
4
|
-
import "../e-invoice-
|
|
5
|
-
import "../0X-
|
|
6
|
-
import "../1X-
|
|
7
|
-
import "../2X-
|
|
8
|
-
import "../3X-
|
|
9
|
-
import "../4X-
|
|
10
|
-
import "../5X-
|
|
11
|
-
import "../6X-
|
|
12
|
-
import "../7X-
|
|
13
|
-
import "../8X-
|
|
14
|
-
import "../9X-
|
|
15
|
-
import "../msic-codes-
|
|
16
|
-
import "../tax-types-
|
|
17
|
-
import "../state-codes-
|
|
18
|
-
import "../1X-
|
|
19
|
-
import "../2X-
|
|
20
|
-
import "../3X-
|
|
21
|
-
import "../4X-
|
|
22
|
-
import "../5X-
|
|
23
|
-
import "../6X-
|
|
24
|
-
import "../7X-
|
|
25
|
-
import "../8X-
|
|
26
|
-
import "../9X-
|
|
27
|
-
import "../AX-
|
|
28
|
-
import "../BX-
|
|
29
|
-
import "../CX-
|
|
30
|
-
import "../DX-
|
|
31
|
-
import "../EX-
|
|
32
|
-
import "../FX-
|
|
33
|
-
import "../GX-
|
|
34
|
-
import "../HX-
|
|
35
|
-
import "../IX-
|
|
36
|
-
import "../JX-
|
|
37
|
-
import "../KX-
|
|
38
|
-
import "../LX-
|
|
39
|
-
import "../MX-
|
|
40
|
-
import "../NX-
|
|
41
|
-
import "../OX-
|
|
42
|
-
import "../PX-
|
|
43
|
-
import "../QX-
|
|
44
|
-
import "../RX-
|
|
45
|
-
import "../SX-
|
|
46
|
-
import "../TX-
|
|
47
|
-
import "../UX-
|
|
48
|
-
import "../VX-
|
|
49
|
-
import "../WX-
|
|
50
|
-
import "../YX-
|
|
51
|
-
import "../ZX-
|
|
52
|
-
import "../XX-
|
|
53
|
-
import "../unit-types-
|
|
54
|
-
import { RegistrationType } from "../documents-
|
|
55
|
-
import "../payment-modes-
|
|
56
|
-
import "../signatures-
|
|
57
|
-
import "../notifications-
|
|
58
|
-
import { TaxpayerQRCodeResponse, TinSearchParams, TinSearchResponse } from "../taxpayer-
|
|
59
|
-
import { Fetch } from "../utils-
|
|
60
|
-
import "../index-
|
|
1
|
+
import "../classification-codes-C2X4xW5-.js";
|
|
2
|
+
import "../country-code-DsI8Mbzx.js";
|
|
3
|
+
import "../currencies-DKuDflOO.js";
|
|
4
|
+
import "../e-invoice-C2TxhyrK.js";
|
|
5
|
+
import "../0X-qj3c_vAo.js";
|
|
6
|
+
import "../1X-B-lyAVC4.js";
|
|
7
|
+
import "../2X-BfCK614i.js";
|
|
8
|
+
import "../3X-Du10Ix_V.js";
|
|
9
|
+
import "../4X-x3cRFuSM.js";
|
|
10
|
+
import "../5X-B52AKeTz.js";
|
|
11
|
+
import "../6X-DBwpWPQ6.js";
|
|
12
|
+
import "../7X-C_XGDSpE.js";
|
|
13
|
+
import "../8X-Di_0wuRX.js";
|
|
14
|
+
import "../9X-8ZnvvViY.js";
|
|
15
|
+
import "../msic-codes-CjrrJmzb.js";
|
|
16
|
+
import "../tax-types-ClyLgydM.js";
|
|
17
|
+
import "../state-codes-Ow4oehYT.js";
|
|
18
|
+
import "../1X-C72Wa4pk.js";
|
|
19
|
+
import "../2X-CH89y3Af.js";
|
|
20
|
+
import "../3X-DryrwYRf.js";
|
|
21
|
+
import "../4X-BPMLRoDv.js";
|
|
22
|
+
import "../5X-Bv7M6KyG.js";
|
|
23
|
+
import "../6X-ZeZ8OB57.js";
|
|
24
|
+
import "../7X-Dvw2Z2VN.js";
|
|
25
|
+
import "../8X-BkgoX8dg.js";
|
|
26
|
+
import "../9X-Du0e44cq.js";
|
|
27
|
+
import "../AX-BSPLpkVT.js";
|
|
28
|
+
import "../BX-u4yMaIkz.js";
|
|
29
|
+
import "../CX-BKZG0pVE.js";
|
|
30
|
+
import "../DX-CwA9WJAf.js";
|
|
31
|
+
import "../EX-BRNu1Ooi.js";
|
|
32
|
+
import "../FX-DBxjq6xY.js";
|
|
33
|
+
import "../GX-B3CvWNrP.js";
|
|
34
|
+
import "../HX-D7FABgTv.js";
|
|
35
|
+
import "../IX-D3ZknsAB.js";
|
|
36
|
+
import "../JX-BRaZM3Gc.js";
|
|
37
|
+
import "../KX-B1K0OWoi.js";
|
|
38
|
+
import "../LX-CKRefinL.js";
|
|
39
|
+
import "../MX-DKmaeO9r.js";
|
|
40
|
+
import "../NX-CJL2Gn1U.js";
|
|
41
|
+
import "../OX-Do2ap5v_.js";
|
|
42
|
+
import "../PX-_DOr_rm9.js";
|
|
43
|
+
import "../QX-HlXLkIki.js";
|
|
44
|
+
import "../RX-DVPGOVES.js";
|
|
45
|
+
import "../SX-OGT3qwlS.js";
|
|
46
|
+
import "../TX-cPDINmZ5.js";
|
|
47
|
+
import "../UX-Be3sqvPV.js";
|
|
48
|
+
import "../VX-CoEuBNDK.js";
|
|
49
|
+
import "../WX-DMvw__jH.js";
|
|
50
|
+
import "../YX-F34sJ7Ik.js";
|
|
51
|
+
import "../ZX-CDQOfsHh.js";
|
|
52
|
+
import "../XX-DOA-10JW.js";
|
|
53
|
+
import "../unit-types-VgYXIwTT.js";
|
|
54
|
+
import { RegistrationType } from "../documents-BPawWCi-.js";
|
|
55
|
+
import "../payment-modes-g3DzLmWb.js";
|
|
56
|
+
import "../signatures-CerHUrj3.js";
|
|
57
|
+
import "../notifications-sFhgh3rJ.js";
|
|
58
|
+
import { TaxpayerQRCodeResponse, TinSearchParams, TinSearchResponse } from "../taxpayer-SC6Tu_nN.js";
|
|
59
|
+
import { Fetch } from "../utils-C4FoVKLq.js";
|
|
60
|
+
import "../index-CygwSf0x.js";
|
|
61
61
|
|
|
62
62
|
//#region src/api/taxpayerValidation.d.ts
|
|
63
63
|
interface TaxpayerContext {
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
//#region src/utils/apiQueue.ts
|
|
2
|
+
const WINDOW = 6e4;
|
|
3
|
+
const RATE_LIMITS = {
|
|
4
|
+
loginTaxpayer: {
|
|
5
|
+
limit: 12,
|
|
6
|
+
windowMs: WINDOW
|
|
7
|
+
},
|
|
8
|
+
loginIntermediary: {
|
|
9
|
+
limit: 12,
|
|
10
|
+
windowMs: WINDOW
|
|
11
|
+
},
|
|
12
|
+
submitDocuments: {
|
|
13
|
+
limit: 100,
|
|
14
|
+
windowMs: WINDOW
|
|
15
|
+
},
|
|
16
|
+
getSubmission: {
|
|
17
|
+
limit: 300,
|
|
18
|
+
windowMs: WINDOW
|
|
19
|
+
},
|
|
20
|
+
cancelDocument: {
|
|
21
|
+
limit: 12,
|
|
22
|
+
windowMs: WINDOW
|
|
23
|
+
},
|
|
24
|
+
rejectDocument: {
|
|
25
|
+
limit: 12,
|
|
26
|
+
windowMs: WINDOW
|
|
27
|
+
},
|
|
28
|
+
getDocument: {
|
|
29
|
+
limit: 60,
|
|
30
|
+
windowMs: WINDOW
|
|
31
|
+
},
|
|
32
|
+
getDocumentDetails: {
|
|
33
|
+
limit: 125,
|
|
34
|
+
windowMs: WINDOW
|
|
35
|
+
},
|
|
36
|
+
getRecentDocuments: {
|
|
37
|
+
limit: 12,
|
|
38
|
+
windowMs: WINDOW
|
|
39
|
+
},
|
|
40
|
+
searchDocuments: {
|
|
41
|
+
limit: 12,
|
|
42
|
+
windowMs: WINDOW
|
|
43
|
+
},
|
|
44
|
+
searchTin: {
|
|
45
|
+
limit: 60,
|
|
46
|
+
windowMs: WINDOW
|
|
47
|
+
},
|
|
48
|
+
taxpayerQr: {
|
|
49
|
+
limit: 60,
|
|
50
|
+
windowMs: WINDOW
|
|
51
|
+
},
|
|
52
|
+
default: {
|
|
53
|
+
limit: 1e4,
|
|
54
|
+
windowMs: WINDOW
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* A very small sliding-window rate-limiter with queuing.
|
|
59
|
+
* Each category gets its own instance so limits are isolated.
|
|
60
|
+
*/
|
|
61
|
+
var RateLimiter = class {
|
|
62
|
+
limit;
|
|
63
|
+
windowMs;
|
|
64
|
+
queue = [];
|
|
65
|
+
timestamps = [];
|
|
66
|
+
timer = null;
|
|
67
|
+
constructor(config) {
|
|
68
|
+
this.limit = config.limit;
|
|
69
|
+
this.windowMs = config.windowMs;
|
|
70
|
+
}
|
|
71
|
+
drainQueue() {
|
|
72
|
+
if (this.queue.length === 0) return;
|
|
73
|
+
const now = Date.now();
|
|
74
|
+
this.timestamps = this.timestamps.filter((ts) => now - ts < this.windowMs);
|
|
75
|
+
if (this.timestamps.length >= this.limit) {
|
|
76
|
+
const earliest = this.timestamps[0];
|
|
77
|
+
const delay = this.windowMs - (now - earliest) + 1;
|
|
78
|
+
if (!this.timer) this.timer = setTimeout(() => {
|
|
79
|
+
this.timer = null;
|
|
80
|
+
this.drainQueue();
|
|
81
|
+
}, delay);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const next = this.queue.shift();
|
|
85
|
+
this.timestamps.push(now);
|
|
86
|
+
next();
|
|
87
|
+
this.drainQueue();
|
|
88
|
+
}
|
|
89
|
+
get queueSize() {
|
|
90
|
+
return this.queue.length;
|
|
91
|
+
}
|
|
92
|
+
schedule(fn, debug = false, category) {
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
const execute = () => {
|
|
95
|
+
if (debug && category) console.log(`[apiQueue] ▶️ Executing request (${category}). Remaining queue: ${this.queue.length}`);
|
|
96
|
+
fn().then(resolve).catch(reject);
|
|
97
|
+
};
|
|
98
|
+
if (debug && category) console.log(`[apiQueue] ⏳ Queued request (${category}). Queue length before push: ${this.queue.length}`);
|
|
99
|
+
this.queue.push(execute);
|
|
100
|
+
this.drainQueue();
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const limiterRegistry = /* @__PURE__ */ new Map();
|
|
105
|
+
function getLimiter(category) {
|
|
106
|
+
if (!limiterRegistry.has(category)) limiterRegistry.set(category, new RateLimiter(RATE_LIMITS[category]));
|
|
107
|
+
return limiterRegistry.get(category);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Public helper to schedule a request according to the category's limits.
|
|
111
|
+
*/
|
|
112
|
+
function queueRequest(category, fn, debug = false) {
|
|
113
|
+
const limiter = getLimiter(category);
|
|
114
|
+
return limiter.schedule(fn, debug, category);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Very naive path-based category detection. If no matcher fits, the `default` category
|
|
118
|
+
* (effectively unlimited) is returned. Adjust these heuristics as your API surface evolves.
|
|
119
|
+
*/
|
|
120
|
+
function categorizeRequest(path, method = "GET") {
|
|
121
|
+
const cleanPath = path.toLowerCase();
|
|
122
|
+
const isPost = method?.toUpperCase() === "POST";
|
|
123
|
+
if (cleanPath.includes("/documentsubmissions")) return isPost ? "submitDocuments" : "getSubmission";
|
|
124
|
+
if (cleanPath.includes("/documentmanagement")) {
|
|
125
|
+
if (cleanPath.endsWith("/cancel")) return "cancelDocument";
|
|
126
|
+
if (cleanPath.endsWith("/reject")) return "rejectDocument";
|
|
127
|
+
if (cleanPath.endsWith("/details")) return "getDocumentDetails";
|
|
128
|
+
if (cleanPath.includes("/recent")) return "getRecentDocuments";
|
|
129
|
+
return method === "GET" ? "getDocument" : "searchDocuments";
|
|
130
|
+
}
|
|
131
|
+
if (cleanPath.includes("/searchtin")) return "searchTin";
|
|
132
|
+
if (cleanPath.includes("/qrcode")) return "taxpayerQr";
|
|
133
|
+
if (cleanPath.includes("/connect/token")) return "loginTaxpayer";
|
|
134
|
+
return "default";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
export { categorizeRequest, queueRequest };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/apiQueue.ts
|
|
3
|
+
const WINDOW = 6e4;
|
|
4
|
+
const RATE_LIMITS = {
|
|
5
|
+
loginTaxpayer: {
|
|
6
|
+
limit: 12,
|
|
7
|
+
windowMs: WINDOW
|
|
8
|
+
},
|
|
9
|
+
loginIntermediary: {
|
|
10
|
+
limit: 12,
|
|
11
|
+
windowMs: WINDOW
|
|
12
|
+
},
|
|
13
|
+
submitDocuments: {
|
|
14
|
+
limit: 100,
|
|
15
|
+
windowMs: WINDOW
|
|
16
|
+
},
|
|
17
|
+
getSubmission: {
|
|
18
|
+
limit: 300,
|
|
19
|
+
windowMs: WINDOW
|
|
20
|
+
},
|
|
21
|
+
cancelDocument: {
|
|
22
|
+
limit: 12,
|
|
23
|
+
windowMs: WINDOW
|
|
24
|
+
},
|
|
25
|
+
rejectDocument: {
|
|
26
|
+
limit: 12,
|
|
27
|
+
windowMs: WINDOW
|
|
28
|
+
},
|
|
29
|
+
getDocument: {
|
|
30
|
+
limit: 60,
|
|
31
|
+
windowMs: WINDOW
|
|
32
|
+
},
|
|
33
|
+
getDocumentDetails: {
|
|
34
|
+
limit: 125,
|
|
35
|
+
windowMs: WINDOW
|
|
36
|
+
},
|
|
37
|
+
getRecentDocuments: {
|
|
38
|
+
limit: 12,
|
|
39
|
+
windowMs: WINDOW
|
|
40
|
+
},
|
|
41
|
+
searchDocuments: {
|
|
42
|
+
limit: 12,
|
|
43
|
+
windowMs: WINDOW
|
|
44
|
+
},
|
|
45
|
+
searchTin: {
|
|
46
|
+
limit: 60,
|
|
47
|
+
windowMs: WINDOW
|
|
48
|
+
},
|
|
49
|
+
taxpayerQr: {
|
|
50
|
+
limit: 60,
|
|
51
|
+
windowMs: WINDOW
|
|
52
|
+
},
|
|
53
|
+
default: {
|
|
54
|
+
limit: 1e4,
|
|
55
|
+
windowMs: WINDOW
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* A very small sliding-window rate-limiter with queuing.
|
|
60
|
+
* Each category gets its own instance so limits are isolated.
|
|
61
|
+
*/
|
|
62
|
+
var RateLimiter = class {
|
|
63
|
+
limit;
|
|
64
|
+
windowMs;
|
|
65
|
+
queue = [];
|
|
66
|
+
timestamps = [];
|
|
67
|
+
timer = null;
|
|
68
|
+
constructor(config) {
|
|
69
|
+
this.limit = config.limit;
|
|
70
|
+
this.windowMs = config.windowMs;
|
|
71
|
+
}
|
|
72
|
+
drainQueue() {
|
|
73
|
+
if (this.queue.length === 0) return;
|
|
74
|
+
const now = Date.now();
|
|
75
|
+
this.timestamps = this.timestamps.filter((ts) => now - ts < this.windowMs);
|
|
76
|
+
if (this.timestamps.length >= this.limit) {
|
|
77
|
+
const earliest = this.timestamps[0];
|
|
78
|
+
const delay = this.windowMs - (now - earliest) + 1;
|
|
79
|
+
if (!this.timer) this.timer = setTimeout(() => {
|
|
80
|
+
this.timer = null;
|
|
81
|
+
this.drainQueue();
|
|
82
|
+
}, delay);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const next = this.queue.shift();
|
|
86
|
+
this.timestamps.push(now);
|
|
87
|
+
next();
|
|
88
|
+
this.drainQueue();
|
|
89
|
+
}
|
|
90
|
+
get queueSize() {
|
|
91
|
+
return this.queue.length;
|
|
92
|
+
}
|
|
93
|
+
schedule(fn, debug = false, category) {
|
|
94
|
+
return new Promise((resolve, reject) => {
|
|
95
|
+
const execute = () => {
|
|
96
|
+
if (debug && category) console.log(`[apiQueue] ▶️ Executing request (${category}). Remaining queue: ${this.queue.length}`);
|
|
97
|
+
fn().then(resolve).catch(reject);
|
|
98
|
+
};
|
|
99
|
+
if (debug && category) console.log(`[apiQueue] ⏳ Queued request (${category}). Queue length before push: ${this.queue.length}`);
|
|
100
|
+
this.queue.push(execute);
|
|
101
|
+
this.drainQueue();
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const limiterRegistry = /* @__PURE__ */ new Map();
|
|
106
|
+
function getLimiter(category) {
|
|
107
|
+
if (!limiterRegistry.has(category)) limiterRegistry.set(category, new RateLimiter(RATE_LIMITS[category]));
|
|
108
|
+
return limiterRegistry.get(category);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Public helper to schedule a request according to the category's limits.
|
|
112
|
+
*/
|
|
113
|
+
function queueRequest(category, fn, debug = false) {
|
|
114
|
+
const limiter = getLimiter(category);
|
|
115
|
+
return limiter.schedule(fn, debug, category);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Very naive path-based category detection. If no matcher fits, the `default` category
|
|
119
|
+
* (effectively unlimited) is returned. Adjust these heuristics as your API surface evolves.
|
|
120
|
+
*/
|
|
121
|
+
function categorizeRequest(path, method = "GET") {
|
|
122
|
+
const cleanPath = path.toLowerCase();
|
|
123
|
+
const isPost = method?.toUpperCase() === "POST";
|
|
124
|
+
if (cleanPath.includes("/documentsubmissions")) return isPost ? "submitDocuments" : "getSubmission";
|
|
125
|
+
if (cleanPath.includes("/documentmanagement")) {
|
|
126
|
+
if (cleanPath.endsWith("/cancel")) return "cancelDocument";
|
|
127
|
+
if (cleanPath.endsWith("/reject")) return "rejectDocument";
|
|
128
|
+
if (cleanPath.endsWith("/details")) return "getDocumentDetails";
|
|
129
|
+
if (cleanPath.includes("/recent")) return "getRecentDocuments";
|
|
130
|
+
return method === "GET" ? "getDocument" : "searchDocuments";
|
|
131
|
+
}
|
|
132
|
+
if (cleanPath.includes("/searchtin")) return "searchTin";
|
|
133
|
+
if (cleanPath.includes("/qrcode")) return "taxpayerQr";
|
|
134
|
+
if (cleanPath.includes("/connect/token")) return "loginTaxpayer";
|
|
135
|
+
return "default";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
Object.defineProperty(exports, 'categorizeRequest', {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
get: function () {
|
|
142
|
+
return categorizeRequest;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(exports, 'queueRequest', {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
get: function () {
|
|
148
|
+
return queueRequest;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
//# sourceMappingURL=apiQueue-sL4mNlVz.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiQueue-sL4mNlVz.cjs","names":["RATE_LIMITS: Record<ApiCategory, RateLimitConfig>","config: RateLimitConfig","fn: () => Promise<T>","debug: boolean","category?: ApiCategory","category: ApiCategory","path: string","method: string"],"sources":["../src/utils/apiQueue.ts"],"sourcesContent":["// A very small utility that provides per-endpoint request queuing with fixed-window rate-limits.\n// The goal is to make sure that we never exceed the vendor-defined limits while also ensuring\n// that every request is eventually executed.\n//\n// NOTE: This is intentionally minimal – no external dependencies are introduced.\n// If you need more advanced features (persistence, jitter, etc.) consider a library such as `bottleneck`.\n\n/*\nRate-limit specification (per 60-second window)\n----------------------------------------------\nLogin as Taxpayer System : 12\nLogin as Intermediary System : 12\nSubmit Documents : 100\nGet Submission : 300\nCancel Document : 12\nReject Document : 12\nGet Document : 60\nGet Document Details : 125\nGet Recent Documents : 12\nSearch Documents : 12\nSearch Taxpayer's TIN : 60\nTaxpayer's QR Code : 60\n*/\n\nexport type ApiCategory =\n | 'loginTaxpayer'\n | 'loginIntermediary'\n | 'submitDocuments'\n | 'getSubmission'\n | 'cancelDocument'\n | 'rejectDocument'\n | 'getDocument'\n | 'getDocumentDetails'\n | 'getRecentDocuments'\n | 'searchDocuments'\n | 'searchTin'\n | 'taxpayerQr'\n | 'default'\n\ninterface RateLimitConfig {\n limit: number\n windowMs: number\n}\n\nconst WINDOW = 60_000 // 60 seconds\n\n// Hard-coded limits based on the specification above.\nconst RATE_LIMITS: Record<ApiCategory, RateLimitConfig> = {\n loginTaxpayer: { limit: 12, windowMs: WINDOW },\n loginIntermediary: { limit: 12, windowMs: WINDOW },\n submitDocuments: { limit: 100, windowMs: WINDOW },\n getSubmission: { limit: 300, windowMs: WINDOW },\n cancelDocument: { limit: 12, windowMs: WINDOW },\n rejectDocument: { limit: 12, windowMs: WINDOW },\n getDocument: { limit: 60, windowMs: WINDOW },\n getDocumentDetails: { limit: 125, windowMs: WINDOW },\n getRecentDocuments: { limit: 12, windowMs: WINDOW },\n searchDocuments: { limit: 12, windowMs: WINDOW },\n searchTin: { limit: 60, windowMs: WINDOW },\n taxpayerQr: { limit: 60, windowMs: WINDOW },\n default: { limit: 10_000, windowMs: WINDOW }, // effectively no limit\n}\n\n/**\n * A very small sliding-window rate-limiter with queuing.\n * Each category gets its own instance so limits are isolated.\n */\nclass RateLimiter {\n private readonly limit: number\n private readonly windowMs: number\n private queue: Array<() => void> = []\n private timestamps: number[] = []\n private timer: NodeJS.Timeout | null = null\n\n constructor(config: RateLimitConfig) {\n this.limit = config.limit\n this.windowMs = config.windowMs\n }\n\n private drainQueue() {\n if (this.queue.length === 0) {\n return\n }\n\n const now = Date.now()\n // Purge stale timestamps (older than window)\n this.timestamps = this.timestamps.filter(ts => now - ts < this.windowMs)\n\n if (this.timestamps.length >= this.limit) {\n // We are currently rate-limited – schedule a retry when the earliest call exits the window\n const earliest = this.timestamps[0]!\n const delay = this.windowMs - (now - earliest) + 1 // +1ms buffer\n if (!this.timer) {\n this.timer = setTimeout(() => {\n this.timer = null\n this.drainQueue()\n }, delay)\n }\n return\n }\n\n // We can process at least one queued request now\n const next = this.queue.shift()!\n this.timestamps.push(now)\n next()\n\n // Recursively drain (in case there is remaining capacity)\n this.drainQueue()\n }\n\n get queueSize() {\n return this.queue.length\n }\n\n schedule<T>(\n fn: () => Promise<T>,\n debug: boolean = false,\n category?: ApiCategory,\n ): Promise<T> {\n return new Promise((resolve, reject) => {\n const execute = () => {\n if (debug && category) {\n console.log(\n `[apiQueue] ▶️ Executing request (${category}). Remaining queue: ${this.queue.length}`,\n )\n }\n fn().then(resolve).catch(reject)\n }\n\n if (debug && category) {\n console.log(\n `[apiQueue] ⏳ Queued request (${category}). Queue length before push: ${this.queue.length}`,\n )\n }\n\n this.queue.push(execute)\n this.drainQueue()\n })\n }\n}\n\n// A shared registry of limiters keyed by category\nconst limiterRegistry = new Map<ApiCategory, RateLimiter>()\n\nfunction getLimiter(category: ApiCategory): RateLimiter {\n if (!limiterRegistry.has(category)) {\n limiterRegistry.set(category, new RateLimiter(RATE_LIMITS[category]))\n }\n // Non-null because we just set it if missing.\n return limiterRegistry.get(category) as RateLimiter\n}\n\n/**\n * Public helper to schedule a request according to the category's limits.\n */\nexport function queueRequest<T>(\n category: ApiCategory,\n fn: () => Promise<T>,\n debug: boolean = false,\n): Promise<T> {\n const limiter = getLimiter(category)\n return limiter.schedule(fn, debug, category)\n}\n\n/**\n * Very naive path-based category detection. If no matcher fits, the `default` category\n * (effectively unlimited) is returned. Adjust these heuristics as your API surface evolves.\n */\nexport function categorizeRequest(\n path: string,\n method: string = 'GET',\n): ApiCategory {\n const cleanPath = path.toLowerCase()\n const isPost = method?.toUpperCase() === 'POST'\n\n if (cleanPath.includes('/documentsubmissions')) {\n return isPost ? 'submitDocuments' : 'getSubmission'\n }\n\n if (cleanPath.includes('/documentmanagement')) {\n if (cleanPath.endsWith('/cancel')) return 'cancelDocument'\n if (cleanPath.endsWith('/reject')) return 'rejectDocument'\n if (cleanPath.endsWith('/details')) return 'getDocumentDetails'\n if (cleanPath.includes('/recent')) return 'getRecentDocuments'\n // Fallbacks inside document management\n return method === 'GET' ? 'getDocument' : 'searchDocuments'\n }\n\n if (cleanPath.includes('/searchtin')) return 'searchTin'\n if (cleanPath.includes('/qrcode')) return 'taxpayerQr'\n if (cleanPath.includes('/connect/token')) {\n // Distinguish between taxpayer & intermediary based on path hint if possible\n return 'loginTaxpayer'\n }\n\n return 'default'\n}\n"],"mappings":";;AA4CA,MAAM,SAAS;AAGf,MAAMA,cAAoD;CACxD,eAAe;EAAE,OAAO;EAAI,UAAU;CAAQ;CAC9C,mBAAmB;EAAE,OAAO;EAAI,UAAU;CAAQ;CAClD,iBAAiB;EAAE,OAAO;EAAK,UAAU;CAAQ;CACjD,eAAe;EAAE,OAAO;EAAK,UAAU;CAAQ;CAC/C,gBAAgB;EAAE,OAAO;EAAI,UAAU;CAAQ;CAC/C,gBAAgB;EAA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async function submitDocument(context, documents) {
|
|
5
5
|
const { fetch: fetch$1, debug, signingCredentials } = context;
|
|
6
|
+
if (documents.length > 100) throw new Error("Submission rejected: Cannot submit more than 100 documents at once");
|
|
6
7
|
if (debug) console.log(`📦 Preparing to submit ${documents.length} document(s)...`);
|
|
7
8
|
const crypto = await import("crypto");
|
|
8
9
|
const submissionPayload = { documents: await Promise.all(documents.map(async (doc) => {
|
|
@@ -10,6 +11,8 @@ async function submitDocument(context, documents) {
|
|
|
10
11
|
const docJson = JSON.stringify(signedDocument);
|
|
11
12
|
const docHash = crypto.createHash("sha256").update(docJson, "utf8").digest("hex");
|
|
12
13
|
const docBase64 = Buffer.from(docJson, "utf8").toString("base64");
|
|
14
|
+
const rawSize = Buffer.byteLength(docBase64, "base64");
|
|
15
|
+
if (rawSize > 300 * 1024) throw new Error(`Submission rejected: Document ${doc.eInvoiceCodeOrNumber} is ${rawSize} bytes – exceeds 300KB limit`);
|
|
13
16
|
if (debug) {
|
|
14
17
|
console.log("—".repeat(60));
|
|
15
18
|
console.log(`📄 Prepared document: ${doc.eInvoiceCodeOrNumber}`);
|
|
@@ -23,18 +26,13 @@ async function submitDocument(context, documents) {
|
|
|
23
26
|
codeNumber: doc.eInvoiceCodeOrNumber
|
|
24
27
|
};
|
|
25
28
|
})) };
|
|
29
|
+
const payloadSize = Buffer.byteLength(JSON.stringify(submissionPayload));
|
|
30
|
+
if (payloadSize > 5 * 1024 * 1024) throw new Error(`Submission rejected: Payload is ${payloadSize} bytes – exceeds 5MB limit`);
|
|
26
31
|
if (debug) {
|
|
27
32
|
console.log("🚀 Submission payload structure:");
|
|
28
33
|
console.log("- Format: JSON");
|
|
29
34
|
console.log("- Documents count:", submissionPayload.documents.length);
|
|
30
|
-
console.log("- Total payload size:",
|
|
31
|
-
const payloadSize = JSON.stringify(submissionPayload).length;
|
|
32
|
-
if (payloadSize > 5 * 1024 * 1024) console.warn("⚠️ WARNING: Payload size exceeds 5MB limit");
|
|
33
|
-
if (documents.length > 100) console.warn("⚠️ WARNING: Document count exceeds 100 document limit");
|
|
34
|
-
submissionPayload.documents.forEach((d) => {
|
|
35
|
-
const size = Buffer.from(d.document, "base64").length;
|
|
36
|
-
if (size > 300 * 1024) console.warn(`⚠️ WARNING: Document ${d.codeNumber} size (${size} bytes) exceeds 300KB limit`);
|
|
37
|
-
});
|
|
35
|
+
console.log("- Total payload size:", payloadSize, "bytes");
|
|
38
36
|
}
|
|
39
37
|
const response = await fetch$1("/api/v1.0/documentsubmissions", {
|
|
40
38
|
method: "POST",
|
|
@@ -3,6 +3,7 @@ const require_document = require('./document-D7LLOhCD.cjs');
|
|
|
3
3
|
//#region src/api/documentSubmission.ts
|
|
4
4
|
async function submitDocument(context, documents) {
|
|
5
5
|
const { fetch: fetch$1, debug, signingCredentials } = context;
|
|
6
|
+
if (documents.length > 100) throw new Error("Submission rejected: Cannot submit more than 100 documents at once");
|
|
6
7
|
if (debug) console.log(`📦 Preparing to submit ${documents.length} document(s)...`);
|
|
7
8
|
const crypto = await import("crypto");
|
|
8
9
|
const submissionPayload = { documents: await Promise.all(documents.map(async (doc) => {
|
|
@@ -10,6 +11,8 @@ async function submitDocument(context, documents) {
|
|
|
10
11
|
const docJson = JSON.stringify(signedDocument);
|
|
11
12
|
const docHash = crypto.createHash("sha256").update(docJson, "utf8").digest("hex");
|
|
12
13
|
const docBase64 = Buffer.from(docJson, "utf8").toString("base64");
|
|
14
|
+
const rawSize = Buffer.byteLength(docBase64, "base64");
|
|
15
|
+
if (rawSize > 300 * 1024) throw new Error(`Submission rejected: Document ${doc.eInvoiceCodeOrNumber} is ${rawSize} bytes – exceeds 300KB limit`);
|
|
13
16
|
if (debug) {
|
|
14
17
|
console.log("—".repeat(60));
|
|
15
18
|
console.log(`📄 Prepared document: ${doc.eInvoiceCodeOrNumber}`);
|
|
@@ -23,18 +26,13 @@ async function submitDocument(context, documents) {
|
|
|
23
26
|
codeNumber: doc.eInvoiceCodeOrNumber
|
|
24
27
|
};
|
|
25
28
|
})) };
|
|
29
|
+
const payloadSize = Buffer.byteLength(JSON.stringify(submissionPayload));
|
|
30
|
+
if (payloadSize > 5 * 1024 * 1024) throw new Error(`Submission rejected: Payload is ${payloadSize} bytes – exceeds 5MB limit`);
|
|
26
31
|
if (debug) {
|
|
27
32
|
console.log("🚀 Submission payload structure:");
|
|
28
33
|
console.log("- Format: JSON");
|
|
29
34
|
console.log("- Documents count:", submissionPayload.documents.length);
|
|
30
|
-
console.log("- Total payload size:",
|
|
31
|
-
const payloadSize = JSON.stringify(submissionPayload).length;
|
|
32
|
-
if (payloadSize > 5 * 1024 * 1024) console.warn("⚠️ WARNING: Payload size exceeds 5MB limit");
|
|
33
|
-
if (documents.length > 100) console.warn("⚠️ WARNING: Document count exceeds 100 document limit");
|
|
34
|
-
submissionPayload.documents.forEach((d) => {
|
|
35
|
-
const size = Buffer.from(d.document, "base64").length;
|
|
36
|
-
if (size > 300 * 1024) console.warn(`⚠️ WARNING: Document ${d.codeNumber} size (${size} bytes) exceeds 300KB limit`);
|
|
37
|
-
});
|
|
35
|
+
console.log("- Total payload size:", payloadSize, "bytes");
|
|
38
36
|
}
|
|
39
37
|
const response = await fetch$1("/api/v1.0/documentsubmissions", {
|
|
40
38
|
method: "POST",
|
|
@@ -147,4 +145,4 @@ Object.defineProperty(exports, 'submitDocument', {
|
|
|
147
145
|
return submitDocument;
|
|
148
146
|
}
|
|
149
147
|
});
|
|
150
|
-
//# sourceMappingURL=documentSubmission-
|
|
148
|
+
//# sourceMappingURL=documentSubmission-ys1hH7jn.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentSubmission-ys1hH7jn.cjs","names":["context: SubmissionContext","documents: AllDocumentsV1_1[]","context: Pick<SubmissionContext, 'fetch' | 'debug'>","submissionUid: string","pollInterval: number","maxRetries: number","documentUid: string","status: 'rejected' | 'cancelled'","reason: string"],"sources":["../src/api/documentSubmission.ts"],"sourcesContent":["import type {\n AllDocumentsV1_1,\n SubmissionResponse,\n SigningCredentials,\n SubmissionStatus,\n DocumentSummary,\n Fetch,\n StandardError,\n} from '../types'\nimport { generateCompleteDocument } from '../utils/document'\n\ninterface SubmissionContext {\n fetch: Fetch\n debug: boolean\n signingCredentials: SigningCredentials\n}\n\nexport async function submitDocument(\n context: SubmissionContext,\n documents: AllDocumentsV1_1[],\n): Promise<{\n data: SubmissionResponse\n status: number\n}> {\n const { fetch, debug, signingCredentials } = context\n\n // 🔒 Hard enforcement of platform submission limits\n if (documents.length > 100) {\n throw new Error(\n 'Submission rejected: Cannot submit more than 100 documents at once',\n )\n }\n\n if (debug) {\n console.log(`📦 Preparing to submit ${documents.length} document(s)...`)\n }\n\n // For batch submission, each document must be signed and encoded separately\n // Build the submission payload according to MyInvois API format\n const crypto = await import('crypto')\n\n const submissionPayload = {\n documents: await Promise.all(\n documents.map(async doc => {\n // 1️⃣ Sign the single document (generateCompleteDocument expects an array)\n const signedDocument = generateCompleteDocument(\n [doc],\n signingCredentials,\n )\n\n // 2️⃣ Serialize\n const docJson = JSON.stringify(signedDocument)\n\n // 3️⃣ Hash\n const docHash = crypto\n .createHash('sha256')\n .update(docJson, 'utf8')\n .digest('hex')\n\n // 4️⃣ Base64 encode\n const docBase64 = Buffer.from(docJson, 'utf8').toString('base64')\n\n // 🚨 Enforce 300 KB per-document limit\n const rawSize = Buffer.byteLength(docBase64, 'base64')\n if (rawSize > 300 * 1024) {\n throw new Error(\n `Submission rejected: Document ${doc.eInvoiceCodeOrNumber} is ${rawSize} bytes – exceeds 300KB limit`,\n )\n }\n\n if (debug) {\n console.log('—'.repeat(60))\n console.log(`📄 Prepared document: ${doc.eInvoiceCodeOrNumber}`)\n console.log(` • JSON size : ${docJson.length} bytes`)\n console.log(` • Base64 size: ${docBase64.length} bytes`)\n }\n\n return {\n format: 'JSON',\n document: docBase64,\n documentHash: docHash,\n codeNumber: doc.eInvoiceCodeOrNumber,\n }\n }),\n ),\n }\n\n const payloadSize = Buffer.byteLength(JSON.stringify(submissionPayload))\n\n if (payloadSize > 5 * 1024 * 1024) {\n throw new Error(\n `Submission rejected: Payload is ${payloadSize} bytes – exceeds 5MB limit`,\n )\n }\n\n if (debug) {\n console.log('🚀 Submission payload structure:')\n console.log('- Format: JSON')\n console.log('- Documents count:', submissionPayload.documents.length)\n console.log('- Total payload size:', payloadSize, 'bytes')\n }\n\n // Submit to MyInvois API with proper headers\n const response = await fetch('/api/v1.0/documentsubmissions', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(submissionPayload),\n })\n\n const responseData = (await response.json()) as SubmissionResponse\n\n if (debug) {\n console.log(`📡 API Response status: ${response.status}`)\n\n if (responseData.rejectedDocuments?.length > 0) {\n responseData.rejectedDocuments.forEach((doc, index) => {\n console.log(` Document ${index + 1}:`, doc.invoiceCodeNumber)\n if (doc.error) {\n console.log(` Error:`, doc.error.message)\n if (doc.error.details) {\n doc.error.details.forEach((detail, detailIndex) => {\n console.log(` Detail ${detailIndex + 1}:`, detail.message)\n })\n }\n }\n })\n }\n }\n\n const data = responseData as SubmissionResponse\n\n if (debug) {\n if (response.status !== 202) {\n console.error('❌ Submission failed with status:', response.status)\n console.error('❌ Response data:', data)\n } else {\n console.log('✅ Submission successful!')\n console.log(`📋 Submission UID: ${data.submissionUid}`)\n console.log(\n `✅ Accepted documents: ${data.acceptedDocuments?.length || 0}`,\n )\n console.log(\n `❌ Rejected documents: ${data.rejectedDocuments?.length || 0}`,\n )\n }\n }\n\n return {\n data,\n status: response.status,\n }\n}\n\nexport async function getSubmissionStatus(\n context: Pick<SubmissionContext, 'fetch' | 'debug'>,\n submissionUid: string,\n pollInterval: number = 1000,\n maxRetries: number = 10,\n): Promise<{\n status: SubmissionStatus\n documentSummary?: DocumentSummary[]\n error?: {\n code: string\n message: string | null\n target: string\n details: {\n code: string\n message: string\n target: string\n }[]\n }\n}> {\n const { fetch, debug } = context\n\n try {\n const response = await fetch(\n `/api/v1.0/documentsubmissions/${submissionUid}`,\n )\n\n const data = await response.json()\n\n if (debug) {\n console.log('Submission:', data)\n if (data.error) {\n console.log('Submission error details:', data.error.details)\n }\n }\n\n // If we have a successful response and status is completed, return success\n if (data.overallStatus === 'Valid') {\n return {\n status: data.overallStatus,\n documentSummary: data.documentSummary,\n }\n }\n if (data.overallStatus === 'Invalid') {\n return {\n status: 'Invalid',\n documentSummary: data.documentSummary,\n }\n }\n\n // If we have retries left, continue polling for any non-completed status or errors\n if (maxRetries > 0) {\n await new Promise(resolve => setTimeout(resolve, pollInterval))\n return await getSubmissionStatus(\n context,\n submissionUid,\n pollInterval,\n maxRetries - 1,\n )\n }\n\n // No retries left - return timeout\n return {\n status: 'Invalid',\n error: {\n code: 'Timeout',\n message: 'Submission timed out',\n target: 'submission',\n details: [],\n },\n }\n } catch (error) {\n // Handle any request errors by retrying if we have retries left\n if (maxRetries > 0) {\n if (debug) {\n console.log('Request error, retrying...', error)\n }\n await new Promise(resolve => setTimeout(resolve, pollInterval))\n return await getSubmissionStatus(\n context,\n submissionUid,\n pollInterval,\n maxRetries - 1,\n )\n }\n\n // No retries left - return timeout\n return {\n status: 'Invalid',\n error: {\n code: 'Timeout',\n message: 'Submission timed out after request errors',\n target: 'submission',\n details: [],\n },\n }\n }\n}\n\nexport async function performDocumentAction(\n documentUid: string,\n status: 'rejected' | 'cancelled',\n reason: string,\n): Promise<{\n uuid: string\n status: string\n error: StandardError\n}> {\n const response = await fetch(\n `/api/v1.0/documents/state/${documentUid}/state`,\n {\n method: 'POST',\n body: JSON.stringify({\n status,\n reason,\n }),\n },\n )\n\n const data = (await response.json()) as {\n uuid: string\n status: string\n error: StandardError\n }\n\n return data\n}\n"],"mappings":";;;AAiBA,eAAsB,eACpBA,SACAC,WAIC;CACD,MAAM,EAAE,gBAAO,OAAO,oBAAoB,GAAG;AAG7C,KAAI,UAAU,SAAS,IACrB,OAAM,IAAI,MACR;AAIJ,KAAI,MACF,SAAQ,KAAK,yBAAyB,UAAU,OAAO,iBAAiB;CAK1E,MAA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ACzB,QAAO;GACL,QAAQ;GACR,iBAAiB,KAAK;EACvB;AAIH,MAAI,aAAa,GAAG;AAClB,SAAM,IAAI,QAAQ,aAAW,WAAW,SAAS,aAAa;AAC9D,UAAO,MAAM,oBACX,SACA,eACA,cACA,aAAa,EACd;EACF;AAGD,SAAO;GACL,QAAQ;GACR,OAAO;IACL,MAAM;IACN,SAAS;IACT,QAAQ;IACR,SAAS,CAAE;GACZ;EACF;CACF,SAAQ,OAAO;AAEd,MAAI,aAAa,GAAG;AAClB,OAAI,MACF,SAAQ,IAAI,8BAA8B,MAAM;AAElD,SAAM,IAAI,QAAQ,aAAW,WAAW,SAAS,aAAa;AAC9D,UAAO,MAAM,oBACX,SACA,eACA,cACA,aAAa,EACd;EACF;AAGD,SAAO;GACL,QAAQ;GACR,OAAO;IACL,MAAM;IACN,SAAS;IACT,QAAQ;IACR,SAAS,CAAE;GACZ;EACF;CACF;AACF;AAED,eAAsB,sBACpBC,aACAC,QACAC,QAKC;CACD,MAAM,WAAW,MAAM,OACpB,4BAA4B,YAAY,SACzC;EACE,QAAQ;EACR,MAAM,KAAK,UAAU;GACnB;GACA;EACD,EAAC;CACH,EACF;CAED,MAAM,OAAQ,MAAM,SAAS,MAAM;AAMnC,QAAO;AACR"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ClassificationCode } from "./classification-codes-
|
|
2
|
-
import { CountryCode } from "./country-code-
|
|
3
|
-
import { CurrencyCode } from "./currencies-
|
|
4
|
-
import { EInvoiceTypeCode } from "./e-invoice-
|
|
5
|
-
import { MSICCode } from "./msic-codes-
|
|
6
|
-
import { TaxTypeCode } from "./tax-types-
|
|
7
|
-
import { StateCode } from "./state-codes-
|
|
8
|
-
import { UnitTypeCode } from "./unit-types-
|
|
1
|
+
import { ClassificationCode } from "./classification-codes-C2X4xW5-.js";
|
|
2
|
+
import { CountryCode } from "./country-code-DsI8Mbzx.js";
|
|
3
|
+
import { CurrencyCode } from "./currencies-DKuDflOO.js";
|
|
4
|
+
import { EInvoiceTypeCode } from "./e-invoice-C2TxhyrK.js";
|
|
5
|
+
import { MSICCode } from "./msic-codes-CjrrJmzb.js";
|
|
6
|
+
import { TaxTypeCode } from "./tax-types-ClyLgydM.js";
|
|
7
|
+
import { StateCode } from "./state-codes-Ow4oehYT.js";
|
|
8
|
+
import { UnitTypeCode } from "./unit-types-VgYXIwTT.js";
|
|
9
9
|
|
|
10
10
|
//#region src/types/documents.d.ts
|
|
11
11
|
type RegistrationType = 'BRN' | 'NRIC' | 'PASSPORT' | 'ARMY';
|
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
const require_documentManagement = require('./documentManagement-DQ7JEcBq.cjs');
|
|
2
2
|
require('./formatIdValue-i67o4kyD.cjs');
|
|
3
3
|
require('./document-D7LLOhCD.cjs');
|
|
4
|
-
const require_documentSubmission = require('./documentSubmission-
|
|
4
|
+
const require_documentSubmission = require('./documentSubmission-ys1hH7jn.cjs');
|
|
5
5
|
const require_documentTypeManagement = require('./documentTypeManagement-D_-LiQVg.cjs');
|
|
6
6
|
const require_notificationManagement = require('./notificationManagement-DLBDn77E.cjs');
|
|
7
7
|
const require_platformLogin = require('./platformLogin-Ch6hFKoU.cjs');
|
|
8
8
|
const require_taxpayerValidation = require('./taxpayerValidation-D_jGaVty.cjs');
|
|
9
9
|
const require_certificate = require('./certificate-CLmh3bGS.cjs');
|
|
10
10
|
const require_getBaseUrl = require('./getBaseUrl-D0G4GZmp.cjs');
|
|
11
|
+
const require_apiQueue = require('./apiQueue-sL4mNlVz.cjs');
|
|
11
12
|
|
|
12
13
|
//#region src/index.ts
|
|
13
14
|
var MyInvoisClient = class {
|
|
@@ -58,13 +59,14 @@ var MyInvoisClient = class {
|
|
|
58
59
|
}
|
|
59
60
|
async fetch(path, options = {}) {
|
|
60
61
|
const token = await this.getToken();
|
|
61
|
-
|
|
62
|
+
const category = require_apiQueue.categorizeRequest(path, options?.method);
|
|
63
|
+
return require_apiQueue.queueRequest(category, () => fetch(`${this.baseUrl}${path}`, {
|
|
62
64
|
...options,
|
|
63
65
|
headers: {
|
|
64
66
|
...options.headers,
|
|
65
67
|
Authorization: `Bearer ${token}`
|
|
66
68
|
}
|
|
67
|
-
});
|
|
69
|
+
}), this.debug);
|
|
68
70
|
}
|
|
69
71
|
/**
|
|
70
72
|
* Validates a TIN against a NRIC/ARMY/PASSPORT/BRN (Business Registration Number)
|