@ripwords/myinvois-client 0.3.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/{apiQueue-DgKWaQDS.cjs → apiQueue-C45w-ymm.cjs} +1 -1
- package/dist/{apiQueue-DgKWaQDS.cjs.map → apiQueue-C45w-ymm.cjs.map} +1 -1
- package/dist/{certificate-CWmfCPdt.cjs → certificate-Dw46fkYv.cjs} +5 -31
- package/dist/certificate-Dw46fkYv.cjs.map +1 -0
- package/dist/{document-B6ab06s1.cjs → document-B11B5lqd.cjs} +75 -21
- package/dist/document-B11B5lqd.cjs.map +1 -0
- package/dist/{documentManagement-BviJDtf2.cjs → documentManagement-qJnd0l1z.cjs} +3 -2
- package/dist/documentManagement-qJnd0l1z.cjs.map +1 -0
- package/dist/{documentSubmission-C-v4_4-x.cjs → documentSubmission-BaPECvYU.cjs} +5 -5
- package/dist/{documentSubmission-C-v4_4-x.cjs.map → documentSubmission-BaPECvYU.cjs.map} +1 -1
- package/dist/{documentTypeManagement-D_-LiQVg.cjs → documentTypeManagement-DXRLfTsW.cjs} +1 -1
- package/dist/{documentTypeManagement-D_-LiQVg.cjs.map → documentTypeManagement-DXRLfTsW.cjs.map} +1 -1
- package/dist/{getBaseUrl-D0G4GZmp.cjs → getBaseUrl-D2iJdUGL.cjs} +1 -1
- package/dist/{getBaseUrl-D0G4GZmp.cjs.map → getBaseUrl-D2iJdUGL.cjs.map} +1 -1
- package/dist/index.cjs +14 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index10.cjs +4 -2
- package/dist/index11.cjs +1 -1
- package/dist/index13.cjs +1 -1
- package/dist/index14.cjs +2 -329
- package/dist/index15.cjs +308 -172
- package/dist/index15.cjs.map +1 -1
- package/dist/index16.cjs +187 -56
- package/dist/index16.cjs.map +1 -1
- package/dist/index17.cjs +53 -523
- package/dist/index17.cjs.map +1 -1
- package/dist/index18.cjs +523 -187
- package/dist/index18.cjs.map +1 -1
- package/dist/index19.cjs +196 -0
- package/dist/index19.cjs.map +1 -0
- package/dist/index2.cjs +1 -1
- package/dist/index20.cjs +0 -25
- package/dist/index21.cjs +25 -0
- package/dist/{index20.cjs.map → index21.cjs.map} +1 -1
- package/dist/index23.cjs +0 -29
- package/dist/index24.cjs +24 -20
- package/dist/index24.cjs.map +1 -1
- package/dist/index25.cjs +25 -0
- package/dist/index25.cjs.map +1 -0
- package/dist/index26.cjs +0 -34
- package/dist/index27.cjs +25 -15
- package/dist/index27.cjs.map +1 -1
- package/dist/index28.cjs +24 -0
- package/dist/index28.cjs.map +1 -0
- package/dist/index3.cjs +2 -2
- package/dist/index31.cjs +0 -208
- package/dist/index32.cjs +203 -104
- package/dist/index32.cjs.map +1 -1
- package/dist/index33.cjs +104 -132
- package/dist/index33.cjs.map +1 -1
- package/dist/index34.cjs +132 -59
- package/dist/index34.cjs.map +1 -1
- package/dist/index35.cjs +59 -262
- package/dist/index35.cjs.map +1 -1
- package/dist/index36.cjs +262 -74
- package/dist/index36.cjs.map +1 -1
- package/dist/index37.cjs +74 -102
- package/dist/index37.cjs.map +1 -1
- package/dist/index38.cjs +102 -68
- package/dist/index38.cjs.map +1 -1
- package/dist/index39.cjs +68 -107
- package/dist/index39.cjs.map +1 -1
- package/dist/index4.cjs +1 -1
- package/dist/index40.cjs +107 -95
- package/dist/index40.cjs.map +1 -1
- package/dist/index41.cjs +95 -13
- package/dist/index41.cjs.map +1 -1
- package/dist/index42.cjs +11 -31
- package/dist/index42.cjs.map +1 -1
- package/dist/index43.cjs +31 -12
- package/dist/index43.cjs.map +1 -1
- package/dist/index44.cjs +12 -22
- package/dist/index44.cjs.map +1 -1
- package/dist/index45.cjs +22 -13
- package/dist/index45.cjs.map +1 -1
- package/dist/index46.cjs +13 -7
- package/dist/index46.cjs.map +1 -1
- package/dist/index47.cjs +7 -7
- package/dist/index47.cjs.map +1 -1
- package/dist/index48.cjs +7 -10
- package/dist/index48.cjs.map +1 -1
- package/dist/index49.cjs +10 -6
- package/dist/index49.cjs.map +1 -1
- package/dist/index5.cjs +1 -1
- package/dist/index50.cjs +6 -101
- package/dist/index50.cjs.map +1 -1
- package/dist/index51.cjs +101 -106
- package/dist/index51.cjs.map +1 -1
- package/dist/index52.cjs +106 -119
- package/dist/index52.cjs.map +1 -1
- package/dist/index53.cjs +119 -106
- package/dist/index53.cjs.map +1 -1
- package/dist/index54.cjs +106 -98
- package/dist/index54.cjs.map +1 -1
- package/dist/index55.cjs +98 -118
- package/dist/index55.cjs.map +1 -1
- package/dist/index56.cjs +118 -127
- package/dist/index56.cjs.map +1 -1
- package/dist/index57.cjs +127 -117
- package/dist/index57.cjs.map +1 -1
- package/dist/index58.cjs +117 -14
- package/dist/index58.cjs.map +1 -1
- package/dist/index59.cjs +14 -95
- package/dist/index59.cjs.map +1 -1
- package/dist/index6.cjs +1 -1
- package/dist/index60.cjs +95 -142
- package/dist/index60.cjs.map +1 -1
- package/dist/index61.cjs +142 -114
- package/dist/index61.cjs.map +1 -1
- package/dist/index62.cjs +114 -144
- package/dist/index62.cjs.map +1 -1
- package/dist/index63.cjs +144 -113
- package/dist/index63.cjs.map +1 -1
- package/dist/index64.cjs +113 -17
- package/dist/index64.cjs.map +1 -1
- package/dist/index65.cjs +17 -112
- package/dist/index65.cjs.map +1 -1
- package/dist/index66.cjs +112 -47
- package/dist/index66.cjs.map +1 -1
- package/dist/index67.cjs +47 -14
- package/dist/index67.cjs.map +1 -1
- package/dist/index68.cjs +14 -28
- package/dist/index68.cjs.map +1 -1
- package/dist/index69.cjs +28 -22
- package/dist/index69.cjs.map +1 -1
- package/dist/index7.cjs +1 -1
- package/dist/index70.cjs +22 -9
- package/dist/index70.cjs.map +1 -1
- package/dist/index71.cjs +9 -8
- package/dist/index71.cjs.map +1 -1
- package/dist/index72.cjs +8 -17
- package/dist/index72.cjs.map +1 -1
- package/dist/index73.cjs +17 -412
- package/dist/index73.cjs.map +1 -1
- package/dist/index74.cjs +412 -8
- package/dist/index74.cjs.map +1 -1
- package/dist/index75.cjs +8 -9
- package/dist/index75.cjs.map +1 -1
- package/dist/index76.cjs +16 -0
- package/dist/index76.cjs.map +1 -0
- package/dist/index8.cjs +1 -1
- package/dist/lineItems-C8iT0OL1.cjs +64 -0
- package/dist/lineItems-C8iT0OL1.cjs.map +1 -0
- package/dist/{notificationManagement-DLBDn77E.cjs → notificationManagement-C_qrFwWL.cjs} +1 -1
- package/dist/{notificationManagement-DLBDn77E.cjs.map → notificationManagement-C_qrFwWL.cjs.map} +1 -1
- package/dist/{platformLogin-Ch6hFKoU.cjs → platformLogin-DC4s6Qpv.cjs} +1 -1
- package/dist/{platformLogin-Ch6hFKoU.cjs.map → platformLogin-DC4s6Qpv.cjs.map} +1 -1
- package/dist/{taxpayerValidation-j8s6YGED.cjs → taxpayerValidation-DzCJROgP.cjs} +1 -1
- package/dist/{taxpayerValidation-j8s6YGED.cjs.map → taxpayerValidation-DzCJROgP.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/0X-Cr3M7hci.d.cts +0 -211
- package/dist/0X-qj3c_vAo.d.ts +0 -210
- package/dist/1X-B-lyAVC4.d.ts +0 -111
- package/dist/1X-C72Wa4pk.d.ts +0 -19
- package/dist/1X-CWwmfCzo.d.cts +0 -112
- package/dist/1X-DYw2tURz.d.cts +0 -20
- package/dist/2X-BfCK614i.d.ts +0 -139
- package/dist/2X-CH89y3Af.d.ts +0 -39
- package/dist/2X-CXtqiwRg.d.cts +0 -40
- package/dist/2X-DNtkJ0tj.d.cts +0 -140
- package/dist/3X-BOxfatu3.d.cts +0 -62
- package/dist/3X-Bk_fUIAk.d.cts +0 -21
- package/dist/3X-DryrwYRf.d.ts +0 -20
- package/dist/3X-Du10Ix_V.d.ts +0 -61
- package/dist/4X-BPMLRoDv.d.ts +0 -30
- package/dist/4X-C7fzDWJ_.d.cts +0 -265
- package/dist/4X-CK9rj5qd.d.cts +0 -31
- package/dist/4X-x3cRFuSM.d.ts +0 -264
- package/dist/5X-B52AKeTz.d.ts +0 -76
- package/dist/5X-Bv7M6KyG.d.ts +0 -21
- package/dist/5X-CNAFsDm2.d.cts +0 -77
- package/dist/5X-CpAvNxvd.d.cts +0 -22
- package/dist/6X-DBwpWPQ6.d.ts +0 -104
- package/dist/6X-ZeZ8OB57.d.ts +0 -15
- package/dist/6X-bXWr_7xY.d.cts +0 -16
- package/dist/6X-uObUP4VG.d.cts +0 -105
- package/dist/7X-BJBOlWhV.d.cts +0 -16
- package/dist/7X-BifJnY24.d.cts +0 -71
- package/dist/7X-C_XGDSpE.d.ts +0 -70
- package/dist/7X-Dvw2Z2VN.d.ts +0 -15
- package/dist/8X-BkgoX8dg.d.ts +0 -18
- package/dist/8X-Di_0wuRX.d.ts +0 -109
- package/dist/8X-DioBXCJ0.d.cts +0 -110
- package/dist/8X-dshwiOxU.d.cts +0 -19
- package/dist/9X-8ZnvvViY.d.ts +0 -97
- package/dist/9X-9j2Djy4W.d.cts +0 -15
- package/dist/9X-BjffnXuq.d.cts +0 -98
- package/dist/9X-Du0e44cq.d.ts +0 -14
- package/dist/AX-BSPLpkVT.d.ts +0 -110
- package/dist/AX-CWCopjCC.d.cts +0 -111
- package/dist/BX-Cq7WdhD3.d.cts +0 -115
- package/dist/BX-u4yMaIkz.d.ts +0 -114
- package/dist/CX-BKZG0pVE.d.ts +0 -127
- package/dist/CX-DlcVZfxx.d.cts +0 -128
- package/dist/DX-CwA9WJAf.d.ts +0 -114
- package/dist/DX-DLdv-Nxj.d.cts +0 -115
- package/dist/EX-BRNu1Ooi.d.ts +0 -106
- package/dist/EX-CIJv8-Lw.d.cts +0 -107
- package/dist/FX-DBxjq6xY.d.ts +0 -126
- package/dist/FX-DlDM_Zea.d.cts +0 -127
- package/dist/GX-B3CvWNrP.d.ts +0 -135
- package/dist/GX-BFGNX6Jy.d.cts +0 -136
- package/dist/HX-D7FABgTv.d.ts +0 -125
- package/dist/HX-D7Y9qRSm.d.cts +0 -126
- package/dist/IX-D3ZknsAB.d.ts +0 -22
- package/dist/IX-DPTrbhgX.d.cts +0 -23
- package/dist/JX-BRaZM3Gc.d.ts +0 -103
- package/dist/JX-D8JmtNpo.d.cts +0 -104
- package/dist/KX-B1K0OWoi.d.ts +0 -150
- package/dist/KX-B46KJZrH.d.cts +0 -151
- package/dist/LX-CKRefinL.d.ts +0 -122
- package/dist/LX-CfTKy8Sx.d.cts +0 -123
- package/dist/MX-BKJ4gNvV.d.cts +0 -153
- package/dist/MX-DKmaeO9r.d.ts +0 -152
- package/dist/NX-CJL2Gn1U.d.ts +0 -121
- package/dist/NX-CSdLIFqU.d.cts +0 -122
- package/dist/OX-BwqOsulT.d.cts +0 -26
- package/dist/OX-Do2ap5v_.d.ts +0 -25
- package/dist/PX-BTx0TXsJ.d.cts +0 -121
- package/dist/PX-_DOr_rm9.d.ts +0 -120
- package/dist/QX-BUXR8RJL.d.cts +0 -59
- package/dist/QX-HlXLkIki.d.ts +0 -58
- package/dist/RX-CZ8HiH37.d.cts +0 -23
- package/dist/RX-DVPGOVES.d.ts +0 -22
- package/dist/SX-CLxsqiQk.d.cts +0 -40
- package/dist/SX-OGT3qwlS.d.ts +0 -39
- package/dist/TX-DKc8hLc4.d.cts +0 -31
- package/dist/TX-cPDINmZ5.d.ts +0 -30
- package/dist/UX-Be3sqvPV.d.ts +0 -17
- package/dist/UX-bc7xDnZI.d.cts +0 -18
- package/dist/VX-CIHTFyoC.d.cts +0 -17
- package/dist/VX-CoEuBNDK.d.ts +0 -16
- package/dist/WX-BHvlq7Jx.d.cts +0 -26
- package/dist/WX-DMvw__jH.d.ts +0 -25
- package/dist/XX-DOA-10JW.d.ts +0 -827
- package/dist/XX-DztQxYHJ.d.cts +0 -828
- package/dist/YX-CkxLeFb4.d.cts +0 -20
- package/dist/YX-F34sJ7Ik.d.ts +0 -19
- package/dist/ZX-CDQOfsHh.d.ts +0 -21
- package/dist/ZX-DVb_buNI.d.cts +0 -22
- package/dist/api/documentManagement.d.ts +0 -89
- package/dist/api/documentManagement.js +0 -3
- package/dist/api/documentSubmission.d.ts +0 -92
- package/dist/api/documentSubmission.js +0 -5
- package/dist/api/documentTypeManagement.d.ts +0 -70
- package/dist/api/documentTypeManagement.js +0 -3
- package/dist/api/notificationManagement.d.ts +0 -68
- package/dist/api/notificationManagement.js +0 -3
- package/dist/api/platformLogin.d.ts +0 -68
- package/dist/api/platformLogin.js +0 -3
- package/dist/api/taxpayerValidation.d.ts +0 -71
- package/dist/api/taxpayerValidation.js +0 -4
- package/dist/apiQueue-B6Q644Bz.js +0 -201
- package/dist/certificate-COwqszxD.js +0 -71
- package/dist/certificate-CWmfCPdt.cjs.map +0 -1
- package/dist/chunk-CUT6urMc.cjs +0 -30
- package/dist/classification-codes-B15PbWxz.d.cts +0 -118
- package/dist/classification-codes-C2X4xW5-.d.ts +0 -117
- package/dist/country-code-DPeNFMMi.d.cts +0 -543
- package/dist/country-code-DsI8Mbzx.d.ts +0 -542
- package/dist/currencies-DKuDflOO.d.ts +0 -207
- package/dist/currencies-S5g1gzBU.d.cts +0 -208
- package/dist/document-B6ab06s1.cjs.map +0 -1
- package/dist/document-Bb5WkhRe.js +0 -626
- package/dist/documentManagement-BviJDtf2.cjs.map +0 -1
- package/dist/documentManagement-lPm8Gziu.js +0 -49
- package/dist/documentSubmission-igf605QK.js +0 -135
- package/dist/documentTypeManagement-cBtVCOY3.js +0 -22
- package/dist/documents-BYV12TVt.d.ts +0 -1196
- package/dist/documents-D_V38Q_U.d.cts +0 -1197
- package/dist/e-invoice-BuwtFnlI.d.cts +0 -44
- package/dist/e-invoice-C2TxhyrK.d.ts +0 -43
- package/dist/formatIdValue-qTxJqj9o.js +0 -7
- package/dist/getBaseUrl-D7nUmoYb.js +0 -7
- package/dist/index-CygwSf0x.d.ts +0 -15
- package/dist/index-Yr1QAbIF.d.cts +0 -16
- package/dist/index.d.ts +0 -614
- package/dist/index.js +0 -627
- package/dist/index14.cjs.map +0 -1
- package/dist/index23.cjs.map +0 -1
- package/dist/index26.cjs.map +0 -1
- package/dist/index31.cjs.map +0 -1
- package/dist/index61.cts.map +0 -1
- package/dist/index62.cts.map +0 -1
- package/dist/index63.cts.map +0 -1
- package/dist/index64.cts.map +0 -1
- package/dist/index65.cts.map +0 -1
- package/dist/index66.cts.map +0 -1
- package/dist/index67.cts.map +0 -1
- package/dist/index68.cts.map +0 -1
- package/dist/index69.cts.map +0 -1
- package/dist/index70.cts.map +0 -1
- package/dist/index71.cts.map +0 -1
- package/dist/index72.cts.map +0 -1
- package/dist/index73.cts.map +0 -1
- package/dist/index74.cts.map +0 -1
- package/dist/index75.cts.map +0 -1
- package/dist/msic-codes-CIKdPqag.d.cts +0 -26
- package/dist/msic-codes-CjrrJmzb.d.ts +0 -25
- package/dist/notificationManagement-n4Z5e-My.js +0 -19
- package/dist/notifications-DdlEkprb.d.cts +0 -63
- package/dist/notifications-sFhgh3rJ.d.ts +0 -62
- package/dist/payment-modes-7c1lWlIr.d.cts +0 -44
- package/dist/payment-modes-g3DzLmWb.d.ts +0 -43
- package/dist/platformLogin-CqI9OLYP.js +0 -39
- package/dist/signatures-CerHUrj3.d.ts +0 -172
- package/dist/signatures-CyDSZr_e.d.cts +0 -173
- package/dist/state-codes-Ow4oehYT.d.ts +0 -61
- package/dist/state-codes-u3ppueWo.d.cts +0 -62
- package/dist/tax-types-ClyLgydM.d.ts +0 -41
- package/dist/tax-types-fu5Q6dic.d.cts +0 -42
- package/dist/taxpayer-BAoT73gg.d.ts +0 -35
- package/dist/taxpayer-DwGzY1IL.d.cts +0 -36
- package/dist/taxpayerValidation-Xd_EHDvk.js +0 -47
- package/dist/types/classification-codes.d.ts +0 -2
- package/dist/types/country-code.d.ts +0 -2
- package/dist/types/currencies.d.ts +0 -2
- package/dist/types/documents.d.ts +0 -55
- package/dist/types/e-invoice.d.ts +0 -2
- package/dist/types/index.d.ts +0 -61
- package/dist/types/msic/0X.d.ts +0 -2
- package/dist/types/msic/1X.d.ts +0 -2
- package/dist/types/msic/2X.d.ts +0 -2
- package/dist/types/msic/3X.d.ts +0 -2
- package/dist/types/msic/4X.d.ts +0 -2
- package/dist/types/msic/5X.d.ts +0 -2
- package/dist/types/msic/6X.d.ts +0 -2
- package/dist/types/msic/7X.d.ts +0 -2
- package/dist/types/msic/8X.d.ts +0 -2
- package/dist/types/msic/9X.d.ts +0 -2
- package/dist/types/msic-codes.d.ts +0 -12
- package/dist/types/notifications.d.ts +0 -2
- package/dist/types/payment-modes.d.ts +0 -2
- package/dist/types/signatures.d.ts +0 -2
- package/dist/types/state-codes.d.ts +0 -2
- package/dist/types/tax-types.d.ts +0 -2
- package/dist/types/taxpayer.d.ts +0 -56
- package/dist/types/unit/1X.d.ts +0 -2
- package/dist/types/unit/2X.d.ts +0 -2
- package/dist/types/unit/3X.d.ts +0 -2
- package/dist/types/unit/4X.d.ts +0 -2
- package/dist/types/unit/5X.d.ts +0 -2
- package/dist/types/unit/6X.d.ts +0 -2
- package/dist/types/unit/7X.d.ts +0 -2
- package/dist/types/unit/8X.d.ts +0 -2
- package/dist/types/unit/9X.d.ts +0 -2
- package/dist/types/unit/AX.d.ts +0 -2
- package/dist/types/unit/BX.d.ts +0 -2
- package/dist/types/unit/CX.d.ts +0 -2
- package/dist/types/unit/DX.d.ts +0 -2
- package/dist/types/unit/EX.d.ts +0 -2
- package/dist/types/unit/FX.d.ts +0 -2
- package/dist/types/unit/GX.d.ts +0 -2
- package/dist/types/unit/HX.d.ts +0 -2
- package/dist/types/unit/IX.d.ts +0 -2
- package/dist/types/unit/JX.d.ts +0 -2
- package/dist/types/unit/KX.d.ts +0 -2
- package/dist/types/unit/LX.d.ts +0 -2
- package/dist/types/unit/MX.d.ts +0 -2
- package/dist/types/unit/NX.d.ts +0 -2
- package/dist/types/unit/OX.d.ts +0 -2
- package/dist/types/unit/PX.d.ts +0 -2
- package/dist/types/unit/QX.d.ts +0 -2
- package/dist/types/unit/RX.d.ts +0 -2
- package/dist/types/unit/SX.d.ts +0 -2
- package/dist/types/unit/TX.d.ts +0 -2
- package/dist/types/unit/UX.d.ts +0 -2
- package/dist/types/unit/VX.d.ts +0 -2
- package/dist/types/unit/WX.d.ts +0 -2
- package/dist/types/unit/XX.d.ts +0 -2
- package/dist/types/unit/YX.d.ts +0 -2
- package/dist/types/unit/ZX.d.ts +0 -2
- package/dist/types/unit-types.d.ts +0 -37
- package/dist/types/utils.d.ts +0 -2
- package/dist/unit-types-BXdufGWm.d.cts +0 -56
- package/dist/unit-types-VgYXIwTT.d.ts +0 -55
- package/dist/utils/apiQueue.d.ts +0 -45
- package/dist/utils/apiQueue.js +0 -3
- package/dist/utils/base64.d.ts +0 -5
- package/dist/utils/base64.js +0 -10
- package/dist/utils/certificate.d.ts +0 -26
- package/dist/utils/certificate.js +0 -3
- package/dist/utils/document.d.ts +0 -211
- package/dist/utils/document.js +0 -4
- package/dist/utils/formatIdValue.d.ts +0 -4
- package/dist/utils/formatIdValue.js +0 -3
- package/dist/utils/getBaseUrl.d.ts +0 -4
- package/dist/utils/getBaseUrl.js +0 -3
- package/dist/utils/signature-diagnostics.d.ts +0 -96
- package/dist/utils/signature-diagnostics.js +0 -327
- package/dist/utils/validation.d.ts +0 -108
- package/dist/utils/validation.js +0 -186
- package/dist/utils-C4FoVKLq.d.ts +0 -4
- package/dist/utils-Cdqbbzca.d.cts +0 -5
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
//#region src/utils/apiQueue.ts
|
|
2
|
-
const queues = {};
|
|
3
|
-
const LIMITS = {
|
|
4
|
-
loginTaxpayer: {
|
|
5
|
-
max: 12,
|
|
6
|
-
perMs: 6e4
|
|
7
|
-
},
|
|
8
|
-
loginIntermediary: {
|
|
9
|
-
max: 12,
|
|
10
|
-
perMs: 6e4
|
|
11
|
-
},
|
|
12
|
-
submitDocuments: {
|
|
13
|
-
max: 100,
|
|
14
|
-
perMs: 6e4
|
|
15
|
-
},
|
|
16
|
-
getSubmission: {
|
|
17
|
-
max: 300,
|
|
18
|
-
perMs: 6e4
|
|
19
|
-
},
|
|
20
|
-
cancelDocument: {
|
|
21
|
-
max: 12,
|
|
22
|
-
perMs: 6e4
|
|
23
|
-
},
|
|
24
|
-
rejectDocument: {
|
|
25
|
-
max: 12,
|
|
26
|
-
perMs: 6e4
|
|
27
|
-
},
|
|
28
|
-
getDocument: {
|
|
29
|
-
max: 60,
|
|
30
|
-
perMs: 6e4
|
|
31
|
-
},
|
|
32
|
-
getDocumentDetails: {
|
|
33
|
-
max: 125,
|
|
34
|
-
perMs: 6e4
|
|
35
|
-
},
|
|
36
|
-
getRecentDocuments: {
|
|
37
|
-
max: 12,
|
|
38
|
-
perMs: 6e4
|
|
39
|
-
},
|
|
40
|
-
searchDocuments: {
|
|
41
|
-
max: 12,
|
|
42
|
-
perMs: 6e4
|
|
43
|
-
},
|
|
44
|
-
searchTin: {
|
|
45
|
-
max: 60,
|
|
46
|
-
perMs: 6e4
|
|
47
|
-
},
|
|
48
|
-
taxpayerQr: {
|
|
49
|
-
max: 60,
|
|
50
|
-
perMs: 6e4
|
|
51
|
-
},
|
|
52
|
-
default: {
|
|
53
|
-
max: 12,
|
|
54
|
-
perMs: 6e4
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Clean up old timestamps outside the sliding window
|
|
59
|
-
*/
|
|
60
|
-
function cleanupTimestamps(timestamps, windowMs, now) {
|
|
61
|
-
return timestamps.filter((ts) => now - ts < windowMs);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Calculate when we can make the next request without exceeding the rate limit
|
|
65
|
-
*/
|
|
66
|
-
function getNextAvailableTime(timestamps, max, windowMs, now) {
|
|
67
|
-
if (timestamps.length < max) return now;
|
|
68
|
-
const oldestTimestamp = timestamps[0];
|
|
69
|
-
if (!oldestTimestamp) return now;
|
|
70
|
-
return oldestTimestamp + windowMs;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Public helper to schedule a request according to the category's limits.
|
|
74
|
-
* Rate limits are enforced per clientId, so multiple instances with the same
|
|
75
|
-
* clientId will share rate limiters, while different clientIds get separate limiters.
|
|
76
|
-
*
|
|
77
|
-
* This implementation uses a sliding window to track all requests within the time window.
|
|
78
|
-
*/
|
|
79
|
-
function queueRequest(clientId, category, task, debug = false) {
|
|
80
|
-
const key = `${clientId}:${category}`;
|
|
81
|
-
if (!queues[key]) queues[key] = {
|
|
82
|
-
running: 0,
|
|
83
|
-
queue: [],
|
|
84
|
-
requestTimestamps: [],
|
|
85
|
-
nextTimer: null
|
|
86
|
-
};
|
|
87
|
-
const queue = queues[key];
|
|
88
|
-
const { max, perMs } = LIMITS[category] ?? LIMITS.default;
|
|
89
|
-
return new Promise((resolve, reject) => {
|
|
90
|
-
const run = () => {
|
|
91
|
-
const now$1 = Date.now();
|
|
92
|
-
queue.requestTimestamps = cleanupTimestamps(queue.requestTimestamps, perMs, now$1);
|
|
93
|
-
if (queue.requestTimestamps.length >= max) {
|
|
94
|
-
const nextAvailable = getNextAvailableTime(queue.requestTimestamps, max, perMs, now$1);
|
|
95
|
-
const waitTime = nextAvailable - now$1;
|
|
96
|
-
if (debug) console.log(`[apiQueue] 🚫 Rate limit reached (${queue.requestTimestamps.length}/${max} in last ${perMs}ms). Queuing request. Need to wait ${waitTime.toFixed(0)}ms. Queue size: ${queue.queue.length + 1}`);
|
|
97
|
-
queue.queue.push({
|
|
98
|
-
run,
|
|
99
|
-
addedAt: now$1
|
|
100
|
-
});
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
queue.requestTimestamps.push(now$1);
|
|
104
|
-
queue.running++;
|
|
105
|
-
if (debug) console.log(`[apiQueue] ▶️ Executing request (${category}). Requests in window: ${queue.requestTimestamps.length}/${max}. Running: ${queue.running}. Queue size: ${queue.queue.length}`);
|
|
106
|
-
task().then(resolve).catch(reject).finally(() => {
|
|
107
|
-
queue.running--;
|
|
108
|
-
if (debug) console.log(`[apiQueue] ✅ Request completed (${category}). Requests in window: ${queue.requestTimestamps.length}/${max}. Running: ${queue.running}. Queue size: ${queue.queue.length}`);
|
|
109
|
-
processQueue(key, debug, category);
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
const now = Date.now();
|
|
113
|
-
queue.requestTimestamps = cleanupTimestamps(queue.requestTimestamps, perMs, now);
|
|
114
|
-
if (queue.queue.length > 0 || queue.requestTimestamps.length >= max) {
|
|
115
|
-
queue.queue.push({
|
|
116
|
-
run,
|
|
117
|
-
addedAt: now
|
|
118
|
-
});
|
|
119
|
-
if (debug) console.log(`[apiQueue] ⏳ Queued request (${category}). Requests in window: ${queue.requestTimestamps.length}/${max}. Queue size: ${queue.queue.length}`);
|
|
120
|
-
processQueue(key, debug, category);
|
|
121
|
-
} else run();
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
function processQueue(key, debug, category) {
|
|
125
|
-
const queue = queues[key];
|
|
126
|
-
if (!queue || queue.queue.length === 0) return;
|
|
127
|
-
const { max, perMs } = LIMITS[category] ?? LIMITS.default;
|
|
128
|
-
const now = Date.now();
|
|
129
|
-
queue.requestTimestamps = cleanupTimestamps(queue.requestTimestamps, perMs, now);
|
|
130
|
-
if (queue.requestTimestamps.length < max) {
|
|
131
|
-
const next = queue.queue.shift();
|
|
132
|
-
if (next) {
|
|
133
|
-
if (debug) {
|
|
134
|
-
const waitTime = Date.now() - next.addedAt;
|
|
135
|
-
console.log(`[apiQueue] 🚀 Processing queued request (${category}). Waited: ${waitTime.toFixed(0)}ms. Queue size: ${queue.queue.length}`);
|
|
136
|
-
}
|
|
137
|
-
next.run();
|
|
138
|
-
}
|
|
139
|
-
if (queue.queue.length > 0) processQueue(key, debug, category);
|
|
140
|
-
} else {
|
|
141
|
-
const nextAvailable = getNextAvailableTime(queue.requestTimestamps, max, perMs, now);
|
|
142
|
-
const delay = Math.max(0, nextAvailable - now + 50);
|
|
143
|
-
if (debug) console.log(`[apiQueue] ⏸️ Delaying queue processing (${category}). Will retry in ${delay.toFixed(0)}ms. Queue size: ${queue.queue.length}`);
|
|
144
|
-
if (!queue.nextTimer) queue.nextTimer = setTimeout(() => {
|
|
145
|
-
queue.nextTimer = null;
|
|
146
|
-
processQueue(key, debug, category);
|
|
147
|
-
}, delay);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Cleanup function to clear all queues and timers for a specific client.
|
|
152
|
-
* Useful for testing or cleanup on application shutdown.
|
|
153
|
-
*/
|
|
154
|
-
function clearQueue(clientId, category) {
|
|
155
|
-
if (category) {
|
|
156
|
-
const key = `${clientId}:${category}`;
|
|
157
|
-
const queue = queues[key];
|
|
158
|
-
if (queue) {
|
|
159
|
-
if (queue.nextTimer) {
|
|
160
|
-
clearTimeout(queue.nextTimer);
|
|
161
|
-
queue.nextTimer = null;
|
|
162
|
-
}
|
|
163
|
-
queue.queue = [];
|
|
164
|
-
queue.requestTimestamps = [];
|
|
165
|
-
queue.running = 0;
|
|
166
|
-
}
|
|
167
|
-
} else Object.keys(queues).forEach((key) => {
|
|
168
|
-
if (key.startsWith(`${clientId}:`)) {
|
|
169
|
-
const queue = queues[key];
|
|
170
|
-
if (queue?.nextTimer) {
|
|
171
|
-
clearTimeout(queue.nextTimer);
|
|
172
|
-
queue.nextTimer = null;
|
|
173
|
-
}
|
|
174
|
-
delete queues[key];
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Very naive path-based category detection. If no matcher fits, the `default` category
|
|
180
|
-
* (effectively unlimited) is returned. Adjust these heuristics as your API surface evolves.
|
|
181
|
-
*/
|
|
182
|
-
function categorizeRequest(path, method = "GET") {
|
|
183
|
-
const cleanPath = path.toLowerCase();
|
|
184
|
-
const isPost = method?.toUpperCase() === "POST";
|
|
185
|
-
if (cleanPath.includes("/documentsubmissions")) return isPost ? "submitDocuments" : "getSubmission";
|
|
186
|
-
if (cleanPath.includes("/documents/recent")) return "getRecentDocuments";
|
|
187
|
-
if (cleanPath.includes("/documents/search")) return "searchDocuments";
|
|
188
|
-
if (cleanPath.includes("/documents/state/") && cleanPath.endsWith("/state")) return "cancelDocument";
|
|
189
|
-
if (/\/documents\/[^/]+\/raw$/.test(cleanPath)) return "getDocument";
|
|
190
|
-
if (/\/documents\/[^/]+\/details$/.test(cleanPath)) return "getDocumentDetails";
|
|
191
|
-
if (cleanPath.includes("/taxpayer/search/tin")) return "searchTin";
|
|
192
|
-
if (cleanPath.includes("/taxpayer/validate/")) return "searchTin";
|
|
193
|
-
if (cleanPath.includes("/taxpayer/qrcode")) return "taxpayerQr";
|
|
194
|
-
if (cleanPath.includes("/searchtin")) return "searchTin";
|
|
195
|
-
if (cleanPath.includes("/qrcode")) return "taxpayerQr";
|
|
196
|
-
if (cleanPath.includes("/connect/token")) return "loginTaxpayer";
|
|
197
|
-
return "default";
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
//#endregion
|
|
201
|
-
export { categorizeRequest, clearQueue, queueRequest };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import crypto from "crypto";
|
|
2
|
-
import * as forge from "node-forge";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
|
|
5
|
-
//#region src/utils/certificate.ts
|
|
6
|
-
/**
|
|
7
|
-
* Extracts certificate information from PEM certificate
|
|
8
|
-
* Converts hex serial number to decimal as required by MyInvois
|
|
9
|
-
*
|
|
10
|
-
* @param certificatePem - Certificate in PEM format
|
|
11
|
-
* @returns Object with issuer name and decimal serial number
|
|
12
|
-
*/
|
|
13
|
-
const extractCertificateInfo = (certificatePem) => {
|
|
14
|
-
try {
|
|
15
|
-
const cert = new crypto.X509Certificate(certificatePem);
|
|
16
|
-
const serialNumberHex = cert.serialNumber;
|
|
17
|
-
const serialNumberDecimal = BigInt("0x" + serialNumberHex).toString();
|
|
18
|
-
return {
|
|
19
|
-
issuerName: cert.issuer,
|
|
20
|
-
serialNumber: serialNumberDecimal
|
|
21
|
-
};
|
|
22
|
-
} catch (error) {
|
|
23
|
-
throw new Error(`Failed to extract certificate info: ${error}`);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Validates that certificate and private key form a valid pair
|
|
28
|
-
*
|
|
29
|
-
* @param certificatePem - Certificate in PEM format
|
|
30
|
-
* @param privateKeyPem - Private key in PEM format
|
|
31
|
-
* @returns Boolean indicating if key pair is valid
|
|
32
|
-
*/
|
|
33
|
-
const validateKeyPair = (certificatePem, privateKeyPem) => {
|
|
34
|
-
try {
|
|
35
|
-
const cert = new crypto.X509Certificate(certificatePem);
|
|
36
|
-
const publicKey = cert.publicKey;
|
|
37
|
-
const testData = "validation-test-data";
|
|
38
|
-
const signer = crypto.createSign("RSA-SHA256");
|
|
39
|
-
signer.update(testData);
|
|
40
|
-
const signature = signer.sign(privateKeyPem);
|
|
41
|
-
const verifier = crypto.createVerify("RSA-SHA256");
|
|
42
|
-
verifier.update(testData);
|
|
43
|
-
return verifier.verify(publicKey, signature);
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error("Key pair validation failed:", error);
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const getPemFromP12 = (p12Input, passphrase) => {
|
|
50
|
-
try {
|
|
51
|
-
const p12Buffer = Buffer.isBuffer(p12Input) ? p12Input : fs.readFileSync(p12Input);
|
|
52
|
-
const p12Der = forge.util.createBuffer(p12Buffer.toString("binary"));
|
|
53
|
-
const p12Asn1 = forge.asn1.fromDer(p12Der.getBytes());
|
|
54
|
-
const p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, passphrase);
|
|
55
|
-
const certBags = p12.getBags({ bagType: forge.pki.oids.certBag })[forge.pki.oids.certBag];
|
|
56
|
-
if (!certBags || certBags.length === 0) throw new Error("No certificate found in PKCS#12 bundle");
|
|
57
|
-
const certificatePem = forge.pki.certificateToPem(certBags[0].cert);
|
|
58
|
-
const keyBags = p12.getBags({ bagType: forge.pki.oids.pkcs8ShroudedKeyBag })[forge.pki.oids.pkcs8ShroudedKeyBag];
|
|
59
|
-
if (!keyBags || keyBags.length === 0) throw new Error("No private key found in PKCS#12 bundle");
|
|
60
|
-
const privateKeyPem = forge.pki.privateKeyToPem(keyBags[0].key);
|
|
61
|
-
return {
|
|
62
|
-
certificatePem,
|
|
63
|
-
privateKeyPem
|
|
64
|
-
};
|
|
65
|
-
} catch (error) {
|
|
66
|
-
throw new Error(`Failed to extract PEM from PKCS#12 file: ${error}`);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { extractCertificateInfo, getPemFromP12, validateKeyPair };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"certificate-CWmfCPdt.cjs","names":["certificatePem: string","privateKeyPem: string","p12Input: Buffer | string","passphrase: string","p12Buffer: Buffer","forge"],"sources":["../src/utils/certificate.ts"],"sourcesContent":["import crypto from 'crypto'\nimport * as forge from 'node-forge'\nimport fs from 'fs'\n\n/**\n * Extracts certificate information from PEM certificate\n * Converts hex serial number to decimal as required by MyInvois\n *\n * @param certificatePem - Certificate in PEM format\n * @returns Object with issuer name and decimal serial number\n */\nexport const extractCertificateInfo = (\n certificatePem: string,\n): {\n issuerName: string\n serialNumber: string\n} => {\n try {\n const cert = new crypto.X509Certificate(certificatePem)\n\n // Convert hex serial number to decimal (MyInvois requirement)\n const serialNumberHex = cert.serialNumber\n const serialNumberDecimal = BigInt('0x' + serialNumberHex).toString()\n\n return {\n issuerName: cert.issuer,\n serialNumber: serialNumberDecimal,\n }\n } catch (error) {\n throw new Error(`Failed to extract certificate info: ${error}`)\n }\n}\n\n/**\n * Validates that certificate and private key form a valid pair\n *\n * @param certificatePem - Certificate in PEM format\n * @param privateKeyPem - Private key in PEM format\n * @returns Boolean indicating if key pair is valid\n */\nexport const validateKeyPair = (\n certificatePem: string,\n privateKeyPem: string,\n): boolean => {\n try {\n const cert = new crypto.X509Certificate(certificatePem)\n const publicKey = cert.publicKey\n\n // Test signature/verification cycle\n const testData = 'validation-test-data'\n const signer = crypto.createSign('RSA-SHA256')\n signer.update(testData)\n const signature = signer.sign(privateKeyPem)\n\n const verifier = crypto.createVerify('RSA-SHA256')\n verifier.update(testData)\n return verifier.verify(publicKey, signature)\n } catch (error) {\n console.error('Key pair validation failed:', error)\n return false\n }\n}\n\nexport const getPemFromP12 = (\n p12Input: Buffer | string,\n passphrase: string,\n): {\n certificatePem: string\n privateKeyPem: string\n} => {\n try {\n // Load binary DER contents of the p12 file\n const p12Buffer: Buffer = Buffer.isBuffer(p12Input)\n ? p12Input\n : fs.readFileSync(p12Input)\n\n // Convert DER -> ASN.1\n const p12Der = forge.util.createBuffer(p12Buffer.toString('binary'))\n const p12Asn1 = forge.asn1.fromDer(p12Der.getBytes())\n\n // Parse the PKCS#12 using the provided passphrase\n const p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, passphrase)\n\n // Extract the first certificate (assumes it is the signing cert)\n const certBags = p12.getBags({ bagType: forge.pki.oids.certBag })[\n forge.pki.oids.certBag\n ]\n if (!certBags || certBags.length === 0)\n throw new Error('No certificate found in PKCS#12 bundle')\n const certificatePem = forge.pki.certificateToPem(certBags[0].cert)\n\n // Extract the first private key\n const keyBags = p12.getBags({\n bagType: forge.pki.oids.pkcs8ShroudedKeyBag,\n })[forge.pki.oids.pkcs8ShroudedKeyBag]\n if (!keyBags || keyBags.length === 0)\n throw new Error('No private key found in PKCS#12 bundle')\n const privateKeyPem = forge.pki.privateKeyToPem(keyBags[0].key)\n\n return { certificatePem, privateKeyPem }\n } catch (error) {\n throw new Error(`Failed to extract PEM from PKCS#12 file: ${error}`)\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,yBAAyB,CACpCA,mBAIG;AACH,KAAI;EACF,MAAM,OAAO,IAAI,eAAO,gBAAgB;EAGxC,MAAM,kBAAkB,KAAK;EAC7B,MAAM,sBAAsB,OAAO,OAAO,gBAAgB,CAAC,UAAU;AAErE,SAAO;GACL,YAAY,KAAK;GACjB,cAAc;EACf;CACF,SAAQ,OAAO;AACd,QAAM,IAAI,OAAO,sCAAsC,MAAM;CAC9D;AACF;;;;;;;;AASD,MAAa,kBAAkB,CAC7BA,gBACAC,kBACY;AACZ,KAAI;EACF,MAAM,OAAO,IAAI,eAAO,gBAAgB;EACxC,MAAM,YAAY,KAAK;EAGvB,MAAM,WAAW;EACjB,MAAM,SAAS,eAAO,WAAW,aAAa;AAC9C,SAAO,OAAO,SAAS;EACvB,MAAM,YAAY,OAAO,KAAK,cAAc;EAE5C,MAAM,WAAW,eAAO,aAAa,aAAa;AAClD,WAAS,OAAO,SAAS;AACzB,SAAO,SAAS,OAAO,WAAW,UAAU;CAC7C,SAAQ,OAAO;AACd,UAAQ,MAAM,+BAA+B,MAAM;AACnD,SAAO;CACR;AACF;AAED,MAAa,gBAAgB,CAC3BC,UACAC,eAIG;AACH,KAAI;EAEF,MAAMC,YAAoB,OAAO,SAAS,SAAS,GAC/C,WACA,WAAG,aAAa,SAAS;EAG7B,MAAM,SAAS,WAAM,KAAK,aAAa,UAAU,SAAS,SAAS,CAAC;EACpE,MAAM,UAAU,WAAM,KAAK,QAAQ,OAAO,UAAU,CAAC;EAGrD,MAAM,MAAM,WAAM,OAAO,eAAe,SAAS,WAAW;EAG5D,MAAM,WAAW,IAAI,QAAQ,EAAE,SAASC,WAAM,IAAI,KAAK,QAAS,EAAC,CAC/DA,WAAM,IAAI,KAAK;AAEjB,OAAK,YAAY,SAAS,WAAW,EACnC,OAAM,IAAI,MAAM;EAClB,MAAM,iBAAiB,WAAM,IAAI,iBAAiB,SAAS,GAAG,KAAK;EAGnE,MAAM,UAAU,IAAI,QAAQ,EAC1B,SAASA,WAAM,IAAI,KAAK,oBACzB,EAAC,CAACA,WAAM,IAAI,KAAK;AAClB,OAAK,WAAW,QAAQ,WAAW,EACjC,OAAM,IAAI,MAAM;EAClB,MAAM,gBAAgB,WAAM,IAAI,gBAAgB,QAAQ,GAAG,IAAI;AAE/D,SAAO;GAAE;GAAgB;EAAe;CACzC,SAAQ,OAAO;AACd,QAAM,IAAI,OAAO,2CAA2C,MAAM;CACnE;AACF"}
|
package/dist/chunk-CUT6urMc.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(exports, '__toESM', {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return __toESM;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
//#region src/types/classification-codes.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Represents the allowed classification codes for e-Invoice items.
|
|
4
|
-
* Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/classification-codes/
|
|
5
|
-
*/
|
|
6
|
-
type ClassificationCode = '001' // Breastfeeding equipment
|
|
7
|
-
| '002' // Child care centres and kindergartens fees
|
|
8
|
-
| '003' // Computer, smartphone or tablet
|
|
9
|
-
| '004' // Consolidated e-Invoice
|
|
10
|
-
| '005' // Construction materials (as specified under Fourth Schedule of the Lembaga Pembangunan Industri Pembinaan Malaysia Act 1994)
|
|
11
|
-
| '006' // Disbursement
|
|
12
|
-
| '007' // Donation
|
|
13
|
-
| '008' // e-Commerce - e-Invoice to buyer / purchaser
|
|
14
|
-
| '009' // e-Commerce - Self-billed e-Invoice to seller, logistics, etc.
|
|
15
|
-
| '010' // Education fees
|
|
16
|
-
| '011' // Goods on consignment (Consignor)
|
|
17
|
-
| '012' // Goods on consignment (Consignee)
|
|
18
|
-
| '013' // Gym membership
|
|
19
|
-
| '014' // Insurance - Education and medical benefits
|
|
20
|
-
| '015' // Insurance - Takaful or life insurance
|
|
21
|
-
| '016' // Interest and financing expenses
|
|
22
|
-
| '017' // Internet subscription
|
|
23
|
-
| '018' // Land and building
|
|
24
|
-
| '019' // Medical examination for learning disabilities and early intervention or rehabilitation treatments of learning disabilities
|
|
25
|
-
| '020' // Medical examination or vaccination expenses
|
|
26
|
-
| '021' // Medical expenses for serious diseases
|
|
27
|
-
| '022' // Others
|
|
28
|
-
| '023' // Petroleum operations (as defined in Petroleum (Income Tax) Act 1967)
|
|
29
|
-
| '024' // Private retirement scheme or deferred annuity scheme
|
|
30
|
-
| '025' // Motor vehicle
|
|
31
|
-
| '026' // Subscription of books / journals / magazines / newspapers / other similar publications
|
|
32
|
-
| '027' // Reimbursement
|
|
33
|
-
| '028' // Rental of motor vehicle
|
|
34
|
-
| '029' // EV charging facilities (Installation, rental, sale / purchase or subscription fees)
|
|
35
|
-
| '030' // Repair and maintenance
|
|
36
|
-
| '031' // Research and development
|
|
37
|
-
| '032' // Foreign income
|
|
38
|
-
| '033' // Self-billed - Betting and gaming
|
|
39
|
-
| '034' // Self-billed - Importation of goods
|
|
40
|
-
| '035' // Self-billed - Importation of services
|
|
41
|
-
| '036' // Self-billed - Others
|
|
42
|
-
| '037' // Self-billed - Monetary payment to agents, dealers or distributors
|
|
43
|
-
| '038' // Sports equipment, rental / entry fees for sports facilities, registration in sports competition or sports training fees imposed by associations / sports clubs / companies registered with the Sports Commissioner or Companies Commission of Malaysia and carrying out sports activities as listed under the Sports Development Act 1997
|
|
44
|
-
| '039' // Supporting equipment for disabled person
|
|
45
|
-
| '040' // Voluntary contribution to approved provident fund
|
|
46
|
-
| '041' // Dental examination or treatment
|
|
47
|
-
| '042' // Fertility treatment
|
|
48
|
-
| '043' // Treatment and home care nursing, daycare centres and residential care centers
|
|
49
|
-
| '044' // Vouchers, gift cards, loyalty points, etc
|
|
50
|
-
| '045'; // Self-billed - Non-monetary payment to agents, dealers or distributors
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Enum representing the allowed classification codes with descriptive names.
|
|
54
|
-
* Provides a more readable way to reference classification codes.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* const code = ClassificationCodeEnum.ComputerSmartphoneOrTablet;
|
|
58
|
-
* console.log(code); // Output: "003"
|
|
59
|
-
*/
|
|
60
|
-
declare enum ClassificationCodeEnum {
|
|
61
|
-
BreastfeedingEquipment = '001',
|
|
62
|
-
ChildCareCentresAndKindergartensFees = '002',
|
|
63
|
-
ComputerSmartphoneOrTablet = '003',
|
|
64
|
-
ConsolidatedEInvoice = '004',
|
|
65
|
-
ConstructionMaterials = '005',
|
|
66
|
-
Disbursement = '006',
|
|
67
|
-
Donation = '007',
|
|
68
|
-
ECommerceEInvoiceToBuyer = '008',
|
|
69
|
-
ECommerceSelfBilledToSellerLogistics = '009',
|
|
70
|
-
EducationFees = '010',
|
|
71
|
-
GoodsOnConsignmentConsignor = '011',
|
|
72
|
-
GoodsOnConsignmentConsignee = '012',
|
|
73
|
-
GymMembership = '013',
|
|
74
|
-
InsuranceEducationMedicalBenefits = '014',
|
|
75
|
-
InsuranceTakafulLife = '015',
|
|
76
|
-
InterestFinancingExpenses = '016',
|
|
77
|
-
InternetSubscription = '017',
|
|
78
|
-
LandAndBuilding = '018',
|
|
79
|
-
MedicalExamLearningDisabilities = '019',
|
|
80
|
-
MedicalExamVaccination = '020',
|
|
81
|
-
MedicalExpensesSeriousDiseases = '021',
|
|
82
|
-
Others = '022',
|
|
83
|
-
PetroleumOperations = '023',
|
|
84
|
-
PrivateRetirementSchemeDeferredAnnuity = '024',
|
|
85
|
-
MotorVehicle = '025',
|
|
86
|
-
SubscriptionBooksJournalsEtc = '026',
|
|
87
|
-
Reimbursement = '027',
|
|
88
|
-
RentalOfMotorVehicle = '028',
|
|
89
|
-
EVChargingFacilities = '029',
|
|
90
|
-
RepairAndMaintenance = '030',
|
|
91
|
-
ResearchAndDevelopment = '031',
|
|
92
|
-
ForeignIncome = '032',
|
|
93
|
-
SelfBilledBettingGaming = '033',
|
|
94
|
-
SelfBilledImportationGoods = '034',
|
|
95
|
-
SelfBilledImportationServices = '035',
|
|
96
|
-
SelfBilledOthers = '036',
|
|
97
|
-
SelfBilledMonetaryPaymentToAgents = '037',
|
|
98
|
-
SportsEquipmentRentalFeesEtc = '038',
|
|
99
|
-
SupportingEquipmentDisabledPerson = '039',
|
|
100
|
-
VoluntaryContributionProvidentFund = '040',
|
|
101
|
-
DentalExamTreatment = '041',
|
|
102
|
-
FertilityTreatment = '042',
|
|
103
|
-
TreatmentHomeCareNursingEtc = '043',
|
|
104
|
-
VouchersGiftCardsLoyaltyPoints = '044',
|
|
105
|
-
SelfBilledNonMonetaryPaymentToAgents = '045',
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Interface representing a classification code entry.
|
|
110
|
-
* Contains the code and its corresponding description.
|
|
111
|
-
*/
|
|
112
|
-
interface Classification {
|
|
113
|
-
code: ClassificationCode;
|
|
114
|
-
description: string;
|
|
115
|
-
}
|
|
116
|
-
//#endregion
|
|
117
|
-
export { Classification, ClassificationCode, ClassificationCodeEnum };
|
|
118
|
-
//# sourceMappingURL=classification-codes-B15PbWxz.d.cts.map
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
//#region src/types/classification-codes.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Represents the allowed classification codes for e-Invoice items.
|
|
4
|
-
* Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/classification-codes/
|
|
5
|
-
*/
|
|
6
|
-
type ClassificationCode = '001' // Breastfeeding equipment
|
|
7
|
-
| '002' // Child care centres and kindergartens fees
|
|
8
|
-
| '003' // Computer, smartphone or tablet
|
|
9
|
-
| '004' // Consolidated e-Invoice
|
|
10
|
-
| '005' // Construction materials (as specified under Fourth Schedule of the Lembaga Pembangunan Industri Pembinaan Malaysia Act 1994)
|
|
11
|
-
| '006' // Disbursement
|
|
12
|
-
| '007' // Donation
|
|
13
|
-
| '008' // e-Commerce - e-Invoice to buyer / purchaser
|
|
14
|
-
| '009' // e-Commerce - Self-billed e-Invoice to seller, logistics, etc.
|
|
15
|
-
| '010' // Education fees
|
|
16
|
-
| '011' // Goods on consignment (Consignor)
|
|
17
|
-
| '012' // Goods on consignment (Consignee)
|
|
18
|
-
| '013' // Gym membership
|
|
19
|
-
| '014' // Insurance - Education and medical benefits
|
|
20
|
-
| '015' // Insurance - Takaful or life insurance
|
|
21
|
-
| '016' // Interest and financing expenses
|
|
22
|
-
| '017' // Internet subscription
|
|
23
|
-
| '018' // Land and building
|
|
24
|
-
| '019' // Medical examination for learning disabilities and early intervention or rehabilitation treatments of learning disabilities
|
|
25
|
-
| '020' // Medical examination or vaccination expenses
|
|
26
|
-
| '021' // Medical expenses for serious diseases
|
|
27
|
-
| '022' // Others
|
|
28
|
-
| '023' // Petroleum operations (as defined in Petroleum (Income Tax) Act 1967)
|
|
29
|
-
| '024' // Private retirement scheme or deferred annuity scheme
|
|
30
|
-
| '025' // Motor vehicle
|
|
31
|
-
| '026' // Subscription of books / journals / magazines / newspapers / other similar publications
|
|
32
|
-
| '027' // Reimbursement
|
|
33
|
-
| '028' // Rental of motor vehicle
|
|
34
|
-
| '029' // EV charging facilities (Installation, rental, sale / purchase or subscription fees)
|
|
35
|
-
| '030' // Repair and maintenance
|
|
36
|
-
| '031' // Research and development
|
|
37
|
-
| '032' // Foreign income
|
|
38
|
-
| '033' // Self-billed - Betting and gaming
|
|
39
|
-
| '034' // Self-billed - Importation of goods
|
|
40
|
-
| '035' // Self-billed - Importation of services
|
|
41
|
-
| '036' // Self-billed - Others
|
|
42
|
-
| '037' // Self-billed - Monetary payment to agents, dealers or distributors
|
|
43
|
-
| '038' // Sports equipment, rental / entry fees for sports facilities, registration in sports competition or sports training fees imposed by associations / sports clubs / companies registered with the Sports Commissioner or Companies Commission of Malaysia and carrying out sports activities as listed under the Sports Development Act 1997
|
|
44
|
-
| '039' // Supporting equipment for disabled person
|
|
45
|
-
| '040' // Voluntary contribution to approved provident fund
|
|
46
|
-
| '041' // Dental examination or treatment
|
|
47
|
-
| '042' // Fertility treatment
|
|
48
|
-
| '043' // Treatment and home care nursing, daycare centres and residential care centers
|
|
49
|
-
| '044' // Vouchers, gift cards, loyalty points, etc
|
|
50
|
-
| '045'; // Self-billed - Non-monetary payment to agents, dealers or distributors
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Enum representing the allowed classification codes with descriptive names.
|
|
54
|
-
* Provides a more readable way to reference classification codes.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* const code = ClassificationCodeEnum.ComputerSmartphoneOrTablet;
|
|
58
|
-
* console.log(code); // Output: "003"
|
|
59
|
-
*/
|
|
60
|
-
declare enum ClassificationCodeEnum {
|
|
61
|
-
BreastfeedingEquipment = '001',
|
|
62
|
-
ChildCareCentresAndKindergartensFees = '002',
|
|
63
|
-
ComputerSmartphoneOrTablet = '003',
|
|
64
|
-
ConsolidatedEInvoice = '004',
|
|
65
|
-
ConstructionMaterials = '005',
|
|
66
|
-
Disbursement = '006',
|
|
67
|
-
Donation = '007',
|
|
68
|
-
ECommerceEInvoiceToBuyer = '008',
|
|
69
|
-
ECommerceSelfBilledToSellerLogistics = '009',
|
|
70
|
-
EducationFees = '010',
|
|
71
|
-
GoodsOnConsignmentConsignor = '011',
|
|
72
|
-
GoodsOnConsignmentConsignee = '012',
|
|
73
|
-
GymMembership = '013',
|
|
74
|
-
InsuranceEducationMedicalBenefits = '014',
|
|
75
|
-
InsuranceTakafulLife = '015',
|
|
76
|
-
InterestFinancingExpenses = '016',
|
|
77
|
-
InternetSubscription = '017',
|
|
78
|
-
LandAndBuilding = '018',
|
|
79
|
-
MedicalExamLearningDisabilities = '019',
|
|
80
|
-
MedicalExamVaccination = '020',
|
|
81
|
-
MedicalExpensesSeriousDiseases = '021',
|
|
82
|
-
Others = '022',
|
|
83
|
-
PetroleumOperations = '023',
|
|
84
|
-
PrivateRetirementSchemeDeferredAnnuity = '024',
|
|
85
|
-
MotorVehicle = '025',
|
|
86
|
-
SubscriptionBooksJournalsEtc = '026',
|
|
87
|
-
Reimbursement = '027',
|
|
88
|
-
RentalOfMotorVehicle = '028',
|
|
89
|
-
EVChargingFacilities = '029',
|
|
90
|
-
RepairAndMaintenance = '030',
|
|
91
|
-
ResearchAndDevelopment = '031',
|
|
92
|
-
ForeignIncome = '032',
|
|
93
|
-
SelfBilledBettingGaming = '033',
|
|
94
|
-
SelfBilledImportationGoods = '034',
|
|
95
|
-
SelfBilledImportationServices = '035',
|
|
96
|
-
SelfBilledOthers = '036',
|
|
97
|
-
SelfBilledMonetaryPaymentToAgents = '037',
|
|
98
|
-
SportsEquipmentRentalFeesEtc = '038',
|
|
99
|
-
SupportingEquipmentDisabledPerson = '039',
|
|
100
|
-
VoluntaryContributionProvidentFund = '040',
|
|
101
|
-
DentalExamTreatment = '041',
|
|
102
|
-
FertilityTreatment = '042',
|
|
103
|
-
TreatmentHomeCareNursingEtc = '043',
|
|
104
|
-
VouchersGiftCardsLoyaltyPoints = '044',
|
|
105
|
-
SelfBilledNonMonetaryPaymentToAgents = '045',
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Interface representing a classification code entry.
|
|
110
|
-
* Contains the code and its corresponding description.
|
|
111
|
-
*/
|
|
112
|
-
interface Classification {
|
|
113
|
-
code: ClassificationCode;
|
|
114
|
-
description: string;
|
|
115
|
-
}
|
|
116
|
-
//#endregion
|
|
117
|
-
export { Classification, ClassificationCode, ClassificationCodeEnum };
|