@thisisagile/easy 15.26.2 → 15.27.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 (678) hide show
  1. package/dist/chunk-35PSIDGU.mjs +17 -0
  2. package/dist/chunk-35PSIDGU.mjs.map +1 -0
  3. package/dist/chunk-3HTSHJPL.mjs +26 -0
  4. package/dist/chunk-3HTSHJPL.mjs.map +1 -0
  5. package/dist/chunk-3WOYFN2Q.mjs +18 -0
  6. package/dist/chunk-3WOYFN2Q.mjs.map +1 -0
  7. package/dist/chunk-4AP5H3OQ.mjs +46 -0
  8. package/dist/chunk-4AP5H3OQ.mjs.map +1 -0
  9. package/dist/chunk-4EVQZKMK.mjs +15 -0
  10. package/dist/chunk-4EVQZKMK.mjs.map +1 -0
  11. package/dist/chunk-4QX4EMLL.mjs +13 -0
  12. package/dist/chunk-4QX4EMLL.mjs.map +1 -0
  13. package/dist/chunk-5AF55QCJ.mjs +51 -0
  14. package/dist/chunk-5AF55QCJ.mjs.map +1 -0
  15. package/dist/chunk-6NOTDYUE.mjs +272 -0
  16. package/dist/chunk-6NOTDYUE.mjs.map +1 -0
  17. package/dist/chunk-6OW7KEN5.mjs +94 -0
  18. package/dist/chunk-6OW7KEN5.mjs.map +1 -0
  19. package/dist/chunk-74AOBBOZ.mjs +113 -0
  20. package/dist/chunk-74AOBBOZ.mjs.map +1 -0
  21. package/dist/chunk-7EP6VCI3.mjs +60 -0
  22. package/dist/chunk-7EP6VCI3.mjs.map +1 -0
  23. package/dist/{types/PageList.js → chunk-7NYZAGM3.mjs} +31 -48
  24. package/dist/chunk-7NYZAGM3.mjs.map +1 -0
  25. package/dist/chunk-7RIXMU5L.mjs +50 -0
  26. package/dist/chunk-7RIXMU5L.mjs.map +1 -0
  27. package/dist/chunk-A7OYYR2S.mjs +48 -0
  28. package/dist/chunk-A7OYYR2S.mjs.map +1 -0
  29. package/dist/chunk-ADJAEGCT.mjs +21 -0
  30. package/dist/chunk-ADJAEGCT.mjs.map +1 -0
  31. package/dist/chunk-AKYA7FHU.mjs +15 -0
  32. package/dist/chunk-AKYA7FHU.mjs.map +1 -0
  33. package/dist/chunk-CLKUH5JA.mjs +42 -0
  34. package/dist/chunk-CLKUH5JA.mjs.map +1 -0
  35. package/dist/chunk-CMRS457E.mjs +11 -0
  36. package/dist/chunk-CMRS457E.mjs.map +1 -0
  37. package/dist/chunk-D54TPU6G.mjs +43 -0
  38. package/dist/chunk-D54TPU6G.mjs.map +1 -0
  39. package/dist/chunk-DICMUQFL.mjs +11 -0
  40. package/dist/chunk-DICMUQFL.mjs.map +1 -0
  41. package/dist/chunk-EZC3HAYN.mjs +70 -0
  42. package/dist/chunk-EZC3HAYN.mjs.map +1 -0
  43. package/dist/chunk-FAAERRP2.mjs +37 -0
  44. package/dist/chunk-FAAERRP2.mjs.map +1 -0
  45. package/dist/chunk-FSK4W6I2.mjs +33 -0
  46. package/dist/chunk-FSK4W6I2.mjs.map +1 -0
  47. package/dist/chunk-G7QSW2EB.mjs +23 -0
  48. package/dist/chunk-G7QSW2EB.mjs.map +1 -0
  49. package/dist/chunk-GDD652NR.mjs +94 -0
  50. package/dist/chunk-GDD652NR.mjs.map +1 -0
  51. package/dist/chunk-GGC4TWMF.mjs +40 -0
  52. package/dist/chunk-GGC4TWMF.mjs.map +1 -0
  53. package/dist/chunk-GI5TZOAG.mjs +30 -0
  54. package/dist/chunk-GI5TZOAG.mjs.map +1 -0
  55. package/dist/chunk-GVX6S54O.mjs +54 -0
  56. package/dist/chunk-GVX6S54O.mjs.map +1 -0
  57. package/dist/chunk-H22IHXDC.mjs +23 -0
  58. package/dist/chunk-H22IHXDC.mjs.map +1 -0
  59. package/dist/chunk-H6GKGVYF.mjs +18 -0
  60. package/dist/chunk-H6GKGVYF.mjs.map +1 -0
  61. package/dist/chunk-HNB4RM5S.mjs +89 -0
  62. package/dist/chunk-HNB4RM5S.mjs.map +1 -0
  63. package/dist/chunk-I3VZW3XF.mjs +46 -0
  64. package/dist/chunk-I3VZW3XF.mjs.map +1 -0
  65. package/dist/chunk-IJFQ7PRU.mjs +19 -0
  66. package/dist/chunk-IJFQ7PRU.mjs.map +1 -0
  67. package/dist/chunk-JER7KLEK.mjs +82 -0
  68. package/dist/chunk-JER7KLEK.mjs.map +1 -0
  69. package/dist/chunk-JXJ5LRH3.mjs +30 -0
  70. package/dist/chunk-JXJ5LRH3.mjs.map +1 -0
  71. package/dist/chunk-L2BMMXCX.mjs +79 -0
  72. package/dist/chunk-L2BMMXCX.mjs.map +1 -0
  73. package/dist/chunk-LB7OMB5S.mjs +57 -0
  74. package/dist/chunk-LB7OMB5S.mjs.map +1 -0
  75. package/dist/chunk-LCDQWW2Y.mjs +18 -0
  76. package/dist/chunk-LCDQWW2Y.mjs.map +1 -0
  77. package/dist/chunk-LD64IICE.mjs +28 -0
  78. package/dist/chunk-LD64IICE.mjs.map +1 -0
  79. package/dist/chunk-LV7HNQ3N.mjs +183 -0
  80. package/dist/chunk-LV7HNQ3N.mjs.map +1 -0
  81. package/dist/chunk-M4UUIOW6.mjs +86 -0
  82. package/dist/chunk-M4UUIOW6.mjs.map +1 -0
  83. package/dist/chunk-MDLVDMKY.mjs +11 -0
  84. package/dist/chunk-MDLVDMKY.mjs.map +1 -0
  85. package/dist/chunk-NF7FTEE7.mjs +26 -0
  86. package/dist/chunk-NF7FTEE7.mjs.map +1 -0
  87. package/dist/chunk-NYTGMBLK.mjs +49 -0
  88. package/dist/chunk-NYTGMBLK.mjs.map +1 -0
  89. package/dist/chunk-O62PGEQ7.mjs +20 -0
  90. package/dist/chunk-O62PGEQ7.mjs.map +1 -0
  91. package/dist/chunk-OQNZEKWO.mjs +24 -0
  92. package/dist/chunk-OQNZEKWO.mjs.map +1 -0
  93. package/dist/chunk-OXBQSJDF.mjs +45 -0
  94. package/dist/chunk-OXBQSJDF.mjs.map +1 -0
  95. package/dist/chunk-PIRWVOO2.mjs +7 -0
  96. package/dist/chunk-PIRWVOO2.mjs.map +1 -0
  97. package/dist/chunk-PLIJ2CRV.mjs +25 -0
  98. package/dist/chunk-PLIJ2CRV.mjs.map +1 -0
  99. package/dist/chunk-PSIJUWZT.mjs +13 -0
  100. package/dist/chunk-PSIJUWZT.mjs.map +1 -0
  101. package/dist/chunk-QOGUHAMC.mjs +40 -0
  102. package/dist/chunk-QOGUHAMC.mjs.map +1 -0
  103. package/dist/chunk-SGSU4KYT.mjs +49 -0
  104. package/dist/chunk-SGSU4KYT.mjs.map +1 -0
  105. package/dist/chunk-SJGDB24D.mjs +41 -0
  106. package/dist/chunk-SJGDB24D.mjs.map +1 -0
  107. package/dist/chunk-SJGQU3OG.mjs +15 -0
  108. package/dist/chunk-SJGQU3OG.mjs.map +1 -0
  109. package/dist/chunk-SP4KAT3N.mjs +25 -0
  110. package/dist/chunk-SP4KAT3N.mjs.map +1 -0
  111. package/dist/chunk-SS3C77DP.mjs +134 -0
  112. package/dist/chunk-SS3C77DP.mjs.map +1 -0
  113. package/dist/chunk-SW2OCUH3.mjs +10 -0
  114. package/dist/chunk-SW2OCUH3.mjs.map +1 -0
  115. package/dist/chunk-UDLMLGTS.mjs +43 -0
  116. package/dist/chunk-UDLMLGTS.mjs.map +1 -0
  117. package/dist/chunk-V62IOKST.mjs +21 -0
  118. package/dist/chunk-V62IOKST.mjs.map +1 -0
  119. package/dist/chunk-WEXSGVXZ.mjs +53 -0
  120. package/dist/chunk-WEXSGVXZ.mjs.map +1 -0
  121. package/dist/chunk-WUFQM7VZ.mjs +20 -0
  122. package/dist/chunk-WUFQM7VZ.mjs.map +1 -0
  123. package/dist/chunk-YTWFWQNB.mjs +866 -0
  124. package/dist/chunk-YTWFWQNB.mjs.map +1 -0
  125. package/dist/chunk-ZHAJLP7P.mjs +49 -0
  126. package/dist/chunk-ZHAJLP7P.mjs.map +1 -0
  127. package/dist/chunk-ZNWOAXMK.mjs +46 -0
  128. package/dist/chunk-ZNWOAXMK.mjs.map +1 -0
  129. package/dist/data/Condition.mjs +19 -35
  130. package/dist/data/Condition.mjs.map +1 -1
  131. package/dist/data/Database.mjs +15 -12
  132. package/dist/data/Database.mjs.map +1 -1
  133. package/dist/data/Field.mjs +28 -6
  134. package/dist/data/Field.mjs.map +1 -1
  135. package/dist/data/InMemoryGateway.mjs +26 -4
  136. package/dist/data/InMemoryGateway.mjs.map +1 -1
  137. package/dist/domain/Audit.mjs +18 -24
  138. package/dist/domain/Audit.mjs.map +1 -1
  139. package/dist/domain/Child.mjs +28 -5
  140. package/dist/domain/Child.mjs.map +1 -1
  141. package/dist/domain/Entity.mjs +32 -6
  142. package/dist/domain/Entity.mjs.map +1 -1
  143. package/dist/domain/Repo.mjs +28 -5
  144. package/dist/domain/Repo.mjs.map +1 -1
  145. package/dist/domain/Struct.mjs +15 -25
  146. package/dist/domain/Struct.mjs.map +1 -1
  147. package/dist/domain/Typo.mjs +21 -4
  148. package/dist/domain/Typo.mjs.map +1 -1
  149. package/dist/domain/enums/Country.mjs +14 -262
  150. package/dist/domain/enums/Country.mjs.map +1 -1
  151. package/dist/domain/enums/Currency.mjs +17 -131
  152. package/dist/domain/enums/Currency.mjs.map +1 -1
  153. package/dist/domain/enums/Environment.mjs +21 -7
  154. package/dist/domain/enums/Environment.mjs.map +1 -1
  155. package/dist/domain/enums/Locale.mjs +581 -566
  156. package/dist/domain/enums/Locale.mjs.map +1 -1
  157. package/dist/domain/enums/UnitOfMeasurement.mjs +14 -12
  158. package/dist/domain/enums/UnitOfMeasurement.mjs.map +1 -1
  159. package/dist/domain/enums/UnitOfWeight.mjs +14 -10
  160. package/dist/domain/enums/UnitOfWeight.mjs.map +1 -1
  161. package/dist/domain/structs/Address.mjs +34 -8
  162. package/dist/domain/structs/Address.mjs.map +1 -1
  163. package/dist/domain/structs/Box.mjs +26 -5
  164. package/dist/domain/structs/Box.mjs.map +1 -1
  165. package/dist/domain/structs/Dimension.mjs +18 -26
  166. package/dist/domain/structs/Dimension.mjs.map +1 -1
  167. package/dist/domain/structs/Money.mjs +19 -32
  168. package/dist/domain/structs/Money.mjs.map +1 -1
  169. package/dist/domain/structs/Name.mjs +25 -6
  170. package/dist/domain/structs/Name.mjs.map +1 -1
  171. package/dist/domain/structs/Weight.mjs +26 -6
  172. package/dist/domain/structs/Weight.mjs.map +1 -1
  173. package/dist/domain/values/DateTime.mjs +17 -88
  174. package/dist/domain/values/DateTime.mjs.map +1 -1
  175. package/dist/domain/values/EAN.mjs +21 -4
  176. package/dist/domain/values/EAN.mjs.map +1 -1
  177. package/dist/domain/values/Email.mjs +23 -5
  178. package/dist/domain/values/Email.mjs.map +1 -1
  179. package/dist/domain/values/IBAN.mjs +21 -4
  180. package/dist/domain/values/IBAN.mjs.map +1 -1
  181. package/dist/domain/values/PostalCode.mjs +16 -13
  182. package/dist/domain/values/PostalCode.mjs.map +1 -1
  183. package/dist/domain/values/Slug.mjs +21 -4
  184. package/dist/domain/values/Slug.mjs.map +1 -1
  185. package/dist/domain/values/Url.mjs +22 -5
  186. package/dist/domain/values/Url.mjs.map +1 -1
  187. package/dist/health/HealthResource.mjs +32 -4
  188. package/dist/health/HealthResource.mjs.map +1 -1
  189. package/dist/health/HealthUri.mjs +15 -5
  190. package/dist/health/HealthUri.mjs.map +1 -1
  191. package/dist/http/CacheControl.mjs +16 -28
  192. package/dist/http/CacheControl.mjs.map +1 -1
  193. package/dist/http/ContentType.mjs +14 -15
  194. package/dist/http/ContentType.mjs.map +1 -1
  195. package/dist/http/HttpHeader.mjs +3 -4
  196. package/dist/http/HttpHeader.mjs.map +1 -1
  197. package/dist/http/HttpStatus.mjs +16 -80
  198. package/dist/http/HttpStatus.mjs.map +1 -1
  199. package/dist/http/HttpVerb.mjs +14 -11
  200. package/dist/http/HttpVerb.mjs.map +1 -1
  201. package/dist/http/LocalRequestStore.mjs +17 -3
  202. package/dist/http/LocalRequestStore.mjs.map +1 -1
  203. package/dist/http/OriginatedError.mjs +9 -5
  204. package/dist/http/OriginatedError.mjs.map +1 -1
  205. package/dist/http/RequestOptions.mjs +19 -59
  206. package/dist/http/RequestOptions.mjs.map +1 -1
  207. package/dist/http/Response.mjs +16 -9
  208. package/dist/http/Response.mjs.map +1 -1
  209. package/dist/http/RestResult.mjs +16 -26
  210. package/dist/http/RestResult.mjs.map +1 -1
  211. package/dist/http/Verb.mjs +27 -19
  212. package/dist/http/Verb.mjs.map +1 -1
  213. package/dist/index.js +4790 -27
  214. package/dist/index.js.map +1 -1
  215. package/dist/process/App.mjs +19 -4
  216. package/dist/process/App.mjs.map +1 -1
  217. package/dist/process/Manage.mjs +19 -3
  218. package/dist/process/Manage.mjs.map +1 -1
  219. package/dist/process/Scope.mjs +14 -18
  220. package/dist/process/Scope.mjs.map +1 -1
  221. package/dist/process/Search.mjs +15 -34
  222. package/dist/process/Search.mjs.map +1 -1
  223. package/dist/process/UseCase.mjs +24 -4
  224. package/dist/process/UseCase.mjs.map +1 -1
  225. package/dist/resources/Req.mjs +20 -4
  226. package/dist/resources/Req.mjs.map +1 -1
  227. package/dist/resources/Requires.mjs +18 -4
  228. package/dist/resources/Requires.mjs.map +1 -1
  229. package/dist/resources/Route.mjs +15 -32
  230. package/dist/resources/Route.mjs.map +1 -1
  231. package/dist/resources/Service.mjs +19 -3
  232. package/dist/resources/Service.mjs.map +1 -1
  233. package/dist/security/Jwt.mjs +21 -5
  234. package/dist/security/Jwt.mjs.map +1 -1
  235. package/dist/services/Api.mjs +25 -63
  236. package/dist/services/Api.mjs.map +1 -1
  237. package/dist/services/ApiGateway.mjs +27 -29
  238. package/dist/services/ApiGateway.mjs.map +1 -1
  239. package/dist/services/AxiosProvider.mjs +22 -23
  240. package/dist/services/AxiosProvider.mjs.map +1 -1
  241. package/dist/services/MappedRouteGateway.mjs +40 -5
  242. package/dist/services/MappedRouteGateway.mjs.map +1 -1
  243. package/dist/services/RouteGateway.mjs +28 -42
  244. package/dist/services/RouteGateway.mjs.map +1 -1
  245. package/dist/services/ViewRouteGateway.mjs +39 -5
  246. package/dist/services/ViewRouteGateway.mjs.map +1 -1
  247. package/dist/sql/Clause.mjs +19 -22
  248. package/dist/sql/Clause.mjs.map +1 -1
  249. package/dist/sql/Column.mjs +19 -64
  250. package/dist/sql/Column.mjs.map +1 -1
  251. package/dist/sql/Count.mjs +16 -7
  252. package/dist/sql/Count.mjs.map +1 -1
  253. package/dist/sql/Delete.mjs +15 -7
  254. package/dist/sql/Delete.mjs.map +1 -1
  255. package/dist/sql/Insert.mjs +17 -12
  256. package/dist/sql/Insert.mjs.map +1 -1
  257. package/dist/sql/Join.mjs +3 -18
  258. package/dist/sql/Join.mjs.map +1 -1
  259. package/dist/sql/Select.mjs +15 -40
  260. package/dist/sql/Select.mjs.map +1 -1
  261. package/dist/sql/SqlQuery.mjs +14 -11
  262. package/dist/sql/SqlQuery.mjs.map +1 -1
  263. package/dist/sql/Table.mjs +53 -12
  264. package/dist/sql/Table.mjs.map +1 -1
  265. package/dist/sql/TableGateway.mjs +27 -5
  266. package/dist/sql/TableGateway.mjs.map +1 -1
  267. package/dist/sql/Update.mjs +17 -13
  268. package/dist/sql/Update.mjs.map +1 -1
  269. package/dist/types/Array.mjs +9 -22
  270. package/dist/types/Array.mjs.map +1 -1
  271. package/dist/types/Builder.mjs +21 -7
  272. package/dist/types/Builder.mjs.map +1 -1
  273. package/dist/types/Cache.mjs +17 -3
  274. package/dist/types/Cache.mjs.map +1 -1
  275. package/dist/types/CacheAge.mjs +15 -36
  276. package/dist/types/CacheAge.mjs.map +1 -1
  277. package/dist/types/Case.mjs +13 -87
  278. package/dist/types/Case.mjs.map +1 -1
  279. package/dist/types/Constructor.mjs +11 -12
  280. package/dist/types/Constructor.mjs.map +1 -1
  281. package/dist/types/Context.mjs +17 -81
  282. package/dist/types/Context.mjs.map +1 -1
  283. package/dist/types/Enum.mjs +14 -46
  284. package/dist/types/Enum.mjs.map +1 -1
  285. package/dist/types/Exception.mjs +15 -22
  286. package/dist/types/Exception.mjs.map +1 -1
  287. package/dist/types/Falsy.mjs +4 -2
  288. package/dist/types/Falsy.mjs.map +1 -1
  289. package/dist/types/Func.mjs +3 -1
  290. package/dist/types/Func.mjs.map +1 -1
  291. package/dist/types/Gateway.mjs +14 -34
  292. package/dist/types/Gateway.mjs.map +1 -1
  293. package/dist/types/Get.mjs +6 -4
  294. package/dist/types/Get.mjs.map +1 -1
  295. package/dist/types/Id.mjs +5 -2
  296. package/dist/types/Id.mjs.map +1 -1
  297. package/dist/types/Is.mjs +21 -21
  298. package/dist/types/Is.mjs.map +1 -1
  299. package/dist/types/IsA.mjs +6 -3
  300. package/dist/types/IsA.mjs.map +1 -1
  301. package/dist/types/IsDate.mjs +6 -12
  302. package/dist/types/IsDate.mjs.map +1 -1
  303. package/dist/types/IsEqual.mjs +14 -11
  304. package/dist/types/IsEqual.mjs.map +1 -1
  305. package/dist/types/Json.mjs +14 -31
  306. package/dist/types/Json.mjs.map +1 -1
  307. package/dist/types/List.mjs +18 -170
  308. package/dist/types/List.mjs.map +1 -1
  309. package/dist/types/Message.mjs +6 -2
  310. package/dist/types/Message.mjs.map +1 -1
  311. package/dist/types/Meta.mjs +14 -41
  312. package/dist/types/Meta.mjs.map +1 -1
  313. package/dist/types/Nullish.mjs +3 -1
  314. package/dist/types/Nullish.mjs.map +1 -1
  315. package/dist/types/Number.mjs +14 -5
  316. package/dist/types/Number.mjs.map +1 -1
  317. package/dist/types/PageList.mjs +19 -118
  318. package/dist/types/PageList.mjs.map +1 -1
  319. package/dist/types/Parser.mjs +30 -7
  320. package/dist/types/Parser.mjs.map +1 -1
  321. package/dist/types/Primitive.mjs +4 -4
  322. package/dist/types/Primitive.mjs.map +1 -1
  323. package/dist/types/Repository.mjs +14 -40
  324. package/dist/types/Repository.mjs.map +1 -1
  325. package/dist/types/Result.mjs +14 -8
  326. package/dist/types/Result.mjs.map +1 -1
  327. package/dist/types/Results.mjs +15 -19
  328. package/dist/types/Results.mjs.map +1 -1
  329. package/dist/types/Sort.mjs +4 -2
  330. package/dist/types/Sort.mjs.map +1 -1
  331. package/dist/types/Tag.mjs +17 -3
  332. package/dist/types/Tag.mjs.map +1 -1
  333. package/dist/types/Template.mjs +14 -35
  334. package/dist/types/Template.mjs.map +1 -1
  335. package/dist/types/Text.mjs +19 -97
  336. package/dist/types/Text.mjs.map +1 -1
  337. package/dist/types/Try.mjs +14 -107
  338. package/dist/types/Try.mjs.map +1 -1
  339. package/dist/types/Uri.mjs +16 -74
  340. package/dist/types/Uri.mjs.map +1 -1
  341. package/dist/types/Uuid.mjs +5 -5
  342. package/dist/types/Uuid.mjs.map +1 -1
  343. package/dist/types/Validatable.mjs +6 -2
  344. package/dist/types/Validatable.mjs.map +1 -1
  345. package/dist/types/Value.mjs +14 -17
  346. package/dist/types/Value.mjs.map +1 -1
  347. package/dist/utils/Base64.mjs +3 -1
  348. package/dist/utils/Base64.mjs.map +1 -1
  349. package/dist/utils/Convert.mjs +15 -39
  350. package/dist/utils/Convert.mjs.map +1 -1
  351. package/dist/utils/If.mjs +10 -13
  352. package/dist/utils/If.mjs.map +1 -1
  353. package/dist/utils/Loading.mjs +6 -2
  354. package/dist/utils/Loading.mjs.map +1 -1
  355. package/dist/utils/Log.mjs +2 -0
  356. package/dist/utils/Log.mjs.map +1 -1
  357. package/dist/utils/Mapper.mjs +19 -101
  358. package/dist/utils/Mapper.mjs.map +1 -1
  359. package/dist/utils/Promise.mjs +19 -16
  360. package/dist/utils/Promise.mjs.map +1 -1
  361. package/dist/utils/Property.mjs +15 -14
  362. package/dist/utils/Property.mjs.map +1 -1
  363. package/dist/utils/Sentence.mjs +28 -14
  364. package/dist/utils/Sentence.mjs.map +1 -1
  365. package/dist/utils/State.mjs +7 -8
  366. package/dist/utils/State.mjs.map +1 -1
  367. package/dist/utils/Traverse.mjs +3 -5
  368. package/dist/utils/Traverse.mjs.map +1 -1
  369. package/dist/utils/View.mjs +21 -64
  370. package/dist/utils/View.mjs.map +1 -1
  371. package/dist/utils/Wait.mjs +5 -3
  372. package/dist/utils/Wait.mjs.map +1 -1
  373. package/dist/validation/Contraints.mjs +32 -29
  374. package/dist/validation/Contraints.mjs.map +1 -1
  375. package/dist/validation/Validate.mjs +16 -28
  376. package/dist/validation/Validate.mjs.map +1 -1
  377. package/dist/validation/When.mjs +14 -38
  378. package/dist/validation/When.mjs.map +1 -1
  379. package/package.json +4 -3
  380. package/dist/data/Condition.js +0 -71
  381. package/dist/data/Condition.js.map +0 -1
  382. package/dist/data/DataProvider.js +0 -17
  383. package/dist/data/DataProvider.js.map +0 -1
  384. package/dist/data/Database.js +0 -42
  385. package/dist/data/Database.js.map +0 -1
  386. package/dist/data/Field.js +0 -48
  387. package/dist/data/Field.js.map +0 -1
  388. package/dist/data/InMemoryGateway.js +0 -59
  389. package/dist/data/InMemoryGateway.js.map +0 -1
  390. package/dist/data/Query.js +0 -17
  391. package/dist/data/Query.js.map +0 -1
  392. package/dist/data/QueryProvider.js +0 -17
  393. package/dist/data/QueryProvider.js.map +0 -1
  394. package/dist/data/index.js +0 -35
  395. package/dist/data/index.js.map +0 -1
  396. package/dist/domain/Audit.js +0 -59
  397. package/dist/domain/Audit.js.map +0 -1
  398. package/dist/domain/Child.js +0 -49
  399. package/dist/domain/Child.js.map +0 -1
  400. package/dist/domain/Entity.js +0 -62
  401. package/dist/domain/Entity.js.map +0 -1
  402. package/dist/domain/Repo.js +0 -81
  403. package/dist/domain/Repo.js.map +0 -1
  404. package/dist/domain/Struct.js +0 -55
  405. package/dist/domain/Struct.js.map +0 -1
  406. package/dist/domain/Typo.js +0 -62
  407. package/dist/domain/Typo.js.map +0 -1
  408. package/dist/domain/enums/Country.js +0 -290
  409. package/dist/domain/enums/Country.js.map +0 -1
  410. package/dist/domain/enums/Currency.js +0 -159
  411. package/dist/domain/enums/Currency.js.map +0 -1
  412. package/dist/domain/enums/Environment.js +0 -35
  413. package/dist/domain/enums/Environment.js.map +0 -1
  414. package/dist/domain/enums/Locale.js +0 -605
  415. package/dist/domain/enums/Locale.js.map +0 -1
  416. package/dist/domain/enums/UnitOfMeasurement.js +0 -40
  417. package/dist/domain/enums/UnitOfMeasurement.js.map +0 -1
  418. package/dist/domain/enums/UnitOfWeight.js +0 -38
  419. package/dist/domain/enums/UnitOfWeight.js.map +0 -1
  420. package/dist/domain/enums/index.js +0 -33
  421. package/dist/domain/enums/index.js.map +0 -1
  422. package/dist/domain/index.js +0 -39
  423. package/dist/domain/index.js.map +0 -1
  424. package/dist/domain/structs/Address.js +0 -73
  425. package/dist/domain/structs/Address.js.map +0 -1
  426. package/dist/domain/structs/Box.js +0 -70
  427. package/dist/domain/structs/Box.js.map +0 -1
  428. package/dist/domain/structs/Dimension.js +0 -61
  429. package/dist/domain/structs/Dimension.js.map +0 -1
  430. package/dist/domain/structs/Money.js +0 -71
  431. package/dist/domain/structs/Money.js.map +0 -1
  432. package/dist/domain/structs/Name.js +0 -57
  433. package/dist/domain/structs/Name.js.map +0 -1
  434. package/dist/domain/structs/Weight.js +0 -71
  435. package/dist/domain/structs/Weight.js.map +0 -1
  436. package/dist/domain/structs/index.js +0 -33
  437. package/dist/domain/structs/index.js.map +0 -1
  438. package/dist/domain/values/DateTime.js +0 -120
  439. package/dist/domain/values/DateTime.js.map +0 -1
  440. package/dist/domain/values/EAN.js +0 -50
  441. package/dist/domain/values/EAN.js.map +0 -1
  442. package/dist/domain/values/Email.js +0 -57
  443. package/dist/domain/values/Email.js.map +0 -1
  444. package/dist/domain/values/IBAN.js +0 -50
  445. package/dist/domain/values/IBAN.js.map +0 -1
  446. package/dist/domain/values/PostalCode.js +0 -53
  447. package/dist/domain/values/PostalCode.js.map +0 -1
  448. package/dist/domain/values/Slug.js +0 -41
  449. package/dist/domain/values/Slug.js.map +0 -1
  450. package/dist/domain/values/Url.js +0 -57
  451. package/dist/domain/values/Url.js.map +0 -1
  452. package/dist/domain/values/index.js +0 -35
  453. package/dist/domain/values/index.js.map +0 -1
  454. package/dist/health/HealthResource.js +0 -49
  455. package/dist/health/HealthResource.js.map +0 -1
  456. package/dist/health/HealthUri.js +0 -33
  457. package/dist/health/HealthUri.js.map +0 -1
  458. package/dist/health/index.js +0 -25
  459. package/dist/health/index.js.map +0 -1
  460. package/dist/http/CacheControl.js +0 -56
  461. package/dist/http/CacheControl.js.map +0 -1
  462. package/dist/http/ContentType.js +0 -53
  463. package/dist/http/ContentType.js.map +0 -1
  464. package/dist/http/HttpHeader.js +0 -32
  465. package/dist/http/HttpHeader.js.map +0 -1
  466. package/dist/http/HttpStatus.js +0 -112
  467. package/dist/http/HttpStatus.js.map +0 -1
  468. package/dist/http/HttpVerb.js +0 -39
  469. package/dist/http/HttpVerb.js.map +0 -1
  470. package/dist/http/LocalRequestStore.js +0 -36
  471. package/dist/http/LocalRequestStore.js.map +0 -1
  472. package/dist/http/OriginatedError.js +0 -44
  473. package/dist/http/OriginatedError.js.map +0 -1
  474. package/dist/http/Request.js +0 -17
  475. package/dist/http/Request.js.map +0 -1
  476. package/dist/http/RequestOptions.js +0 -91
  477. package/dist/http/RequestOptions.js.map +0 -1
  478. package/dist/http/RequestProvider.js +0 -17
  479. package/dist/http/RequestProvider.js.map +0 -1
  480. package/dist/http/Response.js +0 -39
  481. package/dist/http/Response.js.map +0 -1
  482. package/dist/http/RestResult.js +0 -56
  483. package/dist/http/RestResult.js.map +0 -1
  484. package/dist/http/Verb.js +0 -61
  485. package/dist/http/Verb.js.map +0 -1
  486. package/dist/http/index.js +0 -45
  487. package/dist/http/index.js.map +0 -1
  488. package/dist/process/App.js +0 -35
  489. package/dist/process/App.js.map +0 -1
  490. package/dist/process/Manage.js +0 -43
  491. package/dist/process/Manage.js.map +0 -1
  492. package/dist/process/Scope.js +0 -46
  493. package/dist/process/Scope.js.map +0 -1
  494. package/dist/process/Search.js +0 -62
  495. package/dist/process/Search.js.map +0 -1
  496. package/dist/process/UseCase.js +0 -50
  497. package/dist/process/UseCase.js.map +0 -1
  498. package/dist/process/index.js +0 -31
  499. package/dist/process/index.js.map +0 -1
  500. package/dist/resources/AppProvider.js +0 -17
  501. package/dist/resources/AppProvider.js.map +0 -1
  502. package/dist/resources/Req.js +0 -54
  503. package/dist/resources/Req.js.map +0 -1
  504. package/dist/resources/Requires.js +0 -48
  505. package/dist/resources/Requires.js.map +0 -1
  506. package/dist/resources/Resource.js +0 -17
  507. package/dist/resources/Resource.js.map +0 -1
  508. package/dist/resources/Route.js +0 -62
  509. package/dist/resources/Route.js.map +0 -1
  510. package/dist/resources/Service.js +0 -49
  511. package/dist/resources/Service.js.map +0 -1
  512. package/dist/resources/index.js +0 -35
  513. package/dist/resources/index.js.map +0 -1
  514. package/dist/security/Jwt.js +0 -48
  515. package/dist/security/Jwt.js.map +0 -1
  516. package/dist/security/index.js +0 -23
  517. package/dist/security/index.js.map +0 -1
  518. package/dist/services/Api.js +0 -93
  519. package/dist/services/Api.js.map +0 -1
  520. package/dist/services/ApiGateway.js +0 -57
  521. package/dist/services/ApiGateway.js.map +0 -1
  522. package/dist/services/AxiosProvider.js +0 -61
  523. package/dist/services/AxiosProvider.js.map +0 -1
  524. package/dist/services/MappedRouteGateway.js +0 -52
  525. package/dist/services/MappedRouteGateway.js.map +0 -1
  526. package/dist/services/RouteGateway.js +0 -70
  527. package/dist/services/RouteGateway.js.map +0 -1
  528. package/dist/services/ViewRouteGateway.js +0 -55
  529. package/dist/services/ViewRouteGateway.js.map +0 -1
  530. package/dist/services/index.js +0 -33
  531. package/dist/services/index.js.map +0 -1
  532. package/dist/sql/Clause.js +0 -58
  533. package/dist/sql/Clause.js.map +0 -1
  534. package/dist/sql/Column.js +0 -96
  535. package/dist/sql/Column.js.map +0 -1
  536. package/dist/sql/Count.js +0 -35
  537. package/dist/sql/Count.js.map +0 -1
  538. package/dist/sql/Delete.js +0 -35
  539. package/dist/sql/Delete.js.map +0 -1
  540. package/dist/sql/Insert.js +0 -40
  541. package/dist/sql/Insert.js.map +0 -1
  542. package/dist/sql/Join.js +0 -46
  543. package/dist/sql/Join.js.map +0 -1
  544. package/dist/sql/Select.js +0 -68
  545. package/dist/sql/Select.js.map +0 -1
  546. package/dist/sql/SqlQuery.js +0 -39
  547. package/dist/sql/SqlQuery.js.map +0 -1
  548. package/dist/sql/Table.js +0 -63
  549. package/dist/sql/Table.js.map +0 -1
  550. package/dist/sql/TableGateway.js +0 -62
  551. package/dist/sql/TableGateway.js.map +0 -1
  552. package/dist/sql/Update.js +0 -41
  553. package/dist/sql/Update.js.map +0 -1
  554. package/dist/sql/index.js +0 -41
  555. package/dist/sql/index.js.map +0 -1
  556. package/dist/types/Array.js +0 -54
  557. package/dist/types/Array.js.map +0 -1
  558. package/dist/types/Builder.js +0 -43
  559. package/dist/types/Builder.js.map +0 -1
  560. package/dist/types/Cache.js +0 -38
  561. package/dist/types/Cache.js.map +0 -1
  562. package/dist/types/CacheAge.js +0 -64
  563. package/dist/types/CacheAge.js.map +0 -1
  564. package/dist/types/Case.js +0 -115
  565. package/dist/types/Case.js.map +0 -1
  566. package/dist/types/Constructor.js +0 -50
  567. package/dist/types/Constructor.js.map +0 -1
  568. package/dist/types/Context.js +0 -117
  569. package/dist/types/Context.js.map +0 -1
  570. package/dist/types/Enum.js +0 -76
  571. package/dist/types/Enum.js.map +0 -1
  572. package/dist/types/ErrorOrigin.js +0 -17
  573. package/dist/types/ErrorOrigin.js.map +0 -1
  574. package/dist/types/Exception.js +0 -54
  575. package/dist/types/Exception.js.map +0 -1
  576. package/dist/types/Falsy.js +0 -32
  577. package/dist/types/Falsy.js.map +0 -1
  578. package/dist/types/Func.js +0 -29
  579. package/dist/types/Func.js.map +0 -1
  580. package/dist/types/Gateway.js +0 -62
  581. package/dist/types/Gateway.js.map +0 -1
  582. package/dist/types/Get.js +0 -36
  583. package/dist/types/Get.js.map +0 -1
  584. package/dist/types/Id.js +0 -30
  585. package/dist/types/Id.js.map +0 -1
  586. package/dist/types/Identity.js +0 -17
  587. package/dist/types/Identity.js.map +0 -1
  588. package/dist/types/Is.js +0 -85
  589. package/dist/types/Is.js.map +0 -1
  590. package/dist/types/IsA.js +0 -33
  591. package/dist/types/IsA.js.map +0 -1
  592. package/dist/types/IsDate.js +0 -46
  593. package/dist/types/IsDate.js.map +0 -1
  594. package/dist/types/IsEqual.js +0 -39
  595. package/dist/types/IsEqual.js.map +0 -1
  596. package/dist/types/Json.js +0 -67
  597. package/dist/types/Json.js.map +0 -1
  598. package/dist/types/List.js +0 -208
  599. package/dist/types/List.js.map +0 -1
  600. package/dist/types/Message.js +0 -30
  601. package/dist/types/Message.js.map +0 -1
  602. package/dist/types/Meta.js +0 -71
  603. package/dist/types/Meta.js.map +0 -1
  604. package/dist/types/Nullish.js +0 -29
  605. package/dist/types/Nullish.js.map +0 -1
  606. package/dist/types/Number.js +0 -33
  607. package/dist/types/Number.js.map +0 -1
  608. package/dist/types/PageList.js.map +0 -1
  609. package/dist/types/Parser.js +0 -69
  610. package/dist/types/Parser.js.map +0 -1
  611. package/dist/types/Primitive.js +0 -32
  612. package/dist/types/Primitive.js.map +0 -1
  613. package/dist/types/Repository.js +0 -68
  614. package/dist/types/Repository.js.map +0 -1
  615. package/dist/types/Result.js +0 -38
  616. package/dist/types/Result.js.map +0 -1
  617. package/dist/types/Results.js +0 -51
  618. package/dist/types/Results.js.map +0 -1
  619. package/dist/types/Sort.js +0 -32
  620. package/dist/types/Sort.js.map +0 -1
  621. package/dist/types/Tag.js +0 -35
  622. package/dist/types/Tag.js.map +0 -1
  623. package/dist/types/Template.js +0 -65
  624. package/dist/types/Template.js.map +0 -1
  625. package/dist/types/Text.js +0 -137
  626. package/dist/types/Text.js.map +0 -1
  627. package/dist/types/Try.js +0 -137
  628. package/dist/types/Try.js.map +0 -1
  629. package/dist/types/TypeGuard.js +0 -17
  630. package/dist/types/TypeGuard.js.map +0 -1
  631. package/dist/types/Types.js +0 -17
  632. package/dist/types/Types.js.map +0 -1
  633. package/dist/types/Uri.js +0 -106
  634. package/dist/types/Uri.js.map +0 -1
  635. package/dist/types/Uuid.js +0 -35
  636. package/dist/types/Uuid.js.map +0 -1
  637. package/dist/types/Validatable.js +0 -30
  638. package/dist/types/Validatable.js.map +0 -1
  639. package/dist/types/Value.js +0 -47
  640. package/dist/types/Value.js.map +0 -1
  641. package/dist/types/index.js +0 -107
  642. package/dist/types/index.js.map +0 -1
  643. package/dist/utils/Base64.js +0 -33
  644. package/dist/utils/Base64.js.map +0 -1
  645. package/dist/utils/Convert.js +0 -69
  646. package/dist/utils/Convert.js.map +0 -1
  647. package/dist/utils/If.js +0 -47
  648. package/dist/utils/If.js.map +0 -1
  649. package/dist/utils/Loading.js +0 -30
  650. package/dist/utils/Loading.js.map +0 -1
  651. package/dist/utils/Log.js +0 -43
  652. package/dist/utils/Log.js.map +0 -1
  653. package/dist/utils/Mapper.js +0 -133
  654. package/dist/utils/Mapper.js.map +0 -1
  655. package/dist/utils/Promise.js +0 -56
  656. package/dist/utils/Promise.js.map +0 -1
  657. package/dist/utils/Property.js +0 -42
  658. package/dist/utils/Property.js.map +0 -1
  659. package/dist/utils/Sentence.js +0 -80
  660. package/dist/utils/Sentence.js.map +0 -1
  661. package/dist/utils/State.js +0 -36
  662. package/dist/utils/State.js.map +0 -1
  663. package/dist/utils/Traverse.js +0 -33
  664. package/dist/utils/Traverse.js.map +0 -1
  665. package/dist/utils/View.js +0 -86
  666. package/dist/utils/View.js.map +0 -1
  667. package/dist/utils/Wait.js +0 -39
  668. package/dist/utils/Wait.js.map +0 -1
  669. package/dist/utils/index.js +0 -47
  670. package/dist/utils/index.js.map +0 -1
  671. package/dist/validation/Contraints.js +0 -91
  672. package/dist/validation/Contraints.js.map +0 -1
  673. package/dist/validation/Validate.js +0 -46
  674. package/dist/validation/Validate.js.map +0 -1
  675. package/dist/validation/When.js +0 -68
  676. package/dist/validation/When.js.map +0 -1
  677. package/dist/validation/index.js +0 -27
  678. package/dist/validation/index.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,45 +1,4808 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
