@n1k1t/mock-server 0.1.1 → 0.1.3

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 (373) hide show
  1. package/lib/package.json +5 -2
  2. package/lib/src/client/helpers/expectations.d.ts +89 -0
  3. package/lib/src/client/helpers/expectations.d.ts.map +1 -0
  4. package/lib/src/client/helpers/expectations.js +66 -0
  5. package/lib/src/client/helpers/expectations.js.map +1 -0
  6. package/lib/src/client/helpers/index.d.ts +2 -0
  7. package/lib/src/client/helpers/index.d.ts.map +1 -0
  8. package/lib/src/client/helpers/index.js +18 -0
  9. package/lib/src/client/helpers/index.js.map +1 -0
  10. package/lib/src/client/index.d.ts +1 -0
  11. package/lib/src/client/index.d.ts.map +1 -1
  12. package/lib/src/client/index.js +1 -0
  13. package/lib/src/client/index.js.map +1 -1
  14. package/lib/src/client/methods/expectations.create.method.d.ts +1 -3
  15. package/lib/src/client/methods/expectations.create.method.d.ts.map +1 -1
  16. package/lib/src/client/methods/expectations.create.method.js +3 -3
  17. package/lib/src/client/methods/expectations.create.method.js.map +1 -1
  18. package/lib/src/client/methods/expectations.update.method.d.ts +2 -2
  19. package/lib/src/client/methods/expectations.update.method.js +6 -6
  20. package/lib/src/client/methods/expectations.update.method.js.map +1 -1
  21. package/lib/src/client/methods/ping.method.d.ts +1 -1
  22. package/lib/src/client/methods/ping.method.js.map +1 -1
  23. package/lib/src/client/models/client.d.ts +40 -0
  24. package/lib/src/client/models/client.d.ts.map +1 -0
  25. package/lib/src/client/models/client.js +33 -0
  26. package/lib/src/client/models/client.js.map +1 -0
  27. package/lib/src/client/models/client.spec.d.ts +2 -0
  28. package/lib/src/client/models/client.spec.d.ts.map +1 -0
  29. package/lib/src/client/models/client.spec.js +224 -0
  30. package/lib/src/client/models/client.spec.js.map +1 -0
  31. package/lib/src/client/models/index.d.ts +1 -0
  32. package/lib/src/client/models/index.d.ts.map +1 -1
  33. package/lib/src/client/models/index.js +1 -0
  34. package/lib/src/client/models/index.js.map +1 -1
  35. package/lib/src/client/models/method.d.ts +4 -4
  36. package/lib/src/client/models/method.d.ts.map +1 -1
  37. package/lib/src/client/models/method.js.map +1 -1
  38. package/lib/src/client/onsite.d.ts +4 -3
  39. package/lib/src/client/onsite.d.ts.map +1 -1
  40. package/lib/src/client/onsite.js +8 -6
  41. package/lib/src/client/onsite.js.map +1 -1
  42. package/lib/src/client/remote.d.ts +4 -4
  43. package/lib/src/client/remote.d.ts.map +1 -1
  44. package/lib/src/client/remote.js +11 -10
  45. package/lib/src/client/remote.js.map +1 -1
  46. package/lib/src/client/types.d.ts +2 -0
  47. package/lib/src/client/types.d.ts.map +1 -1
  48. package/lib/src/client/utils.d.ts +2 -2
  49. package/lib/src/client/utils.d.ts.map +1 -1
  50. package/lib/src/client/utils.js +25 -12
  51. package/lib/src/client/utils.js.map +1 -1
  52. package/lib/src/expectations/__utils__/index.d.ts +2 -2
  53. package/lib/src/expectations/__utils__/index.d.ts.map +1 -1
  54. package/lib/src/expectations/__utils__/index.js +31 -23
  55. package/lib/src/expectations/__utils__/index.js.map +1 -1
  56. package/lib/src/expectations/index.d.ts +1 -2
  57. package/lib/src/expectations/index.d.ts.map +1 -1
  58. package/lib/src/expectations/index.js +1 -2
  59. package/lib/src/expectations/index.js.map +1 -1
  60. package/lib/src/expectations/models/expectation.d.ts +33 -0
  61. package/lib/src/expectations/models/expectation.d.ts.map +1 -0
  62. package/lib/src/expectations/models/expectation.js +81 -0
  63. package/lib/src/expectations/models/expectation.js.map +1 -0
  64. package/lib/src/expectations/models/index.d.ts +4 -0
  65. package/lib/src/expectations/models/index.d.ts.map +1 -0
  66. package/lib/src/expectations/models/index.js +20 -0
  67. package/lib/src/expectations/models/index.js.map +1 -0
  68. package/lib/src/expectations/models/operator.d.ts +20 -0
  69. package/lib/src/expectations/models/operator.d.ts.map +1 -0
  70. package/lib/src/expectations/models/operator.js +49 -0
  71. package/lib/src/expectations/models/operator.js.map +1 -0
  72. package/lib/src/expectations/models/storage.d.ts +15 -0
  73. package/lib/src/expectations/models/storage.d.ts.map +1 -0
  74. package/lib/src/expectations/{storage.js → models/storage.js} +4 -14
  75. package/lib/src/expectations/models/storage.js.map +1 -0
  76. package/lib/src/expectations/models/storage.spec.d.ts +2 -0
  77. package/lib/src/expectations/models/storage.spec.d.ts.map +1 -0
  78. package/lib/src/expectations/models/storage.spec.js +111 -0
  79. package/lib/src/expectations/models/storage.spec.js.map +1 -0
  80. package/lib/src/expectations/operators/and.operator.d.ts +7 -2
  81. package/lib/src/expectations/operators/and.operator.d.ts.map +1 -1
  82. package/lib/src/expectations/operators/and.operator.js +21 -2
  83. package/lib/src/expectations/operators/and.operator.js.map +1 -1
  84. package/lib/src/expectations/operators/and.operator.spec.js +57 -39
  85. package/lib/src/expectations/operators/and.operator.spec.js.map +1 -1
  86. package/lib/src/expectations/operators/exec.operator.d.ts +7 -2
  87. package/lib/src/expectations/operators/exec.operator.d.ts.map +1 -1
  88. package/lib/src/expectations/operators/exec.operator.js +14 -18
  89. package/lib/src/expectations/operators/exec.operator.js.map +1 -1
  90. package/lib/src/expectations/operators/exec.operator.spec.js +49 -18
  91. package/lib/src/expectations/operators/exec.operator.spec.js.map +1 -1
  92. package/lib/src/expectations/operators/has.operator.d.ts +27 -2
  93. package/lib/src/expectations/operators/has.operator.d.ts.map +1 -1
  94. package/lib/src/expectations/operators/has.operator.js +108 -69
  95. package/lib/src/expectations/operators/has.operator.js.map +1 -1
  96. package/lib/src/expectations/operators/has.operator.spec.js +422 -161
  97. package/lib/src/expectations/operators/has.operator.spec.js.map +1 -1
  98. package/lib/src/expectations/operators/if.operator.d.ts +15 -2
  99. package/lib/src/expectations/operators/if.operator.d.ts.map +1 -1
  100. package/lib/src/expectations/operators/if.operator.js +44 -10
  101. package/lib/src/expectations/operators/if.operator.js.map +1 -1
  102. package/lib/src/expectations/operators/if.operator.spec.js +89 -65
  103. package/lib/src/expectations/operators/if.operator.spec.js.map +1 -1
  104. package/lib/src/expectations/operators/index.d.ts +2 -0
  105. package/lib/src/expectations/operators/index.d.ts.map +1 -1
  106. package/lib/src/expectations/operators/index.js +5 -1
  107. package/lib/src/expectations/operators/index.js.map +1 -1
  108. package/lib/src/expectations/operators/merge.operator.d.ts +13 -2
  109. package/lib/src/expectations/operators/merge.operator.d.ts.map +1 -1
  110. package/lib/src/expectations/operators/merge.operator.js +23 -19
  111. package/lib/src/expectations/operators/merge.operator.js.map +1 -1
  112. package/lib/src/expectations/operators/merge.operator.spec.js +43 -33
  113. package/lib/src/expectations/operators/merge.operator.spec.js.map +1 -1
  114. package/lib/src/expectations/operators/not.operator.d.ts +7 -2
  115. package/lib/src/expectations/operators/not.operator.d.ts.map +1 -1
  116. package/lib/src/expectations/operators/not.operator.js +21 -2
  117. package/lib/src/expectations/operators/not.operator.js.map +1 -1
  118. package/lib/src/expectations/operators/not.operator.spec.js +28 -9
  119. package/lib/src/expectations/operators/not.operator.spec.js.map +1 -1
  120. package/lib/src/expectations/operators/or.operator.d.ts +7 -2
  121. package/lib/src/expectations/operators/or.operator.d.ts.map +1 -1
  122. package/lib/src/expectations/operators/or.operator.js +21 -6
  123. package/lib/src/expectations/operators/or.operator.js.map +1 -1
  124. package/lib/src/expectations/operators/or.operator.spec.js +58 -39
  125. package/lib/src/expectations/operators/or.operator.spec.js.map +1 -1
  126. package/lib/src/expectations/operators/remove.operator.d.ts +12 -2
  127. package/lib/src/expectations/operators/remove.operator.d.ts.map +1 -1
  128. package/lib/src/expectations/operators/remove.operator.js +22 -17
  129. package/lib/src/expectations/operators/remove.operator.js.map +1 -1
  130. package/lib/src/expectations/operators/remove.operator.spec.js +40 -28
  131. package/lib/src/expectations/operators/remove.operator.spec.js.map +1 -1
  132. package/lib/src/expectations/operators/root.operator.d.ts +8 -0
  133. package/lib/src/expectations/operators/root.operator.d.ts.map +1 -0
  134. package/lib/src/expectations/operators/root.operator.js +36 -0
  135. package/lib/src/expectations/operators/root.operator.js.map +1 -0
  136. package/lib/src/expectations/operators/set.operator.d.ts +20 -2
  137. package/lib/src/expectations/operators/set.operator.d.ts.map +1 -1
  138. package/lib/src/expectations/operators/set.operator.js +38 -23
  139. package/lib/src/expectations/operators/set.operator.js.map +1 -1
  140. package/lib/src/expectations/operators/set.operator.spec.js +87 -43
  141. package/lib/src/expectations/operators/set.operator.spec.js.map +1 -1
  142. package/lib/src/expectations/operators/switch.operator.d.ts +25 -0
  143. package/lib/src/expectations/operators/switch.operator.d.ts.map +1 -0
  144. package/lib/src/expectations/operators/switch.operator.js +68 -0
  145. package/lib/src/expectations/operators/switch.operator.js.map +1 -0
  146. package/lib/src/expectations/operators/switch.operator.spec.d.ts +2 -0
  147. package/lib/src/expectations/operators/switch.operator.spec.d.ts.map +1 -0
  148. package/lib/src/expectations/operators/switch.operator.spec.js +129 -0
  149. package/lib/src/expectations/operators/switch.operator.spec.js.map +1 -0
  150. package/lib/src/expectations/types.d.ts +67 -63
  151. package/lib/src/expectations/types.d.ts.map +1 -1
  152. package/lib/src/expectations/types.js +17 -3
  153. package/lib/src/expectations/types.js.map +1 -1
  154. package/lib/src/expectations/utils.d.ts +23 -10
  155. package/lib/src/expectations/utils.d.ts.map +1 -1
  156. package/lib/src/expectations/utils.js +111 -53
  157. package/lib/src/expectations/utils.js.map +1 -1
  158. package/lib/src/server/endpoints/config.get.endpoint.d.ts +8 -3
  159. package/lib/src/server/endpoints/config.get.endpoint.d.ts.map +1 -1
  160. package/lib/src/server/endpoints/config.get.endpoint.js +2 -4
  161. package/lib/src/server/endpoints/config.get.endpoint.js.map +1 -1
  162. package/lib/src/server/endpoints/expectations.create.endpoint.d.ts +9 -11
  163. package/lib/src/server/endpoints/expectations.create.endpoint.d.ts.map +1 -1
  164. package/lib/src/server/endpoints/expectations.create.endpoint.js +2 -3
  165. package/lib/src/server/endpoints/expectations.create.endpoint.js.map +1 -1
  166. package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts +8 -5
  167. package/lib/src/server/endpoints/expectations.delete.endpoint.d.ts.map +1 -1
  168. package/lib/src/server/endpoints/expectations.delete.endpoint.js +2 -2
  169. package/lib/src/server/endpoints/expectations.delete.endpoint.js.map +1 -1
  170. package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts +8 -3
  171. package/lib/src/server/endpoints/expectations.get-list.endpoint.d.ts.map +1 -1
  172. package/lib/src/server/endpoints/expectations.get-list.endpoint.js +2 -2
  173. package/lib/src/server/endpoints/expectations.get-list.endpoint.js.map +1 -1
  174. package/lib/src/server/endpoints/expectations.update.endpoint.d.ts +13 -11
  175. package/lib/src/server/endpoints/expectations.update.endpoint.d.ts.map +1 -1
  176. package/lib/src/server/endpoints/expectations.update.endpoint.js +4 -6
  177. package/lib/src/server/endpoints/expectations.update.endpoint.js.map +1 -1
  178. package/lib/src/server/endpoints/history.get-list.endpoint.d.ts +27 -0
  179. package/lib/src/server/endpoints/history.get-list.endpoint.d.ts.map +1 -0
  180. package/lib/src/server/endpoints/history.get-list.endpoint.js +11 -0
  181. package/lib/src/server/endpoints/history.get-list.endpoint.js.map +1 -0
  182. package/lib/src/server/endpoints/index.d.ts +1 -1
  183. package/lib/src/server/endpoints/index.d.ts.map +1 -1
  184. package/lib/src/server/endpoints/index.js +3 -3
  185. package/lib/src/server/endpoints/index.js.map +1 -1
  186. package/lib/src/server/endpoints/ping.endpoint.d.ts +8 -3
  187. package/lib/src/server/endpoints/ping.endpoint.d.ts.map +1 -1
  188. package/lib/src/server/endpoints/ping.endpoint.js +1 -1
  189. package/lib/src/server/endpoints/ping.endpoint.js.map +1 -1
  190. package/lib/src/server/history/model.d.ts +16 -16
  191. package/lib/src/server/history/model.d.ts.map +1 -1
  192. package/lib/src/server/history/model.js +21 -6
  193. package/lib/src/server/history/model.js.map +1 -1
  194. package/lib/src/server/history/storage.d.ts +3 -4
  195. package/lib/src/server/history/storage.d.ts.map +1 -1
  196. package/lib/src/server/history/storage.js +2 -2
  197. package/lib/src/server/history/storage.js.map +1 -1
  198. package/lib/src/server/index.d.ts +10 -6
  199. package/lib/src/server/index.d.ts.map +1 -1
  200. package/lib/src/server/index.js +21 -22
  201. package/lib/src/server/index.js.map +1 -1
  202. package/lib/src/server/middlewares/delay.middleware.d.ts +24 -0
  203. package/lib/src/server/middlewares/delay.middleware.d.ts.map +1 -0
  204. package/lib/src/server/middlewares/delay.middleware.js +13 -0
  205. package/lib/src/server/middlewares/delay.middleware.js.map +1 -0
  206. package/lib/src/server/middlewares/destroy.midleware.d.ts +24 -0
  207. package/lib/src/server/middlewares/destroy.midleware.d.ts.map +1 -0
  208. package/lib/src/server/middlewares/destroy.midleware.js +16 -0
  209. package/lib/src/server/middlewares/destroy.midleware.js.map +1 -0
  210. package/lib/src/server/middlewares/forward.middleware.d.ts +24 -0
  211. package/lib/src/server/middlewares/forward.middleware.d.ts.map +1 -0
  212. package/lib/src/server/middlewares/forward.middleware.js +71 -0
  213. package/lib/src/server/middlewares/forward.middleware.js.map +1 -0
  214. package/lib/src/server/middlewares/history.middleware.d.ts +24 -0
  215. package/lib/src/server/middlewares/history.middleware.d.ts.map +1 -0
  216. package/lib/src/server/middlewares/history.middleware.js +13 -0
  217. package/lib/src/server/middlewares/history.middleware.js.map +1 -0
  218. package/lib/src/server/middlewares/index.d.ts +7 -6
  219. package/lib/src/server/middlewares/index.d.ts.map +1 -1
  220. package/lib/src/server/middlewares/index.js +15 -13
  221. package/lib/src/server/middlewares/index.js.map +1 -1
  222. package/lib/src/server/middlewares/internal-route.middleware.d.ts +20 -2
  223. package/lib/src/server/middlewares/internal-route.middleware.d.ts.map +1 -1
  224. package/lib/src/server/middlewares/internal-route.middleware.js +4 -3
  225. package/lib/src/server/middlewares/internal-route.middleware.js.map +1 -1
  226. package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts +24 -0
  227. package/lib/src/server/middlewares/manipulate-expectation.middleware.d.ts.map +1 -0
  228. package/lib/src/server/middlewares/manipulate-expectation.middleware.js +13 -0
  229. package/lib/src/server/middlewares/manipulate-expectation.middleware.js.map +1 -0
  230. package/lib/src/server/middlewares/match-expectation.middleware.d.ts +24 -0
  231. package/lib/src/server/middlewares/match-expectation.middleware.d.ts.map +1 -0
  232. package/lib/src/server/middlewares/match-expectation.middleware.js +20 -0
  233. package/lib/src/server/middlewares/match-expectation.middleware.js.map +1 -0
  234. package/lib/src/server/middlewares/public.middleware.d.ts +24 -0
  235. package/lib/src/server/middlewares/public.middleware.d.ts.map +1 -0
  236. package/lib/src/server/middlewares/{resolve-public.middleware.js → public.middleware.js} +13 -13
  237. package/lib/src/server/middlewares/public.middleware.js.map +1 -0
  238. package/lib/src/server/middlewares/reply.middleware.d.ts +21 -5
  239. package/lib/src/server/middlewares/reply.middleware.d.ts.map +1 -1
  240. package/lib/src/server/middlewares/reply.middleware.js +34 -25
  241. package/lib/src/server/middlewares/reply.middleware.js.map +1 -1
  242. package/lib/src/server/models/endpoint.d.ts +19 -13
  243. package/lib/src/server/models/endpoint.d.ts.map +1 -1
  244. package/lib/src/server/models/endpoint.js +2 -2
  245. package/lib/src/server/models/endpoint.js.map +1 -1
  246. package/lib/src/server/models/middleware.d.ts +21 -20
  247. package/lib/src/server/models/middleware.d.ts.map +1 -1
  248. package/lib/src/server/models/middleware.js +6 -10
  249. package/lib/src/server/models/middleware.js.map +1 -1
  250. package/lib/src/server/models/reply-service/index.d.ts +6 -6
  251. package/lib/src/server/models/reply-service/index.d.ts.map +1 -1
  252. package/lib/src/server/models/reply-service/index.js +24 -24
  253. package/lib/src/server/models/reply-service/index.js.map +1 -1
  254. package/lib/src/server/models/request-context/http.d.ts +45 -0
  255. package/lib/src/server/models/request-context/http.d.ts.map +1 -0
  256. package/lib/src/server/models/request-context/http.js +71 -0
  257. package/lib/src/server/models/request-context/http.js.map +1 -0
  258. package/lib/src/server/models/request-context/index.d.ts +4 -57
  259. package/lib/src/server/models/request-context/index.d.ts.map +1 -1
  260. package/lib/src/server/models/request-context/index.js +4 -57
  261. package/lib/src/server/models/request-context/index.js.map +1 -1
  262. package/lib/src/server/models/request-context/model.d.ts +13 -0
  263. package/lib/src/server/models/request-context/model.d.ts.map +1 -0
  264. package/lib/src/server/models/request-context/model.js +14 -0
  265. package/lib/src/server/models/request-context/model.js.map +1 -0
  266. package/lib/src/server/models/request-context/types.d.ts +16 -18
  267. package/lib/src/server/models/request-context/types.d.ts.map +1 -1
  268. package/lib/src/server/models/request-context/utils.d.ts +7 -3
  269. package/lib/src/server/models/request-context/utils.d.ts.map +1 -1
  270. package/lib/src/server/models/request-context/utils.js +48 -25
  271. package/lib/src/server/models/request-context/utils.js.map +1 -1
  272. package/lib/src/server/models/request-context/ws.d.ts +21 -0
  273. package/lib/src/server/models/request-context/ws.d.ts.map +1 -0
  274. package/lib/src/server/models/request-context/ws.js +22 -0
  275. package/lib/src/server/models/request-context/ws.js.map +1 -0
  276. package/lib/src/server/models/server-context.d.ts +4 -4
  277. package/lib/src/server/models/server-context.d.ts.map +1 -1
  278. package/lib/src/server/models/server-context.js +5 -5
  279. package/lib/src/server/models/server-context.js.map +1 -1
  280. package/lib/src/server/router.d.ts +4 -7
  281. package/lib/src/server/router.d.ts.map +1 -1
  282. package/lib/src/server/router.js +5 -12
  283. package/lib/src/server/router.js.map +1 -1
  284. package/lib/src/server/ws-exchange/index.d.ts +5 -0
  285. package/lib/src/server/ws-exchange/index.d.ts.map +1 -0
  286. package/lib/src/server/{web-socket-exchange → ws-exchange}/index.js +3 -3
  287. package/lib/src/server/ws-exchange/index.js.map +1 -0
  288. package/lib/src/server/ws-exchange/types.d.ts +12 -0
  289. package/lib/src/server/ws-exchange/types.d.ts.map +1 -0
  290. package/lib/src/server/ws-exchange/types.js.map +1 -0
  291. package/lib/src/types.d.ts +0 -1
  292. package/lib/src/types.d.ts.map +1 -1
  293. package/lib/src/utils/index.d.ts +1 -0
  294. package/lib/src/utils/index.d.ts.map +1 -1
  295. package/lib/src/utils/index.js +1 -0
  296. package/lib/src/utils/index.js.map +1 -1
  297. package/lib/src/utils/json.d.ts +1 -1
  298. package/lib/src/utils/json.d.ts.map +1 -1
  299. package/lib/src/utils/json.js +3 -3
  300. package/lib/src/utils/json.js.map +1 -1
  301. package/lib/src/utils/regexp.d.ts +2 -0
  302. package/lib/src/utils/regexp.d.ts.map +1 -0
  303. package/lib/src/utils/regexp.js +9 -0
  304. package/lib/src/utils/regexp.js.map +1 -0
  305. package/lib/test/index.js +140 -136
  306. package/lib/test/index.js.map +1 -1
  307. package/lib/tsconfig.tsbuildinfo +1 -1
  308. package/lib/types/common.global.d.ts +13 -6
  309. package/lib/types/common.global.d.ts.map +1 -1
  310. package/lib/types/lib.d.ts +1 -0
  311. package/lib/types/lib.d.ts.map +1 -1
  312. package/lib/types/lib.js +1 -0
  313. package/lib/types/lib.js.map +1 -1
  314. package/package.json +5 -2
  315. package/types/common.global.ts +21 -2
  316. package/types/lib.ts +1 -0
  317. package/lib/src/expectations/model.d.ts +0 -39
  318. package/lib/src/expectations/model.d.ts.map +0 -1
  319. package/lib/src/expectations/model.js +0 -90
  320. package/lib/src/expectations/model.js.map +0 -1
  321. package/lib/src/expectations/operators/utils.d.ts +0 -20
  322. package/lib/src/expectations/operators/utils.d.ts.map +0 -1
  323. package/lib/src/expectations/operators/utils.js +0 -67
  324. package/lib/src/expectations/operators/utils.js.map +0 -1
  325. package/lib/src/expectations/storage.d.ts +0 -19
  326. package/lib/src/expectations/storage.d.ts.map +0 -1
  327. package/lib/src/expectations/storage.js.map +0 -1
  328. package/lib/src/expectations/utils.spec.d.ts +0 -2
  329. package/lib/src/expectations/utils.spec.d.ts.map +0 -1
  330. package/lib/src/expectations/utils.spec.js +0 -59
  331. package/lib/src/expectations/utils.spec.js.map +0 -1
  332. package/lib/src/expectations/validation-schemas.d.ts +0 -14
  333. package/lib/src/expectations/validation-schemas.d.ts.map +0 -1
  334. package/lib/src/expectations/validation-schemas.js +0 -36
  335. package/lib/src/expectations/validation-schemas.js.map +0 -1
  336. package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts +0 -16
  337. package/lib/src/server/endpoints/history-records.get-list.endpoint.d.ts.map +0 -1
  338. package/lib/src/server/endpoints/history-records.get-list.endpoint.js +0 -9
  339. package/lib/src/server/endpoints/history-records.get-list.endpoint.js.map +0 -1
  340. package/lib/src/server/middlewares/add-history.middleware.d.ts +0 -8
  341. package/lib/src/server/middlewares/add-history.middleware.d.ts.map +0 -1
  342. package/lib/src/server/middlewares/add-history.middleware.js +0 -14
  343. package/lib/src/server/middlewares/add-history.middleware.js.map +0 -1
  344. package/lib/src/server/middlewares/destroy-request.midleware.d.ts +0 -8
  345. package/lib/src/server/middlewares/destroy-request.midleware.d.ts.map +0 -1
  346. package/lib/src/server/middlewares/destroy-request.midleware.js +0 -17
  347. package/lib/src/server/middlewares/destroy-request.midleware.js.map +0 -1
  348. package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts +0 -8
  349. package/lib/src/server/middlewares/handle-expectation-delay.middleware.d.ts.map +0 -1
  350. package/lib/src/server/middlewares/handle-expectation-delay.middleware.js +0 -18
  351. package/lib/src/server/middlewares/handle-expectation-delay.middleware.js.map +0 -1
  352. package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts +0 -8
  353. package/lib/src/server/middlewares/handle-expectation-forward.middleware.d.ts.map +0 -1
  354. package/lib/src/server/middlewares/handle-expectation-forward.middleware.js +0 -86
  355. package/lib/src/server/middlewares/handle-expectation-forward.middleware.js.map +0 -1
  356. package/lib/src/server/middlewares/resolve-public.middleware.d.ts +0 -6
  357. package/lib/src/server/middlewares/resolve-public.middleware.d.ts.map +0 -1
  358. package/lib/src/server/middlewares/resolve-public.middleware.js.map +0 -1
  359. package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts +0 -6
  360. package/lib/src/server/middlewares/validate-expectation-request.middleware.d.ts.map +0 -1
  361. package/lib/src/server/middlewares/validate-expectation-request.middleware.js +0 -20
  362. package/lib/src/server/middlewares/validate-expectation-request.middleware.js.map +0 -1
  363. package/lib/src/server/types.d.ts +0 -6
  364. package/lib/src/server/types.d.ts.map +0 -1
  365. package/lib/src/server/types.js.map +0 -1
  366. package/lib/src/server/web-socket-exchange/index.d.ts +0 -5
  367. package/lib/src/server/web-socket-exchange/index.d.ts.map +0 -1
  368. package/lib/src/server/web-socket-exchange/index.js.map +0 -1
  369. package/lib/src/server/web-socket-exchange/types.d.ts +0 -12
  370. package/lib/src/server/web-socket-exchange/types.d.ts.map +0 -1
  371. package/lib/src/server/web-socket-exchange/types.js +0 -3
  372. package/lib/src/server/web-socket-exchange/types.js.map +0 -1
  373. /package/lib/src/server/{types.js → ws-exchange/types.js} +0 -0
