postman-sandbox
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -21,3 +21,3 @@ const _ = require('lodash'), | ||
CONTEXT_VARIABLE_SCOPES = ['_variables', 'environment', 'collectionVariables', 'globals'], | ||
CONTEXT_VARIABLE_SCOPES = ['_variables', 'environment', 'collectionVariables', 'globals', 'vaultSecrets'], | ||
@@ -24,0 +24,0 @@ trackingOptions = { autoCompact: true }; |
@@ -66,2 +66,3 @@ const _ = require('lodash'), | ||
execution._variables.addLayer(execution.globals.values); | ||
execution._variables.addLayer(execution.vaultSecrets.values); | ||
@@ -131,2 +132,7 @@ execution.cookies && (execution.cookies.jar = function () { | ||
*/ | ||
vault: execution.vaultSecrets, | ||
/** | ||
* @type {VariableScope} | ||
*/ | ||
globals: execution.globals, | ||
@@ -133,0 +139,0 @@ |
@@ -44,3 +44,13 @@ /* eslint-disable max-classes-per-file */ | ||
cheerio: 'require(\'cheerio\')', | ||
'postman.setNextRequest': 'pm.execution.setNextRequest()' | ||
'postman.setNextRequest': 'pm.execution.setNextRequest()', | ||
'postman.setEnvironmentVariable': 'pm.environment.set()', | ||
'postman.getEnvironmentVariable': 'pm.environment.get()', | ||
'postman.clearEnvironmentVariables': 'pm.environment.clear()', | ||
'postman.clearEnvironmentVariable': 'pm.environment.unset()', | ||
'postman.setGlobalVariable': 'pm.globals.set()', | ||
'postman.getGlobalVariable': 'pm.globals.get()', | ||
'postman.clearGlobalVariables': 'pm.globals.clear()', | ||
'postman.clearGlobalVariable': 'pm.globals.unset()', | ||
'postman.getResponseCookie': 'pm.cookies.get()', | ||
'postman.getResponseHeader': 'pm.response.headers.get()' | ||
}, | ||
@@ -417,2 +427,9 @@ | ||
// 6. create the postman interface object | ||
const postmanLegacy = new (execution.target === TARGET_TEST ? | ||
PostmanLegacyTestInterface : PostmanLegacyInterface)(execution, globalvars), | ||
legacyAPIUsage = new Set(); | ||
scope.__is_deprecation_warning_enabled = true; | ||
/** | ||
@@ -422,9 +439,11 @@ * @memberOf SandboxGlobals | ||
*/ | ||
globalvars.postman = new (execution.target === TARGET_TEST ? | ||
PostmanLegacyTestInterface : PostmanLegacyInterface)(execution, globalvars); | ||
globalvars.postman = new Proxy(postmanLegacy, { | ||
get (target, prop) { | ||
scope.__is_deprecation_warning_enabled && | ||
logDeprecationWarning(`postman.${prop}`, legacyAPIUsage, console); | ||
const legacyAPIUsage = new Set(); | ||
return target[prop]; | ||
} | ||
}); | ||
scope.__is_deprecation_warning_enabled = true; | ||
// wrap all globals to ensure we track their usage to show warnings | ||
@@ -445,9 +464,5 @@ // on access. | ||
get (target, prop) { | ||
// special handling for postman because setNextRequest is | ||
// used a lot. | ||
if (key === 'postman') { | ||
scope.__is_deprecation_warning_enabled && | ||
logDeprecationWarning('postman.setNextRequest', legacyAPIUsage, console); | ||
} | ||
else { | ||
// special handling for postman.* because we're handling | ||
// those in the `PostmanLegacyInterface` itself. | ||
if (key !== 'postman') { | ||
scope.__is_deprecation_warning_enabled && logDeprecationWarning(key, legacyAPIUsage, console); | ||
@@ -454,0 +469,0 @@ } |
{ | ||
"name": "postman-sandbox", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Sandbox for Postman Scripts to run in Node.js or browser", | ||
@@ -46,3 +46,3 @@ "author": "Postman Inc.", | ||
"lodash": "4.17.21", | ||
"postman-collection": "4.4.0", | ||
"postman-collection": "4.4.1", | ||
"teleport-javascript": "1.0.0", | ||
@@ -95,3 +95,3 @@ "uvm": "3.0.0" | ||
"sinon-chai": "^3.7.0", | ||
"terser": "^5.31.1", | ||
"terser": "^5.31.3", | ||
"tsd-jsdoc": "^2.5.0", | ||
@@ -98,0 +98,0 @@ "tv4": "1.3.0", |
@@ -34,6 +34,14 @@ # Postman Sandbox [![Build Status](https://github.com/postmanlabs/postman-sandbox/actions/workflows/ci.yml/badge.svg)](https://github.com/postmanlabs/postman-sandbox/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/postmanlabs/postman-sandbox/branch/develop/graph/badge.svg)](https://codecov.io/gh/postmanlabs/postman-sandbox) | ||
- pm.test | ||
- pm.info | ||
- pm.vault | ||
- pm.globals | ||
- pm.cookies | ||
- pm.execution | ||
- pm.variables | ||
- pm.visualizer | ||
- pm.sendRequest | ||
- pm.environment | ||
- pm.iterationData | ||
- pm.collectionVariables | ||
- pm.test | ||
@@ -40,0 +48,0 @@ #### pre-request script specials |
@@ -1,2 +0,2 @@ | ||
// Type definitions for postman-sandbox 4.7.1 | ||
// Type definitions for postman-sandbox 5.0.0 | ||
// Project: https://github.com/postmanlabs/postman-sandbox | ||
@@ -178,2 +178,3 @@ // Definitions by: PostmanLabs | ||
info: Info; | ||
vault: VariableScope; | ||
globals: VariableScope; | ||
@@ -180,0 +181,0 @@ environment: VariableScope; |
@@ -1,2 +0,2 @@ | ||
// Type definitions for postman-sandbox 4.7.1 | ||
// Type definitions for postman-sandbox 5.0.0 | ||
// Project: https://github.com/postmanlabs/postman-sandbox | ||
@@ -112,2 +112,3 @@ // Definitions by: PostmanLabs | ||
info: Info; | ||
vault: import("postman-collection").VariableScope; | ||
globals: import("postman-collection").VariableScope; | ||
@@ -114,0 +115,0 @@ environment: import("postman-collection").VariableScope; |
@@ -1,2 +0,2 @@ | ||
// Type definitions for postman-sandbox 4.7.1 | ||
// Type definitions for postman-sandbox 5.0.0 | ||
// Project: https://github.com/postmanlabs/postman-sandbox | ||
@@ -142,2 +142,3 @@ // Definitions by: PostmanLabs | ||
info: Info; | ||
vault: import("postman-collection").VariableScope; | ||
globals: import("postman-collection").VariableScope; | ||
@@ -144,0 +145,0 @@ environment: import("postman-collection").VariableScope; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
5387795
11968
80
+ Addedpostman-collection@4.4.1(transitive)
- Removedpostman-collection@4.4.0(transitive)
Updatedpostman-collection@4.4.1