@n1k1t/mock-server 0.1.0 → 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 (539) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/README.md +55 -28
  3. package/bin/index.ts +31 -0
  4. package/lib/bin/index.d.ts +2 -0
  5. package/lib/bin/index.d.ts.map +1 -0
  6. package/lib/{src/cli.js → bin/index.js} +13 -15
  7. package/lib/bin/index.js.map +1 -0
  8. package/lib/package.json +4 -3
  9. package/lib/src/client/errors/connection.error.js +1 -1
  10. package/lib/src/client/errors/connection.error.js.map +1 -1
  11. package/lib/src/client/errors/validation.error.d.ts.map +1 -1
  12. package/lib/src/client/helpers/expectations.d.ts +91 -0
  13. package/lib/src/client/helpers/expectations.d.ts.map +1 -0
  14. package/lib/src/client/helpers/expectations.js +66 -0
  15. package/lib/src/client/helpers/expectations.js.map +1 -0
  16. package/lib/src/client/helpers/index.d.ts +2 -0
  17. package/lib/src/client/helpers/index.d.ts.map +1 -0
  18. package/lib/src/client/helpers/index.js +18 -0
  19. package/lib/src/client/helpers/index.js.map +1 -0
  20. package/lib/src/client/index.d.ts +4 -7
  21. package/lib/src/client/index.d.ts.map +1 -1
  22. package/lib/src/client/index.js +4 -41
  23. package/lib/src/client/index.js.map +1 -1
  24. package/lib/src/client/methods/expectations.create.method.d.ts +4 -0
  25. package/lib/src/client/methods/expectations.create.method.d.ts.map +1 -0
  26. package/lib/src/client/methods/expectations.create.method.js +29 -0
  27. package/lib/src/client/methods/expectations.create.method.js.map +1 -0
  28. package/lib/src/client/methods/expectations.delete.method.d.ts +6 -0
  29. package/lib/src/client/methods/expectations.delete.method.d.ts.map +1 -0
  30. package/lib/src/client/methods/expectations.delete.method.js +26 -0
  31. package/lib/src/client/methods/expectations.delete.method.js.map +1 -0
  32. package/lib/src/client/methods/expectations.update.method.d.ts +8 -0
  33. package/lib/src/client/methods/expectations.update.method.d.ts.map +1 -0
  34. package/lib/src/client/methods/expectations.update.method.js +44 -0
  35. package/lib/src/client/methods/expectations.update.method.js.map +1 -0
  36. package/lib/src/client/methods/index.d.ts +4 -1
  37. package/lib/src/client/methods/index.d.ts.map +1 -1
  38. package/lib/src/client/methods/index.js +11 -14
  39. package/lib/src/client/methods/index.js.map +1 -1
  40. package/lib/src/client/methods/ping.method.d.ts +4 -0
  41. package/lib/src/client/methods/ping.method.d.ts.map +1 -0
  42. package/lib/src/client/methods/ping.method.js +22 -0
  43. package/lib/src/client/methods/ping.method.js.map +1 -0
  44. package/lib/src/client/models/client.d.ts +40 -0
  45. package/lib/src/client/models/client.d.ts.map +1 -0
  46. package/lib/src/client/models/client.js +33 -0
  47. package/lib/src/client/models/client.js.map +1 -0
  48. package/lib/src/client/models/client.spec.d.ts +2 -0
  49. package/lib/src/client/models/client.spec.d.ts.map +1 -0
  50. package/lib/src/client/models/client.spec.js +219 -0
  51. package/lib/src/client/models/client.spec.js.map +1 -0
  52. package/lib/src/client/models/index.d.ts +3 -0
  53. package/lib/src/client/models/index.d.ts.map +1 -0
  54. package/lib/src/client/models/index.js +19 -0
  55. package/lib/src/client/models/index.js.map +1 -0
  56. package/lib/src/client/models/method.d.ts +17 -0
  57. package/lib/src/client/models/method.d.ts.map +1 -0
  58. package/lib/src/client/models/method.js +25 -0
  59. package/lib/src/client/models/method.js.map +1 -0
  60. package/lib/src/client/onsite.d.ts +7 -0
  61. package/lib/src/client/onsite.d.ts.map +1 -0
  62. package/lib/src/client/onsite.js +44 -0
  63. package/lib/src/client/onsite.js.map +1 -0
  64. package/lib/src/client/remote.d.ts +8 -0
  65. package/lib/src/client/remote.d.ts.map +1 -0
  66. package/lib/src/client/remote.js +52 -0
  67. package/lib/src/client/remote.js.map +1 -0
  68. package/lib/src/client/types.d.ts +19 -1
  69. package/lib/src/client/types.d.ts.map +1 -1
  70. package/lib/src/client/utils.d.ts +4 -3
  71. package/lib/src/client/utils.d.ts.map +1 -1
  72. package/lib/src/client/utils.js +36 -3
  73. package/lib/src/client/utils.js.map +1 -1
  74. package/lib/src/config/index.d.ts +9 -6
  75. package/lib/src/config/index.d.ts.map +1 -1
  76. package/lib/src/config/index.js +8 -7
  77. package/lib/src/config/index.js.map +1 -1
  78. package/lib/src/expectations/__utils__/index.d.ts +3 -0
  79. package/lib/src/expectations/__utils__/index.d.ts.map +1 -0
  80. package/lib/src/expectations/__utils__/index.js +44 -0
  81. package/lib/src/expectations/__utils__/index.js.map +1 -0
  82. package/lib/src/expectations/errors/index.d.ts.map +1 -0
  83. package/lib/src/expectations/errors/index.js.map +1 -0
  84. package/lib/src/expectations/index.d.ts +4 -0
  85. package/lib/src/expectations/index.d.ts.map +1 -0
  86. package/lib/src/{server/expectations → expectations}/index.js +1 -2
  87. package/lib/src/expectations/index.js.map +1 -0
  88. package/lib/src/expectations/models/expectation.d.ts +35 -0
  89. package/lib/src/expectations/models/expectation.d.ts.map +1 -0
  90. package/lib/src/expectations/models/expectation.js +113 -0
  91. package/lib/src/expectations/models/expectation.js.map +1 -0
  92. package/lib/src/expectations/models/index.d.ts +4 -0
  93. package/lib/src/expectations/models/index.d.ts.map +1 -0
  94. package/lib/src/expectations/models/index.js +20 -0
  95. package/lib/src/expectations/models/index.js.map +1 -0
  96. package/lib/src/expectations/models/operator.d.ts +20 -0
  97. package/lib/src/expectations/models/operator.d.ts.map +1 -0
  98. package/lib/src/expectations/models/operator.js +41 -0
  99. package/lib/src/expectations/models/operator.js.map +1 -0
  100. package/lib/src/expectations/models/storage.d.ts +15 -0
  101. package/lib/src/expectations/models/storage.d.ts.map +1 -0
  102. package/lib/src/{server/expectations → expectations/models}/storage.js +4 -14
  103. package/lib/src/expectations/models/storage.js.map +1 -0
  104. package/lib/src/expectations/models/storage.spec.d.ts +2 -0
  105. package/lib/src/expectations/models/storage.spec.d.ts.map +1 -0
  106. package/lib/src/expectations/models/storage.spec.js +111 -0
  107. package/lib/src/expectations/models/storage.spec.js.map +1 -0
  108. package/lib/src/expectations/operators/and.operator.d.ts +8 -0
  109. package/lib/src/expectations/operators/and.operator.d.ts.map +1 -0
  110. package/lib/src/expectations/operators/and.operator.js +24 -0
  111. package/lib/src/expectations/operators/and.operator.js.map +1 -0
  112. package/lib/src/expectations/operators/and.operator.spec.d.ts.map +1 -0
  113. package/lib/src/expectations/operators/and.operator.spec.js +73 -0
  114. package/lib/src/expectations/operators/and.operator.spec.js.map +1 -0
  115. package/lib/src/expectations/operators/exec.operator.d.ts +8 -0
  116. package/lib/src/expectations/operators/exec.operator.d.ts.map +1 -0
  117. package/lib/src/expectations/operators/exec.operator.js +18 -0
  118. package/lib/src/expectations/operators/exec.operator.js.map +1 -0
  119. package/lib/src/expectations/operators/exec.operator.spec.d.ts.map +1 -0
  120. package/lib/src/expectations/operators/exec.operator.spec.js +58 -0
  121. package/lib/src/expectations/operators/exec.operator.spec.js.map +1 -0
  122. package/lib/src/expectations/operators/has.operator.d.ts +28 -0
  123. package/lib/src/expectations/operators/has.operator.d.ts.map +1 -0
  124. package/lib/src/expectations/operators/has.operator.js +119 -0
  125. package/lib/src/expectations/operators/has.operator.js.map +1 -0
  126. package/lib/src/expectations/operators/has.operator.spec.d.ts.map +1 -0
  127. package/lib/src/expectations/operators/has.operator.spec.js +434 -0
  128. package/lib/src/expectations/operators/has.operator.spec.js.map +1 -0
  129. package/lib/src/expectations/operators/if.operator.d.ts +16 -0
  130. package/lib/src/expectations/operators/if.operator.d.ts.map +1 -0
  131. package/lib/src/expectations/operators/if.operator.js +49 -0
  132. package/lib/src/expectations/operators/if.operator.js.map +1 -0
  133. package/lib/src/expectations/operators/if.operator.spec.d.ts.map +1 -0
  134. package/lib/src/expectations/operators/if.operator.spec.js +122 -0
  135. package/lib/src/expectations/operators/if.operator.spec.js.map +1 -0
  136. package/lib/src/{server/expectations → expectations}/operators/index.d.ts +2 -0
  137. package/lib/src/expectations/operators/index.d.ts.map +1 -0
  138. package/lib/src/{server/expectations → expectations}/operators/index.js +5 -1
  139. package/lib/src/expectations/operators/index.js.map +1 -0
  140. package/lib/src/expectations/operators/merge.operator.d.ts +14 -0
  141. package/lib/src/expectations/operators/merge.operator.d.ts.map +1 -0
  142. package/lib/src/expectations/operators/merge.operator.js +34 -0
  143. package/lib/src/expectations/operators/merge.operator.js.map +1 -0
  144. package/lib/src/expectations/operators/merge.operator.spec.d.ts.map +1 -0
  145. package/lib/src/expectations/operators/merge.operator.spec.js +65 -0
  146. package/lib/src/expectations/operators/merge.operator.spec.js.map +1 -0
  147. package/lib/src/expectations/operators/not.operator.d.ts +8 -0
  148. package/lib/src/expectations/operators/not.operator.d.ts.map +1 -0
  149. package/lib/src/expectations/operators/not.operator.js +24 -0
  150. package/lib/src/expectations/operators/not.operator.js.map +1 -0
  151. package/lib/src/expectations/operators/not.operator.spec.d.ts.map +1 -0
  152. package/lib/src/expectations/operators/not.operator.spec.js +36 -0
  153. package/lib/src/expectations/operators/not.operator.spec.js.map +1 -0
  154. package/lib/src/expectations/operators/or.operator.d.ts +8 -0
  155. package/lib/src/expectations/operators/or.operator.d.ts.map +1 -0
  156. package/lib/src/expectations/operators/or.operator.js +24 -0
  157. package/lib/src/expectations/operators/or.operator.js.map +1 -0
  158. package/lib/src/expectations/operators/or.operator.spec.d.ts.map +1 -0
  159. package/lib/src/expectations/operators/or.operator.spec.js +74 -0
  160. package/lib/src/expectations/operators/or.operator.spec.js.map +1 -0
  161. package/lib/src/expectations/operators/remove.operator.d.ts +13 -0
  162. package/lib/src/expectations/operators/remove.operator.d.ts.map +1 -0
  163. package/lib/src/expectations/operators/remove.operator.js +33 -0
  164. package/lib/src/expectations/operators/remove.operator.js.map +1 -0
  165. package/lib/src/expectations/operators/remove.operator.spec.d.ts.map +1 -0
  166. package/lib/src/expectations/operators/remove.operator.spec.js +57 -0
  167. package/lib/src/expectations/operators/remove.operator.spec.js.map +1 -0
  168. package/lib/src/expectations/operators/root.operator.d.ts +8 -0
  169. package/lib/src/expectations/operators/root.operator.d.ts.map +1 -0
  170. package/lib/src/expectations/operators/root.operator.js +36 -0
  171. package/lib/src/expectations/operators/root.operator.js.map +1 -0
  172. package/lib/src/expectations/operators/set.operator.d.ts +21 -0
  173. package/lib/src/expectations/operators/set.operator.d.ts.map +1 -0
  174. package/lib/src/expectations/operators/set.operator.js +56 -0
  175. package/lib/src/expectations/operators/set.operator.js.map +1 -0
  176. package/lib/src/expectations/operators/set.operator.spec.d.ts.map +1 -0
  177. package/lib/src/expectations/operators/set.operator.spec.js +101 -0
  178. package/lib/src/expectations/operators/set.operator.spec.js.map +1 -0
  179. package/lib/src/expectations/operators/switch.operator.d.ts +25 -0
  180. package/lib/src/expectations/operators/switch.operator.d.ts.map +1 -0
  181. package/lib/src/expectations/operators/switch.operator.js +68 -0
  182. package/lib/src/expectations/operators/switch.operator.js.map +1 -0
  183. package/lib/src/expectations/operators/switch.operator.spec.d.ts +2 -0
  184. package/lib/src/expectations/operators/switch.operator.spec.d.ts.map +1 -0
  185. package/lib/src/expectations/operators/switch.operator.spec.js +129 -0
  186. package/lib/src/expectations/operators/switch.operator.spec.js.map +1 -0
  187. package/lib/src/expectations/types.d.ts +86 -0
  188. package/lib/src/expectations/types.d.ts.map +1 -0
  189. package/lib/src/{server/expectations → expectations}/types.js +13 -2
  190. package/lib/src/expectations/types.js.map +1 -0
  191. package/lib/src/expectations/utils.d.ts +24 -0
  192. package/lib/src/expectations/utils.d.ts.map +1 -0
  193. package/lib/src/expectations/utils.js +119 -0
  194. package/lib/src/expectations/utils.js.map +1 -0
  195. package/lib/src/server/endpoints/config.get.endpoint.d.ts +9 -4
  196. package/lib/src/server/endpoints/config.get.endpoint.d.ts.map +1 -1
  197. package/lib/src/server/endpoints/config.get.endpoint.js +4 -7
  198. package/lib/src/server/endpoints/config.get.endpoint.js.map +1 -1
  199. package/lib/src/server/endpoints/expectations.create.endpoint.d.ts +10 -12
  200. package/lib/src/server/endpoints/expectations.create.endpoint.d.ts.map +1 -1
  201. package/lib/src/server/endpoints/expectations.create.endpoint.js +4 -9
  202. package/lib/src/server/endpoints/expectations.create.endpoint.js.map +1 -1
  203. package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts +11 -8
  204. package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts.map +1 -1
  205. package/lib/src/server/endpoints/expectations.delete.endpoint.js +4 -7
  206. package/lib/src/server/endpoints/expectations.delete.endpoint.js.map +1 -1
  207. package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts +10 -5
  208. package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts.map +1 -1
  209. package/lib/src/server/endpoints/expectations.get-list.endpoint.js +4 -4
  210. package/lib/src/server/endpoints/expectations.get-list.endpoint.js.map +1 -1
  211. package/lib/src/server/endpoints/expectations.update.endpoint.d.ts +14 -12
  212. package/lib/src/server/endpoints/expectations.update.endpoint.d.ts.map +1 -1
  213. package/lib/src/server/endpoints/expectations.update.endpoint.js +6 -21
  214. package/lib/src/server/endpoints/expectations.update.endpoint.js.map +1 -1
  215. package/lib/src/server/endpoints/history.get-list.endpoint.d.ts +27 -0
  216. package/lib/src/server/endpoints/history.get-list.endpoint.d.ts.map +1 -0
  217. package/lib/src/server/endpoints/history.get-list.endpoint.js +11 -0
  218. package/lib/src/server/endpoints/history.get-list.endpoint.js.map +1 -0
  219. package/lib/src/server/endpoints/index.d.ts +2 -3
  220. package/lib/src/server/endpoints/index.d.ts.map +1 -1
  221. package/lib/src/server/endpoints/index.js +5 -7
  222. package/lib/src/server/endpoints/index.js.map +1 -1
  223. package/lib/src/server/endpoints/ping.endpoint.d.ts +9 -4
  224. package/lib/src/server/endpoints/ping.endpoint.d.ts.map +1 -1
  225. package/lib/src/server/endpoints/ping.endpoint.js +3 -3
  226. package/lib/src/server/endpoints/ping.endpoint.js.map +1 -1
  227. package/lib/src/server/history/model.d.ts +16 -16
  228. package/lib/src/server/history/model.d.ts.map +1 -1
  229. package/lib/src/server/history/model.js +21 -6
  230. package/lib/src/server/history/model.js.map +1 -1
  231. package/lib/src/server/history/storage.d.ts +3 -4
  232. package/lib/src/server/history/storage.d.ts.map +1 -1
  233. package/lib/src/server/history/storage.js +7 -4
  234. package/lib/src/server/history/storage.js.map +1 -1
  235. package/lib/src/server/index.d.ts +15 -3
  236. package/lib/src/server/index.d.ts.map +1 -1
  237. package/lib/src/server/index.js +31 -32
  238. package/lib/src/server/index.js.map +1 -1
  239. package/lib/src/server/middlewares/add-history.middleware.d.ts +15 -5
  240. package/lib/src/server/middlewares/add-history.middleware.d.ts.map +1 -1
  241. package/lib/src/server/middlewares/add-history.middleware.js +7 -8
  242. package/lib/src/server/middlewares/add-history.middleware.js.map +1 -1
  243. package/lib/src/server/middlewares/destroy-request.midleware.d.ts +15 -5
  244. package/lib/src/server/middlewares/destroy-request.midleware.d.ts.map +1 -1
  245. package/lib/src/server/middlewares/destroy-request.midleware.js +6 -7
  246. package/lib/src/server/middlewares/destroy-request.midleware.js.map +1 -1
  247. package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts +15 -5
  248. package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts.map +1 -1
  249. package/lib/src/server/middlewares/handle-expectation-delay.middleware.js +3 -4
  250. package/lib/src/server/middlewares/handle-expectation-delay.middleware.js.map +1 -1
  251. package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts +15 -5
  252. package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts.map +1 -1
  253. package/lib/src/server/middlewares/handle-expectation-forward.middleware.js +33 -47
  254. package/lib/src/server/middlewares/handle-expectation-forward.middleware.js.map +1 -1
  255. package/lib/src/server/middlewares/index.d.ts +4 -4
  256. package/lib/src/server/middlewares/index.d.ts.map +1 -1
  257. package/lib/src/server/middlewares/index.js +9 -9
  258. package/lib/src/server/middlewares/index.js.map +1 -1
  259. package/lib/src/server/middlewares/internal-route.middleware.d.ts +15 -3
  260. package/lib/src/server/middlewares/internal-route.middleware.d.ts.map +1 -1
  261. package/lib/src/server/middlewares/internal-route.middleware.js +6 -5
  262. package/lib/src/server/middlewares/internal-route.middleware.js.map +1 -1
  263. package/lib/src/server/middlewares/match-expectation.middleware.d.ts +18 -0
  264. package/lib/src/server/middlewares/match-expectation.middleware.d.ts.map +1 -0
  265. package/lib/src/server/middlewares/match-expectation.middleware.js +20 -0
  266. package/lib/src/server/middlewares/match-expectation.middleware.js.map +1 -0
  267. package/lib/src/server/middlewares/reply.middleware.d.ts +15 -5
  268. package/lib/src/server/middlewares/reply.middleware.d.ts.map +1 -1
  269. package/lib/src/server/middlewares/reply.middleware.js +36 -27
  270. package/lib/src/server/middlewares/reply.middleware.js.map +1 -1
  271. package/lib/src/server/middlewares/resolve-public.middleware.d.ts +15 -3
  272. package/lib/src/server/middlewares/resolve-public.middleware.d.ts.map +1 -1
  273. package/lib/src/server/middlewares/resolve-public.middleware.js +14 -15
  274. package/lib/src/server/middlewares/resolve-public.middleware.js.map +1 -1
  275. package/lib/src/server/models/endpoint.d.ts +32 -0
  276. package/lib/src/server/models/endpoint.d.ts.map +1 -0
  277. package/lib/src/server/{endpoints/model.js → models/endpoint.js} +3 -3
  278. package/lib/src/server/models/endpoint.js.map +1 -0
  279. package/lib/src/server/models/index.d.ts +2 -0
  280. package/lib/src/server/models/index.d.ts.map +1 -1
  281. package/lib/src/server/models/index.js +2 -0
  282. package/lib/src/server/models/index.js.map +1 -1
  283. package/lib/src/server/models/middleware.d.ts +23 -0
  284. package/lib/src/server/models/middleware.d.ts.map +1 -0
  285. package/lib/src/server/{middlewares/model.js → models/middleware.js} +7 -11
  286. package/lib/src/server/models/middleware.js.map +1 -0
  287. package/lib/src/server/models/reply-service/index.d.ts +6 -6
  288. package/lib/src/server/models/reply-service/index.d.ts.map +1 -1
  289. package/lib/src/server/models/reply-service/index.js +24 -24
  290. package/lib/src/server/models/reply-service/index.js.map +1 -1
  291. package/lib/src/server/models/request-context/http.d.ts +42 -0
  292. package/lib/src/server/models/request-context/http.d.ts.map +1 -0
  293. package/lib/src/server/models/request-context/http.js +51 -0
  294. package/lib/src/server/models/request-context/http.js.map +1 -0
  295. package/lib/src/server/models/request-context/index.d.ts +4 -58
  296. package/lib/src/server/models/request-context/index.d.ts.map +1 -1
  297. package/lib/src/server/models/request-context/index.js +4 -57
  298. package/lib/src/server/models/request-context/index.js.map +1 -1
  299. package/lib/src/server/models/request-context/model.d.ts +13 -0
  300. package/lib/src/server/models/request-context/model.d.ts.map +1 -0
  301. package/lib/src/server/models/request-context/model.js +14 -0
  302. package/lib/src/server/models/request-context/model.js.map +1 -0
  303. package/lib/src/server/models/request-context/types.d.ts +14 -18
  304. package/lib/src/server/models/request-context/types.d.ts.map +1 -1
  305. package/lib/src/server/models/request-context/utils.d.ts +7 -3
  306. package/lib/src/server/models/request-context/utils.d.ts.map +1 -1
  307. package/lib/src/server/models/request-context/utils.js +48 -25
  308. package/lib/src/server/models/request-context/utils.js.map +1 -1
  309. package/lib/src/server/models/request-context/ws.d.ts +21 -0
  310. package/lib/src/server/models/request-context/ws.d.ts.map +1 -0
  311. package/lib/src/server/models/request-context/ws.js +22 -0
  312. package/lib/src/server/models/request-context/ws.js.map +1 -0
  313. package/lib/src/server/models/server-context.d.ts +26 -0
  314. package/lib/src/server/models/server-context.d.ts.map +1 -0
  315. package/lib/src/server/models/server-context.js +33 -0
  316. package/lib/src/server/models/server-context.js.map +1 -0
  317. package/lib/src/server/proxy.d.ts +0 -1
  318. package/lib/src/server/proxy.d.ts.map +1 -1
  319. package/lib/src/server/router.d.ts +4 -8
  320. package/lib/src/server/router.d.ts.map +1 -1
  321. package/lib/src/server/router.js +5 -12
  322. package/lib/src/server/router.js.map +1 -1
  323. package/lib/src/server/ws-exchange/index.d.ts +5 -0
  324. package/lib/src/server/ws-exchange/index.d.ts.map +1 -0
  325. package/lib/src/server/{web-socket-exchange → ws-exchange}/index.js +3 -3
  326. package/lib/src/server/ws-exchange/index.js.map +1 -0
  327. package/lib/src/server/ws-exchange/types.d.ts +12 -0
  328. package/lib/src/server/ws-exchange/types.d.ts.map +1 -0
  329. package/lib/src/server/ws-exchange/types.js.map +1 -0
  330. package/lib/src/types.d.ts +0 -3
  331. package/lib/src/types.d.ts.map +1 -1
  332. package/lib/src/utils/common.d.ts +4 -0
  333. package/lib/src/utils/common.d.ts.map +1 -0
  334. package/lib/src/utils/common.js +18 -0
  335. package/lib/src/utils/common.js.map +1 -0
  336. package/lib/src/utils/index.d.ts +4 -28
  337. package/lib/src/utils/index.d.ts.map +1 -1
  338. package/lib/src/utils/index.js +17 -46
  339. package/lib/src/utils/index.js.map +1 -1
  340. package/lib/src/utils/json.d.ts +26 -0
  341. package/lib/src/utils/json.d.ts.map +1 -0
  342. package/lib/src/utils/json.js +36 -0
  343. package/lib/src/utils/json.js.map +1 -0
  344. package/lib/src/utils/regexp.d.ts +2 -0
  345. package/lib/src/utils/regexp.d.ts.map +1 -0
  346. package/lib/src/utils/regexp.js +9 -0
  347. package/lib/src/utils/regexp.js.map +1 -0
  348. package/lib/src/{server/utils/index.d.ts → utils/validation.d.ts} +1 -1
  349. package/lib/src/utils/validation.d.ts.map +1 -0
  350. package/lib/src/{server/utils/index.js → utils/validation.js} +1 -1
  351. package/lib/src/{server/utils/index.js.map → utils/validation.js.map} +1 -1
  352. package/lib/test/index.js +111 -108
  353. package/lib/test/index.js.map +1 -1
  354. package/lib/tsconfig.tsbuildinfo +1 -1
  355. package/lib/types/common.global.d.ts +13 -6
  356. package/lib/types/common.global.d.ts.map +1 -1
  357. package/lib/types/lib.d.ts +1 -0
  358. package/lib/types/lib.d.ts.map +1 -1
  359. package/lib/types/lib.js +1 -0
  360. package/lib/types/lib.js.map +1 -1
  361. package/package.json +4 -3
  362. package/types/common.global.ts +21 -2
  363. package/types/lib.ts +1 -0
  364. package/lib/src/cli.d.ts +0 -2
  365. package/lib/src/cli.d.ts.map +0 -1
  366. package/lib/src/cli.js.map +0 -1
  367. package/lib/src/client/methods/expectations/create.method.d.ts +0 -6
  368. package/lib/src/client/methods/expectations/create.method.d.ts.map +0 -1
  369. package/lib/src/client/methods/expectations/create.method.js +0 -13
  370. package/lib/src/client/methods/expectations/create.method.js.map +0 -1
  371. package/lib/src/client/methods/expectations/delete-all.method.d.ts +0 -3
  372. package/lib/src/client/methods/expectations/delete-all.method.d.ts.map +0 -1
  373. package/lib/src/client/methods/expectations/delete-all.method.js +0 -11
  374. package/lib/src/client/methods/expectations/delete-all.method.js.map +0 -1
  375. package/lib/src/client/methods/expectations/delete.method.d.ts +0 -4
  376. package/lib/src/client/methods/expectations/delete.method.d.ts.map +0 -1
  377. package/lib/src/client/methods/expectations/delete.method.js +0 -12
  378. package/lib/src/client/methods/expectations/delete.method.js.map +0 -1
  379. package/lib/src/client/methods/expectations/index.d.ts +0 -5
  380. package/lib/src/client/methods/expectations/index.d.ts.map +0 -1
  381. package/lib/src/client/methods/expectations/index.js +0 -15
  382. package/lib/src/client/methods/expectations/index.js.map +0 -1
  383. package/lib/src/client/methods/expectations/types.d.ts +0 -18
  384. package/lib/src/client/methods/expectations/types.d.ts.map +0 -1
  385. package/lib/src/client/methods/expectations/types.js.map +0 -1
  386. package/lib/src/client/methods/expectations/update.method.d.ts +0 -8
  387. package/lib/src/client/methods/expectations/update.method.d.ts.map +0 -1
  388. package/lib/src/client/methods/expectations/update.method.js +0 -16
  389. package/lib/src/client/methods/expectations/update.method.js.map +0 -1
  390. package/lib/src/client/methods/expectations/utils.d.ts +0 -3
  391. package/lib/src/client/methods/expectations/utils.d.ts.map +0 -1
  392. package/lib/src/client/methods/expectations/utils.js +0 -26
  393. package/lib/src/client/methods/expectations/utils.js.map +0 -1
  394. package/lib/src/server/endpoints/expectations.delete-all.endpoint.d.ts +0 -11
  395. package/lib/src/server/endpoints/expectations.delete-all.endpoint.d.ts.map +0 -1
  396. package/lib/src/server/endpoints/expectations.delete-all.endpoint.js +0 -11
  397. package/lib/src/server/endpoints/expectations.delete-all.endpoint.js.map +0 -1
  398. package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts +0 -16
  399. package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts.map +0 -1
  400. package/lib/src/server/endpoints/history-records.get-list.endpoint.js +0 -11
  401. package/lib/src/server/endpoints/history-records.get-list.endpoint.js.map +0 -1
  402. package/lib/src/server/endpoints/model.d.ts +0 -26
  403. package/lib/src/server/endpoints/model.d.ts.map +0 -1
  404. package/lib/src/server/endpoints/model.js.map +0 -1
  405. package/lib/src/server/expectations/__utils__/index.d.ts +0 -3
  406. package/lib/src/server/expectations/__utils__/index.d.ts.map +0 -1
  407. package/lib/src/server/expectations/__utils__/index.js +0 -36
  408. package/lib/src/server/expectations/__utils__/index.js.map +0 -1
  409. package/lib/src/server/expectations/errors/index.d.ts.map +0 -1
  410. package/lib/src/server/expectations/errors/index.js.map +0 -1
  411. package/lib/src/server/expectations/index.d.ts +0 -5
  412. package/lib/src/server/expectations/index.d.ts.map +0 -1
  413. package/lib/src/server/expectations/index.js.map +0 -1
  414. package/lib/src/server/expectations/model.d.ts +0 -37
  415. package/lib/src/server/expectations/model.d.ts.map +0 -1
  416. package/lib/src/server/expectations/model.js +0 -90
  417. package/lib/src/server/expectations/model.js.map +0 -1
  418. package/lib/src/server/expectations/operators/and.operator.d.ts +0 -3
  419. package/lib/src/server/expectations/operators/and.operator.d.ts.map +0 -1
  420. package/lib/src/server/expectations/operators/and.operator.js +0 -5
  421. package/lib/src/server/expectations/operators/and.operator.js.map +0 -1
  422. package/lib/src/server/expectations/operators/and.operator.spec.d.ts.map +0 -1
  423. package/lib/src/server/expectations/operators/and.operator.spec.js +0 -55
  424. package/lib/src/server/expectations/operators/and.operator.spec.js.map +0 -1
  425. package/lib/src/server/expectations/operators/exec.operator.d.ts +0 -9
  426. package/lib/src/server/expectations/operators/exec.operator.d.ts.map +0 -1
  427. package/lib/src/server/expectations/operators/exec.operator.js +0 -15
  428. package/lib/src/server/expectations/operators/exec.operator.js.map +0 -1
  429. package/lib/src/server/expectations/operators/exec.operator.spec.d.ts.map +0 -1
  430. package/lib/src/server/expectations/operators/exec.operator.spec.js +0 -27
  431. package/lib/src/server/expectations/operators/exec.operator.spec.js.map +0 -1
  432. package/lib/src/server/expectations/operators/has.operator.d.ts +0 -3
  433. package/lib/src/server/expectations/operators/has.operator.d.ts.map +0 -1
  434. package/lib/src/server/expectations/operators/has.operator.js +0 -83
  435. package/lib/src/server/expectations/operators/has.operator.js.map +0 -1
  436. package/lib/src/server/expectations/operators/has.operator.spec.d.ts.map +0 -1
  437. package/lib/src/server/expectations/operators/has.operator.spec.js +0 -173
  438. package/lib/src/server/expectations/operators/has.operator.spec.js.map +0 -1
  439. package/lib/src/server/expectations/operators/if.operator.d.ts +0 -3
  440. package/lib/src/server/expectations/operators/if.operator.d.ts.map +0 -1
  441. package/lib/src/server/expectations/operators/if.operator.js +0 -15
  442. package/lib/src/server/expectations/operators/if.operator.js.map +0 -1
  443. package/lib/src/server/expectations/operators/if.operator.spec.d.ts.map +0 -1
  444. package/lib/src/server/expectations/operators/if.operator.spec.js +0 -98
  445. package/lib/src/server/expectations/operators/if.operator.spec.js.map +0 -1
  446. package/lib/src/server/expectations/operators/index.d.ts.map +0 -1
  447. package/lib/src/server/expectations/operators/index.js.map +0 -1
  448. package/lib/src/server/expectations/operators/merge.operator.d.ts +0 -3
  449. package/lib/src/server/expectations/operators/merge.operator.d.ts.map +0 -1
  450. package/lib/src/server/expectations/operators/merge.operator.js +0 -30
  451. package/lib/src/server/expectations/operators/merge.operator.js.map +0 -1
  452. package/lib/src/server/expectations/operators/merge.operator.spec.d.ts.map +0 -1
  453. package/lib/src/server/expectations/operators/merge.operator.spec.js +0 -55
  454. package/lib/src/server/expectations/operators/merge.operator.spec.js.map +0 -1
  455. package/lib/src/server/expectations/operators/not.operator.d.ts +0 -3
  456. package/lib/src/server/expectations/operators/not.operator.d.ts.map +0 -1
  457. package/lib/src/server/expectations/operators/not.operator.js +0 -5
  458. package/lib/src/server/expectations/operators/not.operator.js.map +0 -1
  459. package/lib/src/server/expectations/operators/not.operator.spec.d.ts.map +0 -1
  460. package/lib/src/server/expectations/operators/not.operator.spec.js +0 -17
  461. package/lib/src/server/expectations/operators/not.operator.spec.js.map +0 -1
  462. package/lib/src/server/expectations/operators/or.operator.d.ts +0 -3
  463. package/lib/src/server/expectations/operators/or.operator.d.ts.map +0 -1
  464. package/lib/src/server/expectations/operators/or.operator.js +0 -9
  465. package/lib/src/server/expectations/operators/or.operator.js.map +0 -1
  466. package/lib/src/server/expectations/operators/or.operator.spec.d.ts.map +0 -1
  467. package/lib/src/server/expectations/operators/or.operator.spec.js +0 -55
  468. package/lib/src/server/expectations/operators/or.operator.spec.js.map +0 -1
  469. package/lib/src/server/expectations/operators/remove.operator.d.ts +0 -3
  470. package/lib/src/server/expectations/operators/remove.operator.d.ts.map +0 -1
  471. package/lib/src/server/expectations/operators/remove.operator.js +0 -28
  472. package/lib/src/server/expectations/operators/remove.operator.js.map +0 -1
  473. package/lib/src/server/expectations/operators/remove.operator.spec.d.ts.map +0 -1
  474. package/lib/src/server/expectations/operators/remove.operator.spec.js +0 -45
  475. package/lib/src/server/expectations/operators/remove.operator.spec.js.map +0 -1
  476. package/lib/src/server/expectations/operators/set.operator.d.ts +0 -3
  477. package/lib/src/server/expectations/operators/set.operator.d.ts.map +0 -1
  478. package/lib/src/server/expectations/operators/set.operator.js +0 -39
  479. package/lib/src/server/expectations/operators/set.operator.js.map +0 -1
  480. package/lib/src/server/expectations/operators/set.operator.spec.d.ts.map +0 -1
  481. package/lib/src/server/expectations/operators/set.operator.spec.js +0 -57
  482. package/lib/src/server/expectations/operators/set.operator.spec.js.map +0 -1
  483. package/lib/src/server/expectations/operators/utils.d.ts +0 -20
  484. package/lib/src/server/expectations/operators/utils.d.ts.map +0 -1
  485. package/lib/src/server/expectations/operators/utils.js +0 -67
  486. package/lib/src/server/expectations/operators/utils.js.map +0 -1
  487. package/lib/src/server/expectations/storage.d.ts +0 -19
  488. package/lib/src/server/expectations/storage.d.ts.map +0 -1
  489. package/lib/src/server/expectations/storage.js.map +0 -1
  490. package/lib/src/server/expectations/types.d.ts +0 -83
  491. package/lib/src/server/expectations/types.d.ts.map +0 -1
  492. package/lib/src/server/expectations/types.js.map +0 -1
  493. package/lib/src/server/expectations/utils.d.ts +0 -12
  494. package/lib/src/server/expectations/utils.d.ts.map +0 -1
  495. package/lib/src/server/expectations/utils.js +0 -92
  496. package/lib/src/server/expectations/utils.js.map +0 -1
  497. package/lib/src/server/expectations/utils.spec.d.ts +0 -2
  498. package/lib/src/server/expectations/utils.spec.d.ts.map +0 -1
  499. package/lib/src/server/expectations/utils.spec.js +0 -59
  500. package/lib/src/server/expectations/utils.spec.js.map +0 -1
  501. package/lib/src/server/expectations/validation-schemas.d.ts +0 -24
  502. package/lib/src/server/expectations/validation-schemas.d.ts.map +0 -1
  503. package/lib/src/server/expectations/validation-schemas.js +0 -36
  504. package/lib/src/server/expectations/validation-schemas.js.map +0 -1
  505. package/lib/src/server/middlewares/model.d.ts +0 -25
  506. package/lib/src/server/middlewares/model.d.ts.map +0 -1
  507. package/lib/src/server/middlewares/model.js.map +0 -1
  508. package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts +0 -6
  509. package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts.map +0 -1
  510. package/lib/src/server/middlewares/validate-expectation-request.middleware.js +0 -20
  511. package/lib/src/server/middlewares/validate-expectation-request.middleware.js.map +0 -1
  512. package/lib/src/server/models/server-context/index.d.ts +0 -14
  513. package/lib/src/server/models/server-context/index.d.ts.map +0 -1
  514. package/lib/src/server/models/server-context/index.js +0 -20
  515. package/lib/src/server/models/server-context/index.js.map +0 -1
  516. package/lib/src/server/types.d.ts +0 -6
  517. package/lib/src/server/types.d.ts.map +0 -1
  518. package/lib/src/server/types.js +0 -3
  519. package/lib/src/server/types.js.map +0 -1
  520. package/lib/src/server/utils/index.d.ts.map +0 -1
  521. package/lib/src/server/web-socket-exchange/index.d.ts +0 -5
  522. package/lib/src/server/web-socket-exchange/index.d.ts.map +0 -1
  523. package/lib/src/server/web-socket-exchange/index.js.map +0 -1
  524. package/lib/src/server/web-socket-exchange/types.d.ts +0 -12
  525. package/lib/src/server/web-socket-exchange/types.d.ts.map +0 -1
  526. package/lib/src/server/web-socket-exchange/types.js +0 -3
  527. package/lib/src/server/web-socket-exchange/types.js.map +0 -1
  528. /package/lib/src/{server/expectations → expectations}/errors/index.d.ts +0 -0
  529. /package/lib/src/{server/expectations → expectations}/errors/index.js +0 -0
  530. /package/lib/src/{server/expectations → expectations}/operators/and.operator.spec.d.ts +0 -0
  531. /package/lib/src/{server/expectations → expectations}/operators/exec.operator.spec.d.ts +0 -0
  532. /package/lib/src/{server/expectations → expectations}/operators/has.operator.spec.d.ts +0 -0
  533. /package/lib/src/{server/expectations → expectations}/operators/if.operator.spec.d.ts +0 -0
  534. /package/lib/src/{server/expectations → expectations}/operators/merge.operator.spec.d.ts +0 -0
  535. /package/lib/src/{server/expectations → expectations}/operators/not.operator.spec.d.ts +0 -0
  536. /package/lib/src/{server/expectations → expectations}/operators/or.operator.spec.d.ts +0 -0
  537. /package/lib/src/{server/expectations → expectations}/operators/remove.operator.spec.d.ts +0 -0
  538. /package/lib/src/{server/expectations → expectations}/operators/set.operator.spec.d.ts +0 -0
  539. /package/lib/src/{client/methods/expectations → server/ws-exchange}/types.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"exec.operator.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/exec.operator.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAGvB,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE3E,MAAM,MAAM,+BAA+B,CAAC,QAAQ,SAAS,oBAAoB,GAAG,qBAAqB,IACvG,SAAS,CAAC,OAAO,EAAE,CAAC;IAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC,CAAC;;AAE3D,wBASE"}
