@http-forge/core 0.4.5 → 0.4.6
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/dist/index.js +96 -96
- package/dist/index.mjs +96 -96
- package/dist/infrastructure/environment/environment-config-service.d.ts +1 -1
- package/dist/infrastructure/environment/environment-resolver.d.ts +9 -0
- package/dist/infrastructure/environment/forge-env.d.ts +34 -1
- package/dist/infrastructure/environment/variable-interpolator.d.ts +1 -2
- package/dist/infrastructure/script/interfaces.d.ts +3 -3
- package/dist/infrastructure/script/script-executor.d.ts +7 -0
- package/dist/infrastructure/test-suite/result-storage.d.ts +0 -2
- package/dist/types/types.d.ts +0 -2
- package/package.json +1 -1
|
@@ -113,7 +113,7 @@ export declare class EnvironmentConfigService implements IEnvironmentConfigServi
|
|
|
113
113
|
private getEnvLocalConfigPath;
|
|
114
114
|
private loadFolderConfigs;
|
|
115
115
|
/**
|
|
116
|
-
* Create a VariableResolver pre-loaded with environment
|
|
116
|
+
* Create a VariableResolver pre-loaded with environment variables.
|
|
117
117
|
*/
|
|
118
118
|
private createResolver;
|
|
119
119
|
private saveFolderSharedConfig;
|
|
@@ -77,6 +77,15 @@ export declare class EnvironmentResolver implements IEnvironmentStore {
|
|
|
77
77
|
* Set a global variable
|
|
78
78
|
*/
|
|
79
79
|
setGlobal(key: string, value: string): void;
|
|
80
|
+
/**
|
|
81
|
+
* Remove a session global variable. File-defined globals (globalVariables)
|
|
82
|
+
* are defaults and cannot be deleted here — only session overrides are removed.
|
|
83
|
+
*/
|
|
84
|
+
unsetGlobal(key: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Clear all session global variables. File-defined globals are left intact.
|
|
87
|
+
*/
|
|
88
|
+
clearGlobals(): void;
|
|
80
89
|
/**
|
|
81
90
|
* Resolve environment for execution
|
|
82
91
|
*/
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
* env.get('token'); // 'abc'
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
import { EnvironmentResolver } from './environment-resolver';
|
|
34
33
|
import type { IEnvironmentStore, IVariableInterpolator } from '../../types/environment-config';
|
|
34
|
+
import { EnvironmentResolver } from './environment-resolver';
|
|
35
35
|
/**
|
|
36
36
|
* ForgeEnv interface - the public API for environment management
|
|
37
37
|
*/
|
|
@@ -69,6 +69,22 @@ export interface IForgeEnv {
|
|
|
69
69
|
* Get list of available environment names
|
|
70
70
|
*/
|
|
71
71
|
getEnvironments(): string[];
|
|
72
|
+
/**
|
|
73
|
+
* Get all global variables (environment-agnostic variable layer)
|
|
74
|
+
*/
|
|
75
|
+
getGlobals(): Record<string, string>;
|
|
76
|
+
/**
|
|
77
|
+
* Set a global variable value
|
|
78
|
+
*/
|
|
79
|
+
setGlobal(key: string, value: string): void;
|
|
80
|
+
/**
|
|
81
|
+
* Remove a global variable
|
|
82
|
+
*/
|
|
83
|
+
unsetGlobal(key: string): void;
|
|
84
|
+
/**
|
|
85
|
+
* Clear all (session) global variables
|
|
86
|
+
*/
|
|
87
|
+
clearGlobals(): void;
|
|
72
88
|
/**
|
|
73
89
|
* Resolve {{variable}} placeholders in a string
|
|
74
90
|
*/
|
|
@@ -127,6 +143,23 @@ export declare class ForgeEnv implements IForgeEnv {
|
|
|
127
143
|
* Get list of available environment names
|
|
128
144
|
*/
|
|
129
145
|
getEnvironments(): string[];
|
|
146
|
+
/**
|
|
147
|
+
* Get all global variables. Globals are the lowest-priority, environment-agnostic
|
|
148
|
+
* variable layer — treated like environment variables with no environment scope.
|
|
149
|
+
*/
|
|
150
|
+
getGlobals(): Record<string, string>;
|
|
151
|
+
/**
|
|
152
|
+
* Set a global variable value.
|
|
153
|
+
*/
|
|
154
|
+
setGlobal(key: string, value: string): void;
|
|
155
|
+
/**
|
|
156
|
+
* Remove a (session) global variable.
|
|
157
|
+
*/
|
|
158
|
+
unsetGlobal(key: string): void;
|
|
159
|
+
/**
|
|
160
|
+
* Clear all (session) global variables.
|
|
161
|
+
*/
|
|
162
|
+
clearGlobals(): void;
|
|
130
163
|
/**
|
|
131
164
|
* Resolve {{variable}} placeholders
|
|
132
165
|
*/
|
|
@@ -28,13 +28,12 @@ export interface VariableResolverConfig {
|
|
|
28
28
|
globals: Record<string, string>;
|
|
29
29
|
collectionVariables: Record<string, string>;
|
|
30
30
|
environmentVariables: Record<string, string>;
|
|
31
|
-
sessionVariables: Record<string, string>;
|
|
32
31
|
variables: Record<string, string>;
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
35
34
|
* Variable Resolver - Resolves {{varName}} patterns in strings and objects
|
|
36
35
|
* Uses a 5-step pipeline: $dynamic → filter chains → simple lookup → JS expressions → passthrough
|
|
37
|
-
* Variable precedence: globals > collection > environment >
|
|
36
|
+
* Variable precedence: globals > collection > environment > request > extra
|
|
38
37
|
*/
|
|
39
38
|
export declare class VariableResolver {
|
|
40
39
|
private readonly allVariables;
|
|
@@ -61,7 +61,6 @@ export interface CommonScriptContext {
|
|
|
61
61
|
variables: Record<string, string>;
|
|
62
62
|
collectionVariables?: Record<string, string>;
|
|
63
63
|
globals?: Record<string, string>;
|
|
64
|
-
sessionVariables?: Record<string, string>;
|
|
65
64
|
environmentVariables?: Record<string, string>;
|
|
66
65
|
environmentName?: string;
|
|
67
66
|
sendRequest?: (options: any) => Promise<any>;
|
|
@@ -70,6 +69,7 @@ export interface CommonScriptContext {
|
|
|
70
69
|
iterationCount?: number;
|
|
71
70
|
iterationData?: Record<string, any>;
|
|
72
71
|
onEnvironmentChange?: (action: 'set' | 'unset' | 'clear', key?: string, value?: string) => void;
|
|
72
|
+
onGlobalsChange?: (action: 'set' | 'unset' | 'clear', key?: string, value?: string) => void;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Script execution context for pre-request scripts
|
|
@@ -95,7 +95,6 @@ export interface PreRequestScriptResult {
|
|
|
95
95
|
modifiedVariables?: Record<string, string>;
|
|
96
96
|
modifiedCollectionVariables?: Record<string, string>;
|
|
97
97
|
modifiedGlobals?: Record<string, string>;
|
|
98
|
-
modifiedSessionVariables?: Record<string, string>;
|
|
99
98
|
modifiedEnvironmentVariables?: Record<string, string>;
|
|
100
99
|
consoleOutput?: string[];
|
|
101
100
|
/** Postman-compatible: pm.execution.setNextRequest() value. null = stop runner. */
|
|
@@ -110,7 +109,8 @@ export interface PostResponseScriptResult {
|
|
|
110
109
|
testResults: TestAssertion[];
|
|
111
110
|
consoleOutput?: string[];
|
|
112
111
|
modifiedEnvironmentVariables?: Record<string, string>;
|
|
113
|
-
|
|
112
|
+
modifiedGlobals?: Record<string, string>;
|
|
113
|
+
modifiedCollectionVariables?: Record<string, string>;
|
|
114
114
|
/** Postman-compatible: pm.execution.setNextRequest() value. null = stop runner. */
|
|
115
115
|
nextRequest?: string | null;
|
|
116
116
|
/** Postman-compatible: pm.visualizer.set(template, data) output */
|
|
@@ -55,6 +55,13 @@ export declare class ScriptExecutor implements IScriptExecutor {
|
|
|
55
55
|
* Create a basic variable scope with get/set/has/unset/clear/toObject
|
|
56
56
|
*/
|
|
57
57
|
private createVariableScope;
|
|
58
|
+
/**
|
|
59
|
+
* Create the globals scope with change callbacks.
|
|
60
|
+
* Globals are a special, environment-agnostic variable layer, so they are
|
|
61
|
+
* persisted live through the same push-callback mechanism as environment
|
|
62
|
+
* variables (see createEnvironmentScope) rather than a post-hoc diff.
|
|
63
|
+
*/
|
|
64
|
+
private createGlobalsScope;
|
|
58
65
|
/**
|
|
59
66
|
* Create merged variable scope (Postman-style cascading lookup)
|
|
60
67
|
*/
|
|
@@ -227,8 +227,6 @@ export interface FullResultDetails {
|
|
|
227
227
|
modifiedEnvironmentVariables?: Record<string, string>;
|
|
228
228
|
/** Collection variables modified by scripts */
|
|
229
229
|
modifiedCollectionVariables?: Record<string, string>;
|
|
230
|
-
/** Session variables modified by scripts */
|
|
231
|
-
modifiedSessionVariables?: Record<string, string>;
|
|
232
230
|
/** pm.execution.setNextRequest() value */
|
|
233
231
|
nextRequest?: string | null;
|
|
234
232
|
/** pm.visualizer.set() payload */
|
package/dist/types/types.d.ts
CHANGED
|
@@ -218,7 +218,6 @@ export interface ExecutionVariables {
|
|
|
218
218
|
variables: Record<string, string>;
|
|
219
219
|
collectionVariables?: Record<string, string>;
|
|
220
220
|
globals?: Record<string, string>;
|
|
221
|
-
sessionVariables?: Record<string, string>;
|
|
222
221
|
environmentVariables?: Record<string, string>;
|
|
223
222
|
}
|
|
224
223
|
/**
|
|
@@ -619,7 +618,6 @@ export interface ExecutionResult {
|
|
|
619
618
|
modifiedVariables?: Record<string, string>;
|
|
620
619
|
modifiedEnvironmentVariables?: Record<string, string>;
|
|
621
620
|
modifiedCollectionVariables?: Record<string, string>;
|
|
622
|
-
modifiedSessionVariables?: Record<string, string>;
|
|
623
621
|
error?: string;
|
|
624
622
|
/** Folder path of the request within its collection (slash-separated; empty for root) */
|
|
625
623
|
folderPath?: string;
|
package/package.json
CHANGED