@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.
@@ -409,10 +409,15 @@ type IgniterCallerMockStatus<TSchemas extends IgniterCallerSchemaMap, TPath exte
409
409
  * Prefers 200, then 201, then the first available status.
410
410
  */
411
411
  type IgniterCallerMockDefaultStatus<TSchemas extends IgniterCallerSchemaMap, TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>> = 200 extends IgniterCallerMockStatus<TSchemas, TPath, TMethod> ? 200 : 201 extends IgniterCallerMockStatus<TSchemas, TPath, TMethod> ? 201 : IgniterCallerMockStatus<TSchemas, TPath, TMethod>;
412
+ type IgniterCallerMockRequestBodyField<TSchemas extends IgniterCallerSchemaMap, TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>> = [SchemaMapRequestType<TSchemas, TPath, TMethod>] extends [never] ? {
413
+ body?: undefined;
414
+ } : {
415
+ body: SchemaMapRequestType<TSchemas, TPath, TMethod>;
416
+ };
412
417
  /**
413
418
  * Full request context passed to mock handlers.
414
419
  */
415
- interface IgniterCallerMockRequest<TSchemas extends IgniterCallerSchemaMap, TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>> {
420
+ type IgniterCallerMockRequest<TSchemas extends IgniterCallerSchemaMap, TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>> = {
416
421
  method: TMethod;
417
422
  path: TPath;
418
423
  url: string;
@@ -421,13 +426,12 @@ interface IgniterCallerMockRequest<TSchemas extends IgniterCallerSchemaMap, TPat
421
426
  headers: Record<string, string>;
422
427
  query: Record<string, string | number | boolean>;
423
428
  params: EndpointInfo<TSchemas, TPath, TMethod>['params'];
424
- body?: SchemaMapRequestType<TSchemas, TPath, TMethod>;
425
429
  timeoutMs?: number;
426
430
  cache?: RequestCache;
427
431
  cacheKey?: string;
428
432
  staleTime?: number;
429
433
  responseTypeSchema?: StandardSchemaV1 | z.ZodSchema<any>;
430
- }
434
+ } & IgniterCallerMockRequestBodyField<TSchemas, TPath, TMethod>;
431
435
  /**
432
436
  * Resolved mock handler for a given request path+method.
433
437
  */
@@ -494,6 +498,7 @@ type IgniterCallerMockRegistry<TSchemas extends IgniterCallerSchemaMap> = Partia
494
498
  */
495
499
  interface IgniterCallerMockConfig<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap> {
496
500
  enabled: boolean;
501
+ delay?: number;
497
502
  mock: IIgniterCallerMockManager<TSchemas>;
498
503
  }
499
504
 
@@ -1118,4 +1123,4 @@ declare class IgniterCallerManager<TSchemas extends IgniterCallerSchemaMap> impl
1118
1123
  static emitEvent(url: string, method: string, result: IgniterCallerApiResponse<any>): Promise<void>;
1119
1124
  }
1120
1125
 
