@stancer/stancer 1.0.1 → 1.0.2

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 (292) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/dist/address/api-endpoint.d.ts +20 -0
  3. package/dist/address/api-endpoint.d.ts.map +1 -0
  4. package/dist/address/api-endpoint.js +28 -0
  5. package/dist/address/api-endpoint.js.map +1 -0
  6. package/dist/address/model.d.ts +35 -0
  7. package/dist/address/model.d.ts.map +1 -0
  8. package/dist/address/model.js +63 -0
  9. package/dist/address/model.js.map +1 -0
  10. package/dist/address/repository.d.ts +7 -0
  11. package/dist/address/repository.d.ts.map +1 -0
  12. package/dist/address/repository.js +14 -0
  13. package/dist/address/repository.js.map +1 -0
  14. package/dist/address/validator.d.ts +4 -0
  15. package/dist/address/validator.d.ts.map +1 -0
  16. package/dist/address/validator.js +32 -0
  17. package/dist/address/validator.js.map +1 -0
  18. package/dist/api-endpoint/abstract-api-endpoint.d.ts +46 -0
  19. package/dist/api-endpoint/abstract-api-endpoint.d.ts.map +1 -0
  20. package/dist/api-endpoint/abstract-api-endpoint.js +220 -0
  21. package/dist/api-endpoint/abstract-api-endpoint.js.map +1 -0
  22. package/dist/api-endpoint/configuration.d.ts +34 -0
  23. package/dist/api-endpoint/configuration.d.ts.map +1 -0
  24. package/dist/api-endpoint/configuration.js +99 -0
  25. package/dist/api-endpoint/configuration.js.map +1 -0
  26. package/dist/api-endpoint/http/fetch-http-client.d.ts +3 -0
  27. package/dist/api-endpoint/http/fetch-http-client.d.ts.map +1 -0
  28. package/dist/api-endpoint/http/fetch-http-client.js +28 -0
  29. package/dist/api-endpoint/http/fetch-http-client.js.map +1 -0
  30. package/dist/api-endpoint/http/http.d.ts +18 -0
  31. package/dist/api-endpoint/http/http.d.ts.map +1 -0
  32. package/dist/api-endpoint/http/http.js +47 -0
  33. package/dist/api-endpoint/http/http.js.map +1 -0
  34. package/dist/api-endpoint/http/index.d.ts +3 -0
  35. package/dist/api-endpoint/http/index.d.ts.map +1 -0
  36. package/dist/api-endpoint/http/index.js +3 -0
  37. package/dist/api-endpoint/http/index.js.map +1 -0
  38. package/dist/api-endpoint/version.d.ts +5 -0
  39. package/dist/api-endpoint/version.d.ts.map +1 -0
  40. package/dist/api-endpoint/version.js +6 -0
  41. package/dist/api-endpoint/version.js.map +1 -0
  42. package/dist/card/api-endpoint.d.ts +28 -0
  43. package/dist/card/api-endpoint.d.ts.map +1 -0
  44. package/dist/card/api-endpoint.js +37 -0
  45. package/dist/card/api-endpoint.js.map +1 -0
  46. package/dist/card/enum/funding.d.ts +3 -0
  47. package/dist/card/enum/funding.d.ts.map +1 -0
  48. package/dist/card/enum/funding.js +10 -0
  49. package/dist/card/enum/funding.js.map +1 -0
  50. package/dist/card/enum/nature.d.ts +3 -0
  51. package/dist/card/enum/nature.d.ts.map +1 -0
  52. package/dist/card/enum/nature.js +6 -0
  53. package/dist/card/enum/nature.js.map +1 -0
  54. package/dist/card/enum/network.d.ts +5 -0
  55. package/dist/card/enum/network.d.ts.map +1 -0
  56. package/dist/card/enum/network.js +12 -0
  57. package/dist/card/enum/network.js.map +1 -0
  58. package/dist/card/model.d.ts +55 -0
  59. package/dist/card/model.d.ts.map +1 -0
  60. package/dist/card/model.js +90 -0
  61. package/dist/card/model.js.map +1 -0
  62. package/dist/card/repository.d.ts +7 -0
  63. package/dist/card/repository.d.ts.map +1 -0
  64. package/dist/card/repository.js +10 -0
  65. package/dist/card/repository.js.map +1 -0
  66. package/dist/card/validator.d.ts +8 -0
  67. package/dist/card/validator.d.ts.map +1 -0
  68. package/dist/card/validator.js +71 -0
  69. package/dist/card/validator.js.map +1 -0
  70. package/dist/core/abstract-model.d.ts +51 -0
  71. package/dist/core/abstract-model.d.ts.map +1 -0
  72. package/dist/core/abstract-model.js +93 -0
  73. package/dist/core/abstract-model.js.map +1 -0
  74. package/dist/core/abstract-repository.d.ts +86 -0
  75. package/dist/core/abstract-repository.d.ts.map +1 -0
  76. package/dist/core/abstract-repository.js +97 -0
  77. package/dist/core/abstract-repository.js.map +1 -0
  78. package/dist/core/common/branded-type.d.ts +6 -0
  79. package/dist/core/common/branded-type.d.ts.map +1 -0
  80. package/dist/core/common/branded-type.js +9 -0
  81. package/dist/core/common/branded-type.js.map +1 -0
  82. package/dist/core/common/handler/date-handler.d.ts +5 -0
  83. package/dist/core/common/handler/date-handler.d.ts.map +1 -0
  84. package/dist/core/common/handler/date-handler.js +23 -0
  85. package/dist/core/common/handler/date-handler.js.map +1 -0
  86. package/dist/core/common/handler/enum-handler.d.ts +3 -0
  87. package/dist/core/common/handler/enum-handler.d.ts.map +1 -0
  88. package/dist/core/common/handler/enum-handler.js +14 -0
  89. package/dist/core/common/handler/enum-handler.js.map +1 -0
  90. package/dist/core/common/handler/handler.d.ts +24 -0
  91. package/dist/core/common/handler/handler.d.ts.map +1 -0
  92. package/dist/core/common/handler/handler.js +33 -0
  93. package/dist/core/common/handler/handler.js.map +1 -0
  94. package/dist/core/common/handler/id-handler.d.ts +4 -0
  95. package/dist/core/common/handler/id-handler.d.ts.map +1 -0
  96. package/dist/core/common/handler/id-handler.js +21 -0
  97. package/dist/core/common/handler/id-handler.js.map +1 -0
  98. package/dist/core/common/id-validator.d.ts +10 -0
  99. package/dist/core/common/id-validator.d.ts.map +1 -0
  100. package/dist/core/common/id-validator.js +17 -0
  101. package/dist/core/common/id-validator.js.map +1 -0
  102. package/dist/core/common/mutation-tracked-object.d.ts +8 -0
  103. package/dist/core/common/mutation-tracked-object.d.ts.map +1 -0
  104. package/dist/core/common/mutation-tracked-object.js +38 -0
  105. package/dist/core/common/mutation-tracked-object.js.map +1 -0
  106. package/dist/core/endpoint-interface.d.ts +38 -0
  107. package/dist/core/endpoint-interface.d.ts.map +1 -0
  108. package/dist/core/endpoint-interface.js +2 -0
  109. package/dist/core/endpoint-interface.js.map +1 -0
  110. package/dist/core/error/base-error.d.ts +3 -0
  111. package/dist/core/error/base-error.d.ts.map +1 -0
  112. package/dist/core/error/base-error.js +3 -0
  113. package/dist/core/error/base-error.js.map +1 -0
  114. package/dist/core/error/endpoint/api/api-conflict-error.d.ts +5 -0
  115. package/dist/core/error/endpoint/api/api-conflict-error.d.ts.map +1 -0
  116. package/dist/core/error/endpoint/api/api-conflict-error.js +7 -0
  117. package/dist/core/error/endpoint/api/api-conflict-error.js.map +1 -0
  118. package/dist/core/error/endpoint/api/api-error.d.ts +6 -0
  119. package/dist/core/error/endpoint/api/api-error.d.ts.map +1 -0
  120. package/dist/core/error/endpoint/api/api-error.js +9 -0
  121. package/dist/core/error/endpoint/api/api-error.js.map +1 -0
  122. package/dist/core/error/endpoint/api/api-not-found-error.d.ts +5 -0
  123. package/dist/core/error/endpoint/api/api-not-found-error.d.ts.map +1 -0
  124. package/dist/core/error/endpoint/api/api-not-found-error.js +7 -0
  125. package/dist/core/error/endpoint/api/api-not-found-error.js.map +1 -0
  126. package/dist/core/error/endpoint/api/api-unauthorized-error.d.ts +5 -0
  127. package/dist/core/error/endpoint/api/api-unauthorized-error.d.ts.map +1 -0
  128. package/dist/core/error/endpoint/api/api-unauthorized-error.js +7 -0
  129. package/dist/core/error/endpoint/api/api-unauthorized-error.js.map +1 -0
  130. package/dist/core/error/endpoint/api/api-unknown-error.d.ts +5 -0
  131. package/dist/core/error/endpoint/api/api-unknown-error.d.ts.map +1 -0
  132. package/dist/core/error/endpoint/api/api-unknown-error.js +7 -0
  133. package/dist/core/error/endpoint/api/api-unknown-error.js.map +1 -0
  134. package/dist/core/error/endpoint/api/api-validation-error.d.ts +11 -0
  135. package/dist/core/error/endpoint/api/api-validation-error.d.ts.map +1 -0
  136. package/dist/core/error/endpoint/api/api-validation-error.js +9 -0
  137. package/dist/core/error/endpoint/api/api-validation-error.js.map +1 -0
  138. package/dist/core/error/endpoint/api/index.d.ts +7 -0
  139. package/dist/core/error/endpoint/api/index.d.ts.map +1 -0
  140. package/dist/core/error/endpoint/api/index.js +7 -0
  141. package/dist/core/error/endpoint/api/index.js.map +1 -0
  142. package/dist/core/error/endpoint/route-inaccessible-error.d.ts +5 -0
  143. package/dist/core/error/endpoint/route-inaccessible-error.d.ts.map +1 -0
  144. package/dist/core/error/endpoint/route-inaccessible-error.js +8 -0
  145. package/dist/core/error/endpoint/route-inaccessible-error.js.map +1 -0
  146. package/dist/core/error/unpopulated-error.d.ts +4 -0
  147. package/dist/core/error/unpopulated-error.d.ts.map +1 -0
  148. package/dist/core/error/unpopulated-error.js +4 -0
  149. package/dist/core/error/unpopulated-error.js.map +1 -0
  150. package/dist/core/error/unsendable-error.d.ts +4 -0
  151. package/dist/core/error/unsendable-error.d.ts.map +1 -0
  152. package/dist/core/error/unsendable-error.js +4 -0
  153. package/dist/core/error/unsendable-error.js.map +1 -0
  154. package/dist/core/error/validation-error.d.ts +4 -0
  155. package/dist/core/error/validation-error.d.ts.map +1 -0
  156. package/dist/core/error/validation-error.js +4 -0
  157. package/dist/core/error/validation-error.js.map +1 -0
  158. package/dist/core/validator.d.ts +63 -0
  159. package/dist/core/validator.d.ts.map +1 -0
  160. package/dist/core/validator.js +73 -0
  161. package/dist/core/validator.js.map +1 -0
  162. package/dist/customer/api-endpoint.d.ts +21 -0
  163. package/dist/customer/api-endpoint.d.ts.map +1 -0
  164. package/dist/customer/api-endpoint.js +27 -0
  165. package/dist/customer/api-endpoint.js.map +1 -0
  166. package/dist/customer/model.d.ts +39 -0
  167. package/dist/customer/model.d.ts.map +1 -0
  168. package/dist/customer/model.js +73 -0
  169. package/dist/customer/model.js.map +1 -0
  170. package/dist/customer/repository.d.ts +7 -0
  171. package/dist/customer/repository.d.ts.map +1 -0
  172. package/dist/customer/repository.js +10 -0
  173. package/dist/customer/repository.js.map +1 -0
  174. package/dist/customer/validator.d.ts +4 -0
  175. package/dist/customer/validator.d.ts.map +1 -0
  176. package/dist/customer/validator.js +23 -0
  177. package/dist/customer/validator.js.map +1 -0
  178. package/dist/main.d.ts +2 -0
  179. package/dist/main.d.ts.map +1 -0
  180. package/dist/main.js +2 -0
  181. package/dist/main.js.map +1 -0
  182. package/dist/payment/api-endpoint.d.ts +51 -0
  183. package/dist/payment/api-endpoint.d.ts.map +1 -0
  184. package/dist/payment/api-endpoint.js +110 -0
  185. package/dist/payment/api-endpoint.js.map +1 -0
  186. package/dist/payment/enum/currency.d.ts +3 -0
  187. package/dist/payment/enum/currency.d.ts.map +1 -0
  188. package/dist/payment/enum/currency.js +13 -0
  189. package/dist/payment/enum/currency.js.map +1 -0
  190. package/dist/payment/enum/method.d.ts +3 -0
  191. package/dist/payment/enum/method.d.ts.map +1 -0
  192. package/dist/payment/enum/method.js +2 -0
  193. package/dist/payment/enum/method.js.map +1 -0
  194. package/dist/payment/enum/status.d.ts +4 -0
  195. package/dist/payment/enum/status.d.ts.map +1 -0
  196. package/dist/payment/enum/status.js +19 -0
  197. package/dist/payment/enum/status.js.map +1 -0
  198. package/dist/payment/model.d.ts +135 -0
  199. package/dist/payment/model.d.ts.map +1 -0
  200. package/dist/payment/model.js +232 -0
  201. package/dist/payment/model.js.map +1 -0
  202. package/dist/payment/repository.d.ts +17 -0
  203. package/dist/payment/repository.d.ts.map +1 -0
  204. package/dist/payment/repository.js +56 -0
  205. package/dist/payment/repository.js.map +1 -0
  206. package/dist/payment/validator.d.ts +16 -0
  207. package/dist/payment/validator.d.ts.map +1 -0
  208. package/dist/payment/validator.js +81 -0
  209. package/dist/payment/validator.js.map +1 -0
  210. package/dist/payment-intent/api-endpoint.d.ts +48 -0
  211. package/dist/payment-intent/api-endpoint.d.ts.map +1 -0
  212. package/dist/payment-intent/api-endpoint.js +94 -0
  213. package/dist/payment-intent/api-endpoint.js.map +1 -0
  214. package/dist/payment-intent/enum/status.d.ts +5 -0
  215. package/dist/payment-intent/enum/status.d.ts.map +1 -0
  216. package/dist/payment-intent/enum/status.js +20 -0
  217. package/dist/payment-intent/enum/status.js.map +1 -0
  218. package/dist/payment-intent/enum/threeds.d.ts +3 -0
  219. package/dist/payment-intent/enum/threeds.d.ts.map +1 -0
  220. package/dist/payment-intent/enum/threeds.js +2 -0
  221. package/dist/payment-intent/enum/threeds.js.map +1 -0
  222. package/dist/payment-intent/model.d.ts +90 -0
  223. package/dist/payment-intent/model.d.ts.map +1 -0
  224. package/dist/payment-intent/model.js +177 -0
  225. package/dist/payment-intent/model.js.map +1 -0
  226. package/dist/payment-intent/repository.d.ts +13 -0
  227. package/dist/payment-intent/repository.d.ts.map +1 -0
  228. package/dist/payment-intent/repository.js +65 -0
  229. package/dist/payment-intent/repository.js.map +1 -0
  230. package/dist/payment-intent/validator.d.ts +4 -0
  231. package/dist/payment-intent/validator.d.ts.map +1 -0
  232. package/dist/payment-intent/validator.js +38 -0
  233. package/dist/payment-intent/validator.js.map +1 -0
  234. package/dist/payout/model.d.ts +7 -0
  235. package/dist/payout/model.d.ts.map +1 -0
  236. package/dist/payout/model.js +6 -0
  237. package/dist/payout/model.js.map +1 -0
  238. package/dist/refund/api-endpoint.d.ts +22 -0
  239. package/dist/refund/api-endpoint.d.ts.map +1 -0
  240. package/dist/refund/api-endpoint.js +32 -0
  241. package/dist/refund/api-endpoint.js.map +1 -0
  242. package/dist/refund/enum/refund-status.d.ts +3 -0
  243. package/dist/refund/enum/refund-status.d.ts.map +1 -0
  244. package/dist/refund/enum/refund-status.js +10 -0
  245. package/dist/refund/enum/refund-status.js.map +1 -0
  246. package/dist/refund/model.d.ts +38 -0
  247. package/dist/refund/model.d.ts.map +1 -0
  248. package/dist/refund/model.js +51 -0
  249. package/dist/refund/model.js.map +1 -0
  250. package/dist/refund/repository.d.ts +7 -0
  251. package/dist/refund/repository.d.ts.map +1 -0
  252. package/dist/refund/repository.js +10 -0
  253. package/dist/refund/repository.js.map +1 -0
  254. package/dist/refund/validator.d.ts +4 -0
  255. package/dist/refund/validator.d.ts.map +1 -0
  256. package/dist/refund/validator.js +41 -0
  257. package/dist/refund/validator.js.map +1 -0
  258. package/dist/sepa/api-endpoint.d.ts +19 -0
  259. package/dist/sepa/api-endpoint.d.ts.map +1 -0
  260. package/dist/sepa/api-endpoint.js +25 -0
  261. package/dist/sepa/api-endpoint.js.map +1 -0
  262. package/dist/sepa/model.d.ts +32 -0
  263. package/dist/sepa/model.d.ts.map +1 -0
  264. package/dist/sepa/model.js +53 -0
  265. package/dist/sepa/model.js.map +1 -0
  266. package/dist/sepa/repository.d.ts +7 -0
  267. package/dist/sepa/repository.d.ts.map +1 -0
  268. package/dist/sepa/repository.js +10 -0
  269. package/dist/sepa/repository.js.map +1 -0
  270. package/dist/sepa/validator.d.ts +8 -0
  271. package/dist/sepa/validator.d.ts.map +1 -0
  272. package/dist/sepa/validator.js +47 -0
  273. package/dist/sepa/validator.js.map +1 -0
  274. package/package.json +1 -1
  275. package/reports/base.css +362 -0
  276. package/reports/block-navigation.js +75 -0
  277. package/reports/cobertura-coverage.xml +18 -0
  278. package/reports/favicon.png +0 -0
  279. package/reports/index.html +177 -0
  280. package/reports/junit.xml +25 -0
  281. package/reports/prettify.css +101 -0
  282. package/reports/prettify.js +955 -0
  283. package/reports/sort-arrow-sprite.png +0 -0
  284. package/reports/sorter.js +205 -0
  285. package/.editorconfig +0 -14
  286. package/.gitlab-ci.yml +0 -159
  287. package/.prettierignore +0 -3
  288. package/eslint.config.js +0 -14
  289. package/pnpm-workspace.yaml +0 -19
  290. package/prettier.config.js +0 -3
  291. package/tsconfig.json +0 -50
  292. package/vitest.config.ts +0 -20
