@thisisagile/easy 18.6.0 → 18.8.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 (185) hide show
  1. package/dist/{chunk-34COXZ5A.mjs → chunk-5N6Q7OXJ.mjs} +3 -3
  2. package/dist/{chunk-ZBVKM7WT.mjs → chunk-63DTRTSC.mjs} +4 -8
  3. package/dist/{chunk-ZBVKM7WT.mjs.map → chunk-63DTRTSC.mjs.map} +1 -1
  4. package/dist/{chunk-U3NVU37K.mjs → chunk-6PMTGQVO.mjs} +3 -3
  5. package/dist/{chunk-ISRJB7Z4.mjs → chunk-6YTIRHPN.mjs} +4 -6
  6. package/dist/{chunk-ISRJB7Z4.mjs.map → chunk-6YTIRHPN.mjs.map} +1 -1
  7. package/dist/{chunk-GOZMSSH5.mjs → chunk-AYR4US3Z.mjs} +2 -2
  8. package/dist/{chunk-6MBDCDGA.mjs → chunk-B37NZCNW.mjs} +2 -2
  9. package/dist/{chunk-H73MZAGT.mjs → chunk-FF3BNZ4H.mjs} +3 -5
  10. package/dist/{chunk-H73MZAGT.mjs.map → chunk-FF3BNZ4H.mjs.map} +1 -1
  11. package/dist/{chunk-WWYPWYFC.mjs → chunk-FFD2T6YV.mjs} +2 -2
  12. package/dist/{chunk-GV6NUD6R.mjs → chunk-FSWASMJZ.mjs} +2 -2
  13. package/dist/{chunk-TRR2LTWJ.mjs → chunk-GF7JYGJU.mjs} +4 -8
  14. package/dist/{chunk-TRR2LTWJ.mjs.map → chunk-GF7JYGJU.mjs.map} +1 -1
  15. package/dist/{chunk-LPT6LW5N.mjs → chunk-GKQMIKIY.mjs} +2 -2
  16. package/dist/{chunk-C6VQGKDB.mjs → chunk-IESVFCB3.mjs} +3 -3
  17. package/dist/{chunk-JZCNZKGP.mjs → chunk-IYUYA5OX.mjs} +5 -5
  18. package/dist/{chunk-SW73SKB2.mjs → chunk-J5PB7ZVO.mjs} +4 -6
  19. package/dist/{chunk-SW73SKB2.mjs.map → chunk-J5PB7ZVO.mjs.map} +1 -1
  20. package/dist/{chunk-V6TMXDF7.mjs → chunk-JI7MC5EA.mjs} +2 -2
  21. package/dist/{chunk-GMFUUU3V.mjs → chunk-JM6NAJQ3.mjs} +4 -6
  22. package/dist/{chunk-GMFUUU3V.mjs.map → chunk-JM6NAJQ3.mjs.map} +1 -1
  23. package/dist/{chunk-2SE4U4T2.mjs → chunk-JNZUGKMO.mjs} +2 -2
  24. package/dist/{chunk-MLYUI7R7.mjs → chunk-KPXOQFEB.mjs} +4 -6
  25. package/dist/{chunk-MLYUI7R7.mjs.map → chunk-KPXOQFEB.mjs.map} +1 -1
  26. package/dist/{chunk-FAFNTQIS.mjs → chunk-LHDTOERW.mjs} +3 -5
  27. package/dist/{chunk-FAFNTQIS.mjs.map → chunk-LHDTOERW.mjs.map} +1 -1
  28. package/dist/{chunk-CFJJ2C6C.mjs → chunk-M2S4OLVZ.mjs} +2 -2
  29. package/dist/{chunk-SW5NBVHL.mjs → chunk-O4RWZGFC.mjs} +4 -6
  30. package/dist/{chunk-SW5NBVHL.mjs.map → chunk-O4RWZGFC.mjs.map} +1 -1
  31. package/dist/{chunk-ZEIIFJDX.mjs → chunk-QBPSI5NM.mjs} +4 -4
  32. package/dist/{chunk-HBDIZSIE.mjs → chunk-QLEGIYVU.mjs} +3 -5
  33. package/dist/{chunk-HBDIZSIE.mjs.map → chunk-QLEGIYVU.mjs.map} +1 -1
  34. package/dist/{chunk-DUYHH6LC.mjs → chunk-QZPBFVZL.mjs} +2 -2
  35. package/dist/{chunk-YXLGHJ5Q.mjs → chunk-RBJBAJOK.mjs} +2 -2
  36. package/dist/{chunk-5C5OHGRW.mjs → chunk-RW4AKBCN.mjs} +3 -3
  37. package/dist/{chunk-5FD5G442.mjs → chunk-SBT3WGBP.mjs} +7 -7
  38. package/dist/{chunk-USR4ETA7.mjs → chunk-TNIG6FU2.mjs} +2 -2
  39. package/dist/{chunk-5BGTUK7G.mjs → chunk-TUO7ZPSP.mjs} +540 -104
  40. package/dist/chunk-TUO7ZPSP.mjs.map +1 -0
  41. package/dist/{chunk-UATZAAX2.mjs → chunk-WOUH6UVC.mjs} +3 -5
  42. package/dist/{chunk-UATZAAX2.mjs.map → chunk-WOUH6UVC.mjs.map} +1 -1
  43. package/dist/{chunk-KXNGKB2N.mjs → chunk-XQ4F3L4F.mjs} +22 -16
  44. package/dist/{chunk-KXNGKB2N.mjs.map → chunk-XQ4F3L4F.mjs.map} +1 -1
  45. package/dist/{chunk-5MCJXABA.mjs → chunk-XQJ5LQEQ.mjs} +2 -2
  46. package/dist/{chunk-5JE4QW4E.mjs → chunk-ZBOGLMG2.mjs} +4 -4
  47. package/dist/{chunk-UGNNHNYX.mjs → chunk-ZRH6FGUK.mjs} +4 -4
  48. package/dist/{chunk-LCJEJ3LU.mjs → chunk-ZZ73Z5CU.mjs} +2 -2
  49. package/dist/data/Condition.mjs +5 -4
  50. package/dist/data/Database.mjs +4 -5
  51. package/dist/data/Field.mjs +5 -4
  52. package/dist/data/Field.mjs.map +1 -1
  53. package/dist/data/InMemoryGateway.mjs +4 -9
  54. package/dist/data/InMemoryGateway.mjs.map +1 -1
  55. package/dist/domain/Audit.mjs +8 -13
  56. package/dist/domain/Child.mjs +5 -10
  57. package/dist/domain/Child.mjs.map +1 -1
  58. package/dist/domain/DateTime.mjs +4 -9
  59. package/dist/domain/Entity.mjs +8 -13
  60. package/dist/domain/Entity.mjs.map +1 -1
  61. package/dist/domain/Repo.mjs +7 -14
  62. package/dist/domain/Repo.mjs.map +1 -1
  63. package/dist/domain/Struct.mjs +4 -9
  64. package/dist/domain/Typo.mjs +4 -9
  65. package/dist/domain/Typo.mjs.map +1 -1
  66. package/dist/http/CacheControl.mjs +6 -12
  67. package/dist/http/CacheControl.mjs.map +1 -1
  68. package/dist/http/ContentType.mjs +4 -5
  69. package/dist/http/HttpStatus.mjs +4 -5
  70. package/dist/http/HttpVerb.mjs +4 -5
  71. package/dist/http/LocalRequestStore.mjs +2 -7
  72. package/dist/http/LocalRequestStore.mjs.map +1 -1
  73. package/dist/http/RequestOptions.mjs +4 -9
  74. package/dist/http/RestResult.mjs +4 -9
  75. package/dist/http/toResponse.mjs +5 -10
  76. package/dist/index.js +540 -521
  77. package/dist/index.js.map +1 -1
  78. package/dist/process/App.mjs +3 -8
  79. package/dist/process/App.mjs.map +1 -1
  80. package/dist/process/Manage.mjs +4 -9
  81. package/dist/process/Manage.mjs.map +1 -1
  82. package/dist/process/Scope.mjs +3 -8
  83. package/dist/process/Search.mjs +4 -9
  84. package/dist/process/UseCase.mjs +5 -12
  85. package/dist/process/UseCase.mjs.map +1 -1
  86. package/dist/resources/Req.mjs +4 -9
  87. package/dist/resources/Req.mjs.map +1 -1
  88. package/dist/services/Api.mjs +12 -17
  89. package/dist/services/ApiGateway.mjs +15 -20
  90. package/dist/services/AxiosProvider.mjs +10 -15
  91. package/dist/services/MappedRouteGateway.mjs +18 -23
  92. package/dist/services/MappedRouteGateway.mjs.map +1 -1
  93. package/dist/services/RouteGateway.mjs +16 -21
  94. package/dist/services/ViewRouteGateway.mjs +18 -24
  95. package/dist/services/ViewRouteGateway.mjs.map +1 -1
  96. package/dist/sql/Column.mjs +3 -8
  97. package/dist/sql/Count.mjs +6 -4
  98. package/dist/sql/Delete.mjs +5 -3
  99. package/dist/sql/Insert.mjs +5 -3
  100. package/dist/sql/Select.mjs +5 -3
  101. package/dist/sql/SqlQuery.mjs +4 -2
  102. package/dist/sql/Table.mjs +13 -18
  103. package/dist/sql/Table.mjs.map +1 -1
  104. package/dist/sql/TableGateway.mjs +5 -11
  105. package/dist/sql/TableGateway.mjs.map +1 -1
  106. package/dist/sql/Update.mjs +5 -3
  107. package/dist/types/Cache.mjs +3 -3
  108. package/dist/types/CacheAge.mjs +4 -9
  109. package/dist/types/Case.mjs +2 -7
  110. package/dist/types/Context.mjs +2 -7
  111. package/dist/types/Enum.mjs +3 -4
  112. package/dist/types/Environment.mjs +3 -4
  113. package/dist/types/Environment.mjs.map +1 -1
  114. package/dist/types/Exception.mjs +2 -7
  115. package/dist/types/Gateway.mjs +3 -8
  116. package/dist/types/IsEqual.mjs +2 -8
  117. package/dist/types/Json.mjs +4 -3
  118. package/dist/types/List.mjs +3 -1
  119. package/dist/types/Meta.mjs +3 -3
  120. package/dist/types/Number.mjs +3 -8
  121. package/dist/types/Object.mjs +3 -2
  122. package/dist/types/PageList.mjs +3 -8
  123. package/dist/types/Parser.mjs +2 -7
  124. package/dist/types/Parser.mjs.map +1 -1
  125. package/dist/types/Repository.mjs +3 -8
  126. package/dist/types/Result.mjs +2 -7
  127. package/dist/types/Results.mjs +2 -7
  128. package/dist/types/Tag.mjs +3 -3
  129. package/dist/types/Template.mjs +2 -7
  130. package/dist/types/ToText.mjs +2 -7
  131. package/dist/types/Try.mjs +2 -7
  132. package/dist/types/Uri.mjs +5 -13
  133. package/dist/types/Uri.mjs.map +1 -1
  134. package/dist/utils/If.d.ts +2 -0
  135. package/dist/utils/If.mjs +5 -1
  136. package/dist/utils/Mapper.mjs +5 -5
  137. package/dist/utils/Period.mjs +4 -9
  138. package/dist/utils/Period.mjs.map +1 -1
  139. package/dist/utils/Promise.mjs +3 -3
  140. package/dist/utils/Seconds.mjs +4 -2
  141. package/dist/utils/Sentence.mjs +2 -7
  142. package/dist/utils/Sentence.mjs.map +1 -1
  143. package/dist/utils/View.d.ts +7 -0
  144. package/dist/utils/View.mjs +5 -11
  145. package/dist/validation/Contraints.mjs +3 -8
  146. package/dist/validation/Validate.mjs +2 -7
  147. package/dist/validation/When.mjs +2 -7
  148. package/package.json +1 -1
  149. package/src/utils/If.ts +7 -0
  150. package/src/utils/View.ts +14 -0
  151. package/dist/chunk-2PL5VUHT.mjs +0 -37
  152. package/dist/chunk-2PL5VUHT.mjs.map +0 -1
  153. package/dist/chunk-5BGTUK7G.mjs.map +0 -1
  154. package/dist/chunk-5FAZA55F.mjs +0 -58
  155. package/dist/chunk-5FAZA55F.mjs.map +0 -1
  156. package/dist/chunk-7A3RM67L.mjs +0 -68
  157. package/dist/chunk-7A3RM67L.mjs.map +0 -1
  158. package/dist/chunk-AJZIKJEC.mjs +0 -54
  159. package/dist/chunk-AJZIKJEC.mjs.map +0 -1
  160. package/dist/chunk-AQXV7L65.mjs +0 -310
  161. package/dist/chunk-AQXV7L65.mjs.map +0 -1
  162. package/dist/chunk-DC5HIBQG.mjs +0 -23
  163. package/dist/chunk-DC5HIBQG.mjs.map +0 -1
  164. /package/dist/{chunk-34COXZ5A.mjs.map → chunk-5N6Q7OXJ.mjs.map} +0 -0
  165. /package/dist/{chunk-U3NVU37K.mjs.map → chunk-6PMTGQVO.mjs.map} +0 -0
  166. /package/dist/{chunk-GOZMSSH5.mjs.map → chunk-AYR4US3Z.mjs.map} +0 -0
  167. /package/dist/{chunk-6MBDCDGA.mjs.map → chunk-B37NZCNW.mjs.map} +0 -0
  168. /package/dist/{chunk-WWYPWYFC.mjs.map → chunk-FFD2T6YV.mjs.map} +0 -0
  169. /package/dist/{chunk-GV6NUD6R.mjs.map → chunk-FSWASMJZ.mjs.map} +0 -0
  170. /package/dist/{chunk-LPT6LW5N.mjs.map → chunk-GKQMIKIY.mjs.map} +0 -0
  171. /package/dist/{chunk-C6VQGKDB.mjs.map → chunk-IESVFCB3.mjs.map} +0 -0
  172. /package/dist/{chunk-JZCNZKGP.mjs.map → chunk-IYUYA5OX.mjs.map} +0 -0
  173. /package/dist/{chunk-V6TMXDF7.mjs.map → chunk-JI7MC5EA.mjs.map} +0 -0
  174. /package/dist/{chunk-2SE4U4T2.mjs.map → chunk-JNZUGKMO.mjs.map} +0 -0
  175. /package/dist/{chunk-CFJJ2C6C.mjs.map → chunk-M2S4OLVZ.mjs.map} +0 -0
  176. /package/dist/{chunk-ZEIIFJDX.mjs.map → chunk-QBPSI5NM.mjs.map} +0 -0
  177. /package/dist/{chunk-DUYHH6LC.mjs.map → chunk-QZPBFVZL.mjs.map} +0 -0
  178. /package/dist/{chunk-YXLGHJ5Q.mjs.map → chunk-RBJBAJOK.mjs.map} +0 -0
  179. /package/dist/{chunk-5C5OHGRW.mjs.map → chunk-RW4AKBCN.mjs.map} +0 -0
  180. /package/dist/{chunk-5FD5G442.mjs.map → chunk-SBT3WGBP.mjs.map} +0 -0
  181. /package/dist/{chunk-USR4ETA7.mjs.map → chunk-TNIG6FU2.mjs.map} +0 -0
  182. /package/dist/{chunk-5MCJXABA.mjs.map → chunk-XQJ5LQEQ.mjs.map} +0 -0
  183. /package/dist/{chunk-5JE4QW4E.mjs.map → chunk-ZBOGLMG2.mjs.map} +0 -0
  184. /package/dist/{chunk-UGNNHNYX.mjs.map → chunk-ZRH6FGUK.mjs.map} +0 -0
  185. /package/dist/{chunk-LCJEJ3LU.mjs.map → chunk-ZZ73Z5CU.mjs.map} +0 -0
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  rest
3
- } from "./chunk-ISRJB7Z4.mjs";
3
+ } from "./chunk-6YTIRHPN.mjs";
4
4
  import {
5
5
  toHttpStatus
6
- } from "./chunk-GV6NUD6R.mjs";
6
+ } from "./chunk-FSWASMJZ.mjs";
7
7
 
