@http-forge/core 0.6.2-2.beta.1 → 0.6.2-2.beta.3

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.
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Chai/Postman-compatible expect chain.
3
+ *
4
+ * Implements the full Chai BDD expect surface plus Postman-specific
5
+ * extensions (`jsonSchema`). Organized by category for easy navigation.
6
+ */
7
+ /**
8
+ * Chai-style expect chain with Postman-compatible extensions.
9
+ * Mirrors the full Chai BDD `expect(...)` surface.
10
+ */
11
+ export interface ExpectChain {
12
+ _value: any;
13
+ _negated: boolean;
14
+ _deep: boolean;
15
+ to: ExpectChain;
16
+ be: ExpectChain;
17
+ been: ExpectChain;
18
+ is: ExpectChain;
19
+ that: ExpectChain;
20
+ which: ExpectChain;
21
+ and: ExpectChain;
22
+ has: ExpectChain;
23
+ have: ExpectChain;
24
+ with: ExpectChain;
25
+ at: ExpectChain;
26
+ of: ExpectChain;
27
+ same: ExpectChain;
28
+ but: ExpectChain;
29
+ does: ExpectChain;
30
+ still: ExpectChain;
31
+ also: ExpectChain;
32
+ /** Negates the next assertion. */
33
+ not: ExpectChain;
34
+ /** Use deep (structural) equality in equal/include/members/keys/property. */
35
+ deep: ExpectChain;
36
+ /** Enable dot- and bracket-notation path resolution in property/include. */
37
+ nested: ExpectChain;
38
+ /** Restrict property/include to own (non-inherited) properties. */
39
+ own: ExpectChain;
40
+ /** Require members to appear in order. */
41
+ ordered: ExpectChain;
42
+ /** Require *any* of the given keys to be present (use with keys). */
43
+ any: ExpectChain;
44
+ /** Require *all* of the given keys to be present (default; use with keys). */
45
+ all: ExpectChain;
46
+ /** When asserting on a function, target the function itself rather than its prototype. */
47
+ itself: ExpectChain;
48
+ ok: ExpectChain;
49
+ "true": ExpectChain;
50
+ "false": ExpectChain;
51
+ "null": ExpectChain;
52
+ "undefined": ExpectChain;
53
+ "NaN": ExpectChain;
54
+ exist: ExpectChain;
55
+ exists: ExpectChain;
56
+ empty: ExpectChain;
57
+ "arguments": ExpectChain;
58
+ "Arguments": ExpectChain;
59
+ extensible: ExpectChain;
60
+ sealed: ExpectChain;
61
+ frozen: ExpectChain;
62
+ finite: ExpectChain;
63
+ equal(expected: any): ExpectChain;
64
+ eq(expected: any): ExpectChain;
65
+ equals(expected: any): ExpectChain;
66
+ eql(expected: any): ExpectChain;
67
+ eqls(expected: any): ExpectChain;
68
+ include(value: any): ExpectChain;
69
+ includes(value: any): ExpectChain;
70
+ contain(value: any): ExpectChain;
71
+ contains(value: any): ExpectChain;
72
+ oneOf(values: any[]): ExpectChain;
73
+ property(name: string, value?: any): ExpectChain;
74
+ ownPropertyDescriptor(name: string, descriptor?: PropertyDescriptor): ExpectChain;
75
+ haveOwnPropertyDescriptor(name: string, descriptor?: PropertyDescriptor): ExpectChain;
76
+ keys(...args: any[]): ExpectChain;
77
+ key(...args: any[]): ExpectChain;
78
+ members(arr: any[]): ExpectChain;
79
+ string(substr: string): ExpectChain;
80
+ match(pattern: RegExp): ExpectChain;
81
+ matches(pattern: RegExp): ExpectChain;
82
+ a(type: string): ExpectChain;
83
+ an(type: string): ExpectChain;
84
+ length(len: number): ExpectChain;
85
+ lengthOf(len: number): ExpectChain;
86
+ satisfy(matcher: (value: any) => any): ExpectChain;
87
+ satisfies(matcher: (value: any) => any): ExpectChain;
88
+ jsonSchema(schema: any): ExpectChain;
89
+ above(num: number): ExpectChain;
90
+ gt(num: number): ExpectChain;
91
+ greaterThan(num: number): ExpectChain;
92
+ least(num: number): ExpectChain;
93
+ gte(num: number): ExpectChain;
94
+ greaterThanOrEqual(num: number): ExpectChain;
95
+ below(num: number): ExpectChain;
96
+ lt(num: number): ExpectChain;
97
+ lessThan(num: number): ExpectChain;
98
+ most(num: number): ExpectChain;
99
+ lte(num: number): ExpectChain;
100
+ lessThanOrEqual(num: number): ExpectChain;
101
+ within(start: number, end: number): ExpectChain;
102
+ closeTo(expected: number, delta: number): ExpectChain;
103
+ approximately(expected: number, delta: number): ExpectChain;
104
+ instanceOf(constructor: Function): ExpectChain;
105
+ "instanceof"(constructor: Function): ExpectChain;
106
+ "throw"(expected?: any): ExpectChain;
107
+ throws(expected?: any): ExpectChain;
108
+ "Throw"(expected?: any): ExpectChain;
109
+ respondTo(method: string): ExpectChain;
110
+ respondsTo(method: string): ExpectChain;
111
+ change(subject: any, prop?: string): ExpectChain;
112
+ changes(subject: any, prop?: string): ExpectChain;
113
+ increase(subject: any, prop?: string): ExpectChain;
114
+ increases(subject: any, prop?: string): ExpectChain;
115
+ decrease(subject: any, prop?: string): ExpectChain;
116
+ decreases(subject: any, prop?: string): ExpectChain;
117
+ /** Assert the magnitude of the preceding change/increase/decrease. */
118
+ by(delta: number): ExpectChain;
119
+ }
120
+ export declare function createExpectChain(value: any): ExpectChain;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Minimal, dependency-free JSON Schema validator.
3
+ *
4
+ * Supports the common subset used in API tests (draft-04 style):
5
+ * `type`, `properties`, `required`, `items`, `enum`, `additionalProperties`
6
+ * (boolean), `minimum`/`maximum`, `minLength`/`maxLength`, and `pattern`.
7
+ * Returns a list of human-readable error strings (empty when valid).
8
+ */
9
+ export declare function validateJsonSchema(data: any, schema: any, path?: string): string[];
@@ -1,20 +1,17 @@
1
1
  /**
2
2
  * Script Factories
3
3
  *
4
- * Single Responsibility: Create objects used in script execution contexts
5
- * Open/Closed: New factory methods can be added without modifying existing ones
4
+ * Single Responsibility: Create objects used in script execution contexts.
5
+ *
6
+ * `validateJsonSchema` lives in ./json-schema-validator
7
+ * `ExpectChain` / `createExpectChain` live in ./expect-chain
8
+ * Both are re-exported here for backward compatibility.
6
9
  */
