callman-core 1.35.0 → 1.36.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/ai-packs/feature-policy.md +1 -6
- package/ai-packs/pm-api.md +238 -98
- package/ai-packs/sandbox-globals.md +6 -5
- package/dist/ai/prompts/fragments.d.ts.map +1 -1
- package/dist/ai/prompts/fragments.js +0 -1
- package/dist/ai/prompts/fragments.js.map +1 -1
- package/dist/ai/prompts/unified.js +1 -1
- package/dist/ai/prompts/unified.js.map +1 -1
- package/dist/ai/types.d.ts +1 -1
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/types.js +1 -1
- package/dist/ai/types.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/runner/requestRunner.d.ts.map +1 -1
- package/dist/runner/requestRunner.js +33 -0
- package/dist/runner/requestRunner.js.map +1 -1
- package/dist/runner/runCollection.d.ts.map +1 -1
- package/dist/runner/runCollection.js +46 -9
- package/dist/runner/runCollection.js.map +1 -1
- package/dist/runner/runRequestWithDataset.d.ts.map +1 -1
- package/dist/runner/runRequestWithDataset.js +3 -2
- package/dist/runner/runRequestWithDataset.js.map +1 -1
- package/dist/scenario-runner/adapters/request-executor.d.ts.map +1 -1
- package/dist/scenario-runner/adapters/request-executor.js +7 -0
- package/dist/scenario-runner/adapters/request-executor.js.map +1 -1
- package/dist/scenario-runner/runScenario.d.ts.map +1 -1
- package/dist/scenario-runner/runScenario.js +4 -0
- package/dist/scenario-runner/runScenario.js.map +1 -1
- package/dist/scenario-runner/types.d.ts +11 -0
- package/dist/scenario-runner/types.d.ts.map +1 -1
- package/dist/script/chain.d.ts +2 -0
- package/dist/script/chain.d.ts.map +1 -1
- package/dist/script/chain.js +2 -0
- package/dist/script/chain.js.map +1 -1
- package/dist/script/errors.js +6 -6
- package/dist/script/errors.js.map +1 -1
- package/dist/script/executor.d.ts.map +1 -1
- package/dist/script/executor.js +284 -64
- package/dist/script/executor.js.map +1 -1
- package/dist/script/features/collectionVariables.d.ts +4 -4
- package/dist/script/features/collectionVariables.d.ts.map +1 -1
- package/dist/script/features/collectionVariables.js +20 -11
- package/dist/script/features/collectionVariables.js.map +1 -1
- package/dist/script/features/environment.d.ts +4 -4
- package/dist/script/features/environment.d.ts.map +1 -1
- package/dist/script/features/environment.js +20 -11
- package/dist/script/features/environment.js.map +1 -1
- package/dist/script/features/feature-policy.d.ts +1 -1
- package/dist/script/features/feature-policy.d.ts.map +1 -1
- package/dist/script/features/feature-policy.js +2 -2
- package/dist/script/features/feature-policy.js.map +1 -1
- package/dist/script/features/info.d.ts.map +1 -1
- package/dist/script/features/info.js +6 -3
- package/dist/script/features/info.js.map +1 -1
- package/dist/script/features/iterationData.d.ts +12 -0
- package/dist/script/features/iterationData.d.ts.map +1 -0
- package/dist/script/features/iterationData.js +28 -0
- package/dist/script/features/iterationData.js.map +1 -0
- package/dist/script/features/legacyPostman.d.ts +14 -0
- package/dist/script/features/legacyPostman.d.ts.map +1 -0
- package/dist/script/features/legacyPostman.js +106 -0
- package/dist/script/features/legacyPostman.js.map +1 -0
- package/dist/script/features/log.d.ts +35 -8
- package/dist/script/features/log.d.ts.map +1 -1
- package/dist/script/features/log.js +343 -27
- package/dist/script/features/log.js.map +1 -1
- package/dist/script/features/tests.d.ts +7 -8
- package/dist/script/features/tests.d.ts.map +1 -1
- package/dist/script/features/tests.js +90 -64
- package/dist/script/features/tests.js.map +1 -1
- package/dist/script/features/timers.d.ts +7 -1
- package/dist/script/features/timers.d.ts.map +1 -1
- package/dist/script/features/timers.js +17 -5
- package/dist/script/features/timers.js.map +1 -1
- package/dist/script/features/variables.d.ts +19 -4
- package/dist/script/features/variables.d.ts.map +1 -1
- package/dist/script/features/variables.js +22 -6
- package/dist/script/features/variables.js.map +1 -1
- package/dist/script/features/visualizer.d.ts +15 -0
- package/dist/script/features/visualizer.d.ts.map +1 -0
- package/dist/script/features/visualizer.js +52 -0
- package/dist/script/features/visualizer.js.map +1 -0
- package/dist/script/isolated-runner.d.ts +4 -1
- package/dist/script/isolated-runner.d.ts.map +1 -1
- package/dist/script/isolated-runner.js +26 -2
- package/dist/script/isolated-runner.js.map +1 -1
- package/dist/script/legacy.d.ts +1 -0
- package/dist/script/legacy.d.ts.map +1 -1
- package/dist/script/legacy.js +12 -2
- package/dist/script/legacy.js.map +1 -1
- package/dist/script/pm-api-declarations.d.ts +45 -0
- package/dist/script/pm-api-declarations.d.ts.map +1 -0
- package/dist/script/pm-api-declarations.js +1963 -0
- package/dist/script/pm-api-declarations.js.map +1 -0
- package/dist/script/pm-api-metadata.d.ts +3 -1
- package/dist/script/pm-api-metadata.d.ts.map +1 -1
- package/dist/script/pm-api-metadata.js +336 -106
- package/dist/script/pm-api-metadata.js.map +1 -1
- package/dist/script/pm-api-reference.d.ts.map +1 -1
- package/dist/script/pm-api-reference.js +24 -8
- package/dist/script/pm-api-reference.js.map +1 -1
- package/dist/script/postman/chaiCompat.d.ts +4 -0
- package/dist/script/postman/chaiCompat.d.ts.map +1 -0
- package/dist/script/postman/chaiCompat.js +176 -0
- package/dist/script/postman/chaiCompat.js.map +1 -0
- package/dist/script/postman/cookies.d.ts +36 -0
- package/dist/script/postman/cookies.d.ts.map +1 -0
- package/dist/script/postman/cookies.js +163 -0
- package/dist/script/postman/cookies.js.map +1 -0
- package/dist/script/postman/modules.d.ts +16 -0
- package/dist/script/postman/modules.d.ts.map +1 -0
- package/dist/script/postman/modules.js +114 -0
- package/dist/script/postman/modules.js.map +1 -0
- package/dist/script/postman/proxies.d.ts +13 -0
- package/dist/script/postman/proxies.d.ts.map +1 -0
- package/dist/script/postman/proxies.js +88 -0
- package/dist/script/postman/proxies.js.map +1 -0
- package/dist/script/postman/requestAdapter.d.ts +7 -0
- package/dist/script/postman/requestAdapter.d.ts.map +1 -0
- package/dist/script/postman/requestAdapter.js +223 -0
- package/dist/script/postman/requestAdapter.js.map +1 -0
- package/dist/script/postman/responseAdapter.d.ts +5 -0
- package/dist/script/postman/responseAdapter.d.ts.map +1 -0
- package/dist/script/postman/responseAdapter.js +78 -0
- package/dist/script/postman/responseAdapter.js.map +1 -0
- package/dist/script/postman/runtime.d.ts +22 -0
- package/dist/script/postman/runtime.d.ts.map +1 -0
- package/dist/script/postman/runtime.js +122 -0
- package/dist/script/postman/runtime.js.map +1 -0
- package/dist/script/scope.d.ts +5 -1
- package/dist/script/scope.d.ts.map +1 -1
- package/dist/script/scope.js +47 -5
- package/dist/script/scope.js.map +1 -1
- package/dist/script/types.d.ts +33 -14
- package/dist/script/types.d.ts.map +1 -1
- package/dist/script/worker-entry.js +9 -0
- package/dist/script/worker-entry.js.map +1 -1
- package/dist/script/worker-pool.d.ts +3 -1
- package/dist/script/worker-pool.d.ts.map +1 -1
- package/dist/script/worker-pool.js +23 -2
- package/dist/script/worker-pool.js.map +1 -1
- package/dist/templating/generator-metadata.d.ts +1 -0
- package/dist/templating/generator-metadata.d.ts.map +1 -1
- package/dist/templating/generator-metadata.js +14 -0
- package/dist/templating/generator-metadata.js.map +1 -1
- package/dist/templating/postman-dynamic-catalog.d.ts +7 -0
- package/dist/templating/postman-dynamic-catalog.d.ts.map +1 -0
- package/dist/templating/postman-dynamic-catalog.js +126 -0
- package/dist/templating/postman-dynamic-catalog.js.map +1 -0
- package/dist/templating/postman-generators.d.ts +9 -0
- package/dist/templating/postman-generators.d.ts.map +1 -1
- package/dist/templating/postman-generators.js +10 -1
- package/dist/templating/postman-generators.js.map +1 -1
- package/dist/types/index.d.ts +22 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/variables/replaceIn.d.ts +10 -0
- package/dist/variables/replaceIn.d.ts.map +1 -0
- package/dist/variables/replaceIn.js +106 -0
- package/dist/variables/replaceIn.js.map +1 -0
- package/dist-cjs/ai/prompts/fragments.js +0 -1
- package/dist-cjs/ai/prompts/fragments.js.map +1 -1
- package/dist-cjs/ai/prompts/unified.js +1 -1
- package/dist-cjs/ai/prompts/unified.js.map +1 -1
- package/dist-cjs/ai/types.js +1 -1
- package/dist-cjs/ai/types.js.map +1 -1
- package/dist-cjs/index.js +17 -5
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/runner/requestRunner.js +33 -0
- package/dist-cjs/runner/requestRunner.js.map +1 -1
- package/dist-cjs/runner/runCollection.js +46 -9
- package/dist-cjs/runner/runCollection.js.map +1 -1
- package/dist-cjs/runner/runRequestWithDataset.js +3 -2
- package/dist-cjs/runner/runRequestWithDataset.js.map +1 -1
- package/dist-cjs/scenario-runner/adapters/request-executor.js +7 -0
- package/dist-cjs/scenario-runner/adapters/request-executor.js.map +1 -1
- package/dist-cjs/scenario-runner/runScenario.js +4 -0
- package/dist-cjs/scenario-runner/runScenario.js.map +1 -1
- package/dist-cjs/script/chain.js +2 -0
- package/dist-cjs/script/chain.js.map +1 -1
- package/dist-cjs/script/errors.js +6 -6
- package/dist-cjs/script/errors.js.map +1 -1
- package/dist-cjs/script/executor.js +284 -64
- package/dist-cjs/script/executor.js.map +1 -1
- package/dist-cjs/script/features/collectionVariables.js +20 -11
- package/dist-cjs/script/features/collectionVariables.js.map +1 -1
- package/dist-cjs/script/features/environment.js +20 -11
- package/dist-cjs/script/features/environment.js.map +1 -1
- package/dist-cjs/script/features/feature-policy.js +2 -2
- package/dist-cjs/script/features/feature-policy.js.map +1 -1
- package/dist-cjs/script/features/info.js +6 -3
- package/dist-cjs/script/features/info.js.map +1 -1
- package/dist-cjs/script/features/iterationData.js +32 -0
- package/dist-cjs/script/features/iterationData.js.map +1 -0
- package/dist-cjs/script/features/legacyPostman.js +112 -0
- package/dist-cjs/script/features/legacyPostman.js.map +1 -0
- package/dist-cjs/script/features/log.js +347 -28
- package/dist-cjs/script/features/log.js.map +1 -1
- package/dist-cjs/script/features/tests.js +90 -64
- package/dist-cjs/script/features/tests.js.map +1 -1
- package/dist-cjs/script/features/timers.js +17 -5
- package/dist-cjs/script/features/timers.js.map +1 -1
- package/dist-cjs/script/features/variables.js +22 -6
- package/dist-cjs/script/features/variables.js.map +1 -1
- package/dist-cjs/script/features/visualizer.js +56 -0
- package/dist-cjs/script/features/visualizer.js.map +1 -0
- package/dist-cjs/script/isolated-runner.js +26 -2
- package/dist-cjs/script/isolated-runner.js.map +1 -1
- package/dist-cjs/script/legacy.js +14 -3
- package/dist-cjs/script/legacy.js.map +1 -1
- package/dist-cjs/script/pm-api-declarations.js +1969 -0
- package/dist-cjs/script/pm-api-declarations.js.map +1 -0
- package/dist-cjs/script/pm-api-metadata.js +336 -106
- package/dist-cjs/script/pm-api-metadata.js.map +1 -1
- package/dist-cjs/script/pm-api-reference.js +24 -8
- package/dist-cjs/script/pm-api-reference.js.map +1 -1
- package/dist-cjs/script/postman/chaiCompat.js +181 -0
- package/dist-cjs/script/postman/chaiCompat.js.map +1 -0
- package/dist-cjs/script/postman/cookies.js +170 -0
- package/dist-cjs/script/postman/cookies.js.map +1 -0
- package/dist-cjs/script/postman/modules.js +123 -0
- package/dist-cjs/script/postman/modules.js.map +1 -0
- package/dist-cjs/script/postman/proxies.js +93 -0
- package/dist-cjs/script/postman/proxies.js.map +1 -0
- package/dist-cjs/script/postman/requestAdapter.js +227 -0
- package/dist-cjs/script/postman/requestAdapter.js.map +1 -0
- package/dist-cjs/script/postman/responseAdapter.js +83 -0
- package/dist-cjs/script/postman/responseAdapter.js.map +1 -0
- package/dist-cjs/script/postman/runtime.js +132 -0
- package/dist-cjs/script/postman/runtime.js.map +1 -0
- package/dist-cjs/script/scope.js +47 -5
- package/dist-cjs/script/scope.js.map +1 -1
- package/dist-cjs/script/worker-entry.js +9 -0
- package/dist-cjs/script/worker-entry.js.map +1 -1
- package/dist-cjs/script/worker-pool.js +23 -2
- package/dist-cjs/script/worker-pool.js.map +1 -1
- package/dist-cjs/templating/generator-metadata.js +15 -1
- package/dist-cjs/templating/generator-metadata.js.map +1 -1
- package/dist-cjs/templating/postman-dynamic-catalog.js +129 -0
- package/dist-cjs/templating/postman-dynamic-catalog.js.map +1 -0
- package/dist-cjs/templating/postman-generators.js +13 -3
- package/dist-cjs/templating/postman-generators.js.map +1 -1
- package/dist-cjs/variables/replaceIn.js +111 -0
- package/dist-cjs/variables/replaceIn.js.map +1 -0
- package/package.json +12 -2
|
@@ -0,0 +1,1969 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Authoritative TypeScript declaration text for the script sandbox.
|
|
3
|
+
//
|
|
4
|
+
// Editors (Monaco `addExtraLib`) feed `getPmApiDeclarations(...)` to their TS
|
|
5
|
+
// worker so autocomplete, hover and diagnostics describe EXACTLY what the
|
|
6
|
+
// runtime exposes. The file is browser-safe on purpose: strings only, no
|
|
7
|
+
// imports, no Node APIs.
|
|
8
|
+
//
|
|
9
|
+
// Conventions
|
|
10
|
+
// • The editor is assumed to use `lib: ["es2022"]` WITHOUT `dom`, so every web
|
|
11
|
+
// global the sandbox provides (console, URL, TextEncoder, crypto, …) is
|
|
12
|
+
// declared here, with the types the SANDBOX has — not the DOM's.
|
|
13
|
+
// • `pm`, `cm` and `callman` are the same object.
|
|
14
|
+
// • `pm.response.json()` returns `CallmanResponseBody`, declared in a SEPARATE
|
|
15
|
+
// chunk (CALLMAN_RESPONSE_BODY_DECLARATION) so an editor can replace it with
|
|
16
|
+
// a type inferred from the last response body. getPmApiDeclarations() does
|
|
17
|
+
// NOT contain it — always add one of the two.
|
|
18
|
+
// • The runtime is the source of truth. `scripts/check-pm-api-drift.mjs`
|
|
19
|
+
// reflects the real sandbox objects and fails CI when PM_API_DECLARED_MEMBERS
|
|
20
|
+
// (and therefore these declarations) fall behind.
|
|
21
|
+
//
|
|
22
|
+
// When the sandbox gains or loses a member, update the declaration AND
|
|
23
|
+
// PM_API_DECLARED_MEMBERS in the same commit.
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.PM_API_DECLARED_MEMBERS = exports.getScenarioLabelDeclarations = exports.getPmApiDeclarationLibs = exports.getPmApiDeclarations = exports.PM_API_RESERVED_NAMES = exports.PM_REQUIRABLE_MODULE_ALIASES = exports.PM_REQUIRABLE_MODULES = exports.CALLMAN_RESPONSE_BODY_DECLARATION_PATH = exports.PM_API_DECLARATIONS_PATH = exports.CALLMAN_RESPONSE_BODY_DECLARATION = void 0;
|
|
26
|
+
/** Default type of `pm.response.json()`. Editors replace this chunk with a type inferred from a sample body. */
|
|
27
|
+
exports.CALLMAN_RESPONSE_BODY_DECLARATION = "type CallmanResponseBody = any;";
|
|
28
|
+
/** Virtual file paths editors can use for the two chunks. */
|
|
29
|
+
exports.PM_API_DECLARATIONS_PATH = "file:///callman/pm-api.d.ts";
|
|
30
|
+
exports.CALLMAN_RESPONSE_BODY_DECLARATION_PATH = "file:///callman/response-body.d.ts";
|
|
31
|
+
/** Modules `require()` / `pm.require()` can load (mirrors postman/modules.ts). */
|
|
32
|
+
exports.PM_REQUIRABLE_MODULES = [
|
|
33
|
+
"lodash",
|
|
34
|
+
"moment",
|
|
35
|
+
"chai",
|
|
36
|
+
"ajv",
|
|
37
|
+
"cheerio",
|
|
38
|
+
"xml2js",
|
|
39
|
+
"tv4",
|
|
40
|
+
"uuid",
|
|
41
|
+
"csv-parse/lib/sync",
|
|
42
|
+
"postman-collection",
|
|
43
|
+
"crypto-js",
|
|
44
|
+
"atob",
|
|
45
|
+
"btoa",
|
|
46
|
+
"path",
|
|
47
|
+
"assert",
|
|
48
|
+
"buffer",
|
|
49
|
+
"util",
|
|
50
|
+
"url",
|
|
51
|
+
"querystring",
|
|
52
|
+
"string_decoder",
|
|
53
|
+
"stream",
|
|
54
|
+
"events",
|
|
55
|
+
"punycode",
|
|
56
|
+
"timers",
|
|
57
|
+
];
|
|
58
|
+
/** Alternative spellings accepted by the runtime (resolved to the module above). */
|
|
59
|
+
exports.PM_REQUIRABLE_MODULE_ALIASES = {
|
|
60
|
+
"string-decoder": "string_decoder",
|
|
61
|
+
"csv-parse/sync": "csv-parse/lib/sync",
|
|
62
|
+
"csv-parse": "csv-parse/lib/sync",
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Names a scenario node label can NOT use as a global (mirrors RESERVED_LABEL_NAMES
|
|
66
|
+
* in scope.ts; the drift check keeps the two equal).
|
|
67
|
+
*/
|
|
68
|
+
exports.PM_API_RESERVED_NAMES = [
|
|
69
|
+
"AbortController", "AbortSignal", "AggregateError", "Array", "ArrayBuffer", "BigInt", "BigInt64Array",
|
|
70
|
+
"BigUint64Array", "Blob", "Boolean", "Buffer", "DOMException", "DataView", "Date", "Error", "EvalError",
|
|
71
|
+
"Event", "EventTarget", "File", "FinalizationRegistry", "Float32Array", "Float64Array", "Function",
|
|
72
|
+
"Infinity", "Int16Array", "Int32Array", "Int8Array", "Intl", "JSON", "Map", "Math", "NaN", "Number",
|
|
73
|
+
"Object", "Promise", "Proxy", "RangeError", "ReadableStream", "ReferenceError", "Reflect", "RegExp",
|
|
74
|
+
"Set", "String", "Symbol", "SyntaxError", "TextDecoder", "TextDecoderStream", "TextEncoder",
|
|
75
|
+
"TextEncoderStream", "TransformStream", "TypeError", "URIError", "URL", "URLSearchParams", "Uint16Array",
|
|
76
|
+
"Uint32Array", "Uint8Array", "Uint8ClampedArray", "WeakMap", "WeakRef", "WeakSet", "WebSocket", "Worker",
|
|
77
|
+
"WritableStream", "XMLHttpRequest", "atob", "btoa", "callman", "cm", "console", "crypto", "db",
|
|
78
|
+
"decodeURI", "decodeURIComponent", "document", "encodeURI", "encodeURIComponent", "env", "escape",
|
|
79
|
+
"eval", "expect", "exports", "fetch", "global", "globalThis", "importScripts", "isFinite", "isNaN",
|
|
80
|
+
"kafka", "module", "navigator", "parseFloat", "parseInt", "pm", "postman", "process", "queueMicrotask",
|
|
81
|
+
"redis", "request", "require", "response", "self", "structuredClone", "test", "undefined", "unescape",
|
|
82
|
+
"window", "workflow",
|
|
83
|
+
];
|
|
84
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
85
|
+
// Web / Node globals the sandbox provides (lib es2022 has none of them)
|
|
86
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
87
|
+
const PLATFORM_GLOBALS = `
|
|
88
|
+
interface ScriptConsole {
|
|
89
|
+
/** Print to the script console (also: info, warn, error, debug). Supports %s %d %i %f %j %o %O %c. */
|
|
90
|
+
log(...data: any[]): void;
|
|
91
|
+
info(...data: any[]): void;
|
|
92
|
+
warn(...data: any[]): void;
|
|
93
|
+
error(...data: any[]): void;
|
|
94
|
+
debug(...data: any[]): void;
|
|
95
|
+
/** Log with a stack trace. */
|
|
96
|
+
trace(...data: any[]): void;
|
|
97
|
+
/** Log an error when the condition is falsy. */
|
|
98
|
+
assert(condition?: any, ...data: any[]): void;
|
|
99
|
+
count(label?: string): void;
|
|
100
|
+
countReset(label?: string): void;
|
|
101
|
+
time(label?: string): void;
|
|
102
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
103
|
+
timeEnd(label?: string): void;
|
|
104
|
+
/** Indent following output until groupEnd(). */
|
|
105
|
+
group(...label: any[]): void;
|
|
106
|
+
groupCollapsed(...label: any[]): void;
|
|
107
|
+
groupEnd(): void;
|
|
108
|
+
/** Render an array of objects / arrays as a table. */
|
|
109
|
+
table(data: any, columns?: string[]): void;
|
|
110
|
+
dir(item?: any, options?: any): void;
|
|
111
|
+
dirxml(...data: any[]): void;
|
|
112
|
+
/** Clear the console buffer of the host. */
|
|
113
|
+
clear(): void;
|
|
114
|
+
}
|
|
115
|
+
declare const console: ScriptConsole;
|
|
116
|
+
|
|
117
|
+
declare function atob(data: string): string;
|
|
118
|
+
declare function btoa(data: string): string;
|
|
119
|
+
declare function structuredClone<T>(value: T, options?: { transfer?: any[] }): T;
|
|
120
|
+
declare function queueMicrotask(callback: () => void): void;
|
|
121
|
+
|
|
122
|
+
/** Timers are per-run wrappers: delays are capped at 60 s and everything pending is cancelled when the script ends. */
|
|
123
|
+
declare function setTimeout(handler: (...args: any[]) => void, delay?: number, ...args: any[]): number;
|
|
124
|
+
declare function clearTimeout(id: number | undefined): void;
|
|
125
|
+
declare function setInterval(handler: (...args: any[]) => void, delay?: number, ...args: any[]): number;
|
|
126
|
+
declare function clearInterval(id: number | undefined): void;
|
|
127
|
+
declare function setImmediate(handler: (...args: any[]) => void, ...args: any[]): number;
|
|
128
|
+
declare function clearImmediate(id: number | undefined): void;
|
|
129
|
+
|
|
130
|
+
declare class TextEncoder {
|
|
131
|
+
readonly encoding: string;
|
|
132
|
+
encode(input?: string): Uint8Array;
|
|
133
|
+
encodeInto(source: string, destination: Uint8Array): { read: number; written: number };
|
|
134
|
+
}
|
|
135
|
+
declare class TextDecoder {
|
|
136
|
+
constructor(label?: string, options?: { fatal?: boolean; ignoreBOM?: boolean });
|
|
137
|
+
readonly encoding: string;
|
|
138
|
+
readonly fatal: boolean;
|
|
139
|
+
readonly ignoreBOM: boolean;
|
|
140
|
+
decode(input?: ArrayBuffer | ArrayBufferView, options?: { stream?: boolean }): string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
declare class URLSearchParams implements Iterable<[string, string]> {
|
|
144
|
+
constructor(init?: string | string[][] | Record<string, string> | URLSearchParams);
|
|
145
|
+
readonly size: number;
|
|
146
|
+
append(name: string, value: string): void;
|
|
147
|
+
delete(name: string, value?: string): void;
|
|
148
|
+
get(name: string): string | null;
|
|
149
|
+
getAll(name: string): string[];
|
|
150
|
+
has(name: string, value?: string): boolean;
|
|
151
|
+
set(name: string, value: string): void;
|
|
152
|
+
sort(): void;
|
|
153
|
+
forEach(callback: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void;
|
|
154
|
+
entries(): IterableIterator<[string, string]>;
|
|
155
|
+
keys(): IterableIterator<string>;
|
|
156
|
+
values(): IterableIterator<string>;
|
|
157
|
+
toString(): string;
|
|
158
|
+
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
159
|
+
}
|
|
160
|
+
declare class URL {
|
|
161
|
+
constructor(url: string | URL, base?: string | URL);
|
|
162
|
+
static canParse(url: string, base?: string): boolean;
|
|
163
|
+
hash: string;
|
|
164
|
+
host: string;
|
|
165
|
+
hostname: string;
|
|
166
|
+
href: string;
|
|
167
|
+
readonly origin: string;
|
|
168
|
+
password: string;
|
|
169
|
+
pathname: string;
|
|
170
|
+
port: string;
|
|
171
|
+
protocol: string;
|
|
172
|
+
search: string;
|
|
173
|
+
readonly searchParams: URLSearchParams;
|
|
174
|
+
username: string;
|
|
175
|
+
toString(): string;
|
|
176
|
+
toJSON(): string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
declare class Event {
|
|
180
|
+
constructor(type: string, init?: { bubbles?: boolean; cancelable?: boolean; composed?: boolean });
|
|
181
|
+
readonly type: string;
|
|
182
|
+
readonly defaultPrevented: boolean;
|
|
183
|
+
preventDefault(): void;
|
|
184
|
+
stopPropagation(): void;
|
|
185
|
+
}
|
|
186
|
+
declare class EventTarget {
|
|
187
|
+
addEventListener(type: string, listener: ((event: any) => void) | { handleEvent(event: any): void } | null, options?: boolean | { once?: boolean; passive?: boolean; signal?: AbortSignal }): void;
|
|
188
|
+
removeEventListener(type: string, listener: ((event: any) => void) | { handleEvent(event: any): void } | null, options?: boolean | { capture?: boolean }): void;
|
|
189
|
+
dispatchEvent(event: Event): boolean;
|
|
190
|
+
}
|
|
191
|
+
declare class DOMException extends Error {
|
|
192
|
+
constructor(message?: string, name?: string);
|
|
193
|
+
readonly code: number;
|
|
194
|
+
}
|
|
195
|
+
declare class AbortSignal extends EventTarget {
|
|
196
|
+
static abort(reason?: any): AbortSignal;
|
|
197
|
+
static timeout(milliseconds: number): AbortSignal;
|
|
198
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
199
|
+
readonly aborted: boolean;
|
|
200
|
+
readonly reason: any;
|
|
201
|
+
onabort: ((event: Event) => void) | null;
|
|
202
|
+
throwIfAborted(): void;
|
|
203
|
+
}
|
|
204
|
+
declare class AbortController {
|
|
205
|
+
readonly signal: AbortSignal;
|
|
206
|
+
abort(reason?: any): void;
|
|
207
|
+
}
|
|
208
|
+
declare class Blob {
|
|
209
|
+
constructor(blobParts?: Array<string | ArrayBuffer | ArrayBufferView | Blob>, options?: { type?: string; endings?: "transparent" | "native" });
|
|
210
|
+
readonly size: number;
|
|
211
|
+
readonly type: string;
|
|
212
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
213
|
+
text(): Promise<string>;
|
|
214
|
+
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
215
|
+
stream(): ReadableStream<Uint8Array>;
|
|
216
|
+
}
|
|
217
|
+
declare class File extends Blob {
|
|
218
|
+
constructor(fileBits: Array<string | ArrayBuffer | ArrayBufferView | Blob>, fileName: string, options?: { type?: string; lastModified?: number });
|
|
219
|
+
readonly name: string;
|
|
220
|
+
readonly lastModified: number;
|
|
221
|
+
}
|
|
222
|
+
declare class ReadableStream<R = any> {
|
|
223
|
+
constructor(underlyingSource?: any, strategy?: any);
|
|
224
|
+
readonly locked: boolean;
|
|
225
|
+
cancel(reason?: any): Promise<void>;
|
|
226
|
+
getReader(): { read(): Promise<{ done: boolean; value?: R }>; releaseLock(): void; cancel(reason?: any): Promise<void>; closed: Promise<void> };
|
|
227
|
+
pipeThrough<T>(transform: { readable: ReadableStream<T>; writable: WritableStream<R> }, options?: any): ReadableStream<T>;
|
|
228
|
+
pipeTo(destination: WritableStream<R>, options?: any): Promise<void>;
|
|
229
|
+
tee(): [ReadableStream<R>, ReadableStream<R>];
|
|
230
|
+
}
|
|
231
|
+
declare class WritableStream<W = any> {
|
|
232
|
+
constructor(underlyingSink?: any, strategy?: any);
|
|
233
|
+
readonly locked: boolean;
|
|
234
|
+
abort(reason?: any): Promise<void>;
|
|
235
|
+
close(): Promise<void>;
|
|
236
|
+
getWriter(): { write(chunk?: W): Promise<void>; close(): Promise<void>; abort(reason?: any): Promise<void>; releaseLock(): void; closed: Promise<void>; ready: Promise<void> };
|
|
237
|
+
}
|
|
238
|
+
declare class TransformStream<I = any, O = any> {
|
|
239
|
+
constructor(transformer?: any, writableStrategy?: any, readableStrategy?: any);
|
|
240
|
+
readonly readable: ReadableStream<O>;
|
|
241
|
+
readonly writable: WritableStream<I>;
|
|
242
|
+
}
|
|
243
|
+
declare class TextEncoderStream {
|
|
244
|
+
readonly encoding: string;
|
|
245
|
+
readonly readable: ReadableStream<Uint8Array>;
|
|
246
|
+
readonly writable: WritableStream<string>;
|
|
247
|
+
}
|
|
248
|
+
declare class TextDecoderStream {
|
|
249
|
+
constructor(label?: string, options?: { fatal?: boolean; ignoreBOM?: boolean });
|
|
250
|
+
readonly encoding: string;
|
|
251
|
+
readonly readable: ReadableStream<string>;
|
|
252
|
+
readonly writable: WritableStream<ArrayBuffer | ArrayBufferView>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
type PmBufferEncoding = "utf8" | "utf-8" | "hex" | "base64" | "base64url" | "ascii" | "latin1" | "binary" | "ucs2" | "ucs-2" | "utf16le" | "utf-16le";
|
|
256
|
+
interface Buffer extends Uint8Array {
|
|
257
|
+
toString(encoding?: PmBufferEncoding, start?: number, end?: number): string;
|
|
258
|
+
toJSON(): { type: "Buffer"; data: number[] };
|
|
259
|
+
equals(other: Uint8Array): boolean;
|
|
260
|
+
compare(other: Uint8Array): -1 | 0 | 1;
|
|
261
|
+
write(value: string, offset?: number, length?: number, encoding?: PmBufferEncoding): number;
|
|
262
|
+
copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
263
|
+
indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: PmBufferEncoding): number;
|
|
264
|
+
includes(value: string | number | Uint8Array, byteOffset?: number, encoding?: PmBufferEncoding): boolean;
|
|
265
|
+
readUInt8(offset?: number): number;
|
|
266
|
+
readUInt16BE(offset?: number): number;
|
|
267
|
+
readUInt16LE(offset?: number): number;
|
|
268
|
+
readUInt32BE(offset?: number): number;
|
|
269
|
+
readUInt32LE(offset?: number): number;
|
|
270
|
+
readInt8(offset?: number): number;
|
|
271
|
+
readInt16BE(offset?: number): number;
|
|
272
|
+
readInt16LE(offset?: number): number;
|
|
273
|
+
readInt32BE(offset?: number): number;
|
|
274
|
+
readInt32LE(offset?: number): number;
|
|
275
|
+
writeUInt8(value: number, offset?: number): number;
|
|
276
|
+
writeUInt16BE(value: number, offset?: number): number;
|
|
277
|
+
writeUInt16LE(value: number, offset?: number): number;
|
|
278
|
+
writeUInt32BE(value: number, offset?: number): number;
|
|
279
|
+
writeUInt32LE(value: number, offset?: number): number;
|
|
280
|
+
}
|
|
281
|
+
interface PmBufferConstructor {
|
|
282
|
+
readonly prototype: Buffer;
|
|
283
|
+
from(data: string, encoding?: PmBufferEncoding): Buffer;
|
|
284
|
+
from(data: ArrayBuffer | ArrayLike<number> | Iterable<number>, byteOffset?: number, length?: number): Buffer;
|
|
285
|
+
alloc(size: number, fill?: string | number | Uint8Array, encoding?: PmBufferEncoding): Buffer;
|
|
286
|
+
allocUnsafe(size: number): Buffer;
|
|
287
|
+
concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
|
|
288
|
+
isBuffer(value: any): value is Buffer;
|
|
289
|
+
isEncoding(encoding: string): boolean;
|
|
290
|
+
byteLength(value: string | ArrayBuffer | ArrayBufferView, encoding?: PmBufferEncoding): number;
|
|
291
|
+
compare(a: Uint8Array, b: Uint8Array): -1 | 0 | 1;
|
|
292
|
+
}
|
|
293
|
+
declare const Buffer: PmBufferConstructor;
|
|
294
|
+
|
|
295
|
+
interface PmCryptoKey {
|
|
296
|
+
readonly type: "secret" | "private" | "public";
|
|
297
|
+
readonly extractable: boolean;
|
|
298
|
+
readonly algorithm: { name: string; [option: string]: any };
|
|
299
|
+
readonly usages: string[];
|
|
300
|
+
}
|
|
301
|
+
interface PmSubtleCrypto {
|
|
302
|
+
digest(algorithm: string | { name: string }, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
|
|
303
|
+
importKey(format: string, keyData: any, algorithm: any, extractable: boolean, keyUsages: string[]): Promise<PmCryptoKey>;
|
|
304
|
+
exportKey(format: string, key: PmCryptoKey): Promise<any>;
|
|
305
|
+
generateKey(algorithm: any, extractable: boolean, keyUsages: string[]): Promise<PmCryptoKey | { publicKey: PmCryptoKey; privateKey: PmCryptoKey }>;
|
|
306
|
+
sign(algorithm: any, key: PmCryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
|
|
307
|
+
verify(algorithm: any, key: PmCryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;
|
|
308
|
+
encrypt(algorithm: any, key: PmCryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
|
|
309
|
+
decrypt(algorithm: any, key: PmCryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;
|
|
310
|
+
deriveBits(algorithm: any, baseKey: PmCryptoKey, length: number): Promise<ArrayBuffer>;
|
|
311
|
+
deriveKey(algorithm: any, baseKey: PmCryptoKey, derivedKeyType: any, extractable: boolean, keyUsages: string[]): Promise<PmCryptoKey>;
|
|
312
|
+
}
|
|
313
|
+
interface PmWebCrypto {
|
|
314
|
+
readonly subtle: PmSubtleCrypto;
|
|
315
|
+
getRandomValues<T extends ArrayBufferView | null>(array: T): T;
|
|
316
|
+
randomUUID(): string;
|
|
317
|
+
}
|
|
318
|
+
declare const crypto: PmWebCrypto;
|
|
319
|
+
`;
|
|
320
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
321
|
+
// postman-collection object model (pm.request / pm.response / cookies)
|
|
322
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
323
|
+
const SDK_TYPES = `
|
|
324
|
+
interface PmPropertyBase {
|
|
325
|
+
/** Free-form metadata (rarely used). */
|
|
326
|
+
meta?: any;
|
|
327
|
+
readonly parent: any;
|
|
328
|
+
setParent(parent: any): void;
|
|
329
|
+
findInParents(property: string, customizer?: (item: any) => boolean): any;
|
|
330
|
+
findParentContaining(item: any, customizer?: (item: any) => boolean): any;
|
|
331
|
+
forEachParent(options: { withRoot?: boolean } | ((parent: any) => void), iterator?: (parent: any) => void): void;
|
|
332
|
+
toJSON(): any;
|
|
333
|
+
}
|
|
334
|
+
interface PmProperty extends PmPropertyBase {
|
|
335
|
+
id?: string;
|
|
336
|
+
name?: string;
|
|
337
|
+
disabled?: boolean;
|
|
338
|
+
describe(content: string, type?: string): void;
|
|
339
|
+
findSubstitutions(): string[];
|
|
340
|
+
toObjectResolved(variables?: any, overrides?: any, options?: { ignoreOwnVariables?: boolean }): any;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** postman-collection PropertyList: an ordered collection with Postman's lookup / mutation helpers. */
|
|
344
|
+
interface PmPropertyList<T> extends PmPropertyBase {
|
|
345
|
+
readonly Type: any;
|
|
346
|
+
/** The items as an array. */
|
|
347
|
+
readonly members: T[];
|
|
348
|
+
/** Items keyed by their index key (header name, query key, …). */
|
|
349
|
+
readonly reference: Record<string, T>;
|
|
350
|
+
add(item: T | object): void;
|
|
351
|
+
append(item: T | object): void;
|
|
352
|
+
prepend(item: T | object): void;
|
|
353
|
+
insert(item: T | object, before?: T | string): void;
|
|
354
|
+
insertAfter(item: T | object, after?: T | string): void;
|
|
355
|
+
upsert(item: T | object): boolean | null;
|
|
356
|
+
assimilate(source: PmPropertyList<T> | Array<T | object>, prune?: boolean): void;
|
|
357
|
+
populate(items: Array<T | object>): void;
|
|
358
|
+
repopulate(items: Array<T | object>): void;
|
|
359
|
+
clear(): void;
|
|
360
|
+
count(): number;
|
|
361
|
+
idx(index: number): T | undefined;
|
|
362
|
+
indexOf(item: T | string): number;
|
|
363
|
+
one(id: string): T | undefined;
|
|
364
|
+
get(key: string): any;
|
|
365
|
+
has(item: T | string, value?: any): boolean;
|
|
366
|
+
all(): T[];
|
|
367
|
+
each(iterator: (item: T, index: number) => void, context?: any): void;
|
|
368
|
+
eachParent(iterator: (parent: any) => void, context?: any): void;
|
|
369
|
+
map<R>(iterator: (item: T, index: number) => R, context?: any): R[];
|
|
370
|
+
filter(rule: (item: T, index: number) => boolean, context?: any): T[];
|
|
371
|
+
find(rule: (item: T, index: number) => boolean, context?: any): T | undefined;
|
|
372
|
+
reduce<R>(iterator: (accumulator: R, item: T, index: number) => R, accumulator: R, context?: any): R;
|
|
373
|
+
remove(predicate: T | string | ((item: T) => boolean), context?: any): void;
|
|
374
|
+
toObject(excludeDisabled?: boolean, caseSensitive?: boolean, multiValue?: boolean, sanitizeKeys?: boolean): Record<string, any>;
|
|
375
|
+
toString(): string;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
interface PmHeader extends PmProperty {
|
|
379
|
+
key: string;
|
|
380
|
+
value: string;
|
|
381
|
+
system?: boolean;
|
|
382
|
+
update(header: string | { key?: string; value?: string }): void;
|
|
383
|
+
toString(): string;
|
|
384
|
+
valueOf(): string;
|
|
385
|
+
}
|
|
386
|
+
/** Header collection. Besides Postman's list API, bracket access reads / writes a header by name (case-insensitive). */
|
|
387
|
+
interface PmHeaderList extends PmPropertyList<PmHeader> {
|
|
388
|
+
/** Case-insensitive value lookup. */
|
|
389
|
+
get(name: string): string | undefined;
|
|
390
|
+
/** Total size of the headers in bytes. */
|
|
391
|
+
contentSize(): number;
|
|
392
|
+
[name: string]: any;
|
|
393
|
+
}
|
|
394
|
+
interface PmQueryParam extends PmProperty {
|
|
395
|
+
key: string | null;
|
|
396
|
+
value: string | null;
|
|
397
|
+
system?: boolean;
|
|
398
|
+
update(param: string | { key?: string | null; value?: string | null }): void;
|
|
399
|
+
toString(): string;
|
|
400
|
+
valueOf(): string;
|
|
401
|
+
}
|
|
402
|
+
interface PmQueryParamList extends PmPropertyList<PmQueryParam> {
|
|
403
|
+
/** Value of the (first, enabled) param with that key. */
|
|
404
|
+
get(key: string): string | null | undefined;
|
|
405
|
+
[name: string]: any;
|
|
406
|
+
}
|
|
407
|
+
interface PmFormParam extends PmProperty {
|
|
408
|
+
key: string;
|
|
409
|
+
value?: string;
|
|
410
|
+
type?: "text" | "file";
|
|
411
|
+
src?: string | string[];
|
|
412
|
+
contentType?: string;
|
|
413
|
+
toString(): string;
|
|
414
|
+
valueOf(): string;
|
|
415
|
+
}
|
|
416
|
+
interface PmVariable extends PmProperty {
|
|
417
|
+
key?: string;
|
|
418
|
+
value?: any;
|
|
419
|
+
type?: "string" | "boolean" | "number" | "json" | "any";
|
|
420
|
+
readonly valueType: string;
|
|
421
|
+
get(): any;
|
|
422
|
+
set(value: any): void;
|
|
423
|
+
cast(value: any, type: string): any;
|
|
424
|
+
castIn(value: any): any;
|
|
425
|
+
castOut(value: any): any;
|
|
426
|
+
update(options: object): void;
|
|
427
|
+
toString(): string;
|
|
428
|
+
valueOf(): any;
|
|
429
|
+
}
|
|
430
|
+
interface PmVariableList extends PmPropertyList<PmVariable> {
|
|
431
|
+
oneNormalizedVariable(key: string): PmVariable | undefined;
|
|
432
|
+
replace(str: string, overrides?: object): string;
|
|
433
|
+
substitute(obj: any, overrides?: object): any;
|
|
434
|
+
syncFromObject(obj: Record<string, any>, track?: boolean, prune?: boolean): any;
|
|
435
|
+
syncToObject(obj?: Record<string, any>): Record<string, any>;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
interface PmCookie extends PmPropertyBase {
|
|
439
|
+
name: string;
|
|
440
|
+
value: string;
|
|
441
|
+
domain?: string;
|
|
442
|
+
path?: string;
|
|
443
|
+
expires?: string | number | Date;
|
|
444
|
+
maxAge?: number | string;
|
|
445
|
+
httpOnly?: boolean;
|
|
446
|
+
secure?: boolean;
|
|
447
|
+
hostOnly?: boolean;
|
|
448
|
+
session?: boolean;
|
|
449
|
+
sameSite?: string;
|
|
450
|
+
extensions?: Array<{ key: string; value: string }>;
|
|
451
|
+
update(cookie: string | object): void;
|
|
452
|
+
toString(): string;
|
|
453
|
+
valueOf(): string;
|
|
454
|
+
}
|
|
455
|
+
/** The cookies of the request's domain (Set-Cookie of the response, or the host's jar). */
|
|
456
|
+
interface PmCookieList extends PmPropertyList<PmCookie> {
|
|
457
|
+
/** Cookie jar: cookies of ANY domain. Every method takes a callback (error, result) OR returns a Promise. */
|
|
458
|
+
jar(): PmCookieJar;
|
|
459
|
+
/** Value of the cookie with that name. */
|
|
460
|
+
get(name: string): string | undefined;
|
|
461
|
+
}
|
|
462
|
+
interface PmCookieJar {
|
|
463
|
+
set(url: string | PmUrl, name: string, value: string): Promise<void>;
|
|
464
|
+
set(url: string | PmUrl, name: string, value: string, callback: (error: Error | null) => void): void;
|
|
465
|
+
set(url: string | PmUrl, cookie: { name: string; value: string; domain?: string; path?: string; expires?: string | number | Date; maxAge?: number; httpOnly?: boolean; secure?: boolean; sameSite?: string }): Promise<void>;
|
|
466
|
+
set(url: string | PmUrl, cookie: { name: string; value: string; domain?: string; path?: string; expires?: string | number | Date; maxAge?: number; httpOnly?: boolean; secure?: boolean; sameSite?: string }, callback: (error: Error | null) => void): void;
|
|
467
|
+
get(url: string | PmUrl, name: string): Promise<string | null>;
|
|
468
|
+
get(url: string | PmUrl, name: string, callback: (error: Error | null, value: string | null) => void): void;
|
|
469
|
+
getAll(url: string | PmUrl, options?: { http?: boolean; secure?: boolean }): Promise<PmCookie[]>;
|
|
470
|
+
getAll(url: string | PmUrl, callback: (error: Error | null, cookies: PmCookie[]) => void): void;
|
|
471
|
+
getAll(url: string | PmUrl, options: { http?: boolean; secure?: boolean }, callback: (error: Error | null, cookies: PmCookie[]) => void): void;
|
|
472
|
+
unset(url: string | PmUrl, name: string): Promise<void>;
|
|
473
|
+
unset(url: string | PmUrl, name: string, callback: (error: Error | null) => void): void;
|
|
474
|
+
clear(url: string | PmUrl): Promise<void>;
|
|
475
|
+
clear(url: string | PmUrl, callback: (error: Error | null) => void): void;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
interface PmUrlDefinition {
|
|
479
|
+
raw?: string;
|
|
480
|
+
protocol?: string;
|
|
481
|
+
host?: string | string[];
|
|
482
|
+
port?: string | number;
|
|
483
|
+
path?: string | string[];
|
|
484
|
+
hash?: string;
|
|
485
|
+
query?: string | Array<{ key: string; value?: string; disabled?: boolean }>;
|
|
486
|
+
variable?: Array<{ key: string; value?: any }>;
|
|
487
|
+
auth?: { user?: string; password?: string };
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* pm.request.url — a postman-collection Url that ALSO behaves like the string it
|
|
491
|
+
* used to be: url.includes("/v1"), url + "?x=1", \`\${url}\`, url.length all work.
|
|
492
|
+
*/
|
|
493
|
+
interface PmUrl extends PmPropertyBase {
|
|
494
|
+
protocol?: string;
|
|
495
|
+
auth?: { user?: string; password?: string };
|
|
496
|
+
host?: string[];
|
|
497
|
+
port?: string;
|
|
498
|
+
path?: string[];
|
|
499
|
+
hash?: string;
|
|
500
|
+
query: PmQueryParamList;
|
|
501
|
+
variables: PmVariableList;
|
|
502
|
+
getHost(): string;
|
|
503
|
+
getPath(unresolved?: boolean): string;
|
|
504
|
+
getPathWithQuery(): string;
|
|
505
|
+
getQueryString(options?: { ignoreDisabled?: boolean; encode?: boolean }): string;
|
|
506
|
+
getRaw(): string;
|
|
507
|
+
getRemote(forcePort?: boolean): string;
|
|
508
|
+
getOAuth1BaseUrl(): string;
|
|
509
|
+
addQueryParams(params: string | Array<{ key: string; value?: string; disabled?: boolean }>): void;
|
|
510
|
+
removeQueryParams(params: string | string[] | PmQueryParam[]): void;
|
|
511
|
+
update(url: string | PmUrlDefinition): void;
|
|
512
|
+
toString(forceProtocol?: boolean): string;
|
|
513
|
+
// ── string behaviour (kept for scripts written when the url was a string)
|
|
514
|
+
readonly length: number;
|
|
515
|
+
at(index: number): string | undefined;
|
|
516
|
+
charAt(pos: number): string;
|
|
517
|
+
charCodeAt(index: number): number;
|
|
518
|
+
codePointAt(pos: number): number | undefined;
|
|
519
|
+
concat(...strings: string[]): string;
|
|
520
|
+
endsWith(searchString: string, endPosition?: number): boolean;
|
|
521
|
+
includes(searchString: string, position?: number): boolean;
|
|
522
|
+
indexOf(searchString: string, position?: number): number;
|
|
523
|
+
lastIndexOf(searchString: string, position?: number): number;
|
|
524
|
+
localeCompare(that: string): number;
|
|
525
|
+
match(regexp: string | RegExp): RegExpMatchArray | null;
|
|
526
|
+
matchAll(regexp: RegExp): IterableIterator<RegExpMatchArray>;
|
|
527
|
+
normalize(form?: string): string;
|
|
528
|
+
padEnd(maxLength: number, fillString?: string): string;
|
|
529
|
+
padStart(maxLength: number, fillString?: string): string;
|
|
530
|
+
repeat(count: number): string;
|
|
531
|
+
replace(searchValue: string | RegExp, replaceValue: string | ((substring: string, ...args: any[]) => string)): string;
|
|
532
|
+
replaceAll(searchValue: string | RegExp, replaceValue: string | ((substring: string, ...args: any[]) => string)): string;
|
|
533
|
+
search(regexp: string | RegExp): number;
|
|
534
|
+
slice(start?: number, end?: number): string;
|
|
535
|
+
split(separator: string | RegExp, limit?: number): string[];
|
|
536
|
+
startsWith(searchString: string, position?: number): boolean;
|
|
537
|
+
substr(from: number, length?: number): string;
|
|
538
|
+
substring(start: number, end?: number): string;
|
|
539
|
+
toLocaleLowerCase(): string;
|
|
540
|
+
toLocaleUpperCase(): string;
|
|
541
|
+
toLowerCase(): string;
|
|
542
|
+
toUpperCase(): string;
|
|
543
|
+
trim(): string;
|
|
544
|
+
trimEnd(): string;
|
|
545
|
+
trimStart(): string;
|
|
546
|
+
valueOf(): string;
|
|
547
|
+
[Symbol.toPrimitive](hint?: string): string;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
interface PmRequestBody extends PmPropertyBase {
|
|
551
|
+
mode?: "raw" | "urlencoded" | "formdata" | "file" | "graphql";
|
|
552
|
+
raw?: string;
|
|
553
|
+
urlencoded?: PmPropertyList<PmQueryParam>;
|
|
554
|
+
formdata?: PmPropertyList<PmFormParam>;
|
|
555
|
+
file?: { src?: string; content?: string };
|
|
556
|
+
graphql?: { query?: string; variables?: string | object };
|
|
557
|
+
options?: { raw?: { language?: string } };
|
|
558
|
+
disabled?: boolean;
|
|
559
|
+
isEmpty(): boolean;
|
|
560
|
+
/** Body as text (raw / urlencoded / graphql). */
|
|
561
|
+
toString(): string;
|
|
562
|
+
update(options: string | { mode?: string; raw?: string; urlencoded?: any; formdata?: any; graphql?: any; file?: any; options?: any }): void;
|
|
563
|
+
}
|
|
564
|
+
interface PmRequestAuth extends PmProperty {
|
|
565
|
+
type: string;
|
|
566
|
+
current(): any;
|
|
567
|
+
clear(type: string): void;
|
|
568
|
+
parameters(): PmVariableList;
|
|
569
|
+
use(type: string, options?: object): void;
|
|
570
|
+
update(options: object | PmVariable[], type?: string): void;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
interface PmRequestDefinition {
|
|
574
|
+
url: string | PmUrl | PmUrlDefinition;
|
|
575
|
+
method?: string;
|
|
576
|
+
header?: Record<string, string> | Array<{ key: string; value: string; disabled?: boolean }> | string | PmHeaderList;
|
|
577
|
+
headers?: Record<string, string> | Array<{ key: string; value: string; disabled?: boolean }> | string | PmHeaderList;
|
|
578
|
+
/** Postman's body object; unknown modes / extra parts are accepted (pasted collections vary). */
|
|
579
|
+
body?: string | PmRequestBodyDefinition | { mode: string; [part: string]: any } | null;
|
|
580
|
+
/** Milliseconds. */
|
|
581
|
+
timeout?: number;
|
|
582
|
+
description?: string;
|
|
583
|
+
}
|
|
584
|
+
type PmRequestBodyDefinition =
|
|
585
|
+
| { mode: "raw"; raw: string; options?: { raw?: { language?: string } } }
|
|
586
|
+
| { mode: "urlencoded"; urlencoded: Array<{ key: string; value?: string; disabled?: boolean }> }
|
|
587
|
+
| { mode: "formdata"; formdata: Array<{ key: string; value?: string; type?: "text" | "file"; disabled?: boolean }> }
|
|
588
|
+
| { mode: "graphql"; graphql: { query: string; variables?: string | object } }
|
|
589
|
+
| { mode: "file"; file: { src?: string } };
|
|
590
|
+
|
|
591
|
+
interface PmSizeInfo {
|
|
592
|
+
body: number;
|
|
593
|
+
header: number;
|
|
594
|
+
total: number;
|
|
595
|
+
source?: string;
|
|
596
|
+
}
|
|
597
|
+
`;
|
|
598
|
+
const REQUEST_TYPES = `
|
|
599
|
+
/** pm.request — a postman-collection Request plus Callman's helpers. In post-response / tests it is read-only in effect (the call has been made). */
|
|
600
|
+
interface PmRequest extends PmProperty {
|
|
601
|
+
/** A Url that also behaves like a string. Assign a string to replace it: pm.request.url = "https://…". */
|
|
602
|
+
get url(): PmUrl;
|
|
603
|
+
set url(value: string | PmUrl);
|
|
604
|
+
method: string;
|
|
605
|
+
readonly headers: PmHeaderList;
|
|
606
|
+
body: PmRequestBody;
|
|
607
|
+
/** Only set when the request carries Postman-style auth (Callman does not populate it). */
|
|
608
|
+
auth?: PmRequestAuth;
|
|
609
|
+
addHeader(header: string | { key: string; value: string; disabled?: boolean }): void;
|
|
610
|
+
removeHeader(toRemove: string | PmHeader, ignoreCase?: boolean): void;
|
|
611
|
+
upsertHeader(header: { key: string; value: string }): void;
|
|
612
|
+
forEachHeader(callback: (header: PmHeader, context?: any) => void): void;
|
|
613
|
+
getHeaders(options?: { ignoreCase?: boolean; enabled?: boolean }): Record<string, string>;
|
|
614
|
+
addQueryParams(params: string | Array<{ key: string; value?: string; disabled?: boolean }>): void;
|
|
615
|
+
removeQueryParams(params: string | string[] | PmQueryParam[]): void;
|
|
616
|
+
authorizeUsing(type: string | object, options?: object): void;
|
|
617
|
+
update(options: string | PmRequestDefinition): void;
|
|
618
|
+
size(): PmSizeInfo;
|
|
619
|
+
clone(): PmRequest;
|
|
620
|
+
/** chai-postman assertions, e.g. pm.request.to.have.header("Authorization"). */
|
|
621
|
+
readonly to: PmAssertion;
|
|
622
|
+
// ── Callman helpers
|
|
623
|
+
/** Query params of the url (same list as pm.request.url.query). */
|
|
624
|
+
readonly query: PmQueryParamList;
|
|
625
|
+
getHeader(name: string): string | undefined;
|
|
626
|
+
setHeader(name: string, value: any): void;
|
|
627
|
+
unsetHeader(name: string): void;
|
|
628
|
+
getQueryParam(name: string): string | undefined;
|
|
629
|
+
setQueryParam(name: string, value: any): void;
|
|
630
|
+
unsetQueryParam(name: string): void;
|
|
631
|
+
setMethod(method: string): void;
|
|
632
|
+
setUrl(url: string): void;
|
|
633
|
+
/** Replace the body with raw text (non-strings are stringified). */
|
|
634
|
+
setRawBody(value: any): void;
|
|
635
|
+
}
|
|
636
|
+
`;
|
|
637
|
+
const RESPONSE_TYPES = `
|
|
638
|
+
interface PmResponseDetails {
|
|
639
|
+
name?: string;
|
|
640
|
+
code: number;
|
|
641
|
+
detail?: string;
|
|
642
|
+
standardName?: string;
|
|
643
|
+
}
|
|
644
|
+
interface PmResponseContentInfo {
|
|
645
|
+
mimeType: string;
|
|
646
|
+
mimeFormat: string;
|
|
647
|
+
charset: string;
|
|
648
|
+
fileExtension: string;
|
|
649
|
+
fileName?: string;
|
|
650
|
+
contentType: string;
|
|
651
|
+
}
|
|
652
|
+
/** pm.response — a postman-collection Response plus Callman's accessors. Not available in pre-request scripts. */
|
|
653
|
+
interface PmResponse extends PmProperty {
|
|
654
|
+
/** HTTP status code (number). */
|
|
655
|
+
readonly code: number;
|
|
656
|
+
/** Status REASON PHRASE ("OK", "Not Found") — Postman semantics. The number is pm.response.code. */
|
|
657
|
+
readonly status: string;
|
|
658
|
+
/** Reason phrase (method form of .status). */
|
|
659
|
+
reason(): string;
|
|
660
|
+
readonly headers: PmHeaderList;
|
|
661
|
+
readonly cookies: PmCookieList;
|
|
662
|
+
/** Round-trip time in ms. */
|
|
663
|
+
readonly responseTime: number;
|
|
664
|
+
/** Body size in bytes. */
|
|
665
|
+
readonly responseSize: number;
|
|
666
|
+
/** Body bytes. */
|
|
667
|
+
readonly stream: Buffer;
|
|
668
|
+
/** Body as text. */
|
|
669
|
+
text(): string;
|
|
670
|
+
/** Parse the body as JSON. THROWS when the body is empty or not valid JSON. */
|
|
671
|
+
json(reviver?: (key: string, value: any) => any): CallmanResponseBody;
|
|
672
|
+
/** Parse a JSONP body (callback name optional). Throws when it is not valid. */
|
|
673
|
+
jsonp(callbackName?: string, reviver?: (key: string, value: any) => any): any;
|
|
674
|
+
size(): PmSizeInfo;
|
|
675
|
+
/** The body as a data: URI. */
|
|
676
|
+
dataURI(): string;
|
|
677
|
+
details(): PmResponseDetails;
|
|
678
|
+
contentInfo(): PmResponseContentInfo;
|
|
679
|
+
encoding(): { format: string; source: string };
|
|
680
|
+
mime(): PmResponseContentInfo;
|
|
681
|
+
update(options: object): void;
|
|
682
|
+
// ── Callman accessors
|
|
683
|
+
/** true for 2xx / 3xx. */
|
|
684
|
+
readonly ok: boolean;
|
|
685
|
+
/** Same as .reason(). */
|
|
686
|
+
readonly statusText: string;
|
|
687
|
+
/** Parsed body: JSON value for JSON responses, otherwise the text. Prefer .json() / .text(). */
|
|
688
|
+
readonly body: any;
|
|
689
|
+
readonly data: any;
|
|
690
|
+
/** Raw body text (same as .text()). */
|
|
691
|
+
readonly rawBody: string;
|
|
692
|
+
readonly raw: string;
|
|
693
|
+
/** Content-Type header value. */
|
|
694
|
+
readonly contentType: string;
|
|
695
|
+
/** Same as .responseTime. */
|
|
696
|
+
readonly durationMs: number;
|
|
697
|
+
/** Same as .responseSize. */
|
|
698
|
+
readonly sizeBytes: number;
|
|
699
|
+
/** chai-postman assertions: pm.response.to.have.status(200), .to.be.ok, .to.have.jsonBody("a.b", 1), … (to, be and have are the same entry point). */
|
|
700
|
+
readonly to: PmAssertion;
|
|
701
|
+
readonly be: PmAssertion;
|
|
702
|
+
readonly have: PmAssertion;
|
|
703
|
+
}
|
|
704
|
+
`;
|
|
705
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
706
|
+
// pm.expect (chai 4.4.1 + chai-postman + Callman's jest-style aliases)
|
|
707
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
708
|
+
const ASSERTION_TYPES = `
|
|
709
|
+
/** A chai 4 assertion plus chai-postman helpers (HTTP predicates) and Callman's jest-style aliases. */
|
|
710
|
+
interface PmAssertion {
|
|
711
|
+
// ── language chains (no behaviour)
|
|
712
|
+
readonly to: PmAssertion;
|
|
713
|
+
readonly be: PmAssertion;
|
|
714
|
+
readonly been: PmAssertion;
|
|
715
|
+
readonly is: PmAssertion;
|
|
716
|
+
readonly that: PmAssertion;
|
|
717
|
+
readonly which: PmAssertion;
|
|
718
|
+
readonly and: PmAssertion;
|
|
719
|
+
readonly has: PmAssertion;
|
|
720
|
+
readonly have: PmAssertion;
|
|
721
|
+
readonly with: PmAssertion;
|
|
722
|
+
readonly at: PmAssertion;
|
|
723
|
+
readonly of: PmAssertion;
|
|
724
|
+
readonly same: PmAssertion;
|
|
725
|
+
readonly but: PmAssertion;
|
|
726
|
+
readonly does: PmAssertion;
|
|
727
|
+
readonly still: PmAssertion;
|
|
728
|
+
readonly also: PmAssertion;
|
|
729
|
+
// ── flags
|
|
730
|
+
/** Negate the assertion that follows. */
|
|
731
|
+
readonly not: PmAssertion;
|
|
732
|
+
/** Use deep (structural) equality for the assertion that follows. */
|
|
733
|
+
readonly deep: PmAssertion;
|
|
734
|
+
/** Use dot / bracket path notation with .property / .include. */
|
|
735
|
+
readonly nested: PmAssertion;
|
|
736
|
+
/** Only own (non-inherited) properties. */
|
|
737
|
+
readonly own: PmAssertion;
|
|
738
|
+
/** Compare .members in order. */
|
|
739
|
+
readonly ordered: PmAssertion;
|
|
740
|
+
readonly any: PmAssertion;
|
|
741
|
+
readonly all: PmAssertion;
|
|
742
|
+
/** Make .respondTo look at the constructor's own methods. */
|
|
743
|
+
readonly itself: PmAssertion;
|
|
744
|
+
// ── property assertions (no parentheses)
|
|
745
|
+
readonly ok: PmAssertion;
|
|
746
|
+
readonly true: PmAssertion;
|
|
747
|
+
readonly false: PmAssertion;
|
|
748
|
+
readonly null: PmAssertion;
|
|
749
|
+
readonly undefined: PmAssertion;
|
|
750
|
+
readonly NaN: PmAssertion;
|
|
751
|
+
readonly exist: PmAssertion;
|
|
752
|
+
readonly exists: PmAssertion;
|
|
753
|
+
readonly empty: PmAssertion;
|
|
754
|
+
readonly arguments: PmAssertion;
|
|
755
|
+
readonly Arguments: PmAssertion;
|
|
756
|
+
readonly extensible: PmAssertion;
|
|
757
|
+
readonly sealed: PmAssertion;
|
|
758
|
+
readonly frozen: PmAssertion;
|
|
759
|
+
readonly finite: PmAssertion;
|
|
760
|
+
// ── type / inclusion / length (callable AND chainable)
|
|
761
|
+
/** .a("string") / .an("array") / .a("object") … */
|
|
762
|
+
a: PmChainableAssertion<(type: string, message?: string) => PmAssertion>;
|
|
763
|
+
an: PmChainableAssertion<(type: string, message?: string) => PmAssertion>;
|
|
764
|
+
include: PmChainableAssertion<(value: any, message?: string) => PmAssertion>;
|
|
765
|
+
includes: PmChainableAssertion<(value: any, message?: string) => PmAssertion>;
|
|
766
|
+
contain: PmChainableAssertion<(value: any, message?: string) => PmAssertion>;
|
|
767
|
+
contains: PmChainableAssertion<(value: any, message?: string) => PmAssertion>;
|
|
768
|
+
length: PmChainableAssertion<(length: number, message?: string) => PmAssertion>;
|
|
769
|
+
lengthOf: PmChainableAssertion<(length: number, message?: string) => PmAssertion>;
|
|
770
|
+
// ── comparison
|
|
771
|
+
equal(value: any, message?: string): PmAssertion;
|
|
772
|
+
equals(value: any, message?: string): PmAssertion;
|
|
773
|
+
eq(value: any, message?: string): PmAssertion;
|
|
774
|
+
eql(value: any, message?: string): PmAssertion;
|
|
775
|
+
eqls(value: any, message?: string): PmAssertion;
|
|
776
|
+
above(value: number | Date, message?: string): PmAssertion;
|
|
777
|
+
gt(value: number | Date, message?: string): PmAssertion;
|
|
778
|
+
greaterThan(value: number | Date, message?: string): PmAssertion;
|
|
779
|
+
least(value: number | Date, message?: string): PmAssertion;
|
|
780
|
+
gte(value: number | Date, message?: string): PmAssertion;
|
|
781
|
+
greaterThanOrEqual(value: number | Date, message?: string): PmAssertion;
|
|
782
|
+
below(value: number | Date, message?: string): PmAssertion;
|
|
783
|
+
lt(value: number | Date, message?: string): PmAssertion;
|
|
784
|
+
lessThan(value: number | Date, message?: string): PmAssertion;
|
|
785
|
+
most(value: number | Date, message?: string): PmAssertion;
|
|
786
|
+
lte(value: number | Date, message?: string): PmAssertion;
|
|
787
|
+
lessThanOrEqual(value: number | Date, message?: string): PmAssertion;
|
|
788
|
+
within(start: number | Date, finish: number | Date, message?: string): PmAssertion;
|
|
789
|
+
closeTo(expected: number, delta: number, message?: string): PmAssertion;
|
|
790
|
+
approximately(expected: number, delta: number, message?: string): PmAssertion;
|
|
791
|
+
instanceof(constructor: Function, message?: string): PmAssertion;
|
|
792
|
+
instanceOf(constructor: Function, message?: string): PmAssertion;
|
|
793
|
+
oneOf(list: any[], message?: string): PmAssertion;
|
|
794
|
+
members(set: any[], message?: string): PmAssertion;
|
|
795
|
+
satisfy(matcher: (value: any) => boolean, message?: string): PmAssertion;
|
|
796
|
+
satisfies(matcher: (value: any) => boolean, message?: string): PmAssertion;
|
|
797
|
+
match(pattern: RegExp, message?: string): PmAssertion;
|
|
798
|
+
matches(pattern: RegExp, message?: string): PmAssertion;
|
|
799
|
+
/** String contains the substring. */
|
|
800
|
+
string(substring: string, message?: string): PmAssertion;
|
|
801
|
+
// ── object shape
|
|
802
|
+
/** With dot / bracket paths by default ("a.b[0]"); with a second argument the value must match. */
|
|
803
|
+
property(name: string | symbol, value?: any, message?: string): PmAssertion;
|
|
804
|
+
ownProperty(name: string | symbol, value?: any, message?: string): PmAssertion;
|
|
805
|
+
haveOwnProperty(name: string | symbol, value?: any, message?: string): PmAssertion;
|
|
806
|
+
ownPropertyDescriptor(name: string | symbol, descriptor?: PropertyDescriptor, message?: string): PmAssertion;
|
|
807
|
+
haveOwnPropertyDescriptor(name: string | symbol, descriptor?: PropertyDescriptor, message?: string): PmAssertion;
|
|
808
|
+
key(...keys: string[]): PmAssertion;
|
|
809
|
+
keys(...keys: Array<string | string[]>): PmAssertion;
|
|
810
|
+
keys(keys: object): PmAssertion;
|
|
811
|
+
respondTo(method: string, message?: string): PmAssertion;
|
|
812
|
+
respondsTo(method: string, message?: string): PmAssertion;
|
|
813
|
+
throw(errorLike?: Function | Error | RegExp | string, errMsgMatcher?: RegExp | string, message?: string): PmAssertion;
|
|
814
|
+
throws(errorLike?: Function | Error | RegExp | string, errMsgMatcher?: RegExp | string, message?: string): PmAssertion;
|
|
815
|
+
Throw(errorLike?: Function | Error | RegExp | string, errMsgMatcher?: RegExp | string, message?: string): PmAssertion;
|
|
816
|
+
// ── change tracking
|
|
817
|
+
change(subject: object | (() => any), property?: string, message?: string): PmAssertion;
|
|
818
|
+
changes(subject: object | (() => any), property?: string, message?: string): PmAssertion;
|
|
819
|
+
increase(subject: object | (() => any), property?: string, message?: string): PmAssertion;
|
|
820
|
+
increases(subject: object | (() => any), property?: string, message?: string): PmAssertion;
|
|
821
|
+
decrease(subject: object | (() => any), property?: string, message?: string): PmAssertion;
|
|
822
|
+
decreases(subject: object | (() => any), property?: string, message?: string): PmAssertion;
|
|
823
|
+
by(delta: number, message?: string): PmAssertion;
|
|
824
|
+
/** chai's low-level hook for custom assertions. */
|
|
825
|
+
assert(expression: any, message: string, negateMessage: string, expected?: any, actual?: any, showDiff?: boolean): void;
|
|
826
|
+
// ── Callman / jest-style aliases
|
|
827
|
+
toBe(expected: any): PmAssertion;
|
|
828
|
+
toEqual(expected: any): PmAssertion;
|
|
829
|
+
toContain(expected: any): PmAssertion;
|
|
830
|
+
toBeDefined(): PmAssertion;
|
|
831
|
+
toBeTruthy(): PmAssertion;
|
|
832
|
+
toBeFalsy(): PmAssertion;
|
|
833
|
+
toBeGreaterThan(expected: number): PmAssertion;
|
|
834
|
+
toBeLessThan(expected: number): PmAssertion;
|
|
835
|
+
// ── chai-postman: HTTP assertions on pm.response / pm.request (the status / header / body forms also work on plain objects)
|
|
836
|
+
/** pm.response.to.have.status(200) or .status("OK"). */
|
|
837
|
+
status(codeOrReason: number | string): PmAssertion;
|
|
838
|
+
statusCode(code: number): PmAssertion;
|
|
839
|
+
statusCodeClass(classCode: number): PmAssertion;
|
|
840
|
+
statusReason(reason: string): PmAssertion;
|
|
841
|
+
/** Header exists / has that value (case-insensitive name). */
|
|
842
|
+
header(name: string, value?: string): PmAssertion;
|
|
843
|
+
/** Body is non-empty, equals / contains a string, or matches a RegExp / object. */
|
|
844
|
+
body(expected?: string | RegExp | object): PmAssertion;
|
|
845
|
+
/** Body is JSON; optionally a dot-path, and the value at it. */
|
|
846
|
+
jsonBody(path?: string | object, value?: any): PmAssertion;
|
|
847
|
+
/** Body validates against a JSON schema (ajv). Works on any value: pm.expect(obj).to.have.jsonSchema(schema). */
|
|
848
|
+
jsonSchema(schema: object, ajvOptions?: object): PmAssertion;
|
|
849
|
+
/** Chain into .below() / .above() / .within() — pm.response.to.have.responseTime.below(200). */
|
|
850
|
+
readonly responseTime: PmAssertion;
|
|
851
|
+
readonly responseSize: PmAssertion;
|
|
852
|
+
/** 2xx. */
|
|
853
|
+
readonly success: PmAssertion;
|
|
854
|
+
/** 1xx. */
|
|
855
|
+
readonly info: PmAssertion;
|
|
856
|
+
/** 3xx. */
|
|
857
|
+
readonly redirection: PmAssertion;
|
|
858
|
+
/** 4xx. */
|
|
859
|
+
readonly clientError: PmAssertion;
|
|
860
|
+
/** 5xx. */
|
|
861
|
+
readonly serverError: PmAssertion;
|
|
862
|
+
/** 4xx or 5xx. */
|
|
863
|
+
readonly error: PmAssertion;
|
|
864
|
+
readonly accepted: PmAssertion;
|
|
865
|
+
readonly badRequest: PmAssertion;
|
|
866
|
+
readonly unauthorized: PmAssertion;
|
|
867
|
+
readonly unauthorised: PmAssertion;
|
|
868
|
+
readonly forbidden: PmAssertion;
|
|
869
|
+
readonly notFound: PmAssertion;
|
|
870
|
+
readonly notAcceptable: PmAssertion;
|
|
871
|
+
readonly rateLimited: PmAssertion;
|
|
872
|
+
readonly withoutContent: PmAssertion;
|
|
873
|
+
readonly withBody: PmAssertion;
|
|
874
|
+
readonly json: PmAssertion;
|
|
875
|
+
readonly xml: PmAssertion;
|
|
876
|
+
readonly html: PmAssertion;
|
|
877
|
+
/** The subject is a postman-collection Request / Response. */
|
|
878
|
+
readonly postmanRequest: PmAssertion;
|
|
879
|
+
readonly postmanResponse: PmAssertion;
|
|
880
|
+
readonly postmanRequestOrResponse: PmAssertion;
|
|
881
|
+
}
|
|
882
|
+
/** A chai chainable method: callable, and still an assertion for chains like .to.have.length.above(2). */
|
|
883
|
+
type PmChainableAssertion<Call extends (...args: any[]) => any> = PmAssertion & Call;
|
|
884
|
+
|
|
885
|
+
interface PmExpect {
|
|
886
|
+
/** Start a chai assertion. Fails the surrounding pm.test (or the script when used outside one). */
|
|
887
|
+
<T = any>(actual: T, message?: string): PmAssertion;
|
|
888
|
+
/** Throw an AssertionError. */
|
|
889
|
+
fail(message?: string): never;
|
|
890
|
+
fail(actual: any, expected: any, message?: string, operator?: string): never;
|
|
891
|
+
}
|
|
892
|
+
`;
|
|
893
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
894
|
+
// Variables, info, execution
|
|
895
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
896
|
+
const VARIABLE_TYPES = `
|
|
897
|
+
type PmVariableType = "string" | "boolean" | "number" | "json" | "any";
|
|
898
|
+
|
|
899
|
+
/** pm.environment / pm.globals / pm.collectionVariables. */
|
|
900
|
+
interface PmVariableScope {
|
|
901
|
+
/** Scope name (the active environment's name for pm.environment). */
|
|
902
|
+
readonly name: string;
|
|
903
|
+
/** Raw string values as they will be stored. */
|
|
904
|
+
readonly values: Record<string, string>;
|
|
905
|
+
/** The value as it was set (numbers, objects… stay native within the run; stored values are strings / JSON). */
|
|
906
|
+
get(key: string): any;
|
|
907
|
+
set(key: string, value: any, type?: PmVariableType): void;
|
|
908
|
+
unset(key: string): void;
|
|
909
|
+
has(key: string): boolean;
|
|
910
|
+
clear(): void;
|
|
911
|
+
toObject(): Record<string, any>;
|
|
912
|
+
/** Resolve {{variables}} against THIS scope. Unresolved {{x}} stay as written; objects and arrays are walked. */
|
|
913
|
+
replaceIn(template: string): string;
|
|
914
|
+
replaceIn<T extends object>(template: T): T;
|
|
915
|
+
replaceIn(template: any): any;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/** pm.variables — read through every scope (local > iteration data > environment > collection > globals). */
|
|
919
|
+
interface PmVariables {
|
|
920
|
+
get(key: string): any;
|
|
921
|
+
/** Writes the run-local scope (shared by the scripts of one request). */
|
|
922
|
+
set(key: string, value: any, type?: PmVariableType): void;
|
|
923
|
+
unset(key: string): void;
|
|
924
|
+
has(key: string): boolean;
|
|
925
|
+
clear(): void;
|
|
926
|
+
toObject(): Record<string, any>;
|
|
927
|
+
/** Postman's replaceIn: unresolved {{x}} stay as written; objects and arrays are walked. */
|
|
928
|
+
replaceIn(template: string): string;
|
|
929
|
+
replaceIn<T extends object>(template: T): T;
|
|
930
|
+
replaceIn(template: any): any;
|
|
931
|
+
/** Callman's older resolver: like replaceIn on a string, but unresolved {{x}} become "". */
|
|
932
|
+
resolve(template: any): string;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/** pm.iterationData — the data-file row of the current iteration. */
|
|
936
|
+
interface PmIterationData {
|
|
937
|
+
get(key: string): any;
|
|
938
|
+
set(key: string, value: any): void;
|
|
939
|
+
unset(key: string): void;
|
|
940
|
+
has(key: string): boolean;
|
|
941
|
+
clear(): void;
|
|
942
|
+
toObject(): Record<string, any>;
|
|
943
|
+
toJSON(): Record<string, any>;
|
|
944
|
+
replaceIn(template: string): string;
|
|
945
|
+
replaceIn<T extends object>(template: T): T;
|
|
946
|
+
replaceIn(template: any): any;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
interface PmInfo {
|
|
950
|
+
/** "prerequest" in pre-request scripts, "test" in post-response / tests scripts, "scenario-script" in scenario script nodes. */
|
|
951
|
+
readonly eventName: "prerequest" | "test" | "scenario-script" | (string & {});
|
|
952
|
+
/** 0-based iteration index (0 outside a data-driven run). */
|
|
953
|
+
readonly iteration: number;
|
|
954
|
+
/** Total iterations (1 outside a data-driven run). */
|
|
955
|
+
readonly iterationCount: number;
|
|
956
|
+
readonly requestName: string;
|
|
957
|
+
readonly requestId: string;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
interface PmExecutionLocation extends Array<string> {
|
|
961
|
+
/** Name of the current request (last segment). */
|
|
962
|
+
readonly current: string;
|
|
963
|
+
}
|
|
964
|
+
interface PmExecution {
|
|
965
|
+
/** Run the request with this name / id next (collection runs). null stops the run after the current request. */
|
|
966
|
+
setNextRequest(request: string | null | undefined): void;
|
|
967
|
+
/** Folder path to the current request. */
|
|
968
|
+
readonly location: PmExecutionLocation;
|
|
969
|
+
/** Not supported in Callman yet — always throws. */
|
|
970
|
+
runRequest(request: string, options?: { variables?: Record<string, any> }): Promise<never>;
|
|
971
|
+
/** Skip the current request (its post-response / tests scripts do not run). Only takes effect in a PRE-REQUEST script; elsewhere it has no effect. */
|
|
972
|
+
skipRequest(): void;
|
|
973
|
+
}
|
|
974
|
+
interface PmExecutionPreRequest extends PmExecution {}
|
|
975
|
+
`;
|
|
976
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
977
|
+
// Callman-specific APIs
|
|
978
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
979
|
+
const CALLMAN_TYPES = `
|
|
980
|
+
interface PmDbPhaseResult {
|
|
981
|
+
success: boolean;
|
|
982
|
+
error: string | null;
|
|
983
|
+
rowCount: number;
|
|
984
|
+
rows: any[];
|
|
985
|
+
/** First row or null. Oracle column names are UPPERCASE. */
|
|
986
|
+
firstRow(): any;
|
|
987
|
+
}
|
|
988
|
+
/** The post-response DB query result is only populated in the tests script; here it is always empty. */
|
|
989
|
+
interface PmDbEmptyResult {
|
|
990
|
+
success: boolean;
|
|
991
|
+
error: string | null;
|
|
992
|
+
rowCount: number;
|
|
993
|
+
rows: never[];
|
|
994
|
+
firstRow(): null;
|
|
995
|
+
}
|
|
996
|
+
interface PmDbQueryResult extends PmDbPhaseResult {
|
|
997
|
+
connectionId: string;
|
|
998
|
+
connectionName: string;
|
|
999
|
+
connectionType: string;
|
|
1000
|
+
phase: "pre" | "post" | "manual";
|
|
1001
|
+
query: string;
|
|
1002
|
+
resolvedQuery: string;
|
|
1003
|
+
durationMs: number;
|
|
1004
|
+
executedAt: string;
|
|
1005
|
+
}
|
|
1006
|
+
interface PmDbQueryInput {
|
|
1007
|
+
/** Defaults to the request's configured connection. */
|
|
1008
|
+
connectionId?: string;
|
|
1009
|
+
/** SQL text; for MongoDB a JSON string of a command object. */
|
|
1010
|
+
query: string;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
interface PmRedisCommandResult {
|
|
1014
|
+
success: boolean;
|
|
1015
|
+
error: string | null;
|
|
1016
|
+
connectionId: string;
|
|
1017
|
+
connectionName: string;
|
|
1018
|
+
command: string;
|
|
1019
|
+
resolvedCommand: string;
|
|
1020
|
+
commandName: string;
|
|
1021
|
+
key: string | null;
|
|
1022
|
+
result: any;
|
|
1023
|
+
resultText: string;
|
|
1024
|
+
phase: "pre" | "post" | "manual";
|
|
1025
|
+
durationMs: number;
|
|
1026
|
+
executedAt: string;
|
|
1027
|
+
}
|
|
1028
|
+
interface PmRedisApi {
|
|
1029
|
+
/** Value already captured by a declared GET command (synchronous). */
|
|
1030
|
+
get(key: string): any;
|
|
1031
|
+
/** Results of the declared pre / post commands, by line index. */
|
|
1032
|
+
readonly results: { pre: any[]; post: any[] };
|
|
1033
|
+
/** Run an ad-hoc command — always await it. */
|
|
1034
|
+
command(input: { connectionId?: string; command: string }): Promise<PmRedisCommandResult>;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/** pm.random.* — every generator returns a STRING (int / boolean / bigdecimal too). */
|
|
1038
|
+
interface PmRandom {
|
|
1039
|
+
uuid(): string;
|
|
1040
|
+
int(min?: number, max?: number): string;
|
|
1041
|
+
string(length?: number): string;
|
|
1042
|
+
email(): string;
|
|
1043
|
+
phone(): string;
|
|
1044
|
+
name(): string;
|
|
1045
|
+
date(format?: string): string;
|
|
1046
|
+
boolean(): "true" | "false";
|
|
1047
|
+
bigdecimal(min?: number, max?: number, scale?: number): string;
|
|
1048
|
+
}
|
|
1049
|
+
interface PmCounter {
|
|
1050
|
+
/** Next value of the run counter (starts at 1). */
|
|
1051
|
+
next(): number;
|
|
1052
|
+
/** Counter that starts at startAt (default 1). */
|
|
1053
|
+
start(startAt?: number): number;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
interface ScenarioNodeExecutionMeta {
|
|
1057
|
+
status: "success" | "failed" | "skipped";
|
|
1058
|
+
success: boolean;
|
|
1059
|
+
failed: boolean;
|
|
1060
|
+
skipped: boolean;
|
|
1061
|
+
attempts: number;
|
|
1062
|
+
startedAt: string;
|
|
1063
|
+
endedAt: string;
|
|
1064
|
+
durationMs: number;
|
|
1065
|
+
continueAfterFailure?: boolean;
|
|
1066
|
+
error?: { message?: string | null; code?: string | null; type?: string | null } | null;
|
|
1067
|
+
}
|
|
1068
|
+
interface WorkflowExecutionMeta {
|
|
1069
|
+
status: "success" | "failed" | "partial";
|
|
1070
|
+
success: boolean;
|
|
1071
|
+
failed: boolean;
|
|
1072
|
+
totalNodes: number;
|
|
1073
|
+
successfulNodes: number;
|
|
1074
|
+
failedNodes: number;
|
|
1075
|
+
skippedNodes: number;
|
|
1076
|
+
totalRetries: number;
|
|
1077
|
+
startedAt: string;
|
|
1078
|
+
endedAt: string;
|
|
1079
|
+
durationMs: number;
|
|
1080
|
+
currentNode?: string | null;
|
|
1081
|
+
lastNode?: string | null;
|
|
1082
|
+
failedNode?: string | null;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
interface PmSendRequestCallback {
|
|
1086
|
+
(error: Error | null, response: PmResponse, history?: any): void;
|
|
1087
|
+
}
|
|
1088
|
+
interface PmSendRequest {
|
|
1089
|
+
/**
|
|
1090
|
+
* Send an HTTP request from a script. Accepts a URL string, Postman's request
|
|
1091
|
+
* options, or a postman-collection Request. Resolves to a Response (same API as
|
|
1092
|
+
* pm.response); the optional callback gets (error, response) too.
|
|
1093
|
+
*/
|
|
1094
|
+
(request: string | PmRequestDefinition | PmRequest, callback?: PmSendRequestCallback): Promise<PmResponse>;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
interface PmVisualizer {
|
|
1098
|
+
/** Render a Handlebars HTML template with data in the Visualize tab. */
|
|
1099
|
+
set(template: string, data?: object, options?: object): void;
|
|
1100
|
+
clear(): void;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
interface PmTest {
|
|
1104
|
+
/** Register a test. The callback runs synchronously; a throw marks the test failed. Use (done) => … for callback-style async. */
|
|
1105
|
+
(name: string, fn?: (done: (error?: any) => void) => any): Promise<void>;
|
|
1106
|
+
/** Record a skipped test (the callback is not run). */
|
|
1107
|
+
skip(name: string, reason?: any): void;
|
|
1108
|
+
/** Number of tests recorded so far in this script. */
|
|
1109
|
+
index(): number;
|
|
1110
|
+
}
|
|
1111
|
+
`;
|
|
1112
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1113
|
+
// Library facades for require() / pm.require()
|
|
1114
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1115
|
+
const MODULE_TYPES = `
|
|
1116
|
+
interface PmLodashChain<T = any> {
|
|
1117
|
+
value(): T;
|
|
1118
|
+
map<R>(iteratee: ((value: any, indexOrKey: any) => R) | string): PmLodashChain<R[]>;
|
|
1119
|
+
filter(predicate?: ((value: any, indexOrKey: any) => any) | object | string): PmLodashChain<T>;
|
|
1120
|
+
reject(predicate?: ((value: any, indexOrKey: any) => any) | object | string): PmLodashChain<T>;
|
|
1121
|
+
sortBy(...iteratees: Array<((value: any) => any) | string>): PmLodashChain<T>;
|
|
1122
|
+
groupBy(iteratee?: ((value: any) => any) | string): PmLodashChain<Record<string, any[]>>;
|
|
1123
|
+
keyBy(iteratee?: ((value: any) => any) | string): PmLodashChain<Record<string, any>>;
|
|
1124
|
+
uniq(): PmLodashChain<T>;
|
|
1125
|
+
flatten(): PmLodashChain<any[]>;
|
|
1126
|
+
compact(): PmLodashChain<T>;
|
|
1127
|
+
take(n?: number): PmLodashChain<T>;
|
|
1128
|
+
reverse(): PmLodashChain<T>;
|
|
1129
|
+
first(): PmLodashChain<any>;
|
|
1130
|
+
last(): PmLodashChain<any>;
|
|
1131
|
+
size(): PmLodashChain<number>;
|
|
1132
|
+
sum(): PmLodashChain<number>;
|
|
1133
|
+
toPairs(): PmLodashChain<Array<[string, any]>>;
|
|
1134
|
+
keys(): PmLodashChain<string[]>;
|
|
1135
|
+
values(): PmLodashChain<any[]>;
|
|
1136
|
+
[method: string]: any;
|
|
1137
|
+
}
|
|
1138
|
+
/** lodash (the global _ and require("lodash")). Unlisted methods are available through the index signature. */
|
|
1139
|
+
interface PmLodash {
|
|
1140
|
+
<T = any>(value: T): PmLodashChain<T>;
|
|
1141
|
+
/** Explicit chain: _.chain(x).map(...).value(). */
|
|
1142
|
+
chain<T = any>(value: T): PmLodashChain<T>;
|
|
1143
|
+
VERSION: string;
|
|
1144
|
+
filter<T>(collection: T[] | Record<string, T> | null | undefined, predicate?: ((value: T, indexOrKey: any) => any) | Partial<T> | string | [string, any]): T[];
|
|
1145
|
+
reject<T>(collection: T[] | Record<string, T> | null | undefined, predicate?: ((value: T, indexOrKey: any) => any) | Partial<T> | string | [string, any]): T[];
|
|
1146
|
+
map<T, R>(collection: T[] | Record<string, T> | null | undefined, iteratee: ((value: T, indexOrKey: any) => R) | string): R[];
|
|
1147
|
+
forEach<T>(collection: T[] | Record<string, T> | null | undefined, iteratee: (value: T, indexOrKey: any) => any): any;
|
|
1148
|
+
each<T>(collection: T[] | Record<string, T> | null | undefined, iteratee: (value: T, indexOrKey: any) => any): any;
|
|
1149
|
+
find<T>(collection: T[] | Record<string, T> | null | undefined, predicate?: ((value: T, indexOrKey: any) => any) | Partial<T> | string | [string, any]): T | undefined;
|
|
1150
|
+
findIndex<T>(array: T[] | null | undefined, predicate?: ((value: T) => any) | Partial<T> | string | [string, any]): number;
|
|
1151
|
+
some<T>(collection: T[] | Record<string, T> | null | undefined, predicate?: ((value: T) => any) | Partial<T> | string | [string, any]): boolean;
|
|
1152
|
+
every<T>(collection: T[] | Record<string, T> | null | undefined, predicate?: ((value: T) => any) | Partial<T> | string | [string, any]): boolean;
|
|
1153
|
+
includes<T>(collection: T[] | Record<string, T> | string | null | undefined, value: T, fromIndex?: number): boolean;
|
|
1154
|
+
groupBy<T>(collection: T[] | Record<string, T> | null | undefined, iteratee?: ((value: T) => any) | string | object): Record<string, T[]>;
|
|
1155
|
+
keyBy<T>(collection: T[] | Record<string, T> | null | undefined, iteratee?: ((value: T) => any) | string): Record<string, T>;
|
|
1156
|
+
countBy<T>(collection: T[] | Record<string, T> | null | undefined, iteratee?: ((value: T) => any) | string): Record<string, number>;
|
|
1157
|
+
sortBy<T>(collection: T[] | Record<string, T> | null | undefined, ...iteratees: any[]): T[];
|
|
1158
|
+
orderBy<T>(collection: T[] | Record<string, T> | null | undefined, iteratees?: any, orders?: any): T[];
|
|
1159
|
+
uniq<T>(array: T[] | null | undefined): T[];
|
|
1160
|
+
uniqBy<T>(array: T[] | null | undefined, iteratee: ((value: T) => any) | string): T[];
|
|
1161
|
+
compact<T>(array: Array<T | null | undefined | false | 0 | ""> | null | undefined): T[];
|
|
1162
|
+
flatten<T>(array: any[] | null | undefined): T[];
|
|
1163
|
+
flattenDeep<T>(array: any[] | null | undefined): T[];
|
|
1164
|
+
chunk<T>(array: T[] | null | undefined, size?: number): T[][];
|
|
1165
|
+
difference<T>(array: T[] | null | undefined, ...values: T[][]): T[];
|
|
1166
|
+
intersection<T>(...arrays: T[][]): T[];
|
|
1167
|
+
union<T>(...arrays: T[][]): T[];
|
|
1168
|
+
zip<T>(...arrays: T[][]): Array<Array<T | undefined>>;
|
|
1169
|
+
first<T>(array: T[] | null | undefined): T | undefined;
|
|
1170
|
+
last<T>(array: T[] | null | undefined): T | undefined;
|
|
1171
|
+
take<T>(array: T[] | null | undefined, n?: number): T[];
|
|
1172
|
+
drop<T>(array: T[] | null | undefined, n?: number): T[];
|
|
1173
|
+
range(start: number, end?: number, step?: number): number[];
|
|
1174
|
+
sum(array: number[] | null | undefined): number;
|
|
1175
|
+
sumBy<T>(array: T[] | null | undefined, iteratee: ((value: T) => number) | string): number;
|
|
1176
|
+
mean(array: number[] | null | undefined): number;
|
|
1177
|
+
min<T>(array: T[] | null | undefined): T | undefined;
|
|
1178
|
+
max<T>(array: T[] | null | undefined): T | undefined;
|
|
1179
|
+
minBy<T>(array: T[] | null | undefined, iteratee: ((value: T) => any) | string): T | undefined;
|
|
1180
|
+
maxBy<T>(array: T[] | null | undefined, iteratee: ((value: T) => any) | string): T | undefined;
|
|
1181
|
+
pick<T extends object>(object: T | null | undefined, ...paths: Array<string | string[]>): Partial<T>;
|
|
1182
|
+
omit<T extends object>(object: T | null | undefined, ...paths: Array<string | string[]>): Partial<T>;
|
|
1183
|
+
pickBy<T extends object>(object: T | null | undefined, predicate?: (value: any, key: string) => any): Partial<T>;
|
|
1184
|
+
omitBy<T extends object>(object: T | null | undefined, predicate?: (value: any, key: string) => any): Partial<T>;
|
|
1185
|
+
merge<T extends object>(object: T, ...sources: any[]): T;
|
|
1186
|
+
assign<T extends object>(object: T, ...sources: any[]): T;
|
|
1187
|
+
defaults<T extends object>(object: T, ...sources: any[]): T;
|
|
1188
|
+
cloneDeep<T>(value: T): T;
|
|
1189
|
+
clone<T>(value: T): T;
|
|
1190
|
+
isEqual(a: any, b: any): boolean;
|
|
1191
|
+
get(object: any, path: string | Array<string | number>, defaultValue?: any): any;
|
|
1192
|
+
set<T extends object>(object: T, path: string | Array<string | number>, value: any): T;
|
|
1193
|
+
has(object: any, path: string | Array<string | number>): boolean;
|
|
1194
|
+
unset(object: any, path: string | Array<string | number>): boolean;
|
|
1195
|
+
keys(object: any): string[];
|
|
1196
|
+
values<T>(object: Record<string, T> | ArrayLike<T> | null | undefined): T[];
|
|
1197
|
+
entries<T>(object: Record<string, T> | null | undefined): Array<[string, T]>;
|
|
1198
|
+
toPairs<T>(object: Record<string, T> | null | undefined): Array<[string, T]>;
|
|
1199
|
+
fromPairs<T>(pairs: Array<[string, T]>): Record<string, T>;
|
|
1200
|
+
mapValues<T, R>(object: Record<string, T> | null | undefined, iteratee: ((value: T, key: string) => R) | string): Record<string, R>;
|
|
1201
|
+
mapKeys<T>(object: Record<string, T> | null | undefined, iteratee: (value: T, key: string) => string): Record<string, T>;
|
|
1202
|
+
invert(object: object): Record<string, string>;
|
|
1203
|
+
size(collection: any): number;
|
|
1204
|
+
isEmpty(value: any): boolean;
|
|
1205
|
+
isArray(value: any): value is any[];
|
|
1206
|
+
isObject(value: any): boolean;
|
|
1207
|
+
isPlainObject(value: any): boolean;
|
|
1208
|
+
isString(value: any): value is string;
|
|
1209
|
+
isNumber(value: any): value is number;
|
|
1210
|
+
isBoolean(value: any): value is boolean;
|
|
1211
|
+
isFunction(value: any): value is Function;
|
|
1212
|
+
isNil(value: any): value is null | undefined;
|
|
1213
|
+
isNull(value: any): value is null;
|
|
1214
|
+
isUndefined(value: any): value is undefined;
|
|
1215
|
+
toString(value: any): string;
|
|
1216
|
+
toNumber(value: any): number;
|
|
1217
|
+
toInteger(value: any): number;
|
|
1218
|
+
camelCase(value?: string): string;
|
|
1219
|
+
kebabCase(value?: string): string;
|
|
1220
|
+
snakeCase(value?: string): string;
|
|
1221
|
+
startCase(value?: string): string;
|
|
1222
|
+
capitalize(value?: string): string;
|
|
1223
|
+
upperFirst(value?: string): string;
|
|
1224
|
+
lowerFirst(value?: string): string;
|
|
1225
|
+
trim(value?: string, chars?: string): string;
|
|
1226
|
+
pad(value?: string, length?: number, chars?: string): string;
|
|
1227
|
+
padStart(value?: string, length?: number, chars?: string): string;
|
|
1228
|
+
padEnd(value?: string, length?: number, chars?: string): string;
|
|
1229
|
+
repeat(value?: string, n?: number): string;
|
|
1230
|
+
random(min?: number, max?: number, floating?: boolean): number;
|
|
1231
|
+
shuffle<T>(collection: T[] | null | undefined): T[];
|
|
1232
|
+
sample<T>(collection: T[] | null | undefined): T | undefined;
|
|
1233
|
+
sampleSize<T>(collection: T[] | null | undefined, n?: number): T[];
|
|
1234
|
+
debounce<F extends (...args: any[]) => any>(fn: F, wait?: number, options?: object): F;
|
|
1235
|
+
throttle<F extends (...args: any[]) => any>(fn: F, wait?: number, options?: object): F;
|
|
1236
|
+
memoize<F extends (...args: any[]) => any>(fn: F, resolver?: (...args: any[]) => any): F;
|
|
1237
|
+
once<F extends (...args: any[]) => any>(fn: F): F;
|
|
1238
|
+
times<R>(n: number, iteratee: (index: number) => R): R[];
|
|
1239
|
+
noop(...args: any[]): void;
|
|
1240
|
+
identity<T>(value: T): T;
|
|
1241
|
+
uniqueId(prefix?: string): string;
|
|
1242
|
+
/** Any other lodash function. */
|
|
1243
|
+
[method: string]: any;
|
|
1244
|
+
}
|
|
1245
|
+
declare const _: PmLodash;
|
|
1246
|
+
|
|
1247
|
+
interface PmMoment {
|
|
1248
|
+
format(pattern?: string): string;
|
|
1249
|
+
add(amount: number | string | object, unit?: string): PmMoment;
|
|
1250
|
+
subtract(amount: number | string | object, unit?: string): PmMoment;
|
|
1251
|
+
startOf(unit: string): PmMoment;
|
|
1252
|
+
endOf(unit: string): PmMoment;
|
|
1253
|
+
diff(other: any, unit?: string, precise?: boolean): number;
|
|
1254
|
+
isBefore(other?: any, unit?: string): boolean;
|
|
1255
|
+
isAfter(other?: any, unit?: string): boolean;
|
|
1256
|
+
isSame(other?: any, unit?: string): boolean;
|
|
1257
|
+
isSameOrBefore(other?: any, unit?: string): boolean;
|
|
1258
|
+
isSameOrAfter(other?: any, unit?: string): boolean;
|
|
1259
|
+
isBetween(from: any, to: any, unit?: string, inclusivity?: string): boolean;
|
|
1260
|
+
isValid(): boolean;
|
|
1261
|
+
clone(): PmMoment;
|
|
1262
|
+
utc(keepLocalTime?: boolean): PmMoment;
|
|
1263
|
+
local(): PmMoment;
|
|
1264
|
+
utcOffset(offset?: number | string): any;
|
|
1265
|
+
unix(): number;
|
|
1266
|
+
valueOf(): number;
|
|
1267
|
+
toDate(): Date;
|
|
1268
|
+
toISOString(keepOffset?: boolean): string;
|
|
1269
|
+
toJSON(): string;
|
|
1270
|
+
toArray(): number[];
|
|
1271
|
+
toObject(): object;
|
|
1272
|
+
fromNow(withoutSuffix?: boolean): string;
|
|
1273
|
+
toNow(withoutSuffix?: boolean): string;
|
|
1274
|
+
from(other: any, withoutSuffix?: boolean): string;
|
|
1275
|
+
calendar(reference?: any, formats?: object): string;
|
|
1276
|
+
year(value?: number): any;
|
|
1277
|
+
month(value?: number | string): any;
|
|
1278
|
+
date(value?: number): any;
|
|
1279
|
+
day(value?: number | string): any;
|
|
1280
|
+
hour(value?: number): any;
|
|
1281
|
+
minute(value?: number): any;
|
|
1282
|
+
second(value?: number): any;
|
|
1283
|
+
millisecond(value?: number): any;
|
|
1284
|
+
set(unit: string | object, value?: number): PmMoment;
|
|
1285
|
+
get(unit: string): number;
|
|
1286
|
+
locale(locale?: string): any;
|
|
1287
|
+
[method: string]: any;
|
|
1288
|
+
}
|
|
1289
|
+
interface PmMomentStatic {
|
|
1290
|
+
(input?: any, format?: string | string[], strict?: boolean): PmMoment;
|
|
1291
|
+
(input: any, format: string, locale: string, strict?: boolean): PmMoment;
|
|
1292
|
+
utc(input?: any, format?: string | string[], strict?: boolean): PmMoment;
|
|
1293
|
+
unix(seconds: number): PmMoment;
|
|
1294
|
+
duration(input?: any, unit?: string): any;
|
|
1295
|
+
isMoment(value: any): value is PmMoment;
|
|
1296
|
+
isDate(value: any): value is Date;
|
|
1297
|
+
isDuration(value: any): boolean;
|
|
1298
|
+
max(...moments: any[]): PmMoment;
|
|
1299
|
+
min(...moments: any[]): PmMoment;
|
|
1300
|
+
locale(locale?: string): string;
|
|
1301
|
+
tz?: any;
|
|
1302
|
+
[member: string]: any;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
interface PmChaiStatic {
|
|
1306
|
+
expect: PmExpect;
|
|
1307
|
+
assert: any;
|
|
1308
|
+
should(): any;
|
|
1309
|
+
use(plugin: (chai: any, utils: any) => void): PmChaiStatic;
|
|
1310
|
+
Assertion: any;
|
|
1311
|
+
AssertionError: any;
|
|
1312
|
+
config: Record<string, any>;
|
|
1313
|
+
util: any;
|
|
1314
|
+
version: string;
|
|
1315
|
+
[member: string]: any;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
interface PmAjvError {
|
|
1319
|
+
keyword: string;
|
|
1320
|
+
dataPath: string;
|
|
1321
|
+
schemaPath: string;
|
|
1322
|
+
params: Record<string, any>;
|
|
1323
|
+
message?: string;
|
|
1324
|
+
}
|
|
1325
|
+
interface PmAjvValidate {
|
|
1326
|
+
(data: any): boolean | Promise<any>;
|
|
1327
|
+
errors?: PmAjvError[] | null;
|
|
1328
|
+
schema?: any;
|
|
1329
|
+
}
|
|
1330
|
+
interface PmAjvInstance {
|
|
1331
|
+
compile(schema: object | boolean): PmAjvValidate;
|
|
1332
|
+
validate(schemaKeyRef: object | string | boolean, data: any): boolean | Promise<any>;
|
|
1333
|
+
addSchema(schema: object | object[], key?: string): PmAjvInstance;
|
|
1334
|
+
addFormat(name: string, format: any): PmAjvInstance;
|
|
1335
|
+
addKeyword(keyword: string, definition: object): PmAjvInstance;
|
|
1336
|
+
getSchema(keyRef: string): PmAjvValidate | undefined;
|
|
1337
|
+
removeSchema(schemaKeyRef?: any): PmAjvInstance;
|
|
1338
|
+
errorsText(errors?: PmAjvError[] | null, options?: { separator?: string; dataVar?: string }): string;
|
|
1339
|
+
errors?: PmAjvError[] | null;
|
|
1340
|
+
}
|
|
1341
|
+
/** ajv v6 (what Postman ships). */
|
|
1342
|
+
interface PmAjvConstructor {
|
|
1343
|
+
new (options?: object): PmAjvInstance;
|
|
1344
|
+
(options?: object): PmAjvInstance;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
interface PmCheerioSelection {
|
|
1348
|
+
length: number;
|
|
1349
|
+
[index: number]: any;
|
|
1350
|
+
text(): string;
|
|
1351
|
+
html(): string | null;
|
|
1352
|
+
attr(name: string): string | undefined;
|
|
1353
|
+
attr(name: string, value: string): PmCheerioSelection;
|
|
1354
|
+
find(selector: string): PmCheerioSelection;
|
|
1355
|
+
children(selector?: string): PmCheerioSelection;
|
|
1356
|
+
parent(selector?: string): PmCheerioSelection;
|
|
1357
|
+
first(): PmCheerioSelection;
|
|
1358
|
+
last(): PmCheerioSelection;
|
|
1359
|
+
eq(index: number): PmCheerioSelection;
|
|
1360
|
+
each(callback: (index: number, element: any) => any): PmCheerioSelection;
|
|
1361
|
+
map(callback: (index: number, element: any) => any): PmCheerioSelection;
|
|
1362
|
+
get(): any[];
|
|
1363
|
+
hasClass(name: string): boolean;
|
|
1364
|
+
val(): string | undefined;
|
|
1365
|
+
data(name?: string): any;
|
|
1366
|
+
[member: string]: any;
|
|
1367
|
+
}
|
|
1368
|
+
interface PmCheerioApi {
|
|
1369
|
+
(selector: any, context?: any): PmCheerioSelection;
|
|
1370
|
+
load(html: string, options?: object): PmCheerioApi;
|
|
1371
|
+
html(selector?: any): string;
|
|
1372
|
+
root(): PmCheerioSelection;
|
|
1373
|
+
[member: string]: any;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
interface PmXml2js {
|
|
1377
|
+
parseString(xml: string, callback: (error: Error | null, result: any) => void): void;
|
|
1378
|
+
parseString(xml: string, options: object, callback: (error: Error | null, result: any) => void): void;
|
|
1379
|
+
parseStringPromise(xml: string, options?: object): Promise<any>;
|
|
1380
|
+
Parser: new (options?: object) => { parseString(xml: string, callback: (error: Error | null, result: any) => void): void; parseStringPromise(xml: string): Promise<any> };
|
|
1381
|
+
Builder: new (options?: object) => { buildObject(rootObj: object): string };
|
|
1382
|
+
[member: string]: any;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
interface PmTv4 {
|
|
1386
|
+
validate(data: any, schema: object, checkRecursive?: boolean, banUnknownProperties?: boolean): boolean;
|
|
1387
|
+
validateResult(data: any, schema: object, checkRecursive?: boolean, banUnknownProperties?: boolean): { valid: boolean; error: any; missing: string[] };
|
|
1388
|
+
validateMultiple(data: any, schema: object, checkRecursive?: boolean, banUnknownProperties?: boolean): { valid: boolean; errors: any[]; missing: string[] };
|
|
1389
|
+
addSchema(uri: string, schema: object): void;
|
|
1390
|
+
error: any;
|
|
1391
|
+
missing: string[];
|
|
1392
|
+
[member: string]: any;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
interface PmUuid {
|
|
1396
|
+
(): string;
|
|
1397
|
+
v4(): string;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
interface PmPathModule {
|
|
1401
|
+
sep: string;
|
|
1402
|
+
delimiter: string;
|
|
1403
|
+
join(...paths: string[]): string;
|
|
1404
|
+
resolve(...paths: string[]): string;
|
|
1405
|
+
normalize(path: string): string;
|
|
1406
|
+
relative(from: string, to: string): string;
|
|
1407
|
+
dirname(path: string): string;
|
|
1408
|
+
basename(path: string, suffix?: string): string;
|
|
1409
|
+
extname(path: string): string;
|
|
1410
|
+
isAbsolute(path: string): boolean;
|
|
1411
|
+
parse(path: string): { root: string; dir: string; base: string; ext: string; name: string };
|
|
1412
|
+
format(parts: { root?: string; dir?: string; base?: string; ext?: string; name?: string }): string;
|
|
1413
|
+
}
|
|
1414
|
+
interface PmAssertModule {
|
|
1415
|
+
(value: any, message?: string): void;
|
|
1416
|
+
ok(value: any, message?: string): void;
|
|
1417
|
+
equal(actual: any, expected: any, message?: string): void;
|
|
1418
|
+
notEqual(actual: any, expected: any, message?: string): void;
|
|
1419
|
+
strictEqual(actual: any, expected: any, message?: string): void;
|
|
1420
|
+
notStrictEqual(actual: any, expected: any, message?: string): void;
|
|
1421
|
+
deepEqual(actual: any, expected: any, message?: string): void;
|
|
1422
|
+
deepStrictEqual(actual: any, expected: any, message?: string): void;
|
|
1423
|
+
notDeepStrictEqual(actual: any, expected: any, message?: string): void;
|
|
1424
|
+
throws(fn: () => any, expected?: any, message?: string): void;
|
|
1425
|
+
doesNotThrow(fn: () => any, message?: string): void;
|
|
1426
|
+
rejects(promiseOrFn: Promise<any> | (() => Promise<any>), expected?: any, message?: string): Promise<void>;
|
|
1427
|
+
match(value: string, regexp: RegExp, message?: string): void;
|
|
1428
|
+
fail(message?: string): never;
|
|
1429
|
+
[member: string]: any;
|
|
1430
|
+
}
|
|
1431
|
+
interface PmUtilModule {
|
|
1432
|
+
format(format: any, ...args: any[]): string;
|
|
1433
|
+
inspect(value: any, options?: object): string;
|
|
1434
|
+
promisify<F extends (...args: any[]) => any>(fn: F): (...args: any[]) => Promise<any>;
|
|
1435
|
+
inherits(constructor: Function, superConstructor: Function): void;
|
|
1436
|
+
isDeepStrictEqual(a: any, b: any): boolean;
|
|
1437
|
+
types: Record<string, (value: any) => boolean>;
|
|
1438
|
+
TextEncoder: typeof TextEncoder;
|
|
1439
|
+
TextDecoder: typeof TextDecoder;
|
|
1440
|
+
[member: string]: any;
|
|
1441
|
+
}
|
|
1442
|
+
interface PmEventEmitter {
|
|
1443
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1444
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1445
|
+
off(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1446
|
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1447
|
+
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1448
|
+
removeAllListeners(event?: string | symbol): this;
|
|
1449
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
|
1450
|
+
listeners(event: string | symbol): Function[];
|
|
1451
|
+
listenerCount(event: string | symbol): number;
|
|
1452
|
+
setMaxListeners(n: number): this;
|
|
1453
|
+
}
|
|
1454
|
+
interface PmEventsModule {
|
|
1455
|
+
new (options?: object): PmEventEmitter;
|
|
1456
|
+
EventEmitter: new (options?: object) => PmEventEmitter;
|
|
1457
|
+
once(emitter: PmEventEmitter, event: string): Promise<any[]>;
|
|
1458
|
+
[member: string]: any;
|
|
1459
|
+
}
|
|
1460
|
+
interface PmQuerystringModule {
|
|
1461
|
+
parse(str: string, sep?: string, eq?: string, options?: object): Record<string, string | string[]>;
|
|
1462
|
+
stringify(obj: object, sep?: string, eq?: string, options?: object): string;
|
|
1463
|
+
escape(str: string): string;
|
|
1464
|
+
unescape(str: string): string;
|
|
1465
|
+
}
|
|
1466
|
+
interface PmUrlModule {
|
|
1467
|
+
URL: typeof URL;
|
|
1468
|
+
URLSearchParams: typeof URLSearchParams;
|
|
1469
|
+
parse(url: string, parseQueryString?: boolean): Record<string, any>;
|
|
1470
|
+
format(url: any): string;
|
|
1471
|
+
resolve(from: string, to: string): string;
|
|
1472
|
+
[member: string]: any;
|
|
1473
|
+
}
|
|
1474
|
+
interface PmBufferModule {
|
|
1475
|
+
Buffer: typeof Buffer;
|
|
1476
|
+
[member: string]: any;
|
|
1477
|
+
}
|
|
1478
|
+
interface PmStreamModule {
|
|
1479
|
+
Stream: any; Readable: any; Writable: any; Duplex: any; Transform: any; PassThrough: any;
|
|
1480
|
+
pipeline: any; finished: any; promises: any;
|
|
1481
|
+
}
|
|
1482
|
+
interface PmStringDecoderModule {
|
|
1483
|
+
StringDecoder: new (encoding?: string) => { write(buffer: ArrayBufferView | ArrayBuffer | string): string; end(buffer?: ArrayBufferView | ArrayBuffer | string): string };
|
|
1484
|
+
}
|
|
1485
|
+
interface PmPunycodeModule {
|
|
1486
|
+
encode(input: string): string;
|
|
1487
|
+
decode(input: string): string;
|
|
1488
|
+
toASCII(input: string): string;
|
|
1489
|
+
toUnicode(input: string): string;
|
|
1490
|
+
ucs2: { decode(input: string): number[]; encode(codePoints: number[]): string };
|
|
1491
|
+
version: string;
|
|
1492
|
+
}
|
|
1493
|
+
interface PmTimersModule {
|
|
1494
|
+
setTimeout: typeof setTimeout;
|
|
1495
|
+
clearTimeout: typeof clearTimeout;
|
|
1496
|
+
setInterval: typeof setInterval;
|
|
1497
|
+
clearInterval: typeof clearInterval;
|
|
1498
|
+
setImmediate: typeof setImmediate;
|
|
1499
|
+
clearImmediate: typeof clearImmediate;
|
|
1500
|
+
}
|
|
1501
|
+
/** A class of the postman-collection SDK that is not modelled in detail. */
|
|
1502
|
+
interface PmSdkClass {
|
|
1503
|
+
new (definition?: any, ...args: any[]): any;
|
|
1504
|
+
[member: string]: any;
|
|
1505
|
+
}
|
|
1506
|
+
interface PmPostmanCollectionModule {
|
|
1507
|
+
Request: { new (definition?: string | PmRequestDefinition): PmRequest; isRequest(value: any): value is PmRequest };
|
|
1508
|
+
Response: { new (definition?: object): PmResponse; isResponse(value: any): value is PmResponse; [member: string]: any };
|
|
1509
|
+
Url: { new (definition?: string | PmUrlDefinition): PmUrl; parse(url: string): PmUrlDefinition; isUrl(value: any): boolean };
|
|
1510
|
+
Header: { new (definition?: string | { key: string; value: string }): PmHeader; parse(headers: string): Array<{ key: string; value: string }>; unparse(headers: any): string; isHeader(value: any): boolean; [member: string]: any };
|
|
1511
|
+
HeaderList: { new (parent?: any, headers?: Array<{ key: string; value: string }>): PmHeaderList };
|
|
1512
|
+
QueryParam: { new (definition?: string | { key: string; value?: string }): PmQueryParam; [member: string]: any };
|
|
1513
|
+
Cookie: { new (definition?: string | object): PmCookie; parse(line: string): PmCookie; stringify(cookie: PmCookie | object): string; [member: string]: any };
|
|
1514
|
+
CookieList: { new (parent?: any, cookies?: Array<PmCookie | object>): PmCookieList };
|
|
1515
|
+
Variable: { new (definition?: any): PmVariable; [member: string]: any };
|
|
1516
|
+
VariableList: { new (parent?: any, variables?: Array<PmVariable | object>): PmVariableList };
|
|
1517
|
+
RequestBody: { new (definition?: object): PmRequestBody };
|
|
1518
|
+
RequestAuth: { new (definition?: object): PmRequestAuth };
|
|
1519
|
+
Property: PmSdkClass;
|
|
1520
|
+
PropertyBase: PmSdkClass;
|
|
1521
|
+
PropertyList: PmSdkClass;
|
|
1522
|
+
FormParam: PmSdkClass;
|
|
1523
|
+
Item: PmSdkClass;
|
|
1524
|
+
ItemGroup: PmSdkClass;
|
|
1525
|
+
Collection: PmSdkClass;
|
|
1526
|
+
Event: PmSdkClass;
|
|
1527
|
+
EventList: PmSdkClass;
|
|
1528
|
+
Script: PmSdkClass;
|
|
1529
|
+
Description: PmSdkClass;
|
|
1530
|
+
ProxyConfig: PmSdkClass;
|
|
1531
|
+
ProxyConfigList: PmSdkClass;
|
|
1532
|
+
Certificate: PmSdkClass;
|
|
1533
|
+
CertificateList: PmSdkClass;
|
|
1534
|
+
MutationTracker: PmSdkClass;
|
|
1535
|
+
UrlMatchPattern: PmSdkClass;
|
|
1536
|
+
UrlMatchPatternList: PmSdkClass;
|
|
1537
|
+
VariableScope: PmSdkClass;
|
|
1538
|
+
Version: PmSdkClass;
|
|
1539
|
+
}
|
|
1540
|
+
`;
|
|
1541
|
+
// require() name → type table (declared as an interface so unknown names are a type error).
|
|
1542
|
+
const MODULE_TYPE_TABLE = [
|
|
1543
|
+
["lodash", "PmLodash"],
|
|
1544
|
+
["moment", "PmMomentStatic"],
|
|
1545
|
+
["chai", "PmChaiStatic"],
|
|
1546
|
+
["ajv", "PmAjvConstructor"],
|
|
1547
|
+
["cheerio", "PmCheerioApi"],
|
|
1548
|
+
["xml2js", "PmXml2js"],
|
|
1549
|
+
["tv4", "PmTv4"],
|
|
1550
|
+
["uuid", "PmUuid"],
|
|
1551
|
+
["csv-parse/lib/sync", "(input: string | Uint8Array, options?: object) => any[]"],
|
|
1552
|
+
["postman-collection", "PmPostmanCollectionModule"],
|
|
1553
|
+
["crypto-js", "CryptoJsApi"],
|
|
1554
|
+
["atob", "typeof atob"],
|
|
1555
|
+
["btoa", "typeof btoa"],
|
|
1556
|
+
["path", "PmPathModule"],
|
|
1557
|
+
["assert", "PmAssertModule"],
|
|
1558
|
+
["buffer", "PmBufferModule"],
|
|
1559
|
+
["util", "PmUtilModule"],
|
|
1560
|
+
["url", "PmUrlModule"],
|
|
1561
|
+
["querystring", "PmQuerystringModule"],
|
|
1562
|
+
["string_decoder", "PmStringDecoderModule"],
|
|
1563
|
+
["stream", "PmStreamModule"],
|
|
1564
|
+
["events", "PmEventsModule"],
|
|
1565
|
+
["punycode", "PmPunycodeModule"],
|
|
1566
|
+
["timers", "PmTimersModule"],
|
|
1567
|
+
];
|
|
1568
|
+
const buildModuleMap = () => {
|
|
1569
|
+
const lines = [];
|
|
1570
|
+
const quote = (name) => JSON.stringify(name);
|
|
1571
|
+
for (const [name, type] of MODULE_TYPE_TABLE) {
|
|
1572
|
+
lines.push(` ${quote(name)}: ${type};`);
|
|
1573
|
+
lines.push(` ${quote(`node:${name}`)}: ${type};`);
|
|
1574
|
+
}
|
|
1575
|
+
for (const [alias, target] of Object.entries(exports.PM_REQUIRABLE_MODULE_ALIASES)) {
|
|
1576
|
+
const type = MODULE_TYPE_TABLE.find(([name]) => name === target)?.[1] ?? "any";
|
|
1577
|
+
lines.push(` ${quote(alias)}: ${type};`);
|
|
1578
|
+
}
|
|
1579
|
+
// TypeScript resolves `const _ = require("lodash")` in a JS file as a module
|
|
1580
|
+
// import (error 2307 unless the module exists), so every name also gets an
|
|
1581
|
+
// ambient module declaration pointing at the same type.
|
|
1582
|
+
const ambientModules = [...MODULE_TYPE_TABLE.map(([name]) => name), ...MODULE_TYPE_TABLE.map(([name]) => `node:${name}`), ...Object.keys(exports.PM_REQUIRABLE_MODULE_ALIASES)].map((name) => `declare module ${quote(name)} { const value: PmModuleMap[${quote(name)}]; export = value; }`);
|
|
1583
|
+
return [
|
|
1584
|
+
"/** Modules require() / pm.require() can load. Anything else throws \"Cannot find module\". */",
|
|
1585
|
+
"interface PmModuleMap {",
|
|
1586
|
+
...lines,
|
|
1587
|
+
"}",
|
|
1588
|
+
"declare function require<K extends keyof PmModuleMap>(name: K): PmModuleMap[K];",
|
|
1589
|
+
"/** Any other name is not available in Callman and throws at run time (\"Cannot find module\"). */",
|
|
1590
|
+
"declare function require(name: string): any;",
|
|
1591
|
+
"declare module \"*\";",
|
|
1592
|
+
...ambientModules,
|
|
1593
|
+
].join("\n");
|
|
1594
|
+
};
|
|
1595
|
+
const CRYPTOJS_TYPES = `
|
|
1596
|
+
interface CryptoJsWordArray {
|
|
1597
|
+
words: number[];
|
|
1598
|
+
sigBytes: number;
|
|
1599
|
+
toString(encoder?: CryptoJsEncoder): string;
|
|
1600
|
+
concat(other: CryptoJsWordArray): CryptoJsWordArray;
|
|
1601
|
+
clone(): CryptoJsWordArray;
|
|
1602
|
+
}
|
|
1603
|
+
interface CryptoJsEncoder {
|
|
1604
|
+
stringify(wordArray: CryptoJsWordArray): string;
|
|
1605
|
+
parse(input: string): CryptoJsWordArray;
|
|
1606
|
+
}
|
|
1607
|
+
interface CryptoJsCipherParams {
|
|
1608
|
+
ciphertext: CryptoJsWordArray;
|
|
1609
|
+
key?: CryptoJsWordArray;
|
|
1610
|
+
iv?: CryptoJsWordArray;
|
|
1611
|
+
salt?: CryptoJsWordArray;
|
|
1612
|
+
toString(encoder?: CryptoJsEncoder): string;
|
|
1613
|
+
}
|
|
1614
|
+
interface CryptoJsCipher {
|
|
1615
|
+
encrypt(message: string | CryptoJsWordArray, key: string | CryptoJsWordArray, options?: object): CryptoJsCipherParams;
|
|
1616
|
+
decrypt(ciphertext: string | CryptoJsCipherParams, key: string | CryptoJsWordArray, options?: object): CryptoJsWordArray;
|
|
1617
|
+
}
|
|
1618
|
+
type CryptoJsHasher = (message: string | CryptoJsWordArray) => CryptoJsWordArray;
|
|
1619
|
+
type CryptoJsHmac = (message: string | CryptoJsWordArray, key: string | CryptoJsWordArray) => CryptoJsWordArray;
|
|
1620
|
+
/** crypto-js (the global CryptoJS and require("crypto-js")). */
|
|
1621
|
+
interface CryptoJsApi {
|
|
1622
|
+
enc: {
|
|
1623
|
+
Utf8: CryptoJsEncoder;
|
|
1624
|
+
Utf16: CryptoJsEncoder;
|
|
1625
|
+
Utf16BE: CryptoJsEncoder;
|
|
1626
|
+
Utf16LE: CryptoJsEncoder;
|
|
1627
|
+
Base64: CryptoJsEncoder;
|
|
1628
|
+
Base64url: CryptoJsEncoder;
|
|
1629
|
+
Hex: CryptoJsEncoder;
|
|
1630
|
+
Latin1: CryptoJsEncoder;
|
|
1631
|
+
};
|
|
1632
|
+
MD5: CryptoJsHasher;
|
|
1633
|
+
SHA1: CryptoJsHasher;
|
|
1634
|
+
SHA224: CryptoJsHasher;
|
|
1635
|
+
SHA256: CryptoJsHasher;
|
|
1636
|
+
SHA384: CryptoJsHasher;
|
|
1637
|
+
SHA512: CryptoJsHasher;
|
|
1638
|
+
SHA3(message: string | CryptoJsWordArray, options?: { outputLength?: number }): CryptoJsWordArray;
|
|
1639
|
+
RIPEMD160: CryptoJsHasher;
|
|
1640
|
+
HmacMD5: CryptoJsHmac;
|
|
1641
|
+
HmacSHA1: CryptoJsHmac;
|
|
1642
|
+
HmacSHA224: CryptoJsHmac;
|
|
1643
|
+
HmacSHA256: CryptoJsHmac;
|
|
1644
|
+
HmacSHA384: CryptoJsHmac;
|
|
1645
|
+
HmacSHA512: CryptoJsHmac;
|
|
1646
|
+
HmacRIPEMD160: CryptoJsHmac;
|
|
1647
|
+
AES: CryptoJsCipher;
|
|
1648
|
+
DES: CryptoJsCipher;
|
|
1649
|
+
TripleDES: CryptoJsCipher;
|
|
1650
|
+
RC4: CryptoJsCipher;
|
|
1651
|
+
RC4Drop: CryptoJsCipher;
|
|
1652
|
+
Rabbit: CryptoJsCipher;
|
|
1653
|
+
RabbitLegacy: CryptoJsCipher;
|
|
1654
|
+
PBKDF2(password: string | CryptoJsWordArray, salt: string | CryptoJsWordArray, options?: { keySize?: number; iterations?: number; hasher?: any }): CryptoJsWordArray;
|
|
1655
|
+
EvpKDF(password: string | CryptoJsWordArray, salt: string | CryptoJsWordArray, options?: { keySize?: number; iterations?: number; hasher?: any }): CryptoJsWordArray;
|
|
1656
|
+
lib: {
|
|
1657
|
+
WordArray: { create(words?: number[] | Uint8Array, sigBytes?: number): CryptoJsWordArray; random(nBytes: number): CryptoJsWordArray };
|
|
1658
|
+
CipherParams: { create(props: object): CryptoJsCipherParams };
|
|
1659
|
+
[member: string]: any;
|
|
1660
|
+
};
|
|
1661
|
+
algo: Record<string, any>;
|
|
1662
|
+
mode: Record<string, any>;
|
|
1663
|
+
pad: Record<string, any>;
|
|
1664
|
+
format: Record<string, any>;
|
|
1665
|
+
kdf: Record<string, any>;
|
|
1666
|
+
x64: Record<string, any>;
|
|
1667
|
+
[member: string]: any;
|
|
1668
|
+
}
|
|
1669
|
+
declare const CryptoJS: CryptoJsApi;
|
|
1670
|
+
`;
|
|
1671
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1672
|
+
// Legacy Postman globals (postman.*, tests[], responseBody, …)
|
|
1673
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1674
|
+
const LEGACY_TYPES = `
|
|
1675
|
+
/** Postman's legacy scripting API (disabled when the script starts with "use sandbox2"). Prefer pm.*. */
|
|
1676
|
+
interface PostmanLegacy {
|
|
1677
|
+
setEnvironmentVariable(key: string, value: any): void;
|
|
1678
|
+
getEnvironmentVariable(key: string): any;
|
|
1679
|
+
clearEnvironmentVariable(key: string): void;
|
|
1680
|
+
clearEnvironmentVariables(): void;
|
|
1681
|
+
setGlobalVariable(key: string, value: any): void;
|
|
1682
|
+
getGlobalVariable(key: string): any;
|
|
1683
|
+
clearGlobalVariable(key: string): void;
|
|
1684
|
+
clearGlobalVariables(): void;
|
|
1685
|
+
setNextRequest(name: string | null): void;
|
|
1686
|
+
getResponseHeader(name: string): string | undefined;
|
|
1687
|
+
getResponseCookie(name: string): PmCookie | undefined;
|
|
1688
|
+
}
|
|
1689
|
+
/** Legacy environment / globals: the pm API plus bracket access to variables (environment["token"]). */
|
|
1690
|
+
type PmLegacyVariableScope = PmVariableScope & { [variable: string]: any };
|
|
1691
|
+
`;
|
|
1692
|
+
const LEGACY_REQUEST_GLOBALS = `
|
|
1693
|
+
/** Legacy: raw response body text. */
|
|
1694
|
+
declare const responseBody: string;
|
|
1695
|
+
/** Legacy: { code, name, detail }. */
|
|
1696
|
+
declare const responseCode: { code: number; name: string; detail: string };
|
|
1697
|
+
/** Legacy: response time in ms. */
|
|
1698
|
+
declare const responseTime: number;
|
|
1699
|
+
/** Legacy: response headers as a plain object. */
|
|
1700
|
+
declare const responseHeaders: Record<string, string>;
|
|
1701
|
+
/** Legacy: response cookies as { name: value }. */
|
|
1702
|
+
declare const responseCookies: Record<string, string>;
|
|
1703
|
+
`;
|
|
1704
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1705
|
+
// Assembly
|
|
1706
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1707
|
+
const dbDeclaration = (stage) => {
|
|
1708
|
+
const members = [];
|
|
1709
|
+
if (stage !== "script") {
|
|
1710
|
+
members.push(" /** Result of the declared pre-request DB query. */", " readonly pre: PmDbPhaseResult;");
|
|
1711
|
+
}
|
|
1712
|
+
if (stage === "post-response") {
|
|
1713
|
+
members.push(" /** Declared post-response DB query: empty here — it is populated in the tests script. */", " readonly post: PmDbEmptyResult;");
|
|
1714
|
+
}
|
|
1715
|
+
else if (stage === "tests") {
|
|
1716
|
+
members.push(" /** Result of the declared post-response DB query. */", " readonly post: PmDbPhaseResult;");
|
|
1717
|
+
}
|
|
1718
|
+
members.push(" /** Run an ad-hoc query — always await it. Rejects when the query fails. */", " query(input: PmDbQueryInput): Promise<PmDbQueryResult>;");
|
|
1719
|
+
return ["interface PmDbApi {", ...members, "}"].join("\n");
|
|
1720
|
+
};
|
|
1721
|
+
const pmDeclaration = (stage, scenario) => {
|
|
1722
|
+
const hasRequest = stage !== "script";
|
|
1723
|
+
const hasResponse = stage === "post-response" || stage === "tests";
|
|
1724
|
+
const lines = [
|
|
1725
|
+
"/** The Callman / Postman script API. pm, cm and callman are the same object. */",
|
|
1726
|
+
"interface Pm {",
|
|
1727
|
+
" /** @deprecated Postman Vault is not supported in Callman yet — using it throws a clear error. */",
|
|
1728
|
+
" vault: any;",
|
|
1729
|
+
" /** @deprecated Postman datasets are not supported in Callman yet — using it throws a clear error. */",
|
|
1730
|
+
" datasets: any;",
|
|
1731
|
+
" /** @deprecated pm.mock (mock editor) is not supported in Callman yet — using it throws a clear error. */",
|
|
1732
|
+
" mock: any;",
|
|
1733
|
+
" /** @deprecated pm.state (mock editor) is not supported in Callman yet — using it throws a clear error. */",
|
|
1734
|
+
" state: any;",
|
|
1735
|
+
" /** @deprecated pm.message (streaming protocols) is not supported in Callman yet — using it throws a clear error. */",
|
|
1736
|
+
" message: any;",
|
|
1737
|
+
" test: PmTest;",
|
|
1738
|
+
" expect: PmExpect;",
|
|
1739
|
+
" /** Active environment variables. */",
|
|
1740
|
+
" environment: PmVariableScope;",
|
|
1741
|
+
" /** Alias of pm.environment. */",
|
|
1742
|
+
" env: PmVariableScope;",
|
|
1743
|
+
" globals: PmVariableScope;",
|
|
1744
|
+
" collectionVariables: PmVariableScope;",
|
|
1745
|
+
" variables: PmVariables;",
|
|
1746
|
+
" iterationData: PmIterationData;",
|
|
1747
|
+
" info: PmInfo;",
|
|
1748
|
+
` execution: ${stage === "pre-request" ? "PmExecutionPreRequest" : "PmExecution"};`,
|
|
1749
|
+
" /** Cookies of the request's domain; pm.cookies.jar() gives the whole cookie jar. */",
|
|
1750
|
+
" cookies: PmCookieList;",
|
|
1751
|
+
" sendRequest: PmSendRequest;",
|
|
1752
|
+
' /** Load one of the built-in libraries (same as the global require). */',
|
|
1753
|
+
" require<K extends keyof PmModuleMap>(name: K): PmModuleMap[K];",
|
|
1754
|
+
" /** Any other name (npm:, jsr:, team packages, fs…) is not available in Callman and throws at run time. */",
|
|
1755
|
+
" require(name: string): any;",
|
|
1756
|
+
" /** Structured log entry (like console.log). */",
|
|
1757
|
+
" log(...args: any[]): void;",
|
|
1758
|
+
" db: PmDbApi;",
|
|
1759
|
+
" redis: PmRedisApi;",
|
|
1760
|
+
" random: PmRandom;",
|
|
1761
|
+
" counter: PmCounter;",
|
|
1762
|
+
];
|
|
1763
|
+
if (hasRequest) {
|
|
1764
|
+
lines.push(hasResponse
|
|
1765
|
+
? " /** The request that was sent. */"
|
|
1766
|
+
: " /** The request about to be sent — mutate it here (headers, url, body). */", " request: PmRequest;");
|
|
1767
|
+
}
|
|
1768
|
+
if (hasResponse) {
|
|
1769
|
+
lines.push(" /** The received response. */", " response: PmResponse;");
|
|
1770
|
+
lines.push(" visualizer: PmVisualizer;", " /** Inside a visualizer template: receive the data passed to pm.visualizer.set. */", " getData(callback: (error: any, data: any) => void): void;");
|
|
1771
|
+
}
|
|
1772
|
+
if (scenario) {
|
|
1773
|
+
lines.push(" /** Output of a scenario node by label (with __meta: status, timing). null when it has not run. */", " node(label: string): any;");
|
|
1774
|
+
}
|
|
1775
|
+
lines.push("}");
|
|
1776
|
+
return lines.join("\n");
|
|
1777
|
+
};
|
|
1778
|
+
const globalsDeclaration = (stage, scenario) => {
|
|
1779
|
+
const hasRequest = stage !== "script";
|
|
1780
|
+
const hasResponse = stage === "post-response" || stage === "tests";
|
|
1781
|
+
const legacy = stage !== "script";
|
|
1782
|
+
const lines = [
|
|
1783
|
+
"declare const pm: Pm;",
|
|
1784
|
+
"/** Alias of pm. */",
|
|
1785
|
+
"declare const cm: Pm;",
|
|
1786
|
+
"/** Alias of pm. */",
|
|
1787
|
+
"declare const callman: Pm;",
|
|
1788
|
+
"/** Active environment variables as a plain object. */",
|
|
1789
|
+
"declare const env: Record<string, string>;",
|
|
1790
|
+
"declare const test: PmTest;",
|
|
1791
|
+
"declare const expect: PmExpect;",
|
|
1792
|
+
"declare const db: PmDbApi;",
|
|
1793
|
+
"declare const redis: PmRedisApi;",
|
|
1794
|
+
"declare const random: PmRandom;",
|
|
1795
|
+
"declare const counter: PmCounter;",
|
|
1796
|
+
"declare const variables: PmVariables;",
|
|
1797
|
+
legacy ? "declare const environment: PmLegacyVariableScope;" : "declare const environment: PmVariableScope;",
|
|
1798
|
+
];
|
|
1799
|
+
if (hasRequest)
|
|
1800
|
+
lines.push("declare const request: PmRequest;");
|
|
1801
|
+
if (hasResponse)
|
|
1802
|
+
lines.push("declare const response: PmResponse;");
|
|
1803
|
+
if (scenario) {
|
|
1804
|
+
lines.push("/** Workflow-level data of the scenario run. */", "declare const workflow: { __meta: WorkflowExecutionMeta; [key: string]: any };");
|
|
1805
|
+
}
|
|
1806
|
+
if (legacy) {
|
|
1807
|
+
lines.push("declare const postman: PostmanLegacy;", "/** Legacy: tests[\"name\"] = boolean records a test. */", "declare const tests: Record<string, any>;", "declare const globals: PmLegacyVariableScope;", "/** Legacy: the current iteration's data row. */", "declare const data: Record<string, any>;", "/** Legacy: 0-based iteration index. */", "declare const iteration: number;", "declare const tv4: PmTv4;", "declare const cheerio: PmCheerioApi;", "/** Legacy: XML string to object. */", "declare function xml2Json(xml: string): any;");
|
|
1808
|
+
}
|
|
1809
|
+
return lines.join("\n");
|
|
1810
|
+
};
|
|
1811
|
+
/**
|
|
1812
|
+
* The declaration text for one script editor. Add it (and ONE response-body chunk,
|
|
1813
|
+
* see CALLMAN_RESPONSE_BODY_DECLARATION) to a TS language service configured with
|
|
1814
|
+
* lib es2022 and no DOM.
|
|
1815
|
+
*/
|
|
1816
|
+
const getPmApiDeclarations = (options) => {
|
|
1817
|
+
const { stage } = options;
|
|
1818
|
+
const scenario = options.scenario === true || stage === "script";
|
|
1819
|
+
const hasRequest = stage !== "script";
|
|
1820
|
+
const hasResponse = stage === "post-response" || stage === "tests";
|
|
1821
|
+
const legacy = stage !== "script";
|
|
1822
|
+
const parts = [
|
|
1823
|
+
"// Callman script API — generated from callman-core (pm-api-declarations.ts). Do not edit.",
|
|
1824
|
+
PLATFORM_GLOBALS,
|
|
1825
|
+
SDK_TYPES,
|
|
1826
|
+
ASSERTION_TYPES,
|
|
1827
|
+
VARIABLE_TYPES,
|
|
1828
|
+
CALLMAN_TYPES,
|
|
1829
|
+
dbDeclaration(stage),
|
|
1830
|
+
CRYPTOJS_TYPES,
|
|
1831
|
+
MODULE_TYPES,
|
|
1832
|
+
buildModuleMap(),
|
|
1833
|
+
];
|
|
1834
|
+
// PmRequest is also what pm.sendRequest accepts and PmResponse is its result, so both are always declared.
|
|
1835
|
+
parts.push(REQUEST_TYPES, RESPONSE_TYPES);
|
|
1836
|
+
if (legacy)
|
|
1837
|
+
parts.push(LEGACY_TYPES);
|
|
1838
|
+
parts.push(pmDeclaration(stage, scenario));
|
|
1839
|
+
parts.push(globalsDeclaration(stage, scenario));
|
|
1840
|
+
if (legacy && hasResponse)
|
|
1841
|
+
parts.push(LEGACY_REQUEST_GLOBALS);
|
|
1842
|
+
return parts.join("\n");
|
|
1843
|
+
};
|
|
1844
|
+
exports.getPmApiDeclarations = getPmApiDeclarations;
|
|
1845
|
+
/** The chunks as virtual files for `addExtraLib(content, path)`. */
|
|
1846
|
+
const getPmApiDeclarationLibs = (options) => [
|
|
1847
|
+
{ path: exports.PM_API_DECLARATIONS_PATH, content: (0, exports.getPmApiDeclarations)(options) },
|
|
1848
|
+
{ path: exports.CALLMAN_RESPONSE_BODY_DECLARATION_PATH, content: exports.CALLMAN_RESPONSE_BODY_DECLARATION },
|
|
1849
|
+
];
|
|
1850
|
+
exports.getPmApiDeclarationLibs = getPmApiDeclarationLibs;
|
|
1851
|
+
const IDENTIFIER_PATTERN = /^[A-Za-z_$][\w$]*$/;
|
|
1852
|
+
/**
|
|
1853
|
+
* `declare const Label: any;` for every scenario node label that the runtime
|
|
1854
|
+
* exposes as a global (valid identifier, not reserved). Add next to the script
|
|
1855
|
+
* declarations of a scenario script editor.
|
|
1856
|
+
*/
|
|
1857
|
+
const getScenarioLabelDeclarations = (labels) => {
|
|
1858
|
+
const reserved = new Set(exports.PM_API_RESERVED_NAMES);
|
|
1859
|
+
const seen = new Set();
|
|
1860
|
+
const lines = [];
|
|
1861
|
+
for (const raw of labels) {
|
|
1862
|
+
const label = raw.trim();
|
|
1863
|
+
if (!label || seen.has(label) || !IDENTIFIER_PATTERN.test(label) || reserved.has(label))
|
|
1864
|
+
continue;
|
|
1865
|
+
seen.add(label);
|
|
1866
|
+
lines.push(`declare const ${label}: any;`);
|
|
1867
|
+
}
|
|
1868
|
+
return lines.join("\n");
|
|
1869
|
+
};
|
|
1870
|
+
exports.getScenarioLabelDeclarations = getScenarioLabelDeclarations;
|
|
1871
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1872
|
+
// What is declared, for the drift check
|
|
1873
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1874
|
+
const PROPERTY_BASE = ["meta", "parent", "setParent", "findInParents", "findParentContaining", "forEachParent", "toJSON"];
|
|
1875
|
+
const PROPERTY = [...PROPERTY_BASE, "id", "name", "disabled", "describe", "findSubstitutions", "toObjectResolved"];
|
|
1876
|
+
const PROPERTY_LIST = [
|
|
1877
|
+
...PROPERTY_BASE, "Type", "members", "reference", "add", "append", "prepend", "insert", "insertAfter", "upsert",
|
|
1878
|
+
"assimilate", "populate", "repopulate", "clear", "count", "idx", "indexOf", "one", "get", "has", "all", "each",
|
|
1879
|
+
"eachParent", "map", "filter", "find", "reduce", "remove", "toObject", "toString",
|
|
1880
|
+
];
|
|
1881
|
+
const VARIABLE_SCOPE = ["name", "values", "get", "set", "unset", "has", "clear", "toObject", "replaceIn"];
|
|
1882
|
+
const URL_STRING_METHODS = [
|
|
1883
|
+
"length", "at", "charAt", "charCodeAt", "codePointAt", "concat", "endsWith", "includes", "indexOf", "lastIndexOf",
|
|
1884
|
+
"localeCompare", "match", "matchAll", "normalize", "padEnd", "padStart", "repeat", "replace", "replaceAll", "search",
|
|
1885
|
+
"slice", "split", "startsWith", "substr", "substring", "toLocaleLowerCase", "toLocaleUpperCase", "toLowerCase",
|
|
1886
|
+
"toUpperCase", "trim", "trimEnd", "trimStart", "valueOf",
|
|
1887
|
+
];
|
|
1888
|
+
/**
|
|
1889
|
+
* Member names declared per namespace (union over every stage). The drift check
|
|
1890
|
+
* compares this map with (a) the declaration text, via the TypeScript checker,
|
|
1891
|
+
* and (b) the live sandbox objects.
|
|
1892
|
+
*/
|
|
1893
|
+
exports.PM_API_DECLARED_MEMBERS = {
|
|
1894
|
+
pm: [
|
|
1895
|
+
"test", "expect", "environment", "env", "globals", "collectionVariables", "variables", "iterationData", "info",
|
|
1896
|
+
"execution", "cookies", "sendRequest", "require", "log", "db", "redis", "random", "counter", "request", "response",
|
|
1897
|
+
"visualizer", "getData", "node", "vault", "datasets", "mock", "state", "message",
|
|
1898
|
+
],
|
|
1899
|
+
"pm.environment": VARIABLE_SCOPE,
|
|
1900
|
+
"pm.globals": VARIABLE_SCOPE,
|
|
1901
|
+
"pm.collectionVariables": VARIABLE_SCOPE,
|
|
1902
|
+
"pm.variables": ["get", "set", "unset", "has", "clear", "toObject", "replaceIn", "resolve"],
|
|
1903
|
+
"pm.iterationData": ["get", "set", "unset", "has", "clear", "toObject", "toJSON", "replaceIn"],
|
|
1904
|
+
"pm.info": ["eventName", "iteration", "iterationCount", "requestName", "requestId"],
|
|
1905
|
+
"pm.execution": ["setNextRequest", "location", "runRequest", "skipRequest"],
|
|
1906
|
+
"pm.cookies": [...PROPERTY_LIST, "jar"],
|
|
1907
|
+
"pm.cookies.jar": ["set", "get", "getAll", "unset", "clear"],
|
|
1908
|
+
"pm.request": [
|
|
1909
|
+
...PROPERTY, "url", "method", "headers", "body", "auth", "addHeader", "removeHeader", "upsertHeader", "forEachHeader",
|
|
1910
|
+
"getHeaders", "addQueryParams", "removeQueryParams", "authorizeUsing", "update", "size", "clone", "to", "query",
|
|
1911
|
+
"getHeader", "setHeader", "unsetHeader", "getQueryParam", "setQueryParam", "unsetQueryParam", "setMethod", "setUrl",
|
|
1912
|
+
"setRawBody",
|
|
1913
|
+
],
|
|
1914
|
+
"pm.request.url": [
|
|
1915
|
+
...PROPERTY_BASE, "protocol", "auth", "host", "port", "path", "hash", "query", "variables", "getHost", "getPath",
|
|
1916
|
+
"getPathWithQuery", "getQueryString", "getRaw", "getRemote", "getOAuth1BaseUrl", "addQueryParams",
|
|
1917
|
+
"removeQueryParams", "update", "toString", ...URL_STRING_METHODS,
|
|
1918
|
+
],
|
|
1919
|
+
"pm.request.headers": [...PROPERTY_LIST, "contentSize"],
|
|
1920
|
+
"pm.request.url.query": PROPERTY_LIST,
|
|
1921
|
+
"pm.request.body": [
|
|
1922
|
+
...PROPERTY_BASE, "mode", "raw", "urlencoded", "formdata", "file", "graphql", "options", "disabled", "isEmpty", "toString",
|
|
1923
|
+
"update",
|
|
1924
|
+
],
|
|
1925
|
+
"pm.response": [
|
|
1926
|
+
...PROPERTY, "code", "status", "reason", "headers", "cookies", "responseTime", "responseSize", "stream", "text", "json",
|
|
1927
|
+
"jsonp", "size", "dataURI", "details", "contentInfo", "encoding", "mime", "update", "ok", "statusText", "body", "data",
|
|
1928
|
+
"rawBody", "raw", "contentType", "durationMs", "sizeBytes", "to", "be", "have",
|
|
1929
|
+
],
|
|
1930
|
+
"pm.response.headers": [...PROPERTY_LIST, "contentSize"],
|
|
1931
|
+
"pm.visualizer": ["set", "clear"],
|
|
1932
|
+
"pm.test": ["skip", "index"],
|
|
1933
|
+
"pm.expect": ["fail"],
|
|
1934
|
+
"pm.expect()": [
|
|
1935
|
+
"to", "be", "been", "is", "that", "which", "and", "has", "have", "with", "at", "of", "same", "but", "does", "still", "also",
|
|
1936
|
+
"not", "deep", "nested", "own", "ordered", "any", "all", "itself", "ok", "true", "false", "null", "undefined", "NaN",
|
|
1937
|
+
"exist", "exists", "empty", "arguments", "Arguments", "extensible", "sealed", "frozen", "finite", "a", "an", "include",
|
|
1938
|
+
"includes", "contain", "contains", "length", "lengthOf", "equal", "equals", "eq", "eql", "eqls", "above", "gt",
|
|
1939
|
+
"greaterThan", "least", "gte", "greaterThanOrEqual", "below", "lt", "lessThan", "most", "lte", "lessThanOrEqual",
|
|
1940
|
+
"within", "closeTo", "approximately", "instanceof", "instanceOf", "oneOf", "members", "satisfy", "satisfies", "match",
|
|
1941
|
+
"matches", "string", "property", "ownProperty", "haveOwnProperty", "ownPropertyDescriptor", "haveOwnPropertyDescriptor",
|
|
1942
|
+
"key", "keys", "respondTo", "respondsTo", "throw", "throws", "Throw", "change", "changes", "increase", "increases",
|
|
1943
|
+
"decrease", "decreases", "by", "assert", "toBe", "toEqual", "toContain", "toBeDefined", "toBeTruthy", "toBeFalsy",
|
|
1944
|
+
"toBeGreaterThan", "toBeLessThan", "status", "statusCode", "statusCodeClass", "statusReason", "header", "body", "jsonBody",
|
|
1945
|
+
"jsonSchema", "responseTime", "responseSize", "success", "info", "redirection", "clientError", "serverError", "error",
|
|
1946
|
+
"accepted", "badRequest", "unauthorized", "unauthorised", "forbidden", "notFound", "notAcceptable", "rateLimited",
|
|
1947
|
+
"withoutContent", "withBody", "json", "xml", "html", "postmanRequest", "postmanResponse", "postmanRequestOrResponse",
|
|
1948
|
+
],
|
|
1949
|
+
"pm.db": ["pre", "post", "query"],
|
|
1950
|
+
"pm.redis": ["get", "results", "command"],
|
|
1951
|
+
"pm.random": ["uuid", "int", "string", "email", "phone", "name", "date", "boolean", "bigdecimal"],
|
|
1952
|
+
"pm.counter": ["next", "start"],
|
|
1953
|
+
console: [
|
|
1954
|
+
"log", "info", "warn", "error", "debug", "trace", "assert", "count", "countReset", "time", "timeLog", "timeEnd", "group",
|
|
1955
|
+
"groupCollapsed", "groupEnd", "table", "dir", "dirxml", "clear",
|
|
1956
|
+
],
|
|
1957
|
+
// Top-level identifiers declared by this file (union over stages). Language built-ins that
|
|
1958
|
+
// lib es2022 already declares are intentionally absent.
|
|
1959
|
+
globals: [
|
|
1960
|
+
"pm", "cm", "callman", "env", "test", "expect", "db", "redis", "random", "counter", "variables", "environment",
|
|
1961
|
+
"request", "response", "workflow", "postman", "globals", "data", "iteration", "tv4", "cheerio", "xml2Json", "tests",
|
|
1962
|
+
"responseBody", "responseCode", "responseTime", "responseHeaders", "responseCookies", "console", "atob", "btoa",
|
|
1963
|
+
"structuredClone", "queueMicrotask", "setTimeout", "clearTimeout", "setInterval", "clearInterval", "setImmediate",
|
|
1964
|
+
"clearImmediate", "TextEncoder", "TextDecoder", "URL", "URLSearchParams", "Event", "EventTarget", "DOMException",
|
|
1965
|
+
"AbortSignal", "AbortController", "Blob", "File", "ReadableStream", "WritableStream", "TransformStream",
|
|
1966
|
+
"TextEncoderStream", "TextDecoderStream", "Buffer", "crypto", "require", "_", "CryptoJS",
|
|
1967
|
+
],
|
|
1968
|
+
};
|
|
1969
|
+
//# sourceMappingURL=pm-api-declarations.js.map
|