@ripwords/myinvois-client 0.2.40 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/apiQueue-B6Q644Bz.js +201 -0
  2. package/dist/apiQueue-DgKWaQDS.cjs +220 -0
  3. package/dist/apiQueue-DgKWaQDS.cjs.map +1 -0
  4. package/dist/index.cjs +2 -2
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/index10.cjs +16 -187
  8. package/dist/index10.cjs.map +1 -1
  9. package/dist/index12.cjs +25 -16
  10. package/dist/index12.cjs.map +1 -1
  11. package/dist/index13.cjs +24 -0
  12. package/dist/{index19.cjs.map → index13.cjs.map} +1 -1
  13. package/dist/index15.cjs +0 -29
  14. package/dist/index16.cjs +0 -25
  15. package/dist/index17.cjs +5 -0
  16. package/dist/index18.cjs +6 -33
  17. package/dist/index19.cjs +4 -23
  18. package/dist/index2.cjs +61 -4
  19. package/dist/{index8.cjs.map → index2.cjs.map} +1 -1
  20. package/dist/index20.cjs +3 -0
  21. package/dist/index21.cjs +3 -0
  22. package/dist/index22.cjs +6 -0
  23. package/dist/index23.cjs +207 -3
  24. package/dist/index23.cjs.map +1 -0
  25. package/dist/index24.cjs +105 -9
  26. package/dist/index24.cjs.map +1 -1
  27. package/dist/index25.cjs +136 -4
  28. package/dist/index25.cjs.map +1 -0
  29. package/dist/index26.cjs +63 -21
  30. package/dist/index26.cjs.map +1 -0
  31. package/dist/index27.cjs +266 -2
  32. package/dist/index27.cjs.map +1 -0
  33. package/dist/index28.cjs +78 -2
  34. package/dist/index28.cjs.map +1 -0
  35. package/dist/index29.cjs +103 -326
  36. package/dist/index29.cjs.map +1 -1
  37. package/dist/index3.cjs +531 -6
  38. package/dist/index3.cjs.map +1 -0
  39. package/dist/index30.cjs +69 -189
  40. package/dist/index30.cjs.map +1 -1
  41. package/dist/index31.cjs +107 -203
  42. package/dist/index31.cjs.map +1 -1
  43. package/dist/index32.cjs +95 -104
  44. package/dist/index32.cjs.map +1 -1
  45. package/dist/index33.cjs +13 -132
  46. package/dist/index33.cjs.map +1 -1
  47. package/dist/index34.cjs +33 -59
  48. package/dist/index34.cjs.map +1 -1
  49. package/dist/index35.cjs +14 -262
  50. package/dist/index35.cjs.map +1 -1
  51. package/dist/index36.cjs +24 -74
  52. package/dist/index36.cjs.map +1 -1
  53. package/dist/index37.cjs +15 -102
  54. package/dist/index37.cjs.map +1 -1
  55. package/dist/index38.cjs +9 -68
  56. package/dist/index38.cjs.map +1 -1
  57. package/dist/index39.cjs +9 -107
  58. package/dist/index39.cjs.map +1 -1
  59. package/dist/index4.cjs +195 -4
  60. package/dist/index4.cjs.map +1 -0
  61. package/dist/index40.cjs +12 -95
  62. package/dist/index40.cjs.map +1 -1
  63. package/dist/index41.cjs +6 -11
  64. package/dist/index41.cjs.map +1 -1
  65. package/dist/index42.cjs +101 -31
  66. package/dist/index42.cjs.map +1 -1
  67. package/dist/index43.cjs +106 -12
  68. package/dist/index43.cjs.map +1 -1
  69. package/dist/index44.cjs +119 -22
  70. package/dist/index44.cjs.map +1 -1
  71. package/dist/index45.cjs +106 -13
  72. package/dist/index45.cjs.map +1 -1
  73. package/dist/index46.cjs +98 -7
  74. package/dist/index46.cjs.map +1 -1
  75. package/dist/index47.cjs +118 -7
  76. package/dist/index47.cjs.map +1 -1
  77. package/dist/index48.cjs +127 -10
  78. package/dist/index48.cjs.map +1 -1
  79. package/dist/index49.cjs +117 -6
  80. package/dist/index49.cjs.map +1 -1
  81. package/dist/index5.cjs +0 -3
  82. package/dist/index50.cjs +14 -101
  83. package/dist/index50.cjs.map +1 -1
  84. package/dist/index51.cjs +95 -106
  85. package/dist/index51.cjs.map +1 -1
  86. package/dist/index52.cjs +142 -119
  87. package/dist/index52.cjs.map +1 -1
  88. package/dist/index53.cjs +114 -106
  89. package/dist/index53.cjs.map +1 -1
  90. package/dist/index54.cjs +144 -98
  91. package/dist/index54.cjs.map +1 -1
  92. package/dist/index55.cjs +113 -118
  93. package/dist/index55.cjs.map +1 -1
  94. package/dist/index56.cjs +17 -127
  95. package/dist/index56.cjs.map +1 -1
  96. package/dist/index57.cjs +112 -117
  97. package/dist/index57.cjs.map +1 -1
  98. package/dist/index58.cjs +47 -14
  99. package/dist/index58.cjs.map +1 -1
  100. package/dist/index59.cjs +14 -95
  101. package/dist/index59.cjs.map +1 -1
  102. package/dist/index6.cjs +24 -2
  103. package/dist/index6.cjs.map +1 -0
  104. package/dist/index60.cjs +28 -142
  105. package/dist/index60.cjs.map +1 -1
  106. package/dist/index61.cjs +22 -114
  107. package/dist/index61.cjs.map +1 -1
  108. package/dist/index62.cjs +9 -144
  109. package/dist/index62.cjs.map +1 -1
  110. package/dist/index63.cjs +8 -113
  111. package/dist/index63.cjs.map +1 -1
  112. package/dist/index64.cjs +17 -17
  113. package/dist/index64.cjs.map +1 -1
  114. package/dist/index65.cjs +412 -112
  115. package/dist/index65.cjs.map +1 -1
  116. package/dist/index66.cjs +8 -47
  117. package/dist/index66.cjs.map +1 -1
  118. package/dist/index67.cjs +9 -14
  119. package/dist/index67.cjs.map +1 -1
  120. package/dist/index68.cjs +4 -34
  121. package/dist/index68.cts.map +1 -1
  122. package/dist/index69.cjs +9 -25
  123. package/dist/index69.cjs.map +1 -1
  124. package/dist/index7.cjs +0 -6
  125. package/dist/index70.cjs +4 -15
  126. package/dist/index71.cjs +21 -14
  127. package/dist/index72.cjs +2 -23
  128. package/dist/index73.cjs +2 -418
  129. package/dist/index74.cjs +324 -9
  130. package/dist/index74.cjs.map +1 -1
  131. package/dist/index75.cjs +187 -10
  132. package/dist/index75.cjs.map +1 -1
  133. package/dist/index8.cjs +0 -62
  134. package/dist/index9.cjs +23 -526
  135. package/dist/index9.cjs.map +1 -1
  136. package/dist/utils/apiQueue.d.ts +13 -3
  137. package/dist/utils/apiQueue.js +2 -2
  138. package/package.json +1 -1
  139. package/dist/apiQueue-CrR6pgYn.js +0 -181
  140. package/dist/apiQueue-Dj0xtcGe.cjs +0 -194
  141. package/dist/apiQueue-Dj0xtcGe.cjs.map +0 -1
  142. package/dist/index15.cjs.map +0 -1
  143. package/dist/index16.cjs.map +0 -1
  144. package/dist/index18.cjs.map +0 -1
  145. package/dist/index68.cjs.map +0 -1
  146. package/dist/index70.cjs.map +0 -1
  147. package/dist/index71.cjs.map +0 -1
  148. package/dist/index72.cjs.map +0 -1
  149. package/dist/index73.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index9.cjs","names":[],"sources":["../src/types/country-code.d.ts"],"sourcesContent":["/**\n * Represents the allowed ISO-3166 alpha-3 country codes.\n * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/countries/\n */\nexport type CountryCode =\n | \"ABW\"\n | \"AFG\"\n | \"AGO\"\n | \"AIA\"\n | \"ALA\"\n | \"ALB\"\n | \"AND\"\n | \"ANT\"\n | \"ARE\"\n | \"ARG\"\n | \"ARM\"\n | \"ASM\"\n | \"ATA\"\n | \"ATF\"\n | \"ATG\"\n | \"AUS\"\n | \"AUT\"\n | \"AZE\"\n | \"BDI\"\n | \"BEL\"\n | \"BEN\"\n | \"BES\"\n | \"BFA\"\n | \"BGD\"\n | \"BGR\"\n | \"BHR\"\n | \"BHS\"\n | \"BIH\"\n | \"BLM\"\n | \"BLR\"\n | \"BLZ\"\n | \"BMU\"\n | \"BOL\"\n | \"BRA\"\n | \"BRB\"\n | \"BRN\"\n | \"BTN\"\n | \"BVT\"\n | \"BWA\"\n | \"CAF\"\n | \"CAN\"\n | \"CCK\"\n | \"CHE\"\n | \"CHL\"\n | \"CHN\"\n | \"CIV\"\n | \"CMR\"\n | \"COD\"\n | \"COG\"\n | \"COK\"\n | \"COL\"\n | \"COM\"\n | \"CPV\"\n | \"CRI\"\n | \"CUB\"\n | \"CUW\"\n | \"CXR\"\n | \"CYM\"\n | \"CYP\"\n | \"CZE\"\n | \"DEU\"\n | \"DJI\"\n | \"DMA\"\n | \"DNK\"\n | \"DOM\"\n | \"DZA\"\n | \"ECU\"\n | \"EGY\"\n | \"ERI\"\n | \"ESH\"\n | \"ESP\"\n | \"EST\"\n | \"ETH\"\n | \"FIN\"\n | \"FJI\"\n | \"FLK\"\n | \"FRA\"\n | \"FRO\"\n | \"FSM\"\n | \"GAB\"\n | \"GBR\"\n | \"GEO\"\n | \"GGY\"\n | \"GHA\"\n | \"GIB\"\n | \"GIN\"\n | \"GLP\"\n | \"GMB\"\n | \"GNB\"\n | \"GNQ\"\n | \"GRC\"\n | \"GRD\"\n | \"GRL\"\n | \"GTM\"\n | \"GUF\"\n | \"GUM\"\n | \"GUY\"\n | \"HKG\"\n | \"HMD\"\n | \"HND\"\n | \"HRV\"\n | \"HTI\"\n | \"HUN\"\n | \"IDN\"\n | \"IMN\"\n | \"IND\"\n | \"IOT\"\n | \"IRL\"\n | \"IRN\"\n | \"IRQ\"\n | \"ISL\"\n | \"ISR\"\n | \"ITA\"\n | \"JAM\"\n | \"JEY\"\n | \"JOR\"\n | \"JPN\"\n | \"KAZ\"\n | \"KEN\"\n | \"KGZ\"\n | \"KHM\"\n | \"KIR\"\n | \"KNA\"\n | \"KOR\"\n | \"KWT\"\n | \"LAO\"\n | \"LBN\"\n | \"LBR\"\n | \"LBY\"\n | \"LCA\"\n | \"LIE\"\n | \"LKA\"\n | \"LSO\"\n | \"LTU\"\n | \"LUX\"\n | \"LVA\"\n | \"MAC\"\n | \"MAF\"\n | \"MAR\"\n | \"MCO\"\n | \"MDA\"\n | \"MDG\"\n | \"MDV\"\n | \"MEX\"\n | \"MHL\"\n | \"MKD\"\n | \"MLI\"\n | \"MLT\"\n | \"MMR\"\n | \"MNE\"\n | \"MNG\"\n | \"MNP\"\n | \"MOZ\"\n | \"MRT\"\n | \"MSR\"\n | \"MTQ\"\n | \"MUS\"\n | \"MWI\"\n | \"MYS\"\n | \"MYT\"\n | \"NAM\"\n | \"NCL\"\n | \"NER\"\n | \"NFK\"\n | \"NGA\"\n | \"NIC\"\n | \"NIU\"\n | \"NLD\"\n | \"NOR\"\n | \"NPL\"\n | \"NRU\"\n | \"NZL\"\n | \"OMN\"\n | \"PAK\"\n | \"PAN\"\n | \"PCN\"\n | \"PER\"\n | \"PHL\"\n | \"PLW\"\n | \"PNG\"\n | \"POL\"\n | \"PRI\"\n | \"PRK\"\n | \"PRT\"\n | \"PRY\"\n | \"PSE\"\n | \"PYF\"\n | \"QAT\"\n | \"REU\"\n | \"ROU\"\n | \"RUS\"\n | \"RWA\"\n | \"SAU\"\n | \"SDN\"\n | \"SEN\"\n | \"SGP\"\n | \"SGS\"\n | \"SHN\"\n | \"SJM\"\n | \"SLB\"\n | \"SLE\"\n | \"SLV\"\n | \"SMR\"\n | \"SOM\"\n | \"SPM\"\n | \"SRB\"\n | \"SSD\"\n | \"STP\"\n | \"SUR\"\n | \"SVK\"\n | \"SVN\"\n | \"SWE\"\n | \"SWZ\"\n | \"SXM\"\n | \"SYC\"\n | \"SYR\"\n | \"TCA\"\n | \"TCD\"\n | \"TGO\"\n | \"THA\"\n | \"TJK\"\n | \"TKL\"\n | \"TKM\"\n | \"TLS\"\n | \"TON\"\n | \"TTO\"\n | \"TUN\"\n | \"TUR\"\n | \"TUV\"\n | \"TWN\"\n | \"TZA\"\n | \"UGA\"\n | \"UKR\"\n | \"UMI\"\n | \"URY\"\n | \"USA\"\n | \"UZB\"\n | \"VAT\"\n | \"VCT\"\n | \"VEN\"\n | \"VGB\"\n | \"VIR\"\n | \"VNM\"\n | \"VUT\"\n | \"WLF\"\n | \"WSM\"\n | \"XKX\"\n | \"YEM\"\n | \"ZAF\"\n | \"ZMB\"\n | \"ZWE\"\n\n/**\n * Enum representing the allowed ISO-3166 alpha-3 country codes.\n * Provides a more readable way to reference country codes.\n *\n * @example\n * const malaysiaCode = CountryCodeEnum.MYS;\n * console.log(malaysiaCode); // Output: \"MYS\"\n */\nexport enum CountryCodeEnum {\n ABW = \"ABW\",\n AFG = \"AFG\",\n AGO = \"AGO\",\n AIA = \"AIA\",\n ALA = \"ALA\",\n ALB = \"ALB\",\n AND = \"AND\",\n ANT = \"ANT\",\n ARE = \"ARE\",\n ARG = \"ARG\",\n ARM = \"ARM\",\n ASM = \"ASM\",\n ATA = \"ATA\",\n ATF = \"ATF\",\n ATG = \"ATG\",\n AUS = \"AUS\",\n AUT = \"AUT\",\n AZE = \"AZE\",\n BDI = \"BDI\",\n BEL = \"BEL\",\n BEN = \"BEN\",\n BES = \"BES\",\n BFA = \"BFA\",\n BGD = \"BGD\",\n BGR = \"BGR\",\n BHR = \"BHR\",\n BHS = \"BHS\",\n BIH = \"BIH\",\n BLM = \"BLM\",\n BLR = \"BLR\",\n BLZ = \"BLZ\",\n BMU = \"BMU\",\n BOL = \"BOL\",\n BRA = \"BRA\",\n BRB = \"BRB\",\n BRN = \"BRN\",\n BTN = \"BTN\",\n BVT = \"BVT\",\n BWA = \"BWA\",\n CAF = \"CAF\",\n CAN = \"CAN\",\n CCK = \"CCK\",\n CHE = \"CHE\",\n CHL = \"CHL\",\n CHN = \"CHN\",\n CIV = \"CIV\",\n CMR = \"CMR\",\n COD = \"COD\",\n COG = \"COG\",\n COK = \"COK\",\n COL = \"COL\",\n COM = \"COM\",\n CPV = \"CPV\",\n CRI = \"CRI\",\n CUB = \"CUB\",\n CUW = \"CUW\",\n CXR = \"CXR\",\n CYM = \"CYM\",\n CYP = \"CYP\",\n CZE = \"CZE\",\n DEU = \"DEU\",\n DJI = \"DJI\",\n DMA = \"DMA\",\n DNK = \"DNK\",\n DOM = \"DOM\",\n DZA = \"DZA\",\n ECU = \"ECU\",\n EGY = \"EGY\",\n ERI = \"ERI\",\n ESH = \"ESH\",\n ESP = \"ESP\",\n EST = \"EST\",\n ETH = \"ETH\",\n FIN = \"FIN\",\n FJI = \"FJI\",\n FLK = \"FLK\",\n FRA = \"FRA\",\n FRO = \"FRO\",\n FSM = \"FSM\",\n GAB = \"GAB\",\n GBR = \"GBR\",\n GEO = \"GEO\",\n GGY = \"GGY\",\n GHA = \"GHA\",\n GIB = \"GIB\",\n GIN = \"GIN\",\n GLP = \"GLP\",\n GMB = \"GMB\",\n GNB = \"GNB\",\n GNQ = \"GNQ\",\n GRC = \"GRC\",\n GRD = \"GRD\",\n GRL = \"GRL\",\n GTM = \"GTM\",\n GUF = \"GUF\",\n GUM = \"GUM\",\n GUY = \"GUY\",\n HKG = \"HKG\",\n HMD = \"HMD\",\n HND = \"HND\",\n HRV = \"HRV\",\n HTI = \"HTI\",\n HUN = \"HUN\",\n IDN = \"IDN\",\n IMN = \"IMN\",\n IND = \"IND\",\n IOT = \"IOT\",\n IRL = \"IRL\",\n IRN = \"IRN\",\n IRQ = \"IRQ\",\n ISL = \"ISL\",\n ISR = \"ISR\",\n ITA = \"ITA\",\n JAM = \"JAM\",\n JEY = \"JEY\",\n JOR = \"JOR\",\n JPN = \"JPN\",\n KAZ = \"KAZ\",\n KEN = \"KEN\",\n KGZ = \"KGZ\",\n KHM = \"KHM\",\n KIR = \"KIR\",\n KNA = \"KNA\",\n KOR = \"KOR\",\n KWT = \"KWT\",\n LAO = \"LAO\",\n LBN = \"LBN\",\n LBR = \"LBR\",\n LBY = \"LBY\",\n LCA = \"LCA\",\n LIE = \"LIE\",\n LKA = \"LKA\",\n LSO = \"LSO\",\n LTU = \"LTU\",\n LUX = \"LUX\",\n LVA = \"LVA\",\n MAC = \"MAC\",\n MAF = \"MAF\",\n MAR = \"MAR\",\n MCO = \"MCO\",\n MDA = \"MDA\",\n MDG = \"MDG\",\n MDV = \"MDV\",\n MEX = \"MEX\",\n MHL = \"MHL\",\n MKD = \"MKD\",\n MLI = \"MLI\",\n MLT = \"MLT\",\n MMR = \"MMR\",\n MNE = \"MNE\",\n MNG = \"MNG\",\n MNP = \"MNP\",\n MOZ = \"MOZ\",\n MRT = \"MRT\",\n MSR = \"MSR\",\n MTQ = \"MTQ\",\n MUS = \"MUS\",\n MWI = \"MWI\",\n MYS = \"MYS\",\n MYT = \"MYT\",\n NAM = \"NAM\",\n NCL = \"NCL\",\n NER = \"NER\",\n NFK = \"NFK\",\n NGA = \"NGA\",\n NIC = \"NIC\",\n NIU = \"NIU\",\n NLD = \"NLD\",\n NOR = \"NOR\",\n NPL = \"NPL\",\n NRU = \"NRU\",\n NZL = \"NZL\",\n OMN = \"OMN\",\n PAK = \"PAK\",\n PAN = \"PAN\",\n PCN = \"PCN\",\n PER = \"PER\",\n PHL = \"PHL\",\n PLW = \"PLW\",\n PNG = \"PNG\",\n POL = \"POL\",\n PRI = \"PRI\",\n PRK = \"PRK\",\n PRT = \"PRT\",\n PRY = \"PRY\",\n PSE = \"PSE\",\n PYF = \"PYF\",\n QAT = \"QAT\",\n REU = \"REU\",\n ROU = \"ROU\",\n RUS = \"RUS\",\n RWA = \"RWA\",\n SAU = \"SAU\",\n SDN = \"SDN\",\n SEN = \"SEN\",\n SGP = \"SGP\",\n SGS = \"SGS\",\n SHN = \"SHN\",\n SJM = \"SJM\",\n SLB = \"SLB\",\n SLE = \"SLE\",\n SLV = \"SLV\",\n SMR = \"SMR\",\n SOM = \"SOM\",\n SPM = \"SPM\",\n SRB = \"SRB\",\n SSD = \"SSD\",\n STP = \"STP\",\n SUR = \"SUR\",\n SVK = \"SVK\",\n SVN = \"SVN\",\n SWE = \"SWE\",\n SWZ = \"SWZ\",\n SXM = \"SXM\",\n SYC = \"SYC\",\n SYR = \"SYR\",\n TCA = \"TCA\",\n TCD = \"TCD\",\n TGO = \"TGO\",\n THA = \"THA\",\n TJK = \"TJK\",\n TKL = \"TKL\",\n TKM = \"TKM\",\n TLS = \"TLS\",\n TON = \"TON\",\n TTO = \"TTO\",\n TUN = \"TUN\",\n TUR = \"TUR\",\n TUV = \"TUV\",\n TWN = \"TWN\",\n TZA = \"TZA\",\n UGA = \"UGA\",\n UKR = \"UKR\",\n UMI = \"UMI\",\n URY = \"URY\",\n USA = \"USA\",\n UZB = \"UZB\",\n VAT = \"VAT\",\n VCT = \"VCT\",\n VEN = \"VEN\",\n VGB = \"VGB\",\n VIR = \"VIR\",\n VNM = \"VNM\",\n VUT = \"VUT\",\n WLF = \"WLF\",\n WSM = \"WSM\",\n XKX = \"XKX\",\n YEM = \"YEM\",\n ZAF = \"ZAF\",\n ZMB = \"ZMB\",\n ZWE = \"ZWE\",\n}\n\n/**\n * Enum mapping ISO-3166 alpha-3 country codes to their corresponding country names.\n * Provides a way to easily retrieve the name of a country using its code.\n *\n * @example\n * import { CountryCodeEnum, CountryNameEnum } from './country-code';\n * const malaysiaName = CountryNameEnum[CountryCodeEnum.MYS];\n * console.log(malaysiaName); // Output: MALAYSIA\n */\nexport enum CountryNameEnum {\n ABW = \"ARUBA\",\n AFG = \"AFGHANISTAN\",\n AGO = \"ANGOLA\",\n AIA = \"ANGUILLA\",\n ALA = \"ALAND ISLANDS\",\n ALB = \"ALBANIA\",\n AND = \"ANDORA\",\n ANT = \"NETHERLANDS ANTILLES\",\n ARE = \"UNITED ARAB EMIRATES\",\n ARG = \"ARGENTINA\",\n ARM = \"ARMENIA\",\n ASM = \"AMERICAN SAMOA\",\n ATA = \"ANTARCTICA\",\n ATF = \"FRENCH SOUTHERN TERRITORIES\",\n ATG = \"ANTIGUA AND BARBUDA\",\n AUS = \"AUSTRALIA\",\n AUT = \"AUSTRIA\",\n AZE = \"AZERBAIDJAN\",\n BDI = \"BURUNDI\",\n BEL = \"BELGIUM\",\n BEN = \"BENIN\",\n BES = \"BONAIRE, SINT EUSTATIUS AND SABA\",\n BFA = \"BURKINA FASO\",\n BGD = \"BANGLADESH\",\n BGR = \"BULGARIA\",\n BHR = \"BAHRAIN\",\n BHS = \"BAHAMAS\",\n BIH = \"BOSNIA AND HERZEGOVINA\",\n BLM = \"SAINT BARTHELEMY\",\n BLR = \"BELARUS\",\n BLZ = \"BELIZE\",\n BMU = \"BERMUDA\",\n BOL = \"BOLIVIA\",\n BRA = \"BRAZIL\",\n BRB = \"BARBADOS\",\n BRN = \"BRUNEI DARUSSALAM\",\n BTN = \"BHUTAN\",\n BVT = \"BOUVET ISLAND\",\n BWA = \"BOTSWANA\",\n CAF = \"CENTRAL AFRICAN REPUBLIC\",\n CAN = \"CANADA\",\n CCK = \"COCOS ISLAND\",\n CHE = \"SWITZERLAND\",\n CHL = \"CHILE\",\n CHN = \"CHINA\",\n CIV = \"COTE D'IVOIRE\",\n CMR = \"CAMEROON\",\n COD = \"CONGO, THE DEMOCRATIC REPUBLIC\",\n COG = \"CONGO\",\n COK = \"COOK ISLANDS\",\n COL = \"COLOMBIA\",\n COM = \"COMOROS\",\n CPV = \"CAPE VERDE\",\n CRI = \"COSTA RICA\",\n CUB = \"CUBA\",\n CUW = \"CURACAO\",\n CXR = \"CHRISTMAS ISLANDS\",\n CYM = \"CAYMAN ISLANDS\",\n CYP = \"CYPRUS\",\n CZE = \"CZECH REPUBLIC\",\n DEU = \"GERMANY\",\n DJI = \"DJIBOUTI\",\n DMA = \"DOMINICA\",\n DNK = \"DENMARK\",\n DOM = \"DOMINICAN REPUBLIC\",\n DZA = \"ALGERIA\",\n ECU = \"ECUADOR\",\n EGY = \"EGYPT\",\n ERI = \"ERITREA\",\n ESH = \"WESTERN SAHARA\",\n ESP = \"SPAIN\",\n EST = \"ESTONIA\",\n ETH = \"ETHIOPIA\",\n FIN = \"FINLAND\",\n FJI = \"FIJI\",\n FLK = \"FALKLAND ISLANDS (MALVINAS)\",\n FRA = \"FRANCE\",\n FRO = \"FAEROE ISLANDS\",\n FSM = \"MICRONESIA, FEDERATED STATES OF\",\n GAB = \"GABON\",\n GBR = \"UNITED KINGDOM\",\n GEO = \"GEORGIA\",\n GGY = \"GUERNSEY\",\n GHA = \"GHANA\",\n GIB = \"GIBRALTAR\",\n GIN = \"GUINEA\",\n GLP = \"GUADELOUPE\",\n GMB = \"GAMBIA\",\n GNB = \"GUINEA-BISSAU\",\n GNQ = \"EQUATORIAL GUINEA\",\n GRC = \"GREECE\",\n GRD = \"GRENADA\",\n GRL = \"GREENLAND\",\n GTM = \"GUATEMALA\",\n GUF = \"FRENCH GUIANA\",\n GUM = \"GUAM\",\n GUY = \"GUYANA\",\n HKG = \"HONG KONG\",\n HMD = \"HEARD AND MCDONALD ISLANDS\",\n HND = \"HONDURAS\",\n HRV = \"CROATIA\",\n HTI = \"HAITI\",\n HUN = \"HUNGARY\",\n IDN = \"INDONESIA\",\n IMN = \"ISLE OF MAN\",\n IND = \"INDIA\",\n IOT = \"BRITISH INDIAN OCEAN TERRITORY\",\n IRL = \"IRELAND\",\n IRN = \"IRAN\",\n IRQ = \"IRAQ\",\n ISL = \"ICELAND\",\n ISR = \"ISRAEL\",\n ITA = \"ITALY\",\n JAM = \"JAMAICA\",\n JEY = \"JERSEY (CHANNEL ISLANDS)\",\n JOR = \"JORDAN\",\n JPN = \"JAPAN\",\n KAZ = \"KAZAKHSTAN\",\n KEN = \"KENYA\",\n KGZ = \"KYRGYZSTAN\",\n KHM = \"CAMBODIA\",\n KIR = \"KIRIBATI\",\n KNA = \"ST.KITTS AND NEVIS\",\n KOR = \"THE REPUBLIC OF KOREA\",\n KWT = \"KUWAIT\",\n LAO = \"LAOS\",\n LBN = \"LEBANON\",\n LBR = \"LIBERIA\",\n LBY = \"LIBYAN ARAB JAMAHIRIYA\",\n LCA = \"SAINT LUCIA\",\n LIE = \"LIECHTENSTEIN\",\n LKA = \"SRI LANKA\",\n LSO = \"LESOTHO\",\n LTU = \"LITHUANIA\",\n LUX = \"LUXEMBOURG\",\n LVA = \"LATVIA\",\n MAC = \"MACAO\",\n MAF = \"SAINT MARTIN (FRENCH PART)\",\n MAR = \"MOROCCO\",\n MCO = \"MONACO\",\n MDA = \"MOLDOVA, REPUBLIC OF\",\n MDG = \"MADAGASCAR\",\n MDV = \"MALDIVES\",\n MEX = \"MEXICO\",\n MHL = \"MARSHALL ISLANDS\",\n MKD = \"MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF\",\n MLI = \"MALI\",\n MLT = \"MALTA\",\n MMR = \"MYANMAR\",\n MNE = \"MONTENEGRO\",\n MNG = \"MONGOLIA\",\n MNP = \"NORTHERN MARIANA ISLANDS\",\n MOZ = \"MOZAMBIQUE\",\n MRT = \"MAURITANIA\",\n MSR = \"MONTSERRAT\",\n MTQ = \"MARTINIQUE\",\n MUS = \"MAURITIUS\",\n MWI = \"MALAWI\",\n MYS = \"MALAYSIA\",\n MYT = \"MAYOTTE\",\n NAM = \"NAMIBIA\",\n NCL = \"NEW CALEDONIA\",\n NER = \"NIGER\",\n NFK = \"NORFOLK ISLAND\",\n NGA = \"NIGERIA\",\n NIC = \"NICARAGUA\",\n NIU = \"NIUE\",\n NLD = \"NETHERLANDS\",\n NOR = \"NORWAY\",\n NPL = \"NEPAL\",\n NRU = \"NAURU\",\n NZL = \"NEW ZEALAND\",\n OMN = \"OMAN\",\n PAK = \"PAKISTAN\",\n PAN = \"PANAMA\",\n PCN = \"PITCAIRN\",\n PER = \"PERU\",\n PHL = \"PHILIPPINES\",\n PLW = \"PALAU\",\n PNG = \"PAPUA NEW GUINEA\",\n POL = \"POLAND\",\n PRI = \"PUERTO RICO\",\n PRK = \"DEMOC.PEOPLES REP.OF KOREA\",\n PRT = \"PORTUGAL\",\n PRY = \"PARAGUAY\",\n PSE = \"PALESTINIAN TERRITORY, OCCUPIED\",\n PYF = \"FRENCH POLYNESIA\",\n QAT = \"QATAR\",\n REU = \"REUNION\",\n ROU = \"ROMANIA\",\n RUS = \"RUSSIAN FEDERATION (USSR)\",\n RWA = \"RWANDA\",\n SAU = \"SAUDI ARABIA\",\n SDN = \"SUDAN\",\n SEN = \"SENEGAL\",\n SGP = \"SINGAPORE\",\n SGS = \"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLAND\",\n SHN = \"ST. HELENA\",\n SJM = \"SVALBARD AND JAN MAYEN ISLANDS\",\n SLB = \"SOLOMON ISLANDS\",\n SLE = \"SIERRA LEONE\",\n SLV = \"EL SALVADOR\",\n SMR = \"SAN MARINO\",\n SOM = \"SOMALIA\",\n SPM = \"ST. PIERRE AND MIQUELON\",\n SRB = \"SERBIA\",\n SSD = \"SOUTH SUDAN\",\n STP = \"SAO TOME AND PRINCIPE\",\n SUR = \"SURINAME\",\n SVK = \"SLOVAK REPUBLIC\",\n SVN = \"SLOVENIA\",\n SWE = \"SWEDEN\",\n SWZ = \"ESWATINI, KINGDOM OF (SWAZILAND)\",\n SXM = \"SINT MAARTEN (DUTCH PART)\",\n SYC = \"SEYCHELLES\",\n SYR = \"SYRIAN ARAB REPUBLIC\",\n TCA = \"TURKS AND CAICOS ISLANDS\",\n TCD = \"CHAD\",\n TGO = \"TOGO\",\n THA = \"THAILAND\",\n TJK = \"TAJIKISTAN\",\n TKL = \"TOKELAU\",\n TKM = \"TURKMENISTAN\",\n TLS = \"TIMOR-LESTE\",\n TON = \"TONGA\",\n TTO = \"TRINIDAD AND TOBAGO\",\n TUN = \"TUNISIA\",\n TUR = \"TURKIYE\",\n TUV = \"TUVALU\",\n TWN = \"TAIWAN\",\n TZA = \"TANZANIA UNITED REPUBLIC\",\n UGA = \"UGANDA\",\n UKR = \"UKRAINE\",\n UMI = \"UNITED STATES MINOR OUTLYING ISLANDS\",\n URY = \"URUGUAY\",\n USA = \"UNITED STATES OF AMERICA\",\n UZB = \"UZBEKISTAN\",\n VAT = \"VATICAN CITY STATE (HOLY SEE)\",\n VCT = \"SAINT VINCENT AND GRENADINES\",\n VEN = \"VENEZUELA\",\n VGB = \"VIRGIN ISLANDS(BRITISH)\",\n VIR = \"VIRGIN ISLANDS(US)\",\n VNM = \"VIETNAM\",\n VUT = \"VANUATU\",\n WLF = \"WALLIS AND FUTUNA ISLANDS\",\n WSM = \"SAMOA\",\n XKX = \"KOSOVO\",\n YEM = \"YEMEN\",\n ZAF = \"SOUTH AFRICA\",\n ZMB = \"ZAMBIA\",\n ZWE = \"ZIMBABWE\",\n}\n\n/**\n * Interface representing a country code entry.\n * Contains the ISO-3166 alpha-3 code and the country name.\n */\nexport interface Country {\n code: CountryCode\n name: string\n}\n"],"mappings":";;;;;;;;;;AAyQA,IAAY,8DAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD;;;;;;;;;;AAWD,IAAY,8DAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
