@thymian/core 0.0.0-PLACEHOLDER

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 (642) hide show
  1. package/README.md +59 -0
  2. package/dist/actions/action.d.ts +5 -0
  3. package/dist/actions/action.d.ts.map +1 -0
  4. package/dist/actions/action.js +2 -0
  5. package/dist/actions/action.js.map +1 -0
  6. package/dist/actions/close.action.d.ts +3 -0
  7. package/dist/actions/close.action.d.ts.map +1 -0
  8. package/dist/actions/close.action.js +2 -0
  9. package/dist/actions/close.action.js.map +1 -0
  10. package/dist/actions/core-analyze.action.d.ts +11 -0
  11. package/dist/actions/core-analyze.action.d.ts.map +1 -0
  12. package/dist/actions/core-analyze.action.js +2 -0
  13. package/dist/actions/core-analyze.action.js.map +1 -0
  14. package/dist/actions/core-lint.action.d.ts +9 -0
  15. package/dist/actions/core-lint.action.d.ts.map +1 -0
  16. package/dist/actions/core-lint.action.js +2 -0
  17. package/dist/actions/core-lint.action.js.map +1 -0
  18. package/dist/actions/core-request-sample.action.d.ts +9 -0
  19. package/dist/actions/core-request-sample.action.d.ts.map +1 -0
  20. package/dist/actions/core-request-sample.action.js +2 -0
  21. package/dist/actions/core-request-sample.action.js.map +1 -0
  22. package/dist/actions/core-test.action.d.ts +10 -0
  23. package/dist/actions/core-test.action.d.ts.map +1 -0
  24. package/dist/actions/core-test.action.js +2 -0
  25. package/dist/actions/core-test.action.js.map +1 -0
  26. package/dist/actions/core-validation-input.d.ts +6 -0
  27. package/dist/actions/core-validation-input.d.ts.map +1 -0
  28. package/dist/actions/core-validation-input.js +2 -0
  29. package/dist/actions/core-validation-input.js.map +1 -0
  30. package/dist/actions/format-load.action.d.ts +16 -0
  31. package/dist/actions/format-load.action.d.ts.map +1 -0
  32. package/dist/actions/format-load.action.js +36 -0
  33. package/dist/actions/format-load.action.js.map +1 -0
  34. package/dist/actions/format.action.d.ts +4 -0
  35. package/dist/actions/format.action.d.ts.map +1 -0
  36. package/dist/actions/format.action.js +2 -0
  37. package/dist/actions/format.action.js.map +1 -0
  38. package/dist/actions/index.d.ts +39 -0
  39. package/dist/actions/index.d.ts.map +1 -0
  40. package/dist/actions/index.js +14 -0
  41. package/dist/actions/index.js.map +1 -0
  42. package/dist/actions/ready.action.d.ts +3 -0
  43. package/dist/actions/ready.action.d.ts.map +1 -0
  44. package/dist/actions/ready.action.js +2 -0
  45. package/dist/actions/ready.action.js.map +1 -0
  46. package/dist/actions/report-flush.action.d.ts +6 -0
  47. package/dist/actions/report-flush.action.d.ts.map +1 -0
  48. package/dist/actions/report-flush.action.js +2 -0
  49. package/dist/actions/report-flush.action.js.map +1 -0
  50. package/dist/actions/request-dispatch.action.d.ts +13 -0
  51. package/dist/actions/request-dispatch.action.d.ts.map +1 -0
  52. package/dist/actions/request-dispatch.action.js +45 -0
  53. package/dist/actions/request-dispatch.action.js.map +1 -0
  54. package/dist/actions/traffic-load.action.d.ts +16 -0
  55. package/dist/actions/traffic-load.action.d.ts.map +1 -0
  56. package/dist/actions/traffic-load.action.js +36 -0
  57. package/dist/actions/traffic-load.action.js.map +1 -0
  58. package/dist/actions/validation-result.d.ts +18 -0
  59. package/dist/actions/validation-result.d.ts.map +1 -0
  60. package/dist/actions/validation-result.js +81 -0
  61. package/dist/actions/validation-result.js.map +1 -0
  62. package/dist/ajv.d.ts +5 -0
  63. package/dist/ajv.d.ts.map +1 -0
  64. package/dist/ajv.js +9 -0
  65. package/dist/ajv.js.map +1 -0
  66. package/dist/chalk.d.ts +2 -0
  67. package/dist/chalk.d.ts.map +1 -0
  68. package/dist/chalk.js +2 -0
  69. package/dist/chalk.js.map +1 -0
  70. package/dist/constants.d.ts +5 -0
  71. package/dist/constants.d.ts.map +1 -0
  72. package/dist/constants.js +6 -0
  73. package/dist/constants.js.map +1 -0
  74. package/dist/core-plugin.d.ts +5 -0
  75. package/dist/core-plugin.d.ts.map +1 -0
  76. package/dist/core-plugin.js +62 -0
  77. package/dist/core-plugin.js.map +1 -0
  78. package/dist/emitter/action-event.d.ts +19 -0
  79. package/dist/emitter/action-event.d.ts.map +1 -0
  80. package/dist/emitter/action-event.js +2 -0
  81. package/dist/emitter/action-event.js.map +1 -0
  82. package/dist/emitter/error-event.d.ts +13 -0
  83. package/dist/emitter/error-event.d.ts.map +1 -0
  84. package/dist/emitter/error-event.js +2 -0
  85. package/dist/emitter/error-event.js.map +1 -0
  86. package/dist/emitter/events.d.ts +10 -0
  87. package/dist/emitter/events.d.ts.map +1 -0
  88. package/dist/emitter/events.js +2 -0
  89. package/dist/emitter/events.js.map +1 -0
  90. package/dist/emitter/index.d.ts +6 -0
  91. package/dist/emitter/index.d.ts.map +1 -0
  92. package/dist/emitter/index.js +6 -0
  93. package/dist/emitter/index.js.map +1 -0
  94. package/dist/emitter/thymian-emitter.d.ts +61 -0
  95. package/dist/emitter/thymian-emitter.d.ts.map +1 -0
  96. package/dist/emitter/thymian-emitter.js +371 -0
  97. package/dist/emitter/thymian-emitter.js.map +1 -0
  98. package/dist/emitter/utils.d.ts +8 -0
  99. package/dist/emitter/utils.d.ts.map +1 -0
  100. package/dist/emitter/utils.js +16 -0
  101. package/dist/emitter/utils.js.map +1 -0
  102. package/dist/events/error.event.d.ts +5 -0
  103. package/dist/events/error.event.d.ts.map +1 -0
  104. package/dist/events/error.event.js +49 -0
  105. package/dist/events/error.event.js.map +1 -0
  106. package/dist/events/exit.event.d.ts +14 -0
  107. package/dist/events/exit.event.d.ts.map +1 -0
  108. package/dist/events/exit.event.js +9 -0
  109. package/dist/events/exit.event.js.map +1 -0
  110. package/dist/events/index.d.ts +15 -0
  111. package/dist/events/index.d.ts.map +1 -0
  112. package/dist/events/index.js +4 -0
  113. package/dist/events/index.js.map +1 -0
  114. package/dist/events/register-plugin.event.d.ts +51 -0
  115. package/dist/events/register-plugin.event.d.ts.map +1 -0
  116. package/dist/events/register-plugin.event.js +29 -0
  117. package/dist/events/register-plugin.event.js.map +1 -0
  118. package/dist/events/report.event.d.ts +104 -0
  119. package/dist/events/report.event.d.ts.map +1 -0
  120. package/dist/events/report.event.js +109 -0
  121. package/dist/events/report.event.js.map +1 -0
  122. package/dist/format/circular-references.d.ts +3 -0
  123. package/dist/format/circular-references.d.ts.map +1 -0
  124. package/dist/format/circular-references.js +71 -0
  125. package/dist/format/circular-references.js.map +1 -0
  126. package/dist/format/edges/edge.d.ts +9 -0
  127. package/dist/format/edges/edge.d.ts.map +1 -0
  128. package/dist/format/edges/edge.js +2 -0
  129. package/dist/format/edges/edge.js.map +1 -0
  130. package/dist/format/edges/has-sample.edge.d.ts +5 -0
  131. package/dist/format/edges/has-sample.edge.d.ts.map +1 -0
  132. package/dist/format/edges/has-sample.edge.js +2 -0
  133. package/dist/format/edges/has-sample.edge.js.map +1 -0
  134. package/dist/format/edges/http-link.edge.d.ts +10 -0
  135. package/dist/format/edges/http-link.edge.d.ts.map +1 -0
  136. package/dist/format/edges/http-link.edge.js +2 -0
  137. package/dist/format/edges/http-link.edge.js.map +1 -0
  138. package/dist/format/edges/http-transaction.edge.d.ts +5 -0
  139. package/dist/format/edges/http-transaction.edge.d.ts.map +1 -0
  140. package/dist/format/edges/http-transaction.edge.js +2 -0
  141. package/dist/format/edges/http-transaction.edge.js.map +1 -0
  142. package/dist/format/edges/is-secured-with.edge.d.ts +5 -0
  143. package/dist/format/edges/is-secured-with.edge.d.ts.map +1 -0
  144. package/dist/format/edges/is-secured-with.edge.js +2 -0
  145. package/dist/format/edges/is-secured-with.edge.js.map +1 -0
  146. package/dist/format/edges/sample-http-transaction.edge.d.ts +5 -0
  147. package/dist/format/edges/sample-http-transaction.edge.d.ts.map +1 -0
  148. package/dist/format/edges/sample-http-transaction.edge.js +2 -0
  149. package/dist/format/edges/sample-http-transaction.edge.js.map +1 -0
  150. package/dist/format/format-location.d.ts +13 -0
  151. package/dist/format/format-location.d.ts.map +1 -0
  152. package/dist/format/format-location.js +2 -0
  153. package/dist/format/format-location.js.map +1 -0
  154. package/dist/format/http-filter-expression-to-transaction-filter.d.ts +5 -0
  155. package/dist/format/http-filter-expression-to-transaction-filter.d.ts.map +1 -0
  156. package/dist/format/http-filter-expression-to-transaction-filter.js +88 -0
  157. package/dist/format/http-filter-expression-to-transaction-filter.js.map +1 -0
  158. package/dist/format/index.d.ts +14 -0
  159. package/dist/format/index.d.ts.map +1 -0
  160. package/dist/format/index.js +14 -0
  161. package/dist/format/index.js.map +1 -0
  162. package/dist/format/nodes/http-request.node.d.ts +29 -0
  163. package/dist/format/nodes/http-request.node.d.ts.map +1 -0
  164. package/dist/format/nodes/http-request.node.js +2 -0
  165. package/dist/format/nodes/http-request.node.js.map +1 -0
  166. package/dist/format/nodes/http-response.node.d.ts +12 -0
  167. package/dist/format/nodes/http-response.node.d.ts.map +1 -0
  168. package/dist/format/nodes/http-response.node.js +2 -0
  169. package/dist/format/nodes/http-response.node.js.map +1 -0
  170. package/dist/format/nodes/node.d.ts +9 -0
  171. package/dist/format/nodes/node.d.ts.map +1 -0
  172. package/dist/format/nodes/node.js +2 -0
  173. package/dist/format/nodes/node.js.map +1 -0
  174. package/dist/format/nodes/sample-http-request.node.d.ts +7 -0
  175. package/dist/format/nodes/sample-http-request.node.d.ts.map +1 -0
  176. package/dist/format/nodes/sample-http-request.node.js +2 -0
  177. package/dist/format/nodes/sample-http-request.node.js.map +1 -0
  178. package/dist/format/nodes/sample-http-response.node.d.ts +7 -0
  179. package/dist/format/nodes/sample-http-response.node.d.ts.map +1 -0
  180. package/dist/format/nodes/sample-http-response.node.js +2 -0
  181. package/dist/format/nodes/sample-http-response.node.js.map +1 -0
  182. package/dist/format/nodes/security-scheme.node.d.ts +17 -0
  183. package/dist/format/nodes/security-scheme.node.d.ts.map +1 -0
  184. package/dist/format/nodes/security-scheme.node.js +2 -0
  185. package/dist/format/nodes/security-scheme.node.js.map +1 -0
  186. package/dist/format/parameter.d.ts +10 -0
  187. package/dist/format/parameter.d.ts.map +1 -0
  188. package/dist/format/parameter.js +2 -0
  189. package/dist/format/parameter.js.map +1 -0
  190. package/dist/format/serialization-style/cookie.serialization-style.d.ts +5 -0
  191. package/dist/format/serialization-style/cookie.serialization-style.d.ts.map +1 -0
  192. package/dist/format/serialization-style/cookie.serialization-style.js +7 -0
  193. package/dist/format/serialization-style/cookie.serialization-style.js.map +1 -0
  194. package/dist/format/serialization-style/header.serialization-style.d.ts +5 -0
  195. package/dist/format/serialization-style/header.serialization-style.d.ts.map +1 -0
  196. package/dist/format/serialization-style/header.serialization-style.js +7 -0
  197. package/dist/format/serialization-style/header.serialization-style.js.map +1 -0
  198. package/dist/format/serialization-style/index.d.ts +6 -0
  199. package/dist/format/serialization-style/index.d.ts.map +1 -0
  200. package/dist/format/serialization-style/index.js +6 -0
  201. package/dist/format/serialization-style/index.js.map +1 -0
  202. package/dist/format/serialization-style/path.serialization-style.d.ts +5 -0
  203. package/dist/format/serialization-style/path.serialization-style.d.ts.map +1 -0
  204. package/dist/format/serialization-style/path.serialization-style.js +7 -0
  205. package/dist/format/serialization-style/path.serialization-style.js.map +1 -0
  206. package/dist/format/serialization-style/query.serialization-style.d.ts +5 -0
  207. package/dist/format/serialization-style/query.serialization-style.d.ts.map +1 -0
  208. package/dist/format/serialization-style/query.serialization-style.js +7 -0
  209. package/dist/format/serialization-style/query.serialization-style.js.map +1 -0
  210. package/dist/format/serialization-style/serialization-style.d.ts +13 -0
  211. package/dist/format/serialization-style/serialization-style.d.ts.map +1 -0
  212. package/dist/format/serialization-style/serialization-style.js +25 -0
  213. package/dist/format/serialization-style/serialization-style.js.map +1 -0
  214. package/dist/format/thymian-format.d.ts +109 -0
  215. package/dist/format/thymian-format.d.ts.map +1 -0
  216. package/dist/format/thymian-format.js +437 -0
  217. package/dist/format/thymian-format.js.map +1 -0
  218. package/dist/format/thymian-schema.d.ts +56 -0
  219. package/dist/format/thymian-schema.d.ts.map +1 -0
  220. package/dist/format/thymian-schema.js +2 -0
  221. package/dist/format/thymian-schema.js.map +1 -0
  222. package/dist/format/utils.d.ts +12 -0
  223. package/dist/format/utils.d.ts.map +1 -0
  224. package/dist/format/utils.js +85 -0
  225. package/dist/format/utils.js.map +1 -0
  226. package/dist/http-filter-visitor.d.ts +76 -0
  227. package/dist/http-filter-visitor.d.ts.map +1 -0
  228. package/dist/http-filter-visitor.js +168 -0
  229. package/dist/http-filter-visitor.js.map +1 -0
  230. package/dist/http-filter.d.ts +140 -0
  231. package/dist/http-filter.d.ts.map +1 -0
  232. package/dist/http-filter.js +137 -0
  233. package/dist/http-filter.js.map +1 -0
  234. package/dist/http-status-codes/1xx/index.d.ts +15 -0
  235. package/dist/http-status-codes/1xx/index.d.ts.map +1 -0
  236. package/dist/http-status-codes/1xx/index.js +15 -0
  237. package/dist/http-status-codes/1xx/index.js.map +1 -0
  238. package/dist/http-status-codes/1xx/informational.phrases.d.ts +4 -0
  239. package/dist/http-status-codes/1xx/informational.phrases.d.ts.map +1 -0
  240. package/dist/http-status-codes/1xx/informational.phrases.js +10 -0
  241. package/dist/http-status-codes/1xx/informational.phrases.js.map +1 -0
  242. package/dist/http-status-codes/1xx/informational.status-codes.d.ts +4 -0
  243. package/dist/http-status-codes/1xx/informational.status-codes.d.ts.map +1 -0
  244. package/dist/http-status-codes/1xx/informational.status-codes.js +5 -0
  245. package/dist/http-status-codes/1xx/informational.status-codes.js.map +1 -0
  246. package/dist/http-status-codes/2xx/index.d.ts +25 -0
  247. package/dist/http-status-codes/2xx/index.d.ts.map +1 -0
  248. package/dist/http-status-codes/2xx/index.js +25 -0
  249. package/dist/http-status-codes/2xx/index.js.map +1 -0
  250. package/dist/http-status-codes/2xx/successful.phrases.d.ts +4 -0
  251. package/dist/http-status-codes/2xx/successful.phrases.d.ts.map +1 -0
  252. package/dist/http-status-codes/2xx/successful.phrases.js +15 -0
  253. package/dist/http-status-codes/2xx/successful.phrases.js.map +1 -0
  254. package/dist/http-status-codes/2xx/successful.status-codes.d.ts +4 -0
  255. package/dist/http-status-codes/2xx/successful.status-codes.d.ts.map +1 -0
  256. package/dist/http-status-codes/2xx/successful.status-codes.js +7 -0
  257. package/dist/http-status-codes/2xx/successful.status-codes.js.map +1 -0
  258. package/dist/http-status-codes/3xx/index.d.ts +21 -0
  259. package/dist/http-status-codes/3xx/index.d.ts.map +1 -0
  260. package/dist/http-status-codes/3xx/index.js +21 -0
  261. package/dist/http-status-codes/3xx/index.js.map +1 -0
  262. package/dist/http-status-codes/3xx/redirection.phrases.d.ts +4 -0
  263. package/dist/http-status-codes/3xx/redirection.phrases.d.ts.map +1 -0
  264. package/dist/http-status-codes/3xx/redirection.phrases.js +13 -0
  265. package/dist/http-status-codes/3xx/redirection.phrases.js.map +1 -0
  266. package/dist/http-status-codes/3xx/redirection.status-codes.d.ts +4 -0
  267. package/dist/http-status-codes/3xx/redirection.status-codes.d.ts.map +1 -0
  268. package/dist/http-status-codes/3xx/redirection.status-codes.js +7 -0
  269. package/dist/http-status-codes/3xx/redirection.status-codes.js.map +1 -0
  270. package/dist/http-status-codes/4xx/client-error.phrases.d.ts +4 -0
  271. package/dist/http-status-codes/4xx/client-error.phrases.d.ts.map +1 -0
  272. package/dist/http-status-codes/4xx/client-error.phrases.js +34 -0
  273. package/dist/http-status-codes/4xx/client-error.phrases.js.map +1 -0
  274. package/dist/http-status-codes/4xx/client-error.status-codes.d.ts +4 -0
  275. package/dist/http-status-codes/4xx/client-error.status-codes.d.ts.map +1 -0
  276. package/dist/http-status-codes/4xx/client-error.status-codes.js +8 -0
  277. package/dist/http-status-codes/4xx/client-error.status-codes.js.map +1 -0
  278. package/dist/http-status-codes/4xx/index.d.ts +63 -0
  279. package/dist/http-status-codes/4xx/index.d.ts.map +1 -0
  280. package/dist/http-status-codes/4xx/index.js +63 -0
  281. package/dist/http-status-codes/4xx/index.js.map +1 -0
  282. package/dist/http-status-codes/5xx/index.d.ts +29 -0
  283. package/dist/http-status-codes/5xx/index.d.ts.map +1 -0
  284. package/dist/http-status-codes/5xx/index.js +29 -0
  285. package/dist/http-status-codes/5xx/index.js.map +1 -0
  286. package/dist/http-status-codes/5xx/server-error.phrases.d.ts +4 -0
  287. package/dist/http-status-codes/5xx/server-error.phrases.d.ts.map +1 -0
  288. package/dist/http-status-codes/5xx/server-error.phrases.js +17 -0
  289. package/dist/http-status-codes/5xx/server-error.phrases.js.map +1 -0
  290. package/dist/http-status-codes/5xx/server-error.status-codes.d.ts +4 -0
  291. package/dist/http-status-codes/5xx/server-error.status-codes.d.ts.map +1 -0
  292. package/dist/http-status-codes/5xx/server-error.status-codes.js +7 -0
  293. package/dist/http-status-codes/5xx/server-error.status-codes.js.map +1 -0
  294. package/dist/http-status-codes/http-status-code-ranges.d.ts +11 -0
  295. package/dist/http-status-codes/http-status-code-ranges.d.ts.map +1 -0
  296. package/dist/http-status-codes/http-status-code-ranges.js +19 -0
  297. package/dist/http-status-codes/http-status-code-ranges.js.map +1 -0
  298. package/dist/http-status-codes/http-status-code.d.ts +8 -0
  299. package/dist/http-status-codes/http-status-code.d.ts.map +1 -0
  300. package/dist/http-status-codes/http-status-code.js +13 -0
  301. package/dist/http-status-codes/http-status-code.js.map +1 -0
  302. package/dist/http-status-codes/http-status-phrase.d.ts +8 -0
  303. package/dist/http-status-codes/http-status-phrase.d.ts.map +1 -0
  304. package/dist/http-status-codes/http-status-phrase.js +13 -0
  305. package/dist/http-status-codes/http-status-phrase.js.map +1 -0
  306. package/dist/http-status-codes/index.d.ts +10 -0
  307. package/dist/http-status-codes/index.d.ts.map +1 -0
  308. package/dist/http-status-codes/index.js +10 -0
  309. package/dist/http-status-codes/index.js.map +1 -0
  310. package/dist/http-status-codes/phrase-to-status-code.d.ts +62 -0
  311. package/dist/http-status-codes/phrase-to-status-code.d.ts.map +1 -0
  312. package/dist/http-status-codes/phrase-to-status-code.js +13 -0
  313. package/dist/http-status-codes/phrase-to-status-code.js.map +1 -0
  314. package/dist/http-status-codes/status-code-to-phrase.d.ts +62 -0
  315. package/dist/http-status-codes/status-code-to-phrase.d.ts.map +1 -0
  316. package/dist/http-status-codes/status-code-to-phrase.js +13 -0
  317. package/dist/http-status-codes/status-code-to-phrase.js.map +1 -0
  318. package/dist/http-status-codes/validate.d.ts +5 -0
  319. package/dist/http-status-codes/validate.d.ts.map +1 -0
  320. package/dist/http-status-codes/validate.js +28 -0
  321. package/dist/http-status-codes/validate.js.map +1 -0
  322. package/dist/http-testing/http-test/create-hook-runner.d.ts +21 -0
  323. package/dist/http-testing/http-test/create-hook-runner.d.ts.map +1 -0
  324. package/dist/http-testing/http-test/create-hook-runner.js +17 -0
  325. package/dist/http-testing/http-test/create-hook-runner.js.map +1 -0
  326. package/dist/http-testing/http-test/create-http-test-context.d.ts +3 -0
  327. package/dist/http-testing/http-test/create-http-test-context.d.ts.map +1 -0
  328. package/dist/http-testing/http-test/create-http-test-context.js +24 -0
  329. package/dist/http-testing/http-test/create-http-test-context.js.map +1 -0
  330. package/dist/http-testing/http-test/http-test-case-result.d.ts +46 -0
  331. package/dist/http-testing/http-test/http-test-case-result.d.ts.map +1 -0
  332. package/dist/http-testing/http-test/http-test-case-result.js +2 -0
  333. package/dist/http-testing/http-test/http-test-case-result.js.map +1 -0
  334. package/dist/http-testing/http-test/http-test-case.d.ts +36 -0
  335. package/dist/http-testing/http-test/http-test-case.d.ts.map +1 -0
  336. package/dist/http-testing/http-test/http-test-case.js +2 -0
  337. package/dist/http-testing/http-test/http-test-case.js.map +1 -0
  338. package/dist/http-testing/http-test/http-test-context.d.ts +20 -0
  339. package/dist/http-testing/http-test/http-test-context.d.ts.map +1 -0
  340. package/dist/http-testing/http-test/http-test-context.js +2 -0
  341. package/dist/http-testing/http-test/http-test-context.js.map +1 -0
  342. package/dist/http-testing/http-test/http-test-hooks.d.ts +26 -0
  343. package/dist/http-testing/http-test/http-test-hooks.d.ts.map +1 -0
  344. package/dist/http-testing/http-test/http-test-hooks.js +2 -0
  345. package/dist/http-testing/http-test/http-test-hooks.js.map +1 -0
  346. package/dist/http-testing/http-test/http-test-pipeline.d.ts +10 -0
  347. package/dist/http-testing/http-test/http-test-pipeline.d.ts.map +1 -0
  348. package/dist/http-testing/http-test/http-test-pipeline.js +2 -0
  349. package/dist/http-testing/http-test/http-test-pipeline.js.map +1 -0
  350. package/dist/http-testing/http-test/http-test.d.ts +11 -0
  351. package/dist/http-testing/http-test/http-test.d.ts.map +1 -0
  352. package/dist/http-testing/http-test/http-test.js +35 -0
  353. package/dist/http-testing/http-test/http-test.js.map +1 -0
  354. package/dist/http-testing/http-test/index.d.ts +10 -0
  355. package/dist/http-testing/http-test/index.d.ts.map +1 -0
  356. package/dist/http-testing/http-test/index.js +10 -0
  357. package/dist/http-testing/http-test/index.js.map +1 -0
  358. package/dist/http-testing/http-test/utils.d.ts +11 -0
  359. package/dist/http-testing/http-test/utils.d.ts.map +1 -0
  360. package/dist/http-testing/http-test/utils.js +16 -0
  361. package/dist/http-testing/http-test/utils.js.map +1 -0
  362. package/dist/http-testing/index.d.ts +7 -0
  363. package/dist/http-testing/index.d.ts.map +1 -0
  364. package/dist/http-testing/index.js +7 -0
  365. package/dist/http-testing/index.js.map +1 -0
  366. package/dist/http-testing/operators/expect-for-transaction.operator.d.ts +5 -0
  367. package/dist/http-testing/operators/expect-for-transaction.operator.d.ts.map +1 -0
  368. package/dist/http-testing/operators/expect-for-transaction.operator.js +39 -0
  369. package/dist/http-testing/operators/expect-for-transaction.operator.js.map +1 -0
  370. package/dist/http-testing/operators/expect-headers.operator.d.ts +4 -0
  371. package/dist/http-testing/operators/expect-headers.operator.d.ts.map +1 -0
  372. package/dist/http-testing/operators/expect-headers.operator.js +37 -0
  373. package/dist/http-testing/operators/expect-headers.operator.js.map +1 -0
  374. package/dist/http-testing/operators/expect-status-code.operator.d.ts +5 -0
  375. package/dist/http-testing/operators/expect-status-code.operator.d.ts.map +1 -0
  376. package/dist/http-testing/operators/expect-status-code.operator.js +55 -0
  377. package/dist/http-testing/operators/expect-status-code.operator.js.map +1 -0
  378. package/dist/http-testing/operators/expect.operator.d.ts +4 -0
  379. package/dist/http-testing/operators/expect.operator.d.ts.map +1 -0
  380. package/dist/http-testing/operators/expect.operator.js +31 -0
  381. package/dist/http-testing/operators/expect.operator.js.map +1 -0
  382. package/dist/http-testing/operators/fail.operator.d.ts +4 -0
  383. package/dist/http-testing/operators/fail.operator.d.ts.map +1 -0
  384. package/dist/http-testing/operators/fail.operator.js +8 -0
  385. package/dist/http-testing/operators/fail.operator.js.map +1 -0
  386. package/dist/http-testing/operators/filter-http-transactions.operator.d.ts +10 -0
  387. package/dist/http-testing/operators/filter-http-transactions.operator.d.ts.map +1 -0
  388. package/dist/http-testing/operators/filter-http-transactions.operator.js +18 -0
  389. package/dist/http-testing/operators/filter-http-transactions.operator.js.map +1 -0
  390. package/dist/http-testing/operators/generate-requests.operator.d.ts +10 -0
  391. package/dist/http-testing/operators/generate-requests.operator.d.ts.map +1 -0
  392. package/dist/http-testing/operators/generate-requests.operator.js +44 -0
  393. package/dist/http-testing/operators/generate-requests.operator.js.map +1 -0
  394. package/dist/http-testing/operators/index.d.ts +21 -0
  395. package/dist/http-testing/operators/index.d.ts.map +1 -0
  396. package/dist/http-testing/operators/index.js +21 -0
  397. package/dist/http-testing/operators/index.js.map +1 -0
  398. package/dist/http-testing/operators/map-to-grouped-test-case.operator.d.ts +7 -0
  399. package/dist/http-testing/operators/map-to-grouped-test-case.operator.d.ts.map +1 -0
  400. package/dist/http-testing/operators/map-to-grouped-test-case.operator.js +32 -0
  401. package/dist/http-testing/operators/map-to-grouped-test-case.operator.js.map +1 -0
  402. package/dist/http-testing/operators/map-to-test-case.operator.d.ts +7 -0
  403. package/dist/http-testing/operators/map-to-test-case.operator.d.ts.map +1 -0
  404. package/dist/http-testing/operators/map-to-test-case.operator.js +21 -0
  405. package/dist/http-testing/operators/map-to-test-case.operator.js.map +1 -0
  406. package/dist/http-testing/operators/override-headers.operator.d.ts +5 -0
  407. package/dist/http-testing/operators/override-headers.operator.d.ts.map +1 -0
  408. package/dist/http-testing/operators/override-headers.operator.js +18 -0
  409. package/dist/http-testing/operators/override-headers.operator.js.map +1 -0
  410. package/dist/http-testing/operators/override-with-previous.operator.d.ts +5 -0
  411. package/dist/http-testing/operators/override-with-previous.operator.d.ts.map +1 -0
  412. package/dist/http-testing/operators/override-with-previous.operator.js +23 -0
  413. package/dist/http-testing/operators/override-with-previous.operator.js.map +1 -0
  414. package/dist/http-testing/operators/replay-previous-step.operator.d.ts +5 -0
  415. package/dist/http-testing/operators/replay-previous-step.operator.d.ts.map +1 -0
  416. package/dist/http-testing/operators/replay-previous-step.operator.js +27 -0
  417. package/dist/http-testing/operators/replay-previous-step.operator.js.map +1 -0
  418. package/dist/http-testing/operators/reply-previous-but-expect-response.operator.d.ts +7 -0
  419. package/dist/http-testing/operators/reply-previous-but-expect-response.operator.d.ts.map +1 -0
  420. package/dist/http-testing/operators/reply-previous-but-expect-response.operator.js +61 -0
  421. package/dist/http-testing/operators/reply-previous-but-expect-response.operator.js.map +1 -0
  422. package/dist/http-testing/operators/requires-authorization.operator.d.ts +5 -0
  423. package/dist/http-testing/operators/requires-authorization.operator.d.ts.map +1 -0
  424. package/dist/http-testing/operators/requires-authorization.operator.js +9 -0
  425. package/dist/http-testing/operators/requires-authorization.operator.js.map +1 -0
  426. package/dist/http-testing/operators/run-requests.operator.d.ts +14 -0
  427. package/dist/http-testing/operators/run-requests.operator.d.ts.map +1 -0
  428. package/dist/http-testing/operators/run-requests.operator.js +139 -0
  429. package/dist/http-testing/operators/run-requests.operator.js.map +1 -0
  430. package/dist/http-testing/operators/single-step-for-transaction.operator.d.ts +5 -0
  431. package/dist/http-testing/operators/single-step-for-transaction.operator.d.ts.map +1 -0
  432. package/dist/http-testing/operators/single-step-for-transaction.operator.js +43 -0
  433. package/dist/http-testing/operators/single-step-for-transaction.operator.js.map +1 -0
  434. package/dist/http-testing/operators/skip.operator.d.ts +5 -0
  435. package/dist/http-testing/operators/skip.operator.d.ts.map +1 -0
  436. package/dist/http-testing/operators/skip.operator.js +11 -0
  437. package/dist/http-testing/operators/skip.operator.js.map +1 -0
  438. package/dist/http-testing/operators/step.operator.d.ts +5 -0
  439. package/dist/http-testing/operators/step.operator.d.ts.map +1 -0
  440. package/dist/http-testing/operators/step.operator.js +20 -0
  441. package/dist/http-testing/operators/step.operator.js.map +1 -0
  442. package/dist/http-testing/operators/utils.d.ts +10 -0
  443. package/dist/http-testing/operators/utils.d.ts.map +1 -0
  444. package/dist/http-testing/operators/utils.js +17 -0
  445. package/dist/http-testing/operators/utils.js.map +1 -0
  446. package/dist/http-testing/operators/validate-responses.operator.d.ts +4 -0
  447. package/dist/http-testing/operators/validate-responses.operator.d.ts.map +1 -0
  448. package/dist/http-testing/operators/validate-responses.operator.js +33 -0
  449. package/dist/http-testing/operators/validate-responses.operator.js.map +1 -0
  450. package/dist/http-testing/serialize-parameter.d.ts +6 -0
  451. package/dist/http-testing/serialize-parameter.d.ts.map +1 -0
  452. package/dist/http-testing/serialize-parameter.js +51 -0
  453. package/dist/http-testing/serialize-parameter.js.map +1 -0
  454. package/dist/http-testing/serialize-request.d.ts +7 -0
  455. package/dist/http-testing/serialize-request.d.ts.map +1 -0
  456. package/dist/http-testing/serialize-request.js +112 -0
  457. package/dist/http-testing/serialize-request.js.map +1 -0
  458. package/dist/http-testing/test-builder/builder-pipeline.d.ts +4 -0
  459. package/dist/http-testing/test-builder/builder-pipeline.d.ts.map +1 -0
  460. package/dist/http-testing/test-builder/builder-pipeline.js +2 -0
  461. package/dist/http-testing/test-builder/builder-pipeline.js.map +1 -0
  462. package/dist/http-testing/test-builder/compilers/http-filter-to-transaction-filter.d.ts +9 -0
  463. package/dist/http-testing/test-builder/compilers/http-filter-to-transaction-filter.d.ts.map +1 -0
  464. package/dist/http-testing/test-builder/compilers/http-filter-to-transaction-filter.js +114 -0
  465. package/dist/http-testing/test-builder/compilers/http-filter-to-transaction-filter.js.map +1 -0
  466. package/dist/http-testing/test-builder/compilers/response-scoped-to-response-checker.d.ts +4 -0
  467. package/dist/http-testing/test-builder/compilers/response-scoped-to-response-checker.d.ts.map +1 -0
  468. package/dist/http-testing/test-builder/compilers/response-scoped-to-response-checker.js +36 -0
  469. package/dist/http-testing/test-builder/compilers/response-scoped-to-response-checker.js.map +1 -0
  470. package/dist/http-testing/test-builder/compilers/response-scoped-to-transaction-validator.d.ts +4 -0
  471. package/dist/http-testing/test-builder/compilers/response-scoped-to-transaction-validator.d.ts.map +1 -0
  472. package/dist/http-testing/test-builder/compilers/response-scoped-to-transaction-validator.js +65 -0
  473. package/dist/http-testing/test-builder/compilers/response-scoped-to-transaction-validator.js.map +1 -0
  474. package/dist/http-testing/test-builder/extract-value-from-response.d.ts +4 -0
  475. package/dist/http-testing/test-builder/extract-value-from-response.d.ts.map +1 -0
  476. package/dist/http-testing/test-builder/extract-value-from-response.js +16 -0
  477. package/dist/http-testing/test-builder/extract-value-from-response.js.map +1 -0
  478. package/dist/http-testing/test-builder/override-request-template.d.ts +4 -0
  479. package/dist/http-testing/test-builder/override-request-template.d.ts.map +1 -0
  480. package/dist/http-testing/test-builder/override-request-template.js +33 -0
  481. package/dist/http-testing/test-builder/override-request-template.js.map +1 -0
  482. package/dist/http-testing/test-builder/reply-step-builder.d.ts +10 -0
  483. package/dist/http-testing/test-builder/reply-step-builder.d.ts.map +1 -0
  484. package/dist/http-testing/test-builder/reply-step-builder.js +39 -0
  485. package/dist/http-testing/test-builder/reply-step-builder.js.map +1 -0
  486. package/dist/http-testing/test-builder/single-step-test-builder.d.ts +42 -0
  487. package/dist/http-testing/test-builder/single-step-test-builder.d.ts.map +1 -0
  488. package/dist/http-testing/test-builder/single-step-test-builder.js +112 -0
  489. package/dist/http-testing/test-builder/single-step-test-builder.js.map +1 -0
  490. package/dist/http-testing/validate/ajv.d.ts +3 -0
  491. package/dist/http-testing/validate/ajv.d.ts.map +1 -0
  492. package/dist/http-testing/validate/ajv.js +7 -0
  493. package/dist/http-testing/validate/ajv.js.map +1 -0
  494. package/dist/http-testing/validate/index.d.ts +9 -0
  495. package/dist/http-testing/validate/index.d.ts.map +1 -0
  496. package/dist/http-testing/validate/index.js +9 -0
  497. package/dist/http-testing/validate/index.js.map +1 -0
  498. package/dist/http-testing/validate/validate-body.d.ts +5 -0
  499. package/dist/http-testing/validate/validate-body.d.ts.map +1 -0
  500. package/dist/http-testing/validate/validate-body.js +62 -0
  501. package/dist/http-testing/validate/validate-body.js.map +1 -0
  502. package/dist/http-testing/validate/validate-headers.d.ts +8 -0
  503. package/dist/http-testing/validate/validate-headers.d.ts.map +1 -0
  504. package/dist/http-testing/validate/validate-headers.js +101 -0
  505. package/dist/http-testing/validate/validate-headers.js.map +1 -0
  506. package/dist/http-testing/validate/validate-request-body.d.ts +5 -0
  507. package/dist/http-testing/validate/validate-request-body.d.ts.map +1 -0
  508. package/dist/http-testing/validate/validate-request-body.js +71 -0
  509. package/dist/http-testing/validate/validate-request-body.js.map +1 -0
  510. package/dist/http-testing/validate/validate-request-headers.d.ts +8 -0
  511. package/dist/http-testing/validate/validate-request-headers.d.ts.map +1 -0
  512. package/dist/http-testing/validate/validate-request-headers.js +93 -0
  513. package/dist/http-testing/validate/validate-request-headers.js.map +1 -0
  514. package/dist/http-testing/validate/validate-request-path-parameters.d.ts +6 -0
  515. package/dist/http-testing/validate/validate-request-path-parameters.d.ts.map +1 -0
  516. package/dist/http-testing/validate/validate-request-path-parameters.js +69 -0
  517. package/dist/http-testing/validate/validate-request-path-parameters.js.map +1 -0
  518. package/dist/http-testing/validate/validate-request-query-parameters.d.ts +7 -0
  519. package/dist/http-testing/validate/validate-request-query-parameters.d.ts.map +1 -0
  520. package/dist/http-testing/validate/validate-request-query-parameters.js +91 -0
  521. package/dist/http-testing/validate/validate-request-query-parameters.js.map +1 -0
  522. package/dist/http-testing/validate/validate-response.d.ts +7 -0
  523. package/dist/http-testing/validate/validate-response.d.ts.map +1 -0
  524. package/dist/http-testing/validate/validate-response.js +15 -0
  525. package/dist/http-testing/validate/validate-response.js.map +1 -0
  526. package/dist/http-testing/validate/validate-status-code.d.ts +3 -0
  527. package/dist/http-testing/validate/validate-status-code.d.ts.map +1 -0
  528. package/dist/http-testing/validate/validate-status-code.js +25 -0
  529. package/dist/http-testing/validate/validate-status-code.js.map +1 -0
  530. package/dist/http.d.ts +29 -0
  531. package/dist/http.d.ts.map +1 -0
  532. package/dist/http.js +2 -0
  533. package/dist/http.js.map +1 -0
  534. package/dist/index.d.ts +25 -0
  535. package/dist/index.d.ts.map +1 -0
  536. package/dist/index.js +25 -0
  537. package/dist/index.js.map +1 -0
  538. package/dist/logger/log-level.d.ts +5 -0
  539. package/dist/logger/log-level.d.ts.map +1 -0
  540. package/dist/logger/log-level.js +24 -0
  541. package/dist/logger/log-level.js.map +1 -0
  542. package/dist/logger/logger.d.ts +13 -0
  543. package/dist/logger/logger.d.ts.map +1 -0
  544. package/dist/logger/logger.js +2 -0
  545. package/dist/logger/logger.js.map +1 -0
  546. package/dist/logger/noop.logger.d.ts +15 -0
  547. package/dist/logger/noop.logger.d.ts.map +1 -0
  548. package/dist/logger/noop.logger.js +18 -0
  549. package/dist/logger/noop.logger.js.map +1 -0
  550. package/dist/logger/text.logger.d.ts +16 -0
  551. package/dist/logger/text.logger.d.ts.map +1 -0
  552. package/dist/logger/text.logger.js +51 -0
  553. package/dist/logger/text.logger.js.map +1 -0
  554. package/dist/report-sorter.d.ts +16 -0
  555. package/dist/report-sorter.d.ts.map +1 -0
  556. package/dist/report-sorter.js +193 -0
  557. package/dist/report-sorter.js.map +1 -0
  558. package/dist/rules/ajv-validate.d.ts +2 -0
  559. package/dist/rules/ajv-validate.d.ts.map +1 -0
  560. package/dist/rules/ajv-validate.js +4 -0
  561. package/dist/rules/ajv-validate.js.map +1 -0
  562. package/dist/rules/captured-trace-to-string.d.ts +3 -0
  563. package/dist/rules/captured-trace-to-string.d.ts.map +1 -0
  564. package/dist/rules/captured-trace-to-string.js +27 -0
  565. package/dist/rules/captured-trace-to-string.js.map +1 -0
  566. package/dist/rules/common-http-converters.d.ts +8 -0
  567. package/dist/rules/common-http-converters.d.ts.map +1 -0
  568. package/dist/rules/common-http-converters.js +58 -0
  569. package/dist/rules/common-http-converters.js.map +1 -0
  570. package/dist/rules/contexts.d.ts +63 -0
  571. package/dist/rules/contexts.d.ts.map +1 -0
  572. package/dist/rules/contexts.js +2 -0
  573. package/dist/rules/contexts.js.map +1 -0
  574. package/dist/rules/index.d.ts +16 -0
  575. package/dist/rules/index.d.ts.map +1 -0
  576. package/dist/rules/index.js +16 -0
  577. package/dist/rules/index.js.map +1 -0
  578. package/dist/rules/rule-builder.d.ts +34 -0
  579. package/dist/rules/rule-builder.d.ts.map +1 -0
  580. package/dist/rules/rule-builder.js +112 -0
  581. package/dist/rules/rule-builder.js.map +1 -0
  582. package/dist/rules/rule-configuration.d.ts +10 -0
  583. package/dist/rules/rule-configuration.d.ts.map +1 -0
  584. package/dist/rules/rule-configuration.js +2 -0
  585. package/dist/rules/rule-configuration.js.map +1 -0
  586. package/dist/rules/rule-filter.d.ts +9 -0
  587. package/dist/rules/rule-filter.d.ts.map +1 -0
  588. package/dist/rules/rule-filter.js +12 -0
  589. package/dist/rules/rule-filter.js.map +1 -0
  590. package/dist/rules/rule-fn.d.ts +7 -0
  591. package/dist/rules/rule-fn.d.ts.map +1 -0
  592. package/dist/rules/rule-fn.js +2 -0
  593. package/dist/rules/rule-fn.js.map +1 -0
  594. package/dist/rules/rule-loader.d.ts +8 -0
  595. package/dist/rules/rule-loader.d.ts.map +1 -0
  596. package/dist/rules/rule-loader.js +124 -0
  597. package/dist/rules/rule-loader.js.map +1 -0
  598. package/dist/rules/rule-meta.d.ts +20 -0
  599. package/dist/rules/rule-meta.d.ts.map +1 -0
  600. package/dist/rules/rule-meta.js +18 -0
  601. package/dist/rules/rule-meta.js.map +1 -0
  602. package/dist/rules/rule-runner.d.ts +30 -0
  603. package/dist/rules/rule-runner.d.ts.map +1 -0
  604. package/dist/rules/rule-runner.js +129 -0
  605. package/dist/rules/rule-runner.js.map +1 -0
  606. package/dist/rules/rule-set.d.ts +9 -0
  607. package/dist/rules/rule-set.d.ts.map +1 -0
  608. package/dist/rules/rule-set.js +2 -0
  609. package/dist/rules/rule-set.js.map +1 -0
  610. package/dist/rules/rule-severity.d.ts +10 -0
  611. package/dist/rules/rule-severity.d.ts.map +1 -0
  612. package/dist/rules/rule-severity.js +12 -0
  613. package/dist/rules/rule-severity.js.map +1 -0
  614. package/dist/rules/rule-violation.d.ts +22 -0
  615. package/dist/rules/rule-violation.d.ts.map +1 -0
  616. package/dist/rules/rule-violation.js +2 -0
  617. package/dist/rules/rule-violation.js.map +1 -0
  618. package/dist/rules/rule.d.ts +10 -0
  619. package/dist/rules/rule.d.ts.map +1 -0
  620. package/dist/rules/rule.js +2 -0
  621. package/dist/rules/rule.js.map +1 -0
  622. package/dist/rules/traffic.d.ts +25 -0
  623. package/dist/rules/traffic.d.ts.map +1 -0
  624. package/dist/rules/traffic.js +2 -0
  625. package/dist/rules/traffic.js.map +1 -0
  626. package/dist/thymian-plugin.d.ts +38 -0
  627. package/dist/thymian-plugin.d.ts.map +1 -0
  628. package/dist/thymian-plugin.js +24 -0
  629. package/dist/thymian-plugin.js.map +1 -0
  630. package/dist/thymian.d.ts +85 -0
  631. package/dist/thymian.d.ts.map +1 -0
  632. package/dist/thymian.error.d.ts +26 -0
  633. package/dist/thymian.error.d.ts.map +1 -0
  634. package/dist/thymian.error.js +34 -0
  635. package/dist/thymian.error.js.map +1 -0
  636. package/dist/thymian.js +322 -0
  637. package/dist/thymian.js.map +1 -0
  638. package/dist/utils.d.ts +40 -0
  639. package/dist/utils.d.ts.map +1 -0
  640. package/dist/utils.js +139 -0
  641. package/dist/utils.js.map +1 -0
  642. package/package.json +64 -0
