@thymian/plugin-sampler 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 (170) hide show
  1. package/README.md +59 -0
  2. package/dist/cli/commands/sampler/check.d.ts +16 -0
  3. package/dist/cli/commands/sampler/check.d.ts.map +1 -0
  4. package/dist/cli/commands/sampler/check.js +135 -0
  5. package/dist/cli/commands/sampler/check.js.map +1 -0
  6. package/dist/cli/commands/sampler/generate/hook.d.ts +9 -0
  7. package/dist/cli/commands/sampler/generate/hook.d.ts.map +1 -0
  8. package/dist/cli/commands/sampler/generate/hook.js +18 -0
  9. package/dist/cli/commands/sampler/generate/hook.js.map +1 -0
  10. package/dist/cli/commands/sampler/init.d.ts +9 -0
  11. package/dist/cli/commands/sampler/init.d.ts.map +1 -0
  12. package/dist/cli/commands/sampler/init.js +55 -0
  13. package/dist/cli/commands/sampler/init.js.map +1 -0
  14. package/dist/cli/create-context.d.ts +3 -0
  15. package/dist/cli/create-context.d.ts.map +1 -0
  16. package/dist/cli/create-context.js +21 -0
  17. package/dist/cli/create-context.js.map +1 -0
  18. package/dist/cli/generate-hook.d.ts +4 -0
  19. package/dist/cli/generate-hook.d.ts.map +1 -0
  20. package/dist/cli/generate-hook.js +92 -0
  21. package/dist/cli/generate-hook.js.map +1 -0
  22. package/dist/cli/templates.d.ts +4 -0
  23. package/dist/cli/templates.d.ts.map +1 -0
  24. package/dist/cli/templates.js +28 -0
  25. package/dist/cli/templates.js.map +1 -0
  26. package/dist/constants.d.ts +5 -0
  27. package/dist/constants.d.ts.map +1 -0
  28. package/dist/constants.js +5 -0
  29. package/dist/constants.js.map +1 -0
  30. package/dist/generation/content-source-generator.d.ts +10 -0
  31. package/dist/generation/content-source-generator.d.ts.map +1 -0
  32. package/dist/generation/content-source-generator.js +15 -0
  33. package/dist/generation/content-source-generator.js.map +1 -0
  34. package/dist/generation/content-type-strategies/content-type-strategy.d.ts +7 -0
  35. package/dist/generation/content-type-strategies/content-type-strategy.d.ts.map +1 -0
  36. package/dist/generation/content-type-strategies/content-type-strategy.js +2 -0
  37. package/dist/generation/content-type-strategies/content-type-strategy.js.map +1 -0
  38. package/dist/generation/content-type-strategies/error.content-type-strategy.d.ts +7 -0
  39. package/dist/generation/content-type-strategies/error.content-type-strategy.d.ts.map +1 -0
  40. package/dist/generation/content-type-strategies/error.content-type-strategy.js +13 -0
  41. package/dist/generation/content-type-strategies/error.content-type-strategy.js.map +1 -0
  42. package/dist/generation/content-type-strategies/hook.content-type-strategy.d.ts +10 -0
  43. package/dist/generation/content-type-strategies/hook.content-type-strategy.d.ts.map +1 -0
  44. package/dist/generation/content-type-strategies/hook.content-type-strategy.js +27 -0
  45. package/dist/generation/content-type-strategies/hook.content-type-strategy.js.map +1 -0
  46. package/dist/generation/content-type-strategies/image.content-type-strategy.d.ts +15 -0
  47. package/dist/generation/content-type-strategies/image.content-type-strategy.d.ts.map +1 -0
  48. package/dist/generation/content-type-strategies/image.content-type-strategy.js +40 -0
  49. package/dist/generation/content-type-strategies/image.content-type-strategy.js.map +1 -0
  50. package/dist/generation/content-type-strategies/json.content-type-strategy.d.ts +8 -0
  51. package/dist/generation/content-type-strategies/json.content-type-strategy.d.ts.map +1 -0
  52. package/dist/generation/content-type-strategies/json.content-type-strategy.js +12 -0
  53. package/dist/generation/content-type-strategies/json.content-type-strategy.js.map +1 -0
  54. package/dist/generation/content-type-strategies/text.content-type-strategy.d.ts +8 -0
  55. package/dist/generation/content-type-strategies/text.content-type-strategy.d.ts.map +1 -0
  56. package/dist/generation/content-type-strategies/text.content-type-strategy.js +13 -0
  57. package/dist/generation/content-type-strategies/text.content-type-strategy.js.map +1 -0
  58. package/dist/generation/content-type-strategies/xml.content-type-strategy.d.ts +8 -0
  59. package/dist/generation/content-type-strategies/xml.content-type-strategy.d.ts.map +1 -0
  60. package/dist/generation/content-type-strategies/xml.content-type-strategy.js +14 -0
  61. package/dist/generation/content-type-strategies/xml.content-type-strategy.js.map +1 -0
  62. package/dist/generation/generate-samples-for-thymian-format.d.ts +4 -0
  63. package/dist/generation/generate-samples-for-thymian-format.d.ts.map +1 -0
  64. package/dist/generation/generate-samples-for-thymian-format.js +18 -0
  65. package/dist/generation/generate-samples-for-thymian-format.js.map +1 -0
  66. package/dist/generation/generate-samples.d.ts +4 -0
  67. package/dist/generation/generate-samples.d.ts.map +1 -0
  68. package/dist/generation/generate-samples.js +26 -0
  69. package/dist/generation/generate-samples.js.map +1 -0
  70. package/dist/generation/request-generators/default-request-generator.d.ts +22 -0
  71. package/dist/generation/request-generators/default-request-generator.d.ts.map +1 -0
  72. package/dist/generation/request-generators/default-request-generator.js +80 -0
  73. package/dist/generation/request-generators/default-request-generator.js.map +1 -0
  74. package/dist/generation/request-generators/range-request-generator.d.ts +8 -0
  75. package/dist/generation/request-generators/range-request-generator.d.ts.map +1 -0
  76. package/dist/generation/request-generators/range-request-generator.js +22 -0
  77. package/dist/generation/request-generators/range-request-generator.js.map +1 -0
  78. package/dist/generation/request-generators/unauthorized-request-generator.d.ts +6 -0
  79. package/dist/generation/request-generators/unauthorized-request-generator.d.ts.map +1 -0
  80. package/dist/generation/request-generators/unauthorized-request-generator.js +10 -0
  81. package/dist/generation/request-generators/unauthorized-request-generator.js.map +1 -0
  82. package/dist/hooks/create-hook-utils.d.ts +8 -0
  83. package/dist/hooks/create-hook-utils.d.ts.map +1 -0
  84. package/dist/hooks/create-hook-utils.js +137 -0
  85. package/dist/hooks/create-hook-utils.js.map +1 -0
  86. package/dist/hooks/generate-request-types.d.ts +30 -0
  87. package/dist/hooks/generate-request-types.d.ts.map +1 -0
  88. package/dist/hooks/generate-request-types.js +424 -0
  89. package/dist/hooks/generate-request-types.js.map +1 -0
  90. package/dist/hooks/hook-errors.d.ts +5 -0
  91. package/dist/hooks/hook-errors.d.ts.map +1 -0
  92. package/dist/hooks/hook-errors.js +5 -0
  93. package/dist/hooks/hook-errors.js.map +1 -0
  94. package/dist/hooks/hook-runner.d.ts +18 -0
  95. package/dist/hooks/hook-runner.d.ts.map +1 -0
  96. package/dist/hooks/hook-runner.js +172 -0
  97. package/dist/hooks/hook-runner.js.map +1 -0
  98. package/dist/hooks/hook-types.d.ts +7 -0
  99. package/dist/hooks/hook-types.d.ts.map +1 -0
  100. package/dist/hooks/hook-types.js +2 -0
  101. package/dist/hooks/hook-types.js.map +1 -0
  102. package/dist/hooks/hook-utils.d.ts +36 -0
  103. package/dist/hooks/hook-utils.d.ts.map +1 -0
  104. package/dist/hooks/hook-utils.js +2 -0
  105. package/dist/hooks/hook-utils.js.map +1 -0
  106. package/dist/hooks/load-hooks-from-samples.d.ts +3 -0
  107. package/dist/hooks/load-hooks-from-samples.d.ts.map +1 -0
  108. package/dist/hooks/load-hooks-from-samples.js +22 -0
  109. package/dist/hooks/load-hooks-from-samples.js.map +1 -0
  110. package/dist/hooks/ts-config.d.ts +10 -0
  111. package/dist/hooks/ts-config.d.ts.map +1 -0
  112. package/dist/hooks/ts-config.js +10 -0
  113. package/dist/hooks/ts-config.js.map +1 -0
  114. package/dist/http-request-sample.d.ts +24 -0
  115. package/dist/http-request-sample.d.ts.map +1 -0
  116. package/dist/http-request-sample.js +11 -0
  117. package/dist/http-request-sample.js.map +1 -0
  118. package/dist/index.d.ts +41 -0
  119. package/dist/index.d.ts.map +1 -0
  120. package/dist/index.js +145 -0
  121. package/dist/index.js.map +1 -0
  122. package/dist/request-sample-to-request-template.d.ts +6 -0
  123. package/dist/request-sample-to-request-template.d.ts.map +1 -0
  124. package/dist/request-sample-to-request-template.js +35 -0
  125. package/dist/request-sample-to-request-template.js.map +1 -0
  126. package/dist/request-sampler.d.ts +15 -0
  127. package/dist/request-sampler.d.ts.map +1 -0
  128. package/dist/request-sampler.js +82 -0
  129. package/dist/request-sampler.js.map +1 -0
  130. package/dist/samples-structure/file-request-sample.d.ts +20 -0
  131. package/dist/samples-structure/file-request-sample.d.ts.map +1 -0
  132. package/dist/samples-structure/file-request-sample.js +5 -0
  133. package/dist/samples-structure/file-request-sample.js.map +1 -0
  134. package/dist/samples-structure/get-path-transaction-id.d.ts +3 -0
  135. package/dist/samples-structure/get-path-transaction-id.d.ts.map +1 -0
  136. package/dist/samples-structure/get-path-transaction-id.js +22 -0
  137. package/dist/samples-structure/get-path-transaction-id.js.map +1 -0
  138. package/dist/samples-structure/merge-tree.d.ts +5 -0
  139. package/dist/samples-structure/merge-tree.d.ts.map +1 -0
  140. package/dist/samples-structure/merge-tree.js +118 -0
  141. package/dist/samples-structure/merge-tree.js.map +1 -0
  142. package/dist/samples-structure/read-samples-from-dir.d.ts +13 -0
  143. package/dist/samples-structure/read-samples-from-dir.d.ts.map +1 -0
  144. package/dist/samples-structure/read-samples-from-dir.js +204 -0
  145. package/dist/samples-structure/read-samples-from-dir.js.map +1 -0
  146. package/dist/samples-structure/samples-from-transactions.d.ts +5 -0
  147. package/dist/samples-structure/samples-from-transactions.d.ts.map +1 -0
  148. package/dist/samples-structure/samples-from-transactions.js +120 -0
  149. package/dist/samples-structure/samples-from-transactions.js.map +1 -0
  150. package/dist/samples-structure/samples-tree-structure.d.ts +106 -0
  151. package/dist/samples-structure/samples-tree-structure.d.ts.map +1 -0
  152. package/dist/samples-structure/samples-tree-structure.js +26 -0
  153. package/dist/samples-structure/samples-tree-structure.js.map +1 -0
  154. package/dist/samples-structure/structure-meta-on-disc.d.ts +11 -0
  155. package/dist/samples-structure/structure-meta-on-disc.d.ts.map +1 -0
  156. package/dist/samples-structure/structure-meta-on-disc.js +2 -0
  157. package/dist/samples-structure/structure-meta-on-disc.js.map +1 -0
  158. package/dist/samples-structure/traverse.d.ts +4 -0
  159. package/dist/samples-structure/traverse.d.ts.map +1 -0
  160. package/dist/samples-structure/traverse.js +13 -0
  161. package/dist/samples-structure/traverse.js.map +1 -0
  162. package/dist/samples-structure/write-samples-to-dir.d.ts +25 -0
  163. package/dist/samples-structure/write-samples-to-dir.d.ts.map +1 -0
  164. package/dist/samples-structure/write-samples-to-dir.js +173 -0
  165. package/dist/samples-structure/write-samples-to-dir.js.map +1 -0
  166. package/dist/utils.d.ts +4 -0
  167. package/dist/utils.d.ts.map +1 -0
  168. package/dist/utils.js +26 -0
  169. package/dist/utils.js.map +1 -0
  170. package/package.json +70 -0
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ <!-- HEADER:START - Do not remove or modify this section -->
2
+ <div align="center">
3
+ <img src="https://raw.githubusercontent.com/thymianofficial/thymian/main/astro-docs/src/assets/logo.svg" alt="Thymian Logo" width="200"/>
4
+
5
+ # Thymian
6
+
7
+ **Add resilience and HTTP conformance to your API development workflow**
8
+
9
+ [![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL%203.0-green.svg)](https://github.com/thymianofficial/thymian/blob/main/LICENSE)
10
+ [![CI](https://github.com/thymianofficial/thymian/actions/workflows/ci.yaml/badge.svg)](https://github.com/thymianofficial/thymian/actions/workflows/ci.yaml)
11
+ [![Documentation](https://img.shields.io/badge/docs-thymian.dev-green.svg)](https://thymian.dev)
12
+ [![Discord](https://img.shields.io/discord/1440702693768429791?logo=discord&label=Discord&color=5865F2)](https://discord.gg/TRSwCxbz9f)
13
+ [![Reddit](https://img.shields.io/badge/Reddit-ThymianOfficial-FF4500?logo=reddit)](https://www.reddit.com/r/ThymianOfficial/)
14
+ [![Twitter](https://img.shields.io/badge/Twitter-@thymiandev-1DA1F2?logo=x)](https://x.com/thymiandev)
15
+
16
+ </div>
17
+ <!-- HEADER:END -->
18
+
19
+ ## @thymian/plugin-sampler
20
+
21
+ Generates example HTTP request and response payloads from API specifications. Used by the testing pipeline to create realistic sample data for endpoints that need to be exercised during conformance testing.
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ npm install @thymian/plugin-sampler
27
+ ```
28
+
29
+ > **Getting started with Thymian?** See the [main Thymian package](https://www.npmjs.com/package/thymian) for quick installation and first-run instructions.
30
+
31
+ <!-- FOOTER:START - Do not remove or modify this section -->
32
+
33
+ ## 📚 Documentation
34
+
35
+ - **[Getting Started](https://thymian.dev/introduction/getting-started)** - Set up Thymian in minutes
36
+ - **[Documentation](https://thymian.dev)** - Comprehensive guides and API reference
37
+ - **[CLI Reference](https://thymian.dev/references/cli)** - Complete CLI command documentation
38
+ - **[HTTP Rules](https://thymian.dev/guides/http-rules/how-to-use-rules)** - Learn about HTTP conformance validation
39
+
40
+ ## 🏢 Enterprise Support
41
+
42
+ Get professional consulting and dedicated support from the creators of Thymian. We offer:
43
+
44
+ - API design and governance strategies
45
+ - HTTP standards compliance auditing
46
+ - Custom plugin development
47
+ - Custom rule development
48
+ - Team training and workshops
49
+
50
+ **[Learn more about Enterprise Support](https://thymian.dev/enterprise)** | **Email: [support@thymian.dev](mailto:support@thymian.dev)**
51
+
52
+ ---
53
+
54
+ <div align="center">
55
+
56
+ **Shipped with 🌱 by [qupaya](https://qupaya.com)**
57
+
58
+ </div>
59
+ <!-- FOOTER:END -->
@@ -0,0 +1,16 @@
1
+ import { BaseCliRunCommand, oclif } from '@thymian/common-cli';
2
+ export default class Check extends BaseCliRunCommand<typeof Check> {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ incremental: oclif.Interfaces.BooleanFlag<boolean>;
7
+ "target-url": oclif.Interfaces.OptionFlag<string | undefined, oclif.Interfaces.CustomOptions>;
8
+ };
9
+ run(): Promise<void>;
10
+ private checkAllTransactions;
11
+ private checkTransactionsIncremental;
12
+ private isCheckableTransaction;
13
+ private runTransaction;
14
+ private logFailureDetails;
15
+ }
16
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +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;YA8BrB,oBAAoB;YAwDpB,4BAA4B;IAgE1C,OAAO,CAAC,sBAAsB;YAOhB,cAAc;IA2B5B,OAAO,CAAC,iBAAiB;CAmB1B"}
@@ -0,0 +1,135 @@
1
+ import { BaseCliRunCommand, oclif, prompts } from '@thymian/common-cli';
2
+ import { Flags } from '@thymian/common-cli/oclif';
3
+ import { filterHttpTransactions, generateRequests, httpTest, isValidClientErrorStatusCode, isValidSuccessfulStatusCode, mapToTestCase, runRequests, thymianHttpTransactionToString, } from '@thymian/core';
4
+ import { createContext } from '../../create-context.js';
5
+ export default class Check extends BaseCliRunCommand {
6
+ static description = 'Verify that all sampled transactions can be executed against the live API.';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ '<%= config.bin %> <%= command.id %> --target-url http://localhost:8080',
10
+ '<%= config.bin %> <%= command.id %> --incremental',
11
+ ];
12
+ static flags = {
13
+ incremental: Flags.boolean({
14
+ allowNo: true,
15
+ default: false,
16
+ description: 'Check transactions one by one and offer to generate hooks for failures.',
17
+ }),
18
+ ['target-url']: Flags.string({
19
+ 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
+ }),
21
+ };
22
+ async run() {
23
+ await this.thymian.run(async (emitter) => {
24
+ const specifications = this.thymianConfig.specifications ?? [];
25
+ const format = await this.thymian.loadFormat({
26
+ inputs: specifications,
27
+ });
28
+ const transactions = format.getThymianHttpTransactions();
29
+ const targetUrl = this.flags['target-url'] ?? this.thymianConfig.targetUrl;
30
+ const context = createContext(format, this.logger.child('sampler-check'), emitter);
31
+ if (this.flags.incremental) {
32
+ await this.checkTransactionsIncremental(transactions, context, targetUrl);
33
+ }
34
+ else {
35
+ await this.checkAllTransactions(transactions, context, targetUrl);
36
+ }
37
+ });
38
+ }
39
+ async checkAllTransactions(transactions, context, targetUrl) {
40
+ let successful = 0;
41
+ let failed = 0;
42
+ for (const transaction of transactions) {
43
+ if (!this.isCheckableTransaction(transaction)) {
44
+ continue;
45
+ }
46
+ const transactionName = thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes);
47
+ this.logger.debug('Checking transaction: ' + transactionName);
48
+ const testResult = await this.runTransaction(transaction, context, targetUrl);
49
+ const testCase = testResult.cases[0];
50
+ if (testCase && testCase.status === 'passed') {
51
+ this.log(oclif.ux.colorize('green', `✔ ${transactionName}`));
52
+ successful++;
53
+ }
54
+ else {
55
+ this.log(oclif.ux.colorize('red', `✖ ${transactionName}`));
56
+ this.logFailureDetails(testCase);
57
+ this.log();
58
+ failed++;
59
+ }
60
+ }
61
+ this.log();
62
+ if (failed > 0) {
63
+ this.log(`Checked ${successful + failed} transactions. ${oclif.ux.colorize('red', `${failed} failed`)}.`);
64
+ this.exit(1);
65
+ }
66
+ else {
67
+ this.log(oclif.ux.colorize('green', `Checked ${successful + failed} transactions. All passed.`));
68
+ }
69
+ }
70
+ async checkTransactionsIncremental(transactions, context, targetUrl) {
71
+ for (const transaction of transactions) {
72
+ if (!this.isCheckableTransaction(transaction)) {
73
+ continue;
74
+ }
75
+ const transactionName = thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes);
76
+ this.logger.debug('Checking transaction: ' + transactionName);
77
+ const testResult = await this.runTransaction(transaction, context, targetUrl);
78
+ const testCase = testResult.cases[0];
79
+ if (testCase && testCase.status === 'passed') {
80
+ this.log(oclif.ux.colorize('green', `✔ ${transactionName}`));
81
+ continue;
82
+ }
83
+ this.log(oclif.ux.colorize('red', `✖ ${transactionName}`));
84
+ this.logFailureDetails(testCase);
85
+ this.log();
86
+ this.log('You can generate a hook for this transaction with:');
87
+ this.log(` $ thymian sampler generate hook --for-transaction ${transaction.transactionId}`);
88
+ this.log();
89
+ if (!this.config.findCommand('sampler generate hook')) {
90
+ this.debug('Command sampler generate hook is not available. Skipping hook generation prompt.');
91
+ continue;
92
+ }
93
+ const answer = await prompts.confirm({
94
+ message: 'Do you want to generate a hook to fix this transaction?',
95
+ default: false,
96
+ });
97
+ if (answer) {
98
+ await this.config.runCommand('sampler generate hook', [
99
+ '--for-transaction',
100
+ transaction.transactionId,
101
+ '--cwd',
102
+ this.flags.cwd,
103
+ ...(this.flags.config ? ['-c', this.flags.config] : []),
104
+ ]);
105
+ }
106
+ }
107
+ }
108
+ isCheckableTransaction(transaction) {
109
+ return (isValidSuccessfulStatusCode(transaction.thymianRes.statusCode) ||
110
+ isValidClientErrorStatusCode(transaction.thymianRes.statusCode));
111
+ }
112
+ async runTransaction(transaction, context, targetUrl) {
113
+ const transactionName = thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes);
114
+ const reqFilter = (_req, reqId) => reqId === transaction.thymianReqId;
115
+ const resFilter = (_res, resId) => resId === transaction.thymianResId;
116
+ const test = httpTest(transactionName, (transactions) => transactions.pipe(filterHttpTransactions(reqFilter, resFilter), mapToTestCase(), generateRequests(), runRequests({ checkResponse: false, origin: targetUrl })));
117
+ return test(context);
118
+ }
119
+ logFailureDetails(testCase) {
120
+ if (!testCase) {
121
+ this.log(oclif.ux.colorize('dim', ' Reason: No test result.'));
122
+ return;
123
+ }
124
+ if (testCase.reason) {
125
+ this.log(oclif.ux.colorize('dim', ` Reason: ${testCase.reason}`));
126
+ }
127
+ for (const result of testCase.results) {
128
+ if (result.type === 'assertion-failure' ||
129
+ result.type === 'invalid-transaction') {
130
+ this.log(oclif.ux.colorize('dim', ` ${result.message}`));
131
+ }
132
+ }
133
+ }
134
+ }
135
+ //# sourceMappingURL=check.js.map
@@ -0,0 +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,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,QA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C,CAAC;gBACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;IACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { BaseCliRunCommand } from '@thymian/common-cli';
2
+ export default class GenerateHook extends BaseCliRunCommand<typeof GenerateHook> {
3
+ static aliases: string[];
4
+ static flags: {
5
+ 'for-transaction': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ };
7
+ run(): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/sampler/generate/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAKxD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,iBAAiB,CACzD,OAAO,YAAY,CACpB;IACC,OAAgB,OAAO,WAAyC;IAEhE,OAAgB,KAAK;;MAKnB;IAEa,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAWpC"}
@@ -0,0 +1,18 @@
1
+ import { BaseCliRunCommand } from '@thymian/common-cli';
2
+ import { Flags } from '@thymian/common-cli/oclif';
3
+ import { generateHook } from '../../../generate-hook.js';
4
+ export default class GenerateHook extends BaseCliRunCommand {
5
+ static aliases = ['sampler g h', 'sampler generate h'];
6
+ static flags = {
7
+ 'for-transaction': Flags.string({
8
+ description: 'For which transaction do you want to generate a hook?',
9
+ required: false,
10
+ }),
11
+ };
12
+ async run() {
13
+ await this.thymian.run(async (emitter) => {
14
+ await generateHook(this.thymian, emitter, this, this.flags.cwd, this.flags['for-transaction']);
15
+ });
16
+ }
17
+ }
18
+ //# sourceMappingURL=hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.js","sourceRoot":"","sources":["../../../../../src/cli/commands/sampler/generate/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,iBAEzC;IACC,MAAM,CAAU,OAAO,GAAG,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;IAEhE,MAAM,CAAU,KAAK,GAAG;QACtB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC;YAC9B,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH,CAAC;IAEO,KAAK,CAAC,GAAG;QAChB,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACvC,MAAM,YAAY,CAChB,IAAI,CAAC,OAAO,EACZ,OAAO,EACP,IAAI,EACJ,IAAI,CAAC,KAAK,CAAC,GAAG,EACd,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAC9B,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { BaseCliRunCommand, oclif } from '@thymian/common-cli';
2
+ export default class Init extends BaseCliRunCommand<typeof Init> {
3
+ static flags: {
4
+ overwrite: oclif.Interfaces.BooleanFlag<boolean>;
5
+ check: oclif.Interfaces.BooleanFlag<boolean>;
6
+ };
7
+ run(): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +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,KAAK;;;MAYnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyD3B"}
@@ -0,0 +1,55 @@
1
+ import { BaseCliRunCommand, oclif, prompts } from '@thymian/common-cli';
2
+ export default class Init extends BaseCliRunCommand {
3
+ static flags = {
4
+ overwrite: oclif.Flags.boolean({
5
+ default: false,
6
+ description: 'Overwrite existing samples.',
7
+ }),
8
+ check: oclif.Flags.boolean({
9
+ description: 'After initialization, run sampler check to verify all transactions can be executed.',
10
+ allowNo: true,
11
+ default: false,
12
+ }),
13
+ };
14
+ async run() {
15
+ await this.thymian.run(async (emitter) => {
16
+ if (!this.thymian.plugins.find((p) => p.plugin.name === '@thymian/plugin-sampler')) {
17
+ this.error('Cannot initialize sampler if sampler plugin is not registered.', {
18
+ exit: 1,
19
+ });
20
+ }
21
+ const format = await this.thymian.loadFormat({ inputs: this.thymianConfig.specifications ?? [] }, {
22
+ emitFormat: true,
23
+ });
24
+ await emitter.emitAction('sampler.init', {
25
+ format: format.export(),
26
+ overwrite: this.flags.overwrite,
27
+ });
28
+ });
29
+ this.log(oclif.ux.colorize('green', 'Sampler initialized.'));
30
+ if (this.flags.check) {
31
+ if (this.config.findCommand('sampler check')) {
32
+ this.log();
33
+ const answer = await prompts.confirm({
34
+ message: 'Do you want to run this check now?',
35
+ });
36
+ if (answer) {
37
+ this.log();
38
+ const args = ['--cwd', this.flags.cwd];
39
+ if (this.flags.config) {
40
+ args.push('-c', this.flags.config);
41
+ }
42
+ await this.config.runCommand('sampler check', args);
43
+ }
44
+ }
45
+ }
46
+ else {
47
+ this.log();
48
+ this.log('To check if every transaction can be executed, run:');
49
+ this.log();
50
+ this.log('$ thymian sampler check');
51
+ this.log();
52
+ }
53
+ }
54
+ }
55
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/cli/commands/sampler/init.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AAE,sBAAsB,CAAC,CAAC,CAAC;QAE7D,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACrB,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC;gBAC7C,IAAI,CAAC,GAAG,EAAE,CAAC;gBACX,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC;oBACnC,OAAO,EAAE,oCAAoC;iBAC9C,CAAC,CAAC;gBAEH,IAAI,MAAM,EAAE,CAAC;oBACX,IAAI,CAAC,GAAG,EAAE,CAAC;oBAEX,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAEvC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;wBACtB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;oBACrC,CAAC;oBAED,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;gBACtD,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,EAAE,CAAC;YACX,IAAI,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;YAChE,IAAI,CAAC,GAAG,EAAE,CAAC;YACX,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;YACpC,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,CAAC;IACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Logger, ThymianEmitter, ThymianFormat } from '@thymian/core';
2
+ export declare function createContext(format: ThymianFormat, logger: Logger, emitter: ThymianEmitter): import("@thymian/core").HttpTestContext<{}>;
3
+ //# sourceMappingURL=create-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-context.d.ts","sourceRoot":"","sources":["../../src/cli/create-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,MAAM,EACX,cAAc,EACd,aAAa,EAEd,MAAM,eAAe,CAAC;AAMvB,wBAAgB,aAAa,CAC3B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,+CA4BxB"}
@@ -0,0 +1,21 @@
1
+ import { ThymianEmitter, ThymianFormat, } from '@thymian/core';
2
+ import { createHttpTestContext, createHttpTestHookRunnerFromThymianEmitter, } from '@thymian/core';
3
+ export function createContext(format, logger, emitter) {
4
+ return createHttpTestContext({
5
+ format,
6
+ logger,
7
+ locals: {},
8
+ sampleRequest: async function (transaction) {
9
+ return await emitter.emitAction('core.request.sample', { transaction }, { strategy: 'first' });
10
+ },
11
+ runRequest: async function (request) {
12
+ return await emitter.emitAction('core.request.dispatch', {
13
+ request,
14
+ }, {
15
+ strategy: 'first',
16
+ });
17
+ },
18
+ runHook: createHttpTestHookRunnerFromThymianEmitter(emitter),
19
+ });
20
+ }
21
+ //# sourceMappingURL=create-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-context.js","sourceRoot":"","sources":["../../src/cli/create-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,cAAc,EACd,aAAa,GAEd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,qBAAqB,EACrB,0CAA0C,GAC3C,MAAM,eAAe,CAAC;AAEvB,MAAM,UAAU,aAAa,CAC3B,MAAqB,EACrB,MAAc,EACd,OAAuB;IAEvB,OAAO,qBAAqB,CAAC;QAC3B,MAAM;QACN,MAAM;QACN,MAAM,EAAE,EAAE;QACV,aAAa,EAAE,KAAK,WAClB,WAAmC;YAEnC,OAAO,MAAM,OAAO,CAAC,UAAU,CAC7B,qBAAqB,EACrB,EAAE,WAAW,EAAE,EACf,EAAE,QAAQ,EAAE,OAAO,EAAE,CACtB,CAAC;QACJ,CAAC;QACD,UAAU,EAAE,KAAK,WAAW,OAAoB;YAC9C,OAAO,MAAM,OAAO,CAAC,UAAU,CAC7B,uBAAuB,EACvB;gBACE,OAAO;aACR,EACD;gBACE,QAAQ,EAAE,OAAO;aAClB,CACF,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,0CAA0C,CAAC,OAAO,CAAC;KAC7D,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BaseCliRunCommand, oclif } from '@thymian/common-cli';
2
+ import { type Thymian, type ThymianEmitter, type ThymianFormat } from '@thymian/core';
3
+ export declare function generateHook<T extends typeof oclif.Command = typeof oclif.Command>(thymian: Thymian, emitter: ThymianEmitter, command: BaseCliRunCommand<T>, cwd: string, forTransaction?: string, loadedThymianFormat?: ThymianFormat): Promise<void>;
4
+ //# sourceMappingURL=generate-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-hook.d.ts","sourceRoot":"","sources":["../../src/cli/generate-hook.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAW,MAAM,qBAAqB,CAAC;AACxE,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,cAAc,EACnB,KAAK,aAAa,EAGnB,MAAM,eAAe,CAAC;AASvB,wBAAsB,YAAY,CAChC,CAAC,SAAS,OAAO,KAAK,CAAC,OAAO,GAAG,OAAO,KAAK,CAAC,OAAO,EAErD,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC7B,GAAG,EAAE,MAAM,EACX,cAAc,CAAC,EAAE,MAAM,EACvB,mBAAmB,CAAC,EAAE,aAAa,GAClC,OAAO,CAAC,IAAI,CAAC,CAiHf"}
@@ -0,0 +1,92 @@
1
+ import { writeFile } from 'node:fs/promises';
2
+ import { format, join, relative } from 'node:path';
3
+ import { BaseCliRunCommand, oclif, prompts } from '@thymian/common-cli';
4
+ import { ThymianBaseError, thymianHttpTransactionToString, } from '@thymian/core';
5
+ import launchEditor from 'launch-editor';
6
+ import { afterEachRequestHook, authorizeHook, beforeEachRequestHook, } from './templates.js';
7
+ export async function generateHook(thymian, emitter, command, cwd, forTransaction, loadedThymianFormat) {
8
+ const thymianFormat = loadedThymianFormat ?? (await thymian.loadFormat({ inputs: [] }));
9
+ const titleToTransaction = new Map();
10
+ for (const t of thymianFormat.getThymianHttpTransactions()) {
11
+ titleToTransaction.set(thymianHttpTransactionToString(t.thymianReq, t.thymianRes), t);
12
+ }
13
+ const transactions = [...titleToTransaction.keys()].map((title) => ({
14
+ name: title,
15
+ value: title,
16
+ }));
17
+ let transaction;
18
+ if (!forTransaction) {
19
+ const result = await prompts.search({
20
+ message: 'For which transaction do you want to generate a hook?',
21
+ source: (answersSoFar) => {
22
+ if (typeof answersSoFar === 'undefined') {
23
+ return transactions;
24
+ }
25
+ return transactions.filter((t) => t.value.toLowerCase().includes(answersSoFar.toLowerCase()));
26
+ },
27
+ });
28
+ transaction = titleToTransaction.get(result);
29
+ }
30
+ else {
31
+ transaction = thymianFormat.getThymianHttpTransactionById(forTransaction);
32
+ }
33
+ if (!transaction) {
34
+ throw new ThymianBaseError('Invalid transaction selected.', {
35
+ name: 'InvalidTransactionError',
36
+ ref: 'https://thymian.dev/references/errors/invalid-transaction-error/',
37
+ });
38
+ }
39
+ const path = await emitter.emitAction('sampler.path-from-transaction', {
40
+ transactionId: transaction.transactionId,
41
+ }, {
42
+ strategy: 'first',
43
+ });
44
+ if (path) {
45
+ const relativePath = relative(cwd, path);
46
+ const answer = await prompts.confirm({
47
+ message: `Do you want to generate a hook file at ${oclif.ux.colorize('bold', oclif.ux.colorize('underline', relativePath))}?`,
48
+ default: true,
49
+ });
50
+ if (answer) {
51
+ const choice = await prompts.select({
52
+ message: 'When do you want to execute the hook?',
53
+ choices: ['Before each request', 'After each response', 'Authorize'],
54
+ });
55
+ const fileName = Math.random().toString(36).slice(2, 7);
56
+ const dir = join(path, '..');
57
+ const suffix = choice === 'After each response'
58
+ ? 'afterEach'
59
+ : choice === 'Before each request'
60
+ ? 'beforeEach'
61
+ : 'authorize';
62
+ const fullFilePath = format({
63
+ dir,
64
+ name: `${fileName}.${suffix}`,
65
+ ext: '.ts',
66
+ });
67
+ if (choice === 'After each response') {
68
+ await writeFile(fullFilePath, afterEachRequestHook);
69
+ }
70
+ else if (choice === 'Authorize') {
71
+ await writeFile(fullFilePath, authorizeHook);
72
+ }
73
+ else {
74
+ await writeFile(fullFilePath, beforeEachRequestHook);
75
+ }
76
+ command.log(oclif.ux.colorize('green', 'Hook generated successfully!'));
77
+ const openInEditor = await prompts.confirm({
78
+ message: `Do you want to open the file in your editor now?`,
79
+ default: true,
80
+ });
81
+ if (openInEditor) {
82
+ launchEditor(fullFilePath, 'webstorm', (_, errorMessage) => {
83
+ if (errorMessage) {
84
+ command.error(errorMessage);
85
+ }
86
+ command.log('Opening file in editor.');
87
+ });
88
+ }
89
+ }
90
+ }
91
+ }
92
+ //# sourceMappingURL=generate-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-hook.js","sourceRoot":"","sources":["../../src/cli/generate-hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAEL,gBAAgB,EAIhB,8BAA8B,GAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,KAAK,UAAU,YAAY,CAGhC,OAAgB,EAChB,OAAuB,EACvB,OAA6B,EAC7B,GAAW,EACX,cAAuB,EACvB,mBAAmC;IAEnC,MAAM,aAAa,GACjB,mBAAmB,IAAI,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,E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KAAK;aACX,CAAC,CAAC;YAEH,IAAI,MAAM,KAAK,qBAAqB,EAAE,CAAC;gBACrC,MAAM,SAAS,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;YACtD,CAAC;iBAAM,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;gBAClC,MAAM,SAAS,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACN,MAAM,SAAS,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAAC;YACvD,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC,CAAC;YAExE,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC;gBACzC,OAAO,EAAE,kDAAkD;gBAC3D,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YAEH,IAAI,YAAY,EAAE,CAAC;gBACjB,YAAY,CAAC,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE;oBACzD,IAAI,YAAY,EAAE,CAAC;wBACjB,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;oBAC9B,CAAC;oBAED,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;gBACzC,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const beforeEachRequestHook = "import * as Hooks from '@thymian/hooks';\n\nconst hook: Hooks.BeforeEachRequestHook = async (request, context, utils) => {\n\n return request;\n}\n\nexport default hook;\n";
2
+ export declare const afterEachRequestHook = "import * as Hooks from '@thymian/hooks';\n\nconst hook: Hooks.AfterEachRequestHook = async (response, context, utils) => {\n\n return response;\n}\n\nexport default hook;\n";
3
+ export declare const authorizeHook = "import * as Hooks from '@thymian/hooks';\n\nconst hook: Hooks.AuthorizeHook = async (request, context, utils) => {\n\n return request;\n}\n\nexport default hook;\n";
4
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/cli/templates.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,iLAQjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,kLAQhC,CAAC;AAEF,eAAO,MAAM,aAAa,yKAQzB,CAAC"}
@@ -0,0 +1,28 @@
1
+ export const beforeEachRequestHook = `import * as Hooks from '@thymian/hooks';
2
+
3
+ const hook: Hooks.BeforeEachRequestHook = async (request, context, utils) => {
4
+
5
+ return request;
6
+ }
7
+
8
+ export default hook;
9
+ `;
10
+ export const afterEachRequestHook = `import * as Hooks from '@thymian/hooks';
11
+
12
+ const hook: Hooks.AfterEachRequestHook = async (response, context, utils) => {
13
+
14
+ return response;
15
+ }
16
+
17
+ export default hook;
18
+ `;
19
+ export const authorizeHook = `import * as Hooks from '@thymian/hooks';
20
+
21
+ const hook: Hooks.AuthorizeHook = async (request, context, utils) => {
22
+
23
+ return request;
24
+ }
25
+
26
+ export default hook;
27
+ `;
28
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/cli/templates.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;CAQpC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;CAQnC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;CAQ5B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const SAMPLE_FILE: RegExp;
2
+ export declare const BEFORE_EACH_HOOK: RegExp;
3
+ export declare const AFTER_EACH_HOOK: RegExp;
4
+ export declare const AUTHORIZE_HOOK: RegExp;
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAoB,CAAC;AAC7C,eAAO,MAAM,gBAAgB,QAA+C,CAAC;AAC7E,eAAO,MAAM,eAAe,QAA8C,CAAC;AAC3E,eAAO,MAAM,cAAc,QAA8C,CAAC"}
@@ -0,0 +1,5 @@
1
+ export const SAMPLE_FILE = /.*request\.json/;
2
+ export const BEFORE_EACH_HOOK = /(.*\.)?beforeEach\.(ts|js|mjs|cjs|mts|cts)/;
3
+ export const AFTER_EACH_HOOK = /(.*\.)?afterEach\.(ts|js|mjs|cjs|mts|cts)/;
4
+ export const AUTHORIZE_HOOK = /(.*\.)?authorize\.(ts|js|mjs|cjs|mts|cts)/;
5
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,4CAA4C,CAAC;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,2CAA2C,CAAC;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,2CAA2C,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ThymianSchema } from '@thymian/core';
2
+ import type { ContentSource } from '../http-request-sample.js';
3
+ import type { ContentTypeStrategy } from './content-type-strategies/content-type-strategy.js';
4
+ export declare class ContentSourceGenerator {
5
+ private readonly strategies;
6
+ private readonly fallbackStrategy;
7
+ constructor(strategies: ContentTypeStrategy[], fallbackStrategy?: ContentTypeStrategy);
8
+ generate(contentType: string, schema: ThymianSchema): Promise<ContentSource>;
9
+ }
10
+ //# sourceMappingURL=content-source-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-source-generator.d.ts","sourceRoot":"","sources":["../../src/generation/content-source-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAG9F,qBAAa,sBAAsB;IAE/B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,UAAU,EAAE,mBAAmB,EAAE,EACjC,gBAAgB,GAAE,mBAAoD;IAGzF,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;CAO7E"}
@@ -0,0 +1,15 @@
1
+ import { ErrorContentTypeStrategy } from './content-type-strategies/error.content-type-strategy.js';
2
+ export class ContentSourceGenerator {
3
+ strategies;
4
+ fallbackStrategy;
5
+ constructor(strategies, fallbackStrategy = new ErrorContentTypeStrategy()) {
6
+ this.strategies = strategies;
7
+ this.fallbackStrategy = fallbackStrategy;
8
+ }
9
+ generate(contentType, schema) {
10
+ const strategy = this.strategies.find((strategy) => strategy.matches(contentType)) ??
11
+ this.fallbackStrategy;
12
+ return strategy.generate(schema, contentType);
13
+ }
14
+ }
15
+ //# sourceMappingURL=content-source-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-source-generator.js","sourceRoot":"","sources":["../../src/generation/content-source-generator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AAEpG,MAAM,OAAO,sBAAsB;IAEd;IACA;IAFnB,YACmB,UAAiC,EACjC,mBAAwC,IAAI,wBAAwB,EAAE;QADtE,eAAU,GAAV,UAAU,CAAuB;QACjC,qBAAgB,GAAhB,gBAAgB,CAAsD;IACtF,CAAC;IAEJ,QAAQ,CAAC,WAAmB,EAAE,MAAqB;QACjD,MAAM,QAAQ,GACZ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACjE,IAAI,CAAC,gBAAgB,CAAC;QAExB,OAAO,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import type { ThymianSchema } from '@thymian/core';
2
+ import type { ContentSource } from '../../http-request-sample.js';
3
+ export interface ContentTypeStrategy {
4
+ matches(contentType: string): boolean;
5
+ generate(schema: ThymianSchema, contentType: string): Promise<ContentSource>;
6
+ }
7
+ //# sourceMappingURL=content-type-strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-type-strategy.d.ts","sourceRoot":"","sources":["../../../src/generation/content-type-strategies/content-type-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtC,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC9E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=content-type-strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-type-strategy.js","sourceRoot":"","sources":["../../../src/generation/content-type-strategies/content-type-strategy.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { type ThymianSchema } from '@thymian/core';
2
+ import type { ContentTypeStrategy } from './content-type-strategy.js';
3
+ export declare class ErrorContentTypeStrategy implements ContentTypeStrategy {
4
+ matches(): boolean;
5
+ generate(schema: ThymianSchema, contentType: string): never;
6
+ }
7
+ //# sourceMappingURL=error.content-type-strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.content-type-strategy.d.ts","sourceRoot":"","sources":["../../../src/generation/content-type-strategies/error.content-type-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,qBAAa,wBAAyB,YAAW,mBAAmB;IAClE,OAAO,IAAI,OAAO;IAIlB,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,GAAG,KAAK;CAS5D"}