8
8
  // src/http/toResponse.ts
9
9
  function toResponse(status, body, headers) {
@@ -17,4 +17,4 @@ function toResponse(status, body, headers) {
17
17
  export {
18
18
  toResponse
19
19
  };
20
- //# sourceMappingURL=chunk-34COXZ5A.mjs.map
20
+ //# sourceMappingURL=chunk-5N6Q7OXJ.mjs.map
@@ -1,12 +1,8 @@
1
1
  import {
2
- text
3
- } from "./chunk-5BGTUK7G.mjs";
4
- import {
5
- Enum
6
- } from "./chunk-7A3RM67L.mjs";
7
- import {
2
+ Enum,
3
+ text,
8
4
  toList
9
- } from "./chunk-AQXV7L65.mjs";
5
+ } from "./chunk-TUO7ZPSP.mjs";
10
6
  import {
11
7
  kebab
12
8
  } from "./chunk-4Q6IHSAU.mjs";
@@ -36,4 +32,4 @@ var Scope = class _Scope extends Enum {
36
32
  export {
37
33
  Scope
38
34
  };
39
- //# sourceMappingURL=chunk-ZBVKM7WT.mjs.map
35
+ //# sourceMappingURL=chunk-63DTRTSC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/process/Scope.ts"],"sourcesContent":["import { Enum } from '../types/Enum';\nimport type { Text } from '../types/Text';\nimport { kebab } from '../types/Text';\nimport { List, toList } from '../types/List';\nimport { isString } from '../types/Is';\nimport { IdNamePlain } from '../types/IdName';\nimport { text } from '../types/ToText';\n\nexport class Scope extends Enum {\n protected constructor(\n readonly name: string,\n id: Text = text(name).kebab,\n readonly subs: List<Scope> = toList()\n ) {\n super(name, id.toString());\n }\n\n for(item: string | IdNamePlain): Scope {\n return new Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));\n }\n\n combines(...scopes: Scope[]): this {\n this.subs.add(scopes);\n return this;\n }\n\n expand(): List<Scope> {\n return this.subs\n .flatMap(s => s.expand())\n .add(this)\n .distinct();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQO,IAAM,QAAN,MAAM,eAAc,KAAK;AAAA,EACpB,YACC,MACT,KAAW,KAAK,IAAI,EAAE,OACb,OAAoB,OAAO,GACpC;AACA,UAAM,MAAM,GAAG,SAAS,CAAC;AAJhB;AAEA;AAAA,EAGX;AAAA,EAEA,IAAI,MAAmC;AACrC,WAAO,IAAI,OAAM,GAAG,KAAK,IAAI,IAAI,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,QAAQ,KAAK,IAAI,IAAI,MAAM,GAAG,KAAK,EAAE,IAAI,SAAS,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;AAAA,EAC1I;AAAA,EAEA,YAAY,QAAuB;AACjC,SAAK,KAAK,IAAI,MAAM;AACpB,WAAO;AAAA,EACT;AAAA,EAEA,SAAsB;AACpB,WAAO,KAAK,KACT,QAAQ,OAAK,EAAE,OAAO,CAAC,EACvB,IAAI,IAAI,EACR,SAAS;AAAA,EACd;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/process/Scope.ts"],"sourcesContent":["import { Enum } from '../types/Enum';\nimport type { Text } from '../types/Text';\nimport { kebab } from '../types/Text';\nimport { List, toList } from '../types/List';\nimport { isString } from '../types/Is';\nimport { IdNamePlain } from '../types/IdName';\nimport { text } from '../types/ToText';\n\nexport class Scope extends Enum {\n protected constructor(\n readonly name: string,\n id: Text = text(name).kebab,\n readonly subs: List<Scope> = toList()\n ) {\n super(name, id.toString());\n }\n\n for(item: string | IdNamePlain): Scope {\n return new Scope(`${this.name} ${isString(item) ? text(item).title : item.name}`, kebab(`${this.id} ${isString(item) ? item : item.id}`));\n }\n\n combines(...scopes: Scope[]): this {\n this.subs.add(scopes);\n return this;\n }\n\n expand(): List<Scope> {\n return this.subs\n .flatMap(s => s.expand())\n .add(this)\n .distinct();\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAQO,IAAM,QAAN,MAAM,eAAc,KAAK;AAAA,EACpB,YACC,MACT,KAAW,KAAK,IAAI,EAAE,OACb,OAAoB,OAAO,GACpC;AACA,UAAM,MAAM,GAAG,SAAS,CAAC;AAJhB;AAEA;AAAA,EAGX;AAAA,EAEA,IAAI,MAAmC;AACrC,WAAO,IAAI,OAAM,GAAG,KAAK,IAAI,IAAI,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,QAAQ,KAAK,IAAI,IAAI,MAAM,GAAG,KAAK,EAAE,IAAI,SAAS,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;AAAA,EAC1I;AAAA,EAEA,YAAY,QAAuB;AACjC,SAAK,KAAK,IAAI,MAAM;AACpB,WAAO;AAAA,EACT;AAAA,EAEA,SAAsB;AACpB,WAAO,KAAK,KACT,QAAQ,OAAK,EAAE,OAAO,CAAC,EACvB,IAAI,IAAI,EACR,SAAS;AAAA,EACd;AACF;","names":[]}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  SqlQuery
3
- } from "./chunk-6MBDCDGA.mjs";
3
+ } from "./chunk-B37NZCNW.mjs";
4
4
  import {
5
5
  toList
6
- } from "./chunk-AQXV7L65.mjs";
6
+ } from "./chunk-TUO7ZPSP.mjs";
7
7
  import {
8
8
  ifGet
9
9
  } from "./chunk-SJGQU3OG.mjs";
@@ -51,4 +51,4 @@ var Select = class extends SqlQuery {
51
51
  export {
52
52
  Select
53
53
  };
54
- //# sourceMappingURL=chunk-U3NVU37K.mjs.map
54
+ //# sourceMappingURL=chunk-6PMTGQVO.mjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HttpStatus,
3
3
  isHttpStatus
4
- } from "./chunk-GV6NUD6R.mjs";
4
+ } from "./chunk-FSWASMJZ.mjs";
5
5
  import {
6
6
  isResponse
7
7
  } from "./chunk-WYLKFMFD.mjs";
