@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
@@ -0,0 +1,88 @@
1
+ import { type HttpTestCase, type ThymianHttpTransaction } from '@thymian/core';
2
+ import type { Selector } from '../selectors/selector.js';
3
+ /**
4
+ * The record `sampler check` renders and `--json` emits.
5
+ *
6
+ * Beside the commands rather than among them: everything under
7
+ * `cli/commands/` is scanned by oclif as a command, and a module that is not
8
+ * one is reported as a missing command on every single run.
9
+ */
10
+ /**
11
+ * What one Transaction earned. Exactly one, always — a run that ends leaves no
12
+ * Transaction unaccounted for.
13
+ *
14
+ * - `passed` — executed, and answered as described.
15
+ * - `failed` — executed, and the response was invalid.
16
+ * - `skipped` — could not be executed *as described*: its Seed was answered
17
+ * differently, or the description does not supply a value the request needs.
18
+ * - `errored` — the attempt itself broke.
19
+ *
20
+ * The line between `skipped` and `failed` is the one worth holding. A
21
+ * transaction whose precondition never happened has told us nothing about the
22
+ * API, and rendering it as a failure is what turned one upstream problem into a
23
+ * wall of unrelated red.
24
+ */
25
+ export type Outcome = 'passed' | 'failed' | 'skipped' | 'errored';
26
+ /** One Transaction's result — and the documented shape `--json` emits. */
27
+ export type CheckedTransaction = {
28
+ selector: Selector;
29
+ outcome: Outcome;
30
+ expectedStatus: number;
31
+ actualStatus?: number;
32
+ /** Why it is not `passed`. Printed once, under the header. */
33
+ reason?: string;
34
+ /** The Seed whose own answer explains this outcome, when there is one. */
35
+ causedBy?: Selector;
36
+ /** Remediation, as whoever raised the problem wrote it. */
37
+ details: string[];
38
+ };
39
+ export type CheckSummary = {
40
+ passed: number;
41
+ failed: number;
42
+ skipped: number;
43
+ errored: number;
44
+ total: number;
45
+ };
46
+ /**
47
+ * What `sampler check --json` prints: one document, the whole run.
48
+ *
49
+ * The stable machine contract. `details` is deliberately not part of it — it is
50
+ * remediation prose for a reader, and `reason` already names the cause an agent
51
+ * has to act on.
52
+ */
53
+ export type CheckReport = {
54
+ summary: CheckSummary;
55
+ transactions: Array<Omit<CheckedTransaction, 'details'>>;
56
+ };
57
+ export declare function reportOf(checked: readonly CheckedTransaction[]): CheckReport;
58
+ /**
59
+ * The outcome of a Transaction whose pipeline ran to a conclusion.
60
+ *
61
+ * `passed` is the pipeline's own verdict. Everything else is re-read here,
62
+ * because the pipeline has one axis (did the test case fail?) and this has two:
63
+ * whether the transaction ran, and whether something upstream is why it did
64
+ * not.
65
+ */
66
+ export declare function checkedFromTestCase(testCase: HttpTestCase, transaction: ThymianHttpTransaction): CheckedTransaction;
67
+ /**
68
+ * The outcome of a Transaction whose attempt threw.
69
+ *
70
+ * A request that could not be built from the description is a Transaction that
71
+ * cannot be executed *as described* — a skip. Anything else that throws broke
72
+ * the attempt itself, which is what `errored` is for: a hook defect, a refused
73
+ * connection, a body that will not serialize.
74
+ */
75
+ export declare function checkedFromError(error: unknown, transaction: ThymianHttpTransaction): CheckedTransaction;
76
+ /**
77
+ * The outcome of a declared Transaction `sampler check` never attempts.
78
+ *
79
+ * A 3xx or 5xx response is declared but not executable as a check: there is
80
+ * nothing to assert against a redirect target the description does not name,
81
+ * and a 5xx is the server's own failure mode, not a claim about the API. Both
82
+ * are still declared Transactions, so they earn an Outcome of their own —
83
+ * `skipped`, with a reason, rather than disappearing from the report and
84
+ * leaving the totals silently short of what the description promises.
85
+ */
86
+ export declare function checkedAsUncheckable(transaction: ThymianHttpTransaction): CheckedTransaction;
87
+ export declare function summaryOf(checked: readonly CheckedTransaction[]): CheckSummary;
88
+ //# sourceMappingURL=check-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-result.d.ts","sourceRoot":"","sources":["../../src/cli/check-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAGjB,KAAK,sBAAsB,EAE5B,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;;;GAMG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAElE,0EAA0E;AAC1E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAC;CAC1D,CAAC;AAEF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,GAAG,WAAW,CAW5E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,sBAAsB,GAClC,kBAAkB,CAmCpB;AAUD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,sBAAsB,GAClC,kBAAkB,CAQpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,sBAAsB,GAClC,kBAAkB,CAQpB;AAED,wBAAgB,SAAS,CACvB,OAAO,EAAE,SAAS,kBAAkB,EAAE,GACrC,YAAY,CAWd"}
@@ -0,0 +1,160 @@
1
+ import { errorSuggestions, isRequestSerializationError, thymianHttpTransactionToString, } from '@thymian/core';
2
+ export function reportOf(checked) {
3
+ return {
4
+ summary: summaryOf(checked),
5
+ transactions: checked.map((result) => {
6
+ const document = { ...result };
7
+ delete document.details;
8
+ return document;
9
+ }),
10
+ };
11
+ }
12
+ /**
13
+ * The outcome of a Transaction whose pipeline ran to a conclusion.
14
+ *
15
+ * `passed` is the pipeline's own verdict. Everything else is re-read here,
16
+ * because the pipeline has one axis (did the test case fail?) and this has two:
17
+ * whether the transaction ran, and whether something upstream is why it did
18
+ * not.
19
+ */
20
+ export function checkedFromTestCase(testCase, transaction) {
21
+ const actualStatus = testCase.steps[0]?.transactions[0]?.response?.statusCode;
22
+ const seed = seedAnomaly(testCase, transaction);
23
+ const outcome = testCase.status === 'passed'
24
+ ? 'passed'
25
+ : // `failed` means the transaction executed and its own response was
26
+ // invalid — explicitly, per `utils.fail(...)`, or because the
27
+ // pipeline's own validation rejected it (#48). That verdict is never
28
+ // second-guessed: a seed anomaly recorded earlier in the same case
29
+ // does not explain *this* transaction's response, so it must not
30
+ // downgrade an explicit failure into a skip. Only when the pipeline
31
+ // did *not* call it failed does a seed anomaly get to say why —
32
+ // a transaction whose precondition never happened was not executed
33
+ // as described.
34
+ testCase.status === 'failed'
35
+ ? 'failed'
36
+ : 'skipped';
37
+ const details = detailsOf(testCase);
38
+ return {
39
+ selector: selectorOf(transaction),
40
+ expectedStatus: transaction.thymianRes.statusCode,
41
+ ...(actualStatus === undefined ? {} : { actualStatus }),
42
+ outcome,
43
+ // Anything that is not `passed` says why, always: the documented `--json`
44
+ // contract promises a `reason` for it, and a consumer should never have to
45
+ // handle a failure that came with no sentence. A case that failed without
46
+ // one hands over its first detail rather than repeating it below.
47
+ ...(outcome === 'passed'
48
+ ? {}
49
+ : { reason: testCase.reason || details.shift() || FALLBACK[outcome] }),
50
+ ...(seed ? { causedBy: seed } : {}),
51
+ details,
52
+ };
53
+ }
54
+ /** Last resort, for a pipeline verdict that arrived with nothing said. */
55
+ const FALLBACK = {
56
+ passed: '',
57
+ failed: 'The response did not match the description.',
58
+ skipped: 'This transaction could not be executed as described.',
59
+ errored: 'The attempt broke.',
60
+ };
61
+ /**
62
+ * The outcome of a Transaction whose attempt threw.
63
+ *
64
+ * A request that could not be built from the description is a Transaction that
65
+ * cannot be executed *as described* — a skip. Anything else that throws broke
66
+ * the attempt itself, which is what `errored` is for: a hook defect, a refused
67
+ * connection, a body that will not serialize.
68
+ */
69
+ export function checkedFromError(error, transaction) {
70
+ return {
71
+ selector: selectorOf(transaction),
72
+ expectedStatus: transaction.thymianRes.statusCode,
73
+ outcome: isRequestSerializationError(error) ? 'skipped' : 'errored',
74
+ reason: error instanceof Error ? error.message : String(error),
75
+ details: errorSuggestions(error),
76
+ };
77
+ }
78
+ /**
79
+ * The outcome of a declared Transaction `sampler check` never attempts.
80
+ *
81
+ * A 3xx or 5xx response is declared but not executable as a check: there is
82
+ * nothing to assert against a redirect target the description does not name,
83
+ * and a 5xx is the server's own failure mode, not a claim about the API. Both
84
+ * are still declared Transactions, so they earn an Outcome of their own —
85
+ * `skipped`, with a reason, rather than disappearing from the report and
86
+ * leaving the totals silently short of what the description promises.
87
+ */
88
+ export function checkedAsUncheckable(transaction) {
89
+ return {
90
+ selector: selectorOf(transaction),
91
+ expectedStatus: transaction.thymianRes.statusCode,
92
+ outcome: 'skipped',
93
+ reason: 'only 2xx and 4xx responses are checkable',
94
+ details: [],
95
+ };
96
+ }
97
+ export function summaryOf(checked) {
98
+ const count = (outcome) => checked.filter((result) => result.outcome === outcome).length;
99
+ return {
100
+ passed: count('passed'),
101
+ failed: count('failed'),
102
+ skipped: count('skipped'),
103
+ errored: count('errored'),
104
+ total: checked.length,
105
+ };
106
+ }
107
+ function selectorOf(transaction) {
108
+ return thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes);
109
+ }
110
+ /**
111
+ * The Seed that explains this outcome: an `invalid-transaction` result carrying
112
+ * a transaction other than the one being checked.
113
+ *
114
+ * Recorded by the hook runner when a `utils.request` call is answered with
115
+ * something other than what its Selector named — the only place that knows a
116
+ * nested request happened at all.
117
+ */
118
+ function seedAnomaly(testCase, checked) {
119
+ for (const result of testCase.results) {
120
+ if (result.type !== 'invalid-transaction' || !result.transaction) {
121
+ continue;
122
+ }
123
+ if (result.transaction.transactionId === checked.transactionId) {
124
+ continue;
125
+ }
126
+ return selectorOf(result.transaction);
127
+ }
128
+ return undefined;
129
+ }
130
+ /**
131
+ * Everything worth printing under the header, each sentence once.
132
+ *
133
+ * The case's `reason` is printed by the caller, and every result that merely
134
+ * repeats it is dropped: a status mismatch arrives twice — once as the reason
135
+ * and once as the `invalid-transaction` result it was derived from — which is
136
+ * how one sentence ended up on two consecutive lines.
137
+ */
138
+ function detailsOf(testCase) {
139
+ const seen = new Set([testCase.reason ?? '']);
140
+ const details = [];
141
+ for (const result of testCase.results) {
142
+ for (const line of linesOf(result)) {
143
+ if (line && !seen.has(line)) {
144
+ seen.add(line);
145
+ details.push(line);
146
+ }
147
+ }
148
+ }
149
+ return details;
150
+ }
151
+ function linesOf(result) {
152
+ if (result.type === 'assertion-failure') {
153
+ return [result.message];
154
+ }
155
+ if (result.type === 'invalid-transaction') {
156
+ return [result.message, result.details ?? ''];
157
+ }
158
+ return [];
159
+ }
160
+ //# sourceMappingURL=check-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-result.js","sourceRoot":"","sources":["../../src/cli/check-result.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,2BAA2B,EAE3B,8BAA8B,GAC/B,MAAM,eAAe,CAAC;AA+DvB,MAAM,UAAU,QAAQ,CAAC,OAAsC;IAC7D,OAAO;QACL,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC;QAC3B,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACnC,MAAM,QAAQ,GAAG,EAAE,GAAG,MAAM,EAAiC,CAAC;YAE9D,OAAO,QAAQ,CAAC,OAAO,CAAC;YAExB,OAAO,QAA+C,CAAC;QACzD,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAsB,EACtB,WAAmC;IAEnC,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC;IAC9E,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAChD,MAAM,OAAO,GACX,QAAQ,CAAC,MAAM,KAAK,QAAQ;QAC1B,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,mEAAmE;YACnE,8DAA8D;YAC9D,qEAAqE;YACrE,mEAAmE;YACnE,iEAAiE;YACjE,oEAAoE;YACpE,gEAAgE;YAChE,mEAAmE;YACnE,gBAAgB;YAChB,QAAQ,CAAC,MAAM,KAAK,QAAQ;gBAC5B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SAAS;QACX,CAAC;QAED,OAAO,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,SAAS,CAAC,QAAsB;IACvC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IACtD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACtC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACnC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,OAAO,CAAC,MAA0B;IACzC,IAAI,MAAM,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACxC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;QAC1C,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -1,16 +1,44 @@
1
1
  import { BaseCliRunCommand, oclif } from '@thymian/common-cli';
