@igniter-js/caller 0.1.5 → 0.1.51

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.
@@ -389,7 +389,7 @@ type IgniterCallerSchemaBuildResult<TSchemas extends IgniterCallerSchemaMap, TRe
389
389
  /**
390
390
  * Accepted input types for `withSchemas`.
391
391
  */
392
- type IgniterCallerSchemaInput<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap, TRegistry extends IgniterCallerSchemaRegistry = IgniterCallerSchemaRegistry> = TSchemas | IgniterCallerSchemaBuildResult<TSchemas, TRegistry>;
392
+ type IgniterCallerSchemaInput<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap, TRegistry extends IgniterCallerSchemaRegistry = IgniterCallerSchemaRegistry> = TSchemas | IgniterCallerSchemaBuildResult<TSchemas, TRegistry> | IgniterCallerSchemaBuildResult<any, any>;
393
393
  /**
394
394
  * Extracts the schema map from a build result or raw map.
395
395
  */
@@ -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
 
@@ -389,7 +389,7 @@ type IgniterCallerSchemaBuildResult<TSchemas extends IgniterCallerSchemaMap, TRe
389
389
  /**
390
390
  * Accepted input types for `withSchemas`.
391
391
  */
392
- type IgniterCallerSchemaInput<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap, TRegistry extends IgniterCallerSchemaRegistry = IgniterCallerSchemaRegistry> = TSchemas | IgniterCallerSchemaBuildResult<TSchemas, TRegistry>;
392
+ type IgniterCallerSchemaInput<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap, TRegistry extends IgniterCallerSchemaRegistry = IgniterCallerSchemaRegistry> = TSchemas | IgniterCallerSchemaBuildResult<TSchemas, TRegistry> | IgniterCallerSchemaBuildResult<any, any>;
393
393
  /**
394
394
  * Extracts the schema map from a build result or raw map.
395
395
  */
@@ -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
 
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.51",
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",