@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectations.delete.method.js","sourceRoot":"","sources":["../../../../src/client/methods/expectations.delete.method.ts"],"names":[],"mappings":";;AAAA,oCAA8C;AAC9C,sCAAyC;AAEzC,uCAAmC;AAEnC,kBAAe,qBAAY;KACxB,KAAK,EAAsF;KAC3F,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IAC9C,MAAM,QAAQ;SACX,OAAO,CAA8C;QACpD,IAAI,EAAE,IAAI;QAEV,GAAG,IAAA,YAAI,EAA8C;YACnD,GAAG,EAAE,qBAAqB;YAC1B,MAAM,EAAE,QAAQ;SACjB,CAAC;KACH,CAAC;SACD,KAAK,CAAC,0BAAkB,CAAC,CAAC;IAE7B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;KACD,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IAC7C,IAAI,EAAE,GAAG;QACP,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACnE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAEzC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ClientMethod } from '../models';
2
+ import { Expectation } from '../../expectations';
3
+ declare const _default: ClientMethod<Pick<Expectation<{}>, "name" | "type" | "schema" | "id" | "isEnabled" | "meta"> | null, {
4
+ id: string;
5
+ set: Partial<Omit<import("../../expectations").TBuildExpectationConfiguration<any>, "type">>;
6
+ }>;
7
+ export default _default;
8
+ //# sourceMappingURL=expectations.update.method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectations.update.method.d.ts","sourceRoot":"","sources":["../../../../src/client/methods/expectations.update.method.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;;;;;AAIjD,wBAoCK"}
@@ -0,0 +1,44 @@
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 deepmerge_1 = __importDefault(require("deepmerge"));
7
+ const utils_1 = require("../utils");
8
+ const utils_2 = require("../utils");
9
+ const errors_1 = require("../errors");
10
+ const models_1 = require("../models");
11
+ const expectations_1 = require("../../expectations");
12
+ const utils_3 = require("../../utils");
13
+ exports.default = models_1.ClientMethod
14
+ .build()
15
+ .provide('remote', (instance) => async (body) => {
16
+ const response = await instance
17
+ .request({
18
+ data: {
19
+ id: body.id,
20
+ body: (0, utils_1.prepareExpectationBodyToRequest)(body.set),
21
+ },
22
+ ...(0, utils_3.cast)({
23
+ url: '/_mock/expectations',
24
+ method: 'PUT',
25
+ }),
26
+ })
27
+ .catch(utils_2.handleRequestError);
28
+ return response.data.data;
29
+ })
30
+ .provide('onsite', (context) => async (body) => {
31
+ const found = context.storage.expectations.get(body.id);
32
+ if (!found) {
33
+ return null;
34
+ }
35
+ const updated = expectations_1.Expectation.build((0, deepmerge_1.default)(found.toPlain(), body.set ?? {}));
36
+ const errors = updated.validate();
37
+ if (errors.length) {
38
+ throw new errors_1.ValidationError({}, errors);
39
+ }
40
+ context.storage.expectations.set(body.id, updated);
41
+ context.exchange.ws.publish('expectation:updated', updated);
42
+ return updated.toPlain();
43
+ });
44
+ //# sourceMappingURL=expectations.update.method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectations.update.method.js","sourceRoot":"","sources":["../../../../src/client/methods/expectations.update.method.ts"],"names":[],"mappings":";;;;;AAAA,0DAA8B;AAE9B,oCAA2D;AAC3D,oCAA8C;AAC9C,sCAA4C;AAC5C,sCAAyC;AACzC,qDAAiD;AAEjD,uCAAmC;AAEnC,kBAAe,qBAAY;KACxB,KAAK,EAA6F;KAClG,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IAC9C,MAAM,QAAQ,GAAG,MAAM,QAAQ;SAC5B,OAAO,CAA8C;QACpD,IAAI,EAAE;YACJ,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAA,uCAA+B,EAAC,IAAI,CAAC,GAAG,CAAC;SAChD;QAED,GAAG,IAAA,YAAI,EAA8C;YACnD,GAAG,EAAE,qBAAqB;YAC1B,MAAM,EAAE,KAAK;SACd,CAAC;KACH,CAAC;SACD,KAAK,CAAC,0BAAkB,CAAC,CAAC;IAE7B,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;AAC5B,CAAC,CAAC;KACD,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,0BAAW,CAAC,KAAK,CAAC,IAAA,mBAAK,EAAC,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;IAE1E,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAClC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,IAAI,wBAAe,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IAE5D,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AAC3B,CAAC,CAAC,CAAC"}
@@ -1,2 +1,5 @@
1
- export * from './expectations';
1
+ export { default as createExpectation } from './expectations.create.method';
2
+ export { default as updateExpectation } from './expectations.update.method';
3
+ export { default as deleteExpectations } from './expectations.delete.method';
4
+ export { default as ping } from './ping.method';
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/methods/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/methods/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,eAAe,CAAC"}
@@ -1,18 +1,15 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
5
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./expectations"), exports);
6
+ exports.ping = exports.deleteExpectations = exports.updateExpectation = exports.createExpectation = void 0;
7
+ var expectations_create_method_1 = require("./expectations.create.method");
8
+ Object.defineProperty(exports, "createExpectation", { enumerable: true, get: function () { return __importDefault(expectations_create_method_1).default; } });
9
+ var expectations_update_method_1 = require("./expectations.update.method");
10
+ Object.defineProperty(exports, "updateExpectation", { enumerable: true, get: function () { return __importDefault(expectations_update_method_1).default; } });
11
+ var expectations_delete_method_1 = require("./expectations.delete.method");
12
+ Object.defineProperty(exports, "deleteExpectations", { enumerable: true, get: function () { return __importDefault(expectations_delete_method_1).default; } });
13
+ var ping_method_1 = require("./ping.method");
14
+ Object.defineProperty(exports, "ping", { enumerable: true, get: function () { return __importDefault(ping_method_1).default; } });
18
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/methods/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/methods/index.ts"],"names":[],"mappings":";;;;;;AAAA,2EAA4E;AAAnE,gJAAA,OAAO,OAAqB;AACrC,2EAA4E;AAAnE,gJAAA,OAAO,OAAqB;AACrC,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,6CAAgD;AAAvC,oHAAA,OAAO,OAAQ"}
@@ -0,0 +1,4 @@
1
+ import { ClientMethod } from '../models';
2
+ declare const _default: ClientMethod<"pong", void>;
3
+ export default _default;
4
+ //# sourceMappingURL=ping.method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping.method.d.ts","sourceRoot":"","sources":["../../../../src/client/methods/ping.method.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;;AAIzC,wBAgBK"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const models_1 = require("../models");
5
+ const utils_2 = require("../../utils");
6
+ exports.default = models_1.ClientMethod
7
+ .build()
8
+ .provide('remote', (instance) => async () => {
9
+ const response = await instance
10
+ .request({
11
+ ...(0, utils_2.cast)({
12
+ url: '/_mock/ping',
13
+ method: 'GET',
14
+ }),
15
+ })
16
+ .catch(utils_1.handleRequestError);
17
+ return response.data.data;
18
+ })
19
+ .provide('onsite', (context) => async () => {
20
+ return 'pong';
21
+ });
22
+ //# sourceMappingURL=ping.method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping.method.js","sourceRoot":"","sources":["../../../../src/client/methods/ping.method.ts"],"names":[],"mappings":";;AAAA,oCAA8C;AAC9C,sCAAyC;AAEzC,uCAAmC;AAEnC,kBAAe,qBAAY;KACxB,KAAK,EAAsC;KAC3C,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE;IAC1C,MAAM,QAAQ,GAAG,MAAM,QAAQ;SAC5B,OAAO,CAAiC;QACvC,GAAG,IAAA,YAAI,EAAiC;YACtC,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,KAAK;SACd,CAAC;KACH,CAAC;SACD,KAAK,CAAC,0BAAkB,CAAC,CAAC;IAE7B,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;AAC5B,CAAC,CAAC;KACD,OAAO,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE;IACzC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { IExpectationOperatorContext, TBuildExpectationConfiguration } from '../../expectations';
2
+ import type { TMethodsSchema } from '../types';
3
+ import { ICompiledExpectationOperators } from '../helpers';
4
+ interface IExpectationHandlerContext<T extends PartialDeep<IExpectationOperatorContext>> {
5
+ $: ICompiledExpectationOperators<T>;
6
+ T: <T>(payload: T) => T extends TFunction<any, any[]> ? TFunction<any, any[]> : T;
7
+ }
8
+ interface IUnknownExpectationContext {
9
+ incoming: IExpectationOperatorContext['incoming'] & {
10
+ headers: any;
11
+ query: any;
12
+ body: any;
13
+ };
14
+ outgoing?: IExpectationOperatorContext['outgoing'] & {
15
+ headers: any;
16
+ data: any;
17
+ };
18
+ }
19
+ export declare class Client {
20
+ protected methods: TMethodsSchema;
21
+ constructor(methods: TMethodsSchema);
22
+ get ping(): TFunction<Promise<"pong">, [void]>;
23
+ get deleteExpectations(): TFunction<Promise<null>, [void | {
24
+ ids?: string[];
25
+ }]>;
26
+ createExpectation<T extends PartialDeep<IExpectationOperatorContext> = {}>(predicate: TBuildExpectationConfiguration<IUnknownExpectationContext> | TFunction<TBuildExpectationConfiguration<any>, [
27
+ IExpectationHandlerContext<T>
28
+ ]>): ReturnType<TMethodsSchema['createExpectation']>;
29
+ updateExpectation<T extends Partial<IExpectationOperatorContext>>(predicate: {
30
+ id: string;
31
+ set: Partial<Omit<TBuildExpectationConfiguration, 'type'>>;
32
+ } | TFunction<{
33
+ id: string;
34
+ set: Partial<Omit<TBuildExpectationConfiguration<any>, 'type'>>;
35
+ }, [
36
+ IExpectationHandlerContext<T>
37
+ ]>): ReturnType<TMethodsSchema['updateExpectation']>;
38
+ }
39
+ export {};
40
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/client/models/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAA+B,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAExF,UAAU,0BAA0B,CAAC,CAAC,SAAS,WAAW,CAAC,2BAA2B,CAAC;IACrF,CAAC,EAAE,6BAA6B,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;CACnF;AAED,UAAU,0BAA0B;IAClC,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,GAAG;QAClD,OAAO,EAAE,GAAG,CAAC;QACb,KAAK,EAAE,GAAG,CAAC;QACX,IAAI,EAAE,GAAG,CAAC;KACX,CAAC;IAEF,QAAQ,CAAC,EAAE,2BAA2B,CAAC,UAAU,CAAC,GAAG;QACnD,OAAO,EAAE,GAAG,CAAC;QACb,IAAI,EAAE,GAAG,CAAC;KACX,CAAC;CACH;AAED,qBAAa,MAAM;IACL,SAAS,CAAC,OAAO,EAAE,cAAc;gBAAvB,OAAO,EAAE,cAAc;IAE7C,IAAW,IAAI,uCAEd;IAED,IAAW,kBAAkB;;QAE5B;IAEM,iBAAiB,CAAC,CAAC,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,EAC9E,SAAS,EAAE,8BAA8B,CAAC,0BAA0B,CAAC,GAAG,SAAS,CAC/E,8BAA8B,CAAC,GAAG,CAAC,EACnC;QAAC,0BAA0B,CAAC,CAAC,CAAC;KAAC,CAChC,GACA,UAAU,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;IAS3C,iBAAiB,CAAC,CAAC,SAAS,OAAO,CAAC,2BAA2B,CAAC,EACrE,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,MAAM,CAAC,CAAC,CAAA;KAAE,GAAG,SAAS,CAC/F;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;KAAE,EAC/E;QAAC,0BAA0B,CAAC,CAAC,CAAC;KAAC,CAChC,GACA,UAAU,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;CAQnD"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Client = void 0;
4
+ const helpers_1 = require("../helpers");
5
+ class Client {
6
+ constructor(methods) {
7
+ this.methods = methods;
8
+ }
9
+ get ping() {
10
+ return this.methods.ping;
11
+ }
12
+ get deleteExpectations() {
13
+ return this.methods.deleteExpectations;
14
+ }
15
+ createExpectation(predicate) {
16
+ return typeof predicate === 'function'
17
+ ? this.methods.createExpectation(predicate({
18
+ $: (0, helpers_1.compileExpectationOperators)(),
19
+ T: (payload) => payload,
20
+ }))
21
+ : this.methods.createExpectation(predicate);
22
+ }
23
+ updateExpectation(predicate) {
24
+ return typeof predicate === 'function'
25
+ ? this.methods.updateExpectation(predicate({
26
+ $: (0, helpers_1.compileExpectationOperators)(),
27
+ T: (payload) => payload,
28
+ }))
29
+ : this.methods.updateExpectation(predicate);
30
+ }
31
+ }
32
+ exports.Client = Client;
33
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/client/models/client.ts"],"names":[],"mappings":";;;AAGA,wCAAwF;AAoBxF,MAAa,MAAM;IACjB,YAAsB,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAAG,CAAC;IAEjD,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,IAAW,kBAAkB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACzC,CAAC;IAEM,iBAAiB,CACtB,SAGC;QAED,OAAO,OAAO,SAAS,KAAK,UAAU;YACpC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC;gBACzC,CAAC,EAAE,IAAA,qCAA2B,GAAK;gBACnC,CAAC,EAAE,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO;aAC7B,CAAC,CAAC;YACH,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAEM,iBAAiB,CACtB,SAGC;QAED,OAAO,OAAO,SAAS,KAAK,UAAU;YACpC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC;gBACzC,CAAC,EAAE,IAAA,qCAA2B,GAAK;gBACnC,CAAC,EAAE,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO;aAC7B,CAAC,CAAC;YACH,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;CACF;AAtCD,wBAsCC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.spec.d.ts","sourceRoot":"","sources":["../../../../src/client/models/client.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const expectations_1 = require("../../expectations");
4
+ const utils_1 = require("../utils");
5
+ const client_1 = require("./client");
6
+ const buildClient = () => new client_1.Client({
7
+ ping: () => Promise.resolve('pong'),
8
+ deleteExpectations: () => Promise.resolve(null),
9
+ createExpectation: (configuration) => Promise.resolve((0, utils_1.prepareExpectationBodyToRequest)(Object.assign(expectations_1.Expectation.build(configuration).toPlain(), {
10
+ id: '12426262-85a3-4340-969b-272e003722e9',
11
+ name: 'MaliciousCobra',
12
+ }))),
13
+ updateExpectation: ({ id, set }) => Promise.resolve((0, utils_1.prepareExpectationBodyToRequest)(Object.assign(expectations_1.Expectation.build({ ...set, schema: set.schema ?? {} }).toPlain(), { id }))),
14
+ });
15
+ describe('Client.Models.Client', () => {
16
+ it('should create expectation with complex schema as object', async () => {
17
+ const client = buildClient();
18
+ await expect(client.createExpectation({
19
+ schema: {
20
+ request: {
21
+ $and: [
22
+ { $has: { $location: 'path', $value: '/foo' } },
23
+ { $has: { $location: 'path', $valueAnyOf: ['/foo', '/foo/bar'] } },
24
+ { $has: { $location: 'path', $match: '/foo/*' } },
25
+ { $has: { $location: 'path', $matchAnyOf: ['/foo/*', '*/bar'] } },
26
+ { $has: { $location: 'path', $regExp: /^\/foo/ } },
27
+ { $has: { $location: 'path', $regExpAnyOf: [/^\/foo$/, /^\/foo\/bar$/] } },
28
+ { $has: { $location: 'path', $exec: (payload) => payload.includes('/foo') } },
29
+ { $has: { $location: 'path', $path: '/foo', $value: '/foo' } },
30
+ { $has: { $location: 'path', $path: '/foo', $valueAnyOf: ['/foo', '/foo/bar'] } },
31
+ { $has: { $location: 'path', $path: '/foo', $match: '/foo/*' } },
32
+ { $has: { $location: 'path', $path: '/foo', $matchAnyOf: ['/foo/*', '*/bar'] } },
33
+ { $has: { $location: 'path', $path: '/foo', $regExp: /^\/foo/ } },
34
+ { $has: { $location: 'path', $path: '/foo', $regExpAnyOf: [/^\/foo$/, /^\/foo\/bar$/] } },
35
+ { $has: { $location: 'path', $path: '/foo', $exec: (payload) => payload.includes('/foo') } },
36
+ { $has: { $location: 'incoming.query' } },
37
+ { $has: { $location: 'incoming.query', $value: { foo: 'a' } } },
38
+ { $has: { $location: 'incoming.query', $valueAnyOf: [{ foo: 'a' }, { foo: 'b' }] } },
39
+ { $has: { $location: 'incoming.query', $match: { foo: 'a' } } },
40
+ { $has: { $location: 'incoming.query', $matchAnyOf: [{ foo: 'a' }, { foo: 'b' }] } },
41
+ { $has: { $location: 'incoming.query', $exec: (payload, { T }) => T(payload)?.foo === 'a' } },
42
+ { $has: { $location: 'incoming.query', $path: 'foo', $value: 'a' } },
43
+ { $has: { $location: 'incoming.query', $path: 'foo', $valueAnyOf: ['a', 'b'] } },
44
+ { $has: { $location: 'incoming.query', $path: 'foo', $match: 'a' } },
45
+ { $has: { $location: 'incoming.query', $path: 'foo', $matchAnyOf: ['a', 'b'] } },
46
+ { $has: { $location: 'incoming.query', $path: 'foo', $regExp: /a|b/ } },
47
+ { $has: { $location: 'incoming.query', $path: 'foo', $regExpAnyOf: [/a/i, /b/i] } },
48
+ { $has: { $location: 'incoming.query', $path: 'foo', $exec: (payload) => payload === 'a' } },
49
+ { $has: { $location: 'incoming.body' } },
50
+ { $has: { $location: 'incoming.body', $value: { foo: 'a', bar: ['a'] } } },
51
+ { $has: { $location: 'incoming.body', $valueAnyOf: [{ foo: 'a', bar: ['a'] }, { bar: ['b'] }, { baz: {} }] } },
52
+ { $has: { $location: 'incoming.body', $match: { foo: 'a', baz: { foo: 1 } } } },
53
+ { $has: { $location: 'incoming.body', $matchAnyOf: [{ baz: {} }, { bar: [] }] } },
54
+ { $has: { $location: 'incoming.body', $exec: (payload, { T }) => T(payload)?.baz?.foo === 1 } },
55
+ { $has: { $location: 'incoming.body', $path: 'baz', $value: { foo: 1, bar: 1 } } },
56
+ { $has: { $location: 'incoming.body', $path: 'baz', $valueAnyOf: [{ foo: 1 }, { bar: 1 }] } },
57
+ { $has: { $location: 'incoming.body', $path: 'baz', $match: { foo: 1 } } },
58
+ { $has: { $location: 'incoming.body', $path: 'baz', $matchAnyOf: [{}, { foo: '1' }] } },
59
+ { $has: { $location: 'incoming.body', $path: 'baz', $exec: (payload, { T }) => T(payload)?.foo === 1 } },
60
+ { $has: { $location: 'incoming.body', $path: 'baz.baz', $value: [1] } },
61
+ { $has: { $location: 'incoming.body', $path: 'baz.baz', $valueAnyOf: [[1], [1, 2]] } },
62
+ { $has: { $location: 'incoming.body', $path: 'baz.baz', $match: '*' } },
63
+ { $has: { $location: 'incoming.body', $path: 'baz.baz', $matchAnyOf: ['1', '2'] } },
64
+ { $has: { $location: 'incoming.body', $path: 'baz.baz', $regExp: /1/ } },
65
+ { $has: { $location: 'incoming.body', $path: 'baz.baz', $regExpAnyOf: [/1/, /2/] } },
66
+ { $has: { $location: 'incoming.body', $path: 'baz.baz', $exec: (payload) => payload === 1 } },
67
+ ],
68
+ },
69
+ response: {
70
+ $or: [
71
+ {
72
+ $switch: {
73
+ $location: 'outgoing.status',
74
+ $cases: {
75
+ 200: {
76
+ $and: [
77
+ { $set: { $location: 'outgoing.data', $value: {} } },
78
+ { $set: { $location: 'outgoing.data', $path: 'foo', $value: 'a' } },
79
+ { $set: { $location: 'outgoing.headers', $exec: () => ({}) } },
80
+ { $set: { $location: 'outgoing.headers', $path: 'foo', $value: 'bar' } },
81
+ ],
82
+ },
83
+ },
84
+ $default: { $set: { $location: 'outgoing.data', $value: {} } },
85
+ },
86
+ },
87
+ {
88
+ $switch: {
89
+ $location: 'outgoing.data',
90
+ $path: 'baz.bar',
91
+ $cases: {
92
+ 1: {
93
+ $and: [
94
+ { $merge: { $location: 'outgoing.data', $value: {} } },
95
+ { $remove: { $location: 'outgoing.data', $path: 'foo' } },
96
+ ],
97
+ },
98
+ },
99
+ },
100
+ },
101
+ {
102
+ $switch: {
103
+ $location: 'outgoing.headers',
104
+ $exec: (payload) => payload.foo,
105
+ $cases: {
106
+ 'a': {
107
+ $and: [{
108
+ $exec: ({ context }) => {
109
+ if (context.incoming.body?.foo === 'a') {
110
+ context.outgoing.status = 200;
111
+ }
112
+ },
113
+ }],
114
+ },
115
+ },
116
+ },
117
+ },
118
+ ],
119
+ },
120
+ },
121
+ })).resolves.toMatchSnapshot();
122
+ });
123
+ it('should create expectation with complex schema as function', async () => {
124
+ const client = buildClient();
125
+ await expect(client.createExpectation(({ $ }) => ({
126
+ schema: {
127
+ request: $.and([
128
+ $.has('path', { $value: '/foo' }),
129
+ $.has('path', { $valueAnyOf: ['/foo', '/foo/bar'] }),
130
+ $.has('path', { $match: '/foo/*' }),
131
+ $.has('path', { $matchAnyOf: ['/foo/*', '*/bar'] }),
132
+ $.has('path', { $regExp: /^\/foo/ }),
133
+ $.has('path', { $regExpAnyOf: [/^\/foo$/, /^\/foo\/bar$/] }),
134
+ $.has('path', { $exec: (payload) => payload.includes('/foo') }),
135
+ $.has('path', '$path', '/foo', { $value: '/foo' }),
136
+ $.has('path', '$path', '/foo', { $valueAnyOf: ['/foo', '/foo/bar'] }),
137
+ $.has('path', '$path', '/foo', { $match: '/foo/*' }),
138
+ $.has('path', '$path', '/foo', { $matchAnyOf: ['/foo/*', '*/bar'] }),
139
+ $.has('path', '$path', '/foo', { $regExp: /^\/foo/ }),
140
+ $.has('path', '$path', '/foo', { $regExpAnyOf: [/^\/foo$/, /^\/foo\/bar$/] }),
141
+ $.has('path', '$path', '/foo', { $exec: (payload) => payload.includes('/foo') }),
142
+ $.has('incoming.query', {}),
143
+ $.has('incoming.query', '$path', 'foo'),
144
+ $.has('incoming.query', { $value: { foo: 'a', bar: 'a' } }),
145
+ $.has('incoming.query', { $valueAnyOf: [{ foo: 'a', bar: 'a' }, { foo: 'b', bar: 'b' }] }),
146
+ $.has('incoming.query', { $match: { foo: 'a' } }),
147
+ $.has('incoming.query', { $matchAnyOf: [{ foo: 'a' }, { foo: 'b' }] }),
148
+ $.has('incoming.query', { $exec: (payload) => payload?.foo === 'a' }),
149
+ $.has('incoming.query', '$path', 'foo', { $value: 'a' }),
150
+ $.has('incoming.query', '$path', 'foo', { $valueAnyOf: ['a', 'b'] }),
151
+ $.has('incoming.query', '$path', 'foo', { $match: 'a' }),
152
+ $.has('incoming.query', '$path', 'foo', { $matchAnyOf: ['a', 'b'] }),
153
+ $.has('incoming.query', '$path', 'foo', { $regExp: /a|b/ }),
154
+ $.has('incoming.query', '$path', 'foo', { $regExpAnyOf: [/a/i, /b/i] }),
155
+ $.has('incoming.query', '$path', 'foo', { $exec: (payload) => payload === 'a' }),
156
+ $.has('incoming.body', {}),
157
+ $.has('incoming.body', { $value: { foo: 'a', bar: ['a'] } }),
158
+ $.has('incoming.body', { $valueAnyOf: [{ foo: 'a', bar: ['a'] }, { bar: ['b'] }, { baz: {} }] }),
159
+ $.has('incoming.body', { $match: { foo: 'a', baz: { foo: 1 } } }),
160
+ $.has('incoming.body', { $matchAnyOf: [{ baz: {} }, { bar: [] }] }),
161
+ $.has('incoming.body', { $exec: (payload) => payload?.baz?.foo === 1 }),
162
+ $.has('incoming.body', '$path', 'baz', { $value: { foo: 1, bar: 1 } }),
163
+ $.has('incoming.body', '$path', 'baz', { $valueAnyOf: [{ foo: 1 }, { foo: 1, bar: 1 }] }),
164
+ $.has('incoming.body', '$path', 'baz', { $match: { foo: 1 } }),
165
+ $.has('incoming.body', '$path', 'baz', { $matchAnyOf: [{}, { foo: 1 }] }),
166
+ $.has('incoming.body', '$path', 'baz', { $exec: (payload) => payload?.foo === 1 }),
167
+ $.has('incoming.body', '$jsonPath', '123.123.213', {
168
+ $match: {},
169
+ }),
170
+ $.has('incoming.body', '$path', 'baz.baz', { $value: [1] }),
171
+ $.has('incoming.body', '$path', 'baz.baz', { $valueAnyOf: [[1], [1, 2]] }),
172
+ $.has('incoming.body', '$path', 'baz.baz.0', { $match: '*' }),
173
+ $.has('incoming.body', '$path', 'baz.baz.0', { $matchAnyOf: ['1', '2'] }),
174
+ $.has('incoming.body', '$path', 'baz.baz', { $regExp: /1/ }),
175
+ $.has('incoming.body', '$path', 'baz.baz', { $regExpAnyOf: [/1/, /2/] }),
176
+ $.has('incoming.body', '$path', 'baz.baz', { $exec: (payload) => payload?.[0] === 1 }),
177
+ ]),
178
+ response: $.or([
179
+ $.switch('outgoing.status', {
180
+ $cases: {
181
+ 200: $.and([
182
+ $.set('outgoing.data', { $value: {} }),
183
+ $.set('outgoing.data', '$path', 'foo', { $value: 'a' }),
184
+ $.set('outgoing.headers', { $exec: () => ({}) }),
185
+ $.set('outgoing.headers', '$path', 'foo', { $value: 'bar' }),
186
+ ]),
187
+ },
188
+ $default: $.set('outgoing.data', { $value: {} }),
189
+ }),
190
+ $.switch('incoming.body', '$path', 'baz.bar', {
191
+ $cases: {
192
+ 1: $.and([
193
+ $.merge('outgoing.data', { $value: {} }),
194
+ $.remove('outgoing.data', '$path', 'foo'),
195
+ ]),
196
+ },
197
+ }),
198
+ $.switch('incoming.body', '$exec', (payload) => payload.baz.bar, {
199
+ $cases: {
200
+ 1: $.and([]),
201
+ },
202
+ }),
203
+ $.switch('outgoing.headers', '$exec', (payload) => payload.foo, {
204
+ $cases: {
205
+ 'a': $.and([
206
+ $.exec(({ context }) => {
207
+ if (context.incoming.body.foo === 'a') {
208
+ context.outgoing.status = 200;
209
+ }
210
+ }),
211
+ ]),
212
+ },
213
+ }),
214
+ ]),
215
+ },
216
+ }))).resolves.toMatchSnapshot();
217
+ });
218
+ });
219
+ //# sourceMappingURL=client.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.spec.js","sourceRoot":"","sources":["../../../../src/client/models/client.spec.ts"],"names":[],"mappings":";;AAAA,qDAAiD;AACjD,oCAA2D;AAC3D,qCAAkC;AAsBlC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,eAAM,CAAC;IACnC,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;IACnC,kBAAkB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;IAE/C,iBAAiB,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CACnD,IAAA,uCAA+B,EAC7B,MAAM,CAAC,MAAM,CAAC,0BAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,EAAE;QACxD,EAAE,EAAE,sCAAsC;QAC1C,IAAI,EAAE,gBAAgB;KACvB,CAAC,CACH,CACF;IAED,iBAAiB,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CACjD,IAAA,uCAA+B,EAC7B,MAAM,CAAC,MAAM,CAAC,0BAAW,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CACzF,CACF;CACF,CAAC,CAAC;AAEH,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;QACvE,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;QAE7B,MAAM,MAAM,CACV,MAAM,CAAC,iBAAiB,CAAC;YACvB,MAAM,EAAE;gBACN,OAAO,EAAE;oBACP,IAAI,EAAE;wBACJ,EAAE,I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,eAAe,EAAE,OAAO,EAAE,KAAK,CAAC;6BAC1C,CAAC;yBACH;qBACF,CAAC;oBAEF,CAAC,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE;wBAC/D,MAAM,EAAE;4BACN,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;yBACb;qBACF,CAAC;oBAEF,CAAC,CAAC,MAAM,CAAC,kBAAkB,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;wBAC9D,MAAM,EAAE;4BACN,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC;gCACT,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;oCACrB,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;wCACtC,OAAO,CAAC,QAAS,CAAC,MAAM,GAAG,GAAG,CAAC;oCACjC,CAAC;gCACH,CAAC,CAAC;6BACH,CAAC;yBACH;qBACF,CAAC;iBACH,CAAC;aACH;SACF,CAAC,CAAC,CACJ,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './method';
2
+ export * from './client';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./method"), exports);
18
+ __exportStar(require("./client"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB"}
@@ -0,0 +1,17 @@
1
+ import type { AxiosInstance } from 'axios';
2
+ import type { ServerContext } from '../../server/models';
3
+ type THandler<TContext, TResult, TBody> = (context: TContext) => (body: TBody) => Promise<TResult>;
4
+ export interface IClientMethodHandlers<TResult = void, TBody = void> {
5
+ remote: THandler<AxiosInstance, TResult, TBody>;
6
+ onsite: THandler<ServerContext, TResult, TBody>;
7
+ }
8
+ export declare class ClientMethod<TResult = void, TBody = void> {
9
+ TResult: TResult;
10
+ TBody: TBody;
11
+ private handlers;
12
+ provide<K extends keyof IClientMethodHandlers>(type: K, handler: IClientMethodHandlers<TResult, TBody>[K]): this;
13
+ compile<K extends keyof IClientMethodHandlers>(type: K, context: Parameters<IClientMethodHandlers<TResult, TBody>[K]>[0]): (body: TBody) => Promise<TResult>;
14
+ static build<TResult = void, TBody = void>(): ClientMethod<TResult, TBody>;
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method.d.ts","sourceRoot":"","sources":["../../../../src/client/models/method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,KAAK,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC,OAAO,EAAE,QAAQ,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEnG,MAAM,WAAW,qBAAqB,CAAC,OAAO,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI;IACjE,MAAM,EAAE,QAAQ,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAChD,MAAM,EAAE,QAAQ,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;CACjD;AAED,qBAAa,YAAY,CAAC,OAAO,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI;IAC7C,OAAO,EAAG,OAAO,CAAC;IAClB,KAAK,EAAG,KAAK,CAAC;IAErB,OAAO,CAAC,QAAQ,CAGb;IAEI,OAAO,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAClD,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAM5C,OAAO,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAClD,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,UAAU,CAAC,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAMlE,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI;CAG1C"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientMethod = void 0;
4
+ const utils_1 = require("../../utils");
5
+ class ClientMethod {
6
+ constructor() {
7
+ this.handlers = (0, utils_1.cast)({
8
+ remote: () => () => Promise.reject(new Error('Not implemented')),
9
+ onsite: () => () => Promise.reject(new Error('Not implemented')),
10
+ });
11
+ }
12
+ provide(type, handler) {
13
+ this.handlers[type] = handler;
14
+ return this;
15
+ }
16
+ compile(type, context) {
17
+ const handler = this.handlers[type];
18
+ return handler(context);
19
+ }
20
+ static build() {
21
+ return new ClientMethod();
22
+ }
23
+ }
24
+ exports.ClientMethod = ClientMethod;
25
+ //# sourceMappingURL=method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method.js","sourceRoot":"","sources":["../../../../src/client/models/method.ts"],"names":[],"mappings":";;;AAGA,uCAAmC;AASnC,MAAa,YAAY;IAAzB;QAIU,aAAQ,GAAG,IAAA,YAAI,EAAwC;YAC7D,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;YAChE,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;SACjE,CAAC,CAAC;IAqBL,CAAC;IAnBQ,OAAO,CACZ,IAAO,EACP,OAAiD;QAEjD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO,CACZ,IAAO,EACP,OAAgE;QAEhE,MAAM,OAAO,GAAkC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,YAAY,EAAkB,CAAC;IAC5C,CAAC;CACF;AA5BD,oCA4BC"}
@@ -0,0 +1,7 @@
1
+ import type { ServerContext } from '../server/models';
2
+ import { Client } from './models';
3
+ export declare class OnsiteClient extends Client {
4
+ constructor(context: ServerContext);
5
+ static build(context: ServerContext): OnsiteClient;
6
+ }
7
+ //# sourceMappingURL=onsite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onsite.d.ts","sourceRoot":"","sources":["../../../src/client/onsite.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,qBAAa,YAAa,SAAQ,MAAM;gBAC1B,OAAO,EAAE,aAAa;IAQlC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,aAAa;CAGpC"}