@thymian/plugin-sampler 0.3.0-canary.20261007-e6cb8dc → 0.3.0-canary.20261007-cdbe1d3

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 (264) hide show
  1. package/dist/cli/check-result.d.ts +88 -0
  2. package/dist/cli/check-result.d.ts.map +1 -0
  3. package/dist/cli/check-result.js +160 -0
  4. package/dist/cli/check-result.js.map +1 -0
  5. package/dist/cli/commands/sampler/check.d.ts +32 -4
  6. package/dist/cli/commands/sampler/check.d.ts.map +1 -1
  7. package/dist/cli/commands/sampler/check.js +126 -88
  8. package/dist/cli/commands/sampler/check.js.map +1 -1
  9. package/dist/cli/commands/sampler/init.d.ts +4 -6
  10. package/dist/cli/commands/sampler/init.d.ts.map +1 -1
  11. package/dist/cli/commands/sampler/init.js +33 -49
  12. package/dist/cli/commands/sampler/init.js.map +1 -1
  13. package/dist/cli/commands/sampler/show.d.ts +11 -0
  14. package/dist/cli/commands/sampler/show.d.ts.map +1 -0
  15. package/dist/cli/commands/sampler/show.js +36 -0
  16. package/dist/cli/commands/sampler/show.js.map +1 -0
  17. package/dist/cli/commands/sampler/sync.d.ts +11 -0
  18. package/dist/cli/commands/sampler/sync.d.ts.map +1 -0
  19. package/dist/cli/commands/sampler/sync.js +65 -0
  20. package/dist/cli/commands/sampler/sync.js.map +1 -0
  21. package/dist/cli/commands/sampler/validate.d.ts +3 -10
  22. package/dist/cli/commands/sampler/validate.d.ts.map +1 -1
  23. package/dist/cli/commands/sampler/validate.js +57 -126
  24. package/dist/cli/commands/sampler/validate.js.map +1 -1
  25. package/dist/generation/closed-schema.d.ts +22 -0
  26. package/dist/generation/closed-schema.d.ts.map +1 -0
  27. package/dist/generation/closed-schema.js +45 -0
  28. package/dist/generation/closed-schema.js.map +1 -0
  29. package/dist/generation/content-type-strategies/json.content-type-strategy.d.ts.map +1 -1
  30. package/dist/generation/content-type-strategies/json.content-type-strategy.js +3 -1
  31. package/dist/generation/content-type-strategies/json.content-type-strategy.js.map +1 -1
  32. package/dist/generation/content-type-strategies/xml.content-type-strategy.d.ts.map +1 -1
  33. package/dist/generation/content-type-strategies/xml.content-type-strategy.js +3 -1
  34. package/dist/generation/content-type-strategies/xml.content-type-strategy.js.map +1 -1
  35. package/dist/generation/generate-request-sample.d.ts +12 -0
  36. package/dist/generation/generate-request-sample.d.ts.map +1 -0
  37. package/dist/generation/{generate-samples.js → generate-request-sample.js} +11 -4
  38. package/dist/generation/generate-request-sample.js.map +1 -0
  39. package/dist/generation/request-generators/default-request-generator.d.ts +14 -0
  40. package/dist/generation/request-generators/default-request-generator.d.ts.map +1 -1
  41. package/dist/generation/request-generators/default-request-generator.js +18 -1
  42. package/dist/generation/request-generators/default-request-generator.js.map +1 -1
  43. package/dist/generation/types/declaration-set.d.ts +124 -0
  44. package/dist/generation/types/declaration-set.d.ts.map +1 -0
  45. package/dist/generation/types/declaration-set.js +389 -0
  46. package/dist/generation/types/declaration-set.js.map +1 -0
  47. package/dist/generation/types/example-reflection.d.ts +21 -0
  48. package/dist/generation/types/example-reflection.d.ts.map +1 -0
  49. package/dist/generation/types/example-reflection.js +135 -0
  50. package/dist/generation/types/example-reflection.js.map +1 -0
  51. package/dist/generation/types/generate-type-surface.d.ts +23 -0
  52. package/dist/generation/types/generate-type-surface.d.ts.map +1 -0
  53. package/dist/generation/types/generate-type-surface.js +671 -0
  54. package/dist/generation/types/generate-type-surface.js.map +1 -0
  55. package/dist/generation/types/schema-type.d.ts +20 -0
  56. package/dist/generation/types/schema-type.d.ts.map +1 -0
  57. package/dist/generation/types/schema-type.js +203 -0
  58. package/dist/generation/types/schema-type.js.map +1 -0
  59. package/dist/generation/types/self-check-surface.d.ts +32 -0
  60. package/dist/generation/types/self-check-surface.d.ts.map +1 -0
  61. package/dist/generation/types/self-check-surface.js +92 -0
  62. package/dist/generation/types/self-check-surface.js.map +1 -0
  63. package/dist/generation/types/type-names.d.ts +135 -0
  64. package/dist/generation/types/type-names.d.ts.map +1 -0
  65. package/dist/generation/types/type-names.js +213 -0
  66. package/dist/generation/types/type-names.js.map +1 -0
  67. package/dist/generation/types/write-type-surface.d.ts +58 -0
  68. package/dist/generation/types/write-type-surface.d.ts.map +1 -0
  69. package/dist/generation/types/write-type-surface.js +119 -0
  70. package/dist/generation/types/write-type-surface.js.map +1 -0
  71. package/dist/hooks/create-hook-utils.d.ts +22 -6
  72. package/dist/hooks/create-hook-utils.d.ts.map +1 -1
  73. package/dist/hooks/create-hook-utils.js +74 -96
  74. package/dist/hooks/create-hook-utils.js.map +1 -1
  75. package/dist/hooks/hook-api.d.ts +49 -0
  76. package/dist/hooks/hook-api.d.ts.map +1 -0
  77. package/dist/hooks/hook-api.js +105 -0
  78. package/dist/hooks/hook-api.js.map +1 -0
  79. package/dist/hooks/hook-diagnostics.d.ts +45 -0
  80. package/dist/hooks/hook-diagnostics.d.ts.map +1 -0
  81. package/dist/hooks/hook-diagnostics.js +80 -0
  82. package/dist/hooks/hook-diagnostics.js.map +1 -0
  83. package/dist/hooks/hook-errors.d.ts +33 -0
  84. package/dist/hooks/hook-errors.d.ts.map +1 -1
  85. package/dist/hooks/hook-errors.js +46 -0
  86. package/dist/hooks/hook-errors.js.map +1 -1
  87. package/dist/hooks/hook-registration.d.ts +108 -0
  88. package/dist/hooks/hook-registration.d.ts.map +1 -0
  89. package/dist/hooks/hook-registration.js +69 -0
  90. package/dist/hooks/hook-registration.js.map +1 -0
  91. package/dist/hooks/hook-runner.d.ts +111 -11
  92. package/dist/hooks/hook-runner.d.ts.map +1 -1
  93. package/dist/hooks/hook-runner.js +309 -142
  94. package/dist/hooks/hook-runner.js.map +1 -1
  95. package/dist/hooks/hook-utils-factory.d.ts +19 -0
  96. package/dist/hooks/hook-utils-factory.d.ts.map +1 -0
  97. package/dist/hooks/hook-utils-factory.js +2 -0
  98. package/dist/hooks/hook-utils-factory.js.map +1 -0
  99. package/dist/hooks/hook-utils.d.ts +80 -12
  100. package/dist/hooks/hook-utils.d.ts.map +1 -1
  101. package/dist/hooks/invoke-hook.d.ts +71 -0
  102. package/dist/hooks/invoke-hook.d.ts.map +1 -0
  103. package/dist/hooks/invoke-hook.js +161 -0
  104. package/dist/hooks/invoke-hook.js.map +1 -0
  105. package/dist/hooks/load-user-hooks.d.ts +96 -0
  106. package/dist/hooks/load-user-hooks.d.ts.map +1 -0
  107. package/dist/hooks/load-user-hooks.js +432 -0
  108. package/dist/hooks/load-user-hooks.js.map +1 -0
  109. package/dist/hooks/nested-request.d.ts +21 -0
  110. package/dist/hooks/nested-request.d.ts.map +1 -0
  111. package/dist/hooks/nested-request.js +24 -0
  112. package/dist/hooks/nested-request.js.map +1 -0
  113. package/dist/hooks/overlay-args.d.ts +40 -0
  114. package/dist/hooks/overlay-args.d.ts.map +1 -0
  115. package/dist/hooks/overlay-args.js +84 -0
  116. package/dist/hooks/overlay-args.js.map +1 -0
  117. package/dist/hooks/resolve-targeting.d.ts +16 -0
  118. package/dist/hooks/resolve-targeting.d.ts.map +1 -0
  119. package/dist/hooks/resolve-targeting.js +168 -0
  120. package/dist/hooks/resolve-targeting.js.map +1 -0
  121. package/dist/hooks/run-scoped-hooks.d.ts +83 -0
  122. package/dist/hooks/run-scoped-hooks.d.ts.map +1 -0
  123. package/dist/hooks/run-scoped-hooks.js +153 -0
  124. package/dist/hooks/run-scoped-hooks.js.map +1 -0
  125. package/dist/index.d.ts +42 -19
  126. package/dist/index.d.ts.map +1 -1
  127. package/dist/index.js +152 -165
  128. package/dist/index.js.map +1 -1
  129. package/dist/request-sampler.d.ts +40 -11
  130. package/dist/request-sampler.d.ts.map +1 -1
  131. package/dist/request-sampler.js +51 -76
  132. package/dist/request-sampler.js.map +1 -1
  133. package/dist/sampler-paths.d.ts +19 -0
  134. package/dist/sampler-paths.d.ts.map +1 -0
  135. package/dist/sampler-paths.js +22 -0
  136. package/dist/sampler-paths.js.map +1 -0
  137. package/dist/selectors/nearest-paths.d.ts +14 -0
  138. package/dist/selectors/nearest-paths.d.ts.map +1 -0
  139. package/dist/selectors/nearest-paths.js +32 -0
  140. package/dist/selectors/nearest-paths.js.map +1 -0
  141. package/dist/selectors/path-glob.d.ts +94 -0
  142. package/dist/selectors/path-glob.d.ts.map +1 -0
  143. package/dist/selectors/path-glob.js +136 -0
  144. package/dist/selectors/path-glob.js.map +1 -0
  145. package/dist/selectors/selector-errors.d.ts +17 -0
  146. package/dist/selectors/selector-errors.d.ts.map +1 -0
  147. package/dist/selectors/selector-errors.js +139 -0
  148. package/dist/selectors/selector-errors.js.map +1 -0
  149. package/dist/selectors/selector.d.ts +55 -0
  150. package/dist/selectors/selector.d.ts.map +1 -0
  151. package/dist/selectors/selector.js +305 -0
  152. package/dist/selectors/selector.js.map +1 -0
  153. package/dist/selectors/transaction-catalog.d.ts +96 -0
  154. package/dist/selectors/transaction-catalog.d.ts.map +1 -0
  155. package/dist/selectors/transaction-catalog.js +193 -0
  156. package/dist/selectors/transaction-catalog.js.map +1 -0
  157. package/dist/selectors/transaction-filter.d.ts +119 -0
  158. package/dist/selectors/transaction-filter.d.ts.map +1 -0
  159. package/dist/selectors/transaction-filter.js +191 -0
  160. package/dist/selectors/transaction-filter.js.map +1 -0
  161. package/dist/ts-path.d.ts +36 -0
  162. package/dist/ts-path.d.ts.map +1 -0
  163. package/dist/ts-path.js +46 -0
  164. package/dist/ts-path.js.map +1 -0
  165. package/dist/utils.d.ts +1 -2
  166. package/dist/utils.d.ts.map +1 -1
  167. package/dist/utils.js +2 -20
  168. package/dist/utils.js.map +1 -1
  169. package/dist/validation/canonicalize.d.ts +17 -0
  170. package/dist/validation/canonicalize.d.ts.map +1 -0
  171. package/dist/validation/canonicalize.js +29 -0
  172. package/dist/validation/canonicalize.js.map +1 -0
  173. package/dist/validation/shared-compiler-host.d.ts +17 -0
  174. package/dist/validation/shared-compiler-host.d.ts.map +1 -0
  175. package/dist/validation/shared-compiler-host.js +58 -0
  176. package/dist/validation/shared-compiler-host.js.map +1 -0
  177. package/dist/validation/typecheck-hooks.d.ts +37 -0
  178. package/dist/validation/typecheck-hooks.d.ts.map +1 -0
  179. package/dist/validation/typecheck-hooks.js +169 -0
  180. package/dist/validation/typecheck-hooks.js.map +1 -0
  181. package/dist/validation/validate-sampler.d.ts +79 -0
  182. package/dist/validation/validate-sampler.d.ts.map +1 -0
  183. package/dist/validation/validate-sampler.js +89 -0
  184. package/dist/validation/validate-sampler.js.map +1 -0
  185. package/package.json +7 -11
  186. package/dist/cli/commands/sampler/generate/hook.d.ts +0 -10
  187. package/dist/cli/commands/sampler/generate/hook.d.ts.map +0 -1
  188. package/dist/cli/commands/sampler/generate/hook.js +0 -19
  189. package/dist/cli/commands/sampler/generate/hook.js.map +0 -1
  190. package/dist/cli/generate-hook.d.ts +0 -4
  191. package/dist/cli/generate-hook.d.ts.map +0 -1
  192. package/dist/cli/generate-hook.js +0 -96
  193. package/dist/cli/generate-hook.js.map +0 -1
  194. package/dist/cli/templates.d.ts +0 -4
  195. package/dist/cli/templates.d.ts.map +0 -1
  196. package/dist/cli/templates.js +0 -28
  197. package/dist/cli/templates.js.map +0 -1
  198. package/dist/constants.d.ts +0 -12
  199. package/dist/constants.d.ts.map +0 -1
  200. package/dist/constants.js +0 -16
  201. package/dist/constants.js.map +0 -1
  202. package/dist/generation/generate-samples-for-thymian-format.d.ts +0 -4
  203. package/dist/generation/generate-samples-for-thymian-format.d.ts.map +0 -1
  204. package/dist/generation/generate-samples-for-thymian-format.js +0 -18
  205. package/dist/generation/generate-samples-for-thymian-format.js.map +0 -1
  206. package/dist/generation/generate-samples.d.ts +0 -4
  207. package/dist/generation/generate-samples.d.ts.map +0 -1
  208. package/dist/generation/generate-samples.js.map +0 -1
  209. package/dist/hooks/generate-request-types.d.ts +0 -34
  210. package/dist/hooks/generate-request-types.d.ts.map +0 -1
  211. package/dist/hooks/generate-request-types.js +0 -458
  212. package/dist/hooks/generate-request-types.js.map +0 -1
  213. package/dist/hooks/hook-types.d.ts +0 -7
  214. package/dist/hooks/hook-types.d.ts.map +0 -1
  215. package/dist/hooks/hook-types.js +0 -2
  216. package/dist/hooks/hook-types.js.map +0 -1
  217. package/dist/hooks/load-hooks-from-samples.d.ts +0 -3
  218. package/dist/hooks/load-hooks-from-samples.d.ts.map +0 -1
  219. package/dist/hooks/load-hooks-from-samples.js +0 -22
  220. package/dist/hooks/load-hooks-from-samples.js.map +0 -1
  221. package/dist/hooks/ts-config.d.ts +0 -10
  222. package/dist/hooks/ts-config.d.ts.map +0 -1
  223. package/dist/hooks/ts-config.js +0 -10
  224. package/dist/hooks/ts-config.js.map +0 -1
  225. package/dist/samples-structure/file-request-sample.d.ts +0 -20
  226. package/dist/samples-structure/file-request-sample.d.ts.map +0 -1
  227. package/dist/samples-structure/file-request-sample.js +0 -5
  228. package/dist/samples-structure/file-request-sample.js.map +0 -1
  229. package/dist/samples-structure/get-path-transaction-id.d.ts +0 -3
  230. package/dist/samples-structure/get-path-transaction-id.d.ts.map +0 -1
  231. package/dist/samples-structure/get-path-transaction-id.js +0 -22
  232. package/dist/samples-structure/get-path-transaction-id.js.map +0 -1
  233. package/dist/samples-structure/merge-tree.d.ts +0 -5
  234. package/dist/samples-structure/merge-tree.d.ts.map +0 -1
  235. package/dist/samples-structure/merge-tree.js +0 -118
  236. package/dist/samples-structure/merge-tree.js.map +0 -1
  237. package/dist/samples-structure/read-samples-from-dir.d.ts +0 -13
  238. package/dist/samples-structure/read-samples-from-dir.d.ts.map +0 -1
  239. package/dist/samples-structure/read-samples-from-dir.js +0 -205
  240. package/dist/samples-structure/read-samples-from-dir.js.map +0 -1
  241. package/dist/samples-structure/samples-from-transactions.d.ts +0 -5
  242. package/dist/samples-structure/samples-from-transactions.d.ts.map +0 -1
  243. package/dist/samples-structure/samples-from-transactions.js +0 -120
  244. package/dist/samples-structure/samples-from-transactions.js.map +0 -1
  245. package/dist/samples-structure/samples-tree-structure.d.ts +0 -106
  246. package/dist/samples-structure/samples-tree-structure.d.ts.map +0 -1
  247. package/dist/samples-structure/samples-tree-structure.js +0 -26
  248. package/dist/samples-structure/samples-tree-structure.js.map +0 -1
  249. package/dist/samples-structure/structure-meta-on-disc.d.ts +0 -11
  250. package/dist/samples-structure/structure-meta-on-disc.d.ts.map +0 -1
  251. package/dist/samples-structure/structure-meta-on-disc.js +0 -2
  252. package/dist/samples-structure/structure-meta-on-disc.js.map +0 -1
  253. package/dist/samples-structure/traverse.d.ts +0 -4
  254. package/dist/samples-structure/traverse.d.ts.map +0 -1
  255. package/dist/samples-structure/traverse.js +0 -13
  256. package/dist/samples-structure/traverse.js.map +0 -1
  257. package/dist/samples-structure/write-samples-to-dir.d.ts +0 -37
  258. package/dist/samples-structure/write-samples-to-dir.d.ts.map +0 -1
  259. package/dist/samples-structure/write-samples-to-dir.js +0 -183
  260. package/dist/samples-structure/write-samples-to-dir.js.map +0 -1
  261. package/dist/validation/validate-sampler-output.d.ts +0 -38
  262. package/dist/validation/validate-sampler-output.d.ts.map +0 -1
  263. package/dist/validation/validate-sampler-output.js +0 -288
  264. package/dist/validation/validate-sampler-output.js.map +0 -1