1121
- export { type SchemaMapEndpoint as $, type IgniterCallerMockPathDefinition as A, type IgniterCallerFileResponse as B, IgniterCallerRequestBuilder as C, type DeletePaths as D, type EndpointInfo as E, type IgniterCallerHttpMethod as F, type GetPaths as G, type HeadPaths as H, IgniterCallerManager as I, type IgniterCallerBaseRequestOptions as J, type IgniterCallerRequestOptions as K, type IgniterCallerDirectRequestOptions as L, type IgniterCallerResponseContentType as M, type IgniterCallerValidatableContentType as N, type IgniterCallerResponseMarker as O, type PostPaths as P, type IgniterCallerRetryOptions as Q, type ResolveStatusKey as R, type SchemaArray as S, type TypedRequestBuilder as T, type ExtractPathParams as U, type InferRequestType as V, type InferResponseType as W, type InferSuccessResponseType as X, type InferAllResponseTypes as Y, type SchemaMapMethods as Z, type PathsForMethod as _, type IgniterCallerApiResponse as a, type SchemaMapResponseType as a0, type SchemaMapRequestType as a1, type SchemaMapResponses as a2, type SchemaMapResponsesType as a3, type SchemaMapRequestSchema as a4, type SchemaMapResponseSchema as a5, type IgniterCallerSchemaInfer as a6, type IgniterCallerSchemaGetters as a7, type IgniterCallerMockStatus as a8, type IgniterCallerMockDefaultStatus as a9, type IgniterCallerMockRequest as aa, type IgniterCallerMockResponseForStatus as ab, type IgniterCallerMockResponseDefault as ac, type IgniterCallerMockResponse as ad, type IgniterCallerMockHandler as ae, type IgniterCallerMockHandlerDefinition as af, type IgniterCallerBuilderState as ag, type IgniterCallerRequestBuilderParams as ah, type IgniterCallerMethodRequestBuilder as ai, type InferSuccessResponse as aj, type GetEndpoint as ak, type IIgniterCallerManager as al, type IgniterCallerSchemaMap as b, type IgniterCallerSchemaMethod as c, type InferResponse as d, type IgniterCallerTypedRequestBuilder as e, type PutPaths as f, type PatchPaths as g, type IgniterCallerUrlPattern as h, type IgniterCallerEventCallback as i, type IIgniterCallerMockManager as j, type IgniterCallerMockRegistry as k, type IgniterCallerMockResolvedHandler as l, type IgniterCallerRequestInterceptor as m, type IgniterCallerResponseInterceptor as n, type IgniterCallerSchemaInput as o, type IgniterCallerSchemaValidationOptions as p, type IgniterCallerSchemaMapFrom as q, type IgniterCallerMockConfig as r, type IgniterCallerEndpointSchema as s, type IgniterCallerSchemaRegistry as t, type SchemaNullable as u, type SchemaOptional as v, type SchemaRecord as w, type IgniterCallerSchemaEndpointConfig as x, type IgniterCallerSchemaBuildResult as y, type SchemaMapPaths as z };
1126
+ export { type SchemaMapRequestType as $, IgniterCallerRequestBuilder as A, type IgniterCallerHttpMethod as B, type IgniterCallerBaseRequestOptions as C, type DeletePaths as D, type EndpointInfo as E, type IgniterCallerRequestOptions as F, type GetPaths as G, type HeadPaths as H, IgniterCallerManager as I, type IgniterCallerDirectRequestOptions as J, type IgniterCallerResponseContentType as K, type IgniterCallerValidatableContentType as L, type IgniterCallerResponseMarker as M, type IgniterCallerRetryOptions as N, type ExtractPathParams as O, type PostPaths as P, type InferRequestType as Q, type ResolveStatusKey as R, type SchemaArray as S, type TypedRequestBuilder as T, type InferResponseType as U, type InferSuccessResponseType as V, type InferAllResponseTypes as W, type SchemaMapMethods as X, type PathsForMethod as Y, type SchemaMapEndpoint as Z, type SchemaMapResponseType as _, type IgniterCallerApiResponse as a, type SchemaMapResponses as a0, type SchemaMapResponsesType as a1, type SchemaMapRequestSchema as a2, type SchemaMapResponseSchema as a3, type IgniterCallerSchemaInfer as a4, type IgniterCallerSchemaGetters as a5, type IgniterCallerSchemaInput as a6, type IgniterCallerSchemaMapFrom as a7, type IgniterCallerMockStatus as a8, type IgniterCallerMockDefaultStatus as a9, type IgniterCallerMockRequest as aa, type IgniterCallerMockResponseForStatus as ab, type IgniterCallerMockResponseDefault as ac, type IgniterCallerMockResponse as ad, type IgniterCallerMockHandler as ae, type IgniterCallerMockHandlerDefinition as af, type IgniterCallerBuilderState as ag, type IgniterCallerRequestBuilderParams as ah, type IgniterCallerMethodRequestBuilder as ai, type InferSuccessResponse as aj, type GetEndpoint as ak, type IIgniterCallerManager as al, type IgniterCallerSchemaMap as b, type IgniterCallerSchemaMethod as c, type InferResponse as d, type IgniterCallerTypedRequestBuilder as e, type PutPaths as f, type PatchPaths as g, type IgniterCallerUrlPattern as h, type IgniterCallerEventCallback as i, type IIgniterCallerMockManager as j, type IgniterCallerMockRegistry as k, type IgniterCallerMockResolvedHandler as l, type IgniterCallerRequestInterceptor as m, type IgniterCallerResponseInterceptor as n, type IgniterCallerSchemaValidationOptions as o, type IgniterCallerSchemaRegistry as p, type IgniterCallerSchemaBuildResult as q, type IgniterCallerMockConfig as r, type IgniterCallerEndpointSchema as s, type SchemaNullable as t, type SchemaOptional as u, type SchemaRecord as v, type IgniterCallerSchemaEndpointConfig as w, type SchemaMapPaths as x, type IgniterCallerMockPathDefinition as y, type IgniterCallerFileResponse as z };
@@ -409,10 +409,15 @@ type IgniterCallerMockStatus<TSchemas extends IgniterCallerSchemaMap, TPath exte
409
409
  * Prefers 200, then 201, then the first available status.