@@ -1,90 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.Expectation = void 0;
16
- const random_animal_name_1 = __importDefault(require("random-animal-name"));
17
- const typebox_1 = require("@n1k1t/typebox");
18
- const uuid_1 = require("uuid");
19
- const rfdc_1 = __importDefault(require("rfdc"));
20
- const lodash_1 = __importDefault(require("lodash"));
21
- const utils_1 = require("./utils");
22
- const validation_schemas_1 = require("./validation-schemas");
23
- const utils_2 = require("../utils");
24
- const types_1 = require("./types");
25
- const clone = (0, rfdc_1.default)();
26
- class Expectation {
27
- constructor(type) {
28
- this.type = type;
29
- this.id = (0, uuid_1.v4)();
30
- this.name = (0, random_animal_name_1.default)().split(' ').map(lodash_1.default.capitalize).join('');
31
- this.isEnabled = true;
32
- this.meta = {
33
- executionsCount: 0,
34
- additional: {},
35
- };
36
- }
37
- increaseExecutionsCounter() {
38
- this.meta.executionsCount += 1;
39
- return this;
40
- }
41
- validateContext(location, context) {
42
- return (0, utils_1.exploreNestedExpectationSchema)('validation', this[location] ?? {}, context);
43
- }
44
- manipulateContext(location, context, options) {
45
- const result = options?.clone ? clone(context) : context;
46
- (0, utils_1.exploreNestedExpectationSchema)('manipulation', this[location] ?? {}, result);
47
- return result;
48
- }
49
- validate() {
50
- return (0, utils_2.validate)(this, [validation_schemas_1.ExpectationValidationSchema, validation_schemas_1.ExpectationTargetionalValidationSchema]);
51
- }
52
- static build(type = 'HTTP', configuration) {
53
- const expectation = Object.assign(new Expectation(type), configuration ?? {});
54
- expectation.meta.additional = Object.assign((0, utils_1.extractMetaAdditionalFromExpectationSchema)(expectation.request ?? {}), (0, utils_1.extractMetaAdditionalFromExpectationSchema)(expectation.response ?? {}));
55
- return expectation;
56
- }
57
- }
58
- exports.Expectation = Expectation;
59
- __decorate([
60
- (0, utils_2.UseValidation)(typebox_1.Type.Optional(typebox_1.Type.Object({
61
- ms: typebox_1.Type.Number(),
62
- times: typebox_1.Type.Optional(typebox_1.Type.Number()),
63
- }))),
64
- __metadata("design:type", Object)
65
- ], Expectation.prototype, "delay", void 0);
66
- __decorate([
67
- (0, utils_2.UseValidation)(typebox_1.Type.Optional(typebox_1.Type.Union(types_1.LExpectationDestroyType.map((value) => typebox_1.Type.Literal(value))))),
68
- __metadata("design:type", String)
69
- ], Expectation.prototype, "destroy", void 0);
70
- __decorate([
71
- (0, utils_2.UseValidation)(typebox_1.Type.Optional(validation_schemas_1.ExpectationValidationSchema)),
72
- __metadata("design:type", Object)
73
- ], Expectation.prototype, "request", void 0);
74
- __decorate([
75
- (0, utils_2.UseValidation)(typebox_1.Type.Optional(validation_schemas_1.ExpectationValidationSchema)),
76
- __metadata("design:type", Object)
77
- ], Expectation.prototype, "response", void 0);
78
- __decorate([
79
- (0, utils_2.UseValidation)(typebox_1.Type.Optional(typebox_1.Type.Object({
80
- protocol: typebox_1.Type.Union(types_1.LExpectationForwardProtocol.map((value) => typebox_1.Type.Literal(value))),
81
- host: typebox_1.Type.String(),
82
- port: typebox_1.Type.Number(),
83
- timeout: typebox_1.Type.Optional(typebox_1.Type.Number()),
84
- proxy: typebox_1.Type.Optional(typebox_1.Type.Object({
85
- protocol: typebox_1.Type.Union(types_1.LExpectationForwardProtocol.map((value) => typebox_1.Type.Literal(value))),
86
- }))
87
- }))),
88
- __metadata("design:type", Object)
89
- ], Expectation.prototype, "forward", void 0);
90
- //# sourceMappingURL=model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/expectations/model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4EAAoD;AAEpD,4CAAsC;AACtC,+BAAoC;AACpC,gDAAwB;AACxB,oDAAuB;AAEvB,mCAAqG;AACrG,6DAA2G;AAC3G,oCAAmD;AAEnD,mCASiB;AAEjB,MAAM,KAAK,GAAG,IAAA,cAAI,GAAE,CAAC;AAErB,MAAa,WAAW;IAqEtB,YAAmB,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;QApElC,OAAE,GAAW,IAAA,SAAM,GAAE,CAAC;QACtB,SAAI,GAAW,IAAA,4BAAkB,GAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,gBAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE1E,cAAS,GAAY,IAAI,CAAC;QAE1B,SAAI,GAAqB;YAC9B,eAAe,EAAE,CAAC;YAClB,UAAU,EAAE,EAAE;SACf,CAAC;IA4D0C,CAAC;IAEtC,yBAAyB;QAC9B,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC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F;;0CACsD;AAOhD;IALN,IAAA,qBAAa,EACZ,cAAI,CAAC,QAAQ,CACX,cAAI,CAAC,KAAK,CAAC,+BAAuB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CACxE,CACF;;4CAC+B;AAGzB;IADN,IAAA,qBAAa,EAAC,cAAI,CAAC,QAAQ,CAAC,gDAA2B,CAAC,CAAC;;4CAMvD;AAGI;IADN,IAAA,qBAAa,EAAC,cAAI,CAAC,QAAQ,CAAC,gDAA2B,CAAC,CAAC;;6CAIvD;AAkBI;IAhBN,IAAA,qBAAa,EACZ,cAAI,CAAC,QAAQ,CACX,cAAI,CAAC,MAAM,CAAC;QACV,QAAQ,EAAE,cAAI,CAAC,KAAK,CAAC,mCAA2B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QACrF,IAAI,EAAE,cAAI,CAAC,MAAM,EAAE;QACnB,IAAI,EAAE,cAAI,CAAC,MAAM,EAAE;QAEnB,OAAO,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;QACrC,KAAK,EAAE,cAAI,CAAC,QAAQ,CAClB,cAAI,CAAC,MAAM,CAAC;YACV,QAAQ,EAAE,cAAI,CAAC,KAAK,CAAC,mCAA2B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;SACtF,CAAC,CACH;KACF,CAAC,CACH,CACF;;4CAUC"}
@@ -1,20 +0,0 @@
1
- import type { IRequestPlainContext, IResponsePlainContext } from '../../server/models';
2
- import { TExpectationOperatorLocation, TExpectationOperatorHandler, TExpectationOperator } from '../types';
3
- type TBasePayloadSegment = {
4
- parent: object;
5
- key: string;
6
- };
7
- type TPayloadSegment = (TBasePayloadSegment & {
8
- value: object;
9
- type: 'object';
10
- }) | (TBasePayloadSegment & {
11
- value: string;
12
- type: 'string';
13
- }) | (TBasePayloadSegment & {
14
- value: number;
15
- type: 'number';
16
- });
17
- export declare const buildExpectationOperatorHandler: <K extends TExpectationOperator>(handler: TExpectationOperatorHandler<K>) => TExpectationOperatorHandler<K>;
18
- export declare const extractContextPayloadSegment: (location: TExpectationOperatorLocation, context: IRequestPlainContext | IResponsePlainContext) => TPayloadSegment | null;
19
- export {};
20
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB,KAAK,mBAAmB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3D,KAAK,eAAe,GAChB,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,GACzD,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,GACzD,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAE9D,eAAO,MAAM,+BAA+B,GAAI,CAAC,SAAS,oBAAoB,WACnE,2BAA2B,CAAC,CAAC,CAAC,mCAC7B,CAAC;AAEb,eAAO,MAAM,4BAA4B,aAC7B,4BAA4B,WAC7B,oBAAoB,GAAG,qBAAqB,KACpD,eAAe,GAAG,IAiEpB,CAAA"}
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractContextPayloadSegment = exports.buildExpectationOperatorHandler = void 0;
4
- const utils_1 = require("../../utils");
5
- const buildExpectationOperatorHandler = (handler) => handler;
6
- exports.buildExpectationOperatorHandler = buildExpectationOperatorHandler;
7
- const extractContextPayloadSegment = (location, context) => {
8
- switch (location) {
9
- case 'headers': return (0, utils_1.cast)({
10
- key: 'headers',
11
- type: 'object',
12
- parent: context,
13
- value: context.headers,
14
- });
15
- case 'method': return 'method' in context
16
- ? (0, utils_1.cast)({
17
- key: 'method',
18
- type: 'string',
19
- parent: context,
20
- value: context.method,
21
- })
22
- : null;
23
- case 'path': return 'path' in context
24
- ? (0, utils_1.cast)({
25
- key: 'path',
26
- type: 'string',
27
- parent: context,
28
- value: context.path,
29
- })
30
- : null;
31
- case 'body': return 'body' in context
32
- ? ({
33
- key: 'body',
34
- type: 'object',
35
- parent: context,
36
- value: context.body,
37
- })
38
- : null;
39
- case 'data': return 'data' in context
40
- ? ({
41
- key: 'data',
42
- type: 'object',
43
- parent: context,
44
- value: context.data,
45
- })
46
- : null;
47
- case 'statusCode': return 'statusCode' in context
48
- ? ({
49
- key: 'statusCode',
50
- type: 'number',
51
- parent: context,
52
- value: context.statusCode,
53
- })
54
- : null;
55
- case 'query': return 'query' in context
56
- ? ({
57
- key: 'query',
58
- type: 'object',
59
- parent: context,
60
- value: context.query,
61
- })
62
- : null;
63
- default: return null;
64
- }
65
- };
66
- exports.extractContextPayloadSegment = extractContextPayloadSegment;
67
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/expectations/operators/utils.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAc5B,MAAM,+BAA+B,GAAG,CAC7C,OAAuC,EACvC,EAAE,CAAC,OAAO,CAAC;AAFA,QAAA,+BAA+B,mCAE/B;AAEN,MAAM,4BAA4B,GAAG,CAC1C,QAAsC,EACtC,OAA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C,CAAC,CAAC,CAAC;gBACD,GAAG,EAAE,YAAY;gBACjB,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,OAAO,CAAC,UAAW;aAC3B,CAAC;YACF,CAAC,CAAC,IAAI,CAAC;QAET,KAAK,OAAO,CAAC,CAAC,OAAO,OAAO,IAAI,OAAO;YACrC,CAAC,CAAC,CAAC;gBACD,GAAG,EAAE,OAAO;gBACZ,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,OAAO,CAAC,KAAM;aACtB,CAAC;YACF,CAAC,CAAC,IAAI,CAAC;QAET,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC;IACvB,CAAC;AACH,CAAC,CAAA;AApEY,QAAA,4BAA4B,gCAoExC"}
@@ -1,19 +0,0 @@
1
- import { ValueError } from '@n1k1t/typebox/errors';
2
- import { Expectation } from './model';
3
- import { TExpectationContext, TExpectationContextLocation } from './types';
4
- export type TExpectationsStorageRegisterationResult = {
5
- status: 'REGISTRED';
6
- expectation: Expectation;
7
- } | {
8
- status: 'ERROR';
9
- reasons: ValueError[];
10
- };
11
- export declare class ExpectationsStorage extends Map<string, Expectation> {
12
- register(configuration: Parameters<typeof Expectation['build']>[1]): TExpectationsStorageRegisterationResult;
13
- findByContext(location: TExpectationContextLocation, context: TExpectationContext): Expectation | null;
14
- findAndManipulateContext<T extends TExpectationContext>(location: TExpectationContextLocation, context: T, options?: Parameters<Expectation['manipulateContext']>[2]): {
15
- context: T;
16
- expectation: Expectation;
17
- } | null;
18
- }
19
- //# sourceMappingURL=storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/expectations/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,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,EAAE,EAAE,WAAW,CAAC,CAAC;QACtC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IAC9C,CAAC;IAEM,aAAa,CAAC,QAAqC,EAAE,OAA4B;QACtF,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;YACxC,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC5E,OAAO,WAAW,CAAC;YACrB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,wBAAwB,CAC7B,QAAqC,EACrC,OAAU,EACV,OAAyD;QAEzD,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,WAAW;YACX,OAAO,EAAE,WAAW,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;SACnE,CAAA;IACH,CAAC;CACF;AAtCD,kDAsCC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utils.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.spec.d.ts","sourceRoot":"","sources":["../../../src/expectations/utils.spec.ts"],"names":[],"mappings":""}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const __utils__1 = require("./__utils__");
4
- const utils_1 = require("./utils");
5
- describe('Expectations.Utils', () => {
6
- it('should validate by expectation schema', () => {
7
- const context = (0, __utils__1.buildExpectationContext)();
8
- const schema = {
9
- $and: [
10
- {
11
- $has: {
12
- $location: 'statusCode',
13
- $value: 200,
14
- },
15
- },
16
- {
17
- $has: {
18
- $location: 'query',
19
- $path: 'bar.baz',
20
- $value: null,
21
- },
22
- },
23
- ],
24
- };
25
- expect((0, utils_1.exploreNestedExpectationSchema)('validation', schema, context)).toBeTruthy();
26
- });
27
- it('should manipulate by expectation schema', () => {
28
- const context = (0, __utils__1.buildExpectationContext)();
29
- const schema = {
30
- $if: {
31
- $and: [
32
- {
33
- $has: {
34
- $location: 'statusCode',
35
- $value: 200,
36
- },
37
- },
38
- {
39
- $has: {
40
- $location: 'query',
41
- $path: 'bar.baz',
42
- $value: null,
43
- },
44
- },
45
- ],
46
- $then: {
47
- $set: {
48
- $location: 'query',
49
- $path: 'bar.baz',
50
- $value: true,
51
- },
52
- },
53
- },
54
- };
55
- (0, utils_1.exploreNestedExpectationSchema)('manipulation', schema, context);
56
- expect(context.query.bar.baz).toBeTruthy();
57
- });
58
- });
59
- //# sourceMappingURL=utils.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.spec.js","sourceRoot":"","sources":["../../../src/expectations/utils.spec.ts"],"names":[],"mappings":";;AAAA,0CAAsD;AAEtD,mCAAyD;AAEzD,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,OAAO,GAAG,IAAA,kCAAuB,GAAE,CAAA;QACzC,MAAM,MAAM,GAAuB;YACjC,IAAI,EAAE;gBACJ;oBACE,IAAI,EAAE;wBACJ,SAAS,EAAE,YAAY;wBACvB,MAAM,EAAE,GAAG;qBACZ;iBACF;gBACD;oBACE,IAAI,EAAE;wBACJ,SAAS,EAAE,OAAO;wBAClB,KAAK,EAAE,SAAS;wBAChB,MAAM,EAAE,IAAI;qBACb;iBACF;aACF;SACF,CAAC;QAEF,MAAM,CAAC,IAAA,sCAA8B,EAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IACrF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,OAAO,GAAG,IAAA,kCAAuB,GAAE,CAAA;QACzC,MAAM,MAAM,GAAuB;YACjC,GAAG,EAAE;gBACH,IAAI,EAAE;oBACJ;wBACE,IAAI,EAAE;4BACJ,SAAS,EAAE,YAAY;4BACvB,MAAM,EAAE,GAAG;yBACZ;qBACF;oBACD;wBACE,IAAI,EAAE;4BACJ,SAAS,EAAE,OAAO;4BAClB,KAAK,EAAE,SAAS;4BAChB,MAAM,EAAE,IAAI;yBACb;qBACF;iBACF;gBAED,KAAK,EAAE;oBACL,IAAI,EAAE;wBACJ,SAAS,EAAE,OAAO;wBAClB,KAAK,EAAE,SAAS;wBAChB,MAAM,EAAE,IAAI;qBACb;iBACF;aACF;SACF,CAAC;QAEF,IAAA,sCAA8B,EAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAChE,MAAM,CAAO,OAAO,CAAC,KAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAA"}
@@ -1,14 +0,0 @@
1
- import { TSchema } from '@n1k1t/typebox';
2
- export declare const ExpectationTargetionalValidationSchema: import("@n1k1t/typebox").TObject<{
3
- $location: import("@n1k1t/typebox").TOptional<TSchema>;
4
- $path: import("@n1k1t/typebox").TOptional<TSchema>;
5
- $jsonPath: import("@n1k1t/typebox").TOptional<TSchema>;
6
- $regExp: import("@n1k1t/typebox").TOptional<TSchema>;
7
- $regExpAnyOf: import("@n1k1t/typebox").TOptional<TSchema>;
8
- $value: import("@n1k1t/typebox").TOptional<TSchema>;
9
- $valueAnyOf: import("@n1k1t/typebox").TOptional<TSchema>;
10
- $minimatch: import("@n1k1t/typebox").TOptional<TSchema>;
11
- $minimatchAnyOf: import("@n1k1t/typebox").TOptional<TSchema>;
12
- }>;
13
- export declare const ExpectationValidationSchema: import("@n1k1t/typebox").TRecursive<TSchema>;
14
- //# sourceMappingURL=validation-schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-schemas.d.ts","sourceRoot":"","sources":["../../../src/expectations/validation-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,gBAAgB,CAAC;AAiB/C,eAAO,MAAM,sCAAsC;;;;;;;;;;EAiBlD,CAAC;AAEF,eAAO,MAAM,2BAA2B,8CA4BtC,CAAA"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExpectationValidationSchema = exports.ExpectationTargetionalValidationSchema = void 0;
4
- const typebox_1 = require("@n1k1t/typebox");
5
- const utils_1 = require("../utils");
6
- const types_1 = require("./types");
7
- exports.ExpectationTargetionalValidationSchema = typebox_1.Type.Partial(typebox_1.Type.Object((0, utils_1.cast)({
8
- $jsonPath: typebox_1.Type.String(),
9
- $path: typebox_1.Type.String(),
10
- $location: typebox_1.Type.Union(types_1.LExpectationOperatorLocation.map((value) => typebox_1.Type.Literal(value))),
11
- $minimatch: typebox_1.Type.String(),
12
- $minimatchAnyOf: typebox_1.Type.Array(typebox_1.Type.String()),
13
- $regExp: typebox_1.Type.Object({}),
14
- $regExpAnyOf: typebox_1.Type.Array(typebox_1.Type.Object({})),
15
- $value: typebox_1.Type.Unknown(),
16
- $valueAnyOf: typebox_1.Type.Array(typebox_1.Type.Unknown()),
17
- })), { $id: 'ExpectationTargetionalSchema' });
18
- exports.ExpectationValidationSchema = typebox_1.Type.Recursive((This) => typebox_1.Type.Partial(typebox_1.Type.Object((0, utils_1.cast)({
19
- $and: typebox_1.Type.Array(This),
20
- $or: typebox_1.Type.Array(This),
21
- $not: This,
22
- $if: typebox_1.Type.Partial(typebox_1.Type.Object((0, utils_1.cast)({
23
- $then: This,
24
- $else: This,
25
- $has: typebox_1.Type.Ref(exports.ExpectationTargetionalValidationSchema),
26
- $and: typebox_1.Type.Array(This),
27
- $or: typebox_1.Type.Array(This),
28
- $not: This,
29
- }))),
30
- $has: typebox_1.Type.Ref(exports.ExpectationTargetionalValidationSchema),
31
- $set: typebox_1.Type.Ref(exports.ExpectationTargetionalValidationSchema),
32
- $merge: typebox_1.Type.Ref(exports.ExpectationTargetionalValidationSchema),
33
- $remove: typebox_1.Type.Ref(exports.ExpectationTargetionalValidationSchema),
34
- $exec: typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Function([typebox_1.Type.Any()], typebox_1.Type.Any())]),
35
- })), { $id: 'ExpectationSchema' }));
36
- //# sourceMappingURL=validation-schemas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-schemas.js","sourceRoot":"","sources":["../../../src/expectations/validation-schemas.ts"],"names":[],"mappings":";;;AAAA,4CAA+C;AAE/C,oCAAgC;AAChC,mCAKiB;AASJ,QAAA,sCAAsC,GAAG,cAAI,CAAC,OAAO,CAChE,cAAI,CAAC,MAAM,CAAC,IAAA,YAAI,EAA0C;IACxD,SAAS,EAAE,cAAI,CAAC,MAAM,EAAE;IACxB,KAAK,EAAE,cAAI,CAAC,MAAM,EAAE;IAEpB,SAAS,EAAE,cAAI,CAAC,KAAK,CAAC,oCAA4B,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAEvF,UAAU,EAAE,cAAI,CAAC,MAAM,EAAE;IACzB,eAAe,EAAE,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;IAE1C,OAAO,EAAE,cAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,YAAY,EAAE,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEzC,MAAM,EAAE,cAAI,CAAC,OAAO,EAAE;IACtB,WAAW,EAAE,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,OAAO,EAAE,CAAC;CACxC,CAAC,CAAC,EACH,EAAE,GAAG,EAAE,8BAA8B,EAAE,CACxC,CAAC;AAEW,QAAA,2BAA2B,GAAG,cAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAC9E,cAAI,CAAC,MAAM,CAAC,IAAA,YAAI,EAA+B;IAC7C,IAAI,EAAE,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACtB,GAAG,EAAE,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IAErB,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,cAAI,CAAC,OAAO,CACf,cAAI,CAAC,MAAM,CAAC,IAAA,YAAI,EAA0C;QACxD,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,IAAI;QAEX,IAAI,EAAE,cAAI,CAAC,GAAG,CAAC,8CAAsC,CAAC;QAEtD,IAAI,EAAE,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACtB,GAAG,EAAE,cAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACrB,IAAI,EAAE,IAAI;KACX,CAAC,CAAC,CACJ;IAED,IAAI,EAAE,cAAI,CAAC,GAAG,CAAC,8CAAsC,CAAC;IACtD,IAAI,EAAE,cAAI,CAAC,GAAG,CAAC,8CAAsC,CAAC;IAEtD,MAAM,EAAE,cAAI,CAAC,GAAG,CAAC,8CAAsC,CAAC;IACxD,OAAO,EAAE,cAAI,CAAC,GAAG,CAAC,8CAAsC,CAAC;IAEzD,KAAK,EAAE,cAAI,CAAC,KAAK,CAAC,CAAC,cAAI,CAAC,MAAM,EAAE,EAAE,cAAI,CAAC,QAAQ,CAAC,CAAC,cAAI,CAAC,GAAG,EAAE,CAAC,EAAE,cAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;CAC5E,CAAC,CAAC,EACH,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAC7B,CAAC,CAAA"}
@@ -1,16 +0,0 @@
1
- import { HistoryRecord } from '../history';
2
- import { Endpoint } from '../models';
3
- declare const _default: Endpoint<HistoryRecord[], import("../models").IHttpRequestIncommingContext> & {
4
- http: {
5
- readonly method: "GET";
6
- readonly path: "/_mock/history";
7
- };
8
- } & {
9
- webSocket: {
10
- readonly path: "history:get";
11
- };
12
- } & {
13
- handler: ({ reply, storage }: import("../models").RequestContext<import("../models").IHttpRequestIncommingContext, HistoryRecord[]>) => void;
14
- };
15
- export default _default;
16
- //# sourceMappingURL=history-records.get-list.endpoint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"history-records.get-list.endpoint.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/history-records.get-list.endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;;;;;;;;;;;;;AAErC,wBAMI"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const models_1 = require("../models");
4
- exports.default = models_1.Endpoint
5
- .build()
6
- .bindToHttp({ method: 'GET', path: '/_mock/history' })
7
- .bindToWebSocket({ path: 'history:get' })
8
- .assignHandler(({ reply, storage }) => reply.ok([...storage.history.values()].sort((a, b) => b.meta.requestedAt - a.meta.requestedAt)));
9
- //# sourceMappingURL=history-records.get-list.endpoint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"history-records.get-list.endpoint.js","sourceRoot":"","sources":["../../../../src/server/endpoints/history-records.get-list.endpoint.ts"],"names":[],"mappings":";;AACA,sCAAqC;AAErC,kBAAe,iBAAQ;KACpB,KAAK,EAAmB;KACxB,UAAU,CAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;KAC5D,eAAe,CAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;KAC/C,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CACpC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAChG,CAAC"}
@@ -1,8 +0,0 @@
1
- import { Middleware } from '../models';
2
- declare const _default: Middleware & {
3
- required: "expectation"[];
4
- } & {
5
- handler: import("../models").TMiddlewareHandler<"expectation">;
6
- };
7
- export default _default;
8
- //# sourceMappingURL=add-history.middleware.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-history.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/add-history.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;AAEvC,wBAUK"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const models_1 = require("../models");
4
- exports.default = models_1.Middleware
5
- .build(__filename)
6
- .requires(['expectation'])
7
- .assignHandler((context, next) => {
8
- const historyRecord = context.storage.history
9
- .register(context.toPlain())
10
- .assign({ expectation: context.shared.expectation });
11
- context.exchange.ws.publish('history:added', historyRecord);
12
- next({ historyRecord });
13
- });
14
- //# sourceMappingURL=add-history.middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-history.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/add-history.middleware.ts"],"names":[],"mappings":";;AACA,sCAAuC;AAEvC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,CAAC;KACjB,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC;KACzB,aAAa,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;IAC/B,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO;SAC1C,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;SAC3B,MAAM,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IAEvD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IAC5D,IAAI,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { Middleware } from '../models';
2
- declare const _default: Middleware & {
3
- required: ("expectation" | "historyRecord")[];
4
- } & {
5
- handler: import("../models").TMiddlewareHandler<"expectation" | "historyRecord">;
6
- };
7
- export default _default;
8
- //# sourceMappingURL=destroy-request.midleware.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"destroy-request.midleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/destroy-request.midleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;AAEvC,wBAcK"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const models_1 = require("../models");
4
- exports.default = models_1.Middleware
5
- .build(__filename)
6
- .requires(['expectation', 'historyRecord'])
7
- .assignHandler((context, next) => {
8
- if (context.shared.expectation.destroy) {
9
- context.shared.historyRecord
10
- .assign({ error: { code: context.shared.expectation.destroy, isManual: true } })
11
- .changeState('finished');
12
- context.exchange.ws.publish('history:updated', context.shared.historyRecord);
13
- return context.http.response.destroy(new Error(context.shared.expectation.destroy));
14
- }
15
- next();
16
- });
17
- //# sourceMappingURL=destroy-request.midleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"destroy-request.midleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/destroy-request.midleware.ts"],"names":[],"mappings":";;AACA,sCAAuC;AAEvC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,CAAC;KACjB,QAAQ,CAAC,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;KAC1C,aAAa,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE;IAC/B,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QACvC,OAAO,CAAC,MAAM,CAAC,aAAa;aACzB,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC;aAC/E,WAAW,CAAC,UAAU,CAAC,CAAC;QAE3B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC7E,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IACtF,CAAC;IAED,IAAI,EAAE,CAAC;AACT,CAAC,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { Middleware } from '../models';
2
- declare const _default: Middleware & {
3
- required: "expectation"[];
4
- } & {
5
- handler: import("../models").TMiddlewareHandler<"expectation">;
6
- };
7
- export default _default;
8
- //# sourceMappingURL=handle-expectation-delay.middleware.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handle-expectation-delay.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/handle-expectation-delay.middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;AAGvC,wBASK"}
@@ -1,18 +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 models_1 = require("../models");
8
- const utils_1 = require("../../utils");
9
- exports.default = models_1.Middleware
10
- .build(__filename)
11
- .requires(['expectation'])
12
- .assignHandler(async (context, next) => {
13
- if (context.shared.expectation.delay) {
14
- await (0, utils_1.wait)(lodash_1.default.flatten([context.shared.expectation.delay])[0].ms);
15
- }
16
- next();
17
- });
18
- //# sourceMappingURL=handle-expectation-delay.middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handle-expectation-delay.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/handle-expectation-delay.middleware.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAEvB,sCAAuC;AACvC,uCAAmC;AAEnC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,CAAC;KACjB,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC;KACzB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACrC,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACrC,MAAM,IAAA,YAAI,EAAC,gBAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,EAAE,CAAC;AACT,CAAC,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { Middleware } from '../models';
2
- declare const _default: Middleware & {
3
- required: ("expectation" | "historyRecord")[];
4
- } & {
5
- handler: import("../models").TMiddlewareHandler<"expectation" | "historyRecord">;
6
- };
7
- export default _default;
8
- //# sourceMappingURL=handle-expectation-forward.middleware.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handle-expectation-forward.middleware.d.ts","sourceRoot":"","sources":["../../../../src/server/middlewares/handle-expectation-forward.middleware.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;;;;;;AAEvC,wBA+FK"}
@@ -1,86 +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 axios_1 = __importDefault(require("axios"));
7
- const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const utils_1 = require("../../utils");
10
- const models_1 = require("../models");
11
- exports.default = models_1.Middleware
12
- .build(__filename)
13
- .requires(['expectation', 'historyRecord'])
14
- .assignHandler(async (context, next) => {
15
- if (!context.shared.expectation.forward) {
16
- return next();
17
- }
18
- const { protocol, host, port, timeout, proxy } = context.shared.expectation.forward;
19
- const manipulatedContext = context.shared.expectation
20
- .manipulateContext('request', context.toPlain(), { clone: true });
21
- const body = manipulatedContext.body === undefined ? manipulatedContext.bodyRaw : manipulatedContext.body;
22
- const bodyRaw = Buffer.from(typeof body === 'object' ? JSON.stringify(body) : String(body));
23
- Object.assign(manipulatedContext, {
24
- bodyRaw,
25
- headers: {
26
- 'connection': 'close',
27
- ...manipulatedContext.headers,
28
- ...((!manipulatedContext.headers?.['transfer-encoding'] && bodyRaw?.length) && {
29
- 'content-length': String(bodyRaw.length),
30
- }),
31
- },
32
- });
33
- const historyRecord = context.shared.historyRecord.assign({ forwaded: { request: manipulatedContext } });
34
- context.exchange.ws.publish('history:updated', historyRecord);
35
- const response = await (0, axios_1.default)({
36
- timeout: timeout ?? 1000 * 30,
37
- method: manipulatedContext.method,
38
- headers: manipulatedContext.headers,
39
- url: manipulatedContext.path,
40
- baseURL: `${protocol.toLocaleLowerCase()}://${host}:${port}`,
41
- data: bodyRaw,
42
- params: context.query,
43
- responseType: 'arraybuffer',
44
- ...(proxy && {
45
- proxy,
46
- httpsAgent: (0, https_proxy_agent_1.default)(proxy.host)
47
- }),
48
- }).catch((error) => {
49
- if (!error.response) {
50
- historyRecord
51
- .assign({ error: lodash_1.default.pick(error, ['message', 'code']) })
52
- .changeState('finished');
53
- context.exchange.ws.publish('history:updated', historyRecord);
54
- context.reply.internalError(error.message);
55
- throw error;
56
- }
57
- return error.response;
58
- });
59
- const contentTypeKey = Object
60
- .keys(response.headers)
61
- .find((key) => key.toLowerCase() === 'content-type');
62
- const isJsonData = lodash_1.default.flatten([lodash_1.default.get(response.headers, contentTypeKey ?? '', '')])
63
- .join(',')
64
- .toLowerCase()
65
- .includes('application/json');
66
- const parsingResponseDataResult = isJsonData ? (0, utils_1.parseJsonSafe)(response.data) : null;
67
- const responseContext = {
68
- payloadType: isJsonData ? 'json' : 'plain',
69
- statusCode: response.status,
70
- headers: response.headers,
71
- dataRaw: response.data?.toString() ?? '',
72
- ...(parsingResponseDataResult?.status === 'OK' && { data: parsingResponseDataResult.result }),
73
- };
74
- historyRecord.extendForwarded({
75
- response: responseContext,
76
- curl: lodash_1.default.get(response.config, 'curlCommand'),
77
- });
78
- context.exchange.ws.publish('history:updated', historyRecord);
79
- return next({
80
- forwarded: {
81
- request: manipulatedContext,
82
- response: responseContext,
83
- },
84
- });
85
- });
86
- //# sourceMappingURL=handle-expectation-forward.middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handle-expectation-forward.middleware.js","sourceRoot":"","sources":["../../../../src/server/middlewares/handle-expectation-forward.middleware.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0C;AAC1C,0EAAgD;AAChD,oDAAuB;AAGvB,uCAA4C;AAC5C,sCAAuC;AAEvC,kBAAe,mBAAU;KACtB,KAAK,CAAC,UAAU,CAAC;KACjB,QAAQ,CAAC,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;KAC1C,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACrC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QACxC,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC;IACpF,MAAM,kBAAkB,GAA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AC,CAAC;IAEhC,MAAM,yBAAyB,GAAG,UAAU,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnF,MAAM,eAAe,GAA0B;QAC7C,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;QAE1C,UAAU,EAAE,QAAQ,CAAC,MAAM;QAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO;QAEzB,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;QACxC,GAAG,CAAC,yBAAyB,EAAE,MAAM,KAAK,IAAI,IAAI,EAAE,IAAI,EAAE,yBAAyB,CAAC,MAAM,EAAE,CAAC;KAC9F,CAAC;IAEF,aAAa,CAAC,eAAe,CAAC;QAC5B,QAAQ,EAAE,eAAe;QACzB,IAAI,EAAE,gBAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;KAC5C,CAAC,CAAC;IAEH,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;IAE9D,OAAO,IAAI,CAAC;QACV,SAAS,EAAE;YACT,OAAO,EAAE,kBAAkB;YAC3B,QAAQ,EAAE,eAAe;SAC1B;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- import { Middleware } from '../models';
2
- declare const _default: Middleware & {
3
- handler: import("../models").TMiddlewareHandler<never>;
4
- };
5
- export default _default;
6
- //# sourceMappingURL=resolve-public.middleware.d.ts.map