@@ -9,11 +9,9 @@ import {
9
9
  choose,
10
10
  isResult,
11
11
  isResults,
12
+ toList,
12
13
  toResult
13
- } from "./chunk-5BGTUK7G.mjs";
14
- import {
15
- toList
16
- } from "./chunk-AQXV7L65.mjs";
14
+ } from "./chunk-TUO7ZPSP.mjs";
17
15
  import {
18
16
  isDefined,
19
17
  isError
@@ -48,4 +46,4 @@ export {
48
46
  rest,
49
47
  isRestResult
50
48
  };
51
- //# sourceMappingURL=chunk-ISRJB7Z4.mjs.map
49
+ //# sourceMappingURL=chunk-6YTIRHPN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/http/RestResult.ts"],"sourcesContent":["import { HttpStatus, isHttpStatus } from './HttpStatus';\nimport { isResponse } from './Response';\nimport { List, toList } from '../types/List';\nimport { Json } from '../types/Json';\nimport { isResult, Result, toResult } from '../types/Result';\nimport { isDefined, isError } from '../types/Is';\nimport { choose } from '../types/Case';\nimport { isResults } from '../types/Results';\nimport { Id } from '../types/Id';\n\nexport type RestResult = {\n data?: { code: number; items: List<Json>; itemCount: number; totalItems?: number; meta?: Json };\n error?: { code: number; message: string; errorCount: number; errors: List<Result> };\n};\n\nconst hasErrors = (a: any): a is { error: { code: number; errors: List<Result> } } => isDefined(a?.error?.errors);\nconst hasItems = (a: any): a is { data: { code: number; items: List<Json>; totalItems?: number; meta?: Json } } => isDefined(a?.data.items);\n\nexport const rest = {\n toData: (status: HttpStatus, items: Json[] = [], totalItems?: number, meta?: Json): RestResult => ({\n data: {\n code: status.status,\n items: toList(items),\n itemCount: items.length,\n totalItems,\n meta,\n },\n }),\n toError: (status: HttpStatus, errors: Result[] = [toResult(status.name)]): RestResult => ({\n error: {\n code: status.status,\n message: status.name ?? errors[0].message ?? 'Unknown',\n errors: toList(errors),\n errorCount: errors.length,\n },\n }),\n to: (payload?: any | any[], status?: HttpStatus): RestResult =>\n choose(payload)\n .is.not.defined(p => p, undefined as unknown as RestResult)\n .type(isHttpStatus, h => rest.toError(h ?? status ?? HttpStatus.InternalServerError, [toResult(h.name)]))\n .type(isResult, r => rest.toError(status ?? HttpStatus.BadRequest, [r]))\n .type(isError, e => rest.toError(status ?? HttpStatus.BadRequest, [e]))\n .type(isResults, r => rest.toError(status ?? HttpStatus.BadRequest, r.results))\n .type(isResponse, r => rest.toError(status ?? HttpStatus.byId(r.body.error?.code as Id), r.body.error?.errors))\n .type(hasErrors, e => rest.toError(status ?? HttpStatus.byId(e.error.code, HttpStatus.BadRequest), e.error.errors))\n .type(hasItems, d => rest.toData(status ?? HttpStatus.byId(d.data.code, HttpStatus.Ok), d.data.items, d.data.totalItems, d.data.meta))\n .else(p => rest.toData(status ?? HttpStatus.Ok, toList(p))),\n};\n\nexport const isRestResult = (r: unknown): r is RestResult => isDefined(r) && (isDefined((r as RestResult).data) || isDefined((r as RestResult).error));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAeA,IAAM,YAAY,CAAC,MAAmE,UAAU,GAAG,OAAO,MAAM;AAChH,IAAM,WAAW,CAAC,MAAiG,UAAU,GAAG,KAAK,KAAK;AAEnI,IAAM,OAAO;AAAA,EAClB,QAAQ,CAAC,QAAoB,QAAgB,CAAC,GAAG,YAAqB,UAA6B;AAAA,IACjG,MAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,OAA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AAM,eAAe,CAAC,MAAgC,UAAU,CAAC,MAAM,UAAW,EAAiB,IAAI,KAAK,UAAW,EAAiB,KAAK;","names":[]}
1
+ {"version":3,"sources":["../src/http/RestResult.ts"],"sourcesContent":["import { HttpStatus, isHttpStatus } from './HttpStatus';\nimport { isResponse } from './Response';\nimport { List, toList } from '../types/List';\nimport { Json } from '../types/Json';\nimport { isResult, Result, toResult } from '../types/Result';\nimport { isDefined, isError } from '../types/Is';\nimport { choose } from '../types/Case';\nimport { isResults } from '../types/Results';\nimport { Id } from '../types/Id';\n\nexport type RestResult = {\n data?: { code: number; items: List<Json>; itemCount: number; totalItems?: number; meta?: Json };\n error?: { code: number; message: string; errorCount: number; errors: List<Result> };\n};\n\nconst hasErrors = (a: any): a is { error: { code: number; errors: List<Result> } } => isDefined(a?.error?.errors);\nconst hasItems = (a: any): a is { data: { code: number; items: List<Json>; totalItems?: number; meta?: Json } } => isDefined(a?.data.items);\n\nexport const rest = {\n toData: (status: HttpStatus, items: Json[] = [], totalItems?: number, meta?: Json): RestResult => ({\n data: {\n code: status.status,\n items: toList(items),\n itemCount: items.length,\n totalItems,\n meta,\n },\n }),\n toError: (status: HttpStatus, errors: Result[] = [toResult(status.name)]): RestResult => ({\n error: {\n code: status.status,\n message: status.name ?? errors[0].message ?? 'Unknown',\n errors: toList(errors),\n errorCount: errors.length,\n },\n }),\n to: (payload?: any | any[], status?: HttpStatus): RestResult =>\n choose(payload)\n .is.not.defined(p => p, undefined as unknown as RestResult)\n .type(isHttpStatus, h => rest.toError(h ?? status ?? HttpStatus.InternalServerError, [toResult(h.name)]))\n .type(isResult, r => rest.toError(status ?? HttpStatus.BadRequest, [r]))\n .type(isError, e => rest.toError(status ?? HttpStatus.BadRequest, [e]))\n .type(isResults, r => rest.toError(status ?? HttpStatus.BadRequest, r.results))\n .type(isResponse, r => rest.toError(status ?? HttpStatus.byId(r.body.error?.code as Id), r.body.error?.errors))\n .type(hasErrors, e => rest.toError(status ?? HttpStatus.byId(e.error.code, HttpStatus.BadRequest), e.error.errors))\n .type(hasItems, d => rest.toData(status ?? HttpStatus.byId(d.data.code, HttpStatus.Ok), d.data.items, d.data.totalItems, d.data.meta))\n .else(p => rest.toData(status ?? HttpStatus.Ok, toList(p))),\n};\n\nexport const isRestResult = (r: unknown): r is RestResult => isDefined(r) && (isDefined((r as RestResult).data) || isDefined((r as RestResult).error));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAeA,IAAM,YAAY,CAAC,MAAmE,UAAU,GAAG,OAAO,MAAM;AAChH,IAAM,WAAW,CAAC,MAAiG,UAAU,GAAG,KAAK,KAAK;AAEnI,IAAM,OAAO;AAAA,EAClB,QAAQ,CAAC,QAAoB,QAAgB,CAAC,GAAG,YAAqB,UAA6B;AAAA,IACjG,MAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,OAAO,OAAO,KAAK;AAAA,MACnB,WAAW,MAAM;AAAA,MACjB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,SAAS,CAAC,QAAoB,SAAmB,CAAC,SAAS,OAAO,IAAI,CAAC,OAAmB;AAAA,IACxF,OAAO;AAAA,MACL,MAAM,OAAO;AAAA,MACb,SAAS,OAAO,QAAQ,OAAO,CAAC,EAAE,WAAW;AAAA,MAC7C,QAAQ,OAAO,MAAM;AAAA,MACrB,YAAY,OAAO;AAAA,IACrB;AAAA,EACF;AAAA,EACA,IAAI,CAAC,SAAuB,WAC1B,OAAO,OAAO,EACX,GAAG,IAAI,QAAQ,OAAK,GAAG,MAAkC,EACzD,KAAK,cAAc,OAAK,KAAK,QAAQ,KAAK,UAAU,WAAW,qBAAqB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,EACvG,KAAK,UAAU,OAAK,KAAK,QAAQ,UAAU,WAAW,YAAY,CAAC,CAAC,CAAC,CAAC,EACtE,KAAK,SAAS,OAAK,KAAK,QAAQ,UAAU,WAAW,YAAY,CAAC,CAAC,CAAC,CAAC,EACrE,KAAK,WAAW,OAAK,KAAK,QAAQ,UAAU,WAAW,YAAY,EAAE,OAAO,CAAC,EAC7E,KAAK,YAAY,OAAK,KAAK,QAAQ,UAAU,WAAW,KAAK,EAAE,KAAK,OAAO,IAAU,GAAG,EAAE,KAAK,OAAO,MAAM,CAAC,EAC7G,KAAK,WAAW,OAAK,KAAK,QAAQ,UAAU,WAAW,KAAK,EAAE,MAAM,MAAM,WAAW,UAAU,GAAG,EAAE,MAAM,MAAM,CAAC,EACjH,KAAK,UAAU,OAAK,KAAK,OAAO,UAAU,WAAW,KAAK,EAAE,KAAK,MAAM,WAAW,EAAE,GAAG,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,IAAI,CAAC,EACpI,KAAK,OAAK,KAAK,OAAO,UAAU,WAAW,IAAI,OAAO,CAAC,CAAC,CAAC;AAChE;AAEO,IAAM,eAAe,CAAC,MAAgC,UAAU,CAAC,MAAM,UAAW,EAAiB,IAAI,KAAK,UAAW,EAAiB,KAAK;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SqlQuery
3
- } from "./chunk-6MBDCDGA.mjs";
3
+ } from "./chunk-B37NZCNW.mjs";
4
4
  import {
5
5
  ifGet
6
6
  } from "./chunk-SJGQU3OG.mjs";
@@ -15,4 +15,4 @@ var Delete = class extends SqlQuery {
15
15
  export {
16
16
  Delete
17
17
  };
18
- //# sourceMappingURL=chunk-GOZMSSH5.mjs.map
18
+ //# sourceMappingURL=chunk-AYR4US3Z.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toList
3
- } from "./chunk-AQXV7L65.mjs";
3
+ } from "./chunk-TUO7ZPSP.mjs";
4
4
 
5
5
  // src/sql/SqlQuery.ts
6
6
  var SqlQuery = class {
@@ -17,4 +17,4 @@ var SqlQuery = class {
17
17
  export {
18
18
  SqlQuery
19
19
  };
20
- //# sourceMappingURL=chunk-6MBDCDGA.mjs.map
20
+ //# sourceMappingURL=chunk-B37NZCNW.mjs.map
@@ -1,9 +1,7 @@
1
1
  import {
2
- Exception
3
- } from "./chunk-5BGTUK7G.mjs";
4
- import {
2
+ Exception,
5
3
  reject
6
- } from "./chunk-AJZIKJEC.mjs";
4
+ } from "./chunk-TUO7ZPSP.mjs";
7
5
 
8
6
  // src/types/Gateway.ts
9
7
  var Gateway = class {
@@ -42,4 +40,4 @@ var Gateway = class {
42
40
  export {
43
41
  Gateway
44
42
  };
45
- //# sourceMappingURL=chunk-H73MZAGT.mjs.map
43
+ //# sourceMappingURL=chunk-FF3BNZ4H.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/Gateway.ts"],"sourcesContent":["import { Json, JsonValue } from './Json';\nimport { Id } from './Id';\nimport { Exception } from './Exception';\nimport { PageList, PageOptions } from './PageList';\nimport { List } from './List';\nimport { Optional } from './Types';\nimport { reject } from '../utils/Promise';\n\nexport type FetchOptions = PageOptions;\n\nexport abstract class Gateway<Options = FetchOptions> {\n all(options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byId(id: Id, options?: Options): Promise<Optional<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n by(_key: string, _value: JsonValue, _options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byIds(..._ids: Id[]): Promise<List<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n search(q: JsonValue, options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n filter(options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n exists(id: Id, options?: Options): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n\n add(item: Json, options?: Options): Promise<Json> {\n return reject(Exception.IsNotImplemented);\n }\n\n update(item: Json, options?: Options): Promise<Json> {\n return reject(Exception.IsNotImplemented);\n }\n\n remove(id: Id, options?: Options): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n}\n"],"mappings":";;;;;;;;AAUO,IAAe,UAAf,MAA+C;AAAA,EACpD,IAAI,SAA4C;AAC9C,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,KAAK,IAAQ,SAA4C;AACvD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,GAAG,MAAc,QAAmB,UAA6C;AAC/E,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,SAAS,MAAiC;AACxC,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,GAAc,SAA4C;AAC/D,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,SAA4C;AACjD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,SAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,IAAI,MAAY,SAAkC;AAChD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,MAAY,SAAkC;AACnD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,SAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/types/Gateway.ts"],"sourcesContent":["import { Json, JsonValue } from './Json';\nimport { Id } from './Id';\nimport { Exception } from './Exception';\nimport { PageList, PageOptions } from './PageList';\nimport { List } from './List';\nimport { Optional } from './Types';\nimport { reject } from '../utils/Promise';\n\nexport type FetchOptions = PageOptions;\n\nexport abstract class Gateway<Options = FetchOptions> {\n all(options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byId(id: Id, options?: Options): Promise<Optional<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n by(_key: string, _value: JsonValue, _options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byIds(..._ids: Id[]): Promise<List<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n search(q: JsonValue, options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n filter(options?: Options): Promise<PageList<Json>> {\n return reject(Exception.IsNotImplemented);\n }\n\n exists(id: Id, options?: Options): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n\n add(item: Json, options?: Options): Promise<Json> {\n return reject(Exception.IsNotImplemented);\n }\n\n update(item: Json, options?: Options): Promise<Json> {\n return reject(Exception.IsNotImplemented);\n }\n\n remove(id: Id, options?: Options): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n}\n"],"mappings":";;;;;;AAUO,IAAe,UAAf,MAA+C;AAAA,EACpD,IAAI,SAA4C;AAC9C,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,KAAK,IAAQ,SAA4C;AACvD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,GAAG,MAAc,QAAmB,UAA6C;AAC/E,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,SAAS,MAAiC;AACxC,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,GAAc,SAA4C;AAC/D,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,SAA4C;AACjD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,SAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,IAAI,MAAY,SAAkC;AAChD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,MAAY,SAAkC;AACnD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,SAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Enum
3
- } from "./chunk-7A3RM67L.mjs";
3
+ } from "./chunk-TUO7ZPSP.mjs";
4
4
  import {
5
5
  asString
6
6
  } from "./chunk-4Q6IHSAU.mjs";
@@ -28,4 +28,4 @@ var ContentType = class _ContentType extends Enum {
28
28
  export {
29
29
  ContentType
30
30
  };
31
- //# sourceMappingURL=chunk-WWYPWYFC.mjs.map
31
+ //# sourceMappingURL=chunk-FFD2T6YV.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Enum
3
- } from "./chunk-7A3RM67L.mjs";
3
+ } from "./chunk-TUO7ZPSP.mjs";
4
4
  import {
5
5
  isAn
6
6
  } from "./chunk-MDIO6K2O.mjs";
