callman-core 1.35.0 → 1.37.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 +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/loadtest/compare.d.ts +32 -0
- package/dist/loadtest/compare.d.ts.map +1 -0
- package/dist/loadtest/compare.js +55 -0
- package/dist/loadtest/compare.js.map +1 -0
- package/dist/loadtest/flow-eval.d.ts +21 -0
- package/dist/loadtest/flow-eval.d.ts.map +1 -0
- package/dist/loadtest/flow-eval.js +199 -0
- package/dist/loadtest/flow-eval.js.map +1 -0
- package/dist/loadtest/from-collection.d.ts +51 -0
- package/dist/loadtest/from-collection.d.ts.map +1 -0
- package/dist/loadtest/from-collection.js +131 -0
- package/dist/loadtest/from-collection.js.map +1 -0
- package/dist/loadtest/histogram.d.ts +41 -0
- package/dist/loadtest/histogram.d.ts.map +1 -0
- package/dist/loadtest/histogram.js +166 -0
- package/dist/loadtest/histogram.js.map +1 -0
- package/dist/loadtest/index.d.ts +18 -0
- package/dist/loadtest/index.d.ts.map +1 -0
- package/dist/loadtest/index.js +14 -0
- package/dist/loadtest/index.js.map +1 -0
- package/dist/loadtest/node/index.d.ts +4 -0
- package/dist/loadtest/node/index.d.ts.map +1 -0
- package/dist/loadtest/node/index.js +4 -0
- package/dist/loadtest/node/index.js.map +1 -0
- package/dist/loadtest/node/metrics.d.ts +84 -0
- package/dist/loadtest/node/metrics.d.ts.map +1 -0
- package/dist/loadtest/node/metrics.js +396 -0
- package/dist/loadtest/node/metrics.js.map +1 -0
- package/dist/loadtest/node/orchestrator.d.ts +24 -0
- package/dist/loadtest/node/orchestrator.d.ts.map +1 -0
- package/dist/loadtest/node/orchestrator.js +363 -0
- package/dist/loadtest/node/orchestrator.js.map +1 -0
- package/dist/loadtest/node/protocol.d.ts +102 -0
- package/dist/loadtest/node/protocol.d.ts.map +1 -0
- package/dist/loadtest/node/protocol.js +17 -0
- package/dist/loadtest/node/protocol.js.map +1 -0
- package/dist/loadtest/node/setup.d.ts +6 -0
- package/dist/loadtest/node/setup.d.ts.map +1 -0
- package/dist/loadtest/node/setup.js +100 -0
- package/dist/loadtest/node/setup.js.map +1 -0
- package/dist/loadtest/node/step-compiler.d.ts +29 -0
- package/dist/loadtest/node/step-compiler.d.ts.map +1 -0
- package/dist/loadtest/node/step-compiler.js +229 -0
- package/dist/loadtest/node/step-compiler.js.map +1 -0
- package/dist/loadtest/node/transport.d.ts +66 -0
- package/dist/loadtest/node/transport.d.ts.map +1 -0
- package/dist/loadtest/node/transport.js +414 -0
- package/dist/loadtest/node/transport.js.map +1 -0
- package/dist/loadtest/node/worker-core.d.ts +77 -0
- package/dist/loadtest/node/worker-core.d.ts.map +1 -0
- package/dist/loadtest/node/worker-core.js +744 -0
- package/dist/loadtest/node/worker-core.js.map +1 -0
- package/dist/loadtest/node/worker.d.ts +2 -0
- package/dist/loadtest/node/worker.d.ts.map +1 -0
- package/dist/loadtest/node/worker.js +28 -0
- package/dist/loadtest/node/worker.js.map +1 -0
- package/dist/loadtest/plan-file.d.ts +91 -0
- package/dist/loadtest/plan-file.d.ts.map +1 -0
- package/dist/loadtest/plan-file.js +134 -0
- package/dist/loadtest/plan-file.js.map +1 -0
- package/dist/loadtest/plan.d.ts +47 -0
- package/dist/loadtest/plan.d.ts.map +1 -0
- package/dist/loadtest/plan.js +259 -0
- package/dist/loadtest/plan.js.map +1 -0
- package/dist/loadtest/report.d.ts +8 -0
- package/dist/loadtest/report.d.ts.map +1 -0
- package/dist/loadtest/report.js +211 -0
- package/dist/loadtest/report.js.map +1 -0
- package/dist/loadtest/thresholds.d.ts +55 -0
- package/dist/loadtest/thresholds.d.ts.map +1 -0
- package/dist/loadtest/thresholds.js +203 -0
- package/dist/loadtest/thresholds.js.map +1 -0
- package/dist/loadtest/types.d.ts +500 -0
- package/dist/loadtest/types.d.ts.map +1 -0
- package/dist/loadtest/types.js +8 -0
- package/dist/loadtest/types.js.map +1 -0
- package/dist/loadtest/validate.d.ts +30 -0
- package/dist/loadtest/validate.d.ts.map +1 -0
- package/dist/loadtest/validate.js +162 -0
- package/dist/loadtest/validate.js.map +1 -0
- 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/compile.d.ts +8 -0
- package/dist/templating/compile.d.ts.map +1 -0
- package/dist/templating/compile.js +110 -0
- package/dist/templating/compile.js.map +1 -0
- 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/index.d.ts +2 -0
- package/dist/templating/index.d.ts.map +1 -1
- package/dist/templating/index.js +1 -0
- package/dist/templating/index.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/templating/template-engine.d.ts +6 -0
- package/dist/templating/template-engine.d.ts.map +1 -1
- package/dist/templating/template-engine.js +6 -6
- package/dist/templating/template-engine.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 +18 -5
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/loadtest/compare.js +59 -0
- package/dist-cjs/loadtest/compare.js.map +1 -0
- package/dist-cjs/loadtest/flow-eval.js +205 -0
- package/dist-cjs/loadtest/flow-eval.js.map +1 -0
- package/dist-cjs/loadtest/from-collection.js +139 -0
- package/dist-cjs/loadtest/from-collection.js.map +1 -0
- package/dist-cjs/loadtest/histogram.js +171 -0
- package/dist-cjs/loadtest/histogram.js.map +1 -0
- package/dist-cjs/loadtest/index.js +78 -0
- package/dist-cjs/loadtest/index.js.map +1 -0
- package/dist-cjs/loadtest/node/index.js +12 -0
- package/dist-cjs/loadtest/node/index.js.map +1 -0
- package/dist-cjs/loadtest/node/metrics.js +402 -0
- package/dist-cjs/loadtest/node/metrics.js.map +1 -0
- package/dist-cjs/loadtest/node/orchestrator.js +372 -0
- package/dist-cjs/loadtest/node/orchestrator.js.map +1 -0
- package/dist-cjs/loadtest/node/protocol.js +20 -0
- package/dist-cjs/loadtest/node/protocol.js.map +1 -0
- package/dist-cjs/loadtest/node/setup.js +105 -0
- package/dist-cjs/loadtest/node/setup.js.map +1 -0
- package/dist-cjs/loadtest/node/step-compiler.js +234 -0
- package/dist-cjs/loadtest/node/step-compiler.js.map +1 -0
- package/dist-cjs/loadtest/node/transport.js +422 -0
- package/dist-cjs/loadtest/node/transport.js.map +1 -0
- package/dist-cjs/loadtest/node/worker-core.js +749 -0
- package/dist-cjs/loadtest/node/worker-core.js.map +1 -0
- package/dist-cjs/loadtest/node/worker.js +30 -0
- package/dist-cjs/loadtest/node/worker.js.map +1 -0
- package/dist-cjs/loadtest/plan-file.js +143 -0
- package/dist-cjs/loadtest/plan-file.js.map +1 -0
- package/dist-cjs/loadtest/plan.js +271 -0
- package/dist-cjs/loadtest/plan.js.map +1 -0
- package/dist-cjs/loadtest/report.js +220 -0
- package/dist-cjs/loadtest/report.js.map +1 -0
- package/dist-cjs/loadtest/thresholds.js +213 -0
- package/dist-cjs/loadtest/thresholds.js.map +1 -0
- package/dist-cjs/loadtest/types.js +9 -0
- package/dist-cjs/loadtest/types.js.map +1 -0
- package/dist-cjs/loadtest/validate.js +169 -0
- package/dist-cjs/loadtest/validate.js.map +1 -0
- 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/compile.js +114 -0
- package/dist-cjs/templating/compile.js.map +1 -0
- package/dist-cjs/templating/generator-metadata.js +15 -1
- package/dist-cjs/templating/generator-metadata.js.map +1 -1
- package/dist-cjs/templating/index.js +3 -1
- package/dist-cjs/templating/index.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/templating/template-engine.js +14 -12
- package/dist-cjs/templating/template-engine.js.map +1 -1
- package/dist-cjs/variables/replaceIn.js +111 -0
- package/dist-cjs/variables/replaceIn.js.map +1 -0
- package/package.json +21 -2
|
@@ -12,11 +12,6 @@ Capability-gated members:
|
|
|
12
12
|
- `pm.db.pre`
|
|
13
13
|
- `pm.db.post`
|
|
14
14
|
|
|
15
|
-
## kafka
|
|
16
|
-
|
|
17
|
-
- `pm.kafka.event()`
|
|
18
|
-
- `pm.kafka.messages()`
|
|
19
|
-
|
|
20
15
|
## redis
|
|
21
16
|
|
|
22
17
|
- `pm.redis.command({ connectionId, command })`
|
|
@@ -24,4 +19,4 @@ Capability-gated members:
|
|
|
24
19
|
- `pm.redis.results.pre`
|
|
25
20
|
- `pm.redis.results.post`
|
|
26
21
|
|
|
27
|
-
Generation guidance: prefer declared pre/post queries and `pm.db.query` only when the user explicitly asks for database work; never assume
|
|
22
|
+
Generation guidance: prefer declared pre/post queries and `pm.db.query` only when the user explicitly asks for database work; never assume redis capabilities exist unless the task mentions them.
|
package/ai-packs/pm-api.md
CHANGED
|
@@ -2,179 +2,274 @@
|
|
|
2
2
|
|
|
3
3
|
# Callman `pm.*` scripting API
|
|
4
4
|
|
|
5
|
-
Scripts are plain JavaScript (top-level `await` allowed). Use ONLY the API below —
|
|
5
|
+
Scripts are plain JavaScript (top-level `await` allowed). `pm`, `cm` and `callman` are the SAME object: a script can use `cm.` exactly like `pm.` (cm.environment.get(...), cm.test(...), cm.expect(...)), and Postman scripts run unchanged. Use ONLY the API below — fetch, XMLHttpRequest, process, eval, import() and the filesystem are blocked by the sandbox (use `pm.sendRequest` for HTTP and `require()` for the built-in libraries).
|
|
6
|
+
|
|
7
|
+
## pm
|
|
8
|
+
|
|
9
|
+
The script API. `cm` and `callman` are the SAME object as `pm` — a script can use `cm.` exactly like `pm.` (cm === pm), so Postman scripts run unchanged and Callman-branded scripts behave identically.
|
|
10
|
+
|
|
11
|
+
- `cm.environment.set(key, value)` — `cm.x` and `callman.x` are aliases of `pm.x` for every member below. Example: `cm.test("ok", () => cm.expect(1).to.equal(1))`
|
|
6
12
|
|
|
7
13
|
## pm.test
|
|
8
14
|
|
|
9
|
-
Register a named test. The callback
|
|
15
|
+
Register a named test. The callback runs synchronously; a failing assertion (or a throw) marks the test failed without aborting the script. Works in pre-request, post-response and tests scripts.
|
|
10
16
|
|
|
11
|
-
- `pm.test(name, fn)` — Runs fn
|
|
17
|
+
- `pm.test(name, fn)` — Runs fn immediately; pass/fail lands in the run's test results. An async fn / returned Promise is awaited before the script is reported. Example: `pm.test("sum is 4", () => pm.expect(2 + 2).to.equal(4))`
|
|
18
|
+
- `pm.test(name, done => { done(); })` — Callback-style async test: the test completes when done() is called (done(error) fails it). Example: `pm.test("later", done => { setTimeout(done, 10); })`
|
|
19
|
+
- `pm.test.skip(name)` — Record a skipped test (shown as SKIP); the callback, if any, is never run. Example: `pm.test.skip("not ready yet")`
|
|
20
|
+
- `pm.test.index()` — Number of tests recorded so far in this script. Example: `pm.test.index()`
|
|
12
21
|
|
|
13
22
|
## pm.expect
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
pm.expect is chai 4.4.1 with the full BDD API (expect-style), the chai-postman helpers and a few jest-style aliases. Chain words (to, be, been, is, that, which, and, has, have, with, at, of, same, but, does, still, also) read like English; flags (not, deep, nested, own, ordered, any, all, itself) change the assertion that follows. Equality is strict: .equal / .eq use ===, so NaN does not equal NaN and 1 does not equal "1"; use .eql / .deep.equal for structural comparison. Failure messages are chai's own.
|
|
16
25
|
|
|
17
|
-
- `pm.expect(value)` —
|
|
18
|
-
- `pm.expect.fail(message?)` —
|
|
26
|
+
- `pm.expect(value, message?)` — Start an assertion. Equality: .to.equal(x) (===), .to.eql(x) / .to.deep.equal(x) (deep), .toBe(x) / .toEqual(x) (jest-style). Existence/type: .to.exist, .to.be.null, .to.be.undefined, .to.be.true, .to.be.a('string'|'number'|'array'|'object'|...). Strings/arrays: .to.include(x) / .to.contain(x) / .toContain(x), .to.have.lengthOf(n), .to.be.empty, .to.match(/re/), .to.have.members([...]), .to.be.oneOf([...]). Numbers: .to.be.above(n) / .below(n) / .within(a, b) / .closeTo(n, delta) / .toBeGreaterThan(n) / .toBeLessThan(n). Objects: .to.have.property('a.b', value?) (dot paths work by default), .to.have.all.keys('a', 'b'), .to.have.jsonSchema(schema). Negation: .to.not.<assertion>. Example: `pm.expect(user.id).to.be.a("number")`
|
|
27
|
+
- `pm.expect.fail(message?)` — Throws an AssertionError (fails the surrounding test) immediately. Example: `pm.expect.fail("unexpected branch")`
|
|
28
|
+
- `pm.expect(value).to.have.jsonSchema(schema, ajvOptions?)` — Validate any value against a JSON Schema (ajv). Also available on the response as pm.response.to.have.jsonSchema(schema) in post-response scripts. Example: `pm.expect(user).to.have.jsonSchema({ type: "object", required: ["id"] })`
|
|
19
29
|
|
|
20
30
|
## pm.environment
|
|
21
31
|
|
|
22
|
-
Active environment variables (alias: pm.env).
|
|
32
|
+
Active environment variables (alias: pm.env). get() returns the value as it was set within the run (numbers and objects stay native); stored values are strings, objects/arrays are saved as JSON. Writes surface as variable mutations.
|
|
23
33
|
|
|
24
|
-
- `pm.environment.get(key)` — Read a variable (
|
|
25
|
-
- `pm.environment.set(key, value)` — Write a variable for subsequent steps.
|
|
34
|
+
- `pm.environment.get(key)` — Read a variable (undefined when missing). Example: `pm.environment.get("baseUrl")`
|
|
35
|
+
- `pm.environment.set(key, value, type?)` — Write a variable for subsequent steps. type is one of string, number, boolean, json, any. Example: `pm.environment.set("token", token)`
|
|
26
36
|
- `pm.environment.unset(key)` — Remove a variable.
|
|
27
37
|
- `pm.environment.has(key)` — true when the key exists.
|
|
28
38
|
- `pm.environment.clear()` — Remove every variable in the scope.
|
|
29
39
|
- `pm.environment.toObject()` — Plain { key: value } snapshot.
|
|
30
|
-
- `pm.environment.replaceIn(template)` — Resolve {{tokens}}
|
|
40
|
+
- `pm.environment.replaceIn(template)` — Resolve {{tokens}} against THIS scope only. Unresolved {{x}} stay as written (literal); objects and arrays are walked. Example: `pm.environment.replaceIn("{{baseUrl}}/users")`
|
|
31
41
|
- `pm.environment.name` — Active environment's name.
|
|
42
|
+
- `pm.environment.values` — The raw string values record (read-only view).
|
|
32
43
|
|
|
33
44
|
## pm.globals
|
|
34
45
|
|
|
35
46
|
Workspace-level global variables. Same surface as pm.environment.
|
|
36
47
|
|
|
37
48
|
- `pm.globals.get(key)` — Read a global.
|
|
38
|
-
- `pm.globals.set(key, value)` — Write a global for the run.
|
|
49
|
+
- `pm.globals.set(key, value, type?)` — Write a global for the run.
|
|
39
50
|
- `pm.globals.unset(key)` — Remove a global.
|
|
40
51
|
- `pm.globals.has(key)` — true when the key exists.
|
|
41
52
|
- `pm.globals.clear()` — Remove every global in the scope.
|
|
42
53
|
- `pm.globals.toObject()` — Plain snapshot.
|
|
43
|
-
- `pm.globals.replaceIn(template)` — Resolve {{tokens}}
|
|
54
|
+
- `pm.globals.replaceIn(template)` — Resolve {{tokens}} against the globals; unresolved tokens stay literal.
|
|
55
|
+
- `pm.globals.name` — Scope name.
|
|
56
|
+
- `pm.globals.values` — The raw string values record (read-only view).
|
|
44
57
|
|
|
45
58
|
## pm.collectionVariables
|
|
46
59
|
|
|
47
|
-
Collection-scoped variables that survive across requests within one collection run
|
|
60
|
+
Collection-scoped variables that survive across requests within one collection run. `{{name}}` resolves them after the environment and before globals.
|
|
48
61
|
|
|
49
62
|
- `pm.collectionVariables.get(key)` — Read a collection variable.
|
|
50
|
-
- `pm.collectionVariables.set(key, value)` — Write; persists across the iteration.
|
|
63
|
+
- `pm.collectionVariables.set(key, value, type?)` — Write; persists across the iteration.
|
|
51
64
|
- `pm.collectionVariables.unset(key)` — Remove a collection variable.
|
|
52
65
|
- `pm.collectionVariables.has(key)` — true when the key exists.
|
|
53
66
|
- `pm.collectionVariables.clear()` — Remove all collection variables.
|
|
54
67
|
- `pm.collectionVariables.toObject()` — Plain snapshot.
|
|
55
|
-
- `pm.collectionVariables.replaceIn(template)` — Resolve {{tokens}}.
|
|
68
|
+
- `pm.collectionVariables.replaceIn(template)` — Resolve {{tokens}}; unresolved tokens stay literal.
|
|
69
|
+
- `pm.collectionVariables.name` — Scope name.
|
|
70
|
+
- `pm.collectionVariables.values` — The raw string values record (read-only view).
|
|
56
71
|
|
|
57
72
|
## pm.variables
|
|
58
73
|
|
|
59
|
-
Layered read across all scopes
|
|
74
|
+
Layered read across all scopes — local > iteration data > environment > collection > globals. `set` writes the local scope, shared by every script of the same request (collection → folder → request) and gone afterwards.
|
|
60
75
|
|
|
61
|
-
- `pm.variables.get(key)` — Read through the precedence chain.
|
|
62
|
-
- `pm.variables.set(key, value)` — Write to the run-local layer.
|
|
76
|
+
- `pm.variables.get(key)` — Read through the precedence chain. Example: `pm.variables.get("userId")`
|
|
77
|
+
- `pm.variables.set(key, value, type?)` — Write to the run-local layer.
|
|
63
78
|
- `pm.variables.unset(key)` — Remove from the run-local layer.
|
|
64
79
|
- `pm.variables.has(key)` — true when any layer has the key.
|
|
80
|
+
- `pm.variables.clear()` — Clear the run-local layer.
|
|
65
81
|
- `pm.variables.toObject()` — Merged snapshot.
|
|
66
|
-
- `pm.variables.replaceIn(template)` —
|
|
67
|
-
- `pm.variables.resolve(template)` —
|
|
82
|
+
- `pm.variables.replaceIn(template)` — Postman semantics: resolve {{tokens}} (and dynamic variables like {{$guid}}); an unresolved {{x}} stays as written; objects and arrays are walked. Example: `pm.variables.replaceIn("{{baseUrl}}/users/{{userId}}")`
|
|
83
|
+
- `pm.variables.resolve(template)` — Callman's older resolver: like replaceIn on a string, but an unresolved {{x}} becomes an empty string. Does NOT read scenario node outputs — use pm.node(label) for those. Example: `pm.variables.resolve("{{missing}}")`
|
|
68
84
|
|
|
69
|
-
## pm.
|
|
85
|
+
## pm.iterationData
|
|
86
|
+
|
|
87
|
+
The data-file / dataset row of the current iteration of a data-driven run (empty outside one). Also a layer of pm.variables.
|
|
88
|
+
|
|
89
|
+
- `pm.iterationData.get(key)` — Read a column of the current row. Example: `pm.iterationData.get("email")`
|
|
90
|
+
- `pm.iterationData.has(key)` — true when the row has the column.
|
|
91
|
+
- `pm.iterationData.toObject()` — The whole row as a plain object.
|
|
92
|
+
- `pm.iterationData.toJSON()` — Same as toObject(); used by JSON.stringify.
|
|
93
|
+
- `pm.iterationData.set(key, value)` — Change this run's copy of the row (not written back to the data file).
|
|
94
|
+
- `pm.iterationData.unset(key)` — Remove a column from this run's copy of the row.
|
|
95
|
+
- `pm.iterationData.clear()` — Remove every column from this run's copy of the row.
|
|
96
|
+
- `pm.iterationData.replaceIn(template)` — Resolve {{tokens}} against the row only.
|
|
70
97
|
|
|
71
|
-
|
|
98
|
+
## pm.request
|
|
72
99
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- `pm.request.
|
|
76
|
-
- `pm.request.
|
|
77
|
-
- `pm.request.query` —
|
|
78
|
-
- `pm.request.
|
|
79
|
-
- `pm.request.
|
|
80
|
-
- `pm.request.
|
|
100
|
+
The request. Its url is a postman-collection Url object that ALSO behaves like a string (url.includes('/v1'), url + '?x=1'); headers is a HeaderList (case-insensitive get/has/add/upsert/remove, bracket access headers['X-Id']). Mutations only have effect in pre-request scripts (the call has not fired yet).
|
|
101
|
+
|
|
102
|
+
- `pm.request.url` — Url object: .getHost() .getPath() .getPathWithQuery() .getQueryString() .getRaw() .protocol .host[] .port .path[] .hash .query (list of params) .variables .addQueryParams() .removeQueryParams() .update(); also usable as a string. Assign a string to replace it.
|
|
103
|
+
- `pm.request.url.query.get(key)` — Value of a query param. Example: `pm.request.url.query.get("page")`
|
|
104
|
+
- `pm.request.url.query.add(param)` — Add a query param ({ key, value }). _(stages: pre-request)_ Example: `pm.request.url.query.add({ key: "debug", value: "1" })`
|
|
105
|
+
- `pm.request.method` — HTTP method string; assignable in pre-request.
|
|
106
|
+
- `pm.request.body` — RequestBody: .mode ('raw'|'urlencoded'|'formdata'|'file'|'graphql') .raw .urlencoded .formdata .graphql .isEmpty() .toString() .update({ mode, raw }). Example: `pm.request.body.update({ mode: "raw", raw: JSON.stringify({ a: 1 }) })`
|
|
107
|
+
- `pm.request.headers` — HeaderList: .get(name) .has(name) .add({key,value}) .upsert({key,value}) .remove(name) .each(fn) .map(fn) .filter(fn) .find(fn) .count() .toObject(); bracket access reads/writes by name. Example: `pm.request.headers.upsert({ key: "X-Trace", value: pm.variables.replaceIn("{{$guid}}") })`
|
|
108
|
+
- `pm.request.query` — Callman alias of pm.request.url.query (the query params list).
|
|
109
|
+
- `pm.request.getHeader(name)` — Read one header value (case-insensitive).
|
|
110
|
+
- `pm.request.setHeader(name, value)` — Set/replace a header. _(stages: pre-request)_
|
|
111
|
+
- `pm.request.unsetHeader(name)` — Remove a header. _(stages: pre-request)_
|
|
81
112
|
- `pm.request.getQueryParam(name)` — Read one query param.
|
|
82
|
-
- `pm.request.setQueryParam(name, value)` — Set/replace a query param. _(stages: pre-request
|
|
83
|
-
- `pm.request.unsetQueryParam(name)` — Remove a query param. _(stages: pre-request
|
|
84
|
-
- `pm.request.setUrl(url)` — Replace the URL. _(stages: pre-request
|
|
85
|
-
- `pm.request.setMethod(method)` — Replace the method. _(stages: pre-request
|
|
86
|
-
- `pm.request.setRawBody(value)` — Replace the raw
|
|
113
|
+
- `pm.request.setQueryParam(name, value)` — Set/replace a query param. _(stages: pre-request)_
|
|
114
|
+
- `pm.request.unsetQueryParam(name)` — Remove a query param. _(stages: pre-request)_
|
|
115
|
+
- `pm.request.setUrl(url)` — Replace the URL. _(stages: pre-request)_
|
|
116
|
+
- `pm.request.setMethod(method)` — Replace the method. _(stages: pre-request)_
|
|
117
|
+
- `pm.request.setRawBody(value)` — Replace the body with raw text (objects are NOT auto-stringified; pass JSON.stringify(obj)). _(stages: pre-request)_
|
|
118
|
+
- `pm.request.to.have.header(name)` — chai-postman assertions work on the request too (pm.request.to.have.header, .to.have.body, ...).
|
|
87
119
|
|
|
88
120
|
## pm.response
|
|
89
121
|
|
|
90
|
-
The received response. Not available in pre-request scripts.
|
|
91
|
-
|
|
92
|
-
- `pm.response.code` — Status code (number). _(stages: post-response, tests
|
|
93
|
-
- `pm.response.status` — Status
|
|
94
|
-
- `pm.response.
|
|
95
|
-
- `pm.response.
|
|
96
|
-
- `pm.response.
|
|
97
|
-
- `pm.response.
|
|
98
|
-
- `pm.response.
|
|
99
|
-
- `pm.response.
|
|
100
|
-
- `pm.response.
|
|
101
|
-
- `pm.response.
|
|
122
|
+
The received response — a postman-collection Response. Not available in pre-request scripts. pm.response.code is the NUMBER (200); pm.response.status is the reason PHRASE ('OK', 'Not Found') exactly like Postman, so `pm.response.status === 200` is false.
|
|
123
|
+
|
|
124
|
+
- `pm.response.code` — Status code (number). _(stages: post-response, tests)_ Example: `pm.expect(pm.response.code).to.equal(200)`
|
|
125
|
+
- `pm.response.status` — Status reason phrase (string), e.g. "OK". Use pm.response.code for the number. _(stages: post-response, tests)_
|
|
126
|
+
- `pm.response.reason()` — Reason phrase (method form of status). _(stages: post-response, tests)_
|
|
127
|
+
- `pm.response.statusText` — Callman alias of pm.response.reason(). _(stages: post-response, tests)_
|
|
128
|
+
- `pm.response.json()` — Parse the body as JSON — call it once into a const. THROWS when the body is empty or not valid JSON (guard with try/catch, or assert pm.response.to.be.json first). Optional reviver as in JSON.parse. _(stages: post-response, tests)_ Example: `const body = pm.response.json()`
|
|
129
|
+
- `pm.response.text()` — Raw body as a string. _(stages: post-response, tests)_
|
|
130
|
+
- `pm.response.jsonp(callbackName?)` — Parse a JSONP body; throws when it is not valid. _(stages: post-response, tests)_
|
|
131
|
+
- `pm.response.rawBody` — Raw body string (Callman alias of text()). _(stages: post-response, tests)_
|
|
132
|
+
- `pm.response.body` — Callman: the parsed body (JSON value, or the text). Prefer json() / text(). _(stages: post-response, tests)_
|
|
133
|
+
- `pm.response.headers` — Response HeaderList (read-only): .get(name) .has(name) .each(fn) .toObject(); bracket access headers['content-type']. _(stages: post-response, tests)_ Example: `pm.response.headers.get("Content-Type")`
|
|
134
|
+
- `pm.response.cookies` — CookieList of the response's Set-Cookie headers: .get(name) .has(name) .toObject() .each(fn). _(stages: post-response, tests)_
|
|
135
|
+
- `pm.response.responseTime` — Duration in ms. _(stages: post-response, tests)_
|
|
136
|
+
- `pm.response.responseSize` — Body size in bytes. _(stages: post-response, tests)_
|
|
137
|
+
- `pm.response.size()` — { body, header, total } sizes in bytes. _(stages: post-response, tests)_
|
|
138
|
+
- `pm.response.dataURI()` — The body as a data: URI. _(stages: post-response, tests)_
|
|
139
|
+
- `pm.response.details()` — { code, name, detail } of the status code. _(stages: post-response, tests)_
|
|
140
|
+
- `pm.response.contentInfo()` — { mimeType, mimeFormat, charset, fileExtension, contentType } of the body. _(stages: post-response, tests)_
|
|
141
|
+
- `pm.response.stream` — Body bytes as a Buffer. _(stages: post-response, tests)_
|
|
142
|
+
- `pm.response.to.have.status(codeOrReason)` — chai-postman assertions on the response: .to.have.status(200 | "OK"), .to.have.header(name, value?), .to.have.body(text?), .to.have.jsonBody(path?, value?), .to.have.jsonSchema(schema), .to.have.responseTime.below(ms), .to.be.ok / .success / .info / .redirection / .clientError / .serverError / .error / .json / .html / .xml / .withBody / .accepted / .badRequest / .unauthorized / .forbidden / .notFound / .rateLimited, plus .to.not.<predicate>. _(stages: post-response, tests)_ Example: `pm.response.to.have.status(200)`
|
|
102
143
|
|
|
103
144
|
## pm.sendRequest
|
|
104
145
|
|
|
105
|
-
Fire an ad-hoc HTTP request from inside a script.
|
|
106
|
-
|
|
107
|
-
- `pm.sendRequest(
|
|
146
|
+
Fire an ad-hoc HTTP request from inside a script. It returns a Promise that resolves to a Response with the same API as pm.response (code, status, json(), text(), headers, cookies, responseTime, ...). The callback form (err, res) also works; hosts that keep a cookie jar send and store cookies.
|
|
147
|
+
|
|
148
|
+
- `pm.sendRequest(url)` — GET a URL string. Prefer `const res = await pm.sendRequest(...)`. Example: `const res = await pm.sendRequest("https://api.example.com/health")`
|
|
149
|
+
- `pm.sendRequest({ url, method, header, body })` — Request options. header: object, array of { key, value } or a header string. body: a string, or { mode: 'raw', raw }, { mode: 'urlencoded', urlencoded: [{key,value}] }, { mode: 'formdata', formdata: [{key,value}] } (text parts only), { mode: 'graphql', graphql: { query, variables } }. {{variables}} in all fields are resolved. Example: `await pm.sendRequest({ url: "https://x.test/login", method: "POST", header: { "Content-Type": "application/json" }, body: { mode: "raw", raw: JSON.stringify({ user: "a" }) } })`
|
|
150
|
+
- `pm.sendRequest(request, (err, res, history) => {})` — Callback form; request may also be a postman-collection Request (new (require('postman-collection').Request)({...})). Example: `pm.sendRequest("https://x.test", (err, res) => { pm.environment.set("code", res.code) })`
|
|
151
|
+
|
|
152
|
+
## pm.cookies
|
|
153
|
+
|
|
154
|
+
Cookies of the current request's domain (a CookieList: .get(name) .has(name) .toObject() .each(fn)), plus the cookie jar of ANY domain via pm.cookies.jar().
|
|
155
|
+
|
|
156
|
+
- `pm.cookies.get(name)` — Value of a cookie of the request's domain. Example: `pm.cookies.get("session")`
|
|
157
|
+
- `pm.cookies.has(name)` — true when the cookie exists.
|
|
158
|
+
- `pm.cookies.toObject()` — { name: value } of the request's domain.
|
|
159
|
+
- `pm.cookies.jar()` — The cookie jar. Every jar method takes a callback (error, result) OR returns a Promise. Example: `const jar = pm.cookies.jar()`
|
|
160
|
+
- `pm.cookies.jar().set(url, name, value)` — Set a cookie (or pass a { name, value, domain, path, expires, httpOnly, secure } object instead of name, value). Example: `await pm.cookies.jar().set("https://x.test", "theme", "dark")`
|
|
161
|
+
- `pm.cookies.jar().get(url, name)` — Value of one cookie, or null. Example: `await pm.cookies.jar().get("https://x.test", "theme")`
|
|
162
|
+
- `pm.cookies.jar().getAll(url)` — All cookies matching the url (Cookie objects). Example: `await pm.cookies.jar().getAll("https://x.test")`
|
|
163
|
+
- `pm.cookies.jar().unset(url, name)` — Delete one cookie.
|
|
164
|
+
- `pm.cookies.jar().clear(url)` — Delete every cookie of the url's domain.
|
|
165
|
+
|
|
166
|
+
## pm.visualizer
|
|
167
|
+
|
|
168
|
+
Render a custom view of the response: pass a Handlebars HTML template and its data; the host shows it in the Visualize tab (the last call wins). Data must be JSON-serializable.
|
|
169
|
+
|
|
170
|
+
- `pm.visualizer.set(template, data, options?)` — template: Handlebars HTML string; data: object available as {{...}} in the template; options: Handlebars compile options. _(stages: post-response, tests)_ Example: `pm.visualizer.set("<ul>{{#each items}}<li>{{name}}</li>{{/each}}</ul>", { items: pm.response.json() })`
|
|
171
|
+
- `pm.visualizer.clear()` — Remove the visualization set earlier in the run. _(stages: post-response, tests)_
|
|
172
|
+
- `pm.getData(callback)` — Inside a visualizer template script: receive the data passed to pm.visualizer.set as callback(error, data). _(stages: post-response, tests)_ Example: `pm.getData((error, data) => { console.log(data) })`
|
|
173
|
+
|
|
174
|
+
## require
|
|
175
|
+
|
|
176
|
+
require(name) and pm.require(name) load one of the built-in libraries (Postman's list). There is no filesystem or package access: `npm:`, `jsr:` and `@team/` specifiers and any other name throw "Cannot find module". The `node:` prefix is accepted.
|
|
177
|
+
|
|
178
|
+
- `require(name)` — Built-in modules: lodash, moment, chai, ajv (v6), cheerio (0.22), xml2js, uuid, csv-parse/lib/sync, postman-collection, crypto-js, tv4, atob, btoa, path, assert, buffer, util, url, querystring, string_decoder, stream, events, punycode, timers. Example: `const moment = require("moment")`
|
|
179
|
+
- `pm.require(name)` — Same as require(name). Example: `const _lodash = pm.require("lodash")`
|
|
180
|
+
- `require('uuid').v4()` — Random UUID v4 string. Example: `const id = require("uuid").v4()`
|
|
181
|
+
- `require('csv-parse/lib/sync')(input, options?)` — Parse CSV text into an array of rows. Example: `require("csv-parse/lib/sync")(csv, { columns: true })`
|
|
182
|
+
- `require('xml2js').parseString(xml, callback)` — Parse XML into a JS object (also parseStringPromise). Example: `require("xml2js").parseString(xmlText, (err, result) => {})`
|
|
183
|
+
- `require('cheerio').load(html)` — Parse HTML and query it with jQuery-style selectors (cheerio 0.22). Example: `const $ = require("cheerio").load(htmlText)`
|
|
184
|
+
|
|
185
|
+
## console
|
|
186
|
+
|
|
187
|
+
The full console API. Output appears in the run's Console and is streamed while the script runs (kept even when the script times out). Format strings %s %d %i %f %j %o %O %c are supported; objects, Errors, Maps and Sets print readably.
|
|
188
|
+
|
|
189
|
+
- `console.log(...args)` — Print to the console (also console.info / warn / error / debug, which set the level). Example: `console.log("token:", pm.environment.get("token"))`
|
|
190
|
+
- `console.info(...args)` — Info level.
|
|
191
|
+
- `console.warn(...args)` — Warning level.
|
|
192
|
+
- `console.error(...args)` — Error level.
|
|
193
|
+
- `console.debug(...args)` — Debug level.
|
|
194
|
+
- `console.trace(...args)` — Log with a stack trace.
|
|
195
|
+
- `console.assert(condition, ...args)` — Log an error when the condition is falsy (never throws).
|
|
196
|
+
- `console.count(label?)` — Count calls per label. Example: `console.count("retry")`
|
|
197
|
+
- `console.countReset(label?)` — Reset a counter.
|
|
198
|
+
- `console.time(label?)` — Start a timer.
|
|
199
|
+
- `console.timeLog(label?, ...args)` — Log the elapsed time without stopping the timer.
|
|
200
|
+
- `console.timeEnd(label?)` — Log the elapsed time and stop the timer.
|
|
201
|
+
- `console.group(...label)` — Indent following output until console.groupEnd() (console.groupCollapsed is the same).
|
|
202
|
+
- `console.groupCollapsed(...label)` — Like console.group().
|
|
203
|
+
- `console.groupEnd()` — End the current group.
|
|
204
|
+
- `console.table(data, columns?)` — Print an array of objects/arrays as a table. Example: `console.table(rows)`
|
|
205
|
+
- `console.dir(value, options?)` — Print an object with Node's inspect (depth/colors options).
|
|
206
|
+
- `console.dirxml(...args)` — Same as console.log().
|
|
207
|
+
- `console.clear()` — Clear the console buffer of the host.
|
|
108
208
|
|
|
109
209
|
## pm.db
|
|
110
210
|
|
|
111
211
|
Database access (Oracle / MongoDB / PostgreSQL / MySQL). Disabled by feature policy in some contexts — tests then report SKIP.
|
|
112
212
|
|
|
113
|
-
- `pm.db.query({ connectionId, query })` — Run an ad-hoc query — ALWAYS await it. SQL connections (Oracle/Postgres/MySQL): `query` is the SQL text. MongoDB: `query` is a JSON STRING of a command object, e.g. `JSON.stringify({ collection: 'users', operation: 'findOne', filter: { email } })` — operation is find|findOne|aggregate|countDocuments|insertOne|updateOne|deleteOne|…, the match key is `filter` (NOT a `db.coll.find(...)` shell string and NOT `query`), and aggregate uses `pipeline`. Resolves to { success, error, rowCount, rows, firstRow(), connectionId, connectionName, connectionType, durationMs, executedAt }. firstRow is a FUNCTION: res.firstRow()?.STATUS (Oracle columns are UPPERCASE); for a Mongo existence check assert rowCount > 0. _(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:
|
|
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)_
|
|
213
|
+
- `pm.db.query({ connectionId, query })` — Run an ad-hoc query — ALWAYS await it. Rejects when the query fails. SQL connections (Oracle/Postgres/MySQL): `query` is the SQL text. MongoDB: `query` is a JSON STRING of a command object, e.g. `JSON.stringify({ collection: 'users', operation: 'findOne', filter: { email } })` — operation is find|findOne|aggregate|countDocuments|insertOne|updateOne|deleteOne|…, the match key is `filter` (NOT a `db.coll.find(...)` shell string and NOT `query`), and aggregate uses `pipeline`. Resolves to { success, error, rowCount, rows, firstRow(), connectionId, connectionName, connectionType, durationMs, executedAt }. firstRow is a FUNCTION: res.firstRow()?.STATUS (Oracle columns are UPPERCASE); for a Mongo existence check assert rowCount > 0. _(requires the database capability — may be disabled by feature policy)_ Example: `const res = await pm.db.query({ connectionId: "orders-db", query: "select status from orders where id = 1" })`
|
|
214
|
+
- `pm.db.pre` — Result object of the declared pre-request DB query: { success, error, rowCount, rows, firstRow() }. Not a promise — read directly. _(stages: pre-request, post-response, tests)_ _(requires the database capability — may be disabled by feature policy)_
|
|
215
|
+
- `pm.db.post` — Result object of the declared post-response DB query (same shape as pm.db.pre). Populated ONLY in the `tests` script; in a post-response script it is an empty result. _(stages: tests)_ _(requires the database capability — may be disabled by feature policy)_
|
|
123
216
|
|
|
124
217
|
## pm.redis
|
|
125
218
|
|
|
126
219
|
Run ad-hoc Redis commands and read results of declared pre/post commands.
|
|
127
220
|
|
|
128
|
-
- `pm.redis.command({ connectionId, command })` — Run an ad-hoc Redis command (
|
|
221
|
+
- `pm.redis.command({ connectionId, command })` — Run an ad-hoc Redis command (strings, hashes, lists, sets, sorted sets, counters, key expiry, SCAN) — ALWAYS await it. Resolves to { success, error, result, resultText, commandName, key, connectionId, connectionName, command, resolvedCommand, durationMs, executedAt }. Omit connectionId to use the request's configured Redis connection. _(requires the redis capability — may be disabled by feature policy)_ Example: `const res = await pm.redis.command({ command: "GET session:1" })`
|
|
129
222
|
- `pm.redis.get(key)` — Read a value already captured by a declared GET. _(requires the redis capability — may be disabled by feature policy)_
|
|
130
223
|
- `pm.redis.results.pre` — Array of pre-stage command results (by line index). _(requires the redis capability — may be disabled by feature policy)_
|
|
131
224
|
- `pm.redis.results.post` — Array of post-stage command results. _(stages: post-response, tests)_ _(requires the redis capability — may be disabled by feature policy)_
|
|
132
225
|
|
|
133
226
|
## pm.random
|
|
134
227
|
|
|
135
|
-
|
|
228
|
+
Random data generators. EVERY generator returns a string (pm.random.int() returns "42", pm.random.boolean() returns "true"/"false") — wrap with Number() when you need a number.
|
|
136
229
|
|
|
137
|
-
- `pm.random.uuid()` — UUID v4.
|
|
138
|
-
- `pm.random.email()` — Random email address.
|
|
139
|
-
- `pm.random.string(length?)` — Alphanumeric string.
|
|
140
|
-
- `pm.random.int(min
|
|
141
|
-
- `pm.random.bigdecimal(min
|
|
142
|
-
- `pm.random.boolean()` — true
|
|
230
|
+
- `pm.random.uuid()` — UUID v4 string. Example: `pm.random.uuid()`
|
|
231
|
+
- `pm.random.email()` — Random email address string.
|
|
232
|
+
- `pm.random.string(length?)` — Alphanumeric string (default 12, max 128).
|
|
233
|
+
- `pm.random.int(min?, max?)` — Integer in range, as a STRING (default 0..999999). Example: `Number(pm.random.int(1, 100))`
|
|
234
|
+
- `pm.random.bigdecimal(min?, max?, scale?)` — Decimal string with `scale` fraction digits (default 6).
|
|
235
|
+
- `pm.random.boolean()` — The string "true" or "false".
|
|
143
236
|
- `pm.random.phone()` — Phone number string.
|
|
144
|
-
- `pm.random.name()` — Person name.
|
|
145
|
-
- `pm.random.date(format?)` — Date string.
|
|
237
|
+
- `pm.random.name()` — Person name string.
|
|
238
|
+
- `pm.random.date(format?)` — Date string within ±1 year (default format YYYY-MM-DD; tokens YYYY MM DD HH mm ss SSS Z).
|
|
146
239
|
|
|
147
240
|
## pm.counter
|
|
148
241
|
|
|
149
|
-
|
|
242
|
+
Counter that survives across the requests of a run.
|
|
150
243
|
|
|
151
|
-
- `pm.counter.next()` — Next value (starts at 1).
|
|
152
|
-
- `pm.counter.start(startAt?)` — Counter starting at a custom value.
|
|
244
|
+
- `pm.counter.next()` — Next value (number, starts at 1).
|
|
245
|
+
- `pm.counter.start(startAt?)` — Counter starting at a custom value (number, default 1); each call increments.
|
|
153
246
|
|
|
154
247
|
## pm.info
|
|
155
248
|
|
|
156
|
-
Execution metadata snapshot.
|
|
249
|
+
Execution metadata snapshot (read-only).
|
|
157
250
|
|
|
158
|
-
- `pm.info.eventName` — "prerequest"
|
|
159
|
-
- `pm.info.iteration` —
|
|
160
|
-
- `pm.info.iterationCount` — Total iterations
|
|
251
|
+
- `pm.info.eventName` — "prerequest" in pre-request scripts, "test" in post-response / tests scripts, "scenario-script" in scenario script nodes.
|
|
252
|
+
- `pm.info.iteration` — 0-BASED index of the current iteration of a data-driven run (0 outside one, like Postman).
|
|
253
|
+
- `pm.info.iterationCount` — Total iterations of the run (1 outside a data-driven run). Never use it to gate token/cache logic in single sends.
|
|
161
254
|
- `pm.info.requestName` — Current request's name.
|
|
162
255
|
- `pm.info.requestId` — Current request's id.
|
|
163
256
|
|
|
164
257
|
## pm.execution
|
|
165
258
|
|
|
166
|
-
Collection-run flow control.
|
|
259
|
+
Collection-run flow control (Postman's pm.execution). Honoured by the collection runner; a single Send ignores it.
|
|
167
260
|
|
|
168
|
-
- `pm.execution.setNextRequest(
|
|
169
|
-
- `pm.execution.skipRequest()` — Skip the current request. _(stages: pre-request)_
|
|
170
|
-
- `pm.execution.location` — Folder path of the current request.
|
|
261
|
+
- `pm.execution.setNextRequest(nameOrId)` — Run the request with this name or id next; pass null to stop the run after the current request. Postman's postman.setNextRequest is the same. Example: `pm.execution.setNextRequest("Get order")`
|
|
262
|
+
- `pm.execution.skipRequest()` — Skip the current request: it is not sent and its post-response/tests scripts do not run (counted as skipped). _(stages: pre-request)_
|
|
263
|
+
- `pm.execution.location` — Folder path of the current request as an array of names; pm.execution.location.current is the request's own name. Example: `pm.execution.location.current`
|
|
264
|
+
- `pm.execution.runRequest(requestIdOrName)` — Not supported in Callman yet — always throws a clear error.
|
|
171
265
|
|
|
172
266
|
## pm.node
|
|
173
267
|
|
|
174
|
-
Scenario workflow context (only
|
|
268
|
+
Scenario workflow context (scenario script and request nodes only). pm.node is a FUNCTION — pm.node(label) — not an object. The same data is also available as a global named after the node label when the label is a valid identifier (Login.token).
|
|
175
269
|
|
|
176
|
-
- `pm.node
|
|
177
|
-
- `
|
|
270
|
+
- `pm.node(label)` — Output of a previous node by label (null when it has not run). The value carries __meta { status, success, failed, skipped, attempts, startedAt, endedAt, durationMs, error }. _(stages: scenario-script)_ Example: `const token = pm.node("Login").token`
|
|
271
|
+
- `workflow.__meta` — Run-level metadata: status, totalNodes, successfulNodes, failedNodes, skippedNodes, totalRetries, durationMs, currentNode, lastNode, failedNode. _(stages: scenario-script)_
|
|
272
|
+
- `env.NAME` — The active environment's variables as a plain object (also available in request scripts). Example: `env.BASE_URL`
|
|
178
273
|
|
|
179
274
|
## pm.log
|
|
180
275
|
|
|
@@ -184,33 +279,68 @@ Structured logging into the run report.
|
|
|
184
279
|
|
|
185
280
|
## CryptoJS
|
|
186
281
|
|
|
187
|
-
crypto-js global (NOT under pm
|
|
282
|
+
crypto-js global (NOT under pm.*; also require('crypto-js')). Results are WordArrays: call .toString() for hex or .toString(CryptoJS.enc.Base64).
|
|
188
283
|
|
|
189
|
-
- `CryptoJS.SHA256(
|
|
190
|
-
- `CryptoJS.HmacSHA256(
|
|
191
|
-
- `CryptoJS.AES.encrypt(
|
|
192
|
-
- `CryptoJS.PBKDF2(password, salt, options)` — Key derivation.
|
|
193
|
-
- `CryptoJS.enc.
|
|
194
|
-
- `CryptoJS.lib.WordArray.
|
|
284
|
+
- `CryptoJS.SHA256(message)` — Hash (also SHA1, SHA224, SHA384, SHA512, SHA3, MD5, RIPEMD160); .toString() is hex. Example: `CryptoJS.SHA256(body).toString()`
|
|
285
|
+
- `CryptoJS.HmacSHA256(message, key)` — HMAC (also HmacSHA1/224/384/512, HmacMD5). Example: `CryptoJS.HmacSHA256(msg, secret).toString(CryptoJS.enc.Hex)`
|
|
286
|
+
- `CryptoJS.AES.encrypt(message, key)` — AES encryption; CryptoJS.AES.decrypt(cipher, key) returns a WordArray — call .toString(CryptoJS.enc.Utf8). Example: `CryptoJS.AES.encrypt(text, key).toString()`
|
|
287
|
+
- `CryptoJS.PBKDF2(password, salt, options)` — Key derivation ({ keySize, iterations }).
|
|
288
|
+
- `CryptoJS.enc.Base64` — Encoders for .toString(...) / .parse(...): Utf8, Base64, Base64url, Hex, Latin1, Utf16. Example: `CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(text))`
|
|
289
|
+
- `CryptoJS.lib.WordArray.random(nBytes)` — Raw random word array (e.g. IVs); WordArray.create(words, sigBytes) builds one.
|
|
195
290
|
|
|
196
291
|
## _
|
|
197
292
|
|
|
198
|
-
lodash global (NOT under pm
|
|
293
|
+
lodash global (NOT under pm.*; also require('lodash')).
|
|
199
294
|
|
|
200
|
-
- `_.get(
|
|
295
|
+
- `_.get(object, path, defaultValue?)` — Safe nested read; the full lodash surface (pick, omit, groupBy, sortBy, uniq, merge, cloneDeep, isEqual, chunk, ...) is available. Example: `_.get(payload, "data.items[0].id")`
|
|
296
|
+
- `_.groupBy(collection, iteratee)` — Group items by a key or function. Example: `_.groupBy(items, "status")`
|
|
201
297
|
|
|
202
298
|
## timers
|
|
203
299
|
|
|
204
|
-
Safe per-
|
|
300
|
+
Safe per-run timer wrappers (callbacks never outlive the run; delays are capped at 60 s). They return numeric ids.
|
|
301
|
+
|
|
302
|
+
- `setTimeout(handler, delayMs)` — Run later; use with await new Promise(r => setTimeout(r, ms)) for polling loops. clearTimeout(id) cancels. Example: `await new Promise(r => setTimeout(r, 500))`
|
|
303
|
+
- `clearTimeout(id)` — Cancel a setTimeout.
|
|
304
|
+
- `setInterval(handler, delayMs)` — Repeat; clearInterval(id) cancels.
|
|
305
|
+
- `clearInterval(id)` — Cancel a setInterval.
|
|
306
|
+
- `setImmediate(handler)` — Run on the next turn (clearImmediate(id) cancels).
|
|
307
|
+
|
|
308
|
+
## globals
|
|
309
|
+
|
|
310
|
+
Other globals available in every script (no import): Buffer, Intl, Reflect, Proxy, WeakRef, URL, URLSearchParams, TextEncoder/TextDecoder, atob/btoa, structuredClone, queueMicrotask, AbortController, Blob, crypto (Web Crypto), encodeURI/decodeURI, escape/unescape and the usual JSON/Math/Date/Promise/Map/Set/typed arrays. fetch, XMLHttpRequest, WebSocket, process, window, eval and Function are blocked — use pm.sendRequest for HTTP.
|
|
311
|
+
|
|
312
|
+
- `Buffer.from(data, encoding?)` — Node Buffer (utf8, hex, base64, base64url, latin1, ...). Example: `Buffer.from("hello").toString("base64")`
|
|
313
|
+
- `crypto.randomUUID()` — Web Crypto: also crypto.getRandomValues(typedArray) and crypto.subtle.digest/sign/verify/encrypt/decrypt. Example: `crypto.randomUUID()`
|
|
314
|
+
- `structuredClone(value)` — Deep clone (Date, Map, Set, RegExp, ...).
|
|
315
|
+
- `atob(base64)` — Decode base64 to a binary string (btoa(text) encodes).
|
|
316
|
+
|
|
317
|
+
## postman
|
|
318
|
+
|
|
319
|
+
Postman's LEGACY scripting API, kept so old exported collections run unchanged. Enabled in request scripts unless the script starts with "use sandbox2"; prefer pm.* in new scripts.
|
|
320
|
+
|
|
321
|
+
- `postman.setEnvironmentVariable(key, value)` — Same as pm.environment.set (also getEnvironmentVariable, clearEnvironmentVariable, clearEnvironmentVariables). Example: `postman.setEnvironmentVariable("token", "abc")`
|
|
322
|
+
- `postman.setGlobalVariable(key, value)` — Same as pm.globals.set (also getGlobalVariable, clearGlobalVariable, clearGlobalVariables).
|
|
323
|
+
- `postman.setNextRequest(name)` — Same as pm.execution.setNextRequest.
|
|
324
|
+
- `postman.getResponseHeader(name)` — Header value of the response. _(stages: post-response, tests)_
|
|
325
|
+
- `postman.getResponseCookie(name)` — Cookie of the response. _(stages: post-response, tests)_
|
|
326
|
+
- `tests['name'] = boolean` — Legacy test: records a test named `name` that passes when the value is truthy. Example: `tests["status is 200"] = responseCode.code === 200`
|
|
327
|
+
- `responseBody` — Legacy: raw response body text. _(stages: post-response, tests)_
|
|
328
|
+
- `responseCode.code` — Legacy: { code, name, detail } of the status. _(stages: post-response, tests)_
|
|
329
|
+
- `responseTime` — Legacy: response time in ms. _(stages: post-response, tests)_
|
|
330
|
+
- `responseHeaders` — Legacy: response headers as a plain object. _(stages: post-response, tests)_
|
|
331
|
+
- `responseCookies` — Legacy: response cookies as { name: value }. _(stages: post-response, tests)_
|
|
332
|
+
- `environment['name']` — Legacy: `environment` and `globals` also read variables by bracket (environment['token']); environment.get('token') keeps working. `data` is the iteration row, `iteration` the 0-based index; tv4, cheerio and xml2Json(xml) are globals.
|
|
333
|
+
|
|
334
|
+
## unsupported
|
|
335
|
+
|
|
336
|
+
Postman APIs Callman does not implement. Accessing them throws a clear "is not supported in Callman yet" error (never `undefined`), so a copied script fails loudly instead of misbehaving: pm.vault, pm.datasets, pm.mock, pm.state, pm.message, pm.execution.runRequest, and pm.require('npm:...' / 'jsr:...' / '@team/...') package specifiers. Postman Flows, Postbot, gRPC/WebSocket/MQTT hooks are out of scope.
|
|
205
337
|
|
|
206
|
-
- `setTimeout(fn, ms) / clearTimeout(id)` — Use with await new Promise(r => setTimeout(r, ms)) for polling loops.
|
|
207
|
-
- `setInterval(fn, ms) / clearInterval(id)` — Interval variant.
|
|
208
338
|
|
|
209
339
|
## Stage rules
|
|
210
340
|
|
|
211
341
|
- `pre-request`: runs BEFORE the HTTP call. `pm.response` does not exist; `pm.request` mutations take effect.
|
|
212
342
|
- `post-response` / `tests`: run AFTER the call. `pm.response` is available; `pm.request` mutations have no effect.
|
|
213
|
-
- `scenario-script`: a scenario Script node. Prior node outputs are readable via `pm.
|
|
343
|
+
- `scenario-script`: a scenario Script node. There is no `pm.request` / `pm.response`. Prior node outputs are readable via `pm.node("NodeLabel")` or the label as a global (`NodeLabel.path`); `env` is the environment as a plain object; the script's return value becomes the node output.
|
|
214
344
|
- Members without a stage note are available in every stage.
|
|
215
345
|
|
|
216
346
|
## Collection and folder scripts
|
|
@@ -220,4 +350,14 @@ Safe per-execution timer wrappers (callbacks never outlive the run).
|
|
|
220
350
|
- Every script of one request shares the same `pm.variables` (local) scope; environment, globals and collection-variable writes are visible to the next script in the chain.
|
|
221
351
|
- A failing pre-request script stops the chain and the request is not sent. Post-response / tests scripts of every level still run and report.
|
|
222
352
|
- `pm.info.requestName` / `pm.info.requestId` tell a collection script which request it is running for (e.g. skip a token fetch for the Login request).
|
|
223
|
-
|
|
353
|
+
|
|
354
|
+
## Postman compatibility notes
|
|
355
|
+
|
|
356
|
+
- `pm.response.code` is the number (200); `pm.response.status` is the reason phrase ("OK") — `pm.response.status === 200` is false.
|
|
357
|
+
- `pm.response.json()` throws when the body is empty or not valid JSON.
|
|
358
|
+
- `pm.test` runs its callback synchronously; `pm.test(name, done => ...)`, `pm.test.skip(name)` and `pm.test.index()` exist.
|
|
359
|
+
- `pm.info.iteration` is 0-based; `pm.info.eventName` is "prerequest" or "test".
|
|
360
|
+
- `replaceIn` keeps an unresolved `{{x}}` as written; environment / globals values keep the type they were set with inside the run and are stored as strings (objects as JSON).
|
|
361
|
+
- `pm.random.*` generators return strings (including `int()` and `boolean()`).
|
|
362
|
+
- Postman's legacy API (`postman.*`, `tests["name"] = bool`, `responseBody`, `responseCode`, ...) works unless the script starts with "use sandbox2".
|
|
363
|
+
- Unsupported Postman APIs (`pm.vault`, `pm.datasets`, `pm.mock`, `pm.state`, `pm.message`, `pm.execution.runRequest`, `npm:` / `jsr:` packages) throw a clear "not supported in Callman yet" error.
|
|
@@ -6,15 +6,16 @@ The sandbox is a Node `vm` context. Generated code must never reference a blocke
|
|
|
6
6
|
|
|
7
7
|
## Available built-ins
|
|
8
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`
|
|
9
|
+
`AbortController`, `AbortSignal`, `AggregateError`, `Array`, `ArrayBuffer`, `BigInt`, `BigInt64Array`, `BigUint64Array`, `Blob`, `Boolean`, `Buffer`, `DOMException`, `DataView`, `Date`, `Error`, `EvalError`, `Event`, `EventTarget`, `File`, `FinalizationRegistry`, `Float32Array`, `Float64Array`, `Infinity`, `Int16Array`, `Int32Array`, `Int8Array`, `Intl`, `JSON`, `Map`, `Math`, `NaN`, `Number`, `Object`, `Promise`, `Proxy`, `RangeError`, `ReadableStream`, `ReferenceError`, `Reflect`, `RegExp`, `Set`, `String`, `Symbol`, `SyntaxError`, `TextDecoder`, `TextDecoderStream`, `TextEncoder`, `TextEncoderStream`, `TransformStream`, `TypeError`, `URIError`, `URL`, `URLSearchParams`, `Uint16Array`, `Uint32Array`, `Uint8Array`, `Uint8ClampedArray`, `WeakMap`, `WeakRef`, `WeakSet`, `WritableStream`, `atob`, `btoa`, `crypto`, `decodeURI`, `decodeURIComponent`, `encodeURI`, `encodeURIComponent`, `escape`, `isFinite`, `isNaN`, `parseFloat`, `parseInt`, `queueMicrotask`, `structuredClone`, `undefined`, `unescape`
|
|
10
10
|
|
|
11
|
-
Plus the injected helpers: `pm
|
|
11
|
+
Plus the injected helpers: `pm` (also `cm` and `callman` — the same object), `console` (the full console API), `require` / `pm.require`, `CryptoJS`, `_` (lodash), `setTimeout`/`clearTimeout`/`setInterval`/`clearInterval`/`setImmediate`/`clearImmediate` (safe per-run wrappers) and, in request scripts, Postman's legacy globals (`postman`, `tests`, `responseBody`, `responseCode`, `responseTime`, `responseHeaders`, `responseCookies`, `environment`, `globals`, `data`, `iteration`, `tv4`, `cheerio`, `xml2Json`).
|
|
12
12
|
|
|
13
13
|
## Blocked (never use)
|
|
14
14
|
|
|
15
|
-
`
|
|
15
|
+
`Function`, `WebSocket`, `Worker`, `XMLHttpRequest`, `document`, `eval`, `exports`, `fetch`, `global`, `globalThis`, `importScripts`, `module`, `navigator`, `process`, `self`, `window`
|
|
16
16
|
|
|
17
17
|
Notes:
|
|
18
18
|
- No `fetch` — use `pm.sendRequest` for HTTP.
|
|
19
|
-
-
|
|
20
|
-
-
|
|
19
|
+
- `Buffer`, `crypto` (Web Crypto), `atob`/`btoa`, `TextEncoder`/`TextDecoder`, `URL`, `structuredClone`, `AbortController` and `Blob` are available.
|
|
20
|
+
- `require(name)` / `pm.require(name)` serve only these built-in libraries: `lodash`, `moment`, `chai`, `ajv`, `cheerio`, `xml2js`, `tv4`, `uuid`, `csv-parse/lib/sync`, `postman-collection`, `crypto-js`, `atob`, `btoa`, `path`, `assert`, `buffer`, `util`, `url`, `querystring`, `string_decoder`, `stream`, `events`, `punycode`, `timers`. `import`, `npm:`/`jsr:` packages and the filesystem are not available. `CryptoJS` and `_` are already in scope.
|
|
21
|
+
- `pm.vault`, `pm.datasets`, `pm.mock`, `pm.state`, `pm.message` and `pm.execution.runRequest` throw a clear "not supported in Callman yet" error.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/ai/prompts/fragments.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,eAAO,MAAM,mBAAmB,QAQpB,CAAC;AAIb,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/ai/prompts/fragments.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,eAAO,MAAM,mBAAmB,QAQpB,CAAC;AAIb,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAO5D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,EAAE,YAAQ,KAAG,MACJ,CAAC"}
|
|
@@ -21,7 +21,6 @@ export const STAGE_DESCRIPTIONS = {
|
|
|
21
21
|
"pre-request": "Runs BEFORE the HTTP call. `pm.response` does NOT exist. `pm.request` mutations (setHeader/setQueryParam/setRawBody/setUrl) take effect. Use for setup: auth tokens, computed headers/body, seeding env/DB/Redis.",
|
|
22
22
|
"post-response": "Runs immediately AFTER the response. `pm.response` is available; `pm.request` mutations have no effect. Use to capture values from the response into variables.",
|
|
23
23
|
tests: "Runs after the response and any declared DB/Redis steps. `pm.response`, `pm.db.post`, `pm.redis.results.post` are available. Put assertions inside `pm.test(...)`.",
|
|
24
|
-
kafka: "Runs when a Kafka event is matched (post-response/tests context). `pm.response` and `pm.kafka.event()` / `pm.kafka.messages()` are available. Put assertions inside `pm.test(...)`.",
|
|
25
24
|
};
|
|
26
25
|
export const truncateForPrompt = (value, max = 80) => value.length > max ? `${value.slice(0, max)}…` : value;
|
|
27
26
|
//# sourceMappingURL=fragments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../../src/ai/prompts/fragments.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,yBAAyB;AAEzB,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAGtE,+EAA+E;AAC/E,+EAA+E;AAC/E,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,qEAAqE;IACrE,qHAAqH;IACrH,yFAAyF;IACzF,oJAAoJ;IACpJ,wGAAwG;IACxG,sGAAsG;IACtG,oBAAoB,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;CAC3D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,8EAA8E;AAC9E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAkC;IAC/D,aAAa,EACX,mNAAmN;IACrN,eAAe,EACb,iKAAiK;IACnK,KAAK,EACH,oKAAoK;
|
|
1
|
+
{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../../src/ai/prompts/fragments.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,yBAAyB;AAEzB,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAGtE,+EAA+E;AAC/E,+EAA+E;AAC/E,wDAAwD;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,qEAAqE;IACrE,qHAAqH;IACrH,yFAAyF;IACzF,oJAAoJ;IACpJ,wGAAwG;IACxG,sGAAsG;IACtG,oBAAoB,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;CAC3D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,8EAA8E;AAC9E,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAkC;IAC/D,aAAa,EACX,mNAAmN;IACrN,eAAe,EACb,iKAAiK;IACnK,KAAK,EACH,oKAAoK;CACvK,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,GAAG,GAAG,EAAE,EAAU,EAAE,CACnE,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC"}
|
|
@@ -22,7 +22,7 @@ export const buildUnifiedSystemPrompt = () => {
|
|
|
22
22
|
"what is needed — the user does NOT pick a mode or a target. Respond with ONE JSON",
|
|
23
23
|
"object ONLY (no markdown, no prose outside JSON), shaped:",
|
|
24
24
|
"",
|
|
25
|
-
'{"reply": string, "contract": {"add": [{"path": string, "rules": {…}}], "remove": [string]} | null, "scripts": [{"stage": "pre-request|post-response|tests
|
|
25
|
+
'{"reply": string, "contract": {"add": [{"path": string, "rules": {…}}], "remove": [string]} | null, "scripts": [{"stage": "pre-request|post-response|tests", "code": string}]}',
|
|
26
26
|
"",
|
|
27
27
|
"How to decide (classify intent yourself):",
|
|
28
28
|
"- Assertions about the LAST RESPONSE's shape (a field's type/format/required/value/",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified.js","sourceRoot":"","sources":["../../../src/ai/prompts/unified.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,uDAAuD;AACvD,EAAE;AACF,yEAAyE;AACzE,+EAA+E;AAC/E,oBAAoB;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAQxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAE5F,+EAA+E;AAC/E,0EAA0E;AAC1E,+EAA+E;AAC/E,sBAAsB;AACtB,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAW,EAAE;IACnD,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,CACrC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,OAAO,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAC1D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO;QACL,iFAAiF;QACjF,iFAAiF;QACjF,mFAAmF;QACnF,2DAA2D;QAC3D,EAAE;QACF,
|
|
1
|
+
{"version":3,"file":"unified.js","sourceRoot":"","sources":["../../../src/ai/prompts/unified.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,uDAAuD;AACvD,EAAE;AACF,yEAAyE;AACzE,+EAA+E;AAC/E,oBAAoB;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAQxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAE5F,+EAA+E;AAC/E,0EAA0E;AAC1E,+EAA+E;AAC/E,sBAAsB;AACtB,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAW,EAAE;IACnD,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,CACrC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,OAAO,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAC1D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO;QACL,iFAAiF;QACjF,iFAAiF;QACjF,mFAAmF;QACnF,2DAA2D;QAC3D,EAAE;QACF,gLAAgL;QAChL,EAAE;QACF,2CAA2C;QAC3C,qFAAqF;QACrF,sFAAsF;QACtF,sFAAsF;QACtF,uFAAuF;QACvF,2DAA2D;QAC3D,wFAAwF;QACxF,wFAAwF;QACxF,gEAAgE;QAChE,0FAA0F;QAC1F,EAAE;QACF,sDAAsD;QACtD,UAAU;QACV,EAAE;QACF,iBAAiB;QACjB,sFAAsF;QACtF,yFAAyF;QACzF,uDAAuD;QACvD,uFAAuF;QACvF,sFAAsF;QACtF,4DAA4D;QAC5D,mBAAmB;QACnB,EAAE;QACF,wFAAwF;QACxF,yFAAyF;QACzF,yFAAyF;QACzF,yFAAyF;QACzF,oDAAoD;QACpD,EAAE;QACF,wFAAwF;QACxF,0FAA0F;QAC1F,yFAAyF;QACzF,wFAAwF;QACxF,yFAAyF;QACzF,kDAAkD;QAClD,6FAA6F;QAC7F,EAAE;QACF,0BAA0B;QAC1B,kFAAkF;QAClF,2FAA2F;QAC3F,kFAAkF;QAClF,2EAA2E;QAC3E,wCAAwC;QACxC,EAAE;QACF,yBAAyB;QACzB,oBAAoB,EAAE;QACtB,EAAE;QACF,gDAAgD;QAChD,sBAAsB,EAAE;KACzB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,WAAW,EACX,MAAM,GAAG,EAAE,EACX,aAAa,GAAG,EAAE,EAClB,cAAc,GAAG,EAAE,EACnB,WAAW,GAAG,EAAE,EAChB,WAAW,EACX,UAAU,EACV,WAAW,GAUZ,EAAU,EAAE;IACX,MAAM,WAAW,GACf,WAAW,IAAI,CAAC,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,GAAG,CAAC;QACpD,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC/E,CAAC,CAAC,IAAI,CAAC;IAEX,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM;QAC/B,CAAC,CAAC,MAAM;aACH,GAAG,CACF,CAAC,KAAK,EAAE,EAAE,CACR,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAClG;aACA,IAAI,CAAC,IAAI,CAAC;QACf,CAAC,CAAC,wBAAwB,CAAC;IAE7B,MAAM,IAAI,GAAG;QACX,UAAU,CAAC,CAAC,CAAC,gBAAgB,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI;QAChD,WAAW,CAAC,CAAC,CAAC,iBAAiB,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI;KACpD;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,MAAM,aAAa,GAAG,aAAa,CAAC,MAAM;QACxC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACvF,CAAC,CAAC,YAAY,CAAC;IAEjB,MAAM,aAAa,GACjB,cAAc;SACX,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;SACjD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,KAAK,mBAAmB,MAAM,CAAC,IAAI,EAAE,CAAC;SACpE,IAAI,CAAC,MAAM,CAAC,IAAI,yBAAyB,CAAC;IAE/C,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM;QACxC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC1E,CAAC,CAAC,QAAQ,CAAC;IAEb,OAAO;QACL,WAAW;QACX,kBAAkB;QAClB,WAAW;QACX,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;QACvB,EAAE;QACF,4CAA4C;QAC5C,aAAa;QACb,EAAE;QACF,yDAAyD;QACzD,eAAe;QACf,EAAE;QACF,kBAAkB;QAClB,aAAa;QACb,EAAE;QACF,gBAAgB,WAAW,EAAE;KAC9B;SACE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC;SAC/B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/ai/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const AI_SCRIPT_STAGES: readonly ["pre-request", "post-response", "tests"
|
|
1
|
+
export declare const AI_SCRIPT_STAGES: readonly ["pre-request", "post-response", "tests"];
|
|
2
2
|
export type AiScriptStage = (typeof AI_SCRIPT_STAGES)[number];
|
|
3
3
|
export interface AiSchemaField {
|
|
4
4
|
path: string;
|