@http-forge/core 0.2.7 → 0.2.9
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/README.md +62 -3
- package/dist/index.d.ts +11 -9
- package/dist/index.js +178 -174
- package/dist/index.mjs +178 -174
- package/dist/infrastructure/environment/environment-config-service.d.ts +21 -1
- package/dist/infrastructure/execution/request-preparer.d.ts +3 -3
- package/dist/infrastructure/script/request-script-session.d.ts +3 -1
- package/dist/infrastructure/script/script-executor.d.ts +0 -4
- package/dist/infrastructure/script/vm-script-executor.adapter.d.ts +1 -1
- package/dist/infrastructure/security/sensitive-data-redactor.d.ts +117 -0
- package/dist/infrastructure/test-suite/result-storage-service.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
- 🚀 **Postman Collections** - Load and execute `.postman_collection.json` and `.forge.json` files
|
|
14
14
|
- 📝 **JavaScript Scripting** - Pre-request and post-response scripts with full `pm.*` API (variables, assertions, execution flow, visualizer)
|
|
15
15
|
- 🔄 **Dynamic Variables** - Built-in generators: `{{$randomInt}}`, `{{$timestamp}}`, `{{$uuid}}`, `{{$guid}}`, etc.
|
|
16
|
-
- 🌍 **Environments** - Full variable scoping (globals, collection, environment,
|
|
16
|
+
- 🌍 **Environments** - Full variable scoping (globals, collection, environment, iterationData) with Postman-compatible cascade
|
|
17
17
|
- 👁️ **File Watching** - Automatic reload on collection/environment file changes with notification callbacks
|
|
18
18
|
- 🍪 **Cookie Persistence** - Automatic cookie storage and reuse, `pm.cookies.jar()` and `.toObject()`
|
|
19
19
|
- 📊 **Test Assertions** - BDD-style testing with `pm.test()` (sync/async) and full Chai `expect()` chains
|
|
20
20
|
- 🔐 **CryptoJS** - Full crypto library: hash, HMAC, AES/DES/TripleDES, PBKDF2, encoding helpers
|
|
21
21
|
- 🎯 **Execution Flow** - `pm.setNextRequest()`, `pm.execution.skipRequest()` for suite runner flow control
|
|
22
22
|
- 📈 **Visualizer** - `pm.visualizer.set(template, data)` for custom Handlebars-based HTML output
|
|
23
|
-
-
|
|
23
|
+
- �️ **Sensitive Data Redaction** - Auto-redacts tokens, passwords, secrets from persisted history/result files
|
|
24
|
+
- �🔌 **Extensible** - Custom interceptors, HTTP clients, and module loaders
|
|
24
25
|
|
|
25
26
|
**Ideal for:**
|
|
26
27
|
- CI/CD pipeline integration (GitHub Actions, GitLab CI, Jenkins)
|
|
@@ -379,6 +380,47 @@ const entries = history.getAll(); // All requests
|
|
|
379
380
|
const byId = history.getByRequestId(id); // Specific request history
|
|
380
381
|
```
|
|
381
382
|
|
|
383
|
+
### 🛡️ Sensitive Data Redaction
|
|
384
|
+
|
|
385
|
+
History and result files automatically redact sensitive data before writing to disk. This prevents tokens, passwords, and credentials from being persisted in plaintext.
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
import {
|
|
389
|
+
redactHeaders, redactUrl, redactBody,
|
|
390
|
+
redactHistoryEntry, redactFullResponse, redactFullResultDetails
|
|
391
|
+
} from '@http-forge/core';
|
|
392
|
+
|
|
393
|
+
// Redact sensitive headers
|
|
394
|
+
redactHeaders({ 'Authorization': 'Bearer eyJ...', 'Content-Type': 'application/json' });
|
|
395
|
+
// → { 'Authorization': '***', 'Content-Type': 'application/json' }
|
|
396
|
+
|
|
397
|
+
// Any header containing 'token', 'cookie', 'secret' is redacted
|
|
398
|
+
redactHeaders({ 'avs-token': 'abc123', 'telus-access-token-cookie': 'xyz' });
|
|
399
|
+
// → { 'avs-token': '***', 'telus-access-token-cookie': '***' }
|
|
400
|
+
|
|
401
|
+
// Redact sensitive URL query params
|
|
402
|
+
redactUrl('https://api.example.com/auth?client_secret=abc&scope=read');
|
|
403
|
+
// → 'https://api.example.com/auth?client_secret=***&scope=read'
|
|
404
|
+
|
|
405
|
+
// Redact sensitive JSON body fields (recursive)
|
|
406
|
+
redactBody({ user: 'admin', password: 'hunter2', data: { api_token: 'xyz' } });
|
|
407
|
+
// → { user: 'admin', password: '***', data: { api_token: '***' } }
|
|
408
|
+
|
|
409
|
+
// Redact URL-encoded form bodies
|
|
410
|
+
redactBody('username=admin&password=secret&grant_type=password');
|
|
411
|
+
// → 'username=admin&password=***&grant_type=***'
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
**Auto-detected patterns:**
|
|
415
|
+
- **Headers**: `authorization`, `proxy-authorization`, `www-authenticate`, and any header containing `token`, `cookie`, `secret`, `credential`, `api-key`, `bearer`, `session-id`
|
|
416
|
+
- **Fields/Params**: Any name containing `password`, `passwd`, `pwd`, `token`, `cookie`, `secret`, `credential`, `api_key`, `access_token`, `refresh_token`, `client_secret`, `private_key`, `auth_code`, `bearer`, `session_id`, `jwt`
|
|
417
|
+
|
|
418
|
+
**Integration points:**
|
|
419
|
+
- `RequestHistoryService.addEntry()` — redacts `sentRequest` (headers, body, URL) before saving
|
|
420
|
+
- `RequestHistoryService.saveFullResponse()` — redacts response headers and cookies
|
|
421
|
+
- `ResultStorageService.saveResult()` — redacts request/response headers and body in suite results
|
|
422
|
+
- `originalConfig` (unresolved `{{variable}}` templates) is never redacted — only resolved values
|
|
423
|
+
|
|
382
424
|
## 📖 API Reference
|
|
383
425
|
|
|
384
426
|
### ForgeContainer
|
|
@@ -753,6 +795,23 @@ MIT © Henry Huang
|
|
|
753
795
|
|
|
754
796
|
## 📝 Changelog
|
|
755
797
|
|
|
798
|
+
### 0.2.7 (Session Scope Removal & Postman Parity)
|
|
799
|
+
|
|
800
|
+
- ✅ **Session scope removed** — The separate "session" variable scope has been removed. `pm.environment.set()` now persists to workspace state (matching Postman's behavior). Variable resolution uses a Postman-compatible 5-scope cascade: `variables > iterationData > environmentVariables > collectionVariables > globals`.
|
|
801
|
+
- ✅ **Request preparer extraVariables fix** — All request resolutions (params, query, headers, bearer auth, basic auth, API key) now use `extraVariables`. Previously only body and URL used them.
|
|
802
|
+
- ✅ **Exported `ResolvedEnvironment` type** — Now part of the public API for downstream consumers.
|
|
803
|
+
|
|
804
|
+
### 0.2.6 (Sensitive Data Redaction & Variable Propagation Fix)
|
|
805
|
+
|
|
806
|
+
- ✅ **Sensitive data redaction** — History files, shared history, suite test results, and full response files automatically redact sensitive data before persisting to disk:
|
|
807
|
+
- Headers matching `authorization`, `proxy-authorization`, or containing `token`, `cookie`, `secret`, `credential`, `api-key`, `bearer`, `session-id`
|
|
808
|
+
- URL query params and JSON/form body fields matching `password`, `token`, `secret`, `api_key`, `client_secret`, `private_key`, `auth_code`, `jwt`, etc.
|
|
809
|
+
- Response `Set-Cookie` headers and cookies with sensitive names
|
|
810
|
+
- Unresolved `{{variable}}` templates in `originalConfig` are preserved — only resolved values redacted
|
|
811
|
+
- Exported functions: `redactHeaders()`, `redactUrl()`, `redactBody()`, `redactHistoryEntry()`, `redactFullResponse()`, `redactFullResultDetails()`
|
|
812
|
+
- ✅ **Fixed `pm.environment.set()` propagation** — Post-response script `pm.environment.set()` now correctly propagates to `{{variable}}` resolution in subsequent collection runner requests. The session now uses live scope references instead of a disconnected snapshot.
|
|
813
|
+
- ✅ **Cookie jar flush in collection runner** — `flush()` is now called in the `finally` block ensuring script-set cookies persist to the shared session store after a run completes.
|
|
814
|
+
|
|
756
815
|
### 0.2.5 (OpenAPI Constraint Round-Trip & Collision Merging)
|
|
757
816
|
|
|
758
817
|
- ✅ **Full parameter constraint round-trip** — OpenAPI import/export now preserves all schema constraint fields: `pattern`, `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `minLength`, `maxLength`, and `oneOf` on both `KeyValueEntry` and `PathParamEntry`
|
|
@@ -791,7 +850,7 @@ MIT © Henry Huang
|
|
|
791
850
|
- ✅ **Core request execution** with Postman collection support
|
|
792
851
|
- ✅ **Dynamic variables** - 7 generators for on-the-fly value generation
|
|
793
852
|
- ✅ **Postman-compatible scripting** - `pm.*` API with full feature parity
|
|
794
|
-
- ✅ **Variable scoping** - globals, collection, environment,
|
|
853
|
+
- ✅ **Variable scoping** - globals, collection, environment, workspace-state persistence for `pm.environment.set()`
|
|
795
854
|
- ✅ **Cookie persistence** - automatic storage and reuse across request chains
|
|
796
855
|
- ✅ **Pre-request & post-response scripts** with shared VM context
|
|
797
856
|
- ✅ **Test assertions** with BDD-style `pm.test()` and expect chains
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export { ForgeContainer } from './container';
|
|
20
20
|
export type { ForgeContainerOptions, StorageFormat } from './container';
|
|
21
|
-
export {
|
|
21
|
+
export { getServiceContainer, registerCoreServices, ServiceContainer, ServiceIdentifiers } from './di';
|
|
22
22
|
export type { PlatformAdapters, ServiceIdentifier } from './di';
|
|
23
23
|
export * from './types/console-service';
|
|
24
24
|
export * from './types/platform';
|
|
@@ -32,7 +32,7 @@ export { PersistentCookieJar } from './infrastructure/cookie/persistent-cookie-j
|
|
|
32
32
|
export { FetchHttpClient } from './infrastructure/http/fetch-http-client';
|
|
33
33
|
export { HttpRequestService } from './infrastructure/http/http-request-service';
|
|
34
34
|
export { InterceptorChain, LoggingRequestInterceptor, RetryErrorInterceptor, TimingResponseInterceptor } from './infrastructure/http/interceptor-chain';
|
|
35
|
-
export type { IErrorInterceptor, IInterceptorChain, IRequestInterceptor, IResponseInterceptor
|
|
35
|
+
export type { IErrorInterceptor, IInterceptorChain, InterceptorContext, IRequestInterceptor, IResponseInterceptor } from './infrastructure/http/interceptor-chain';
|
|
36
36
|
export type { IHttpRequestService } from './infrastructure/http/interfaces';
|
|
37
37
|
export { mergeRequestSettings } from './infrastructure/http/merge-request-settings';
|
|
38
38
|
export { DEFAULT_REQUEST_SETTINGS, NodeHttpClient } from './infrastructure/http/native-http-client';
|
|
@@ -41,7 +41,7 @@ export type { IRequestPreprocessor } from './infrastructure/http/request-preproc
|
|
|
41
41
|
export { UrlBuilder } from './infrastructure/http/url-builder';
|
|
42
42
|
export type { IUrlBuilder } from './infrastructure/http/url-builder';
|
|
43
43
|
export * from './infrastructure/script/interfaces';
|
|
44
|
-
export {
|
|
44
|
+
export { createLodashShim, createModuleLoader, createMomentShim, ModuleLoader } from './infrastructure/script/module-loader';
|
|
45
45
|
export type { ModuleLoaderOptions } from './infrastructure/script/module-loader';
|
|
46
46
|
export { RequestScriptSession } from './infrastructure/script/request-script-session';
|
|
47
47
|
export type { SessionDependencies } from './infrastructure/script/request-script-session';
|
|
@@ -50,6 +50,8 @@ export { createExpectChain, createResponseObject } from './infrastructure/script
|
|
|
50
50
|
export type { ExpectChain, ResponseAssertions, ScriptResponse } from './infrastructure/script/script-factories';
|
|
51
51
|
export { concatenateScripts, createScriptConsole, createTestFunction, formatConsoleOutput, hasChanged, normalizeHeaders } from './infrastructure/script/script-utils';
|
|
52
52
|
export type { ConsoleMessage } from './infrastructure/script/script-utils';
|
|
53
|
+
export { applyExtractionPlan, buildExtractionPlan, detectSensitiveData, redactBody, redactFullResponse, redactFullResultDetails, redactHeaders, redactHistoryEntry, redactUrl } from './infrastructure/security/sensitive-data-redactor';
|
|
54
|
+
export type { SensitiveDataWarning, SensitiveExtraction } from './infrastructure/security/sensitive-data-redactor';
|
|
53
55
|
export { CollectionLoader } from './infrastructure/collection/collection-loader';
|
|
54
56
|
export type { LoadOptions } from './infrastructure/collection/collection-loader';
|
|
55
57
|
export { CollectionLoaderFactory } from './infrastructure/collection/collection-loader-factory';
|
|
@@ -59,8 +61,8 @@ export { FolderCollectionStore } from './infrastructure/collection/folder-collec
|
|
|
59
61
|
export * from './infrastructure/collection/folder-io';
|
|
60
62
|
export { generateSlug } from './infrastructure/collection/folder-io';
|
|
61
63
|
export { ParserRegistry } from './infrastructure/collection/parser-registry';
|
|
62
|
-
export type { Collection, ICollectionService } from './types/collection';
|
|
63
64
|
export { JsonCollectionLoader } from './infrastructure/collection/json-collection-loader';
|
|
65
|
+
export type { Collection, ICollectionService } from './types/collection';
|
|
64
66
|
export { EnvironmentConfigService } from './infrastructure/environment/environment-config-service';
|
|
65
67
|
export { isSystemEnvironmentFile, loadEnvironmentsFromFolder } from './infrastructure/environment/environment-file-loader';
|
|
66
68
|
export type { EnvironmentEntry, EnvironmentFolderData } from './infrastructure/environment/environment-file-loader';
|
|
@@ -68,9 +70,9 @@ export { EnvironmentResolver } from './infrastructure/environment/environment-re
|
|
|
68
70
|
export type { Environment, EnvironmentStoreConfig } from './infrastructure/environment/environment-resolver';
|
|
69
71
|
export { ForgeEnv } from './infrastructure/environment/forge-env';
|
|
70
72
|
export type { IForgeEnv } from './infrastructure/environment/forge-env';
|
|
71
|
-
export
|
|
72
|
-
export { VariableInterpolator, VariableResolver, createVariableResolver } from './infrastructure/environment/variable-interpolator';
|
|
73
|
+
export { createVariableResolver, VariableInterpolator, VariableResolver } from './infrastructure/environment/variable-interpolator';
|
|
73
74
|
export type { VariableResolverConfig } from './infrastructure/environment/variable-interpolator';
|
|
75
|
+
export type { IEnvironmentConfigService, ResolvedEnvironment } from './types/environment-config';
|
|
74
76
|
export { CollectionRequestExecutor } from './infrastructure/execution/collection-request-executor';
|
|
75
77
|
export * from './infrastructure/execution/collection-request-executor-interfaces';
|
|
76
78
|
export { RequestExecutor } from './infrastructure/execution/request-executor';
|
|
@@ -94,8 +96,8 @@ export { CONFIG_FILES, ConfigService, DEFAULT_CONFIG, ROOT_DIRECTORIES } from '.
|
|
|
94
96
|
export type { EnvironmentsConfig, HttpForgeConfig, IConfigService, ProxyConfig, RequestConfig, RestClientExportConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './infrastructure/config';
|
|
95
97
|
export { DEFAULT_SUITE_CONFIG } from './infrastructure/test-suite/interfaces';
|
|
96
98
|
export type { ErrorSummary, IStatisticsService, ITestSuiteService, RequestStatistics, RunStatistics, RunSummary, SuiteConfig, SuiteRequest, TestSuite } from './infrastructure/test-suite/interfaces';
|
|
97
|
-
export {
|
|
98
|
-
export type { FullResultDetails,
|
|
99
|
+
export { buildResultFileName, expandSummary, HTTP_METHOD_MAP, HTTP_METHOD_REVERSE } from './infrastructure/test-suite/result-storage';
|
|
100
|
+
export type { FullResultDetails, IndexPage, IResultStorageService, RecentError, RequestStats, ResultSummary, RunConfig, RunManifest, RunStats } from './infrastructure/test-suite/result-storage';
|
|
99
101
|
export { ResultStorageService } from './infrastructure/test-suite/result-storage-service';
|
|
100
102
|
export { StatisticsService } from './infrastructure/test-suite/statistics-service';
|
|
101
103
|
export { TestSuiteService } from './infrastructure/test-suite/test-suite-service';
|
|
@@ -109,7 +111,7 @@ export { exportCollectionToRestClient, getRestClientExportFolder, writeEnvFile,
|
|
|
109
111
|
export { DataFileParser } from './infrastructure/platform/data-file-parser';
|
|
110
112
|
export type { IDataFileParser } from './infrastructure/platform/data-file-parser';
|
|
111
113
|
export { NodeFileSystem } from './infrastructure/platform/node-file-system';
|
|
112
|
-
export {
|
|
114
|
+
export { augmentWithDynamicVars, DYNAMIC_VARIABLES, resolveDynamicVariable, resolveDynamicVariablesInString } from './utils/dynamic-variables';
|
|
113
115
|
export { evaluateExpression, isExpression } from './utils/expression-evaluator';
|
|
114
116
|
export { applyFilterChain, parseFilterChain } from './utils/filter-engine';
|
|
115
117
|
export { deepClone, formatBytes, formatDuration, generateId, generateUUID, isPlainObject, mergeHeadersCaseInsensitive, safeJsonParse, sanitizeName } from './utils/helpers';
|