2
+ import { type CheckReport } from '../../check-result.js';
2
3
  export default class Check extends BaseCliRunCommand<typeof Check> {
4
+ static enableJsonFlag: boolean;
3
5
  static description: string;
4
6
  static examples: string[];
5
7
  static flags: {
6
8
  incremental: oclif.Interfaces.BooleanFlag<boolean>;
7
9
  "target-url": oclif.Interfaces.OptionFlag<string | undefined, oclif.Interfaces.CustomOptions>;
8
10
  };
9
- run(): Promise<void>;
10
- private checkAllTransactions;
11
- private checkTransactionsIncremental;
11
+ run(): Promise<CheckReport>;
12
+ /**
13
+ * Run one Transaction and say what it earned.
14
+ *
15
+ * The `try` is the whole point of the outcome model. A hook defect, a request
16
+ * that cannot be serialized or a refused connection used to reject the
17
+ * pipeline's observable and abort the command, so one broken transaction hid
18
+ * every transaction after it. Here it ends that transaction and nothing else.
19
+ */
20
+ private checkTransaction;
21
+ /** One line per transaction, then its reason once, then its remediation. */
22
+ private report;
23
+ /** The tally. */
24
+ private summarize;
25
+ /**
26
+ * Non-zero iff any Transaction is not `passed`.
27
+ *
28
+ * `process.exitCode` rather than `this.exit()`: an early exit throws past the
29
+ * run's teardown, and teardown is where the user's `afterAll` cleanups live.
30
+ * The command finishes, and then the shell learns how it went.
31
+ */
32
+ private setExitCode;
33
+ /**
34
+ * Whether a declared Transaction is one `sampler check` can actually run.
35
+ *
36
+ * A 3xx or 5xx Transaction is still declared and still counted — it earns
37
+ * `checkedAsUncheckable`'s `skipped` Outcome instead of a real attempt — so
38
+ * every declared Transaction is accounted for, per the check-outcomes
39
+ * contract, without sending a request nothing can assert against.
40
+ */
12
41
  private isCheckableTransaction;
13
42
  private runTransaction;
14
- private logFailureDetails;
15
43
  }
