@http-forge/core 0.2.0 → 0.2.1

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.
Files changed (38) hide show
  1. package/README.md +25 -4
  2. package/dist/auth/oauth2-token-manager.d.ts +1 -1
  3. package/dist/collection/collection-loader-factory.d.ts +1 -1
  4. package/dist/collection/collection-service.d.ts +2 -2
  5. package/dist/collection/collection-store.d.ts +1 -1
  6. package/dist/collection/folder-collection-loader.d.ts +17 -228
  7. package/dist/collection/folder-collection-store.d.ts +8 -1
  8. package/dist/collection/folder-io.d.ts +113 -0
  9. package/dist/container.d.ts +13 -14
  10. package/dist/cookie/cookie-service.d.ts +1 -1
  11. package/dist/cookie/in-memory-cookie-jar.d.ts +1 -1
  12. package/dist/cookie/persistent-cookie-jar.d.ts +1 -1
  13. package/dist/di/core-bootstrap.d.ts +25 -0
  14. package/dist/di/index.d.ts +11 -0
  15. package/dist/di/platform-adapters.d.ts +53 -0
  16. package/dist/di/service-container.d.ts +97 -0
  17. package/dist/di/service-identifiers.d.ts +34 -0
  18. package/dist/environment/environment-config-service.d.ts +6 -3
  19. package/dist/environment/environment-file-loader.d.ts +42 -0
  20. package/dist/environment/forge-env.d.ts +1 -1
  21. package/dist/execution/collection-request-executor.d.ts +3 -3
  22. package/dist/execution/request-executor.d.ts +3 -3
  23. package/dist/execution/request-preparer.d.ts +3 -3
  24. package/dist/history/request-history.d.ts +1 -1
  25. package/dist/http/http-request-service.d.ts +2 -2
  26. package/dist/import-export/import-postman-environment.d.ts +1 -1
  27. package/dist/index.d.ts +25 -19
  28. package/dist/index.js +187 -187
  29. package/dist/index.mjs +187 -187
  30. package/dist/openapi/interfaces.d.ts +2 -2
  31. package/dist/script/interfaces.d.ts +12 -0
  32. package/dist/script/request-script-session.d.ts +3 -0
  33. package/dist/script/script-executor.d.ts +1 -1
  34. package/dist/script/script-factories.d.ts +15 -4
  35. package/dist/script/script-utils.d.ts +2 -1
  36. package/dist/test-suite/result-storage-service.d.ts +1 -1
  37. package/dist/types/types.d.ts +7 -0
  38. package/package.json +2 -2
@@ -4,10 +4,10 @@
4
4
  * DI abstractions for OpenAPI-related services.
5
5
  * The concrete implementations live in services/openapi/.
6
6
  */
7
- import type { OpenApiExportOptions } from './openapi-exporter';
8
- import type { OpenApiImportOptions } from './openapi-importer';
9
7
  import type { Collection } from '../collection/collection-service-interfaces';
10
8
  import type { BodySchemaDefinition, JSONSchema7, KeyValueEntry, ResponseSchemaDefinition } from '../types/types';
9
+ import type { OpenApiExportOptions } from './openapi-exporter';
10
+ import type { OpenApiImportOptions } from './openapi-importer';
11
11
  /**
12
12
  * Schema inference service interface
13
13
  */
@@ -68,6 +68,7 @@ export interface CommonScriptContext {
68
68
  info?: ScriptInfo;
69
69
  iteration?: number;
70
70
  iterationCount?: number;
71
+ iterationData?: Record<string, any>;
71
72
  onSessionChange?: (action: 'set' | 'unset' | 'clear', key?: string, value?: string) => void;
72
73
  onEnvironmentChange?: (action: 'set' | 'unset' | 'clear', key?: string, value?: string) => void;
73
74
  }
@@ -98,6 +99,10 @@ export interface PreRequestScriptResult {
98
99
  modifiedSessionVariables?: Record<string, string>;
99
100
  modifiedEnvironmentVariables?: Record<string, string>;
100
101
  consoleOutput?: string[];
102
+ /** Postman-compatible: pm.execution.setNextRequest() value. null = stop runner. */
103
+ nextRequest?: string | null;
104
+ /** Postman-compatible: pm.execution.skipRequest() was called */
105
+ skipRequest?: boolean;
101
106
  }
102
107
  /**
103
108
  * Script execution result for post-response scripts
@@ -107,6 +112,13 @@ export interface PostResponseScriptResult {
107
112
  consoleOutput?: string[];
108
113
  modifiedEnvironmentVariables?: Record<string, string>;
109
114
  modifiedSessionVariables?: Record<string, string>;
115
+ /** Postman-compatible: pm.execution.setNextRequest() value. null = stop runner. */
116
+ nextRequest?: string | null;
117
+ /** Postman-compatible: pm.visualizer.set(template, data) output */
118
+ visualizerData?: {
119
+ template: string;
120
+ data?: any;
121
+ };
110
122
  }
111
123
  /**
112
124
  * Test script execution context
@@ -36,6 +36,9 @@ export declare class RequestScriptSession implements IRequestScriptSession {
36
36
  private _globals;
37
37
  private _sessionVariables;
38
38
  private _environmentVariables;
39
+ private _nextRequest;
40
+ private _skipRequest;
41
+ private _visualizerData;
39
42
  constructor(deps: SessionDependencies, initialContext: PreRequestScriptContext);
40
43
  /**
41
44
  * Initialize the shared VM context
@@ -8,8 +8,8 @@
8
8
  * This is the main entry point for script execution.
9
9
  * It configures the VM sandbox and delegates session management to RequestScriptSession.
10
10
  */