@@ -0,0 +1,33 @@
1
+ import { setHeader } from '../../index.js';
2
+ export function overrideTemplate(template, toRequest, value) {
3
+ switch (toRequest.type) {
4
+ case 'method':
5
+ template.method = value;
6
+ break;
7
+ case 'requestHeader':
8
+ if (typeof toRequest.header === 'undefined') {
9
+ break;
10
+ }
11
+ setHeader(template.headers, toRequest.header, value);
12
+ break;
13
+ case 'queryParam':
14
+ if (typeof toRequest.param === 'undefined') {
15
+ break;
16
+ }
17
+ setHeader(template.query, toRequest.param, value);
18
+ break;
19
+ case 'path':
20
+ template.path = value;
21
+ break;
22
+ case 'origin':
23
+ template.origin = value;
24
+ break;
25
+ case 'requestMediaType':
26
+ setHeader(template.headers, 'content-type', toRequest.mediaType);
27
+ break;
28
+ default:
29
+ throw new Error(`Invalid expression type "${toRequest.type}".`);
30
+ }
31
+ return template;
32
+ }
33
+ //# sourceMappingURL=override-request-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"override-request-template.js","sourceRoot":"","sources":["../../../src/http-testing/test-builder/override-request-template.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,UAAU,gBAAgB,CAC9B,QAA6B,EAC7B,SAAkC,EAClC,KAAc;IAEd,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,QAAQ;YACX,QAAQ,CAAC,MAAM,GAAG,KAAe,CAAC;YAClC,MAAM;QACR,KAAK,eAAe;YAClB,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;gBAC5C,MAAM;YACR,CAAC;YAED,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACrD,MAAM;QACR,KAAK,YAAY;YACf,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;gBAC3C,MAAM;YACR,CAAC;YAED,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAClD,MAAM;QACR,KAAK,MAAM;YACT,QAAQ,CAAC,IAAI,GAAG,KAAe,CAAC;YAChC,MAAM;QACR,KAAK,QAAQ;YACX,QAAQ,CAAC,MAAM,GAAG,KAAe,CAAC;YAClC,MAAM;QACR,KAAK,kBAAkB;YACrB,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACjE,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,SAAS,CAAC,IAAI,IAAI,CAAC,CAAC;IACpE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type Constant, type HttpResponse, type RequestFilterExpression, type ResponseFilterExpression } from '../../index.js';
2
+ import type { BuilderPipeline } from './builder-pipeline.js';
3
+ import type { RunOptions } from './single-step-test-builder.js';
4
+ export declare class ReplyStepBuilder {
5
+ protected readonly pipeline: BuilderPipeline;
6
+ set(toRequest: RequestFilterExpression, fromResponse: ResponseFilterExpression | Constant | ((response: HttpResponse) => unknown)): ReplyStepBuilder;
7
+ run(options?: RunOptions): ReplyStepBuilder;
8
+ done(): BuilderPipeline;
9
+ }
10
+ //# sourceMappingURL=reply-step-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reply-step-builder.d.ts","sourceRoot":"","sources":["../../../src/http-testing/test-builder/reply-step-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,qBAAa,gBAAgB;IAC3B,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAM;IAElD,GAAG,CACD,SAAS,EAAE,uBAAuB,EAClC,YAAY,EACR,wBAAwB,GACxB,QAAQ,GACR,CAAC,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC,GACxC,gBAAgB;IAgCnB,GAAG,CAAC,OAAO,GAAE,UAAe,GAAG,gBAAgB;IAM/C,IAAI,IAAI,eAAe;CAGxB"}
@@ -0,0 +1,39 @@
1
+ import {} from '../../index.js';
2
+ import { overrideRequestWithPrevious, runRequests, } from '../operators/index.js';
3
+ import { extractValueFromResponse } from './extract-value-from-response.js';
4
+ import { overrideTemplate } from './override-request-template.js';
5
+ export class ReplyStepBuilder {
6
+ pipeline = [];
7
+ set(toRequest, fromResponse) {
8
+ const operator = overrideRequestWithPrevious((requestTemplate, previous) => {
9
+ const response = previous.transactions[0]?.response;
10
+ if (response) {
11
+ let extractedValue;
12
+ if (typeof fromResponse === 'function') {
13
+ extractedValue = fromResponse(response);
14
+ }
15
+ else if (fromResponse.type === 'constant') {
16
+ extractedValue = fromResponse.value;
17
+ }
18
+ else {
19
+ extractedValue = extractValueFromResponse(response, fromResponse);
20
+ }
21
+ if (extractedValue) {
22
+ return overrideTemplate(requestTemplate, toRequest, extractedValue);
23
+ }
24
+ return requestTemplate;
25
+ }
26
+ throw new Error('No response found to override template.');
27
+ });
28
+ this.pipeline.push(operator);
29
+ return this;
30
+ }
31
+ run(options = {}) {
32
+ this.pipeline.push(runRequests(options));
33
+ return this;
34
+ }
35
+ done() {
36
+ return this.pipeline;
37
+ }
38
+ }
39
+ //# sourceMappingURL=reply-step-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reply-step-builder.js","sourceRoot":"","sources":["../../../src/http-testing/test-builder/reply-step-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,2BAA2B,EAC3B,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGlE,MAAM,OAAO,gBAAgB;IACR,QAAQ,GAAoB,EAAE,CAAC;IAElD,GAAG,CACD,SAAkC,EAClC,YAGyC;QAEzC,MAAM,QAAQ,GAAG,2BAA2B,CAC1C,CAAC,eAAe,EAAE,QAAQ,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;YAEpD,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,cAAwB,CAAC;gBAE7B,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE,CAAC;oBACvC,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAC1C,CAAC;qBAAM,IAAI,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;oBAC5C,cAAc,GAAG,YAAY,CAAC,KAAK,CAAC;gBACtC,CAAC;qBAAM,CAAC;oBACN,cAAc,GAAG,wBAAwB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;gBACpE,CAAC;gBAED,IAAI,cAAc,EAAE,CAAC;oBACnB,OAAO,gBAAgB,CAAC,eAAe,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;gBACtE,CAAC;gBAED,OAAO,eAAe,CAAC;YACzB,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC,CACF,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,UAAsB,EAAE;QAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,42 @@
1
+ import type { HttpRequestTemplate } from '../../index.js';
2
+ import { type HttpFilterExpression, type RequestFilterExpression } from '../../index.js';
3
+ import { type GenerateRequestsOptions, type HttpTestCaseStepTransaction, type HttpTestPipeline } from '../http-test/index.js';
4
+ import { type RunRequestsOptions } from '../operators/index.js';
5
+ import type { BuilderPipeline } from './builder-pipeline.js';
6
+ import { ReplyStepBuilder } from './reply-step-builder.js';
7
+ export type RunOptions = GenerateRequestsOptions & Partial<RunRequestsOptions>;
8
+ export interface FilterTransactions {
9
+ forTransactionsWith(filter: HttpFilterExpression): RunRequests;
10
+ }
11
+ export interface RunRequests {
12
+ set(filter: RequestFilterExpression, value: unknown): RunRequests;
13
+ mapRequest(fn: (request: HttpRequestTemplate) => HttpRequestTemplate): RunRequests;
14
+ tap(fn: () => void): RunRequests;
15
+ run(options?: RunOptions): ExpectOrStep<[Required<HttpTestCaseStepTransaction>]>;
16
+ }
17
+ export interface ExpectOrStep<Transactions extends Required<HttpTestCaseStepTransaction>[]> {
18
+ expectForTransactions(...filters: HttpFilterExpression[]): ExpectOrStep<Transactions>;
19
+ replayStep(step: (step: ReplyStepBuilder) => BuilderPipeline): ExpectOrStep<[...Transactions, Required<HttpTestCaseStepTransaction>]>;
20
+ skipIf(expression: HttpFilterExpression, message?: string): ExpectOrStep<Transactions>;
21
+ done(): HttpTestPipeline<Record<PropertyKey, unknown>>;
22
+ transactions(fn: (transactions: Transactions) => void): ExpectOrStep<Transactions>;
23
+ }
24
+ export declare class SingleStepTestBuilder<Transactions extends Required<HttpTestCaseStepTransaction>[]> implements RunRequests, FilterTransactions, ExpectOrStep<Transactions> {
25
+ #private;
26
+ protected readonly pipeline: BuilderPipeline;
27
+ mapRequest(fn: (request: HttpRequestTemplate) => HttpRequestTemplate): SingleStepTestBuilder<Transactions>;
28
+ forTransactionsWith(filterExpression: HttpFilterExpression): RunRequests;
29
+ tap(fn: () => void): RunRequests;
30
+ set(filter: RequestFilterExpression, value: unknown): SingleStepTestBuilder<Transactions>;
31
+ skipIf(expression: HttpFilterExpression, message?: string): ExpectOrStep<Transactions>;
32
+ run(options?: RunOptions): SingleStepTestBuilder<[Required<HttpTestCaseStepTransaction>]>;
33
+ expectForTransactions(...filters: HttpFilterExpression[]): ExpectOrStep<Transactions>;
34
+ done(): HttpTestPipeline<Record<PropertyKey, unknown>>;
35
+ replayStep(step: (step: ReplyStepBuilder) => BuilderPipeline): SingleStepTestBuilder<[
36
+ ...Transactions,
37
+ Required<HttpTestCaseStepTransaction>
38
+ ]>;
39
+ transactions(fn: (transactions: Transactions) => void): SingleStepTestBuilder<Transactions>;
40
+ }
41
+ export declare function singleTestCase(): FilterTransactions;
42
+ //# sourceMappingURL=single-step-test-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-step-test-builder.d.ts","sourceRoot":"","sources":["../../../src/http-testing/test-builder/single-step-test-builder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,uBAAuB,EAE5B,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EAItB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAK7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,MAAM,UAAU,GAAG,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE/E,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,WAAW,CAAC;CAChE;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,MAAM,EAAE,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,WAAW,CAAC;IAElE,UAAU,CACR,EAAE,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,mBAAmB,GACxD,WAAW,CAAC;IAEf,GAAG,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;IAEjC,GAAG,CACD,OAAO,CAAC,EAAE,UAAU,GACnB,YAA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B,EAChC,OAAO,CAAC,EAAE,MAAM,GACf,YAAY,CAAC,YAAY,CAAC;IA6B7B,GAAG,CACD,OAAO,GAAE,UAAe,GACvB,qBAAqB,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAajE,qBAAqB,CACnB,GAAG,OAAO,EAAE,oBAAoB,EAAE,GACjC,YAAY,CAAC,YAAY,CAAC;IAa7B,IAAI,IAAI,gBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAStD,UAAU,CACR,IAAI,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,eAAe,GAChD,qBAAqB,CACtB;QAAC,GAAG,YAAY;QAAE,QAAQ,CAAC,2BAA2B,CAAC;KAAC,CACzD;IAgBD,YAAY,CACV,EAAE,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,GACvC,qBAAqB,CAAC,YAAY,CAAC;CA2BvC;AAED,wBAAgB,cAAc,IAAI,kBAAkB,CAEnD"}
@@ -0,0 +1,112 @@
1
+ import { filter, map, tap } from 'rxjs';
2
+ import { and, } from '../../index.js';
3
+ import { isFailedTestCase, isSkippedTestCase, } from '../http-test/index.js';
4
+ import { expectForTransactions, generateRequests, mapToTestCase, replayStep, runRequests, } from '../operators/index.js';
5
+ import { httpFilterToTransactionFilter } from './compilers/http-filter-to-transaction-filter.js';
6
+ import { compileResponseScopedToResponseChecker } from './compilers/response-scoped-to-response-checker.js';
7
+ import { compileResponseScopedExpressionToTransactionValidationFn } from './compilers/response-scoped-to-transaction-validator.js';
8
+ import { overrideTemplate } from './override-request-template.js';
9
+ import { ReplyStepBuilder } from './reply-step-builder.js';
10
+ export class SingleStepTestBuilder {
11
+ pipeline = [];
12
+ #requestOverrides = [];
13
+ mapRequest(fn) {
14
+ const operator = map(({ current, ctx }) => {
15
+ if (current.steps[0]?.transactions[0]) {
16
+ current.steps[0].transactions[0].requestTemplate = fn(current.steps[0].transactions[0].requestTemplate);
17
+ }
18
+ return { current, ctx };
19
+ });
20
+ this.#requestOverrides.push(operator);
21
+ return this;
22
+ }
23
+ forTransactionsWith(filterExpression) {
24
+ this.pipeline.push(filter(({ current, ctx }) => {
25
+ const filterFn = httpFilterToTransactionFilter(filterExpression, ctx.format);
26
+ const responses = ctx.format.getNeighboursOfType(current.thymianReqId, 'http-response');
27
+ return filterFn(current.thymianReq, current.thymianReqId, current.thymianRes, current.thymianResId, responses);
28
+ }));
29
+ return this;
30
+ }
31
+ tap(fn) {
32
+ this.pipeline.push(tap(fn));
33
+ return this;
34
+ }
35
+ set(filter, value) {
36
+ const operator = map(({ current, ctx }) => {
37
+ if (current.steps[0]?.transactions[0]) {
38
+ current.steps[0].transactions[0].requestTemplate = overrideTemplate(current.steps[0].transactions[0].requestTemplate, filter, value);
39
+ }
40
+ return { current, ctx };
41
+ });
42
+ this.#requestOverrides.push(operator);
43
+ return this;
44
+ }
45
+ skipIf(expression, message) {
46
+ const operator = map(({ current, ctx }) => {
47
+ if (isSkippedTestCase(current) || isFailedTestCase(current)) {
48
+ return { current, ctx };
49
+ }
50
+ const step = current.steps.at(-1);
51
+ if (step) {
52
+ const response = step.transactions[0]?.response;
53
+ if (response &&
54
+ compileResponseScopedToResponseChecker(expression, response)) {
55
+ return ctx.skip(current, message);
56
+ }
57
+ }
58
+ return { current, ctx };
59
+ });
60
+ this.pipeline.push(operator);
61
+ return this;
62
+ }
63
+ run(options = {}) {
64
+ this.pipeline.push(mapToTestCase(), generateRequests(options), ...this.#requestOverrides, runRequests(options));
65
+ return this;
66
+ }
67
+ expectForTransactions(...filters) {
68
+ const validate = compileResponseScopedExpressionToTransactionValidationFn(and(...filters));
69
+ const fn = expectForTransactions((transaction) => validate(transaction));
70
+ this.pipeline.push(fn);
71
+ return this;
72
+ }
73
+ done() {
74
+ return (transactions) => transactions.pipe(
75
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
76
+ // @ts-expect-error
77
+ ...this.pipeline);
78
+ }
79
+ replayStep(step) {
80
+ this.pipeline.push(replayStep((step1) => step1.pipe(
81
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
82
+ // @ts-expect-error
83
+ ...step(new ReplyStepBuilder()))));
84
+ return this;
85
+ }
86
+ transactions(fn) {
87
+ const operator = map(({ current, ctx }) => {
88
+ if (isSkippedTestCase(current) || isFailedTestCase(current)) {
89
+ return { current, ctx };
90
+ }
91
+ const transactions = current.steps.flatMap((step) => step.transactions);
92
+ try {
93
+ fn(transactions);
94
+ }
95
+ catch (e) {
96
+ if (e instanceof Error) {
97
+ return ctx.fail(current, e.message);
98
+ }
99
+ else {
100
+ return ctx.fail(current, 'unknown error.');
101
+ }
102
+ }
103
+ return { current, ctx };
104
+ });
105
+ this.pipeline.push(operator);
106
+ return this;
107
+ }
108
+ }
109
+ export function singleTestCase() {
110
+ return new SingleStepTestBuilder();
111
+ }
112
+ //# sourceMappingURL=single-step-test-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-step-test-builder.js","sourceRoot":"","sources":["../../../src/http-testing/test-builder/single-step-test-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAiC,GAAG,EAAE,MAAM,MAAM,CAAC;AAMvE,OAAO,EACL,GAAG,GAGJ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAKL,gBAAgB,EAChB,iBAAiB,GAElB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,WAAW,GAEZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,sCAAsC,EAAE,MAAM,oDAAoD,CAAC;AAC5G,OAAO,EAAE,wDAAwD,EAAE,MAAM,yDAAyD,CAAC;AACnI,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,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IAEN,CAAC;IACJ,CAAC;IAED,YAAY,CACV,EAAwC;QAExC,MAAM,QAAQ,GAAyD,GAAG,CACxE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;YACnB,IAAI,iBAAiB,CAAC,OAAO,CAAC,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC5D,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;YAC1B,CAAC;YAED,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAExE,IAAI,CAAC;gBACH,EAAE,CAAC,YAA4B,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;oBACvB,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;gBACtC,CAAC;qBAAM,CAAC;oBACN,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;QAC1B,CAAC,CACF,CAAC;QAEF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE7B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,qBAAqB,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Ajv2020 } from 'ajv/dist/2020.js';
2
+ export declare const ajv: Ajv2020;
3
+ //# sourceMappingURL=ajv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,eAAO,MAAM,GAAG,SAAgB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Ajv2020 } from 'ajv/dist/2020.js';
2
+ import addFormats from 'ajv-formats';
3
+ export const ajv = new Ajv2020();
4
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5
+ // @ts-expect-error
6
+ addFormats(ajv);
7
+ //# sourceMappingURL=ajv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../../src/http-testing/validate/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;AAEjC,6DAA6D;AAC7D,mBAAmB;AACnB,UAAU,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from './validate-body.js';
2
+ export * from './validate-headers.js';
3
+ export * from './validate-request-body.js';
4
+ export * from './validate-request-headers.js';
5
+ export * from './validate-request-path-parameters.js';
6
+ export * from './validate-request-query-parameters.js';
7
+ export * from './validate-response.js';
8
+ export * from './validate-status-code.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from './validate-body.js';
2
+ export * from './validate-headers.js';
3
+ export * from './validate-request-body.js';
4
+ export * from './validate-request-headers.js';
5
+ export * from './validate-request-path-parameters.js';
6
+ export * from './validate-request-query-parameters.js';
7
+ export * from './validate-response.js';
8
+ export * from './validate-status-code.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http-testing/validate/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ThymianHttpResponse } from '../../index.js';
2
+ import type { HttpTestCaseResult } from '../http-test/index.js';
3
+ export declare function validateJsonBody(body: string, response: ThymianHttpResponse): HttpTestCaseResult[];
4
+ export declare function validateBodyForResponse(body: string | undefined, response: ThymianHttpResponse): HttpTestCaseResult[];
5
+ //# sourceMappingURL=validate-body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-body.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CA8CtB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CAiBtB"}
@@ -0,0 +1,62 @@
1
+ import { parse } from 'secure-json-parse';
2
+ import { ajv } from './ajv.js';
3
+ export function validateJsonBody(body, response) {
4
+ try {
5
+ const json = parse(body);
6
+ if (!response.schema) {
7
+ return [
8
+ {
9
+ type: 'info',
10
+ message: 'No response schema is provided.',
11
+ details: '',
12
+ timestamp: Date.now(),
13
+ },
14
+ ];
15
+ }
16
+ const validate = ajv.compile(response.schema);
17
+ validate(json);
18
+ if (validate.errors) {
19
+ return [
20
+ {
21
+ type: 'assertion-failure',
22
+ message: `Invalid response body: ${validate.errors.map((err) => err.instancePath + ' ' + err.message).join(', ')}`,
23
+ timestamp: Date.now(),
24
+ },
25
+ ];
26
+ }
27
+ return [
28
+ {
29
+ type: 'assertion-success',
30
+ message: 'Valid response body.',
31
+ timestamp: Date.now(),
32
+ },
33
+ ];
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ }
36
+ catch (err) {
37
+ return [
38
+ {
39
+ type: 'assertion-failure',
40
+ message: 'Response body is not valid JSON.',
41
+ timestamp: Date.now(),
42
+ },
43
+ ];
44
+ }
45
+ }
46
+ export function validateBodyForResponse(body, response) {
47
+ if (typeof body === 'undefined') {
48
+ return [];
49
+ }
50
+ if (/^application\/[^+]*[+]?(json);?.*/.test(response.mediaType)) {
51
+ return validateJsonBody(body, response);
52
+ }
53
+ return [
54
+ {
55
+ type: 'info',
56
+ message: 'Non JSON response body cannot be validated.',
57
+ timestamp: Date.now(),
58
+ details: '',
59
+ },
60
+ ];
61
+ }
62
+ //# sourceMappingURL=validate-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-body.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,QAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,OAAO;gBACL;oBACE,IAAI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C;IAED,OAAO;QACL;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,6CAA6C;YACtD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO,EAAE,EAAE;SACZ;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type ThymianHttpResponse } from '../../index.js';
2
+ import type { HttpTestCaseResult } from '../http-test/index.js';
3
+ export declare const commonHttpHeaders: readonly ["date", "content-length", "transfer-encoding", "content-type", "connection", "server", "vary", "content-encoding", "access-control-allow-origin", "access-control-allow-headers", "access-control-allow-methods", "access-control-expose-headers", "access-control-max-age", "set-cookie", "strict-transport-security", "x-powered-by", "keep-alive", "cross-origin-opener-policy", "content-security-policy", "cross-origin-opener-policy", "origin-agent-cluster", "referrer-policy", "x-content-type-options", "x-dns-prefetch-control", "x-download-options", "x-frame-options", "x-permitted-cross-domain-policies", "x-xss-protection"];
4
+ export declare function checkForMissingHeaders(headers: Record<string, string | string[] | undefined>, response: ThymianHttpResponse): HttpTestCaseResult[];
5
+ export declare function checkForAdditionalHeaders(headers: Record<string, string | string[] | undefined>, response: ThymianHttpResponse): HttpTestCaseResult[];
6
+ export declare function validateExistingHeader(headers: Record<string, string | string[] | undefined>, response: ThymianHttpResponse): HttpTestCaseResult[];
7
+ export declare function validateHeaders(headers: Record<string, string | string[] | undefined>, response: ThymianHttpResponse): HttpTestCaseResult[];
8
+ //# sourceMappingURL=validate-headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-headers.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-headers.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,eAAO,MAAM,iBAAiB,ynBA6BpB,CAAC;AAKX,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CAatB;AAGD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CAoBtB;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CA8BtB;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,QAAQ,EAAE,mBAAmB,GAC5B,kBAAkB,EAAE,CAMtB"}
@@ -0,0 +1,101 @@
1
+ import { getHeader, objHasKeyIgnoreCase, } from '../../index.js';
2
+ import { ajv } from './ajv.js';
3
+ export const commonHttpHeaders = [
4
+ 'date',
5
+ 'content-length',
6
+ 'transfer-encoding',
7
+ 'content-type',
8
+ 'connection',
9
+ 'server',
10
+ 'vary',
11
+ 'content-encoding',
12
+ 'access-control-allow-origin',
13
+ 'access-control-allow-headers',
14
+ 'access-control-allow-methods',
15
+ 'access-control-expose-headers',
16
+ 'access-control-max-age',
17
+ 'set-cookie',
18
+ 'strict-transport-security',
19
+ 'x-powered-by',
20
+ 'keep-alive',
21
+ 'cross-origin-opener-policy',
22
+ 'content-security-policy',
23
+ 'cross-origin-opener-policy',
24
+ 'origin-agent-cluster',
25
+ 'referrer-policy',
26
+ 'x-content-type-options',
27
+ 'x-dns-prefetch-control',
28
+ 'x-download-options',
29
+ 'x-frame-options',
30
+ 'x-permitted-cross-domain-policies',
31
+ 'x-xss-protection',
32
+ ];
33
+ const commonHeadersSet = new Set(commonHttpHeaders);
34
+ // checks if the response is missing required headers
35
+ export function checkForMissingHeaders(headers, response) {
36
+ return Object.entries(response.headers).reduce((acc, [name, header]) => {
37
+ const value = getHeader(headers, name);
38
+ if (!value && header.required) {
39
+ acc.push({
40
+ type: 'assertion-failure',
41
+ message: `Header "${name}" is required but not included in the response.`,
42
+ });
43
+ }
44
+ return acc;
45
+ }, []);
46
+ }
47
+ // Are there headers included in the response that are not in the description format?
48
+ export function checkForAdditionalHeaders(headers, response) {
49
+ const failures = Object.keys(headers)
50
+ .filter((headerName) => !objHasKeyIgnoreCase(response.headers, headerName) &&
51
+ !commonHeadersSet.has(headerName.toLowerCase()))
52
+ .map((headerName) => ({
53
+ type: 'assertion-failure',
54
+ message: `Response contains header "${headerName}" that is not included in the description format.`,
55
+ }));
56
+ return failures.length > 0
57
+ ? failures
58
+ : [
59
+ {
60
+ type: 'assertion-success',
61
+ message: `Response does not contain additional headers that are included in the description format.`,
62
+ },
63
+ ];
64
+ }
65
+ export function validateExistingHeader(headers, response) {
66
+ return Object.entries(headers)
67
+ .filter(([name]) => Object.hasOwn(response.headers, name))
68
+ .map(([name, value]) => {
69
+ if (response.headers[name]?.schema) {
70
+ const validate = ajv.compile(response.headers[name]?.schema);
71
+ validate(value);
72
+ if (validate.errors) {
73
+ return {
74
+ type: 'assertion-failure',
75
+ message: `Invalid value for header ${name}: ${validate.errors.map((err) => err.message).join(', ')}.`,
76
+ timestamp: Date.now(),
77
+ };
78
+ }
79
+ else {
80
+ return {
81
+ type: 'assertion-success',
82
+ message: `Valid header ${name}.`,
83
+ timestamp: Date.now(),
84
+ };
85
+ }
86
+ }
87
+ return {
88
+ type: 'info',
89
+ message: `No schema provided for header ${name}.`,
90
+ timestamp: Date.now(),
91
+ };
92
+ });
93
+ }
94
+ export function validateHeaders(headers, response) {
95
+ return [
96
+ ...checkForMissingHeaders(headers, response),
97
+ ...checkForAdditionalHeaders(headers, response),
98
+ ...validateExistingHeader(headers, response),
99
+ ];
100
+ }
101
+ //# sourceMappingURL=validate-headers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-headers.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-headers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,mBAAmB,GAEpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM;IACN,gBAAgB;IAChB,mBAAmB;IACnB,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,kBAAkB;IAClB,6BAA6B;IAC7B,8BAA8B;IAC9B,8BAA8B;IAC9B,+BAA+B;IAC/B,wBAAwB;IACxB,YAAY;IACZ,2BAA2B;IAC3B,cAAc;IACd,YAAY;IACZ,4BAA4B;IAC5B,yBAAyB;IACzB,4BAA4B;IAC5B,sBAAsB;IACtB,iBAAiB;IACjB,wBAAwB;IACxB,wBAAwB;IACxB,oBAAoB;IACpB,iBAAiB;IACjB,mCAAmC;IACnC,kBAAkB;CACV,CAAC;AAEX,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS,iBAAiB,CAAC,CAAC;AAE5D,qDAAqD;AACrD,MAAM,UAAU,sBAAsB,CACpC,OAAsD,EACtD,QAA6B;IAE7B,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;QACrE,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAEvC,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC9B,GAAG,CAAC,IAAI,CAAC;gBACP,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,WAAW,IAAI,iDAAiD;aAC1E,CAAC,CAAC;QACL,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAA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pB,OAAO;oBACL,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,4BAA4B,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;oBACrG,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO;oBACL,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,gBAAgB,IAAI,GAAG;oBAChC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,iCAAiC,IAAI,GAAG;YACjD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,OAAsD,EACtD,QAA6B;IAE7B,OAAO;QACL,GAAG,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC5C,GAAG,yBAAyB,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC/C,GAAG,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC7C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ThymianHttpRequest } from '../../index.js';
2
+ import type { HttpTestCaseResult } from '../http-test/index.js';
3
+ export declare function validateJsonRequestBody(body: string, request: ThymianHttpRequest): HttpTestCaseResult[];
4
+ export declare function validateBodyForRequest(body: string | undefined, request: ThymianHttpRequest): HttpTestCaseResult[];
5
+ //# sourceMappingURL=validate-request-body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-request-body.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CA8CtB;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CA2BtB"}
@@ -0,0 +1,71 @@
1
+ import { parse } from 'secure-json-parse';
2
+ import { ajv } from './ajv.js';
3
+ export function validateJsonRequestBody(body, request) {
4
+ try {
5
+ const json = parse(body);
6
+ if (!request.body) {
7
+ return [
8
+ {
9
+ type: 'info',
10
+ message: 'No request body schema is provided.',
11
+ details: '',
12
+ timestamp: Date.now(),
13
+ },
14
+ ];
15
+ }
16
+ const validate = ajv.compile(request.body);
17
+ validate(json);
18
+ if (validate.errors) {
19
+ return [
20
+ {
21
+ type: 'assertion-failure',
22
+ message: `Invalid request body: ${validate.errors.map((err) => err.instancePath + ' ' + err.message).join(', ')}`,
23
+ timestamp: Date.now(),
24
+ },
25
+ ];
26
+ }
27
+ return [
28
+ {
29
+ type: 'assertion-success',
30
+ message: 'Valid request body.',
31
+ timestamp: Date.now(),
32
+ },
33
+ ];
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ }
36
+ catch (err) {
37
+ return [
38
+ {
39
+ type: 'assertion-failure',
40
+ message: 'Request body is not valid JSON.',
41
+ timestamp: Date.now(),
42
+ },
43
+ ];
44
+ }
45
+ }
46
+ export function validateBodyForRequest(body, request) {
47
+ if (typeof body === 'undefined') {
48
+ if (request.bodyRequired) {
49
+ return [
50
+ {
51
+ type: 'assertion-failure',
52
+ message: 'Request body is required but not provided.',
53
+ timestamp: Date.now(),
54
+ },
55
+ ];
56
+ }
57
+ return [];
58
+ }
59
+ if (/^application\/[^+]*[+]?(json);?.*/.test(request.mediaType)) {
60
+ return validateJsonRequestBody(body, request);
61
+ }
62
+ return [
63
+ {
64
+ type: 'info',
65
+ message: 'Non JSON request body cannot be validated.',
66
+ timestamp: Date.now(),
67
+ details: '',
68
+ },
69
+ ];
70
+ }
71
+ //# sourceMappingURL=validate-request-body.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-request-body.js","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI1C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,UAAU,uBAAuB,CACrC,IAAY,EACZ,OAA2B;IAE3B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,OAAO;gBACL;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,qCAAqC;oBAC9C,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB;aACF,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE3C,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEf,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO;gBACL;oBACE,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,yBAAyB,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,GAAG,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBACjH,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,qBAAqB;gBAC9B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACtB;SACF,CAAC;QACF,6DAA6D;IAC/D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL;gBACE,IAAI,EAAE,mBAAmB;gBACzB,OAAO,EAAE,iCAAiC;gBAC1C,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;aACtB;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,IAAwB,EACxB,OAA2B;IAE3B,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,OAAO;gBACL;oBACE,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,4CAA4C;oBACrD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB;aACF,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,mCAAmC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAChE,OAAO,uBAAuB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,OAAO;QACL;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,4CAA4C;YACrD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO,EAAE,EAAE;SACZ;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type ThymianHttpRequest } from '../../index.js';
2
+ import type { HttpTestCaseResult } from '../http-test/index.js';
3
+ export declare const commonRequestHeaders: readonly ["accept", "accept-charset", "accept-encoding", "accept-language", "authorization", "cache-control", "connection", "content-length", "content-type", "cookie", "host", "origin", "referer", "user-agent", "te", "upgrade", "via", "x-forwarded-for", "x-forwarded-host", "x-forwarded-proto", "x-request-id", "x-correlation-id"];
4
+ export declare function checkForMissingRequestHeaders(headers: Record<string, string | string[] | undefined>, request: ThymianHttpRequest): HttpTestCaseResult[];
5
+ export declare function checkForAdditionalRequestHeaders(headers: Record<string, string | string[] | undefined>, request: ThymianHttpRequest): HttpTestCaseResult[];
6
+ export declare function validateExistingRequestHeader(headers: Record<string, string | string[] | undefined>, request: ThymianHttpRequest): HttpTestCaseResult[];
7
+ export declare function validateRequestHeaders(headers: Record<string, string | string[] | undefined>, request: ThymianHttpRequest): HttpTestCaseResult[];
8
+ //# sourceMappingURL=validate-request-headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-request-headers.d.ts","sourceRoot":"","sources":["../../../src/http-testing/validate/validate-request-headers.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,eAAO,MAAM,oBAAoB,4UAuBvB,CAAC;AAIX,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAatB;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAoBtB;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CA8BtB;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,OAAO,EAAE,kBAAkB,GAC1B,kBAAkB,EAAE,CAMtB"}