16
44
  //# sourceMappingURL=check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/sampler/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAW,MAAM,qBAAqB,CAAC;AAmBxE,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,iBAAiB,CAAC,OAAO,KAAK,CAAC;IAChE,OAAgB,WAAW,SACoD;IAE/E,OAAgB,QAAQ,WAItB;IAEF,OAAgB,KAAK;;;MAWnB;IAEa,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YA+BrB,oBAAoB;YAwDpB,4BAA4B;IAgE1C,OAAO,CAAC,sBAAsB;YAOhB,cAAc;IA2B5B,OAAO,CAAC,iBAAiB;CAmB1B"}
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/sampler/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAe/D,OAAO,EAKL,KAAK,WAAW,EAIjB,MAAM,uBAAuB,CAAC;AAc/B,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,iBAAiB,CAAC,OAAO,KAAK,CAAC;IAChE,OAAgB,cAAc,UAAQ;IAEtC,OAAgB,WAAW,SACoD;IAE/E,OAAgB,QAAQ,WAKtB;IAEF,OAAgB,KAAK;;;MAWnB;IAEa,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;IAoE1C;;;;;;;OAOG;YACW,gBAAgB;IA+B9B,4EAA4E;IAC5E,OAAO,CAAC,MAAM;IAyBd,iBAAiB;IACjB,OAAO,CAAC,SAAS;IA2BjB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAMnB;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;YAahB,cAAc;CA0B7B"}
@@ -1,136 +1,174 @@
1
- import { BaseCliRunCommand, oclif, prompts } from '@thymian/common-cli';
1
+ import { BaseCliRunCommand, oclif } from '@thymian/common-cli';
2
2
  import { Flags } from '@thymian/common-cli/oclif';