11
- import { IRequestScriptSession, IScriptExecutor, PreRequestScriptContext } from './interfaces';
12
11
  import { IHttpRequestService } from '../http/interfaces';
12
+ import { IRequestScriptSession, IScriptExecutor, PreRequestScriptContext } from './interfaces';
13
13
  /**
14
14
  * Script Executor Implementation
15
15
  *
@@ -28,6 +28,7 @@ export interface ScriptResponse {
28
28
  }
29
29
  /**
30
30
  * Response assertion helpers (Postman-style)
31
+ * Note: be.ok/error/etc. are getters that execute assertions on property access
31
32
  */
32
33
  export interface ResponseAssertions {
33
34
  have: {
@@ -37,10 +38,11 @@ export interface ResponseAssertions {
37
38
  jsonBody(expectedJson?: any): void;
38
39
  };
39
40
  be: {
40
- ok(): void;
41
- error(): void;
42
- clientError(): void;
43
- serverError(): void;
41
+ readonly ok: any;
42
+ readonly success: any;
43
+ readonly error: any;
44
+ readonly clientError: any;
45
+ readonly serverError: any;
44
46
  };
45
47
  }
46
48
  /**
@@ -54,14 +56,17 @@ export declare function createResponseObject(response: ResponseContext): ScriptR
54
56
  export interface ExpectChain {
55
57
  _value: any;
56
58
  _negated: boolean;
59
+ _deep: boolean;
57
60
  not: ExpectChain;
58
61
  to: ExpectChain;
59
62
  be: ExpectChain;
60
63
  have: ExpectChain;
64
+ deep: ExpectChain;
61
65
  equal(expected: any): ExpectChain;
62
66
  eql(expected: any): ExpectChain;
63
67
  property(name: string, value?: any): ExpectChain;
64
68
  ok: ExpectChain;
69
+ exist: ExpectChain;
65
70
  include(value: any): ExpectChain;
66
71
  oneOf(values: any[]): ExpectChain;
67
72
  match(pattern: RegExp): ExpectChain;
@@ -70,12 +75,18 @@ export interface ExpectChain {
70
75
  greaterThan(num: number): ExpectChain;
71
76
  lessThan(num: number): ExpectChain;
72
77
  within(start: number, end: number): ExpectChain;
78
+ a(type: string): ExpectChain;
79
+ an(type: string): ExpectChain;
73
80
  true: ExpectChain;
74
81
  false: ExpectChain;
75
82
  null: ExpectChain;
76
83
  undefined: ExpectChain;
77
84
  empty: ExpectChain;
78
85
  length(len: number): ExpectChain;
86
+ lengthOf(len: number): ExpectChain;
87
+ members(arr: any[]): ExpectChain;
88
+ keys(...args: any[]): ExpectChain;
89
+ string(substr: string): ExpectChain;
79
90
  }
80
91
  /**
81
92
  * Create Chai-style expect chain for assertions
@@ -32,8 +32,9 @@ export declare function formatConsoleOutput(messages: ConsoleMessage[]): string[
32
32
  export declare function createScriptConsole(messages: ConsoleMessage[]): Console;
33
33
  /**
34
34
  * Create a test function that records assertions
35
+ * Supports both sync and async test functions (Postman-compatible)
35
36
  */
36
- export declare function createTestFunction(assertions: TestAssertion[]): (name: string, fn: () => void) => void;
37
+ export declare function createTestFunction(assertions: TestAssertion[]): any;
37
38
  /**
38
39
  * Normalize HTTP headers to Record<string, string>
39
40
  * Converts multi-value headers (string[]) to comma-separated strings
@@ -7,8 +7,8 @@
7
7
  * - Aggregated stats in memory (constant size)
8
8
  * - On-demand result loading
9
9
  */
10
- import { ExecutionResult } from '../types/types';
11
10
  import { IConfigService } from '../config';
11
+ import { ExecutionResult } from '../types/types';
12
12
  import { FullResultDetails, IndexPage, IResultStorageService, RecentError, RequestStats, ResultSummary, RunConfig, RunManifest, RunStats } from './result-storage';
13
13
  /**
14
14
  * File-based Result Storage Service for Test Suite
@@ -575,4 +575,11 @@ export interface ExecutionResult {
575
575
  modifiedCollectionVariables?: Record<string, string>;
576
576
  modifiedSessionVariables?: Record<string, string>;
577
577
  error?: string;
578
+ /** Postman-compatible: pm.execution.setNextRequest() value. null = stop runner. */
579
+ nextRequest?: string | null;
580
+ /** Postman-compatible: pm.visualizer.set(template, data) output */
581
+ visualizerData?: {
582
+ template: string;
583
+ data?: any;
584
+ };
578
585
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@http-forge/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Headless HTTP testing engine with Postman collection support, dynamic variables, and script-based automation.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -48,7 +48,7 @@
48
48
  "directory": "packages/core"
49
49
  },
50
50
  "engines": {
51
- "node": ">=18.0.0"
51
+ "node": ">=20.0.0"
52
52
  },
53
53
  "dependencies": {
54
54
  "@apidevtools/json-schema-ref-parser": "^11.7.3",