@stancer/stancer 1.0.1 → 1.1.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 (371) hide show
  1. package/CHANGELOG.md +23 -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 +34 -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/handler/metadata-handler.d.ts +18 -0
  99. package/dist/core/common/handler/metadata-handler.d.ts.map +1 -0
  100. package/dist/core/common/handler/metadata-handler.js +19 -0
  101. package/dist/core/common/handler/metadata-handler.js.map +1 -0
  102. package/dist/core/common/id-validator.d.ts +10 -0
  103. package/dist/core/common/id-validator.d.ts.map +1 -0
  104. package/dist/core/common/id-validator.js +17 -0
  105. package/dist/core/common/id-validator.js.map +1 -0
  106. package/dist/core/common/mutation-tracked-object.d.ts +8 -0
  107. package/dist/core/common/mutation-tracked-object.d.ts.map +1 -0
  108. package/dist/core/common/mutation-tracked-object.js +38 -0
  109. package/dist/core/common/mutation-tracked-object.js.map +1 -0
  110. package/dist/core/endpoint-interface.d.ts +38 -0
  111. package/dist/core/endpoint-interface.d.ts.map +1 -0
  112. package/dist/core/endpoint-interface.js +2 -0
  113. package/dist/core/endpoint-interface.js.map +1 -0
  114. package/dist/core/error/base-error.d.ts +3 -0
  115. package/dist/core/error/base-error.d.ts.map +1 -0
  116. package/dist/core/error/base-error.js +3 -0
  117. package/dist/core/error/base-error.js.map +1 -0
  118. package/dist/core/error/endpoint/api/api-conflict-error.d.ts +5 -0
  119. package/dist/core/error/endpoint/api/api-conflict-error.d.ts.map +1 -0
  120. package/dist/core/error/endpoint/api/api-conflict-error.js +7 -0
  121. package/dist/core/error/endpoint/api/api-conflict-error.js.map +1 -0
  122. package/dist/core/error/endpoint/api/api-error.d.ts +6 -0
  123. package/dist/core/error/endpoint/api/api-error.d.ts.map +1 -0
  124. package/dist/core/error/endpoint/api/api-error.js +9 -0
  125. package/dist/core/error/endpoint/api/api-error.js.map +1 -0
  126. package/dist/core/error/endpoint/api/api-not-found-error.d.ts +5 -0
  127. package/dist/core/error/endpoint/api/api-not-found-error.d.ts.map +1 -0
  128. package/dist/core/error/endpoint/api/api-not-found-error.js +7 -0
  129. package/dist/core/error/endpoint/api/api-not-found-error.js.map +1 -0
  130. package/dist/core/error/endpoint/api/api-unauthorized-error.d.ts +5 -0
  131. package/dist/core/error/endpoint/api/api-unauthorized-error.d.ts.map +1 -0
  132. package/dist/core/error/endpoint/api/api-unauthorized-error.js +7 -0
  133. package/dist/core/error/endpoint/api/api-unauthorized-error.js.map +1 -0
  134. package/dist/core/error/endpoint/api/api-unknown-error.d.ts +5 -0
  135. package/dist/core/error/endpoint/api/api-unknown-error.d.ts.map +1 -0
  136. package/dist/core/error/endpoint/api/api-unknown-error.js +7 -0
  137. package/dist/core/error/endpoint/api/api-unknown-error.js.map +1 -0
  138. package/dist/core/error/endpoint/api/api-validation-error.d.ts +11 -0
  139. package/dist/core/error/endpoint/api/api-validation-error.d.ts.map +1 -0
  140. package/dist/core/error/endpoint/api/api-validation-error.js +9 -0
  141. package/dist/core/error/endpoint/api/api-validation-error.js.map +1 -0
  142. package/dist/core/error/endpoint/api/index.d.ts +7 -0
  143. package/dist/core/error/endpoint/api/index.d.ts.map +1 -0
  144. package/dist/core/error/endpoint/api/index.js +7 -0
  145. package/dist/core/error/endpoint/api/index.js.map +1 -0
  146. package/dist/core/error/endpoint/route-inaccessible-error.d.ts +5 -0
  147. package/dist/core/error/endpoint/route-inaccessible-error.d.ts.map +1 -0
  148. package/dist/core/error/endpoint/route-inaccessible-error.js +8 -0
  149. package/dist/core/error/endpoint/route-inaccessible-error.js.map +1 -0
  150. package/dist/core/error/unpopulated-error.d.ts +4 -0
  151. package/dist/core/error/unpopulated-error.d.ts.map +1 -0
  152. package/dist/core/error/unpopulated-error.js +4 -0
  153. package/dist/core/error/unpopulated-error.js.map +1 -0
  154. package/dist/core/error/unsendable-error.d.ts +4 -0
  155. package/dist/core/error/unsendable-error.d.ts.map +1 -0
  156. package/dist/core/error/unsendable-error.js +4 -0
  157. package/dist/core/error/unsendable-error.js.map +1 -0
  158. package/dist/core/error/validation-error.d.ts +4 -0
  159. package/dist/core/error/validation-error.d.ts.map +1 -0
  160. package/dist/core/error/validation-error.js +4 -0
  161. package/dist/core/error/validation-error.js.map +1 -0
  162. package/dist/core/validator.d.ts +63 -0
  163. package/dist/core/validator.d.ts.map +1 -0
  164. package/dist/core/validator.js +73 -0
  165. package/dist/core/validator.js.map +1 -0
  166. package/dist/customer/api-endpoint.d.ts +21 -0
  167. package/dist/customer/api-endpoint.d.ts.map +1 -0
  168. package/dist/customer/api-endpoint.js +27 -0
  169. package/dist/customer/api-endpoint.js.map +1 -0
  170. package/dist/customer/model.d.ts +39 -0
  171. package/dist/customer/model.d.ts.map +1 -0
  172. package/dist/customer/model.js +73 -0
  173. package/dist/customer/model.js.map +1 -0
  174. package/dist/customer/repository.d.ts +7 -0
  175. package/dist/customer/repository.d.ts.map +1 -0
  176. package/dist/customer/repository.js +10 -0
  177. package/dist/customer/repository.js.map +1 -0
  178. package/dist/customer/validator.d.ts +4 -0
  179. package/dist/customer/validator.d.ts.map +1 -0
  180. package/dist/customer/validator.js +23 -0
  181. package/dist/customer/validator.js.map +1 -0
  182. package/dist/event/model.d.ts +20 -0
  183. package/dist/event/model.d.ts.map +1 -0
  184. package/dist/event/model.js +30 -0
  185. package/dist/event/model.js.map +1 -0
  186. package/dist/payment/api-endpoint.d.ts +51 -0
  187. package/dist/payment/api-endpoint.d.ts.map +1 -0
  188. package/dist/payment/api-endpoint.js +110 -0
  189. package/dist/payment/api-endpoint.js.map +1 -0
  190. package/dist/payment/enum/currency.d.ts +3 -0
  191. package/dist/payment/enum/currency.d.ts.map +1 -0
  192. package/dist/payment/enum/currency.js +13 -0
  193. package/dist/payment/enum/currency.js.map +1 -0
  194. package/dist/payment/enum/method.d.ts +3 -0
  195. package/dist/payment/enum/method.d.ts.map +1 -0
  196. package/dist/payment/enum/method.js +2 -0
  197. package/dist/payment/enum/method.js.map +1 -0
  198. package/dist/payment/enum/status.d.ts +4 -0
  199. package/dist/payment/enum/status.d.ts.map +1 -0
  200. package/dist/payment/enum/status.js +19 -0
  201. package/dist/payment/enum/status.js.map +1 -0
  202. package/dist/payment/model.d.ts +135 -0
  203. package/dist/payment/model.d.ts.map +1 -0
  204. package/dist/payment/model.js +232 -0
  205. package/dist/payment/model.js.map +1 -0
  206. package/dist/payment/repository.d.ts +17 -0
  207. package/dist/payment/repository.d.ts.map +1 -0
  208. package/dist/payment/repository.js +56 -0
  209. package/dist/payment/repository.js.map +1 -0
  210. package/dist/payment/validator.d.ts +16 -0
  211. package/dist/payment/validator.d.ts.map +1 -0
  212. package/dist/payment/validator.js +81 -0
  213. package/dist/payment/validator.js.map +1 -0
  214. package/dist/payment-intent/api-endpoint.d.ts +63 -0
  215. package/dist/payment-intent/api-endpoint.d.ts.map +1 -0
  216. package/dist/payment-intent/api-endpoint.js +95 -0
  217. package/dist/payment-intent/api-endpoint.js.map +1 -0
  218. package/dist/payment-intent/enum/status.d.ts +5 -0
  219. package/dist/payment-intent/enum/status.d.ts.map +1 -0
  220. package/dist/payment-intent/enum/status.js +20 -0
  221. package/dist/payment-intent/enum/status.js.map +1 -0
  222. package/dist/payment-intent/enum/threeds.d.ts +3 -0
  223. package/dist/payment-intent/enum/threeds.d.ts.map +1 -0
  224. package/dist/payment-intent/enum/threeds.js +2 -0
  225. package/dist/payment-intent/enum/threeds.js.map +1 -0
  226. package/dist/payment-intent/model.d.ts +91 -0
  227. package/dist/payment-intent/model.d.ts.map +1 -0
  228. package/dist/payment-intent/model.js +183 -0
  229. package/dist/payment-intent/model.js.map +1 -0
  230. package/dist/payment-intent/repository.d.ts +13 -0
  231. package/dist/payment-intent/repository.d.ts.map +1 -0
  232. package/dist/payment-intent/repository.js +65 -0
  233. package/dist/payment-intent/repository.js.map +1 -0
  234. package/dist/payment-intent/validator.d.ts +4 -0
  235. package/dist/payment-intent/validator.d.ts.map +1 -0
  236. package/dist/payment-intent/validator.js +38 -0
  237. package/dist/payment-intent/validator.js.map +1 -0
  238. package/dist/payout/model.d.ts +7 -0
  239. package/dist/payout/model.d.ts.map +1 -0
  240. package/dist/payout/model.js +6 -0
  241. package/dist/payout/model.js.map +1 -0
  242. package/dist/refund/api-endpoint.d.ts +22 -0
  243. package/dist/refund/api-endpoint.d.ts.map +1 -0
  244. package/dist/refund/api-endpoint.js +32 -0
  245. package/dist/refund/api-endpoint.js.map +1 -0
  246. package/dist/refund/enum/refund-status.d.ts +3 -0
  247. package/dist/refund/enum/refund-status.d.ts.map +1 -0
  248. package/dist/refund/enum/refund-status.js +10 -0
  249. package/dist/refund/enum/refund-status.js.map +1 -0
  250. package/dist/refund/model.d.ts +38 -0
  251. package/dist/refund/model.d.ts.map +1 -0
  252. package/dist/refund/model.js +51 -0
  253. package/dist/refund/model.js.map +1 -0
  254. package/dist/refund/repository.d.ts +7 -0
  255. package/dist/refund/repository.d.ts.map +1 -0
  256. package/dist/refund/repository.js +10 -0
  257. package/dist/refund/repository.js.map +1 -0
  258. package/dist/refund/validator.d.ts +4 -0
  259. package/dist/refund/validator.d.ts.map +1 -0
  260. package/dist/refund/validator.js +41 -0
  261. package/dist/refund/validator.js.map +1 -0
  262. package/dist/sepa/api-endpoint.d.ts +19 -0
  263. package/dist/sepa/api-endpoint.d.ts.map +1 -0
  264. package/dist/sepa/api-endpoint.js +25 -0
  265. package/dist/sepa/api-endpoint.js.map +1 -0
  266. package/dist/sepa/model.d.ts +32 -0
  267. package/dist/sepa/model.d.ts.map +1 -0
  268. package/dist/sepa/model.js +53 -0
  269. package/dist/sepa/model.js.map +1 -0
  270. package/dist/sepa/repository.d.ts +7 -0
  271. package/dist/sepa/repository.d.ts.map +1 -0
  272. package/dist/sepa/repository.js +10 -0
  273. package/dist/sepa/repository.js.map +1 -0
  274. package/dist/sepa/validator.d.ts +8 -0
  275. package/dist/sepa/validator.d.ts.map +1 -0
  276. package/dist/sepa/validator.js +47 -0
  277. package/dist/sepa/validator.js.map +1 -0
  278. package/dist/webhook/api-endpoint.d.ts +16 -0
  279. package/dist/webhook/api-endpoint.d.ts.map +1 -0
  280. package/dist/webhook/api-endpoint.js +33 -0
  281. package/dist/webhook/api-endpoint.js.map +1 -0
  282. package/dist/webhook/model.d.ts +35 -0
  283. package/dist/webhook/model.d.ts.map +1 -0
  284. package/dist/webhook/model.js +110 -0
  285. package/dist/webhook/model.js.map +1 -0
  286. package/dist/webhook/repository.d.ts +7 -0
  287. package/dist/webhook/repository.d.ts.map +1 -0
  288. package/dist/webhook/repository.js +10 -0
  289. package/dist/webhook/repository.js.map +1 -0
  290. package/dist/webhook/validator.d.ts +4 -0
  291. package/dist/webhook/validator.d.ts.map +1 -0
  292. package/dist/webhook/validator.js +16 -0
  293. package/dist/webhook/validator.js.map +1 -0
  294. package/package.json +4 -2
  295. package/src/api-endpoint/http/fetch-http-client.ts +8 -1
  296. package/src/core/common/handler/metadata-handler.ts +19 -0
  297. package/src/event/model.ts +42 -0
  298. package/src/payment-intent/api-endpoint.ts +2 -1
  299. package/src/payment-intent/model.ts +8 -3
  300. package/src/webhook/api-endpoint.ts +36 -0
  301. package/src/webhook/model.ts +140 -0
  302. package/src/webhook/repository.ts +14 -0
  303. package/src/webhook/validator.ts +18 -0
  304. package/.editorconfig +0 -14
  305. package/.gitlab-ci.yml +0 -159
  306. package/.prettierignore +0 -3
  307. package/eslint.config.js +0 -14
  308. package/pnpm-workspace.yaml +0 -19
  309. package/prettier.config.js +0 -3
  310. package/test/fixtures/endpoint.stub.ts +0 -22
  311. package/test/fixtures/list-endpoint.stub.ts +0 -33
  312. package/test/fixtures/list-model.stub.ts +0 -24
  313. package/test/fixtures/model.stub.ts +0 -12
  314. package/test/functional/address.test.ts +0 -126
  315. package/test/functional/card.test.ts +0 -175
  316. package/test/functional/customer.test.ts +0 -174
  317. package/test/functional/payment-intent.test.ts +0 -215
  318. package/test/functional/payment.test.ts +0 -206
  319. package/test/functional/refund.test.ts +0 -112
  320. package/test/functional/sepa.test.ts +0 -136
  321. package/test/integration/stub-integration.test.ts +0 -88
  322. package/test/stub/stub-endpoint.ts +0 -42
  323. package/test/stub/stub-model.ts +0 -82
  324. package/test/stub/stub-repository.ts +0 -11
  325. package/test/test-helper.ts +0 -133
  326. package/test/unit/address/api-endpoint.test.ts +0 -134
  327. package/test/unit/address/fixtures.ts +0 -60
  328. package/test/unit/address/model.test.ts +0 -75
  329. package/test/unit/address/repository.test.ts +0 -148
  330. package/test/unit/address/validator.test.ts +0 -49
  331. package/test/unit/api-endpoint/http/fetch-http-client.test.ts +0 -44
  332. package/test/unit/api-endpoint/http/http.test.ts +0 -152
  333. package/test/unit/card/api-endpoint.test.ts +0 -170
  334. package/test/unit/card/card-helper.ts +0 -116
  335. package/test/unit/card/fixtures.ts +0 -87
  336. package/test/unit/card/model.test.ts +0 -167
  337. package/test/unit/card/repository.test.ts +0 -146
  338. package/test/unit/card/validator.test.ts +0 -96
  339. package/test/unit/core/common/mutation-tracked-object.test.ts +0 -24
  340. package/test/unit/customer/api-endpoint.test.ts +0 -143
  341. package/test/unit/customer/fixtures.ts +0 -73
  342. package/test/unit/customer/model.test.ts +0 -90
  343. package/test/unit/customer/repository.test.ts +0 -148
  344. package/test/unit/customer/validator.test.ts +0 -62
  345. package/test/unit/payment/api-endpoint.test.ts +0 -188
  346. package/test/unit/payment/fixtures.ts +0 -116
  347. package/test/unit/payment/model.test.ts +0 -240
  348. package/test/unit/payment/repository.test.ts +0 -270
  349. package/test/unit/payment/validator.test.ts +0 -137
  350. package/test/unit/payment-intent/api-endpoint.test.ts +0 -142
  351. package/test/unit/payment-intent/fixtures.ts +0 -94
  352. package/test/unit/payment-intent/model.test.ts +0 -157
  353. package/test/unit/payment-intent/repository.test.ts +0 -263
  354. package/test/unit/payment-intent/validator.test.ts +0 -136
  355. package/test/unit/refund/api-endpoint.test.ts +0 -129
  356. package/test/unit/refund/fixtures.ts +0 -58
  357. package/test/unit/refund/model.test.ts +0 -89
  358. package/test/unit/refund/repository.test.ts +0 -157
  359. package/test/unit/refund/validator.test.ts +0 -89
  360. package/test/unit/sepa/api-endpoint.test.ts +0 -170
  361. package/test/unit/sepa/fixture.ts +0 -62
  362. package/test/unit/sepa/model.test.ts +0 -86
  363. package/test/unit/sepa/repository.test.ts +0 -149
  364. package/test/unit/sepa/sepa-helper.ts +0 -71
  365. package/test/unit/sepa/validator.test.ts +0 -58
  366. package/test/unit/stub/stub-endpoint.test.ts +0 -236
  367. package/test/unit/stub/stub-list-endpoint.test.ts +0 -86
  368. package/test/unit/stub/stub-model.test.ts +0 -111
  369. package/test/unit/stub/stub-repository.test.ts +0 -144
  370. package/tsconfig.json +0 -50
  371. package/vitest.config.ts +0 -20
