@thymian/plugin-sampler 0.1.2-canary.20260410-043042b → 0.1.2
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.
- package/dist/cli/commands/sampler/check.d.ts +1 -1
- package/dist/cli/commands/sampler/check.d.ts.map +1 -1
- package/dist/cli/commands/sampler/check.js +33 -56
- package/dist/cli/commands/sampler/check.js.map +1 -1
- package/dist/cli/commands/sampler/generate/hook.js +1 -1
- package/dist/hooks/hook-runner.js +3 -3
- package/dist/index.js +1 -1
- package/dist/request-sampler.js +1 -1
- package/package.json +5 -5
|
@@ -10,7 +10,7 @@ export default class Check extends BaseCliRunCommand<typeof Check> {
|
|
|
10
10
|
private checkAllTransactions;
|
|
11
11
|
private checkTransactionsIncremental;
|
|
12
12
|
private isCheckableTransaction;
|
|
13
|
-
private
|
|
13
|
+
private runTransaction;
|
|
14
14
|
private logFailureDetails;
|
|
15
15
|
}
|
|
16
16
|
//# 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;
|
|
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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseCliRunCommand, oclif, prompts } from '@thymian/common-cli';
|
|
2
2
|
import { Flags } from '@thymian/common-cli/oclif';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { filterHttpTransactions, generateRequests, httpTest, isValidClientErrorStatusCode, isValidSuccessfulStatusCode, mapToTestCase, runRequests, thymianHttpTransactionToString, } from '@thymian/core';
|
|
4
|
+
import { createContext } from '../../create-context.js';
|
|
5
5
|
export default class Check extends BaseCliRunCommand {
|
|
6
6
|
static description = 'Verify that all sampled transactions can be executed against the live API.';
|
|
7
7
|
static examples = [
|
|
@@ -20,22 +20,23 @@ export default class Check extends BaseCliRunCommand {
|
|
|
20
20
|
}),
|
|
21
21
|
};
|
|
22
22
|
async run() {
|
|
23
|
-
await this.thymian.run(async () => {
|
|
23
|
+
await this.thymian.run(async (emitter) => {
|
|
24
24
|
const specifications = this.thymianConfig.specifications ?? [];
|
|
25
25
|
const format = await this.thymian.loadFormat({
|
|
26
26
|
inputs: specifications,
|
|
27
27
|
});
|
|
28
28
|
const transactions = format.getThymianHttpTransactions();
|
|
29
29
|
const targetUrl = this.flags['target-url'] ?? this.thymianConfig.targetUrl;
|
|
30
|
+
const context = createContext(format, this.logger.child('sampler-check'), emitter);
|
|
30
31
|
if (this.flags.incremental) {
|
|
31
|
-
await this.checkTransactionsIncremental(transactions, targetUrl);
|
|
32
|
+
await this.checkTransactionsIncremental(transactions, context, targetUrl);
|
|
32
33
|
}
|
|
33
34
|
else {
|
|
34
|
-
await this.checkAllTransactions(transactions, targetUrl);
|
|
35
|
+
await this.checkAllTransactions(transactions, context, targetUrl);
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
|
-
async checkAllTransactions(transactions, targetUrl) {
|
|
39
|
+
async checkAllTransactions(transactions, context, targetUrl) {
|
|
39
40
|
let successful = 0;
|
|
40
41
|
let failed = 0;
|
|
41
42
|
for (const transaction of transactions) {
|
|
@@ -44,14 +45,15 @@ export default class Check extends BaseCliRunCommand {
|
|
|
44
45
|
}
|
|
45
46
|
const transactionName = thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes);
|
|
46
47
|
this.logger.debug('Checking transaction: ' + transactionName);
|
|
47
|
-
const
|
|
48
|
-
|
|
48
|
+
const testResult = await this.runTransaction(transaction, context, targetUrl);
|
|
49
|
+
const testCase = testResult.cases[0];
|
|
50
|
+
if (testCase && testCase.status === 'passed') {
|
|
49
51
|
this.log(oclif.ux.colorize('green', `✔ ${transactionName}`));
|
|
50
52
|
successful++;
|
|
51
53
|
}
|
|
52
54
|
else {
|
|
53
55
|
this.log(oclif.ux.colorize('red', `✖ ${transactionName}`));
|
|
54
|
-
this.logFailureDetails(
|
|
56
|
+
this.logFailureDetails(testCase);
|
|
55
57
|
this.log();
|
|
56
58
|
failed++;
|
|
57
59
|
}
|
|
@@ -65,20 +67,21 @@ export default class Check extends BaseCliRunCommand {
|
|
|
65
67
|
this.log(oclif.ux.colorize('green', `Checked ${successful + failed} transactions. All passed.`));
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
|
-
async checkTransactionsIncremental(transactions, targetUrl) {
|
|
70
|
+
async checkTransactionsIncremental(transactions, context, targetUrl) {
|
|
69
71
|
for (const transaction of transactions) {
|
|
70
72
|
if (!this.isCheckableTransaction(transaction)) {
|
|
71
73
|
continue;
|
|
72
74
|
}
|
|
73
75
|
const transactionName = thymianHttpTransactionToString(transaction.thymianReq, transaction.thymianRes);
|
|
74
76
|
this.logger.debug('Checking transaction: ' + transactionName);
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
+
const testResult = await this.runTransaction(transaction, context, targetUrl);
|
|
78
|
+
const testCase = testResult.cases[0];
|
|
79
|
+
if (testCase && testCase.status === 'passed') {
|
|
77
80
|
this.log(oclif.ux.colorize('green', `✔ ${transactionName}`));
|
|
78
81
|
continue;
|
|
79
82
|
}
|
|
80
83
|
this.log(oclif.ux.colorize('red', `✖ ${transactionName}`));
|
|
81
|
-
this.logFailureDetails(
|
|
84
|
+
this.logFailureDetails(testCase);
|
|
82
85
|
this.log();
|
|
83
86
|
this.log('You can generate a hook for this transaction with:');
|
|
84
87
|
this.log(` $ thymian sampler generate hook --for-transaction ${transaction.transactionId}`);
|
|
@@ -106,52 +109,26 @@ export default class Check extends BaseCliRunCommand {
|
|
|
106
109
|
return (isValidSuccessfulStatusCode(transaction.thymianRes.statusCode) ||
|
|
107
110
|
isValidClientErrorStatusCode(transaction.thymianRes.statusCode));
|
|
108
111
|
}
|
|
109
|
-
async
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
116
|
-
if (targetUrl) {
|
|
117
|
-
request.origin = targetUrl;
|
|
118
|
-
}
|
|
119
|
-
const response = await this.thymian.dispatch({ request });
|
|
120
|
-
if (response.statusCode !== transaction.thymianRes.statusCode) {
|
|
121
|
-
return {
|
|
122
|
-
passed: false,
|
|
123
|
-
reason: `Expected status ${transaction.thymianRes.statusCode}, got ${response.statusCode}.`,
|
|
124
|
-
response,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
return { passed: true };
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
return {
|
|
131
|
-
passed: false,
|
|
132
|
-
reason: error instanceof Error ? error.message : String(error),
|
|
133
|
-
};
|
|
134
|
-
}
|
|
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);
|
|
135
118
|
}
|
|
136
|
-
logFailureDetails(
|
|
137
|
-
|
|
138
|
-
|
|
119
|
+
logFailureDetails(testCase) {
|
|
120
|
+
if (!testCase) {
|
|
121
|
+
this.log(oclif.ux.colorize('dim', ' Reason: No test result.'));
|
|
139
122
|
return;
|
|
140
123
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.log(oclif.ux.colorize('dim', ` Received: ${statusCode} ${phrase}${contentTypeStr ? ` (${contentTypeStr})` : ''}`));
|
|
150
|
-
if (body) {
|
|
151
|
-
const preview = body.length > MAX_BODY_PREVIEW_LENGTH
|
|
152
|
-
? body.slice(0, MAX_BODY_PREVIEW_LENGTH) + '…'
|
|
153
|
-
: body;
|
|
154
|
-
this.log(oclif.ux.colorize('dim', ` Body: ${preview}`));
|
|
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
|
+
}
|
|
155
132
|
}
|
|
156
133
|
}
|
|
157
134
|
}
|
|
@@ -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,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../src/cli/commands/sampler/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,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,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtC,IACE,MAAM,CAAC,IAAI,KAAK,mBAAmB;gBACnC,MAAM,CAAC,IAAI,KAAK,qBAAqB,EACrC,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"}
|
|
@@ -2,7 +2,7 @@ import { BaseCliRunCommand } from '@thymian/common-cli';
|
|
|
2
2
|
import { Flags } from '@thymian/common-cli/oclif';
|
|
3
3
|
import { generateHook } from '../../../generate-hook.js';
|
|
4
4
|
export default class GenerateHook extends BaseCliRunCommand {
|
|
5
|
-
static aliases = ['sampler
|
|
5
|
+
static aliases = ['sampler g h', 'sampler generate h'];
|
|
6
6
|
static flags = {
|
|
7
7
|
'for-transaction': Flags.string({
|
|
8
8
|
description: 'For which transaction do you want to generate a hook?',
|
|
@@ -37,7 +37,7 @@ export class HookRunner {
|
|
|
37
37
|
if (!this.initialized) {
|
|
38
38
|
throw new ThymianBaseError('Cannot run hooks before @thymian/plugin-sampler is initialized.', {
|
|
39
39
|
name: 'HookRunnerNotInitialized',
|
|
40
|
-
suggestions: ['Did you run "thymian sampler
|
|
40
|
+
suggestions: ['Did you run "thymian sampler init"?'],
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
const { value, ctx } = hook;
|
|
@@ -81,7 +81,7 @@ export class HookRunner {
|
|
|
81
81
|
if (!this.initialized) {
|
|
82
82
|
throw new ThymianBaseError('Cannot run hooks before @thymian/plugin-sampler is initialized.', {
|
|
83
83
|
name: 'HookRunnerNotInitialized',
|
|
84
|
-
suggestions: ['Did you run "thymian sampler
|
|
84
|
+
suggestions: ['Did you run "thymian sampler init"?'],
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
const { value, ctx } = hook;
|
|
@@ -128,7 +128,7 @@ export class HookRunner {
|
|
|
128
128
|
if (!this.initialized) {
|
|
129
129
|
throw new ThymianBaseError('Cannot run hooks before @thymian/plugin-sampler is initialized.', {
|
|
130
130
|
name: 'HookRunnerNotInitialized',
|
|
131
|
-
suggestions: ['Did you run "thymian sampler
|
|
131
|
+
suggestions: ['Did you run "thymian sampler init"?'],
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
const { value, ctx } = hook;
|
package/dist/index.js
CHANGED
|
@@ -118,7 +118,7 @@ export const samplePlugin = {
|
|
|
118
118
|
name: 'VersionMismatchError',
|
|
119
119
|
suggestions: [
|
|
120
120
|
`The loaded samples were generated at ${requestSampler.timestamp()}. Did you forget to regenerate the samples?`,
|
|
121
|
-
'$ thymian sampler
|
|
121
|
+
'$ thymian sampler init',
|
|
122
122
|
],
|
|
123
123
|
ref: 'https://thymian.dev/guides/samples/update-samples',
|
|
124
124
|
});
|
package/dist/request-sampler.js
CHANGED
|
@@ -55,7 +55,7 @@ export class RequestSampler {
|
|
|
55
55
|
sampleForTransaction(transactionId) {
|
|
56
56
|
if (!this.initialized) {
|
|
57
57
|
throw new ThymianBaseError('Cannot sample for transaction before @thymian/plugin-sampler was initialized.', {
|
|
58
|
-
suggestions: ['Did you run "thymian sampler
|
|
58
|
+
suggestions: ['Did you run "thymian sampler init"?'],
|
|
59
59
|
name: 'SamplerNotInitializedError',
|
|
60
60
|
});
|
|
61
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thymian/plugin-sampler",
|
|
3
|
-
"version": "0.1.2
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/thymianofficial/thymian/issues"
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"!**/*.tsbuildinfo"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@thymian/common-cli": "0.1.2
|
|
35
|
-
"@thymian/core": "0.1.2
|
|
36
|
-
"@thymian/plugin-request-dispatcher": "0.1.2
|
|
34
|
+
"@thymian/common-cli": "0.1.2",
|
|
35
|
+
"@thymian/core": "0.1.2",
|
|
36
|
+
"@thymian/plugin-request-dispatcher": "0.1.2",
|
|
37
37
|
"code-block-writer": "^13.0.3",
|
|
38
38
|
"jiti": "^2.6.1",
|
|
39
39
|
"json-schema-to-typescript": "^15.0.4",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@thymian/core-testing": "0.1.2
|
|
56
|
+
"@thymian/core-testing": "0.1.2",
|
|
57
57
|
"fast-json-stable-stringify": "^2.1.0",
|
|
58
58
|
"ts-morph": "^27.0.2"
|
|
59
59
|
}
|