@temboplus/frontend-core 0.4.0 → 0.4.1

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 (426) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +100 -38
  3. package/esm/_dnt.test_shims.d.ts.map +1 -0
  4. package/esm/deps/deno.land/std@0.217.0/assert/_constants.d.ts.map +1 -0
  5. package/esm/deps/deno.land/std@0.217.0/assert/_diff.d.ts.map +1 -0
  6. package/esm/deps/deno.land/std@0.217.0/assert/_format.d.ts.map +1 -0
  7. package/esm/deps/deno.land/std@0.217.0/assert/assert.d.ts.map +1 -0
  8. package/esm/deps/deno.land/std@0.217.0/assert/assert_almost_equals.d.ts.map +1 -0
  9. package/esm/deps/deno.land/std@0.217.0/assert/assert_array_includes.d.ts.map +1 -0
  10. package/esm/deps/deno.land/std@0.217.0/assert/assert_equals.d.ts.map +1 -0
  11. package/esm/deps/deno.land/std@0.217.0/assert/assert_exists.d.ts.map +1 -0
  12. package/esm/deps/deno.land/std@0.217.0/assert/assert_false.d.ts.map +1 -0
  13. package/esm/deps/deno.land/std@0.217.0/assert/assert_greater.d.ts.map +1 -0
  14. package/esm/deps/deno.land/std@0.217.0/assert/assert_greater_or_equal.d.ts.map +1 -0
  15. package/esm/deps/deno.land/std@0.217.0/assert/assert_instance_of.d.ts.map +1 -0
  16. package/esm/deps/deno.land/std@0.217.0/assert/assert_is_error.d.ts.map +1 -0
  17. package/esm/deps/deno.land/std@0.217.0/assert/assert_less.d.ts.map +1 -0
  18. package/esm/deps/deno.land/std@0.217.0/assert/assert_less_or_equal.d.ts.map +1 -0
  19. package/esm/deps/deno.land/std@0.217.0/assert/assert_match.d.ts.map +1 -0
  20. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_equals.d.ts.map +1 -0
  21. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_instance_of.d.ts.map +1 -0
  22. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_match.d.ts.map +1 -0
  23. package/esm/deps/deno.land/std@0.217.0/assert/assert_not_strict_equals.d.ts.map +1 -0
  24. package/esm/deps/deno.land/std@0.217.0/assert/assert_object_match.d.ts.map +1 -0
  25. package/esm/deps/deno.land/std@0.217.0/assert/assert_rejects.d.ts.map +1 -0
  26. package/esm/deps/deno.land/std@0.217.0/assert/assert_strict_equals.d.ts.map +1 -0
  27. package/esm/deps/deno.land/std@0.217.0/assert/assert_string_includes.d.ts.map +1 -0
  28. package/esm/deps/deno.land/std@0.217.0/assert/assert_throws.d.ts.map +1 -0
  29. package/esm/deps/deno.land/std@0.217.0/assert/assertion_error.d.ts.map +1 -0
  30. package/esm/deps/deno.land/std@0.217.0/assert/equal.d.ts.map +1 -0
  31. package/esm/deps/deno.land/std@0.217.0/assert/fail.d.ts.map +1 -0
  32. package/esm/deps/deno.land/std@0.217.0/assert/mod.d.ts.map +1 -0
  33. package/esm/deps/deno.land/std@0.217.0/assert/unimplemented.d.ts.map +1 -0
  34. package/esm/deps/deno.land/std@0.217.0/assert/unreachable.d.ts.map +1 -0
  35. package/esm/deps/deno.land/std@0.217.0/fmt/colors.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
  37. package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
  38. package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
  40. package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
  41. package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
  46. package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
  47. package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
  49. package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
  50. package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
  52. package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
  53. package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
  54. package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
  56. package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
  57. package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
  58. package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
  59. package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
  60. package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
  61. package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
  62. package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
  63. package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
  64. package/esm/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +1 -0
  65. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
  69. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
  71. package/esm/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +1 -0
  73. package/esm/mod.d.ts +5 -0
  74. package/esm/mod.d.ts.map +1 -0
  75. package/esm/mod.js +4 -0
  76. package/esm/package.json +3 -0
  77. package/esm/src/config/config_service.d.ts +11 -0
  78. package/esm/src/config/config_service.d.ts.map +1 -0
  79. package/esm/src/config/config_service.js +19 -0
  80. package/esm/src/config/index.d.ts +2 -0
  81. package/esm/src/config/index.d.ts.map +1 -0
  82. package/esm/src/config/index.js +1 -0
  83. package/esm/src/data/banks_tz.d.ts +7 -0
  84. package/esm/src/data/banks_tz.d.ts.map +1 -0
  85. package/esm/src/data/banks_tz.js +197 -0
  86. package/esm/src/data/countries.d.ts +39 -0
  87. package/esm/src/data/countries.d.ts.map +1 -0
  88. package/esm/src/data/countries.js +2475 -0
  89. package/esm/src/data/currencies.d.ts +1901 -0
  90. package/esm/src/data/currencies.d.ts.map +1 -0
  91. package/esm/src/data/currencies.js +1073 -0
  92. package/esm/src/data/phone_patterns.d.ts +3809 -0
  93. package/esm/src/data/phone_patterns.d.ts.map +1 -0
  94. package/esm/src/data/phone_patterns.js +2325 -0
  95. package/esm/src/models/amount/amount.d.ts +53 -0
  96. package/esm/src/models/amount/amount.d.ts.map +1 -0
  97. package/esm/src/models/amount/amount.js +190 -0
  98. package/esm/src/models/amount/amount.test.d.ts.map +1 -0
  99. package/esm/src/models/amount/antd_validator.d.ts +40 -0
  100. package/esm/src/models/amount/antd_validator.d.ts.map +1 -0
  101. package/esm/src/models/amount/antd_validator.js +58 -0
  102. package/esm/src/models/amount/antd_validator.test.d.ts.map +1 -0
  103. package/esm/src/models/amount/index.d.ts +3 -0
  104. package/esm/src/models/amount/index.d.ts.map +1 -0
  105. package/esm/src/models/amount/index.js +2 -0
  106. package/esm/src/models/bank/antd_validator.d.ts +11 -0
  107. package/esm/src/models/bank/antd_validator.d.ts.map +1 -0
  108. package/esm/src/models/bank/antd_validator.js +26 -0
  109. package/esm/src/models/bank/antd_validator.test.d.ts.map +1 -0
  110. package/esm/src/models/bank/bank.d.ts +257 -0
  111. package/esm/src/models/bank/bank.d.ts.map +1 -0
  112. package/esm/src/models/bank/bank.js +450 -0
  113. package/esm/src/models/bank/bank.test.d.ts.map +1 -0
  114. package/esm/src/models/bank/index.d.ts +5 -0
  115. package/esm/src/models/bank/index.d.ts.map +1 -0
  116. package/esm/src/models/bank/index.js +4 -0
  117. package/esm/src/models/bank/types.d.ts +7 -0
  118. package/esm/src/models/bank/types.d.ts.map +1 -0
  119. package/esm/src/models/bank/types.js +45 -0
  120. package/esm/src/models/bank/utils.d.ts +8 -0
  121. package/esm/src/models/bank/utils.d.ts.map +1 -0
  122. package/esm/src/models/bank/utils.js +9 -0
  123. package/esm/src/models/country/country.d.ts +822 -0
  124. package/esm/src/models/country/country.d.ts.map +1 -0
  125. package/esm/src/models/country/country.js +737 -0
  126. package/esm/src/models/country/country.test.d.ts.map +1 -0
  127. package/esm/src/models/country/index.d.ts +4 -0
  128. package/esm/src/models/country/index.d.ts.map +1 -0
  129. package/esm/src/models/country/index.js +3 -0
  130. package/{dist/models/country/country.types.d.ts → esm/src/models/country/types.d.ts} +1 -0
  131. package/esm/src/models/country/types.d.ts.map +1 -0
  132. package/esm/src/models/country/types.js +105 -0
  133. package/{dist/models/country/country.validation.d.ts → esm/src/models/country/utils.d.ts} +6 -10
  134. package/esm/src/models/country/utils.d.ts.map +1 -0
  135. package/esm/src/models/country/utils.js +25 -0
  136. package/esm/src/models/currency/currency.d.ts +465 -0
  137. package/esm/src/models/currency/currency.d.ts.map +1 -0
  138. package/esm/src/models/currency/currency.js +471 -0
  139. package/esm/src/models/currency/currency.test.d.ts.map +1 -0
  140. package/esm/src/models/currency/index.d.ts +4 -0
  141. package/esm/src/models/currency/index.d.ts.map +1 -0
  142. package/esm/src/models/currency/index.js +3 -0
  143. package/{dist/models/currency/currency.types.d.ts → esm/src/models/currency/types.d.ts} +2 -1
  144. package/esm/src/models/currency/types.d.ts.map +1 -0
  145. package/esm/src/models/currency/types.js +28 -0
  146. package/esm/src/models/currency/utils.d.ts +8 -0
  147. package/esm/src/models/currency/utils.d.ts.map +1 -0
  148. package/esm/src/models/currency/utils.js +9 -0
  149. package/esm/src/models/index.d.ts +6 -0
  150. package/esm/src/models/index.d.ts.map +1 -0
  151. package/{dist/models/index.d.ts → esm/src/models/index.js} +1 -1
  152. package/esm/src/models/phone_number/format.d.ts +13 -0
  153. package/esm/src/models/phone_number/format.d.ts.map +1 -0
  154. package/esm/src/models/phone_number/format.js +13 -0
  155. package/esm/src/models/phone_number/global/phone_number.d.ts +162 -0
  156. package/esm/src/models/phone_number/global/phone_number.d.ts.map +1 -0
  157. package/esm/src/models/phone_number/global/phone_number.js +459 -0
  158. package/esm/src/models/phone_number/global/phone_number.test.d.ts.map +1 -0
  159. package/esm/src/models/phone_number/global/service.d.ts +267 -0
  160. package/esm/src/models/phone_number/global/service.d.ts.map +1 -0
  161. package/esm/src/models/phone_number/global/service.js +498 -0
  162. package/esm/src/models/phone_number/global/service.test.d.ts.map +1 -0
  163. package/esm/src/models/phone_number/index.d.ts +6 -0
  164. package/esm/src/models/phone_number/index.d.ts.map +1 -0
  165. package/esm/src/models/phone_number/index.js +5 -0
  166. package/esm/src/models/phone_number/tz/antd_validator.d.ts +77 -0
  167. package/esm/src/models/phone_number/tz/antd_validator.d.ts.map +1 -0
  168. package/esm/src/models/phone_number/tz/antd_validator.js +90 -0
  169. package/esm/src/models/phone_number/tz/antdvalidator.test.d.ts.map +1 -0
  170. package/esm/src/models/phone_number/tz/network_operator.d.ts +30 -0
  171. package/esm/src/models/phone_number/tz/network_operator.d.ts.map +1 -0
  172. package/esm/src/models/phone_number/tz/network_operator.js +47 -0
  173. package/esm/src/models/phone_number/tz/phone_number.d.ts +141 -0
  174. package/esm/src/models/phone_number/tz/phone_number.d.ts.map +1 -0
  175. package/esm/src/models/phone_number/tz/phone_number.js +290 -0
  176. package/esm/src/models/phone_number/tz/phone_number.test.d.ts.map +1 -0
  177. package/esm/src/reports/index.d.ts +2 -0
  178. package/esm/src/reports/index.d.ts.map +1 -0
  179. package/esm/src/reports/index.js +1 -0
  180. package/esm/src/reports/report_manager.d.ts +146 -0
  181. package/esm/src/reports/report_manager.d.ts.map +1 -0
  182. package/esm/src/reports/report_manager.js +320 -0
  183. package/{dist → esm/src}/utils/id.d.ts +3 -7
  184. package/esm/src/utils/id.d.ts.map +1 -0
  185. package/esm/src/utils/id.js +19 -0
  186. package/esm/src/utils/index.d.ts +4 -0
  187. package/esm/src/utils/index.d.ts.map +1 -0
  188. package/esm/src/utils/text.d.ts +32 -0
  189. package/esm/src/utils/text.d.ts.map +1 -0
  190. package/esm/src/utils/text.js +68 -0
  191. package/esm/src/utils/text.test.d.ts.map +1 -0
  192. package/{dist → esm/src}/utils/time.d.ts +4 -9
  193. package/esm/src/utils/time.d.ts.map +1 -0
  194. package/esm/src/utils/time.js +34 -0
  195. package/package.json +23 -46
  196. package/script/_dnt.test_shims.d.ts.map +1 -0
  197. package/script/deps/deno.land/std@0.217.0/assert/_constants.d.ts.map +1 -0
  198. package/script/deps/deno.land/std@0.217.0/assert/_diff.d.ts.map +1 -0
  199. package/script/deps/deno.land/std@0.217.0/assert/_format.d.ts.map +1 -0
  200. package/script/deps/deno.land/std@0.217.0/assert/assert.d.ts.map +1 -0
  201. package/script/deps/deno.land/std@0.217.0/assert/assert_almost_equals.d.ts.map +1 -0
  202. package/script/deps/deno.land/std@0.217.0/assert/assert_array_includes.d.ts.map +1 -0
  203. package/script/deps/deno.land/std@0.217.0/assert/assert_equals.d.ts.map +1 -0
  204. package/script/deps/deno.land/std@0.217.0/assert/assert_exists.d.ts.map +1 -0
  205. package/script/deps/deno.land/std@0.217.0/assert/assert_false.d.ts.map +1 -0
  206. package/script/deps/deno.land/std@0.217.0/assert/assert_greater.d.ts.map +1 -0
  207. package/script/deps/deno.land/std@0.217.0/assert/assert_greater_or_equal.d.ts.map +1 -0
  208. package/script/deps/deno.land/std@0.217.0/assert/assert_instance_of.d.ts.map +1 -0
  209. package/script/deps/deno.land/std@0.217.0/assert/assert_is_error.d.ts.map +1 -0
  210. package/script/deps/deno.land/std@0.217.0/assert/assert_less.d.ts.map +1 -0
  211. package/script/deps/deno.land/std@0.217.0/assert/assert_less_or_equal.d.ts.map +1 -0
  212. package/script/deps/deno.land/std@0.217.0/assert/assert_match.d.ts.map +1 -0
  213. package/script/deps/deno.land/std@0.217.0/assert/assert_not_equals.d.ts.map +1 -0
  214. package/script/deps/deno.land/std@0.217.0/assert/assert_not_instance_of.d.ts.map +1 -0
  215. package/script/deps/deno.land/std@0.217.0/assert/assert_not_match.d.ts.map +1 -0
  216. package/script/deps/deno.land/std@0.217.0/assert/assert_not_strict_equals.d.ts.map +1 -0
  217. package/script/deps/deno.land/std@0.217.0/assert/assert_object_match.d.ts.map +1 -0
  218. package/script/deps/deno.land/std@0.217.0/assert/assert_rejects.d.ts.map +1 -0
  219. package/script/deps/deno.land/std@0.217.0/assert/assert_strict_equals.d.ts.map +1 -0
  220. package/script/deps/deno.land/std@0.217.0/assert/assert_string_includes.d.ts.map +1 -0
  221. package/script/deps/deno.land/std@0.217.0/assert/assert_throws.d.ts.map +1 -0
  222. package/script/deps/deno.land/std@0.217.0/assert/assertion_error.d.ts.map +1 -0
  223. package/script/deps/deno.land/std@0.217.0/assert/equal.d.ts.map +1 -0
  224. package/script/deps/deno.land/std@0.217.0/assert/fail.d.ts.map +1 -0
  225. package/script/deps/deno.land/std@0.217.0/assert/mod.d.ts.map +1 -0
  226. package/script/deps/deno.land/std@0.217.0/assert/unimplemented.d.ts.map +1 -0
  227. package/script/deps/deno.land/std@0.217.0/assert/unreachable.d.ts.map +1 -0
  228. package/script/deps/deno.land/std@0.217.0/fmt/colors.d.ts.map +1 -0
  229. package/script/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
  230. package/script/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
  231. package/script/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
  232. package/script/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
  233. package/script/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
  234. package/script/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
  235. package/script/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
  236. package/script/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
  237. package/script/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
  238. package/script/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
  239. package/script/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
  240. package/script/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
  241. package/script/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
  242. package/script/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
  243. package/script/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
  244. package/script/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
  245. package/script/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
  246. package/script/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
  247. package/script/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
  248. package/script/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
  249. package/script/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
  250. package/script/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
  251. package/script/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
  252. package/script/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
  253. package/script/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
  254. package/script/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
  255. package/script/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
  256. package/script/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
  257. package/script/deps/jsr.io/@std/internal/1.0.5/assertion_state.d.ts.map +1 -0
  258. package/script/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
  259. package/script/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
  260. package/script/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
  261. package/script/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
  262. package/script/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
  263. package/script/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
  264. package/script/deps/jsr.io/@std/testing/1.0.9/_test_suite.d.ts.map +1 -0
  265. package/script/deps/jsr.io/@std/testing/1.0.9/bdd.d.ts.map +1 -0
  266. package/script/mod.d.ts +5 -0
  267. package/script/mod.d.ts.map +1 -0
  268. package/script/mod.js +20 -0
  269. package/script/package.json +3 -0
  270. package/script/src/config/config_service.d.ts +11 -0
  271. package/script/src/config/config_service.d.ts.map +1 -0
  272. package/script/src/config/config_service.js +23 -0
  273. package/script/src/config/index.d.ts +2 -0
  274. package/script/src/config/index.d.ts.map +1 -0
  275. package/script/src/config/index.js +17 -0
  276. package/script/src/data/banks_tz.d.ts +7 -0
  277. package/script/src/data/banks_tz.d.ts.map +1 -0
  278. package/script/src/data/banks_tz.js +199 -0
  279. package/script/src/data/countries.d.ts +39 -0
  280. package/script/src/data/countries.d.ts.map +1 -0
  281. package/script/src/data/countries.js +2477 -0
  282. package/script/src/data/currencies.d.ts +1901 -0
  283. package/script/src/data/currencies.d.ts.map +1 -0
  284. package/script/src/data/currencies.js +1075 -0
  285. package/script/src/data/phone_patterns.d.ts +3809 -0
  286. package/script/src/data/phone_patterns.d.ts.map +1 -0
  287. package/script/src/data/phone_patterns.js +2327 -0
  288. package/script/src/models/amount/amount.d.ts +53 -0
  289. package/script/src/models/amount/amount.d.ts.map +1 -0
  290. package/script/src/models/amount/amount.js +194 -0
  291. package/script/src/models/amount/amount.test.d.ts.map +1 -0
  292. package/script/src/models/amount/antd_validator.d.ts +40 -0
  293. package/script/src/models/amount/antd_validator.d.ts.map +1 -0
  294. package/script/src/models/amount/antd_validator.js +62 -0
  295. package/script/src/models/amount/antd_validator.test.d.ts.map +1 -0
  296. package/script/src/models/amount/index.d.ts +3 -0
  297. package/script/src/models/amount/index.d.ts.map +1 -0
  298. package/script/src/models/amount/index.js +18 -0
  299. package/script/src/models/bank/antd_validator.d.ts +11 -0
  300. package/script/src/models/bank/antd_validator.d.ts.map +1 -0
  301. package/script/src/models/bank/antd_validator.js +30 -0
  302. package/script/src/models/bank/antd_validator.test.d.ts.map +1 -0
  303. package/script/src/models/bank/bank.d.ts +257 -0
  304. package/script/src/models/bank/bank.d.ts.map +1 -0
  305. package/script/src/models/bank/bank.js +458 -0
  306. package/script/src/models/bank/bank.test.d.ts.map +1 -0
  307. package/script/src/models/bank/index.d.ts +5 -0
  308. package/script/src/models/bank/index.d.ts.map +1 -0
  309. package/script/src/models/bank/index.js +20 -0
  310. package/script/src/models/bank/types.d.ts +7 -0
  311. package/script/src/models/bank/types.d.ts.map +1 -0
  312. package/script/src/models/bank/types.js +48 -0
  313. package/script/src/models/bank/utils.d.ts +8 -0
  314. package/script/src/models/bank/utils.d.ts.map +1 -0
  315. package/script/src/models/bank/utils.js +12 -0
  316. package/script/src/models/country/country.d.ts +822 -0
  317. package/script/src/models/country/country.d.ts.map +1 -0
  318. package/script/src/models/country/country.js +745 -0
  319. package/script/src/models/country/country.test.d.ts.map +1 -0
  320. package/script/src/models/country/index.d.ts +4 -0
  321. package/script/src/models/country/index.d.ts.map +1 -0
  322. package/script/src/models/country/index.js +19 -0
  323. package/script/src/models/country/types.d.ts +63 -0
  324. package/script/src/models/country/types.d.ts.map +1 -0
  325. package/script/src/models/country/types.js +108 -0
  326. package/script/src/models/country/utils.d.ts +21 -0
  327. package/script/src/models/country/utils.d.ts.map +1 -0
  328. package/script/src/models/country/utils.js +30 -0
  329. package/script/src/models/currency/currency.d.ts +465 -0
  330. package/script/src/models/currency/currency.d.ts.map +1 -0
  331. package/script/src/models/currency/currency.js +479 -0
  332. package/script/src/models/currency/currency.test.d.ts.map +1 -0
  333. package/script/src/models/currency/index.d.ts +4 -0
  334. package/script/src/models/currency/index.d.ts.map +1 -0
  335. package/script/src/models/currency/index.js +19 -0
  336. package/script/src/models/currency/types.d.ts +21 -0
  337. package/script/src/models/currency/types.d.ts.map +1 -0
  338. package/script/src/models/currency/types.js +31 -0
  339. package/script/src/models/currency/utils.d.ts +8 -0
  340. package/script/src/models/currency/utils.d.ts.map +1 -0
  341. package/script/src/models/currency/utils.js +12 -0
  342. package/script/src/models/index.d.ts +6 -0
  343. package/script/src/models/index.d.ts.map +1 -0
  344. package/script/src/models/index.js +21 -0
  345. package/script/src/models/phone_number/format.d.ts +13 -0
  346. package/script/src/models/phone_number/format.d.ts.map +1 -0
  347. package/script/src/models/phone_number/format.js +16 -0
  348. package/script/src/models/phone_number/global/phone_number.d.ts +162 -0
  349. package/script/src/models/phone_number/global/phone_number.d.ts.map +1 -0
  350. package/script/src/models/phone_number/global/phone_number.js +463 -0
  351. package/script/src/models/phone_number/global/phone_number.test.d.ts.map +1 -0
  352. package/script/src/models/phone_number/global/service.d.ts +267 -0
  353. package/script/src/models/phone_number/global/service.d.ts.map +1 -0
  354. package/script/src/models/phone_number/global/service.js +506 -0
  355. package/script/src/models/phone_number/global/service.test.d.ts.map +1 -0
  356. package/script/src/models/phone_number/index.d.ts +6 -0
  357. package/script/src/models/phone_number/index.d.ts.map +1 -0
  358. package/script/src/models/phone_number/index.js +21 -0
  359. package/script/src/models/phone_number/tz/antd_validator.d.ts +77 -0
  360. package/script/src/models/phone_number/tz/antd_validator.d.ts.map +1 -0
  361. package/script/src/models/phone_number/tz/antd_validator.js +94 -0
  362. package/script/src/models/phone_number/tz/antdvalidator.test.d.ts.map +1 -0
  363. package/script/src/models/phone_number/tz/network_operator.d.ts +30 -0
  364. package/script/src/models/phone_number/tz/network_operator.d.ts.map +1 -0
  365. package/script/src/models/phone_number/tz/network_operator.js +50 -0
  366. package/script/src/models/phone_number/tz/phone_number.d.ts +141 -0
  367. package/script/src/models/phone_number/tz/phone_number.d.ts.map +1 -0
  368. package/script/src/models/phone_number/tz/phone_number.js +294 -0
  369. package/script/src/models/phone_number/tz/phone_number.test.d.ts.map +1 -0
  370. package/script/src/reports/index.d.ts +2 -0
  371. package/script/src/reports/index.d.ts.map +1 -0
  372. package/script/src/reports/index.js +17 -0
  373. package/script/src/reports/report_manager.d.ts +146 -0
  374. package/script/src/reports/report_manager.d.ts.map +1 -0
  375. package/script/src/reports/report_manager.js +330 -0
  376. package/script/src/utils/id.d.ts +12 -0
  377. package/script/src/utils/id.d.ts.map +1 -0
  378. package/script/src/utils/id.js +23 -0
  379. package/script/src/utils/index.d.ts +4 -0
  380. package/script/src/utils/index.d.ts.map +1 -0
  381. package/script/src/utils/index.js +19 -0
  382. package/script/src/utils/text.d.ts +32 -0
  383. package/script/src/utils/text.d.ts.map +1 -0
  384. package/script/src/utils/text.js +75 -0
  385. package/script/src/utils/text.test.d.ts.map +1 -0
  386. package/script/src/utils/time.d.ts +21 -0
  387. package/script/src/utils/time.d.ts.map +1 -0
  388. package/script/src/utils/time.js +39 -0
  389. package/dist/constants/index.d.ts +0 -1
  390. package/dist/constants/payout-countries.d.ts +0 -2
  391. package/dist/index.cjs.js +0 -8
  392. package/dist/index.cjs.js.map +0 -1
  393. package/dist/index.d.ts +0 -4
  394. package/dist/index.esm.js +0 -5
  395. package/dist/index.esm.js.map +0 -1
  396. package/dist/models/amount/amount.d.ts +0 -748
  397. package/dist/models/amount/index.d.ts +0 -1
  398. package/dist/models/bank/bank.d.ts +0 -184
  399. package/dist/models/bank/bank.schema.d.ts +0 -23
  400. package/dist/models/bank/bank.types.d.ts +0 -5
  401. package/dist/models/bank/bank.validation.d.ts +0 -80
  402. package/dist/models/bank/index.d.ts +0 -4
  403. package/dist/models/country/country.d.ts +0 -329
  404. package/dist/models/country/country.schema.d.ts +0 -73
  405. package/dist/models/country/index.d.ts +0 -4
  406. package/dist/models/currency/currency.d.ts +0 -214
  407. package/dist/models/currency/currency.schema.d.ts +0 -24
  408. package/dist/models/currency/currency.validation.d.ts +0 -11
  409. package/dist/models/currency/index.d.ts +0 -4
  410. package/dist/models/phone-number/index.d.ts +0 -6
  411. package/dist/models/phone-number/mno/index.d.ts +0 -6
  412. package/dist/models/phone-number/mno/ke/mobile-number.ke-mnos.d.ts +0 -22
  413. package/dist/models/phone-number/mno/ke/mobile-number.ke.d.ts +0 -45
  414. package/dist/models/phone-number/mno/mno.types.d.ts +0 -62
  415. package/dist/models/phone-number/mno/mno.utils.d.ts +0 -40
  416. package/dist/models/phone-number/mno/tz/mobile-number.tz-mnos.d.ts +0 -48
  417. package/dist/models/phone-number/mno/tz/mobile-number.tz.d.ts +0 -44
  418. package/dist/models/phone-number/phone-number.d.ts +0 -135
  419. package/dist/models/phone-number/phone-number.factory.d.ts +0 -52
  420. package/dist/models/phone-number/phone-number.service.d.ts +0 -36
  421. package/dist/models/phone-number/phone-number.types.d.ts +0 -115
  422. package/dist/models/phone-number/phone-number.utils.d.ts +0 -67
  423. package/dist/services/index.d.ts +0 -1
  424. package/dist/services/logger.d.ts +0 -2
  425. package/dist/utils/text.d.ts +0 -103
  426. /package/{dist/utils/index.d.ts → esm/src/utils/index.js} +0 -0
