@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
@@ -2,34 +2,42 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildExpectationContext = void 0;
4
4
  const buildExpectationContext = () => ({
5
- path: '/foo/bar/baz',
6
- method: 'POST',
7
- payloadType: 'json',
8
- statusCode: 200,
9
- dataRaw: '{"foo": {"bar": {"baz": true}}}',
10
- data: {
11
- foo: {
5
+ incoming: {
6
+ type: 'json',
7
+ path: '/foo/bar/baz',
8
+ method: 'POST',
9
+ query: {
10
+ foo: 1,
12
11
  bar: {
13
- baz: true,
12
+ baz: null,
14
13
  },
15
14
  },
16
- },
17
- query: {
18
- foo: 1,
19
- bar: {
20
- baz: null,
15
+ bodyRaw: '{"foo": [{"bar": 1}, {"baz": ["2"]}]}',
16
+ body: {
17
+ foo: [
18
+ { bar: 1 },
19
+ { baz: ['2'] },
20
+ ],
21
+ },
22
+ headers: {
23
+ 'content-type': 'application/json',
24
+ 'accept-language': 'en/gb',
21
25
  },
22
26
  },
23
- bodyRaw: '{"foo": [{"bar": 1}, {"baz": ["2"]}]}',
24
- body: {
25
- foo: [
26
- { bar: 1 },
27
- { baz: ['2'] },
28
- ],
29
- },
30
- headers: {
31
- 'content-type': 'application/json',
32
- 'accept-language': 'en/gb',
27
+ outgoing: {
28
+ type: 'json',
29
+ status: 200,
30
+ dataRaw: '{"foo": {"bar": {"baz": true}}}',
31
+ data: {
32
+ foo: {
33
+ bar: {
34
+ baz: true,
35
+ },
36
+ },
37
+ },
38
+ headers: {
39
+ 'content-type': 'application/json',
40
+ },
33
41
  },
34
42
  });
35
43
  exports.buildExpectationContext = buildExpectationContext;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/expectations/__utils__/index.ts"],"names":[],"mappings":";;;AAEO,MAAM,uBAAuB,GAAG,GAAiD,EAAE,CAAC,CAAC;IAC1F,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,MAAM;IAEnB,UAAU,EAAE,GAAG;IAEf,OAAO,EAAE,iCAAiC;IAC1C,IAAI,EAAE;QACJ,GAAG,EAAE;YACH,GAAG,EAAE;gBACH,GAAG,EAAE,IAAI;aACV;SACF;KACF;IAED,KAAK,EAAE;QACL,GAAG,EAAE,CAAC;QACN,GAAG,EAAE;YACH,GAAG,EAAE,IAAI;SACV;KACF;IAED,OAAO,EAAE,uCAAuC;IAChD,IAAI,EAAE;QACJ,GAAG,EAAE;YACH,EAAE,GAAG,EAAE,CAAC,EAAE;YACV,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE;SACf;KACF;IAED,OAAO,EAAE;QACP,cAAc,EAAE,kBAAkB;QAClC,iBAAiB,EAAE,OAAO;KAC3B;CACF,CAAC,CAAC;AAnCU,QAAA,uBAAuB,2BAmCjC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/expectations/__utils__/index.ts"],"names":[],"mappings":";;;AAEO,MAAM,uBAAuB,GAAG,GAA6C,EAAE,CAAC,CAAC;IACtF,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM;QAEZ,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,MAAM;QAEd,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;YACN,GAAG,EAAE;gBACH,GAAG,EAAE,IAAI;aACV;SACF;QAED,OAAO,EAAE,uCAAuC;QAChD,IAAI,EAAE;YACJ,GAAG,EAAE;gBACH,EAAE,GAAG,EAAE,CAAC,EAAE;gBACV,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE;aACf;SACF;QAED,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,iBAAiB,EAAE,OAAO;SAC3B;KACF;IAED,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,GAAG;QAEX,OAAO,EAAE,iCAAiC;QAC1C,IAAI,EAAE;YACJ,GAAG,EAAE;gBACH,GAAG,EAAE;oBACH,GAAG,EAAE,IAAI;iBACV;aACF;SACF;QAED,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF;CACF,CAAC,CAAC;AA7CU,QAAA,uBAAuB,2BA6CjC"}
@@ -1,5 +1,4 @@
1
- export * from './storage';
2
- export * from './model';
1
+ export * from './models';
3
2
  export * from './types';
4
3
  export * from './utils';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/expectations/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/expectations/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -14,8 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./storage"), exports);
18
- __exportStar(require("./model"), exports);
17
+ __exportStar(require("./models"), exports);
19
18
  __exportStar(require("./types"), exports);
20
19
  __exportStar(require("./utils"), exports);
21
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/expectations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/expectations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,0CAAwB"}
@@ -0,0 +1,33 @@
1
+ import { AxiosProxyConfig } from 'axios';
2
+ import { ValueError } from '@n1k1t/typebox/errors';
3
+ import _ from 'lodash';
4
+ import { IExpectationMeta, IExpectationOperatorContext, IExpectationSchema, TExpectationType } from '../types';
5
+ import { TRequestProtocol } from '../../types';
6
+ import * as operators from '../operators';
7
+ export type TBuildExpectationConfiguration<TContext extends PartialDeep<IExpectationOperatorContext> = {}> = Pick<Expectation<TContext>, 'schema'> & Partial<Pick<Expectation<TContext>, 'name' | 'isEnabled' | 'type'>>;
8
+ export declare class Expectation<TContext extends PartialDeep<IExpectationOperatorContext> = {}> {
9
+ type: TExpectationType;
10
+ schema: IExpectationSchema<TContext>;
11
+ TSchema: IExpectationSchema<TContext>;
12
+ TPlain: Pick<Expectation<TContext>, 'schema' | 'type' | 'id' | 'isEnabled' | 'meta' | 'name'>;
13
+ id: string;
14
+ name: string;
15
+ isEnabled: boolean;
16
+ meta: IExpectationMeta;
17
+ request: operators.root<TContext, "path" | "state" | "seed" | "error" | "delay" | "method" | "incoming.body" | "incoming.bodyRaw" | "incoming.query" | "incoming.headers" | "outgoing.status" | "outgoing.headers" | "outgoing.data" | "outgoing.dataRaw", void> | null;
18
+ response: operators.root<TContext, "path" | "state" | "seed" | "error" | "delay" | "method" | "incoming.body" | "incoming.bodyRaw" | "incoming.query" | "incoming.headers" | "outgoing.status" | "outgoing.headers" | "outgoing.data" | "outgoing.dataRaw", void> | null;
19
+ get forward(): {
20
+ url?: string;
21
+ baseUrl?: string;
22
+ timeout?: number;
23
+ proxy?: AxiosProxyConfig & {
24
+ protocol: TRequestProtocol;
25
+ };
26
+ } | undefined;
27
+ constructor(type: TExpectationType, schema: IExpectationSchema<TContext>);
28
+ increaseExecutionsCounter(): this;
29
+ validate(): ValueError[];
30
+ toPlain(): Expectation<TContext>['TPlain'];
31
+ static build<TContext extends PartialDeep<IExpectationOperatorContext> = {}>(configuration: TBuildExpectationConfiguration<TContext>): Expectation<TContext> & _.Omit<TBuildExpectationConfiguration<TContext>, "type" | "schema">;
32
+ }
33
+ //# sourceMappingURL=expectation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expectation.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/expectation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,8BAA8B,CAAC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,IACvG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC;AAE9G,qBAAa,WAAW,CAAC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE;IA0BlE,IAAI,EAAE,gBAAgB;IAAS,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC;IAzB/E,OAAO,EAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,EAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;IAE/F,EAAE,EAAE,MAAM,CAAY;IACtB,IAAI,EAAE,MAAM,CAA8D;IAE1E,SAAS,EAAE,OAAO,CAAQ;IAE1B,IAAI,EAAE,gBAAgB,CAG3B;IAEK,OAAO,iQAEL;IAEF,QAAQ,iQAEN;IAET,IAAW,OAAO;;;;;;;kBAEjB;gBAEkB,IAAI,EAAE,gBAAgB,EAAS,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC;IAE/E,yBAAyB,IAAI,IAAI;IAKjC,QAAQ,IAAI,UAAU,EAAE;IAIxB,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC;IAajD,MAAM,CAAC,KAAK,CAAC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,EACzE,aAAa,EAAE,8BAA8B,CAAC,QAAQ,CAAC;CAY1D"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Expectation = void 0;
30
+ const random_animal_name_1 = __importDefault(require("random-animal-name"));
31
+ const uuid_1 = require("uuid");
32
+ const lodash_1 = __importDefault(require("lodash"));
33
+ const operators = __importStar(require("../operators"));
34
+ class Expectation {
35
+ get forward() {
36
+ return this.schema.forward;
37
+ }
38
+ constructor(type, schema) {
39
+ this.type = type;
40
+ this.schema = schema;
41
+ this.id = (0, uuid_1.v4)();
42
+ this.name = (0, random_animal_name_1.default)().split(' ').map(lodash_1.default.capitalize).join('');
43
+ this.isEnabled = true;
44
+ this.meta = {
45
+ executionsCount: 0,
46
+ additional: {},
47
+ };
48
+ this.request = this.schema.request
49
+ ? new operators.root(operators, this.schema.request)
50
+ : null;
51
+ this.response = this.schema.response
52
+ ? new operators.root(operators, this.schema.response)
53
+ : null;
54
+ }
55
+ increaseExecutionsCounter() {
56
+ this.meta.executionsCount += 1;
57
+ return this;
58
+ }
59
+ validate() {
60
+ return [];
61
+ }
62
+ toPlain() {
63
+ return {
64
+ id: this.id,
65
+ type: this.type,
66
+ name: this.name,
67
+ schema: this.schema,
68
+ meta: this.meta,
69
+ isEnabled: this.isEnabled,
70
+ };
71
+ }
72
+ static build(configuration) {
73
+ // expectation.meta.additional = Object.assign(
74
+ // extractMetaAdditionalFromExpectationSchema(expectation.request ?? {}),
75
+ // extractMetaAdditionalFromExpectationSchema(expectation.response ?? {}),
76
+ // );
77
+ return Object.assign(new Expectation(configuration.type ?? 'HTTP', configuration.schema), lodash_1.default.omit(configuration, ['schema', 'type']));
78
+ }
79
+ }
80
+ exports.Expectation = Expectation;
81
+ //# sourceMappingURL=expectation.js.map
@@ -0,0 +1 @@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E,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YAEf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YAEnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CACV,aAAuD;QAEvD,+CAA+C;QAC/C,2EAA2E;QAC3E,4EAA4E;QAC5E,KAAK;QAEL,OAAO,MAAM,CAAC,MAAM,CAClB,IAAI,WAAW,CAAC,aAAa,CAAC,IAAI,IAAI,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EACnE,gBAAC,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAC1C,CAAC;IACJ,CAAC;CACF;AA/DD,kCA+DC"}
@@ -0,0 +1,4 @@
1
+ export * from './expectation';
2
+ export * from './operator';
3
+ export * from './storage';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./expectation"), exports);
18
+ __exportStar(require("./operator"), exports);
19
+ __exportStar(require("./storage"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/expectations/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6CAA2B;AAC3B,4CAA0B"}
@@ -0,0 +1,20 @@
1
+ import { IExpectationOperatorContext, IExpectationOperatorsSchema, TExpectationOperators } from '../types';
2
+ export type TExpectationOperatorConstructor<TContext extends PartialDeep<IExpectationOperatorContext>> = Constructable<ExpectationOperator<TContext, any>, ConstructorParameters<typeof ExpectationOperator>>;
3
+ export declare abstract class ExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext>, TSchema> {
4
+ operators: TExpectationOperators;
5
+ command: TSchema;
6
+ TContext: TContext;
7
+ TSchema: TSchema;
8
+ abstract match(context: TContext): boolean;
9
+ abstract manipulate<T extends TContext>(context: T): T;
10
+ constructor(operators: TExpectationOperators, command: TSchema);
11
+ protected compileExecHandler(raw: TFunction<any, any[]> | string, provide: ('payload' | 'utils')[]): (context: TContext, ...args: unknown[]) => any;
12
+ protected extractNestedSchema(schema: IExpectationOperatorsSchema<any, any>): {
13
+ [K in keyof IExpectationOperatorsSchema]: null | {
14
+ key: K;
15
+ nested: IExpectationOperatorsSchema[K];
16
+ };
17
+ }[keyof IExpectationOperatorsSchema];
18
+ private compileExecUtils;
19
+ }
20
+ //# sourceMappingURL=operator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/operator.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,2BAA2B,EAE3B,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,+BAA+B,CAAC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,IACnG,aAAa,CAAC,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,qBAAqB,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAA;AAEtG,8BAAsB,mBAAmB,CAAC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,EAAE,OAAO;IAOvF,SAAS,EAAE,qBAAqB;IAAS,OAAO,EAAE,OAAO;IANrE,QAAQ,EAAG,QAAQ,CAAC;IACpB,OAAO,EAAG,OAAO,CAAC;aAET,KAAK,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;aACjC,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;gBAE1C,SAAS,EAAE,qBAAqB,EAAS,OAAO,EAAE,OAAO;IAE5E,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,SAAS,GAAG,OAAO,CAAC,EAAE,aAY/E,QAAQ,WAAW,OAAO,EAAE;IAQ/C,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG;SAC3E,CAAC,IAAI,MAAM,2BAA2B,GAAG,IAAI,GAAG;YAC/C,GAAG,EAAE,CAAC,CAAC;YACP,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC;SACxC;KACF,CAAC,MAAM,2BAA2B,CAAC;IAKpC,OAAO,CAAC,gBAAgB;CAgBzB"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ExpectationOperator = void 0;
7
+ const faker_1 = require("@faker-js/faker");
8
+ const dayjs_1 = __importDefault(require("dayjs"));
9
+ const lodash_1 = __importDefault(require("lodash"));
10
+ class ExpectationOperator {
11
+ constructor(operators, command) {
12
+ this.operators = operators;
13
+ this.command = command;
14
+ }
15
+ compileExecHandler(raw, provide) {
16
+ const parameters = [];
17
+ if (provide.includes('payload')) {
18
+ parameters.push('payload');
19
+ }
20
+ if (provide.includes('utils')) {
21
+ parameters.push('{ _, T, context }');
22
+ }
23
+ const handler = typeof raw === 'function' ? raw : Function(parameters.join(', '), `return (() => ${raw})()`);
24
+ return (context, ...args) => {
25
+ const utils = this.compileExecUtils(context);
26
+ const handled = handler(...args, utils);
27
+ return typeof handled === 'function' ? handled(...args, utils) : handled;
28
+ };
29
+ }
30
+ extractNestedSchema(schema) {
31
+ const key = Object.keys(schema)[0];
32
+ return key ? { key, nested: schema[key] } : null;
33
+ }
34
+ compileExecUtils(context) {
35
+ const faker = new faker_1.Faker({ locale: [faker_1.ru, faker_1.en, faker_1.en_GB] });
36
+ if (context.seed) {
37
+ faker.seed(context.seed);
38
+ }
39
+ return {
40
+ context: context,
41
+ T: (payload) => payload,
42
+ _: lodash_1.default,
43
+ d: dayjs_1.default,
44
+ faker: faker,
45
+ };
46
+ }
47
+ }
48
+ exports.ExpectationOperator = ExpectationOperator;
49
+ //# sourceMappingURL=operator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator.js","sourceRoot":"","sources":["../../../../src/expectations/models/operator.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAuD;AACvD,kDAA0B;AAC1B,oDAAuB;AAYvB,MAAsB,mBAAmB;IAOvC,YAAmB,SAAgC,EAAS,OAAgB;QAAzD,cAAS,GAAT,SAAS,CAAuB;QAAS,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEtE,kBAAkB,CAAC,GAAmC,EAAE,OAAgC;QAChG,MAAM,UAAU,GAAa,EAAE,CAAC;QAEhC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAA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AC;QAED,OAAO;YACL,OAAO,EAAmC,OAAO;YACjD,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAM,OAAO;YAE5B,CAAC,EAAE,gBAAC;YACJ,CAAC,EAAE,eAAK;YACR,KAAK,EAAE,KAAK;SACb,CAAA;IACH,CAAC;CACF;AAvDD,kDAuDC"}
@@ -0,0 +1,15 @@
1
+ import { ValueError } from '@n1k1t/typebox/errors';
2
+ import { IExpectationOperatorContext, TExpectationContextLocation } from '../types';
3
+ import { Expectation, TBuildExpectationConfiguration } from './expectation';
4
+ export type TExpectationsStorageRegisterationResult = {
5
+ status: 'REGISTRED';
6
+ expectation: Expectation<any>;
7
+ } | {
8
+ status: 'ERROR';
9
+ reasons: ValueError[];
10
+ };
11
+ export declare class ExpectationsStorage extends Map<string, Expectation<any>> {
12
+ register(configuration: TBuildExpectationConfiguration<any>): TExpectationsStorageRegisterationResult;
13
+ match<TContext extends PartialDeep<IExpectationOperatorContext>>(location: TExpectationContextLocation, context: TContext): Expectation<TContext> | null;
14
+ }
15
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAE5E,MAAM,MAAM,uCAAuC,GAC/C;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAA;CAAE,GACtD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAE/C,qBAAa,mBAAoB,SAAQ,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7D,QAAQ,CAAC,aAAa,EAAE,8BAA8B,CAAC,GAAG,CAAC,GAAG,uCAAuC;IAYrG,KAAK,CAAC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,EACpE,QAAQ,EAAE,2BAA2B,EACrC,OAAO,EAAE,QAAQ,GAChB,WAAW,CAAC,QAAQ,CAAC,GAAG,IAAI;CAShC"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExpectationsStorage = void 0;
4
- const model_1 = require("./model");
4
+ const expectation_1 = require("./expectation");
5
5
  class ExpectationsStorage extends Map {
6
6
  register(configuration) {
7
- const expectation = model_1.Expectation.build('HTTP', configuration);
7
+ const expectation = expectation_1.Expectation.build(configuration);
8
8
  const errors = expectation.validate();
9
9
  if (errors.length) {
10
10
  return { status: 'ERROR', reasons: errors };
@@ -12,24 +12,14 @@ class ExpectationsStorage extends Map {
12
12
  this.set(expectation.id, expectation);
13
13
  return { status: 'REGISTRED', expectation };
14
14
  }
15
- findByContext(location, context) {
15
+ match(location, context) {
16
16
  for (const expectation of this.values()) {
17
- if (expectation.isEnabled && expectation.validateContext(location, context)) {
17
+ if (expectation.isEnabled && expectation[location]?.match(context)) {
18
18
  return expectation;
19
19
  }
20
20
  }
21
21
  return null;
22
22
  }
23
- findAndManipulateContext(location, context, options) {
24
- const expectation = this.findByContext(location, context);
25
- if (!expectation) {
26
- return null;
27
- }
28
- return {
29
- expectation,
30
- context: expectation.manipulateContext(location, context, options),
31
- };
32
- }
33
23
  }
34
24
  exports.ExpectationsStorage = ExpectationsStorage;
35
25
  //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../../src/expectations/models/storage.ts"],"names":[],"mappings":";;;AAGA,+CAA4E;AAM5E,MAAa,mBAAoB,SAAQ,GAA6B;IAC7D,QAAQ,CAAC,aAAkD;QAChE,MAAM,WAAW,GAAG,yBAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QAEtC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;QAC7C,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACtC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IAC9C,CAAC;IAEM,KAAK,CACV,QAAqC,EACrC,OAAiB;QAEjB,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;YACxC,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnE,OAAO,WAAW,CAAC;YACrB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAzBD,kDAyBC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=storage.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.spec.d.ts","sourceRoot":"","sources":["../../../../src/expectations/models/storage.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const __utils__1 = require("../__utils__");
4
+ const storage_1 = require("./storage");
5
+ describe('Expectations.Models.Storage', () => {
6
+ describe('request', () => {
7
+ it('should not match with empty storage', () => {
8
+ const storage = new storage_1.ExpectationsStorage();
9
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())).toBeNull();
10
+ });
11
+ it('should match with 1 expectation', () => {
12
+ const storage = new storage_1.ExpectationsStorage();
13
+ const { expectation } = storage.register({
14
+ schema: {
15
+ request: { $has: { $location: 'path', $value: '/foo/bar/baz' } },
16
+ },
17
+ });
18
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())?.id).toEqual(expectation.id);
19
+ });
20
+ it('should not match with 1 expectation', () => {
21
+ const storage = new storage_1.ExpectationsStorage();
22
+ storage.register({
23
+ schema: {
24
+ request: { $has: { $location: 'path', $value: '/foo' } },
25
+ },
26
+ });
27
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())).toBeNull();
28
+ });
29
+ it('should match with 2 expectations', () => {
30
+ const storage = new storage_1.ExpectationsStorage();
31
+ storage.register({
32
+ schema: {
33
+ request: { $has: { $location: 'path', $value: '/foo/bar' } },
34
+ },
35
+ });
36
+ const { expectation } = storage.register({
37
+ schema: {
38
+ request: { $has: { $location: 'method', $valueAnyOf: ['GET', 'POST'] } },
39
+ },
40
+ });
41
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())?.id).toEqual(expectation.id);
42
+ });
43
+ it('should not match with 2 expectations', () => {
44
+ const storage = new storage_1.ExpectationsStorage();
45
+ storage.register({
46
+ schema: {
47
+ request: { $has: { $location: 'path', $value: '/foo/bar' } },
48
+ },
49
+ });
50
+ storage.register({
51
+ schema: {
52
+ request: { $has: { $location: 'method', $valueAnyOf: ['GET'] } },
53
+ },
54
+ });
55
+ expect(storage.match('request', (0, __utils__1.buildExpectationContext)())).toBeNull();
56
+ });
57
+ });
58
+ describe('reponse', () => {
59
+ it('should not match with empty storage', () => {
60
+ const storage = new storage_1.ExpectationsStorage();
61
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())).toBeNull();
62
+ });
63
+ it('should match with 1 expectation', () => {
64
+ const storage = new storage_1.ExpectationsStorage();
65
+ const { expectation } = storage.register({
66
+ schema: {
67
+ response: { $has: { $location: 'path', $value: '/foo/bar/baz' } },
68
+ },
69
+ });
70
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())?.id).toEqual(expectation.id);
71
+ });
72
+ it('should not match with 1 expectation', () => {
73
+ const storage = new storage_1.ExpectationsStorage();
74
+ storage.register({
75
+ schema: {
76
+ response: { $has: { $location: 'path', $value: '/foo' } },
77
+ },
78
+ });
79
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())).toBeNull();
80
+ });
81
+ it('should match with 2 expectations', () => {
82
+ const storage = new storage_1.ExpectationsStorage();
83
+ storage.register({
84
+ schema: {
85
+ response: { $has: { $location: 'path', $value: '/foo/bar' } },
86
+ },
87
+ });
88
+ const { expectation } = storage.register({
89
+ schema: {
90
+ response: { $has: { $location: 'method', $valueAnyOf: ['GET', 'POST'] } },
91
+ },
92
+ });
93
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())?.id).toEqual(expectation.id);
94
+ });
95
+ it('should not match with 2 expectations', () => {
96
+ const storage = new storage_1.ExpectationsStorage();
97
+ storage.register({
98
+ schema: {
99
+ response: { $has: { $location: 'path', $value: '/foo/bar' } },
100
+ },
101
+ });
102
+ storage.register({
103
+ schema: {
104
+ response: { $has: { $location: 'method', $valueAnyOf: ['GET'] } },
105
+ },
106
+ });
107
+ expect(storage.match('response', (0, __utils__1.buildExpectationContext)())).toBeNull();
108
+ });
109
+ });
110
+ });
111
+ //# sourceMappingURL=storage.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.spec.js","sourceRoot":"","sources":["../../../../src/expectations/models/storage.spec.ts"],"names":[],"mappings":";;AAAA,2CAAuD;AACvD,uCAA+C;AAG/C,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC7C,MAAM,OAAO,GAAG,IAAI,6BAAmB,EAAE,CAAC;YAC1C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,IAAA,kCAAuB,GAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QACzE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE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CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE;iBAC1E;aACF,CAAC,CAAC;YAEH,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,IAAA,kCAAuB,GAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,OAAO,GAAG,IAAI,6BAAmB,EAAE,CAAC;YAE1C,OAAO,CAAC,QAAQ,CAAC;gBACf,MAAM,EAAE;oBACN,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;iBAC9D;aACF,CAAC,CAAC;YAEH,OAAO,CAAC,QAAQ,CAAC;gBACf,MAAM,EAAE;oBACN,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE;iBAClE;aACF,CAAC,CAAC;YAEH,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,IAAA,kCAAuB,GAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +1,8 @@
1
- declare const _default: import("..").TExpectationOperatorHandler<"$and">;
2
- export default _default;
1
+ import { IExpectationOperatorContext, IExpectationOperatorsSchema, TExpectationOperatorLocation } from '../types';
2
+ import { ExpectationOperator } from '../models/operator';
3
+ export default class AndExpectationOperator<TContext extends PartialDeep<IExpectationOperatorContext> = {}, TLocation extends TExpectationOperatorLocation = TExpectationOperatorLocation, TValue = void> extends ExpectationOperator<TContext, IExpectationOperatorsSchema<TContext, TLocation, TValue>[]> {
4
+ compiled: ExpectationOperator<TContext, any>[];
5
+ match(context: TContext): boolean;
6
+ manipulate<T extends TContext>(context: T): T;
7
+ }
3
8
  //# sourceMappingURL=and.operator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"and.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/and.operator.ts"],"names":[],"mappings":";AAEA,wBAGE"}