@@ -91,4 +91,4 @@ export {
91
91
  isHttpStatus,
92
92
  toHttpStatus
93
93
  };
94
- //# sourceMappingURL=chunk-GV6NUD6R.mjs.map
94
+ //# sourceMappingURL=chunk-FSWASMJZ.mjs.map
@@ -3,16 +3,12 @@ import {
3
3
  inPast
4
4
  } from "./chunk-ADJAEGCT.mjs";
5
5
  import {
6
+ meta,
6
7
  text,
8
+ toList,
7
9
  tryTo,
8
10
  validate
9
- } from "./chunk-5BGTUK7G.mjs";
10
- import {
11
- meta
12
- } from "./chunk-5FAZA55F.mjs";
13
- import {
14
- toList
15
- } from "./chunk-AQXV7L65.mjs";
11
+ } from "./chunk-TUO7ZPSP.mjs";
16
12
  import {
17
13
  isBoolean,
18
14
  isDefined,
@@ -73,4 +69,4 @@ export {
73
69
  maxLength,
74
70
  rule
75
71
  };
76
- //# sourceMappingURL=chunk-TRR2LTWJ.mjs.map
72
+ //# sourceMappingURL=chunk-GF7JYGJU.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/validation/Contraints.ts"],"sourcesContent":["import { validate, Validator } from './Validate';\nimport { Func } from '../types/Func';\nimport { Results } from '../types/Results';\nimport { meta } from '../types/Meta';\nimport { List, toList } from '../types/List';\nimport { isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString } from '../types/Is';\nimport { tryTo } from '../types/Try';\nimport { inFuture, inPast } from '../types/IsDate';\nimport type { Text } from '../types/Text';\nimport { text } from '../types/ToText';\n\nexport type Constraint = Func<boolean | Results, any>;\n\nexport const constraint =\n <T>(c: Constraint, message: Text): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n const cs = meta(subject).property(property).get<List<Validator>>('constraint') ?? toList<Validator>();\n meta(subject)\n .property(property)\n .set('constraint', cs.add({ property, constraint: c, text: message }));\n };\n\nexport const defined = (message?: Text): PropertyDecorator => constraint(v => isDefined(v), message ?? 'Property {property} must be defined.');\n\nexport const required = (message?: Text): PropertyDecorator =>\n constraint(v => isNotEmpty(v), message ?? 'Property {property} is required, and may not be empty.');\n\nexport const notEmpty = (message?: Text): PropertyDecorator => constraint(v => isNotEmpty(v), message ?? 'Property {property} may not be empty.');\n\nexport const valid = (): PropertyDecorator => constraint(v => validate(v), '');\n\nexport const optional = (): PropertyDecorator => constraint(v => !isDefined(v) || validate(v), '');\n\nexport const includes = (sub: string, message?: string): PropertyDecorator =>\n constraint(s => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);\n\nexport const inList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inOptionalList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => !isDefined(v) || isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inUnion = (values: readonly unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, [...values]), message ?? 'Value {actual} must be in union.');\n\nexport const gt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);\n\nexport const gte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);\n\nexport const lt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);\n\nexport const lte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);\n\nexport const past = (message?: Text): PropertyDecorator => constraint(v => inPast(v), message ?? 'Value {actual} must lay in the past.');\n\nexport const future = (message?: Text): PropertyDecorator => constraint(v => inFuture(v), message ?? 'Value {actual} must lay in the future.');\n\nexport const minLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length >= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} must be at least '${length}' characters long.`\n );\n\nexport const maxLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length <= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} cannot be longer than '${length}' characters.`\n );\n\nexport const rule = (message?: Text): PropertyDecorator =>\n constraint(v => (isFunction(v) ? (v() as boolean | Results) : isBoolean(v) ? v : false), message ?? `Value {actual} must be true`);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaO,IAAM,aACX,CAAI,GAAe,YACnB,CAAC,SAAkB,aAAoC;AACrD,QAAM,KAAK,KAAK,OAAO,EAAE,SAAS,QAAQ,EAAE,IAAqB,YAAY,KAAK,OAAkB;AACpG,OAAK,OAAO,EACT,SAAS,QAAQ,EACjB,IAAI,cAAc,GAAG,IAAI,EAAE,UAAU,YAAY,GAAG,MAAM,QAAQ,CAAC,CAAC;AACzE;AAEK,IAAM,UAAU,CAAC,YAAsC,WAAW,OAAK,UAAU,CAAC,GAAG,WAAW,sCAAsC;AAEtI,IAAM,WAAW,CAAC,YACvB,WAAW,OAAK,WAAW,CAAC,GAAG,WAAW,wDAAwD;AAE7F,IAAM,WAAW,CAAC,YAAsC,WAAW,OAAK,WAAW,CAAC,GAAG,WAAW,uCAAuC;AAEzI,IAAM,QAAQ,MAA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K,KAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,oCAAoC,MAAM;AACvD;AAEK,IAAM,YAAY,CAAC,QAAgB,YACxC;AAAA,EACE,OACE,MAAM,MAAM,CAAC,EACV,GAAG,QAAQ,EACX,IAAI,CAAAA,OAAK,KAAKA,EAAC,EAAE,SAAS,EAAE,UAAU,MAAM,EAC5C,OAAO,IAAI;AAAA,EAChB,WAAW,yCAAyC,MAAM;AAC5D;AAEK,IAAM,OAAO,CAAC,YACnB,WAAW,OAAM,WAAW,CAAC,IAAK,EAAE,IAA0B,UAAU,CAAC,IAAI,IAAI,OAAQ,WAAW,6BAA6B;","names":["v"]}
1
+ {"version":3,"sources":["../src/validation/Contraints.ts"],"sourcesContent":["import { validate, Validator } from './Validate';\nimport { Func } from '../types/Func';\nimport { Results } from '../types/Results';\nimport { meta } from '../types/Meta';\nimport { List, toList } from '../types/List';\nimport { isBoolean, isDefined, isFunction, isIn, isNotEmpty, isString } from '../types/Is';\nimport { tryTo } from '../types/Try';\nimport { inFuture, inPast } from '../types/IsDate';\nimport type { Text } from '../types/Text';\nimport { text } from '../types/ToText';\n\nexport type Constraint = Func<boolean | Results, any>;\n\nexport const constraint =\n <T>(c: Constraint, message: Text): PropertyDecorator =>\n (subject: unknown, property: string | symbol): void => {\n const cs = meta(subject).property(property).get<List<Validator>>('constraint') ?? toList<Validator>();\n meta(subject)\n .property(property)\n .set('constraint', cs.add({ property, constraint: c, text: message }));\n };\n\nexport const defined = (message?: Text): PropertyDecorator => constraint(v => isDefined(v), message ?? 'Property {property} must be defined.');\n\nexport const required = (message?: Text): PropertyDecorator =>\n constraint(v => isNotEmpty(v), message ?? 'Property {property} is required, and may not be empty.');\n\nexport const notEmpty = (message?: Text): PropertyDecorator => constraint(v => isNotEmpty(v), message ?? 'Property {property} may not be empty.');\n\nexport const valid = (): PropertyDecorator => constraint(v => validate(v), '');\n\nexport const optional = (): PropertyDecorator => constraint(v => !isDefined(v) || validate(v), '');\n\nexport const includes = (sub: string, message?: string): PropertyDecorator =>\n constraint(s => isDefined(s) && isString(s) && s.includes(sub), message ?? `Value {actual} must include '${sub}'.`);\n\nexport const inList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inOptionalList = (values: unknown[], message?: Text): PropertyDecorator =>\n constraint(v => !isDefined(v) || isIn(v, values), message ?? 'Value {actual} must appear in list.');\n\nexport const inUnion = (values: readonly unknown[], message?: Text): PropertyDecorator =>\n constraint(v => isDefined(v) && isIn(v, [...values]), message ?? 'Value {actual} must be in union.');\n\nexport const gt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v > limit, message ?? `Value {actual} must be larger than '${limit}'.`);\n\nexport const gte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v >= limit, message ?? `Value {actual} must be larger than or equal to ${limit}.`);\n\nexport const lt = (limit: number, message?: Text): PropertyDecorator => constraint(v => v < limit, message ?? `Value {actual} must be smaller than ${limit}.`);\n\nexport const lte = (limit: number, message?: Text): PropertyDecorator =>\n constraint(v => v <= limit, message ?? `Value {actual} must be smaller than or equal to ${limit}.`);\n\nexport const past = (message?: Text): PropertyDecorator => constraint(v => inPast(v), message ?? 'Value {actual} must lay in the past.');\n\nexport const future = (message?: Text): PropertyDecorator => constraint(v => inFuture(v), message ?? 'Value {actual} must lay in the future.');\n\nexport const minLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length >= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} must be at least '${length}' characters long.`\n );\n\nexport const maxLength = (length: number, message?: Text): PropertyDecorator =>\n constraint(\n v =>\n tryTo(() => v)\n .is.defined()\n .map(v => text(v).toString().length <= length)\n .orElse(true) as boolean,\n message ?? `Value {actual} cannot be longer than '${length}' characters.`\n );\n\nexport const rule = (message?: Text): PropertyDecorator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} from "./chunk-YYWOQNZQ.mjs";
@@ -50,4 +50,4 @@ export {
50
50
  toCondition,
51
51
  isSortCondition
52
52
  };
53
- //# sourceMappingURL=chunk-LPT6LW5N.mjs.map
53
+ //# sourceMappingURL=chunk-GKQMIKIY.mjs.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  asNumber
3
- } from "./chunk-5MCJXABA.mjs";
3
+ } from "./chunk-XQJ5LQEQ.mjs";
4
4
  import {
5
5
  choose
6
- } from "./chunk-5BGTUK7G.mjs";
6
+ } from "./chunk-TUO7ZPSP.mjs";
7
7
  import {
8
8
  asString
9
9
  } from "./chunk-4Q6IHSAU.mjs";
@@ -54,4 +54,4 @@ export {
54
54
  cacheAge,
55
55
  isCacheAge
56
56
  };
57
- //# sourceMappingURL=chunk-C6VQGKDB.mjs.map
57
+ //# sourceMappingURL=chunk-IESVFCB3.mjs.map
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  required,
3
3
  valid