1
+ {"version":3,"file":"index9.cjs","names":[],"sources":["../src/types/notifications.d.ts"],"sourcesContent":["export type NotificationType = 3 | 6 | 7 | 8 | 10 | 11 | 15 | 26 | 33 | 34 | 35\n\nexport enum NotificationTypeEnum {\n 'Profile data validation' = 3,\n 'Document received' = 6,\n 'Document validated' = 7,\n 'Document cancelled' = 8,\n 'User profile changed' = 10,\n 'Taxpayer profile changed' = 11,\n 'Document rejection initiated' = 15,\n 'ERP data validation' = 26,\n 'Documents processing summary' = 33,\n 'Document Template Published' = 34,\n 'Document Template Deletion' = 35,\n}\n\nexport type NotificationStatus = 1 | 2 | 3 | 4 | 5\n\nexport enum NotificationStatusEnum {\n 'New' = 1,\n 'Pending' = 2,\n 'Batched' = 3,\n 'Delivered' = 4,\n 'Error' = 5,\n}\n\nexport type NotificationDeliveryAttempt = {\n attemptDateTime: string\n status: string\n statusDetails: string\n}\n\nexport type NotificationMetadata = {\n hasNext: boolean\n}\n\nexport type Notification = {\n notificationId: string\n receiverNName: string\n notificationDeliveryId: string\n creationDateTime: string\n receivedDateTime: string\n notificationSubject: string\n deliveredDateTime: string\n typeId: string\n typeName: string\n finalMessage: string\n address: string\n language: string\n status: string\n deliveryAttempts: NotificationDeliveryAttempt[]\n}\n\nexport type NotificationResponse = {\n notifications: Notification[]\n metadata: NotificationMetadata\n}\n\nexport type NotificationSearchParams = {\n dateFrom?: string\n dateTo?: string\n type?: NotificationType\n language?: string\n status?: NotificationStatus\n pageNo?: number\n pageSize?: number\n}\n"],"mappings":";;AAEA,IAAY,wEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD;AAID,IAAY,4EAAL;AACL;AACA;AACA;AACA;AACA;;AACD"}
@@ -1,5 +1,5 @@
1
1
  //#region src/utils/apiQueue.d.ts