7
10
  import { Cookie } from '../cookie/interfaces';
8
11
  import { ResponseContext } from './interfaces';
9
- /**
10
- * Minimal, dependency-free JSON Schema validator.
11
- *
12
- * Supports the common subset used in API tests (draft-04 style):
13
- * `type`, `properties`, `required`, `items`, `enum`, `additionalProperties`
14
- * (boolean), `minimum`/`maximum`, `minLength`/`maxLength`, and `pattern`.
15
- * Returns a list of human-readable error strings (empty when valid).
16
- */
17
- export declare function validateJsonSchema(data: any, schema: any, path?: string): string[];
12
+ export { createExpectChain } from './expect-chain';
13
+ export type { ExpectChain } from './expect-chain';
14
+ export { validateJsonSchema } from './json-schema-validator';
18
15
  /**
19
16
  * Response object interface for script context
20
17
  */
@@ -102,86 +99,9 @@ export interface CookieList extends Array<PostmanCookie> {
102
99
  count(): number;
103
100
  idx(index: number): PostmanCookie | undefined;
104
101
  }
105
- /**
106
- * Create a Postman-compatible CookieList from parsed cookies.
107
- */
108
102
  export declare function createCookieList(cookies: Cookie[]): CookieList;
109
103
  /**
110
- * Create response object with helper methods for script context
111
- * Provides Postman-compatible response API
104
+ * Create response object with helper methods for script context.
105
+ * Provides Postman-compatible response API.
112
106
  */