@@ -1,15 +0,0 @@
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
- const lodash_1 = __importDefault(require("lodash"));
7
- const utils_1 = require("./utils");
8
- exports.default = (0, utils_1.buildExpectationOperatorHandler)((mode, command, context) => {
9
- if (mode !== 'manipulation') {
10
- return true;
11
- }
12
- Function(`return ({ _, context }) => ${command}`)()({ _: lodash_1.default, context });
13
- return true;
14
- });
15
- //# sourceMappingURL=exec.operator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exec.operator.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/exec.operator.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAEvB,mCAA0D;AAM1D,kBAAe,IAAA,uCAA+B,EAC5C,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACzB,IAAI,IAAI,KAAK,cAAc,EAAE;QAC3B,OAAO,IAAI,CAAC;KACb;IAED,QAAQ,CAAC,8BAA8B,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAD,gBAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"exec.operator.spec.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/exec.operator.spec.ts"],"names":[],"mappings":""}
@@ -1,27 +0,0 @@
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
- const __utils__1 = require("../__utils__");
7
- const utils_1 = require("../utils");
8
- const exec_operator_1 = __importDefault(require("./exec.operator"));
9
- describe('Expectations.Operators.Exec', () => {
10
- it('should exec by inline command', () => {
11
- const context = (0, __utils__1.buildExpectationContext)();
12
- const command = '_.set(context, "query.test", "foo")';
13
- expect((0, exec_operator_1.default)('manipulation', command, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
14
- expect(context.query.test).toEqual('foo');
15
- });
16
- it('should exec by multiline command', () => {
17
- const context = (0, __utils__1.buildExpectationContext)();
18
- const command = `{
19
- context.body.foo.push({ test: 1 });
20
- context.body.foo.push({ test: 2 });
21
- }`;
22
- expect((0, exec_operator_1.default)('manipulation', command, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
23
- expect(context.body.foo[2].test).toEqual(1);
24
- expect(context.body.foo[3].test).toEqual(2);
25
- });
26
- });
27
- //# sourceMappingURL=exec.operator.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exec.operator.spec.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/exec.operator.spec.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,oCAA0D;AAE1D,oEAAuC;AAEvC,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,OAAO,GAAG,IAAA,kCAAuB,GAAE,CAAA;QACzC,MAAM,OAAO,GAAG,qCAAqC,CAAC;QAEtD,MAAM,CAAC,IAAA,uBAAQ,EAAC,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QACzH,MAAM,CAAO,OAAO,CAAC,KAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,OAAO,GAAG,IAAA,kCAAuB,GAAE,CAAA;QACzC,MAAM,OAAO,GAAG;;;MAGd,CAAC;QAEH,MAAM,CAAC,IAAA,uBAAQ,EAAC,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QACzH,MAAM,CAAO,OAAO,CAAC,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnD,MAAM,CAAO,OAAO,CAAC,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const _default: import("..").TExpectationOperatorHandler<"$has">;
2
- export default _default;
3
- //# sourceMappingURL=has.operator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"has.operator.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/has.operator.ts"],"names":[],"mappings":";AAMA,wBAoFG"}
@@ -1,83 +0,0 @@
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
- const minimatch_1 = __importDefault(require("minimatch"));
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const utils_1 = require("./utils");
9
- const utils_2 = require("../../../utils");
10
- exports.default = (0, utils_1.buildExpectationOperatorHandler)((mode, schema, context) => {
11
- if (!schema.$location) {
12
- return false;
13
- }
14
- const payload = (0, utils_1.extractContextPayloadSegment)(schema.$location, context);
15
- if (!payload) {
16
- return false;
17
- }
18
- switch (payload.type) {
19
- case 'string': {
20
- if (schema.$value !== undefined) {
21
- return payload.value === schema.$value;
22
- }
23
- if (schema.$valueAnyOf) {
24
- return schema.$valueAnyOf.some((value) => payload.value === value);
25
- }
26
- if (schema.$regExp) {
27
- return schema.$regExp.test(payload.value);
28
- }
29
- if (schema.$regExpAnyOf) {
30
- return schema.$regExpAnyOf.some((regExp) => regExp.test(payload.value));
31
- }
32
- if (schema.$minimatch) {
33
- return (0, minimatch_1.default)(payload.value, schema.$minimatch);
34
- }
35
- if (schema.$minimatchAnyOf) {
36
- return schema.$minimatchAnyOf.some((pattern) => (0, minimatch_1.default)(payload.value, pattern));
37
- }
38
- }
39
- case 'number': {
40
- if (schema.$value !== undefined) {
41
- return payload.value === schema.$value;
42
- }
43
- if (schema.$valueAnyOf) {
44
- return schema.$valueAnyOf.some((value) => payload.value === value);
45
- }
46
- if (schema.$minimatch) {
47
- return (0, minimatch_1.default)(String(payload.value), schema.$minimatch);
48
- }
49
- if (schema.$minimatchAnyOf) {
50
- const value = String(payload.value);
51
- return schema.$minimatchAnyOf.some((pattern) => (0, minimatch_1.default)(value, pattern));
52
- }
53
- }
54
- case 'object': {
55
- const values = schema.$path
56
- ? [lodash_1.default.get(payload.value, schema.$path)]
57
- : schema.$jsonPath
58
- ? (0, utils_2.extractByJsonPathSafe)({ path: schema.$jsonPath, json: payload.value }).results?.map(({ value }) => value) ?? []
59
- : [];
60
- if (schema.$value !== undefined) {
61
- return values.every((value) => schema.$value === value);
62
- }
63
- if (schema.$valueAnyOf) {
64
- return values.every((valueToCheck) => (schema.$valueAnyOf).some((value) => valueToCheck === value));
65
- }
66
- if (schema.$regExp) {
67
- return values.every((value) => (schema.$regExp).test(String(value)));
68
- }
69
- if (schema.$regExpAnyOf) {
70
- return values.every((value) => (schema.$regExpAnyOf).some((regExp) => regExp.test(String(value))));
71
- }
72
- if (schema.$minimatch) {
73
- return values.every((value) => (0, minimatch_1.default)(String(value), schema.$minimatch));
74
- }
75
- if (schema.$minimatchAnyOf) {
76
- return values.every((value) => (schema.$minimatchAnyOf).some((pattern) => (0, minimatch_1.default)(String(value), pattern)));
77
- }
78
- return values.length !== 0;
79
- }
80
- default: return false;
81
- }
82
- });
83
- //# sourceMappingURL=has.operator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"has.operator.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/has.operator.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,oDAAuB;AAEvB,mC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AC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;aAChH;YAED,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;SAC5B;QAED,OAAO,CAAC,CAAC,OAAO,KAAK,CAAC;KACvB;AACH,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"has.operator.spec.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/has.operator.spec.ts"],"names":[],"mappings":""}
@@ -1,173 +0,0 @@
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
- const __utils__1 = require("../__utils__");
7
- const utils_1 = require("../utils");
8
- const has_operator_1 = __importDefault(require("./has.operator"));
9
- describe('Expectations.Operators.Has', () => {
10
- it('should handle invalid payload', () => {
11
- const schema = { $location: 'query' };
12
- expect((0, has_operator_1.default)('validation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
13
- });
14
- it('should handle schema without location', () => {
15
- expect((0, has_operator_1.default)('validation', {}, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
16
- });
17
- it('should validate by schema in query using path', () => {
18
- const schema = {
19
- $location: 'query',
20
- $path: 'foo',
21
- };
22
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
23
- });
24
- it('should validate by schema in query using path and value', () => {
25
- const schema = {
26
- $location: 'query',
27
- $path: 'foo',
28
- $value: 1,
29
- };
30
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
31
- });
32
- it('should validate by schema in query using jsonPath and valueAnyOf', () => {
33
- const schema = {
34
- $location: 'query',
35
- $jsonPath: '$.bar.baz',
36
- $valueAnyOf: [1, 2, null],
37
- };
38
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
39
- });
40
- it('should validate by schema in query using path and regExp', () => {
41
- const schema = {
42
- $location: 'query',
43
- $path: 'foo',
44
- $regExp: /\d/,
45
- };
46
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
47
- });
48
- it('should validate by schema in query using path and regExpAnyOf', () => {
49
- const schema = {
50
- $location: 'query',
51
- $path: 'foo',
52
- $regExpAnyOf: [/\./, /\d/],
53
- };
54
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
55
- });
56
- it('should validate by schema in query using path and minimatch', () => {
57
- const schema = {
58
- $location: 'query',
59
- $path: 'foo',
60
- $minimatch: '*',
61
- };
62
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
63
- });
64
- it('should validate by schema in query using path and minimatchAnyOf', () => {
65
- const schema = {
66
- $location: 'query',
67
- $path: 'foo',
68
- $minimatchAnyOf: ['2', '3', '1'],
69
- };
70
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
71
- });
72
- it('should validate by schema in query using jsonPath', () => {
73
- const schema = {
74
- $location: 'query',
75
- $jsonPath: '$.bar.baz',
76
- };
77
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
78
- });
79
- it('should validate by schema in query using jsonPath and value', () => {
80
- const schema = {
81
- $location: 'query',
82
- $jsonPath: '$.bar.baz',
83
- $value: null,
84
- };
85
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
86
- });
87
- it('should validate by schema with invalid condition in query using jsonPath and value', () => {
88
- const schema = {
89
- $location: 'query',
90
- $jsonPath: '$.bar.baz',
91
- $value: 1,
92
- };
93
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
94
- });
95
- it('should validate by schema in path using value', () => {
96
- const schema = {
97
- $location: 'path',
98
- $value: '/foo/bar/baz',
99
- };
100
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
101
- });
102
- it('should validate by schema in path using valueAnyOf', () => {
103
- const schema = {
104
- $location: 'path',
105
- $valueAnyOf: ['/foo', '/bar', '/foo/bar/baz'],
106
- };
107
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
108
- });
109
- it('should validate by schema in path using regExp', () => {
110
- const schema = {
111
- $location: 'path',
112
- $regExp: /^\/foo\/\w+\/baz$/,
113
- };
114
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
115
- });
116
- it('should validate by schema in path using regExpAnyOf', () => {
117
- const schema = {
118
- $location: 'path',
119
- $regExpAnyOf: [/\./, /^\/foo\/\w+\/baz$/, /^foo$/],
120
- };
121
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
122
- });
123
- it('should validate by schema in path using minimatch', () => {
124
- const schema = {
125
- $location: 'path',
126
- $minimatch: '/foo/*/baz',
127
- };
128
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
129
- });
130
- it('should validate by schema in path using minimatchAnyOf', () => {
131
- const schema = {
132
- $location: 'path',
133
- $minimatchAnyOf: ['/foo/baz', '/bar/baz', '/foo/bar/*'],
134
- };
135
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
136
- });
137
- it('should validate by schema in method using value', () => {
138
- const schema = {
139
- $location: 'method',
140
- $value: 'POST',
141
- };
142
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
143
- });
144
- it('should validate by schema in statusCode using value', () => {
145
- const schema = {
146
- $location: 'statusCode',
147
- $value: 200,
148
- };
149
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
150
- });
151
- it('should validate by schema in statusCode using valueAnyOf', () => {
152
- const schema = {
153
- $location: 'statusCode',
154
- $valueAnyOf: [404, 200],
155
- };
156
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
157
- });
158
- it('should validate by schema in statusCode using minimatch', () => {
159
- const schema = {
160
- $location: 'statusCode',
161
- $minimatch: '2**',
162
- };
163
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
164
- });
165
- it('should validate by schema in statusCode using minimatchAnyOf', () => {
166
- const schema = {
167
- $location: 'statusCode',
168
- $minimatchAnyOf: ['2*1', '200'],
169
- };
170
- expect((0, has_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
171
- });
172
- });
173
- //# sourceMappingURL=has.operator.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"has.operator.spec.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/has.operator.spec.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,oCAA0D;AAE1D,kEAAsC;AAEtC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,MAAM,GAAmC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;QACtE,MAAM,CAAC,IAAA,sBAAQ,EAAC,YAAY,EAAE,MAAM,EAAO,EAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACvH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,IAAA,sBAAQ,EAAC,YAAY,EAAE,EAAE,EAAO,EAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACnH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,MAAM,GAAmC;YAC7C,SAAS,EAAE,OAAO;YAClB,KAAK,EAAE,KAAK;SACb,CAAC;QAEF,MAAM,CACJ,IAAA,sBAAQ,EAAC,YAAY,EAAE,MAAM,EAAE,IAAA,kCAAuB,GAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CACnH,CAAC,UAAU,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,MAAM,GAAmC;YAC7C,SAAS,EAAE,OAAO;YAClB,KAAK,EAAE,KAAK;YACZ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,EAAE,MAAM,EAAE,IAAA,kCAAuB,GAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CACnH,CAAC,UAAU,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,MAAM,GAAmC;YAC7C,SAAS,EAAE,YAAY;YACvB,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;SAChC,CAAC;QAEF,MAAM,CACJ,IAAA,sBAAQ,EAAC,YAAY,EAAE,MAAM,EAAE,IAAA,kCAAuB,GAAE,EAAE,EAAE,mBAAmB,EAAE,sCAA8B,EAAE,CAAC,CACnH,CAAC,UAAU,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const _default: import("..").TExpectationOperatorHandler<"$if">;
2
- export default _default;
3
- //# sourceMappingURL=if.operator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"if.operator.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/if.operator.ts"],"names":[],"mappings":";AAEA,wBAYG"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("./utils");
4
- exports.default = (0, utils_1.buildExpectationOperatorHandler)((mode, schema, context, { exploreNestedSchema }) => {
5
- const { $then, $else, ...schemaPart } = schema;
6
- const result = exploreNestedSchema(mode, schemaPart, context);
7
- if ($then && result) {
8
- return exploreNestedSchema(mode, $then, context);
9
- }
10
- if ($else && !result) {
11
- return exploreNestedSchema(mode, $else, context);
12
- }
13
- return false;
14
- });
15
- //# sourceMappingURL=if.operator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"if.operator.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/if.operator.ts"],"names":[],"mappings":";;AAAA,mCAA0D;AAE1D,kBAAe,IAAA,uCAA+B,EAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE;IACvG,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAC;IAC/C,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAE9D,IAAI,KAAK,IAAI,MAAM,EAAE;QACnB,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;KAClD;IACD,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE;QACpB,OAAO,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;KAClD;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"if.operator.spec.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/if.operator.spec.ts"],"names":[],"mappings":""}
@@ -1,98 +0,0 @@
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
- const __utils__1 = require("../__utils__");
7
- const utils_1 = require("../utils");
8
- const if_operator_1 = __importDefault(require("./if.operator"));
9
- describe('Expectations.Operators.If', () => {
10
- describe('validation mode', () => {
11
- it('should validate by schema with simple valid condition and valid [then] target branch', () => {
12
- const schema = {
13
- $has: { $location: 'path', $regExp: /^\/foo/ },
14
- $then: { $has: { $location: 'method', $value: 'POST' } },
15
- };
16
- expect((0, if_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
17
- });
18
- it('should validate by schema with simple invalid condition and valid [then] target branch', () => {
19
- const schema = {
20
- $has: { $location: 'path', $regExp: /^\/bar/ },
21
- $then: { $has: { $location: 'method', $value: 'POST' } },
22
- };
23
- expect((0, if_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
24
- });
25
- it('should validate by schema with simple valid condition and invalid [then] target branch', () => {
26
- const schema = {
27
- $has: { $location: 'path', $regExp: /^\/foo/ },
28
- $then: { $has: { $location: 'method', $value: 'GET' } },
29
- };
30
- expect((0, if_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
31
- });
32
- it('should validate by schema with simple invalid condition and valid [else] target branch', () => {
33
- const schema = {
34
- $has: { $location: 'path', $regExp: /^\/bar/ },
35
- $else: { $has: { $location: 'method', $value: 'POST' } },
36
- };
37
- expect((0, if_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
38
- });
39
- it('should validate by schema with simple invalid condition and invalid [else] target branch', () => {
40
- const schema = {
41
- $has: { $location: 'path', $regExp: /^\/bar/ },
42
- $else: { $has: { $location: 'method', $value: 'GET' } },
43
- };
44
- expect((0, if_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
45
- });
46
- it('should validate by schema with complex valid condition', () => {
47
- const schema = {
48
- $or: [
49
- { $if: {} },
50
- { $has: { $location: 'path', $regExp: /^\/bar/ } },
51
- { $has: { $location: 'method', $value: 'POST' } },
52
- ],
53
- $then: {
54
- $or: [
55
- { $has: { $location: 'body', $path: 'foo.1.test.0', $regExp: /^2/ } },
56
- { $has: { $location: 'body', $path: 'foo.1.baz.0', $regExp: /^2/ } },
57
- ],
58
- },
59
- };
60
- expect((0, if_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
61
- });
62
- it('should validate by schema with complex invalid condition', () => {
63
- const schema = {
64
- $or: [
65
- { $if: {} },
66
- { $has: { $location: 'path', $regExp: /^\/bar/ } },
67
- { $has: { $location: 'method', $value: 'GET' } },
68
- ],
69
- $else: {
70
- $has: { $location: 'body', $path: 'foo.1.test.0', $regExp: /^2/ },
71
- },
72
- };
73
- expect((0, if_operator_1.default)('validation', schema, (0, __utils__1.buildExpectationContext)(), { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeFalsy();
74
- });
75
- });
76
- describe('manipulation mode', () => {
77
- it('should manipulate by schema with conplex condition', () => {
78
- const context = (0, __utils__1.buildExpectationContext)();
79
- const schema = {
80
- $or: [
81
- { $if: {} },
82
- { $has: { $location: 'path', $regExp: /^\/bar/ } },
83
- { $has: { $location: 'method', $value: 'POST' } },
84
- ],
85
- $then: {
86
- $and: [
87
- { $set: { $location: 'headers', $path: 'content-length', $value: 100 } },
88
- { $set: { $location: 'query', $path: 'bar.baz', $value: { test: true } } },
89
- ],
90
- },
91
- };
92
- expect((0, if_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
93
- expect(context.headers?.['content-length']).toEqual(100);
94
- expect(context.query?.bar?.baz?.test).toBeTruthy();
95
- });
96
- });
97
- });
98
- //# sourceMappingURL=if.operator.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"if.operator.spec.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/if.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,sFAAsF,EAAE,GAAG,EAAE;YAC9F,MAAM,MAAM,GAAmC;gBAC7C,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE;gBAC9C,KAAK,EAAE,EAAE,IAAI,EAAE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O,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAiD;AAAxC,qHAAA,OAAO,OAAQ;AACxB,6CAA+C;AAAtC,mHAAA,OAAO,OAAO;AACvB,+CAAiD;AAAxC,qHAAA,OAAO,OAAQ;AACxB,6CAA+C;AAAtC,mHAAA,OAAO,OAAO;AACvB,+CAAiD;AAAxC,qHAAA,OAAO,OAAQ;AACxB,+CAAiD;AAAxC,qHAAA,OAAO,OAAQ;AACxB,mDAAqD;AAA5C,yHAAA,OAAO,OAAU;AAC1B,qDAAuD;AAA9C,2HAAA,OAAO,OAAW;AAC3B,iDAAmD;AAA1C,uHAAA,OAAO,OAAS"}
@@ -1,3 +0,0 @@
1
- declare const _default: import("..").TExpectationOperatorHandler<"$merge">;
2
- export default _default;
3
- //# sourceMappingURL=merge.operator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge.operator.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/merge.operator.ts"],"names":[],"mappings":";AAMA,wBA6BG"}
@@ -1,30 +0,0 @@
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
- const lodash_1 = __importDefault(require("lodash"));
7
- const deepmerge_1 = __importDefault(require("deepmerge"));
8
- const utils_1 = require("./utils");
9
- const utils_2 = require("../../../utils");
10
- exports.default = (0, utils_1.buildExpectationOperatorHandler)((mode, schema, context) => {
11
- if (mode !== 'manipulation' || !schema.$location || schema.$value === undefined) {
12
- return true;
13
- }
14
- const payload = (0, utils_1.extractContextPayloadSegment)(schema.$location, context);
15
- if (payload?.type !== 'object') {
16
- return true;
17
- }
18
- if (schema.$path) {
19
- lodash_1.default.set(payload.value, schema.$path, (0, deepmerge_1.default)(lodash_1.default.get(payload.value, schema.$path), schema.$value ?? {}));
20
- return true;
21
- }
22
- if (schema.$jsonPath) {
23
- (0, utils_2.extractByJsonPathSafe)({ path: schema.$jsonPath, json: payload.value })
24
- .results?.forEach((segment) => lodash_1.default.set(payload.value, segment.pointer.substring(1).replace(/\//g, '.'), (0, deepmerge_1.default)(lodash_1.default.get(segment.parent, segment.parentProperty), schema.$value ?? {})));
25
- return true;
26
- }
27
- lodash_1.default.set(payload.parent, payload.key, (0, deepmerge_1.default)(payload.value, schema.$value ?? {}));
28
- return true;
29
- });
30
- //# sourceMappingURL=merge.operator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge.operator.js","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/merge.operator.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AACvB,0DAA8B;AAE9B,mCAAwF;AACxF,0CAAuD;AAEvD,kBAAe,IAAA,uCAA+B,EAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IACjF,IAAI,IAAI,KAAK,cAAc,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE;QAC/E,OAAO,IAAI,CAAC;KACb;IAED,MAAM,OAAO,GAAG,IAAA,oCAA4B,EAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACxE,IAAI,OAAO,EAAE,IAAI,KAAK,QAAQ,EAAE;QAC9B,OAAO,IAAI,CAAC;KACb;IAED,IAAI,MAAM,CAAC,KAAK,EAAE;QAChB,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAA,mBAAK,EAAC,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;QACnG,OAAO,IAAI,CAAC;KACb;IACD,IAAI,MAAM,CAAC,SAAS,EAAE;QACpB,IAAA,6BAAqB,EAAC,EAAE,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;aACnE,OAAO,EAAE,OAAO,CACf,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAC,CAAC,GAAG,CAChB,OAAO,CAAC,KAAK,EACb,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAChD,IAAA,mBAAK,EAAC,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAC1E,CACF,CAAC;QAEJ,OAAO,IAAI,CAAC;KACb;IAED,gBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAAA,mBAAK,EAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge.operator.spec.d.ts","sourceRoot":"","sources":["../../../../../src/server/expectations/operators/merge.operator.spec.ts"],"names":[],"mappings":""}
@@ -1,55 +0,0 @@
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
- const __utils__1 = require("../__utils__");
7
- const utils_1 = require("../utils");
8
- const merge_operator_1 = __importDefault(require("./merge.operator"));
9
- describe('Expectations.Operators.Merge', () => {
10
- it('should handle invalid payload', () => {
11
- const schema = { $location: 'query' };
12
- expect((0, merge_operator_1.default)('manipulation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
13
- });
14
- it('should handle schema without location', () => {
15
- expect((0, merge_operator_1.default)('manipulation', {}, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
16
- });
17
- it('should handle schema with non object payload', () => {
18
- const schema = {
19
- $location: 'path',
20
- $value: true,
21
- };
22
- expect((0, merge_operator_1.default)('manipulation', schema, {}, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
23
- });
24
- it('should manipulate by schema', () => {
25
- const context = (0, __utils__1.buildExpectationContext)();
26
- const schema = {
27
- $location: 'query',
28
- $value: { test: true },
29
- };
30
- expect((0, merge_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
31
- expect(context.query.test).toBeTruthy();
32
- });
33
- it('should manipulate by schema using path', () => {
34
- const context = (0, __utils__1.buildExpectationContext)();
35
- const schema = {
36
- $location: 'query',
37
- $path: 'bar',
38
- $value: { test: true },
39
- };
40
- expect((0, merge_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
41
- expect(context.query.bar.test).toBeTruthy();
42
- });
43
- it('should manipulate by schema using jsonPath', () => {
44
- const context = (0, __utils__1.buildExpectationContext)();
45
- const schema = {
46
- $location: 'body',
47
- $jsonPath: '$.foo[*]',
48
- $value: { test: true },
49
- };
50
- expect((0, merge_operator_1.default)('manipulation', schema, context, { exploreNestedSchema: utils_1.exploreNestedExpectationSchema })).toBeTruthy();
51
- expect(context.body.foo[0].test).toBeTruthy();
52
- expect(context.body.foo[1].test).toBeTruthy();
53
- });
54
- });
55
- //# sourceMappingURL=merge.operator.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"merge.operator.spec.js","sourceRoot":"","sources":["../../../../../src/server/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,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IACtH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,MAAM,GAAmC;YAC7C,SAAS,EAAE,MAAM;YACjB,MAAM,EAAE,IAAI;SACb,CAAC;QAEF,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,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,OAAO,GAAG,IAAA,kCAAuB,GAAE,CAAA;QACzC,MAAM,MAAM,GAAmC;YAC7C,SAAS,EAAE,OAAO;YAClB,MAAM,EAAE,EAA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