8
+ var __export = (target, all) => {
9
+ for (var name2 in all)
10
+ __defProp(target, name2, { get: all[name2], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc2) => {
7
13
  if (from && typeof from === "object" || typeof from === "function") {
8
14
  for (let key of __getOwnPropNames(from))
9
15
  if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
11
17
  }
12
18
  return to;
13
19
  };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
15
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var __decorateClass = (decorators, target, key, kind) => {
30
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
31
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
32
+ if (decorator = decorators[i])
33
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
34
+ if (kind && result)
35
+ __defProp(target, key, result);
36
+ return result;
37
+ };
38
+
39
+ // src/index.ts
16
40
  var src_exports = {};
41
+ __export(src_exports, {
42
+ Address: () => Address,
43
+ Api: () => Api,
44
+ ApiGateway: () => ApiGateway,
45
+ App: () => App,
46
+ Audit: () => Audit,
47
+ AxiosProvider: () => AxiosProvider,
48
+ BaseContext: () => BaseContext,
49
+ BaseRequestContext: () => BaseRequestContext,
50
+ Box: () => Box,
51
+ CacheControl: () => CacheControl,
52
+ Child: () => Child,
53
+ Clause: () => Clause,
54
+ Column: () => Column,
55
+ Condition: () => Condition,
56
+ ContentType: () => ContentType,
57
+ Context: () => Context,
58
+ Convert: () => Convert,
59
+ Country: () => Country,
60
+ Currency: () => Currency,
61
+ Database: () => Database,
62
+ DateTime: () => DateTime,
63
+ DefaultProvider: () => DefaultProvider,
64
+ Delete: () => Delete,
65
+ Dimension: () => Dimension,
66
+ DotEnvContext: () => DotEnvContext,
67
+ EAN: () => EAN,
68
+ EasyUri: () => EasyUri,
69
+ Email: () => Email,
70
+ Entity: () => Entity,
71
+ Enum: () => Enum,
72
+ Environment: () => Environment,
73
+ Exception: () => Exception,
74
+ Field: () => Field,
75
+ Gateway: () => Gateway,
76
+ HealthResource: () => HealthResource,
77
+ HealthUri: () => HealthUri,
78
+ HttpHeader: () => HttpHeader,
79
+ HttpStatus: () => HttpStatus,
80
+ HttpVerb: () => HttpVerb,
81
+ IBAN: () => IBAN,
82
+ InMemoryGateway: () => InMemoryGateway,
83
+ Insert: () => Insert,
84
+ Join: () => Join2,
85
+ Jwt: () => Jwt,
86
+ List: () => List6,
87
+ Locale: () => Locale,
88
+ LogicalCondition: () => LogicalCondition,
89
+ Manage: () => Manage,
90
+ MappedRouteGateway: () => MappedRouteGateway,
91
+ Mapper: () => Mapper,
92
+ Money: () => Money,
93
+ Name: () => Name,
94
+ OrderColumn: () => OrderColumn,
95
+ OriginatedError: () => OriginatedError,
96
+ PageList: () => PageList2,
97
+ ParathesizedClause: () => ParathesizedClause,
98
+ Parser: () => Parser,
99
+ PatternColumn: () => PatternColumn,
100
+ PostalCode: () => PostalCode,
101
+ Property: () => Property,
102
+ Repo: () => Repo,
103
+ Repository: () => Repository,
104
+ Req: () => Req,
105
+ RequestOptions: () => RequestOptions,
106
+ Requires: () => Requires,
107
+ Results: () => Results4,
108
+ RouteGateway: () => RouteGateway,
109
+ Scope: () => Scope,
110
+ Search: () => Search,
111
+ Select: () => Select,
112
+ Sentence: () => Sentence,
113
+ Service: () => Service,
114
+ Slug: () => Slug,
115
+ SortCondition: () => SortCondition,
116
+ SqlQuery: () => SqlQuery,
117
+ State: () => State,
118
+ Struct: () => Struct,
119
+ Table: () => Table2,
120
+ TableGateway: () => TableGateway,
121
+ Template: () => Template,
122
+ ToText: () => ToText2,
123
+ Try: () => Try,
124
+ Typo: () => Typo,
125
+ UnitOfMeasurement: () => UnitOfMeasurement,
126
+ UnitOfWeight: () => UnitOfWeight,
127
+ Update: () => Update,
128
+ Url: () => Url,
129
+ UseCase: () => UseCase,
130
+ Value: () => Value,
131
+ View: () => View,
132
+ ViewRouteGateway: () => ViewRouteGateway,
133
+ Wait: () => Wait,
134
+ Weight: () => Weight,
135
+ When: () => When,
136
+ any: () => any,
137
+ api: () => api,
138
+ array: () => array,
139
+ asJson: () => asJson,
140
+ asList: () => asList,
141
+ asNumber: () => asNumber,
142
+ asPageList: () => asPageList,
143
+ asResults: () => asResults,
144
+ asString: () => asString,
145
+ asc: () => asc,
146
+ base64: () => base64,
147
+ build: () => build,
148
+ cache: () => cache,
149
+ cacheAge: () => cacheAge,
150
+ choose: () => choose,
151
+ constraint: () => constraint,
152
+ convert: () => convert,
153
+ ctx: () => ctx,
154
+ days: () => days,
155
+ defined: () => defined,
156
+ del: () => del,
157
+ desc: () => desc,
158
+ dir: () => dir,
159
+ dt: () => dt,
160
+ email: () => email,
161
+ entries: () => entries,
162
+ future: () => future,
163
+ get: () => get,
164
+ gt: () => gt,
165
+ gte: () => gte,
166
+ ifA: () => ifA,
167
+ ifDefined: () => ifDefined,
168
+ ifFalse: () => ifFalse,
169
+ ifGet: () => ifGet,
170
+ ifNotEmpty: () => ifNotEmpty,
171
+ ifTrue: () => ifTrue,
172
+ inFuture: () => inFuture,
173
+ inList: () => inList,
174
+ inOptionalList: () => inOptionalList,
175
+ inPast: () => inPast,
176
+ includes: () => includes,
177
+ isA: () => isA,
178
+ isAddress: () => isAddress,
179
+ isAn: () => isAn,
180
+ isArray: () => isArray,
181
+ isBoolean: () => isBoolean,
182
+ isClause: () => isClause,
183
+ isConstructor: () => isConstructor,
184
+ isDate: () => isDate,
185
+ isDateTime: () => isDateTime,
186
+ isDefined: () => isDefined,
187
+ isDoesNotExist: () => isDoesNotExist,
188
+ isEAN: () => isEAN,
189
+ isEmail: () => isEmail,
190
+ isEmpty: () => isEmpty,
191
+ isEmptyObject: () => isEmptyObject,
192
+ isEnum: () => isEnum,
193
+ isEqual: () => isEqual,
194
+ isError: () => isError,
195
+ isException: () => isException,
196
+ isFalsy: () => isFalsy,
197
+ isField: () => isField,
198
+ isFunc: () => isFunc,
199
+ isFunction: () => isFunction,
200
+ isHttpStatus: () => isHttpStatus,
201
+ isIBAN: () => isIBAN,
202
+ isIn: () => isIn,
203
+ isInstance: () => isInstance,
204
+ isIntersecting: () => isIntersecting,
205
+ isIsoDateString: () => isIsoDateString,
206
+ isJson: () => isJson,
207
+ isList: () => isList,
208
+ isLoading: () => isLoading,
209
+ isMapping: () => isMapping,
210
+ isMoney: () => isMoney,
211
+ isNotEmpty: () => isNotEmpty,
212
+ isNotPresent: () => isNotPresent,
213
+ isNullish: () => isNullish,
214
+ isNumber: () => isNumber,
215
+ isObject: () => isObject,
216
+ isOriginatedError: () => isOriginatedError,
217
+ isPageList: () => isPageList,
218
+ isPresent: () => isPresent,
219
+ isPrimitive: () => isPrimitive,
220
+ isRequestOptions: () => isRequestOptions,
221
+ isResponse: () => isResponse,
222
+ isRestResult: () => isRestResult,
223
+ isResult: () => isResult,
224
+ isResults: () => isResults,
225
+ isSimpleView: () => isSimpleView,
226
+ isSortCondition: () => isSortCondition,
227
+ isString: () => isString,
228
+ isStruct: () => isStruct,
229
+ isText: () => isText,
230
+ isTrue: () => isTrue,
231
+ isTruthy: () => isTruthy,
232
+ isUndefined: () => isUndefined,
233
+ isUrl: () => isUrl,
234
+ isUuid: () => isUuid,
235
+ isValid: () => isValid,
236
+ isValidatable: () => isValidatable,
237
+ isValue: () => isValue,
238
+ json: () => json,
239
+ kebab: () => kebab,
240
+ log: () => log,
241
+ lt: () => lt,
242
+ lte: () => lte,
243
+ mappings: () => mappings,
244
+ maxLength: () => maxLength,
245
+ maxValue: () => maxValue,
246
+ meta: () => meta,
247
+ minLength: () => minLength,
248
+ minValue: () => minValue,
249
+ money: () => money,
250
+ name: () => name,
251
+ notEmpty: () => notEmpty,
252
+ ofConstruct: () => ofConstruct,
253
+ ofGet: () => ofGet,
254
+ ofMessage: () => ofMessage,
255
+ ofProperty: () => ofProperty,
256
+ on: () => on,
257
+ optional: () => optional2,
258
+ past: () => past,
259
+ patch: () => patch,
260
+ post: () => post,
261
+ postalCode: () => postalCode,
262
+ put: () => put,
263
+ quote: () => quote,
264
+ reject: () => reject,
265
+ replaceAll: () => replaceAll,
266
+ required: () => required,
267
+ requires: () => requires,
268
+ resolve: () => resolve,
269
+ rest: () => rest,
270
+ route: () => route,
271
+ routes: () => routes,
272
+ rule: () => rule,
273
+ search: () => search,
274
+ searchable: () => searchable,
275
+ singleton: () => singleton,
276
+ stream: () => stream,
277
+ tag: () => tag,
278
+ template: () => template,
279
+ text: () => text,
280
+ toArray: () => toArray,
281
+ toCacheOptions: () => toCacheOptions,
282
+ toClause: () => toClause,
283
+ toCondition: () => toCondition,
284
+ toFilter: () => toFilter,
285
+ toHttpStatus: () => toHttpStatus,
286
+ toId: () => toId,
287
+ toJson: () => toJson,
288
+ toList: () => toList,
289
+ toName: () => toName,
290
+ toObject: () => toObject,
291
+ toOriginatedError: () => toOriginatedError,
292
+ toPageList: () => toPageList,
293
+ toPageOptions: () => toPageOptions,
294
+ toReq: () => toReq,
295
+ toResponse: () => toResponse,
296
+ toResult: () => toResult,
297
+ toResults: () => toResults,
298
+ toSegment: () => toSegment,
299
+ toShortFilter: () => toShortFilter,
300
+ toSlug: () => toSlug,
301
+ toUuid: () => toUuid,
302
+ toVerbOptions: () => toVerbOptions,
303
+ toViewer: () => toViewer,
304
+ toWords: () => toWords,
305
+ traverse: () => traverse,
306
+ tryTo: () => tryTo,
307
+ tuple: () => tuple,
308
+ tuple2: () => tuple2,
309
+ tuple3: () => tuple3,
310
+ tuple4: () => tuple4,
311
+ tuple5: () => tuple5,
312
+ uri: () => uri,
313
+ url: () => url,
314
+ use: () => use,
315
+ valid: () => valid,
316
+ validate: () => validate,
317
+ validateReject: () => validateReject,
318
+ view: () => view,
319
+ views: () => views,
320
+ wait: () => wait,
321
+ we: () => we,
322
+ weight: () => weight,
323
+ when: () => when
324
+ });
17
325
  module.exports = __toCommonJS(src_exports);
18
- __reExport(src_exports, require("./data"), module.exports);
19
- __reExport(src_exports, require("./domain"), module.exports);
20
- __reExport(src_exports, require("./http"), module.exports);
21
- __reExport(src_exports, require("./health"), module.exports);
22
- __reExport(src_exports, require("./process"), module.exports);
23
- __reExport(src_exports, require("./resources"), module.exports);
24
- __reExport(src_exports, require("./services"), module.exports);
25
- __reExport(src_exports, require("./security"), module.exports);
26
- __reExport(src_exports, require("./sql"), module.exports);
27
- __reExport(src_exports, require("./types"), module.exports);
28
- __reExport(src_exports, require("./utils"), module.exports);
29
- __reExport(src_exports, require("./validation"), module.exports);
326
+
327
+ // src/types/Is.ts
328
+ var isDefined = (o) => o !== void 0 && o !== null;
329
+ var isUndefined = (v) => v === void 0 || v === null;
330
+ var isEmpty = (o) => o === "" || o === null || o === void 0 || isArray(o) && o.length === 0;
331
+ var isNotEmpty = (o) => o !== "" && o !== null && o !== void 0 && (!isArray(o) || o.length > 0);
332
+ var isString = (o) => o instanceof String || typeof o === "string";
333
+ var isIsoDateString = (o) => isString(o) && /^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)$/.test(o);
334
+ var isBoolean = (o) => isDefined(o) && typeof o === "boolean";
335
+ var isTrue = (o) => isFunction(o) ? isTrue(o()) : isBoolean(o) ? o : !!o;
336
+ var isNumber = (o) => isDefined(o) && typeof o === "number" && !Number.isNaN(o);
337
+ var isObject = (o) => o != null && typeof o === "object" && !isArray(o);
338
+ var isEmptyObject = (o) => isObject(o) && Object.getOwnPropertyNames(o).length === 0;
339
+ var isFunction = (o) => isDefined(o) && typeof o === "function";
340
+ var isArray = (o) => isDefined(o) && o instanceof Array;
341
+ var isInstance = (ctor, o) => isFunction(ctor) && o instanceof ctor;
342
+ var isIn = (o, values) => isArray(values) && values.some((v) => v === o);
343
+ var isIntersecting = (o, values) => isArray(o) && isArray(values) && o.some((ov) => isIn(ov, values));
344
+ var isError = (e) => isDefined(e) && e instanceof Error;
345
+ var isNotPresent = (...os) => os.some(
346
+ (o) => o === null || o === void 0 || o === "" || o instanceof Array && o.length === 0 || typeof o === "object" && Object.getOwnPropertyNames(o).length === 0
347
+ );
348
+ var isPresent = (...os) => !isNotPresent(...os);
349
+
350
+ // src/types/Func.ts
351
+ var isFunc = (o) => !!o && typeof o === "function";
352
+
353
+ // src/types/Primitive.ts
354
+ var isPrimitive = (v) => {
355
+ return v === null || v === void 0 || isIn(typeof v, ["string", "number", "bigint", "boolean", "symbol"]);
356
+ };
357
+
358
+ // src/types/Constructor.ts
359
+ var isConstructor = (c) => (isDefined(c) && isFunc(c) && c.prototype && c.prototype.constructor) === c;
360
+ var ofConstruct = (c, ...args) => isConstructor(c) ? new c(...args) : isFunc(c) ? c(...args) : c;
361
+ var toName = (subject, postfix = "") => subject?.constructor?.name?.replace(postfix, "").toLowerCase() ?? "";
362
+ var on = (t, f) => {
363
+ f(t);
364
+ return t;
365
+ };
366
+ var use = (t, f) => f(t);
367
+ var ifA = (c, t, alt) => !isPrimitive(t) && t instanceof c ? t : alt ? ifA(c, alt) : void 0;
368
+
369
+ // src/types/Array.ts
370
+ var toArray = (...items) => items.length > 1 ? items : isArray(items[0]) ? items[0] : isDefined(items[0]) ? [items[0]] : [];
371
+ var toObject = (key, ...items) => toArray(...items).reduce((o, i) => {
372
+ o[i[key]] = i;
373
+ return o;
374
+ }, {});
375
+ var array = {
376
+ merge: (first = [], second = [], firstKey = "id", secondKey = "id") => first.map((f) => ({
377
+ ...f,
378
+ ...second.find((s) => isDefined(s[secondKey]) && isDefined(f[firstKey]) && s[secondKey] === f[firstKey])
379
+ })),
380
+ switch: (items = [], item) => use([...items], (res) => {
381
+ on(res.indexOf(item), (i) => i !== -1 ? res.splice(i, 1) : res.push(item));
382
+ return res;
383
+ }),
384
+ splitIn: (items = [], length = 2) => {
385
+ const res = Array.from({ length }, () => []);
386
+ items.forEach((i, index) => res[index % length].push(i));
387
+ return res;
388
+ }
389
+ };
390
+
391
+ // src/types/Meta.ts
392
+ var import_reflect_metadata = require("reflect-metadata");
393
+
394
+ // src/types/IsA.ts
395
+ var isA = (t, ...properties) => !isPrimitive(t) && properties.every((p) => p.toString() in t);
396
+ var isAn = isA;
397
+
398
+ // src/types/Get.ts
399
+ var ofGet = (g, ...args) => isFunc(g) ? g(...args) : g;
400
+ var ifGet = (pred, valid2, invalid) => ofGet(pred) ? ofGet(valid2) : ofGet(invalid);
401
+ var ofProperty = (t, p) => isFunc(p) ? p(t) : t[p];
402
+
403
+ // src/utils/Base64.ts
404
+ var base64 = {
405
+ decode: (data) => Buffer.from(data, "base64").toString("utf-8"),
406
+ encode: (data) => Buffer.from(data, "utf-8").toString("base64"),
407
+ toJson: (data) => JSON.parse(base64.decode(data))
408
+ };
409
+
410
+ // src/utils/Convert.ts
411
+ var Convert = class {
412
+ constructor(from, to) {
413
+ this.from = from;
414
+ this.to = to;
415
+ }
416
+ };
417
+ var convert = {
418
+ default: new Convert(
419
+ (a) => a,
420
+ (a) => a
421
+ ),
422
+ ignore: new Convert(
423
+ () => void 0,
424
+ () => void 0
425
+ ),
426
+ toBool: {
427
+ fromNumber: new Convert(
428
+ (b) => b ? 1 : 0,
429
+ (n) => n !== 0
430
+ ),
431
+ fromString: new Convert(
432
+ (b) => b ? "true" : "false",
433
+ (s) => s === "true"
434
+ )
435
+ },
436
+ toDate: {
437
+ fromString: new Convert(
438
+ (s) => new Date(s).toISOString(),
439
+ (s) => s
440
+ )
441
+ },
442
+ toNumber: {
443
+ fromString: new Convert(
444
+ (n) => asString(n),
445
+ (s) => parseInt(s)
446
+ )
447
+ }
448
+ };
449
+
450
+ // src/utils/If.ts
451
+ function ifTrue(o, f, alt) {
452
+ return isTrue(o) ? ofConstruct(f, o) : ofConstruct(alt, o);
453
+ }
454
+ function ifFalse(o, f, alt) {
455
+ return !isTrue(o) ? ofConstruct(f, o) : ofConstruct(alt, o);
456
+ }
457
+ function ifDefined(o, f, alt) {
458
+ return isDefined(o) ? ofConstruct(f, o) : ofConstruct(alt);
459
+ }
460
+ function ifNotEmpty(o, f = (o2) => o2, alt) {
461
+ return isNotEmpty(o) ? ofConstruct(f, o) : ofConstruct(alt, o);
462
+ }
463
+
464
+ // src/utils/Loading.ts
465
+ var isLoading = (...targets) => isNotPresent(...targets);
466
+
467
+ // src/utils/Log.ts
468
+ function log(labelOrT, t) {
469
+ if (t) {
470
+ console.log(labelOrT, t);
471
+ return t;
472
+ } else {
473
+ console.log(labelOrT);
474
+ return labelOrT;
475
+ }
476
+ }
477
+ function dir(t) {
478
+ console.dir(t, { depth: 200 });
479
+ return t;
480
+ }
481
+
482
+ // src/utils/Property.ts
483
+ var Property = class {
484
+ constructor(property, options) {
485
+ this.property = property;
486
+ this.options = options;
487
+ this.options = { ...options, convert: options?.convert ?? convert.default };
488
+ }
489
+ in = (source = {}) => this.options?.convert?.to(source[this.property] ?? ofGet(this.options?.dflt));
490
+ out = (source = {}, key = "") => this.options?.convert?.from(source[key]);
491
+ toString() {
492
+ return this.property;
493
+ }
494
+ };
495
+
496
+ // src/utils/State.ts
497
+ var State = class {
498
+ constructor(state = {}) {
499
+ this.state = state;
500
+ }
501
+ get = (key, alt) => this.state[key] ?? (this.state[key] = ofConstruct(alt));
502
+ set = (key, value) => this.get(key, value);
503
+ };
504
+
505
+ // src/utils/Mapper.ts
506
+ var isMapping = (m) => isA(m, "in", "out");
507
+ var Mapper = class extends State {
508
+ constructor(options = { startFrom: "scratch" }, property = "") {
509
+ super();
510
+ this.options = options;
511
+ this.property = property;
512
+ }
513
+ map = mappings;
514
+ // All properties that are a mapping
515
+ get properties() {
516
+ return this.get(
517
+ "props",
518
+ () => meta(this).entries().filter(([, v]) => isMapping(v))
519
+ );
520
+ }
521
+ // All names of properties (in target) that have a Mapping
522
+ get keys() {
523
+ return this.get("keys", () => this.properties.map(([k]) => k));
524
+ }
525
+ // All names of properties (in source) that are named in a Mapping
526
+ get columns() {
527
+ return this.get("columns", () => this.properties.mapDefined(([, p]) => ifNotEmpty(p.property, p.property))).distinct();
528
+ }
529
+ // All names of properties (in source) that are NOT properties in target
530
+ get droppedIn() {
531
+ return this.get("droppedIn", () => this.columns.filter((c) => !this.keys.some((k) => k === c)));
532
+ }
533
+ // All names op properties (in target) that are NOT properties in source
534
+ get droppedOut() {
535
+ return this.get("droppedOut", () => this.properties.filter(([, p]) => !this.keys.some((k) => k === p.property)).map(([k]) => k));
536
+ }
537
+ in(from = {}) {
538
+ return json.omit(
539
+ this.properties.reduce((a, [k, p]) => json.merge(a, { [k]: p.in({ ...a, ...from }) }), this.options.startFrom === "source" ? from : {}),
540
+ ...this.droppedIn
541
+ );
542
+ }
543
+ out(to = {}) {
544
+ return json.omit(
545
+ this.properties.reduce(
546
+ (a, [k, p]) => json.merge(a, isEmpty(p.property) ? p.out(to, k) : { [p.property ?? ""]: p.out({ ...a, ...to }, k) }),
547
+ this.options.startFrom === "source" ? to : {}
548
+ ),
549
+ ...this.droppedOut
550
+ );
551
+ }
552
+ toString() {
553
+ return this.constructor.name;
554
+ }
555
+ };
556
+ var mappings = {
557
+ item: (property, options) => new Property(property, options),
558
+ ignore: (property = "") => ({
559
+ property,
560
+ in: () => void 0,
561
+ out: () => void 0
562
+ }),
563
+ skipIn: (property) => ({
564
+ property,
565
+ in: () => void 0,
566
+ out: (source = {}) => source[property]
567
+ }),
568
+ skipOut: (property) => ({
569
+ property,
570
+ in: (source = {}) => source[property],
571
+ out: () => void 0
572
+ }),
573
+ func: (property, funcIn, funcOut) => ({
574
+ property,
575
+ in: (source = {}) => ofGet(funcIn, source),
576
+ out: (source = {}) => ofGet(funcOut, source)
577
+ }),
578
+ add: (funcIn) => ({
579
+ property: "",
580
+ in: (source = {}) => ofGet(funcIn, source),
581
+ out: () => void 0
582
+ }),
583
+ map: (mapper, property = "") => ({
584
+ property,
585
+ in: (source = {}) => ofConstruct(mapper).in(isEmpty(property) ? source : source[property]),
586
+ out: (source = {}, key = "") => ofConstruct(mapper).out(isEmpty(key) ? source : source[key])
587
+ }),
588
+ propsToList: (...maps) => ({
589
+ property: "",
590
+ in: (source = {}) => toList(maps.map((m) => ofConstruct(m).in(source))).toJSON(),
591
+ out: (source = {}, key = "") => maps.reduce((a, m, i) => {
592
+ const res = toList(source[key])[i];
593
+ const out = m.out(res);
594
+ return { ...a, [m.property]: out ?? {} };
595
+ }, {})
596
+ }),
597
+ list: (mapper, property) => ({
598
+ property,
599
+ in: (source = {}) => toList(source[property]).map((v) => mapper.in(v)).toJSON(),
600
+ out: (source = {}, key = "") => toList(isEmpty(key) ? source : source[key]).map((v) => mapper.out(v)).toJSON()
601
+ })
602
+ };
603
+
604
+ // src/utils/Promise.ts
605
+ var resolve = (subject) => Promise.resolve(subject);
606
+ var reject = (e) => Promise.reject(e);
607
+ var tuple = {
608
+ 2: (first, second) => Promise.all([first, second]),
609
+ 3: (first, second, third) => Promise.all([first, second, third]),
610
+ 4: (first, second, third, forth) => Promise.all([first, second, third, forth]),
611
+ 5: (first, second, third, forth, fifth) => Promise.all([first, second, third, forth, fifth]),
612
+ all: (first, second) => Promise.all([first, Promise.all(second)]),
613
+ spread: (first, ...second) => Promise.all([first, Promise.all(toArray(second))]),
614
+ list: (list) => Promise.all([...list]).then(toList)
615
+ };
616
+ var tuple2 = tuple[2];
617
+ var tuple3 = tuple[3];
618
+ var tuple4 = tuple[4];
619
+ var tuple5 = tuple[5];
620
+
621
+ // src/utils/Sentence.ts
622
+ var Sentence = class {
623
+ constructor(word, pre, sentence = (pre?.sentence ?? []).concat(word)) {
624
+ this.sentence = sentence;
625
+ }
626
+ toString() {
627
+ return text(this.sentence.join(" ")).sentence.toString();
628
+ }
629
+ };
630
+ var Topic = class extends Sentence {
631
+ it = new Sentence("it", this);
632
+ anything = new Sentence("anything", this);
633
+ id = (id) => new Sentence(`id '${id}'`, this);
634
+ your = (subject) => new Sentence(`your ${subject ?? "item"}`, this);
635
+ a = (subject) => new Sentence(subject ? `a ${subject}` : "an item", this);
636
+ an = (subject) => new Sentence(`an ${subject ?? "item"}`, this);
637
+ any = (subjects) => new Sentence(`any ${subjects ?? "items"}`, this);
638
+ };
639
+ var Verb = class extends Sentence {
640
+ add = new Topic("add", this);
641
+ check = new Topic("check", this);
642
+ fetch = new Topic("fetch", this);
643
+ find = new Topic("find", this);
644
+ like = new Topic("like", this);
645
+ process = new Topic("process", this);
646
+ remove = new Topic("remove", this);
647
+ translate = new Topic("translate", this);
648
+ update = new Topic("update", this);
649
+ validate = new Topic("validate", this);
650
+ };
651
+ var Not = class extends Verb {
652
+ };
653
+ var SupportVerb = class extends Verb {
654
+ not = new Not("not", this);
655
+ };
656
+ var We = class extends Sentence {
657
+ could = new SupportVerb("could", this);
658
+ did = new SupportVerb("did", this);
659
+ added = new Topic("added", this);
660
+ checked = new Topic("checked", this);
661
+ fetched = new Topic("fetched", this);
662
+ found = new Topic("found", this);
663
+ liked = new Topic("liked", this);
664
+ processed = new Topic("processed", this);
665
+ removed = new Topic("removed", this);
666
+ translated = new Topic("translated", this);
667
+ updated = new Topic("updated", this);
668
+ validated = new Topic("validated", this);
669
+ };
670
+ var we = new We("we");
671
+
672
+ // src/utils/Traverse.ts
673
+ var traverse = (subject = {}, property = "") => {
674
+ const props = property.split(".");
675
+ const p = props.shift();
676
+ return props.length === 0 ? subject[p] : traverse(subject[p], props.join("."));
677
+ };
678
+
679
+ // src/utils/View.ts
680
+ var ignore = Symbol("view.ignore");
681
+ var keep = Symbol("view.keep");
682
+ var toViewer = (key, value) => choose(value).is.not.defined((v) => v, { key, f: () => void 0 }).type(isBoolean, (b) => ({ key, f: () => b })).equals(ignore, { key, f: () => void 0 }).equals(keep, { key, f: (a) => traverse(a, key) }).type(isString, (s) => ({ key, f: (a) => traverse(a, s) })).type(isConstructor, (c) => ({
683
+ key,
684
+ f: (a, key2) => use(traverse(a, key2), (v) => isArray(v) ? v.map((i) => optional(c, i)) : optional(c, v))
685
+ })).type(isSimpleView, (f) => ({ key, f: (a) => f.from(traverse(a, key)) })).type(isFunction, (f) => ({ key, f })).else((v) => ({ key, f: () => v }));
686
+ var optional = (c, v) => ifDefined(
687
+ v,
688
+ (i) => new c(i),
689
+ () => v
690
+ );
691
+ var toViewers = (views2) => meta(views2).entries().map(([k, v]) => toViewer(k, v));
692
+ var View = class _View {
693
+ constructor(views2 = {}, startsFrom = "scratch", viewers = toViewers(views2)) {
694
+ this.views = views2;
695
+ this.startsFrom = startsFrom;
696
+ this.viewers = viewers;
697
+ }
698
+ get fromSource() {
699
+ return new _View(this.views, "source", this.viewers);
700
+ }
701
+ from(source) {
702
+ if (isPageList(source))
703
+ return toPageList(
704
+ source.map((s) => this.reduce(s)),
705
+ source
706
+ );
707
+ if (isArray(source))
708
+ return source.map((s) => this.reduce(s));
709
+ return this.reduce(source);
710
+ }
711
+ same = (one, another) => isEqual(this.from(one), this.from(another));
712
+ reduce = (source) => use(asJson(source), (src) => this.viewers.reduce((acc, v) => json.set(acc, v.key, v.f(src, v.key)), this.startsFrom === "scratch" ? {} : src));
713
+ };
714
+ var isSimpleView = (a) => a instanceof View;
715
+ var view = (views2) => new View(views2);
716
+ var views = {
717
+ ignore,
718
+ keep,
719
+ skip: ignore,
720
+ value: (value) => () => value,
721
+ or: {
722
+ key: (altKey) => (a, key) => traverse(a, key) ?? traverse(a, altKey),
723
+ value: (altValue) => (a, key) => traverse(a, key) ?? altValue,
724
+ func: (altFunc) => (a, key) => traverse(a, key) ?? altFunc(a, key)
725
+ }
726
+ };
727
+
728
+ // src/utils/Wait.ts
729
+ var Wait = class {
730
+ static wait(ms = 0) {
731
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
732
+ }
733
+ static seconds(s = 0) {
734
+ return this.wait(s * 1e3);
735
+ }
736
+ };
737
+ var wait = (millis) => Wait.wait(millis);
738
+
739
+ // src/types/Json.ts
740
+ var isJson = (subject) => isA(subject, "toJSON");
741
+ var json = {
742
+ parse: (subject) => JSON.parse(JSON.stringify(subject ?? {})),
743
+ merge: (...subjects) => json.parse(subjects.map((s) => asJson(s, (s2) => json.parse(s2))).reduce((js, j) => ({ ...js, ...j }), {})),
744
+ delete: (subject, key) => {
745
+ ifDefined(subject, () => delete subject[key]);
746
+ return subject;
747
+ },
748
+ set: (subject, key = "", value) => isEmpty(key) ? subject : value !== void 0 ? { ...subject, ...{ [key]: value } } : json.delete(subject, key),
749
+ omit: (subject, ...keys) => keys.reduce((js, k) => json.delete(js, k), json.parse(subject)),
750
+ defaults: (options = {}, defaults = {}) => json.merge(defaults, options)
751
+ };
752
+ var toJson = json.merge;
753
+ var asJson = (j, alt = {}) => isJson(j) ? j.toJSON() : isObject(j) ? j : ofGet(alt, j);
754
+ var Any = class {
755
+ constructor(value) {
756
+ this.value = value;
757
+ }
758
+ merge = (...subjects) => any(json.merge(this.value, ...subjects));
759
+ delete = (key) => any(json.delete(this.value, key));
760
+ omit = (...keys) => any(json.omit(this.value, ...keys));
761
+ set = (key, value) => any(json.set(this.value, key, value));
762
+ toJSON() {
763
+ return this.value;
764
+ }
765
+ };
766
+ var any = (value) => new Any(value);
767
+
768
+ // src/validation/When.ts
769
+ var When = class _When {
770
+ constructor(subject, valid2 = true, results) {
771
+ this.subject = subject;
772
+ this.valid = valid2;
773
+ this.results = results;
774
+ }
775
+ get not() {
776
+ return this.clone(!this.valid);
777
+ }
778
+ get and() {
779
+ return this.clone(this.valid);
780
+ }
781
+ get isDefined() {
782
+ return this.clone(this.valid === isDefined(this.subject));
783
+ }
784
+ get isEmpty() {
785
+ return this.clone(this.valid === isEmpty(this.subject));
786
+ }
787
+ get isTrue() {
788
+ return this.clone(this.valid === !!this.subject);
789
+ }
790
+ get isValid() {
791
+ this.results = validate(this.subject);
792
+ return this.clone(this.valid === this.results.isValid);
793
+ }
794
+ isInstance = (c) => this.clone(this.valid === this.subject instanceof c);
795
+ with = (pred) => this.clone(this.valid === ofGet(pred, this.subject));
796
+ contains = (property) => this.clone(this.valid === isDefined(ofGet(property, this.subject)));
797
+ in = (...items) => this.clone(this.valid === isIn(this.subject, toArray(...items)));
798
+ is = (item) => this.clone(this.valid === (this.subject === item));
799
+ reject = (error) => !this.valid ? resolve(this.subject) : reject(ofGet(error, this.subject) ?? this.results ?? Exception.Unknown);
800
+ recover = (f) => resolve(!this.valid ? this.subject : f(this.subject));
801
+ clone = (result = true) => new _When(this.subject, result, this.results);
802
+ };
803
+ var when = (subject) => new When(subject);
804
+
805
+ // src/validation/Validate.ts
806
+ var asResults = (subject, template2, options = {}) => toResults(toResult(text(template2).parse(subject, options), toName(subject)));
807
+ var validators = (subject) => meta(subject).keys("constraint").reduce((list, vs) => list.add(vs), toList());
808
+ var runValidator = (v, subject) => tryTo(() => isFunction(subject[v.property]) ? subject[v.property]() : subject[v.property]).map((actual) => [actual, v.constraint(actual)]).map(([actual, res]) => isResults(res) ? res : !res ? asResults(subject, v.text, { ...v, actual }) : toResults()).recover((e) => asResults(subject, asString(e))).value;
809
+ var constraints = (subject) => tryTo(() => validators(subject)).map((vs) => vs.mapDefined((v) => runValidator(v, subject))).map((res) => res.reduce((rs, r) => rs.add(...r.results), toResults())).value;
810
+ var validate = (subject) => choose(subject).is.not.defined(
811
+ (s) => s,
812
+ () => toResults("Subject is not defined.")
813
+ ).type(isEnum, (e) => e.isValid ? toResults() : asResults(e, "This is not a valid {type}.")).type(isValue, (v) => v.isValid ? toResults() : asResults(v, "This is not a valid {type}.")).type(isArray, (a) => a.map((i) => validate(i)).reduce((rs, r) => rs.add(...r.results), toResults())).type(isValidatable, (v) => constraints(v)).else(toResults());
814
+ var validateReject = (subject) => when(subject).not.isValid.reject();
815
+ var isValid = (t) => validate(t).isValid;
816
+
817
+ // src/validation/Contraints.ts
818
+ var constraint = (c, message) => (subject, property) => {
819
+ const cs = meta(subject).property(property).get("constraint") ?? toList();
820
+ meta(subject).property(property).set("constraint", cs.add({ property, constraint: c, text: message }));
821
+ };
822
+ var defined = (message) => constraint((v) => isDefined(v), message ?? "Property {property} must be defined.");
823
+ var required = (message) => constraint((v) => isNotEmpty(v), message ?? "Property {property} is required, and may not be empty.");
824
+ var notEmpty = (message) => constraint((v) => isNotEmpty(v), message ?? "Property {property} may not be empty.");
825
+ var valid = () => constraint((v) => validate(v), "");
826
+ var optional2 = () => constraint((v) => !isDefined(v) || validate(v), "");
827
+ var includes = (sub, message) => constraint((s) => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);
828
+ var inList = (values, message) => constraint((v) => isDefined(v) && isIn(v, values), message ?? "Value {actual} must appear in list.");
829
+ var inOptionalList = (values, message) => constraint((v) => !isDefined(v) || isIn(v, values), message ?? "Value {actual} must appear in list.");
830
+ var gt = (limit, message) => constraint((v) => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);
831
+ var gte = (limit, message) => constraint((v) => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);
832
+ var lt = (limit, message) => constraint((v) => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);
833
+ var lte = (limit, message) => constraint((v) => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);
834
+ var past = (message) => constraint((v) => inPast(v), message ?? "Value {actual} must lay in the past.");
835
+ var future = (message) => constraint((v) => inFuture(v), message ?? "Value {actual} must lay in the future.");
836
+ var minLength = (length, message) => constraint(
837
+ (v) => tryTo(() => v).is.defined().map((v2) => text(v2).toString().length >= length).orElse(true),
838
+ message ?? `Value {actual} must be at least '${length}' characters long.`
839
+ );
840
+ var maxLength = (length, message) => constraint(
841
+ (v) => tryTo(() => v).is.defined().map((v2) => text(v2).toString().length <= length).orElse(true),
842
+ message ?? `Value {actual} cannot be longer than '${length}' characters.`
843
+ );
844
+ var rule = (message) => constraint((v) => isFunction(v) ? v() : isBoolean(v) ? v : false, message ?? `Value {actual} must be true`);
845
+
846
+ // src/types/Try.ts
847
+ var Try = class _Try {
848
+ is = {
849
+ defined: (prop) => this.filter((v) => isDefined(prop ? prop(v) : v)),
850
+ empty: (prop) => this.filter((v) => isEmpty(prop ? prop(v) : v)),
851
+ valid: (prop) => this.filter((v) => validate(prop ? prop(v) : v).isValid),
852
+ true: (prop) => this.filter((v) => isTrue(prop ? prop(v) : v)),
853
+ false: (prop) => this.filter((v) => !isTrue(prop ? prop(v) : v)),
854
+ not: {
855
+ defined: (prop) => this.filter((v) => !isDefined(prop ? prop(v) : v)),
856
+ empty: (prop) => this.filter((v) => !isEmpty(prop ? prop(v) : v)),
857
+ valid: (prop) => this.filter((v) => !validate(prop ? prop(v) : v).isValid)
858
+ }
859
+ };
860
+ if = this.is;
861
+ static of = (c, ...args) => {
862
+ try {
863
+ const out = ofGet(c, ...args);
864
+ return new Success(out instanceof _Try ? out.value : out);
865
+ } catch (e) {
866
+ return new Failure(e);
867
+ }
868
+ };
869
+ };
870
+ var Success = class extends Try {
871
+ constructor(value) {
872
+ super();
873
+ this.value = value;
874
+ }
875
+ get error() {
876
+ throw new Error("No error found");
877
+ }
878
+ get isValid() {
879
+ return true;
880
+ }
881
+ map(f) {
882
+ return tryTo(f, this.value);
883
+ }
884
+ recover(f) {
885
+ return this;
886
+ }
887
+ recoverFrom(type, f) {
888
+ return this;
889
+ }
890
+ accept(f) {
891
+ return tryTo(() => {
892
+ f(this.value);
893
+ return this;
894
+ });
895
+ }
896
+ filter(predicate) {
897
+ return tryTo(() => {
898
+ if (predicate(this.value))
899
+ return this;
900
+ throw new Error(`Applying filter(${predicate.toString()}) failed.`);
901
+ });
902
+ }
903
+ or(value) {
904
+ return this.value;
905
+ }
906
+ orElse(value) {
907
+ return this.value;
908
+ }
909
+ orThrow(_error) {
910
+ return this.value;
911
+ }
912
+ };
913
+ var Failure = class _Failure extends Try {
914
+ constructor(error) {
915
+ super();
916
+ this.error = error;
917
+ }
918
+ get value() {
919
+ throw this.error;
920
+ }
921
+ get isValid() {
922
+ return false;
923
+ }
924
+ map(f) {
925
+ return new _Failure(this.error);
926
+ }
927
+ recover(f) {
928
+ return tryTo(f, this.error);
929
+ }
930
+ recoverFrom(type, f) {
931
+ return tryTo(() => this.error instanceof type ? this.recover(f) : this);
932
+ }
933
+ accept(f) {
934
+ return this;
935
+ }
936
+ filter(predicate) {
937
+ return this;
938
+ }
939
+ or(value) {
940
+ return ofGet(value);
941
+ }
942
+ orElse(value) {
943
+ return ofGet(value);
944
+ }
945
+ orThrow(error) {
946
+ throw ofConstruct(error);
947
+ }
948
+ };
949
+ var tryTo = (c, ...args) => Try.of(c, ...args);
950
+
951
+ // src/types/List.ts
952
+ var List6 = class extends Array {
953
+ asc(p) {
954
+ return this.sort((e1, e2) => ofProperty(e1, p) > ofProperty(e2, p) ? 1 : -1);
955
+ }
956
+ desc(p) {
957
+ return this.sort((e1, e2) => ofProperty(e1, p) < ofProperty(e2, p) ? 1 : -1);
958
+ }
959
+ first(p, params) {
960
+ return p ? this.find(p, params) : this[0];
961
+ }
962
+ firstValue(f, alt) {
963
+ return tryTo(() => this.first((t) => !!f(t))).map((i) => i ? f(i) : ofGet(alt, i)).value;
964
+ }
965
+ isFirst(value) {
966
+ return value === this.first();
967
+ }
968
+ next(p, params) {
969
+ return p ? this[this.findIndex(p, params) + 1] : this[0];
970
+ }
971
+ prev(p, params) {
972
+ return p ? this[this.findIndex(p, params) - 1] : this[0];
973
+ }
974
+ last(p, params) {
975
+ return p ? this.filter(p, params).last() : this[this.length - 1];
976
+ }
977
+ isLast(value) {
978
+ return value === this.last();
979
+ }
980
+ overlaps(...items) {
981
+ return toList(...items).some((i) => this.some((t) => i === t));
982
+ }
983
+ diff(others) {
984
+ return this.filter((i) => !others.includes(i));
985
+ }
986
+ diffByKey(others, key) {
987
+ return this.filter((i) => !others.some((o) => o[key] === i[key]));
988
+ }
989
+ symmetricDiff(others) {
990
+ return this.diff(others).concat(toList(...others).diff(this));
991
+ }
992
+ symmetricDiffByKey(others, key) {
993
+ return this.diffByKey(others, key).concat(toList(...others).diffByKey(this, key));
994
+ }
995
+ intersect(others) {
996
+ return this.filter((i) => others.includes(i));
997
+ }
998
+ intersectByKey(others, key) {
999
+ return this.filter((i) => others.some((o) => o[key] === i[key]));
1000
+ }
1001
+ toJSON() {
1002
+ return this.reduce((a, i) => {
1003
+ a.push(json.parse(i));
1004
+ return a;
1005
+ }, new Array());
1006
+ }
1007
+ map(f, params) {
1008
+ return toList(super.map(f, params));
1009
+ }
1010
+ flatMap(f, params) {
1011
+ return toList(super.flatMap(f, params));
1012
+ }
1013
+ mapDefined(f, params) {
1014
+ return this.map(f, params).defined();
1015
+ }
1016
+ mapAsync(f) {
1017
+ return Promise.all(super.map((e) => f(e))).then((a) => toList(a));
1018
+ }
1019
+ distinct() {
1020
+ return this.filter((i, index) => this.indexOf(i) === index);
1021
+ }
1022
+ distinctByKey(key) {
1023
+ return meta(this.toObject(key)).values();
1024
+ }
1025
+ filter(p, params) {
1026
+ return toList(super.filter(p, params));
1027
+ }
1028
+ sum(p) {
1029
+ return this.reduce((sum, i) => sum + p(i), 0);
1030
+ }
1031
+ max(key) {
1032
+ return this.desc(key).first();
1033
+ }
1034
+ min(key) {
1035
+ return this.asc(key).first();
1036
+ }
1037
+ byId(id) {
1038
+ return this.first((i) => asString(i.id) === asString(id));
1039
+ }
1040
+ add(...items) {
1041
+ super.push(...toArray(...items));
1042
+ return this;
1043
+ }
1044
+ concat(...items) {
1045
+ return toList(super.concat(...items));
1046
+ }
1047
+ reverse() {
1048
+ return toList(super.reverse());
1049
+ }
1050
+ splice(start, deleteCount, ...items) {
1051
+ return toList(super.splice(start, deleteCount, ...items));
1052
+ }
1053
+ remove(item) {
1054
+ const index = this.indexOf(item);
1055
+ if (index > -1) {
1056
+ this.splice(index, 1);
1057
+ }
1058
+ return this;
1059
+ }
1060
+ replace(key, item) {
1061
+ tryTo(() => item[key]).map((k) => this.findIndex((i) => i[key] === k)).filter((i) => i > -1).map((i) => this[i] = item);
1062
+ return this;
1063
+ }
1064
+ switch(item) {
1065
+ return this.includes(item) ? this.remove(item) : this.add(item);
1066
+ }
1067
+ defined() {
1068
+ return this.reduce((l, v) => isDefined(v) ? l.add(v) : l, toList());
1069
+ }
1070
+ toObject(key, options = {}) {
1071
+ return this.reduce((o, i) => {
1072
+ o[i[key]] = i;
1073
+ if (options.deleteKey)
1074
+ delete o[i[key]][key];
1075
+ return o;
1076
+ }, {});
1077
+ }
1078
+ toObjectList(key) {
1079
+ return this.reduce(
1080
+ (a, t) => {
1081
+ const k = t[key];
1082
+ a[k] = a[k] ?? toList();
1083
+ a[k].push(t);
1084
+ return a;
1085
+ },
1086
+ {}
1087
+ );
1088
+ }
1089
+ orElse(...alt) {
1090
+ return !isEmpty(this) ? this : !isEmpty(...alt) ? toList(...alt) : void 0;
1091
+ }
1092
+ weave(insertFrom, interval) {
1093
+ for (let i = interval, n = 0; i <= this.length && n < insertFrom.length; i += interval + 1) {
1094
+ this.splice(i, 0, insertFrom[n++]);
1095
+ }
1096
+ return this;
1097
+ }
1098
+ slice(start, end) {
1099
+ return toList(super.slice(start, end));
1100
+ }
1101
+ none(p) {
1102
+ return !this.some(p);
1103
+ }
1104
+ chunk(chunkSize) {
1105
+ return this.reduce((acc, _, index) => index % chunkSize === 0 ? on(acc, (a) => a.push(this.slice(index, index + chunkSize))) : acc, toList());
1106
+ }
1107
+ };
1108
+ var toList = (...items) => new List6().add(...items);
1109
+ var isList = (l) => isDefined(l) && isArray(l) && isA(l, "first", "last", "asc", "desc");
1110
+ var asList = (c, items = []) => toList(toArray(items).map((i) => new c(i)));
1111
+ var maxValue = (l, key) => l.desc(key).first()?.[key];
1112
+ var minValue = (l, key) => l.asc(key).first()?.[key];
1113
+
1114
+ // src/types/Meta.ts
1115
+ var ClassMeta = class {
1116
+ constructor(subject, data = (subject.prototype ?? subject).constructor) {
1117
+ this.subject = subject;
1118
+ this.data = data;
1119
+ }
1120
+ get = (key) => Reflect.getMetadata(key, this.data);
1121
+ set = (key, value) => {
1122
+ Reflect.defineMetadata(key, value, this.data);
1123
+ return value;
1124
+ };
1125
+ entries = () => toList([...Object.entries(this.subject), ...Object.entries(Object.getPrototypeOf(this.subject))]);
1126
+ parse = (f, options = {}) => {
1127
+ const { initial = {}, skipUndefined = false } = options;
1128
+ return this.entries().reduce((a, [k, val]) => use(f(val), (v) => isDefined(v) || !skipUndefined ? on(a, (a2) => a2[k] = v) : a), initial);
1129
+ };
1130
+ properties = (key) => toList([...Object.getOwnPropertyNames(this.subject), ...Object.getOwnPropertyNames(Object.getPrototypeOf(this.subject))]).map((p) => this.property(p)).filter((p) => key ? p.get(key) : p);
1131
+ keys = (key) => this.properties().map((p) => p.get(key)).reduce((list, u) => u ? list.add(u) : list, toList());
1132
+ values = () => toList([...Object.values(this.subject), ...Object.values(Object.getPrototypeOf(this.subject))]);
1133
+ property = (property) => new PropertyMeta(this.subject, property);
1134
+ };
1135
+ var PropertyMeta = class {
1136
+ constructor(subject, property, data = Reflect.getMetadata(property, subject)) {
1137
+ this.subject = subject;
1138
+ this.property = property;
1139
+ this.data = data;
1140
+ }
1141
+ get value() {
1142
+ return this.subject[this.property];
1143
+ }
1144
+ get = (key) => isDefined(this.data) && isDefined(this.data[key]) ? this.data[key] : void 0;
1145
+ set = (key, value) => {
1146
+ Reflect.defineMetadata(this.property, { ...this.data, [key]: value }, this.subject);
1147
+ return value;
1148
+ };
1149
+ };
1150
+ var meta = (subject) => new ClassMeta(subject ?? {});
1151
+ var entries = (subject) => meta(subject).entries();
1152
+
1153
+ // src/types/Template.ts
1154
+ var Template = class {
1155
+ constructor(template2, subject = {}, options = {}) {
1156
+ this.template = template2;
1157
+ this.subject = subject;
1158
+ this.options = options;
1159
+ }
1160
+ toString = () => {
1161
+ return meta(this.options).entries().reduce((t, [k]) => this.option(t, k), this.object()).replace(" ", " ");
1162
+ };
1163
+ value = (subject, prop) => tryTo(() => prop.split(".")).map((p) => [p, p.splice(1)]).map(([p, ps]) => ps.reduce((t, s) => t[s], text(subject[p[0]]))).map((p) => p.toString()).value;
1164
+ props = (tmpl, key, result = toList()) => {
1165
+ const i1 = tmpl.indexOf(`{${key}`);
1166
+ if (i1 < 0) {
1167
+ return result;
1168
+ }
1169
+ const i2 = tmpl.indexOf("}", i1);
1170
+ return this.props(tmpl.slice(i2 + 1), key, result.add(tmpl.substring(i1 + 1, i2)));
1171
+ };
1172
+ object = () => {
1173
+ return this.props(this.template, "this").reduce((t, p) => t.replace(`{${p}}`, this.value(this.subject, p.replace("this.", ""))), this.template);
1174
+ };
1175
+ option = (tmpl, prop) => {
1176
+ return this.props(tmpl, prop).reduce((t, p) => t.replace(`{${p}}`, this.value(this.options, p)), tmpl);
1177
+ };
1178
+ };
1179
+ var template = (tmpl, subject, options = {}) => new Template(asString(tmpl), subject, {
1180
+ type: toName(subject),
1181
+ subject: text(JSON.stringify(subject)),
1182
+ ...options
1183
+ });
1184
+
1185
+ // src/types/Text.ts
1186
+ var isText = (t) => isDefined(t) && isFunc(t.toString);
1187
+ var asString = (t, alt = "") => (isText(t) ? t : ofGet(alt)).toString();
1188
+ var replaceAll = (origin, search2, replace = "") => asString(origin).split(asString(search2)).join(asString(replace));
1189
+ var toWords = (input) => {
1190
+ return asString(input).replace(/(\p{Lower})(\p{Upper})/gu, "$1 $2").replace(/(\p{Upper})(\p{Upper}\p{Lower})/gu, "$1 $2").split(/[_\W]+/g).filter(Boolean);
1191
+ };
1192
+ var kebab = (s = "") => toWords(s).join("-").toLowerCase();
1193
+ var ToText2 = class {
1194
+ constructor(subject) {
1195
+ this.subject = subject;
1196
+ }
1197
+ get cap() {
1198
+ return this.map((s) => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase());
1199
+ }
1200
+ get title() {
1201
+ return this.map(
1202
+ (s) => s.split(" ").map((w) => text(w).cap).join(" ")
1203
+ );
1204
+ }
1205
+ get pascal() {
1206
+ return this.title.replace(" ", "");
1207
+ }
1208
+ get lower() {
1209
+ return this.map((s) => s.toLowerCase());
1210
+ }
1211
+ get upper() {
1212
+ return this.map((s) => s.toUpperCase());
1213
+ }
1214
+ get camel() {
1215
+ return this.title.trim.map((s) => `${s.charAt(0).toLowerCase()}${s.slice(1)}`);
1216
+ }
1217
+ get kebab() {
1218
+ return this.lower.replace(" ", "-");
1219
+ }
1220
+ get strictKebab() {
1221
+ return this.map((s) => s.replace(/[^a-z\d]+/gi, " ").trim()).kebab;
1222
+ }
1223
+ get slug() {
1224
+ return this.map(
1225
+ (s) => s.replace(/ß/g, "ss").normalize("NFKD").replace(/[\u0300-\u036F]/g, "").toLowerCase().replace(/[^a-z\d]+/g, "-").replace(/(^-)|(-$)/g, "")
1226
+ );
1227
+ }
1228
+ get snake() {
1229
+ return this.upper.replace(" ", "_");
1230
+ }
1231
+ get plural() {
1232
+ return this.ifLike("") ?? this.add("s");
1233
+ }
1234
+ get space() {
1235
+ return this.map((s) => s.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]/g, " "));
1236
+ }
1237
+ get sentence() {
1238
+ return this.isEmpty ? this : this.map((s) => `${s.charAt(0).toUpperCase()}${s.slice(1)}.`);
1239
+ }
1240
+ get initials() {
1241
+ return this.map(
1242
+ (s) => s.split(" ").map((w) => w[0]).join("")
1243
+ );
1244
+ }
1245
+ get trim() {
1246
+ return this.map((s) => s.replace(/[- ,_#]/g, ""));
1247
+ }
1248
+ get isEmpty() {
1249
+ return isEmpty(this.toString());
1250
+ }
1251
+ parse = (subject, options = {}) => text(template(this.subject, subject, { type: toName(subject), ...options }));
1252
+ is = (...others) => others.some((o) => this.toString() === text(o).toString());
1253
+ equals = this.is;
1254
+ isLike = (...others) => others.some((o) => this.trim.lower.is(text(o).trim.lower));
1255
+ ifLike = (...others) => this.isLike(...others) ? this : void 0;
1256
+ endsWith = (end) => this.subject.endsWith(asString(end));
1257
+ startsWith = (end) => this.subject.startsWith(asString(end));
1258
+ first = (n) => this.map((s) => s.substring(0, n));
1259
+ last = (n) => this.map((s) => s.substring(s.length - n));
1260
+ map = (func) => text(ofGet(func, this.subject));
1261
+ replace = (search2, replace) => this.map((s) => replaceAll(s, search2, replace));
1262
+ add = (add, separator = "") => this.map((s) => isNotEmpty(add) ? `${s}${separator}${text(add)}` : s);
1263
+ with = (separator, ...other) => this.map(
1264
+ (s) => toList(s).add(...other.map((u) => text(u).toString())).filter((s2) => isNotEmpty(s2)).join(separator)
1265
+ );
1266
+ toString() {
1267
+ return this.subject;
1268
+ }
1269
+ toJSON() {
1270
+ return this.subject;
1271
+ }
1272
+ };
1273
+ var text = (subject, alt = "") => {
1274
+ const sub = subject ? asString(subject) : alt;
1275
+ return new ToText2(sub !== "[object Object]" ? sub : "");
1276
+ };
1277
+
1278
+ // src/types/Builder.ts
1279
+ var builder = class _builder {
1280
+ static state = {};
1281
+ static singleton = (ctr, ...args) => _builder.state[asString(ctr)] ?? (_builder.state[asString(ctr)] = new ctr(...args));
1282
+ static reset = () => {
1283
+ _builder.state = {};
1284
+ };
1285
+ };
1286
+ var build = {
1287
+ singleton: (ctr, ...args) => builder.singleton(ctr, ...args),
1288
+ reset: () => builder.reset()
1289
+ };
1290
+ var singleton = (ctr, ...args) => build.singleton(ctr, ...args);
1291
+
1292
+ // src/types/Cache.ts
1293
+ var toCacheOptions = (co) => ({
1294
+ expiresIn: co.expiresIn ?? "5m",
1295
+ store: co.store
1296
+ });
1297
+ var cache = (options) => (subject) => {
1298
+ meta(subject).set("cache", toCacheOptions(options));
1299
+ };
1300
+
1301
+ // src/types/CacheAge.ts
1302
+ var ageNumber = (s) => asNumber(s.replace(/[a-z]/g, ""));
1303
+ var cacheAge = {
1304
+ toMilliseconds: (ca) => choose(asString(ca)).case(
1305
+ (c) => c.endsWith("ms"),
1306
+ (c) => ageNumber(c)
1307
+ ).case(
1308
+ (c) => c.endsWith("s"),
1309
+ (c) => ageNumber(c) * 1e3
1310
+ ).case(
1311
+ (c) => c.endsWith("m"),
1312
+ (c) => ageNumber(c) * 60 * 1e3
1313
+ ).case(
1314
+ (c) => c.endsWith("h"),
1315
+ (c) => ageNumber(c) * 3600 * 1e3
1316
+ ).case(
1317
+ (c) => c.endsWith("d"),
1318
+ (c) => ageNumber(c) * 24 * 3600 * 1e3
1319
+ ).else(ca),
1320
+ toSeconds: (ca) => choose(asString(ca)).case(
1321
+ (c) => c.endsWith("ms"),
1322
+ (c) => ageNumber(c) / 1e3
1323
+ ).case(
1324
+ (c) => c.endsWith("s"),
1325
+ (c) => ageNumber(c)
1326
+ ).case(
1327
+ (c) => c.endsWith("m"),
1328
+ (c) => ageNumber(c) * 60
1329
+ ).case(
1330
+ (c) => c.endsWith("h"),
1331
+ (c) => ageNumber(c) * 3600
1332
+ ).case(
1333
+ (c) => c.endsWith("d"),
1334
+ (c) => ageNumber(c) * 24 * 3600
1335
+ ).else(ca)
1336
+ };
1337
+
1338
+ // src/types/Case.ts
1339
+ var CaseBuilder = class {
1340
+ constructor(v) {
1341
+ this.v = v;
1342
+ }
1343
+ case(pred, out) {
1344
+ return new Case(this.v).case(pred, out);
1345
+ }
1346
+ type(guard, out) {
1347
+ return new Case(this.v).type(guard, out);
1348
+ }
1349
+ equals(value, out) {
1350
+ return new Case(this.v).equals(value, out);
1351
+ }
1352
+ is = {
1353
+ defined: (prop, out) => new Case(this.v).case(isDefined(prop(this.v)), out),
1354
+ empty: (prop, out) => new Case(this.v).case(isEmpty(prop(this.v)), out),
1355
+ valid: (prop, out) => new Case(this.v).case(validate(prop(this.v)).isValid, out),
1356
+ not: {
1357
+ defined: (prop, out) => new Case(this.v).case(!isDefined(prop(this.v)), out),
1358
+ empty: (prop, out) => new Case(this.v).case(!isEmpty(prop(this.v)), out),
1359
+ valid: (prop, out) => new Case(this.v).case(!validate(prop(this.v)).isValid, out)
1360
+ }
1361
+ };
1362
+ if = this.is;
1363
+ };
1364
+ var Case = class _Case {
1365
+ constructor(value, outcome) {
1366
+ this.value = value;
1367
+ this.outcome = outcome;
1368
+ }
1369
+ case(pred, out) {
1370
+ return tryTo(pred, this.value).is.true().map(() => ofGet(out, this.value)).map((res) => new Found(this.value, res)).or(this);
1371
+ }
1372
+ type(guard, out) {
1373
+ return tryTo(guard, this.value).is.true().map(() => out(this.value)).map((res) => new Found(this.value, res)).or(this);
1374
+ }
1375
+ equals(value, out) {
1376
+ return this.case(this.value === value, out);
1377
+ }
1378
+ is = {
1379
+ defined: (prop, out) => new _Case(this.value).case(isDefined(prop(this.value)), out),
1380
+ empty: (prop, out) => new _Case(this.value).case(isEmpty(prop(this.value)), out),
1381
+ valid: (prop, out) => new _Case(this.value).case(validate(prop(this.value)).isValid, out),
1382
+ not: {
1383
+ defined: (prop, out) => new _Case(this.value).case(!isDefined(prop(this.value)), out),
1384
+ empty: (prop, out) => new _Case(this.value).case(!isEmpty(prop(this.value)), out),
1385
+ valid: (prop, out) => new _Case(this.value).case(!validate(prop(this.value)).isValid, out)
1386
+ }
1387
+ };
1388
+ if = this.is;
1389
+ else(alt) {
1390
+ return ofGet(alt, this.value);
1391
+ }
1392
+ };
1393
+ var Found = class extends Case {
1394
+ constructor(value, outcome) {
1395
+ super(value, outcome);
1396
+ this.value = value;
1397
+ this.outcome = outcome;
1398
+ }
1399
+ case(pred, out) {
1400
+ return this;
1401
+ }
1402
+ type(guard, out) {
1403
+ return this;
1404
+ }
1405
+ equals(value, out) {
1406
+ return this;
1407
+ }
1408
+ is = {
1409
+ defined: (_prop, _out) => this,
1410
+ empty: (_prop, _out) => this,
1411
+ valid: (_prop, _out) => this,
1412
+ not: {
1413
+ defined: (_prop, _out) => this,
1414
+ empty: (_prop, _out) => this,
1415
+ valid: (_prop, _out) => this
1416
+ }
1417
+ };
1418
+ if = this.is;
1419
+ else(alt) {
1420
+ return this.outcome;
1421
+ }
1422
+ };
1423
+ var choose = (value) => new CaseBuilder(value);
1424
+
1425
+ // src/types/Context.ts
1426
+ var DotEnvContext = class {
1427
+ domain = process.env.DOMAIN ?? "easy";
1428
+ name = process.env.ENVIRONMENT_NAME ?? "";
1429
+ host = process.env.HOST ?? "";
1430
+ port = Number.parseInt(process.env.PORT ?? "8080");
1431
+ app = process.env.APP ?? "";
1432
+ get = (key, alt) => tryTo(
1433
+ () => text(key).map((k) => k.replace(/([a-z])([A-Z])/g, "$1 $2")).snake.toString()
1434
+ ).map((k) => process.env[k] ?? alt).value;
1435
+ };
1436
+ var BaseRequestContext = class {
1437
+ state = {};
1438
+ get token() {
1439
+ return this.get("token");
1440
+ }
1441
+ set token(token) {
1442
+ this.set("token", token);
1443
+ }
1444
+ get identity() {
1445
+ return this.token;
1446
+ }
1447
+ get jwt() {
1448
+ return this.get("jwt");
1449
+ }
1450
+ set jwt(jwt) {
1451
+ this.set("jwt", jwt);
1452
+ }
1453
+ get correlationId() {
1454
+ return this.get("correlationId");
1455
+ }
1456
+ set correlationId(id) {
1457
+ this.set("correlationId", id);
1458
+ }
1459
+ get lastError() {
1460
+ return this.get("lastError");
1461
+ }
1462
+ set lastError(error) {
1463
+ this.set("lastError", error);
1464
+ }
1465
+ get(key) {
1466
+ return this.state[key];
1467
+ }
1468
+ set(key, value) {
1469
+ return this.state[key] = value;
1470
+ }
1471
+ create = (f) => f();
1472
+ wrap = (f) => f();
1473
+ };
1474
+ var BaseContext = class extends BaseRequestContext {
1475
+ };
1476
+ var Context = class {
1477
+ constructor(state = {}) {
1478
+ this.state = state;
1479
+ this.state = {
1480
+ ...{
1481
+ env: new DotEnvContext(),
1482
+ request: new BaseRequestContext(),
1483
+ other: {}
1484
+ },
1485
+ ...this.state
1486
+ };
1487
+ }
1488
+ get env() {
1489
+ return this.state.env;
1490
+ }
1491
+ set env(env) {
1492
+ this.state.env = env;
1493
+ }
1494
+ get request() {
1495
+ return this.state.request;
1496
+ }
1497
+ set request(request) {
1498
+ this.state.request = request;
1499
+ }
1500
+ get other() {
1501
+ return this.state.other;
1502
+ }
1503
+ };
1504
+ var ctx = new Context();
1505
+
1506
+ // src/types/Enum.ts
1507
+ var Enum = class {
1508
+ constructor(name2, id = name2.toLowerCase(), code = id.toString()) {
1509
+ this.name = name2;
1510
+ this.id = id;
1511
+ this.code = code;
1512
+ }
1513
+ get isValid() {
1514
+ return isDefined(this.id);
1515
+ }
1516
+ static all() {
1517
+ return meta(this.allTuple()).values();
1518
+ }
1519
+ static allTuple() {
1520
+ return meta(this).get(`all-${this.name}`) ?? meta(this).set(`all-${this.name}`, meta(this).values().filter(isEnum).toObject("id"));
1521
+ }
1522
+ static filter(p, params) {
1523
+ return this.all().filter(p, params);
1524
+ }
1525
+ static first(p, params) {
1526
+ return this.all().first(p, params);
1527
+ }
1528
+ static byIds(ids = []) {
1529
+ return toList(ids).mapDefined((id) => this.byId(id)).distinct();
1530
+ }
1531
+ static byId(id, alt) {
1532
+ return this.allTuple()[id] ?? ofGet(alt);
1533
+ }
1534
+ equals(other) {
1535
+ return this.id === (isEnum(other) ? other.id : other);
1536
+ }
1537
+ isIn(...items) {
1538
+ return items.some((i) => this.equals(i));
1539
+ }
1540
+ toJSON() {
1541
+ return this.id;
1542
+ }
1543
+ toString() {
1544
+ return this.id.toString();
1545
+ }
1546
+ };
1547
+ var isEnum = (e) => isDefined(e) && e instanceof Enum && isAn(e, "name", "id", "code");
1548
+
1549
+ // src/types/Exception.ts
1550
+ var Exception = class _Exception extends Enum {
1551
+ constructor(message, id, reason) {
1552
+ super(message, id ?? text(message).pascal.toString());
1553
+ this.message = message;
1554
+ this.reason = reason;
1555
+ }
1556
+ static AlreadyExists = new _Exception("Subject already exists");
1557
+ static DoesNotExist = new _Exception("Does not exist");
1558
+ static IsMissingId = new _Exception("Subject is missing an id");
1559
+ static IsNotImplemented = new _Exception("Is not implemented");
1560
+ static IsNotValid = new _Exception("Is not valid");
1561
+ static Unknown = new _Exception("Unknown error");
1562
+ static CouldNotExecute = (target) => new _Exception(`Could not execute ${target}.`, "CouldNotExecute");
1563
+ static CouldNotValidate = (target) => new _Exception(`Could not validate ${target}.`, "CouldNotValidate");
1564
+ static EnvironmentVariableNotFound = (variable) => new _Exception(`Environment variable ${text(variable).upper} could not be found.`, "EnvironmentVariableNotFound");
1565
+ because = (reason) => new _Exception(this.message, this.id, reason);
1566
+ };
1567
+ var isException = (e, t) => e instanceof Exception && (isDefined(t) ? e.equals(asString(t)) : true);
1568
+ var isDoesNotExist = (e) => e instanceof Exception && Exception.DoesNotExist.equals(e);
1569
+
1570
+ // src/types/Falsy.ts
1571
+ var isFalsy = (v) => !v;
1572
+ var isTruthy = (v) => !isFalsy(v);
1573
+
1574
+ // src/types/Gateway.ts
1575
+ var Gateway = class {
1576
+ all(options) {
1577
+ return reject(Exception.IsNotImplemented);
1578
+ }
1579
+ byId(id, options) {
1580
+ return reject(Exception.IsNotImplemented);
1581
+ }
1582
+ by(_key, _value, _options) {
1583
+ return reject(Exception.IsNotImplemented);
1584
+ }
1585
+ byIds(..._ids) {
1586
+ return reject(Exception.IsNotImplemented);
1587
+ }
1588
+ search(q, options) {
1589
+ return reject(Exception.IsNotImplemented);
1590
+ }
1591
+ filter(options) {
1592
+ return reject(Exception.IsNotImplemented);
1593
+ }
1594
+ exists(id, options) {
1595
+ return reject(Exception.IsNotImplemented);
1596
+ }
1597
+ add(item, options) {
1598
+ return reject(Exception.IsNotImplemented);
1599
+ }
1600
+ update(item, options) {
1601
+ return reject(Exception.IsNotImplemented);
1602
+ }
1603
+ remove(id, options) {
1604
+ return reject(Exception.IsNotImplemented);
1605
+ }
1606
+ };
1607
+
1608
+ // src/types/Uuid.ts
1609
+ var import_uuid = require("uuid");
1610
+ var isValidUuid = new RegExp(/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i);
1611
+ var isUuid = (id) => isString(id) && isValidUuid.test(id);
1612
+ var toUuid = () => (0, import_uuid.v4)();
1613
+
1614
+ // src/types/Id.ts
1615
+ var toId = () => toUuid();
1616
+
1617
+ // src/types/IsDate.ts
1618
+ var isDate = (o) => o instanceof Date && !isNaN(o.getTime());
1619
+ var days = {
1620
+ add: (date, days2) => {
1621
+ date.setDate(date.getDate() + days2);
1622
+ return date;
1623
+ },
1624
+ today: () => /* @__PURE__ */ new Date(),
1625
+ yesterday: () => days.add(days.today(), -1),
1626
+ tomorrow: () => days.add(days.today(), 1)
1627
+ };
1628
+ var inPast = (o) => isDate(o) && o <= days.today();
1629
+ var inFuture = (o) => isDate(o) && o > days.today();
1630
+
1631
+ // src/types/IsEqual.ts
1632
+ var isEqualArray = (one, another) => choose([one, another]).case(([o, a]) => !isArray(o) || !isArray(a), false).case(([o, a]) => o?.length !== a?.length, false).else(([o, a]) => !o.some((v, i) => !isEqual(v, a[i])));
1633
+ var isEqualObject = (one, another) => choose([Object.keys(one), Object.keys(another)]).case(([keysO, keysA]) => keysO.length !== keysA.length, false).case(([keysO, keysA]) => keysO.some((k) => !keysA.includes(k)), false).case(([keysO]) => keysO.some((k) => !isEqual(one[k], another[k])), false).else(true);
1634
+ var isEqual = (one, another) => choose([one, another]).case(([o, a]) => o === a, true).case(
1635
+ ([o, a]) => isArray(o) || isArray(a),
1636
+ ([o, a]) => isEqualArray(o, a)
1637
+ ).case(
1638
+ ([o, a]) => o == null || a == null || !isObject(o) && !isObject(a),
1639
+ ([o, a]) => o !== o && a !== a
1640
+ ).else(([o, a]) => isEqualObject(o, a));
1641
+
1642
+ // src/types/Message.ts
1643
+ var ofMessage = (g, ...params) => isFunc(g) ? g(...params) : g;
1644
+
1645
+ // src/types/Nullish.ts
1646
+ var isNullish = (v) => v == null;
1647
+
1648
+ // src/types/Number.ts
1649
+ var asNumber = (n, alt) => tryTo(() => asString(n)).map((s) => parseInt(s)).filter((n2) => isNumber(n2)).or(ofGet(alt) ?? NaN);
1650
+
1651
+ // src/types/PageList.ts
1652
+ var toFilter = (field, value) => toShortFilter(field, field, value);
1653
+ var toShortFilter = (field, shortField, value) => ({
1654
+ field,
1655
+ shortField,
1656
+ values: [{ value }]
1657
+ });
1658
+ var PageList2 = class extends List6 {
1659
+ _options;
1660
+ setPageOptions(options) {
1661
+ this._options = options;
1662
+ return this;
1663
+ }
1664
+ get take() {
1665
+ return this._options?.take ?? 250;
1666
+ }
1667
+ get skip() {
1668
+ return this._options?.skip ?? 0;
1669
+ }
1670
+ get total() {
1671
+ return this._options?.total;
1672
+ }
1673
+ get sorts() {
1674
+ return this._options?.sorts;
1675
+ }
1676
+ get filters() {
1677
+ return this._options?.filters;
1678
+ }
1679
+ get meta() {
1680
+ return {
1681
+ take: this.take,
1682
+ skip: this.skip,
1683
+ total: this.total,
1684
+ sorts: this.sorts,
1685
+ filters: this.filters
1686
+ };
1687
+ }
1688
+ get options() {
1689
+ return this._options;
1690
+ }
1691
+ asc(p) {
1692
+ return toPageList(super.asc(p), this);
1693
+ }
1694
+ desc(p) {
1695
+ return toPageList(super.desc(p), this);
1696
+ }
1697
+ diff(others) {
1698
+ return toPageList(super.diff(others), this);
1699
+ }
1700
+ diffByKey(others, key) {
1701
+ return toPageList(super.diffByKey(others, key), this);
1702
+ }
1703
+ intersect(others) {
1704
+ return toPageList(super.intersect(others), this);
1705
+ }
1706
+ intersectByKey(others, key) {
1707
+ return toPageList(super.intersectByKey(others, key), this);
1708
+ }
1709
+ map(f, params) {
1710
+ const items = super.map(f, params);
1711
+ return toPageList(items, this);
1712
+ }
1713
+ flatMap(f, params) {
1714
+ return toPageList(super.flatMap(f, params), this);
1715
+ }
1716
+ mapDefined(f, params) {
1717
+ return toPageList(super.mapDefined(f, params), this);
1718
+ }
1719
+ mapAsync(f) {
1720
+ return super.mapAsync(f).then((r) => toPageList(r, this));
1721
+ }
1722
+ distinct() {
1723
+ return toPageList(super.distinct(), this);
1724
+ }
1725
+ distinctByKey(key) {
1726
+ return toPageList(super.distinctByKey(key), this);
1727
+ }
1728
+ filter(p, params) {
1729
+ return toPageList(super.filter(p, params), this);
1730
+ }
1731
+ concat(...items) {
1732
+ return toPageList(super.concat(...items), this);
1733
+ }
1734
+ reverse() {
1735
+ return toPageList(super.reverse(), this);
1736
+ }
1737
+ splice(start, deleteCount, ...items) {
1738
+ return toPageList(super.splice(start, deleteCount, ...items), this);
1739
+ }
1740
+ remove(item) {
1741
+ return toPageList(super.remove(item), this);
1742
+ }
1743
+ replace(key, item) {
1744
+ return toPageList(super.replace(key, item), this);
1745
+ }
1746
+ switch(item) {
1747
+ return toPageList(super.switch(item), this);
1748
+ }
1749
+ defined() {
1750
+ return toPageList(super.defined(), this);
1751
+ }
1752
+ orElse(...alt) {
1753
+ return toPageList(super.orElse(...alt), this);
1754
+ }
1755
+ slice(start, end) {
1756
+ return toPageList(super.slice(start, end), this);
1757
+ }
1758
+ };
1759
+ var isPageList = (l) => isList(l) && isA(l, "total");
1760
+ var toPageList = (items = [], options) => choose(items).case(
1761
+ (i) => i.length === 1 && isNumber(i[0]),
1762
+ (i) => new PageList2().add(...i)
1763
+ ).else((i) => new PageList2(...i)).setPageOptions(options);
1764
+ var asPageList = (c, items = toPageList()) => items.map((i) => ofConstruct(c, i));
1765
+
1766
+ // src/types/Parser.ts
1767
+ var Parser = class {
1768
+ constructor(value, valid2 = true) {
1769
+ this.value = value;
1770
+ this.valid = valid2;
1771
+ }
1772
+ if = {
1773
+ equals: (pred) => this.evaluate(isTrue, pred),
1774
+ empty: (pred) => this.evaluate(isEmpty, pred),
1775
+ defined: (pred) => this.evaluate(isDefined, pred),
1776
+ valid: (pred) => this.evaluate(isValid, pred),
1777
+ in: (...items) => this.evaluate(() => isIn(this.value, toArray(...items))),
1778
+ is: {
1779
+ object: (pred) => this.evaluate(isObject, pred),
1780
+ string: (pred) => this.evaluate(isString, pred),
1781
+ instance: (c, pred) => this.evaluate(() => this.value instanceof c, pred)
1782
+ },
1783
+ not: {
1784
+ empty: (pred) => this.evaluateNot(isEmpty, pred),
1785
+ defined: (pred) => this.evaluateNot(isDefined, pred),
1786
+ valid: (pred) => this.evaluateNot(isValid, pred),
1787
+ isObject: (pred) => this.evaluateNot(isObject, pred),
1788
+ in: (...items) => this.evaluate(() => !isIn(this.value, toArray(...items))),
1789
+ is: {
1790
+ object: (pred) => this.evaluateNot(isObject, pred),
1791
+ string: (pred) => this.evaluateNot(isString, pred),
1792
+ instance: (c, pred) => this.evaluate(() => !(this.value instanceof c), pred)
1793
+ }
1794
+ }
1795
+ };
1796
+ evaluate(meta2, pred) {
1797
+ return on(this, (t) => t.valid = ofGet(meta2, pred ? ofGet(pred, this.value) : this.value));
1798
+ }
1799
+ evaluateNot(meta2, pred) {
1800
+ return on(this, (t) => t.valid = !ofGet(meta2, pred ? ofGet(pred, this.value) : this.value));
1801
+ }
1802
+ };
1803
+
1804
+ // src/types/Repository.ts
1805
+ var Repository = class {
1806
+ all(options) {
1807
+ return reject(Exception.IsNotImplemented);
1808
+ }
1809
+ byId(id) {
1810
+ return reject(Exception.IsNotImplemented);
1811
+ }
1812
+ byIds(...ids) {
1813
+ return reject(Exception.IsNotImplemented);
1814
+ }
1815
+ byKey(key, options) {
1816
+ return reject(Exception.IsNotImplemented);
1817
+ }
1818
+ by(key, value, options) {
1819
+ return reject(Exception.IsNotImplemented);
1820
+ }
1821
+ search(q, options) {
1822
+ return reject(Exception.IsNotImplemented);
1823
+ }
1824
+ filter(options) {
1825
+ return reject(Exception.IsNotImplemented);
1826
+ }
1827
+ exists(id) {
1828
+ return reject(Exception.IsNotImplemented);
1829
+ }
1830
+ add(t) {
1831
+ return reject(Exception.IsNotImplemented);
1832
+ }
1833
+ update(id, json2) {
1834
+ return reject(Exception.IsNotImplemented);
1835
+ }
1836
+ remove(id) {
1837
+ return reject(Exception.IsNotImplemented);
1838
+ }
1839
+ upsert(id, item) {
1840
+ return reject(Exception.IsNotImplemented);
1841
+ }
1842
+ };
1843
+
1844
+ // src/types/Result.ts
1845
+ var toResult = (message, location, domain = ctx.env.domain) => ({
1846
+ message: message.toString(),
1847
+ location: location?.toString(),
1848
+ domain: domain?.toString()
1849
+ });
1850
+ var isResult = (r) => isA(r, "message");
1851
+
1852
+ // src/types/Results.ts
1853
+ var parse = (...rs) => toArray(...rs).map((r) => isResult(r) ? r : toResult(r));
1854
+ var Results4 = class {
1855
+ results;
1856
+ constructor(...rs) {
1857
+ this.results = parse(...rs);
1858
+ }
1859
+ get length() {
1860
+ return this.results.length;
1861
+ }
1862
+ get isValid() {
1863
+ return this.results.length === 0;
1864
+ }
1865
+ add = (...rs) => toResults(...this.results, ...parse(...rs));
1866
+ };
1867
+ var toResults = (...r) => new Results4(...r);
1868
+ var isResults = (r) => isDefined(r) && r instanceof Results4;
1869
+
1870
+ // src/types/Sort.ts
1871
+ var asc = 1;
1872
+ var desc = -1;
1873
+
1874
+ // src/types/Tag.ts
1875
+ var tag = (name2) => (subject, property) => {
1876
+ meta(subject).property(property).set(name2, property);
1877
+ };
1878
+ var searchable = () => tag(searchable.name);
1879
+
1880
+ // src/types/Uri.ts
1881
+ var toSegment = (key, {
1882
+ segment,
1883
+ query
1884
+ } = {}) => ({
1885
+ key,
1886
+ segment,
1887
+ query,
1888
+ toString: () => asString(key)
1889
+ });
1890
+ var uri = {
1891
+ host: (key) => toSegment(key, { segment: key ?? ctx.env.host ?? "$host" }),
1892
+ resource: (resource) => toSegment(toName(resource, "Uri"), { segment: toName(resource, "Uri") }),
1893
+ segment: (key) => toSegment(key, { segment: key }),
1894
+ path: (key) => toSegment(key, { segment: `:${key}` }),
1895
+ query: (key) => toSegment(key, {
1896
+ query: (value) => tryTo(value).is.defined().map((v) => encodeURIComponent(asString(v))).map((v) => `${key}=${v}`).orElse("") ?? ""
1897
+ }),
1898
+ boolean: (key) => toSegment(key, { query: (value) => isTrue(value) ? `${key}` : "" })
1899
+ };
1900
+ var toRoute = (...segments) => toList(segments).mapDefined((s) => s.segment).join("/");
1901
+ var EasyUri = class _EasyUri {
1902
+ constructor(segments = []) {
1903
+ this.segments = segments;
1904
+ }
1905
+ static id = uri.path("id");
1906
+ static ids = uri.query("ids");
1907
+ static query = uri.query("q");
1908
+ static sort = uri.query("s");
1909
+ static skip = uri.query("skip");
1910
+ static take = uri.query("take");
1911
+ host = uri.host();
1912
+ resource = uri.resource(this);
1913
+ state = {};
1914
+ get path() {
1915
+ return toRoute(uri.segment(""), this.resource, ...this.segments);
1916
+ }
1917
+ get complete() {
1918
+ return toRoute(this.host, this.resource, ...this.segments);
1919
+ }
1920
+ get isInternal() {
1921
+ return toRoute(this.host) === (ctx.env.host ?? "$host");
1922
+ }
1923
+ get props() {
1924
+ return meta(this.state).values();
1925
+ }
1926
+ route = (resource = this.resource.key) => toRoute(uri.segment(""), uri.segment(resource?.toLowerCase()), ...this.segments);
1927
+ set = (segment, value) => {
1928
+ tryTo(value).is.defined().accept((value2) => this.state[segment.key ?? ""] = { segment, value: value2 });
1929
+ return this;
1930
+ };
1931
+ toString() {
1932
+ return tryTo(() => this.props).map((ps) => ps.filter((p) => p.segment?.segment)).map((ps) => ps.reduce((r, p) => r.replace(asString(p.segment.segment), asString(p.value)), this.complete)).map((route2) => ({
1933
+ route: route2,
1934
+ query: this.props.mapDefined((p) => p.segment?.query ? p.segment?.query(p.value) : void 0)?.join("&")
1935
+ })).map(({ route: route2, query }) => isNotEmpty(query) ? `${route2}?${query}` : route2).value;
1936
+ }
1937
+ id = (id) => this.set(_EasyUri.id, id);
1938
+ ids = (ids) => this.set(_EasyUri.ids, toArray(ids).join(","));
1939
+ query = (q) => this.set(_EasyUri.query, q);
1940
+ sort = (s) => this.set(_EasyUri.sort, asString(s));
1941
+ skip = (index) => this.set(_EasyUri.skip, index);
1942
+ take = (items) => this.set(_EasyUri.take, items);
1943
+ expand(props) {
1944
+ return entries(props).filter(([_, v]) => isNotEmpty(v)).reduce((u, [k, v]) => isBoolean(v) ? u.set(uri.boolean(k), v) : u.set(uri.query(k), toArray(v).join(",")), this);
1945
+ }
1946
+ };
1947
+
1948
+ // src/types/Validatable.ts
1949
+ var isValidatable = (v) => isA(v, "isValid");
1950
+
1951
+ // src/types/Value.ts
1952
+ var Value = class {
1953
+ constructor(value) {
1954
+ this.value = value;
1955
+ this.value = value;
1956
+ }
1957
+ get isValid() {
1958
+ return isDefined(this.value);
1959
+ }
1960
+ toJSON() {
1961
+ return this.value;
1962
+ }
1963
+ toString() {
1964
+ return asString(this.value);
1965
+ }
1966
+ };
1967
+ var isValue = (v) => v instanceof Value;
1968
+
1969
+ // src/data/Condition.ts
1970
+ var Condition = class {
1971
+ constructor(key, operator, value) {
1972
+ this.key = key;
1973
+ this.operator = operator;
1974
+ this.value = value;
1975
+ }
1976
+ and = (...others) => new LogicalCondition("and", [this, ...others]);
1977
+ or = (...others) => new LogicalCondition("or", [this, ...others]);
1978
+ toJSON() {
1979
+ return { [this.key]: { [`$${this.operator}`]: json.parse(this.value) } };
1980
+ }
1981
+ };
1982
+ var LogicalCondition = class {
1983
+ constructor(operator, conditions) {
1984
+ this.operator = operator;
1985
+ this.conditions = conditions;
1986
+ }
1987
+ toJSON() {
1988
+ return { [`$${this.operator}`]: this.conditions.map((c) => c.toJSON()) };
1989
+ }
1990
+ };
1991
+ var SortCondition = class extends Condition {
1992
+ constructor(key, value) {
1993
+ super(key, "", value);
1994
+ this.key = key;
1995
+ this.value = value;
1996
+ }
1997
+ toJSON() {
1998
+ return { [this.key]: this.value };
1999
+ }
2000
+ };
2001
+ var toCondition = (field, operator, value, conv = convert.default) => new Condition(field, operator, conv.from(value));
2002
+ var isSortCondition = (s) => isDefined(s) && s instanceof SortCondition;
2003
+
2004
+ // src/data/InMemoryGateway.ts
2005
+ var InMemoryGateway = class extends Gateway {
2006
+ constructor(data) {
2007
+ super();
2008
+ this.data = data;
2009
+ }
2010
+ all(options) {
2011
+ return this.data.then((d) => toPageList(d, d));
2012
+ }
2013
+ byId(id) {
2014
+ return this.data.then((d) => d.byId(id)).then((d) => d ? { ...d } : void 0);
2015
+ }
2016
+ by = (key, value) => {
2017
+ return this.data.then((d) => d.filter((i) => i[key] === value));
2018
+ };
2019
+ exists(id) {
2020
+ return this.byId(id).then((d) => isDefined(d));
2021
+ }
2022
+ add(item) {
2023
+ return when(item).not.contains((i) => i.id).reject(Exception.IsMissingId).then((i) => this.exists(i.id)).then((ex) => when(ex).isTrue.reject(Exception.AlreadyExists)).then(() => this.data.then((d) => d.add(item))).then(() => ({ ...item }));
2024
+ }
2025
+ remove(id) {
2026
+ return this.data.then(
2027
+ (d) => when(d.findIndex((i) => i.id === id)).with((i) => i < 0).reject(Exception.DoesNotExist).then((i) => d.splice(i, 1))
2028
+ ).then(() => true);
2029
+ }
2030
+ update(item) {
2031
+ return when(item).not.contains((i) => i.id).reject(Exception.IsMissingId).then((i) => this.remove(i.id).then(() => this.add(i)));
2032
+ }
2033
+ };
2034
+
2035
+ // src/data/Database.ts
2036
+ var DefaultProvider = class {
2037
+ };
2038
+ var Database = class _Database extends Enum {
2039
+ constructor(name2, provider, options) {
2040
+ super(name2);
2041
+ this.provider = provider;
2042
+ this.options = options;
2043
+ }
2044
+ static Default = new _Database("Default", DefaultProvider);
2045
+ provide = () => ofConstruct(this.provider, this);
2046
+ };
2047
+
2048
+ // src/data/Field.ts
2049
+ var Field = class extends Property {
2050
+ is = (value) => this.condition("eq", value);
2051
+ isNot = (value) => this.condition("ne", value);
2052
+ isIn = (...value) => this.condition("in", toArray(value));
2053
+ notIn = (...value) => this.condition("nin", toArray(value));
2054
+ exists = (does) => this.condition("exists", does);
2055
+ greater = (value) => this.condition("gt", value);
2056
+ greaterEqual = (value) => this.condition("gte", value);
2057
+ less = (value) => this.condition("lt", value);
2058
+ lessEqual = (value) => this.condition("lte", value);
2059
+ asc = () => new SortCondition(this.property, 1);
2060
+ desc = () => new SortCondition(this.property, -1);
2061
+ condition = (operator, value) => toCondition(this.property, operator, value, this.options?.convert);
2062
+ };
2063
+ var isField = (f) => isDefined(f) && f instanceof Field;
2064
+
2065
+ // src/domain/enums/Country.ts
2066
+ var Country = class _Country extends Enum {
2067
+ constructor(name2, id, lower = text(id).lower.trim.toString()) {
2068
+ super(name2, id);
2069
+ this.lower = lower;
2070
+ }
2071
+ static AF = new _Country("Afghanistan", "AF");
2072
+ static AX = new _Country("\xC5land Islands", "AX");
2073
+ static AL = new _Country("Albania", "AL");
2074
+ static DZ = new _Country("Algeria", "DZ");
2075
+ static AS = new _Country("American Samoa", "AS");
2076
+ static AD = new _Country("Andorra", "AD");
2077
+ static AO = new _Country("Angola", "AO");
2078
+ static AI = new _Country("Anguilla", "AI");
2079
+ static AQ = new _Country("Antarctica", "AQ");
2080
+ static AG = new _Country("Antigua & Barbuda", "AG");
2081
+ static AR = new _Country("Argentina", "AR");
2082
+ static AM = new _Country("Armenia", "AM");
2083
+ static AW = new _Country("Aruba", "AW");
2084
+ static AU = new _Country("Australia", "AU");
2085
+ static AT = new _Country("Austria", "AT");
2086
+ static AZ = new _Country("Azerbaijan", "AZ");
2087
+ static BS = new _Country("Bahamas", "BS");
2088
+ static BH = new _Country("Bahrain", "BH");
2089
+ static BD = new _Country("Bangladesh", "BD");
2090
+ static BB = new _Country("Barbados", "BB");
2091
+ static BY = new _Country("Belarus", "BY");
2092
+ static BE = new _Country("Belgium", "BE");
2093
+ static BZ = new _Country("Belize", "BZ");
2094
+ static BJ = new _Country("Benin", "BJ");
2095
+ static BM = new _Country("Bermuda", "BM");
2096
+ static BT = new _Country("Bhutan", "BT");
2097
+ static BO = new _Country("Bolivia", "BO");
2098
+ static BA = new _Country("Bosnia & Herzegovina", "BA");
2099
+ static BW = new _Country("Botswana", "BW");
2100
+ static BV = new _Country("Bouvet Island", "BV");
2101
+ static BR = new _Country("Brazil", "BR");
2102
+ static IO = new _Country("British Indian Ocean Territory", "IO");
2103
+ static VG = new _Country("British Virgin Islands", "VG");
2104
+ static BN = new _Country("Brunei", "BN");
2105
+ static BG = new _Country("Bulgaria", "BG");
2106
+ static BF = new _Country("Burkina Faso", "BF");
2107
+ static BI = new _Country("Burundi", "BI");
2108
+ static KH = new _Country("Cambodia", "KH");
2109
+ static CM = new _Country("Cameroon", "CM");
2110
+ static CA = new _Country("Canada", "CA");
2111
+ static CV = new _Country("Cape Verde", "CV");
2112
+ static BQ = new _Country("Caribbean Netherlands", "BQ");
2113
+ static KY = new _Country("Cayman Islands", "KY");
2114
+ static CF = new _Country("Central African Republic", "CF");
2115
+ static TD = new _Country("Chad", "TD");
2116
+ static CL = new _Country("Chile", "CL");
2117
+ static CN = new _Country("China", "CN");
2118
+ static CX = new _Country("Christmas Island", "CX");
2119
+ static CC = new _Country("Cocos (Keeling) Islands", "CC");
2120
+ static CO = new _Country("Colombia", "CO");
2121
+ static KM = new _Country("Comoros", "KM");
2122
+ static CG = new _Country("Congo - Brazzaville", "CG");
2123
+ static CD = new _Country("Congo - Kinshasa", "CD");
2124
+ static CK = new _Country("Cook Islands", "CK");
2125
+ static CR = new _Country("Costa Rica", "CR");
2126
+ static CI = new _Country("C\xF4te d\u2019Ivoire", "CI");
2127
+ static HR = new _Country("Croatia", "HR");
2128
+ static CU = new _Country("Cuba", "CU");
2129
+ static CW = new _Country("Cura\xE7ao", "CW");
2130
+ static CY = new _Country("Cyprus", "CY");
2131
+ static CZ = new _Country("Czechia", "CZ");
2132
+ static DK = new _Country("Denmark", "DK");
2133
+ static DJ = new _Country("Djibouti", "DJ");
2134
+ static DM = new _Country("Dominica", "DM");
2135
+ static DO = new _Country("Dominican Republic", "DO");
2136
+ static EC = new _Country("Ecuador", "EC");
2137
+ static EG = new _Country("Egypt", "EG");
2138
+ static SV = new _Country("El Salvador", "SV");
2139
+ static GQ = new _Country("Equatorial Guinea", "GQ");
2140
+ static ER = new _Country("Eritrea", "ER");
2141
+ static EE = new _Country("Estonia", "EE");
2142
+ static SZ = new _Country("Eswatini", "SZ");
2143
+ static ET = new _Country("Ethiopia", "ET");
2144
+ static FK = new _Country("Falkland Islands", "FK");
2145
+ static FO = new _Country("Faroe Islands", "FO");
2146
+ static FJ = new _Country("Fiji", "FJ");
2147
+ static FI = new _Country("Finland", "FI");
2148
+ static FR = new _Country("France", "FR");
2149
+ static GF = new _Country("French Guiana", "GF");
2150
+ static PF = new _Country("French Polynesia", "PF");
2151
+ static TF = new _Country("French Southern Territories", "TF");
2152
+ static GA = new _Country("Gabon", "GA");
2153
+ static GM = new _Country("Gambia", "GM");
2154
+ static GE = new _Country("Georgia", "GE");
2155
+ static DE = new _Country("Germany", "DE");
2156
+ static GH = new _Country("Ghana", "GH");
2157
+ static GI = new _Country("Gibraltar", "GI");
2158
+ static GR = new _Country("Greece", "GR");
2159
+ static GL = new _Country("Greenland", "GL");
2160
+ static GD = new _Country("Grenada", "GD");
2161
+ static GP = new _Country("Guadeloupe", "GP");
2162
+ static GU = new _Country("Guam", "GU");
2163
+ static GT = new _Country("Guatemala", "GT");
2164
+ static GG = new _Country("Guernsey", "GG");
2165
+ static GN = new _Country("Guinea", "GN");
2166
+ static GW = new _Country("Guinea-Bissau", "GW");
2167
+ static GY = new _Country("Guyana", "GY");
2168
+ static HT = new _Country("Haiti", "HT");
2169
+ static HM = new _Country("Heard & McDonald Islands", "HM");
2170
+ static HN = new _Country("Honduras", "HN");
2171
+ static HK = new _Country("Hong Kong SAR China", "HK");
2172
+ static HU = new _Country("Hungary", "HU");
2173
+ static IS = new _Country("Iceland", "IS");
2174
+ static IN = new _Country("India", "IN");
2175
+ static ID = new _Country("Indonesia", "ID");
2176
+ static IR = new _Country("Iran", "IR");
2177
+ static IQ = new _Country("Iraq", "IQ");
2178
+ static IE = new _Country("Ireland", "IE");
2179
+ static IM = new _Country("Isle of Man", "IM");
2180
+ static IL = new _Country("Israel", "IL");
2181
+ static IT = new _Country("Italy", "IT");
2182
+ static JM = new _Country("Jamaica", "JM");
2183
+ static JP = new _Country("Japan", "JP");
2184
+ static JE = new _Country("Jersey", "JE");
2185
+ static JO = new _Country("Jordan", "JO");
2186
+ static KZ = new _Country("Kazakhstan", "KZ");
2187
+ static KE = new _Country("Kenya", "KE");
2188
+ static KI = new _Country("Kiribati", "KI");
2189
+ static KW = new _Country("Kuwait", "KW");
2190
+ static KG = new _Country("Kyrgyzstan", "KG");
2191
+ static LA = new _Country("Laos", "LA");
2192
+ static LV = new _Country("Latvia", "LV");
2193
+ static LB = new _Country("Lebanon", "LB");
2194
+ static LS = new _Country("Lesotho", "LS");
2195
+ static LR = new _Country("Liberia", "LR");
2196
+ static LY = new _Country("Libya", "LY");
2197
+ static LI = new _Country("Liechtenstein", "LI");
2198
+ static LT = new _Country("Lithuania", "LT");
2199
+ static LU = new _Country("Luxembourg", "LU");
2200
+ static MO = new _Country("Macao SAR China", "MO");
2201
+ static MG = new _Country("Madagascar", "MG");
2202
+ static MW = new _Country("Malawi", "MW");
2203
+ static MY = new _Country("Malaysia", "MY");
2204
+ static MV = new _Country("Maldives", "MV");
2205
+ static ML = new _Country("Mali", "ML");
2206
+ static MT = new _Country("Malta", "MT");
2207
+ static MH = new _Country("Marshall Islands", "MH");
2208
+ static MQ = new _Country("Martinique", "MQ");
2209
+ static MR = new _Country("Mauritania", "MR");
2210
+ static MU = new _Country("Mauritius", "MU");
2211
+ static YT = new _Country("Mayotte", "YT");
2212
+ static MX = new _Country("Mexico", "MX");
2213
+ static FM = new _Country("Micronesia", "FM");
2214
+ static MD = new _Country("Moldova", "MD");
2215
+ static MC = new _Country("Monaco", "MC");
2216
+ static MN = new _Country("Mongolia", "MN");
2217
+ static ME = new _Country("Montenegro", "ME");
2218
+ static MS = new _Country("Montserrat", "MS");
2219
+ static MA = new _Country("Morocco", "MA");
2220
+ static MZ = new _Country("Mozambique", "MZ");
2221
+ static MM = new _Country("Myanmar (Burma)", "MM");
2222
+ static NA = new _Country("Namibia", "NA");
2223
+ static NR = new _Country("Nauru", "NR");
2224
+ static NP = new _Country("Nepal", "NP");
2225
+ static NL = new _Country("Netherlands", "NL");
2226
+ static NC = new _Country("New Caledonia", "NC");
2227
+ static NZ = new _Country("New Zealand", "NZ");
2228
+ static NI = new _Country("Nicaragua", "NI");
2229
+ static NE = new _Country("Niger", "NE");
2230
+ static NG = new _Country("Nigeria", "NG");
2231
+ static NU = new _Country("Niue", "NU");
2232
+ static NF = new _Country("Norfolk Island", "NF");
2233
+ static KP = new _Country("North Korea", "KP");
2234
+ static MK = new _Country("North Macedonia", "MK");
2235
+ static MP = new _Country("Northern Mariana Islands", "MP");
2236
+ static NO = new _Country("Norway", "NO");
2237
+ static OM = new _Country("Oman", "OM");
2238
+ static PK = new _Country("Pakistan", "PK");
2239
+ static PW = new _Country("Palau", "PW");
2240
+ static PS = new _Country("Palestinian Territories", "PS");
2241
+ static PA = new _Country("Panama", "PA");
2242
+ static PG = new _Country("Papua New Guinea", "PG");
2243
+ static PY = new _Country("Paraguay", "PY");
2244
+ static PE = new _Country("Peru", "PE");
2245
+ static PH = new _Country("Philippines", "PH");
2246
+ static PN = new _Country("Pitcairn Islands", "PN");
2247
+ static PL = new _Country("Poland", "PL");
2248
+ static PT = new _Country("Portugal", "PT");
2249
+ static PR = new _Country("Puerto Rico", "PR");
2250
+ static QA = new _Country("Qatar", "QA");
2251
+ static RE = new _Country("R\xE9union", "RE");
2252
+ static RO = new _Country("Romania", "RO");
2253
+ static RU = new _Country("Russia", "RU");
2254
+ static RW = new _Country("Rwanda", "RW");
2255
+ static WS = new _Country("Samoa", "WS");
2256
+ static SM = new _Country("San Marino", "SM");
2257
+ static ST = new _Country("S\xE3o Tom\xE9 & Pr\xEDncipe", "ST");
2258
+ static SA = new _Country("Saudi Arabia", "SA");
2259
+ static SN = new _Country("Senegal", "SN");
2260
+ static RS = new _Country("Serbia", "RS");
2261
+ static SC = new _Country("Seychelles", "SC");
2262
+ static SL = new _Country("Sierra Leone", "SL");
2263
+ static SG = new _Country("Singapore", "SG");
2264
+ static SX = new _Country("Sint Maarten", "SX");
2265
+ static SK = new _Country("Slovakia", "SK");
2266
+ static SI = new _Country("Slovenia", "SI");
2267
+ static SB = new _Country("Solomon Islands", "SB");
2268
+ static SO = new _Country("Somalia", "SO");
2269
+ static ZA = new _Country("South Africa", "ZA");
2270
+ static GS = new _Country("South Georgia & South Sandwich Islands", "GS");
2271
+ static KR = new _Country("South Korea", "KR");
2272
+ static SS = new _Country("South Sudan", "SS");
2273
+ static ES = new _Country("Spain", "ES");
2274
+ static LK = new _Country("Sri Lanka", "LK");
2275
+ static BL = new _Country("St. Barth\xE9lemy", "BL");
2276
+ static SH = new _Country("St. Helena", "SH");
2277
+ static KN = new _Country("St. Kitts & Nevis", "KN");
2278
+ static LC = new _Country("St. Lucia", "LC");
2279
+ static MF = new _Country("St. Martin", "MF");
2280
+ static PM = new _Country("St. Pierre & Miquelon", "PM");
2281
+ static VC = new _Country("St. Vincent & Grenadines", "VC");
2282
+ static SD = new _Country("Sudan", "SD");
2283
+ static SR = new _Country("Suriname", "SR");
2284
+ static SJ = new _Country("Svalbard & Jan Mayen", "SJ");
2285
+ static SE = new _Country("Sweden", "SE");
2286
+ static CH = new _Country("Switzerland", "CH");
2287
+ static SY = new _Country("Syria", "SY");
2288
+ static TW = new _Country("Taiwan", "TW");
2289
+ static TJ = new _Country("Tajikistan", "TJ");
2290
+ static TZ = new _Country("Tanzania", "TZ");
2291
+ static TH = new _Country("Thailand", "TH");
2292
+ static TL = new _Country("Timor-Leste", "TL");
2293
+ static TG = new _Country("Togo", "TG");
2294
+ static TK = new _Country("Tokelau", "TK");
2295
+ static TO = new _Country("Tonga", "TO");
2296
+ static TT = new _Country("Trinidad & Tobago", "TT");
2297
+ static TN = new _Country("Tunisia", "TN");
2298
+ static TR = new _Country("Turkey", "TR");
2299
+ static TM = new _Country("Turkmenistan", "TM");
2300
+ static TC = new _Country("Turks & Caicos Islands", "TC");
2301
+ static TV = new _Country("Tuvalu", "TV");
2302
+ static UM = new _Country("U.S. Outlying Islands", "UM");
2303
+ static VI = new _Country("U.S. Virgin Islands", "VI");
2304
+ static UG = new _Country("Uganda", "UG");
2305
+ static UA = new _Country("Ukraine", "UA");
2306
+ static AE = new _Country("United Arab Emirates", "AE");
2307
+ static GB = new _Country("United Kingdom", "GB");
2308
+ static US = new _Country("United States", "US");
2309
+ static UY = new _Country("Uruguay", "UY");
2310
+ static UZ = new _Country("Uzbekistan", "UZ");
2311
+ static VU = new _Country("Vanuatu", "VU");
2312
+ static VA = new _Country("Vatican City", "VA");
2313
+ static VE = new _Country("Venezuela", "VE");
2314
+ static VN = new _Country("Vietnam", "VN");
2315
+ static WF = new _Country("Wallis & Futuna", "WF");
2316
+ static EH = new _Country("Western Sahara", "EH");
2317
+ static YE = new _Country("Yemen", "YE");
2318
+ static ZM = new _Country("Zambia", "ZM");
2319
+ static ZW = new _Country("Zimbabwe", "ZW");
2320
+ static lookup(other) {
2321
+ return this.all().first((l) => l.equals(other));
2322
+ }
2323
+ equals(other) {
2324
+ return text(other).lower.trim.equals(this.lower);
2325
+ }
2326
+ };
2327
+
2328
+ // src/domain/Struct.ts
2329
+ var Struct = class {
2330
+ constructor(state = {}) {
2331
+ this.state = state;
2332
+ }
2333
+ get isValid() {
2334
+ return validate(this).isValid;
2335
+ }
2336
+ toJSON() {
2337
+ return json.delete(json.parse({ ...this }), "state");
2338
+ }
2339
+ toString() {
2340
+ return this.constructor.name;
2341
+ }
2342
+ update(_add) {
2343
+ return this;
2344
+ }
2345
+ merge(a) {
2346
+ return json.merge(this, a);
2347
+ }
2348
+ };
2349
+ function isStruct(s) {
2350
+ return isDefined(s) && s instanceof Struct;
2351
+ }
2352
+
2353
+ // src/domain/values/DateTime.ts
2354
+ var import_luxon = require("luxon");
2355
+ import_luxon.Settings.defaultZone = "utc";
2356
+ var DateTime = class _DateTime extends Value {
2357
+ constructor(value, format) {
2358
+ super(
2359
+ choose(value).type(isString, (v) => format ? import_luxon.DateTime.fromFormat(v, format, { setZone: true }) : import_luxon.DateTime.fromISO(v, { setZone: true })).type(isNumber, (v) => import_luxon.DateTime.fromMillis(v)).type(isDate, (v) => import_luxon.DateTime.fromJSDate(v)).type(isDateTime, (v) => import_luxon.DateTime.fromISO(v.toString())).else(void 0)?.toISO()
2360
+ );
2361
+ }
2362
+ static get now() {
2363
+ return new _DateTime(import_luxon.DateTime.utc().toISO());
2364
+ }
2365
+ get isValid() {
2366
+ return isDefined(this.value) && this.utc.isValid;
2367
+ }
2368
+ /**
2369
+ * @deprecated Deprecated in favor for DateTime.from as that also accepts locales and another DateTime
2370
+ */
2371
+ get fromNow() {
2372
+ return this.from();
2373
+ }
2374
+ get utc() {
2375
+ return this.luxon.setZone("utc");
2376
+ }
2377
+ get luxon() {
2378
+ return import_luxon.DateTime.fromISO(this.value, { setZone: true });
2379
+ }
2380
+ from(param, other) {
2381
+ const date = isA(param) ? param : void 0;
2382
+ const locale = (isString(param) ? param : void 0) ?? other ?? "en";
2383
+ return ifDefined(
2384
+ date,
2385
+ (d) => this.utc.setLocale(locale).toRelative({ base: d.utc }),
2386
+ () => this.utc.setLocale(locale).toRelative()
2387
+ );
2388
+ }
2389
+ isAfter(dt2) {
2390
+ return this.utc > dt2.utc;
2391
+ }
2392
+ isBefore(dt2) {
2393
+ return this.utc < dt2.utc;
2394
+ }
2395
+ equals(dt2) {
2396
+ return this.utc.hasSame(dt2.utc, "millisecond");
2397
+ }
2398
+ add(n, unit) {
2399
+ return new _DateTime(this.luxon.plus(isNumber(n) ? { [unit ?? "day"]: n } : n).toISO());
2400
+ }
2401
+ subtract(n, unit) {
2402
+ return new _DateTime(this.luxon.minus(isNumber(n) ? { [unit ?? "day"]: n } : n).toISO());
2403
+ }
2404
+ diff(other, unit = "day", opts) {
2405
+ return Math[opts?.rounding ?? "floor"](this.utc.diff(other.utc).as(unit));
2406
+ }
2407
+ startOf(unit = "day") {
2408
+ return new _DateTime(this.luxon.startOf(unit).toISO());
2409
+ }
2410
+ endOf(unit = "day") {
2411
+ return new _DateTime(this.luxon.endOf(unit).toISO());
2412
+ }
2413
+ isWeekend() {
2414
+ return this.luxon.isWeekend;
2415
+ }
2416
+ withZone(zone) {
2417
+ return new _DateTime(this.utc.setZone(zone).toISO());
2418
+ }
2419
+ toString() {
2420
+ return this.value ?? "";
2421
+ }
2422
+ toJSON() {
2423
+ return this.utc.toISO();
2424
+ }
2425
+ toFormat(format) {
2426
+ return this.luxon.toFormat(format);
2427
+ }
2428
+ toLocale(locale = "nl-NL", format = "D") {
2429
+ return this.luxon.setLocale(locale).toFormat(format);
2430
+ }
2431
+ toFull(locale) {
2432
+ return this.toLocale(locale, "DDD");
2433
+ }
2434
+ toDate() {
2435
+ return this.isValid ? this.utc.toJSDate() : void 0;
2436
+ }
2437
+ };
2438
+ var isDateTime = (dt2) => isDefined(dt2) && dt2 instanceof DateTime;
2439
+ var dt = (dt2) => isString(dt2) || isNumber(dt2) || dt2 instanceof Date ? new DateTime(dt2) : new DateTime();
2440
+
2441
+ // src/domain/values/EAN.ts
2442
+ var import_isEAN = __toESM(require("validator/lib/isEAN"));
2443
+ var EAN = class extends Value {
2444
+ get isValid() {
2445
+ return isEAN(this.value);
2446
+ }
2447
+ };
2448
+ var isEAN = (ean) => {
2449
+ return !isEmpty(ean) && (0, import_isEAN.default)(asString(ean));
2450
+ };
2451
+
2452
+ // src/domain/values/Email.ts
2453
+ var import_isEmail = __toESM(require("validator/lib/isEmail"));
2454
+ var Email = class extends Value {
2455
+ constructor(email2) {
2456
+ super(asString(email2).trim().toLowerCase());
2457
+ }
2458
+ get isValid() {
2459
+ return isEmail(this.value);
2460
+ }
2461
+ get name() {
2462
+ return text(this.value.split("@")[0]).replace(".", " ").title.toString();
2463
+ }
2464
+ };
2465
+ var email = (email2) => new Email(email2);
2466
+ var isEmail = (e) => !isEmpty(e) && (0, import_isEmail.default)(asString(e));
2467
+
2468
+ // src/domain/values/IBAN.ts
2469
+ var import_isIBAN = __toESM(require("validator/lib/isIBAN"));
2470
+ var IBAN = class extends Value {
2471
+ get isValid() {
2472
+ return isIBAN(this.value);
2473
+ }
2474
+ };
2475
+ var isIBAN = (iban) => {
2476
+ return !isEmpty(iban) && (0, import_isIBAN.default)(asString(iban));
2477
+ };
2478
+
2479
+ // src/domain/values/PostalCode.ts
2480
+ var import_isPostalCode = __toESM(require("validator/lib/isPostalCode"));
2481
+ var PostalCode = class extends Value {
2482
+ constructor(postalCode2, country = Country.NL) {
2483
+ super(text(postalCode2).replace(" ", "").toString());
2484
+ this.country = country;
2485
+ }
2486
+ get isValid() {
2487
+ return (0, import_isPostalCode.default)(this.value, this.country instanceof Country ? this.country.id : text(this.country).upper);
2488
+ }
2489
+ };
2490
+ var postalCode = (postalCode2, country = Country.NL) => new PostalCode(postalCode2, country);
2491
+
2492
+ // src/domain/values/Slug.ts
2493
+ var import_validator = require("validator");
2494
+ var Slug = class extends Value {
2495
+ constructor(slug) {
2496
+ super(text(slug).slug.toString());
2497
+ }
2498
+ get isValid() {
2499
+ return isNotEmpty(this.value) && (0, import_validator.isSlug)(this.value);
2500
+ }
2501
+ };
2502
+ var toSlug = (slug) => new Slug(slug);
2503
+
2504
+ // src/domain/values/Url.ts
2505
+ var import_isURL = __toESM(require("validator/lib/isURL"));
2506
+ var Url = class extends Value {
2507
+ constructor(value, options) {
2508
+ super(asString(value));
2509
+ this.options = options;
2510
+ }
2511
+ get isValid() {
2512
+ return isUrl(this.value, this.options);
2513
+ }
2514
+ };
2515
+ var url = (url2, options) => new Url(url2, options);
2516
+ var isUrl = (url2, options) => {
2517
+ return !isEmpty(url2) && (0, import_isURL.default)(asString(url2), options);
2518
+ };
2519
+
2520
+ // src/domain/structs/Address.ts
2521
+ var Address = class extends Struct {
2522
+ street = this.state.street;
2523
+ houseNumber = this.state.houseNumber;
2524
+ extension = this.state.extension;
2525
+ postalCode = postalCode(this.state.postalCode, this.state.country);
2526
+ city = this.state.city;
2527
+ country = Country.byId(this.state.country);
2528
+ toString() {
2529
+ return text(this.street).with(" ", this.houseNumber, this.extension).with(", ", text(this.postalCode).with(" ", this.city, this.country?.name)).toString();
2530
+ }
2531
+ };
2532
+ __decorateClass([
2533
+ required()
2534
+ ], Address.prototype, "street", 2);
2535
+ __decorateClass([
2536
+ required()
2537
+ ], Address.prototype, "houseNumber", 2);
2538
+ __decorateClass([
2539
+ valid()
2540
+ ], Address.prototype, "postalCode", 2);
2541
+ __decorateClass([
2542
+ required()
2543
+ ], Address.prototype, "city", 2);
2544
+ __decorateClass([
2545
+ required()
2546
+ ], Address.prototype, "country", 2);
2547
+ var isAddress = (a) => {
2548
+ return !isEmpty(a) && a instanceof Address;
2549
+ };
2550
+
2551
+ // src/domain/structs/Dimension.ts
2552
+ var _Dimension = class _Dimension extends Struct {
2553
+ value = this.state.value;
2554
+ uom = UnitOfMeasurement.byId(this.state.uom, UnitOfMeasurement.MM);
2555
+ static with = (value, uom = UnitOfMeasurement.MM) => new _Dimension({ value, uom });
2556
+ /**
2557
+ @deprecated use inMilliMeters getter instead
2558
+ */
2559
+ sizeInMM() {
2560
+ return this.inMilliMeters;
2561
+ }
2562
+ get inMilliMeters() {
2563
+ return this.value * this.uom.mmMultiplier;
2564
+ }
2565
+ gte(dim) {
2566
+ return this.inMilliMeters >= dim.inMilliMeters;
2567
+ }
2568
+ };
2569
+ __decorateClass([
2570
+ required()
2571
+ ], _Dimension.prototype, "value", 2);
2572
+ var Dimension = _Dimension;
2573
+
2574
+ // src/domain/structs/Box.ts
2575
+ var _Box = class _Box extends Struct {
2576
+ l = new Dimension(this.state.l);
2577
+ w = new Dimension(this.state.w);
2578
+ h = new Dimension(this.state.h);
2579
+ sorted = [this.l, this.w, this.h].sort((n1, n2) => n1.inMilliMeters - n2.inMilliMeters);
2580
+ lowestDim = this.sorted[0];
2581
+ medianDim = this.sorted[1];
2582
+ maxDim = this.sorted[2];
2583
+ get isValid() {
2584
+ return super.isValid && this.l.isValid && this.w.isValid && this.h.isValid;
2585
+ }
2586
+ static with = (l, w, h) => new _Box({ l, w, h });
2587
+ stack(qty) {
2588
+ return _Box.with(this.maxDim, this.medianDim, Dimension.with(this.lowestDim.value * qty, this.lowestDim.uom));
2589
+ }
2590
+ fits(contents, qty = 1) {
2591
+ const stackedContent = contents.stack(qty);
2592
+ return this.lowestDim.gte(stackedContent.lowestDim) && this.medianDim.gte(stackedContent.medianDim) && this.maxDim.gte(stackedContent.maxDim);
2593
+ }
2594
+ };
2595
+ __decorateClass([
2596
+ required()
2597
+ ], _Box.prototype, "l", 2);
2598
+ __decorateClass([
2599
+ required()
2600
+ ], _Box.prototype, "w", 2);
2601
+ __decorateClass([
2602
+ required()
2603
+ ], _Box.prototype, "h", 2);
2604
+ var Box = _Box;
2605
+
2606
+ // src/domain/structs/Money.ts
2607
+ var Money = class extends Struct {
2608
+ currency = Currency.byId(this.state.currency);
2609
+ value = this.state.value;
2610
+ add(amount) {
2611
+ return money(this.currency, this.value + amount);
2612
+ }
2613
+ subtract(amount) {
2614
+ return money(this.currency, this.value - amount);
2615
+ }
2616
+ times(n) {
2617
+ return money(this.currency, this.value * n);
2618
+ }
2619
+ toString() {
2620
+ return text(this.currency?.code).with(" ", this.value?.toFixed(this.currency?.digits ?? 2)).toString();
2621
+ }
2622
+ };
2623
+ __decorateClass([
2624
+ required()
2625
+ ], Money.prototype, "currency", 2);
2626
+ __decorateClass([
2627
+ required()
2628
+ ], Money.prototype, "value", 2);
2629
+ var money = (currency, value) => new Money({ currency: currency.id, value });
2630
+ var isMoney = (m) => {
2631
+ return !isEmpty(m) && m instanceof Money;
2632
+ };
2633
+
2634
+ // src/domain/structs/Name.ts
2635
+ var Name = class extends Struct {
2636
+ first = this.state.first;
2637
+ middle = this.state.middle;
2638
+ last = this.state.last;
2639
+ toString() {
2640
+ return text(this.first, "").add(this.middle, " ").add(this.last, " ").toString();
2641
+ }
2642
+ };
2643
+ __decorateClass([
2644
+ required()
2645
+ ], Name.prototype, "first", 2);
2646
+ __decorateClass([
2647
+ required()
2648
+ ], Name.prototype, "last", 2);
2649
+ var name = (n) => new Name(n);
2650
+
2651
+ // src/domain/structs/Weight.ts
2652
+ var Weight = class extends Struct {
2653
+ value = this.state.value;
2654
+ uow = UnitOfWeight.byId(this.state.uow, UnitOfWeight.G);
2655
+ /**
2656
+ @deprecated use inGrams getter instead
2657
+ */
2658
+ sizeInG() {
2659
+ return this.inGrams;
2660
+ }
2661
+ get inGrams() {
2662
+ return this.value * this.uow.gMultiplier;
2663
+ }
2664
+ gte(w) {
2665
+ return this.inGrams >= w.inGrams;
2666
+ }
2667
+ lte(w) {
2668
+ return this.inGrams <= w.inGrams;
2669
+ }
2670
+ between(lower, upper = weight(Number.MAX_VALUE, this.uow)) {
2671
+ return this.gte(lower) && this.lte(upper);
2672
+ }
2673
+ sum(add) {
2674
+ return weight((this.inGrams + add.inGrams) / this.uow.gMultiplier, this.uow);
2675
+ }
2676
+ };
2677
+ __decorateClass([
2678
+ required()
2679
+ ], Weight.prototype, "value", 2);
2680
+ var weight = (value, uow) => new Weight({ value, uow });
2681
+
2682
+ // src/domain/enums/Currency.ts
2683
+ var Currency = class _Currency extends Enum {
2684
+ constructor(id, name2, digits, code) {
2685
+ super(name2, id, code);
2686
+ this.digits = digits;
2687
+ }
2688
+ static EUR = new _Currency("EUR", "Euro", 2, "\u20AC");
2689
+ static USD = new _Currency("USD", "US Dollar", 2, "$");
2690
+ static AED = new _Currency("AED", "United Arab Emirates Dirham", 2, "AED");
2691
+ static AFN = new _Currency("AFN", "Afghan Afghani", 0, "Af");
2692
+ static ALL = new _Currency("ALL", "Albanian Lek", 0, "ALL");
2693
+ static AMD = new _Currency("AMD", "Armenian Dram", 0, "AMD");
2694
+ static ARS = new _Currency("ARS", "Argentine Peso", 2, "AR$");
2695
+ static AUD = new _Currency("AUD", "Australian Dollar", 2, "AU$");
2696
+ static AZN = new _Currency("AZN", "Azerbaijani Manat", 2, "man.");
2697
+ static BAM = new _Currency("BAM", "Bosnia-Herzegovina Convertible Mark", 2, "KM");
2698
+ static BDT = new _Currency("BDT", "Bangladeshi Taka", 2, "Tk");
2699
+ static BGN = new _Currency("BGN", "Bulgarian Lev", 2, "BGN");
2700
+ static BHD = new _Currency("BHD", "Bahraini Dinar", 3, "BD");
2701
+ static BIF = new _Currency("BIF", "Burundian Franc", 0, "FBu");
2702
+ static BND = new _Currency("BND", "Brunei Dollar", 2, "BN$");
2703
+ static BOB = new _Currency("BOB", "Bolivian Boliviano", 2, "Bs");
2704
+ static BRL = new _Currency("BRL", "Brazilian Real", 2, "R$");
2705
+ static BWP = new _Currency("BWP", "Botswanan Pula", 2, "BWP");
2706
+ static BYN = new _Currency("BYN", "Belarusian Ruble", 2, "Br");
2707
+ static BZD = new _Currency("BZD", "Belize Dollar", 2, "BZ$");
2708
+ static CAD = new _Currency("CAD", "Canadian Dollar", 2, "CA$");
2709
+ static CDF = new _Currency("CDF", "Congolese Franc", 2, "CDF");
2710
+ static CHF = new _Currency("CHF", "Swiss Franc", 2, "CHF");
2711
+ static CLP = new _Currency("CLP", "Chilean Peso", 0, "CL$");
2712
+ static CNY = new _Currency("CNY", "Chinese Yuan", 2, "CN\xA5");
2713
+ static COP = new _Currency("COP", "Colombian Peso", 0, "CO$");
2714
+ static CRC = new _Currency("CRC", "Costa Rican Col\xF3n", 0, "\u20A1");
2715
+ static CVE = new _Currency("CVE", "Cape Verdean Escudo", 2, "CV$");
2716
+ static CZK = new _Currency("CZK", "Czech Republic Koruna", 2, "K\u010D");
2717
+ static DJF = new _Currency("DJF", "Djiboutian Franc", 0, "Fdj");
2718
+ static DKK = new _Currency("DKK", "Danish Krone", 2, "Dkr");
2719
+ static DOP = new _Currency("DOP", "Dominican Peso", 2, "RD$");
2720
+ static DZD = new _Currency("DZD", "Algerian Dinar", 2, "DA");
2721
+ static EEK = new _Currency("EEK", "Estonian Kroon", 2, "Ekr");
2722
+ static EGP = new _Currency("EGP", "Egyptian Pound", 2, "EGP");
2723
+ static ERN = new _Currency("ERN", "Eritrean Nakfa", 2, "Nfk");
2724
+ static ETB = new _Currency("ETB", "Ethiopian Birr", 2, "Br");
2725
+ static GBP = new _Currency("GBP", "British Pound Sterling", 2, "\xA3");
2726
+ static GEL = new _Currency("GEL", "Georgian Lari", 2, "GEL");
2727
+ static GHS = new _Currency("GHS", "Ghanaian Cedi", 2, "GH\u20B5");
2728
+ static GNF = new _Currency("GNF", "Guinean Franc", 0, "FG");
2729
+ static GTQ = new _Currency("GTQ", "Guatemalan Quetzal", 2, "GTQ");
2730
+ static HKD = new _Currency("HKD", "Hong Kong Dollar", 2, "HK$");
2731
+ static HNL = new _Currency("HNL", "Honduran Lempira", 2, "HNL");
2732
+ static HRK = new _Currency("HRK", "Croatian Kuna", 2, "kn");
2733
+ static HUF = new _Currency("HUF", "Hungarian Forint", 0, "Ft");
2734
+ static IDR = new _Currency("IDR", "Indonesian Rupiah", 0, "Rp");
2735
+ static ILS = new _Currency("ILS", "Israeli New Sheqel", 2, "\u20AA");
2736
+ static INR = new _Currency("INR", "Indian Rupee", 2, "Rs");
2737
+ static IQD = new _Currency("IQD", "Iraqi Dinar", 0, "IQD");
2738
+ static IRR = new _Currency("IRR", "Iranian Rial", 0, "IRR");
2739
+ static ISK = new _Currency("ISK", "Icelandic Kr\xF3na", 0, "Ikr");
2740
+ static JMD = new _Currency("JMD", "Jamaican Dollar", 2, "J$");
2741
+ static JOD = new _Currency("JOD", "Jordanian Dinar", 3, "JD");
2742
+ static JPY = new _Currency("JPY", "Japanese Yen", 0, "\xA5");
2743
+ static KES = new _Currency("KES", "Kenyan Shilling", 2, "Ksh");
2744
+ static KHR = new _Currency("KHR", "Cambodian Riel", 2, "KHR");
2745
+ static KMF = new _Currency("KMF", "Comorian Franc", 0, "CF");
2746
+ static KRW = new _Currency("KRW", "South Korean Won", 0, "\u20A9");
2747
+ static KWD = new _Currency("KWD", "Kuwaiti Dinar", 3, "KD");
2748
+ static KZT = new _Currency("KZT", "Kazakhstani Tenge", 2, "KZT");
2749
+ static LBP = new _Currency("LBP", "Lebanese Pound", 0, "L.L.");
2750
+ static LKR = new _Currency("LKR", "Sri Lankan Rupee", 2, "SLRs");
2751
+ static LTL = new _Currency("LTL", "Lithuanian Litas", 2, "Lt");
2752
+ static LVL = new _Currency("LVL", "Latvian Lats", 2, "Ls");
2753
+ static LYD = new _Currency("LYD", "Libyan Dinar", 3, "LD");
2754
+ static MAD = new _Currency("MAD", "Moroccan Dirham", 2, "MAD");
2755
+ static MDL = new _Currency("MDL", "Moldovan Leu", 2, "MDL");
2756
+ static MGA = new _Currency("MGA", "Malagasy Ariary", 0, "MGA");
2757
+ static MKD = new _Currency("MKD", "Macedonian Denar", 2, "MKD");
2758
+ static MMK = new _Currency("MMK", "Myanma Kyat", 0, "MMK");
2759
+ static MOP = new _Currency("MOP", "Macanese Pataca", 2, "MOP$");
2760
+ static MUR = new _Currency("MUR", "Mauritian Rupee", 0, "MURs");
2761
+ static MXN = new _Currency("MXN", "Mexican Peso", 2, "MX$");
2762
+ static MYR = new _Currency("MYR", "Malaysian Ringgit", 2, "RM");
2763
+ static MZN = new _Currency("MZN", "Mozambican Metical", 2, "MTn");
2764
+ static NAD = new _Currency("NAD", "Namibian Dollar", 2, "N$");
2765
+ static NGN = new _Currency("NGN", "Nigerian Naira", 2, "\u20A6");
2766
+ static NIO = new _Currency("NIO", "Nicaraguan C\xF3rdoba", 2, "C$");
2767
+ static NOK = new _Currency("NOK", "Norwegian Krone", 2, "Nkr");
2768
+ static NPR = new _Currency("NPR", "Nepalese Rupee", 2, "NPRs");
2769
+ static NZD = new _Currency("NZD", "New Zealand Dollar", 2, "NZ$");
2770
+ static OMR = new _Currency("OMR", "Omani Rial", 3, "OMR");
2771
+ static PAB = new _Currency("PAB", "Panamanian Balboa", 2, "B/.");
2772
+ static PEN = new _Currency("PEN", "Peruvian Nuevo Sol", 2, "S/.");
2773
+ static PHP = new _Currency("PHP", "Philippine Peso", 2, "\u20B1");
2774
+ static PKR = new _Currency("PKR", "Pakistani Rupee", 0, "PKRs");
2775
+ static PLN = new _Currency("PLN", "Polish Zloty", 2, "z\u0142");
2776
+ static PYG = new _Currency("PYG", "Paraguayan Guarani", 0, "\u20B2");
2777
+ static QAR = new _Currency("QAR", "Qatari Rial", 2, "QR");
2778
+ static RON = new _Currency("RON", "Romanian Leu", 2, "RON");
2779
+ static RSD = new _Currency("RSD", "Serbian Dinar", 0, "din.");
2780
+ static RUB = new _Currency("RUB", "Russian Ruble", 2, "RUB");
2781
+ static RWF = new _Currency("RWF", "Rwandan Franc", 0, "RWF");
2782
+ static SAR = new _Currency("SAR", "Saudi Riyal", 2, "SR");
2783
+ static SDG = new _Currency("SDG", "Sudanese Pound", 2, "SDG");
2784
+ static SEK = new _Currency("SEK", "Swedish Krona", 2, "Skr");
2785
+ static SGD = new _Currency("SGD", "Singapore Dollar", 2, "S$");
2786
+ static SOS = new _Currency("SOS", "Somali Shilling", 0, "Ssh");
2787
+ static SYP = new _Currency("SYP", "Syrian Pound", 0, "SY\xA3");
2788
+ static THB = new _Currency("THB", "Thai Baht", 2, "\u0E3F");
2789
+ static TND = new _Currency("TND", "Tunisian Dinar", 3, "DT");
2790
+ static TOP = new _Currency("TOP", "Tongan Pa\u02BBanga", 2, "T$");
2791
+ static TRY = new _Currency("TRY", "Turkish Lira", 2, "TL");
2792
+ static TTD = new _Currency("TTD", "Trinidad and Tobago Dollar", 2, "TT$");
2793
+ static TWD = new _Currency("TWD", "New Taiwan Dollar", 2, "NT$");
2794
+ static TZS = new _Currency("TZS", "Tanzanian Shilling", 0, "TSh");
2795
+ static UAH = new _Currency("UAH", "Ukrainian Hryvnia", 2, "\u20B4");
2796
+ static UGX = new _Currency("UGX", "Ugandan Shilling", 0, "USh");
2797
+ static UYU = new _Currency("UYU", "Uruguayan Peso", 2, "$U");
2798
+ static UZS = new _Currency("UZS", "Uzbekistan Som", 0, "UZS");
2799
+ static VEF = new _Currency("VEF", "Venezuelan Bol\xEDvar", 2, "Bs.F.");
2800
+ static VND = new _Currency("VND", "Vietnamese Dong", 0, "\u20AB");
2801
+ static XAF = new _Currency("XAF", "CFA Franc BEAC", 0, "FCFA");
2802
+ static XOF = new _Currency("XOF", "CFA Franc BCEAO", 0, "CFA");
2803
+ static YER = new _Currency("YER", "Yemeni Rial", 0, "YR");
2804
+ static ZAR = new _Currency("ZAR", "South African Rand", 2, "R");
2805
+ static ZMK = new _Currency("ZMK", "Zambian Kwacha", 0, "ZK");
2806
+ static ZWL = new _Currency("ZWL", "Zimbabwean Dollar", 0, "ZWL$");
2807
+ amount = (amount = 0) => money(this, amount);
2808
+ get zero() {
2809
+ return this.amount();
2810
+ }
2811
+ };
2812
+
2813
+ // src/domain/enums/Environment.ts
2814
+ var Environment = class _Environment extends Enum {
2815
+ static Dev = new _Environment("Development", "dev");
2816
+ static Tst = new _Environment("Test", "tst");
2817
+ static Acc = new _Environment("Acceptance", "acc");
2818
+ static Prd = new _Environment("Production", "prd");
2819
+ };
2820
+
2821
+ // src/domain/enums/Locale.ts
2822
+ var Locale = class _Locale extends Enum {
2823
+ constructor(id, name2, country = text(id).lower.last(2).toString(), lower = text(id).lower.trim.toString()) {
2824
+ super(name2, id);
2825
+ this.country = country;
2826
+ this.lower = lower;
2827
+ }
2828
+ static AF = new _Locale("af", "Afrikaans");
2829
+ static AF_NA = new _Locale("af_NA", "Afrikaans (Namibia)");
2830
+ static AF_ZA = new _Locale("af_ZA", "Afrikaans (South Africa)");
2831
+ static AK = new _Locale("ak", "Akan");
2832
+ static AK_GH = new _Locale("ak_GH", "Akan (Ghana)");
2833
+ static SQ = new _Locale("sq", "Albanian");
2834
+ static SQ_AL = new _Locale("sq_AL", "Albanian (Albania)");
2835
+ static SQ_XK = new _Locale("sq_XK", "Albanian (Kosovo)");
2836
+ static SQ_MK = new _Locale("sq_MK", "Albanian (Macedonia)");
2837
+ static AM = new _Locale("am", "Amharic");
2838
+ static AM_ET = new _Locale("am_ET", "Amharic (Ethiopia)");
2839
+ static AR = new _Locale("ar", "Arabic");
2840
+ static AR_DZ = new _Locale("ar_DZ", "Arabic (Algeria)");
2841
+ static AR_BH = new _Locale("ar_BH", "Arabic (Bahrain)");
2842
+ static AR_TD = new _Locale("ar_TD", "Arabic (Chad)");
2843
+ static AR_KM = new _Locale("ar_KM", "Arabic (Comoros)");
2844
+ static AR_DJ = new _Locale("ar_DJ", "Arabic (Djibouti)");
2845
+ static AR_EG = new _Locale("ar_EG", "Arabic (Egypt)");
2846
+ static AR_ER = new _Locale("ar_ER", "Arabic (Eritrea)");
2847
+ static AR_IQ = new _Locale("ar_IQ", "Arabic (Iraq)");
2848
+ static AR_IL = new _Locale("ar_IL", "Arabic (Israel)");
2849
+ static AR_JO = new _Locale("ar_JO", "Arabic (Jordan)");
2850
+ static AR_KW = new _Locale("ar_KW", "Arabic (Kuwait)");
2851
+ static AR_LB = new _Locale("ar_LB", "Arabic (Lebanon)");
2852
+ static AR_LY = new _Locale("ar_LY", "Arabic (Libya)");
2853
+ static AR_MR = new _Locale("ar_MR", "Arabic (Mauritania)");
2854
+ static AR_MA = new _Locale("ar_MA", "Arabic (Morocco)");
2855
+ static AR_OM = new _Locale("ar_OM", "Arabic (Oman)");
2856
+ static AR_PS = new _Locale("ar_PS", "Arabic (Palestinian Territories)");
2857
+ static AR_QA = new _Locale("ar_QA", "Arabic (Qatar)");
2858
+ static AR_SA = new _Locale("ar_SA", "Arabic (Saudi Arabia)");
2859
+ static AR_SO = new _Locale("ar_SO", "Arabic (Somalia)");
2860
+ static AR_SS = new _Locale("ar_SS", "Arabic (South Sudan)");
2861
+ static AR_SD = new _Locale("ar_SD", "Arabic (Sudan)");
2862
+ static AR_SY = new _Locale("ar_SY", "Arabic (Syria)");
2863
+ static AR_TN = new _Locale("ar_TN", "Arabic (Tunisia)");
2864
+ static AR_AE = new _Locale("ar_AE", "Arabic (United Arab Emirates)");
2865
+ static AR_EH = new _Locale("ar_EH", "Arabic (Western Sahara)");
2866
+ static AR_YE = new _Locale("ar_YE", "Arabic (Yemen)");
2867
+ static HY = new _Locale("hy", "Armenian");
2868
+ static HY_AM = new _Locale("hy_AM", "Armenian (Armenia)");
2869
+ static AS = new _Locale("as", "Assamese");
2870
+ static AS_IN = new _Locale("as_IN", "Assamese (India)");
2871
+ static AZ = new _Locale("az", "Azerbaijani");
2872
+ static AZ_AZ = new _Locale("az_AZ", "Azerbaijani (Azerbaijan)");
2873
+ static AZ_CYRL_AZ = new _Locale("az_Cyrl_AZ", "Azerbaijani (Cyrillic, Azerbaijan)");
2874
+ static AZ_CYRL = new _Locale("az_Cyrl", "Azerbaijani (Cyrillic)", "az");
2875
+ static AZ_LATN_AZ = new _Locale("az_Latn_AZ", "Azerbaijani (Latin, Azerbaijan)");
2876
+ static AZ_LATN = new _Locale("az_Latn", "Azerbaijani (Latin)", "az");
2877
+ static BM = new _Locale("bm", "Bambara");
2878
+ static BM_LATN_ML = new _Locale("bm_Latn_ML", "Bambara (Latin, Mali)");
2879
+ static BM_LATN = new _Locale("bm_Latn", "Bambara (Latin)", "bm");
2880
+ static EU = new _Locale("eu", "Basque");
2881
+ static EU_ES = new _Locale("eu_ES", "Basque (Spain)");
2882
+ static BE = new _Locale("be", "Belarusian");
2883
+ static BE_BY = new _Locale("be_BY", "Belarusian (Belarus)");
2884
+ static BN = new _Locale("bn", "Bengali");
2885
+ static BN_BD = new _Locale("bn_BD", "Bengali (Bangladesh)");
2886
+ static BN_IN = new _Locale("bn_IN", "Bengali (India)");
2887
+ static BS = new _Locale("bs", "Bosnian");
2888
+ static BS_BA = new _Locale("bs_BA", "Bosnian (Bosnia & Herzegovina)");
2889
+ static BS_CYRL_BA = new _Locale("bs_Cyrl_BA", "Bosnian (Cyrillic, Bosnia & Herzegovina)");
2890
+ static BS_CYRL = new _Locale("bs_Cyrl", "Bosnian (Cyrillic)", "bs");
2891
+ static BS_LATN_BA = new _Locale("bs_Latn_BA", "Bosnian (Latin, Bosnia & Herzegovina)");
2892
+ static BS_LATN = new _Locale("bs_Latn", "Bosnian (Latin)", "bs");
2893
+ static BR = new _Locale("br", "Breton");
2894
+ static BR_FR = new _Locale("br_FR", "Breton (France)");
2895
+ static BG = new _Locale("bg", "Bulgarian");
2896
+ static BG_BG = new _Locale("bg_BG", "Bulgarian (Bulgaria)");
2897
+ static MY = new _Locale("my", "Burmese");
2898
+ static MY_MM = new _Locale("my_MM", "Burmese (Myanmar (Burma))");
2899
+ static CA = new _Locale("ca", "Catalan");
2900
+ static CA_AD = new _Locale("ca_AD", "Catalan (Andorra)");
2901
+ static CA_FR = new _Locale("ca_FR", "Catalan (France)");
2902
+ static CA_IT = new _Locale("ca_IT", "Catalan (Italy)");
2903
+ static CA_ES = new _Locale("ca_ES", "Catalan (Spain)");
2904
+ static ZH = new _Locale("zh", "Chinese");
2905
+ static ZH_CN = new _Locale("zh_CN", "Chinese (China)");
2906
+ static ZH_HK = new _Locale("zh_HK", "Chinese (Hong Kong SAR China)");
2907
+ static ZH_MO = new _Locale("zh_MO", "Chinese (Macau SAR China)");
2908
+ static ZH_HANS_CN = new _Locale("zh_Hans_CN", "Chinese (Simplified, China)");
2909
+ static ZH_HANS_HK = new _Locale("zh_Hans_HK", "Chinese (Simplified, Hong Kong SAR China)");
2910
+ static ZH_HANS_MO = new _Locale("zh_Hans_MO", "Chinese (Simplified, Macau SAR China)");
2911
+ static ZH_HANS_SG = new _Locale("zh_Hans_SG", "Chinese (Simplified, Singapore)");
2912
+ static ZH_HANS = new _Locale("zh_Hans", "Chinese (Simplified)");
2913
+ static ZH_SG = new _Locale("zh_SG", "Chinese (Singapore)");
2914
+ static ZH_TW = new _Locale("zh_TW", "Chinese (Taiwan)");
2915
+ static ZH_HANT_HK = new _Locale("zh_Hant_HK", "Chinese (Traditional, Hong Kong SAR China)");
2916
+ static ZH_HANT_MO = new _Locale("zh_Hant_MO", "Chinese (Traditional, Macau SAR China)");
2917
+ static ZH_HANT_TW = new _Locale("zh_Hant_TW", "Chinese (Traditional, Taiwan)");
2918
+ static ZH_HANT = new _Locale("zh_Hant", "Chinese (Traditional)");
2919
+ static KW = new _Locale("kw", "Cornish");
2920
+ static KW_GB = new _Locale("kw_GB", "Cornish (United Kingdom)");
2921
+ static HR = new _Locale("hr", "Croatian");
2922
+ static HR_BA = new _Locale("hr_BA", "Croatian (Bosnia & Herzegovina)");
2923
+ static HR_HR = new _Locale("hr_HR", "Croatian (Croatia)");
2924
+ static CS = new _Locale("cs", "Czech");
2925
+ static CS_CZ = new _Locale("cs_CZ", "Czech (Czech Republic)");
2926
+ static DA = new _Locale("da", "Danish");
2927
+ static DA_DK = new _Locale("da_DK", "Danish (Denmark)");
2928
+ static DA_GL = new _Locale("da_GL", "Danish (Greenland)");
2929
+ static NL = new _Locale("nl", "Dutch");
2930
+ static NL_AW = new _Locale("nl_AW", "Dutch (Aruba)");
2931
+ static NL_BE = new _Locale("nl_BE", "Dutch (Belgium)");
2932
+ static NL_BQ = new _Locale("nl_BQ", "Dutch (Caribbean Netherlands)");
2933
+ static NL_CW = new _Locale("nl_CW", "Dutch (Cura\xE7ao)");
2934
+ static NL_NL = new _Locale("nl_NL", "Dutch (Netherlands)");
2935
+ static NL_SX = new _Locale("nl_SX", "Dutch (Sint Maarten)");
2936
+ static NL_SR = new _Locale("nl_SR", "Dutch (Suriname)");
2937
+ static DZ = new _Locale("dz", "Dzongkha");
2938
+ static DZ_BT = new _Locale("dz_BT", "Dzongkha (Bhutan)");
2939
+ static EN = new _Locale("en", "English", "gb");
2940
+ static EN_AS = new _Locale("en_AS", "English (American Samoa)");
2941
+ static EN_AI = new _Locale("en_AI", "English (Anguilla)");
2942
+ static EN_AG = new _Locale("en_AG", "English (Antigua & Barbuda)");
2943
+ static EN_AU = new _Locale("en_AU", "English (Australia)");
2944
+ static EN_BS = new _Locale("en_BS", "English (Bahamas)");
2945
+ static EN_BB = new _Locale("en_BB", "English (Barbados)");
2946
+ static EN_BE = new _Locale("en_BE", "English (Belgium)");
2947
+ static EN_BZ = new _Locale("en_BZ", "English (Belize)");
2948
+ static EN_BM = new _Locale("en_BM", "English (Bermuda)");
2949
+ static EN_BW = new _Locale("en_BW", "English (Botswana)");
2950
+ static EN_IO = new _Locale("en_IO", "English (British Indian Ocean Territory)");
2951
+ static EN_VG = new _Locale("en_VG", "English (British Virgin Islands)");
2952
+ static EN_CM = new _Locale("en_CM", "English (Cameroon)");
2953
+ static EN_CA = new _Locale("en_CA", "English (Canada)");
2954
+ static EN_KY = new _Locale("en_KY", "English (Cayman Islands)");
2955
+ static EN_CX = new _Locale("en_CX", "English (Christmas Island)");
2956
+ static EN_CC = new _Locale("en_CC", "English (Cocos (Keeling) Islands)");
2957
+ static EN_CK = new _Locale("en_CK", "English (Cook Islands)");
2958
+ static EN_DG = new _Locale("en_DG", "English (Diego Garcia)");
2959
+ static EN_DM = new _Locale("en_DM", "English (Dominica)");
2960
+ static EN_ER = new _Locale("en_ER", "English (Eritrea)");
2961
+ static EN_FK = new _Locale("en_FK", "English (Falkland Islands)");
2962
+ static EN_FJ = new _Locale("en_FJ", "English (Fiji)");
2963
+ static EN_GM = new _Locale("en_GM", "English (Gambia)");
2964
+ static EN_GH = new _Locale("en_GH", "English (Ghana)");
2965
+ static EN_GI = new _Locale("en_GI", "English (Gibraltar)");
2966
+ static EN_GD = new _Locale("en_GD", "English (Grenada)");
2967
+ static EN_GU = new _Locale("en_GU", "English (Guam)");
2968
+ static EN_GG = new _Locale("en_GG", "English (Guernsey)");
2969
+ static EN_GY = new _Locale("en_GY", "English (Guyana)");
2970
+ static EN_HK = new _Locale("en_HK", "English (Hong Kong SAR China)");
2971
+ static EN_IN = new _Locale("en_IN", "English (India)");
2972
+ static EN_IE = new _Locale("en_IE", "English (Ireland)");
2973
+ static EN_IM = new _Locale("en_IM", "English (Isle of Man)");
2974
+ static EN_JM = new _Locale("en_JM", "English (Jamaica)");
2975
+ static EN_JE = new _Locale("en_JE", "English (Jersey)");
2976
+ static EN_KE = new _Locale("en_KE", "English (Kenya)");
2977
+ static EN_KI = new _Locale("en_KI", "English (Kiribati)");
2978
+ static EN_LS = new _Locale("en_LS", "English (Lesotho)");
2979
+ static EN_LR = new _Locale("en_LR", "English (Liberia)");
2980
+ static EN_MO = new _Locale("en_MO", "English (Macau SAR China)");
2981
+ static EN_MG = new _Locale("en_MG", "English (Madagascar)");
2982
+ static EN_MW = new _Locale("en_MW", "English (Malawi)");
2983
+ static EN_MY = new _Locale("en_MY", "English (Malaysia)");
2984
+ static EN_MT = new _Locale("en_MT", "English (Malta)");
2985
+ static EN_MH = new _Locale("en_MH", "English (Marshall Islands)");
2986
+ static EN_MU = new _Locale("en_MU", "English (Mauritius)");
2987
+ static EN_FM = new _Locale("en_FM", "English (Micronesia)");
2988
+ static EN_MS = new _Locale("en_MS", "English (Montserrat)");
2989
+ static EN_NA = new _Locale("en_NA", "English (Namibia)");
2990
+ static EN_NR = new _Locale("en_NR", "English (Nauru)");
2991
+ static EN_NZ = new _Locale("en_NZ", "English (New Zealand)");
2992
+ static EN_NG = new _Locale("en_NG", "English (Nigeria)");
2993
+ static EN_NU = new _Locale("en_NU", "English (Niue)");
2994
+ static EN_NF = new _Locale("en_NF", "English (Norfolk Island)");
2995
+ static EN_MP = new _Locale("en_MP", "English (Northern Mariana Islands)");
2996
+ static EN_PK = new _Locale("en_PK", "English (Pakistan)");
2997
+ static EN_PW = new _Locale("en_PW", "English (Palau)");
2998
+ static EN_PG = new _Locale("en_PG", "English (Papua New Guinea)");
2999
+ static EN_PH = new _Locale("en_PH", "English (Philippines)");
3000
+ static EN_PN = new _Locale("en_PN", "English (Pitcairn Islands)");
3001
+ static EN_PR = new _Locale("en_PR", "English (Puerto Rico)");
3002
+ static EN_RW = new _Locale("en_RW", "English (Rwanda)");
3003
+ static EN_WS = new _Locale("en_WS", "English (Samoa)");
3004
+ static EN_SC = new _Locale("en_SC", "English (Seychelles)");
3005
+ static EN_SL = new _Locale("en_SL", "English (Sierra Leone)");
3006
+ static EN_SG = new _Locale("en_SG", "English (Singapore)");
3007
+ static EN_SX = new _Locale("en_SX", "English (Sint Maarten)");
3008
+ static EN_SB = new _Locale("en_SB", "English (Solomon Islands)");
3009
+ static EN_ZA = new _Locale("en_ZA", "English (South Africa)");
3010
+ static EN_SS = new _Locale("en_SS", "English (South Sudan)");
3011
+ static EN_SH = new _Locale("en_SH", "English (St. Helena)");
3012
+ static EN_KN = new _Locale("en_KN", "English (St. Kitts & Nevis)");
3013
+ static EN_LC = new _Locale("en_LC", "English (St. Lucia)");
3014
+ static EN_VC = new _Locale("en_VC", "English (St. Vincent & Grenadines)");
3015
+ static EN_SD = new _Locale("en_SD", "English (Sudan)");
3016
+ static EN_SZ = new _Locale("en_SZ", "English (Swaziland)");
3017
+ static EN_TZ = new _Locale("en_TZ", "English (Tanzania)");
3018
+ static EN_TK = new _Locale("en_TK", "English (Tokelau)");
3019
+ static EN_TO = new _Locale("en_TO", "English (Tonga)");
3020
+ static EN_TT = new _Locale("en_TT", "English (Trinidad & Tobago)");
3021
+ static EN_TC = new _Locale("en_TC", "English (Turks & Caicos Islands)");
3022
+ static EN_TV = new _Locale("en_TV", "English (Tuvalu)");
3023
+ static EN_UM = new _Locale("en_UM", "English (U.S. Outlying Islands)");
3024
+ static EN_VI = new _Locale("en_VI", "English (U.S. Virgin Islands)");
3025
+ static EN_UG = new _Locale("en_UG", "English (Uganda)");
3026
+ static EN_GB = new _Locale("en_GB", "English (United Kingdom)");
3027
+ static EN_US = new _Locale("en_US", "English (United States)");
3028
+ static EN_VU = new _Locale("en_VU", "English (Vanuatu)");
3029
+ static EN_ZM = new _Locale("en_ZM", "English (Zambia)");
3030
+ static EN_ZW = new _Locale("en_ZW", "English (Zimbabwe)");
3031
+ static EO = new _Locale("eo", "Esperanto");
3032
+ static ET = new _Locale("et", "Estonian");
3033
+ static ET_EE = new _Locale("et_EE", "Estonian (Estonia)");
3034
+ static EE = new _Locale("ee", "Ewe");
3035
+ static EE_GH = new _Locale("ee_GH", "Ewe (Ghana)");
3036
+ static EE_TG = new _Locale("ee_TG", "Ewe (Togo)");
3037
+ static FO = new _Locale("fo", "Faroese");
3038
+ static FO_FO = new _Locale("fo_FO", "Faroese (Faroe Islands)");
3039
+ static FI = new _Locale("fi", "Finnish");
3040
+ static FI_FI = new _Locale("fi_FI", "Finnish (Finland)");
3041
+ static FR = new _Locale("fr", "French");
3042
+ static FR_DZ = new _Locale("fr_DZ", "French (Algeria)");
3043
+ static FR_BE = new _Locale("fr_BE", "French (Belgium)");
3044
+ static FR_BJ = new _Locale("fr_BJ", "French (Benin)");
3045
+ static FR_BF = new _Locale("fr_BF", "French (Burkina Faso)");
3046
+ static FR_BI = new _Locale("fr_BI", "French (Burundi)");
3047
+ static FR_CM = new _Locale("fr_CM", "French (Cameroon)");
3048
+ static FR_CA = new _Locale("fr_CA", "French (Canada)");
3049
+ static FR_CF = new _Locale("fr_CF", "French (Central African Republic)");
3050
+ static FR_TD = new _Locale("fr_TD", "French (Chad)");
3051
+ static FR_KM = new _Locale("fr_KM", "French (Comoros)");
3052
+ static FR_CG = new _Locale("fr_CG", "French (Congo - Brazzaville)");
3053
+ static FR_CD = new _Locale("fr_CD", "French (Congo - Kinshasa)");
3054
+ static FR_CI = new _Locale("fr_CI", "French (C\xF4te d\u2019Ivoire)");
3055
+ static FR_DJ = new _Locale("fr_DJ", "French (Djibouti)");
3056
+ static FR_GQ = new _Locale("fr_GQ", "French (Equatorial Guinea)");
3057
+ static FR_FR = new _Locale("fr_FR", "French (France)");
3058
+ static FR_GF = new _Locale("fr_GF", "French (French Guiana)");
3059
+ static FR_PF = new _Locale("fr_PF", "French (French Polynesia)");
3060
+ static FR_GA = new _Locale("fr_GA", "French (Gabon)");
3061
+ static FR_GP = new _Locale("fr_GP", "French (Guadeloupe)");
3062
+ static FR_GN = new _Locale("fr_GN", "French (Guinea)");
3063
+ static FR_HT = new _Locale("fr_HT", "French (Haiti)");
3064
+ static FR_LU = new _Locale("fr_LU", "French (Luxembourg)");
3065
+ static FR_MG = new _Locale("fr_MG", "French (Madagascar)");
3066
+ static FR_ML = new _Locale("fr_ML", "French (Mali)");
3067
+ static FR_MQ = new _Locale("fr_MQ", "French (Martinique)");
3068
+ static FR_MR = new _Locale("fr_MR", "French (Mauritania)");
3069
+ static FR_MU = new _Locale("fr_MU", "French (Mauritius)");
3070
+ static FR_YT = new _Locale("fr_YT", "French (Mayotte)");
3071
+ static FR_MC = new _Locale("fr_MC", "French (Monaco)");
3072
+ static FR_MA = new _Locale("fr_MA", "French (Morocco)");
3073
+ static FR_NC = new _Locale("fr_NC", "French (New Caledonia)");
3074
+ static FR_NE = new _Locale("fr_NE", "French (Niger)");
3075
+ static FR_RE = new _Locale("fr_RE", "French (R\xE9union)");
3076
+ static FR_RW = new _Locale("fr_RW", "French (Rwanda)");
3077
+ static FR_SN = new _Locale("fr_SN", "French (Senegal)");
3078
+ static FR_SC = new _Locale("fr_SC", "French (Seychelles)");
3079
+ static FR_BL = new _Locale("fr_BL", "French (St. Barth\xE9lemy)");
3080
+ static FR_MF = new _Locale("fr_MF", "French (St. Martin)");
3081
+ static FR_PM = new _Locale("fr_PM", "French (St. Pierre & Miquelon)");
3082
+ static FR_CH = new _Locale("fr_CH", "French (Switzerland)");
3083
+ static FR_SY = new _Locale("fr_SY", "French (Syria)");
3084
+ static FR_TG = new _Locale("fr_TG", "French (Togo)");
3085
+ static FR_TN = new _Locale("fr_TN", "French (Tunisia)");
3086
+ static FR_VU = new _Locale("fr_VU", "French (Vanuatu)");
3087
+ static FR_WF = new _Locale("fr_WF", "French (Wallis & Futuna)");
3088
+ static FF = new _Locale("ff", "Fulah");
3089
+ static FF_CM = new _Locale("ff_CM", "Fulah (Cameroon)");
3090
+ static FF_GN = new _Locale("ff_GN", "Fulah (Guinea)");
3091
+ static FF_MR = new _Locale("ff_MR", "Fulah (Mauritania)");
3092
+ static FF_SN = new _Locale("ff_SN", "Fulah (Senegal)");
3093
+ static GL = new _Locale("gl", "Galician");
3094
+ static GL_ES = new _Locale("gl_ES", "Galician (Spain)");
3095
+ static LG = new _Locale("lg", "Ganda");
3096
+ static LG_UG = new _Locale("lg_UG", "Ganda (Uganda)");
3097
+ static KA = new _Locale("ka", "Georgian");
3098
+ static KA_GE = new _Locale("ka_GE", "Georgian (Georgia)");
3099
+ static DE = new _Locale("de", "German");
3100
+ static DE_AT = new _Locale("de_AT", "German (Austria)");
3101
+ static DE_BE = new _Locale("de_BE", "German (Belgium)");
3102
+ static DE_DE = new _Locale("de_DE", "German (Germany)");
3103
+ static DE_LI = new _Locale("de_LI", "German (Liechtenstein)");
3104
+ static DE_LU = new _Locale("de_LU", "German (Luxembourg)");
3105
+ static DE_CH = new _Locale("de_CH", "German (Switzerland)");
3106
+ static EL = new _Locale("el", "Greek");
3107
+ static EL_CY = new _Locale("el_CY", "Greek (Cyprus)");
3108
+ static EL_GR = new _Locale("el_GR", "Greek (Greece)");
3109
+ static GU = new _Locale("gu", "Gujarati");
3110
+ static GU_IN = new _Locale("gu_IN", "Gujarati (India)");
3111
+ static HA = new _Locale("ha", "Hausa");
3112
+ static HA_GH = new _Locale("ha_GH", "Hausa (Ghana)");
3113
+ static HA_LATN_GH = new _Locale("ha_Latn_GH", "Hausa (Latin, Ghana)");
3114
+ static HA_LATN_NE = new _Locale("ha_Latn_NE", "Hausa (Latin, Niger)");
3115
+ static HA_LATN_NG = new _Locale("ha_Latn_NG", "Hausa (Latin, Nigeria)");
3116
+ static HA_LATN = new _Locale("ha_Latn", "Hausa (Latin)");
3117
+ static HA_NE = new _Locale("ha_NE", "Hausa (Niger)");
3118
+ static HA_NG = new _Locale("ha_NG", "Hausa (Nigeria)");
3119
+ static HE = new _Locale("he", "Hebrew");
3120
+ static HE_IL = new _Locale("he_IL", "Hebrew (Israel)");
3121
+ static HI = new _Locale("hi", "Hindi");
3122
+ static HI_IN = new _Locale("hi_IN", "Hindi (India)");
3123
+ static HU = new _Locale("hu", "Hungarian");
3124
+ static HU_HU = new _Locale("hu_HU", "Hungarian (Hungary)");
3125
+ static IS = new _Locale("is", "Icelandic");
3126
+ static IS_IS = new _Locale("is_IS", "Icelandic (Iceland)");
3127
+ static IG = new _Locale("ig", "Igbo");
3128
+ static IG_NG = new _Locale("ig_NG", "Igbo (Nigeria)");
3129
+ static ID = new _Locale("id", "Indonesian");
3130
+ static ID_ID = new _Locale("id_ID", "Indonesian (Indonesia)");
3131
+ static GA = new _Locale("ga", "Irish");
3132
+ static GA_IE = new _Locale("ga_IE", "Irish (Ireland)");
3133
+ static IT = new _Locale("it", "Italian");
3134
+ static IT_IT = new _Locale("it_IT", "Italian (Italy)");
3135
+ static IT_SM = new _Locale("it_SM", "Italian (San Marino)");
3136
+ static IT_CH = new _Locale("it_CH", "Italian (Switzerland)");
3137
+ static JA = new _Locale("ja", "Japanese");
3138
+ static JA_JP = new _Locale("ja_JP", "Japanese (Japan)");
3139
+ static KL = new _Locale("kl", "Kalaallisut");
3140
+ static KL_GL = new _Locale("kl_GL", "Kalaallisut (Greenland)");
3141
+ static KN = new _Locale("kn", "Kannada");
3142
+ static KN_IN = new _Locale("kn_IN", "Kannada (India)");
3143
+ static KS = new _Locale("ks", "Kashmiri");
3144
+ static KS_ARAB_IN = new _Locale("ks_Arab_IN", "Kashmiri (Arabic, India)");
3145
+ static KS_ARAB = new _Locale("ks_Arab", "Kashmiri (Arabic)", "ks");
3146
+ static KS_IN = new _Locale("ks_IN", "Kashmiri (India)");
3147
+ static KK = new _Locale("kk", "Kazakh");
3148
+ static KK_CYRL_KZ = new _Locale("kk_Cyrl_KZ", "Kazakh (Cyrillic, Kazakhstan)");
3149
+ static KK_CYRL = new _Locale("kk_Cyrl", "Kazakh (Cyrillic)", "kk");
3150
+ static KK_KZ = new _Locale("kk_KZ", "Kazakh (Kazakhstan)");
3151
+ static KM = new _Locale("km", "Khmer");
3152
+ static KM_KH = new _Locale("km_KH", "Khmer (Cambodia)");
3153
+ static KI = new _Locale("ki", "Kikuyu");
3154
+ static KI_KE = new _Locale("ki_KE", "Kikuyu (Kenya)");
3155
+ static RW = new _Locale("rw", "Kinyarwanda");
3156
+ static RW_RW = new _Locale("rw_RW", "Kinyarwanda (Rwanda)");
3157
+ static KO = new _Locale("ko", "Korean");
3158
+ static KO_KP = new _Locale("ko_KP", "Korean (North Korea)");
3159
+ static KO_KR = new _Locale("ko_KR", "Korean (South Korea)");
3160
+ static KY = new _Locale("ky", "Kyrgyz");
3161
+ static KY_CYRL_KG = new _Locale("ky_Cyrl_KG", "Kyrgyz (Cyrillic, Kyrgyzstan)");
3162
+ static KY_CYRL = new _Locale("ky_Cyrl", "Kyrgyz (Cyrillic)", "ky");
3163
+ static KY_KG = new _Locale("ky_KG", "Kyrgyz (Kyrgyzstan)");
3164
+ static LO = new _Locale("lo", "Lao");
3165
+ static LO_LA = new _Locale("lo_LA", "Lao (Laos)");
3166
+ static LV = new _Locale("lv", "Latvian");
3167
+ static LV_LV = new _Locale("lv_LV", "Latvian (Latvia)");
3168
+ static LN = new _Locale("ln", "Lingala");
3169
+ static LN_AO = new _Locale("ln_AO", "Lingala (Angola)");
3170
+ static LN_CF = new _Locale("ln_CF", "Lingala (Central African Republic)");
3171
+ static LN_CG = new _Locale("ln_CG", "Lingala (Congo - Brazzaville)");
3172
+ static LN_CD = new _Locale("ln_CD", "Lingala (Congo - Kinshasa)");
3173
+ static LT = new _Locale("lt", "Lithuanian");
3174
+ static LT_LT = new _Locale("lt_LT", "Lithuanian (Lithuania)");
3175
+ static LU = new _Locale("lu", "Luba-Katanga");
3176
+ static LU_CD = new _Locale("lu_CD", "Luba-Katanga (Congo - Kinshasa)");
3177
+ static LB = new _Locale("lb", "Luxembourgish");
3178
+ static LB_LU = new _Locale("lb_LU", "Luxembourgish (Luxembourg)");
3179
+ static MK = new _Locale("mk", "Macedonian");
3180
+ static MK_MK = new _Locale("mk_MK", "Macedonian (Macedonia)");
3181
+ static MG = new _Locale("mg", "Malagasy");
3182
+ static MG_MG = new _Locale("mg_MG", "Malagasy (Madagascar)");
3183
+ static MS = new _Locale("ms", "Malay");
3184
+ static MS_BN = new _Locale("ms_BN", "Malay (Brunei)");
3185
+ static MS_LATN_BN = new _Locale("ms_Latn_BN", "Malay (Latin, Brunei)");
3186
+ static MS_LATN_MY = new _Locale("ms_Latn_MY", "Malay (Latin, Malaysia)");
3187
+ static MS_LATN_SG = new _Locale("ms_Latn_SG", "Malay (Latin, Singapore)");
3188
+ static MS_LATN = new _Locale("ms_Latn", "Malay (Latin)", "ms");
3189
+ static MS_MY = new _Locale("ms_MY", "Malay (Malaysia)");
3190
+ static MS_SG = new _Locale("ms_SG", "Malay (Singapore)");
3191
+ static ML = new _Locale("ml", "Malayalam");
3192
+ static ML_IN = new _Locale("ml_IN", "Malayalam (India)");
3193
+ static MT = new _Locale("mt", "Maltese");
3194
+ static MT_MT = new _Locale("mt_MT", "Maltese (Malta)");
3195
+ static GV = new _Locale("gv", "Manx");
3196
+ static GV_IM = new _Locale("gv_IM", "Manx (Isle of Man)");
3197
+ static MR = new _Locale("mr", "Marathi");
3198
+ static MR_IN = new _Locale("mr_IN", "Marathi (India)");
3199
+ static MN = new _Locale("mn", "Mongolian");
3200
+ static MN_CYRL_MN = new _Locale("mn_Cyrl_MN", "Mongolian (Cyrillic, Mongolia)");
3201
+ static MN_CYRL = new _Locale("mn_Cyrl", "Mongolian (Cyrillic)", "mn");
3202
+ static MN_MN = new _Locale("mn_MN", "Mongolian (Mongolia)");
3203
+ static NE = new _Locale("ne", "Nepali");
3204
+ static NE_IN = new _Locale("ne_IN", "Nepali (India)");
3205
+ static NE_NP = new _Locale("ne_NP", "Nepali (Nepal)");
3206
+ static ND = new _Locale("nd", "North Ndebele");
3207
+ static ND_ZW = new _Locale("nd_ZW", "North Ndebele (Zimbabwe)");
3208
+ static SE = new _Locale("se", "Northern Sami");
3209
+ static SE_FI = new _Locale("se_FI", "Northern Sami (Finland)");
3210
+ static SE_NO = new _Locale("se_NO", "Northern Sami (Norway)");
3211
+ static SE_SE = new _Locale("se_SE", "Northern Sami (Sweden)");
3212
+ static NO = new _Locale("no", "Norwegian");
3213
+ static NO_NO = new _Locale("no_NO", "Norwegian (Norway)");
3214
+ static NB = new _Locale("nb", "Norwegian Bokm\xE5l");
3215
+ static NB_NO = new _Locale("nb_NO", "Norwegian Bokm\xE5l (Norway)");
3216
+ static NB_SJ = new _Locale("nb_SJ", "Norwegian Bokm\xE5l (Svalbard & Jan Mayen)");
3217
+ static NN = new _Locale("nn", "Norwegian Nynorsk");
3218
+ static NN_NO = new _Locale("nn_NO", "Norwegian Nynorsk (Norway)");
3219
+ static OR = new _Locale("or", "Oriya");
3220
+ static OR_IN = new _Locale("or_IN", "Oriya (India)");
3221
+ static OM = new _Locale("om", "Oromo");
3222
+ static OM_ET = new _Locale("om_ET", "Oromo (Ethiopia)");
3223
+ static OM_KE = new _Locale("om_KE", "Oromo (Kenya)");
3224
+ static OS = new _Locale("os", "Ossetic");
3225
+ static OS_GE = new _Locale("os_GE", "Ossetic (Georgia)");
3226
+ static OS_RU = new _Locale("os_RU", "Ossetic (Russia)");
3227
+ static PS = new _Locale("ps", "Pashto");
3228
+ static PS_AF = new _Locale("ps_AF", "Pashto (Afghanistan)");
3229
+ static FA = new _Locale("fa", "Persian");
3230
+ static FA_AF = new _Locale("fa_AF", "Persian (Afghanistan)");
3231
+ static FA_IR = new _Locale("fa_IR", "Persian (Iran)");
3232
+ static PL = new _Locale("pl", "Polish");
3233
+ static PL_PL = new _Locale("pl_PL", "Polish (Poland)");
3234
+ static PT = new _Locale("pt", "Portuguese");
3235
+ static PT_AO = new _Locale("pt_AO", "Portuguese (Angola)");
3236
+ static PT_BR = new _Locale("pt_BR", "Portuguese (Brazil)");
3237
+ static PT_CV = new _Locale("pt_CV", "Portuguese (Cape Verde)");
3238
+ static PT_GW = new _Locale("pt_GW", "Portuguese (Guinea-Bissau)");
3239
+ static PT_MO = new _Locale("pt_MO", "Portuguese (Macau SAR China)");
3240
+ static PT_MZ = new _Locale("pt_MZ", "Portuguese (Mozambique)");
3241
+ static PT_PT = new _Locale("pt_PT", "Portuguese (Portugal)");
3242
+ static PT_ST = new _Locale("pt_ST", "Portuguese (S\xE3o Tom\xE9 & Pr\xEDncipe)");
3243
+ static PT_TL = new _Locale("pt_TL", "Portuguese (Timor-Leste)");
3244
+ static PA = new _Locale("pa", "Punjabi");
3245
+ static PA_ARAB_PK = new _Locale("pa_Arab_PK", "Punjabi (Arabic, Pakistan)");
3246
+ static PA_ARAB = new _Locale("pa_Arab", "Punjabi (Arabic)", "pa");
3247
+ static PA_GURU_IN = new _Locale("pa_Guru_IN", "Punjabi (Gurmukhi, India)");
3248
+ static PA_GURU = new _Locale("pa_Guru", "Punjabi (Gurmukhi)", "pa");
3249
+ static PA_IN = new _Locale("pa_IN", "Punjabi (India)");
3250
+ static PA_PK = new _Locale("pa_PK", "Punjabi (Pakistan)");
3251
+ static QU = new _Locale("qu", "Quechua");
3252
+ static QU_BO = new _Locale("qu_BO", "Quechua (Bolivia)");
3253
+ static QU_EC = new _Locale("qu_EC", "Quechua (Ecuador)");
3254
+ static QU_PE = new _Locale("qu_PE", "Quechua (Peru)");
3255
+ static RO = new _Locale("ro", "Romanian");
3256
+ static RO_MD = new _Locale("ro_MD", "Romanian (Moldova)");
3257
+ static RO_RO = new _Locale("ro_RO", "Romanian (Romania)");
3258
+ static RM = new _Locale("rm", "Romansh");
3259
+ static RM_CH = new _Locale("rm_CH", "Romansh (Switzerland)");
3260
+ static RN = new _Locale("rn", "Rundi");
3261
+ static RN_BI = new _Locale("rn_BI", "Rundi (Burundi)");
3262
+ static RU = new _Locale("ru", "Russian");
3263
+ static RU_BY = new _Locale("ru_BY", "Russian (Belarus)");
3264
+ static RU_KZ = new _Locale("ru_KZ", "Russian (Kazakhstan)");
3265
+ static RU_KG = new _Locale("ru_KG", "Russian (Kyrgyzstan)");
3266
+ static RU_MD = new _Locale("ru_MD", "Russian (Moldova)");
3267
+ static RU_RU = new _Locale("ru_RU", "Russian (Russia)");
3268
+ static RU_UA = new _Locale("ru_UA", "Russian (Ukraine)");
3269
+ static SG = new _Locale("sg", "Sango");
3270
+ static SG_CF = new _Locale("sg_CF", "Sango (Central African Republic)");
3271
+ static GD = new _Locale("gd", "Scottish Gaelic");
3272
+ static GD_GB = new _Locale("gd_GB", "Scottish Gaelic (United Kingdom)");
3273
+ static SR = new _Locale("sr", "Serbian");
3274
+ static SR_BA = new _Locale("sr_BA", "Serbian (Bosnia & Herzegovina)");
3275
+ static SR_CYRL_BA = new _Locale("sr_Cyrl_BA", "Serbian (Cyrillic, Bosnia & Herzegovina)");
3276
+ static SR_CYRL_XK = new _Locale("sr_Cyrl_XK", "Serbian (Cyrillic, Kosovo)");
3277
+ static SR_CYRL_ME = new _Locale("sr_Cyrl_ME", "Serbian (Cyrillic, Montenegro)");
3278
+ static SR_CYRL_RS = new _Locale("sr_Cyrl_RS", "Serbian (Cyrillic, Serbia)");
3279
+ static SR_CYRL = new _Locale("sr_Cyrl", "Serbian (Cyrillic)", "sr");
3280
+ static SR_XK = new _Locale("sr_XK", "Serbian (Kosovo)");
3281
+ static SR_LATN_BA = new _Locale("sr_Latn_BA", "Serbian (Latin, Bosnia & Herzegovina)");
3282
+ static SR_LATN_XK = new _Locale("sr_Latn_XK", "Serbian (Latin, Kosovo)");
3283
+ static SR_LATN_ME = new _Locale("sr_Latn_ME", "Serbian (Latin, Montenegro)");
3284
+ static SR_LATN_RS = new _Locale("sr_Latn_RS", "Serbian (Latin, Serbia)");
3285
+ static SR_LATN = new _Locale("sr_Latn", "Serbian (Latin)", "sr");
3286
+ static SR_ME = new _Locale("sr_ME", "Serbian (Montenegro)");
3287
+ static SR_RS = new _Locale("sr_RS", "Serbian (Serbia)");
3288
+ static SH = new _Locale("sh", "Serbo-Croatian");
3289
+ static SH_BA = new _Locale("sh_BA", "Serbo-Croatian (Bosnia & Herzegovina)");
3290
+ static SN = new _Locale("sn", "Shona");
3291
+ static SN_ZW = new _Locale("sn_ZW", "Shona (Zimbabwe)");
3292
+ static II = new _Locale("ii", "Sichuan Yi");
3293
+ static II_CN = new _Locale("ii_CN", "Sichuan Yi (China)");
3294
+ static SI = new _Locale("si", "Sinhala");
3295
+ static SI_LK = new _Locale("si_LK", "Sinhala (Sri Lanka)");
3296
+ static SK = new _Locale("sk", "Slovak");
3297
+ static SK_SK = new _Locale("sk_SK", "Slovak (Slovakia)");
3298
+ static SL = new _Locale("sl", "Slovenian");
3299
+ static SL_SI = new _Locale("sl_SI", "Slovenian (Slovenia)");
3300
+ static SO = new _Locale("so", "Somali");
3301
+ static SO_DJ = new _Locale("so_DJ", "Somali (Djibouti)");
3302
+ static SO_ET = new _Locale("so_ET", "Somali (Ethiopia)");
3303
+ static SO_KE = new _Locale("so_KE", "Somali (Kenya)");
3304
+ static SO_SO = new _Locale("so_SO", "Somali (Somalia)");
3305
+ static ES = new _Locale("es", "Spanish");
3306
+ static ES_AR = new _Locale("es_AR", "Spanish (Argentina)");
3307
+ static ES_BO = new _Locale("es_BO", "Spanish (Bolivia)");
3308
+ static ES_IC = new _Locale("es_IC", "Spanish (Canary Islands)");
3309
+ static ES_EA = new _Locale("es_EA", "Spanish (Ceuta & Melilla)");
3310
+ static ES_CL = new _Locale("es_CL", "Spanish (Chile)");
3311
+ static ES_CO = new _Locale("es_CO", "Spanish (Colombia)");
3312
+ static ES_CR = new _Locale("es_CR", "Spanish (Costa Rica)");
3313
+ static ES_CU = new _Locale("es_CU", "Spanish (Cuba)");
3314
+ static ES_DO = new _Locale("es_DO", "Spanish (Dominican Republic)");
3315
+ static ES_EC = new _Locale("es_EC", "Spanish (Ecuador)");
3316
+ static ES_SV = new _Locale("es_SV", "Spanish (El Salvador)");
3317
+ static ES_GQ = new _Locale("es_GQ", "Spanish (Equatorial Guinea)");
3318
+ static ES_GT = new _Locale("es_GT", "Spanish (Guatemala)");
3319
+ static ES_HN = new _Locale("es_HN", "Spanish (Honduras)");
3320
+ static ES_MX = new _Locale("es_MX", "Spanish (Mexico)");
3321
+ static ES_NI = new _Locale("es_NI", "Spanish (Nicaragua)");
3322
+ static ES_PA = new _Locale("es_PA", "Spanish (Panama)");
3323
+ static ES_PY = new _Locale("es_PY", "Spanish (Paraguay)");
3324
+ static ES_PE = new _Locale("es_PE", "Spanish (Peru)");
3325
+ static ES_PH = new _Locale("es_PH", "Spanish (Philippines)");
3326
+ static ES_PR = new _Locale("es_PR", "Spanish (Puerto Rico)");
3327
+ static ES_ES = new _Locale("es_ES", "Spanish (Spain)");
3328
+ static ES_US = new _Locale("es_US", "Spanish (United States)");
3329
+ static ES_UY = new _Locale("es_UY", "Spanish (Uruguay)");
3330
+ static ES_VE = new _Locale("es_VE", "Spanish (Venezuela)");
3331
+ static SW = new _Locale("sw", "Swahili");
3332
+ static SW_KE = new _Locale("sw_KE", "Swahili (Kenya)");
3333
+ static SW_TZ = new _Locale("sw_TZ", "Swahili (Tanzania)");
3334
+ static SW_UG = new _Locale("sw_UG", "Swahili (Uganda)");
3335
+ static SV = new _Locale("sv", "Swedish");
3336
+ static SV_AX = new _Locale("sv_AX", "Swedish (\xC5land Islands)");
3337
+ static SV_FI = new _Locale("sv_FI", "Swedish (Finland)");
3338
+ static SV_SE = new _Locale("sv_SE", "Swedish (Sweden)");
3339
+ static TL = new _Locale("tl", "Tagalog");
3340
+ static TL_PH = new _Locale("tl_PH", "Tagalog (Philippines)");
3341
+ static TA = new _Locale("ta", "Tamil");
3342
+ static TA_IN = new _Locale("ta_IN", "Tamil (India)");
3343
+ static TA_MY = new _Locale("ta_MY", "Tamil (Malaysia)");
3344
+ static TA_SG = new _Locale("ta_SG", "Tamil (Singapore)");
3345
+ static TA_LK = new _Locale("ta_LK", "Tamil (Sri Lanka)");
3346
+ static TE = new _Locale("te", "Telugu");
3347
+ static TE_IN = new _Locale("te_IN", "Telugu (India)");
3348
+ static TH = new _Locale("th", "Thai");
3349
+ static TH_TH = new _Locale("th_TH", "Thai (Thailand)");
3350
+ static BO = new _Locale("bo", "Tibetan");
3351
+ static BO_CN = new _Locale("bo_CN", "Tibetan (China)");
3352
+ static BO_IN = new _Locale("bo_IN", "Tibetan (India)");
3353
+ static TI = new _Locale("ti", "Tigrinya");
3354
+ static TI_ER = new _Locale("ti_ER", "Tigrinya (Eritrea)");
3355
+ static TI_ET = new _Locale("ti_ET", "Tigrinya (Ethiopia)");
3356
+ static TO = new _Locale("to", "Tongan");
3357
+ static TO_TO = new _Locale("to_TO", "Tongan (Tonga)");
3358
+ static TR = new _Locale("tr", "Turkish");
3359
+ static TR_CY = new _Locale("tr_CY", "Turkish (Cyprus)");
3360
+ static TR_TR = new _Locale("tr_TR", "Turkish (Turkey)");
3361
+ static UK = new _Locale("uk", "Ukrainian");
3362
+ static UK_UA = new _Locale("uk_UA", "Ukrainian (Ukraine)");
3363
+ static UR = new _Locale("ur", "Urdu");
3364
+ static UR_IN = new _Locale("ur_IN", "Urdu (India)");
3365
+ static UR_PK = new _Locale("ur_PK", "Urdu (Pakistan)");
3366
+ static UG = new _Locale("ug", "Uyghur");
3367
+ static UG_ARAB_CN = new _Locale("ug_Arab_CN", "Uyghur (Arabic, China)");
3368
+ static UG_ARAB = new _Locale("ug_Arab", "Uyghur (Arabic)");
3369
+ static UG_CN = new _Locale("ug_CN", "Uyghur (China)");
3370
+ static UZ = new _Locale("uz", "Uzbek");
3371
+ static UZ_AF = new _Locale("uz_AF", "Uzbek (Afghanistan)");
3372
+ static UZ_ARAB_AF = new _Locale("uz_Arab_AF", "Uzbek (Arabic, Afghanistan)");
3373
+ static UZ_ARAB = new _Locale("uz_Arab", "Uzbek (Arabic)", "uz");
3374
+ static UZ_CYRL_UZ = new _Locale("uz_Cyrl_UZ", "Uzbek (Cyrillic, Uzbekistan)");
3375
+ static UZ_CYRL = new _Locale("uz_Cyrl", "Uzbek (Cyrillic)", "uz");
3376
+ static UZ_LATN_UZ = new _Locale("uz_Latn_UZ", "Uzbek (Latin, Uzbekistan)");
3377
+ static UZ_LATN = new _Locale("uz_Latn", "Uzbek (Latin)", "uz");
3378
+ static UZ_UZ = new _Locale("uz_UZ", "Uzbek (Uzbekistan)");
3379
+ static VI = new _Locale("vi", "Vietnamese");
3380
+ static VI_VN = new _Locale("vi_VN", "Vietnamese (Vietnam)");
3381
+ static CY = new _Locale("cy", "Welsh");
3382
+ static CY_GB = new _Locale("cy_GB", "Welsh (United Kingdom)");
3383
+ static FY = new _Locale("fy", "Western Frisian");
3384
+ static FY_NL = new _Locale("fy_NL", "Western Frisian (Netherlands)");
3385
+ static YI = new _Locale("yi", "Yiddish");
3386
+ static YO = new _Locale("yo", "Yoruba");
3387
+ static YO_BJ = new _Locale("yo_BJ", "Yoruba (Benin)");
3388
+ static YO_NG = new _Locale("yo_NG", "Yoruba (Nigeria)");
3389
+ static ZU = new _Locale("zu", "Zulu");
3390
+ static ZU_ZA = new _Locale("zu_ZA", "Zulu (South Africa)");
3391
+ static lookup(other) {
3392
+ return this.all().first((l) => l.equals(other));
3393
+ }
3394
+ equals(other) {
3395
+ return text(other).lower.trim.equals(this.lower);
3396
+ }
3397
+ };
3398
+
3399
+ // src/domain/enums/UnitOfMeasurement.ts
3400
+ var UnitOfMeasurement = class _UnitOfMeasurement extends Enum {
3401
+ constructor(name2, id, mmMultiplier) {
3402
+ super(name2, id);
3403
+ this.mmMultiplier = mmMultiplier;
3404
+ }
3405
+ static MM = new _UnitOfMeasurement("Millimeter", "mm", 1);
3406
+ static CM = new _UnitOfMeasurement("Centimeter", "cm", 10);
3407
+ static DM = new _UnitOfMeasurement("Decimeter", "dm", 100);
3408
+ static M = new _UnitOfMeasurement("Meter", "m", 1e3);
3409
+ static KM = new _UnitOfMeasurement("Kilometer", "km", 1e6);
3410
+ };
3411
+
3412
+ // src/domain/enums/UnitOfWeight.ts
3413
+ var UnitOfWeight = class _UnitOfWeight extends Enum {
3414
+ constructor(name2, id, gMultiplier) {
3415
+ super(name2, id);
3416
+ this.gMultiplier = gMultiplier;
3417
+ }
3418
+ static MG = new _UnitOfWeight("MilliGram", "mg", 1e-3);
3419
+ static G = new _UnitOfWeight("Gram", "g", 1);
3420
+ static KG = new _UnitOfWeight("Kilogram", "kg", 1e3);
3421
+ };
3422
+
3423
+ // src/domain/Audit.ts
3424
+ var Audit = class extends Struct {
3425
+ by = { id: this.state.by.id, user: this.state.by.user };
3426
+ when = new DateTime(this.state.when);
3427
+ constructor(json2) {
3428
+ super(
3429
+ choose(json2).is.defined(
3430
+ (j) => j,
3431
+ (j) => j
3432
+ ).else({ by: ctx.request?.identity ?? { id: 0, user: "easy" }, when: DateTime.now.toJSON() })
3433
+ );
3434
+ }
3435
+ };
3436
+ __decorateClass([
3437
+ required()
3438
+ ], Audit.prototype, "by", 2);
3439
+ __decorateClass([
3440
+ valid()
3441
+ ], Audit.prototype, "when", 2);
3442
+
3443
+ // src/domain/Child.ts
3444
+ var Child = class extends Struct {
3445
+ id = this.state.id ?? toId();
3446
+ merge(a) {
3447
+ return json.merge(this, a, { id: this.id });
3448
+ }
3449
+ };
3450
+ __decorateClass([
3451
+ required()
3452
+ ], Child.prototype, "id", 2);
3453
+
3454
+ // src/domain/Entity.ts
3455
+ var Entity = class extends Struct {
3456
+ id = this.state.id ?? toId();
3457
+ created = new Audit(this.state.created);
3458
+ lastModified = new Audit(this.state.lastModified);
3459
+ merge(a) {
3460
+ return json.merge(this, a, {
3461
+ id: this.id,
3462
+ created: this.created,
3463
+ lastModified: new Audit()
3464
+ });
3465
+ }
3466
+ };
3467
+ __decorateClass([
3468
+ required()
3469
+ ], Entity.prototype, "id", 2);
3470
+ __decorateClass([
3471
+ required()
3472
+ ], Entity.prototype, "created", 2);
3473
+ __decorateClass([
3474
+ required()
3475
+ ], Entity.prototype, "lastModified", 2);
3476
+
3477
+ // src/domain/Repo.ts
3478
+ var Repo = class extends Repository {
3479
+ constructor(ctor, gateway) {
3480
+ super();
3481
+ this.ctor = ctor;
3482
+ this.gateway = gateway;
3483
+ }
3484
+ create = (item) => isValidatable(item) ? item : new this.ctor(item);
3485
+ all(options) {
3486
+ return this.gateway.all(options).then((js) => js.map((i) => new this.ctor(i)));
3487
+ }
3488
+ byId(id) {
3489
+ return this.gateway.byId(id).then((j) => when(j).not.isDefined.reject(Exception.DoesNotExist)).then((j) => new this.ctor(j));
3490
+ }
3491
+ byIds(...ids) {
3492
+ return this.gateway.byIds(...ids).then((j) => asList(this.ctor, j));
3493
+ }
3494
+ byKey(key, options) {
3495
+ return this.gateway.by("key", key, options).then((js) => js.map((i) => new this.ctor(i)));
3496
+ }
3497
+ by(key, value, options) {
3498
+ return this.gateway.by(key.toString(), value, options).then((js) => js.map((i) => new this.ctor(i)));
3499
+ }
3500
+ search(q, options) {
3501
+ return this.gateway.search(q, options).then((js) => js.map((i) => new this.ctor(i)));
3502
+ }
3503
+ filter(options) {
3504
+ return this.gateway.filter(options).then((js) => js.map((i) => new this.ctor(i)));
3505
+ }
3506
+ exists(id) {
3507
+ return this.gateway.exists(id);
3508
+ }
3509
+ add(t) {
3510
+ return this.extend(this.create(t), "add").then((i) => when(i).not.isValid.reject()).then((i) => this.validate(i, "add")).then((i) => this.gateway.add(toJson(i))).then((j) => new this.ctor(j));
3511
+ }
3512
+ update(id, json2) {
3513
+ return this.gateway.byId(id).then((j) => when(j).not.isDefined.reject(Exception.DoesNotExist)).then((j) => new this.ctor(j).update(json2)).then((i) => this.extend(i, "update")).then((i) => when(i).not.isValid.reject()).then((i) => this.validate(i, "update")).then((i) => this.gateway.update(toJson(i))).then((j) => new this.ctor(j));
3514
+ }
3515
+ remove(id) {
3516
+ return this.gateway.remove(id);
3517
+ }
3518
+ extend(item, _action) {
3519
+ return resolve(item);
3520
+ }
3521
+ validate(item, _action) {
3522
+ return resolve(item);
3523
+ }
3524
+ upsert(id, item) {
3525
+ return this.update(id, item).catch((e) => Exception.DoesNotExist.equals(e) ? this.add(item) : reject(e));
3526
+ }
3527
+ };
3528
+
3529
+ // src/domain/Typo.ts
3530
+ var Typo = class extends Repository {
3531
+ constructor(view2, gateway) {
3532
+ super();
3533
+ this.view = view2;
3534
+ this.gateway = gateway;
3535
+ }
3536
+ create = (j) => this.view.from(j);
3537
+ all(options) {
3538
+ return this.gateway.all(options).then((js) => js.map(this.create));
3539
+ }
3540
+ byId(id) {
3541
+ return this.gateway.byId(id).then((j) => when(j).not.isDefined.reject(Exception.DoesNotExist)).then((j) => this.create(j));
3542
+ }
3543
+ byIds(...ids) {
3544
+ return this.gateway.byIds(...ids).then((js) => js.map(this.create));
3545
+ }
3546
+ byKey(key, options) {
3547
+ return this.gateway.by("key", key, options).then((js) => js.map(this.create));
3548
+ }
3549
+ by(key, value, options) {
3550
+ return this.gateway.by(key.toString(), value, options).then((js) => js.map(this.create));
3551
+ }
3552
+ search(q, options) {
3553
+ return this.gateway.search(q, options).then((js) => js.map(this.create));
3554
+ }
3555
+ filter(options) {
3556
+ return this.gateway.filter(options).then((js) => js.map((j) => this.create(j)));
3557
+ }
3558
+ exists(id) {
3559
+ return this.gateway.exists(id);
3560
+ }
3561
+ };
3562
+
3563
+ // src/http/CacheControl.ts
3564
+ var CacheControl = class _CacheControl {
3565
+ constructor(enabled = true, directives = {}) {
3566
+ this.enabled = enabled;
3567
+ this.directives = directives;
3568
+ }
3569
+ name = "Cache-Control";
3570
+ static disabled = () => new _CacheControl(false);
3571
+ static OneSecond = () => new _CacheControl().maxAge(1).staleWhileRevalidate(1);
3572
+ static fiveSeconds = () => new _CacheControl().maxAge(5).staleWhileRevalidate(5);
3573
+ static tenSeconds = () => new _CacheControl().maxAge(10).staleWhileRevalidate(10);
3574
+ static thirtySeconds = () => new _CacheControl().maxAge(30).staleWhileRevalidate(30);
3575
+ static sixtySeconds = () => new _CacheControl().maxAge(60).staleWhileRevalidate(60);
3576
+ static custom = (maxAge, staleWhileRevalidate) => new _CacheControl().maxAge(maxAge).staleWhileRevalidate(staleWhileRevalidate);
3577
+ maxAge = (ca) => on(this, (t) => t.directives["max-age"] = ca);
3578
+ sharedMaxAge = (ca) => on(this, (t) => t.directives["s-maxage"] = ca);
3579
+ noCache = (a) => on(this, (t) => t.directives["no-cache"] = a);
3580
+ mustRevalidate = (a) => on(this, (t) => t.directives["must-revalidate"] = a);
3581
+ private = (a) => on(this, (t) => t.directives["private"] = a);
3582
+ public = (a) => on(this, (t) => t.directives["public"] = a);
3583
+ immutable = (a) => on(this, (t) => t.directives["immutable"] = a);
3584
+ staleWhileRevalidate = (ca) => on(this, (t) => t.directives["stale-while-revalidate"] = ca);
3585
+ value = () => this.toString();
3586
+ toString() {
3587
+ return entries(this.directives).mapDefined(([k, v]) => ifDefined(v, isNumber(v) ? `${k}=${cacheAge.toSeconds(v)}` : k)).join(",");
3588
+ }
3589
+ };
3590
+
3591
+ // src/http/ContentType.ts
3592
+ var import_form_urlencoded = __toESM(require("form-urlencoded"));
3593
+ var ContentType = class _ContentType extends Enum {
3594
+ constructor(name2, type, encoder = (b) => asString(b)) {
3595
+ super(name2, type);
3596
+ this.type = type;
3597
+ this.encoder = encoder;
3598
+ }
3599
+ static Form = new _ContentType("form", "application/x-www-form-urlencoded", (b) => (0, import_form_urlencoded.default)(b));
3600
+ static Json = new _ContentType("json", "application/json", (b) => b);
3601
+ static Stream = new _ContentType("stream", "application/octet-stream");
3602
+ static Text = new _ContentType("text", "text/plain");
3603
+ static Xml = new _ContentType("xml", "application/xml");
3604
+ encode = (body) => ofGet(this.encoder, body);
3605
+ };
3606
+
3607
+ // src/http/HttpHeader.ts
3608
+ var HttpHeader = {
3609
+ ContentType: "Content-Type",
3610
+ Correlation: "X-Correlation-Id"
3611
+ };
3612
+
3613
+ // src/http/HttpStatus.ts
3614
+ var HttpStatus = class _HttpStatus extends Enum {
3615
+ static Continue = new _HttpStatus("Continue", 100);
3616
+ static SwitchingProtocols = new _HttpStatus("Switching protocols", 101);
3617
+ static Processing = new _HttpStatus("Processing", 102);
3618
+ static EarlyHints = new _HttpStatus("Early hints", 103);
3619
+ static Ok = new _HttpStatus("Ok", 200);
3620
+ static Created = new _HttpStatus("Created", 201);
3621
+ static Accepted = new _HttpStatus("Accepted", 202);
3622
+ static NonAuthoritativeInformation = new _HttpStatus("Non-authoritative information", 203);
3623
+ static NoContent = new _HttpStatus("No content", 204);
3624
+ static ResetContent = new _HttpStatus("Reset content", 205);
3625
+ static PartialContent = new _HttpStatus("Partial content", 206);
3626
+ static MultiStatus = new _HttpStatus("Multi-status", 207);
3627
+ static AlreadyReported = new _HttpStatus("Already reported", 208);
3628
+ static ImUsed = new _HttpStatus("IM used", 226);
3629
+ static MultipleChoices = new _HttpStatus("Multiple Choices", 300);
3630
+ static MovedPermanently = new _HttpStatus("Moved Permanently", 301);
3631
+ static Found = new _HttpStatus("Found", 302);
3632
+ static SeeOther = new _HttpStatus("See other", 303);
3633
+ static NotModified = new _HttpStatus("Not modified", 304);
3634
+ static UseProxy = new _HttpStatus("Use proxy", 305);
3635
+ static SwitchProxy = new _HttpStatus("Switch proxy", 306);
3636
+ static TemporaryRedirect = new _HttpStatus("Temporary redirect", 307);
3637
+ static PermanentRedirect = new _HttpStatus("Permanent redirect", 308);
3638
+ static BadRequest = new _HttpStatus("Bad request", 400);
3639
+ static NotAuthorized = new _HttpStatus("Not authorized", 401);
3640
+ static PaymentRequired = new _HttpStatus("Payment required", 402);
3641
+ static Forbidden = new _HttpStatus("Forbidden", 403);
3642
+ static NotFound = new _HttpStatus("Not found", 404);
3643
+ static MethodNotAllowed = new _HttpStatus("Method not allowed", 405);
3644
+ static NotAcceptable = new _HttpStatus("Not acceptable", 406);
3645
+ static ProxyAuthenticationRequired = new _HttpStatus("Proxy authentication required", 407);
3646
+ static RequestTimeout = new _HttpStatus("Request timeout", 408);
3647
+ static Conflict = new _HttpStatus("Conflict", 409);
3648
+ static Gone = new _HttpStatus("Gone", 410);
3649
+ static LengthRequired = new _HttpStatus("Length required", 411);
3650
+ static PreconditionFailed = new _HttpStatus("Precondition failed", 412);
3651
+ static PayloadTooLarge = new _HttpStatus("Payload too large", 413);
3652
+ static UriTooLong = new _HttpStatus("URI too long", 414);
3653
+ static UnsupportedMediaType = new _HttpStatus("Unsupported media type", 415);
3654
+ static RangeNotSatisfiable = new _HttpStatus("Range not satisfiable", 416);
3655
+ static ExpectationFailed = new _HttpStatus("Expectation failed", 417);
3656
+ static ImATeapot = new _HttpStatus("I'm a teapot", 418);
3657
+ static MisdirectedRequest = new _HttpStatus("Misdirected request", 421);
3658
+ static UnprocessableEntity = new _HttpStatus("Unprocessable entity", 422);
3659
+ static Locked = new _HttpStatus("Locked", 423);
3660
+ static FailedDependency = new _HttpStatus("Failed dependency", 424);
3661
+ static TooEarly = new _HttpStatus("Too early", 425);
3662
+ static UpgradeRequired = new _HttpStatus("Upgrade required", 426);
3663
+ static PreconditionRequired = new _HttpStatus("Precondition required", 428);
3664
+ static TooManyRequests = new _HttpStatus("Too many requests", 429);
3665
+ static RequestHeaderFieldsTooLarge = new _HttpStatus("Request header fields too large", 431);
3666
+ static UnavailableForLegalReasons = new _HttpStatus("Unavailable for legal reasons", 451);
3667
+ static InternalServerError = new _HttpStatus("Internal server error", 500);
3668
+ static NotImplemented = new _HttpStatus("Not implemented", 501);
3669
+ static BadGateway = new _HttpStatus("Bad gateway", 502);
3670
+ static ServiceUnavailable = new _HttpStatus("Service unavailable", 503);
3671
+ static GatewayTimeout = new _HttpStatus("Gateway timeout", 504);
3672
+ static HTTPVersionNotSupported = new _HttpStatus("Http version not supported", 505);
3673
+ static VariantAlsoNegotiates = new _HttpStatus("Variant also negotiates", 506);
3674
+ static InsufficientStorage = new _HttpStatus("Insufficient storage", 507);
3675
+ static LoopDetected = new _HttpStatus("Loop detected", 508);
3676
+ static NotExtended = new _HttpStatus("Not extended", 510);
3677
+ static NetworkAuthenticationRequired = new _HttpStatus("Network authentication required", 511);
3678
+ get isError() {
3679
+ return this.isClientError || this.isServerError;
3680
+ }
3681
+ get isClientError() {
3682
+ return this.id >= 400 && this.id < 500;
3683
+ }
3684
+ get isServerError() {
3685
+ return this.id >= 500 && this.id < 600;
3686
+ }
3687
+ get status() {
3688
+ return this.id;
3689
+ }
3690
+ };
3691
+ var isHttpStatus = (s) => isAn(s, "id", "status");
3692
+ var toHttpStatus = (s) => isHttpStatus(s) ? s : HttpStatus.byId(s);
3693
+
3694
+ // src/http/HttpVerb.ts
3695
+ var HttpVerb = class _HttpVerb extends Enum {
3696
+ static Get = new _HttpVerb("Get");
3697
+ static Put = new _HttpVerb("Put");
3698
+ static Patch = new _HttpVerb("Patch");
3699
+ static Post = new _HttpVerb("Post");
3700
+ static Delete = new _HttpVerb("Delete");
3701
+ constructor(name2) {
3702
+ super(name2, name2.toLowerCase(), name2.toUpperCase());
3703
+ }
3704
+ };
3705
+
3706
+ // src/http/OriginatedError.ts
3707
+ var OriginatedError = class extends Error {
3708
+ constructor(origin, options) {
3709
+ super();
3710
+ this.origin = origin;
3711
+ this.options = options;
3712
+ if (isError(origin))
3713
+ this.stack = origin.stack;
3714
+ }
3715
+ };
3716
+ var isOriginatedError = (e) => isError(e) && e instanceof OriginatedError;
3717
+ var toOriginatedError = (e, options) => isOriginatedError(e) ? e : new OriginatedError(e, options);
3718
+
3719
+ // src/http/RequestOptions.ts
3720
+ var toPageOptions = (options) => options instanceof RequestOptions ? options.pageOptions : options;
3721
+ var RequestOptions = class _RequestOptions extends Enum {
3722
+ constructor(type = ContentType.Json, headers = {}, pageOptions) {
3723
+ super(type.name);
3724
+ this.type = type;
3725
+ this.headers = headers;
3726
+ this.pageOptions = pageOptions;
3727
+ this.headers["Content-Type"] = type.id;
3728
+ this.headers[HttpHeader.Correlation] = ctx.request.correlationId ?? toUuid();
3729
+ }
3730
+ requestOptions = {};
3731
+ static get Form() {
3732
+ return new _RequestOptions(ContentType.Form);
3733
+ }
3734
+ static get Json() {
3735
+ return new _RequestOptions(ContentType.Json);
3736
+ }
3737
+ static get Stream() {
3738
+ return new _RequestOptions(ContentType.Stream);
3739
+ }
3740
+ static get Text() {
3741
+ return new _RequestOptions(ContentType.Text);
3742
+ }
3743
+ static get Xml() {
3744
+ return new _RequestOptions(ContentType.Xml);
3745
+ }
3746
+ page = (options) => {
3747
+ this.pageOptions = options;
3748
+ return this;
3749
+ };
3750
+ authorization = (auth) => this.setHeader("Authorization", auth);
3751
+ apiKey = (apiKey) => this.setHeader("apiKey", apiKey);
3752
+ setHeader = (key, value) => on(this, (t) => t.headers[asString(key)] = value);
3753
+ setHeaderUnlessPresent = (key, value) => value ? this.setHeader(key, this.headers[key] ?? value) : this;
3754
+ accept = (type) => this.setHeader("Accept", type.id);
3755
+ bearer = (jwt) => {
3756
+ return isNotEmpty(jwt) ? this.authorization(`Bearer ${jwt}`) : this;
3757
+ };
3758
+ basic = (username, password) => {
3759
+ const basicAuth = Buffer.from(`${username}:${password}`, "utf8").toString("base64");
3760
+ return this.authorization(`Basic ${basicAuth}`);
3761
+ };
3762
+ maxRedirects = (max) => {
3763
+ this.requestOptions.maxRedirects = max;
3764
+ return this;
3765
+ };
3766
+ validateStatus = (validate2) => {
3767
+ this.requestOptions.validateStatus = validate2;
3768
+ return this;
3769
+ };
3770
+ timeout = (t) => {
3771
+ this.requestOptions.timeout = t;
3772
+ return this;
3773
+ };
3774
+ };
3775
+ var isRequestOptions = (o) => isDefined(o) && o instanceof RequestOptions;
3776
+
3777
+ // src/http/RestResult.ts
3778
+ var hasErrors = (a) => isDefined(a?.error?.errors);
3779
+ var hasItems = (a) => isDefined(a?.data.items);
3780
+ var rest = {
3781
+ toData: (status, items = [], totalItems, meta2) => ({
3782
+ data: {
3783
+ code: status.status,
3784
+ items: toList(items),
3785
+ itemCount: items.length,
3786
+ totalItems,
3787
+ meta: meta2
3788
+ }
3789
+ }),
3790
+ toError: (status, errors = [toResult(status.name)]) => ({
3791
+ error: {
3792
+ code: status.status,
3793
+ message: status.name ?? errors[0].message ?? "Unknown",
3794
+ errors: toList(errors),
3795
+ errorCount: errors.length
3796
+ }
3797
+ }),
3798
+ to: (payload, status) => choose(payload).is.not.defined((p) => p, void 0).type(isHttpStatus, (h) => rest.toError(h ?? status ?? HttpStatus.InternalServerError, [toResult(h.name)])).type(isResult, (r) => rest.toError(status ?? HttpStatus.BadRequest, [r])).type(isError, (e) => rest.toError(status ?? HttpStatus.BadRequest, [e])).type(isResults, (r) => rest.toError(status ?? HttpStatus.BadRequest, r.results)).type(isResponse, (r) => rest.toError(status ?? HttpStatus.byId(r.body.error?.code), r.body.error?.errors)).type(hasErrors, (e) => rest.toError(status ?? HttpStatus.byId(e.error.code, HttpStatus.BadRequest), e.error.errors)).type(hasItems, (d) => rest.toData(status ?? HttpStatus.byId(d.data.code, HttpStatus.Ok), d.data.items, d.data.totalItems, d.data.meta)).else((p) => rest.toData(status ?? HttpStatus.Ok, toList(p)))
3799
+ };
3800
+ var isRestResult = (r) => isDefined(r) && (isDefined(r.data) || isDefined(r.error));
3801
+
3802
+ // src/http/Response.ts
3803
+ var isResponse = (r) => isA(r, "status", "body");
3804
+ var toResponse = (status, body, headers) => ({
3805
+ status: toHttpStatus(status),
3806
+ headers,
3807
+ body: rest.to(body)
3808
+ });
3809
+
3810
+ // src/http/Verb.ts
3811
+ var toVerbOptions = (options) => ({
3812
+ onOk: options?.onOk ?? HttpStatus.Ok,
3813
+ onNotFound: options?.onNotFound ?? HttpStatus.NotFound,
3814
+ onError: options?.onError ?? HttpStatus.BadRequest,
3815
+ type: options?.type ?? ContentType.Json,
3816
+ cache: options?.cache ?? CacheControl.disabled()
3817
+ });
3818
+ var toVerb = (verb, options) => (subject, property) => {
3819
+ meta(subject).property(property).set("verb", { verb, options });
3820
+ };
3821
+ var get = (options) => toVerb(HttpVerb.Get, options);
3822
+ var search = (options) => toVerb(HttpVerb.Get, { onNotFound: HttpStatus.Ok, ...options });
3823
+ var put = (options) => toVerb(HttpVerb.Put, options);
3824
+ var patch = (options) => toVerb(HttpVerb.Patch, options);
3825
+ var post = (options) => toVerb(HttpVerb.Post, { onOk: HttpStatus.Created, ...options });
3826
+ var del = (options) => toVerb(HttpVerb.Delete, { onOk: HttpStatus.NoContent, ...options });
3827
+ var stream = (options) => toVerb(HttpVerb.Get, { type: ContentType.Stream, ...options });
3828
+
3829
+ // src/health/HealthUri.ts
3830
+ var HealthUri = class _HealthUri extends EasyUri {
3831
+ static health = uri.segment("health");
3832
+ static Health = new _HealthUri([_HealthUri.health]);
3833
+ };
3834
+
3835
+ // src/resources/Req.ts
3836
+ var Req = class {
3837
+ constructor(path = {}, query = {}, body, headers) {
3838
+ this.path = path;
3839
+ this.query = query;
3840
+ this.body = body;
3841
+ this.headers = headers;
3842
+ this.skip = ifDefined(query.skip, (s) => asNumber(s));
3843
+ this.take = ifDefined(query.take, (t) => asNumber(t));
3844
+ }
3845
+ skip;
3846
+ take;
3847
+ get id() {
3848
+ return this.get("id");
3849
+ }
3850
+ get q() {
3851
+ return this.get("q");
3852
+ }
3853
+ get = (key) => this.path[key.toString()] ?? this.query[key.toString()];
3854
+ };
3855
+ function toReq(req) {
3856
+ return new Req(req.params, req.query, req.body, req.headers);
3857
+ }
3858
+
3859
+ // src/resources/Requires.ts
3860
+ var Requires = class {
3861
+ labCoat = () => (subject, property) => {
3862
+ meta(subject).property(property).set("labCoat", true);
3863
+ };
3864
+ token = () => (subject, property) => {
3865
+ meta(subject).property(property).set("token", true);
3866
+ };
3867
+ scope = (scope) => (subject, property) => {
3868
+ meta(subject).property(property).set("token", true);
3869
+ meta(subject).property(property).set("scope", scope);
3870
+ };
3871
+ useCase = (uc) => (subject, property) => {
3872
+ meta(subject).property(property).set("token", true);
3873
+ meta(subject).property(property).set("uc", uc);
3874
+ };
3875
+ };
3876
+ var requires = new Requires();
3877
+
3878
+ // src/resources/Route.ts
3879
+ var route = (uri2) => (subject) => {
3880
+ meta(subject).set("route", uri2);
3881
+ };
3882
+ var toRoute2 = (endpoint, requires2, verb, middleware) => tryTo(verb).is.defined().map((verb2) => ({ verb: verb2, endpoint, requires: requires2, middleware: middleware ?? [] })).orElse();
3883
+ var Router = class {
3884
+ constructor(resource) {
3885
+ this.resource = resource;
3886
+ }
3887
+ get route() {
3888
+ return meta(this.resource).get("route");
3889
+ }
3890
+ get middleware() {
3891
+ return meta(this.resource).get("middleware") ?? [];
3892
+ }
3893
+ get endpoints() {
3894
+ return meta(this.resource).properties("verb").mapDefined(
3895
+ (v) => toRoute2(
3896
+ this.resource[v.property],
3897
+ {
3898
+ labCoat: v.get("labCoat") ?? false,
3899
+ token: v.get("token") ?? false,
3900
+ scope: v.get("scope"),
3901
+ uc: v.get("uc")
3902
+ },
3903
+ v.get("verb"),
3904
+ v.get("middleware")
3905
+ )
3906
+ );
3907
+ }
3908
+ };
3909
+ var routes = (resource) => new Router(resource);
3910
+
3911
+ // src/resources/Service.ts
3912
+ var Service = class extends Enum {
3913
+ constructor(name2, app, resources = toList()) {
3914
+ super(name2);
3915
+ this.name = name2;
3916
+ this.app = app;
3917
+ this.resources = resources;
3918
+ }
3919
+ port = 8080;
3920
+ pre = () => [];
3921
+ post = () => [];
3922
+ with(...resources) {
3923
+ return tryTo(this).accept((t) => t.resources.add(resources.map((r) => new r()))).value;
3924
+ }
3925
+ atPort(port) {
3926
+ return tryTo(this).accept((t) => t.port = port).value;
3927
+ }
3928
+ start(message = `Service ${this.name} listening on port ${this.port} with ${this.resources.length} resources.`) {
3929
+ tryTo(this).accept((t) => t.pre().forEach((h) => this.app.use(h))).accept((t) => t.resources.forEach((r) => this.app.route(this, r))).accept((t) => t.post().forEach((h) => this.app.use(h))).accept((t) => t.app.listen(this.port, message));
3930
+ }
3931
+ };
3932
+
3933
+ // src/health/HealthResource.ts
3934
+ var HealthResource = class {
3935
+ ok = () => resolve({ state: "Service is healthy." });
3936
+ };
3937
+ __decorateClass([
3938
+ get()
3939
+ ], HealthResource.prototype, "ok", 2);
3940
+ HealthResource = __decorateClass([
3941
+ route(HealthUri.Health)
3942
+ ], HealthResource);
3943
+
3944
+ // src/process/Scope.ts
3945
+ var Scope = class _Scope extends Enum {
3946
+ constructor(name2, id = text(name2).kebab, subs = toList()) {
3947
+ super(name2, id.toString());
3948
+ this.name = name2;
3949
+ this.subs = subs;
3950
+ }
3951
+ for(item) {
3952
+ return new _Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));
3953
+ }
3954
+ combines(...scopes) {
3955
+ this.subs.add(scopes);
3956
+ return this;
3957
+ }
3958
+ expand() {
3959
+ return this.subs.flatMap((s) => s.expand()).add(this).distinct();
3960
+ }
3961
+ };
3962
+
3963
+ // src/process/App.ts
3964
+ var App = class _App extends Scope {
3965
+ constructor(name2) {
3966
+ super(name2);
3967
+ }
3968
+ static Main = new _App("Main");
3969
+ };
3970
+
3971
+ // src/process/Search.ts
3972
+ var Search = class {
3973
+ constructor(repo) {
3974
+ this.repo = repo;
3975
+ }
3976
+ all(options) {
3977
+ return this.repo.all(options);
3978
+ }
3979
+ byId(id) {
3980
+ return this.repo.byId(id);
3981
+ }
3982
+ byIds(...ids) {
3983
+ return this.repo.byIds(...ids);
3984
+ }
3985
+ byKey(key, options) {
3986
+ return this.repo.byKey(key, options);
3987
+ }
3988
+ query({ query, skip, take }) {
3989
+ return this.search(query, { skip, take });
3990
+ }
3991
+ search(query, options) {
3992
+ return choose(query).is.not.empty(
3993
+ (q) => q,
3994
+ (q) => this.repo.search(q, options)
3995
+ ).else(() => resolve(toPageList()));
3996
+ }
3997
+ filter(options) {
3998
+ return this.repo.filter(options);
3999
+ }
4000
+ exists(id) {
4001
+ return this.repo.exists(id);
4002
+ }
4003
+ };
4004
+
4005
+ // src/process/Manage.ts
4006
+ var Manage = class extends Search {
4007
+ add(json2) {
4008
+ return this.repo.add(json2);
4009
+ }
4010
+ update(id, json2) {
4011
+ return this.repo.update(id, json2);
4012
+ }
4013
+ upsert(id, json2) {
4014
+ return this.repo.upsert(id, json2);
4015
+ }
4016
+ remove(id) {
4017
+ return this.repo.remove(id);
4018
+ }
4019
+ };
4020
+
4021
+ // src/process/UseCase.ts
4022
+ var UseCase = class _UseCase extends Enum {
4023
+ constructor(app, name2, id = text(name2).kebab, scopes = toList()) {
4024
+ super(name2, id.toString());
4025
+ this.app = app;
4026
+ this.scopes = scopes;
4027
+ }
4028
+ with(...s) {
4029
+ this.scopes.add(
4030
+ ...toList(s).flatMap((s2) => s2.expand()).distinct()
4031
+ );
4032
+ return this;
4033
+ }
4034
+ for(item) {
4035
+ return new _UseCase(this.app, `${this.name} ${isString(item) ? item : item?.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`)).with(
4036
+ ...this.scopes.map((s) => s?.for(item))
4037
+ );
4038
+ }
4039
+ static byScopes(...s) {
4040
+ return this.filter((u) => u.scopes.some((us) => isIn(us, s)));
4041
+ }
4042
+ };
4043
+
4044
+ // src/services/AxiosProvider.ts
4045
+ var import_axios = __toESM(require("axios"));
4046
+ var isResponse2 = (a) => isDefined(a?.response);
4047
+ var isRequest = (a) => isDefined(a?.request);
4048
+ var asResponse = (uri2, verb, error) => choose(error).type(
4049
+ isResponse2,
4050
+ (r) => toResponse(r.response.status, isRestResult(r.response.data) ? r.response.data : toResult(r.response.statusText, uri2.path, uri2), r.response.headers)
4051
+ ).type(isRequest, (r) => toResponse(r.request.status, toResult(r.request.message, uri2.path, uri2))).else((e) => toResponse(HttpStatus.InternalServerError, toResult(e.message, uri2.path, uri2)));
4052
+ var AxiosProvider = class {
4053
+ constructor(ai = import_axios.default) {
4054
+ this.ai = ai;
4055
+ }
4056
+ execute = ({ uri: uri2, verb, body, transform = (r) => r, transformError = (r) => r, options = RequestOptions.Json }) => this.ai.request({
4057
+ url: uri2.toString(),
4058
+ method: verb.toString(),
4059
+ headers: uri2.isInternal && isEmpty(options.headers.Authorization) ? options.bearer(ctx.request.jwt).headers : options.headers,
4060
+ data: options.type.encode(body),
4061
+ maxRedirects: options.requestOptions.maxRedirects,
4062
+ ...options.requestOptions.timeout && { timeout: cacheAge.toMilliseconds(options?.requestOptions.timeout) },
4063
+ ...options.requestOptions.validateStatus && { validateStatus: options.requestOptions.validateStatus }
4064
+ }).then((r) => toResponse(r.status, transform(r.data), r.headers)).catch((e) => Promise.reject(asResponse(uri2, verb, transformError(e))));
4065
+ };
4066
+
4067
+ // src/services/Api.ts
4068
+ var Api = class {
4069
+ constructor(provider = new AxiosProvider(), store) {
4070
+ this.provider = provider;
4071
+ this.store = store;
4072
+ }
4073
+ get(uri2, options, transform, transformError = (r) => r) {
4074
+ return this.execute({
4075
+ uri: uri2.skip(toPageOptions(options)?.skip).take(toPageOptions(options)?.take),
4076
+ verb: HttpVerb.Get,
4077
+ transform,
4078
+ transformError,
4079
+ options: this.options(HttpVerb.Get, options)
4080
+ });
4081
+ }
4082
+ post(uri2, body, options = RequestOptions.Json, transform, transformError = (r) => r) {
4083
+ return this.execute({
4084
+ uri: uri2,
4085
+ verb: HttpVerb.Post,
4086
+ body,
4087
+ transform,
4088
+ transformError,
4089
+ options: this.options(HttpVerb.Post, options)
4090
+ });
4091
+ }
4092
+ put(uri2, body, options = RequestOptions.Json, transform, transformError = (r) => r) {
4093
+ return this.execute({
4094
+ uri: uri2,
4095
+ verb: HttpVerb.Put,
4096
+ body,
4097
+ transform,
4098
+ transformError,
4099
+ options: this.options(HttpVerb.Put, options)
4100
+ });
4101
+ }
4102
+ patch(uri2, body, options = RequestOptions.Json, transform, transformError = (r) => r) {
4103
+ return this.execute({
4104
+ uri: uri2,
4105
+ verb: HttpVerb.Patch,
4106
+ body,
4107
+ transform,
4108
+ transformError,
4109
+ options: this.options(HttpVerb.Patch, options)
4110
+ });
4111
+ }
4112
+ delete(uri2, options = RequestOptions.Json, transform, transformError = (r) => r) {
4113
+ return this.execute({
4114
+ uri: uri2,
4115
+ verb: HttpVerb.Delete,
4116
+ transform,
4117
+ transformError,
4118
+ options: this.options(HttpVerb.Delete, options)
4119
+ });
4120
+ }
4121
+ options(verb, options) {
4122
+ return options instanceof RequestOptions ? options : RequestOptions.Json;
4123
+ }
4124
+ execute(req) {
4125
+ return this.store ? this.store.execute(req, () => this.provider.execute(req)) : this.provider.execute(req);
4126
+ }
4127
+ };
4128
+ var api = new Api();
4129
+
4130
+ // src/services/ApiGateway.ts
4131
+ var ApiGateway = class extends Gateway {
4132
+ constructor(api2 = new Api()) {
4133
+ super();
4134
+ this.api = api2;
4135
+ }
4136
+ get(uri2, options) {
4137
+ return this.api.get(uri2, options).then((r) => use(r.body.data, (d) => toPageList(d?.items, { total: d?.totalItems, ...d?.meta })));
4138
+ }
4139
+ getOne(uri2, options) {
4140
+ return this.get(uri2, options).then((r) => r.first());
4141
+ }
4142
+ post(uri2, item, options) {
4143
+ return this.api.post(uri2, item, options).then((r) => r.body.data?.items.first() ?? {});
4144
+ }
4145
+ postSearch(uri2, options) {
4146
+ return this.api.post(uri2, options).then((r) => use(r.body.data, (d) => toPageList(d?.items, { total: d?.totalItems, ...d?.meta })));
4147
+ }
4148
+ patch(uri2, item, options) {
4149
+ return this.api.patch(uri2, item, options).then((r) => r.body.data?.items.first() ?? {});
4150
+ }
4151
+ put(uri2, item, options) {
4152
+ return this.api.put(uri2, item, options).then((r) => r.body.data?.items.first() ?? {});
4153
+ }
4154
+ delete(uri2, options) {
4155
+ return this.api.delete(uri2, options).then(() => true);
4156
+ }
4157
+ };
4158
+
4159
+ // src/services/RouteGateway.ts
4160
+ var RouteGateway = class extends ApiGateway {
4161
+ constructor(route2, routeId, api2 = new Api()) {
4162
+ super(api2);
4163
+ this.route = route2;
4164
+ this.routeId = routeId;
4165
+ this.api = api2;
4166
+ }
4167
+ all(options) {
4168
+ return this.get(this.route(), options);
4169
+ }
4170
+ byId(id, options) {
4171
+ return this.getOne(this.routeId().id(id));
4172
+ }
4173
+ byIds(...ids) {
4174
+ return this.get(this.route().ids(toArray(...ids)));
4175
+ }
4176
+ search(q, options) {
4177
+ return this.get(this.route().query(q), options);
4178
+ }
4179
+ exists(id, options) {
4180
+ return this.get(this.routeId().id(id)).then((r) => r.length === 1).catch((r) => HttpStatus.NotFound.equals(r.status) ? false : Promise.reject(r));
4181
+ }
4182
+ add(item, options) {
4183
+ return this.post(this.route(), item, options);
4184
+ }
4185
+ filter(options) {
4186
+ return this.postSearch(this.route(), options);
4187
+ }
4188
+ update(item, options) {
4189
+ return this.patch(this.routeId().id(item.id), item, options);
4190
+ }
4191
+ upsert(item, options) {
4192
+ return this.put(this.routeId().id(item.id), item, options);
4193
+ }
4194
+ remove(id, options) {
4195
+ return this.delete(this.routeId().id(id), options);
4196
+ }
4197
+ };
4198
+
4199
+ // src/services/MappedRouteGateway.ts
4200
+ var MappedRouteGateway = class extends RouteGateway {
4201
+ constructor(route2, routeId, map = new Mapper(), api2 = new Api()) {
4202
+ super(route2, routeId, api2);
4203
+ this.route = route2;
4204
+ this.routeId = routeId;
4205
+ this.map = map;
4206
+ this.api = api2;
4207
+ }
4208
+ get(uri2, options) {
4209
+ return super.get(uri2, options).then((is) => is.map((i) => this.map.in(i)));
4210
+ }
4211
+ getOne(uri2, options) {
4212
+ return super.get(uri2, options).then((is) => is.first()).then((i) => this.map.in(i));
4213
+ }
4214
+ add(item) {
4215
+ return super.add(this.map.out(item));
4216
+ }
4217
+ update(item) {
4218
+ return super.update(this.map.out(item));
4219
+ }
4220
+ };
4221
+
4222
+ // src/services/ViewRouteGateway.ts
4223
+ var ViewRouteGateway = class extends RouteGateway {
4224
+ constructor(route2, routeId, views2 = {
4225
+ in: view({}).fromSource,
4226
+ out: view({}).fromSource
4227
+ }, api2 = new Api()) {
4228
+ super(route2, routeId, api2);
4229
+ this.route = route2;
4230
+ this.routeId = routeId;
4231
+ this.views = views2;
4232
+ this.api = api2;
4233
+ }
4234
+ get(uri2, options) {
4235
+ return super.get(uri2, options).then((is) => is.map((i) => this.views.in.from(i)));
4236
+ }
4237
+ getOne(uri2, options) {
4238
+ return super.get(uri2, options).then((is) => is.first()).then((i) => this.views.in.from(i));
4239
+ }
4240
+ add(item) {
4241
+ return super.add(this.views.out.from(item));
4242
+ }
4243
+ update(item) {
4244
+ return super.update(this.views.out.from(item));
4245
+ }
4246
+ };
4247
+
4248
+ // src/security/Jwt.ts
4249
+ var import_jsonwebtoken = require("jsonwebtoken");
4250
+ var Jwt = class _Jwt extends Value {
4251
+ get isValid() {
4252
+ return tryTo(() => ctx.env.get("tokenPublicKey") ?? "").map((key) => (0, import_jsonwebtoken.verify)(this.value, key)).map(() => true).orElse() ?? false;
4253
+ }
4254
+ static sign = (token, options) => tryTo(() => ctx.env.get("tokenPrivateKey") ?? "").is.not.empty().map(
4255
+ (key) => (0, import_jsonwebtoken.sign)(token, key, {
4256
+ ...options,
4257
+ expiresIn: ctx.env.get("tokenExpiresIn") ?? "1h",
4258
+ keyid: ctx.env.get("tokenKeyid") ?? "easy",
4259
+ algorithm: ctx.env.get("tokenAlgorithm", "RS256")
4260
+ })
4261
+ ).map((s) => new _Jwt(s)).value;
4262
+ static of = (a) => new _Jwt(a.jwt);
4263
+ decode = () => (0, import_jsonwebtoken.decode)(this.value);
4264
+ toJSON() {
4265
+ return { jwt: this.value };
4266
+ }
4267
+ };
4268
+
4269
+ // src/sql/Clause.ts
4270
+ var quote = (a) => isNumber(a) || isBoolean(a) || isClause(a) ? a.toString() : `'${a}'`;
4271
+ var Clause = class {
4272
+ constructor(first, operator, second) {
4273
+ this.first = first;
4274
+ this.operator = operator;
4275
+ this.second = second;
4276
+ }
4277
+ and = (other) => new ParathesizedClause(this, "AND", other);
4278
+ or = (other) => new ParathesizedClause(this, "OR", other);
4279
+ toString() {
4280
+ return `${this.first} ${this.operator} ${quote(this.second)}`;
4281
+ }
4282
+ };
4283
+ var ParathesizedClause = class extends Clause {
4284
+ toString() {
4285
+ return `(${this.first} ${this.operator} ${quote(this.second)})`;
4286
+ }
4287
+ };
4288
+ var toClause = (first, operator, second, conv = convert.default) => new Clause(first, operator, conv.from(second));
4289
+ var isClause = (c) => isA(c, "and", "or");
4290
+
4291
+ // src/sql/Column.ts
4292
+ var Column = class extends Property {
4293
+ constructor(owner, property, options) {
4294
+ super(property, options);
4295
+ this.owner = owner;
4296
+ }
4297
+ get count() {
4298
+ return this.function("COUNT");
4299
+ }
4300
+ get max() {
4301
+ return this.function("MAX");
4302
+ }
4303
+ get min() {
4304
+ return this.function("MIN");
4305
+ }
4306
+ get sum() {
4307
+ return this.function("SUM");
4308
+ }
4309
+ get average() {
4310
+ return this.function("AVG");
4311
+ }
4312
+ get length() {
4313
+ return this.function("LEN");
4314
+ }
4315
+ get asc() {
4316
+ return this.format("$col ASC");
4317
+ }
4318
+ get desc() {
4319
+ return this.format("$col DESC");
4320
+ }
4321
+ in = (source = {}) => tryTo(source).map((s) => s[this.property] ?? ofGet(this.options?.dflt)).map((v) => this.options?.convert?.to(v)).orElse();
4322
+ out = (source = {}, key = "") => tryTo(source).map((s) => this.options?.convert?.from(s[key])).orElse();
4323
+ function = (func) => this.format(`${func}($name)`);
4324
+ format = (pattern) => new PatternColumn(this, pattern);
4325
+ is = (value) => this.clause("=", value);
4326
+ not = (value) => this.clause("<>", value);
4327
+ like = (value) => this.clause("LIKE", `%${value}%`);
4328
+ startsLike = (value) => this.clause("LIKE", `${value}%`);
4329
+ endsLike = (value) => this.clause("LIKE", `%${value}`);
4330
+ unlike = (value) => this.clause("NOT LIKE", `%${value}%`);
4331
+ less = (value) => this.clause("<", value);
4332
+ lessEqual = (value) => this.clause("<=", value);
4333
+ greater = (value) => this.clause(">", value);
4334
+ greaterEqual = (value) => this.clause(">=", value);
4335
+ as = (as) => this.format(`$col AS ${as}`);
4336
+ toString() {
4337
+ return `${this.owner}.${this.property}`;
4338
+ }
4339
+ clause = (operator, value) => toClause(this, operator, value, this?.options?.convert);
4340
+ };
4341
+ var PatternColumn = class extends Column {
4342
+ constructor(col, pattern) {
4343
+ super(col.owner, col.property);
4344
+ this.col = col;
4345
+ this.pattern = pattern;
4346
+ }
4347
+ toString() {
4348
+ return this.pattern.replace("$col", this.col.toString()).replace("$table", this.col.owner.toString).replace("$name", this.col.property);
4349
+ }
4350
+ };
4351
+ var OrderColumn = class extends PatternColumn {
4352
+ };
4353
+
4354
+ // src/sql/SqlQuery.ts
4355
+ var SqlQuery = class {
4356
+ constructor(table, clauses = toList()) {
4357
+ this.table = table;
4358
+ this.clauses = clauses;
4359
+ }
4360
+ where = (...clauses) => {
4361
+ this.clauses.add(clauses);
4362
+ return this;
4363
+ };
4364
+ };
4365
+
4366
+ // src/sql/Delete.ts
4367
+ var Delete = class extends SqlQuery {
4368
+ toString() {
4369
+ return `DELETE FROM ${this.table}` + ifGet(this.clauses.length, ` WHERE ${this.clauses.join(" AND ")};`, ";");
4370
+ }
4371
+ };
4372
+
4373
+ // src/sql/Insert.ts
4374
+ var Insert = class extends SqlQuery {
4375
+ constructor(table, fields) {
4376
+ super(table);
4377
+ this.table = table;
4378
+ this.fields = fields;
4379
+ }
4380
+ toString() {
4381
+ return `INSERT INTO ${this.table} (${Object.keys(this.fields).join(", ")}) OUTPUT INSERTED.* VALUES (${Object.values(this.fields).map((v) => quote(v)).join(", ")});`;
4382
+ }
4383
+ };
4384
+
4385
+ // src/sql/Join.ts
4386
+ var Join2 = class {
4387
+ constructor(first, second, c, c2) {
4388
+ this.first = first;
4389
+ this.second = second;
4390
+ this.c = c;
4391
+ this.c2 = c2;
4392
+ this.db = this.first.db;
4393
+ }
4394
+ db;
4395
+ on(c, c2) {
4396
+ this.c = c;
4397
+ this.c2 = c2;
4398
+ return this;
4399
+ }
4400
+ toString() {
4401
+ return `${this.first} JOIN ${this.second} ON ${this.c} = ${this.c2}`;
4402
+ }
4403
+ };
4404
+
4405
+ // src/sql/Select.ts
4406
+ var Select = class extends SqlQuery {
4407
+ constructor(table, columns = toList()) {
4408
+ super(table);
4409
+ this.columns = columns;
4410
+ }
4411
+ ordered = toList();
4412
+ grouped = toList();
4413
+ _top = 0;
4414
+ _limit = 0;
4415
+ _offset = 0;
4416
+ from(t) {
4417
+ this.table = t ?? this.table;
4418
+ return this;
4419
+ }
4420
+ orderBy = (...ordered) => {
4421
+ this.ordered.add(ordered);
4422
+ return this;
4423
+ };
4424
+ groupBy(...grouped) {
4425
+ this.grouped.add(grouped);
4426
+ return this;
4427
+ }
4428
+ top(t) {
4429
+ this._top = t;
4430
+ return this;
4431
+ }
4432
+ limit(l) {
4433
+ this._limit = l;
4434
+ return this;
4435
+ }
4436
+ offset(o) {
4437
+ this._offset = o;
4438
+ return this;
4439
+ }
4440
+ toString() {
4441
+ return `SELECT ` + ifGet(this._top, `TOP ${this._top} `, "") + ifGet(this.columns.length, this.columns.join(", "), "*") + ` FROM ${this.table}` + ifGet(this.clauses.length, ` WHERE ${this.clauses.join(" AND ")}`, "") + ifGet(this.grouped.length, ` GROUP BY ${this.grouped.join(", ")}`, "") + ifGet(this.ordered.length, ` ORDERED BY ${this.ordered.join(", ")}`, "") + ifGet(this._limit, ` LIMIT ${this._limit}`, "") + ifGet(this._offset, ` OFFSET ${this._offset};`, ";");
4442
+ }
4443
+ };
4444
+
4445
+ // src/sql/Update.ts
4446
+ var Update = class extends SqlQuery {
4447
+ constructor(table, fields) {
4448
+ super(table);
4449
+ this.table = table;
4450
+ this.fields = fields;
4451
+ }
4452
+ toString() {
4453
+ return `UPDATE ${this.table} SET ${Object.entries(this.fields).map(([k, v]) => toClause(k, "=", v)).join(", ")} OUTPUT INSERTED.*` + ifGet(this.clauses.length, ` WHERE ${this.clauses.join(" AND ")};`, ";");
4454
+ }
4455
+ };
4456
+
4457
+ // src/sql/Count.ts
4458
+ var Count = class extends Select {
4459
+ toString() {
4460
+ return `SELECT COUNT(*)` + ifGet(this._top, ` TOP ${this._top}`, "") + ` FROM ${this.table}` + ifGet(this.clauses.length, ` WHERE ${this.clauses.join(" AND ")}`, "") + ifGet(this.grouped.length, ` GROUP BY ${this.grouped.join(", ")}`, "") + ";";
4461
+ }
4462
+ };
4463
+
4464
+ // src/sql/Table.ts
4465
+ var Table2 = class extends Mapper {
4466
+ map = {
4467
+ ...mappings,
4468
+ column: (name2, options) => new Column(this, name2, options)
4469
+ };
4470
+ id = this.map.column("", { dflt: toUuid });
4471
+ constructor(options = { startFrom: "source" }) {
4472
+ super(options);
4473
+ }
4474
+ get db() {
4475
+ return Database.Default;
4476
+ }
4477
+ get count() {
4478
+ return new Count(this);
4479
+ }
4480
+ /**
4481
+ * @deprecated Deprecated since version 6.2. Please use map.column instead.
4482
+ */
4483
+ prop = (name2, options) => this.map.column(name2, options);
4484
+ select = (...columns) => new Select(this, toList(columns));
4485
+ insert = (fields) => new Insert(this, this.out(fields));
4486
+ update = (fields) => new Update(this, this.out(fields));
4487
+ delete = () => new Delete(this, toList());
4488
+ join = (t) => new Join2(this, t);
4489
+ };
4490
+
4491
+ // src/sql/TableGateway.ts
4492
+ var TableGateway = class extends Gateway {
4493
+ constructor(table, provider = table.db.provide()) {
4494
+ super();
4495
+ this.table = table;
4496
+ this.provider = provider;
4497
+ }
4498
+ provide = ({ provider } = {}) => provider ?? this.provider;
4499
+ all(options) {
4500
+ return this.provide(options).query(this.table.select()).then(
4501
+ (js) => toPageList(
4502
+ js.map((j) => this.table.in(j)),
4503
+ options
4504
+ )
4505
+ );
4506
+ }
4507
+ byId(id, options) {
4508
+ return this.provide(options).query(this.table.select().where(this.table.id.is(id))).then((js) => js.first()).then((j) => ifDefined(j, this.table.in(j)));
4509
+ }
4510
+ exists(id, options) {
4511
+ return this.byId(id).then((j) => isDefined(j));
4512
+ }
4513
+ add(item, options) {
4514
+ return this.provide(options).query(this.table.insert(item)).then((js) => when(js.first()).not.isDefined.reject(`Could not add items with id ${item.id}`)).then((j) => this.table.in(j));
4515
+ }
4516
+ remove(id, options) {
4517
+ return this.provide(options).command(this.table.delete().where(this.table.id.is(id))).then(() => true);
4518
+ }
4519
+ update(item, options) {
4520
+ return this.provide(options).query(this.table.update(item).where(this.table.id.is(item.id))).then((js) => when(js.first()).not.isDefined.reject(`Could not update item with id ${item.id}`)).then((j) => this.table.in(j));
4521
+ }
4522
+ };
30
4523
  // Annotate the CommonJS export names for ESM import in node:
