Skip to content

Commit

Permalink
Refactor pm.execution.location
Browse files Browse the repository at this point in the history
  • Loading branch information
appurva21 committed Nov 18, 2023
1 parent f962496 commit aad1b76
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
unreleased:
new features:
- GH-950 Added support for pm.execution.location
- GH-950 Added support for `pm.execution.location`

4.3.0:
date: 2023-11-02
Expand Down
17 changes: 0 additions & 17 deletions lib/sandbox/execution-location.js

This file was deleted.

23 changes: 12 additions & 11 deletions lib/sandbox/pmapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const _ = require('lodash'),
PostmanResponse = sdk.Response,
PostmanCookieList = sdk.CookieList,
chai = require('chai'),
ExecutionLocation = require('./execution-location'),

/**
* Use this function to assign readonly properties to an object
Expand Down Expand Up @@ -273,23 +272,25 @@ function Postman (execution, onRequest, onSkipRequest, onAssertion, cookieStore,
skipRequest: onSkipRequest,

/**
* @interface ExecutionLocationInterface
* @interface ExecutionLocation
* @extends Array<string>
*/
/**
* The element name whose script is currently being executed.
*
* @name ExecutionLocationInterface#current
* @type {string}
*/

/**
* The path of the current request.
*
* @type {ExecutionLocationInterface} - current execution path
* @type {ExecutionLocation} - current execution path
* @instance
*/
location: new ExecutionLocation(execution.legacy._eventItemName,
...(execution.legacy._itemPath || []))
location: _assignDefinedReadonly(execution.legacy._itemPath || [], /** @lends ExecutionLocation */ {
/**
* The item name whose script is currently being executed.
*
* @instance
* @type {string}
*/
current: execution.legacy._eventItemName
})
}
}, options.disabledAPIs);

Expand Down
4 changes: 2 additions & 2 deletions types/sandbox/prerequest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ declare interface Execution {
/**
* The path of the current request.
*/
location: ExecutionLocationInterface;
location: ExecutionLocation;
}

declare interface ExecutionLocationInterface extends Array {
declare interface ExecutionLocation extends Array {
/**
* The element name whose script is currently being executed.
*/
Expand Down
4 changes: 2 additions & 2 deletions types/sandbox/test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ declare interface Execution {
/**
* The path of the current request.
*/
location: ExecutionLocationInterface;
location: ExecutionLocation;
}

declare interface ExecutionLocationInterface extends Array {
declare interface ExecutionLocation extends Array {
/**
* The element name whose script is currently being executed.
*/
Expand Down

0 comments on commit aad1b76

Please sign in to comment.