3
- import { filterHttpTransactions, generateRequests, httpTest, isValidClientErrorStatusCode, isValidSuccessfulStatusCode, mapToTestCase, runRequests, thymianHttpTransactionToString, } from '@thymian/core';
3
+ import { filterHttpTransactions, generateRequests, httpTest, mapToTestCase, runRequests, thymianHttpTransactionToString, } from '@thymian/core';
4
+ import { selectorForTransaction } from '../../../selectors/selector.js';
5
+ import { checkedAsUncheckable, checkedFromError, checkedFromTestCase, reportOf, summaryOf, } from '../../check-result.js';
4
6
  import { createContext } from '../../create-context.js';
7
+ /** One glyph per Outcome, so four states read as four states. */
8
+ const MARKS = {
9
+ passed: { mark: '✔', color: 'green' },
10
+ failed: { mark: '✖', color: 'red' },
11
+ skipped: { mark: '↷', color: 'yellow' },
12
+ errored: { mark: '!', color: 'red' },
13
+ };
5
14
  export default class Check extends BaseCliRunCommand {
15
+ static enableJsonFlag = true;
6
16
  static description = 'Verify that all sampled transactions can be executed against the live API.';
7
17
  static examples = [
8
18
  '<%= config.bin %> <%= command.id %>',
9
19
  '<%= config.bin %> <%= command.id %> --target-url http://localhost:8080',
10
20
  '<%= config.bin %> <%= command.id %> --incremental',
21
+ '<%= config.bin %> <%= command.id %> --json',
11
22
  ];
12
23
  static flags = {
13
24
  incremental: Flags.boolean({
14
25
  allowNo: true,
15
26
  default: false,
16
- description: 'Check transactions one by one and offer to generate hooks for failures.',
27
+ description: 'After each transaction that is not passed, print how to shape it with a hook.',
17
28
  }),
18
29
  ['target-url']: Flags.string({
19
30
  description: 'Override the target URL for all check requests. When set, all requests are sent to this origin instead of the servers defined in the specification.',
20
31
  }),
21
32
  };
22
33
  async run() {
23
- await this.thymian.run(async (emitter) => {
34
+ return await this.thymian.run(async (emitter) => {
24
35
  const specifications = this.thymianConfig.specifications ?? [];
25
36
  const format = await this.thymian.loadFormat({
26
37
  inputs: specifications,
27
38
  validateSpecs: this.flags['validate-specs'],
28
39
  });
29
- const transactions = format.getThymianHttpTransactions();
30
40
  const targetUrl = this.flags['target-url'] ?? this.thymianConfig.targetUrl;
31
41
  const context = createContext(format, this.logger.child('sampler-check'), emitter);
32
- if (this.flags.incremental) {
33
- await this.checkTransactionsIncremental(transactions, context, targetUrl);
42
+ const checked = [];
43
+ /**
44
+ * A diagnostic at `error` severity closes the run out from under this
45
+ * loop, and nothing tells the loop.
46
+ *
47
+ * `Thymian.run` closes and rejects on the first such diagnostic, but the
48
+ * callback it is running keeps going — so the loop sent the rest of its
49
+ * requests against a closed run and printed its summary *above* the
50
+ * error trailer. Per-transaction faults are `warn` and never land here;
51
+ * anything that does is the run itself ending.
52
+ */
53
+ let runEnded = false;
54
+ const errors = emitter.onError((event) => {
55
+ runEnded ||= event.error.options.severity === 'error';
56
+ });
57
+ try {
58
+ for (const transaction of format.getThymianHttpTransactions()) {
59
+ if (runEnded) {
60
+ break;
61
+ }
62
+ const result = this.isCheckableTransaction(transaction)
63
+ ? await this.checkTransaction(transaction, context, targetUrl)
64
+ : checkedAsUncheckable(transaction);
65
+ checked.push(result);
66
+ if (!this.jsonEnabled()) {
67
+ this.report(result);
68
+ }
69
+ }
70
+ }
71
+ finally {
72
+ errors.unsubscribe();
73
+ }
74
+ // The exit code is the same contract either way; only the rendering
75
+ // differs, and under `--json` there is none — oclif prints the returned
76
+ // document, and the feedback tip suppresses itself.
77
+ if (this.jsonEnabled()) {
78
+ this.setExitCode(checked);
34
79
  }
35
80
  else {
36
- await this.checkAllTransactions(transactions, context, targetUrl);
81
+ this.summarize(checked);
37
82
  }
83
+ return reportOf(checked);
38
84
  });
39
85
  }
40
- async checkAllTransactions(transactions, context, targetUrl) {
41
- let successful = 0;
42
- let failed = 0;
43
- for (const transaction of transactions) {
44
- if (!this.isCheckableTransaction(transaction)) {
45
- continue;
46
- }
47
- const transactionName = thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes);
48
- this.logger.debug('Checking transaction: ' + transactionName);
86
+ /**
87
+ * Run one Transaction and say what it earned.
88
+ *
89
+ * The `try` is the whole point of the outcome model. A hook defect, a request
90
+ * that cannot be serialized or a refused connection used to reject the
91
+ * pipeline's observable and abort the command, so one broken transaction hid
92
+ * every transaction after it. Here it ends that transaction and nothing else.
93
+ */
94
+ async checkTransaction(transaction, context, targetUrl) {
95
+ this.logger.debug('Checking transaction: ' + selectorForTransaction(transaction));
96
+ try {
49
97
  const testResult = await this.runTransaction(transaction, context, targetUrl);
50
98
  const testCase = testResult.cases[0];
51
- if (testCase && testCase.status === 'passed') {
52
- this.log(oclif.ux.colorize('green', `✔ ${transactionName}`));
53
- successful++;
54
- }
55
- else {
56
- this.log(oclif.ux.colorize('red', `✖ ${transactionName}`));
57
- this.logFailureDetails(testCase);
58
- this.log();
59
- failed++;
60
- }
99
+ return testCase
100
+ ? checkedFromTestCase(testCase, transaction)
101
+ : checkedFromError(new Error('The test pipeline produced no result for this transaction.'), transaction);
61
102
  }
62
- this.log();
63
- if (failed > 0) {
64
- this.log(`Checked ${successful + failed} transactions. ${oclif.ux.colorize('red', `${failed} failed`)}.`);
65
- this.exit(1);
103
+ catch (e) {
104
+ return checkedFromError(e, transaction);
66
105
  }
67
- else {
68
- this.log(oclif.ux.colorize('green', `Checked ${successful + failed} transactions. All passed.`));
106
+ }
107
+ /** One line per transaction, then its reason once, then its remediation. */
108
+ report(result) {
109
+ const { mark, color } = MARKS[result.outcome];
110
+ this.log(oclif.ux.colorize(color, `${mark} ${result.selector}`));
111
+ if (result.outcome === 'passed') {
112
+ return;
113
+ }
114
+ for (const line of [result.reason, ...result.details].filter(Boolean)) {
115
+ this.log(oclif.ux.colorize('dim', ` ${line}`));
116
+ }
117
+ if (this.flags.incremental) {
118
+ this.log(oclif.ux.colorize('dim', ' Shape this request by anchoring a hook to its selector, printed above.'));
69
119
  }
120
+ this.log();
70
121
  }
71
- async checkTransactionsIncremental(transactions, context, targetUrl) {
72
- for (const transaction of transactions) {
73
- if (!this.isCheckableTransaction(transaction)) {
74
- continue;
75
- }
76
- const transactionName = thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes);
77
- this.logger.debug('Checking transaction: ' + transactionName);
78
- const testResult = await this.runTransaction(transaction, context, targetUrl);
79
- const testCase = testResult.cases[0];
80
- if (testCase && testCase.status === 'passed') {
81
- this.log(oclif.ux.colorize('green', `✔ ${transactionName}`));
82
- continue;
83
- }
84
- this.log(oclif.ux.colorize('red', `✖ ${transactionName}`));
85
- this.logFailureDetails(testCase);
86
- this.log();
87
- this.log('You can generate a hook for this transaction with:');
88
- this.log(` $ thymian sampler generate hook --for-transaction ${transaction.transactionId}`);
89
- this.log();
90
- if (!this.config.findCommand('sampler generate hook')) {
91
- this.debug('Command sampler generate hook is not available. Skipping hook generation prompt.');
92
- continue;
93
- }
94
- const answer = await prompts.confirm({
95
- message: 'Do you want to generate a hook to fix this transaction?',
96
- default: false,
97
- });
98
- if (answer) {
99
- await this.config.runCommand('sampler generate hook', [
100
- '--for-transaction',
101
- transaction.transactionId,
102
- '--cwd',
103
- this.flags.cwd,
104
- ...(this.flags.config ? ['-c', this.flags.config] : []),
105
- ]);
106
- }
122
+ /** The tally. */
123
+ summarize(checked) {
124
+ const summary = summaryOf(checked);
125
+ this.log();
126
+ if (summary.passed === summary.total) {
127
+ this.log(oclif.ux.colorize('green', `Checked ${summary.total} transactions. All passed.`));
128
+ return;
107
129
  }
130
+ const tally = ['failed', 'skipped', 'errored']
131
+ .filter((outcome) => summary[outcome] > 0)
132
+ .map((outcome) => `${summary[outcome]} ${outcome}`);
133
+ this.log(`Checked ${summary.total} transactions: ${summary.passed} passed, ${tally.join(', ')}.`);
134
+ this.setExitCode(checked);
108
135
  }
136
+ /**
137
+ * Non-zero iff any Transaction is not `passed`.
138
+ *
139
+ * `process.exitCode` rather than `this.exit()`: an early exit throws past the
140
+ * run's teardown, and teardown is where the user's `afterAll` cleanups live.
141
+ * The command finishes, and then the shell learns how it went.
142
+ */
143
+ setExitCode(checked) {
144
+ if (checked.some((result) => result.outcome !== 'passed')) {
145
+ process.exitCode = 1;
146
+ }
147
+ }
148
+ /**
149
+ * Whether a declared Transaction is one `sampler check` can actually run.
150
+ *
151
+ * A 3xx or 5xx Transaction is still declared and still counted — it earns
152
+ * `checkedAsUncheckable`'s `skipped` Outcome instead of a real attempt — so
153
+ * every declared Transaction is accounted for, per the check-outcomes
154
+ * contract, without sending a request nothing can assert against.
155
+ */
109
156
  isCheckableTransaction(transaction) {
110
- return (isValidSuccessfulStatusCode(transaction.thymianRes.statusCode) ||
111
- isValidClientErrorStatusCode(transaction.thymianRes.statusCode));
157
+ // By first digit, not by the registered-code lists.
158
+ //
159
+ // A description may declare a status IANA never registered — `499` is the
160
+ // common one — and the lists answer "no" for it, so the transaction was
161
+ // reported `skipped` as uncheckable although it is a 4xx. What decides
162
+ // checkability is whether a response can be asserted against at all,
163
+ // which is a property of the class.
164
+ const status = transaction.thymianRes.statusCode;
165
+ return (status >= 200 && status < 300) || (status >= 400 && status < 500);
112
166
  }
113
167
  async runTransaction(transaction, context, targetUrl) {
114
- const transactionName = thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes);
115
168
  const reqFilter = (_req, reqId) => reqId === transaction.thymianReqId;
116
169
  const resFilter = (_res, resId) => resId === transaction.thymianResId;
117
- const test = httpTest(transactionName, (transactions) => transactions.pipe(filterHttpTransactions(reqFilter, resFilter), mapToTestCase(), generateRequests(), runRequests({ checkResponse: false, origin: targetUrl })));
170
+ const test = httpTest(thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes), (transactions) => transactions.pipe(filterHttpTransactions(reqFilter, resFilter), mapToTestCase(), generateRequests(), runRequests({ checkResponse: false, origin: targetUrl })));
118
171
  return test(context);
119
172
  }
120
- logFailureDetails(testCase) {
121
- if (!testCase) {
122
- this.log(oclif.ux.colorize('dim', ' Reason: No test result.'));
123
- return;
124
- }
125
- if (testCase.reason) {
126
- this.log(oclif.ux.colorize('dim', ` Reason: ${testCase.reason}`));
127
- }
128
- for (const result of testCase.results) {
129
- if (result.type === 'assertion-failure' ||
130
- result.type === 'invalid-transaction') {
131
- this.log(oclif.ux.colorize('dim', ` ${result.message}`));
132
- }
133
- }
134
- }
135
173
  }
136
174
  //# sourceMappingURL=check.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../src/cli/commands/sampler/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,O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AI,CAAC,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC;IAC5E,CAAC;IAEO,KAAK,CAAC,cAAc,CAC1B,WAAmC,EACnC,OAAyC,EACzC,SAAkB;QAElB,MAAM,SAAS,GAAoB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACjD,KAAK,KAAK,WAAW,CAAC,YAAY,CAAC;QACrC,MAAM,SAAS,GAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAClD,KAAK,KAAK,WAAW,CAAC,YAAY,CAAC;QAErC,MAAM,IAAI,GAAG,QAAQ,CACnB,8BAA8B,CAC5B,WAAW,CAAC,UAAU,EACtB,WAAW,CAAC,UAAU,CACvB,EACD,CAAC,YAAY,EAAE,EAAE,CACf,YAAY,CAAC,IAAI,CACf,sBAAsB,CAAC,SAAS,EAAE,SAAS,CAAC,EAC5C,aAAa,EAAE,EACf,gBAAgB,EAAE,EAClB,WAAW,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CACzD,CACJ,CAAC;QAEF,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC"}
@@ -1,10 +1,8 @@
1
- import { BaseCliRunCommand, oclif } from '@thymian/common-cli';
1
+ import { BaseCliRunCommand } from '@thymian/common-cli';
2
2
  export default class Init extends BaseCliRunCommand<typeof Init> {
3
+ static enableJsonFlag: boolean;
3
4
  static description: string;
4
- static flags: {
5
- overwrite: oclif.Interfaces.BooleanFlag<boolean>;
6
- check: oclif.Interfaces.BooleanFlag<boolean>;
7
- };
8
- run(): Promise<void>;
5
+ static examples: string[];
6
+ run(): Promise<unknown>;
9
7
  }
10
8
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/sampler/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAW,MAAM,qBAAqB,CAAC;AAExE,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,iBAAiB,CAAC,OAAO,IAAI,CAAC;IAC9D,OAAgB,WAAW,SAC2C;IAEtE,OAAgB,KAAK;;;MAYnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA4D3B"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/sampler/init.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAS,MAAM,qBAAqB,CAAC;AAI/D,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,iBAAiB,CAAC,OAAO,IAAI,CAAC;IAC9D,OAAgB,cAAc,UAAQ;IAEtC,OAAgB,WAAW,SAC6E;IAExG,OAAgB,QAAQ,WAA2C;IAEpD,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CAoDvC"}