31
4524
  0 && (module.exports = {
32
- ...require("./data"),
33
- ...require("./domain"),
34
- ...require("./http"),
35
- ...require("./health"),
36
- ...require("./process"),
37
- ...require("./resources"),
38
- ...require("./services"),
39
- ...require("./security"),
40
- ...require("./sql"),
41
- ...require("./types"),
42
- ...require("./utils"),
43
- ...require("./validation")
4525
+ Address,
4526
+ Api,
4527
+ ApiGateway,
4528
+ App,
4529
+ Audit,
4530
+ AxiosProvider,
4531
+ BaseContext,
4532
+ BaseRequestContext,
4533
+ Box,
4534
+ CacheControl,
4535
+ Child,
4536
+ Clause,
4537
+ Column,
4538
+ Condition,
4539
+ ContentType,
4540
+ Context,
4541
+ Convert,
4542
+ Country,
4543
+ Currency,
4544
+ Database,
4545
+ DateTime,
4546
+ DefaultProvider,
4547
+ Delete,
4548
+ Dimension,
4549
+ DotEnvContext,
4550
+ EAN,
4551
+ EasyUri,
4552
+ Email,
4553
+ Entity,
4554
+ Enum,
4555
+ Environment,
4556
+ Exception,
4557
+ Field,
4558
+ Gateway,
4559
+ HealthResource,
4560
+ HealthUri,
4561
+ HttpHeader,
4562
+ HttpStatus,
4563
+ HttpVerb,
4564
+ IBAN,
4565
+ InMemoryGateway,
4566
+ Insert,
4567
+ Join,
4568
+ Jwt,
4569
+ List,
4570
+ Locale,
4571
+ LogicalCondition,
4572
+ Manage,
4573
+ MappedRouteGateway,
4574
+ Mapper,
4575
+ Money,
4576
+ Name,
4577
+ OrderColumn,
4578
+ OriginatedError,
4579
+ PageList,
4580
+ ParathesizedClause,
4581
+ Parser,
4582
+ PatternColumn,
4583
+ PostalCode,
4584
+ Property,
4585
+ Repo,
4586
+ Repository,
4587
+ Req,
4588
+ RequestOptions,
4589
+ Requires,
4590
+ Results,
4591
+ RouteGateway,
4592
+ Scope,
4593
+ Search,
4594
+ Select,
4595
+ Sentence,
4596
+ Service,
4597
+ Slug,
4598
+ SortCondition,
4599
+ SqlQuery,
4600
+ State,
4601
+ Struct,
4602
+ Table,
4603
+ TableGateway,
4604
+ Template,
4605
+ ToText,
4606
+ Try,
4607
+ Typo,
4608
+ UnitOfMeasurement,
4609
+ UnitOfWeight,
4610
+ Update,
4611
+ Url,
4612
+ UseCase,
4613
+ Value,
4614
+ View,
4615
+ ViewRouteGateway,
4616
+ Wait,
4617
+ Weight,
4618
+ When,
4619
+ any,
4620
+ api,
4621
+ array,
4622
+ asJson,
4623
+ asList,
4624
+ asNumber,
4625
+ asPageList,
4626
+ asResults,
4627
+ asString,
4628
+ asc,
4629
+ base64,
4630
+ build,
4631
+ cache,
4632
+ cacheAge,
4633
+ choose,
4634
+ constraint,
4635
+ convert,
4636
+ ctx,
4637
+ days,
4638
+ defined,
4639
+ del,
4640
+ desc,
4641
+ dir,
4642
+ dt,
4643
+ email,
4644
+ entries,
4645
+ future,
4646
+ get,
4647
+ gt,
4648
+ gte,
4649
+ ifA,
4650
+ ifDefined,
4651
+ ifFalse,
4652
+ ifGet,
4653
+ ifNotEmpty,
4654
+ ifTrue,
4655
+ inFuture,
4656
+ inList,
4657
+ inOptionalList,
4658
+ inPast,
4659
+ includes,
4660
+ isA,
4661
+ isAddress,
4662
+ isAn,
4663
+ isArray,
4664
+ isBoolean,
4665
+ isClause,
4666
+ isConstructor,
4667
+ isDate,
4668
+ isDateTime,
4669
+ isDefined,
4670
+ isDoesNotExist,
4671
+ isEAN,
4672
+ isEmail,
4673
+ isEmpty,
4674
+ isEmptyObject,
4675
+ isEnum,
4676
+ isEqual,
4677
+ isError,
4678
+ isException,
4679
+ isFalsy,
4680
+ isField,
4681
+ isFunc,
4682
+ isFunction,
4683
+ isHttpStatus,
4684
+ isIBAN,
4685
+ isIn,
4686
+ isInstance,
4687
+ isIntersecting,
4688
+ isIsoDateString,
4689
+ isJson,
4690
+ isList,
4691
+ isLoading,
4692
+ isMapping,
4693
+ isMoney,
4694
+ isNotEmpty,
4695
+ isNotPresent,
4696
+ isNullish,
4697
+ isNumber,
4698
+ isObject,
4699
+ isOriginatedError,
4700
+ isPageList,
4701
+ isPresent,
4702
+ isPrimitive,
4703
+ isRequestOptions,
4704
+ isResponse,
4705
+ isRestResult,
4706
+ isResult,
4707
+ isResults,
4708
+ isSimpleView,
4709
+ isSortCondition,
4710
+ isString,
4711
+ isStruct,
4712
+ isText,
4713
+ isTrue,
4714
+ isTruthy,
4715
+ isUndefined,
4716
+ isUrl,
4717
+ isUuid,
4718
+ isValid,
4719
+ isValidatable,
4720
+ isValue,
4721
+ json,
4722
+ kebab,
4723
+ log,
4724
+ lt,
4725
+ lte,
4726
+ mappings,
4727
+ maxLength,
4728
+ maxValue,
4729
+ meta,
4730
+ minLength,
4731
+ minValue,
4732
+ money,
4733
+ name,
4734
+ notEmpty,
4735
+ ofConstruct,
4736
+ ofGet,
4737
+ ofMessage,
4738
+ ofProperty,
4739
+ on,
4740
+ optional,
4741
+ past,
4742
+ patch,
4743
+ post,
4744
+ postalCode,
4745
+ put,
4746
+ quote,
4747
+ reject,
4748
+ replaceAll,
4749
+ required,
4750
+ requires,
4751
+ resolve,
4752
+ rest,
4753
+ route,
4754
+ routes,
4755
+ rule,
4756
+ search,
4757
+ searchable,
4758
+ singleton,
4759
+ stream,
4760
+ tag,
4761
+ template,
4762
+ text,
4763
+ toArray,
4764
+ toCacheOptions,
4765
+ toClause,
4766
+ toCondition,
4767
+ toFilter,
4768
+ toHttpStatus,
4769
+ toId,
4770
+ toJson,
4771
+ toList,
4772
+ toName,
4773
+ toObject,
4774
+ toOriginatedError,
4775
+ toPageList,
4776
+ toPageOptions,
4777
+ toReq,
4778
+ toResponse,
4779
+ toResult,
4780
+ toResults,
4781
+ toSegment,
4782
+ toShortFilter,
4783
+ toSlug,
4784
+ toUuid,
4785
+ toVerbOptions,
4786
+ toViewer,
4787
+ toWords,
4788
+ traverse,
4789
+ tryTo,
4790
+ tuple,
4791
+ tuple2,
4792
+ tuple3,
4793
+ tuple4,
4794
+ tuple5,
4795
+ uri,
4796
+ url,
4797
+ use,
4798
+ valid,
4799
+ validate,
4800
+ validateReject,
4801
+ view,
4802
+ views,
4803
+ wait,
4804
+ we,
4805
+ weight,
4806
+ when
44
4807
  });
45
4808
  //# sourceMappingURL=index.js.map