neuron-inspector 1.2.1 → 1.3.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/dist/collections/assertions.js +11 -0
- package/dist/collections/assertions.js.map +1 -1
- package/dist/collections/dynamic-vars-core.d.ts +79 -0
- package/dist/collections/dynamic-vars-core.js +214 -0
- package/dist/collections/dynamic-vars-core.js.map +1 -0
- package/dist/collections/dynamic-vars.d.ts +2 -61
- package/dist/collections/dynamic-vars.js +6 -146
- package/dist/collections/dynamic-vars.js.map +1 -1
- package/dist/collections/encoding.d.ts +3 -0
- package/dist/collections/encoding.js +20 -0
- package/dist/collections/encoding.js.map +1 -0
- package/dist/collections/executor.d.ts +114 -5
- package/dist/collections/executor.js +315 -91
- package/dist/collections/executor.js.map +1 -1
- package/dist/collections/index.d.ts +11 -3
- package/dist/collections/index.js +7 -1
- package/dist/collections/index.js.map +1 -1
- package/dist/collections/masking.d.ts +42 -0
- package/dist/collections/masking.js +188 -0
- package/dist/collections/masking.js.map +1 -0
- package/dist/collections/resolver-core.d.ts +74 -0
- package/dist/collections/resolver-core.js +309 -0
- package/dist/collections/resolver-core.js.map +1 -0
- package/dist/collections/resolver.d.ts +9 -62
- package/dist/collections/resolver.js +21 -281
- package/dist/collections/resolver.js.map +1 -1
- package/dist/collections/scenario-run.d.ts +33 -0
- package/dist/collections/scenario-run.js +68 -0
- package/dist/collections/scenario-run.js.map +1 -0
- package/dist/collections/script-api.d.ts +18 -0
- package/dist/collections/script-api.js +208 -0
- package/dist/collections/script-api.js.map +1 -0
- package/dist/collections/scripts.d.ts +1 -8
- package/dist/collections/scripts.js +6 -196
- package/dist/collections/scripts.js.map +1 -1
- package/dist/collections/slug.d.ts +2 -0
- package/dist/collections/slug.js +8 -0
- package/dist/collections/slug.js.map +1 -0
- package/dist/collections/store.d.ts +5 -2
- package/dist/collections/store.js +6 -6
- package/dist/collections/store.js.map +1 -1
- package/dist/collections/tools.d.ts +8 -1
- package/dist/collections/tools.js +253 -90
- package/dist/collections/tools.js.map +1 -1
- package/dist/collections/types.d.ts +42 -3
- package/dist/correlation.js +10 -0
- package/dist/correlation.js.map +1 -1
- package/dist/extension-slot.d.ts +45 -0
- package/dist/extension-slot.js +81 -0
- package/dist/extension-slot.js.map +1 -0
- package/dist/monitor.d.ts +5 -0
- package/dist/monitor.js +7 -2
- package/dist/monitor.js.map +1 -1
- package/dist/server.js +113 -25
- package/dist/server.js.map +1 -1
- package/dist/tools.js +1 -1
- package/dist/tools.js.map +1 -1
- package/package.json +3 -2
- package/dist/collections/__tests__/assertions.test.d.ts +0 -1
- package/dist/collections/__tests__/assertions.test.js +0 -203
- package/dist/collections/__tests__/assertions.test.js.map +0 -1
- package/dist/collections/__tests__/dynamic-vars.test.d.ts +0 -1
- package/dist/collections/__tests__/dynamic-vars.test.js +0 -169
- package/dist/collections/__tests__/dynamic-vars.test.js.map +0 -1
- package/dist/collections/__tests__/execution.test.d.ts +0 -1
- package/dist/collections/__tests__/execution.test.js +0 -271
- package/dist/collections/__tests__/execution.test.js.map +0 -1
- package/dist/collections/__tests__/integration.test.d.ts +0 -1
- package/dist/collections/__tests__/integration.test.js +0 -478
- package/dist/collections/__tests__/integration.test.js.map +0 -1
- package/dist/collections/__tests__/merge.test.d.ts +0 -1
- package/dist/collections/__tests__/merge.test.js +0 -411
- package/dist/collections/__tests__/merge.test.js.map +0 -1
- package/dist/collections/__tests__/resolver.test.d.ts +0 -1
- package/dist/collections/__tests__/resolver.test.js +0 -282
- package/dist/collections/__tests__/resolver.test.js.map +0 -1
- package/dist/collections/__tests__/scenario.test.d.ts +0 -1
- package/dist/collections/__tests__/scenario.test.js +0 -367
- package/dist/collections/__tests__/scenario.test.js.map +0 -1
- package/dist/collections/__tests__/scripts.test.d.ts +0 -1
- package/dist/collections/__tests__/scripts.test.js +0 -245
- package/dist/collections/__tests__/scripts.test.js.map +0 -1
- package/dist/collections/__tests__/store.test.d.ts +0 -1
- package/dist/collections/__tests__/store.test.js +0 -313
- package/dist/collections/__tests__/store.test.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../src/collections/encoding.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC;QAC9C,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Collection, Environment, Folder, Endpoint, HttpExecutor, ResolverStep, AssertionEvaluator, AssertionResult, ScenarioStep, ScriptRunner } from "./types.js";
|
|
1
|
+
import type { Collection, Environment, Folder, Endpoint, HttpExecutor, ResolverStep, AssertionEvaluator, AssertionResult, AssertionTarget, Assertion, PollConfig, ScenarioStep, ScriptRunner } from "./types.js";
|
|
2
|
+
import type { ResolverContext } from "./types.js";
|
|
2
3
|
export interface EndpointResult {
|
|
3
4
|
endpoint: {
|
|
4
5
|
method: string;
|
|
@@ -8,6 +9,8 @@ export interface EndpointResult {
|
|
|
8
9
|
request: {
|
|
9
10
|
url: string;
|
|
10
11
|
method: string;
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
body?: string;
|
|
11
14
|
};
|
|
12
15
|
response: {
|
|
13
16
|
status: number;
|
|
@@ -44,18 +47,73 @@ export interface CollectionRunResult {
|
|
|
44
47
|
total_failed: number;
|
|
45
48
|
total_errors: number;
|
|
46
49
|
}
|
|
50
|
+
export interface PollAttempt {
|
|
51
|
+
attempt: number;
|
|
52
|
+
status: number;
|
|
53
|
+
timing: {
|
|
54
|
+
total_ms: number;
|
|
55
|
+
ttfb_ms: number;
|
|
56
|
+
};
|
|
57
|
+
until: AssertionResult[];
|
|
58
|
+
satisfied: boolean;
|
|
59
|
+
body?: unknown;
|
|
60
|
+
error?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface ScenarioStepResult extends EndpointResult {
|
|
63
|
+
step: number;
|
|
64
|
+
ref: string;
|
|
65
|
+
poll?: {
|
|
66
|
+
satisfied: boolean;
|
|
67
|
+
attempts: PollAttempt[];
|
|
68
|
+
max_attempts: number;
|
|
69
|
+
interval_ms: number;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
47
72
|
export interface ScenarioResult {
|
|
48
73
|
scenario: string;
|
|
49
74
|
collection: string;
|
|
50
75
|
environment: string;
|
|
51
|
-
steps:
|
|
52
|
-
step: number;
|
|
53
|
-
ref: string;
|
|
54
|
-
})[];
|
|
76
|
+
steps: ScenarioStepResult[];
|
|
55
77
|
passed: boolean;
|
|
56
78
|
halted_at?: number;
|
|
57
79
|
extracted: Record<string, string>;
|
|
80
|
+
/** True when at least one secret input was masked out of this result. */
|
|
81
|
+
masked?: boolean;
|
|
58
82
|
}
|
|
83
|
+
/** Live progress for a scenario run. Every payload is already masked. */
|
|
84
|
+
export type ScenarioEvent = {
|
|
85
|
+
type: "run_start";
|
|
86
|
+
scenario: string;
|
|
87
|
+
environment: string;
|
|
88
|
+
total_steps: number;
|
|
89
|
+
} | {
|
|
90
|
+
type: "step_start";
|
|
91
|
+
step: number;
|
|
92
|
+
ref: string;
|
|
93
|
+
method: string;
|
|
94
|
+
path: string;
|
|
95
|
+
} | {
|
|
96
|
+
type: "poll_attempt";
|
|
97
|
+
step: number;
|
|
98
|
+
ref: string;
|
|
99
|
+
attempt: PollAttempt;
|
|
100
|
+
max_attempts: number;
|
|
101
|
+
} | {
|
|
102
|
+
type: "step_done";
|
|
103
|
+
step: number;
|
|
104
|
+
result: ScenarioStepResult;
|
|
105
|
+
} | {
|
|
106
|
+
type: "run_done";
|
|
107
|
+
passed: boolean;
|
|
108
|
+
halted_at?: number;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Resolve {{var}} in each assertion's `expect` (each element for array expects)
|
|
112
|
+
* with the same resolver chain as requests. A value that was a single
|
|
113
|
+
* template and resolves to the string form of a non-string actual (e.g.
|
|
114
|
+
* "42" vs 42) takes the actual's type, since templates always yield strings.
|
|
115
|
+
*/
|
|
116
|
+
export declare function resolveAssertionTemplates(assertions: Assertion[], target: AssertionTarget, pipeline: ResolverStep[], context: ResolverContext): Assertion[];
|
|
59
117
|
export declare function executeEndpoint(opts: {
|
|
60
118
|
collection: Collection;
|
|
61
119
|
environment: Environment;
|
|
@@ -66,6 +124,12 @@ export declare function executeEndpoint(opts: {
|
|
|
66
124
|
assertionEvaluator: AssertionEvaluator;
|
|
67
125
|
scriptRunner?: ScriptRunner;
|
|
68
126
|
extracted?: Record<string, string>;
|
|
127
|
+
/** Run-time input values (declared `inputs`). */
|
|
128
|
+
inputs?: Record<string, string>;
|
|
129
|
+
/** Name of the environment actually in use (defaults to the collection's active one). */
|
|
130
|
+
environmentName?: string;
|
|
131
|
+
/** Called with each value extracted under a `mask: true` rule. */
|
|
132
|
+
onSecret?: (value: string) => void;
|
|
69
133
|
}): Promise<EndpointResult>;
|
|
70
134
|
export declare function executeFolder(opts: {
|
|
71
135
|
folderKey: string;
|
|
@@ -77,6 +141,9 @@ export declare function executeFolder(opts: {
|
|
|
77
141
|
assertionEvaluator: AssertionEvaluator;
|
|
78
142
|
scriptRunner?: ScriptRunner;
|
|
79
143
|
extracted?: Record<string, string>;
|
|
144
|
+
environmentName?: string;
|
|
145
|
+
inputs?: Record<string, string>;
|
|
146
|
+
onSecret?: (value: string) => void;
|
|
80
147
|
}): Promise<FolderResult>;
|
|
81
148
|
export declare function executeCollection(opts: {
|
|
82
149
|
collectionId: string;
|
|
@@ -86,7 +153,38 @@ export declare function executeCollection(opts: {
|
|
|
86
153
|
pipeline: ResolverStep[];
|
|
87
154
|
assertionEvaluator: AssertionEvaluator;
|
|
88
155
|
scriptRunner?: ScriptRunner;
|
|
156
|
+
environmentName?: string;
|
|
157
|
+
inputs?: Record<string, string>;
|
|
158
|
+
onSecret?: (value: string) => void;
|
|
89
159
|
}): Promise<CollectionRunResult>;
|
|
160
|
+
/**
|
|
161
|
+
* Resolve a scenario step ref. Accepted forms, tried in order:
|
|
162
|
+
* "folder/<endpoint name>"
|
|
163
|
+
* "folder/METHOD /path" (method is case-insensitive)
|
|
164
|
+
* Folder keys may themselves contain "/", so the longest matching folder wins.
|
|
165
|
+
* More than one matching endpoint is an error, never a guess.
|
|
166
|
+
*/
|
|
167
|
+
export declare function resolveStepRef(collection: Collection, ref: string): {
|
|
168
|
+
folderKey: string;
|
|
169
|
+
folder: Folder;
|
|
170
|
+
endpoint: Endpoint;
|
|
171
|
+
} | {
|
|
172
|
+
error: string;
|
|
173
|
+
};
|
|
174
|
+
export declare const POLL_DEFAULTS: {
|
|
175
|
+
interval_ms: number;
|
|
176
|
+
max_attempts: number;
|
|
177
|
+
};
|
|
178
|
+
export declare const POLL_LIMITS: {
|
|
179
|
+
min_interval_ms: number;
|
|
180
|
+
max_interval_ms: number;
|
|
181
|
+
max_attempts: number;
|
|
182
|
+
};
|
|
183
|
+
export declare function normalizePoll(poll: PollConfig): {
|
|
184
|
+
until: Assertion[];
|
|
185
|
+
interval_ms: number;
|
|
186
|
+
max_attempts: number;
|
|
187
|
+
};
|
|
90
188
|
export declare function executeScenario(opts: {
|
|
91
189
|
scenarioKey: string;
|
|
92
190
|
steps: ScenarioStep[];
|
|
@@ -97,4 +195,15 @@ export declare function executeScenario(opts: {
|
|
|
97
195
|
pipeline: ResolverStep[];
|
|
98
196
|
assertionEvaluator: AssertionEvaluator;
|
|
99
197
|
scriptRunner?: ScriptRunner;
|
|
198
|
+
/** Name of the environment in use (the one passed to the run, not just the active one). */
|
|
199
|
+
environmentName?: string;
|
|
200
|
+
inputs?: Record<string, string>;
|
|
201
|
+
/** Secret values to mask in the result and in every event (plus any `mask: true` extracts). */
|
|
202
|
+
secrets?: string[];
|
|
203
|
+
/** Live progress. Payloads are masked. */
|
|
204
|
+
onEvent?: (event: ScenarioEvent) => void;
|
|
205
|
+
/** Injectable for tests. */
|
|
206
|
+
sleep?: (ms: number) => Promise<void>;
|
|
207
|
+
/** Stop between steps/attempts when this returns true. */
|
|
208
|
+
isCancelled?: () => boolean;
|
|
100
209
|
}): Promise<ScenarioResult>;
|