@@ -1,172 +1,339 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { ThymianBaseError, thymianHttpTransactionToString, } from '@thymian/core';
4
- import { readSamplesFromDir } from '../samples-structure/read-samples-from-dir.js';
5
- import { entryExists } from '../utils.js';
6
- import { createHookUtils } from './create-hook-utils.js';
7
- import { FailError, SkipError } from './hook-errors.js';
8
- import { loadHooksFromSamples } from './load-hooks-from-samples.js';
1
+ import { getContentType, serializeRequest, ThymianFormat, } from '@thymian/core';
2
+ import { TransactionCatalog } from '../selectors/transaction-catalog.js';
3
+ import { createHookUtils, parseResponseBody, } from './create-hook-utils.js';
4
+ import { UndeclaredResponseError } from './hook-errors.js';
5
+ import { interpretHookFailure, invokeHook, invokeOrThrow, reportHookResults, } from './invoke-hook.js';
6
+ import {} from './load-user-hooks.js';
7
+ import { isOnChain, requestCycleError, } from './nested-request.js';
8
+ import { applyArgs } from './overlay-args.js';
9
+ import { RunScopedHooks } from './run-scoped-hooks.js';
10
+ const EMPTY_HOOKS = Object.freeze({
11
+ defineSample: [],
12
+ beforeEach: [],
13
+ afterEach: [],
14
+ authorize: [],
15
+ });
16
+ /**
17
+ * Runs the user's hooks at the http-testing seams.
18
+ *
19
+ * Holds the bindings the loader produced and nothing else: an unbound
20
+ * Transaction simply has no hooks, which is the pass-through case, so there is
21
+ * no "not initialized" state to guard against.
22
+ */
9
23
  export class HookRunner {
10
- path;
11
- runRequest;
12
24
  logger;
13
- initialized = false;
14
- hooks = new Map();
15
- urlToTransactionId = {};
16
- format;
17
- constructor(path, runRequest, logger) {
18
- this.path = path;
19
- this.runRequest = runRequest;
25
+ ports;
26
+ format = new ThymianFormat();
27
+ catalog = TransactionCatalog.fromThymianFormat(new ThymianFormat());
28
+ byTransactionId = new Map();
29
+ globalAuthorize = [];
30
+ runScoped;
31
+ /**
32
+ * The origin this run is actually talking to — a `--target-url` override or
33
+ * a configured target, same as the server the description names when
34
+ * neither is set — so a run-scoped hook's seed goes where the run goes
35
+ * rather than where the description points.
36
+ *
37
+ * Captured once, from the very first request. "Before the run" has no
38
+ * meaning until something decides when the run starts, and the sampler's
39
+ * first observation of a run is its first request, so this is captured in
40
+ * lockstep with {@link RunScopedHooks.start}'s latch, in
41
+ * {@link beforeEachRequest}.
42
+ *
43
+ * **One origin per run**, which is a simplification the CLI does not
44
+ * currently expose: a format assembled from several descriptions may name
45
+ * different servers per transaction, and a `beforeAll` seed would still be
46
+ * sent to whichever origin the first request happened to use rather than to
47
+ * its own transaction's server. Per-request hooks are unaffected — they read
48
+ * the origin off the request in front of them. Reset on {@link load}, so the
49
+ * value never outlives the run that observed it.
50
+ */
51
+ runOrigin;
52
+ constructor(logger, ports) {
20
53
  this.logger = logger;
54
+ this.ports = ports;
55
+ this.runScoped = new RunScopedHooks(logger, this.utilsFactory);
21
56
  }
22
- async init(format, samplesStructure) {
23
- if (this.initialized) {
57
+ /** Adopt a newly loaded format and the hooks bound against it. */
58
+ load(format, catalog, hooks) {
59
+ this.format = format;
60
+ this.catalog = catalog;
61
+ this.byTransactionId = hooks?.byTransactionId ?? new Map();
62
+ this.globalAuthorize = hooks?.globalAuthorize ?? [];
63
+ this.runScoped.load(hooks?.runScoped ?? { beforeAll: [], afterAll: [] });
64
+ // A load is a new run's format, so the previous run's observed origin must
65
+ // not survive into it: in a long-lived process — `thymian serve` — the
66
+ // second run's seeds would otherwise be sent to the first run's target.
67
+ this.runOrigin = undefined;
68
+ }
69
+ /**
70
+ * Teardown, on `core.close`. A no-op when no request was ever sent, so a
71
+ * non-test command never runs somebody's teardown.
72
+ */
73
+ async close() {
74
+ await this.runScoped.close();
75
+ }
76
+ /**
77
+ * The `utils` a hook with no request to shape gets: the run-scoped pair. A
78
+ * nested request is available, because a `beforeAll` seeding the API is the
79
+ * reason `utils.request` exists. `dir` comes from the registration's own
80
+ * file, not the process's working directory, so a run-scoped hook's file
81
+ * helpers resolve the same way a per-Transaction hook's do.
82
+ */
83
+ utilsFactory = (entry) => {
84
+ const results = [];
85
+ return {
86
+ utils: createHookUtils(this.callContext({ dir: entry.dir, results, chain: [] })),
87
+ results,
88
+ };
89
+ };
90
+ /**
91
+ * Shape one request draft with its Transaction's `defineSample` hook, if it
92
+ * has one. This is what `RequestSampler` calls at generation time; the sampler
93
+ * itself knows nothing about hooks.
94
+ *
95
+ * Runs through the same attribution wrapper as every other kind: a throwing
96
+ * `defineSample` used to escape here as a raw error with no pointer to the
97
+ * hook that threw it, misattributed by whatever generic handler caught it
98
+ * further up.
99
+ */
100
+ shapeSample = async (draft, transactionId) => {
101
+ const entry = this.hooksFor(transactionId).defineSample[0];
102
+ if (!entry) {
24
103
  return;
25
104
  }
26
- if (!(await entryExists(this.path))) {
27
- return;
105
+ const results = [];
106
+ try {
107
+ await invokeOrThrow('defineSample', entry, [
108
+ draft,
109
+ createHookUtils(
110
+ // No nested request: a `defineSample` hook runs before any request
111
+ // exists, so there is no pipeline for one to run through.
112
+ { dir: entry.dir, request: draft, results }),
113
+ ]);
28
114
  }
29
- const samples = samplesStructure ?? (await readSamplesFromDir(this.path));
30
- const meta = JSON.parse(await readFile(join(this.path, 'meta.json'), 'utf-8'));
31
- this.urlToTransactionId = meta.transactions;
32
- this.hooks = loadHooksFromSamples(samples);
33
- this.format = format;
34
- this.initialized = true;
115
+ finally {
116
+ reportHookResults(this.logger, results);
117
+ }
118
+ };
119
+ hooksFor(transactionId) {
120
+ if (!transactionId) {
121
+ return EMPTY_HOOKS;
122
+ }
123
+ return this.byTransactionId.get(transactionId) ?? EMPTY_HOOKS;
124
+ }
125
+ callContext(input) {
126
+ // A per-Transaction hook already has a request carrying the run's origin
127
+ // (the operator that overrides it for `--target-url` does so before
128
+ // `beforeRequest` fires), so it stays the source of truth there. A
129
+ // run-scoped hook has no request, which is exactly the case
130
+ // {@link runOrigin} exists for. Only `requestOther` needs this — it is
131
+ // what a nested `utils.request` inherits — so it lives in this closure
132
+ // rather than on the `HookCallContext` itself.
133
+ const origin = input.request?.origin ?? this.runOrigin;
134
+ return {
135
+ dir: input.dir,
136
+ request: input.request,
137
+ results: input.results,
138
+ requestOther: async (selector, args, options) => await this.runNested(selector, args, options, {
139
+ chain: input.chain,
140
+ results: input.results,
141
+ origin,
142
+ }),
143
+ };
144
+ }
145
+ async beforeEachRequest(hook) {
146
+ const { value, ctx } = hook;
147
+ // The first request is what "before the run" means to the sampler, so the
148
+ // latch is armed here — ahead of this transaction's own beforeEach hooks —
149
+ // and this request is also the run's one observation of the origin it is
150
+ // actually talking to. Captured before the latch arms, so a `beforeAll`
151
+ // seed sent while arming it already sees the run's target rather than the
152
+ // server the description names.
153
+ this.runOrigin ??= value.origin;
154
+ await this.runScoped.start();
155
+ return await this.compose('beforeEach', this.hooksFor(ctx?.transactionId).beforeEach, value, ctx, value, this.chainFor(ctx));
35
156
  }
36
157
  async afterEachResponse(hook) {
37
- if (!this.initialized) {
38
- throw new ThymianBaseError('Cannot run hooks before @thymian/plugin-sampler is initialized.', {
39
- name: 'HookRunnerNotInitialized',
40
- suggestions: ['Did you run "thymian sampler init"?'],
41
- });
42
- }
43
158
  const { value, ctx } = hook;
44
- const hooks = ctx.thymianTransaction
45
- ? this.hooks.get(ctx.thymianTransaction.transactionId)
46
- : undefined;
47
- let result = value;
159
+ return await this.compose('afterEach', this.hooksFor(ctx.thymianTransaction?.transactionId).afterEach, value, ctx, ctx.requestTemplate, this.chainFor(ctx.thymianTransaction));
160
+ }
161
+ async authorize(hook) {
162
+ const { value, ctx } = hook;
163
+ const entry = this.authorizeFor(ctx?.transactionId);
164
+ return await this.compose('authorize', entry ? [entry] : [], value, ctx, value, this.chainFor(ctx));
165
+ }
166
+ /**
167
+ * Which authorize hook supplies this Transaction's credentials.
168
+ *
169
+ * A targeted hook wins over the global one for the Transactions it covers, and
170
+ * within each tier the last registration wins, so a later file can override an
171
+ * earlier one. Exactly one hook runs: authorization is "who am I", and
172
+ * composing two answers would mean two sets of credentials on one request.
173
+ *
174
+ * Whether it runs at all is not decided here — core runs this seam only when
175
+ * the run option and the request's own `authorize` flag agree — so a
176
+ * registered hook is necessary but not sufficient, which is what makes
177
+ * "force on" need both.
178
+ */
179
+ authorizeFor(transactionId) {
180
+ return (this.hooksFor(transactionId).authorize.at(-1) ??
181
+ this.globalAuthorize.at(-1));
182
+ }
183
+ /**
184
+ * The chain a hook of `transaction` runs with: the Transaction's own Selector,
185
+ * so a hook that seeds itself is caught on the first step.
186
+ */
187
+ chainFor(transaction) {
188
+ if (!transaction) {
189
+ return [];
190
+ }
191
+ const selector = this.catalog.selectorFor(transaction.transactionId);
192
+ return selector ? [selector] : [];
193
+ }
194
+ /**
195
+ * Run a kind's hooks in order over one value, and translate whatever comes
196
+ * back into the shape the http-testing seam expects.
197
+ *
198
+ * Every hook **mutates `value` in place**; the callback's return value is
199
+ * deliberately discarded (see {@link invokeHook}).
200
+ */
201
+ async compose(kind, entries, value, ctx, request, chain) {
48
202
  const testResults = [];
49
- const utils = createHookUtils(this.format, this.runRequest, this, this.urlToTransactionId, testResults, this.logger);
50
- for (const afterEach of hooks?.afterEachResponse ?? []) {
203
+ for (const entry of entries) {
204
+ const utils = createHookUtils(this.callContext({
205
+ dir: entry.dir,
206
+ request,
207
+ results: testResults,
208
+ chain,
209
+ }));
51
210
  try {
52
- result = await afterEach(result, ctx, utils);
211
+ await invokeHook(entry, [value, ctx, utils]);
53
212
  }
54
213
  catch (e) {
55
- if (e instanceof SkipError) {
56
- return {
57
- result,
58
- skip: e.message,
59
- testResults,
60
- };
214
+ const outcome = interpretHookFailure(e, kind, entry);
215
+ if (outcome.rethrow) {
216
+ throw outcome.rethrow;
61
217
  }
62
- if (e instanceof FailError) {
63
- return {
64
- result,
65
- fail: e.message,
66
- testResults,
67
- };
68
- }
69
- throw new ThymianBaseError(`Error while running afterEach hook${hook.ctx && hook.ctx.thymianTransaction ? ' for transaction: ' + thymianHttpTransactionToString(hook.ctx.thymianTransaction.thymianReq, hook.ctx.thymianTransaction.thymianRes) : ''}.`, {
70
- cause: e,
71
- name: 'HookError',
72
- });
218
+ return { result: value, ...outcome.report, testResults };
73
219
  }
74
220
  }
75
- return {
76
- result,
77
- testResults,
78
- };
221
+ return { result: value, testResults };
79
222
  }
80
- async authorize(hook) {
81
- if (!this.initialized) {
82
- throw new ThymianBaseError('Cannot run hooks before @thymian/plugin-sampler is initialized.', {
83
- name: 'HookRunnerNotInitialized',
84
- suggestions: ['Did you run "thymian sampler init"?'],
85
- });
223
+ /**
224
+ * Send a request to another Transaction, addressed by its Selector.
225
+ *
226
+ * By default the nested request runs the target's own
227
+ * `beforeEach → authorize → afterEach` pipeline, so seeding behaves like the
228
+ * real run rather than like a second, quieter client. `runHooks: false` sends
229
+ * the generated request as-is, which is also the way out of a cycle.
230
+ */
231
+ async runNested(selector, args, options, caller) {
232
+ const { chain, results: callerResults, origin: callerOrigin } = caller;
233
+ const runHooks = options.runHooks ?? true;
234
+ const transaction = this.catalog.resolve(selector);
235
+ const nested = [...chain, selector];
236
+ const template = applyArgs(await this.ports.sampleRequest(transaction), args);
237
+ // A seed goes where the run is going. The caller's request already carries
238
+ // whatever origin the run resolved — a `--target-url`, a configured target
239
+ // — and without inheriting it a seeding call would quietly send real
240
+ // traffic to the server the description names while the run itself talks to
241
+ // localhost.
242
+ if (callerOrigin) {
243
+ template.origin = callerOrigin;
86
244
  }
87
- const { value, ctx } = hook;
88
- const hooks = ctx?.transactionId
89
- ? this.hooks.get(ctx.transactionId)
90
- : undefined;
91
- const authorize = hooks?.authorize?.at(-1);
92
- if (!authorize) {
93
- return {
94
- result: value,
95
- };
245
+ if (options.authorize !== undefined) {
246
+ template.authorize = options.authorize;
96
247
  }
97
- const testResults = [];
98
- const utils = createHookUtils(this.format, this.runRequest, this, this.urlToTransactionId, testResults, this.logger);
99
- try {
100
- const result = await authorize(value, ctx, utils);
101
- return {
102
- result,
103
- testResults,
104
- };
248
+ const authorizeHook = this.authorizeFor(transaction.transactionId);
249
+ // The guard has to ask the same question the two blocks below answer: will
250
+ // *any* hook run for this call? `runHooks` covers `beforeEach`/`afterEach`,
251
+ // but an `authorize` hook can run even with `runHooks: false` — it is
252
+ // gated by the *flag*, evaluated here after the overlay and `options`
253
+ // applied it, and by whether one is registered. Guarding on `runHooks`
254
+ // alone left that second path open: a global `authorize` seeding its own
255
+ // token with `runHooks: false` recursed into itself through exactly this
256
+ // path, with nothing to stop it short of a timeout.
257
+ const willRunAHook = runHooks || (template.authorize === true && !!authorizeHook);
258
+ if (willRunAHook && isOnChain(chain, selector)) {
259
+ throw requestCycleError(chain, selector);
105
260
  }
106
- catch (e) {
107
- if (e instanceof SkipError) {
108
- return {
109
- result: value,
110
- skip: e.message,
111
- testResults,
112
- };
113
- }
114
- if (e instanceof FailError) {
115
- return {
116
- result: value,
117
- fail: e.message,
118
- testResults,
119
- };
120
- }
121
- throw new ThymianBaseError(`Error while running authorize hook${hook.ctx ? ' for transaction: ' + thymianHttpTransactionToString(hook.ctx.thymianReq, hook.ctx.thymianRes) : ''}.`, {
122
- cause: e,
123
- name: 'HookError',
124
- });
261
+ const results = [];
262
+ if (runHooks) {
263
+ const before = await this.compose('beforeEach', this.hooksFor(transaction.transactionId).beforeEach, template, transaction, template, nested);
264
+ results.push(...before.testResults);
125
265
  }
126
- }
127
- async beforeEachRequest(hook) {
128
- if (!this.initialized) {
129
- throw new ThymianBaseError('Cannot run hooks before @thymian/plugin-sampler is initialized.', {
130
- name: 'HookRunnerNotInitialized',
131
- suggestions: ['Did you run "thymian sampler init"?'],
132
- });
266
+ if (template.authorize && authorizeHook) {
267
+ const authorized = await this.compose('authorize', [authorizeHook], template, transaction, template, nested);
268
+ results.push(...authorized.testResults);
133
269
  }
134
- const { value, ctx } = hook;
135
- const hooks = ctx?.transactionId
136
- ? this.hooks.get(ctx.transactionId)
137
- : undefined;
138
- let result = value;
139
- const testResults = [];
140
- const utils = createHookUtils(this.format, this.runRequest, this, this.urlToTransactionId, testResults, this.logger);
141
- for (const beforeEach of hooks?.beforeEachRequest ?? []) {
142
- try {
143
- result = await beforeEach(result, ctx, utils);
144
- }
145
- catch (e) {
146
- if (e instanceof SkipError) {
147
- return {
148
- result,
149
- skip: e.message,
150
- testResults,
151
- };
152
- }
153
- if (e instanceof FailError) {
154
- return {
155
- result,
156
- fail: e.message,
157
- testResults,
158
- };
159
- }
160
- throw new ThymianBaseError(`Error while running beforeEach hook${hook.ctx ? ' for transaction: ' + thymianHttpTransactionToString(hook.ctx.thymianReq, hook.ctx.thymianRes) : ''}.`, {
161
- cause: e,
162
- name: 'HookError',
163
- });
270
+ const request = serializeRequest({
271
+ requestTemplate: template,
272
+ source: transaction,
273
+ });
274
+ const response = await this.ports.dispatch(request);
275
+ if (runHooks) {
276
+ const after = await this.compose('afterEach', this.hooksFor(transaction.transactionId).afterEach, response, { request, requestTemplate: template, thymianTransaction: transaction }, template, nested);
277
+ results.push(...after.testResults);
278
+ }
279
+ // A nested request has no test case of its own; what its hooks recorded is
280
+ // logged rather than dropped.
281
+ reportHookResults(this.logger, results);
282
+ const body = parseResponseBody(response);
283
+ // The Selector said which Transaction to initiate; the server decided which
284
+ // one happened. Either way, a seed that was answered with something other
285
+ // than what it asked for is recorded on the *calling* hook's results — that
286
+ // is what lets `sampler check` say which seed a skip was caused by instead
287
+ // of only that this transaction did not work.
288
+ if (response.statusCode !== transaction.thymianRes.statusCode) {
289
+ // A declared status is one of the union's members and comes back for the
290
+ // caller to branch on. An undeclared one has no member to be, so it
291
+ // throws rather than arriving as a value whose type is a lie.
292
+ const undeclared = this.declaresStatus(transaction, response.statusCode)
293
+ ? undefined
294
+ : new UndeclaredResponseError(selector, response.statusCode, response.headers, body);
295
+ callerResults.push({
296
+ type: 'invalid-transaction',
297
+ // The same sentence the thrown error carries, deliberately: when it
298
+ // escapes the hook it becomes the transaction's reason, and one
299
+ // sentence printed once is the whole point of saying it in one place.
300
+ message: undeclared?.message ??
301
+ `The seed "${selector}" was answered with ${response.statusCode}, not the ${transaction.thymianRes.statusCode} its selector names.`,
302
+ transaction,
303
+ timestamp: Date.now(),
304
+ details: undeclared
305
+ ? 'Branch on the seed’s status code, or call utils.skip to end this transaction deliberately.'
306
+ : 'The specification declares that response, so the seed ran — but it did not put the system into the state this transaction describes. Branch on the status code in the seeding hook, or fix the data it sends.',
307
+ });
308
+ if (undeclared) {
309
+ throw undeclared;
164
310
  }
165
311
  }
166
312
  return {
167
- result,
168
- testResults,
313
+ body,
314
+ headers: response.headers,
315
+ mediaType: mediaTypeOf(response),
316
+ statusCode: response.statusCode,
169
317
  };
170
318
  }
319
+ /** Whether the target's operation declares a response with this status. */
320
+ declaresStatus(transaction, statusCode) {
321
+ return this.catalog
322
+ .responsesOf(transaction)
323
+ .some(([, sibling]) => sibling.thymianRes.statusCode === statusCode);
324
+ }
325
+ }
326
+ /**
327
+ * The media type a response actually carried: the essence of its content type,
328
+ * parameters stripped, or `''` when it declared none.
329
+ *
330
+ * Only the *status* decides whether a response is declared — that is what the
331
+ * union discriminates on, and what `UndeclaredResponseError` reports. The media
332
+ * type is reported as observed, so a body that arrives as something the
333
+ * description did not promise is visible rather than relabelled.
334
+ */
335
+ function mediaTypeOf(response) {
336
+ const contentType = getContentType(response.headers);
337
+ return (contentType.split(';')[0] ?? '').trim().toLowerCase();
171
338
  }
172
339
  //# sourceMappingURL=hook-runner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hook-runner.js","sourceRoot":"","sources":["../../src/hooks/hook-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAIL,gBAAgB,EAEhB,8BAA8B,GAC/B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAMnF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,OAAO,UAAU;IAOF;IACA;IACA;IARX,WAAW,GAAG,KAAK,CAAC;IACpB,KAAK,GAAuB,IAAI,GAAG,EAAE,CAAC;IACtC,kBAAkB,GAA2B,EAAE,CAAC;IAChD,MAAM,CAAiB;IAE/B,YACmB,IAAY,EACZ,UAAuD,EACvD,MAAc;QAFd,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAA6C;QACvD,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;IAEJ,KAAK,CAAC,IAAI,CACR,MAAqB,EACrB,gBAAmC;QAEnC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC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,UAAU,aAAa,WAAW,CAAC,UAAU,CAAC,UAAU,sBAAsB;gBACrI,WAAW;gBACX,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,OAAO,EAAE,UAAU;oBACjB,CAAC,CAAC,4FAA4F;oBAC9F,CAAC,CAAC,+MAA+M;aACpN,CAAC,CAAC;YAEH,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,UAAU,CAAC;YACnB,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI;YACJ,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,SAAS,EAAE,WAAW,CAAC,QAAQ,CAAC;YAChC,UAAU,EAAE,QAAQ,CAAC,UAAU;SAChC,CAAC;IACJ,CAAC;IAED,2EAA2E;IACnE,cAAc,CACpB,WAAmC,EACnC,UAAkB;QAElB,OAAO,IAAI,CAAC,OAAO;aAChB,WAAW,CAAC,WAAW,CAAC;aACxB,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC;IACzE,CAAC;CACF;AAcD;;;;;;;;GAQG;AACH,SAAS,WAAW,CAAC,QAAsB;IACzC,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAErD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAChE,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { HttpTestCaseResult } from '@thymian/core';
2
+ import type { Endpoints, HookUtils } from './hook-utils.js';
3
+ import type { CollectedRegistration } from './load-user-hooks.js';
4
+ /**
5
+ * Makes one `utils` object and the array its results land in, for one
6
+ * registration.
7
+ *
8
+ * A factory rather than a single object: results belong to one hook call, so
9
+ * each call needs its own array, and the caller is the only thing that knows
10
+ * where those results should end up. It takes the registration itself —
11
+ * rather than being called bare — so a run-scoped hook's file helpers resolve
12
+ * against *its own* file's directory instead of the process's working
13
+ * directory.
14
+ */
15
+ export type HookUtilsFactory = (entry: CollectedRegistration) => {
16
+ utils: HookUtils<Endpoints>;
17
+ results: HttpTestCaseResult[];
18
+ };
19
+ //# sourceMappingURL=hook-utils-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook-utils-factory.d.ts","sourceRoot":"","sources":["../../src/hooks/hook-utils-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK;IAC/D,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hook-utils-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook-utils-factory.js","sourceRoot":"","sources":["../../src/hooks/hook-utils-factory.ts"],"names":[],"mappings":""}