410
410
  */
411
411
  type IgniterCallerMockDefaultStatus<TSchemas extends IgniterCallerSchemaMap, TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>> = 200 extends IgniterCallerMockStatus<TSchemas, TPath, TMethod> ? 200 : 201 extends IgniterCallerMockStatus<TSchemas, TPath, TMethod> ? 201 : IgniterCallerMockStatus<TSchemas, TPath, TMethod>;
412
+ type IgniterCallerMockRequestBodyField<TSchemas extends IgniterCallerSchemaMap, TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>> = [SchemaMapRequestType<TSchemas, TPath, TMethod>] extends [never] ? {
413
+ body?: undefined;
414
+ } : {
415
+ body: SchemaMapRequestType<TSchemas, TPath, TMethod>;
416
+ };
412
417
  /**
413
418
  * Full request context passed to mock handlers.
414
419
  */
415
- interface IgniterCallerMockRequest<TSchemas extends IgniterCallerSchemaMap, TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>> {
420
+ type IgniterCallerMockRequest<TSchemas extends IgniterCallerSchemaMap, TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>> = {
416
421
  method: TMethod;
417
422
  path: TPath;
418
423
  url: string;
@@ -421,13 +426,12 @@ interface IgniterCallerMockRequest<TSchemas extends IgniterCallerSchemaMap, TPat
421
426
  headers: Record<string, string>;
422
427
  query: Record<string, string | number | boolean>;
423
428
  params: EndpointInfo<TSchemas, TPath, TMethod>['params'];
424
- body?: SchemaMapRequestType<TSchemas, TPath, TMethod>;
425
429
  timeoutMs?: number;
426
430
  cache?: RequestCache;
427
431
  cacheKey?: string;
428
432
  staleTime?: number;
429
433
  responseTypeSchema?: StandardSchemaV1 | z.ZodSchema<any>;
430
- }
434
+ } & IgniterCallerMockRequestBodyField<TSchemas, TPath, TMethod>;
431
435
  /**
432
436
  * Resolved mock handler for a given request path+method.
433
437
  */
@@ -494,6 +498,7 @@ type IgniterCallerMockRegistry<TSchemas extends IgniterCallerSchemaMap> = Partia
494
498
  */
495
499
  interface IgniterCallerMockConfig<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap> {
496
500
  enabled: boolean;
501
+ delay?: number;
497
502
  mock: IIgniterCallerMockManager<TSchemas>;
498
503
  }
499
504
 
@@ -1118,4 +1123,4 @@ declare class IgniterCallerManager<TSchemas extends IgniterCallerSchemaMap> impl
1118
1123
  static emitEvent(url: string, method: string, result: IgniterCallerApiResponse<any>): Promise<void>;
1119
1124
  }
1120
1125
 
