@thisisagile/easy 15.29.3 → 17.0.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 (256) hide show
  1. package/dist/{chunk-UNHWYQ54.mjs → chunk-27YL5N6O.mjs} +4 -4
  2. package/dist/{chunk-QQRGOHU6.mjs → chunk-2BGTVGU4.mjs} +2 -2
  3. package/dist/{chunk-X7FZPY3P.mjs → chunk-2KBPI5HD.mjs} +2 -2
  4. package/dist/{chunk-M47EOYDK.mjs → chunk-2S656HDG.mjs} +4 -4
  5. package/dist/{chunk-APYISY5K.mjs → chunk-2YNBXKAS.mjs} +2 -2
  6. package/dist/{chunk-YSBACFUR.mjs → chunk-3CTCZJ2E.mjs} +5 -5
  7. package/dist/{chunk-45GNHDKA.mjs → chunk-3G2I3M46.mjs} +4 -4
  8. package/dist/{chunk-6VLC4Z4H.mjs → chunk-3PG7XJVW.mjs} +2 -2
  9. package/dist/{chunk-7TJ4VCBE.mjs → chunk-3VP6O3LL.mjs} +9 -9
  10. package/dist/{chunk-D5FLGKVR.mjs → chunk-464AOKCS.mjs} +8 -8
  11. package/dist/{chunk-3L4RAR24.mjs → chunk-4IGBNRNB.mjs} +5 -5
  12. package/dist/{chunk-Q5HABVOK.mjs → chunk-5TDKTZD7.mjs} +3 -3
  13. package/dist/{chunk-D4K4MC24.mjs → chunk-7GL3D7F7.mjs} +3 -3
  14. package/dist/{chunk-2ZUDYGPP.mjs → chunk-A37OECZ2.mjs} +5 -5
  15. package/dist/{chunk-IAXKOENJ.mjs → chunk-A7PAVXBM.mjs} +4 -4
  16. package/dist/{chunk-KRLEHX37.mjs → chunk-ANOORQCM.mjs} +5 -5
  17. package/dist/{chunk-NYYHRFBW.mjs → chunk-AQT7Z43R.mjs} +4 -4
  18. package/dist/{chunk-U53FLD4J.mjs → chunk-CGMASUXA.mjs} +3 -3
  19. package/dist/{chunk-UKHDSTTZ.mjs → chunk-CMHJOQBL.mjs} +5 -5
  20. package/dist/{chunk-TMZRZLA2.mjs → chunk-CYTFXBYW.mjs} +3 -3
  21. package/dist/{chunk-J7XKOXMW.mjs → chunk-EGVFHL23.mjs} +6 -6
  22. package/dist/{chunk-A62OK7XE.mjs → chunk-F7C6VY2D.mjs} +5 -5
  23. package/dist/{chunk-HBJMCX2I.mjs → chunk-FCGLOMI7.mjs} +3 -3
  24. package/dist/{chunk-ZHXKBOK2.mjs → chunk-G4GZG77M.mjs} +2 -2
  25. package/dist/{chunk-ARTSACXM.mjs → chunk-GD24FBKZ.mjs} +7 -7
  26. package/dist/{chunk-JFU65NZU.mjs → chunk-HRKMPZGD.mjs} +9 -9
  27. package/dist/{chunk-JBJ2YERG.mjs → chunk-IFDDZTWN.mjs} +3 -3
  28. package/dist/{chunk-ZPNFXK7Y.mjs → chunk-IK4EPPOF.mjs} +4 -4
  29. package/dist/{chunk-6YVMQB26.mjs → chunk-JADWPU3M.mjs} +2 -2
  30. package/dist/{chunk-LYAPQ4QZ.mjs → chunk-JKZEVKE3.mjs} +4 -4
  31. package/dist/{chunk-JSON7A4X.mjs → chunk-JOI26DEU.mjs} +2 -2
  32. package/dist/{chunk-UJEQAXZI.mjs → chunk-JPHN3NM3.mjs} +3 -3
  33. package/dist/{chunk-JTGB3TSZ.mjs → chunk-JV37KGKL.mjs} +3 -3
  34. package/dist/{chunk-HV4CI2QX.mjs → chunk-JX7EOMTI.mjs} +9 -9
  35. package/dist/{chunk-HNVAFEZP.mjs → chunk-K2IES6IY.mjs} +2 -2
  36. package/dist/{chunk-ARZEQQW5.mjs → chunk-KCOJAMHS.mjs} +16 -16
  37. package/dist/{chunk-73UD7JJL.mjs → chunk-LCNUK6EI.mjs} +2 -2
  38. package/dist/{chunk-UW6S2PNO.mjs → chunk-LGXHFCSE.mjs} +5 -5
  39. package/dist/{chunk-UYDZZAEK.mjs → chunk-LHD6A2CA.mjs} +2 -2
  40. package/dist/{chunk-QTPKH4PY.mjs → chunk-MPFUPK2O.mjs} +5 -5
  41. package/dist/{chunk-WJZFE5NE.mjs → chunk-MYZQELEU.mjs} +2 -2
  42. package/dist/{chunk-LAR7AT6R.mjs → chunk-MZ74H2HU.mjs} +2 -2
  43. package/dist/{chunk-7K4QMDUN.mjs → chunk-OHHQ5YCI.mjs} +2 -2
  44. package/dist/{chunk-VV534JNS.mjs → chunk-OKVYYWDS.mjs} +3 -3
  45. package/dist/{chunk-CAHTK3AT.mjs → chunk-PB7ZHNR6.mjs} +2 -2
  46. package/dist/{chunk-FHW5K2RR.mjs → chunk-POMUVSEW.mjs} +5 -5
  47. package/dist/{chunk-USGZFNWP.mjs → chunk-QGLPCM3U.mjs} +3 -3
  48. package/dist/{chunk-4DJNTF2D.mjs → chunk-QQ62TFVN.mjs} +3 -3
  49. package/dist/{chunk-J6KN572O.mjs → chunk-RNM4YSY2.mjs} +3 -3
  50. package/dist/{chunk-RNROH3VJ.mjs → chunk-SWKY2KOQ.mjs} +3 -3
  51. package/dist/{chunk-4G6AW6D6.mjs → chunk-T5K5ZLP2.mjs} +3 -3
  52. package/dist/{chunk-EDVJUOFU.mjs → chunk-TUGGAGKI.mjs} +13 -13
  53. package/dist/{chunk-OFGI5FLG.mjs → chunk-UARTMYBD.mjs} +2 -2
  54. package/dist/{chunk-6BQEFLOS.mjs → chunk-V35WKNIG.mjs} +3 -3
  55. package/dist/{chunk-5WSP2IYF.mjs → chunk-WLFIQWOM.mjs} +6 -6
  56. package/dist/{chunk-PPWHEIZW.mjs → chunk-WWJDP64S.mjs} +4 -4
  57. package/dist/{chunk-A2JYVEBB.mjs → chunk-XSK44RYX.mjs} +4 -4
  58. package/dist/data/Condition.mjs +11 -11
  59. package/dist/data/Database.mjs +11 -11
  60. package/dist/data/Field.mjs +12 -12
  61. package/dist/data/InMemoryGateway.mjs +21 -21
  62. package/dist/domain/Audit.mjs +24 -24
  63. package/dist/domain/Child.mjs +24 -24
  64. package/dist/domain/DateTime.mjs +20 -20
  65. package/dist/domain/Entity.mjs +26 -26
  66. package/dist/domain/Repo.mjs +21 -21
  67. package/dist/domain/Struct.mjs +21 -21
  68. package/dist/domain/Typo.mjs +20 -20
  69. package/dist/http/CacheControl.mjs +58 -23
  70. package/dist/http/CacheControl.mjs.map +1 -1
  71. package/dist/http/ContentType.mjs +11 -11
  72. package/dist/http/HttpStatus.mjs +11 -11
  73. package/dist/http/HttpVerb.mjs +11 -11
  74. package/dist/http/LocalRequestStore.mjs +11 -11
  75. package/dist/http/RequestOptions.mjs +15 -15
  76. package/dist/http/Response.mjs +4 -4
  77. package/dist/http/RestResult.mjs +22 -22
  78. package/dist/http/toResponse.mjs +23 -23
  79. package/dist/index.d.ts +0 -9
  80. package/dist/index.js +209 -324
  81. package/dist/index.js.map +1 -1
  82. package/dist/index.mjs +0 -9
  83. package/dist/index.mjs.map +1 -1
  84. package/dist/process/App.mjs +12 -12
  85. package/dist/process/Manage.mjs +21 -21
  86. package/dist/process/Scope.mjs +12 -12
  87. package/dist/process/Search.mjs +21 -21
  88. package/dist/process/UseCase.mjs +11 -11
  89. package/dist/resources/Req.mjs +20 -20
  90. package/dist/security/Jwt.d.ts +2 -12
  91. package/dist/security/Jwt.mjs +60 -37
  92. package/dist/security/Jwt.mjs.map +1 -1
  93. package/dist/services/Api.mjs +31 -31
  94. package/dist/services/ApiGateway.mjs +34 -34
  95. package/dist/services/AxiosProvider.mjs +29 -29
  96. package/dist/services/MappedRouteGateway.mjs +40 -40
  97. package/dist/services/RouteGateway.mjs +35 -35
  98. package/dist/services/ViewRouteGateway.mjs +38 -38
  99. package/dist/sql/Clause.mjs +6 -6
  100. package/dist/sql/Column.mjs +23 -23
  101. package/dist/sql/Count.mjs +10 -10
  102. package/dist/sql/Delete.mjs +9 -9
  103. package/dist/sql/Insert.mjs +11 -11
  104. package/dist/sql/Select.mjs +9 -9
  105. package/dist/sql/SqlQuery.mjs +8 -8
  106. package/dist/sql/Table.mjs +33 -33
  107. package/dist/sql/TableGateway.mjs +21 -21
  108. package/dist/sql/Update.mjs +11 -11
  109. package/dist/types/Array.mjs +3 -3
  110. package/dist/types/Builder.mjs +2 -2
  111. package/dist/types/Cache.mjs +9 -9
  112. package/dist/types/CacheAge.mjs +21 -21
  113. package/dist/types/Case.mjs +19 -19
  114. package/dist/types/Constructor.mjs +2 -2
  115. package/dist/types/Context.mjs +11 -11
  116. package/dist/types/Enum.mjs +10 -10
  117. package/dist/types/Environment.mjs +10 -10
  118. package/dist/types/Exception.mjs +12 -12
  119. package/dist/types/Gateway.mjs +14 -14
  120. package/dist/types/IsA.mjs +3 -3
  121. package/dist/types/IsEqual.mjs +20 -20
  122. package/dist/types/Json.mjs +9 -9
  123. package/dist/types/List.mjs +7 -7
  124. package/dist/types/Meta.mjs +9 -9
  125. package/dist/types/Number.mjs +20 -20
  126. package/dist/types/Object.mjs +8 -8
  127. package/dist/types/PageList.mjs +20 -20
  128. package/dist/types/Parser.mjs +19 -19
  129. package/dist/types/Repository.mjs +14 -14
  130. package/dist/types/Result.mjs +12 -12
  131. package/dist/types/Results.mjs +13 -13
  132. package/dist/types/Tag.mjs +9 -9
  133. package/dist/types/Template.mjs +10 -10
  134. package/dist/types/Text.mjs +2 -2
  135. package/dist/types/Try.mjs +19 -19
  136. package/dist/types/Uri.mjs +106 -23
  137. package/dist/types/Uri.mjs.map +1 -1
  138. package/dist/types/Validatable.mjs +4 -4
  139. package/dist/types/Value.mjs +3 -3
  140. package/dist/utils/Convert.mjs +3 -3
  141. package/dist/utils/If.mjs +3 -3
  142. package/dist/utils/Mapper.mjs +14 -14
  143. package/dist/utils/Promise.mjs +8 -8
  144. package/dist/utils/Property.mjs +4 -4
  145. package/dist/utils/Sentence.mjs +10 -10
  146. package/dist/utils/State.mjs +3 -3
  147. package/dist/utils/View.mjs +23 -23
  148. package/dist/validation/Contraints.mjs +20 -20
  149. package/dist/validation/Validate.mjs +19 -19
  150. package/dist/validation/When.mjs +19 -19
  151. package/package.json +2 -59
  152. package/src/index.ts +0 -10
  153. package/src/security/Jwt.ts +4 -35
  154. package/dist/chunk-EIJ3GSGG.mjs +0 -45
  155. package/dist/chunk-EIJ3GSGG.mjs.map +0 -1
  156. package/dist/chunk-GSZLYZSW.mjs +0 -104
  157. package/dist/chunk-GSZLYZSW.mjs.map +0 -1
  158. package/dist/chunk-JFJLDIJB.mjs +0 -46
  159. package/dist/chunk-JFJLDIJB.mjs.map +0 -1
  160. package/dist/chunk-NFWIUPZU.mjs +0 -48
  161. package/dist/chunk-NFWIUPZU.mjs.map +0 -1
  162. package/dist/chunk-XBYDAQGZ.mjs +0 -15
  163. package/dist/chunk-XBYDAQGZ.mjs.map +0 -1
  164. package/dist/health/HealthResource.d.ts +0 -5
  165. package/dist/health/HealthResource.mjs +0 -58
  166. package/dist/health/HealthResource.mjs.map +0 -1
  167. package/dist/health/HealthUri.d.ts +0 -5
  168. package/dist/health/HealthUri.mjs +0 -31
  169. package/dist/health/HealthUri.mjs.map +0 -1
  170. package/dist/http/OriginatedError.d.ts +0 -9
  171. package/dist/http/OriginatedError.mjs +0 -23
  172. package/dist/http/OriginatedError.mjs.map +0 -1
  173. package/dist/http/Verb.d.ts +0 -23
  174. package/dist/http/Verb.mjs +0 -50
  175. package/dist/http/Verb.mjs.map +0 -1
  176. package/dist/resources/AppProvider.d.ts +0 -9
  177. package/dist/resources/AppProvider.mjs +0 -1
  178. package/dist/resources/AppProvider.mjs.map +0 -1
  179. package/dist/resources/Requires.d.ts +0 -9
  180. package/dist/resources/Requires.mjs +0 -39
  181. package/dist/resources/Requires.mjs.map +0 -1
  182. package/dist/resources/Resource.d.ts +0 -1
  183. package/dist/resources/Resource.mjs +0 -1
  184. package/dist/resources/Resource.mjs.map +0 -1
  185. package/dist/resources/Route.d.ts +0 -28
  186. package/dist/resources/Route.mjs +0 -32
  187. package/dist/resources/Route.mjs.map +0 -1
  188. package/dist/resources/Service.d.ts +0 -17
  189. package/dist/resources/Service.mjs +0 -55
  190. package/dist/resources/Service.mjs.map +0 -1
  191. package/src/health/HealthResource.ts +0 -12
  192. package/src/health/HealthUri.ts +0 -6
  193. package/src/http/OriginatedError.ts +0 -18
  194. package/src/http/Verb.ts +0 -36
  195. package/src/resources/AppProvider.ts +0 -11
  196. package/src/resources/Requires.ts +0 -33
  197. package/src/resources/Resource.ts +0 -1
  198. package/src/resources/Route.ts +0 -60
  199. package/src/resources/Service.ts +0 -37
  200. /package/dist/{chunk-UNHWYQ54.mjs.map → chunk-27YL5N6O.mjs.map} +0 -0
  201. /package/dist/{chunk-QQRGOHU6.mjs.map → chunk-2BGTVGU4.mjs.map} +0 -0
  202. /package/dist/{chunk-X7FZPY3P.mjs.map → chunk-2KBPI5HD.mjs.map} +0 -0
  203. /package/dist/{chunk-M47EOYDK.mjs.map → chunk-2S656HDG.mjs.map} +0 -0
  204. /package/dist/{chunk-APYISY5K.mjs.map → chunk-2YNBXKAS.mjs.map} +0 -0
  205. /package/dist/{chunk-YSBACFUR.mjs.map → chunk-3CTCZJ2E.mjs.map} +0 -0
  206. /package/dist/{chunk-45GNHDKA.mjs.map → chunk-3G2I3M46.mjs.map} +0 -0
  207. /package/dist/{chunk-6VLC4Z4H.mjs.map → chunk-3PG7XJVW.mjs.map} +0 -0
  208. /package/dist/{chunk-7TJ4VCBE.mjs.map → chunk-3VP6O3LL.mjs.map} +0 -0
  209. /package/dist/{chunk-D5FLGKVR.mjs.map → chunk-464AOKCS.mjs.map} +0 -0
  210. /package/dist/{chunk-3L4RAR24.mjs.map → chunk-4IGBNRNB.mjs.map} +0 -0
  211. /package/dist/{chunk-Q5HABVOK.mjs.map → chunk-5TDKTZD7.mjs.map} +0 -0
  212. /package/dist/{chunk-D4K4MC24.mjs.map → chunk-7GL3D7F7.mjs.map} +0 -0
  213. /package/dist/{chunk-2ZUDYGPP.mjs.map → chunk-A37OECZ2.mjs.map} +0 -0
  214. /package/dist/{chunk-IAXKOENJ.mjs.map → chunk-A7PAVXBM.mjs.map} +0 -0
  215. /package/dist/{chunk-KRLEHX37.mjs.map → chunk-ANOORQCM.mjs.map} +0 -0
  216. /package/dist/{chunk-NYYHRFBW.mjs.map → chunk-AQT7Z43R.mjs.map} +0 -0
  217. /package/dist/{chunk-U53FLD4J.mjs.map → chunk-CGMASUXA.mjs.map} +0 -0
  218. /package/dist/{chunk-UKHDSTTZ.mjs.map → chunk-CMHJOQBL.mjs.map} +0 -0
  219. /package/dist/{chunk-TMZRZLA2.mjs.map → chunk-CYTFXBYW.mjs.map} +0 -0
  220. /package/dist/{chunk-J7XKOXMW.mjs.map → chunk-EGVFHL23.mjs.map} +0 -0
  221. /package/dist/{chunk-A62OK7XE.mjs.map → chunk-F7C6VY2D.mjs.map} +0 -0
  222. /package/dist/{chunk-HBJMCX2I.mjs.map → chunk-FCGLOMI7.mjs.map} +0 -0
  223. /package/dist/{chunk-ZHXKBOK2.mjs.map → chunk-G4GZG77M.mjs.map} +0 -0
  224. /package/dist/{chunk-ARTSACXM.mjs.map → chunk-GD24FBKZ.mjs.map} +0 -0
  225. /package/dist/{chunk-JFU65NZU.mjs.map → chunk-HRKMPZGD.mjs.map} +0 -0
  226. /package/dist/{chunk-JBJ2YERG.mjs.map → chunk-IFDDZTWN.mjs.map} +0 -0
  227. /package/dist/{chunk-ZPNFXK7Y.mjs.map → chunk-IK4EPPOF.mjs.map} +0 -0
  228. /package/dist/{chunk-6YVMQB26.mjs.map → chunk-JADWPU3M.mjs.map} +0 -0
  229. /package/dist/{chunk-LYAPQ4QZ.mjs.map → chunk-JKZEVKE3.mjs.map} +0 -0
  230. /package/dist/{chunk-JSON7A4X.mjs.map → chunk-JOI26DEU.mjs.map} +0 -0
  231. /package/dist/{chunk-UJEQAXZI.mjs.map → chunk-JPHN3NM3.mjs.map} +0 -0
  232. /package/dist/{chunk-JTGB3TSZ.mjs.map → chunk-JV37KGKL.mjs.map} +0 -0
  233. /package/dist/{chunk-HV4CI2QX.mjs.map → chunk-JX7EOMTI.mjs.map} +0 -0
  234. /package/dist/{chunk-HNVAFEZP.mjs.map → chunk-K2IES6IY.mjs.map} +0 -0
  235. /package/dist/{chunk-ARZEQQW5.mjs.map → chunk-KCOJAMHS.mjs.map} +0 -0
  236. /package/dist/{chunk-73UD7JJL.mjs.map → chunk-LCNUK6EI.mjs.map} +0 -0
  237. /package/dist/{chunk-UW6S2PNO.mjs.map → chunk-LGXHFCSE.mjs.map} +0 -0
  238. /package/dist/{chunk-UYDZZAEK.mjs.map → chunk-LHD6A2CA.mjs.map} +0 -0
  239. /package/dist/{chunk-QTPKH4PY.mjs.map → chunk-MPFUPK2O.mjs.map} +0 -0
  240. /package/dist/{chunk-WJZFE5NE.mjs.map → chunk-MYZQELEU.mjs.map} +0 -0
  241. /package/dist/{chunk-LAR7AT6R.mjs.map → chunk-MZ74H2HU.mjs.map} +0 -0
  242. /package/dist/{chunk-7K4QMDUN.mjs.map → chunk-OHHQ5YCI.mjs.map} +0 -0
  243. /package/dist/{chunk-VV534JNS.mjs.map → chunk-OKVYYWDS.mjs.map} +0 -0
  244. /package/dist/{chunk-CAHTK3AT.mjs.map → chunk-PB7ZHNR6.mjs.map} +0 -0
  245. /package/dist/{chunk-FHW5K2RR.mjs.map → chunk-POMUVSEW.mjs.map} +0 -0
  246. /package/dist/{chunk-USGZFNWP.mjs.map → chunk-QGLPCM3U.mjs.map} +0 -0
  247. /package/dist/{chunk-4DJNTF2D.mjs.map → chunk-QQ62TFVN.mjs.map} +0 -0
  248. /package/dist/{chunk-J6KN572O.mjs.map → chunk-RNM4YSY2.mjs.map} +0 -0
  249. /package/dist/{chunk-RNROH3VJ.mjs.map → chunk-SWKY2KOQ.mjs.map} +0 -0
  250. /package/dist/{chunk-4G6AW6D6.mjs.map → chunk-T5K5ZLP2.mjs.map} +0 -0
  251. /package/dist/{chunk-EDVJUOFU.mjs.map → chunk-TUGGAGKI.mjs.map} +0 -0
  252. /package/dist/{chunk-OFGI5FLG.mjs.map → chunk-UARTMYBD.mjs.map} +0 -0
  253. /package/dist/{chunk-6BQEFLOS.mjs.map → chunk-V35WKNIG.mjs.map} +0 -0
  254. /package/dist/{chunk-5WSP2IYF.mjs.map → chunk-WLFIQWOM.mjs.map} +0 -0
  255. /package/dist/{chunk-PPWHEIZW.mjs.map → chunk-WWJDP64S.mjs.map} +0 -0
  256. /package/dist/{chunk-A2JYVEBB.mjs.map → chunk-XSK44RYX.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -66,8 +66,6 @@ __export(src_exports, {
66
66
  Exception: () => Exception,
67
67
  Field: () => Field,
68
68
  Gateway: () => Gateway,
69
- HealthResource: () => HealthResource,
70
- HealthUri: () => HealthUri,
71
69
  HttpHeader: () => HttpHeader,
72
70
  HttpStatus: () => HttpStatus,
73
71
  HttpVerb: () => HttpVerb,
@@ -81,7 +79,6 @@ __export(src_exports, {
81
79
  MappedRouteGateway: () => MappedRouteGateway,
82
80
  Mapper: () => Mapper,
83
81
  OrderColumn: () => OrderColumn,
84
- OriginatedError: () => OriginatedError,
85
82
  PageList: () => PageList,
86
83
  ParathesizedClause: () => ParathesizedClause,
87
84
  Parser: () => Parser,
@@ -91,14 +88,12 @@ __export(src_exports, {
91
88
  Repository: () => Repository,
92
89
  Req: () => Req,
93
90
  RequestOptions: () => RequestOptions,
94
- Requires: () => Requires,
95
91
  Results: () => Results,
96
92
  RouteGateway: () => RouteGateway,
97
93
  Scope: () => Scope,
98
94
  Search: () => Search,
99
95
  Select: () => Select,
100
96
  Sentence: () => Sentence,
101
- Service: () => Service,
102
97
  SortCondition: () => SortCondition,
103
98
  SqlQuery: () => SqlQuery,
104
99
  State: () => State,
@@ -136,13 +131,11 @@ __export(src_exports, {
136
131
  ctx: () => ctx,
137
132
  days: () => days,
138
133
  defined: () => defined,
139
- del: () => del,
140
134
  desc: () => desc,
141
135
  dir: () => dir,
142
136
  dt: () => dt,
143
137
  entries: () => entries,
144
138
  future: () => future,
145
- get: () => get,
146
139
  gt: () => gt,
147
140
  gte: () => gte,
148
141
  ifA: () => ifA,
@@ -191,7 +184,6 @@ __export(src_exports, {
191
184
  isNullish: () => isNullish,
192
185
  isNumber: () => isNumber,
193
186
  isObject: () => isObject,
194
- isOriginatedError: () => isOriginatedError,
195
187
  isPageList: () => isPageList,
196
188
  isPresent: () => isPresent,
197
189
  isPrimitive: () => isPrimitive,
@@ -231,23 +223,15 @@ __export(src_exports, {
231
223
  on: () => on,
232
224
  optional: () => optional,
233
225
  past: () => past,
234
- patch: () => patch,
235
- post: () => post,
236
- put: () => put,
237
226
  quote: () => quote,
238
227
  reject: () => reject,
239
228
  replaceAll: () => replaceAll,
240
229
  required: () => required,
241
- requires: () => requires,
242
230
  resolve: () => resolve,
243
231
  rest: () => rest,
244
- route: () => route,
245
- routes: () => routes,
246
232
  rule: () => rule,
247
- search: () => search,
248
233
  searchable: () => searchable,
249
234
  singleton: () => singleton,
250
- stream: () => stream,
251
235
  tag: () => tag,
252
236
  template: () => template,
253
237
  text: () => text,
@@ -263,7 +247,6 @@ __export(src_exports, {
263
247
  toList: () => toList,
264
248
  toName: () => toName,
265
249
  toObject: () => toObject,
266
- toOriginatedError: () => toOriginatedError,
267
250
  toPageList: () => toPageList,
268
251
  toPageOptions: () => toPageOptions,
269
252
  toReq: () => toReq,
@@ -273,7 +256,6 @@ __export(src_exports, {
273
256
  toSegment: () => toSegment,
274
257
  toShortFilter: () => toShortFilter,
275
258
  toUuid: () => toUuid,
276
- toVerbOptions: () => toVerbOptions,
277
259
  toViewer: () => toViewer,
278
260
  toWords: () => toWords,
279
261
  traverse: () => traverse,
@@ -391,7 +373,7 @@ var array = {
391
373
  // src/types/Text.ts
392
374
  var isText = (t) => isDefined(t) && isFunc(t.toString);
393
375
  var asString = (t, alt = "") => (isText(t) ? t : ofGet(alt)).toString();
394
- var replaceAll = (origin, search2, replace = "") => asString(origin).split(asString(search2)).join(asString(replace));
376
+ var replaceAll = (origin, search, replace = "") => asString(origin).split(asString(search)).join(asString(replace));
395
377
  var toWords = (input) => {
396
378
  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);
397
379
  };
@@ -864,7 +846,7 @@ var ToText = class {
864
846
  first = (n) => this.map((s) => s.substring(0, n));
865
847
  last = (n) => this.map((s) => s.substring(s.length - n));
866
848
  map = (func) => text(ofGet(func, this.subject));
867
- replace = (search2, replace) => this.map((s) => replaceAll(s, search2, replace));
849
+ replace = (search, replace) => this.map((s) => replaceAll(s, search, replace));
868
850
  add = (add, separator = "") => this.map((s) => isNotEmpty(add) ? `${s}${separator}${text(add)}` : s);
869
851
  with = (separator, ...other) => this.map(
870
852
  (s) => toList(s).add(...other.map((u) => text(u).toString())).filter((s2) => isNotEmpty(s2)).join(separator)
@@ -1875,112 +1857,95 @@ var Typo = class extends Repository {
1875
1857
  }
1876
1858
  };
1877
1859
 
1878
- // src/types/Uri.ts
1879
- var toSegment = (key, {
1880
- segment,
1881
- query
1882
- } = {}) => ({
1883
- key,
1884
- segment,
1885
- query,
1886
- toString: () => asString(key)
1887
- });
1888
- var uri = {
1889
- host: (key) => toSegment(key, { segment: key ?? ctx.env.host ?? "$host" }),
1890
- resource: (resource) => toSegment(toName(resource, "Uri"), { segment: toName(resource, "Uri") }),
1891
- segment: (key) => toSegment(key, { segment: key }),
1892
- path: (key) => toSegment(key, { segment: `:${key}` }),
1893
- query: (key) => toSegment(key, {
1894
- query: (value) => tryTo(value).is.defined().map((v) => encodeURIComponent(asString(v))).map((v) => `${key}=${v}`).orElse("") ?? ""
1895
- }),
1896
- boolean: (key) => toSegment(key, { query: (value) => isTrue(value) ? `${key}` : "" })
1860
+ // src/types/Number.ts
1861
+ var asNumber = (n, alt) => tryTo(() => asString(n)).map((s) => parseInt(s)).filter((n2) => isNumber(n2)).or(ofGet(alt) ?? NaN);
1862
+
1863
+ // src/types/CacheAge.ts
1864
+ var ageNumber = (s) => asNumber(s.replace(/[a-z]/g, ""));
1865
+ var cacheAge = {
1866
+ toMilliseconds: (ca) => choose(asString(ca)).case(
1867
+ (c) => c.endsWith("ms"),
1868
+ (c) => ageNumber(c)
1869
+ ).case(
1870
+ (c) => c.endsWith("s"),
1871
+ (c) => ageNumber(c) * 1e3
1872
+ ).case(
1873
+ (c) => c.endsWith("m"),
1874
+ (c) => ageNumber(c) * 60 * 1e3
1875
+ ).case(
1876
+ (c) => c.endsWith("h"),
1877
+ (c) => ageNumber(c) * 3600 * 1e3
1878
+ ).case(
1879
+ (c) => c.endsWith("d"),
1880
+ (c) => ageNumber(c) * 24 * 3600 * 1e3
1881
+ ).else(ca),
1882
+ toSeconds: (ca) => choose(asString(ca)).case(
1883
+ (c) => c.endsWith("ms"),
1884
+ (c) => ageNumber(c) / 1e3
1885
+ ).case(
1886
+ (c) => c.endsWith("s"),
1887
+ (c) => ageNumber(c)
1888
+ ).case(
1889
+ (c) => c.endsWith("m"),
1890
+ (c) => ageNumber(c) * 60
1891
+ ).case(
1892
+ (c) => c.endsWith("h"),
1893
+ (c) => ageNumber(c) * 3600
1894
+ ).case(
1895
+ (c) => c.endsWith("d"),
1896
+ (c) => ageNumber(c) * 24 * 3600
1897
+ ).else(ca)
1897
1898
  };
1898
- var toRoute = (...segments) => toList(segments).mapDefined((s) => s.segment).join("/");
1899
- var EasyUri = class _EasyUri {
1900
- constructor(segments = []) {
1901
- this.segments = segments;
1902
- }
1903
- static id = uri.path("id");
1904
- static ids = uri.query("ids");
1905
- static query = uri.query("q");
1906
- static sort = uri.query("s");
1907
- static skip = uri.query("skip");
1908
- static take = uri.query("take");
1909
- host = uri.host();
1910
- resource = uri.resource(this);
1911
- state = {};
1912
- get path() {
1913
- return toRoute(uri.segment(""), this.resource, ...this.segments);
1914
- }
1915
- get complete() {
1916
- return toRoute(this.host, this.resource, ...this.segments);
1917
- }
1918
- get isInternal() {
1919
- return toRoute(this.host) === (ctx.env.host ?? "$host");
1920
- }
1921
- get props() {
1922
- return meta(this.state).values();
1899
+
1900
+ // src/http/CacheControl.ts
1901
+ var CacheControl = class _CacheControl {
1902
+ constructor(enabled = true, directives = {}) {
1903
+ this.enabled = enabled;
1904
+ this.directives = directives;
1923
1905
  }
1924
- route = (resource = this.resource.key) => toRoute(uri.segment(""), uri.segment(resource?.toLowerCase()), ...this.segments);
1925
- set = (segment, value) => {
1926
- tryTo(value).is.defined().accept((value2) => this.state[segment.key ?? ""] = { segment, value: value2 });
1927
- return this;
1928
- };
1906
+ name = "Cache-Control";
1907
+ static disabled = () => new _CacheControl(false);
1908
+ static OneSecond = () => new _CacheControl().maxAge(1).staleWhileRevalidate(1);
1909
+ static fiveSeconds = () => new _CacheControl().maxAge(5).staleWhileRevalidate(5);
1910
+ static tenSeconds = () => new _CacheControl().maxAge(10).staleWhileRevalidate(10);
1911
+ static thirtySeconds = () => new _CacheControl().maxAge(30).staleWhileRevalidate(30);
1912
+ static sixtySeconds = () => new _CacheControl().maxAge(60).staleWhileRevalidate(60);
1913
+ static custom = (maxAge, staleWhileRevalidate) => new _CacheControl().maxAge(maxAge).staleWhileRevalidate(staleWhileRevalidate);
1914
+ maxAge = (ca) => on(this, (t) => t.directives["max-age"] = ca);
1915
+ sharedMaxAge = (ca) => on(this, (t) => t.directives["s-maxage"] = ca);
1916
+ noCache = (a) => on(this, (t) => t.directives["no-cache"] = a);
1917
+ mustRevalidate = (a) => on(this, (t) => t.directives["must-revalidate"] = a);
1918
+ private = (a) => on(this, (t) => t.directives["private"] = a);
1919
+ public = (a) => on(this, (t) => t.directives["public"] = a);
1920
+ immutable = (a) => on(this, (t) => t.directives["immutable"] = a);
1921
+ staleWhileRevalidate = (ca) => on(this, (t) => t.directives["stale-while-revalidate"] = ca);
1922
+ value = () => this.toString();
1929
1923
  toString() {
1930
- 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) => ({
1931
- route: route2,
1932
- query: this.props.mapDefined((p) => p.segment?.query ? p.segment?.query(p.value) : void 0)?.join("&")
1933
- })).map(({ route: route2, query }) => isNotEmpty(query) ? `${route2}?${query}` : route2).value;
1934
- }
1935
- id = (id) => this.set(_EasyUri.id, id);
1936
- ids = (ids) => this.set(_EasyUri.ids, toArray(ids).join(","));
1937
- query = (q) => this.set(_EasyUri.query, q);
1938
- sort = (s) => this.set(_EasyUri.sort, asString(s));
1939
- skip = (index) => this.set(_EasyUri.skip, index);
1940
- take = (items) => this.set(_EasyUri.take, items);
1941
- expand(props) {
1942
- 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);
1924
+ return entries(this.directives).mapDefined(([k, v]) => ifDefined(v, isNumber(v) ? `${k}=${cacheAge.toSeconds(v)}` : k)).join(",");
1943
1925
  }
1944
1926
  };
1945
1927
 
1946
- // src/health/HealthUri.ts
1947
- var HealthUri = class _HealthUri extends EasyUri {
1948
- static health = uri.segment("health");
1949
- static Health = new _HealthUri([_HealthUri.health]);
1928
+ // src/http/ContentType.ts
1929
+ var import_form_urlencoded = __toESM(require("form-urlencoded"));
1930
+ var ContentType = class _ContentType extends Enum {
1931
+ constructor(name, type, encoder = (b) => asString(b)) {
1932
+ super(name, type);
1933
+ this.type = type;
1934
+ this.encoder = encoder;
1935
+ }
1936
+ static Form = new _ContentType("form", "application/x-www-form-urlencoded", (b) => (0, import_form_urlencoded.default)(b));
1937
+ static Json = new _ContentType("json", "application/json", (b) => b);
1938
+ static Stream = new _ContentType("stream", "application/octet-stream");
1939
+ static Text = new _ContentType("text", "text/plain");
1940
+ static Xml = new _ContentType("xml", "application/xml");
1941
+ encode = (body) => ofGet(this.encoder, body);
1950
1942
  };
1951
1943
 
1952
- // src/resources/Route.ts
1953
- var route = (uri2) => (subject) => {
1954
- meta(subject).set("route", uri2);
1955
- };
1956
- var toRoute2 = (endpoint, requires2, verb, middleware) => tryTo(verb).is.defined().map((verb2) => ({ verb: verb2, endpoint, requires: requires2, middleware: middleware ?? [] })).orElse();
1957
- var Router = class {
1958
- constructor(resource) {
1959
- this.resource = resource;
1960
- }
1961
- get route() {
1962
- return meta(this.resource).get("route");
1963
- }
1964
- get middleware() {
1965
- return meta(this.resource).get("middleware") ?? [];
1966
- }
1967
- get endpoints() {
1968
- return meta(this.resource).properties("verb").mapDefined(
1969
- (v) => toRoute2(
1970
- this.resource[v.property],
1971
- {
1972
- labCoat: v.get("labCoat") ?? false,
1973
- token: v.get("token") ?? false,
1974
- scope: v.get("scope"),
1975
- uc: v.get("uc")
1976
- },
1977
- v.get("verb"),
1978
- v.get("middleware")
1979
- )
1980
- );
1981
- }
1944
+ // src/http/HttpHeader.ts
1945
+ var HttpHeader = {
1946
+ ContentType: "Content-Type",
1947
+ Correlation: "X-Correlation-Id"
1982
1948
  };
1983
- var routes = (resource) => new Router(resource);
1984
1949
 
1985
1950
  // src/http/HttpStatus.ts
1986
1951
  var HttpStatus = class _HttpStatus extends Enum {
@@ -2063,90 +2028,6 @@ var HttpStatus = class _HttpStatus extends Enum {
2063
2028
  var isHttpStatus = (s) => isAn(s, "id", "status");
2064
2029
  var toHttpStatus = (s) => isHttpStatus(s) ? s : HttpStatus.byId(s);
2065
2030
 
2066
- // src/http/ContentType.ts
2067
- var import_form_urlencoded = __toESM(require("form-urlencoded"));
2068
- var ContentType = class _ContentType extends Enum {
2069
- constructor(name, type, encoder = (b) => asString(b)) {
2070
- super(name, type);
2071
- this.type = type;
2072
- this.encoder = encoder;
2073
- }
2074
- static Form = new _ContentType("form", "application/x-www-form-urlencoded", (b) => (0, import_form_urlencoded.default)(b));
2075
- static Json = new _ContentType("json", "application/json", (b) => b);
2076
- static Stream = new _ContentType("stream", "application/octet-stream");
2077
- static Text = new _ContentType("text", "text/plain");
2078
- static Xml = new _ContentType("xml", "application/xml");
2079
- encode = (body) => ofGet(this.encoder, body);
2080
- };
2081
-
2082
- // src/types/Number.ts
2083
- var asNumber = (n, alt) => tryTo(() => asString(n)).map((s) => parseInt(s)).filter((n2) => isNumber(n2)).or(ofGet(alt) ?? NaN);
2084
-
2085
- // src/types/CacheAge.ts
2086
- var ageNumber = (s) => asNumber(s.replace(/[a-z]/g, ""));
2087
- var cacheAge = {
2088
- toMilliseconds: (ca) => choose(asString(ca)).case(
2089
- (c) => c.endsWith("ms"),
2090
- (c) => ageNumber(c)
2091
- ).case(
2092
- (c) => c.endsWith("s"),
2093
- (c) => ageNumber(c) * 1e3
2094
- ).case(
2095
- (c) => c.endsWith("m"),
2096
- (c) => ageNumber(c) * 60 * 1e3
2097
- ).case(
2098
- (c) => c.endsWith("h"),
2099
- (c) => ageNumber(c) * 3600 * 1e3
2100
- ).case(
2101
- (c) => c.endsWith("d"),
2102
- (c) => ageNumber(c) * 24 * 3600 * 1e3
2103
- ).else(ca),
2104
- toSeconds: (ca) => choose(asString(ca)).case(
2105
- (c) => c.endsWith("ms"),
2106
- (c) => ageNumber(c) / 1e3
2107
- ).case(
2108
- (c) => c.endsWith("s"),
2109
- (c) => ageNumber(c)
2110
- ).case(
2111
- (c) => c.endsWith("m"),
2112
- (c) => ageNumber(c) * 60
2113
- ).case(
2114
- (c) => c.endsWith("h"),
2115
- (c) => ageNumber(c) * 3600
2116
- ).case(
2117
- (c) => c.endsWith("d"),
2118
- (c) => ageNumber(c) * 24 * 3600
2119
- ).else(ca)
2120
- };
2121
-
2122
- // src/http/CacheControl.ts
2123
- var CacheControl = class _CacheControl {
2124
- constructor(enabled = true, directives = {}) {
2125
- this.enabled = enabled;
2126
- this.directives = directives;
2127
- }
2128
- name = "Cache-Control";
2129
- static disabled = () => new _CacheControl(false);
2130
- static OneSecond = () => new _CacheControl().maxAge(1).staleWhileRevalidate(1);
2131
- static fiveSeconds = () => new _CacheControl().maxAge(5).staleWhileRevalidate(5);
2132
- static tenSeconds = () => new _CacheControl().maxAge(10).staleWhileRevalidate(10);
2133
- static thirtySeconds = () => new _CacheControl().maxAge(30).staleWhileRevalidate(30);
2134
- static sixtySeconds = () => new _CacheControl().maxAge(60).staleWhileRevalidate(60);
2135
- static custom = (maxAge, staleWhileRevalidate) => new _CacheControl().maxAge(maxAge).staleWhileRevalidate(staleWhileRevalidate);
2136
- maxAge = (ca) => on(this, (t) => t.directives["max-age"] = ca);
2137
- sharedMaxAge = (ca) => on(this, (t) => t.directives["s-maxage"] = ca);
2138
- noCache = (a) => on(this, (t) => t.directives["no-cache"] = a);
2139
- mustRevalidate = (a) => on(this, (t) => t.directives["must-revalidate"] = a);
2140
- private = (a) => on(this, (t) => t.directives["private"] = a);
2141
- public = (a) => on(this, (t) => t.directives["public"] = a);
2142
- immutable = (a) => on(this, (t) => t.directives["immutable"] = a);
2143
- staleWhileRevalidate = (ca) => on(this, (t) => t.directives["stale-while-revalidate"] = ca);
2144
- value = () => this.toString();
2145
- toString() {
2146
- return entries(this.directives).mapDefined(([k, v]) => ifDefined(v, isNumber(v) ? `${k}=${cacheAge.toSeconds(v)}` : k)).join(",");
2147
- }
2148
- };
2149
-
2150
2031
  // src/http/HttpVerb.ts
2151
2032
  var HttpVerb = class _HttpVerb extends Enum {
2152
2033
  static Get = new _HttpVerb("Get");
@@ -2159,55 +2040,6 @@ var HttpVerb = class _HttpVerb extends Enum {
2159
2040
  }
2160
2041
  };
2161
2042
 
2162
- // src/http/Verb.ts
2163
- var toVerbOptions = (options) => ({
2164
- onOk: options?.onOk ?? HttpStatus.Ok,
2165
- onNotFound: options?.onNotFound ?? HttpStatus.NotFound,
2166
- onError: options?.onError ?? HttpStatus.BadRequest,
2167
- type: options?.type ?? ContentType.Json,
2168
- cache: options?.cache ?? CacheControl.disabled()
2169
- });
2170
- var toVerb = (verb, options) => (subject, property) => {
2171
- meta(subject).property(property).set("verb", { verb, options });
2172
- };
2173
- var get = (options) => toVerb(HttpVerb.Get, options);
2174
- var search = (options) => toVerb(HttpVerb.Get, { onNotFound: HttpStatus.Ok, ...options });
2175
- var put = (options) => toVerb(HttpVerb.Put, options);
2176
- var patch = (options) => toVerb(HttpVerb.Patch, options);
2177
- var post = (options) => toVerb(HttpVerb.Post, { onOk: HttpStatus.Created, ...options });
2178
- var del = (options) => toVerb(HttpVerb.Delete, { onOk: HttpStatus.NoContent, ...options });
2179
- var stream = (options) => toVerb(HttpVerb.Get, { type: ContentType.Stream, ...options });
2180
-
2181
- // src/health/HealthResource.ts
2182
- var HealthResource = class {
2183
- ok = () => resolve({ state: "Service is healthy." });
2184
- };
2185
- __decorateClass([
2186
- get()
2187
- ], HealthResource.prototype, "ok", 2);
2188
- HealthResource = __decorateClass([
2189
- route(HealthUri.Health)
2190
- ], HealthResource);
2191
-
2192
- // src/http/HttpHeader.ts
2193
- var HttpHeader = {
2194
- ContentType: "Content-Type",
2195
- Correlation: "X-Correlation-Id"
2196
- };
2197
-
2198
- // src/http/OriginatedError.ts
2199
- var OriginatedError = class extends Error {
2200
- constructor(origin, options) {
2201
- super();
2202
- this.origin = origin;
2203
- this.options = options;
2204
- if (isError(origin))
2205
- this.stack = origin.stack;
2206
- }
2207
- };
2208
- var isOriginatedError = (e) => isError(e) && e instanceof OriginatedError;
2209
- var toOriginatedError = (e, options) => isOriginatedError(e) ? e : new OriginatedError(e, options);
2210
-
2211
2043
  // src/http/RequestOptions.ts
2212
2044
  var toPageOptions = (options) => options instanceof RequestOptions ? options.pageOptions : options;
2213
2045
  var RequestOptions = class _RequestOptions extends Enum {
@@ -2427,63 +2259,66 @@ function toReq(req) {
2427
2259
  return new Req(req.params, req.query, req.body, req.headers);
2428
2260
  }
2429
2261
 
2430
- // src/resources/Requires.ts
2431
- var Requires = class {
2432
- labCoat = () => (subject, property) => {
2433
- meta(subject).property(property).set("labCoat", true);
2434
- };
2435
- token = () => (subject, property) => {
2436
- meta(subject).property(property).set("token", true);
2437
- };
2438
- scope = (scope) => (subject, property) => {
2439
- meta(subject).property(property).set("token", true);
2440
- meta(subject).property(property).set("scope", scope);
2441
- };
2442
- useCase = (uc) => (subject, property) => {
2443
- meta(subject).property(property).set("token", true);
2444
- meta(subject).property(property).set("uc", uc);
2445
- };
2262
+ // ../../node_modules/jwt-decode/build/esm/index.js
2263
+ var InvalidTokenError = class extends Error {
2446
2264
  };
2447
- var requires = new Requires();
2448
-
2449
- // src/resources/Service.ts
2450
- var Service = class extends Enum {
2451
- constructor(name, app, resources = toList()) {
2452
- super(name);
2453
- this.name = name;
2454
- this.app = app;
2455
- this.resources = resources;
2265
+ InvalidTokenError.prototype.name = "InvalidTokenError";
2266
+ function b64DecodeUnicode(str) {
2267
+ return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
2268
+ let code = p.charCodeAt(0).toString(16).toUpperCase();
2269
+ if (code.length < 2) {
2270
+ code = "0" + code;
2271
+ }
2272
+ return "%" + code;
2273
+ }));
2274
+ }
2275
+ function base64UrlDecode(str) {
2276
+ let output = str.replace(/-/g, "+").replace(/_/g, "/");
2277
+ switch (output.length % 4) {
2278
+ case 0:
2279
+ break;
2280
+ case 2:
2281
+ output += "==";
2282
+ break;
2283
+ case 3:
2284
+ output += "=";
2285
+ break;
2286
+ default:
2287
+ throw new Error("base64 string is not of the correct length");
2456
2288
  }
2457
- port = 8080;
2458
- pre = () => [];
2459
- post = () => [];
2460
- with(...resources) {
2461
- return tryTo(this).accept((t) => t.resources.add(resources.map((r) => new r()))).value;
2289
+ try {
2290
+ return b64DecodeUnicode(output);
2291
+ } catch (err) {
2292
+ return atob(output);
2462
2293
  }
2463
- atPort(port) {
2464
- return tryTo(this).accept((t) => t.port = port).value;
2294
+ }
2295
+ function jwtDecode(token, options) {
2296
+ if (typeof token !== "string") {
2297
+ throw new InvalidTokenError("Invalid token specified: must be a string");
2465
2298
  }
2466
- start(message = `Service ${this.name} listening on port ${this.port} with ${this.resources.length} resources.`) {
2467
- 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));
2299
+ options || (options = {});
2300
+ const pos = options.header === true ? 0 : 1;
2301
+ const part = token.split(".")[pos];
2302
+ if (typeof part !== "string") {
2303
+ throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
2468
2304
  }
2469
- };
2305
+ let decoded;
2306
+ try {
2307
+ decoded = base64UrlDecode(part);
2308
+ } catch (e) {
2309
+ throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
2310
+ }
2311
+ try {
2312
+ return JSON.parse(decoded);
2313
+ } catch (e) {
2314
+ throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
2315
+ }
2316
+ }
2470
2317
 
2471
2318
  // src/security/Jwt.ts
2472
- var import_jsonwebtoken = require("jsonwebtoken");
2473
2319
  var Jwt = class _Jwt extends Value {
2474
- get isValid() {
2475
- return tryTo(() => ctx.env.get("tokenPublicKey") ?? "").map((key) => (0, import_jsonwebtoken.verify)(this.value, key)).map(() => true).orElse() ?? false;
2476
- }
2477
- static sign = (token, options) => tryTo(() => ctx.env.get("tokenPrivateKey") ?? "").is.not.empty().map(
2478
- (key) => (0, import_jsonwebtoken.sign)(token, key, {
2479
- ...options,
2480
- expiresIn: ctx.env.get("tokenExpiresIn") ?? "1h",
2481
- keyid: ctx.env.get("tokenKeyid") ?? "easy",
2482
- algorithm: ctx.env.get("tokenAlgorithm", "RS256")
2483
- })
2484
- ).map((s) => new _Jwt(s)).value;
2485
2320
  static of = (a) => new _Jwt(a.jwt);
2486
- decode = () => (0, import_jsonwebtoken.decode)(this.value);
2321
+ decode = () => jwtDecode(this.value);
2487
2322
  toJSON() {
2488
2323
  return { jwt: this.value };
2489
2324
  }
@@ -2606,9 +2441,9 @@ var ApiGateway = class extends Gateway {
2606
2441
 
2607
2442
  // src/services/RouteGateway.ts
2608
2443
  var RouteGateway = class extends ApiGateway {
2609
- constructor(route2, routeId, api2 = new Api()) {
2444
+ constructor(route, routeId, api2 = new Api()) {
2610
2445
  super(api2);
2611
- this.route = route2;
2446
+ this.route = route;
2612
2447
  this.routeId = routeId;
2613
2448
  this.api = api2;
2614
2449
  }
@@ -2754,9 +2589,9 @@ var mappings = {
2754
2589
 
2755
2590
  // src/services/MappedRouteGateway.ts
2756
2591
  var MappedRouteGateway = class extends RouteGateway {
2757
- constructor(route2, routeId, map = new Mapper(), api2 = new Api()) {
2758
- super(route2, routeId, api2);
2759
- this.route = route2;
2592
+ constructor(route, routeId, map = new Mapper(), api2 = new Api()) {
2593
+ super(route, routeId, api2);
2594
+ this.route = route;
2760
2595
  this.routeId = routeId;
2761
2596
  this.map = map;
2762
2597
  this.api = api2;
@@ -2844,12 +2679,12 @@ var views = {
2844
2679
 
2845
2680
  // src/services/ViewRouteGateway.ts
2846
2681
  var ViewRouteGateway = class extends RouteGateway {
2847
- constructor(route2, routeId, views2 = {
2682
+ constructor(route, routeId, views2 = {
2848
2683
  in: view({}).fromSource,
2849
2684
  out: view({}).fromSource
2850
2685
  }, api2 = new Api()) {
2851
- super(route2, routeId, api2);
2852
- this.route = route2;
2686
+ super(route, routeId, api2);
2687
+ this.route = route;
2853
2688
  this.routeId = routeId;
2854
2689
  this.views = views2;
2855
2690
  this.api = api2;
@@ -3212,6 +3047,74 @@ var tag = (name) => (subject, property) => {
3212
3047
  };
3213
3048
  var searchable = () => tag(searchable.name);
3214
3049
 
3050
+ // src/types/Uri.ts
3051
+ var toSegment = (key, {
3052
+ segment,
3053
+ query
3054
+ } = {}) => ({
3055
+ key,
3056
+ segment,
3057
+ query,
3058
+ toString: () => asString(key)
3059
+ });
3060
+ var uri = {
3061
+ host: (key) => toSegment(key, { segment: key ?? ctx.env.host ?? "$host" }),
3062
+ resource: (resource) => toSegment(toName(resource, "Uri"), { segment: toName(resource, "Uri") }),
3063
+ segment: (key) => toSegment(key, { segment: key }),
3064
+ path: (key) => toSegment(key, { segment: `:${key}` }),
3065
+ query: (key) => toSegment(key, {
3066
+ query: (value) => tryTo(value).is.defined().map((v) => encodeURIComponent(asString(v))).map((v) => `${key}=${v}`).orElse("") ?? ""
3067
+ }),
3068
+ boolean: (key) => toSegment(key, { query: (value) => isTrue(value) ? `${key}` : "" })
3069
+ };
3070
+ var toRoute = (...segments) => toList(segments).mapDefined((s) => s.segment).join("/");
3071
+ var EasyUri = class _EasyUri {
3072
+ constructor(segments = []) {
3073
+ this.segments = segments;
3074
+ }
3075
+ static id = uri.path("id");
3076
+ static ids = uri.query("ids");
3077
+ static query = uri.query("q");
3078
+ static sort = uri.query("s");
3079
+ static skip = uri.query("skip");
3080
+ static take = uri.query("take");
3081
+ host = uri.host();
3082
+ resource = uri.resource(this);
3083
+ state = {};
3084
+ get path() {
3085
+ return toRoute(uri.segment(""), this.resource, ...this.segments);
3086
+ }
3087
+ get complete() {
3088
+ return toRoute(this.host, this.resource, ...this.segments);
3089
+ }
3090
+ get isInternal() {
3091
+ return toRoute(this.host) === (ctx.env.host ?? "$host");
3092
+ }
3093
+ get props() {
3094
+ return meta(this.state).values();
3095
+ }
3096
+ route = (resource = this.resource.key) => toRoute(uri.segment(""), uri.segment(resource?.toLowerCase()), ...this.segments);
3097
+ set = (segment, value) => {
3098
+ tryTo(value).is.defined().accept((value2) => this.state[segment.key ?? ""] = { segment, value: value2 });
3099
+ return this;
3100
+ };
3101
+ toString() {
3102
+ 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((route) => ({
3103
+ route,
3104
+ query: this.props.mapDefined((p) => p.segment?.query ? p.segment?.query(p.value) : void 0)?.join("&")
3105
+ })).map(({ route, query }) => isNotEmpty(query) ? `${route}?${query}` : route).value;
3106
+ }
3107
+ id = (id) => this.set(_EasyUri.id, id);
3108
+ ids = (ids) => this.set(_EasyUri.ids, toArray(ids).join(","));
3109
+ query = (q) => this.set(_EasyUri.query, q);
3110
+ sort = (s) => this.set(_EasyUri.sort, asString(s));
3111
+ skip = (index) => this.set(_EasyUri.skip, index);
3112
+ take = (items) => this.set(_EasyUri.take, items);
3113
+ expand(props) {
3114
+ 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);
3115
+ }
3116
+ };
3117
+
3215
3118
  // src/utils/Base64.ts
3216
3119
  var base64 = {
3217
3120
  decode: (data) => Buffer.from(data, "base64").toString("utf-8"),
@@ -3327,8 +3230,6 @@ var wait = (millis) => Wait.wait(millis);
3327
3230
  Exception,
3328
3231
  Field,
3329
3232
  Gateway,
3330
- HealthResource,
3331
- HealthUri,
3332
3233
  HttpHeader,
3333
3234
  HttpStatus,
3334
3235
  HttpVerb,
@@ -3342,7 +3243,6 @@ var wait = (millis) => Wait.wait(millis);
3342
3243
  MappedRouteGateway,
3343
3244
  Mapper,
3344
3245
  OrderColumn,
3345
- OriginatedError,
3346
3246
  PageList,
3347
3247
  ParathesizedClause,
3348
3248
  Parser,
@@ -3352,14 +3252,12 @@ var wait = (millis) => Wait.wait(millis);
3352
3252
  Repository,
3353
3253
  Req,
3354
3254
  RequestOptions,
3355
- Requires,
3356
3255
  Results,
3357
3256
  RouteGateway,
3358
3257
  Scope,
3359
3258
  Search,
3360
3259
  Select,
3361
3260
  Sentence,
3362
- Service,
3363
3261
  SortCondition,
3364
3262
  SqlQuery,
3365
3263
  State,
@@ -3397,13 +3295,11 @@ var wait = (millis) => Wait.wait(millis);
3397
3295
  ctx,
3398
3296
  days,
3399
3297
  defined,
3400
- del,
3401
3298
  desc,
3402
3299
  dir,
3403
3300
  dt,
3404
3301
  entries,
3405
3302
  future,
3406
- get,
3407
3303
  gt,
3408
3304
  gte,
3409
3305
  ifA,
@@ -3452,7 +3348,6 @@ var wait = (millis) => Wait.wait(millis);
3452
3348
  isNullish,
3453
3349
  isNumber,
3454
3350
  isObject,
3455
- isOriginatedError,
3456
3351
  isPageList,
3457
3352
  isPresent,
3458
3353
  isPrimitive,
@@ -3492,23 +3387,15 @@ var wait = (millis) => Wait.wait(millis);
3492
3387
  on,
3493
3388
  optional,
3494
3389
  past,
3495
- patch,
3496
- post,
3497
- put,
3498
3390
  quote,
3499
3391
  reject,
3500
3392
  replaceAll,
3501
3393
  required,
3502
- requires,
3503
3394
  resolve,
3504
3395
  rest,
3505
- route,
3506
- routes,
3507
3396
  rule,
3508
- search,
3509
3397
  searchable,
3510
3398
  singleton,
3511
- stream,
3512
3399
  tag,
3513
3400
  template,
3514
3401
  text,
@@ -3524,7 +3411,6 @@ var wait = (millis) => Wait.wait(millis);
3524
3411
  toList,
3525
3412
  toName,
3526
3413
  toObject,
3527
- toOriginatedError,
3528
3414
  toPageList,
3529
3415
  toPageOptions,
3530
3416
  toReq,
@@ -3534,7 +3420,6 @@ var wait = (millis) => Wait.wait(millis);
3534
3420
  toSegment,
3535
3421
  toShortFilter,
3536
3422
  toUuid,
3537
- toVerbOptions,
3538
3423
  toViewer,
3539
3424
  toWords,
3540
3425
  traverse,