@@ -1 +0,0 @@
1
- export * from "./amount.js";
@@ -1,184 +0,0 @@
1
- import { ISO2CountryCode } from "../country/country.types.js";
2
- import type { BankSwiftCode, KEBankSwiftCode, TZBankSwiftCode } from "./bank.types.js";
3
- import { z } from "zod";
4
- import { BankJSONSchema } from "./bank.schema.js";
5
- /**
6
- * Infer the BankJSON type from the schema
7
- */
8
- export type BankJSON = z.infer<typeof BankJSONSchema>;
9
- export declare class Bank {
10
- /**
11
- * The full registered name of the bank.
12
- */
13
- readonly fullName: string;
14
- /**
15
- * The commonly used short name or abbreviation for the bank.
16
- */
17
- readonly shortName: string;
18
- /**
19
- * The SWIFT/BIC code for the bank's head office.
20
- */
21
- readonly swiftCode: TZBankSwiftCode | KEBankSwiftCode;
22
- /**
23
- * The ISO 3166-1 alpha-2 country code (e.g., 'TZ', 'KE').
24
- */
25
- readonly countryCode: ISO2CountryCode;
26
- /**
27
- * Optional list of former names the bank was known by.
28
- * Useful for historical reference and search functionality.
29
- */
30
- readonly formerNames?: string[];
31
- /**
32
- * Creates a new Bank instance.
33
- *
34
- * @param fullName The full registered name of the bank
35
- * @param shortName The commonly used short name or abbreviation for the bank
36
- * @param swiftCode The SWIFT/BIC code for the bank's head office
37
- * @param countryCode The ISO 3166-1 alpha-2 country code
38
- * @param formerNames Optional list of former names the bank was known by
39
- */
40
- constructor(fullName: string, shortName: string, swiftCode: TZBankSwiftCode | KEBankSwiftCode, countryCode: ISO2CountryCode, formerNames?: string[]);
41
- /**
42
- * Checks if this bank has any former names recorded.
43
- * @returns True if the bank has at least one former name, false otherwise.
44
- */
45
- hasFormerNames(): boolean;
46
- /**
47
- * Gets a display string showing the current name with former names in parentheses.
48
- * @returns A formatted string, e.g., "Access Bank Tanzania Limited (formerly BancABC)"
49
- */
50
- getDisplayNameWithHistory(): string;
51
- /**
52
- * Returns a string representation of the bank.
53
- * @returns A formatted string, e.g., "CRDB BANK PLC (CRDB) - SWIFT: CORUTZTZ [TZ]"
54
- */
55
- toString(): string;
56
- static from(swiftCode: BankSwiftCode, countryCode: ISO2CountryCode): Bank;
57
- /**
58
- * Converts the Bank instance to a plain JavaScript object.
59
- * Suitable for serialization or data transfer.
60
- *
61
- * @returns {Object} Plain object representation of the bank
62
- * @returns {string} returns.fullName - The full registered name of the bank
63
- * @returns {string} returns.shortName - The commonly used short name
64
- * @returns {string} returns.swiftCode - The SWIFT/BIC code
65
- * @returns {ISO2CountryCode} returns.countryCode - The ISO 3166-1 alpha-2 country code
66
- * @returns {string[] | undefined} returns.formerNames - Optional list of former names
67
- *
68
- * @example
69
- * ```typescript
70
- * const bank = Bank.from("FMBZTZTX", "TZ");
71
- * const obj = bank.toObject();
72
- * console.log(obj);
73
- * // {
74
- * // fullName: "Access Bank Tanzania Limited",
75
- * // shortName: "ABT",
76
- * // swiftCode: "FMBZTZTX",
77
- * // countryCode: "TZ",
78
- * // formerNames: ["BancABC"]
79
- * // }
80
- * ```
81
- */
82
- toObject(): {
83
- fullName: string;
84
- shortName: string;
85
- swiftCode: TZBankSwiftCode | KEBankSwiftCode;
86
- countryCode: ISO2CountryCode;
87
- formerNames?: string[];
88
- };
89
- /**
90
- * Static method to determine if an unknown object is a valid Bank object.
91
- *
92
- * This method performs a series of checks to validate if the provided object conforms
93
- * to the Bank interface and contains valid data.
94
- *
95
- * @param {unknown} obj - The object to validate.
96
- * @returns {obj is Bank} - Returns true if the object is a valid Bank, false otherwise.
97
- */
98
- static is(obj: unknown): obj is Bank;
99
- /**
100
- * Serializes the Bank instance to a JSON-compatible object
101
- */
102
- toJSON(): BankJSON;
103
- /**
104
- * Serializes the Bank instance to a JSON string
105
- */
106
- toJSONString(): string;
107
- /**
108
- * Creates a Bank instance from a JSON-compatible object or string
109
- */
110
- static fromJSON(json: BankJSON | string): Bank | undefined;
111
- /**
112
- * Creates a Bank instance from a JSON string
113
- */
114
- static fromJSONString(jsonString: string): Bank | undefined;
115
- /**
116
- * Type guard to check if an object is a valid BankJSON using Zod validation
117
- */
118
- static isBankJSON(obj: unknown): obj is BankJSON;
119
- }
120
- /**
121
- * Service for managing bank data, validation, and instance creation
122
- * across multiple countries. Acts as the central Facade and Factory.
123
- * @class BankService
124
- */
125
- export declare class BankService {
126
- private static instance;
127
- private loadedData;
128
- private constructor();
129
- /**
130
- * Gets the singleton instance of BankService.
131
- */
132
- static getInstance(): BankService;
133
- /**
134
- * Loads bank data for a specific country synchronously.
135
- * @param countryCode The ISO country code (e.g., 'TZ', 'KE').
136
- * @returns The loaded country data, or undefined on failure.
137
- */
138
- private loadCountryData;
139
- /**
140
- * Retrieves the loaded data structure for a given country.
141
- * Ensures country is initialized.
142
- * @param countryCode The ISO country code.
143
- * @returns The CountryBankData structure or undefined.
144
- */
145
- private getCountryData;
146
- /**
147
- * Retrieves a Bank instance by its SWIFT code for a specific country.
148
- * Performs validation before returning.
149
- * @param countryCode The ISO country code.
150
- * @param swiftCode The SWIFT code.
151
- * @returns The Bank instance or undefined if SWIFT is invalid or not found.
152
- */
153
- getBankBySwiftCode(countryCode: ISO2CountryCode, swiftCode: BankSwiftCode): Bank | undefined;
154
- /**
155
- * Retrieves all banks for a specific country.
156
- * @param countryCode The ISO country code.
157
- * @returns An array of Bank instances, or empty array.
158
- */
159
- getAllBanks(countryCode: ISO2CountryCode): Bank[];
160
- /**
161
- * Retrieves all banks for all supported countries.
162
- * @returns An array of Bank instances, or empty array.
163
- */
164
- getAllSupportedBanks(): Bank[];
165
- /**
166
- * Searches all supported banks for a bank with the provided swift code
167
- */
168
- detectBank(swiftCode: string): Bank | undefined;
169
- /**
170
- * Searches for banks within a specific country by SWIFT code.
171
- * @param countryCode The ISO country code.
172
- * @param searchTerm The SWIFT code fragment to search for (case-insensitive).
173
- * @param limit Max number of results.
174
- * @returns An array of matching Bank instances.
175
- */
176
- searchBanks(countryCode: ISO2CountryCode, searchTerm: string, limit?: number): Bank[];
177
- /**
178
- * Searches for banks across all supported countries by SWIFT code.
179
- * @param searchTerm The SWIFT code fragment to search for (case-insensitive).
180
- * @param limit Max number of results.
181
- * @returns An array of matching Bank instances from all supported countries.
182
- */
183
- searchAllBanks(searchTerm: string, limit?: number): Bank[];
184
- }
@@ -1,23 +0,0 @@
1
- import { z } from "zod";
2
- export declare const TZBankSWIFTCodeSchema: z.ZodEffects<z.ZodString, string, string>;
3
- export declare const KEBankSWIFTCodeSchema: z.ZodEffects<z.ZodString, string, string>;
4
- /**
5
- * Zod schema for Bank JSON serialization
6
- * This schema validates the JSON representation of a Bank instance
7
- */
8
- export declare const BankJSONSchema: z.ZodObject<{
9
- /** The SWIFT/BIC code for the bank's head office */
10
- swiftCode: z.ZodString;
11
- /** The ISO 3166-1 alpha-2 country code */
12
- countryCode: z.ZodString;
13
- /** Version for future compatibility */
14
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
15
- }, "strip", z.ZodTypeAny, {
16
- version: string;
17
- swiftCode: string;
18
- countryCode: string;
19
- }, {
20
- swiftCode: string;
21
- countryCode: string;
22
- version?: string | undefined;
23
- }>;
@@ -1,5 +0,0 @@
1
- export declare const KEBankSwiftCodesSet: Set<string>;
2
- export declare const TZBankSwiftCodesSet: Set<string>;
3
- export type KEBankSwiftCode = "ABNGKENA" | "ABCLKENA" | "AFRIKENX" | "BARBKENA" | "CRMFKENA" | "CHFIKENX" | "CITIKENA" | "KCOOKENA" | "MYBKKENA" | "CONKKENA" | "CRBTKENA" | "DEVKKENA" | "DTKEKENA" | "DUIBKENA" | "ECOCKENA" | "EQBLKENA" | "FABLKENA" | "FAUMKENA" | "GTBIKENA" | "GUARKENA" | "GAFRKENA" | "HBZUKENA" | "HFCOKENA" | "IMBLKENA" | "KWMIKENX" | "CIFIKENA" | "MORBKENA" | "MIEKKENA" | "NBKEKENX" | "CBAFKENX" | "PAUTKENA" | "IFCBKENA" | "PRIEKENX" | "SBMKKENA" | "SIDNKENA" | "SBICKENX" | "SCBLKENX" | "VICMKENA";
4
- export type TZBankSwiftCode = "CORUTZTZ" | "PBZATZTZ" | "SCBLTZTX" | "SBICTZTX" | "CITITZTZ" | "EUAFTZTZ" | "DTKETZTZ" | "AKCOTZTZ" | "EXTNTZTZ" | "KLMJTZTZ" | "NLCBTZTX" | "NMIBTZTZ" | "KCBLTZTZ" | "HABLTZTZ" | "BKMYTZTZ" | "BARCTZTZ" | "IMBLTZTZ" | "CBAFTZTZ" | "DASUTZTZ" | "BARBTZTZ" | "AZANTZTZ" | "UCCTTZTZ" | "FMBZTZTX" | "ACTZTZTZ" | "BKIDTZTZ" | "UNAFTZTZ" | "MKCBTZTZ" | "ECOCTZTZ" | "MWCBTZTZ" | "FIRNTZTX" | "AMNNTZTZ" | "EQBLTZTZ" | "TAPBTZTZ" | "MBTLTZTZ" | "CNRBTZTZ" | "MWCOTZTZ" | "GTBITZTZ" | "YETMTZTZ" | "CDSHTZTZ";
5
- export type BankSwiftCode = KEBankSwiftCode | TZBankSwiftCode;
@@ -1,80 +0,0 @@
1
- import { ISO2CountryCode } from "@models/country/country.types.js";
2
- import { BankSwiftCode } from "./bank.types.js";
3
- export declare const BankValidation: {
4
- /**
5
- * Validates a bank account number format for a specific country.
6
- * @param accountNumber The account number string.
7
- * @param countryCode The ISO2 country code.
8
- * @returns True if the format is valid, false otherwise.
9
- */
10
- validateAccountNumber: (accountNumber: string, countryCode: ISO2CountryCode) => boolean;
11
- /**
12
- * Validates a bank account number format for any supported country.
13
- * @param accountNumber The account number string.
14
- * @returns True if the format is valid for any supported country, false otherwise.
15
- */
16
- validateAccountNumberForAnyCountry: (accountNumber: string) => boolean;
17
- /**
18
- * Validates a SWIFT/BIC code for a specific country.
19
- * @param swiftCode The SWIFT code string.
20
- * @param countryCode The ISO2 country code.
21
- * @returns True if the format is valid, false otherwise.
22
- */
23
- validateSwiftCode: (swiftCode: string, countryCode: ISO2CountryCode) => swiftCode is BankSwiftCode;
24
- /**
25
- * Validates a SWIFT/BIC code for any supported country.
26
- * @param swiftCode The SWIFT code string.
27
- * @returns True if the SWIFT code is valid for any supported country, false otherwise.
28
- */
29
- validateSwiftCodeForAnyCountry: (swiftCode: string) => swiftCode is BankSwiftCode;
30
- /**
31
- * Validates an account name based on various criteria.
32
- * This validation is country-agnostic as account name rules are generally similar.
33
- *
34
- * @param {string} accountName - The account name to validate
35
- * @returns {boolean} True if the account name meets all validation criteria, false otherwise
36
- *
37
- * @example
38
- * // Returns true
39
- * validateAccountName("John Smith");
40
- *
41
- * @example
42
- * // Returns false (too short)
43
- * validateAccountName("Jo");
44
- *
45
- * @example
46
- * // Returns false (invalid characters)
47
- * validateAccountName("User123");
48
- */
49
- validateAccountName: (accountName: string) => boolean;
50
- /**
51
- * Validates an account name for any supported country.
52
- * Since account name validation is generally country-agnostic, this is an alias to validateAccountName.
53
- * @param accountName The account name to validate.
54
- * @returns True if the account name is valid, false otherwise.
55
- */
56
- validateAccountNameForAnyCountry: (accountName: string) => boolean;
57
- /**
58
- * Validates all bank details (account number, SWIFT code, and account name) for a specific country.
59
- * @param accountNumber The account number string.
60
- * @param swiftCode The SWIFT code string.
61
- * @param accountName The account name string.
62
- * @param countryCode The ISO2 country code.
63
- * @returns True if all details are valid for the specified country, false otherwise.
64
- */
65
- validateAllBankDetails: (accountNumber: string, swiftCode: string, accountName: string, countryCode: ISO2CountryCode) => boolean;
66
- /**
67
- * Validates all bank details (account number, SWIFT code, and account name) for any supported country.
68
- * @param accountNumber The account number string.
69
- * @param swiftCode The SWIFT code string.
70
- * @param accountName The account name string.
71
- * @returns True if all details are valid for any supported country, false otherwise.
72
- */
73
- validateAllBankDetailsForAnyCountry: (accountNumber: string, swiftCode: string, accountName: string) => boolean;
74
- /**
75
- * Determines which country a SWIFT code belongs to.
76
- * @param swiftCode The SWIFT code string.
77
- * @returns The ISO2 country code if found, undefined otherwise.
78
- */
79
- getCountryFromSwiftCode: (swiftCode: string) => ISO2CountryCode | undefined;
80
- };
@@ -1,4 +0,0 @@
1
- export * from "./bank.js";
2
- export * from "./bank.types.js";
3
- export * from "./bank.validation.js";
4
- export * from "./bank.schema.js";
@@ -1,329 +0,0 @@
1
- /**
2
- * @fileoverview This file contains both the Country class and CountryService class.
3
- *
4
- * ARCHITECTURE NOTE: Country and CountryService Classes
5
- * ======================================================
6
- *
7
- * These two classes have been intentionally placed in the same file to resolve
8
- * a circular dependency issue. The original implementation had these in separate files:
9
- *
10
- * - Country class: Defines country properties and lookup helpers
11
- * - CountryService class: Loads country data and provides instance methods
12
- *
13
- * The circular dependency occurred because:
14
- * 1. Country needed CountryService for centralized lookups
15
- * 2. CountryService needed Country to create Country instances
16
- *
17
- * By combining both classes in a single file:
18
- * - We ensure proper initialization order
19
- * - The public API remains unchanged
20
- *
21
- * This approach also better encapsulates related functionality in a single module,
22
- * making it easier to understand and maintain the country-related domain model.
23
- * The addition of currency support through the getCurrency() method leverages
24
- * the Currency model while maintaining a clean separation of concerns.
25
- */
26
- import { Currency } from "@models/currency/currency.js";
27
- import { CurrencyCode } from "@models/currency/currency.types.js";
28
- import { ISO2CountryCode, ISO3CountryCode, CountryCode } from "./country.types.js";
29
- import { z } from "zod";
30
- import { CountryJSONSchema } from "./country.schema.js";
31
- /**
32
- * Infer the CountryJSON type from the schema
33
- */
34
- export type CountryJSON = z.infer<typeof CountryJSONSchema>;
35
- /**
36
- * Enum for continents
37
- */
38
- export declare enum CONTINENT {
39
- AFRICA = "Africa",
40
- ANTARCTICA = "Antarctica",
41
- ASIA = "Asia",
42
- EUROPE = "Europe",
43
- NORTH_AMERICA = "North America",
44
- OCEANIA = "Oceania",
45
- SOUTH_AMERICA = "South America"
46
- }
47
- /**
48
- * Enum for sub-regions
49
- */
50
- export declare enum SUB_REGION {
51
- AUSTRALIA_AND_NEW_ZEALAND = "Australia and New Zealand",
52
- CARIBBEAN = "Caribbean",
53
- CENTRAL_AMERICA = "Central America",
54
- CENTRAL_ASIA = "Central Asia",
55
- EASTERN_AFRICA = "Eastern Africa",
56
- EASTERN_ASIA = "Eastern Asia",
57
- EASTERN_EUROPE = "Eastern Europe",
58
- MELANESIA = "Melanesia",
59
- MICRONESIA = "Micronesia",
60
- MIDDLE_AFRICA = "Middle Africa",
61
- NORTHERN_AFRICA = "Northern Africa",
62
- NORTHERN_AMERICA = "Northern America",
63
- NORTHERN_EUROPE = "Northern Europe",
64
- POLYNESIA = "Polynesia",
65
- SOUTH_EASTERN_ASIA = "South-eastern Asia",
66
- SOUTHERN_AFRICA = "Southern Africa",
67
- SOUTHERN_ASIA = "Southern Asia",
68
- SOUTHERN_EUROPE = "Southern Europe",
69
- WESTERN_AFRICA = "Western Africa",
70
- WESTERN_ASIA = "Western Asia",
71
- WESTERN_EUROPE = "Western Europe"
72
- }
73
- /**
74
- * Represents a country with essential details.
75
- * @class Country
76
- */
77
- export declare class Country {
78
- private readonly _name;
79
- private readonly _iso2;
80
- private readonly _nameOfficial;
81
- private readonly _iso3;
82
- private readonly _flagEmoji;
83
- private readonly _continent;
84
- private readonly _region;
85
- private readonly _currencyCode;
86
- private readonly _dialCode;
87
- /**
88
- * Creates a new Country instance.
89
- * @param {string} _name - The common name of the country
90
- * @param {string} _iso2 - The ISO-2 country code
91
- * @param {string} _nameOfficial - The official name of the country
92
- * @param {string} _iso3 - The ISO-3 country code
93
- * @param {string} _flagEmoji - The flag emoji of the country
94
- * @param {CONTINENT} _continent - The continent where the country is located
95
- * @param {SUB_REGION} _region - The region within the continent where the country is located
96
- * @param {string | null} _currencyCode - The ISO currency code used in the country
97
- * @param {number} _dialCode - The dial code used in the country
98
- */
99
- constructor(token: symbol, _name: string, _iso2: ISO2CountryCode, _nameOfficial: string | undefined, _iso3: ISO3CountryCode, _flagEmoji: string | undefined, _continent: CONTINENT | undefined, _region: SUB_REGION | undefined, _currencyCode: (CurrencyCode | null) | undefined, _dialCode: number);
100
- /**
101
- * Gets the common name of the country.
102
- * @returns {string} The common name of the country
103
- */
104
- get name(): string;
105
- /**
106
- * Gets the ISO-2 code of the country.
107
- * @returns {ISO2CountryCode} The ISO-2 code of the country
108
- */
109
- get code(): ISO2CountryCode;
110
- /**
111
- * Gets the official name of the country.
112
- * @returns {string} The official name of the country
113
- */
114
- get nameOfficial(): string;
115
- /**
116
- * Gets the ISO-3 code of the country.
117
- * @returns {ISO3CountryCode} The ISO-3 code of the country
118
- */
119
- get iso3(): ISO3CountryCode;
120
- /**
121
- * Gets the flag emoji of the country.
122
- * @returns {string} The flag emoji of the country
123
- */
124
- get flagEmoji(): string;
125
- /**
126
- * Gets the continent where the country is located.
127
- * @returns {CONTINENT} The continent where the country is located
128
- */
129
- get continent(): CONTINENT;
130
- /**
131
- * Gets the region within the continent where the country is located.
132
- * @returns {SUB_REGION} The region within the continent where the country is located
133
- */
134
- get region(): SUB_REGION;
135
- /**
136
- * Gets the ISO currency code used in the country.
137
- * @returns {string | null} The ISO currency code of the country, or null if not available
138
- */
139
- get currencyCode(): CurrencyCode | null;
140
- /**
141
- * Gets the dial code used in the country.
142
- * @returns {number} The dial code of the country
143
- */
144
- get dialCode(): number;
145
- /**
146
- * Gets the Currency instance for this country.
147
- * @returns {Currency | undefined} The Currency instance or undefined if no currency is assigned
148
- */
149
- getCurrency(): Currency | undefined;
150
- /**
151
- * Creates a string representation of the country.
152
- * @returns {string} String representation of the country
153
- */
154
- toString(): string;
155
- /**
156
- * Creates a detailed string representation of the country including the flag.
157
- * @returns {string} Detailed string representation of the country
158
- */
159
- toDetailedString(): string;
160
- /**
161
- * Retrieves a country by its ISO-2 or ISO-3 code.
162
- * @param {CountryCode} code The ISO-2 or ISO-3 code of the country.
163
- * @returns {Country | undefined} The country corresponding to the ISO code or `undefined` if not found.
164
- */
165
- static fromCode(code: CountryCode): Country | undefined;
166
- /**
167
- * Retrieves a country by its ISO-3 code.
168
- * @param {ISO3CountryCode} iso3 The ISO-3 code of the country.
169
- * @returns {Country | undefined} The country corresponding to the ISO-3 code or `undefined` if not found.
170
- */
171
- static fromIso3(iso3: ISO3CountryCode): Country | undefined;
172
- /**
173
- * Returns all available countries.
174
- * @returns {Country[]} Array of all countries
175
- */
176
- static getAll(): Country[];
177
- /**
178
- * Returns countries from a specific continent.
179
- * @param {CONTINENT} continent The continent enum value
180
- * @returns {Country[]} Array of countries in the specified continent
181
- */
182
- static getByContinent(continent: CONTINENT): Country[];
183
- /**
184
- * Returns countries from a specific region.
185
- * @param {SUB_REGION} region The region enum value
186
- * @returns {Country[]} Array of countries in the specified region
187
- */
188
- static getByRegion(region: SUB_REGION): Country[];
189
- /**
190
- * Returns a list of all available continents.
191
- * @returns {CONTINENT[]} Array of continent enum values
192
- */
193
- static getContinents(): CONTINENT[];
194
- /**
195
- * Returns a list of all available regions.
196
- * @returns {SUB_REGION[]} Array of region enum values
197
- */
198
- static getRegions(): SUB_REGION[];
199
- /**
200
- * Checks the validity of the country data
201
- * @returns true if the country information is available and valid
202
- */
203
- validate(): boolean;
204
- /**
205
- * Attempts to create a Country instance from an ISO code.
206
- * @param input The ISO-2 or ISO-3 code
207
- * @returns A Country instance if valid input, undefined otherwise
208
- */
209
- static from(input: string): Country | undefined;
210
- /**
211
- * Validates if the input can be used to construct a valid Country instance
212
- * @param input The ISO-2 or ISO-3 code to validate
213
- * @returns True if input can construct a valid country, false otherwise
214
- */
215
- static canConstruct(input?: string | null): boolean;
216
- /**
217
- * Checks if an unknown value is a Country instance
218
- * @param obj The value to validate
219
- * @returns Type predicate indicating if the value is a valid Country
220
- */
221
- static is(obj: unknown): obj is Country;
222
- /**
223
- * Serializes the Country instance to a JSON-compatible object
224
- */
225
- toJSON(): CountryJSON;
226
- /**
227
- * Serializes the Country instance to a JSON string
228
- */
229
- toJSONString(): string;
230
- /**
231
- * Creates a Country instance from a JSON-compatible object or string
232
- */
233
- static fromJSON(json: CountryJSON | string): Country | undefined;
234
- /**
235
- * Creates a Country instance from a JSON string
236
- */
237
- static fromJSONString(jsonString: string): Country | undefined;
238
- /**
239
- * Type guard to check if an object is a valid CountryJSON using Zod validation
240
- */
241
- static isCountryJSON(obj: unknown): obj is CountryJSON;
242
- }
243
- /**
244
- * Service for managing country data.
245
- * @class CountryService
246
- */
247
- export declare class CountryService {
248
- private static instance;
249
- private countryList;
250
- private codeRecord;
251
- private iso3Record;
252
- private continentRecord;
253
- private regionRecord;
254
- private constructor();
255
- /**
256
- * Gets the singleton instance of CountryService.
257
- * Creates the instance if it doesn't exist.
258
- * @static
259
- * @returns {CountryService} The singleton instance
260
- */
261
- static getInstance(): CountryService;
262
- /**
263
- * Maps a string continent name to the CONTINENT enum
264
- * @param continentName String continent name from JSON
265
- * @returns The corresponding CONTINENT enum value
266
- */
267
- private mapContinent;
268
- /**
269
- * Maps a string region name to the SUB_REGION enum
270
- * @param regionName String region name from JSON
271
- * @returns The corresponding SUB_REGION enum value
272
- */
273
- private mapRegion;
274
- /**
275
- * Initializes the service with country data.
276
- * Should be called once when your application starts.
277
- */
278
- private initialize;
279
- /**
280
- * Gets all countries.
281
- * @returns {Country[]} Array of all countries
282
- */
283
- getAll(): Country[];
284
- /**
285
- * Gets all countries as a record.
286
- * @returns {Record<string, Country>} Record of country codes and country objects
287
- */
288
- getAllAsRecord(): Record<string, Country>;
289
- /**
290
- * Gets all countries from a specific continent.
291
- * @param {CONTINENT} continent The continent enum value
292
- * @returns {Country[]} Array of countries in the specified continent
293
- */
294
- getByContinent(continent: CONTINENT): Country[];
295
- /**
296
- * Gets all countries from a specific region.
297
- * @param {SUB_REGION} region The region enum value
298
- * @returns {Country[]} Array of countries in the specified region
299
- */
300
- getByRegion(region: SUB_REGION): Country[];
301
- /**
302
- * Retrieves a country by its ISO-2 or ISO-3 code.
303
- * @param {CountryCode} code The ISO code of the country.
304
- * @returns {Country | undefined} The country corresponding to the ISO code or `undefined` if not found.
305
- */
306
- fromCode(code: CountryCode): Country | undefined;
307
- /**
308
- * Retrieves a country by its ISO-3 code.
309
- * @param {ISO3CountryCode} iso3 The ISO-3 code of the country.
310
- * @returns {Country | undefined} The country corresponding to the ISO-3 code or `undefined` if not found.
311
- */
312
- fromIso3(iso3: ISO3CountryCode): Country | undefined;
313
- /**
314
- * Searches for countries that match the given search term.
315
- * @param {string} searchTerm - The partial ISO-2 or ISO-3 code to search for.
316
- * @param {number} [limit=10] - Maximum number of results to return.
317
- * @returns {Country[]} Array of matching countries, limited to specified count.
318
- */
319
- search(searchTerm: string, limit?: number): Country[];
320
- /**
321
- * Compares two Country instances for equality by checking their name and code
322
- *
323
- * @param {Country} country1 - First country to compare
324
- * @param {Country} country2 - Second country to compare
325
- * @returns {boolean} True if countries are equal, false otherwise
326
- * @private
327
- */
328
- compare(country1: Country, country2: Country): boolean;
329
- }