4
- } from "./chunk-TRR2LTWJ.mjs";
4
+ } from "./chunk-GF7JYGJU.mjs";
5
5
  import {
6
6
  DateTime
7
- } from "./chunk-MLYUI7R7.mjs";
7
+ } from "./chunk-KPXOQFEB.mjs";
8
8
  import {
9
9
  Struct
10
- } from "./chunk-5C5OHGRW.mjs";
10
+ } from "./chunk-RW4AKBCN.mjs";
11
11
  import {
12
12
  choose,
13
13
  ctx
14
- } from "./chunk-5BGTUK7G.mjs";
14
+ } from "./chunk-TUO7ZPSP.mjs";
15
15
  import {
16
16
  isIdentity
17
17
  } from "./chunk-MDIO6K2O.mjs";
@@ -45,4 +45,4 @@ __decorateClass([
45
45
  export {
46
46
  Audit
47
47
  };
48
- //# sourceMappingURL=chunk-JZCNZKGP.mjs.map
48
+ //# sourceMappingURL=chunk-IYUYA5OX.mjs.map
@@ -6,14 +6,12 @@ import {
6
6
  } from "./chunk-RUKHONCR.mjs";
7
7
  import {
8
8
  json
9
- } from "./chunk-UATZAAX2.mjs";
10
- import {
11
- meta
12
- } from "./chunk-5FAZA55F.mjs";
9
+ } from "./chunk-WOUH6UVC.mjs";
13
10
  import {
14
11
  ifNotEmpty,
12
+ meta,
15
13
  toList
16
- } from "./chunk-AQXV7L65.mjs";
14
+ } from "./chunk-TUO7ZPSP.mjs";
17
15
  import {
18
16
  ofGet
19
17
  } from "./chunk-SJGQU3OG.mjs";
@@ -131,4 +129,4 @@ export {
131
129
  Mapper,
132
130
  mappings
133
131
  };
134
- //# sourceMappingURL=chunk-SW73SKB2.mjs.map
132
+ //# sourceMappingURL=chunk-J5PB7ZVO.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/Mapper.ts"],"sourcesContent":["import { Property, PropertyOptions } from './Property';\nimport { State } from './State';\nimport { ifNotEmpty } from './If';\nimport { json, Json, JsonValue } from '../types/Json';\nimport { Optional } from '../types/Types';\nimport { TypeGuard } from '../types/TypeGuard';\nimport { isA } from '../types/IsA';\nimport { List, toList } from '../types/List';\nimport { meta } from '../types/Meta';\nimport { isEmpty } from '../types/Is';\nimport { Get, ofGet } from '../types/Get';\nimport { Construct, ofConstruct } from '../types/Constructor';\n\nexport type Mapping = {\n property: string;\n in: (source?: Json, key?: string) => Optional<JsonValue>;\n out: (source?: Json, key?: string) => Optional<JsonValue>;\n};\nexport const isMapping: TypeGuard<Mapping> = (m?: unknown): m is Mapping => isA<Mapping>(m, 'in', 'out');\n\nexport type MapStartFrom = 'scratch' | 'source';\nexport type MapOptions = { startFrom: MapStartFrom };\n\nexport class Mapper extends State implements Mapping {\n protected readonly map = mappings;\n\n constructor(\n readonly options: MapOptions = { startFrom: 'scratch' },\n readonly property = ''\n ) {\n super();\n }\n\n // All properties that are a mapping\n get properties(): List<[string, Mapping]> {\n return this.get('props', () =>\n meta(this)\n .entries<Mapping>()\n .filter(([, v]) => isMapping(v))\n );\n }\n\n // All names of properties (in target) that have a Mapping\n get keys(): List<string> {\n return this.get('keys', () => this.properties.map(([k]) => k));\n }\n\n // All names of properties (in source) that are named in a Mapping\n get columns(): List<string> {\n return this.get('columns', () => this.properties.mapDefined(([, p]) => ifNotEmpty(p.property, p.property))).distinct();\n }\n\n // All names of properties (in source) that are NOT properties in target\n private get droppedIn(): List<string> {\n return this.get('droppedIn', () => this.columns.filter(c => !this.keys.some(k => k === c)));\n }\n\n // All names op properties (in target) that are NOT properties in source\n private get droppedOut(): List<string> {\n return this.get('droppedOut', () => this.properties.filter(([, p]) => !this.keys.some(k => k === p.property)).map(([k]) => k));\n }\n\n public in(from: Json = {}): Json {\n return json.omit(\n this.properties.reduce((a, [k, p]) => json.merge(a, { [k]: p.in({ ...a, ...from }) }), this.options.startFrom === 'source' ? from : {}),\n ...this.droppedIn\n );\n }\n\n public out(to: Json = {}): Json {\n return json.omit(\n this.properties.reduce(\n (a, [k, p]) => json.merge(a, isEmpty(p.property) ? p.out(to, k) : { [p.property ?? '']: p.out({ ...a, ...to }, k) }),\n this.options.startFrom === 'source' ? to : {}\n ),\n ...this.droppedOut\n );\n }\n\n toString(): string {\n return this.constructor.name;\n }\n}\n\nexport const mappings = {\n item: (property: string, options?: PropertyOptions): Property => new Property(property, options),\n ignore: (property = ''): Mapping => ({\n property,\n in: (): Optional<JsonValue> => undefined,\n out: (): Optional<JsonValue> => undefined,\n }),\n skipIn: (property: string): Mapping => ({\n property,\n in: (): Optional<JsonValue> => undefined,\n out: (source: Json = {}): JsonValue => source[property],\n }),\n skipOut: (property: string): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue => source[property],\n out: (): Optional<JsonValue> => undefined,\n }),\n func: (property: string, funcIn: Get<Optional<JsonValue>, Json>, funcOut: Get<Optional<JsonValue>, Json>): Mapping => ({\n property,\n in: (source: Json = {}): Optional<JsonValue> => ofGet(funcIn, source),\n out: (source: Json = {}): Optional<JsonValue> => ofGet(funcOut, source),\n }),\n add: (funcIn: Get<JsonValue, Json>): Mapping => ({\n property: '',\n in: (source: Json = {}): JsonValue => ofGet(funcIn, source),\n out: (): Optional<JsonValue> => undefined,\n }),\n map: (mapper: Construct<Mapper>, property = ''): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue => ofConstruct(mapper).in(isEmpty(property) ? source : (source[property] as Json)),\n out: (source: Json = {}, key = ''): JsonValue => ofConstruct(mapper).out(isEmpty(key) ? source : (source[key] as Json)),\n }),\n propsToList: (...maps: Mapping[]): Mapping => ({\n property: '',\n in: (source: Json = {}): JsonValue => toList(maps.map(m => ofConstruct(m).in(source))).toJSON(),\n out: (source: Json = {}, key = ''): JsonValue =>\n maps.reduce((a: Json, m, i) => {\n const res = toList(source[key])[i];\n const out = m.out(res as Json);\n return { ...a, [m.property]: out ?? {} };\n }, {}),\n }),\n list: (mapper: Mapping, property: string): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue =>\n toList(source[property])\n .map((v: any) => mapper.in(v))\n .toJSON(),\n out: (source: Json = {}, key = ''): JsonValue =>\n toList(isEmpty(key) ? source : (source[key] as Json))\n .map((v: any) => mapper.out(v))\n .toJSON(),\n }),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,IAAM,YAAgC,CAAC,MAA8B,IAAa,GAAG,MAAM,KAAK;AAKhG,IAAM,SAAN,cAAqB,MAAyB;AAAA,EAGnD,YACW,UAAsB,EAAE,WAAW,UAAU,GAC7C,WAAW,IACpB;AACA,UAAM;AAHG;AACA;AAAA,EAGX;AAAA,EAPmB,MAAM;AAAA;AAAA,EAUzB,IAAI,aAAsC;AACxC,WAAO,KAAK;AAAA,MAAI;AAAA,MAAS,MACvB,KAAK,IAAI,EACN,QAAiB,EACjB,OAAO,CAAC,CAAC,EAAE,CAAC,MAAM,UAAU,CAAC,CAAC;AAAA,IACnC;AAAA,EACF;AAAA;AAAA,EAGA,IAAI,OAAqB;AACvB,WAAO,KAAK,IAAI,QAAQ,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAAA,EAC/D;AAAA;AAAA,EAGA,IAAI,UAAwB;AAC1B,WAAO,KAAK,IAA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UAAU;AAAA,IACV,IAAI,CAAC,SAAe,CAAC,MAAiB,OAAO,KAAK,IAAI,OAAK,YAAY,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO;AAAA,IAC9F,KAAK,CAAC,SAAe,CAAC,GAAG,MAAM,OAC7B,KAAK,OAAO,CAAC,GAAS,GAAG,MAAM;AAC7B,YAAM,MAAM,OAAO,OAAO,GAAG,CAAC,EAAE,CAAC;AACjC,YAAM,MAAM,EAAE,IAAI,GAAW;AAC7B,aAAO,EAAE,GAAG,GAAG,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,EAAE;AAAA,IACzC,GAAG,CAAC,CAAC;AAAA,EACT;AAAA,EACA,MAAM,CAAC,QAAiB,cAA+B;AAAA,IACrD;AAAA,IACA,IAAI,CAAC,SAAe,CAAC,MACnB,OAAO,OAAO,QAAQ,CAAC,EACpB,IAAI,CAAC,MAAW,OAAO,GAAG,CAAC,CAAC,EAC5B,OAAO;AAAA,IACZ,KAAK,CAAC,SAAe,CAAC,GAAG,MAAM,OAC7B,OAAO,QAAQ,GAAG,IAAI,SAAU,OAAO,GAAG,CAAU,EACjD,IAAI,CAAC,MAAW,OAAO,IAAI,CAAC,CAAC,EAC7B,OAAO;AAAA,EACd;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/utils/Mapper.ts"],"sourcesContent":["import { Property, PropertyOptions } from './Property';\nimport { State } from './State';\nimport { ifNotEmpty } from './If';\nimport { json, Json, JsonValue } from '../types/Json';\nimport { Optional } from '../types/Types';\nimport { TypeGuard } from '../types/TypeGuard';\nimport { isA } from '../types/IsA';\nimport { List, toList } from '../types/List';\nimport { meta } from '../types/Meta';\nimport { isEmpty } from '../types/Is';\nimport { Get, ofGet } from '../types/Get';\nimport { Construct, ofConstruct } from '../types/Constructor';\n\nexport type Mapping = {\n property: string;\n in: (source?: Json, key?: string) => Optional<JsonValue>;\n out: (source?: Json, key?: string) => Optional<JsonValue>;\n};\nexport const isMapping: TypeGuard<Mapping> = (m?: unknown): m is Mapping => isA<Mapping>(m, 'in', 'out');\n\nexport type MapStartFrom = 'scratch' | 'source';\nexport type MapOptions = { startFrom: MapStartFrom };\n\nexport class Mapper extends State implements Mapping {\n protected readonly map = mappings;\n\n constructor(\n readonly options: MapOptions = { startFrom: 'scratch' },\n readonly property = ''\n ) {\n super();\n }\n\n // All properties that are a mapping\n get properties(): List<[string, Mapping]> {\n return this.get('props', () =>\n meta(this)\n .entries<Mapping>()\n .filter(([, v]) => isMapping(v))\n );\n }\n\n // All names of properties (in target) that have a Mapping\n get keys(): List<string> {\n return this.get('keys', () => this.properties.map(([k]) => k));\n }\n\n // All names of properties (in source) that are named in a Mapping\n get columns(): List<string> {\n return this.get('columns', () => this.properties.mapDefined(([, p]) => ifNotEmpty(p.property, p.property))).distinct();\n }\n\n // All names of properties (in source) that are NOT properties in target\n private get droppedIn(): List<string> {\n return this.get('droppedIn', () => this.columns.filter(c => !this.keys.some(k => k === c)));\n }\n\n // All names op properties (in target) that are NOT properties in source\n private get droppedOut(): List<string> {\n return this.get('droppedOut', () => this.properties.filter(([, p]) => !this.keys.some(k => k === p.property)).map(([k]) => k));\n }\n\n public in(from: Json = {}): Json {\n return json.omit(\n this.properties.reduce((a, [k, p]) => json.merge(a, { [k]: p.in({ ...a, ...from }) }), this.options.startFrom === 'source' ? from : {}),\n ...this.droppedIn\n );\n }\n\n public out(to: Json = {}): Json {\n return json.omit(\n this.properties.reduce(\n (a, [k, p]) => json.merge(a, isEmpty(p.property) ? p.out(to, k) : { [p.property ?? '']: p.out({ ...a, ...to }, k) }),\n this.options.startFrom === 'source' ? to : {}\n ),\n ...this.droppedOut\n );\n }\n\n toString(): string {\n return this.constructor.name;\n }\n}\n\nexport const mappings = {\n item: (property: string, options?: PropertyOptions): Property => new Property(property, options),\n ignore: (property = ''): Mapping => ({\n property,\n in: (): Optional<JsonValue> => undefined,\n out: (): Optional<JsonValue> => undefined,\n }),\n skipIn: (property: string): Mapping => ({\n property,\n in: (): Optional<JsonValue> => undefined,\n out: (source: Json = {}): JsonValue => source[property],\n }),\n skipOut: (property: string): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue => source[property],\n out: (): Optional<JsonValue> => undefined,\n }),\n func: (property: string, funcIn: Get<Optional<JsonValue>, Json>, funcOut: Get<Optional<JsonValue>, Json>): Mapping => ({\n property,\n in: (source: Json = {}): Optional<JsonValue> => ofGet(funcIn, source),\n out: (source: Json = {}): Optional<JsonValue> => ofGet(funcOut, source),\n }),\n add: (funcIn: Get<JsonValue, Json>): Mapping => ({\n property: '',\n in: (source: Json = {}): JsonValue => ofGet(funcIn, source),\n out: (): Optional<JsonValue> => undefined,\n }),\n map: (mapper: Construct<Mapper>, property = ''): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue => ofConstruct(mapper).in(isEmpty(property) ? source : (source[property] as Json)),\n out: (source: Json = {}, key = ''): JsonValue => ofConstruct(mapper).out(isEmpty(key) ? source : (source[key] as Json)),\n }),\n propsToList: (...maps: Mapping[]): Mapping => ({\n property: '',\n in: (source: Json = {}): JsonValue => toList(maps.map(m => ofConstruct(m).in(source))).toJSON(),\n out: (source: Json = {}, key = ''): JsonValue =>\n maps.reduce((a: Json, m, i) => {\n const res = toList(source[key])[i];\n const out = m.out(res as Json);\n return { ...a, [m.property]: out ?? {} };\n }, {}),\n }),\n list: (mapper: Mapping, property: string): Mapping => ({\n property,\n in: (source: Json = {}): JsonValue =>\n toList(source[property])\n .map((v: any) => mapper.in(v))\n .toJSON(),\n out: (source: Json = {}, key = ''): JsonValue =>\n toList(isEmpty(key) ? source : (source[key] as Json))\n .map((v: any) => mapper.out(v))\n .toJSON(),\n }),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,IAAM,YAAgC,CAAC,MAA8B,IAAa,GAAG,MAAM,KAAK;AAKhG,IAAM,SAAN,cAAqB,MAAyB;AAAA,EAGnD,YACW,UAAsB,EAAE,WAAW,UAAU,GAC7C,WAAW,IACpB;AACA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,6 @@
1
1
  import {
2
2
  Enum
3
- } from "./chunk-7A3RM67L.mjs";
3
+ } from "./chunk-TUO7ZPSP.mjs";
4
4
 
