Skip to content

Commit 3ae5b34

Browse files
committed
Added seperate class for CollectionVariableScope
1 parent 4f9f722 commit 3ae5b34

File tree

7 files changed

+136
-20
lines changed

7 files changed

+136
-20
lines changed

lib/sandbox/pmapi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function Postman (execution, onRequest, onAssertion, cookieStore, options = {})
133133
environment: execution.environment,
134134

135135
/**
136-
* @type {VariableScope}
136+
* @type {CollectionVariableScope}
137137
*/
138138
collectionVariables: execution.collectionVariables,
139139

npm/build-sandbox-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ module.exports = function (exit) {
117117

118118
// Since we are referencing some types from Postman Collection lib, those types needs to imported.
119119
// See https://stackoverflow.com/a/51114250
120-
collectionSDKTypes = ['CookieList', 'Request', 'Response', 'VariableScope'];
120+
collectionSDKTypes = ['CookieList', 'Request', 'Response', 'VariableScope', 'CollectionVariableScope'];
121121

122122
node.forEachChild((child) => {
123123
child.members && child.members.forEach((c) => {

package-lock.json

Lines changed: 61 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postman-sandbox-secret-variable-type-only",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Sandbox for Postman Scripts to run in Node.js or browser",
55
"author": "Postman Inc.",
66
"license": "Apache-2.0",
@@ -43,7 +43,7 @@
4343
},
4444
"dependencies": {
4545
"lodash": "4.17.21",
46-
"postman-collection": "npm:[email protected].1",
46+
"postman-collection": "npm:[email protected].2",
4747
"teleport-javascript": "1.0.0",
4848
"uvm": "2.1.1"
4949
},

types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ declare class Postman {
7676
info: Info;
7777
globals: VariableScope;
7878
environment: VariableScope;
79-
collectionVariables: VariableScope;
79+
collectionVariables: CollectionVariableScope;
8080
variables: VariableScope;
8181
/**
8282
* The iterationData object contains data from the data file provided during a collection run.

types/sandbox/prerequest.d.ts

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for postman-sandbox 3.5.7
1+
// Type definitions for postman-sandbox 1.0.2
22
// Project: https://github.com/postmanlabs/postman-sandbox
33
// Definitions by: PostmanLabs
44
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -14,8 +14,18 @@ declare interface PostmanLegacy {
1414
setNextRequest(requestName: string): void;
1515
}
1616

17+
/**
18+
* @param execution - -
19+
* @param onRequest - -
20+
* @param onAssertion - -
21+
* @param cookieStore - -
22+
* @param [options] - -
23+
* @param [options.disabledAPIs] - -
24+
*/
1725
declare class Postman {
18-
constructor(bridge: EventEmitter, execution: Execution, onRequest: (...params: any[]) => any, cookieStore: any);
26+
constructor(execution: Execution, onRequest: (...params: any[]) => any, onAssertion: (...params: any[]) => any, cookieStore: any, options?: {
27+
disabledAPIs?: string[];
28+
});
1929
/**
2030
* The pm.info object contains information pertaining to the script being executed.
2131
* Useful information such as the request name, request Id, and iteration count are
@@ -24,7 +34,7 @@ declare class Postman {
2434
info: Info;
2535
globals: import("postman-collection").VariableScope;
2636
environment: import("postman-collection").VariableScope;
27-
collectionVariables: import("postman-collection").VariableScope;
37+
collectionVariables: import("postman-collection").CollectionVariableScope;
2838
variables: import("postman-collection").VariableScope;
2939
/**
3040
* The iterationData object contains data from the data file provided during a collection run.
@@ -44,6 +54,8 @@ declare class Postman {
4454
visualizer: Visualizer;
4555
/**
4656
* Allows one to send request from script asynchronously.
57+
* @param req - -
58+
* @param callback - -
4759
*/
4860
sendRequest(req: import("postman-collection").Request | string, callback: (...params: any[]) => any): void;
4961
expect: Chai.ExpectStatic;
@@ -96,25 +108,44 @@ declare interface Visualizer {
96108
*/
97109
declare var pm: Postman;
98110

99-
declare interface PostmanCookieJar {
111+
/**
112+
* @param cookieStore - -
113+
*/
114+
declare class PostmanCookieJar {
115+
constructor(cookieStore: any);
100116
/**
101117
* Get the cookie value with the given name.
118+
* @param url - -
119+
* @param name - -
120+
* @param callback - -
102121
*/
103122
get(url: string, name: string, callback: (...params: any[]) => any): void;
104123
/**
105124
* Get all the cookies for the given URL.
125+
* @param url - -
126+
* @param [options] - -
127+
* @param callback - -
106128
*/
107129
getAll(url: string, options?: any, callback: (...params: any[]) => any): void;
108130
/**
109131
* Set or update a cookie.
132+
* @param url - -
133+
* @param name - -
134+
* @param [value] - -
135+
* @param [callback] - -
110136
*/
111137
set(url: string, name: string | any, value?: string | ((...params: any[]) => any), callback?: (...params: any[]) => any): void;
112138
/**
113139
* Remove single cookie with the given name.
140+
* @param url - -
141+
* @param name - -
142+
* @param [callback] - -
114143
*/
115144
unset(url: string, name: string, callback?: (...params: any[]) => any): void;
116145
/**
117146
* Remove all the cookies for the given URL.
147+
* @param url - -
148+
* @param [callback] - -
118149
*/
119150
clear(url: string, callback?: (...params: any[]) => any): void;
120151
}

types/sandbox/test.d.ts

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for postman-sandbox 3.5.7
1+
// Type definitions for postman-sandbox 1.0.2
22
// Project: https://github.com/postmanlabs/postman-sandbox
33
// Definitions by: PostmanLabs
44
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -14,8 +14,18 @@ declare interface PostmanLegacy {
1414
setNextRequest(requestName: string): void;
1515
}
1616

17+
/**
18+
* @param execution - -
19+
* @param onRequest - -
20+
* @param onAssertion - -
21+
* @param cookieStore - -
22+
* @param [options] - -
23+
* @param [options.disabledAPIs] - -
24+
*/
1725
declare class Postman {
18-
constructor(bridge: EventEmitter, execution: Execution, onRequest: (...params: any[]) => any, cookieStore: any);
26+
constructor(execution: Execution, onRequest: (...params: any[]) => any, onAssertion: (...params: any[]) => any, cookieStore: any, options?: {
27+
disabledAPIs?: string[];
28+
});
1929
/**
2030
* The pm.info object contains information pertaining to the script being executed.
2131
* Useful information such as the request name, request Id, and iteration count are
@@ -24,7 +34,7 @@ declare class Postman {
2434
info: Info;
2535
globals: import("postman-collection").VariableScope;
2636
environment: import("postman-collection").VariableScope;
27-
collectionVariables: import("postman-collection").VariableScope;
37+
collectionVariables: import("postman-collection").CollectionVariableScope;
2838
variables: import("postman-collection").VariableScope;
2939
/**
3040
* The iterationData object contains data from the data file provided during a collection run.
@@ -49,6 +59,8 @@ declare class Postman {
4959
visualizer: Visualizer;
5060
/**
5161
* Allows one to send request from script asynchronously.
62+
* @param req - -
63+
* @param callback - -
5264
*/
5365
sendRequest(req: import("postman-collection").Request | string, callback: (...params: any[]) => any): void;
5466
expect: Chai.ExpectStatic;
@@ -101,25 +113,44 @@ declare interface Visualizer {
101113
*/
102114
declare var pm: Postman;
103115

104-
declare interface PostmanCookieJar {
116+
/**
117+
* @param cookieStore - -
118+
*/
119+
declare class PostmanCookieJar {
120+
constructor(cookieStore: any);
105121
/**
106122
* Get the cookie value with the given name.
123+
* @param url - -
124+
* @param name - -
125+
* @param callback - -
107126
*/
108127
get(url: string, name: string, callback: (...params: any[]) => any): void;
109128
/**
110129
* Get all the cookies for the given URL.
130+
* @param url - -
131+
* @param [options] - -
132+
* @param callback - -
111133
*/
112134
getAll(url: string, options?: any, callback: (...params: any[]) => any): void;
113135
/**
114136
* Set or update a cookie.
137+
* @param url - -
138+
* @param name - -
139+
* @param [value] - -
140+
* @param [callback] - -
115141
*/
116142
set(url: string, name: string | any, value?: string | ((...params: any[]) => any), callback?: (...params: any[]) => any): void;
117143
/**
118144
* Remove single cookie with the given name.
145+
* @param url - -
146+
* @param name - -
147+
* @param [callback] - -
119148
*/
120149
unset(url: string, name: string, callback?: (...params: any[]) => any): void;
121150
/**
122151
* Remove all the cookies for the given URL.
152+
* @param url - -
153+
* @param [callback] - -
123154
*/
124155
clear(url: string, callback?: (...params: any[]) => any): void;
125156
}

0 commit comments

Comments
 (0)