@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":"merge.operator.spec.js","sourceRoot":"","sources":["../../../../src/expectations/operators/merge.operator.spec.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,oCAA0D;AAE1D,sEAAwC;AAExC,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,MAAM,GAAmC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;QACtE,MAAM,CAAC,IAAA,wBAAQ,EAAC,cAAc,EAAE,MAAM,EAAO,EAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC1H,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,IAAA,wBAAQ,EAAC,cAAc,EAAE,EAAE,EAAO,EAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAA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CAAC,CAAC;QAEpE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;QACvD,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +1,8 @@
1
- declare const _default: import("..").TExpectationOperatorHandler<"$not">;
2
- export default _default;
1
+ import { IExpectationOperatorContext, IExpectationOperatorsSchema, TExpectationOperatorLocation } from '../types';
2
+ import { ExpectationOperator } from '../models/operator';
3
+ export default class NotExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TValue = void> extends ExpectationOperator<TContext, IExpectationOperatorsSchema<TContext, TLocation, TValue>> {
4
+ compiled: ExpectationOperator<TContext, any> | null;
5
+ match(context: TContext): boolean;
6
+ manipulate<T extends TContext>(context: T): T;
7
+ }
3
8
  //# sourceMappingURL=not.operator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"not.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/not.operator.ts"],"names":[],"mappings":";AAEA,wBAEE"}
1
+ {"version":3,"file":"not.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/not.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,CACzD;IACQ,QAAQ,4CAQV;IAEE,KAAK,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAIjC,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CAGrD"}
@@ -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 }) => !exploreNestedSchema(mode, schema, context));
3
+ const operator_1 = require("../models/operator");
4
+ class NotExpectationOperator extends operator_1.ExpectationOperator {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.compiled = (() => {
8
+ const extracted = this.extractNestedSchema(this.command);
9
+ if (!extracted) {
10
+ return null;
11
+ }
12
+ const Operator = this.operators[extracted.key];
13
+ return new Operator(this.operators, extracted.nested);
14
+ })();
15
+ }
16
+ match(context) {
17
+ return this.compiled ? !this.compiled.match(context) : false;
18
+ }
19
+ manipulate(context) {
20
+ return context;
21
+ }
22
+ }
23
+ exports.default = NotExpectationOperator;
5
24
  //# sourceMappingURL=not.operator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"not.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/not.operator.ts"],"names":[],"mappings":";;AAAA,mCAA0D;AAE1D,kBAAe,IAAA,uCAA+B,EAC5C,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAChG,CAAC"}
1
+ {"version":3,"file":"not.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/not.operator.ts"],"names":[],"mappings":";;AACA,iDAA0F;AAE1F,MAAqB,sBAInB,SAAQ,8BAGT;IAPD;;QAQS,aAAQ,GAAG,CAAC,GAAG,EAAE;YACtB,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YAED,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,EAAE,CAAC;IASP,CAAC;IAPQ,KAAK,CAAC,OAAiB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/D,CAAC;IAEM,UAAU,CAAqB,OAAU;QAC9C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAzBD,yCAyBC"}
@@ -1,17 +1,36 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
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 __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
4
24
  };
5
25
  Object.defineProperty(exports, "__esModule", { value: true });
6
26
  const __utils__1 = require("../__utils__");