package/.gitlab-ci.yml DELETED
@@ -1,159 +0,0 @@
1
- spec:
2
- inputs:
3
- nodeVersion:
4
- default: 22
5
- description: Node version.
6
-
7
- ---
8
-
9
- .cache: &cache
10
- key:
11
- files:
12
- - pnpm-lock.yaml
13
- paths:
14
- - node_modules/.bin
15
- - node_modules/.cache/pnpm
16
- - node_modules/.pnpm
17
- - node_modules/@**
18
- - node_modules/[a-z]**
19
- - node_modules/.modules.yaml
20
- unprotect: true
21
- when: always
22
-
23
-
24
- .base:
25
- image: wearestancer/node:$[[ inputs.nodeVersion ]]
26
-
27
- before_script:
28
- - section_start --collapsed node_install "Package install"
29
- - echo "node $(node --version)"
30
- - echo "pnpm $(pnpm --version)"
31
- - pnpm config set store-dir node_modules/.cache/pnpm
32
- - pnpm install --frozen-lockfile --prefer-offline
33
- - section_end node_install
34
-
35
- cache:
36
- - <<: *cache
37
-
38
-
39
- stages:
40
- - test
41
- - build
42
- - deploy
43
-
44
-
45
- workflow:
46
- auto_cancel:
47
- on_job_failure: none
48
- on_new_commit: interruptible
49
- rules:
50
- - if: $CI_COMMIT_REF_PROTECTED == "true"
51
- - if: $CI_PIPELINE_SOURCE == "merge_request_event"
52
- - if: $CI_PIPELINE_SOURCE == "web"
53
- - if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
54
- when: never
55
- - when: always
56
-
57
-
58
- variables:
59
- FF_SCRIPT_SECTIONS: true
60
-
61
-
62
- ESLint:
63
- extends:
64
- - .base
65
-
66
- stage: test
67
-
68
- script:
69
- - pnpm exec eslint --cache --cache-location 'node_modules/.cache/eslint' "**/*.{js,ts,vue}" || true
70
- - pnpm exec eslint --cache --cache-location 'node_modules/.cache/eslint' --max-warnings 0 --format junit "**/*.{js,ts,vue}" > junit.xml
71
-
72
- cache:
73
- - <<: *cache
74
- - key: "${CI_COMMIT_REF_SLUG}-eslint"
75
- fallback_keys:
76
- - "${CI_DEFAULT_BRANCH}-eslint"
77
- paths:
78
- - node_modules/.cache/eslint
79
- unprotect: true
80
- when: always
81
-
82
- artifacts:
83
- reports:
84
- junit:
85
- - junit.xml
86
-
87
-
88
- Build Node package:
89
- extends:
90
- - .base
91
-
92
- stage: build
93
-
94
- script:
95
- - section_start publish "Publish"
96
- - pnpm publish --dry-run --no-git-check --report-summary
97
- - section_end publish
98
-
99
- rules:
100
- - if: "$CI_COMMIT_TAG"
101
- when: never
102
- - when: on_success
103
-
104
-
105
- Prettier check:
106
- extends:
107
- - .base
108
-
109
- stage: test
110
-
111
- script:
112
- - section_start --collapsed prettier "Prettier rewrite files"
113
- - pnpm exec prettier --cache-location node_modules/.cache/prettier --write . || true
114
- - section_end prettier
115
-
116
- - if [[ -f .npmrc ]]; then git restore .npmrc; fi
117
- - git diff
118
- - if [ -n "$(git status --untracked-files=no --porcelain)" ]; then exit 1; fi
119
-
120
- cache:
121
- - <<: *cache
122
- - key: "${CI_COMMIT_REF_SLUG}-prettier"
123
- fallback_keys:
124
- - "${CI_DEFAULT_BRANCH}-prettier"
125
- paths:
126
- - node_modules/.cache/prettier
127
- unprotect: true
128
- when: always
129
-
130
-
131
- Type check:
132
- extends:
133
- - .base
134
-
135
- stage: test
136
-
137
- script:
138
- - pnpm exec tsc
139
- - pnpm exec tsc --noEmit
140
-
141
-
142
- Vitest:
143
- extends:
144
- - .base
145
-
146
- stage: test
147
-
148
- script:
149
- - pnpm exec vitest --reporter=verbose --reporter=junit --outputFile.junit=reports/junit.xml
150
-
151
- coverage: "/All\\sfiles.*?\\s+(\\d+.\\d+)/"
152
-
153
- artifacts:
154
- reports:
155
- coverage_report:
156
- coverage_format: cobertura
157
- path: reports/cobertura-coverage.xml
158
- junit:
159
- - reports/junit.xml
package/.prettierignore DELETED
@@ -1,3 +0,0 @@
1
- .gitlab-ci.yml
2
- pnpm-lock.yaml
3
- pnpm-workspace.yaml
package/eslint.config.js DELETED
@@ -1,14 +0,0 @@
1
- import js from '@eslint/js';
2
- import { defineConfig } from 'eslint/config';
3
- import globals from 'globals';
4
- import tseslint from 'typescript-eslint';
5
-
6
- export default defineConfig([
7
- {
8
- files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
9
- plugins: { js },
10
- extends: ['js/recommended'],
11
- languageOptions: { globals: globals.node },
12
- },
13
- tseslint.configs.recommended,
14
- ]);
@@ -1,19 +0,0 @@
1
- catalogs:
2
- eslint:
3
- "@eslint/js": ^10.0.0
4
- eslint: ^10.0.0
5
- eslint-formatter-junit: ^9.0.0
6
- globals: ^17.0.0
7
- typescript-eslint: ^8.0.0
8
-
9
- prettier:
10
- "@stancer/prettier": ^3.0.0
11
- prettier: ^3.0.0
12
-
13
- vitest:
14
- "@vitest/coverage-v8": ^4.0.0
15
- vitest: ^4.0.0
16
-
17
- lockfileIncludeTarballUrl: true
18
-
19
- minimumReleaseAge: 10080 # 7days
@@ -1,3 +0,0 @@
1
- import { createConfig } from '@stancer/prettier';
2
-
3
- export default createConfig();
@@ -1,22 +0,0 @@
1
- import { IdValue } from '#core/common/branded-type.js';
2
- import { randomNumber, randomString } from '#test/test-helper.js';
3
-
4
- const id = 'stub_' + randomString(24, 24);
5
- const defaultValue = randomString(1, 50);
6
- const defaultNumber = randomNumber(12, 200);
7
- export const stubSerialized = {
8
- id,
9
- default: defaultValue,
10
- default_number: defaultNumber,
11
- untouchable: false,
12
- all_authorized: true,
13
- ungettable: false,
14
- unmodifiable: false,
15
- };
16
- export const stubDeserialized = {
17
- id: id as IdValue,
18
- default: defaultValue,
19
- defaultNumber: defaultNumber,
20
- allAuthorized: true,
21
- unmodifiable: false,
22
- };
@@ -1,33 +0,0 @@
1
- import { randomNumber, randomString } from '#test/test-helper.js';
2
-
3
- const stub = {
4
- stubs: [
5
- {
6
- id: 'stub_' + randomString(24, 24),
7
- default: randomString(1, 50),
8
- defaultNumber: randomNumber(12, 263),
9
- untouchable: true,
10
- all_authorized: true,
11
- ungettable: true,
12
- unmodifiable: true,
13
- },
14
- {
15
- id: 'stub_' + randomString(24, 24),
16
- default: randomString(1, 50),
17
- defaultNumber: randomNumber(12, 263),
18
- untouchable: true,
19
- all_authorized: true,
20
- ungettable: true,
21
- unmodifiable: true,
22
- },
23
- ],
24
- range: {
25
- count: 2080,
26
- end: 9,
27
- has_more: false,
28
- limit: 2,
29
- start: 0,
30
- },
31
- };
32
-
33
- export default stub;
@@ -1,24 +0,0 @@
1
- import { IdStub, StubData } from '#test/stub/stub-model.js';
2
- import { randomNumber, randomString } from '#test/test-helper.js';
3
-
4
- const listModel: StubData[] = [
5
- {
6
- id: ('stub_' + randomString(24, 24)) as IdStub,
7
- default: randomString(1, 50),
8
- defaultNumber: randomNumber(12, 100),
9
- untouchable: true,
10
- allAuthorized: true,
11
- ungettable: true,
12
- unmodifiable: true,
13
- },
14
- {
15
- id: ('stub_' + randomString(24, 24)) as IdStub,
16
- default: randomString(1, 50),
17
- defaultNumber: randomNumber(12, 100),
18
- untouchable: true,
19
- allAuthorized: true,
20
- ungettable: true,
21
- unmodifiable: true,
22
- },
23
- ];
24
- export default listModel;
@@ -1,12 +0,0 @@
1
- import { randomNumber, randomString } from '#test/test-helper.js';
2
-
3
- const model = {
4
- default: randomString(1, 50),
5
- defaultNumber: randomNumber(12, 100),
6
- untouchable: true,
7
- allAuthorized: true,
8
- ungettable: true,
9
- unmodifiable: true,
10
- };
11
-
12
- export default model;
@@ -1,126 +0,0 @@
1
- import { Temporal } from 'temporal-polyfill';
2
- import 'temporal-polyfill/global';
3
- import { describe, expect, it } from 'vitest';
4
-
5
- import { idAddress } from '#address/model.js';
6
- import { AddressRepository } from '#address/repository.js';
7
- import { Configuration } from '#api/configuration.js';
8
- import { StancerRouteInaccessibleError } from '#error/endpoint/route-inaccessible-error.js';
9
- import { randomString } from '#test/test-helper.js';
10
-
11
- const config = Configuration;
12
- config.setKey({
13
- privateLiveKey: null,
14
- privateTestKey: process.env['API_KEY'] ?? null,
15
- });
16
- config._host = process.env['API_HOST'] ?? 'api.stancer.com';
17
-
18
- describe('address functional', () => {
19
- describe('address creation', () => {
20
- const city = randomString(1, 50);
21
- const country = randomString(2);
22
- const zipCode = randomString(2, 16);
23
-
24
- it('create an address with aliased value', async () => {
25
- const repository = new AddressRepository();
26
- const address = await repository.create({ zipCode, city, country });
27
- await repository.send(address);
28
- expect(address.id).toBeTruthy();
29
- expect(address.id).toContain('addr_');
30
- expect(address.zipCode).toBe(zipCode);
31
- expect(address.city).toBe(city);
32
- expect(address.country).toBe(country);
33
- });
34
-
35
- it('create an address', async () => {
36
- const repository = new AddressRepository();
37
- const address = await repository.create({ zipCode, city, country });
38
- const newAddress = await repository.send(address);
39
- expect(address._data).toStrictEqual(newAddress._data);
40
- expect(newAddress.id).toBeTruthy();
41
- expect(newAddress.zipCode).toBe(zipCode);
42
- expect(newAddress._data.zipCode).toBe(newAddress.zipCode);
43
- expect(newAddress.city).toBe(city);
44
- expect(newAddress.country).toBe(country);
45
- });
46
- it('create a complete address', async () => {
47
- const repository = new AddressRepository();
48
-
49
- const zipCode = randomString(2, 16);
50
- const city = randomString(1, 50);
51
- const country = randomString(2);
52
-
53
- const line1 = randomString(1, 50);
54
- const line2 = randomString(1, 50);
55
- const line3 = randomString(1, 50);
56
- const state = randomString(1, 3);
57
-
58
- const address = await repository.create({ zipCode, city, line1, line2, line3, state, country });
59
- await repository.send(address);
60
- expect(address.id).toBeTruthy();
61
- expect(address.zipCode).toBe(zipCode);
62
- expect(address._data.zipCode).toBe(address.zipCode);
63
- expect(address.city).toBe(city);
64
- expect(address.country).toBe(country);
65
- expect(address.line1).toBe(line1);
66
- expect(address.line2).toBe(line2);
67
- expect(address.line3).toBe(line3);
68
- expect(address.state).toBe(state);
69
- });
70
-
71
- it('need required values', async () => {
72
- const repository = new AddressRepository();
73
- const addressWithoutZipCode = await repository.create({ city: randomString(1, 50), country: randomString(2) });
74
- await expect(async () => await repository.send(addressWithoutZipCode)).rejects.toThrow(
75
- 'zipCode is required to send AddressModel',
76
- );
77
-
78
- const addressWithoutCity = await repository.create({ zipCode: 'Bloop', country: 'FR' });
79
- await expect(async () => await repository.send(addressWithoutCity)).rejects.toThrow(
80
- 'city is required to send AddressModel',
81
- );
82
-
83
- const addressWithoutCountry = await repository.create({ zipCode: 'Bloop', city: randomString(12) });
84
- await expect(async () => await repository.send(addressWithoutCountry)).rejects.toThrow(
85
- 'country is required to send AddressModel',
86
- );
87
- });
88
- });
89
- describe('patch', () => {
90
- it('is not available on address', async () => {
91
- const repository = new AddressRepository();
92
-
93
- const zipCode = randomString(2, 16);
94
- const city = randomString(1, 50);
95
- const country = randomString(2);
96
-
97
- const address = await repository.create({ zipCode, city, country });
98
- await repository.send(address);
99
- address.setLine1(randomString(1, 25));
100
- await expect(() => repository.send(address)).rejects.toThrow(StancerRouteInaccessibleError);
101
- });
102
- });
103
- describe('get', () => {
104
- it('get the correct object', async () => {
105
- const repository = new AddressRepository();
106
- const id = idAddress('addr_YHvhVplBRGET3V7Ns4B6pzD2');
107
- const address = await repository.create(id);
108
- expect(address.id).toBe(id);
109
- expect(address.zipCode).toBe('75008');
110
- expect(address.zipCode).toBe(address._data.zipCode);
111
- expect(address.city).toBe('Paris');
112
- expect(address.country).toBe('FR');
113
- expect(address.line1).toBe('10 rue');
114
- expect(address.line2).toBe('de la ville');
115
- expect(address.line3).toBe('leveque');
116
- expect(address.state).toBe('IDF');
117
- expect(address.createdAt).toBeInstanceOf(Temporal.Instant);
118
- // we are not checking the exact hour for Timecode reason (not the same in our pipeline and locally)
119
- expect(address.createdAt?.toLocaleString()).toContain('8/13/2026, ');
120
- expect(address.createdAt?.toLocaleString()).toContain(':36:22 PM');
121
-
122
- expect(address._data.createdAt).toStrictEqual(address.createdAt);
123
- expect(address.deleted).toBe(false);
124
- });
125
- });
126
- });
@@ -1,175 +0,0 @@
1
- import { Temporal } from 'temporal-polyfill';
2
- import 'temporal-polyfill/global';
3
- import { describe, expect, it } from 'vitest';
4
-
5
- import { Configuration } from '#api/configuration.js';
6
- import { PreferredNetworkCardEnum } from '#card/enum/network.js';
7
- import { IdCard } from '#card/model.js';
8
- import { CardRepository } from '#card/repository.js';
9
- import { idCustomer } from '#customer/model.ts';
10
- import { randomCVC, randomExpYear, randomMonth, randomNumber, randomString } from '#test/test-helper.js';
11
- import { getValidCardNumber } from '#test/unit/card/card-helper.js';
12
-
13
- const config = Configuration;
14
-
15
- config.setKey({
16
- privateLiveKey: null,
17
- privateTestKey: process.env['API_KEY'] ?? null,
18
- });
19
-
20
- config._host = process.env['API_HOST'] ?? 'api.stancer.com';
21
-
22
- describe('card functional', () => {
23
- describe('card creation', () => {
24
- const expMonth = randomMonth();
25
- const expYear = randomExpYear();
26
- const number = getValidCardNumber();
27
-
28
- it('create an card with minimum information', async () => {
29
- const repository = new CardRepository();
30
-
31
- const card = await repository.create({ expMonth, expYear, number });
32
- await repository.send(card);
33
- expect(card.id).toBeTruthy();
34
- expect(card.id).toContain('card_');
35
- expect(card.last4).toBe(number.slice(number.length - 4));
36
- });
37
-
38
- it('create a complete flat card', async () => {
39
- const repository = new CardRepository();
40
- const cvc = randomCVC();
41
- const expMonth = randomMonth();
42
- const expYear = randomExpYear();
43
- const externalId = randomString(1, 36);
44
- const number = getValidCardNumber();
45
- const last4 = number.slice(number.length - 4);
46
- const name = randomString(3, 64);
47
- const preferredNetwork = PreferredNetworkCardEnum[randomNumber(0, PreferredNetworkCardEnum.length - 1)];
48
- const zipCode = randomString(2, 8);
49
-
50
- const card = await repository.create({
51
- cvc,
52
- expMonth,
53
- expYear,
54
- externalId,
55
- number,
56
- last4,
57
- name,
58
- preferredNetwork,
59
- zipCode,
60
- });
61
-
62
- await repository.send(card);
63
-
64
- expect(card.id).toBeTruthy();
65
- expect(card).toMatchObject({ expMonth, expYear, last4 });
66
- });
67
- it('create a complete card with customer', async () => {
68
- const repository = new CardRepository();
69
- const customer = idCustomer(`cust_SsySBRtGUq3pG9zbSOhJSKCa`);
70
-
71
- const expMonth = randomMonth();
72
- const expYear = randomExpYear();
73
- const number = getValidCardNumber();
74
-
75
- const card = await repository.create({ customer, expMonth, expYear, number });
76
-
77
- await repository.send(card);
78
-
79
- expect(card.id).toBeTruthy();
80
- expect(card.expMonth).toBe(expMonth);
81
- expect(card.expYear).toBe(expYear);
82
- expect(card.last4).toBe(number.slice(number.length - 4));
83
- const now = Temporal.Now.plainDateISO();
84
- // We check that the date had been created today.
85
- // If not we cannot ensure the card has the customer we sent.
86
- if (
87
- card.createdAt?.toZonedDateTimeISO('UTC').year === now.year &&
88
- card.createdAt?.toZonedDateTimeISO('UTC').month === now.month &&
89
- card.createdAt?.toZonedDateTimeISO('UTC').day === now.day
90
- ) {
91
- expect(card.customer).toBe(customer);
92
- }
93
- });
94
-
95
- it('need required expMonth', async () => {
96
- const expYear = randomExpYear();
97
- const number = getValidCardNumber();
98
-
99
- const repository = new CardRepository();
100
-
101
- const cardWithoutRequiredValue = await repository.create({ expYear, number });
102
-
103
- await expect(async () => await repository.send(cardWithoutRequiredValue)).rejects.toThrow(
104
- 'expMonth is required to send CardModel',
105
- );
106
- });
107
- it('need required expYear', async () => {
108
- const repository = new CardRepository();
109
-
110
- const cardWithoutRequiredValue = await repository.create({ expMonth, number });
111
-
112
- await expect(async () => await repository.send(cardWithoutRequiredValue)).rejects.toThrow(
113
- 'expYear is required to send CardModel',
114
- );
115
- });
116
- it('need required number', async () => {
117
- const repository = new CardRepository();
118
-
119
- const cardWithoutRequiredValue = await repository.create({ expMonth, expYear });
120
-
121
- await expect(async () => await repository.send(cardWithoutRequiredValue)).rejects.toThrow(
122
- 'number is required to send CardModel',
123
- );
124
- });
125
- });
126
-
127
- describe('patch', () => {
128
- it('is available on card', async () => {
129
- const repository = new CardRepository();
130
-
131
- const expMonth = randomMonth();
132
- const expYear = randomExpYear();
133
- const number = getValidCardNumber();
134
- const card = await repository.create({ expMonth, expYear, number });
135
-
136
- await repository.send(card);
137
- const id = card.id;
138
- expect(id).toBeTruthy();
139
- expect(card.expMonth).toBe(expMonth);
140
- expect(card.expYear).toBe(expYear);
141
-
142
- const newExpYear = randomExpYear() + 1;
143
- card.setExpYear(newExpYear);
144
- await repository.send(card);
145
- expect(id).toBe(card.id);
146
- expect(card.expYear).toBe(newExpYear);
147
- expect(card.expMonth).toBe(expMonth);
148
- });
149
- });
150
-
151
- describe('get', () => {
152
- it('get the correct object', async () => {
153
- const repository = new CardRepository();
154
- const id = 'card_uqY2HrovY2sPm0Ac2xhnBkfU' as IdCard;
155
- const card = await repository.create(id);
156
- expect(card.id).toBe(id);
157
- expect(card.brand).toBe('visa');
158
- expect(card.country).toBe('US');
159
- expect(card.funding).toBe('credit');
160
- expect(card.last4).toBe('3055');
161
- expect(card.nature).toBe('personal');
162
- expect(card.network).toBe('visa');
163
- expect(card.zipCode).toBe('75001');
164
- expect(card.createdAt.epochMilliseconds).toBe(1758551022000);
165
- expect(card.deleted).toBe(false);
166
- expect(card.expMonth).toBe(12);
167
- expect(card.expYear).toBe(2099);
168
- });
169
- it('get a 404 exception if unknown', async () => {
170
- const id = 'card_' + randomString(24);
171
- const repository = new CardRepository();
172
- await expect(() => repository.create(id)).rejects.toThrow();
173
- });
174
- });
175
- });