113
107
  export declare function createResponseObject(response: ResponseContext): ScriptResponse;
114
- /**
115
- * Expect chain interface for Chai-style assertions
116
- */
117
- export interface ExpectChain {
118
- _value: any;
119
- _negated: boolean;
120
- _deep: boolean;
121
- not: ExpectChain;
122
- to: ExpectChain;
123
- be: ExpectChain;
124
- have: ExpectChain;
125
- deep: ExpectChain;
126
- and: ExpectChain;
127
- that: ExpectChain;
128
- which: ExpectChain;
129
- is: ExpectChain;
130
- been: ExpectChain;
131
- has: ExpectChain;
132
- with: ExpectChain;
133
- at: ExpectChain;
134
- of: ExpectChain;
135
- same: ExpectChain;
136
- but: ExpectChain;
137
- does: ExpectChain;
138
- still: ExpectChain;
139
- also: ExpectChain;
140
- equal(expected: any): ExpectChain;
141
- eq(expected: any): ExpectChain;
142
- equals(expected: any): ExpectChain;
143
- eql(expected: any): ExpectChain;
144
- eqls(expected: any): ExpectChain;
145
- property(name: string, value?: any): ExpectChain;
146
- ok: ExpectChain;
147
- exist: ExpectChain;
148
- include(value: any): ExpectChain;
149
- includes(value: any): ExpectChain;
150
- contain(value: any): ExpectChain;
151
- contains(value: any): ExpectChain;
152
- oneOf(values: any[]): ExpectChain;
153
- match(pattern: RegExp): ExpectChain;
154
- above(num: number): ExpectChain;
155
- below(num: number): ExpectChain;
156
- gt(num: number): ExpectChain;
157
- lt(num: number): ExpectChain;
158
- least(num: number): ExpectChain;
159
- most(num: number): ExpectChain;
160
- gte(num: number): ExpectChain;
161
- lte(num: number): ExpectChain;
162
- greaterThan(num: number): ExpectChain;
163
- lessThan(num: number): ExpectChain;
164
- closeTo(expected: number, delta: number): ExpectChain;
165
- approximately(expected: number, delta: number): ExpectChain;
166
- within(start: number, end: number): ExpectChain;
167
- a(type: string): ExpectChain;
168
- an(type: string): ExpectChain;
169
- "throw"(expected?: any): ExpectChain;
170
- throws(expected?: any): ExpectChain;
171
- instanceOf(constructor: Function): ExpectChain;
172
- "instanceof"(constructor: Function): ExpectChain;
173
- true: ExpectChain;
174
- false: ExpectChain;
175
- null: ExpectChain;
176
- undefined: ExpectChain;
177
- empty: ExpectChain;
178
- length(len: number): ExpectChain;
179
- lengthOf(len: number): ExpectChain;
180
- members(arr: any[]): ExpectChain;
181
- keys(...args: any[]): ExpectChain;
182
- string(substr: string): ExpectChain;
183
- }
184
- /**
185
- * Create Chai-style expect chain for assertions
186
- */
187
- export declare function createExpectChain(value: any): ExpectChain;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@http-forge/core",
3
- "version": "0.6.22.beta.1",
3
+ "version": "0.6.22.beta.3",
4
4
  "description": "Headless Postman-compatible API testing engine for Node.js, CI/CD, OpenAPI workflows, and HTTP Forge automation",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",