5
5
  // src/http/HttpVerb.ts
6
6
  var HttpVerb = class _HttpVerb extends Enum {
@@ -17,4 +17,4 @@ var HttpVerb = class _HttpVerb extends Enum {
17
17
  export {
18
18
  HttpVerb
19
19
  };
20
- //# sourceMappingURL=chunk-V6TMXDF7.mjs.map
20
+ //# sourceMappingURL=chunk-JI7MC5EA.mjs.map
@@ -1,12 +1,10 @@
1
1
  import {
2
2
  toPageList
3
- } from "./chunk-HBDIZSIE.mjs";
4
- import {
5
- choose
6
- } from "./chunk-5BGTUK7G.mjs";
3
+ } from "./chunk-QLEGIYVU.mjs";
7
4
  import {
5
+ choose,
8
6
  resolve
9
- } from "./chunk-AJZIKJEC.mjs";
7
+ } from "./chunk-TUO7ZPSP.mjs";
10
8
 
11
9
  // src/process/Search.ts
12
10
  var Search = class {
@@ -45,4 +43,4 @@ var Search = class {
45
43
  export {
46
44
  Search
47
45
  };
48
- //# sourceMappingURL=chunk-GMFUUU3V.mjs.map
46
+ //# sourceMappingURL=chunk-JM6NAJQ3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/process/Search.ts"],"sourcesContent":["import { FetchOptions } from '../types/Gateway';\nimport { Repository } from '../types/Repository';\nimport { PageList, toPageList } from '../types/PageList';\nimport { Id, Key } from '../types/Id';\nimport { List } from '../types/List';\nimport { Req } from '../resources/Req';\nimport { JsonValue } from '../types/Json';\nimport { choose } from '../types/Case';\nimport { resolve } from '../utils/Promise';\n\nexport class Search<T, Options = FetchOptions> {\n constructor(protected repo: Repository<T, Options>) {}\n\n all(options?: Options): Promise<PageList<T>> {\n return this.repo.all(options);\n }\n\n byId(id: Id): Promise<T> {\n return this.repo.byId(id);\n }\n\n byIds(...ids: Id[]): Promise<List<T>> {\n return this.repo.byIds(...ids);\n }\n\n byKey(key: Key, options?: Options): Promise<PageList<T>> {\n return this.repo.byKey(key, options);\n }\n\n query({ query, skip, take }: Req): Promise<PageList<T>> {\n return this.search(query, { skip, take } as Options);\n }\n\n search(query: JsonValue, options?: Options): Promise<PageList<T>> {\n return choose(query)\n .is.not.empty(\n q => q,\n q => this.repo.search(q, options)\n )\n .else(() => resolve(toPageList<T>()));\n }\n\n filter(options?: Options): Promise<PageList<T>> {\n return this.repo.filter(options);\n }\n\n exists(id: Id): Promise<boolean> {\n return this.repo.exists(id);\n }\n}\n"],"mappings":";;;;;;;;;;;AAUO,IAAM,SAAN,MAAwC;AAAA,EAC7C,YAAsB,MAA8B;AAA9B;AAAA,EAA+B;AAAA,EAErD,IAAI,SAAyC;AAC3C,WAAO,KAAK,KAAK,IAAI,OAAO;AAAA,EAC9B;AAAA,EAEA,KAAK,IAAoB;AACvB,WAAO,KAAK,KAAK,KAAK,EAAE;AAAA,EAC1B;AAAA,EAEA,SAAS,KAA6B;AACpC,WAAO,KAAK,KAAK,MAAM,GAAG,GAAG;AAAA,EAC/B;AAAA,EAEA,MAAM,KAAU,SAAyC;AACvD,WAAO,KAAK,KAAK,MAAM,KAAK,OAAO;AAAA,EACrC;AAAA,EAEA,MAAM,EAAE,OAAO,MAAM,KAAK,GAA8B;AACtD,WAAO,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,CAAY;AAAA,EACrD;AAAA,EAEA,OAAO,OAAkB,SAAyC;AAChE,WAAO,OAAO,KAAK,EAChB,GAAG,IAAI;AAAA,MACN,OAAK;AAAA,MACL,OAAK,KAAK,KAAK,OAAO,GAAG,OAAO;AAAA,IAClC,EACC,KAAK,MAAM,QAAQ,WAAc,CAAC,CAAC;AAAA,EACxC;AAAA,EAEA,OAAO,SAAyC;AAC9C,WAAO,KAAK,KAAK,OAAO,OAAO;AAAA,EACjC;AAAA,EAEA,OAAO,IAA0B;AAC/B,WAAO,KAAK,KAAK,OAAO,EAAE;AAAA,EAC5B;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/process/Search.ts"],"sourcesContent":["import { FetchOptions } from '../types/Gateway';\nimport { Repository } from '../types/Repository';\nimport { PageList, toPageList } from '../types/PageList';\nimport { Id, Key } from '../types/Id';\nimport { List } from '../types/List';\nimport { Req } from '../resources/Req';\nimport { JsonValue } from '../types/Json';\nimport { choose } from '../types/Case';\nimport { resolve } from '../utils/Promise';\n\nexport class Search<T, Options = FetchOptions> {\n constructor(protected repo: Repository<T, Options>) {}\n\n all(options?: Options): Promise<PageList<T>> {\n return this.repo.all(options);\n }\n\n byId(id: Id): Promise<T> {\n return this.repo.byId(id);\n }\n\n byIds(...ids: Id[]): Promise<List<T>> {\n return this.repo.byIds(...ids);\n }\n\n byKey(key: Key, options?: Options): Promise<PageList<T>> {\n return this.repo.byKey(key, options);\n }\n\n query({ query, skip, take }: Req): Promise<PageList<T>> {\n return this.search(query, { skip, take } as Options);\n }\n\n search(query: JsonValue, options?: Options): Promise<PageList<T>> {\n return choose(query)\n .is.not.empty(\n q => q,\n q => this.repo.search(q, options)\n )\n .else(() => resolve(toPageList<T>()));\n }\n\n filter(options?: Options): Promise<PageList<T>> {\n return this.repo.filter(options);\n }\n\n exists(id: Id): Promise<boolean> {\n return this.repo.exists(id);\n }\n}\n"],"mappings":";;;;;;;;;AAUO,IAAM,SAAN,MAAwC;AAAA,EAC7C,YAAsB,MAA8B;AAA9B;AAAA,EAA+B;AAAA,EAErD,IAAI,SAAyC;AAC3C,WAAO,KAAK,KAAK,IAAI,OAAO;AAAA,EAC9B;AAAA,EAEA,KAAK,IAAoB;AACvB,WAAO,KAAK,KAAK,KAAK,EAAE;AAAA,EAC1B;AAAA,EAEA,SAAS,KAA6B;AACpC,WAAO,KAAK,KAAK,MAAM,GAAG,GAAG;AAAA,EAC/B;AAAA,EAEA,MAAM,KAAU,SAAyC;AACvD,WAAO,KAAK,KAAK,MAAM,KAAK,OAAO;AAAA,EACrC;AAAA,EAEA,MAAM,EAAE,OAAO,MAAM,KAAK,GAA8B;AACtD,WAAO,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,CAAY;AAAA,EACrD;AAAA,EAEA,OAAO,OAAkB,SAAyC;AAChE,WAAO,OAAO,KAAK,EAChB,GAAG,IAAI;AAAA,MACN,OAAK;AAAA,MACL,OAAK,KAAK,KAAK,OAAO,GAAG,OAAO;AAAA,IAClC,EACC,KAAK,MAAM,QAAQ,WAAc,CAAC,CAAC;AAAA,EACxC;AAAA,EAEA,OAAO,SAAyC;AAC9C,WAAO,KAAK,KAAK,OAAO,OAAO;AAAA,EACjC;AAAA,EAEA,OAAO,IAA0B;AAC/B,WAAO,KAAK,KAAK,OAAO,EAAE;AAAA,EAC5B;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SqlQuery
3
- } from "./chunk-6MBDCDGA.mjs";
3
+ } from "./chunk-B37NZCNW.mjs";
4
4
  import {
5
5
  toClause
6
6
  } from "./chunk-UXDH5W4T.mjs";
@@ -23,4 +23,4 @@ var Update = class extends SqlQuery {
23
23
  export {
24
24
  Update
25
25
  };
26
- //# sourceMappingURL=chunk-2SE4U4T2.mjs.map
26
+ //# sourceMappingURL=chunk-JNZUGKMO.mjs.map
@@ -1,19 +1,17 @@
1
1
  import {
2
2
  seconds
3
- } from "./chunk-CFJJ2C6C.mjs";
3
+ } from "./chunk-M2S4OLVZ.mjs";
4
4
  import {
5
5
  isDate
6
6
  } from "./chunk-ADJAEGCT.mjs";
