@igniter-js/caller 0.1.5 → 0.1.52
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/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +6 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -41
- package/dist/index.mjs.map +1 -1
- package/dist/{manager-CVi9utzy.d.ts → manager-DQcuAp3y.d.ts} +9 -4
- package/dist/{manager-DWvX2zsz.d.mts → manager-DXmJbnQY.d.mts} +9 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1417,8 +1417,9 @@ var IgniterCallerRequestBuilder = class {
|
|
|
1417
1417
|
resolved.handler,
|
|
1418
1418
|
mockRequest
|
|
1419
1419
|
);
|
|
1420
|
-
|
|
1421
|
-
|
|
1420
|
+
const delayMs = response.delayMs ?? this.mock?.delay;
|
|
1421
|
+
if (delayMs && delayMs > 0) {
|
|
1422
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
1422
1423
|
}
|
|
1423
1424
|
const status = response.status;
|
|
1424
1425
|
const headers = new Headers(response.headers);
|
|
@@ -2155,46 +2156,15 @@ var IgniterCallerBuilder = class _IgniterCallerBuilder {
|
|
|
2155
2156
|
storeOptions: options
|
|
2156
2157
|
});
|
|
2157
2158
|
}
|
|
2158
|
-
/**
|
|
2159
|
-
* Configures schema-based type safety and validation.
|
|
2160
|
-
*
|
|
2161
|
-
* Enables automatic type inference for requests/responses based on
|
|
2162
|
-
* route and method, with optional runtime validation via StandardSchemaV1
|
|
2163
|
-
* (Zod is supported).
|
|
2164
|
-
*
|
|
2165
|
-
* @param schemas - Schema map keyed by URL path and method.
|
|
2166
|
-
* @param validation - Validation options for request/response checks.
|
|
2167
|
-
*
|
|
2168
|
-
* @example
|
|
2169
|
-
* ```ts
|
|
2170
|
-
* const api = IgniterCaller.create()
|
|
2171
|
-
* .withSchemas({
|
|
2172
|
-
* '/users': {
|
|
2173
|
-
* GET: {
|
|
2174
|
-
* responses: {
|
|
2175
|
-
* 200: z.array(UserSchema),
|
|
2176
|
-
* 401: ErrorSchema,
|
|
2177
|
-
* },
|
|
2178
|
-
* },
|
|
2179
|
-
* POST: {
|
|
2180
|
-
* request: CreateUserSchema,
|
|
2181
|
-
* responses: {
|
|
2182
|
-
* 201: UserSchema,
|
|
2183
|
-
* 400: ValidationErrorSchema,
|
|
2184
|
-
* },
|
|
2185
|
-
* },
|
|
2186
|
-
* },
|
|
2187
|
-
* })
|
|
2188
|
-
* .build()
|
|
2189
|
-
* ```
|
|
2190
|
-
*/
|
|
2191
2159
|
withSchemas(schemas, validation) {
|
|
2192
2160
|
const nextState = {
|
|
2193
2161
|
...this.state,
|
|
2194
2162
|
schemas,
|
|
2195
2163
|
schemaValidation: validation
|
|
2196
2164
|
};
|
|
2197
|
-
return new _IgniterCallerBuilder(
|
|
2165
|
+
return new _IgniterCallerBuilder(
|
|
2166
|
+
nextState
|
|
2167
|
+
);
|
|
2198
2168
|
}
|
|
2199
2169
|
/**
|
|
2200
2170
|
* Attaches telemetry for request monitoring and observability.
|
|
@@ -2511,11 +2481,6 @@ var IgniterCallerMockBuilder = class _IgniterCallerMockBuilder {
|
|
|
2511
2481
|
static create() {
|
|
2512
2482
|
return new _IgniterCallerMockBuilder({ registry: {} });
|
|
2513
2483
|
}
|
|
2514
|
-
/**
|
|
2515
|
-
* Sets schemas to enable typed mock definitions.
|
|
2516
|
-
*
|
|
2517
|
-
* @param _schemas - Schema map or build result.
|
|
2518
|
-
*/
|
|
2519
2484
|
withSchemas(_schemas) {
|
|
2520
2485
|
return new _IgniterCallerMockBuilder({
|
|
2521
2486
|
registry: this.state.registry
|