2
- // A very small utility that provides per-endpoint request queuing with fixed-window rate-limits.
2
+ // A very small utility that provides per-endpoint request queuing with rate-limits.
3
3
  // The goal is to make sure that we never exceed the vendor-defined limits while also ensuring
4
4
  // that every request is eventually executed.
5
5
  //
@@ -22,14 +22,24 @@ Search Taxpayer's TIN : 60
22
22
  Taxpayer's QR Code : 60
23
23
  */
24
24
  type ApiCategory = "loginTaxpayer" | "loginIntermediary" | "submitDocuments" | "getSubmission" | "cancelDocument" | "rejectDocument" | "getDocument" | "getDocumentDetails" | "getRecentDocuments" | "searchDocuments" | "searchTin" | "taxpayerQr" | "default";
25
+ type Task<T> = () => Promise<T>;
25
26
  /**
26
27
  * Public helper to schedule a request according to the category's limits.
28
+ * Rate limits are enforced per clientId, so multiple instances with the same
29
+ * clientId will share rate limiters, while different clientIds get separate limiters.
30
+ *
31
+ * This implementation uses a sliding window to track all requests within the time window.
27
32
  */
28
- declare function queueRequest<T>(category: ApiCategory, fn: () => Promise<T>, debug?: boolean): Promise<T>;
33
+ declare function queueRequest<T>(clientId: string, category: ApiCategory, task: Task<T>, debug?: boolean): Promise<T>;
34
+ /**
35
+ * Cleanup function to clear all queues and timers for a specific client.
36
+ * Useful for testing or cleanup on application shutdown.
37
+ */
38
+ declare function clearQueue(clientId: string, category?: ApiCategory): void;
29
39
  /**
30
40
  * Very naive path-based category detection. If no matcher fits, the `default` category
31
41
  * (effectively unlimited) is returned. Adjust these heuristics as your API surface evolves.
32
42
  */