7
- const utils_1 = require("../utils");
8
- const not_operator_1 = __importDefault(require("./not.operator"));
27
+ const operators = __importStar(require("./index"));
9
28
  describe('Expectations.Operators.Not', () => {
10
- it('should validate by schema', () => {
11
- const schema = {
12
- $has: { $location: 'query', $path: 'foo', $value: 1 },
13
- };
14
- expect((0, not_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
29
+ it('should match by schema', () => {
30
+ const operator = new operators.$not(operators, {
31
+ $has: { $location: 'incoming.query', $path: 'foo', $value: 1 },
32
+ });
33
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
15
34
  });
16
35
  });
17
36
  //# sourceMappingURL=not.operator.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"not.operator.spec.js","sourceRoot":"","sources":["../../../../src/expectations/operators/not.operator.spec.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,oCAA0D;AAE1D,kEAAsC;AAEtC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,MAAM,GAAmC;YAC7C,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE;SACtD,CAAC;QAEF,MAAM,CACJ,IAAA,sBAAQ,EAAC,YAAY,EAAE,MAAM,EAAE,IAAA,kCAAuB,GAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CACnH,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"not.operator.spec.js","sourceRoot":"","sources":["../../../../src/expectations/operators/not.operator.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,mDAAqC;AAErC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE;YAC7C,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE;SAC/D,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAA,kCAAuB,GAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +1,8 @@
1
- declare const _default: import("..").TExpectationOperatorHandler<"$or">;
2
- export default _default;
1
+ import { IExpectationOperatorContext, IExpectationOperatorsSchema, TExpectationOperatorLocation } from '../types';
2
+ import { ExpectationOperator } from '../models/operator';
3
+ export default class OrExpectationOperator<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=or.operator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"or.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/or.operator.ts"],"names":[],"mappings":";AAEA,wBAOE"}
1
+ {"version":3,"file":"or.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/or.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,qBAAqB,CACxC,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,9 +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.length && mode === 'validation'
5
- ? schema.some((segment) => exploreNestedSchema(mode, segment, context))
6
- : mode === 'manipulation'
7
- ? schema.every((segment) => exploreNestedSchema(mode, segment, context))
8
- : true);
3
+ const operator_1 = require("../models/operator");
4
+ class OrExpectationOperator 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.some((operator) => operator.match(context));
17
+ }
18
+ manipulate(context) {
19
+ this.compiled.forEach((operator) => operator.manipulate(context));
20
+ return context;
21
+ }
22
+ }
23
+ exports.default = OrExpectationOperator;
9
24
  //# sourceMappingURL=or.operator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"or.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/or.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,MAAM,IAAI,IAAI,KAAK,YAAY;IACpC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC,IAAI,KAAK,cAAc;QACzB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACxE,CAAC,CAAC,IAAI,CACX,CAAC"}
1
+ {"version":3,"file":"or.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/or.operator.ts"],"names":[],"mappings":";;AACA,iDAA0F;AAE1F,MAAqB,qBAInB,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,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,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,wCAwBC"}
@@ -1,54 +1,73 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
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 __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
4
24
  };
5
25
  Object.defineProperty(exports, "__esModule", { value: true });
6
26
  const __utils__1 = require("../__utils__");