7
7
  import {
8
8
  choose,
9
+ ifDefined,
9
10
  tryTo
10
- } from "./chunk-5BGTUK7G.mjs";
11
+ } from "./chunk-TUO7ZPSP.mjs";
11
12
  import {
12
13
  Value
13
14
  } from "./chunk-AMS2ELWR.mjs";
14
- import {
15
- ifDefined
16
- } from "./chunk-AQXV7L65.mjs";
17
15
  import {
18
16
  isA
19
17
  } from "./chunk-MDIO6K2O.mjs";
@@ -139,4 +137,4 @@ export {
139
137
  isDateTime,
140
138
  dt
141
139
  };
142
- //# sourceMappingURL=chunk-MLYUI7R7.mjs.map
140
+ //# sourceMappingURL=chunk-KPXOQFEB.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/domain/DateTime.ts"],"sourcesContent":["import { DateTime as LuxonDateTime, DateTimeUnit as LuxonDateTimeUnit, DurationUnit as LuxonDurationUnit, Settings } from 'luxon';\nimport { Value } from '../types/Value';\nimport { Optional } from '../types/Types';\nimport { choose } from '../types/Case';\nimport { isDefined, isNumber, isString } from '../types/Is';\nimport { isDate } from '../types/IsDate';\nimport { isA } from '../types/IsA';\nimport { ifDefined } from '../utils/If';\nimport { JsonValue } from '../types/Json';\nimport { seconds } from '../utils/Seconds';\nimport { tryTo } from '../types/Try';\nimport { use } from '../types/Constructor';\n\nSettings.defaultZone = 'utc';\n\nexport type DateTimeUnit = LuxonDateTimeUnit;\nexport type DurationUnit = LuxonDurationUnit;\nexport type Duration = Partial<Record<DurationUnit, number>>;\n\nexport type DiffOptions = {\n rounding: 'floor' | 'ceil' | 'round';\n};\n\nexport type DatetimeInput = string | number | Date | DateTime | null;\n\nexport class DateTime extends Value<Optional<string>> {\n protected readonly luxon: LuxonDateTime;\n\n constructor(value?: DatetimeInput);\n constructor(value?: string, format?: string);\n constructor(value?: DatetimeInput, format?: string) {\n const luxon = choose(value)\n .type(isString, v => (format ? LuxonDateTime.fromFormat(v, format, { setZone: true }) : LuxonDateTime.fromISO(v, { setZone: true })))\n .type(isNumber, v => LuxonDateTime.fromMillis(v))\n .type(isDate, v => LuxonDateTime.fromJSDate(v))\n .type(isDateTime, v => v.luxon)\n // Allow constructing with LuxonDateTime without exposing types\n .else(value instanceof LuxonDateTime ? value : LuxonDateTime.fromISO(undefined as any));\n\n super(luxon.toISO() ?? undefined);\n this.luxon = luxon;\n }\n\n static get now(): DateTime {\n return new DateTime(LuxonDateTime.utc() as any);\n }\n\n get isValid(): boolean {\n return isDefined(this.value) && this.utc.isValid;\n }\n\n /**\n * @deprecated Deprecated in favor for DateTime.from as that also accepts locales and another DateTime\n */\n get fromNow(): string {\n return this.from();\n }\n\n get inAmsterdam(): DateTime {\n return this.withZone('Europe/Amsterdam');\n }\n\n get inNewYork(): DateTime {\n return this.withZone('America/New_York');\n }\n\n get inLondon(): DateTime {\n return this.withZone('Europe/London');\n }\n\n get inWarsaw(): DateTime {\n return this.withZone('Europe/Warsaw');\n }\n\n protected get utc(): LuxonDateTime {\n return this.luxon.setZone('utc');\n }\n\n from(locale?: string): string;\n\n from(date?: DateTime, locale?: string): string;\n\n from(dateOrLocale?: string | DateTime, maybeLocale?: string): string {\n return (\n use((isString(dateOrLocale) ? dateOrLocale : maybeLocale) ?? 'en', locale =>\n ifDefined(\n isA<DateTime>(dateOrLocale) ? dateOrLocale : undefined,\n d => this.utc.setLocale(locale).toRelative({ base: d.utc }),\n () => this.utc.setLocale(locale).toRelative()\n )\n ) ?? ''\n );\n }\n\n isAfter(dt: DateTime): boolean {\n return this.utc > dt.utc;\n }\n\n isBefore(dt: DateTime): boolean {\n return this.utc < dt.utc;\n }\n\n equals(dt: DateTime): boolean {\n return this.utc.hasSame(dt.utc, 'millisecond');\n }\n\n add(n: number, unit?: DurationUnit): DateTime;\n\n add(duration: Duration): DateTime;\n\n add(n: number | Duration, unit: DurationUnit = 'day'): DateTime {\n return new DateTime(this.luxon.plus(isNumber(n) ? { [unit]: n } : n) as any);\n }\n\n subtract(n: number, unit?: DurationUnit): DateTime;\n\n subtract(duration: Duration): DateTime;\n\n subtract(n: number | Duration, unit: DurationUnit = 'day'): DateTime {\n return new DateTime(this.luxon.minus(isNumber(n) ? { [unit]: n } : n) as any);\n }\n\n diff(other: DateTime, unit: DateTimeUnit = 'day', opts?: DiffOptions): number {\n return Math[opts?.rounding ?? 'floor'](this.utc.diff(other.utc).as(unit));\n }\n\n startOf(unit: DateTimeUnit = 'day'): DateTime {\n return new DateTime(this.luxon.startOf(unit) as any);\n }\n\n endOf(unit: DateTimeUnit = 'day'): DateTime {\n return new DateTime(this.luxon.endOf(unit) as any);\n }\n\n isWeekend(): boolean {\n return this.luxon.isWeekend;\n }\n\n withZone(zone: string): DateTime {\n return new DateTime(this.luxon.setZone(zone) as any);\n }\n\n toString(): string {\n return this.value ?? '';\n }\n\n toJSON(): JsonValue {\n return this.utc.toISO();\n }\n\n toFormat(format: string): string {\n return this.luxon.toFormat(format);\n }\n\n toLocale(locale = 'nl-NL', format = 'D'): string {\n return this.luxon.setLocale(locale).toFormat(format);\n }\n\n toFull(locale?: string): string {\n return this.toLocale(locale, 'DDD');\n }\n\n toDate(): Optional<Date> {\n return this.isValid ? this.utc.toJSDate() : undefined;\n }\n\n toEpoch(): number {\n return this.luxon.toMillis();\n }\n\n ago(end: DateTime = DateTime.now): string {\n return seconds.toText(end.diff(this, 'second'));\n }\n\n withClock(clock: DateTime): DateTime {\n return tryTo(() => [this.toDate() as Date, clock.toDate() as Date])\n .map(([td, cd]) => new Date(td.getFullYear(), td.getMonth(), td.getDate(), cd.getHours(), cd.getMinutes(), cd.getSeconds()))\n .map(d => new DateTime(d)).value;\n }\n}\n\nexport const isDateTime = (dt?: unknown): dt is DateTime => isDefined(dt) && dt instanceof DateTime;\n\nexport const dt = (dt?: DatetimeInput): DateTime => new DateTime(dt);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,eAAqF,gBAAgB;AAa1H,SAAS,cAAc;AAYhB,IAAM,WAAN,MAAM,kBAAiB,MAAwB;AAAA,EACjC;AAAA,EAInB,YAAY,OAAuB,QAAiB;AAClD,UAAM,QAAQ,OAAO,KAAK,EACvB,KAAK,UAAU,OAAM,SAAS,cAAc,WAAW,GAAG,QAAQ,EAAE,SAAS,KAAK,CAAC,IAAI,cAAc,QAAQ,GAAG,EAAE,SAAS,KAAK,CAAC,CAAE,EACnI,KAAK,UAAU,OAAK,cAAc,WAAW,CAAC,CAAC,EAC/C,KAAK,QAAQ,OAAK,cAAc,WAAW,CAAC,CAAC,EAC7C,KAAK,YAAY,OAAK,EAAE,KAAK,EAE7B,KAAK,iBAAiB,gBAAgB,QAAQ,cAAc,QAAQ,MAAg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WAAO,KAAK,UAAU,KAAK,IAAI,SAAS,IAAI;AAAA,EAC9C;AAAA,EAEA,UAAkB;AAChB,WAAO,KAAK,MAAM,SAAS;AAAA,EAC7B;AAAA,EAEA,IAAI,MAAgB,UAAS,KAAa;AACxC,WAAO,QAAQ,OAAO,IAAI,KAAK,MAAM,QAAQ,CAAC;AAAA,EAChD;AAAA,EAEA,UAAU,OAA2B;AACnC,WAAO,MAAM,MAAM,CAAC,KAAK,OAAO,GAAW,MAAM,OAAO,CAAS,CAAC,EAC/D,IAAI,CAAC,CAAC,IAAI,EAAE,MAAM,IAAI,KAAK,GAAG,YAAY,GAAG,GAAG,SAAS,GAAG,GAAG,QAAQ,GAAG,GAAG,SAAS,GAAG,GAAG,WAAW,GAAG,GAAG,WAAW,CAAC,CAAC,EAC1H,IAAI,OAAK,IAAI,UAAS,CAAC,CAAC,EAAE;AAAA,EAC/B;AACF;AAEO,IAAM,aAAa,CAACA,QAAiC,UAAUA,GAAE,KAAKA,eAAc;AAEpF,IAAM,KAAK,CAACA,QAAiC,IAAI,SAASA,GAAE;","names":["dt"]}
1
+ {"version":3,"sources":["../src/domain/DateTime.ts"],"sourcesContent":["import { DateTime as LuxonDateTime, DateTimeUnit as LuxonDateTimeUnit, DurationUnit as LuxonDurationUnit, Settings } from 'luxon';\nimport { Value } from '../types/Value';\nimport { Optional } from '../types/Types';\nimport { choose } from '../types/Case';\nimport { isDefined, isNumber, isString } from '../types/Is';\nimport { isDate } from '../types/IsDate';\nimport { isA } from '../types/IsA';\nimport { ifDefined } from '../utils/If';\nimport { JsonValue } from '../types/Json';\nimport { seconds } from '../utils/Seconds';\nimport { tryTo } from '../types/Try';\nimport { use } from '../types/Constructor';\n\nSettings.defaultZone = 'utc';\n\nexport type DateTimeUnit = LuxonDateTimeUnit;\nexport type DurationUnit = LuxonDurationUnit;\nexport type Duration = Partial<Record<DurationUnit, number>>;\n\nexport type DiffOptions = {\n rounding: 'floor' | 'ceil' | 'round';\n};\n\nexport type DatetimeInput = string | number | Date | DateTime | null;\n\nexport class DateTime extends Value<Optional<string>> {\n protected readonly luxon: LuxonDateTime;\n\n constructor(value?: DatetimeInput);\n constructor(value?: string, format?: string);\n constructor(value?: DatetimeInput, format?: string) {\n const luxon = choose(value)\n .type(isString, v => (format ? LuxonDateTime.fromFormat(v, format, { setZone: true }) : LuxonDateTime.fromISO(v, { setZone: true })))\n .type(isNumber, v => LuxonDateTime.fromMillis(v))\n .type(isDate, v => LuxonDateTime.fromJSDate(v))\n .type(isDateTime, v => v.luxon)\n // Allow constructing with LuxonDateTime without exposing types\n .else(value instanceof LuxonDateTime ? value : LuxonDateTime.fromISO(undefined as any));\n\n super(luxon.toISO() ?? undefined);\n this.luxon = luxon;\n }\n\n static get now(): DateTime {\n return new DateTime(LuxonDateTime.utc() as any);\n }\n\n get isValid(): boolean {\n return isDefined(this.value) && this.utc.isValid;\n }\n\n /**\n * @deprecated Deprecated in favor for DateTime.from as that also accepts locales and another DateTime\n */\n get fromNow(): string {\n return this.from();\n }\n\n get inAmsterdam(): DateTime {\n return this.withZone('Europe/Amsterdam');\n }\n\n get inNewYork(): DateTime {\n return this.withZone('America/New_York');\n }\n\n get inLondon(): DateTime {\n return this.withZone('Europe/London');\n }\n\n get inWarsaw(): DateTime {\n return this.withZone('Europe/Warsaw');\n }\n\n protected get utc(): LuxonDateTime {\n return this.luxon.setZone('utc');\n }\n\n from(locale?: string): string;\n\n from(date?: DateTime, locale?: string): string;\n\n from(dateOrLocale?: string | DateTime, maybeLocale?: string): string {\n return (\n use((isString(dateOrLocale) ? dateOrLocale : maybeLocale) ?? 'en', locale =>\n ifDefined(\n isA<DateTime>(dateOrLocale) ? dateOrLocale : undefined,\n d => this.utc.setLocale(locale).toRelative({ base: d.utc }),\n () => this.utc.setLocale(locale).toRelative()\n )\n ) ?? ''\n );\n }\n\n isAfter(dt: DateTime): boolean {\n return this.utc > dt.utc;\n }\n\n isBefore(dt: DateTime): boolean {\n return this.utc < dt.utc;\n }\n\n equals(dt: DateTime): boolean {\n return this.utc.hasSame(dt.utc, 'millisecond');\n }\n\n add(n: number, unit?: DurationUnit): DateTime;\n\n add(duration: Duration): DateTime;\n\n add(n: number | Duration, unit: DurationUnit = 'day'): DateTime {\n return new DateTime(this.luxon.plus(isNumber(n) ? { [unit]: n } : n) as any);\n }\n\n subtract(n: number, unit?: DurationUnit): DateTime;\n\n subtract(duration: Duration): DateTime;\n\n subtract(n: number | Duration, unit: DurationUnit = 'day'): DateTime {\n return new DateTime(this.luxon.minus(isNumber(n) ? { [unit]: n } : n) as any);\n }\n\n diff(other: DateTime, unit: DateTimeUnit = 'day', opts?: DiffOptions): number {\n return Math[opts?.rounding ?? 'floor'](this.utc.diff(other.utc).as(unit));\n }\n\n startOf(unit: DateTimeUnit = 'day'): DateTime {\n return new DateTime(this.luxon.startOf(unit) as any);\n }\n\n endOf(unit: DateTimeUnit = 'day'): DateTime {\n return new DateTime(this.luxon.endOf(unit) as any);\n }\n\n isWeekend(): boolean {\n return this.luxon.isWeekend;\n }\n\n withZone(zone: string): DateTime {\n return new DateTime(this.luxon.setZone(zone) as any);\n }\n\n toString(): string {\n return this.value ?? '';\n }\n\n toJSON(): JsonValue {\n return this.utc.toISO();\n }\n\n toFormat(format: string): string {\n return this.luxon.toFormat(format);\n }\n\n toLocale(locale = 'nl-NL', format = 'D'): string {\n return this.luxon.setLocale(locale).toFormat(format);\n }\n\n toFull(locale?: string): string {\n return this.toLocale(locale, 'DDD');\n }\n\n toDate(): Optional<Date> {\n return this.isValid ? this.utc.toJSDate() : undefined;\n }\n\n toEpoch(): number {\n return this.luxon.toMillis();\n }\n\n ago(end: DateTime = DateTime.now): string {\n return seconds.toText(end.diff(this, 'second'));\n }\n\n withClock(clock: DateTime): DateTime {\n return tryTo(() => [this.toDate() as Date, clock.toDate() as Date])\n .map(([td, cd]) => new Date(td.getFullYear(), td.getMonth(), td.getDate(), cd.getHours(), cd.getMinutes(), cd.getSeconds()))\n .map(d => new DateTime(d)).value;\n }\n}\n\nexport const isDateTime = (dt?: unknown): dt is DateTime => isDefined(dt) && dt instanceof DateTime;\n\nexport const dt = (dt?: DatetimeInput): DateTime => new DateTime(dt);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,eAAqF,gBAAgB;AAa1H,SAAS,cAAc;AAYhB,IAAM,WAAN,MAAM,kBAAiB,MAAwB;AAAA,EACjC;AAAA,EAInB,YAAY,OAAuB,QAAiB;AAClD,UAAM,QAAQ,OAAO,KAAK,EACvB,KAAK,UAAU,OAAM,SAAS,cAAc,WAAW,GAAG,QAAQ,EAAE,SAAS,KAAK,CAAC,IAAI,cAAc,QAAQ,GAAG,EAAE,SAAS,KAAK,CAAC,CAAE,EACnI,KAAK,UAAU,OAAK,cAAc,WAAW,CAAC,CAAC,EAC/C,KAAK,QAAQ,OAAK,cAAc,WAAW,CAAC,CAAC,EAC7C,KAAK,YAAY,OAAK,EAAE,KAAK,EAE7B,KAAK,iBAAiB,gBAAgB,QAAQ,cAAc,QAAQ,MAAgB,CAAC;AAExF,UAAM,MAAM,MAAM,KAAK,MAAS;AAChC,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,WAAW,MAAgB;AACzB,WAAO,IAAI,UAAS,cAAc,IAAI,CAAQ;AAAA,EAChD;AAAA,EAEA,IAAI,UAAmB;AACrB,WAAO,UAAU,KAAK,KAAK,KAAK,KAAK,IAAI;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,UAAkB;AACpB,WAAO,KAAK,KAAK;AAAA,EACnB;AAAA,EAEA,IAAI,cAAwB;AAC1B,WAAO,KAAK,SAAS,kBAAkB;AAAA,EACzC;AAAA,EAEA,IAAI,YAAsB;AACxB,WAAO,KAAK,SAAS,kBAAkB;AAAA,EACzC;AAAA,EAEA,IAAI,WAAqB;AACvB,WAAO,KAAK,SAAS,eAAe;AAAA,EACtC;AAAA,EAEA,IAAI,WAAqB;AACvB,WAAO,KAAK,SAAS,eAAe;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AAiC,UAAUA,GAAE,KAAKA,eAAc;AAEpF,IAAM,KAAK,CAACA,QAAiC,IAAI,SAASA,GAAE;","names":["dt"]}
@@ -1,9 +1,7 @@
1
1
  import {
2
- Exception
3
- } from "./chunk-5BGTUK7G.mjs";
4
- import {
2
+ Exception,
5
3
  reject
6
- } from "./chunk-AJZIKJEC.mjs";
4
+ } from "./chunk-TUO7ZPSP.mjs";
7
5
 