1
+ {"version":3,"file":"and.operator.d.ts","sourceRoot":"","sources":["../../../../src/expectations/operators/and.operator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAmC,MAAM,oBAAoB,CAAC;AAE1F,MAAM,CAAC,OAAO,OAAO,sBAAsB,CACzC,QAAQ,SAAS,WAAW,CAAC,2BAA2B,CAAC,GAAG,EAAE,EAC9D,SAAS,SAAS,4BAA4B,GAAG,4BAA4B,EAC7E,MAAM,GAAG,IAAI,CACb,SAAQ,mBAAmB,CAC3B,QAAQ,EACR,2BAA2B,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,CAC3D;IACQ,QAAQ,uCAMV;IAEE,KAAK,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAIjC,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC;CAIrD"}
@@ -1,5 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("./utils");
4
- exports.default = (0, utils_1.buildExpectationOperatorHandler)((mode, schema, context, { exploreNestedSchema }) => schema.every((configuration) => exploreNestedSchema(mode, configuration, context)));
3
+ const operator_1 = require("../models/operator");
4
+ class AndExpectationOperator extends operator_1.ExpectationOperator {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.compiled = this.command
8
+ .map((schema) => this.extractNestedSchema(schema))
9
+ .filter(Boolean)
10
+ .map((extracted) => {
11
+ const Operator = this.operators[extracted.key];
12
+ return new Operator(this.operators, extracted.nested);
13
+ });
14
+ }
15
+ match(context) {
16
+ return this.compiled.every((operator) => operator.match(context));
17
+ }
18
+ manipulate(context) {
19
+ this.compiled.forEach((operator) => operator.manipulate(context));
20
+ return context;
21
+ }
22
+ }
23
+ exports.default = AndExpectationOperator;
5
24
  //# sourceMappingURL=and.operator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"and.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/and.operator.ts"],"names":[],"mappings":";;AAAA,mCAA0D;AAE1D,kBAAe,IAAA,uCAA+B,EAC5C,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,CACjD,MAAM,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,CACrF,CAAC"}
1
+ {"version":3,"file":"and.operator.js","sourceRoot":"","sources":["../../../../src/expectations/operators/and.operator.ts"],"names":[],"mappings":";;AACA,iDAA0F;AAE1F,MAAqB,sBAInB,SAAQ,8BAGT;IAPD;;QAQS,aAAQ,GAAG,IAAI,CAAC,OAAO;aAC3B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAE,CAAC;aAClD,MAAM,CAAC,OAAO,CAAC;aACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACjB,MAAM,QAAQ,GAA8C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAC1F,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IAUP,CAAC;IARQ,KAAK,CAAC,OAAiB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,CAAC;IAEM,UAAU,CAAqB,OAAU;QAC9C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QAClE,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAxBD,yCAwBC"}