7
- const utils_1 = require("../utils");
8
- const or_operator_1 = __importDefault(require("./or.operator"));
27
+ const operators = __importStar(require("./index"));
9
28
  describe('Expectations.Operators.Or', () => {
10
- describe('validation mode', () => {
11
- it('should validate by schema with one valid condition', () => {
12
- const schema = [
13
- { $has: { $location: 'query', $path: 'foo', $value: 1 } },
14
- ];
15
- expect((0, or_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
29
+ describe('matching', () => {
30
+ it('should match by schema with one valid condition', () => {
31
+ const operator = new operators.$or(operators, [
32
+ { $has: { $location: 'incoming.query', $path: 'foo', $value: 1 } },
33
+ ]);
34
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
16
35
  });
17
- it('should validate by schema with two valid conditions', () => {
18
- const schema = [
19
- { $has: { $location: 'query', $path: 'foo', $value: 1 } },
20
- { $has: { $location: 'query', $path: 'bar.baz', $value: null } },
21
- ];
22
- expect((0, or_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
36
+ it('should match by schema with two valid conditions', () => {
37
+ const operator = new operators.$or(operators, [
38
+ { $has: { $location: 'incoming.query', $path: 'foo', $value: 1 } },
39
+ { $has: { $location: 'incoming.query', $path: 'bar.baz', $value: null } },
40
+ ]);
41
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
23
42
  });
24
- it('should validate by schema with zero conditions', () => {
25
- expect((0, or_operator_1.default)('validation', [], (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
43
+ it('should match by schema with zero conditions', () => {
44
+ const operator = new operators.$or(operators, []);
45
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
26
46
  });
27
- it('should validate by schema with one valid and one invalid condition', () => {
28
- const schema = [
29
- { $has: { $location: 'query', $path: 'foo', $value: 1 } },
30
- { $has: { $location: 'query', $path: 'bar.baz', $value: 1 } },
31
- ];
32
- expect((0, or_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
47
+ it('should match by schema with one valid and one invalid condition', () => {
48
+ const operator = new operators.$or(operators, [
49
+ { $has: { $location: 'incoming.query', $path: 'foo', $value: 1 } },
50
+ { $has: { $location: 'incoming.query', $path: 'bar.baz', $value: 1 } },
51
+ ]);
52
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeTruthy();
33
53
  });
34
- it('should validate by schema with two invalid conditions', () => {
35
- const schema = [
36
- { $has: { $location: 'query', $path: 'foo', $value: null } },
37
- { $has: { $location: 'query', $path: 'bar.baz', $value: 1 } },
38
- ];
39
- expect((0, or_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
54
+ it('should match by schema with two invalid conditions', () => {
55
+ const operator = new operators.$or(operators, [
56
+ { $has: { $location: 'incoming.query', $path: 'foo', $value: null } },
57
+ { $has: { $location: 'incoming.query', $path: 'bar.baz', $value: 1 } },
58
+ ]);
59
+ expect(operator.match((0, __utils__1.buildExpectationContext)())).toBeFalsy();
40
60
  });
41
61
  });
42
- describe('manipulation mode', () => {
62
+ describe('manipulation', () => {
43
63
  it('should manipulate by schema with two conditions', () => {
44
- const context = (0, __utils__1.buildExpectationContext)();
45
- const schema = [
46
- { $set: { $location: 'headers', $path: 'content-length', $value: 100 } },
47
- { $set: { $location: 'query', $path: 'bar.baz', $value: { test: true } } },
48
- ];
49
- expect((0, or_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
50
- expect(context.headers?.['content-length']).toEqual(100);
51
- expect(context.query?.bar?.baz?.test).toBeTruthy();
64
+ const operator = new operators.$or(operators, [
65
+ { $set: { $location: 'incoming.headers', $path: 'content-length', $value: 100 } },
66
+ { $set: { $location: 'incoming.query', $path: 'bar.baz', $value: { test: true } } },
67
+ ]);
68
+ const context = operator.manipulate((0, __utils__1.buildExpectationContext)());
69
+ expect(context.incoming.headers?.['content-length']).toEqual(100);
70
+ expect(context.incoming.query?.bar?.baz?.test).toBeTruthy();
52
71
  });
53
72
  });
54
73
  });
@@ -1 +1 @@
1
- {"version":3,"file":"or.operator.spec.js","sourceRoot":"","sources":["../../../../src/expectations/operators/or.operator.spec.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,oCAA0D;AAE1D,gEAAqC;AAErC,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;YAC5D,MAAM,MAAM,GAAmC;gBAC7C,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;aAC1D,CAAC;YAEF,MAAM,CACJ,IAAA,qBAAQ,EAAC,YAAY,EAAE,MAAM,EAAE,IAAA,kCAAuB,GAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CACnH,CAAC,UAAU,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC7D,MAAM,MAAM,GAAmC;gBAC7C,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;gBACzD,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;aACjE,CAAC;YAEF,MAAM,CACJ,IAAA,qBAAQ,EAAC,YAAY,EAAE,MAAM,EAAE,IAAA,kCAAuB,GAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CACnH,CAAC,UAAU,EAAE,CAAC;QACjB,CAAC,CAAC,CA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AC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAClE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +1,13 @@
1
- declare const _default: import("..").TExpectationOperatorHandler<"$remove">;
2
- export default _default;
1
+ import { IExpectationOperatorContext, TExpectationOperatorLocation } from '../types';
2
+ import { ExpectationOperator } from '../models/operator';
3
+ export default class RemoveExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation> extends ExpectationOperator<TContext, {
4
+ [K in TLocation]: {
5
+ $location: K;
6
+ $path?: string;
7
+ $jsonPath?: string;
8
+ };
9
+ }[TLocation]> {
10
+ match(): boolean;
11
+ manipulate<T extends TContext>(context: T): T;
12
+ }
3
13
  //# sourceMappingURL=remove.operator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/remove.operator.ts"],"names":[],"mappings":";AAKA,wBAsBG"}
1
+ {"version":3,"file":"remove.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/remove.operator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAGrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,yBAAyB,CAC5C,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,EAC9D,SAAS,SAAS,4BAA4B,GAAG,4BAA4B,CAC7E,SAAQ,mBAAmB,CAC3B,QAAQ,EACR;KACG,CAAC,IAAI,SAAS,GAAG;QAChB,SAAS,EAAE,CAAC,CAAC;QAEb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CACF,CAAC,SAAS,CAAC,CACb;IACQ,KAAK,IAAI,OAAO;IAIhB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CAqBrD"}
@@ -4,25 +4,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const lodash_1 = __importDefault(require("lodash"));
7
- const utils_1 = require("./utils");
7
+ const utils_1 = require("../utils");
8
8
  const utils_2 = require("../../utils");
9
- exports.default = (0, utils_1.buildExpectationOperatorHandler)((mode, schema, context) => {
10
- if (mode !== 'manipulation' || !schema.$location) {
9
+ const operator_1 = require("../models/operator");
10
+ class RemoveExpectationOperator extends operator_1.ExpectationOperator {
11
+ match() {
11
12
  return true;
12
13
  }
13
- const payload = (0, utils_1.extractContextPayloadSegment)(schema.$location, context);
14
- if (payload?.type !== 'object') {
15
- return true;
16
- }
17
- if (schema.$path) {
18
- lodash_1.default.unset(payload.value, schema.$path);
19
- return true;
20
- }
21
- if (schema.$jsonPath) {
22
- (0, utils_2.extractByJsonPathSafe)({ path: schema.$jsonPath, json: payload.value })
23
- .results?.forEach((segment) => lodash_1.default.unset(segment.parent, segment.parentProperty));
24
- return true;
14
+ manipulate(context) {
15
+ const payload = (0, utils_1.extractContextByLocation)(this.command.$location, context);
16
+ if (payload?.type !== 'object') {
17
+ return context;
18
+ }
19
+ if (this.command.$path) {
20
+ lodash_1.default.unset(payload.value, this.command.$path);
21
+ return context;
22
+ }
23
+ if (this.command.$jsonPath) {
24
+ (0, utils_2.extractWithJsonPathSafe)({ path: this.command.$jsonPath, json: payload.value })
25
+ .results?.forEach((segment) => lodash_1.default.unset(segment.parent, segment.parentProperty));
26
+ return context;
27
+ }
28
+ lodash_1.default.unset(payload.parent, payload.key);
29
+ return context;
25
30
  }
26
- return true;
27
- });
31
+ }
32
+ exports.default = RemoveExpectationOperator;
28
33
  //# sourceMappingURL=remove.operator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/remove.operator.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAEvB,mCAAwF;AACxF,uCAAoD;AAEpD,kBAAe,IAAA,uCAA+B,EAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAClF,IAAI,IAAI,KAAK,cAAc,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,oCAA4B,EAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACxE,IAAI,OAAO,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,IAAA,6BAAqB,EAAC,EAAE,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;aACnE,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;QAElF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"remove.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/remove.operator.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAGvB,oCAAoD;AACpD,uCAAsD;AACtD,iDAAyD;AAEzD,MAAqB,yBAGnB,SAAQ,8BAUT;IACQ,KAAK;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,UAAU,CAAqB,OAAU;QAC9C,MAAM,OAAO,GAAG,IAAA,gCAAwB,EAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC1E,IAAI,OAAO,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACvB,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC3C,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC3B,IAAA,+BAAuB,EAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;iBAC3E,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;YAElF,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,gBAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAvCD,4CAuCC"}
@@ -1,45 +1,57 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
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 __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
4
24
  };
5
25
  Object.defineProperty(exports, "__esModule", { value: true });
6
26
  const __utils__1 = require("../__utils__");
7
- const utils_1 = require("../utils");
8
- const remove_operator_1 = __importDefault(require("./remove.operator"));
27
+ const operators = __importStar(require("./index"));
9
28
  describe('Expectations.Operators.Remove', () => {
10
- it('should handle invalid payload', () => {
11
- const schema = { $location: 'query' };
12
- expect((0, remove_operator_1.default)('manipulation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
13
- });
14
- it('should handle schema without location', () => {
15
- expect((0, remove_operator_1.default)('manipulation', {}, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
16
- });
17
29
  it('should handle schema with non object payload', () => {
18
- const schema = { $location: 'path' };
19
- expect((0, remove_operator_1.default)('manipulation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
30
+ const operator = new operators.$remove(operators, { $location: 'path' });
31
+ const context = operator.manipulate({ incoming: { path: 'foo' } });
32
+ expect(context.incoming.path).toEqual('foo');
20
33
  });
21
34
  it('should handle schema without targeting properties', () => {
22
- const schema = { $location: 'headers' };
23
- expect((0, remove_operator_1.default)('manipulation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
35
+ const operator = new operators.$remove(operators, { $location: 'incoming.headers' });
36
+ const context = operator.manipulate({ headers: { 'content-type': 'unknown' } });
37
+ expect(context.headers['content-type']).toEqual('unknown');
24
38
  });
25
39
  it('should manipulate by schema using path', () => {
26
- const context = (0, __utils__1.buildExpectationContext)();
27
- const schema = {
28
- $location: 'query',
40
+ const operator = new operators.$remove(operators, {
41
+ $location: 'incoming.query',
29
42
  $path: 'foo',
30
- };
31
- expect((0, remove_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
32
- expect(context.query.foo).toBeUndefined();
43
+ });
44
+ const context = operator.manipulate((0, __utils__1.buildExpectationContext)());
45
+ expect(context.incoming.query.foo).toBeUndefined();
33
46
  });
34
47
  it('should manipulate by schema using jsonPath', () => {
35
- const context = (0, __utils__1.buildExpectationContext)();
36
- const schema = {
37
- $location: 'body',
48
+ const operator = new operators.$remove(operators, {
49
+ $location: 'incoming.body',
38
50
  $jsonPath: '$.foo[*].bar,baz',
39
- };
40
- expect((0, remove_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
41
- expect(context.body.foo[0].bar).toBeUndefined();
42
- expect(context.body.foo[1].baz).toBeUndefined();
51
+ });
52
+ const context = operator.manipulate((0, __utils__1.buildExpectationContext)());
53
+ expect(context.incoming.body.foo[0].bar).toBeUndefined();
54
+ expect(context.incoming.body.foo[1].baz).toBeUndefined();
43
55
  });
44
56
  });
45
57
  //# sourceMappingURL=remove.operator.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove.operator.spec.js","sourceRoot":"","sources":["../../../../src/expectations/operators/remove.operator.spec.ts"],"names":[],"mappings":";;;;;AAAA,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AAC;QAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAM,IAAA,kCAAuB,GAAE,CAAC,CAAC;QAEpE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { IExpectationOperatorContext, IExpectationOperatorsSchema, TExpectationOperatorLocation } from '../types';
2
+ import { ExpectationOperator } from '../models/operator';
3
+ export default class RootExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TValue = void> extends ExpectationOperator<TContext, IExpectationOperatorsSchema<TContext, TLocation, TValue>> {
4
+ compiled: ExpectationOperator<TContext, any> | null;
5
+ match(context: TContext): boolean;
6
+ manipulate<T extends TContext>(context: T): T;
7
+ }
8
+ //# sourceMappingURL=root.operator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/root.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,uBAAuB,CAC1C,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,CACzD;IACQ,QAAQ,4CAQV;IAEE,KAAK,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IASjC,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CAQrD"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const operator_1 = require("../models/operator");
4
+ class RootExpectationOperator extends operator_1.ExpectationOperator {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.compiled = (() => {
8
+ const extracted = this.extractNestedSchema(this.command);
9
+ if (!extracted) {
10
+ return null;
11
+ }
12
+ const Operator = this.operators[extracted.key];
13
+ return new Operator(this.operators, extracted.nested);
14
+ })();
15
+ }
16
+ match(context) {
17
+ try {
18
+ return this.compiled?.match(context) ?? false;
19
+ }
20
+ catch (error) {
21
+ console.error('Got error on expectation matching', error);
22
+ return false;
23
+ }
24
+ }
25
+ manipulate(context) {
26
+ try {
27
+ return this.compiled?.manipulate(context) ?? context;
28
+ }
29
+ catch (error) {
30
+ console.error('Got error on expectation manipulation', error);
31
+ return context;
32
+ }
33
+ }
34
+ }
35
+ exports.default = RootExpectationOperator;
36
+ //# sourceMappingURL=root.operator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/root.operator.ts"],"names":[],"mappings":";;AACA,iDAA0F;AAE1F,MAAqB,uBAInB,SAAQ,8BAGT;IAPD;;QAQS,aAAQ,GAAG,CAAC,GAAG,EAAE;YACtB,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzD,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YAED,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,EAAE,CAAC;IAmBP,CAAC;IAjBQ,KAAK,CAAC,OAAiB;QAC5B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC;QAChD,CAAC;QAAC,OAAM,KAAK,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAEM,UAAU,CAAqB,OAAU;QAC9C,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;QACvD,CAAC;QAAC,OAAM,KAAK,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;YAC9D,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;CACF;AAnCD,0CAmCC"}
@@ -1,3 +1,21 @@
1
- declare const _default: import("..").TExpectationOperatorHandler<"$set">;
2
- export default _default;
1
+ import { ExpectationOperator } from '../models/operator';
2
+ import { CompileExpectationOperatorValue, CompileExpectationOperatorValueWithPredicate, IExpectationOperatorContext, IExpectationOperatorExecUtils, TExpectationOperatorLocation } from '../types';
3
+ export default class SetExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TValue = void> extends ExpectationOperator<TContext, {
4
+ [K in TLocation]: {
5
+ $location: K;
6
+ $value?: CompileExpectationOperatorValueWithPredicate<TContext, K, TValue>;
7
+ $exec?: string | TFunction<CompileExpectationOperatorValueWithPredicate<TContext, K, TValue>, [
8
+ CompileExpectationOperatorValue<TContext, K, TValue>,
9
+ IExpectationOperatorExecUtils<TContext>
10
+ ]>;
11
+ $path?: string;
12
+ $jsonPath?: string;
13
+ };
14
+ }[TLocation]> {
15
+ compiled: {
16
+ exec?: ((context: TContext, ...args: unknown[]) => any) | undefined;
17
+ };
18
+ match(): boolean;
19
+ manipulate<T extends TContext>(context: T): T;
20
+ }
3
21
  //# sourceMappingURL=set.operator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"set.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/set.operator.ts"],"names":[],"mappings":";AAKA,wBAmCG"}
1
+ {"version":3,"file":"set.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/set.operator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,+BAA+B,EAC/B,4CAA4C,EAC5C,2BAA2B,EAC3B,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,UAAU,CAAC;AAElB,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;KACG,CAAC,IAAI,SAAS,GAAG;QAChB,SAAS,EAAE,CAAC,CAAC;QAEb,MAAM,CAAC,EAAE,4CAA4C,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,4CAA4C,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE;YAC5F,+BAA+B,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC;YACpD,6BAA6B,CAAC,QAAQ,CAAC;SACxC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CACF,CAAC,SAAS,CAAC,CACb;IACQ,QAAQ;;MAIb;IAEK,KAAK,IAAI,OAAO;IAIhB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CA0CrD"}