@n1k1t/mock-server 0.1.1 → 0.1.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 (350) hide show
  1. package/lib/package.json +3 -2
  2. package/lib/src/client/helpers/expectations.d.ts +91 -0
  3. package/lib/src/client/helpers/expectations.d.ts.map +1 -0
  4. package/lib/src/client/helpers/expectations.js +66 -0
  5. package/lib/src/client/helpers/expectations.js.map +1 -0
  6. package/lib/src/client/helpers/index.d.ts +2 -0
  7. package/lib/src/client/helpers/index.d.ts.map +1 -0
  8. package/lib/src/client/helpers/index.js +18 -0
  9. package/lib/src/client/helpers/index.js.map +1 -0
  10. package/lib/src/client/index.d.ts +1 -0
  11. package/lib/src/client/index.d.ts.map +1 -1
  12. package/lib/src/client/index.js +1 -0
  13. package/lib/src/client/index.js.map +1 -1
  14. package/lib/src/client/methods/expectations.create.method.d.ts +1 -3
  15. package/lib/src/client/methods/expectations.create.method.d.ts.map +1 -1
  16. package/lib/src/client/methods/expectations.create.method.js +2 -2
  17. package/lib/src/client/methods/expectations.create.method.js.map +1 -1
  18. package/lib/src/client/methods/expectations.update.method.d.ts +2 -2
  19. package/lib/src/client/methods/expectations.update.method.js +5 -5
  20. package/lib/src/client/methods/expectations.update.method.js.map +1 -1
  21. package/lib/src/client/methods/ping.method.d.ts +1 -1
  22. package/lib/src/client/methods/ping.method.js.map +1 -1
  23. package/lib/src/client/models/client.d.ts +40 -0
  24. package/lib/src/client/models/client.d.ts.map +1 -0
  25. package/lib/src/client/models/client.js +33 -0
  26. package/lib/src/client/models/client.js.map +1 -0
  27. package/lib/src/client/models/client.spec.d.ts +2 -0
  28. package/lib/src/client/models/client.spec.d.ts.map +1 -0
  29. package/lib/src/client/models/client.spec.js +219 -0
  30. package/lib/src/client/models/client.spec.js.map +1 -0
  31. package/lib/src/client/models/index.d.ts +1 -0
  32. package/lib/src/client/models/index.d.ts.map +1 -1
  33. package/lib/src/client/models/index.js +1 -0
  34. package/lib/src/client/models/index.js.map +1 -1
  35. package/lib/src/client/models/method.d.ts +4 -4
  36. package/lib/src/client/models/method.d.ts.map +1 -1
  37. package/lib/src/client/models/method.js.map +1 -1
  38. package/lib/src/client/onsite.d.ts +4 -3
  39. package/lib/src/client/onsite.d.ts.map +1 -1
  40. package/lib/src/client/onsite.js +8 -6
  41. package/lib/src/client/onsite.js.map +1 -1
  42. package/lib/src/client/remote.d.ts +4 -4
  43. package/lib/src/client/remote.d.ts.map +1 -1
  44. package/lib/src/client/remote.js +11 -10
  45. package/lib/src/client/remote.js.map +1 -1
  46. package/lib/src/client/types.d.ts +2 -0
  47. package/lib/src/client/types.d.ts.map +1 -1
  48. package/lib/src/client/utils.d.ts +2 -2
  49. package/lib/src/client/utils.d.ts.map +1 -1
  50. package/lib/src/client/utils.js +25 -12
  51. package/lib/src/client/utils.js.map +1 -1
  52. package/lib/src/expectations/__utils__/index.d.ts +2 -2
  53. package/lib/src/expectations/__utils__/index.d.ts.map +1 -1
  54. package/lib/src/expectations/__utils__/index.js +31 -23
  55. package/lib/src/expectations/__utils__/index.js.map +1 -1
  56. package/lib/src/expectations/index.d.ts +1 -2
  57. package/lib/src/expectations/index.d.ts.map +1 -1
  58. package/lib/src/expectations/index.js +1 -2
  59. package/lib/src/expectations/index.js.map +1 -1
  60. package/lib/src/expectations/models/expectation.d.ts +35 -0
  61. package/lib/src/expectations/models/expectation.d.ts.map +1 -0
  62. package/lib/src/expectations/models/expectation.js +113 -0
  63. package/lib/src/expectations/models/expectation.js.map +1 -0
  64. package/lib/src/expectations/models/index.d.ts +4 -0
  65. package/lib/src/expectations/models/index.d.ts.map +1 -0
  66. package/lib/src/expectations/models/index.js +20 -0
  67. package/lib/src/expectations/models/index.js.map +1 -0
  68. package/lib/src/expectations/models/operator.d.ts +20 -0
  69. package/lib/src/expectations/models/operator.d.ts.map +1 -0
  70. package/lib/src/expectations/models/operator.js +41 -0
  71. package/lib/src/expectations/models/operator.js.map +1 -0
  72. package/lib/src/expectations/models/storage.d.ts +15 -0
  73. package/lib/src/expectations/models/storage.d.ts.map +1 -0
  74. package/lib/src/expectations/{storage.js → models/storage.js} +4 -14
  75. package/lib/src/expectations/models/storage.js.map +1 -0
  76. package/lib/src/expectations/models/storage.spec.d.ts +2 -0
  77. package/lib/src/expectations/models/storage.spec.d.ts.map +1 -0
  78. package/lib/src/expectations/models/storage.spec.js +111 -0
  79. package/lib/src/expectations/models/storage.spec.js.map +1 -0
  80. package/lib/src/expectations/operators/and.operator.d.ts +7 -2
  81. package/lib/src/expectations/operators/and.operator.d.ts.map +1 -1
  82. package/lib/src/expectations/operators/and.operator.js +21 -2
  83. package/lib/src/expectations/operators/and.operator.js.map +1 -1
  84. package/lib/src/expectations/operators/and.operator.spec.js +57 -39
  85. package/lib/src/expectations/operators/and.operator.spec.js.map +1 -1
  86. package/lib/src/expectations/operators/exec.operator.d.ts +7 -2
  87. package/lib/src/expectations/operators/exec.operator.d.ts.map +1 -1
  88. package/lib/src/expectations/operators/exec.operator.js +13 -18
  89. package/lib/src/expectations/operators/exec.operator.js.map +1 -1
  90. package/lib/src/expectations/operators/exec.operator.spec.js +49 -18
  91. package/lib/src/expectations/operators/exec.operator.spec.js.map +1 -1
  92. package/lib/src/expectations/operators/has.operator.d.ts +27 -2
  93. package/lib/src/expectations/operators/has.operator.d.ts.map +1 -1
  94. package/lib/src/expectations/operators/has.operator.js +106 -70
  95. package/lib/src/expectations/operators/has.operator.js.map +1 -1
  96. package/lib/src/expectations/operators/has.operator.spec.js +422 -161
  97. package/lib/src/expectations/operators/has.operator.spec.js.map +1 -1
  98. package/lib/src/expectations/operators/if.operator.d.ts +15 -2
  99. package/lib/src/expectations/operators/if.operator.d.ts.map +1 -1
  100. package/lib/src/expectations/operators/if.operator.js +44 -10
  101. package/lib/src/expectations/operators/if.operator.js.map +1 -1
  102. package/lib/src/expectations/operators/if.operator.spec.js +89 -65
  103. package/lib/src/expectations/operators/if.operator.spec.js.map +1 -1
  104. package/lib/src/expectations/operators/index.d.ts +2 -0
  105. package/lib/src/expectations/operators/index.d.ts.map +1 -1
  106. package/lib/src/expectations/operators/index.js +5 -1
  107. package/lib/src/expectations/operators/index.js.map +1 -1
  108. package/lib/src/expectations/operators/merge.operator.d.ts +13 -2
  109. package/lib/src/expectations/operators/merge.operator.d.ts.map +1 -1
  110. package/lib/src/expectations/operators/merge.operator.js +23 -19
  111. package/lib/src/expectations/operators/merge.operator.js.map +1 -1
  112. package/lib/src/expectations/operators/merge.operator.spec.js +43 -33
  113. package/lib/src/expectations/operators/merge.operator.spec.js.map +1 -1
  114. package/lib/src/expectations/operators/not.operator.d.ts +7 -2
  115. package/lib/src/expectations/operators/not.operator.d.ts.map +1 -1
  116. package/lib/src/expectations/operators/not.operator.js +21 -2
  117. package/lib/src/expectations/operators/not.operator.js.map +1 -1
  118. package/lib/src/expectations/operators/not.operator.spec.js +28 -9
  119. package/lib/src/expectations/operators/not.operator.spec.js.map +1 -1
  120. package/lib/src/expectations/operators/or.operator.d.ts +7 -2
  121. package/lib/src/expectations/operators/or.operator.d.ts.map +1 -1
  122. package/lib/src/expectations/operators/or.operator.js +21 -6
  123. package/lib/src/expectations/operators/or.operator.js.map +1 -1
  124. package/lib/src/expectations/operators/or.operator.spec.js +58 -39
  125. package/lib/src/expectations/operators/or.operator.spec.js.map +1 -1
  126. package/lib/src/expectations/operators/remove.operator.d.ts +12 -2
  127. package/lib/src/expectations/operators/remove.operator.d.ts.map +1 -1
  128. package/lib/src/expectations/operators/remove.operator.js +22 -17
  129. package/lib/src/expectations/operators/remove.operator.js.map +1 -1
  130. package/lib/src/expectations/operators/remove.operator.spec.js +40 -28
  131. package/lib/src/expectations/operators/remove.operator.spec.js.map +1 -1
  132. package/lib/src/expectations/operators/root.operator.d.ts +8 -0
  133. package/lib/src/expectations/operators/root.operator.d.ts.map +1 -0
  134. package/lib/src/expectations/operators/root.operator.js +36 -0
  135. package/lib/src/expectations/operators/root.operator.js.map +1 -0
  136. package/lib/src/expectations/operators/set.operator.d.ts +20 -2
  137. package/lib/src/expectations/operators/set.operator.d.ts.map +1 -1
  138. package/lib/src/expectations/operators/set.operator.js +40 -23
  139. package/lib/src/expectations/operators/set.operator.js.map +1 -1
  140. package/lib/src/expectations/operators/set.operator.spec.js +87 -43
  141. package/lib/src/expectations/operators/set.operator.spec.js.map +1 -1
  142. package/lib/src/expectations/operators/switch.operator.d.ts +25 -0
  143. package/lib/src/expectations/operators/switch.operator.d.ts.map +1 -0
  144. package/lib/src/expectations/operators/switch.operator.js +68 -0
  145. package/lib/src/expectations/operators/switch.operator.js.map +1 -0
  146. package/lib/src/expectations/operators/switch.operator.spec.d.ts +2 -0
  147. package/lib/src/expectations/operators/switch.operator.spec.d.ts.map +1 -0
  148. package/lib/src/expectations/operators/switch.operator.spec.js +129 -0
  149. package/lib/src/expectations/operators/switch.operator.spec.js.map +1 -0
  150. package/lib/src/expectations/types.d.ts +55 -56
  151. package/lib/src/expectations/types.d.ts.map +1 -1
  152. package/lib/src/expectations/types.js +13 -2
  153. package/lib/src/expectations/types.js.map +1 -1
  154. package/lib/src/expectations/utils.d.ts +19 -7
  155. package/lib/src/expectations/utils.d.ts.map +1 -1
  156. package/lib/src/expectations/utils.js +77 -50
  157. package/lib/src/expectations/utils.js.map +1 -1
  158. package/lib/src/server/endpoints/config.get.endpoint.d.ts +8 -3
  159. package/lib/src/server/endpoints/config.get.endpoint.d.ts.map +1 -1
  160. package/lib/src/server/endpoints/config.get.endpoint.js +2 -4
  161. package/lib/src/server/endpoints/config.get.endpoint.js.map +1 -1
  162. package/lib/src/server/endpoints/expectations.create.endpoint.d.ts +9 -11
  163. package/lib/src/server/endpoints/expectations.create.endpoint.d.ts.map +1 -1
  164. package/lib/src/server/endpoints/expectations.create.endpoint.js +2 -3
  165. package/lib/src/server/endpoints/expectations.create.endpoint.js.map +1 -1
  166. package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts +8 -5
  167. package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts.map +1 -1
  168. package/lib/src/server/endpoints/expectations.delete.endpoint.js +2 -2
  169. package/lib/src/server/endpoints/expectations.delete.endpoint.js.map +1 -1
  170. package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts +8 -3
  171. package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts.map +1 -1
  172. package/lib/src/server/endpoints/expectations.get-list.endpoint.js +2 -2
  173. package/lib/src/server/endpoints/expectations.get-list.endpoint.js.map +1 -1
  174. package/lib/src/server/endpoints/expectations.update.endpoint.d.ts +13 -11
  175. package/lib/src/server/endpoints/expectations.update.endpoint.d.ts.map +1 -1
  176. package/lib/src/server/endpoints/expectations.update.endpoint.js +4 -6
  177. package/lib/src/server/endpoints/expectations.update.endpoint.js.map +1 -1
  178. package/lib/src/server/endpoints/history.get-list.endpoint.d.ts +27 -0
  179. package/lib/src/server/endpoints/history.get-list.endpoint.d.ts.map +1 -0
  180. package/lib/src/server/endpoints/history.get-list.endpoint.js +11 -0
  181. package/lib/src/server/endpoints/history.get-list.endpoint.js.map +1 -0
  182. package/lib/src/server/endpoints/index.d.ts +1 -1
  183. package/lib/src/server/endpoints/index.d.ts.map +1 -1
  184. package/lib/src/server/endpoints/index.js +3 -3
  185. package/lib/src/server/endpoints/index.js.map +1 -1
  186. package/lib/src/server/endpoints/ping.endpoint.d.ts +8 -3
  187. package/lib/src/server/endpoints/ping.endpoint.d.ts.map +1 -1
  188. package/lib/src/server/endpoints/ping.endpoint.js +1 -1
  189. package/lib/src/server/endpoints/ping.endpoint.js.map +1 -1
  190. package/lib/src/server/history/model.d.ts +16 -16
  191. package/lib/src/server/history/model.d.ts.map +1 -1
  192. package/lib/src/server/history/model.js +21 -6
  193. package/lib/src/server/history/model.js.map +1 -1
  194. package/lib/src/server/history/storage.d.ts +3 -4
  195. package/lib/src/server/history/storage.d.ts.map +1 -1
  196. package/lib/src/server/history/storage.js +2 -2
  197. package/lib/src/server/history/storage.js.map +1 -1
  198. package/lib/src/server/index.d.ts +10 -6
  199. package/lib/src/server/index.d.ts.map +1 -1
  200. package/lib/src/server/index.js +9 -18
  201. package/lib/src/server/index.js.map +1 -1
  202. package/lib/src/server/middlewares/add-history.middleware.d.ts +14 -4
  203. package/lib/src/server/middlewares/add-history.middleware.d.ts.map +1 -1
  204. package/lib/src/server/middlewares/add-history.middleware.js +5 -6
  205. package/lib/src/server/middlewares/add-history.middleware.js.map +1 -1
  206. package/lib/src/server/middlewares/destroy-request.midleware.d.ts +14 -4
  207. package/lib/src/server/middlewares/destroy-request.midleware.d.ts.map +1 -1
  208. package/lib/src/server/middlewares/destroy-request.midleware.js +4 -5
  209. package/lib/src/server/middlewares/destroy-request.midleware.js.map +1 -1
  210. package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts +14 -4
  211. package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts.map +1 -1
  212. package/lib/src/server/middlewares/handle-expectation-delay.middleware.js +1 -2
  213. package/lib/src/server/middlewares/handle-expectation-delay.middleware.js.map +1 -1
  214. package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts +14 -4
  215. package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts.map +1 -1
  216. package/lib/src/server/middlewares/handle-expectation-forward.middleware.js +31 -45
  217. package/lib/src/server/middlewares/handle-expectation-forward.middleware.js.map +1 -1
  218. package/lib/src/server/middlewares/index.d.ts +4 -4
  219. package/lib/src/server/middlewares/index.d.ts.map +1 -1
  220. package/lib/src/server/middlewares/index.js +9 -9
  221. package/lib/src/server/middlewares/index.js.map +1 -1
  222. package/lib/src/server/middlewares/internal-route.middleware.d.ts +14 -2
  223. package/lib/src/server/middlewares/internal-route.middleware.d.ts.map +1 -1
  224. package/lib/src/server/middlewares/internal-route.middleware.js +4 -3
  225. package/lib/src/server/middlewares/internal-route.middleware.js.map +1 -1
  226. package/lib/src/server/middlewares/match-expectation.middleware.d.ts +18 -0
  227. package/lib/src/server/middlewares/match-expectation.middleware.d.ts.map +1 -0
  228. package/lib/src/server/middlewares/match-expectation.middleware.js +20 -0
  229. package/lib/src/server/middlewares/match-expectation.middleware.js.map +1 -0
  230. package/lib/src/server/middlewares/reply.middleware.d.ts +15 -5
  231. package/lib/src/server/middlewares/reply.middleware.d.ts.map +1 -1
  232. package/lib/src/server/middlewares/reply.middleware.js +34 -25
  233. package/lib/src/server/middlewares/reply.middleware.js.map +1 -1
  234. package/lib/src/server/middlewares/resolve-public.middleware.d.ts +14 -2
  235. package/lib/src/server/middlewares/resolve-public.middleware.d.ts.map +1 -1
  236. package/lib/src/server/middlewares/resolve-public.middleware.js +11 -11
  237. package/lib/src/server/middlewares/resolve-public.middleware.js.map +1 -1
  238. package/lib/src/server/models/endpoint.d.ts +19 -13
  239. package/lib/src/server/models/endpoint.d.ts.map +1 -1
  240. package/lib/src/server/models/endpoint.js +2 -2
  241. package/lib/src/server/models/endpoint.js.map +1 -1
  242. package/lib/src/server/models/middleware.d.ts +18 -20
  243. package/lib/src/server/models/middleware.d.ts.map +1 -1
  244. package/lib/src/server/models/middleware.js +6 -10
  245. package/lib/src/server/models/middleware.js.map +1 -1
  246. package/lib/src/server/models/reply-service/index.d.ts +6 -6
  247. package/lib/src/server/models/reply-service/index.d.ts.map +1 -1
  248. package/lib/src/server/models/reply-service/index.js +24 -24
  249. package/lib/src/server/models/reply-service/index.js.map +1 -1
  250. package/lib/src/server/models/request-context/http.d.ts +42 -0
  251. package/lib/src/server/models/request-context/http.d.ts.map +1 -0
  252. package/lib/src/server/models/request-context/http.js +51 -0
  253. package/lib/src/server/models/request-context/http.js.map +1 -0
  254. package/lib/src/server/models/request-context/index.d.ts +4 -57
  255. package/lib/src/server/models/request-context/index.d.ts.map +1 -1
  256. package/lib/src/server/models/request-context/index.js +4 -57
  257. package/lib/src/server/models/request-context/index.js.map +1 -1
  258. package/lib/src/server/models/request-context/model.d.ts +13 -0
  259. package/lib/src/server/models/request-context/model.d.ts.map +1 -0
  260. package/lib/src/server/models/request-context/model.js +14 -0
  261. package/lib/src/server/models/request-context/model.js.map +1 -0
  262. package/lib/src/server/models/request-context/types.d.ts +14 -18
  263. package/lib/src/server/models/request-context/types.d.ts.map +1 -1
  264. package/lib/src/server/models/request-context/utils.d.ts +7 -3
  265. package/lib/src/server/models/request-context/utils.d.ts.map +1 -1
  266. package/lib/src/server/models/request-context/utils.js +48 -25
  267. package/lib/src/server/models/request-context/utils.js.map +1 -1
  268. package/lib/src/server/models/request-context/ws.d.ts +21 -0
  269. package/lib/src/server/models/request-context/ws.d.ts.map +1 -0
  270. package/lib/src/server/models/request-context/ws.js +22 -0
  271. package/lib/src/server/models/request-context/ws.js.map +1 -0
  272. package/lib/src/server/models/server-context.d.ts +4 -4
  273. package/lib/src/server/models/server-context.d.ts.map +1 -1
  274. package/lib/src/server/models/server-context.js +5 -5
  275. package/lib/src/server/models/server-context.js.map +1 -1
  276. package/lib/src/server/router.d.ts +4 -7
  277. package/lib/src/server/router.d.ts.map +1 -1
  278. package/lib/src/server/router.js +5 -12
  279. package/lib/src/server/router.js.map +1 -1
  280. package/lib/src/server/ws-exchange/index.d.ts +5 -0
  281. package/lib/src/server/ws-exchange/index.d.ts.map +1 -0
  282. package/lib/src/server/{web-socket-exchange → ws-exchange}/index.js +3 -3
  283. package/lib/src/server/ws-exchange/index.js.map +1 -0
  284. package/lib/src/server/ws-exchange/types.d.ts +12 -0
  285. package/lib/src/server/ws-exchange/types.d.ts.map +1 -0
  286. package/lib/src/server/ws-exchange/types.js.map +1 -0
  287. package/lib/src/types.d.ts +0 -1
  288. package/lib/src/types.d.ts.map +1 -1
  289. package/lib/src/utils/index.d.ts +1 -0
  290. package/lib/src/utils/index.d.ts.map +1 -1
  291. package/lib/src/utils/index.js +1 -0
  292. package/lib/src/utils/index.js.map +1 -1
  293. package/lib/src/utils/json.d.ts +1 -1
  294. package/lib/src/utils/json.d.ts.map +1 -1
  295. package/lib/src/utils/json.js +3 -3
  296. package/lib/src/utils/json.js.map +1 -1
  297. package/lib/src/utils/regexp.d.ts +2 -0
  298. package/lib/src/utils/regexp.d.ts.map +1 -0
  299. package/lib/src/utils/regexp.js +9 -0
  300. package/lib/src/utils/regexp.js.map +1 -0
  301. package/lib/test/index.js +105 -137
  302. package/lib/test/index.js.map +1 -1
  303. package/lib/tsconfig.tsbuildinfo +1 -1
  304. package/lib/types/common.global.d.ts +13 -6
  305. package/lib/types/common.global.d.ts.map +1 -1
  306. package/lib/types/lib.d.ts +1 -0
  307. package/lib/types/lib.d.ts.map +1 -1
  308. package/lib/types/lib.js +1 -0
  309. package/lib/types/lib.js.map +1 -1
  310. package/package.json +3 -2
  311. package/types/common.global.ts +21 -2
  312. package/types/lib.ts +1 -0
  313. package/lib/src/expectations/model.d.ts +0 -39
  314. package/lib/src/expectations/model.d.ts.map +0 -1
  315. package/lib/src/expectations/model.js +0 -90
  316. package/lib/src/expectations/model.js.map +0 -1
  317. package/lib/src/expectations/operators/utils.d.ts +0 -20
  318. package/lib/src/expectations/operators/utils.d.ts.map +0 -1
  319. package/lib/src/expectations/operators/utils.js +0 -67
  320. package/lib/src/expectations/operators/utils.js.map +0 -1
  321. package/lib/src/expectations/storage.d.ts +0 -19
  322. package/lib/src/expectations/storage.d.ts.map +0 -1
  323. package/lib/src/expectations/storage.js.map +0 -1
  324. package/lib/src/expectations/utils.spec.d.ts +0 -2
  325. package/lib/src/expectations/utils.spec.d.ts.map +0 -1
  326. package/lib/src/expectations/utils.spec.js +0 -59
  327. package/lib/src/expectations/utils.spec.js.map +0 -1
  328. package/lib/src/expectations/validation-schemas.d.ts +0 -14
  329. package/lib/src/expectations/validation-schemas.d.ts.map +0 -1
  330. package/lib/src/expectations/validation-schemas.js +0 -36
  331. package/lib/src/expectations/validation-schemas.js.map +0 -1
  332. package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts +0 -16
  333. package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts.map +0 -1
  334. package/lib/src/server/endpoints/history-records.get-list.endpoint.js +0 -9
  335. package/lib/src/server/endpoints/history-records.get-list.endpoint.js.map +0 -1
  336. package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts +0 -6
  337. package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts.map +0 -1
  338. package/lib/src/server/middlewares/validate-expectation-request.middleware.js +0 -20
  339. package/lib/src/server/middlewares/validate-expectation-request.middleware.js.map +0 -1
  340. package/lib/src/server/types.d.ts +0 -6
  341. package/lib/src/server/types.d.ts.map +0 -1
  342. package/lib/src/server/types.js.map +0 -1
  343. package/lib/src/server/web-socket-exchange/index.d.ts +0 -5
  344. package/lib/src/server/web-socket-exchange/index.d.ts.map +0 -1
  345. package/lib/src/server/web-socket-exchange/index.js.map +0 -1
  346. package/lib/src/server/web-socket-exchange/types.d.ts +0 -12
  347. package/lib/src/server/web-socket-exchange/types.d.ts.map +0 -1
  348. package/lib/src/server/web-socket-exchange/types.js +0 -3
  349. package/lib/src/server/web-socket-exchange/types.js.map +0 -1
  350. /package/lib/src/server/{types.js → ws-exchange/types.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/expectations/__utils__/index.ts"],"names":[],"mappings":";;;AAEO,MAAM,uBAAuB,GAAG,GAAiD,EAAE,CAAC,CAAC;IAC1F,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,MAAM;IAEnB,UAAU,EAAE,GAAG;IAEf,OAAO,EAAE,iCAAiC;IAC1C,IAAI,EAAE;QACJ,GAAG,EAAE;YACH,GAAG,EAAE;gBACH,GAAG,EAAE,IAAI;aACV;SACF;KACF;IAED,KAAK,EAAE;QACL,GAAG,EAAE,CAAC;QACN,GAAG,EAAE;YACH,GAAG,EAAE,IAAI;SACV;KACF;IAED,OAAO,EAAE,uCAAuC;IAChD,IAAI,EAAE;QACJ,GAAG,EAAE;YACH,EAAE,GAAG,EAAE,CAAC,EAAE;YACV,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE;SACf;KACF;IAED,OAAO,EAAE;QACP,cAAc,EAAE,kBAAkB;QAClC,iBAAiB,EAAE,OAAO;KAC3B;CACF,CAAC,CAAC;AAnCU,QAAA,uBAAuB,2BAmCjC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/expectations/__utils__/index.ts"],"names":[],"mappings":";;;AAEO,MAAM,uBAAuB,GAAG,GAA6C,EAAE,CAAC,CAAC;IACtF,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM;QAEZ,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,MAAM;QAEd,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,GAAG,EAAE;gBACH,GAAG,EAAE,IAAI;aACV;SACF;QAED,OAAO,EAAE,uCAAuC;QAChD,IAAI,EAAE;YACJ,GAAG,EAAE;gBACH,EAAE,GAAG,EAAE,CAAC,EAAE;gBACV,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE;aACf;SACF;QAED,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,iBAAiB,EAAE,OAAO;SAC3B;KACF;IAED,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,GAAG;QAEX,OAAO,EAAE,iCAAiC;QAC1C,IAAI,EAAE;YACJ,GAAG,EAAE;gBACH,GAAG,EAAE;oBACH,GAAG,EAAE,IAAI;iBACV;aACF;SACF;QAED,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF;CACF,CAAC,CAAC;AA7CU,QAAA,uBAAuB,2BA6CjC"}
@@ -1,5 +1,4 @@
1
- export * from './storage';
2
- export * from './model';
1
+ export * from './models';
3
2
  export * from './types';
4
3
  export * from './utils';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/expectations/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/expectations/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -14,8 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./storage"), exports);
18
- __exportStar(require("./model"), exports);
17
+ __exportStar(require("./models"), exports);
19
18
  __exportStar(require("./types"), exports);
20
19
  __exportStar(require("./utils"), exports);
21
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/expectations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/expectations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB"}
@@ -0,0 +1,35 @@
1
+ import { AxiosProxyConfig } from 'axios';
2
+ import { ValueError } from '@n1k1t/typebox/errors';
3
+ import _ from 'lodash';
4
+ import { TRequestProtocol } from '../../types';
5
+ import { IExpectationMeta, IExpectationOperatorContext, IExpectationSchema, TExpectationType } from '../types';
6
+ import * as operators from '../operators';
7
+ export type TBuildExpectationConfiguration<TContext extends PartialDeep<IExpectationOperatorContext> = {}> = Pick<Expectation<TContext>, 'schema'> & Partial<Pick<Expectation<TContext>, 'name' | 'isEnabled' | 'type'>>;
8
+ export declare class Expectation<TContext extends PartialDeep<IExpectationOperatorContext> = {}> {
9
+ type: TExpectationType;
10
+ schema: IExpectationSchema<TContext>;
11
+ TSchema: IExpectationSchema<TContext>;
12
+ TPlain: Pick<Expectation<TContext>, 'schema' | 'type' | 'id' | 'isEnabled' | 'meta' | 'name'>;
13
+ id: string;
14
+ name: string;
15
+ isEnabled: boolean;
16
+ meta: IExpectationMeta;
17
+ request: operators.root<TContext, "path" | "method" | "incoming.body" | "incoming.bodyRaw" | "incoming.query" | "incoming.headers" | "outgoing.status" | "outgoing.headers" | "outgoing.data" | "outgoing.dataRaw", void> | null;
18
+ response: operators.root<TContext, "path" | "method" | "incoming.body" | "incoming.bodyRaw" | "incoming.query" | "incoming.headers" | "outgoing.status" | "outgoing.headers" | "outgoing.data" | "outgoing.dataRaw", void> | null;
19
+ get delay(): import("../types").IExpectationDelay | import("../types").IExpectationDelay[] | undefined;
20
+ get destroy(): "ECONNABORTED" | undefined;
21
+ get forward(): {
22
+ url?: string;
23
+ baseUrl?: string;
24
+ timeout?: number;
25
+ proxy?: AxiosProxyConfig & {
26
+ protocol: TRequestProtocol;
27
+ };
28
+ } | undefined;
29
+ constructor(type: TExpectationType, schema: IExpectationSchema<TContext>);
30
+ increaseExecutionsCounter(): this;
31
+ validate(): ValueError[];
32
+ toPlain(): Expectation<TContext>['TPlain'];
33
+ static build<TContext extends PartialDeep<IExpectationOperatorContext> = {}>(configuration: TBuildExpectationConfiguration<TContext>): Expectation<TContext> & _.Omit<TBuildExpectationConfiguration<TContext>, "type" | "schema">;
34
+ }
35
+ //# sourceMappingURL=expectation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectation.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/expectation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,kBAAkB,EAElB,gBAA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,CAAC,QAAQ,CAAC;CAY1D"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __metadata = (this && this.__metadata) || function (k, v) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.Expectation = void 0;
39
+ const random_animal_name_1 = __importDefault(require("random-animal-name"));
40
+ const uuid_1 = require("uuid");
41
+ const typebox_1 = require("@n1k1t/typebox");
42
+ const lodash_1 = __importDefault(require("lodash"));
43
+ const utils_1 = require("../../utils");
44
+ const types_1 = require("../types");
45
+ const operators = __importStar(require("../operators"));
46
+ class Expectation {
47
+ get delay() {
48
+ return this.schema.delay;
49
+ }
50
+ ;
51
+ get destroy() {
52
+ return this.schema.destroy;
53
+ }
54
+ get forward() {
55
+ return this.schema.forward;
56
+ }
57
+ constructor(type, schema) {
58
+ this.type = type;
59
+ this.schema = schema;
60
+ this.id = (0, uuid_1.v4)();
61
+ this.name = (0, random_animal_name_1.default)().split(' ').map(lodash_1.default.capitalize).join('');
62
+ this.isEnabled = true;
63
+ this.meta = {
64
+ executionsCount: 0,
65
+ additional: {},
66
+ };
67
+ this.request = this.schema.request
68
+ ? new operators.root(operators, this.schema.request)
69
+ : null;
70
+ this.response = this.schema.response
71
+ ? new operators.root(operators, this.schema.response)
72
+ : null;
73
+ }
74
+ increaseExecutionsCounter() {
75
+ this.meta.executionsCount += 1;
76
+ return this;
77
+ }
78
+ validate() {
79
+ return [];
80
+ }
81
+ toPlain() {
82
+ return {
83
+ id: this.id,
84
+ type: this.type,
85
+ name: this.name,
86
+ schema: this.schema,
87
+ meta: this.meta,
88
+ isEnabled: this.isEnabled,
89
+ };
90
+ }
91
+ static build(configuration) {
92
+ // expectation.meta.additional = Object.assign(
93
+ // extractMetaAdditionalFromExpectationSchema(expectation.request ?? {}),
94
+ // extractMetaAdditionalFromExpectationSchema(expectation.response ?? {}),
95
+ // );
96
+ return Object.assign(new Expectation(configuration.type ?? 'HTTP', configuration.schema), lodash_1.default.omit(configuration, ['schema', 'type']));
97
+ }
98
+ }
99
+ exports.Expectation = Expectation;
100
+ __decorate([
101
+ (0, utils_1.UseValidation)(typebox_1.Type.Optional(typebox_1.Type.Object({
102
+ ms: typebox_1.Type.Number(),
103
+ times: typebox_1.Type.Optional(typebox_1.Type.Number()),
104
+ }))),
105
+ __metadata("design:type", Object),
106
+ __metadata("design:paramtypes", [])
107
+ ], Expectation.prototype, "delay", null);
108
+ __decorate([
109
+ (0, utils_1.UseValidation)(typebox_1.Type.Optional(typebox_1.Type.Union(types_1.LExpectationDestroyType.map((value) => typebox_1.Type.Literal(value))))),
110
+ __metadata("design:type", Object),
111
+ __metadata("design:paramtypes", [])
112
+ ], Expectation.prototype, "destroy", null);
113
+ //# sourceMappingURL=expectation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectation.js","sourceRoot":"","sources":["../../../../src/expectations/models/expectation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4EAAoD;AAEpD,+BAAoC;AAEpC,4CAAsC;AACtC,oDAAuB;AAGvB,uCAA4C;AAC5C,oCAMkB;AAElB,wDAA0C;AAK1C,MAAa,WAAW;IAsBtB,IAQW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC;IAAA,CAAC;IAEF,IAKW,OAAO;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,CAAC;IAED,YAAmB,IAAsB,EAAS,MAAoC;QAAnE,SAAI,GAAJ,IAAI,CAAkB;QAAS,WAAM,GAAN,MAAM,CAA8B;QA3C/E,OAAE,GAAW,IAAA,SAAM,GAAE,CAAC;QACtB,SAAI,GAAW,IAAA,4BAAkB,GAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,gBAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE1E,cAAS,GAAY,IAAI,CAAC;QAE1B,SAAI,GAAqB;YAC9B,eAAe,EAAE,CAAC;YAClB,UAAU,EAAE,EAAE;S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I,CAAC,MAAM,EAAE;QACjB,KAAK,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;KACpC,CAAC,CACH,CACF;;;wCAGA;AAED;IAAC,IAAA,qBAAa,EACZ,cAAI,CAAC,QAAQ,CACX,cAAI,CAAC,KAAK,CAAC,+BAAuB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CACxE,CACF;;;0CAGA"}
@@ -0,0 +1,4 @@
1
+ export * from './expectation';
2
+ export * from './operator';
3
+ export * from './storage';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./expectation"), exports);
18
+ __exportStar(require("./operator"), exports);
19
+ __exportStar(require("./storage"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/expectations/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6CAA2B;AAC3B,4CAA0B"}
@@ -0,0 +1,20 @@
1
+ import { IExpectationOperatorContext, IExpectationOperatorsSchema, TExpectationOperators } from '../types';
2
+ export type TExpectationOperatorConstructor<TContext extends PartialDeep<IExpectationOperatorContext>> = Constructable<ExpectationOperator<TContext, any>, ConstructorParameters<typeof ExpectationOperator>>;
3
+ export declare abstract class ExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext>, TSchema> {
4
+ operators: TExpectationOperators;
5
+ command: TSchema;
6
+ TContext: TContext;
7
+ TSchema: TSchema;
8
+ abstract match(context: TContext): boolean;
9
+ abstract manipulate<T extends TContext>(context: T): T;
10
+ constructor(operators: TExpectationOperators, command: TSchema);
11
+ protected compileExecHandler(raw: TFunction<any, any[]> | string, provide: ('payload' | 'utils')[]): (context: TContext, ...args: unknown[]) => any;
12
+ protected extractNestedSchema(schema: IExpectationOperatorsSchema<any, any>): {
13
+ [K in keyof IExpectationOperatorsSchema]: null | {
14
+ key: K;
15
+ nested: IExpectationOperatorsSchema[K];
16
+ };
17
+ }[keyof IExpectationOperatorsSchema];
18
+ private compileExecUtils;
19
+ }
20
+ //# sourceMappingURL=operator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/operator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAE3B,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,+BAA+B,CAAC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,IACnG,aAAa,CAAC,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,qBAAqB,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAA;AAEtG,8BAAsB,mBAAmB,CAAC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,EAAE,OAAO;IAOvF,SAAS,EAAE,qBAAqB;IAAS,OAAO,EAAE,OAAO;IANrE,QAAQ,EAAG,QAAQ,CAAC;IACpB,OAAO,EAAG,OAAO,CAAC;aAET,KAAK,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;aACjC,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;gBAE1C,SAAS,EAAE,qBAAqB,EAAS,OAAO,EAAE,OAAO;IAE5E,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,SAAS,GAAG,OAAO,CAAC,EAAE,aAY/E,QAAQ,WAAW,OAAO,EAAE;IAQ/C,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG;SAC3E,CAAC,IAAI,MAAM,2BAA2B,GAAG,IAAI,GAAG;YAC/C,GAAG,EAAE,CAAC,CAAC;YACP,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC;SACxC;KACF,CAAC,MAAM,2BAA2B,CAAC;IAKpC,OAAO,CAAC,gBAAgB;CAQzB"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ExpectationOperator = void 0;
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ class ExpectationOperator {
9
+ constructor(operators, command) {
10
+ this.operators = operators;
11
+ this.command = command;
12
+ }
13
+ compileExecHandler(raw, provide) {
14
+ const parameters = [];
15
+ if (provide.includes('payload')) {
16
+ parameters.push('payload');
17
+ }
18
+ if (provide.includes('utils')) {
19
+ parameters.push('{ _, T, context }');
20
+ }
21
+ const handler = typeof raw === 'function' ? raw : Function(parameters.join(', '), `return (() => ${raw})()`);
22
+ return (context, ...args) => {
23
+ const utils = this.compileExecUtils(context);
24
+ const handled = handler(...args, utils);
25
+ return typeof handled === 'function' ? handled(...args, utils) : handled;
26
+ };
27
+ }
28
+ extractNestedSchema(schema) {
29
+ const key = Object.keys(schema)[0];
30
+ return key ? { key, nested: schema[key] } : null;
31
+ }
32
+ compileExecUtils(context) {
33
+ return {
34
+ context: context,
35
+ _: lodash_1.default,
36
+ T: (payload) => payload,
37
+ };
38
+ }
39
+ }
40
+ exports.ExpectationOperator = ExpectationOperator;
41
+ //# sourceMappingURL=operator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator.js","sourceRoot":"","sources":["../../../../src/expectations/models/operator.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAYvB,MAAsB,mBAAmB;IAOvC,YAAmB,SAAgC,EAAS,OAAgB;QAAzD,cAAS,GAAT,SAAS,CAAuB;QAAS,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEtE,kBAAkB,CAAC,GAAmC,EAAE,OAAgC;QAChG,MAAM,UAAU,GAAa,EAAE,CAAC;QAEhC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAChC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;QAED,MAAM,OAAO,GAAG,OAAO,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAC,CAAC;QAE7G,OAAO,CAAC,OAAiB,EAAE,GAAG,IAAe,EAAE,EAAE;YAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC7C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;YAExC,OAAO,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC3E,CAAC,CAAA;IACH,CAAC;IAES,mBAAmB,CAAC,MAA6C;QAMzE,MAAM,GAAG,GAAkD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAClF,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAO,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACxD,CAAC;IAEO,gBAAgB,CAAqB,OAAU;QACrD,OAAO;YACL,OAAO,EAAmC,OAAO;YAEjD,CAAC,EAAE,gBAAC;YACJ,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAM,OAAO;SAC7B,CAAA;IACH,CAAC;CACF;AA/CD,kDA+CC"}
@@ -0,0 +1,15 @@
1
+ import { ValueError } from '@n1k1t/typebox/errors';
2
+ import { IExpectationOperatorContext, TExpectationContextLocation } from '../types';
3
+ import { Expectation, TBuildExpectationConfiguration } from './expectation';
4
+ export type TExpectationsStorageRegisterationResult = {
5
+ status: 'REGISTRED';
6
+ expectation: Expectation<any>;
7
+ } | {
8
+ status: 'ERROR';
9
+ reasons: ValueError[];
10
+ };
11
+ export declare class ExpectationsStorage extends Map<string, Expectation<any>> {
12
+ register(configuration: TBuildExpectationConfiguration<any>): TExpectationsStorageRegisterationResult;
13
+ match<TContext extends PartialDeep<IExpectationOperatorContext>>(location: TExpectationContextLocation, context: TContext): Expectation<TContext> | null;
14
+ }
15
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAE5E,MAAM,MAAM,uCAAuC,GAC/C;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAA;CAAE,GACtD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAE/C,qBAAa,mBAAoB,SAAQ,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7D,QAAQ,CAAC,aAAa,EAAE,8BAA8B,CAAC,GAAG,CAAC,GAAG,uCAAuC;IAYrG,KAAK,CAAC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,EACpE,QAAQ,EAAE,2BAA2B,EACrC,OAAO,EAAE,QAAQ,GAChB,WAAW,CAAC,QAAQ,CAAC,GAAG,IAAI;CAShC"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExpectationsStorage = void 0;
4
- const model_1 = require("./model");
4
+ const expectation_1 = require("./expectation");
5
5
  class ExpectationsStorage extends Map {
6
6
  register(configuration) {
7
- const expectation = model_1.Expectation.build('HTTP', configuration);
7
+ const expectation = expectation_1.Expectation.build(configuration);
8
8
  const errors = expectation.validate();
9
9
  if (errors.length) {
10
10
  return { status: 'ERROR', reasons: errors };
@@ -12,24 +12,14 @@ class ExpectationsStorage extends Map {
12
12
  this.set(expectation.id, expectation);
13
13
  return { status: 'REGISTRED', expectation };
14
14
  }
15
- findByContext(location, context) {
15
+ match(location, context) {
16
16
  for (const expectation of this.values()) {
17
- if (expectation.isEnabled && expectation.validateContext(location, context)) {
17
+ if (expectation.isEnabled && expectation[location]?.match(context)) {
18
18
  return expectation;
19
19
  }
20
20
  }
21
21
  return null;
22
22
  }
23
- findAndManipulateContext(location, context, options) {
24
- const expectation = this.findByContext(location, context);
25
- if (!expectation) {
26
- return null;
27
- }
28
- return {
29
- expectation,
30
- context: expectation.manipulateContext(location, context, options),
31
- };
32
- }
33
23
  }
34
24
  exports.ExpectationsStorage = ExpectationsStorage;
35
25
  //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../src/expectations/models/storage.ts"],"names":[],"mappings":";;;AAGA,+CAA4E;AAM5E,MAAa,mBAAoB,SAAQ,GAA6B;IAC7D,QAAQ,CAAC,aAAkD;QAChE,MAAM,WAAW,GAAG,yBAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QAEtC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;QAC7C,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACtC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IAC9C,CAAC;IAEM,KAAK,CACV,QAAqC,EACrC,OAAiB;QAEjB,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;YACxC,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnE,OAAO,WAAW,CAAC;YACrB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzBD,kDAyBC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=storage.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.spec.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/storage.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const __utils__1 = require("../__utils__");
4
+ const storage_1 = require("./storage");
5
+ describe('Expectations.Models.Storage', () => {
6
+ describe('request', () => {
7
+ it('should not match with empty storage', () => {
8
+ const storage = new storage_1.ExpectationsStorage();
9
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())).toBeNull();
10
+ });
11
+ it('should match with 1 expectation', () => {
12
+ const storage = new storage_1.ExpectationsStorage();
13
+ const { expectation } = storage.register({
14
+ schema: {
15
+ request: { $has: { $location: 'path', $value: '/foo/bar/baz' } },
16
+ },
17
+ });
18
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())?.id).toEqual(expectation.id);
19
+ });
20
+ it('should not match with 1 expectation', () => {
21
+ const storage = new storage_1.ExpectationsStorage();
22
+ storage.register({
23
+ schema: {
24
+ request: { $has: { $location: 'path', $value: '/foo' } },
25
+ },
26
+ });
27
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())).toBeNull();
28
+ });
29
+ it('should match with 2 expectations', () => {
30
+ const storage = new storage_1.ExpectationsStorage();
31
+ storage.register({
32
+ schema: {
33
+ request: { $has: { $location: 'path', $value: '/foo/bar' } },
34
+ },
35
+ });
36
+ const { expectation } = storage.register({
37
+ schema: {
38
+ request: { $has: { $location: 'method', $valueAnyOf: ['GET', 'POST'] } },
39
+ },
40
+ });
41
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())?.id).toEqual(expectation.id);
42
+ });
43
+ it('should not match with 2 expectations', () => {
44
+ const storage = new storage_1.ExpectationsStorage();
45
+ storage.register({
46
+ schema: {
47
+ request: { $has: { $location: 'path', $value: '/foo/bar' } },
48
+ },
49
+ });
50
+ storage.register({
51
+ schema: {
52
+ request: { $has: { $location: 'method', $valueAnyOf: ['GET'] } },
53
+ },
54
+ });
55
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())).toBeNull();
56
+ });
57
+ });
58
+ describe('reponse', () => {
59
+ it('should not match with empty storage', () => {
60
+ const storage = new storage_1.ExpectationsStorage();
61
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())).toBeNull();
62
+ });
63
+ it('should match with 1 expectation', () => {
64
+ const storage = new storage_1.ExpectationsStorage();
65
+ const { expectation } = storage.register({
66
+ schema: {
67
+ response: { $has: { $location: 'path', $value: '/foo/bar/baz' } },
68
+ },
69
+ });
70
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())?.id).toEqual(expectation.id);
71
+ });
72
+ it('should not match with 1 expectation', () => {
73
+ const storage = new storage_1.ExpectationsStorage();
74
+ storage.register({
75
+ schema: {
76
+ response: { $has: { $location: 'path', $value: '/foo' } },
77
+ },
78
+ });
79
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())).toBeNull();
80
+ });
81
+ it('should match with 2 expectations', () => {
82
+ const storage = new storage_1.ExpectationsStorage();
83
+ storage.register({
84
+ schema: {
85
+ response: { $has: { $location: 'path', $value: '/foo/bar' } },
86
+ },
87
+ });
88
+ const { expectation } = storage.register({
89
+ schema: {
90
+ response: { $has: { $location: 'method', $valueAnyOf: ['GET', 'POST'] } },
91
+ },
92
+ });
93
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())?.id).toEqual(expectation.id);
94
+ });
95
+ it('should not match with 2 expectations', () => {
96
+ const storage = new storage_1.ExpectationsStorage();
97
+ storage.register({
98
+ schema: {
99
+ response: { $has: { $location: 'path', $value: '/foo/bar' } },
100
+ },
101
+ });
102
+ storage.register({
103
+ schema: {
104
+ response: { $has: { $location: 'method', $valueAnyOf: ['GET'] } },
105
+ },
106
+ });
107
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())).toBeNull();
108
+ });
109
+ });
110
+ });
111
+ //# sourceMappingURL=storage.spec.js.map
@@ -0,0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AE,IAAA,kCAAuB,GAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +1,8 @@
1
- declare const _default: import("..").TExpectationOperatorHandler<"$and">;
2
- export default _default;
1
+ import { IExpectationOperatorContext, IExpectationOperatorsSchema, TExpectationOperatorLocation } from '../types';
2
+ import { ExpectationOperator } from '../models/operator';
3
+ export default class AndExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TValue = void> extends ExpectationOperator<TContext, IExpectationOperatorsSchema<TContext, TLocation, TValue>[]> {
4
+ compiled: ExpectationOperator<TContext, any>[];
5
+ match(context: TContext): boolean;
6
+ manipulate<T extends TContext>(context: T): T;
7
+ }
3
8
  //# sourceMappingURL=and.operator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"and.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/and.operator.ts"],"names":[],"mappings":";AAEA,wBAGE"}