33
43
  declare function categorizeRequest(path: string, method?: string): ApiCategory;
34
44
  //#endregion
35
- export { ApiCategory, categorizeRequest, queueRequest };
45
+ export { ApiCategory, categorizeRequest, clearQueue, queueRequest };
@@ -1,3 +1,3 @@
1
- import { categorizeRequest, queueRequest } from "../apiQueue-CrR6pgYn.js";
1
+ import { categorizeRequest, clearQueue, queueRequest } from "../apiQueue-B6Q644Bz.js";
2
2
 
3
- export { categorizeRequest, queueRequest };
3
+ export { categorizeRequest, clearQueue, queueRequest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ripwords/myinvois-client",
3
- "version": "0.2.40",
3
+ "version": "0.3.0",
4
4
  "description": "MyInvois client",
5
5
  "scripts": {
6
6
  "build": "tsdown",
@@ -1,181 +0,0 @@
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 token-bucket style rate-limiter with queuing.
59
- * Uses a sliding window approach to allow bursts while respecting overall limits.
60
- * Each category gets its own instance so limits remain isolated.
61
- */
62
- var RateLimiter = class {
63
- limit;
64
- windowMs;
65
- minInterval;
66
- queue = [];
67
- nextAvailable = 0;
68
- timer = null;
69
- requestTimes = [];
70
- isProcessing = false;
71
- constructor(config) {
72
- this.limit = config.limit;
73
- this.windowMs = config.windowMs;
74
- const baseInterval = Math.ceil(this.windowMs / this.limit * .5);
75
- const isTestEnv = process.env.NODE_ENV === "test";
76
- const forceReal = process.env.APIQUEUE_REAL_INTERVAL === "true";
77
- this.minInterval = isTestEnv && !forceReal ? Math.min(10, baseInterval) : baseInterval;
78
- }
79
- drainQueue() {
80
- if (this.isProcessing || this.queue.length === 0) return;
81
- this.isProcessing = true;
82
- try {
83
- const now = Date.now();
84
- this.requestTimes = this.requestTimes.filter((time) => now - time < this.windowMs);
85
- if (this.requestTimes.length >= this.limit) {
86
- const oldestRequest = Math.min(...this.requestTimes);
87
- const nextAvailable = oldestRequest + this.windowMs;
88
- this.scheduleNextDrain(nextAvailable - now);
89
- return;
90
- }
91
- if (now < this.nextAvailable) {
92
- this.scheduleNextDrain(this.nextAvailable - now);
93
- return;
94
- }
95
- const next = this.queue.shift();
96
- const requestStartTime = Date.now();
97
- this.requestTimes.push(requestStartTime);
98
- this.nextAvailable = requestStartTime + this.minInterval;
99
- next();
100
- } finally {
101
- this.isProcessing = false;
102
- }
103
- if (this.queue.length > 0) {
104
- const now = Date.now();
105
- const delay = Math.max(1, this.nextAvailable - now);
106
- this.scheduleNextDrain(delay);
107
- }
108
- }
109
- scheduleNextDrain(delay) {
110
- if (this.timer) clearTimeout(this.timer);
111
- this.timer = setTimeout(() => {
112
- this.timer = null;
113
- this.drainQueue();
114
- }, Math.max(0, delay));
115
- }
116
- get queueSize() {
117
- return this.queue.length;
118
- }
119
- cleanup() {
120
- if (this.timer) {
121
- clearTimeout(this.timer);
122
- this.timer = null;
123
- }
124
- this.queue = [];
125
- this.requestTimes = [];
126
- this.isProcessing = false;
127
- }
128
- schedule(fn, debug = false, category) {
129
- return new Promise((resolve, reject) => {
130
- const execute = () => {
131
- if (debug && category) console.log(`[apiQueue] ▶️ Executing request (${category}). Remaining queue: ${this.queue.length}`);
132
- try {
133
- const result = fn();
134
- if (result && typeof result.then === "function") result.then(resolve).catch(reject);
135
- else resolve(result);
136
- } catch (err) {
137
- reject(err);
138
- }
139
- };
140
- if (debug && category) console.log(`[apiQueue] ⏳ Queued request (${category}). Queue length before push: ${this.queue.length}`);
141
- this.queue.push(execute);
142
- this.drainQueue();
143
- });
144
- }
145
- };
146
- const limiterRegistry = /* @__PURE__ */ new Map();
147
- function getLimiter(category) {
148
- if (!limiterRegistry.has(category)) limiterRegistry.set(category, new RateLimiter(RATE_LIMITS[category]));
149
- return limiterRegistry.get(category);
150
- }
151
- /**
152
- * Public helper to schedule a request according to the category's limits.
153
- */
154
- function queueRequest(category, fn, debug = false) {
155
- const limiter = getLimiter(category);
156
- return limiter.schedule(fn, debug, category);
157
- }
158
- /**
159
- * Very naive path-based category detection. If no matcher fits, the `default` category
160
- * (effectively unlimited) is returned. Adjust these heuristics as your API surface evolves.
161
- */
162
- function categorizeRequest(path, method = "GET") {
163
- const cleanPath = path.toLowerCase();
164
- const isPost = method?.toUpperCase() === "POST";
165
- if (cleanPath.includes("/documentsubmissions")) return isPost ? "submitDocuments" : "getSubmission";
166
- if (cleanPath.includes("/documents/recent")) return "getRecentDocuments";
167
- if (cleanPath.includes("/documents/search")) return "searchDocuments";
168
- if (cleanPath.includes("/documents/state/") && cleanPath.endsWith("/state")) return "cancelDocument";
169
- if (/\/documents\/[^/]+\/raw$/.test(cleanPath)) return "getDocument";
170
- if (/\/documents\/[^/]+\/details$/.test(cleanPath)) return "getDocumentDetails";
171
- if (cleanPath.includes("/taxpayer/search/tin")) return "searchTin";
172
- if (cleanPath.includes("/taxpayer/validate/")) return "searchTin";
173
- if (cleanPath.includes("/taxpayer/qrcode")) return "taxpayerQr";
174
- if (cleanPath.includes("/searchtin")) return "searchTin";
175
- if (cleanPath.includes("/qrcode")) return "taxpayerQr";
176
- if (cleanPath.includes("/connect/token")) return "loginTaxpayer";
177
- return "default";
178
- }
179
-
180
- //#endregion
181
- export { categorizeRequest, queueRequest };
@@ -1,194 +0,0 @@
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 token-bucket style rate-limiter with queuing.
60
- * Uses a sliding window approach to allow bursts while respecting overall limits.
61
- * Each category gets its own instance so limits remain isolated.
62
- */
63
- var RateLimiter = class {
64
- limit;
65
- windowMs;
66
- minInterval;
67
- queue = [];
68
- nextAvailable = 0;
69
- timer = null;
70
- requestTimes = [];
71
- isProcessing = false;
72
- constructor(config) {
73
- this.limit = config.limit;
74
- this.windowMs = config.windowMs;
75
- const baseInterval = Math.ceil(this.windowMs / this.limit * .5);
76
- const isTestEnv = process.env.NODE_ENV === "test";
77
- const forceReal = process.env.APIQUEUE_REAL_INTERVAL === "true";
78
- this.minInterval = isTestEnv && !forceReal ? Math.min(10, baseInterval) : baseInterval;
79
- }
80
- drainQueue() {
81
- if (this.isProcessing || this.queue.length === 0) return;
82
- this.isProcessing = true;
83
- try {
84
- const now = Date.now();
85
- this.requestTimes = this.requestTimes.filter((time) => now - time < this.windowMs);
86
- if (this.requestTimes.length >= this.limit) {
87
- const oldestRequest = Math.min(...this.requestTimes);
88
- const nextAvailable = oldestRequest + this.windowMs;
89
- this.scheduleNextDrain(nextAvailable - now);
90
- return;
91
- }
92
- if (now < this.nextAvailable) {
93
- this.scheduleNextDrain(this.nextAvailable - now);
94
- return;
95
- }
96
- const next = this.queue.shift();
97
- const requestStartTime = Date.now();
98
- this.requestTimes.push(requestStartTime);
99
- this.nextAvailable = requestStartTime + this.minInterval;
100
- next();
101
- } finally {
102
- this.isProcessing = false;
103
- }
104
- if (this.queue.length > 0) {
105
- const now = Date.now();
106
- const delay = Math.max(1, this.nextAvailable - now);
107
- this.scheduleNextDrain(delay);
108
- }
109
- }
110
- scheduleNextDrain(delay) {
111
- if (this.timer) clearTimeout(this.timer);
112
- this.timer = setTimeout(() => {
113
- this.timer = null;
114
- this.drainQueue();
115
- }, Math.max(0, delay));
116
- }
117
- get queueSize() {
118
- return this.queue.length;
119
- }
120
- cleanup() {
121
- if (this.timer) {
122
- clearTimeout(this.timer);
123
- this.timer = null;
124
- }
125
- this.queue = [];
126
- this.requestTimes = [];
127
- this.isProcessing = false;
128
- }
129
- schedule(fn, debug = false, category) {
130
- return new Promise((resolve, reject) => {
131
- const execute = () => {
132
- if (debug && category) console.log(`[apiQueue] ▶️ Executing request (${category}). Remaining queue: ${this.queue.length}`);
133
- try {
134
- const result = fn();
135
- if (result && typeof result.then === "function") result.then(resolve).catch(reject);
136
- else resolve(result);
137
- } catch (err) {
138
- reject(err);
139
- }
140
- };
141
- if (debug && category) console.log(`[apiQueue] ⏳ Queued request (${category}). Queue length before push: ${this.queue.length}`);
142
- this.queue.push(execute);
143
- this.drainQueue();
144
- });
145
- }
146
- };
147
- const limiterRegistry = /* @__PURE__ */ new Map();
148
- function getLimiter(category) {
149
- if (!limiterRegistry.has(category)) limiterRegistry.set(category, new RateLimiter(RATE_LIMITS[category]));
150
- return limiterRegistry.get(category);
151
- }
152
- /**
153
- * Public helper to schedule a request according to the category's limits.
154
- */
155
- function queueRequest(category, fn, debug = false) {
156
- const limiter = getLimiter(category);
157
- return limiter.schedule(fn, debug, category);
158
- }
159
- /**
160
- * Very naive path-based category detection. If no matcher fits, the `default` category
161
- * (effectively unlimited) is returned. Adjust these heuristics as your API surface evolves.
162
- */
163
- function categorizeRequest(path, method = "GET") {
164
- const cleanPath = path.toLowerCase();
165
- const isPost = method?.toUpperCase() === "POST";
166
- if (cleanPath.includes("/documentsubmissions")) return isPost ? "submitDocuments" : "getSubmission";
167
- if (cleanPath.includes("/documents/recent")) return "getRecentDocuments";
168
- if (cleanPath.includes("/documents/search")) return "searchDocuments";
169
- if (cleanPath.includes("/documents/state/") && cleanPath.endsWith("/state")) return "cancelDocument";
170
- if (/\/documents\/[^/]+\/raw$/.test(cleanPath)) return "getDocument";
171
- if (/\/documents\/[^/]+\/details$/.test(cleanPath)) return "getDocumentDetails";
172
- if (cleanPath.includes("/taxpayer/search/tin")) return "searchTin";
173
- if (cleanPath.includes("/taxpayer/validate/")) return "searchTin";
174
- if (cleanPath.includes("/taxpayer/qrcode")) return "taxpayerQr";
175
- if (cleanPath.includes("/searchtin")) return "searchTin";
176
- if (cleanPath.includes("/qrcode")) return "taxpayerQr";
177
- if (cleanPath.includes("/connect/token")) return "loginTaxpayer";
178
- return "default";
179
- }
180
-
181
- //#endregion
182
- Object.defineProperty(exports, 'categorizeRequest', {
183
- enumerable: true,
184
- get: function () {
185
- return categorizeRequest;
186
- }
187
- });
188
- Object.defineProperty(exports, 'queueRequest', {
189
- enumerable: true,
190
- get: function () {
191
- return queueRequest;
192
- }
193
- });
194
- //# sourceMappingURL=apiQueue-Dj0xtcGe.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiQueue-Dj0xtcGe.cjs","names":["RATE_LIMITS: Record<ApiCategory, RateLimitConfig>","config: RateLimitConfig","delay: number","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 token-bucket style rate-limiter with queuing.\n * Uses a sliding window approach to allow bursts while respecting overall limits.\n * Each category gets its own instance so limits remain isolated.\n */\nclass RateLimiter {\n private readonly limit: number\n private readonly windowMs: number\n private readonly minInterval: number\n\n private queue: Array<() => void> = []\n private nextAvailable = 0 // timestamp (ms) when the next request can be executed\n private timer: NodeJS.Timeout | null = null\n private requestTimes: number[] = [] // Track request timestamps for sliding window\n private isProcessing = false // Prevent race conditions in drainQueue\n\n constructor(config: RateLimitConfig) {\n this.limit = config.limit\n this.windowMs = config.windowMs\n // Use a more reasonable interval that allows bursts while preventing 429s\n // Allow bursts up to 50% of the limit, then space out remaining requests\n const baseInterval = Math.ceil((this.windowMs / this.limit) * 0.5) // 50% of even spacing\n const isTestEnv = process.env.NODE_ENV === 'test'\n const forceReal = process.env.APIQUEUE_REAL_INTERVAL === 'true'\n // In unit-test envs we use minimal spacing unless explicitly forced back on.\n // This prevents test failures while still maintaining some rate limiting\n this.minInterval =\n isTestEnv && !forceReal ? Math.min(10, baseInterval) : baseInterval\n }\n\n private drainQueue() {\n // Prevent race conditions by ensuring only one drainQueue runs at a time\n if (this.isProcessing || this.queue.length === 0) {\n return\n }\n\n this.isProcessing = true\n\n try {\n const now = Date.now()\n\n // Clean up old request times outside the window\n this.requestTimes = this.requestTimes.filter(\n time => now - time < this.windowMs,\n )\n\n // Check if we can make another request within the rate limit\n if (this.requestTimes.length >= this.limit) {\n // We've hit the limit, schedule for when the oldest request expires\n const oldestRequest = Math.min(...this.requestTimes)\n const nextAvailable = oldestRequest + this.windowMs\n\n this.scheduleNextDrain(nextAvailable - now)\n return\n }\n\n // Check minimum interval constraint\n if (now < this.nextAvailable) {\n // Too early – schedule when we're allowed to execute next\n this.scheduleNextDrain(this.nextAvailable - now)\n return\n }\n\n // Execute the next queued task\n const next = this.queue.shift()!\n const requestStartTime = Date.now()\n this.requestTimes.push(requestStartTime)\n this.nextAvailable = requestStartTime + this.minInterval\n\n // Execute the request immediately\n next()\n } finally {\n this.isProcessing = false\n }\n\n // After resetting isProcessing, check if there are more requests\n // and schedule the next drain with appropriate delay\n if (this.queue.length > 0) {\n // Calculate delay until we can process the next request\n const now = Date.now()\n const delay = Math.max(1, this.nextAvailable - now)\n\n // Use scheduleNextDrain to ensure only one timer is active\n this.scheduleNextDrain(delay)\n }\n }\n\n private scheduleNextDrain(delay: number) {\n if (this.timer) {\n clearTimeout(this.timer)\n }\n\n this.timer = setTimeout(\n () => {\n this.timer = null\n this.drainQueue()\n },\n Math.max(0, delay),\n )\n }\n\n get queueSize() {\n return this.queue.length\n }\n\n // Cleanup method to prevent memory leaks\n cleanup() {\n if (this.timer) {\n clearTimeout(this.timer)\n this.timer = null\n }\n this.queue = []\n this.requestTimes = []\n this.isProcessing = false\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 try {\n const result = fn()\n if (result && typeof (result as any).then === 'function') {\n ;(result as Promise<T>).then(resolve).catch(reject)\n } else {\n resolve(result as T)\n }\n } catch (err) {\n reject(err)\n }\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 // -----------------------------\n // v1.0 API endpoint matchers\n // -----------------------------\n\n // Get Recent Documents - /api/v1.0/documents/recent\n if (cleanPath.includes('/documents/recent')) {\n return 'getRecentDocuments'\n }\n\n // Search Documents - /api/v1.0/documents/search\n if (cleanPath.includes('/documents/search')) {\n return 'searchDocuments'\n }\n\n // Document state actions (cancel/reject) - PUT /api/v1.0/documents/state/{uuid}/state\n // Both cancel and reject use the same endpoint, differentiated only by request body\n if (cleanPath.includes('/documents/state/') && cleanPath.endsWith('/state')) {\n // Both cancelDocument and rejectDocument share the same rate limit (12 RPM)\n // Use cancelDocument category for both since they share the same bucket\n return 'cancelDocument'\n }\n\n // Document raw content - /api/v1.0/documents/{uuid}/raw\n if (/\\/documents\\/[^/]+\\/raw$/.test(cleanPath)) {\n return 'getDocument'\n }\n\n // Document details - /api/v1.0/documents/{uuid}/details\n if (/\\/documents\\/[^/]+\\/details$/.test(cleanPath)) {\n return 'getDocumentDetails'\n }\n\n // Taxpayer TIN search & validation share same limit bucket\n if (cleanPath.includes('/taxpayer/search/tin')) return 'searchTin'\n if (cleanPath.includes('/taxpayer/validate/')) return 'searchTin'\n\n // Taxpayer QR code info\n if (cleanPath.includes('/taxpayer/qrcode')) return 'taxpayerQr'\n\n // Legacy matchers (kept for backward compatibility)\n if (cleanPath.includes('/searchtin')) return 'searchTin'\n if (cleanPath.includes('/qrcode')) return 'taxpayerQr'\n if (cleanPath.includes('/connect/token')) {\n return 'loginTaxpayer'\n }\n\n return 'default'\n}\n"],"mappings":"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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index15.cjs","names":[],"sources":["../src/types/notifications.d.ts"],"sourcesContent":["export type NotificationType = 3 | 6 | 7 | 8 | 10 | 11 | 15 | 26 | 33 | 34 | 35\n\nexport enum NotificationTypeEnum {\n 'Profile data validation' = 3,\n 'Document received' = 6,\n 'Document validated' = 7,\n 'Document cancelled' = 8,\n 'User profile changed' = 10,\n 'Taxpayer profile changed' = 11,\n 'Document rejection initiated' = 15,\n 'ERP data validation' = 26,\n 'Documents processing summary' = 33,\n 'Document Template Published' = 34,\n 'Document Template Deletion' = 35,\n}\n\nexport type NotificationStatus = 1 | 2 | 3 | 4 | 5\n\nexport enum NotificationStatusEnum {\n 'New' = 1,\n 'Pending' = 2,\n 'Batched' = 3,\n 'Delivered' = 4,\n 'Error' = 5,\n}\n\nexport type NotificationDeliveryAttempt = {\n attemptDateTime: string\n status: string\n statusDetails: string\n}\n\nexport type NotificationMetadata = {\n hasNext: boolean\n}\n\nexport type Notification = {\n notificationId: string\n receiverNName: string\n notificationDeliveryId: string\n creationDateTime: string\n receivedDateTime: string\n notificationSubject: string\n deliveredDateTime: string\n typeId: string\n typeName: string\n finalMessage: string\n address: string\n language: string\n status: string\n deliveryAttempts: NotificationDeliveryAttempt[]\n}\n\nexport type NotificationResponse = {\n notifications: Notification[]\n metadata: NotificationMetadata\n}\n\nexport type NotificationSearchParams = {\n dateFrom?: string\n dateTo?: string\n type?: NotificationType\n language?: string\n status?: NotificationStatus\n pageNo?: number\n pageSize?: number\n}\n"],"mappings":";;AAEA,IAAY,wEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD;AAID,IAAY,4EAAL;AACL;AACA;AACA;AACA;AACA;;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index16.cjs","names":[],"sources":["../src/types/payment-modes.d.ts"],"sourcesContent":["/**\n * Represents the allowed codes for payment modes.\n * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/payment-methods/\n */\nexport type PaymentModeCode =\n | '01' // Cash\n | '02' // Cheque\n | '03' // Bank Transfer\n | '04' // Credit Card\n | '05' // Debit Card\n | '06' // e-Wallet / Digital Wallet\n | '07' // Digital Bank\n | '08' // Others\n\n/**\n * Enum representing the allowed payment mode codes with descriptive names.\n * Provides a more readable way to reference payment modes.\n *\n * @example\n * const mode = PaymentModeCodeEnum.Cash;\n * console.log(mode); // Output: \"01\"\n */\nexport enum PaymentModeCodeEnum {\n Cash = '01',\n Cheque = '02',\n BankTransfer = '03',\n CreditCard = '04',\n DebitCard = '05',\n EWalletDigitalWallet = '06',\n DigitalBank = '07',\n Others = '08',\n}\n\n/**\n * Interface representing a payment mode entry.\n * Contains the code and its corresponding description.\n */\nexport interface PaymentMode {\n code: PaymentModeCode\n description: string\n}\n"],"mappings":";;;;;;;;;;AAsBA,IAAY,sEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index18.cjs","names":[],"sources":["../src/types/state-codes.d.ts"],"sourcesContent":["/**\n * Represents the allowed codes for Malaysian states and federal territories.\n * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/state-codes/\n */\nexport type StateCode =\n | '01' // Johor\n | '02' // Kedah\n | '03' // Kelantan\n | '04' // Melaka\n | '05' // Negeri Sembilan\n | '06' // Pahang\n | '07' // Pulau Pinang\n | '08' // Perak\n | '09' // Perlis\n | '10' // Selangor\n | '11' // Terengganu\n | '12' // Sabah\n | '13' // Sarawak\n | '14' // Wilayah Persekutuan Kuala Lumpur\n | '15' // Wilayah Persekutuan Labuan\n | '16' // Wilayah Persekutuan Putrajaya\n | '17' // Not Applicable\n\n/**\n * Enum representing the allowed state codes with descriptive names.\n * Provides a more readable way to reference states.\n *\n * @example\n * const code = StateCodeEnum.Selangor;\n * console.log(code); // Output: \"10\"\n */\nexport enum StateCodeEnum {\n Johor = '01',\n Kedah = '02',\n Kelantan = '03',\n Melaka = '04',\n NegeriSembilan = '05',\n Pahang = '06',\n PulauPinang = '07',\n Perak = '08',\n Perlis = '09',\n Selangor = '10',\n Terengganu = '11',\n Sabah = '12',\n Sarawak = '13',\n WPKualaLumpur = '14',\n WPLabuan = '15',\n WPPutrajaya = '16',\n NotApplicable = '17',\n}\n\n/**\n * Interface representing a state code entry.\n * Contains the code and its corresponding name.\n */\nexport interface State {\n code: StateCode\n name: string\n}\n"],"mappings":";;;;;;;;;;AA+BA,IAAY,0DAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index68.cjs","names":[],"sources":["../src/types/unit/SX.d.ts"],"sourcesContent":["/**\n * Unit type codes starting with 'S'.\n */\nexport type UnitTypeCode_SX =\n | 'S3'\n | 'S4'\n | 'SAN'\n | 'SCO'\n | 'SCR'\n | 'SEC'\n | 'SET'\n | 'SG'\n | 'SIE'\n | 'SM3'\n | 'SMI'\n | 'SQ'\n | 'SQR'\n | 'SR'\n | 'STC'\n | 'STI'\n | 'STK'\n | 'STL'\n | 'STN'\n | 'STW'\n | 'SW'\n | 'SX'\n | 'SYR'\n\n/**\n * Enum representing unit type codes starting with 'S'.\n */\nexport enum UnitTypeCodeEnum_SX {\n SquareFootPerSecond = 'S3',\n SquareMetrePerSecond = 'S4',\n HalfYear = 'SAN', // 6 months\n Score = 'SCO',\n Scruple = 'SCR',\n SecondTime = 'SEC', // [unit of time]\n Set = 'SET',\n Segment = 'SG',\n Siemens = 'SIE',\n StandardCubicMetre = 'SM3',\n StatuteMile = 'SMI',\n Square = 'SQ',\n SquareRoofing = 'SQR',\n Strip = 'SR',\n Stick = 'STC',\n StoneUK = 'STI',\n StickCigarette = 'STK',\n StandardLitre = 'STL',\n ShortTon = 'STN', // ton (US) or short ton (UK/US)\n Straw = 'STW',\n Skein = 'SW',\n Shipment = 'SX',\n Syringe = 'SYR',\n}\n"],"mappings":";;;;;AA+BA,IAAY,sEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index70.cjs","names":[],"sources":["../src/types/unit/UX.d.ts"],"sourcesContent":["/**\n * Unit type codes starting with 'U'.\n */\nexport type UnitTypeCode_UX = 'U1' | 'U2' | 'UB' | 'UC'\n\n/**\n * Enum representing unit type codes starting with 'U'.\n */\nexport enum UnitTypeCodeEnum_UX {\n Treatment = 'U1',\n Tablet = 'U2',\n TelecomLineInServiceAvg = 'UB',\n TelecomPort = 'UC',\n}\n"],"mappings":";;;;;AAQA,IAAY,sEAAL;AACL;AACA;AACA;AACA;;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index71.cjs","names":[],"sources":["../src/types/unit/VX.d.ts"],"sourcesContent":["/**\n * Unit type codes starting with 'V'.\n */\nexport type UnitTypeCode_VX = 'VA' | 'VLT' | 'VP'\n\n/**\n * Enum representing unit type codes starting with 'V'.\n */\nexport enum UnitTypeCodeEnum_VX {\n VoltAmperePerKilogram = 'VA',\n Volt = 'VLT',\n PercentVolume = 'VP',\n}\n"],"mappings":";;;;;AAQA,IAAY,sEAAL;AACL;AACA;AACA;;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index72.cjs","names":[],"sources":["../src/types/unit/WX.d.ts"],"sourcesContent":["/**\n * Unit type codes starting with 'W'.\n */\nexport type UnitTypeCode_WX =\n | 'W2'\n | 'WA'\n | 'WB'\n | 'WCD'\n | 'WE'\n | 'WEB'\n | 'WEE'\n | 'WG'\n | 'WHR'\n | 'WM'\n | 'WSD'\n | 'WTT'\n\n/**\n * Enum representing unit type codes starting with 'W'.\n */\nexport enum UnitTypeCodeEnum_WX {\n WetKilo = 'W2',\n WattPerKilogram = 'WA',\n WetPound = 'WB',\n Cord = 'WCD',\n WetTon = 'WE',\n Weber = 'WEB',\n Week = 'WEE',\n WineGallon = 'WG',\n WattHour = 'WHR',\n WorkingMonth = 'WM',\n Standard = 'WSD',\n Watt = 'WTT',\n}\n"],"mappings":";;;;;AAoBA,IAAY,sEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}