8
6
  // src/types/Repository.ts
9
7
  var Repository = class {
@@ -48,4 +46,4 @@ var Repository = class {
48
46
  export {
49
47
  Repository
50
48
  };
51
- //# sourceMappingURL=chunk-FAFNTQIS.mjs.map
49
+ //# sourceMappingURL=chunk-LHDTOERW.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/Repository.ts"],"sourcesContent":["import { FetchOptions } from './Gateway';\nimport { PageList } from './PageList';\nimport { Exception } from './Exception';\nimport { reject } from '../utils/Promise';\nimport { Id, Key } from './Id';\nimport { List } from './List';\nimport { Json, JsonValue } from './Json';\n\nexport class Repository<T, Options = FetchOptions> {\n all(options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byId(id: Id): Promise<T> {\n return reject(Exception.IsNotImplemented);\n }\n\n byIds(...ids: Id[]): Promise<List<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byKey(key: Key, options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n by(key: keyof T, value: JsonValue, options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n search(q: JsonValue, options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n filter(options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n exists(id: Id): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n\n add(t: Partial<T> | Json): Promise<T> {\n return reject(Exception.IsNotImplemented);\n }\n\n update(id: Id, json: Partial<T> | Json): Promise<T> {\n return reject(Exception.IsNotImplemented);\n }\n\n remove(id: Id): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n\n upsert(id: Id, item: Partial<T> | Json): Promise<T> {\n return reject(Exception.IsNotImplemented);\n }\n}\n"],"mappings":";;;;;;;;AAQO,IAAM,aAAN,MAA4C;AAAA,EACjD,IAAI,SAAyC;AAC3C,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,KAAK,IAAoB;AACvB,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,SAAS,KAA6B;AACpC,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,MAAM,KAAU,SAAyC;AACvD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,GAAG,KAAc,OAAkB,SAAyC;AAC1E,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,GAAc,SAAyC;AAC5D,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,SAAyC;AAC9C,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAA0B;AAC/B,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,IAAI,GAAkC;AACpC,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,MAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAA0B;AAC/B,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,MAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/types/Repository.ts"],"sourcesContent":["import { FetchOptions } from './Gateway';\nimport { PageList } from './PageList';\nimport { Exception } from './Exception';\nimport { reject } from '../utils/Promise';\nimport { Id, Key } from './Id';\nimport { List } from './List';\nimport { Json, JsonValue } from './Json';\n\nexport class Repository<T, Options = FetchOptions> {\n all(options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byId(id: Id): Promise<T> {\n return reject(Exception.IsNotImplemented);\n }\n\n byIds(...ids: Id[]): Promise<List<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n byKey(key: Key, options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n by(key: keyof T, value: JsonValue, options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n search(q: JsonValue, options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n filter(options?: Options): Promise<PageList<T>> {\n return reject(Exception.IsNotImplemented);\n }\n\n exists(id: Id): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n\n add(t: Partial<T> | Json): Promise<T> {\n return reject(Exception.IsNotImplemented);\n }\n\n update(id: Id, json: Partial<T> | Json): Promise<T> {\n return reject(Exception.IsNotImplemented);\n }\n\n remove(id: Id): Promise<boolean> {\n return reject(Exception.IsNotImplemented);\n }\n\n upsert(id: Id, item: Partial<T> | Json): Promise<T> {\n return reject(Exception.IsNotImplemented);\n }\n}\n"],"mappings":";;;;;;AAQO,IAAM,aAAN,MAA4C;AAAA,EACjD,IAAI,SAAyC;AAC3C,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,KAAK,IAAoB;AACvB,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,SAAS,KAA6B;AACpC,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,MAAM,KAAU,SAAyC;AACvD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,GAAG,KAAc,OAAkB,SAAyC;AAC1E,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,GAAc,SAAyC;AAC5D,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,SAAyC;AAC9C,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAA0B;AAC/B,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,IAAI,GAAkC;AACpC,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,MAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAA0B;AAC/B,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AAAA,EAEA,OAAO,IAAQ,MAAqC;AAClD,WAAO,OAAO,UAAU,gBAAgB;AAAA,EAC1C;AACF;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ifTrue,
3
3
  toList
4
- } from "./chunk-AQXV7L65.mjs";
4
+ } from "./chunk-TUO7ZPSP.mjs";
5
5
 
6
6
  // src/utils/Seconds.ts
7
7
  var seconds = {
@@ -21,4 +21,4 @@ var seconds = {
21
21
  export {
22
22
  seconds
23
23
  };
24
- //# sourceMappingURL=chunk-CFJJ2C6C.mjs.map
24
+ //# sourceMappingURL=chunk-M2S4OLVZ.mjs.map
@@ -6,13 +6,11 @@ import {
6
6
  } from "./chunk-KL75JJTY.mjs";
7
7
  import {
8
8
  ContentType
9
- } from "./chunk-WWYPWYFC.mjs";
9
+ } from "./chunk-FFD2T6YV.mjs";
10
10
  import {
11
+ Enum,
11
12
  ctx
12
- } from "./chunk-5BGTUK7G.mjs";
13
- import {
14
- Enum
15
- } from "./chunk-7A3RM67L.mjs";
13
+ } from "./chunk-TUO7ZPSP.mjs";
16
14
  import {
17
15
  asString
18
16
  } from "./chunk-4Q6IHSAU.mjs";
@@ -87,4 +85,4 @@ export {
87
85
  RequestOptions,
88
86
  isRequestOptions
89
87
  };
90
- //# sourceMappingURL=chunk-SW5NBVHL.mjs.map
88
+ //# sourceMappingURL=chunk-O4RWZGFC.mjs.map