@thymian/plugin-sampler 0.1.0
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/README.md +11 -0
- package/dist/cli/commands/sampler/hooks/generate.d.ts +9 -0
- package/dist/cli/commands/sampler/hooks/generate.d.ts.map +1 -0
- package/dist/cli/commands/sampler/hooks/generate.js +18 -0
- package/dist/cli/commands/sampler/hooks/generate.js.map +1 -0
- package/dist/cli/commands/sampler/init.d.ts +9 -0
- package/dist/cli/commands/sampler/init.d.ts.map +1 -0
- package/dist/cli/commands/sampler/init.js +55 -0
- package/dist/cli/commands/sampler/init.js.map +1 -0
- package/dist/cli/create-context.d.ts +3 -0
- package/dist/cli/create-context.d.ts.map +1 -0
- package/dist/cli/create-context.js +21 -0
- package/dist/cli/create-context.js.map +1 -0
- package/dist/cli/generate-hook.d.ts +4 -0
- package/dist/cli/generate-hook.d.ts.map +1 -0
- package/dist/cli/generate-hook.js +92 -0
- package/dist/cli/generate-hook.js.map +1 -0
- package/dist/cli/templates.d.ts +4 -0
- package/dist/cli/templates.d.ts.map +1 -0
- package/dist/cli/templates.js +28 -0
- package/dist/cli/templates.js.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/generation/content-source-generator.d.ts +10 -0
- package/dist/generation/content-source-generator.d.ts.map +1 -0
- package/dist/generation/content-source-generator.js +15 -0
- package/dist/generation/content-source-generator.js.map +1 -0
- package/dist/generation/content-type-strategies/content-type-strategy.d.ts +7 -0
- package/dist/generation/content-type-strategies/content-type-strategy.d.ts.map +1 -0
- package/dist/generation/content-type-strategies/content-type-strategy.js +2 -0
- package/dist/generation/content-type-strategies/content-type-strategy.js.map +1 -0
- package/dist/generation/content-type-strategies/error.content-type-strategy.d.ts +7 -0
- package/dist/generation/content-type-strategies/error.content-type-strategy.d.ts.map +1 -0
- package/dist/generation/content-type-strategies/error.content-type-strategy.js +13 -0
- package/dist/generation/content-type-strategies/error.content-type-strategy.js.map +1 -0
- package/dist/generation/content-type-strategies/hook.content-type-strategy.d.ts +10 -0
- package/dist/generation/content-type-strategies/hook.content-type-strategy.d.ts.map +1 -0
- package/dist/generation/content-type-strategies/hook.content-type-strategy.js +27 -0
- package/dist/generation/content-type-strategies/hook.content-type-strategy.js.map +1 -0
- package/dist/generation/content-type-strategies/image.content-type-strategy.d.ts +15 -0
- package/dist/generation/content-type-strategies/image.content-type-strategy.d.ts.map +1 -0
- package/dist/generation/content-type-strategies/image.content-type-strategy.js +40 -0
- package/dist/generation/content-type-strategies/image.content-type-strategy.js.map +1 -0
- package/dist/generation/content-type-strategies/json.content-type-strategy.d.ts +8 -0
- package/dist/generation/content-type-strategies/json.content-type-strategy.d.ts.map +1 -0
- package/dist/generation/content-type-strategies/json.content-type-strategy.js +12 -0
- package/dist/generation/content-type-strategies/json.content-type-strategy.js.map +1 -0
- package/dist/generation/content-type-strategies/text.content-type-strategy.d.ts +8 -0
- package/dist/generation/content-type-strategies/text.content-type-strategy.d.ts.map +1 -0
- package/dist/generation/content-type-strategies/text.content-type-strategy.js +13 -0
- package/dist/generation/content-type-strategies/text.content-type-strategy.js.map +1 -0
- package/dist/generation/content-type-strategies/xml.content-type-strategy.d.ts +8 -0
- package/dist/generation/content-type-strategies/xml.content-type-strategy.d.ts.map +1 -0
- package/dist/generation/content-type-strategies/xml.content-type-strategy.js +14 -0
- package/dist/generation/content-type-strategies/xml.content-type-strategy.js.map +1 -0
- package/dist/generation/generate-samples-for-thymian-format.d.ts +4 -0
- package/dist/generation/generate-samples-for-thymian-format.d.ts.map +1 -0
- package/dist/generation/generate-samples-for-thymian-format.js +18 -0
- package/dist/generation/generate-samples-for-thymian-format.js.map +1 -0
- package/dist/generation/generate-samples.d.ts +4 -0
- package/dist/generation/generate-samples.d.ts.map +1 -0
- package/dist/generation/generate-samples.js +26 -0
- package/dist/generation/generate-samples.js.map +1 -0
- package/dist/generation/request-generators/default-request-generator.d.ts +22 -0
- package/dist/generation/request-generators/default-request-generator.d.ts.map +1 -0
- package/dist/generation/request-generators/default-request-generator.js +80 -0
- package/dist/generation/request-generators/default-request-generator.js.map +1 -0
- package/dist/generation/request-generators/range-request-generator.d.ts +8 -0
- package/dist/generation/request-generators/range-request-generator.d.ts.map +1 -0
- package/dist/generation/request-generators/range-request-generator.js +22 -0
- package/dist/generation/request-generators/range-request-generator.js.map +1 -0
- package/dist/generation/request-generators/unauthorized-request-generator.d.ts +6 -0
- package/dist/generation/request-generators/unauthorized-request-generator.d.ts.map +1 -0
- package/dist/generation/request-generators/unauthorized-request-generator.js +10 -0
- package/dist/generation/request-generators/unauthorized-request-generator.js.map +1 -0
- package/dist/hooks/create-hook-utils.d.ts +8 -0
- package/dist/hooks/create-hook-utils.d.ts.map +1 -0
- package/dist/hooks/create-hook-utils.js +137 -0
- package/dist/hooks/create-hook-utils.js.map +1 -0
- package/dist/hooks/generate-request-types.d.ts +30 -0
- package/dist/hooks/generate-request-types.d.ts.map +1 -0
- package/dist/hooks/generate-request-types.js +424 -0
- package/dist/hooks/generate-request-types.js.map +1 -0
- package/dist/hooks/hook-errors.d.ts +5 -0
- package/dist/hooks/hook-errors.d.ts.map +1 -0
- package/dist/hooks/hook-errors.js +5 -0
- package/dist/hooks/hook-errors.js.map +1 -0
- package/dist/hooks/hook-runner.d.ts +18 -0
- package/dist/hooks/hook-runner.d.ts.map +1 -0
- package/dist/hooks/hook-runner.js +172 -0
- package/dist/hooks/hook-runner.js.map +1 -0
- package/dist/hooks/hook-types.d.ts +7 -0
- package/dist/hooks/hook-types.d.ts.map +1 -0
- package/dist/hooks/hook-types.js +2 -0
- package/dist/hooks/hook-types.js.map +1 -0
- package/dist/hooks/hook-utils.d.ts +36 -0
- package/dist/hooks/hook-utils.d.ts.map +1 -0
- package/dist/hooks/hook-utils.js +2 -0
- package/dist/hooks/hook-utils.js.map +1 -0
- package/dist/hooks/load-hooks-from-samples.d.ts +3 -0
- package/dist/hooks/load-hooks-from-samples.d.ts.map +1 -0
- package/dist/hooks/load-hooks-from-samples.js +22 -0
- package/dist/hooks/load-hooks-from-samples.js.map +1 -0
- package/dist/hooks/ts-config.d.ts +10 -0
- package/dist/hooks/ts-config.d.ts.map +1 -0
- package/dist/hooks/ts-config.js +10 -0
- package/dist/hooks/ts-config.js.map +1 -0
- package/dist/http-request-sample.d.ts +24 -0
- package/dist/http-request-sample.d.ts.map +1 -0
- package/dist/http-request-sample.js +11 -0
- package/dist/http-request-sample.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +145 -0
- package/dist/index.js.map +1 -0
- package/dist/request-sample-to-request-template.d.ts +6 -0
- package/dist/request-sample-to-request-template.d.ts.map +1 -0
- package/dist/request-sample-to-request-template.js +35 -0
- package/dist/request-sample-to-request-template.js.map +1 -0
- package/dist/request-sampler.d.ts +15 -0
- package/dist/request-sampler.d.ts.map +1 -0
- package/dist/request-sampler.js +82 -0
- package/dist/request-sampler.js.map +1 -0
- package/dist/samples-structure/file-request-sample.d.ts +20 -0
- package/dist/samples-structure/file-request-sample.d.ts.map +1 -0
- package/dist/samples-structure/file-request-sample.js +5 -0
- package/dist/samples-structure/file-request-sample.js.map +1 -0
- package/dist/samples-structure/get-path-transaction-id.d.ts +3 -0
- package/dist/samples-structure/get-path-transaction-id.d.ts.map +1 -0
- package/dist/samples-structure/get-path-transaction-id.js +22 -0
- package/dist/samples-structure/get-path-transaction-id.js.map +1 -0
- package/dist/samples-structure/merge-tree.d.ts +5 -0
- package/dist/samples-structure/merge-tree.d.ts.map +1 -0
- package/dist/samples-structure/merge-tree.js +118 -0
- package/dist/samples-structure/merge-tree.js.map +1 -0
- package/dist/samples-structure/read-samples-from-dir.d.ts +13 -0
- package/dist/samples-structure/read-samples-from-dir.d.ts.map +1 -0
- package/dist/samples-structure/read-samples-from-dir.js +204 -0
- package/dist/samples-structure/read-samples-from-dir.js.map +1 -0
- package/dist/samples-structure/samples-from-transactions.d.ts +5 -0
- package/dist/samples-structure/samples-from-transactions.d.ts.map +1 -0
- package/dist/samples-structure/samples-from-transactions.js +120 -0
- package/dist/samples-structure/samples-from-transactions.js.map +1 -0
- package/dist/samples-structure/samples-tree-structure.d.ts +106 -0
- package/dist/samples-structure/samples-tree-structure.d.ts.map +1 -0
- package/dist/samples-structure/samples-tree-structure.js +26 -0
- package/dist/samples-structure/samples-tree-structure.js.map +1 -0
- package/dist/samples-structure/structure-meta-on-disc.d.ts +11 -0
- package/dist/samples-structure/structure-meta-on-disc.d.ts.map +1 -0
- package/dist/samples-structure/structure-meta-on-disc.js +2 -0
- package/dist/samples-structure/structure-meta-on-disc.js.map +1 -0
- package/dist/samples-structure/traverse.d.ts +4 -0
- package/dist/samples-structure/traverse.d.ts.map +1 -0
- package/dist/samples-structure/traverse.js +13 -0
- package/dist/samples-structure/traverse.js.map +1 -0
- package/dist/samples-structure/write-samples-to-dir.d.ts +25 -0
- package/dist/samples-structure/write-samples-to-dir.d.ts.map +1 -0
- package/dist/samples-structure/write-samples-to-dir.js +173 -0
- package/dist/samples-structure/write-samples-to-dir.js.map +1 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +26 -0
- package/dist/utils.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure-meta-on-disc.js","sourceRoot":"","sources":["../../src/samples-structure/structure-meta-on-disc.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseNode } from './samples-tree-structure.js';
|
|
2
|
+
export declare function traverse<Context>(node: BaseNode, ctx: Context, visitor: (node: BaseNode, ctx: Context, prev: BaseNode) => Context, prev?: BaseNode): void;
|
|
3
|
+
export declare function traverseAsync<Context>(node: BaseNode, ctx: Context, visitor: (node: BaseNode, ctx: Context) => Promise<Context> | Context): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=traverse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../../src/samples-structure/traverse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE5D,wBAAgB,QAAQ,CAAC,OAAO,EAC9B,IAAI,EAAE,QAAQ,EACd,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,EAClE,IAAI,GAAE,QAAe,GACpB,IAAI,CAMN;AAED,wBAAsB,aAAa,CAAC,OAAO,EACzC,IAAI,EAAE,QAAQ,EACd,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,GACpE,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function traverse(node, ctx, visitor, prev = node) {
|
|
2
|
+
const nextContext = visitor(node, ctx, prev);
|
|
3
|
+
for (const child of node.children) {
|
|
4
|
+
traverse(child, nextContext, visitor, node);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export async function traverseAsync(node, ctx, visitor) {
|
|
8
|
+
const nextContext = await visitor(node, ctx);
|
|
9
|
+
for (const child of node.children) {
|
|
10
|
+
await traverseAsync(child, nextContext, visitor);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=traverse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse.js","sourceRoot":"","sources":["../../src/samples-structure/traverse.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,QAAQ,CACtB,IAAc,EACd,GAAY,EACZ,OAAkE,EAClE,OAAiB,IAAI;IAErB,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAE7C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClC,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAc,EACd,GAAY,EACZ,OAAqE;IAErE,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAE7C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClC,MAAM,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ContentSource, type HttpRequestSample } from '../http-request-sample.js';
|
|
2
|
+
import type { Value } from './file-request-sample.js';
|
|
3
|
+
import { type BaseNode, type SamplesStructure } from './samples-tree-structure.js';
|
|
4
|
+
import type { PathToNodeType } from './structure-meta-on-disc.js';
|
|
5
|
+
export type WriteToFile = (path: string, content: string | Buffer, encoding?: string) => Promise<void>;
|
|
6
|
+
export declare function getTreeStructureMeta(tree: SamplesStructure): PathToNodeType;
|
|
7
|
+
export declare function getFolderNameFromNode(node: BaseNode): string;
|
|
8
|
+
export declare function writeSample({ sample, name, dir, writeToFile, }: {
|
|
9
|
+
sample: HttpRequestSample;
|
|
10
|
+
name: string;
|
|
11
|
+
dir: string;
|
|
12
|
+
writeToFile: WriteToFile;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
export declare function transformParameters({ parameters, dir, baseName, writeToFile, }: {
|
|
15
|
+
parameters: Record<string, ContentSource>;
|
|
16
|
+
baseName: string;
|
|
17
|
+
dir: string;
|
|
18
|
+
writeToFile: WriteToFile;
|
|
19
|
+
}): Promise<Record<string, Value>>;
|
|
20
|
+
export type WriteOptions = {
|
|
21
|
+
path: string;
|
|
22
|
+
mode?: 'failIfExist' | 'overwrite';
|
|
23
|
+
};
|
|
24
|
+
export declare function writeSamplesToDir(samples: SamplesStructure, keyToTransactionId: Record<string, string>, options: WriteOptions): Promise<void>;
|
|
25
|
+
//# sourceMappingURL=write-samples-to-dir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-samples-to-dir.d.ts","sourceRoot":"","sources":["../../src/samples-structure/write-samples-to-dir.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAGvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAqB,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EACL,KAAK,QAAQ,EAKb,KAAK,gBAAgB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,MAAM,MAAM,WAAW,GAAG,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,QAAQ,CAAC,EAAE,MAAM,KACd,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,gBAAgB,GAAG,cAAc,CAoB3E;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAqC5D;AAED,wBAAsB,WAAW,CAAC,EAChC,MAAM,EACN,IAAI,EACJ,GAAG,EACH,WAAW,GACZ,EAAE;IACD,MAAM,EAAE,iBAAiB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,WAAW,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDhB;AAmCD,wBAAsB,mBAAmB,CAAC,EACxC,UAAU,EACV,GAAG,EACH,QAAQ,EACR,WAAW,GACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,WAAW,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAajC;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,aAAa,GAAG,WAAW,CAAC;CACpC,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,gBAAgB,EACzB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAuDf"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { basename, format, join } from 'node:path';
|
|
3
|
+
import { ThymianBaseError } from '@thymian/core';
|
|
4
|
+
import { isFileContentSource, isInlineContentSource, } from '../http-request-sample.js';
|
|
5
|
+
import { checkForSafePath, entryExists, sanitize } from '../utils.js';
|
|
6
|
+
import { isKnownNodeType, isValidNodeType, nodeIsType, } from './samples-tree-structure.js';
|
|
7
|
+
import { traverse, traverseAsync } from './traverse.js';
|
|
8
|
+
export function getTreeStructureMeta(tree) {
|
|
9
|
+
const meta = {};
|
|
10
|
+
traverse(tree, '', (node, currentPath) => {
|
|
11
|
+
const path = join(currentPath, getFolderNameFromNode(node));
|
|
12
|
+
if (!isValidNodeType(node.type)) {
|
|
13
|
+
throw new Error(`Invalid node type: ${node.type}`);
|
|
14
|
+
}
|
|
15
|
+
meta[path] = {
|
|
16
|
+
type: node.type,
|
|
17
|
+
...(meta[path] ?? {}), // this ensures that we don't override the type of a node with type `samples` if it already exists. This can happen cause getFolderNameFromNode returns an empty string for samples nodes.
|
|
18
|
+
containsSamples: nodeIsType(node, 'samples'),
|
|
19
|
+
};
|
|
20
|
+
return path;
|
|
21
|
+
});
|
|
22
|
+
return meta;
|
|
23
|
+
}
|
|
24
|
+
export function getFolderNameFromNode(node) {
|
|
25
|
+
if (!isKnownNodeType(node)) {
|
|
26
|
+
throw new Error(`Unknown node type: ${node}`);
|
|
27
|
+
}
|
|
28
|
+
switch (node.type) {
|
|
29
|
+
case 'host':
|
|
30
|
+
return node.value;
|
|
31
|
+
case 'port':
|
|
32
|
+
return node.value.toString();
|
|
33
|
+
case 'path':
|
|
34
|
+
return sanitize(node.value);
|
|
35
|
+
case 'pathParameter':
|
|
36
|
+
return `[${sanitize(node.value)}]`;
|
|
37
|
+
case 'method':
|
|
38
|
+
return `@${sanitize(node.value.toUpperCase())}`;
|
|
39
|
+
case 'requestMediaType':
|
|
40
|
+
return node.value.replaceAll('/', '__');
|
|
41
|
+
case 'responseMediaType':
|
|
42
|
+
return node.value.replaceAll('/', '__');
|
|
43
|
+
case 'statusCode':
|
|
44
|
+
return node.value.toString();
|
|
45
|
+
case 'samples':
|
|
46
|
+
return '';
|
|
47
|
+
case 'root':
|
|
48
|
+
return '';
|
|
49
|
+
case 'source': {
|
|
50
|
+
if (!node.value) {
|
|
51
|
+
throw new Error('Source Cannot be empty.');
|
|
52
|
+
}
|
|
53
|
+
return sanitize(node.value);
|
|
54
|
+
}
|
|
55
|
+
case 'requests':
|
|
56
|
+
return 'requests';
|
|
57
|
+
default:
|
|
58
|
+
throw new Error(`Unknown node type: ${JSON.stringify(node)}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export async function writeSample({ sample, name, dir, writeToFile, }) {
|
|
62
|
+
const fileSample = {
|
|
63
|
+
origin: sample.origin,
|
|
64
|
+
path: sample.path,
|
|
65
|
+
method: sample.method,
|
|
66
|
+
authorize: sample.authorize,
|
|
67
|
+
bodyEncoding: sample.bodyEncoding,
|
|
68
|
+
headers: await transformParameters({
|
|
69
|
+
parameters: sample.headers,
|
|
70
|
+
baseName: `${name}_header`,
|
|
71
|
+
dir,
|
|
72
|
+
writeToFile,
|
|
73
|
+
}),
|
|
74
|
+
cookies: await transformParameters({
|
|
75
|
+
parameters: sample.cookies,
|
|
76
|
+
baseName: `${name}_cookie`,
|
|
77
|
+
dir,
|
|
78
|
+
writeToFile,
|
|
79
|
+
}),
|
|
80
|
+
pathParameters: await transformParameters({
|
|
81
|
+
parameters: sample.pathParameters,
|
|
82
|
+
baseName: `${name}_pathParameter`,
|
|
83
|
+
dir,
|
|
84
|
+
writeToFile,
|
|
85
|
+
}),
|
|
86
|
+
query: await transformParameters({
|
|
87
|
+
parameters: sample.query,
|
|
88
|
+
baseName: `${name}_query`,
|
|
89
|
+
dir,
|
|
90
|
+
writeToFile,
|
|
91
|
+
}),
|
|
92
|
+
};
|
|
93
|
+
if (sample.body) {
|
|
94
|
+
fileSample.body = await transformContentSource(sample.body, `${name}_body`, dir, writeToFile);
|
|
95
|
+
}
|
|
96
|
+
const fullPath = format({
|
|
97
|
+
ext: 'json',
|
|
98
|
+
dir,
|
|
99
|
+
name,
|
|
100
|
+
});
|
|
101
|
+
checkForSafePath(fullPath, dir);
|
|
102
|
+
await writeToFile(fullPath, JSON.stringify(fileSample, null, 2));
|
|
103
|
+
}
|
|
104
|
+
async function transformContentSource(source, name, dir, writeToFile) {
|
|
105
|
+
if (isInlineContentSource(source)) {
|
|
106
|
+
return source.$content;
|
|
107
|
+
}
|
|
108
|
+
else if (isFileContentSource(source)) {
|
|
109
|
+
const filePath = format({
|
|
110
|
+
ext: source.$ext,
|
|
111
|
+
dir,
|
|
112
|
+
name,
|
|
113
|
+
});
|
|
114
|
+
checkForSafePath(filePath, dir);
|
|
115
|
+
await writeToFile(filePath, source.$buffer, source.$encoding);
|
|
116
|
+
return {
|
|
117
|
+
$file: basename(filePath),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
throw new ThymianBaseError('Unknown content source type .' + source + name, {
|
|
122
|
+
name: 'UnknownContentSourceTypeError',
|
|
123
|
+
ref: 'https://thymian.dev/references/errors/unknown-content-source-type-error/',
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export async function transformParameters({ parameters, dir, baseName, writeToFile, }) {
|
|
128
|
+
const transformedParameters = {};
|
|
129
|
+
for (const [parameterName, source] of Object.entries(parameters)) {
|
|
130
|
+
transformedParameters[parameterName] = await transformContentSource(source, `${baseName}_${parameterName}`, dir, writeToFile);
|
|
131
|
+
}
|
|
132
|
+
return transformedParameters;
|
|
133
|
+
}
|
|
134
|
+
export async function writeSamplesToDir(samples, keyToTransactionId, options) {
|
|
135
|
+
const mode = options.mode ?? 'failIfExist';
|
|
136
|
+
const writeToFile = async (path, content, encoding) => {
|
|
137
|
+
if (mode === 'failIfExist' && (await entryExists(path))) {
|
|
138
|
+
throw new ThymianBaseError(`File/Directory at path "${path}" already exists. Use "overwrite" mode to overwrite it.`, {
|
|
139
|
+
name: 'PathAlreadyExistsError',
|
|
140
|
+
ref: 'https://thymian.dev/references/errors/path-already-exists-error/',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
await writeFile(path, content, encoding);
|
|
144
|
+
};
|
|
145
|
+
await mkdir(options.path, { recursive: true });
|
|
146
|
+
await writeToFile(join(options.path, 'meta.json'), JSON.stringify({
|
|
147
|
+
'//': 'This file contains metadata about the structure of the samples. It is generated by @thymian/plugin-sampler and is not meant to be edited by humans.',
|
|
148
|
+
types: getTreeStructureMeta(samples),
|
|
149
|
+
version: samples.meta,
|
|
150
|
+
transactions: keyToTransactionId,
|
|
151
|
+
}));
|
|
152
|
+
await traverseAsync(samples, options.path, async (node, currentPath) => {
|
|
153
|
+
if (!isValidNodeType(node.type)) {
|
|
154
|
+
throw new Error(`Invalid node type: ${node.type}`);
|
|
155
|
+
}
|
|
156
|
+
const folderName = getFolderNameFromNode(node);
|
|
157
|
+
const dirPath = join(currentPath, folderName);
|
|
158
|
+
if (nodeIsType(node, 'samples')) {
|
|
159
|
+
await mkdir(dirPath, { recursive: true });
|
|
160
|
+
const metaPath = join(dirPath, 'meta.json');
|
|
161
|
+
await writeToFile(metaPath, JSON.stringify(node.meta, null, 2));
|
|
162
|
+
}
|
|
163
|
+
else if (nodeIsType(node, 'requests')) {
|
|
164
|
+
await mkdir(dirPath, { recursive: true });
|
|
165
|
+
for (const [idx, sample] of node.value.entries()) {
|
|
166
|
+
const name = `${idx}-request`;
|
|
167
|
+
await writeSample({ sample, name, dir: dirPath, writeToFile });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return dirPath;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=write-samples-to-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-samples-to-dir.js","sourceRoot":"","sources":["../../src/samples-structure/write-samples-to-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAGL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAEL,eAAe,EACf,eAAe,EAEf,UAAU,GAEX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQxD,MAAM,UAAU,oBAAoB,CAAC,IAAsB;IACzD,MAAM,IAAI,GAAmB,EAAE,CAAC;IAEhC,QAAQ,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,IAAc,EAAE,WAAW,EAAE,EAAE;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,WAA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CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;gBACjD,MAAM,IAAI,GAAG,GAAG,GAAG,UAAU,CAAC;gBAE9B,MAAM,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAcpE;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOhE"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { access } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { ThymianBaseError } from '@thymian/core';
|
|
4
|
+
export function sanitize(name) {
|
|
5
|
+
return decodeURIComponent(name).replace(/[^a-z0-9.-]/gi, '_');
|
|
6
|
+
}
|
|
7
|
+
export function checkForSafePath(path, baseDir) {
|
|
8
|
+
const resolvedPath = resolve(baseDir, path);
|
|
9
|
+
const isSafe = resolvedPath.startsWith(baseDir);
|
|
10
|
+
if (!isSafe) {
|
|
11
|
+
throw new ThymianBaseError('Access denied. The generated path is outside of the base directory.', {
|
|
12
|
+
name: 'PathTraversalError',
|
|
13
|
+
ref: 'https://thymian.dev/references/errors/path-traversal-error/',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function entryExists(path) {
|
|
18
|
+
try {
|
|
19
|
+
await access(path);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,OAAe;IAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAEhD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,gBAAgB,CACxB,qEAAqE,EACrE;YACE,IAAI,EAAE,oBAAoB;YAC1B,GAAG,EAAE,6DAA6D;SACnE,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAY;IAC5C,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thymian/plugin-sampler",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "AGPL-3.0-only",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"!**/*.tsbuildinfo"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@thymian/common-cli": "0.1.0",
|
|
26
|
+
"@thymian/core": "0.1.0",
|
|
27
|
+
"@thymian/plugin-request-dispatcher": "0.1.0",
|
|
28
|
+
"code-block-writer": "^13.0.3",
|
|
29
|
+
"jiti": "^2.6.1",
|
|
30
|
+
"json-schema-to-typescript": "^15.0.4",
|
|
31
|
+
"launch-editor": "^2.13.2",
|
|
32
|
+
"openapi-sampler": "^1.7.2",
|
|
33
|
+
"sharp": "^0.34.5",
|
|
34
|
+
"tslib": "^2.3.0"
|
|
35
|
+
},
|
|
36
|
+
"oclif": {
|
|
37
|
+
"commands": "./dist/cli/commands",
|
|
38
|
+
"bin": "thymian",
|
|
39
|
+
"topicSeparator": " ",
|
|
40
|
+
"topics": {
|
|
41
|
+
"sampler": {
|
|
42
|
+
"description": "Generate sample data for your API."
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@thymian/core-testing": "0.1.0",
|
|
48
|
+
"fast-json-stable-stringify": "^2.1.0",
|
|
49
|
+
"ts-morph": "^27.0.2"
|
|
50
|
+
}
|
|
51
|
+
}
|