1121
- export { type SchemaMapEndpoint as $, type IgniterCallerMockPathDefinition as A, type IgniterCallerFileResponse as B, IgniterCallerRequestBuilder as C, type DeletePaths as D, type EndpointInfo as E, type IgniterCallerHttpMethod as F, type GetPaths as G, type HeadPaths as H, IgniterCallerManager as I, type IgniterCallerBaseRequestOptions as J, type IgniterCallerRequestOptions as K, type IgniterCallerDirectRequestOptions as L, type IgniterCallerResponseContentType as M, type IgniterCallerValidatableContentType as N, type IgniterCallerResponseMarker as O, type PostPaths as P, type IgniterCallerRetryOptions as Q, type ResolveStatusKey as R, type SchemaArray as S, type TypedRequestBuilder as T, type ExtractPathParams as U, type InferRequestType as V, type InferResponseType as W, type InferSuccessResponseType as X, type InferAllResponseTypes as Y, type SchemaMapMethods as Z, type PathsForMethod as _, type IgniterCallerApiResponse as a, type SchemaMapResponseType as a0, type SchemaMapRequestType as a1, type SchemaMapResponses as a2, type SchemaMapResponsesType as a3, type SchemaMapRequestSchema as a4, type SchemaMapResponseSchema as a5, type IgniterCallerSchemaInfer as a6, type IgniterCallerSchemaGetters as a7, type IgniterCallerMockStatus as a8, type IgniterCallerMockDefaultStatus as a9, type IgniterCallerMockRequest as aa, type IgniterCallerMockResponseForStatus as ab, type IgniterCallerMockResponseDefault as ac, type IgniterCallerMockResponse as ad, type IgniterCallerMockHandler as ae, type IgniterCallerMockHandlerDefinition as af, type IgniterCallerBuilderState as ag, type IgniterCallerRequestBuilderParams as ah, type IgniterCallerMethodRequestBuilder as ai, type InferSuccessResponse as aj, type GetEndpoint as ak, type IIgniterCallerManager as al, type IgniterCallerSchemaMap as b, type IgniterCallerSchemaMethod as c, type InferResponse as d, type IgniterCallerTypedRequestBuilder as e, type PutPaths as f, type PatchPaths as g, type IgniterCallerUrlPattern as h, type IgniterCallerEventCallback as i, type IIgniterCallerMockManager as j, type IgniterCallerMockRegistry as k, type IgniterCallerMockResolvedHandler as l, type IgniterCallerRequestInterceptor as m, type IgniterCallerResponseInterceptor as n, type IgniterCallerSchemaInput as o, type IgniterCallerSchemaValidationOptions as p, type IgniterCallerSchemaMapFrom as q, type IgniterCallerMockConfig as r, type IgniterCallerEndpointSchema as s, type IgniterCallerSchemaRegistry as t, type SchemaNullable as u, type SchemaOptional as v, type SchemaRecord as w, type IgniterCallerSchemaEndpointConfig as x, type IgniterCallerSchemaBuildResult as y, type SchemaMapPaths as z };
1126
+ export { type SchemaMapRequestType as $, IgniterCallerRequestBuilder as A, type IgniterCallerHttpMethod as B, type IgniterCallerBaseRequestOptions as C, type DeletePaths as D, type EndpointInfo as E, type IgniterCallerRequestOptions as F, type GetPaths as G, type HeadPaths as H, IgniterCallerManager as I, type IgniterCallerDirectRequestOptions as J, type IgniterCallerResponseContentType as K, type IgniterCallerValidatableContentType as L, type IgniterCallerResponseMarker as M, type IgniterCallerRetryOptions as N, type ExtractPathParams as O, type PostPaths as P, type InferRequestType as Q, type ResolveStatusKey as R, type SchemaArray as S, type TypedRequestBuilder as T, type InferResponseType as U, type InferSuccessResponseType as V, type InferAllResponseTypes as W, type SchemaMapMethods as X, type PathsForMethod as Y, type SchemaMapEndpoint as Z, type SchemaMapResponseType as _, type IgniterCallerApiResponse as a, type SchemaMapResponses as a0, type SchemaMapResponsesType as a1, type SchemaMapRequestSchema as a2, type SchemaMapResponseSchema as a3, type IgniterCallerSchemaInfer as a4, type IgniterCallerSchemaGetters as a5, type IgniterCallerSchemaInput as a6, type IgniterCallerSchemaMapFrom as a7, type IgniterCallerMockStatus as a8, type IgniterCallerMockDefaultStatus as a9, type IgniterCallerMockRequest as aa, type IgniterCallerMockResponseForStatus as ab, type IgniterCallerMockResponseDefault as ac, type IgniterCallerMockResponse as ad, type IgniterCallerMockHandler as ae, type IgniterCallerMockHandlerDefinition as af, type IgniterCallerBuilderState as ag, type IgniterCallerRequestBuilderParams as ah, type IgniterCallerMethodRequestBuilder as ai, type InferSuccessResponse as aj, type GetEndpoint as ak, type IIgniterCallerManager as al, type IgniterCallerSchemaMap as b, type IgniterCallerSchemaMethod as c, type InferResponse as d, type IgniterCallerTypedRequestBuilder as e, type PutPaths as f, type PatchPaths as g, type IgniterCallerUrlPattern as h, type IgniterCallerEventCallback as i, type IIgniterCallerMockManager as j, type IgniterCallerMockRegistry as k, type IgniterCallerMockResolvedHandler as l, type IgniterCallerRequestInterceptor as m, type IgniterCallerResponseInterceptor as n, type IgniterCallerSchemaValidationOptions as o, type IgniterCallerSchemaRegistry as p, type IgniterCallerSchemaBuildResult as q, type IgniterCallerMockConfig as r, type IgniterCallerEndpointSchema as s, type SchemaNullable as t, type SchemaOptional as u, type SchemaRecord as v, type IgniterCallerSchemaEndpointConfig as w, type SchemaMapPaths as x, type IgniterCallerMockPathDefinition as y, type IgniterCallerFileResponse as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igniter-js/caller",
3
- "version": "0.1.5",
3
+ "version": "0.1.52",
4
4
  "description": "Type-safe HTTP client for Igniter.js with interceptors, retries, caching, and StandardSchema validation",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",