@@ -0,0 +1,10 @@
1
+ import type { IdValue } from './branded-type.js';
2
+ export declare const ID_SUFFIX_LENGTH = 24;
3
+ export declare const isValidID: <ID extends IdValue>(id: string, regex: RegExp) => id is ID;
4
+ export declare const IdErrorMessage: (value: string, regex: RegExp) => string;
5
+ export declare const IdValidator: <Id extends IdValue>(regex: RegExp) => {
6
+ validate: (arg0: string) => arg0 is Id;
7
+ errorMessage: (value: string) => string;
8
+ };
9
+ export declare const validateID: <ID extends IdValue>(id: string, regex: RegExp) => ID;
10
+ //# sourceMappingURL=id-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id-validator.d.ts","sourceRoot":"","sources":["../../../src/core/common/id-validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,eAAO,MAAM,SAAS,GAAI,EAAE,SAAS,OAAO,MAAM,MAAM,SAAS,MAAM,KAAG,EAAE,IAAI,EAAoB,CAAC;AACrG,eAAO,MAAM,cAAc,UAAW,MAAM,SAAS,MAAM,WAA2D,CAAC;AAEvH,eAAO,MAAM,WAAW,GAAI,EAAE,SAAS,OAAO,SAAS,MAAM;IAEzD,QAAQ,SAAS,MAAM,KAAG,IAAI,IAAI,EAAE;IACpC,YAAY,UAAU,MAAM;CAE/B,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,EAAE,SAAS,OAAO,MAAM,MAAM,SAAS,MAAM,OAMvE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { StancerValidationError } from '#core/error/validation-error.js';
2
+ export const ID_SUFFIX_LENGTH = 24;
3
+ export const isValidID = (id, regex) => regex.test(id);
4
+ export const IdErrorMessage = (value, regex) => `The id (${value}) doesn't match the pattern ${regex}`;
5
+ export const IdValidator = (regex) => {
6
+ return {
7
+ validate: (arg0) => isValidID(arg0, regex),
8
+ errorMessage: (value) => IdErrorMessage(value, regex),
9
+ };
10
+ };
11
+ export const validateID = (id, regex) => {
12
+ if (isValidID(id, regex)) {
13
+ return id;
14
+ }
15
+ throw new StancerValidationError(IdErrorMessage(id, regex));
16
+ };
17
+ //# sourceMappingURL=id-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id-validator.js","sourceRoot":"","sources":["../../../src/core/common/id-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAIzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAqB,EAAU,EAAE,KAAa,EAAY,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,KAAa,EAAE,EAAE,CAAC,WAAW,KAAK,+BAA+B,KAAK,EAAE,CAAC;AAEvH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAqB,KAAa,EAAE,EAAE;IAC/D,OAAO;QACL,QAAQ,EAAE,CAAC,IAAY,EAAc,EAAE,CAAC,SAAS,CAAK,IAAI,EAAE,KAAK,CAAC;QAClE,YAAY,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC;KAC9D,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAqB,EAAU,EAAE,KAAa,EAAE,EAAE;IAC1E,IAAI,SAAS,CAAK,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,IAAI,sBAAsB,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ModelType } from '#core/abstract-model.js';
2
+ import type { ValidationFunction } from '#core/validator.js';
3
+ export type MutationTrackedObject<T extends Partial<ModelType>> = T & {
4
+ getMutations(): Partial<T>;
5
+ toRaw(): T;
6
+ };
7
+ export declare const trackObjectMutations: <T extends ModelType>(data: Partial<T>, validator: ValidationFunction<T>) => MutationTrackedObject<T>;
8
+ //# sourceMappingURL=mutation-tracked-object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-tracked-object.d.ts","sourceRoot":"","sources":["../../../src/core/common/mutation-tracked-object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAM7D,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;IACpE,YAAY,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,IAAI,CAAC,CAAC;CACZ,CAAC;AACF,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,SAAS,QAChD,OAAO,CAAC,CAAC,CAAC,aACL,kBAAkB,CAAC,CAAC,CAAC,KAC/B,qBAAqB,CAAC,CAAC,CAkCzB,CAAC"}
@@ -0,0 +1,38 @@
1
+ const inMutation = (mutations, key) => {
2
+ return Object.hasOwn(mutations, key);
3
+ };
4
+ export const trackObjectMutations = (data, validator) => {
5
+ const mutations = {};
6
+ const handler = {
7
+ deleteProperty(target, key) {
8
+ if (inMutation(mutations, key)) {
9
+ mutations[key] = undefined;
10
+ }
11
+ return Reflect.deleteProperty(target, key);
12
+ },
13
+ get(target, key, receiver) {
14
+ if (key === 'getMutations') {
15
+ return () => ({ ...mutations });
16
+ }
17
+ if (key === 'toRaw') {
18
+ return () => target;
19
+ }
20
+ return Reflect.get(target, key, receiver);
21
+ },
22
+ set(target, key, value, receiver) {
23
+ if (typeof key === 'symbol') {
24
+ return Reflect.set(target, key, value, receiver);
25
+ }
26
+ const oldValue = Reflect.get(target, key, receiver);
27
+ if (oldValue === undefined || oldValue !== value) {
28
+ // validator throw error on fail
29
+ validator(key, value);
30
+ mutations[key] = value;
31
+ }
32
+ return Reflect.set(target, key, value, receiver);
33
+ },
34
+ };
35
+ // We redefine getMutations & toRaw in handler get. Proxy has getMutations & toRaw
36
+ return new Proxy(data, handler);
37
+ };
38
+ //# sourceMappingURL=mutation-tracked-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-tracked-object.js","sourceRoot":"","sources":["../../../src/core/common/mutation-tracked-object.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,GAAG,CAAmB,SAAY,EAAE,GAA6B,EAAkB,EAAE;IACnG,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAgB,EAChB,SAAgC,EACN,EAAE;IAC5B,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,MAAM,OAAO,GAAoB;QAC/B,cAAc,CAAC,MAAM,EAAE,GAAoB;YACzC,IAAI,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC;gBAC/B,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;YAC7B,CAAC;YACD,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7C,CAAC;QACD,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ;YACvB,IAAI,GAAG,KAAK,cAAc,EAAE,CAAC;gBAC3B,OAAO,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;YAClC,CAAC;YACD,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;gBACpB,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC;YACtB,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC5C,CAAC;QACD,GAAG,CAAC,MAAM,EAAE,GAAoB,EAAE,KAAK,EAAE,QAAQ;YAC/C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;gBAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YACnD,CAAC;YACD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;YACpD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;gBACjD,gCAAgC;gBAChC,SAAS,CAAC,GAAc,EAAE,KAAK,CAAC,CAAC;gBACjC,SAAS,CAAC,GAAc,CAAC,GAAG,KAAK,CAAC;YACpC,CAAC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC;KACF,CAAC;IAEF,kFAAkF;IAClF,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,OAAO,CAA6B,CAAC;AAC9D,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { Url } from 'url';
2
+ import type { IdValue } from './common/branded-type.js';
3
+ export interface ListParams {
4
+ filters: Record<string, unknown>;
5
+ limit: number;
6
+ start: number;
7
+ end: number;
8
+ }
9
+ export type EndpointGenerator<Data> = AsyncIterableIterator<Partial<Data>, void, Partial<Data>>;
10
+ export interface EndpointInterface<Data> {
11
+ /**
12
+ * Delete the object with specific id in the API
13
+ * @param id The Id of the object we want to delete
14
+ * @returns The response of the API
15
+ */
16
+ delete: (id: IdValue) => Promise<Partial<Data>>;
17
+ /**
18
+ * Get an object from the API
19
+ * @param id The Id of the object we want to get
20
+ * @returns The data of an object
21
+ */
22
+ get: (id: IdValue) => Promise<Partial<Data>>;
23
+ /**
24
+ * Get a list of object from the API
25
+ * @param params The params of the listing
26
+ * @param endpoint A custom url for specific subObject
27
+ * @returns A generator of object Data
28
+ */
29
+ list: (params: Partial<ListParams>, endpoint?: Url) => EndpointGenerator<Data>;
30
+ /**
31
+ * Sent an object to the API
32
+ * @param id The ID of the object
33
+ * @param mutations The data to be sent to our API
34
+ * @returns The new data of the object.
35
+ */
36
+ send: (id: IdValue | undefined, mutations: Partial<Data>) => Promise<Partial<Data>>;
37
+ }
38
+ //# sourceMappingURL=endpoint-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint-interface.d.ts","sourceRoot":"","sources":["../../src/core/endpoint-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,iBAAiB,CAAC,IAAI,IAAI,qBAAqB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAChG,MAAM,WAAW,iBAAiB,CAAC,IAAI;IACrC;;;;OAIG;IACH,MAAM,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAEhD;;;;OAIG;IACH,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAE7C;;;;;OAKG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,KAAK,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAE/E;;;;;OAKG;IACH,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CACrF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=endpoint-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint-interface.js","sourceRoot":"","sources":["../../src/core/endpoint-interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export declare class StancerError extends Error {
2
+ }
3
+ //# sourceMappingURL=base-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-error.d.ts","sourceRoot":"","sources":["../../../src/core/error/base-error.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;CAAG"}
@@ -0,0 +1,3 @@
1
+ export class StancerError extends Error {
2
+ }
3
+ //# sourceMappingURL=base-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-error.js","sourceRoot":"","sources":["../../../src/core/error/base-error.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAa,SAAQ,KAAK;CAAG"}
@@ -0,0 +1,5 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export declare class StancerApiConflictError extends StancerApiError {
3
+ constructor(message?: string);
4
+ }
5
+ //# sourceMappingURL=api-conflict-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-conflict-error.d.ts","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-conflict-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,YAAY,OAAO,CAAC,EAAE,MAAM,EAE3B;CACF"}
@@ -0,0 +1,7 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export class StancerApiConflictError extends StancerApiError {
3
+ constructor(message) {
4
+ super(409, message ?? 'Conflict');
5
+ }
6
+ }
7
+ //# sourceMappingURL=api-conflict-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-conflict-error.js","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-conflict-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAC1D,YAAY,OAAgB;QAC1B,KAAK,CAAC,GAAG,EAAE,OAAO,IAAI,UAAU,CAAC,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import { StancerError } from '../../base-error.js';
2
+ export declare class StancerApiError extends StancerError {
3
+ httpStatus: number;
4
+ constructor(httpStatus: number, message: string);
5
+ }
6
+ //# sourceMappingURL=api-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-error.d.ts","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,qBAAa,eAAgB,SAAQ,YAAY;IAEtC,UAAU,EAAE,MAAM;IAD3B,YACS,UAAU,EAAE,MAAM,EACzB,OAAO,EAAE,MAAM,EAGhB;CACF"}
@@ -0,0 +1,9 @@
1
+ import { StancerError } from '../../base-error.js';
2
+ export class StancerApiError extends StancerError {
3
+ httpStatus;
4
+ constructor(httpStatus, message) {
5
+ super(message);
6
+ this.httpStatus = httpStatus;
7
+ }
8
+ }
9
+ //# sourceMappingURL=api-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-error.js","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAEtC,UAAU;IADnB,YACS,UAAkB,EACzB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;0BAHR,UAAU;IAInB,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export declare class StancerApiNotFoundError extends StancerApiError {
3
+ constructor(message?: string);
4
+ }
5
+ //# sourceMappingURL=api-not-found-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-not-found-error.d.ts","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-not-found-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,YAAY,OAAO,CAAC,EAAE,MAAM,EAE3B;CACF"}
@@ -0,0 +1,7 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export class StancerApiNotFoundError extends StancerApiError {
3
+ constructor(message) {
4
+ super(404, message ?? 'Not Found');
5
+ }
6
+ }
7
+ //# sourceMappingURL=api-not-found-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-not-found-error.js","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-not-found-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,OAAO,uBAAwB,SAAQ,eAAe;IAC1D,YAAY,OAAgB;QAC1B,KAAK,CAAC,GAAG,EAAE,OAAO,IAAI,WAAW,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export declare class StancerApiUnauthorizedError extends StancerApiError {
3
+ constructor(message?: string);
4
+ }
5
+ //# sourceMappingURL=api-unauthorized-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-unauthorized-error.d.ts","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-unauthorized-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,qBAAa,2BAA4B,SAAQ,eAAe;IAC9D,YAAY,OAAO,CAAC,EAAE,MAAM,EAE3B;CACF"}
@@ -0,0 +1,7 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export class StancerApiUnauthorizedError extends StancerApiError {
3
+ constructor(message) {
4
+ super(401, message ?? 'Unauthorized');
5
+ }
6
+ }
7
+ //# sourceMappingURL=api-unauthorized-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-unauthorized-error.js","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-unauthorized-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,OAAO,2BAA4B,SAAQ,eAAe;IAC9D,YAAY,OAAgB;QAC1B,KAAK,CAAC,GAAG,EAAE,OAAO,IAAI,cAAc,CAAC,CAAC;IACxC,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export declare class StancerApiUnknownError extends StancerApiError {
3
+ constructor(code?: number, message?: string);
4
+ }
5
+ //# sourceMappingURL=api-unknown-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-unknown-error.d.ts","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-unknown-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,qBAAa,sBAAuB,SAAQ,eAAe;IACzD,YAAY,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAE1C;CACF"}
@@ -0,0 +1,7 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export class StancerApiUnknownError extends StancerApiError {
3
+ constructor(code, message) {
4
+ super(code ?? 500, message ?? 'Unknown Error');
5
+ }
6
+ }
7
+ //# sourceMappingURL=api-unknown-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-unknown-error.js","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-unknown-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,OAAO,sBAAuB,SAAQ,eAAe;IACzD,YAAY,IAAa,EAAE,OAAgB;QACzC,KAAK,CAAC,IAAI,IAAI,GAAG,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;IACjD,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export interface StancerApiValidationErrorDetails {
3
+ loc: (string | number)[];
4
+ msg: string;
5
+ type: string;
6
+ }
7
+ export declare class StancerApiValidationError extends StancerApiError {
8
+ details?: StancerApiValidationErrorDetails[] | undefined;
9
+ constructor(details?: StancerApiValidationErrorDetails[] | undefined);
10
+ }
11
+ //# sourceMappingURL=api-validation-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-validation-error.d.ts","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-validation-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,WAAW,gCAAgC;IAC/C,GAAG,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,yBAA0B,SAAQ,eAAe;IACzC,OAAO,CAAC,EAAE,gCAAgC,EAAE;IAA/D,YAAmB,OAAO,CAAC,EAAE,gCAAgC,EAAE,YAAA,EAE9D;CACF"}
@@ -0,0 +1,9 @@
1
+ import { StancerApiError } from './api-error.js';
2
+ export class StancerApiValidationError extends StancerApiError {
3
+ details;
4
+ constructor(details) {
5
+ super(422, details ? `Validation failed: ${JSON.stringify(details)}` : 'Payload cannot be validated');
6
+ this.details = details;
7
+ }
8
+ }
9
+ //# sourceMappingURL=api-validation-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-validation-error.js","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/api-validation-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQjD,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IACzC,OAAO;IAA1B,YAAmB,OAA4C;QAC7D,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,sBAAsB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC;uBADrF,OAAO;IAE1B,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ export * from './api-conflict-error.js';
2
+ export * from './api-error.js';
3
+ export * from './api-not-found-error.js';
4
+ export * from './api-unauthorized-error.js';
5
+ export * from './api-unknown-error.js';
6
+ export * from './api-validation-error.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './api-conflict-error.js';
2
+ export * from './api-error.js';
3
+ export * from './api-not-found-error.js';
4
+ export * from './api-unauthorized-error.js';
5
+ export * from './api-unknown-error.js';
6
+ export * from './api-validation-error.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/error/endpoint/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { StancerError } from '../base-error.js';
2
+ export declare class StancerRouteInaccessibleError extends StancerError {
3
+ constructor(verb: 'POST' | 'PATCH' | 'LIST' | 'DELETE', resource: string, error?: ErrorOptions);
4
+ }
5
+ //# sourceMappingURL=route-inaccessible-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-inaccessible-error.d.ts","sourceRoot":"","sources":["../../../../src/core/error/endpoint/route-inaccessible-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,qBAAa,6BAA8B,SAAQ,YAAY;IAC7D,YAAY,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,EAG7F;CACF"}
@@ -0,0 +1,8 @@
1
+ import { StancerError } from '../base-error.js';
2
+ export class StancerRouteInaccessibleError extends StancerError {
3
+ constructor(verb, resource, error) {
4
+ const message = `${verb} is not allowed for ${resource} resource`;
5
+ super(message, error);
6
+ }
7
+ }
8
+ //# sourceMappingURL=route-inaccessible-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-inaccessible-error.js","sourceRoot":"","sources":["../../../../src/core/error/endpoint/route-inaccessible-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,OAAO,6BAA8B,SAAQ,YAAY;IAC7D,YAAY,IAA0C,EAAE,QAAgB,EAAE,KAAoB;QAC5F,MAAM,OAAO,GAAG,GAAG,IAAI,uBAAuB,QAAQ,WAAW,CAAC;QAClE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import { StancerError } from './base-error.js';
2
+ export declare class StancerUnpopulatedError extends StancerError {
3
+ }
4
+ //# sourceMappingURL=unpopulated-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpopulated-error.d.ts","sourceRoot":"","sources":["../../../src/core/error/unpopulated-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBAAa,uBAAwB,SAAQ,YAAY;CAAG"}
@@ -0,0 +1,4 @@
1
+ import { StancerError } from './base-error.js';
2
+ export class StancerUnpopulatedError extends StancerError {
3
+ }
4
+ //# sourceMappingURL=unpopulated-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpopulated-error.js","sourceRoot":"","sources":["../../../src/core/error/unpopulated-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,uBAAwB,SAAQ,YAAY;CAAG"}
@@ -0,0 +1,4 @@
1
+ import { StancerError } from './base-error.js';
2
+ export declare class UnsendableError extends StancerError {
3
+ }
4
+ //# sourceMappingURL=unsendable-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsendable-error.d.ts","sourceRoot":"","sources":["../../../src/core/error/unsendable-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBAAa,eAAgB,SAAQ,YAAY;CAAG"}
@@ -0,0 +1,4 @@
1
+ import { StancerError } from './base-error.js';
2
+ export class UnsendableError extends StancerError {
3
+ }
4
+ //# sourceMappingURL=unsendable-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unsendable-error.js","sourceRoot":"","sources":["../../../src/core/error/unsendable-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,eAAgB,SAAQ,YAAY;CAAG"}
@@ -0,0 +1,4 @@
1
+ import { StancerError } from './base-error.js';
2
+ export declare class StancerValidationError extends StancerError {
3
+ }
4
+ //# sourceMappingURL=validation-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-error.d.ts","sourceRoot":"","sources":["../../../src/core/error/validation-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBAAa,sBAAuB,SAAQ,YAAY;CAAG"}
@@ -0,0 +1,4 @@
1
+ import { StancerError } from './base-error.js';
2
+ export class StancerValidationError extends StancerError {
3
+ }
4
+ //# sourceMappingURL=validation-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-error.js","sourceRoot":"","sources":["../../../src/core/error/validation-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,sBAAuB,SAAQ,YAAY;CAAG"}
@@ -0,0 +1,63 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+ interface ValidatorObject<Property> {
3
+ errorMessage: (value: string) => string;
4
+ validate: (value: Property) => boolean;
5
+ }
6
+ /**
7
+ * Validator configuration mapping each property to either a ValidatorObject or true (pass-through).
8
+ */
9
+ export type Validator<ValidationData> = {
10
+ [Property in keyof ValidationData]: ValidatorObject<ValidationData[Property]> | true;
11
+ };
12
+ /**
13
+ * Validation function that validates a single property value.
14
+ * @returns true if valid
15
+ * @throws {StancerValidationError} if invalid
16
+ */
17
+ export type ValidationFunction<Data> = <Key extends keyof Data>(key: Key, value: Data[Key]) => true | never;
18
+ interface ExactSize {
19
+ size: number;
20
+ min?: undefined;
21
+ max?: undefined;
22
+ }
23
+ interface BorderedSize {
24
+ min: number;
25
+ max: number;
26
+ size?: undefined;
27
+ }
28
+ type GoldilocksSize = ExactSize | BorderedSize;
29
+ /**
30
+ * Creates a validation function from a validator configuration.
31
+ */
32
+ export declare const processValidator: <Data>(validator: Validator<Data>) => ValidationFunction<Data>;
33
+ /**
34
+ * Pass-through validator that accepts any value without validation.
35
+ * Use for fields like createdAt that are set server-side.
36
+ */
37
+ export declare const createdAtValidator = true;
38
+ /**
39
+ * Creates a string length validator with exact size or min/max bounds.
40
+ * @throws {StancerValidationError} At creation time if configuration is invalid
41
+ */
42
+ export declare const goldilocksValidator: (propertyName: string, { max, min, size }: GoldilocksSize) => {
43
+ errorMessage: (value: string) => string;
44
+ validate: (value: string) => boolean;
45
+ };
46
+ /**
47
+ * Creates an enum validator for string union types.
48
+ * @param strict - When false and not in DEBUG mode, bypasses validation to prevent SDK crashes
49
+ * when API adds new enum values unknown to the SDK.
50
+ */
51
+ export declare const enumValidator: <Enum extends readonly string[]>(values: Enum, strict?: boolean) => true | {
52
+ validate: (value: unknown) => value is (typeof values)[number];
53
+ errorMessage: (value: string) => string;
54
+ };
55
+ /**
56
+ * Creates a PlainDate validator ensuring the date is between 1971 and today.
57
+ */
58
+ export declare const plainDateValidator: (field: string) => {
59
+ validate: (value: Temporal.PlainDate) => boolean;
60
+ errorMessage: () => string;
61
+ };
62
+ export {};
63
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/core/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM7C,UAAU,eAAe,CAAC,QAAQ;IAChC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,cAAc,IAAI;KACrC,QAAQ,IAAI,MAAM,cAAc,GAAG,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI;CACrF,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,IAAI,IAAI,CAAC,GAAG,SAAS,MAAM,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC;AAE5G,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAED,UAAU,YAAY;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,KAAK,cAAc,GAAG,SAAS,GAAG,YAAY,CAAC;AAM/C;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,IAAI,aAAa,SAAS,CAAC,IAAI,CAAC,KAAG,kBAAkB,CAAC,IAAI,CAc1F,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,iBAAkB,MAAM,sBAAsB,cAAc;0BAOhE,MAAM;sBACV,MAAM;CAc7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,SAAS,SAAS,MAAM,EAAE,UAAU,IAAI,WAAU,OAAO;sBAMrE,OAAO,KAAG,KAAK,IAAI,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC;0BAEtC,MAAM;CAE/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM;IAE5C,QAAQ,UAAU,QAAQ,CAAC,SAAS;IAEpC,YAAY;CAEf,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+ import { StancerValidationError } from './error/validation-error.js';
3
+ //#endregion
4
+ //#region Core Validation Logic
5
+ /**
6
+ * Creates a validation function from a validator configuration.
7
+ */
8
+ export const processValidator = (validator) => {
9
+ return (key, value) => {
10
+ const rule = validator[key];
11
+ if (!rule || rule === true) {
12
+ return true;
13
+ }
14
+ if (!rule.validate(value)) {
15
+ throw new StancerValidationError(rule.errorMessage(String(value)));
16
+ }
17
+ return true;
18
+ };
19
+ };
20
+ //#endregion
21
+ //#region Validator Factories
22
+ /**
23
+ * Pass-through validator that accepts any value without validation.
24
+ * Use for fields like createdAt that are set server-side.
25
+ */
26
+ export const createdAtValidator = true;
27
+ /**
28
+ * Creates a string length validator with exact size or min/max bounds.
29
+ * @throws {StancerValidationError} At creation time if configuration is invalid
30
+ */
31
+ export const goldilocksValidator = (propertyName, { max, min, size }) => {
32
+ const hasExactSize = size !== undefined || (max !== undefined && max === min);
33
+ const hasBoundedSize = min !== undefined && max !== undefined && min <= max;
34
+ if (hasExactSize) {
35
+ const exactLength = size ?? max;
36
+ return {
37
+ errorMessage: (value) => `${value} of ${propertyName} must be exactly ${exactLength} characters`,
38
+ validate: (value) => value.length === exactLength,
39
+ };
40
+ }
41
+ if (hasBoundedSize) {
42
+ return {
43
+ errorMessage: (value) => `${value} of ${propertyName} must be between ${min} and ${max} characters`,
44
+ validate: (value) => value.length >= min && value.length <= max,
45
+ };
46
+ }
47
+ throw new StancerValidationError(`goldilocksValidator for ${propertyName} requires either a size parameter or both min and max parameters`);
48
+ };
49
+ /**
50
+ * Creates an enum validator for string union types.
51
+ * @param strict - When false and not in DEBUG mode, bypasses validation to prevent SDK crashes
52
+ * when API adds new enum values unknown to the SDK.
53
+ */
54
+ export const enumValidator = (values, strict = true) => {
55
+ if (!strict && process.env['DEBUG'] !== 'true') {
56
+ return true;
57
+ }
58
+ return {
59
+ validate: (value) => typeof value === 'string' && values.includes(value),
60
+ errorMessage: (value) => `Expected one of ${values.join(', ')}. Got ${value}`,
61
+ };
62
+ };
63
+ /**
64
+ * Creates a PlainDate validator ensuring the date is between 1971 and today.
65
+ */
66
+ export const plainDateValidator = (field) => {
67
+ return {
68
+ validate: (value) => value.year > 1970 && Temporal.PlainDate.compare(Temporal.Now.plainDateISO(), value) === 1,
69
+ errorMessage: () => `${field} must be a date between 1971 and now.`,
70
+ };
71
+ };
72
+ //#endregion
73
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/core/validator.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,21 @@
1
+ import { type IdAddress } from '#address/model.js';
2
+ import { ApiEndpoint } from '#api/abstract-api-endpoint.js';
3
+ import { type CustomerData, type IdCustomer } from './model.js';
4
+ export declare class CustomerApiEndpoint extends ApiEndpoint<CustomerData> {
5
+ protected _handler: {
6
+ createdAt: import("#core/common/handler/handler.js").Handler<import("temporal-polyfill").Temporal.Instant>;
7
+ deleted: import("#core/common/handler/handler.js").Handler<boolean>;
8
+ id: import("#core/common/handler/handler.js").Handler<IdCustomer>;
9
+ billingAddress: import("#core/common/handler/handler.js").Handler<IdAddress>;
10
+ country: import("#core/common/handler/handler.js").Handler<string>;
11
+ dateBirth: import("#core/common/handler/handler.js").Handler<import("temporal-polyfill").Temporal.PlainDate>;
12
+ email: import("#core/common/handler/handler.js").Handler<string>;
13
+ externalId: import("#core/common/handler/handler.js").Handler<string>;
14
+ legalId: import("#core/common/handler/handler.js").Handler<string>;
15
+ mobile: import("#core/common/handler/handler.js").Handler<string>;
16
+ name: import("#core/common/handler/handler.js").Handler<string>;
17
+ shippingAddress: import("#core/common/handler/handler.js").Handler<IdAddress>;
18
+ };
19
+ constructor();
20
+ }
21
+ //# sourceMappingURL=api-endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-endpoint.d.ts","sourceRoot":"","sources":["../../src/customer/api-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAe,MAAM,+BAA+B,CAAC;AAKzE,OAAO,EAAE,KAAK,YAAY,EAAiB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAE/E,qBAAa,mBAAoB,SAAQ,WAAW,CAAC,YAAY,CAAC;IAChE,SAAS,CAAC,QAAQ;;;;;;;;;;;;;MAYhB;IAEF,cAIC;CACF"}