callman-core 1.3.0 → 1.5.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/scenario-runner/adapters/connection-config.d.ts +34 -0
- package/dist/scenario-runner/adapters/connection-config.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/connection-config.js +6 -0
- package/dist/scenario-runner/adapters/connection-config.js.map +1 -0
- package/dist/scenario-runner/adapters/db-executor.d.ts +4 -0
- package/dist/scenario-runner/adapters/db-executor.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/db-executor.js +42 -0
- package/dist/scenario-runner/adapters/db-executor.js.map +1 -0
- package/dist/scenario-runner/adapters/helpers/abort.d.ts +4 -0
- package/dist/scenario-runner/adapters/helpers/abort.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/helpers/abort.js +47 -0
- package/dist/scenario-runner/adapters/helpers/abort.js.map +1 -0
- package/dist/scenario-runner/adapters/helpers/failure-messages.d.ts +29 -0
- package/dist/scenario-runner/adapters/helpers/failure-messages.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/helpers/failure-messages.js +64 -0
- package/dist/scenario-runner/adapters/helpers/failure-messages.js.map +1 -0
- package/dist/scenario-runner/adapters/helpers/mutations.d.ts +7 -0
- package/dist/scenario-runner/adapters/helpers/mutations.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/helpers/mutations.js +28 -0
- package/dist/scenario-runner/adapters/helpers/mutations.js.map +1 -0
- package/dist/scenario-runner/adapters/helpers/request-helpers.d.ts +31 -0
- package/dist/scenario-runner/adapters/helpers/request-helpers.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/helpers/request-helpers.js +247 -0
- package/dist/scenario-runner/adapters/helpers/request-helpers.js.map +1 -0
- package/dist/scenario-runner/adapters/helpers/response-shapes.d.ts +3 -0
- package/dist/scenario-runner/adapters/helpers/response-shapes.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/helpers/response-shapes.js +32 -0
- package/dist/scenario-runner/adapters/helpers/response-shapes.js.map +1 -0
- package/dist/scenario-runner/adapters/helpers/templates.d.ts +2 -0
- package/dist/scenario-runner/adapters/helpers/templates.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/helpers/templates.js +30 -0
- package/dist/scenario-runner/adapters/helpers/templates.js.map +1 -0
- package/dist/scenario-runner/adapters/index.d.ts +12 -0
- package/dist/scenario-runner/adapters/index.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/index.js +30 -0
- package/dist/scenario-runner/adapters/index.js.map +1 -0
- package/dist/scenario-runner/adapters/kafka-executor.d.ts +4 -0
- package/dist/scenario-runner/adapters/kafka-executor.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/kafka-executor.js +35 -0
- package/dist/scenario-runner/adapters/kafka-executor.js.map +1 -0
- package/dist/scenario-runner/adapters/notification-executor.d.ts +4 -0
- package/dist/scenario-runner/adapters/notification-executor.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/notification-executor.js +67 -0
- package/dist/scenario-runner/adapters/notification-executor.js.map +1 -0
- package/dist/scenario-runner/adapters/redis-executor.d.ts +4 -0
- package/dist/scenario-runner/adapters/redis-executor.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/redis-executor.js +78 -0
- package/dist/scenario-runner/adapters/redis-executor.js.map +1 -0
- package/dist/scenario-runner/adapters/request-executor.d.ts +4 -0
- package/dist/scenario-runner/adapters/request-executor.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/request-executor.js +262 -0
- package/dist/scenario-runner/adapters/request-executor.js.map +1 -0
- package/dist/scenario-runner/adapters/script-executor.d.ts +4 -0
- package/dist/scenario-runner/adapters/script-executor.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/script-executor.js +113 -0
- package/dist/scenario-runner/adapters/script-executor.js.map +1 -0
- package/dist/scenario-runner/adapters/types.d.ts +82 -0
- package/dist/scenario-runner/adapters/types.d.ts.map +1 -0
- package/dist/scenario-runner/adapters/types.js +9 -0
- package/dist/scenario-runner/adapters/types.js.map +1 -0
- package/dist/scenario-runner/index.d.ts +1 -0
- package/dist/scenario-runner/index.d.ts.map +1 -1
- package/dist/scenario-runner/index.js +1 -0
- package/dist/scenario-runner/index.js.map +1 -1
- package/dist/templating/counter-store.d.ts +7 -0
- package/dist/templating/counter-store.d.ts.map +1 -0
- package/dist/templating/counter-store.js +64 -0
- package/dist/templating/counter-store.js.map +1 -0
- package/dist/templating/generator-metadata.d.ts +5 -0
- package/dist/templating/generator-metadata.d.ts.map +1 -0
- package/dist/templating/generator-metadata.js +102 -0
- package/dist/templating/generator-metadata.js.map +1 -0
- package/dist/templating/index.d.ts +6 -0
- package/dist/templating/index.d.ts.map +1 -0
- package/dist/templating/index.js +11 -0
- package/dist/templating/index.js.map +1 -0
- package/dist/templating/random-generators.d.ts +10 -0
- package/dist/templating/random-generators.d.ts.map +1 -0
- package/dist/templating/random-generators.js +16 -0
- package/dist/templating/random-generators.js.map +1 -0
- package/dist/templating/template-engine.d.ts +14 -0
- package/dist/templating/template-engine.d.ts.map +1 -0
- package/dist/templating/template-engine.js +148 -0
- package/dist/templating/template-engine.js.map +1 -0
- package/dist/templating/types.d.ts +22 -0
- package/dist/templating/types.d.ts.map +1 -0
- package/dist/templating/types.js +10 -0
- package/dist/templating/types.js.map +1 -0
- package/dist-cjs/index.js +2 -4
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/scenario-runner/adapters/connection-config.js +7 -0
- package/dist-cjs/scenario-runner/adapters/connection-config.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/db-executor.js +46 -0
- package/dist-cjs/scenario-runner/adapters/db-executor.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/helpers/abort.js +52 -0
- package/dist-cjs/scenario-runner/adapters/helpers/abort.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/helpers/failure-messages.js +69 -0
- package/dist-cjs/scenario-runner/adapters/helpers/failure-messages.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/helpers/mutations.js +32 -0
- package/dist-cjs/scenario-runner/adapters/helpers/mutations.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/helpers/request-helpers.js +263 -0
- package/dist-cjs/scenario-runner/adapters/helpers/request-helpers.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/helpers/response-shapes.js +36 -0
- package/dist-cjs/scenario-runner/adapters/helpers/response-shapes.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/helpers/templates.js +34 -0
- package/dist-cjs/scenario-runner/adapters/helpers/templates.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/index.js +40 -0
- package/dist-cjs/scenario-runner/adapters/index.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/kafka-executor.js +39 -0
- package/dist-cjs/scenario-runner/adapters/kafka-executor.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/notification-executor.js +71 -0
- package/dist-cjs/scenario-runner/adapters/notification-executor.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/redis-executor.js +82 -0
- package/dist-cjs/scenario-runner/adapters/redis-executor.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/request-executor.js +266 -0
- package/dist-cjs/scenario-runner/adapters/request-executor.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/script-executor.js +117 -0
- package/dist-cjs/scenario-runner/adapters/script-executor.js.map +1 -0
- package/dist-cjs/scenario-runner/adapters/types.js +10 -0
- package/dist-cjs/scenario-runner/adapters/types.js.map +1 -0
- package/dist-cjs/scenario-runner/index.js +1 -0
- package/dist-cjs/scenario-runner/index.js.map +1 -1
- package/dist-cjs/templating/counter-store.js +72 -0
- package/dist-cjs/templating/counter-store.js.map +1 -0
- package/dist-cjs/templating/generator-metadata.js +105 -0
- package/dist-cjs/templating/generator-metadata.js.map +1 -0
- package/dist-cjs/templating/index.js +35 -0
- package/dist-cjs/templating/index.js.map +1 -0
- package/dist-cjs/templating/random-generators.js +28 -0
- package/dist-cjs/templating/random-generators.js.map +1 -0
- package/dist-cjs/templating/template-engine.js +155 -0
- package/dist-cjs/templating/template-engine.js.map +1 -0
- package/dist-cjs/templating/types.js +11 -0
- package/dist-cjs/templating/types.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { runCollection } from "./runner/runCollection.js";
|
|
|
2
2
|
export { runRequest } from "./runner/requestRunner.js";
|
|
3
3
|
export { executeRequest } from "./request/executeRequest.js";
|
|
4
4
|
export { EnvStore } from "./variables/envStore.js";
|
|
5
|
-
export { resolveTemplate, resolveTemplateValue } from "./variables/resolver.js";
|
|
6
5
|
export { runScript } from "./script/legacy.js";
|
|
6
|
+
export * from "./templating/index.js";
|
|
7
7
|
export { executeScript, validateScript } from "./script/executor.js";
|
|
8
8
|
export type { CounterSnapshotEntry, ExecuteScriptInput, ExecuteScriptResult, ScriptCapabilities, ScriptCounterCapability, ScriptDbCapability, ScriptDbExecutionInput, ScriptDbExecutionResult, ScriptError, ScriptFeaturePolicy, ScriptKafkaCapability, ScriptKeyValuePair, ScriptLogEntry, ScriptRedisCapability, ScriptRequestBodyState, ScriptRequestState, ScriptResponseState, ScriptStage, ScriptTestResult, ScriptVariableMutation, } from "./script/types.js";
|
|
9
9
|
export { PmAssertion, createExpectApi } from "./script/features/assertions.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACrE,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ export { runCollection } from "./runner/runCollection.js";
|
|
|
2
2
|
export { runRequest } from "./runner/requestRunner.js";
|
|
3
3
|
export { executeRequest } from "./request/executeRequest.js";
|
|
4
4
|
export { EnvStore } from "./variables/envStore.js";
|
|
5
|
-
export { resolveTemplate, resolveTemplateValue } from "./variables/resolver.js";
|
|
6
5
|
export { runScript } from "./script/legacy.js";
|
|
6
|
+
export * from "./templating/index.js";
|
|
7
7
|
export { executeScript, validateScript } from "./script/executor.js";
|
|
8
8
|
export { PmAssertion, createExpectApi } from "./script/features/assertions.js";
|
|
9
9
|
export { PendingKafkaDependencyError, isPendingKafkaValue, } from "./script/features/kafka.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAuBrE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type DatabaseConnectionMode = "detailed" | "connectionString";
|
|
2
|
+
export interface DatabaseConnectionConfig {
|
|
3
|
+
connectionMode: DatabaseConnectionMode;
|
|
4
|
+
connectionString?: string;
|
|
5
|
+
host?: string;
|
|
6
|
+
port?: number;
|
|
7
|
+
database?: string;
|
|
8
|
+
serviceName?: string;
|
|
9
|
+
username?: string;
|
|
10
|
+
password?: string;
|
|
11
|
+
ssl?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface RedisConnectionConfig {
|
|
14
|
+
host: string;
|
|
15
|
+
port: number;
|
|
16
|
+
password?: string;
|
|
17
|
+
dbIndex?: number;
|
|
18
|
+
ssl?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface KafkaConnectionConfig {
|
|
21
|
+
brokers: string[];
|
|
22
|
+
clientId: string;
|
|
23
|
+
groupId: string;
|
|
24
|
+
ssl?: boolean;
|
|
25
|
+
username?: string;
|
|
26
|
+
password?: string;
|
|
27
|
+
saslMechanism?: "plain" | "scram-sha-256" | "scram-sha-512";
|
|
28
|
+
}
|
|
29
|
+
export interface NotificationConnectionConfig {
|
|
30
|
+
webhookUrl: string;
|
|
31
|
+
defaultChannel?: string;
|
|
32
|
+
}
|
|
33
|
+
export type ConnectionRuntimeConfig = DatabaseConnectionConfig | RedisConnectionConfig | KafkaConnectionConfig | NotificationConnectionConfig;
|
|
34
|
+
//# sourceMappingURL=connection-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-config.d.ts","sourceRoot":"","sources":["../../../src/scenario-runner/adapters/connection-config.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,kBAAkB,CAAC;AAErE,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,sBAAsB,CAAC;IACvC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,GAAG,eAAe,GAAG,eAAe,CAAC;CAC7D;AAED,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,uBAAuB,GAC/B,wBAAwB,GACxB,qBAAqB,GACrB,qBAAqB,GACrB,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Connection config shapes shared by core adapter orchestration. Mirror
|
|
2
|
+
// the backend's `connection.types.ts` definitions but framework-agnostic
|
|
3
|
+
// (no Mongoose, no Oracle, etc.). Hosts flatten their richer types into
|
|
4
|
+
// these shapes when calling `resolveConnection`.
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=connection-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-config.js","sourceRoot":"","sources":["../../../src/scenario-runner/adapters/connection-config.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AACxE,iDAAiD"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ScenarioDbExecutionInput, ScenarioDbExecutionResult } from "../types.js";
|
|
2
|
+
import type { ScenarioRuntimeAdapterFactoryOptions } from "./types.js";
|
|
3
|
+
export declare const buildDbExecutor: (options: ScenarioRuntimeAdapterFactoryOptions) => (input: ScenarioDbExecutionInput) => Promise<ScenarioDbExecutionResult>;
|
|
4
|
+
//# sourceMappingURL=db-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-executor.d.ts","sourceRoot":"","sources":["../../../src/scenario-runner/adapters/db-executor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;AAEvE,eAAO,MAAM,eAAe,GAC1B,SAAS,oCAAoC,MAEtC,OAAO,wBAAwB,KAAG,OAAO,CAAC,yBAAyB,CAwCzE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Canonical DB executor — orchestrates a single Database scenario node.
|
|
2
|
+
// Resolves the workspace connection, defers the actual query execution
|
|
3
|
+
// to the host-supplied `databaseExecutor` driver (mongoose / oracledb /
|
|
4
|
+
// postgres / etc.), wraps the result in the scenario adapter shape.
|
|
5
|
+
import { withAbortAndTimeout } from "./helpers/abort.js";
|
|
6
|
+
export const buildDbExecutor = (options) => async (input) => {
|
|
7
|
+
const connection = await options.resolveConnection(input.node.data.config.connectionId);
|
|
8
|
+
try {
|
|
9
|
+
const result = await withAbortAndTimeout(options.drivers.databaseExecutor({
|
|
10
|
+
connection,
|
|
11
|
+
resolvedQuery: input.resolvedQuery,
|
|
12
|
+
}), options.nodeTimeoutMs, `Database node ${input.stepId}`, input.signal);
|
|
13
|
+
return {
|
|
14
|
+
rawResult: {
|
|
15
|
+
success: true,
|
|
16
|
+
rows: result.rows,
|
|
17
|
+
rowCount: result.rowCount,
|
|
18
|
+
},
|
|
19
|
+
dbResult: result.rows,
|
|
20
|
+
outputData: {
|
|
21
|
+
rows: result.rows,
|
|
22
|
+
rowCount: result.rowCount,
|
|
23
|
+
},
|
|
24
|
+
failureMessage: null,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
29
|
+
return {
|
|
30
|
+
rawResult: {
|
|
31
|
+
success: false,
|
|
32
|
+
rows: [],
|
|
33
|
+
rowCount: 0,
|
|
34
|
+
error: message,
|
|
35
|
+
},
|
|
36
|
+
dbResult: null,
|
|
37
|
+
outputData: null,
|
|
38
|
+
failureMessage: message || "Database query failed.",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=db-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-executor.js","sourceRoot":"","sources":["../../../src/scenario-runner/adapters/db-executor.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,uEAAuE;AACvE,wEAAwE;AACxE,oEAAoE;AAOpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,OAA6C,EAC7C,EAAE,CACF,KAAK,EAAE,KAA+B,EAAsC,EAAE;IAC5E,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAExF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,mBAAmB,CACtC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;YAC/B,UAAU;YACV,aAAa,EAAE,KAAK,CAAC,aAAa;SACnC,CAAC,EACF,OAAO,CAAC,aAAa,EACrB,iBAAiB,KAAK,CAAC,MAAM,EAAE,EAC/B,KAAK,CAAC,MAAM,CACb,CAAC;QACF,OAAO;YACL,SAAS,EAAE;gBACT,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B;YACD,QAAQ,EAAE,MAAM,CAAC,IAAI;YACrB,UAAU,EAAE;gBACV,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;aAC1B;YACD,cAAc,EAAE,IAAI;SACrB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO;YACL,SAAS,EAAE;gBACT,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,EAAE;gBACR,QAAQ,EAAE,CAAC;gBACX,KAAK,EAAE,OAAO;aACf;YACD,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,IAAI;YAChB,cAAc,EAAE,OAAO,IAAI,wBAAwB;SACpD,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AbortLikeSignal } from "../../types.js";
|
|
2
|
+
export declare const attachAbortHandler: (signal: AbortLikeSignal | undefined, handler: () => void) => (() => void);
|
|
3
|
+
export declare const withAbortAndTimeout: <T>(task: Promise<T>, timeoutMs: number, label: string, signal?: AbortLikeSignal) => Promise<T>;
|
|
4
|
+
//# sourceMappingURL=abort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../../../src/scenario-runner/adapters/helpers/abort.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,eAAe,GAAG,SAAS,EACnC,SAAS,MAAM,IAAI,KAClB,CAAC,MAAM,IAAI,CAUb,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAU,CAAC,EACzC,MAAM,OAAO,CAAC,CAAC,CAAC,EAChB,WAAW,MAAM,EACjB,OAAO,MAAM,EACb,SAAS,eAAe,KACvB,OAAO,CAAC,CAAC,CAiCR,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Abort signal + timeout helpers shared by every scenario adapter.
|
|
2
|
+
// Lifted from p_man_backend/src/modules/scenario-runner/adapters/runtime-adapters.ts
|
|
3
|
+
// (lines 56-111). Uses callman-core's existing `AbortLikeSignal` type so
|
|
4
|
+
// custom abort dispatchers (not just DOM AbortSignal) can be supplied.
|
|
5
|
+
//
|
|
6
|
+
// `attachAbortHandler` returns a detach function so callers can clean up
|
|
7
|
+
// listeners without leaking when the underlying task settles before the
|
|
8
|
+
// signal fires. `withAbortAndTimeout` wraps a task with both a timeout
|
|
9
|
+
// rejection and an abort rejection, whichever comes first.
|
|
10
|
+
export const attachAbortHandler = (signal, handler) => {
|
|
11
|
+
if (!signal?.addEventListener || !signal?.removeEventListener) {
|
|
12
|
+
return () => undefined;
|
|
13
|
+
}
|
|
14
|
+
if (signal.aborted) {
|
|
15
|
+
handler();
|
|
16
|
+
return () => undefined;
|
|
17
|
+
}
|
|
18
|
+
signal.addEventListener("abort", handler, { once: true });
|
|
19
|
+
return () => signal.removeEventListener?.("abort", handler);
|
|
20
|
+
};
|
|
21
|
+
export const withAbortAndTimeout = async (task, timeoutMs, label, signal) => await new Promise((resolve, reject) => {
|
|
22
|
+
const timer = setTimeout(() => {
|
|
23
|
+
cleanup();
|
|
24
|
+
reject(new Error(`${label} timed out after ${timeoutMs}ms`));
|
|
25
|
+
}, timeoutMs);
|
|
26
|
+
const handleAbort = () => {
|
|
27
|
+
cleanup();
|
|
28
|
+
reject(new Error(`${label} cancelled`));
|
|
29
|
+
};
|
|
30
|
+
const cleanup = () => {
|
|
31
|
+
clearTimeout(timer);
|
|
32
|
+
signal?.removeEventListener?.("abort", handleAbort);
|
|
33
|
+
};
|
|
34
|
+
if (signal?.aborted) {
|
|
35
|
+
handleAbort();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
signal?.addEventListener?.("abort", handleAbort, { once: true });
|
|
39
|
+
task.then((value) => {
|
|
40
|
+
cleanup();
|
|
41
|
+
resolve(value);
|
|
42
|
+
}, (error) => {
|
|
43
|
+
cleanup();
|
|
44
|
+
reject(error);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=abort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.js","sourceRoot":"","sources":["../../../../src/scenario-runner/adapters/helpers/abort.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,qFAAqF;AACrF,yEAAyE;AACzE,uEAAuE;AACvE,EAAE;AACF,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,2DAA2D;AAI3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAAmC,EACnC,OAAmB,EACL,EAAE;IAChB,IAAI,CAAC,MAAM,EAAE,gBAAgB,IAAI,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC;QAC9D,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;IACzB,CAAC;IACD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;QACV,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;IACzB,CAAC;IACD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,OAAO,GAAG,EAAE,CAAC,MAA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
|
|
1
|
+
import type { ScenarioRequestResponse } from "../../types.js";
|
|
2
|
+
export interface FailureMessageInput {
|
|
3
|
+
response: ScenarioRequestResponse;
|
|
4
|
+
postResponseError?: {
|
|
5
|
+
message: string;
|
|
6
|
+
} | null;
|
|
7
|
+
testsError?: {
|
|
8
|
+
message: string;
|
|
9
|
+
} | null;
|
|
10
|
+
testResults: Array<{
|
|
11
|
+
name: string;
|
|
12
|
+
status: "PASS" | "FAIL" | "SKIP";
|
|
13
|
+
error?: string;
|
|
14
|
+
}>;
|
|
15
|
+
contractResults: Array<{
|
|
16
|
+
status?: "PASS" | "FAIL" | "SKIP";
|
|
17
|
+
message?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare const buildRequestFailureMessage: ({ response, postResponseError, testsError, testResults, contractResults, }: FailureMessageInput) => string | null;
|
|
21
|
+
export declare const summarizeContractResults: (contractResults: Array<{
|
|
22
|
+
status?: "PASS" | "FAIL" | "SKIP";
|
|
23
|
+
}>) => {
|
|
24
|
+
total: number;
|
|
25
|
+
passed: number;
|
|
26
|
+
failed: number;
|
|
27
|
+
skipped: number;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=failure-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure-messages.d.ts","sourceRoot":"","sources":["../../../../src/scenario-runner/adapters/helpers/failure-messages.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,iBAAiB,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxC,WAAW,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvF,eAAe,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjF;AAED,eAAO,MAAM,0BAA0B,GAAI,4EAMxC,mBAAmB,KAAG,MAAM,GAAG,IAmCjC,CAAC;AAGF,eAAO,MAAM,wBAAwB,GACnC,iBAAiB,KAAK,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,KAC5D;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAmBlE,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Build a human-readable failure message from a request executor's outcome.
|
|
2
|
+
// Lifted from p_man_backend/src/modules/scenario-runner/adapters/runtime-adapters.ts
|
|
3
|
+
// (createFailureMessage, line 415). Pure function — same priority order as
|
|
4
|
+
// the backend's current behavior; renderer-side variant collapses into the
|
|
5
|
+
// same logic post-unification.
|
|
6
|
+
//
|
|
7
|
+
// Priority: response error → response.ok=false → first FAIL test → first
|
|
8
|
+
// FAIL contract → null (success).
|
|
9
|
+
export const buildRequestFailureMessage = ({ response, postResponseError, testsError, testResults, contractResults, }) => {
|
|
10
|
+
// Backend's current behavior elevates explicit script errors above
|
|
11
|
+
// response/contract failures so the operator sees the root cause first.
|
|
12
|
+
if (postResponseError?.message) {
|
|
13
|
+
return `Post-response script failed: ${postResponseError.message}`;
|
|
14
|
+
}
|
|
15
|
+
if (testsError?.message) {
|
|
16
|
+
return `Tests script failed: ${testsError.message}`;
|
|
17
|
+
}
|
|
18
|
+
if (!response.ok || response.errorMessage) {
|
|
19
|
+
if (response.errorMessage?.trim()) {
|
|
20
|
+
return response.errorMessage;
|
|
21
|
+
}
|
|
22
|
+
if (response.status > 0) {
|
|
23
|
+
return `Request failed with status ${response.status}`;
|
|
24
|
+
}
|
|
25
|
+
return "Request execution failed.";
|
|
26
|
+
}
|
|
27
|
+
const failedTest = testResults.find((entry) => entry.status === "FAIL");
|
|
28
|
+
if (failedTest) {
|
|
29
|
+
return failedTest.error
|
|
30
|
+
? `Script test failed: ${failedTest.name} (${failedTest.error})`
|
|
31
|
+
: `Script test failed: ${failedTest.name}`;
|
|
32
|
+
}
|
|
33
|
+
const failedContract = contractResults.find((entry) => entry?.status === "FAIL");
|
|
34
|
+
if (failedContract) {
|
|
35
|
+
return failedContract.message
|
|
36
|
+
? `Contract validation failed: ${failedContract.message}`
|
|
37
|
+
: "Contract validation failed.";
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
41
|
+
// Convenience helper for callers that want the contract counts in one go.
|
|
42
|
+
export const summarizeContractResults = (contractResults) => {
|
|
43
|
+
let passed = 0;
|
|
44
|
+
let failed = 0;
|
|
45
|
+
let skipped = 0;
|
|
46
|
+
for (const entry of contractResults) {
|
|
47
|
+
if (entry?.status === "PASS") {
|
|
48
|
+
passed += 1;
|
|
49
|
+
}
|
|
50
|
+
else if (entry?.status === "FAIL") {
|
|
51
|
+
failed += 1;
|
|
52
|
+
}
|
|
53
|
+
else if (entry?.status === "SKIP") {
|
|
54
|
+
skipped += 1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
total: contractResults.length,
|
|
59
|
+
passed,
|
|
60
|
+
failed,
|
|
61
|
+
skipped,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=failure-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure-messages.js","sourceRoot":"","sources":["../../../../src/scenario-runner/adapters/helpers/failure-messages.ts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E,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IACjF,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,cAAc,CAAC,OAAO;YAC3B,CAAC,CAAC,+BAA+B,cAAc,CAAC,OAAO,EAAE;YACzD,CAAC,CAAC,6BAA6B,CAAC;IACpC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,eAA6D,EACO,EAAE;IACtE,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,KAAK,IAAI,eAAe,EAAE,CAAC;QACpC,IAAI,KAAK,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;YAC7B,MAAM,IAAI,CAAC,CAAC;QACd,CAAC;aAAM,IAAI,KAAK,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,CAAC,CAAC;QACd,CAAC;aAAM,IAAI,KAAK,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO;QACL,KAAK,EAAE,eAAe,CAAC,MAAM;QAC7B,MAAM;QACN,MAAM;QACN,OAAO;KACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ScenarioVariableMutation } from "../../types.js";
|
|
2
|
+
export interface MutableScopes {
|
|
3
|
+
environment: Record<string, string>;
|
|
4
|
+
globals: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
export declare const applyVariableMutations: (scopes: MutableScopes, mutations: ScenarioVariableMutation[]) => void;
|
|
7
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../../src/scenario-runner/adapters/helpers/mutations.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,sBAAsB,GACjC,QAAQ,aAAa,EACrB,WAAW,wBAAwB,EAAE,KACpC,IAgBF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Apply pm.environment / pm.globals mutations emitted by a scenario script
|
|
2
|
+
// onto plain mutable record instances. Pure function — no async, no side
|
|
3
|
+
// effects beyond the supplied records. Used by every executor that runs a
|
|
4
|
+
// pre/post/test script and needs to thread the mutated state forward.
|
|
5
|
+
//
|
|
6
|
+
// Mutation log shape comes from `ScenarioVariableMutation` in canonical
|
|
7
|
+
// types (set/unset, scope=environment|global). The log itself is produced
|
|
8
|
+
// by the script sandbox; this helper only consumes it.
|
|
9
|
+
export const applyVariableMutations = (scopes, mutations) => {
|
|
10
|
+
for (const mutation of mutations) {
|
|
11
|
+
if (mutation.scope === "environment") {
|
|
12
|
+
if (mutation.type === "unset") {
|
|
13
|
+
delete scopes.environment[mutation.key];
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
scopes.environment[mutation.key] = mutation.value ?? "";
|
|
17
|
+
}
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (mutation.type === "unset") {
|
|
21
|
+
delete scopes.globals[mutation.key];
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
scopes.globals[mutation.key] = mutation.value ?? "";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=mutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../../src/scenario-runner/adapters/helpers/mutations.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,uDAAuD;AASvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,MAAqB,EACrB,SAAqC,EAC/B,EAAE;IACR,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,KAAK,KAAK,aAAa,EAAE,CAAC;YACrC,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAC9B,OAAO,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;YAC1D,CAAC;YACD,SAAS;QACX,CAAC;QACD,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC9B,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;QACtD,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ExecuteRequestResult } from "../../../types/index.js";
|
|
2
|
+
import type { RequestScenarioNode, ScenarioRequestResponse } from "../../types.js";
|
|
3
|
+
import type { ScriptRequestState, ScriptResponseState } from "../../../script/types.js";
|
|
4
|
+
export declare const isJsonLike: (value: string) => boolean;
|
|
5
|
+
export declare const safeJsonParse: (value: string) => unknown | null;
|
|
6
|
+
export declare const normalizeHeaderPairs: (headers: Record<string, string>) => Array<{
|
|
7
|
+
key: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const findHeader: (headers: Record<string, string>, name: string) => string;
|
|
11
|
+
export declare const normalizeCookies: (headers: Record<string, string>) => string[];
|
|
12
|
+
export declare const normalizeResponseValue: (value: unknown) => string;
|
|
13
|
+
export declare const applyAuthToRequest: (request: ScriptRequestState, auth: RequestScenarioNode["data"]["config"]["auth"] | undefined, resolveValue: (value: string) => string) => void;
|
|
14
|
+
export interface BodyResolverHelpers {
|
|
15
|
+
replaceScenarioTemplateTokensForJsonValidation: (raw: string) => string;
|
|
16
|
+
resolveScenarioJsonTemplateString: (raw: string, values: Record<string, string>) => string;
|
|
17
|
+
resolveScenarioTemplateString: (raw: string, values: Record<string, string>) => string;
|
|
18
|
+
}
|
|
19
|
+
export declare const resolveRequestBody: (request: ScriptRequestState, helpers: BodyResolverHelpers, templateValues: Record<string, string>) => unknown;
|
|
20
|
+
export declare const createRequestStateFromNode: (node: RequestScenarioNode) => ScriptRequestState;
|
|
21
|
+
export declare const normalizeRequestForExecution: (request: ScriptRequestState, auth: RequestScenarioNode["data"]["config"]["auth"] | undefined, helpers: BodyResolverHelpers, templateValues: Record<string, string>) => {
|
|
22
|
+
method: string;
|
|
23
|
+
url: string;
|
|
24
|
+
headers: Record<string, string>;
|
|
25
|
+
query: Record<string, string>;
|
|
26
|
+
body: unknown;
|
|
27
|
+
};
|
|
28
|
+
export declare const normalizeExecuteRequestFailure: (error: unknown) => ExecuteRequestResult;
|
|
29
|
+
export declare const toRequestResponse: (executionResult: ExecuteRequestResult) => ScenarioRequestResponse;
|
|
30
|
+
export declare const toRequestScriptResponse: (response: ScenarioRequestResponse) => ScriptResponseState;
|
|
31
|
+
//# sourceMappingURL=request-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-helpers.d.ts","sourceRoot":"","sources":["../../../../src/scenario-runner/adapters/helpers/request-helpers.ts"],"names":[],"mappings":"AAQA,OA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