callman-core 1.9.1 → 1.10.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 +26 -0
- package/ai-packs/pm-api.md +213 -0
- package/ai-packs/sandbox-globals.md +20 -0
- package/ai-packs/templating.md +104 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/scenario-runner/adapters/script-executor.js +3 -3
- package/dist/scenario-runner/adapters/script-executor.js.map +1 -1
- package/dist/script/features/log.d.ts.map +1 -1
- package/dist/script/features/log.js +23 -4
- package/dist/script/features/log.js.map +1 -1
- package/dist/script/isolated-runner.d.ts +11 -0
- package/dist/script/isolated-runner.d.ts.map +1 -0
- package/dist/script/isolated-runner.js +172 -0
- package/dist/script/isolated-runner.js.map +1 -0
- package/dist/script/pm-api-metadata.d.ts +19 -0
- package/dist/script/pm-api-metadata.d.ts.map +1 -0
- package/dist/script/pm-api-metadata.js +264 -0
- package/dist/script/pm-api-metadata.js.map +1 -0
- package/dist/script/scope.d.ts +2 -0
- package/dist/script/scope.d.ts.map +1 -1
- package/dist/script/scope.js +4 -0
- package/dist/script/scope.js.map +1 -1
- package/dist/script/worker-entry.d.ts +2 -0
- package/dist/script/worker-entry.d.ts.map +1 -0
- package/dist/script/worker-entry.js +79 -0
- package/dist/script/worker-entry.js.map +1 -0
- package/dist-cjs/index.js +9 -1
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/scenario-runner/adapters/script-executor.js +3 -3
- package/dist-cjs/scenario-runner/adapters/script-executor.js.map +1 -1
- package/dist-cjs/script/features/log.js +23 -4
- package/dist-cjs/script/features/log.js.map +1 -1
- package/dist-cjs/script/isolated-runner.js +209 -0
- package/dist-cjs/script/isolated-runner.js.map +1 -0
- package/dist-cjs/script/pm-api-metadata.js +267 -0
- package/dist-cjs/script/pm-api-metadata.js.map +1 -0
- package/dist-cjs/script/scope.js +5 -1
- package/dist-cjs/script/scope.js.map +1 -1
- package/dist-cjs/script/worker-entry.js +81 -0
- package/dist-cjs/script/worker-entry.js.map +1 -0
- package/package.json +8 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!-- GENERATED FILE — do not edit by hand. Source: callman_core (npm run ai:packs). -->
|
|
2
|
+
|
|
3
|
+
# Script feature policy
|
|
4
|
+
|
|
5
|
+
Some `pm.*` features can be disabled per execution context (ScriptFeaturePolicy). A disabled feature evaluates to `undefined` at top level; inside `pm.test` callbacks it throws so the test reports SKIPPED instead of failing.
|
|
6
|
+
|
|
7
|
+
Capability-gated members:
|
|
8
|
+
|
|
9
|
+
## database
|
|
10
|
+
|
|
11
|
+
- `pm.db.query({ connectionId, query })`
|
|
12
|
+
- `pm.db.pre`
|
|
13
|
+
- `pm.db.post`
|
|
14
|
+
|
|
15
|
+
## kafka
|
|
16
|
+
|
|
17
|
+
- `pm.kafka.event()`
|
|
18
|
+
- `pm.kafka.messages()`
|
|
19
|
+
|
|
20
|
+
## redis
|
|
21
|
+
|
|
22
|
+
- `pm.redis.get(key)`
|
|
23
|
+
- `pm.redis.results.pre`
|
|
24
|
+
- `pm.redis.results.post`
|
|
25
|
+
|
|
26
|
+
Generation guidance: prefer declared pre/post queries and `pm.db.query` only when the user explicitly asks for database work; never assume kafka/redis capabilities exist unless the task mentions them.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
<!-- GENERATED FILE — do not edit by hand. Source: callman_core (npm run ai:packs). -->
|
|
2
|
+
|
|
3
|
+
# Callman `pm.*` scripting API
|
|
4
|
+
|
|
5
|
+
Scripts are plain JavaScript (top-level `await` allowed). Use ONLY the API below — anything else (fetch, require, process, Buffer, ...) is blocked by the sandbox.
|
|
6
|
+
|
|
7
|
+
## pm.test
|
|
8
|
+
|
|
9
|
+
Register a named test. The callback's assertion failures mark the test failed without aborting the script.
|
|
10
|
+
|
|
11
|
+
- `pm.test(name, fn)` — Runs fn (sync or async); pass/fail lands in the run's test results.
|
|
12
|
+
|
|
13
|
+
## pm.expect
|
|
14
|
+
|
|
15
|
+
Chai-style assertions plus Jest-style matchers.
|
|
16
|
+
|
|
17
|
+
- `pm.expect(value)` — Assertion chain. Equality: .to.equal(x) (identity), .to.eql(x) / .to.deep.equal(x) / .toEqual(x) (deep). Existence: .to.exist, .toBeDefined(), .toBeNull(). Strings/arrays: .to.include(x) / .toContain(x), .oneOf([..]). Numbers: .toBeGreaterThan / .toBeLessThan / .to.be.above(n) / .to.be.below(n). Types: .to.be.a('string'|'number'|...). Negation: .to.not.<...> / .not.<matcher>. Properties: .to.have.property('name', value?).
|
|
18
|
+
- `pm.expect.fail(message?)` — Fails the surrounding test immediately.
|
|
19
|
+
|
|
20
|
+
## pm.environment
|
|
21
|
+
|
|
22
|
+
Active environment variables (alias: pm.env). Writes are scoped to the run and surface as variable mutations.
|
|
23
|
+
|
|
24
|
+
- `pm.environment.get(key)` — Read a variable (string or undefined).
|
|
25
|
+
- `pm.environment.set(key, value)` — Write a variable for subsequent steps.
|
|
26
|
+
- `pm.environment.unset(key)` — Remove a variable.
|
|
27
|
+
- `pm.environment.has(key)` — true when the key exists.
|
|
28
|
+
- `pm.environment.clear()` — Remove every variable in the scope.
|
|
29
|
+
- `pm.environment.toObject()` — Plain { key: value } snapshot.
|
|
30
|
+
- `pm.environment.replaceIn(template)` — Resolve {{tokens}} inside a string.
|
|
31
|
+
- `pm.environment.name` — Active environment's name.
|
|
32
|
+
|
|
33
|
+
## pm.globals
|
|
34
|
+
|
|
35
|
+
Workspace-level global variables. Same surface as pm.environment.
|
|
36
|
+
|
|
37
|
+
- `pm.globals.get(key)` — Read a global.
|
|
38
|
+
- `pm.globals.set(key, value)` — Write a global for the run.
|
|
39
|
+
- `pm.globals.unset(key)` — Remove a global.
|
|
40
|
+
- `pm.globals.has(key)` — true when the key exists.
|
|
41
|
+
- `pm.globals.clear()` — Remove every global in the scope.
|
|
42
|
+
- `pm.globals.toObject()` — Plain snapshot.
|
|
43
|
+
- `pm.globals.replaceIn(template)` — Resolve {{tokens}} inside a string.
|
|
44
|
+
|
|
45
|
+
## pm.collectionVariables
|
|
46
|
+
|
|
47
|
+
Collection-scoped variables that survive across requests within one collection run iteration.
|
|
48
|
+
|
|
49
|
+
- `pm.collectionVariables.get(key)` — Read a collection variable.
|
|
50
|
+
- `pm.collectionVariables.set(key, value)` — Write; persists across the iteration.
|
|
51
|
+
- `pm.collectionVariables.unset(key)` — Remove a collection variable.
|
|
52
|
+
- `pm.collectionVariables.has(key)` — true when the key exists.
|
|
53
|
+
- `pm.collectionVariables.clear()` — Remove all collection variables.
|
|
54
|
+
- `pm.collectionVariables.toObject()` — Plain snapshot.
|
|
55
|
+
- `pm.collectionVariables.replaceIn(template)` — Resolve {{tokens}}.
|
|
56
|
+
|
|
57
|
+
## pm.variables
|
|
58
|
+
|
|
59
|
+
Layered read across all scopes (per-iteration > environment > globals) plus template resolution.
|
|
60
|
+
|
|
61
|
+
- `pm.variables.get(key)` — Read through the precedence chain.
|
|
62
|
+
- `pm.variables.set(key, value)` — Write to the run-local layer.
|
|
63
|
+
- `pm.variables.unset(key)` — Remove from the run-local layer.
|
|
64
|
+
- `pm.variables.has(key)` — true when any layer has the key.
|
|
65
|
+
- `pm.variables.toObject()` — Merged snapshot.
|
|
66
|
+
- `pm.variables.replaceIn(template)` — Resolve {{tokens}} in a string.
|
|
67
|
+
- `pm.variables.resolve(template)` — Like replaceIn, but also resolves scenario node-output references.
|
|
68
|
+
|
|
69
|
+
## pm.request
|
|
70
|
+
|
|
71
|
+
The outgoing request. Mutations only have effect in pre-request scripts (the call has not fired yet).
|
|
72
|
+
|
|
73
|
+
- `pm.request.url` — Resolved URL string.
|
|
74
|
+
- `pm.request.method` — HTTP method.
|
|
75
|
+
- `pm.request.body` — Body snapshot (mode + content).
|
|
76
|
+
- `pm.request.headers` — HeaderList: .all() .get(name) .has(name) .add({key,value}) .upsert({key,value}) .remove(name) .idx(i).
|
|
77
|
+
- `pm.request.query` — Query params as a HeaderList.
|
|
78
|
+
- `pm.request.getHeader(name)` — Read one header value.
|
|
79
|
+
- `pm.request.setHeader(name, value)` — Set/replace a header. _(stages: pre-request, scenario-script)_
|
|
80
|
+
- `pm.request.unsetHeader(name)` — Remove a header. _(stages: pre-request, scenario-script)_
|
|
81
|
+
- `pm.request.getQueryParam(name)` — Read one query param.
|
|
82
|
+
- `pm.request.setQueryParam(name, value)` — Set/replace a query param. _(stages: pre-request, scenario-script)_
|
|
83
|
+
- `pm.request.unsetQueryParam(name)` — Remove a query param. _(stages: pre-request, scenario-script)_
|
|
84
|
+
- `pm.request.setUrl(url)` — Replace the URL. _(stages: pre-request, scenario-script)_
|
|
85
|
+
- `pm.request.setMethod(method)` — Replace the method. _(stages: pre-request, scenario-script)_
|
|
86
|
+
- `pm.request.setRawBody(value)` — Replace the raw body (string or object → JSON). _(stages: pre-request, scenario-script)_
|
|
87
|
+
|
|
88
|
+
## pm.response
|
|
89
|
+
|
|
90
|
+
The received response. Not available in pre-request scripts.
|
|
91
|
+
|
|
92
|
+
- `pm.response.code` — Status code (number). _(stages: post-response, tests, scenario-script)_
|
|
93
|
+
- `pm.response.status` — Status code (number, alias). _(stages: post-response, tests, scenario-script)_
|
|
94
|
+
- `pm.response.statusText` — Status text. _(stages: post-response, tests, scenario-script)_
|
|
95
|
+
- `pm.response.json()` — Parsed JSON body — call once into a const (`const body = pm.response.json()`); throws on non-JSON, so guard with try/catch or pm.response.to.be.json when the content type is uncertain. _(stages: post-response, tests, scenario-script)_
|
|
96
|
+
- `pm.response.text()` — Raw body as string. _(stages: post-response, tests, scenario-script)_
|
|
97
|
+
- `pm.response.rawBody` — Raw body string. _(stages: post-response, tests, scenario-script)_
|
|
98
|
+
- `pm.response.headers` — Response HeaderList. _(stages: post-response, tests, scenario-script)_
|
|
99
|
+
- `pm.response.responseTime` — Duration in ms. _(stages: post-response, tests, scenario-script)_
|
|
100
|
+
- `pm.response.responseSize` — Body size in bytes. _(stages: post-response, tests, scenario-script)_
|
|
101
|
+
- `pm.response.to.have.status(code)` — Assertion shortcuts; also .to.have.header/.jsonBody/.body and .to.be.ok/.json/.success/.clientError/... plus .to.not.<predicate>. _(stages: post-response, tests, scenario-script)_
|
|
102
|
+
|
|
103
|
+
## pm.sendRequest
|
|
104
|
+
|
|
105
|
+
Fire an ad-hoc HTTP request from inside a script.
|
|
106
|
+
|
|
107
|
+
- `pm.sendRequest(urlOrOptions, callback?)` — Options: { url, method, header: {name: value}, body }. Body accepts a plain object (auto-JSON) OR Postman style { mode: 'raw', raw: JSON.stringify({...}) } / { mode: 'urlencoded', urlencoded: [{key, value}] }. Prefer `const res = await pm.sendRequest({...})`; callback form gets (err, res). The response object is { code, status, statusText, headers, body, responseTime, json(), text() } — note it is NOT pm.response.
|
|
108
|
+
|
|
109
|
+
## pm.db
|
|
110
|
+
|
|
111
|
+
Database access (Oracle / MongoDB / PostgreSQL / MySQL). Disabled by feature policy in some contexts — tests then report SKIP.
|
|
112
|
+
|
|
113
|
+
- `pm.db.query({ connectionId, query })` — Run an ad-hoc query — ALWAYS await it. Resolves to { success, error, rowCount, rows, firstRow(), connectionId, connectionName, connectionType, durationMs, executedAt }. firstRow is a FUNCTION: res.firstRow()?.STATUS (Oracle columns are UPPERCASE). _(requires the database capability — may be disabled by feature policy)_
|
|
114
|
+
- `pm.db.pre` — Result object of the declared pre-request DB query: { success, error, rowCount, rows, firstRow() }. Not a promise — read directly. _(requires the database capability — may be disabled by feature policy)_
|
|
115
|
+
- `pm.db.post` — Result object of the declared post-response DB query (same shape as pm.db.pre). _(stages: post-response, tests)_ _(requires the database capability — may be disabled by feature policy)_
|
|
116
|
+
|
|
117
|
+
## pm.kafka
|
|
118
|
+
|
|
119
|
+
Captured Kafka events from the request's Kafka tab listener.
|
|
120
|
+
|
|
121
|
+
- `pm.kafka.event()` — The matched event's parsed payload (or null). _(stages: post-response, tests)_ _(requires the kafka capability — may be disabled by feature policy)_
|
|
122
|
+
- `pm.kafka.messages()` — Every captured message in the listen window. _(stages: post-response, tests)_ _(requires the kafka capability — may be disabled by feature policy)_
|
|
123
|
+
|
|
124
|
+
## pm.redis
|
|
125
|
+
|
|
126
|
+
Results of the declared pre/post Redis commands.
|
|
127
|
+
|
|
128
|
+
- `pm.redis.get(key)` — Read a value already captured by a declared GET. _(requires the redis capability — may be disabled by feature policy)_
|
|
129
|
+
- `pm.redis.results.pre` — Array of pre-stage command results (by line index). _(requires the redis capability — may be disabled by feature policy)_
|
|
130
|
+
- `pm.redis.results.post` — Array of post-stage command results. _(stages: post-response, tests)_ _(requires the redis capability — may be disabled by feature policy)_
|
|
131
|
+
|
|
132
|
+
## pm.random
|
|
133
|
+
|
|
134
|
+
Deterministic-format random data generators.
|
|
135
|
+
|
|
136
|
+
- `pm.random.uuid()` — UUID v4.
|
|
137
|
+
- `pm.random.email()` — Random email address.
|
|
138
|
+
- `pm.random.string(length?)` — Alphanumeric string.
|
|
139
|
+
- `pm.random.int(min, max)` — Integer in range.
|
|
140
|
+
- `pm.random.bigdecimal(min, max, scale)` — Decimal with given scale.
|
|
141
|
+
- `pm.random.boolean()` — true/false.
|
|
142
|
+
- `pm.random.phone()` — Phone number string.
|
|
143
|
+
- `pm.random.name()` — Person name.
|
|
144
|
+
- `pm.random.date(format?)` — Date string.
|
|
145
|
+
|
|
146
|
+
## pm.counter
|
|
147
|
+
|
|
148
|
+
Monotonic counter scoped to the run.
|
|
149
|
+
|
|
150
|
+
- `pm.counter.next()` — Next value (starts at 1).
|
|
151
|
+
- `pm.counter.start(startAt?)` — Counter starting at a custom value.
|
|
152
|
+
|
|
153
|
+
## pm.info
|
|
154
|
+
|
|
155
|
+
Execution metadata snapshot.
|
|
156
|
+
|
|
157
|
+
- `pm.info.eventName` — "prerequest" | "test".
|
|
158
|
+
- `pm.info.iteration` — Zero-based data-driven iteration index.
|
|
159
|
+
- `pm.info.iterationCount` — Total iterations — only meaningful in collection/data-driven runs. Never use it to gate token/cache logic in single sends.
|
|
160
|
+
- `pm.info.requestName` — Current request's name.
|
|
161
|
+
- `pm.info.requestId` — Current request's id.
|
|
162
|
+
|
|
163
|
+
## pm.execution
|
|
164
|
+
|
|
165
|
+
Collection-run flow control.
|
|
166
|
+
|
|
167
|
+
- `pm.execution.setNextRequest(name)` — Jump to a named request next (collection runs).
|
|
168
|
+
- `pm.execution.skipRequest()` — Skip the current request. _(stages: pre-request)_
|
|
169
|
+
- `pm.execution.location` — Folder path of the current request.
|
|
170
|
+
|
|
171
|
+
## pm.node
|
|
172
|
+
|
|
173
|
+
Scenario workflow context (only meaningful inside scenario script nodes).
|
|
174
|
+
|
|
175
|
+
- `pm.node.nodeLabel` — Current node's label. _(stages: scenario-script)_
|
|
176
|
+
- `pm.node.setNextRequest(name)` — Route the workflow to a named node. _(stages: scenario-script)_
|
|
177
|
+
|
|
178
|
+
## pm.log
|
|
179
|
+
|
|
180
|
+
Structured logging into the run report.
|
|
181
|
+
|
|
182
|
+
- `pm.log(...args)` — Like console.log; entries land in the run's log panel.
|
|
183
|
+
|
|
184
|
+
## CryptoJS
|
|
185
|
+
|
|
186
|
+
crypto-js global (NOT under pm.*).
|
|
187
|
+
|
|
188
|
+
- `CryptoJS.SHA256(msg) / SHA1 / SHA512 / MD5` — Hashes; .toString() or .toString(CryptoJS.enc.Hex).
|
|
189
|
+
- `CryptoJS.HmacSHA256(msg, key)` — HMAC family (SHA1/224/384/512, MD5 variants).
|
|
190
|
+
- `CryptoJS.AES.encrypt(msg, key) / .decrypt(cipher, key)` — AES; decrypt result needs .toString(CryptoJS.enc.Utf8).
|
|
191
|
+
- `CryptoJS.PBKDF2(password, salt, options)` — Key derivation.
|
|
192
|
+
- `CryptoJS.enc.Utf8 / Base64 / Hex / Latin1` — Encoders for .toString(...).
|
|
193
|
+
- `CryptoJS.lib.WordArray.create / random(n)` — Raw word arrays (e.g. random IVs).
|
|
194
|
+
|
|
195
|
+
## _
|
|
196
|
+
|
|
197
|
+
lodash global (NOT under pm.*).
|
|
198
|
+
|
|
199
|
+
- `_.get(obj, path, default?) / _.pick / _.groupBy / _.sortBy / _.uniq / ...` — Full lodash surface for data wrangling.
|
|
200
|
+
|
|
201
|
+
## timers
|
|
202
|
+
|
|
203
|
+
Safe per-execution timer wrappers (callbacks never outlive the run).
|
|
204
|
+
|
|
205
|
+
- `setTimeout(fn, ms) / clearTimeout(id)` — Use with await new Promise(r => setTimeout(r, ms)) for polling loops.
|
|
206
|
+
- `setInterval(fn, ms) / clearInterval(id)` — Interval variant.
|
|
207
|
+
|
|
208
|
+
## Stage rules
|
|
209
|
+
|
|
210
|
+
- `pre-request`: runs BEFORE the HTTP call. `pm.response` does not exist; `pm.request` mutations take effect.
|
|
211
|
+
- `post-response` / `tests`: run AFTER the call. `pm.response` is available; `pm.request` mutations have no effect.
|
|
212
|
+
- `scenario-script`: a scenario Script node. Prior node outputs are readable via `pm.variables.resolve("{{NodeLabel.path}}")`; the script's return value becomes the node output.
|
|
213
|
+
- Members without a stage note are available in every stage.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!-- GENERATED FILE — do not edit by hand. Source: callman_core (npm run ai:packs). -->
|
|
2
|
+
|
|
3
|
+
# Script sandbox — available and blocked globals
|
|
4
|
+
|
|
5
|
+
The sandbox is a Node `vm` context. Generated code must never reference a blocked global — the script fails at runtime.
|
|
6
|
+
|
|
7
|
+
## Available built-ins
|
|
8
|
+
|
|
9
|
+
`AggregateError`, `Array`, `ArrayBuffer`, `BigInt`, `BigInt64Array`, `BigUint64Array`, `Boolean`, `DataView`, `Date`, `Error`, `EvalError`, `Float32Array`, `Float64Array`, `Infinity`, `Int16Array`, `Int32Array`, `Int8Array`, `JSON`, `Map`, `Math`, `NaN`, `Number`, `Object`, `Promise`, `RangeError`, `ReferenceError`, `RegExp`, `Set`, `String`, `Symbol`, `SyntaxError`, `TextDecoder`, `TextEncoder`, `TypeError`, `URIError`, `URL`, `URLSearchParams`, `Uint16Array`, `Uint32Array`, `Uint8Array`, `Uint8ClampedArray`, `WeakMap`, `WeakSet`, `atob`, `btoa`, `decodeURIComponent`, `encodeURIComponent`, `isFinite`, `isNaN`, `parseFloat`, `parseInt`, `structuredClone`, `undefined`
|
|
10
|
+
|
|
11
|
+
Plus the injected helpers: `pm`, `console`, `CryptoJS`, `_` (lodash), `setTimeout`/`clearTimeout`/`setInterval`/`clearInterval` (safe per-run wrappers).
|
|
12
|
+
|
|
13
|
+
## Blocked (never use)
|
|
14
|
+
|
|
15
|
+
`Buffer`, `Function`, `WebSocket`, `Worker`, `XMLHttpRequest`, `document`, `eval`, `exports`, `fetch`, `global`, `globalThis`, `importScripts`, `module`, `navigator`, `process`, `require`, `self`, `window`
|
|
16
|
+
|
|
17
|
+
Notes:
|
|
18
|
+
- No `fetch` — use `pm.sendRequest` for HTTP.
|
|
19
|
+
- No `Buffer` — use `atob`/`btoa`/`TextEncoder`/`Uint8Array`.
|
|
20
|
+
- No `require`/`import` — `CryptoJS` and `_` are already in scope.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<!-- GENERATED FILE — do not edit by hand. Source: callman_core (npm run ai:packs). -->
|
|
2
|
+
|
|
3
|
+
# Template tokens (`{{...}}`)
|
|
4
|
+
|
|
5
|
+
Anywhere a `{{...}}` is accepted (URLs, headers, bodies, DB queries, Kafka payloads, scenario node configs), substitution is PLAIN TEXT replacement — no quoting, no escaping. Quote SQL strings yourself (`WHERE id = '{{userId}}'`). A missing variable resolves to an empty string.
|
|
6
|
+
|
|
7
|
+
## Variable lookups
|
|
8
|
+
|
|
9
|
+
- `{{name}}` — environment → globals lookup.
|
|
10
|
+
- `{{env.name}}` / `{{global.name}}` — forced scope.
|
|
11
|
+
- `{{response.body.<path>}}` — current request's response (request context only; dot-indexed arrays: `items.0.id`).
|
|
12
|
+
- `{{<NodeLabel>.<path>}}` — a prior scenario node's output (scenario context only; bracket-indexed arrays: `rows[0].id`).
|
|
13
|
+
|
|
14
|
+
## Random generators
|
|
15
|
+
|
|
16
|
+
| Token | Meaning | Example output |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `{{random.email}}` | Random email address | `sam.user42@example.com` |
|
|
19
|
+
| `{{random.string}}` | Random alphanumeric string | `aZ19xPq20LmN` |
|
|
20
|
+
| `{{random.uuid}}` | Random UUID v4 | `1d7fe6b6-6f47-4fa9-b57a-d2e1d285be51` |
|
|
21
|
+
| `{{random.int}}` | Random integer | `48291` |
|
|
22
|
+
| `{{random.bigdecimal}}` | Random decimal number | `1842.552190` |
|
|
23
|
+
| `{{random.boolean}}` | Random boolean | `true` |
|
|
24
|
+
| `{{random.phone}}` | Random phone number | `+15558675309` |
|
|
25
|
+
| `{{random.date("YYYY-MM-DD")}}` | Random date | `2026-04-06` |
|
|
26
|
+
| `{{random.name}}` | Random human name | `Aylin Karimli` |
|
|
27
|
+
|
|
28
|
+
## Counters
|
|
29
|
+
|
|
30
|
+
| Token | Meaning | Example output |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| `{{counter}}` | Incrementing counter per request | `1, 2, 3...` |
|
|
33
|
+
| `{{counter.start(100)}}` | Counter starting at 100 | `100, 101, 102...` |
|
|
34
|
+
|
|
35
|
+
## Postman-compatible `$` tokens
|
|
36
|
+
|
|
37
|
+
| Token | Meaning | Example output |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| `{{$guid}}` | Postman compat — UUID v4 | `1d7fe6b6-6f47-4fa9-b57a-d2e1d285be51` |
|
|
40
|
+
| `{{$randomUUID}}` | Postman compat — UUID v4 | `1d7fe6b6-6f47-4fa9-b57a-d2e1d285be51` |
|
|
41
|
+
| `{{$timestamp}}` | Postman compat — unix seconds | `1718793600` |
|
|
42
|
+
| `{{$isoTimestamp}}` | Postman compat — ISO 8601 | `2026-05-18T10:24:00.123Z` |
|
|
43
|
+
| `{{$randomInt}}` | Postman compat — 0-1000 | `482` |
|
|
44
|
+
| `{{$randomBoolean}}` | Postman compat | `true` |
|
|
45
|
+
| `{{$randomAlphaNumeric}}` | Postman compat — 8 chars | `aZ19xPq2` |
|
|
46
|
+
| `{{$randomHexaDecimal}}` | Postman compat — 0xNNNNNNNN | `0x4f3a1c2d` |
|
|
47
|
+
| `{{$randomString}}` | Postman compat — 12 chars | `aZ19xPq20LmN` |
|
|
48
|
+
| `{{$randomFirstName}}` | Postman compat | `Aylin` |
|
|
49
|
+
| `{{$randomLastName}}` | Postman compat | `Karimov` |
|
|
50
|
+
| `{{$randomFullName}}` | Postman compat | `Aylin Karimov` |
|
|
51
|
+
| `{{$randomUserName}}` | Postman compat | `aylin.karimov42` |
|
|
52
|
+
| `{{$randomNamePrefix}}` | Postman compat | `Dr.` |
|
|
53
|
+
| `{{$randomNameSuffix}}` | Postman compat | `Jr.` |
|
|
54
|
+
| `{{$randomEmail}}` | Postman compat | `sam.user42@example.com` |
|
|
55
|
+
| `{{$randomUrl}}` | Postman compat | `https://acme.io/q1w2e3` |
|
|
56
|
+
| `{{$randomDomainName}}` | Postman compat | `acme.io` |
|
|
57
|
+
| `{{$randomDomainSuffix}}` | Postman compat | `io` |
|
|
58
|
+
| `{{$randomUserAgent}}` | Postman compat | `Mozilla/5.0 (...)` |
|
|
59
|
+
| `{{$randomIP}}` | Postman compat — IPv4 | `192.168.1.42` |
|
|
60
|
+
| `{{$randomIPV4}}` | Postman compat | `192.168.1.42` |
|
|
61
|
+
| `{{$randomIPV6}}` | Postman compat | `fe80::1ff:fe23:4567:890a` |
|
|
62
|
+
| `{{$randomMACAddress}}` | Postman compat | `1A:2B:3C:4D:5E:6F` |
|
|
63
|
+
| `{{$randomPassword}}` | Postman compat | `x4Z9p2Aq!` |
|
|
64
|
+
| `{{$randomSemver}}` | Postman compat | `3.7.42` |
|
|
65
|
+
| `{{$randomPhoneNumber}}` | Postman compat | `+15558675309` |
|
|
66
|
+
| `{{$randomCity}}` | Postman compat | `Baku` |
|
|
67
|
+
| `{{$randomCountry}}` | Postman compat | `Azerbaijan` |
|
|
68
|
+
| `{{$randomCountryCode}}` | Postman compat | `AZ` |
|
|
69
|
+
| `{{$randomStreetAddress}}` | Postman compat | `742 Maple St` |
|
|
70
|
+
| `{{$randomZipCode}}` | Postman compat | `10042` |
|
|
71
|
+
| `{{$randomLatitude}}` | Postman compat | `40.412345` |
|
|
72
|
+
| `{{$randomLongitude}}` | Postman compat | `-74.012345` |
|
|
73
|
+
| `{{$randomCompanyName}}` | Postman compat | `Acme Labs Inc.` |
|
|
74
|
+
| `{{$randomJobTitle}}` | Postman compat | `Senior Software Engineer` |
|
|
75
|
+
| `{{$randomJobArea}}` | Postman compat | `Engineering` |
|
|
76
|
+
| `{{$randomDepartment}}` | Postman compat | `Engineering` |
|
|
77
|
+
| `{{$randomProduct}}` | Postman compat | `Acme Cloud` |
|
|
78
|
+
| `{{$randomCatchPhrase}}` | Postman compat | `Scalable mesh` |
|
|
79
|
+
| `{{$randomCreditCardMask}}` | Postman compat | `****-****-****-4242` |
|
|
80
|
+
| `{{$randomCreditCardNumber}}` | Postman compat | `4242424242424242` |
|
|
81
|
+
| `{{$randomBankAccount}}` | Postman compat | `0123456789` |
|
|
82
|
+
| `{{$randomBankRoutingNumber}}` | Postman compat | `021000089` |
|
|
83
|
+
| `{{$randomCurrencyCode}}` | Postman compat | `USD` |
|
|
84
|
+
| `{{$randomPrice}}` | Postman compat | `42.99` |
|
|
85
|
+
| `{{$randomTransactionType}}` | Postman compat | `payment` |
|
|
86
|
+
| `{{$randomDatetime}}` | Postman compat | `2026-04-06T10:24:00.000Z` |
|
|
87
|
+
| `{{$randomDatePast}}` | Postman compat | `2025-10-12T...` |
|
|
88
|
+
| `{{$randomDateFuture}}` | Postman compat | `2026-11-04T...` |
|
|
89
|
+
| `{{$randomDateRecent}}` | Postman compat — last 7 days | `2026-05-15T...` |
|
|
90
|
+
| `{{$randomDateSoon}}` | Postman compat — next 7 days | `2026-05-22T...` |
|
|
91
|
+
| `{{$randomTime}}` | Postman compat | `14:23:07` |
|
|
92
|
+
| `{{$randomWeekday}}` | Postman compat | `Wednesday` |
|
|
93
|
+
| `{{$randomMonth}}` | Postman compat | `April` |
|
|
94
|
+
| `{{$randomColor}}` | Postman compat | `purple` |
|
|
95
|
+
| `{{$randomHexColor}}` | Postman compat | `#A78BFA` |
|
|
96
|
+
| `{{$randomWord}}` | Postman compat — lorem | `ipsum` |
|
|
97
|
+
| `{{$randomWords}}` | Postman compat — lorem phrase | `lorem ipsum dolor` |
|
|
98
|
+
| `{{$randomSentence}}` | Postman compat | `Lorem ipsum dolor sit amet.` |
|
|
99
|
+
| `{{$randomParagraph}}` | Postman compat | `Lorem ipsum dolor sit amet...` |
|
|
100
|
+
| `{{$randomFileName}}` | Postman compat | `q1w2e3r4.pdf` |
|
|
101
|
+
| `{{$randomFileExt}}` | Postman compat | `json` |
|
|
102
|
+
| `{{$randomFileType}}` | Postman compat | `image` |
|
|
103
|
+
| `{{$randomMimeType}}` | Postman compat | `application/json` |
|
|
104
|
+
| `{{$randomImageUrl}}` | Postman compat | `https://picsum.photos/400/300` |
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,11 @@ export { EnvStore } from "./variables/envStore.js";
|
|
|
7
7
|
export { runScript } from "./script/legacy.js";
|
|
8
8
|
export * from "./templating/index.js";
|
|
9
9
|
export { executeScript, validateScript } from "./script/executor.js";
|
|
10
|
+
export { runScriptIsolated } from "./script/isolated-runner.js";
|
|
11
|
+
export type { RunScriptIsolatedOptions } from "./script/isolated-runner.js";
|
|
10
12
|
export type { CounterSnapshotEntry, ExecuteScriptInput, ExecuteScriptResult, ScriptCapabilities, ScriptCounterCapability, ScriptDbCapability, ScriptDbExecutionInput, ScriptDbExecutionResult, ScriptError, ScriptFeaturePolicy, ScriptKafkaCapability, ScriptKeyValuePair, ScriptLogEntry, ScriptRedisCapability, ScriptRequestBodyState, ScriptRequestState, ScriptResponseState, ScriptStage, ScriptTestResult, ScriptVariableMutation, SendRequestExecutor, } from "./script/types.js";
|
|
13
|
+
export { PM_API_METADATA, type PmApiMember, type PmApiNamespace, type PmApiStage, } from "./script/pm-api-metadata.js";
|
|
14
|
+
export { ALLOWED_GLOBAL_NAMES, BLOCKED_GLOBAL_NAMES, RESERVED_LABEL_NAMES, } from "./script/scope.js";
|
|
11
15
|
export { PmAssertion, createExpectApi } from "./script/features/assertions.js";
|
|
12
16
|
export { PendingKafkaDependencyError, isPendingKafkaValue, } from "./script/features/kafka.js";
|
|
13
17
|
export { DisabledFeatureDependencyError, isDisabledFeatureValue, } from "./script/features/feature-policy.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACrE,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,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,CAAC;AAC5E,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,KAAK,wBAAwB,GAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,KAAK,iBAAiB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,cAAc,GACpB,MAAM,uBAAuB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ export { EnvStore } from "./variables/envStore.js";
|
|
|
7
7
|
export { runScript } from "./script/legacy.js";
|
|
8
8
|
export * from "./templating/index.js";
|
|
9
9
|
export { executeScript, validateScript } from "./script/executor.js";
|
|
10
|
+
export { runScriptIsolated } from "./script/isolated-runner.js";
|
|
11
|
+
export { PM_API_METADATA, } from "./script/pm-api-metadata.js";
|
|
12
|
+
export { ALLOWED_GLOBAL_NAMES, BLOCKED_GLOBAL_NAMES, RESERVED_LABEL_NAMES, } from "./script/scope.js";
|
|
10
13
|
export { PmAssertion, createExpectApi } from "./script/features/assertions.js";
|
|
11
14
|
export { PendingKafkaDependencyError, isPendingKafkaValue, } from "./script/features/kafka.js";
|
|
12
15
|
export { DisabledFeatureDependencyError, isDisabledFeatureValue, } from "./script/features/feature-policy.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,kBAAkB,GAEnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,kBAAkB,GAEnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAyBhE,OAAO,EACL,eAAe,GAIhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,GAEtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,GAEzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,GAEjB,MAAM,uBAAuB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// - return value gets deep template-resolved
|
|
9
9
|
// - failed pm.test entries surface in `failureMessage` for the runner
|
|
10
10
|
import { buildScenarioTemplateValues, resolveScenarioTemplateString } from "../templateResolver.js";
|
|
11
|
-
import {
|
|
11
|
+
import { runScriptIsolated } from "../../script/isolated-runner.js";
|
|
12
12
|
import { withAbortAndTimeout } from "./helpers/abort.js";
|
|
13
13
|
import { resolveScenarioScriptTemplatesDeep } from "./helpers/templates.js";
|
|
14
14
|
const toScenarioMutation = (mutation) => mutation.type === "set"
|
|
@@ -46,7 +46,7 @@ export const buildScriptExecutor = (options) => async (input) => {
|
|
|
46
46
|
failureMessage: "Script node is empty.",
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
const scriptResult = await withAbortAndTimeout(
|
|
49
|
+
const scriptResult = await withAbortAndTimeout(runScriptIsolated({
|
|
50
50
|
script,
|
|
51
51
|
timeoutMs: baseTimeoutMs,
|
|
52
52
|
filename: "callman-scenario.script.js",
|
|
@@ -74,7 +74,7 @@ export const buildScriptExecutor = (options) => async (input) => {
|
|
|
74
74
|
variables: true,
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
|
-
}), baseTimeoutMs, `Script node ${input.stepId}`, input.signal);
|
|
77
|
+
}, { signal: input.signal }), baseTimeoutMs, `Script node ${input.stepId}`, input.signal);
|
|
78
78
|
// Templates may contain `{{...}}` tokens that reference live runtime
|
|
79
79
|
// values not available inside the sandbox (response.body, db.result,
|
|
80
80
|
// etc.). Resolve them against the current scenario runtime scope
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-executor.js","sourceRoot":"","sources":["../../../src/scenario-runner/adapters/script-executor.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,oEAAoE;AACpE,mCAAmC;AACnC,qEAAqE;AACrE,yEAAyE;AACzE,mEAAmE;AACnE,sBAAsB;AACtB,+CAA+C;AAC/C,wEAAwE;AAOxE,OAAO,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"script-executor.js","sourceRoot":"","sources":["../../../src/scenario-runner/adapters/script-executor.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,oEAAoE;AACpE,mCAAmC;AACnC,qEAAqE;AACrE,yEAA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AAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QACpC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;KACrC,CAAC;IACF,IAAI,EAAE,cAAc,EAAE,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/script/features/log.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAsBlD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE;QACV,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QAClC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QACpC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;KACrC,CAAC;IACF,IAAI,EAAE,cAAc,EAAE,CAAC;CACxB;AAUD,eAAO,MAAM,kBAAkB,QAAO,YAkCrC,CAAC;AAKF,eAAO,MAAM,wBAAwB,QAAO,YAU1C,CAAC"}
|
|
@@ -22,13 +22,32 @@ const stringifyArgument = (value) => {
|
|
|
22
22
|
return String(value);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
+
// Hard caps so a runaway script (e.g. `while (true) { console.log("x") }`)
|
|
26
|
+
// cannot exhaust host memory or produce a multi-gigabyte result payload.
|
|
27
|
+
// Once the entry cap is hit, append becomes a cheap no-op — which also lets
|
|
28
|
+
// the vm-level `timeout` actually interrupt the now CPU-bound loop instead of
|
|
29
|
+
// the host drowning in allocations first.
|
|
30
|
+
const MAX_LOG_ENTRIES = 1000;
|
|
31
|
+
const MAX_MESSAGE_LENGTH = 8192;
|
|
25
32
|
export const createLogCollector = () => {
|
|
26
33
|
const logs = [];
|
|
34
|
+
let truncated = false;
|
|
27
35
|
const append = (level, args) => {
|
|
28
|
-
logs.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
if (logs.length >= MAX_LOG_ENTRIES) {
|
|
37
|
+
if (!truncated) {
|
|
38
|
+
truncated = true;
|
|
39
|
+
logs.push({
|
|
40
|
+
level: "warn",
|
|
41
|
+
message: `… log output truncated (limit of ${MAX_LOG_ENTRIES} entries reached)`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
let message = args.map((entry) => stringifyArgument(entry)).join(" ");
|
|
47
|
+
if (message.length > MAX_MESSAGE_LENGTH) {
|
|
48
|
+
message = `${message.slice(0, MAX_MESSAGE_LENGTH)}… (truncated)`;
|
|
49
|
+
}
|
|
50
|
+
logs.push({ level, message });
|
|
32
51
|
};
|
|
33
52
|
return {
|
|
34
53
|
pmLog: (...args) => append("log", args),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/script/features/log.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,0EAA0E;AAC1E,sEAAsE;AACtE,8BAA8B;AAI9B,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAU,EAAE;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC9E,OAAO,MA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V,GAAG,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC;YAChD,IAAI,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;YAClD,IAAI,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;YAClD,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC;YACpD,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC;SACrD;QACD,IAAI;KACL,CAAC;AACJ,CAAC,CAAC;AAEF,8EAA8E;AAC9E,yEAAyE;AACzE,uEAAuE;AACvE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAiB,EAAE,CAAC,CAAC;IAC3D,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;IACtB,UAAU,EAAE;QACV,GAAG,EAAE,GAAG,EAAE,CAAC,SAAS;QACpB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;QACrB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;QACrB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;QACtB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;KACvB;IACD,IAAI,EAAE,EAAE;CACT,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AbortLikeSignal } from "../scenario-runner/types.js";
|
|
2
|
+
import type { ExecuteScriptInput, ExecuteScriptResult, SendRequestExecutor } from "./types.js";
|
|
3
|
+
export interface RunScriptIsolatedOptions {
|
|
4
|
+
/** Host HTTP executor for pm.sendRequest. When provided, the worker routes
|
|
5
|
+
* pm.sendRequest(...) back to it over the MessagePort. */
|
|
6
|
+
onSendRequest?: SendRequestExecutor;
|
|
7
|
+
/** External cancellation (e.g. scenario run aborted / node timeout). */
|
|
8
|
+
signal?: AbortLikeSignal;
|
|
9
|
+
}
|
|
10
|
+
export declare const runScriptIsolated: (input: ExecuteScriptInput, options?: RunScriptIsolatedOptions) => Promise<ExecuteScriptResult>;
|
|
11
|
+
//# sourceMappingURL=isolated-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isolated-runner.d.ts","sourceRoot":"","sources":["../../src/script/isolated-runner.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EAEnB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAQpB,MAAM,WAAW,wBAAwB;IACvC;+DAC2D;IAC3D,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,wEAAwE;IACxE,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAqCD,eAAO,MAAM,iBAAiB,GAC5B,OAAO,kBAAkB,EACzB,UAAS,wBAA6B,KACrC,OAAO,CAAC,mBAAmB,CA6H7B,CAAC"}
|