@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
@@ -1,17 +0,0 @@
1
- import { AppProvider, Handler } from './AppProvider';
2
- import { Resource } from './Resource';
3
- import { Enum } from '../types/Enum';
4
- import { List } from '../types/List';
5
- import { Constructor } from '../types/Constructor';
6
- export declare class Service extends Enum {
7
- readonly name: string;
8
- protected app: AppProvider;
9
- protected resources: List<Resource>;
10
- protected port: number;
11
- constructor(name: string, app: AppProvider, resources?: List<Resource>);
12
- pre: () => Handler[];
13
- post: () => Handler[];
14
- with(...resources: Constructor<Resource>[]): this;
15
- atPort(port: number): this;
16
- start(message?: string): void;
17
- }
@@ -1,55 +0,0 @@
1
- import {
2
- tryTo
3
- } from "../chunk-ARZEQQW5.mjs";
4
- import "../chunk-OFGI5FLG.mjs";
5
- import "../chunk-CAHTK3AT.mjs";
6
- import "../chunk-4G6AW6D6.mjs";
7
- import "../chunk-J6KN572O.mjs";
8
- import "../chunk-USGZFNWP.mjs";
9
- import "../chunk-LYAPQ4QZ.mjs";
10
- import "../chunk-6YVMQB26.mjs";
11
- import "../chunk-FHW5K2RR.mjs";
12
- import {
13
- Enum
14
- } from "../chunk-UNHWYQ54.mjs";
15
- import "../chunk-PPWHEIZW.mjs";
16
- import "../chunk-JTGB3TSZ.mjs";
17
- import {
18
- toList
19
- } from "../chunk-J7XKOXMW.mjs";
20
- import "../chunk-JSON7A4X.mjs";
21
- import "../chunk-X7FZPY3P.mjs";
22
- import "../chunk-45GNHDKA.mjs";
23
- import "../chunk-SJGQU3OG.mjs";
24
- import "../chunk-ZHXKBOK2.mjs";
25
- import "../chunk-ZPNFXK7Y.mjs";
26
- import "../chunk-DXQSIBC7.mjs";
27
- import "../chunk-PIRWVOO2.mjs";
28
- import "../chunk-DEJ7A5PY.mjs";
29
- import "../chunk-4N72FQFX.mjs";
30
-
31
- // src/resources/Service.ts
32
- var Service = class extends Enum {
33
- constructor(name, app, resources = toList()) {
34
- super(name);
35
- this.name = name;
36
- this.app = app;
37
- this.resources = resources;
38
- }
39
- port = 8080;
40
- pre = () => [];
41
- post = () => [];
42
- with(...resources) {
43
- return tryTo(this).accept((t) => t.resources.add(resources.map((r) => new r()))).value;
44
- }
45
- atPort(port) {
46
- return tryTo(this).accept((t) => t.port = port).value;
47
- }
48
- start(message = `Service ${this.name} listening on port ${this.port} with ${this.resources.length} resources.`) {
49
- 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));
50
- }
51
- };
52
- export {
53
- Service
54
- };
55
- //# sourceMappingURL=Service.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/resources/Service.ts"],"sourcesContent":["import { AppProvider, Handler } from './AppProvider';\nimport { Resource } from './Resource';\nimport { Enum } from '../types/Enum';\nimport { List, toList } from '../types/List';\nimport { Constructor } from '../types/Constructor';\nimport { tryTo } from '../types/Try';\n\nexport class Service extends Enum {\n protected port = 8080;\n\n constructor(\n readonly name: string,\n protected app: AppProvider,\n protected resources: List<Resource> = toList()\n ) {\n super(name);\n }\n\n pre = (): Handler[] => [];\n post = (): Handler[] => [];\n\n with(...resources: Constructor<Resource>[]): this {\n return tryTo(this).accept(t => t.resources.add(resources.map(r => new r()))).value;\n }\n\n atPort(port: number): this {\n return tryTo(this).accept(t => (t.port = port)).value;\n }\n\n start(message = `Service ${this.name} listening on port ${this.port} with ${this.resources.length} resources.`): void {\n tryTo(this)\n .accept(t => t.pre().forEach(h => this.app.use(h)))\n .accept(t => t.resources.forEach(r => this.app.route(this, r)))\n .accept(t => t.post().forEach(h => this.app.use(h)))\n .accept(t => t.app.listen(this.port, message));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,IAAM,UAAN,cAAsB,KAAK;AAAA,EAGhC,YACW,MACC,KACA,YAA4B,OAAO,GAC7C;AACA,UAAM,IAAI;AAJD;AACC;AACA;AAAA,EAGZ;AAAA,EARU,OAAO;AAAA,EAUjB,MAAM,MAAiB,CAAC;AAAA,EACxB,OAAO,MAAiB,CAAC;AAAA,EAEzB,QAAQ,WAA0C;AAChD,WAAO,MAAM,IAAI,EAAE,OAAO,OAAK,EAAE,UAAU,IAAI,UAAU,IAAI,OAAK,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;AAAA,EAC/E;AAAA,EAEA,OAAO,MAAoB;AACzB,WAAO,MAAM,IAAI,EAAE,OAAO,OAAM,EAAE,OAAO,IAAK,EAAE;AAAA,EAClD;AAAA,EAEA,MAAM,UAAU,WAAW,KAAK,IAAI,sBAAsB,KAAK,IAAI,SAAS,KAAK,UAAU,MAAM,eAAqB;AACpH,UAAM,IAAI,EACP,OAAO,OAAK,EAAE,IAAI,EAAE,QAAQ,OAAK,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EACjD,OAAO,OAAK,EAAE,UAAU,QAAQ,OAAK,KAAK,IAAI,MAAM,MAAM,CAAC,CAAC,CAAC,EAC7D,OAAO,OAAK,EAAE,KAAK,EAAE,QAAQ,OAAK,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAClD,OAAO,OAAK,EAAE,IAAI,OAAO,KAAK,MAAM,OAAO,CAAC;AAAA,EACjD;AACF;","names":[]}
@@ -1,12 +0,0 @@
1
- import { HealthUri } from './HealthUri';
2
- import { route } from '../resources/Route';
3
- import { Resource } from '../resources/Resource';
4
- import { get } from '../http/Verb';
5
- import { Json } from '../types/Json';
6
- import { resolve } from '../utils/Promise';
7
-
8
- @route(HealthUri.Health)
9
- export class HealthResource implements Resource {
10
- @get()
11
- ok = (): Promise<Json> => resolve({ state: 'Service is healthy.' });
12
- }
@@ -1,6 +0,0 @@
1
- import { EasyUri, uri } from '../types/Uri';
2
-
3
- export class HealthUri extends EasyUri {
4
- static readonly health = uri.segment('health');
5
- static readonly Health = new HealthUri([HealthUri.health]);
6
- }
@@ -1,18 +0,0 @@
1
- import { VerbOptions } from './Verb';
2
- import { ErrorOrigin } from '../types/ErrorOrigin';
3
- import { isError } from '../types/Is';
4
-
5
- export class OriginatedError extends Error {
6
- constructor(
7
- readonly origin: ErrorOrigin,
8
- readonly options?: VerbOptions
9
- ) {
10
- super();
11
- if (isError(origin)) this.stack = origin.stack;
12
- }
13
- }
14
-
15
- export const isOriginatedError = (e?: unknown): e is OriginatedError => isError(e) && e instanceof OriginatedError;
16
-
17
- export const toOriginatedError = (e: unknown, options?: VerbOptions): OriginatedError =>
18
- isOriginatedError(e) ? e : new OriginatedError(e as ErrorOrigin, options);
package/src/http/Verb.ts DELETED
@@ -1,36 +0,0 @@
1
- import { meta } from '../types/Meta';
2
- import { HttpStatus } from './HttpStatus';
3
- import { ContentType } from './ContentType';
4
- import { CacheControl } from './CacheControl';
5
- import { HttpVerb } from './HttpVerb';
6
-
7
- export type VerbOptions = { onOk?: HttpStatus; onNotFound?: HttpStatus; onError?: HttpStatus; type?: ContentType; cache?: CacheControl };
8
- export type Verb = { verb: HttpVerb; options: VerbOptions };
9
-
10
- export const toVerbOptions = (options?: VerbOptions): Required<VerbOptions> => ({
11
- onOk: options?.onOk ?? HttpStatus.Ok,
12
- onNotFound: options?.onNotFound ?? HttpStatus.NotFound,
13
- onError: options?.onError ?? HttpStatus.BadRequest,
14
- type: options?.type ?? ContentType.Json,
15
- cache: options?.cache ?? CacheControl.disabled(),
16
- });
17
-
18
- const toVerb =
19
- <T>(verb: HttpVerb, options?: VerbOptions): PropertyDecorator =>
20
- (subject: unknown, property: string | symbol): void => {
21
- meta(subject).property(property).set('verb', { verb, options });
22
- };
23
-
24
- export const get = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Get, options);
25
-
26
- export const search = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Get, { onNotFound: HttpStatus.Ok, ...options });
27
-
28
- export const put = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Put, options);
29
-
30
- export const patch = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Patch, options);
31
-
32
- export const post = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Post, { onOk: HttpStatus.Created, ...options });
33
-
34
- export const del = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Delete, { onOk: HttpStatus.NoContent, ...options });
35
-
36
- export const stream = (options?: VerbOptions): PropertyDecorator => toVerb(HttpVerb.Get, { type: ContentType.Stream, ...options });
@@ -1,11 +0,0 @@
1
- import { Resource } from './Resource';
2
- import { Service } from './Service';
3
- import { Func } from '../types/Func';
4
-
5
- export type Handler = Func<void, any>;
6
-
7
- export interface AppProvider {
8
- use: (h: Handler) => void;
9
- route: (s: Service, r: Resource) => void;
10
- listen: (port: number, message?: string) => void;
11
- }
@@ -1,33 +0,0 @@
1
- import { meta } from '../types/Meta';
2
- import { Scope } from '../process/Scope';
3
- import { UseCase } from '../process/UseCase';
4
-
5
- export class Requires {
6
- readonly labCoat =
7
- (): PropertyDecorator =>
8
- (subject: unknown, property: string | symbol): void => {
9
- meta(subject).property(property).set('labCoat', true);
10
- };
11
-
12
- readonly token =
13
- (): PropertyDecorator =>
14
- (subject: unknown, property: string | symbol): void => {
15
- meta(subject).property(property).set('token', true);
16
- };
17
-
18
- readonly scope =
19
- (scope: Scope): PropertyDecorator =>
20
- (subject: unknown, property: string | symbol): void => {
21
- meta(subject).property(property).set('token', true);
22
- meta(subject).property(property).set('scope', scope);
23
- };
24
-
25
- readonly useCase =
26
- (uc: UseCase): PropertyDecorator =>
27
- (subject: unknown, property: string | symbol): void => {
28
- meta(subject).property(property).set('token', true);
29
- meta(subject).property(property).set('uc', uc);
30
- };
31
- }
32
-
33
- export const requires = new Requires();
@@ -1 +0,0 @@
1
- export type Resource = any;
@@ -1,60 +0,0 @@
1
- import { Req } from './Req';
2
- import { Resource } from './Resource';
3
- import { RequestHandler } from 'express';
4
- import { Uri } from '../types/Uri';
5
- import { meta } from '../types/Meta';
6
- import { List } from '../types/List';
7
- import { Scope } from '../process/Scope';
8
- import { UseCase } from '../process/UseCase';
9
- import { Verb } from '../http/Verb';
10
- import { Optional } from '../types/Types';
11
- import { tryTo } from '../types/Try';
12
-
13
- export const route =
14
- (uri: Uri): ClassDecorator =>
15
- (subject: unknown): void => {
16
- meta(subject).set('route', uri);
17
- };
18
-
19
- export type Endpoint<T = unknown> = (re: Req) => Promise<T | List<T>>;
20
- export type RouteRequires = { token: boolean; labCoat: boolean; scope?: Scope; uc?: UseCase };
21
- export type Route = { verb: Verb; endpoint: Endpoint; requires: RouteRequires; middleware: RequestHandler[] };
22
- export type Routes = { route: Uri; middleware: RequestHandler[]; endpoints: List<Route> };
23
-
24
- const toRoute = (endpoint: Endpoint, requires: RouteRequires, verb?: Verb, middleware?: RequestHandler[]): Optional<Route> =>
25
- tryTo(verb)
26
- .is.defined()
27
- .map(verb => ({ verb, endpoint, requires, middleware: middleware ?? [] }) as Route)
28
- .orElse();
29
-
30
- class Router implements Routes {
31
- constructor(readonly resource: Resource) {}
32
-
33
- get route(): Uri {
34
- return meta(this.resource).get('route');
35
- }
36
-
37
- get middleware(): RequestHandler[] {
38
- return meta(this.resource).get<RequestHandler[]>('middleware') ?? [];
39
- }
40
-
41
- get endpoints(): List<Route> {
42
- return meta(this.resource)
43
- .properties('verb')
44
- .mapDefined(v =>
45
- toRoute(
46
- this.resource[v.property],
47
- {
48
- labCoat: v.get<boolean>('labCoat') ?? false,
49
- token: v.get<boolean>('token') ?? false,
50
- scope: v.get<Scope>('scope'),
51
- uc: v.get<UseCase>('uc'),
52
- },
53
- v.get<Verb>('verb'),
54
- v.get<RequestHandler[]>('middleware')
55
- )
56
- );
57
- }
58
- }
59
-
60
- export const routes = (resource: Resource): Routes => new Router(resource);
@@ -1,37 +0,0 @@
1
- import { AppProvider, Handler } from './AppProvider';
2
- import { Resource } from './Resource';
3
- import { Enum } from '../types/Enum';
4
- import { List, toList } from '../types/List';
5
- import { Constructor } from '../types/Constructor';
6
- import { tryTo } from '../types/Try';
7
-
8
- export class Service extends Enum {
9
- protected port = 8080;
10
-
11
- constructor(
12
- readonly name: string,
13
- protected app: AppProvider,
14
- protected resources: List<Resource> = toList()
15
- ) {
16
- super(name);
17
- }
18
-
19
- pre = (): Handler[] => [];
20
- post = (): Handler[] => [];
21
-
22
- with(...resources: Constructor<Resource>[]): this {
23
- return tryTo(this).accept(t => t.resources.add(resources.map(r => new r()))).value;
24
- }
25
-
26
- atPort(port: number): this {
27
- return tryTo(this).accept(t => (t.port = port)).value;
28
- }
29
-
30
- start(message = `Service ${this.name} listening on port ${this.port} with ${this.resources.length} resources.`): void {
31
- tryTo(this)
32
- .accept(t => t.pre().forEach(h => this.app.use(h)))
33
- .accept(t => t.resources.forEach(r => this.app.route(this, r)))
34
- .accept(t => t.post().forEach(h => this.app.use(h)))
35
- .accept(t => t.app.listen(this.port, message));
36
- }
37
- }