1
+ {"version":3,"file":"and.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/and.operator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAmC,MAAM,oBAAoB,CAAC;AAE1F,MAAM,CAAC,OAAO,OAAO,sBAAsB,CACzC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,EAC9D,SAAS,SAAS,4BAA4B,GAAG,4BAA4B,EAC7E,MAAM,GAAG,IAAI,CACb,SAAQ,mBAAmB,CAC3B,QAAQ,EACR,2BAA2B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,CAC3D;IACQ,QAAQ,uCAMV;IAEE,KAAK,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAIjC,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CAIrD"}
@@ -1,5 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("./utils");
4
- exports.default = (0, utils_1.buildExpectationOperatorHandler)((mode, schema, context, { exploreNestedSchema }) => schema.every((configuration) => exploreNestedSchema(mode, configuration, context)));
3
+ const operator_1 = require("../models/operator");
4
+ class AndExpectationOperator extends operator_1.ExpectationOperator {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.compiled = this.command
8
+ .map((schema) => this.extractNestedSchema(schema))
9
+ .filter(Boolean)
10
+ .map((extracted) => {
11
+ const Operator = this.operators[extracted.key];
12
+ return new Operator(this.operators, extracted.nested);
13
+ });
14
+ }
15
+ match(context) {
16
+ return this.compiled.every((operator) => operator.match(context));
17
+ }
18
+ manipulate(context) {
19
+ this.compiled.forEach((operator) => operator.manipulate(context));
20
+ return context;
21
+ }
22
+ }
23
+ exports.default = AndExpectationOperator;
5
24
  //# sourceMappingURL=and.operator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"and.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/and.operator.ts"],"names":[],"mappings":";;AAAA,mCAA0D;AAE1D,kBAAe,IAAA,uCAA+B,EAC5C,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,CACjD,MAAM,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,CACrF,CAAC"}
1
+ {"version":3,"file":"and.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/and.operator.ts"],"names":[],"mappings":";;AACA,iDAA0F;AAE1F,MAAqB,sBAInB,SAAQ,8BAGT;IAPD;;QAQS,aAAQ,GAAG,IAAI,CAAC,OAAO;aAC3B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAE,CAAC;aAClD,MAAM,CAAC,OAAO,CAAC;aACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACjB,MAAM,QAAQ,GAA8C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAC1F,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IAUP,CAAC;IARQ,KAAK,CAAC,OAAiB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,CAAC;IAEM,UAAU,CAAqB,OAAU;QAC9C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QAClE,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAxBD,yCAwBC"}