@igniter-js/caller 0.1.3 → 0.1.4
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/AGENTS.md +2275 -172
- package/CHANGELOG.md +13 -0
- package/README.md +108 -14
- package/dist/adapters/index.d.mts +1 -0
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.js +91 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/index.mjs +89 -0
- package/dist/adapters/index.mjs.map +1 -0
- package/dist/index-COZVROi_.d.mts +121 -0
- package/dist/index-COZVROi_.d.ts +121 -0
- package/dist/index.d.mts +754 -280
- package/dist/index.d.ts +754 -280
- package/dist/index.js +992 -241
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +989 -242
- package/dist/index.mjs.map +1 -1
- package/dist/telemetry/index.d.mts +100 -0
- package/dist/telemetry/index.d.ts +100 -0
- package/dist/telemetry/index.js +54 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/index.mjs +52 -0
- package/dist/telemetry/index.mjs.map +1 -0
- package/package.json +24 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { StandardSchemaV1,
|
|
1
|
+
import { StandardSchemaV1, IgniterError, IgniterLogger } from '@igniter-js/core';
|
|
2
|
+
import { IgniterTelemetryManager } from '@igniter-js/telemetry';
|
|
2
3
|
import { z } from 'zod';
|
|
4
|
+
import { I as IgniterCallerStoreAdapter, a as IgniterCallerStoreOptions } from './index-COZVROi_.js';
|
|
5
|
+
export { M as MockCallerStoreAdapter } from './index-COZVROi_.js';
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Supported HTTP methods for `IgniterCaller` requests.
|
|
@@ -42,7 +45,7 @@ interface IgniterCallerRequestOptions<TBody = unknown> extends IgniterCallerBase
|
|
|
42
45
|
url: string;
|
|
43
46
|
body?: TBody;
|
|
44
47
|
params?: Record<string, string | number | boolean>;
|
|
45
|
-
responseSchema?: z.ZodSchema<any
|
|
48
|
+
responseSchema?: z.ZodSchema<any> | StandardSchemaV1;
|
|
46
49
|
cache?: RequestCache;
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
@@ -60,8 +63,8 @@ interface IgniterCallerDirectRequestOptions<TBody = unknown> extends IgniterCall
|
|
|
60
63
|
params?: Record<string, string | number | boolean>;
|
|
61
64
|
/** Cookies to send with the request */
|
|
62
65
|
cookies?: Record<string, string>;
|
|
63
|
-
/** Response validation schema (Zod) */
|
|
64
|
-
responseSchema?: z.ZodSchema<any
|
|
66
|
+
/** Response validation schema (Zod or any StandardSchemaV1 implementation) */
|
|
67
|
+
responseSchema?: z.ZodSchema<any> | StandardSchemaV1;
|
|
65
68
|
/** Cache strategy */
|
|
66
69
|
cache?: RequestCache;
|
|
67
70
|
/** Cache key for stale-while-revalidate */
|
|
@@ -78,8 +81,10 @@ interface IgniterCallerDirectRequestOptions<TBody = unknown> extends IgniterCall
|
|
|
78
81
|
* Response object containing either successful data or an error.
|
|
79
82
|
*/
|
|
80
83
|
interface IgniterCallerApiResponse<T> {
|
|
84
|
+
/** Parsed response data when the request succeeds. */
|
|
81
85
|
data?: T;
|
|
82
|
-
|
|
86
|
+
/** Error instance when the request fails. */
|
|
87
|
+
error?: IgniterError;
|
|
83
88
|
/** HTTP status code from the response */
|
|
84
89
|
status?: number;
|
|
85
90
|
/** Response headers */
|
|
@@ -90,7 +95,9 @@ interface IgniterCallerApiResponse<T> {
|
|
|
90
95
|
* @deprecated Use execute() with responseType<File>() instead
|
|
91
96
|
*/
|
|
92
97
|
interface IgniterCallerFileResponse {
|
|
98
|
+
/** File instance when download succeeds. */
|
|
93
99
|
file: File | null;
|
|
100
|
+
/** Error instance when download fails. */
|
|
94
101
|
error: Error | null;
|
|
95
102
|
}
|
|
96
103
|
/**
|
|
@@ -125,11 +132,17 @@ type IgniterCallerSchemaMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | '
|
|
|
125
132
|
*
|
|
126
133
|
* Maps status codes to response schemas with optional request schema.
|
|
127
134
|
*/
|
|
128
|
-
type IgniterCallerEndpointSchema<TRequest extends StandardSchemaV1 =
|
|
135
|
+
type IgniterCallerEndpointSchema<TRequest extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined, TResponses extends Record<number | string, StandardSchemaV1> = Record<number | string, StandardSchemaV1>> = {
|
|
129
136
|
/** Request body schema (optional) */
|
|
130
137
|
request?: TRequest;
|
|
131
138
|
/** Response schemas by status code */
|
|
132
139
|
responses: TResponses;
|
|
140
|
+
/** Optional summary or description for docs */
|
|
141
|
+
doc?: string;
|
|
142
|
+
/** Optional tags for grouping */
|
|
143
|
+
tags?: string[];
|
|
144
|
+
/** Optional operation identifier */
|
|
145
|
+
operationId?: string;
|
|
133
146
|
};
|
|
134
147
|
/**
|
|
135
148
|
* Schema map for multiple endpoints.
|
|
@@ -166,6 +179,10 @@ type IgniterCallerEndpointSchema<TRequest extends StandardSchemaV1 = any, TRespo
|
|
|
166
179
|
* ```
|
|
167
180
|
*/
|
|
168
181
|
type IgniterCallerSchemaMap = Record<string, Partial<Record<IgniterCallerSchemaMethod, IgniterCallerEndpointSchema<any, any>>>>;
|
|
182
|
+
/**
|
|
183
|
+
* Resolves a status key against a response map.
|
|
184
|
+
*/
|
|
185
|
+
type ResolveStatusKey<TResponses extends Record<number | string, StandardSchemaV1>, TStatus extends number | string> = Extract<keyof TResponses, TStatus | `${TStatus}`>;
|
|
169
186
|
/**
|
|
170
187
|
* Extract path parameters from a URL pattern.
|
|
171
188
|
*
|
|
@@ -187,15 +204,15 @@ type InferRequestType<T> = T extends IgniterCallerEndpointSchema<infer R, any> ?
|
|
|
187
204
|
/**
|
|
188
205
|
* Infer response type by status code from endpoint schema.
|
|
189
206
|
*/
|
|
190
|
-
type InferResponseType<T, Status extends number> = T extends IgniterCallerEndpointSchema<any, infer Responses> ? Status extends keyof Responses ? Responses[Status] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Responses[Status]> : never : never : never;
|
|
207
|
+
type InferResponseType<T, Status extends number | string> = T extends IgniterCallerEndpointSchema<any, infer Responses> ? ResolveStatusKey<Responses, Status> extends keyof Responses ? Responses[ResolveStatusKey<Responses, Status>] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Responses[ResolveStatusKey<Responses, Status>]> : never : never : never;
|
|
191
208
|
/**
|
|
192
209
|
* Infer the success response type (status 200 or 201) from endpoint schema.
|
|
193
210
|
*/
|
|
194
|
-
type InferSuccessResponseType<T> = T extends IgniterCallerEndpointSchema<any, infer Responses> ? 200 extends keyof Responses ? Responses[200] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Responses[200]> : never : 201 extends keyof Responses ? Responses[201] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Responses[201]> : never : never : never;
|
|
211
|
+
type InferSuccessResponseType<T> = T extends IgniterCallerEndpointSchema<any, infer Responses> ? ResolveStatusKey<Responses, 200> extends keyof Responses ? Responses[ResolveStatusKey<Responses, 200>] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Responses[ResolveStatusKey<Responses, 200>]> : never : ResolveStatusKey<Responses, 201> extends keyof Responses ? Responses[ResolveStatusKey<Responses, 201>] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Responses[ResolveStatusKey<Responses, 201>]> : never : never : never;
|
|
195
212
|
/**
|
|
196
213
|
* Infer all possible response types (union) from endpoint schema.
|
|
197
214
|
*/
|
|
198
|
-
type InferAllResponseTypes<T> = T extends IgniterCallerEndpointSchema<any, infer Responses> ? Responses extends Record<number, StandardSchemaV1> ? {
|
|
215
|
+
type InferAllResponseTypes<T> = T extends IgniterCallerEndpointSchema<any, infer Responses> ? Responses extends Record<number | string, StandardSchemaV1> ? {
|
|
199
216
|
[K in keyof Responses]: Responses[K] extends StandardSchemaV1 ? {
|
|
200
217
|
status: K;
|
|
201
218
|
data: StandardSchemaV1.InferOutput<Responses[K]>;
|
|
@@ -246,7 +263,7 @@ type SchemaMapEndpoint<TSchemas extends IgniterCallerSchemaMap, TPath extends ke
|
|
|
246
263
|
/**
|
|
247
264
|
* Infer response type from schema map for a specific path, method, and status.
|
|
248
265
|
*/
|
|
249
|
-
type SchemaMapResponseType<TSchemas extends IgniterCallerSchemaMap, TPath extends keyof TSchemas, TMethod extends keyof TSchemas[TPath], TStatus extends number = 200> = TSchemas[TPath][TMethod] extends IgniterCallerEndpointSchema<any, infer Responses> ? TStatus extends keyof Responses ? Responses[TStatus] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Responses[TStatus]> : never : never : never;
|
|
266
|
+
type SchemaMapResponseType<TSchemas extends IgniterCallerSchemaMap, TPath extends keyof TSchemas, TMethod extends keyof TSchemas[TPath], TStatus extends number | string = 200> = TSchemas[TPath][TMethod] extends IgniterCallerEndpointSchema<any, infer Responses> ? ResolveStatusKey<Responses, TStatus> extends keyof Responses ? Responses[ResolveStatusKey<Responses, TStatus>] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Responses[ResolveStatusKey<Responses, TStatus>]> : never : never : never;
|
|
250
267
|
/**
|
|
251
268
|
* Infer request type from schema map for a specific path and method.
|
|
252
269
|
*/
|
|
@@ -289,159 +306,6 @@ interface IgniterCallerSchemaValidationOptions {
|
|
|
289
306
|
}) => void;
|
|
290
307
|
}
|
|
291
308
|
|
|
292
|
-
/**
|
|
293
|
-
* Store adapter interface compatible with Igniter.js Store.
|
|
294
|
-
*
|
|
295
|
-
* This allows IgniterCaller to use any store implementation (Redis, in-memory, etc.)
|
|
296
|
-
* for persistent caching across requests and deployments.
|
|
297
|
-
*/
|
|
298
|
-
interface IgniterCallerStoreAdapter<TClient = any> {
|
|
299
|
-
/** The underlying client instance (e.g., Redis client). */
|
|
300
|
-
readonly client: TClient;
|
|
301
|
-
/**
|
|
302
|
-
* Retrieves a value from the store by its key.
|
|
303
|
-
* @param key The key to retrieve.
|
|
304
|
-
* @returns The value if found (auto-deserialized), otherwise null.
|
|
305
|
-
*/
|
|
306
|
-
get<T = any>(key: string): Promise<T | null>;
|
|
307
|
-
/**
|
|
308
|
-
* Stores a value in the store.
|
|
309
|
-
* @param key The key to store the value under.
|
|
310
|
-
* @param value The value to store (will be auto-serialized).
|
|
311
|
-
* @param options Configuration options, such as TTL.
|
|
312
|
-
*/
|
|
313
|
-
set(key: string, value: any, options?: {
|
|
314
|
-
ttl?: number;
|
|
315
|
-
[key: string]: any;
|
|
316
|
-
}): Promise<void>;
|
|
317
|
-
/**
|
|
318
|
-
* Deletes a key from the store.
|
|
319
|
-
* @param key The key to delete.
|
|
320
|
-
*/
|
|
321
|
-
delete(key: string): Promise<void>;
|
|
322
|
-
/**
|
|
323
|
-
* Checks if a key exists in the store.
|
|
324
|
-
* @param key The key to check.
|
|
325
|
-
* @returns `true` if the key exists, otherwise `false`.
|
|
326
|
-
*/
|
|
327
|
-
has(key: string): Promise<boolean>;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Configuration options for store-based caching.
|
|
331
|
-
*/
|
|
332
|
-
interface IgniterCallerStoreOptions {
|
|
333
|
-
/** Default TTL in seconds for cached entries (default: 3600 = 1 hour). */
|
|
334
|
-
ttl?: number;
|
|
335
|
-
/** Prefix for all cache keys (default: 'igniter:caller:'). */
|
|
336
|
-
keyPrefix?: string;
|
|
337
|
-
/** Whether to fallback to fetch cache when store is unavailable (default: true). */
|
|
338
|
-
fallbackToFetch?: boolean;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
type IgniterCallerBuilderState<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap> = {
|
|
342
|
-
baseURL?: string;
|
|
343
|
-
headers?: Record<string, string>;
|
|
344
|
-
cookies?: Record<string, string>;
|
|
345
|
-
logger?: IgniterLogger;
|
|
346
|
-
requestInterceptors?: IgniterCallerRequestInterceptor[];
|
|
347
|
-
responseInterceptors?: IgniterCallerResponseInterceptor[];
|
|
348
|
-
store?: IgniterCallerStoreAdapter;
|
|
349
|
-
storeOptions?: IgniterCallerStoreOptions;
|
|
350
|
-
schemas?: TSchemas;
|
|
351
|
-
schemaValidation?: IgniterCallerSchemaValidationOptions;
|
|
352
|
-
};
|
|
353
|
-
type IgniterCallerBuilderFactory<TCaller, TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap> = (state: IgniterCallerBuilderState<TSchemas>) => TCaller;
|
|
354
|
-
/**
|
|
355
|
-
* Utility type to replace the schema type in a caller.
|
|
356
|
-
* Used by withSchemas to properly type the returned caller.
|
|
357
|
-
*/
|
|
358
|
-
type ReplaceCallerSchema<TCaller, TNewSchemas extends IgniterCallerSchemaMap> = TCaller extends {
|
|
359
|
-
schemas?: infer _;
|
|
360
|
-
} ? Omit<TCaller, 'schemas'> & {
|
|
361
|
-
schemas?: TNewSchemas;
|
|
362
|
-
} : TCaller;
|
|
363
|
-
/**
|
|
364
|
-
* Builder used by developers to initialize the `IgniterCaller` client.
|
|
365
|
-
*
|
|
366
|
-
* This API is designed to remain stable when extracted to `@igniter-js/caller`.
|
|
367
|
-
*/
|
|
368
|
-
declare class IgniterCallerBuilder<TCaller = unknown, TSchemas extends IgniterCallerSchemaMap = any> {
|
|
369
|
-
private readonly state;
|
|
370
|
-
private readonly factory;
|
|
371
|
-
private constructor();
|
|
372
|
-
/**
|
|
373
|
-
* Creates a new builder instance.
|
|
374
|
-
*/
|
|
375
|
-
static create<TCaller, TSchemas extends IgniterCallerSchemaMap = any>(factory: IgniterCallerBuilderFactory<TCaller, TSchemas>): IgniterCallerBuilder<TCaller, TSchemas>;
|
|
376
|
-
/** Sets the base URL for all requests. */
|
|
377
|
-
withBaseUrl(baseURL: string): IgniterCallerBuilder<TCaller, TSchemas>;
|
|
378
|
-
/** Merges default headers for all requests. */
|
|
379
|
-
withHeaders(headers: Record<string, string>): IgniterCallerBuilder<TCaller>;
|
|
380
|
-
/** Sets default cookies (sent as the `Cookie` header). */
|
|
381
|
-
withCookies(cookies: Record<string, string>): IgniterCallerBuilder<TCaller>;
|
|
382
|
-
/** Attaches a logger instance. */
|
|
383
|
-
withLogger(logger: IgniterLogger): IgniterCallerBuilder<TCaller, TSchemas>;
|
|
384
|
-
/** Adds a request interceptor that runs before each request. */
|
|
385
|
-
withRequestInterceptor(interceptor: IgniterCallerRequestInterceptor): IgniterCallerBuilder<TCaller, TSchemas>;
|
|
386
|
-
/** Adds a response interceptor that runs after each request. */
|
|
387
|
-
withResponseInterceptor(interceptor: IgniterCallerResponseInterceptor): IgniterCallerBuilder<TCaller, TSchemas>;
|
|
388
|
-
/**
|
|
389
|
-
* Configures a persistent store adapter for caching.
|
|
390
|
-
*
|
|
391
|
-
* When configured, cache operations will use the store (e.g., Redis)
|
|
392
|
-
* instead of in-memory cache, enabling persistent cache across deployments.
|
|
393
|
-
*/
|
|
394
|
-
withStore(store: IgniterCallerStoreAdapter, options?: IgniterCallerStoreOptions): IgniterCallerBuilder<TCaller, TSchemas>;
|
|
395
|
-
/**
|
|
396
|
-
* Configures schema-based type safety and validation.
|
|
397
|
-
*
|
|
398
|
-
* Enables automatic type inference for requests/responses based on
|
|
399
|
-
* route and method, with optional runtime validation via Zod.
|
|
400
|
-
*
|
|
401
|
-
* @example
|
|
402
|
-
* ```ts
|
|
403
|
-
* const api = IgniterCaller.create()
|
|
404
|
-
* .withSchemas({
|
|
405
|
-
* '/users': {
|
|
406
|
-
* GET: {
|
|
407
|
-
* responses: {
|
|
408
|
-
* 200: z.array(UserSchema),
|
|
409
|
-
* 401: ErrorSchema,
|
|
410
|
-
* },
|
|
411
|
-
* },
|
|
412
|
-
* POST: {
|
|
413
|
-
* request: CreateUserSchema,
|
|
414
|
-
* responses: {
|
|
415
|
-
* 201: UserSchema,
|
|
416
|
-
* 400: ValidationErrorSchema,
|
|
417
|
-
* },
|
|
418
|
-
* },
|
|
419
|
-
* },
|
|
420
|
-
* })
|
|
421
|
-
* .build()
|
|
422
|
-
* ```
|
|
423
|
-
*/
|
|
424
|
-
withSchemas<TNewSchemas extends IgniterCallerSchemaMap>(schemas: TNewSchemas, validation?: IgniterCallerSchemaValidationOptions): IgniterCallerBuilder<TCaller, TNewSchemas>;
|
|
425
|
-
/**
|
|
426
|
-
* Builds the `IgniterCaller` instance.
|
|
427
|
-
*/
|
|
428
|
-
build(): TCaller;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Constructor params for the request builder.
|
|
433
|
-
*/
|
|
434
|
-
interface IgniterCallerRequestBuilderParams {
|
|
435
|
-
baseURL?: string;
|
|
436
|
-
defaultHeaders?: Record<string, string>;
|
|
437
|
-
defaultCookies?: Record<string, string>;
|
|
438
|
-
logger?: IgniterLogger;
|
|
439
|
-
requestInterceptors?: IgniterCallerRequestInterceptor[];
|
|
440
|
-
responseInterceptors?: IgniterCallerResponseInterceptor[];
|
|
441
|
-
eventEmitter?: (url: string, method: string, result: any) => Promise<void>;
|
|
442
|
-
schemas?: IgniterCallerSchemaMap;
|
|
443
|
-
schemaValidation?: IgniterCallerSchemaValidationOptions;
|
|
444
|
-
}
|
|
445
309
|
/**
|
|
446
310
|
* Fluent request builder for `IgniterCaller`.
|
|
447
311
|
*
|
|
@@ -451,6 +315,7 @@ interface IgniterCallerRequestBuilderParams {
|
|
|
451
315
|
declare class IgniterCallerRequestBuilder<TResponse = unknown> {
|
|
452
316
|
private options;
|
|
453
317
|
private logger?;
|
|
318
|
+
private telemetry?;
|
|
454
319
|
private retryOptions?;
|
|
455
320
|
private fallbackFn?;
|
|
456
321
|
private cacheKey?;
|
|
@@ -461,56 +326,87 @@ declare class IgniterCallerRequestBuilder<TResponse = unknown> {
|
|
|
461
326
|
private schemas?;
|
|
462
327
|
private schemaValidation?;
|
|
463
328
|
private responseTypeSchema?;
|
|
329
|
+
/**
|
|
330
|
+
* Creates a new request builder instance.
|
|
331
|
+
*
|
|
332
|
+
* @param params - Builder configuration from the manager.
|
|
333
|
+
*/
|
|
464
334
|
constructor(params: IgniterCallerRequestBuilderParams);
|
|
465
335
|
/**
|
|
466
336
|
* Sets the HTTP method for this request.
|
|
467
337
|
* @internal Used by IgniterCaller.request() for generic requests.
|
|
338
|
+
*
|
|
339
|
+
* @param method - HTTP method for the request.
|
|
468
340
|
*/
|
|
469
341
|
_setMethod(method: IgniterCallerHttpMethod): this;
|
|
470
342
|
/**
|
|
471
343
|
* Sets the URL for this request.
|
|
472
344
|
* @internal Used when URL is passed to HTTP method directly.
|
|
345
|
+
*
|
|
346
|
+
* @param url - Request URL or path.
|
|
473
347
|
*/
|
|
474
348
|
_setUrl(url: string): this;
|
|
475
349
|
/**
|
|
476
350
|
* Overrides the logger for this request chain.
|
|
351
|
+
*
|
|
352
|
+
* @param logger - Logger implementation from `@igniter-js/core`.
|
|
477
353
|
*/
|
|
478
354
|
withLogger(logger: IgniterLogger): this;
|
|
479
355
|
/**
|
|
480
356
|
* Sets the request URL.
|
|
357
|
+
*
|
|
358
|
+
* @param url - Request URL or path.
|
|
481
359
|
*/
|
|
482
360
|
url(url: string): this;
|
|
483
361
|
/**
|
|
484
362
|
* Sets the request body.
|
|
485
363
|
* For GET/HEAD requests, body will be automatically converted to query params.
|
|
364
|
+
*
|
|
365
|
+
* @param body - Body payload for the request.
|
|
486
366
|
*/
|
|
487
367
|
body<TBody>(body: TBody): this;
|
|
488
368
|
/**
|
|
489
369
|
* Sets URL query parameters.
|
|
370
|
+
*
|
|
371
|
+
* @param params - Query string parameters.
|
|
490
372
|
*/
|
|
491
373
|
params(params: Record<string, string | number | boolean>): this;
|
|
492
374
|
/**
|
|
493
375
|
* Merges additional headers into the request.
|
|
376
|
+
*
|
|
377
|
+
* @param headers - Header map merged into existing headers.
|
|
494
378
|
*/
|
|
495
379
|
headers(headers: Record<string, string>): this;
|
|
496
380
|
/**
|
|
497
381
|
* Sets request timeout in milliseconds.
|
|
382
|
+
*
|
|
383
|
+
* @param timeout - Timeout in milliseconds.
|
|
498
384
|
*/
|
|
499
385
|
timeout(timeout: number): this;
|
|
500
386
|
/**
|
|
501
387
|
* Sets cache strategy and optional cache key.
|
|
388
|
+
*
|
|
389
|
+
* @param cache - Cache strategy for the request.
|
|
390
|
+
* @param key - Optional cache key override.
|
|
502
391
|
*/
|
|
503
392
|
cache(cache: RequestCache, key?: string): this;
|
|
504
393
|
/**
|
|
505
394
|
* Configures retry behavior for failed requests.
|
|
395
|
+
*
|
|
396
|
+
* @param maxAttempts - Maximum number of attempts.
|
|
397
|
+
* @param options - Retry options excluding `maxAttempts`.
|
|
506
398
|
*/
|
|
507
399
|
retry(maxAttempts: number, options?: Omit<IgniterCallerRetryOptions, 'maxAttempts'>): this;
|
|
508
400
|
/**
|
|
509
401
|
* Provides a fallback value if the request fails.
|
|
402
|
+
*
|
|
403
|
+
* @param fn - Fallback factory called when the request fails.
|
|
510
404
|
*/
|
|
511
405
|
fallback<T>(fn: () => T): this;
|
|
512
406
|
/**
|
|
513
407
|
* Sets cache stale time in milliseconds.
|
|
408
|
+
*
|
|
409
|
+
* @param milliseconds - Stale time in milliseconds.
|
|
514
410
|
*/
|
|
515
411
|
stale(milliseconds: number): this;
|
|
516
412
|
/**
|
|
@@ -521,6 +417,8 @@ declare class IgniterCallerRequestBuilder<TResponse = unknown> {
|
|
|
521
417
|
*
|
|
522
418
|
* The actual parsing is based on Content-Type headers, not this setting.
|
|
523
419
|
*
|
|
420
|
+
* @param schema - Zod/StandardSchema instance for validation (optional).
|
|
421
|
+
*
|
|
524
422
|
* @example
|
|
525
423
|
* ```ts
|
|
526
424
|
* // With Zod schema (validates JSON response)
|
|
@@ -534,6 +432,8 @@ declare class IgniterCallerRequestBuilder<TResponse = unknown> {
|
|
|
534
432
|
/**
|
|
535
433
|
* Downloads a file via GET request.
|
|
536
434
|
* @deprecated Use `.responseType<File>().execute()` instead. The response type is auto-detected.
|
|
435
|
+
*
|
|
436
|
+
* @param url - URL or path to download.
|
|
537
437
|
*/
|
|
538
438
|
getFile(url: string): {
|
|
539
439
|
execute: () => Promise<IgniterCallerFileResponse>;
|
|
@@ -550,29 +450,86 @@ declare class IgniterCallerRequestBuilder<TResponse = unknown> {
|
|
|
550
450
|
* - `application/octet-stream` → returned as Blob
|
|
551
451
|
*
|
|
552
452
|
* Schema validation (if configured) only runs for validatable content types (JSON, XML, CSV).
|
|
453
|
+
*
|
|
454
|
+
* @returns Response envelope with data or error.
|
|
553
455
|
*/
|
|
554
456
|
execute(): Promise<IgniterCallerApiResponse<TResponse>>;
|
|
555
457
|
private executeWithRetry;
|
|
556
458
|
private executeSingleRequest;
|
|
459
|
+
private resolveUrl;
|
|
557
460
|
private buildRequest;
|
|
558
461
|
/**
|
|
559
462
|
* Emits event for this response using injected emitter.
|
|
560
463
|
*/
|
|
561
464
|
private emitEvent;
|
|
562
465
|
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* @fileoverview Builder and request builder types for @igniter-js/caller.
|
|
469
|
+
* @module @igniter-js/caller/types/builder
|
|
470
|
+
*/
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Builder state for {@link IgniterCallerBuilder}.
|
|
474
|
+
*/
|
|
475
|
+
type IgniterCallerBuilderState<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap> = {
|
|
476
|
+
/** Base URL prefix for outgoing requests. */
|
|
477
|
+
baseURL?: string;
|
|
478
|
+
/** Default headers merged into each request. */
|
|
479
|
+
headers?: Record<string, string>;
|
|
480
|
+
/** Default cookies (sent as the Cookie header). */
|
|
481
|
+
cookies?: Record<string, string>;
|
|
482
|
+
/** Logger instance for request lifecycle logs. */
|
|
483
|
+
logger?: IgniterLogger;
|
|
484
|
+
/** Telemetry manager for emitting events. */
|
|
485
|
+
telemetry?: IgniterTelemetryManager<any>;
|
|
486
|
+
/** Request interceptors executed before the request. */
|
|
487
|
+
requestInterceptors?: IgniterCallerRequestInterceptor[];
|
|
488
|
+
/** Response interceptors executed after the request. */
|
|
489
|
+
responseInterceptors?: IgniterCallerResponseInterceptor[];
|
|
490
|
+
/** Store adapter for persistent cache. */
|
|
491
|
+
store?: IgniterCallerStoreAdapter;
|
|
492
|
+
/** Store adapter options (ttl, keyPrefix, fallback). */
|
|
493
|
+
storeOptions?: IgniterCallerStoreOptions;
|
|
494
|
+
/** Schema map for request/response inference. */
|
|
495
|
+
schemas?: TSchemas;
|
|
496
|
+
/** Validation options for schema enforcement. */
|
|
497
|
+
schemaValidation?: IgniterCallerSchemaValidationOptions;
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Constructor params for the request builder.
|
|
501
|
+
*/
|
|
502
|
+
interface IgniterCallerRequestBuilderParams {
|
|
503
|
+
/** Base URL prefix for outgoing requests. */
|
|
504
|
+
baseURL?: string;
|
|
505
|
+
/** Default headers merged into each request. */
|
|
506
|
+
defaultHeaders?: Record<string, string>;
|
|
507
|
+
/** Default cookies (sent as the Cookie header). */
|
|
508
|
+
defaultCookies?: Record<string, string>;
|
|
509
|
+
/** Logger instance for request lifecycle logs. */
|
|
510
|
+
logger?: IgniterLogger;
|
|
511
|
+
/** Telemetry manager for emitting events. */
|
|
512
|
+
telemetry?: IgniterTelemetryManager<any>;
|
|
513
|
+
/** Request interceptors executed before the request. */
|
|
514
|
+
requestInterceptors?: IgniterCallerRequestInterceptor[];
|
|
515
|
+
/** Response interceptors executed after the request. */
|
|
516
|
+
responseInterceptors?: IgniterCallerResponseInterceptor[];
|
|
517
|
+
/** Callback invoked after request completion. */
|
|
518
|
+
eventEmitter?: (url: string, method: string, result: IgniterCallerApiResponse<unknown>) => Promise<void>;
|
|
519
|
+
/** Schema map for request/response inference. */
|
|
520
|
+
schemas?: IgniterCallerSchemaMap;
|
|
521
|
+
/** Validation options for schema enforcement. */
|
|
522
|
+
schemaValidation?: IgniterCallerSchemaValidationOptions;
|
|
523
|
+
}
|
|
563
524
|
/**
|
|
564
525
|
* Request builder type without internal methods.
|
|
565
|
-
* Used when creating requests via specific HTTP methods (get, post, etc.)
|
|
526
|
+
* Used when creating requests via specific HTTP methods (get, post, etc.).
|
|
566
527
|
*/
|
|
567
|
-
type IgniterCallerMethodRequestBuilder<TResponse = unknown> = Omit<IgniterCallerRequestBuilder<TResponse>,
|
|
528
|
+
type IgniterCallerMethodRequestBuilder<TResponse = unknown> = Omit<IgniterCallerRequestBuilder<TResponse>, "_setMethod" | "_setUrl">;
|
|
568
529
|
/**
|
|
569
530
|
* Request builder with typed response based on schema inference.
|
|
570
|
-
* Used when creating requests via HTTP methods with URL that matches a schema.
|
|
571
|
-
*
|
|
572
|
-
* This type ensures that the execute() method returns the correct response type
|
|
573
|
-
* based on the schema map configuration.
|
|
574
531
|
*/
|
|
575
|
-
type IgniterCallerTypedRequestBuilder<TResponse = unknown> =
|
|
532
|
+
type IgniterCallerTypedRequestBuilder<TResponse = unknown> = IgniterCallerMethodRequestBuilder<TResponse>;
|
|
576
533
|
|
|
577
534
|
/**
|
|
578
535
|
* Callback function for event listeners.
|
|
@@ -587,6 +544,11 @@ type IgniterCallerEventCallback<T = any> = (result: IgniterCallerApiResponse<T>,
|
|
|
587
544
|
*/
|
|
588
545
|
type IgniterCallerUrlPattern = string | RegExp;
|
|
589
546
|
|
|
547
|
+
/**
|
|
548
|
+
* @fileoverview Type inference helpers for @igniter-js/caller.
|
|
549
|
+
* @module @igniter-js/caller/types/infer
|
|
550
|
+
*/
|
|
551
|
+
|
|
590
552
|
/**
|
|
591
553
|
* Infer success response type from endpoint schema (200 or 201).
|
|
592
554
|
*/
|
|
@@ -603,16 +565,83 @@ type InferResponse<TSchemas extends IgniterCallerSchemaMap, TPath extends string
|
|
|
603
565
|
/**
|
|
604
566
|
* Typed request builder with inferred body and params types.
|
|
605
567
|
*/
|
|
606
|
-
type TypedRequestBuilder<TSchemas extends IgniterCallerSchemaMap, TPath extends string, TMethod extends IgniterCallerSchemaMethod> = Omit<IgniterCallerMethodRequestBuilder<EndpointInfo<TSchemas, TPath, TMethod>[
|
|
568
|
+
type TypedRequestBuilder<TSchemas extends IgniterCallerSchemaMap, TPath extends string, TMethod extends IgniterCallerSchemaMethod> = Omit<IgniterCallerMethodRequestBuilder<EndpointInfo<TSchemas, TPath, TMethod>["response"]>, "body" | "params"> & {
|
|
607
569
|
/**
|
|
608
570
|
* Sets the request body with type inference from schema.
|
|
609
571
|
*/
|
|
610
|
-
body: EndpointInfo<TSchemas, TPath, TMethod>[
|
|
572
|
+
body: EndpointInfo<TSchemas, TPath, TMethod>["request"] extends never ? <TBody>(body: TBody) => TypedRequestBuilder<TSchemas, TPath, TMethod> : (body: EndpointInfo<TSchemas, TPath, TMethod>["request"]) => TypedRequestBuilder<TSchemas, TPath, TMethod>;
|
|
611
573
|
/**
|
|
612
574
|
* Sets URL path parameters with type inference from URL pattern.
|
|
613
575
|
*/
|
|
614
|
-
params: keyof EndpointInfo<TSchemas, TPath, TMethod>[
|
|
576
|
+
params: keyof EndpointInfo<TSchemas, TPath, TMethod>["params"] extends never ? (params: Record<string, string | number | boolean>) => TypedRequestBuilder<TSchemas, TPath, TMethod> : (params: EndpointInfo<TSchemas, TPath, TMethod>["params"] & Record<string, string | number | boolean>) => TypedRequestBuilder<TSchemas, TPath, TMethod>;
|
|
615
577
|
};
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* @fileoverview Manager contracts for @igniter-js/caller.
|
|
581
|
+
* @module @igniter-js/caller/types/manager
|
|
582
|
+
*/
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Public contract for the IgniterCaller manager runtime.
|
|
586
|
+
*/
|
|
587
|
+
interface IIgniterCallerManager<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap> {
|
|
588
|
+
/**
|
|
589
|
+
* Creates a GET request.
|
|
590
|
+
*
|
|
591
|
+
* @param url - Optional URL for the request.
|
|
592
|
+
* @returns Typed request builder.
|
|
593
|
+
*/
|
|
594
|
+
get<TPath extends GetPaths<TSchemas>>(url: TPath): TypedRequestBuilder<TSchemas, TPath, "GET">;
|
|
595
|
+
get<TPath extends string>(url?: TPath): IgniterCallerTypedRequestBuilder<InferResponse<TSchemas, TPath, "GET">>;
|
|
596
|
+
/**
|
|
597
|
+
* Creates a POST request.
|
|
598
|
+
*
|
|
599
|
+
* @param url - Optional URL for the request.
|
|
600
|
+
* @returns Typed request builder.
|
|
601
|
+
*/
|
|
602
|
+
post<TPath extends PostPaths<TSchemas>>(url: TPath): TypedRequestBuilder<TSchemas, TPath, "POST">;
|
|
603
|
+
post<TPath extends string>(url?: TPath): IgniterCallerTypedRequestBuilder<InferResponse<TSchemas, TPath, "POST">>;
|
|
604
|
+
/**
|
|
605
|
+
* Creates a PUT request.
|
|
606
|
+
*
|
|
607
|
+
* @param url - Optional URL for the request.
|
|
608
|
+
* @returns Typed request builder.
|
|
609
|
+
*/
|
|
610
|
+
put<TPath extends PutPaths<TSchemas>>(url: TPath): TypedRequestBuilder<TSchemas, TPath, "PUT">;
|
|
611
|
+
put<TPath extends string>(url?: TPath): IgniterCallerTypedRequestBuilder<InferResponse<TSchemas, TPath, "PUT">>;
|
|
612
|
+
/**
|
|
613
|
+
* Creates a PATCH request.
|
|
614
|
+
*
|
|
615
|
+
* @param url - Optional URL for the request.
|
|
616
|
+
* @returns Typed request builder.
|
|
617
|
+
*/
|
|
618
|
+
patch<TPath extends PatchPaths<TSchemas>>(url: TPath): TypedRequestBuilder<TSchemas, TPath, "PATCH">;
|
|
619
|
+
patch<TPath extends string>(url?: TPath): IgniterCallerTypedRequestBuilder<InferResponse<TSchemas, TPath, "PATCH">>;
|
|
620
|
+
/**
|
|
621
|
+
* Creates a DELETE request.
|
|
622
|
+
*
|
|
623
|
+
* @param url - Optional URL for the request.
|
|
624
|
+
* @returns Typed request builder.
|
|
625
|
+
*/
|
|
626
|
+
delete<TPath extends DeletePaths<TSchemas>>(url: TPath): TypedRequestBuilder<TSchemas, TPath, "DELETE">;
|
|
627
|
+
delete<TPath extends string>(url?: TPath): IgniterCallerTypedRequestBuilder<InferResponse<TSchemas, TPath, "DELETE">>;
|
|
628
|
+
/**
|
|
629
|
+
* Creates a HEAD request.
|
|
630
|
+
*
|
|
631
|
+
* @param url - Optional URL for the request.
|
|
632
|
+
* @returns Typed request builder.
|
|
633
|
+
*/
|
|
634
|
+
head<TPath extends HeadPaths<TSchemas>>(url: TPath): TypedRequestBuilder<TSchemas, TPath, "HEAD">;
|
|
635
|
+
head<TPath extends string>(url?: TPath): IgniterCallerTypedRequestBuilder<InferResponse<TSchemas, TPath, "HEAD">>;
|
|
636
|
+
/**
|
|
637
|
+
* Executes a request directly with all options in one object.
|
|
638
|
+
*
|
|
639
|
+
* @param options - Request configuration.
|
|
640
|
+
* @returns Response envelope with data or error.
|
|
641
|
+
*/
|
|
642
|
+
request<T = unknown>(options: IgniterCallerDirectRequestOptions): Promise<IgniterCallerApiResponse<T>>;
|
|
643
|
+
}
|
|
644
|
+
|
|
616
645
|
/**
|
|
617
646
|
* HTTP client runtime for Igniter.js.
|
|
618
647
|
*
|
|
@@ -621,47 +650,38 @@ type TypedRequestBuilder<TSchemas extends IgniterCallerSchemaMap, TPath extends
|
|
|
621
650
|
*
|
|
622
651
|
* @template TSchemas - The schema map type for type-safe requests/responses.
|
|
623
652
|
*/
|
|
624
|
-
declare class
|
|
653
|
+
declare class IgniterCallerManager<TSchemas extends IgniterCallerSchemaMap> implements IIgniterCallerManager<TSchemas> {
|
|
625
654
|
/** Global event emitter for observing HTTP responses */
|
|
626
655
|
private static readonly events;
|
|
627
656
|
private baseURL?;
|
|
628
657
|
private headers?;
|
|
629
658
|
private cookies?;
|
|
630
659
|
private logger?;
|
|
660
|
+
private telemetry?;
|
|
631
661
|
private requestInterceptors?;
|
|
632
662
|
private responseInterceptors?;
|
|
633
663
|
private schemas?;
|
|
634
664
|
private schemaValidation?;
|
|
665
|
+
/**
|
|
666
|
+
* Creates a new manager instance.
|
|
667
|
+
*
|
|
668
|
+
* @param baseURL - Base URL prefix for requests.
|
|
669
|
+
* @param opts - Optional configuration (headers, cookies, telemetry, schemas).
|
|
670
|
+
*/
|
|
635
671
|
constructor(baseURL?: string, opts?: {
|
|
636
672
|
headers?: Record<string, string>;
|
|
637
673
|
cookies?: Record<string, string>;
|
|
638
674
|
logger?: IgniterLogger;
|
|
675
|
+
telemetry?: IgniterTelemetryManager<any>;
|
|
639
676
|
requestInterceptors?: IgniterCallerRequestInterceptor[];
|
|
640
677
|
responseInterceptors?: IgniterCallerResponseInterceptor[];
|
|
641
678
|
schemas?: TSchemas;
|
|
642
679
|
schemaValidation?: IgniterCallerSchemaValidationOptions;
|
|
643
680
|
});
|
|
644
|
-
/**
|
|
645
|
-
* Canonical initialization entrypoint.
|
|
646
|
-
*
|
|
647
|
-
* This is designed to remain stable when extracted to `@igniter-js/caller`.
|
|
648
|
-
*/
|
|
649
|
-
static create<TInitSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap>(): IgniterCallerBuilder<IgniterCaller<TInitSchemas>, TInitSchemas>;
|
|
650
|
-
/**
|
|
651
|
-
* Returns a new client with the same config and a new logger.
|
|
652
|
-
*/
|
|
653
|
-
withLogger(logger: IgniterLogger): IgniterCaller<TSchemas>;
|
|
654
|
-
setBaseURL(baseURL: string): this;
|
|
655
|
-
setHeaders(headers: Record<string, string>): this;
|
|
656
|
-
setCookies(cookies: Record<string, string>): this;
|
|
657
681
|
/**
|
|
658
682
|
* Creates common request builder params.
|
|
659
683
|
*/
|
|
660
684
|
private createBuilderParams;
|
|
661
|
-
/**
|
|
662
|
-
* Resolves the full URL path by prepending baseURL if needed.
|
|
663
|
-
*/
|
|
664
|
-
private resolveSchemaPath;
|
|
665
685
|
/**
|
|
666
686
|
* Creates a GET request.
|
|
667
687
|
*
|
|
@@ -685,10 +705,6 @@ declare class IgniterCaller<TSchemas extends IgniterCallerSchemaMap = IgniterCal
|
|
|
685
705
|
*/
|
|
686
706
|
get<TPath extends GetPaths<TSchemas>>(url: TPath): TypedRequestBuilder<TSchemas, TPath, 'GET'>;
|
|
687
707
|
get<TPath extends string>(url?: TPath): IgniterCallerTypedRequestBuilder<InferResponse<TSchemas, TPath, 'GET'>>;
|
|
688
|
-
/**
|
|
689
|
-
* Creates a POST request.
|
|
690
|
-
*
|
|
691
|
-
* When a URL is provided and matches a schema, the response type is automatically inferred.
|
|
692
708
|
/**
|
|
693
709
|
* Creates a POST request.
|
|
694
710
|
*
|
|
@@ -776,6 +792,9 @@ declare class IgniterCaller<TSchemas extends IgniterCallerSchemaMap = IgniterCal
|
|
|
776
792
|
* This is a convenience method for making requests without using the builder pattern.
|
|
777
793
|
* Useful for dynamic requests where options are constructed programmatically.
|
|
778
794
|
*
|
|
795
|
+
* @param options - Request configuration for method, url, and behavior.
|
|
796
|
+
* @returns Response envelope with data or error.
|
|
797
|
+
*
|
|
779
798
|
* @example
|
|
780
799
|
* ```ts
|
|
781
800
|
* const result = await api.request({
|
|
@@ -806,6 +825,9 @@ declare class IgniterCaller<TSchemas extends IgniterCallerSchemaMap = IgniterCal
|
|
|
806
825
|
* Executes multiple requests in parallel and returns results as an array.
|
|
807
826
|
*
|
|
808
827
|
* This is useful for batching independent API calls.
|
|
828
|
+
*
|
|
829
|
+
* @param requests - Array of request promises.
|
|
830
|
+
* @returns Array of resolved results in the same order.
|
|
809
831
|
*/
|
|
810
832
|
static batch<T extends readonly Promise<IgniterCallerApiResponse<any>>[]>(requests: [...T]): Promise<{
|
|
811
833
|
[K in keyof T]: T[K] extends Promise<infer R> ? R : never;
|
|
@@ -826,7 +848,7 @@ declare class IgniterCaller<TSchemas extends IgniterCallerSchemaMap = IgniterCal
|
|
|
826
848
|
* @example
|
|
827
849
|
* ```ts
|
|
828
850
|
* // Listen to all user endpoints
|
|
829
|
-
* const cleanup =
|
|
851
|
+
* const cleanup = IgniterCallerManager.on(/^\/users/, (result, context) => {
|
|
830
852
|
* console.log(`${context.method} ${context.url}`, result)
|
|
831
853
|
* })
|
|
832
854
|
*
|
|
@@ -837,6 +859,9 @@ declare class IgniterCaller<TSchemas extends IgniterCallerSchemaMap = IgniterCal
|
|
|
837
859
|
static on(pattern: IgniterCallerUrlPattern, callback: IgniterCallerEventCallback): () => void;
|
|
838
860
|
/**
|
|
839
861
|
* Removes event listeners for a pattern.
|
|
862
|
+
*
|
|
863
|
+
* @param pattern - URL string or RegExp pattern.
|
|
864
|
+
* @param callback - Callback to remove (optional).
|
|
840
865
|
*/
|
|
841
866
|
static off(pattern: IgniterCallerUrlPattern, callback?: IgniterCallerEventCallback): void;
|
|
842
867
|
/**
|
|
@@ -844,11 +869,13 @@ declare class IgniterCaller<TSchemas extends IgniterCallerSchemaMap = IgniterCal
|
|
|
844
869
|
*
|
|
845
870
|
* This is useful after mutations to ensure fresh data on next fetch.
|
|
846
871
|
*
|
|
872
|
+
* @param key - Cache key to invalidate.
|
|
873
|
+
*
|
|
847
874
|
* @example
|
|
848
875
|
* ```ts
|
|
849
876
|
* // After creating a user
|
|
850
877
|
* await api.post('/users').body(newUser).execute()
|
|
851
|
-
* await
|
|
878
|
+
* await IgniterCallerManager.invalidate('/users') // Clear users list cache
|
|
852
879
|
* ```
|
|
853
880
|
*/
|
|
854
881
|
static invalidate(key: string): Promise<void>;
|
|
@@ -856,11 +883,12 @@ declare class IgniterCaller<TSchemas extends IgniterCallerSchemaMap = IgniterCal
|
|
|
856
883
|
* Invalidates all cache entries matching a pattern.
|
|
857
884
|
*
|
|
858
885
|
* @param pattern Glob pattern (e.g., '/users/*') or exact key
|
|
886
|
+
* @returns Promise that resolves when invalidation completes.
|
|
859
887
|
*
|
|
860
888
|
* @example
|
|
861
889
|
* ```ts
|
|
862
890
|
* // Invalidate all user-related caches
|
|
863
|
-
* await
|
|
891
|
+
* await IgniterCallerManager.invalidatePattern('/users/*')
|
|
864
892
|
* ```
|
|
865
893
|
*/
|
|
866
894
|
static invalidatePattern(pattern: string): Promise<void>;
|
|
@@ -868,6 +896,10 @@ declare class IgniterCaller<TSchemas extends IgniterCallerSchemaMap = IgniterCal
|
|
|
868
896
|
* Emits an event to all registered listeners.
|
|
869
897
|
*
|
|
870
898
|
* @internal
|
|
899
|
+
*
|
|
900
|
+
* @param url - Request URL (resolved).
|
|
901
|
+
* @param method - HTTP method.
|
|
902
|
+
* @param result - Response envelope.
|
|
871
903
|
*/
|
|
872
904
|
static emitEvent(url: string, method: string, result: IgniterCallerApiResponse<any>): Promise<void>;
|
|
873
905
|
}
|
|
@@ -910,120 +942,450 @@ declare class IgniterCallerEvents {
|
|
|
910
942
|
on(pattern: IgniterCallerUrlPattern, callback: IgniterCallerEventCallback): () => void;
|
|
911
943
|
/**
|
|
912
944
|
* Removes a specific listener or all listeners for a pattern.
|
|
945
|
+
*
|
|
946
|
+
* @param pattern - URL string or RegExp pattern.
|
|
947
|
+
* @param callback - Optional specific callback to remove.
|
|
913
948
|
*/
|
|
914
949
|
off(pattern: IgniterCallerUrlPattern, callback?: IgniterCallerEventCallback): void;
|
|
915
950
|
/**
|
|
916
951
|
* Emits an event to all matching listeners.
|
|
917
952
|
*
|
|
918
953
|
* @internal
|
|
954
|
+
*
|
|
955
|
+
* @param url - Request URL to match listeners against.
|
|
956
|
+
* @param method - HTTP method.
|
|
957
|
+
* @param result - Response envelope.
|
|
919
958
|
*/
|
|
920
959
|
emit(url: string, method: string, result: any): Promise<void>;
|
|
921
960
|
/**
|
|
922
961
|
* Removes all listeners.
|
|
962
|
+
*
|
|
963
|
+
* @returns Nothing.
|
|
923
964
|
*/
|
|
924
965
|
clear(): void;
|
|
925
966
|
}
|
|
926
967
|
|
|
927
|
-
type IgniterCallerErrorCode = 'IGNITER_CALLER_HTTP_ERROR' | 'IGNITER_CALLER_TIMEOUT' | 'IGNITER_CALLER_REQUEST_VALIDATION_FAILED' | 'IGNITER_CALLER_RESPONSE_VALIDATION_FAILED' | 'IGNITER_CALLER_UNKNOWN_ERROR';
|
|
928
|
-
type IgniterCallerOperation = 'execute' | 'download' | 'buildRequest' | 'parseResponse' | 'validateRequest' | 'validateResponse';
|
|
929
968
|
/**
|
|
930
|
-
*
|
|
969
|
+
* @fileoverview Schema builder helper types for @igniter-js/caller.
|
|
970
|
+
* @module @igniter-js/caller/types/schema-builder
|
|
931
971
|
*/
|
|
932
|
-
|
|
933
|
-
/** Machine-readable error code. */
|
|
934
|
-
code: IgniterCallerErrorCode;
|
|
935
|
-
/** Where the error happened. */
|
|
936
|
-
operation: IgniterCallerOperation;
|
|
937
|
-
/** Human-readable message. */
|
|
938
|
-
message: string;
|
|
939
|
-
/** Optional HTTP status code when surfacing errors through HTTP boundaries. */
|
|
940
|
-
statusCode?: number;
|
|
941
|
-
/** Optional HTTP status text (when available). */
|
|
942
|
-
statusText?: string;
|
|
943
|
-
/** Extra diagnostic details (e.g. response body or schema issues). */
|
|
944
|
-
details?: unknown;
|
|
945
|
-
/** Arbitrary metadata for debugging. */
|
|
946
|
-
metadata?: Record<string, unknown>;
|
|
947
|
-
/** Optional original cause. */
|
|
948
|
-
cause?: unknown;
|
|
949
|
-
/** Optional logger used by IgniterError. */
|
|
950
|
-
logger?: IgniterLogger;
|
|
951
|
-
};
|
|
972
|
+
|
|
952
973
|
/**
|
|
953
|
-
*
|
|
954
|
-
*
|
|
955
|
-
* Designed to be extracted into `@igniter-js/caller`.
|
|
974
|
+
* Registry of reusable schemas keyed by name.
|
|
956
975
|
*/
|
|
957
|
-
|
|
958
|
-
readonly code: IgniterCallerErrorCode;
|
|
959
|
-
readonly operation: IgniterCallerOperation;
|
|
960
|
-
readonly statusText?: string;
|
|
961
|
-
readonly cause?: unknown;
|
|
962
|
-
constructor(payload: IgniterCallerErrorPayload);
|
|
963
|
-
static is(error: unknown): error is IgniterCallerError;
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
declare class IgniterCallerBodyUtils {
|
|
967
|
-
/**
|
|
968
|
-
* Returns true when the request body should be passed to `fetch` as-is.
|
|
969
|
-
*/
|
|
970
|
-
static isRawBody(body: unknown): boolean;
|
|
971
|
-
/**
|
|
972
|
-
* Removes Content-Type for FormData so fetch can set boundaries automatically.
|
|
973
|
-
*/
|
|
974
|
-
static normalizeHeadersForBody(headers: Record<string, string> | undefined, body: unknown): Record<string, string> | undefined;
|
|
975
|
-
}
|
|
976
|
-
|
|
976
|
+
type IgniterCallerSchemaRegistry = Record<string, StandardSchemaV1>;
|
|
977
977
|
/**
|
|
978
|
-
*
|
|
979
|
-
*
|
|
980
|
-
* Supports both in-memory caching and persistent store-based caching (Redis, etc).
|
|
978
|
+
* Configuration payload for a single endpoint method in the schema builder.
|
|
981
979
|
*/
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
980
|
+
type IgniterCallerSchemaEndpointConfig<TRequest extends StandardSchemaV1 | undefined = undefined, TResponses extends Record<number | string, StandardSchemaV1> = Record<number | string, StandardSchemaV1>> = {
|
|
981
|
+
request?: TRequest;
|
|
982
|
+
responses: TResponses;
|
|
983
|
+
doc?: string;
|
|
984
|
+
tags?: string[];
|
|
985
|
+
operationId?: string;
|
|
986
|
+
};
|
|
987
|
+
/**
|
|
988
|
+
* Helper type for array wrappers on StandardSchemaV1.
|
|
989
|
+
*/
|
|
990
|
+
type SchemaArray<TSchema extends StandardSchemaV1> = StandardSchemaV1<Array<StandardSchemaV1.InferInput<TSchema>>, Array<StandardSchemaV1.InferOutput<TSchema>>>;
|
|
991
|
+
/**
|
|
992
|
+
* Helper type for nullable wrappers on StandardSchemaV1.
|
|
993
|
+
*/
|
|
994
|
+
type SchemaNullable<TSchema extends StandardSchemaV1> = StandardSchemaV1<StandardSchemaV1.InferInput<TSchema> | null, StandardSchemaV1.InferOutput<TSchema> | null>;
|
|
995
|
+
/**
|
|
996
|
+
* Helper type for optional wrappers on StandardSchemaV1.
|
|
997
|
+
*/
|
|
998
|
+
type SchemaOptional<TSchema extends StandardSchemaV1> = StandardSchemaV1<StandardSchemaV1.InferInput<TSchema> | undefined, StandardSchemaV1.InferOutput<TSchema> | undefined>;
|
|
999
|
+
/**
|
|
1000
|
+
* Helper type for record wrappers on StandardSchemaV1.
|
|
1001
|
+
*/
|
|
1002
|
+
type SchemaRecord<TSchema extends StandardSchemaV1> = StandardSchemaV1<Record<string, StandardSchemaV1.InferInput<TSchema>>, Record<string, StandardSchemaV1.InferOutput<TSchema>>>;
|
|
1003
|
+
/**
|
|
1004
|
+
* Extracts the raw responses map (schemas) from a schema map.
|
|
1005
|
+
*/
|
|
1006
|
+
type SchemaMapResponses<TSchemas extends IgniterCallerSchemaMap, TPath extends keyof TSchemas, TMethod extends keyof TSchemas[TPath]> = TSchemas[TPath][TMethod] extends IgniterCallerEndpointSchema<any, infer Responses> ? Responses : never;
|
|
1007
|
+
/**
|
|
1008
|
+
* Infers the response output types for every status in a responses map.
|
|
1009
|
+
*/
|
|
1010
|
+
type SchemaMapResponsesType<TSchemas extends IgniterCallerSchemaMap, TPath extends keyof TSchemas, TMethod extends keyof TSchemas[TPath]> = SchemaMapResponses<TSchemas, TPath, TMethod> extends Record<number | string, StandardSchemaV1> ? {
|
|
1011
|
+
[K in keyof SchemaMapResponses<TSchemas, TPath, TMethod>]: SchemaMapResponses<TSchemas, TPath, TMethod>[K] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<SchemaMapResponses<TSchemas, TPath, TMethod>[K]> : never;
|
|
1012
|
+
} : never;
|
|
1013
|
+
/**
|
|
1014
|
+
* Extracts the request schema for a path + method.
|
|
1015
|
+
*/
|
|
1016
|
+
type SchemaMapRequestSchema<TSchemas extends IgniterCallerSchemaMap, TPath extends keyof TSchemas, TMethod extends keyof TSchemas[TPath]> = TSchemas[TPath][TMethod] extends IgniterCallerEndpointSchema<infer Request, any> ? Request : never;
|
|
1017
|
+
/**
|
|
1018
|
+
* Extracts the response schema for a path + method + status code.
|
|
1019
|
+
*/
|
|
1020
|
+
type SchemaMapResponseSchema<TSchemas extends IgniterCallerSchemaMap, TPath extends keyof TSchemas, TMethod extends keyof TSchemas[TPath], TStatus extends number | string> = SchemaMapResponses<TSchemas, TPath, TMethod> extends Record<number | string, StandardSchemaV1> ? ResolveStatusKey<SchemaMapResponses<TSchemas, TPath, TMethod>, TStatus> extends keyof SchemaMapResponses<TSchemas, TPath, TMethod> ? SchemaMapResponses<TSchemas, TPath, TMethod>[ResolveStatusKey<SchemaMapResponses<TSchemas, TPath, TMethod>, TStatus>] : never : never;
|
|
1021
|
+
/**
|
|
1022
|
+
* Type-level helpers attached to schema build outputs.
|
|
1023
|
+
*/
|
|
1024
|
+
type IgniterCallerSchemaInfer<TSchemas extends IgniterCallerSchemaMap, TRegistry extends IgniterCallerSchemaRegistry> = {
|
|
1025
|
+
Path: SchemaMapPaths<TSchemas>;
|
|
1026
|
+
Endpoint: <TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>>() => EndpointInfo<TSchemas, TPath, TMethod>;
|
|
1027
|
+
Request: <TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>>() => SchemaMapRequestType<TSchemas, TPath, TMethod>;
|
|
1028
|
+
Response: <TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>, TStatus extends number | string>() => SchemaMapResponseType<TSchemas, TPath, TMethod, TStatus>;
|
|
1029
|
+
Responses: <TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>>() => SchemaMapResponsesType<TSchemas, TPath, TMethod>;
|
|
1030
|
+
Schema: <TKey extends keyof TRegistry>() => StandardSchemaV1.InferOutput<TRegistry[TKey]>;
|
|
1031
|
+
};
|
|
1032
|
+
/**
|
|
1033
|
+
* Runtime helpers attached to schema build outputs.
|
|
1034
|
+
*/
|
|
1035
|
+
type IgniterCallerSchemaGetters<TSchemas extends IgniterCallerSchemaMap, TRegistry extends IgniterCallerSchemaRegistry> = {
|
|
1036
|
+
path: <TPath extends SchemaMapPaths<TSchemas>>(path: TPath) => TSchemas[TPath];
|
|
1037
|
+
endpoint: <TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>>(path: TPath, method: TMethod) => SchemaMapEndpoint<TSchemas, TPath, TMethod>;
|
|
1038
|
+
request: <TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>>(path: TPath, method: TMethod) => SchemaMapRequestSchema<TSchemas, TPath, TMethod>;
|
|
1039
|
+
response: <TPath extends SchemaMapPaths<TSchemas>, TMethod extends SchemaMapMethods<TSchemas, TPath>, TStatus extends number | string>(path: TPath, method: TMethod, status: TStatus) => SchemaMapResponseSchema<TSchemas, TPath, TMethod, TStatus>;
|
|
1040
|
+
schema: <TKey extends keyof TRegistry>(key: TKey) => TRegistry[TKey];
|
|
1041
|
+
};
|
|
1042
|
+
/**
|
|
1043
|
+
* Output type for IgniterCallerSchema.build().
|
|
1044
|
+
*/
|
|
1045
|
+
type IgniterCallerSchemaBuildResult<TSchemas extends IgniterCallerSchemaMap, TRegistry extends IgniterCallerSchemaRegistry> = TSchemas & {
|
|
1046
|
+
$Infer: IgniterCallerSchemaInfer<TSchemas, TRegistry>;
|
|
1047
|
+
get: IgniterCallerSchemaGetters<TSchemas, TRegistry>;
|
|
1048
|
+
};
|
|
1049
|
+
/**
|
|
1050
|
+
* Accepted input types for `withSchemas`.
|
|
1051
|
+
*/
|
|
1052
|
+
type IgniterCallerSchemaInput<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap, TRegistry extends IgniterCallerSchemaRegistry = IgniterCallerSchemaRegistry> = TSchemas | IgniterCallerSchemaBuildResult<TSchemas, TRegistry>;
|
|
1053
|
+
/**
|
|
1054
|
+
* Extracts the schema map from a build result or raw map.
|
|
1055
|
+
*/
|
|
1056
|
+
type IgniterCallerSchemaMapFrom<T> = T extends IgniterCallerSchemaBuildResult<infer TMap, any> ? TMap : T extends IgniterCallerSchemaMap ? T : never;
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* Builder used by developers to initialize the `IgniterCaller` client.
|
|
1060
|
+
*
|
|
1061
|
+
* This API is designed to remain stable when extracted to `@igniter-js/caller`.
|
|
1062
|
+
*/
|
|
1063
|
+
declare class IgniterCallerBuilder<TSchemas extends IgniterCallerSchemaMap = IgniterCallerSchemaMap> {
|
|
1064
|
+
private readonly state;
|
|
1065
|
+
private constructor();
|
|
1066
|
+
/**
|
|
1067
|
+
* Creates a new builder instance.
|
|
1068
|
+
*
|
|
1069
|
+
* @returns New builder instance with empty state.
|
|
1070
|
+
*/
|
|
1071
|
+
static create(): IgniterCallerBuilder<{}>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Sets the base URL for all requests.
|
|
1074
|
+
*
|
|
1075
|
+
* @param baseURL - Base URL prefix for outgoing requests.
|
|
1076
|
+
*/
|
|
1077
|
+
withBaseUrl(baseURL: string): IgniterCallerBuilder<TSchemas>;
|
|
1078
|
+
/**
|
|
1079
|
+
* Merges default headers for all requests.
|
|
1080
|
+
*
|
|
1081
|
+
* @param headers - Header map merged into every request.
|
|
1082
|
+
*/
|
|
1083
|
+
withHeaders(headers: Record<string, string>): IgniterCallerBuilder<TSchemas>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Sets default cookies (sent as the `Cookie` header).
|
|
1086
|
+
*
|
|
1087
|
+
* @param cookies - Cookie key/value pairs.
|
|
1088
|
+
*/
|
|
1089
|
+
withCookies(cookies: Record<string, string>): IgniterCallerBuilder<TSchemas>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Attaches a logger instance.
|
|
1092
|
+
*
|
|
1093
|
+
* @param logger - Logger implementation from `@igniter-js/core`.
|
|
1094
|
+
*/
|
|
1095
|
+
withLogger(logger: IgniterLogger): IgniterCallerBuilder<TSchemas>;
|
|
1096
|
+
/**
|
|
1097
|
+
* Adds a request interceptor that runs before each request.
|
|
1098
|
+
*
|
|
1099
|
+
* @param interceptor - Interceptor called with request options.
|
|
1100
|
+
*/
|
|
1101
|
+
withRequestInterceptor(interceptor: IgniterCallerRequestInterceptor): IgniterCallerBuilder<TSchemas>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Adds a response interceptor that runs after each request.
|
|
1104
|
+
*
|
|
1105
|
+
* @param interceptor - Interceptor called with the response result.
|
|
1106
|
+
*/
|
|
1107
|
+
withResponseInterceptor(interceptor: IgniterCallerResponseInterceptor): IgniterCallerBuilder<TSchemas>;
|
|
986
1108
|
/**
|
|
987
1109
|
* Configures a persistent store adapter for caching.
|
|
988
1110
|
*
|
|
989
1111
|
* When configured, cache operations will use the store (e.g., Redis)
|
|
990
1112
|
* instead of in-memory cache, enabling persistent cache across deployments.
|
|
1113
|
+
*
|
|
1114
|
+
* @param store - Store adapter implementation.
|
|
1115
|
+
* @param options - Store options (ttl, keyPrefix, fallback).
|
|
991
1116
|
*/
|
|
992
|
-
|
|
1117
|
+
withStore(store: IgniterCallerStoreAdapter, options?: IgniterCallerStoreOptions): IgniterCallerBuilder<TSchemas>;
|
|
993
1118
|
/**
|
|
994
|
-
*
|
|
1119
|
+
* Configures schema-based type safety and validation.
|
|
1120
|
+
*
|
|
1121
|
+
* Enables automatic type inference for requests/responses based on
|
|
1122
|
+
* route and method, with optional runtime validation via StandardSchemaV1
|
|
1123
|
+
* (Zod is supported).
|
|
1124
|
+
*
|
|
1125
|
+
* @param schemas - Schema map keyed by URL path and method.
|
|
1126
|
+
* @param validation - Validation options for request/response checks.
|
|
1127
|
+
*
|
|
1128
|
+
* @example
|
|
1129
|
+
* ```ts
|
|
1130
|
+
* const api = IgniterCaller.create()
|
|
1131
|
+
* .withSchemas({
|
|
1132
|
+
* '/users': {
|
|
1133
|
+
* GET: {
|
|
1134
|
+
* responses: {
|
|
1135
|
+
* 200: z.array(UserSchema),
|
|
1136
|
+
* 401: ErrorSchema,
|
|
1137
|
+
* },
|
|
1138
|
+
* },
|
|
1139
|
+
* POST: {
|
|
1140
|
+
* request: CreateUserSchema,
|
|
1141
|
+
* responses: {
|
|
1142
|
+
* 201: UserSchema,
|
|
1143
|
+
* 400: ValidationErrorSchema,
|
|
1144
|
+
* },
|
|
1145
|
+
* },
|
|
1146
|
+
* },
|
|
1147
|
+
* })
|
|
1148
|
+
* .build()
|
|
1149
|
+
* ```
|
|
995
1150
|
*/
|
|
996
|
-
|
|
1151
|
+
withSchemas<TNewSchemas extends IgniterCallerSchemaInput>(schemas: TNewSchemas, validation?: IgniterCallerSchemaValidationOptions): IgniterCallerBuilder<IgniterCallerSchemaMapFrom<TNewSchemas>>;
|
|
997
1152
|
/**
|
|
998
|
-
*
|
|
1153
|
+
* Attaches telemetry for request monitoring and observability.
|
|
1154
|
+
*
|
|
1155
|
+
* Telemetry is optional and only emits events when a manager is provided.
|
|
1156
|
+
*
|
|
1157
|
+
* Telemetry events emitted by the caller package include:
|
|
1158
|
+
* - `request.execute.started`
|
|
1159
|
+
* - `request.execute.success`
|
|
1160
|
+
* - `request.execute.error`
|
|
1161
|
+
* - `request.timeout.error`
|
|
1162
|
+
* - `cache.read.hit`
|
|
1163
|
+
* - `retry.attempt.started`
|
|
1164
|
+
* - `validation.request.error`
|
|
1165
|
+
* - `validation.response.error`
|
|
1166
|
+
*
|
|
1167
|
+
* @param telemetry - Telemetry manager instance.
|
|
1168
|
+
*
|
|
1169
|
+
* @example
|
|
1170
|
+
* ```ts
|
|
1171
|
+
* import { IgniterTelemetry } from '@igniter-js/telemetry'
|
|
1172
|
+
* import { IgniterCallerTelemetryEvents } from '@igniter-js/caller/telemetry'
|
|
1173
|
+
*
|
|
1174
|
+
* const telemetry = IgniterTelemetry.create()
|
|
1175
|
+
* .withService('my-api')
|
|
1176
|
+
* .addEvents(IgniterCallerTelemetryEvents)
|
|
1177
|
+
* .build()
|
|
1178
|
+
*
|
|
1179
|
+
* const api = IgniterCaller.create()
|
|
1180
|
+
* .withBaseUrl('https://api.example.com')
|
|
1181
|
+
* .withTelemetry(telemetry)
|
|
1182
|
+
* .build()
|
|
1183
|
+
* ```
|
|
999
1184
|
*/
|
|
1000
|
-
|
|
1185
|
+
withTelemetry(telemetry: IgniterTelemetryManager<any>): IgniterCallerBuilder<TSchemas>;
|
|
1001
1186
|
/**
|
|
1002
|
-
*
|
|
1187
|
+
* Builds the `IgniterCaller` instance.
|
|
1188
|
+
*
|
|
1189
|
+
* @returns Configured manager instance.
|
|
1003
1190
|
*/
|
|
1004
|
-
|
|
1191
|
+
build(): IgniterCallerManager<TSchemas>;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Main entrypoint for the caller builder.
|
|
1195
|
+
*
|
|
1196
|
+
* @example
|
|
1197
|
+
* ```ts
|
|
1198
|
+
* const api = IgniterCaller.create().withBaseUrl('https://api.example.com').build()
|
|
1199
|
+
* ```
|
|
1200
|
+
*/
|
|
1201
|
+
declare const IgniterCaller: {
|
|
1202
|
+
create: typeof IgniterCallerBuilder.create;
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
/**
|
|
1206
|
+
* @fileoverview Path-first schema builder for @igniter-js/caller.
|
|
1207
|
+
* @module @igniter-js/caller/builders/schema-path
|
|
1208
|
+
*/
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* Builder for schema methods within a single path.
|
|
1212
|
+
*/
|
|
1213
|
+
declare class IgniterCallerSchemaPathBuilder<TMethods extends Partial<Record<IgniterCallerSchemaMethod, IgniterCallerEndpointSchema<any, any>>> = {}, TRegistry extends IgniterCallerSchemaRegistry = {}> {
|
|
1214
|
+
private readonly methods;
|
|
1215
|
+
private readonly registry;
|
|
1216
|
+
private constructor();
|
|
1005
1217
|
/**
|
|
1006
|
-
*
|
|
1218
|
+
* Creates a new path builder for the provided registry.
|
|
1007
1219
|
*/
|
|
1008
|
-
static
|
|
1220
|
+
static create<TRegistry extends IgniterCallerSchemaRegistry>(registry: TRegistry): IgniterCallerSchemaPathBuilder<{}, TRegistry>;
|
|
1009
1221
|
/**
|
|
1010
|
-
*
|
|
1222
|
+
* Returns a registry reference helper for a given key.
|
|
1223
|
+
* The helper exposes optional Zod-based wrappers (array/optional/nullable/record).
|
|
1224
|
+
*/
|
|
1225
|
+
ref<TKey extends keyof TRegistry>(key: TKey): {
|
|
1226
|
+
schema: TRegistry[TKey];
|
|
1227
|
+
array: () => SchemaArray<TRegistry[TKey]>;
|
|
1228
|
+
nullable: () => SchemaNullable<TRegistry[TKey]>;
|
|
1229
|
+
optional: () => SchemaOptional<TRegistry[TKey]>;
|
|
1230
|
+
record: (keyType?: StandardSchemaV1) => SchemaRecord<TRegistry[TKey]>;
|
|
1231
|
+
};
|
|
1232
|
+
/**
|
|
1233
|
+
* Defines a GET endpoint.
|
|
1234
|
+
*/
|
|
1235
|
+
get<TRequest extends StandardSchemaV1 | undefined, TResponses extends Record<number | string, StandardSchemaV1>>(config: IgniterCallerSchemaEndpointConfig<TRequest, TResponses>): IgniterCallerSchemaPathBuilder<TMethods & {
|
|
1236
|
+
GET: IgniterCallerEndpointSchema<TRequest, TResponses>;
|
|
1237
|
+
}, TRegistry>;
|
|
1238
|
+
/**
|
|
1239
|
+
* Defines a POST endpoint.
|
|
1240
|
+
*/
|
|
1241
|
+
post<TRequest extends StandardSchemaV1 | undefined, TResponses extends Record<number | string, StandardSchemaV1>>(config: IgniterCallerSchemaEndpointConfig<TRequest, TResponses>): IgniterCallerSchemaPathBuilder<TMethods & {
|
|
1242
|
+
POST: IgniterCallerEndpointSchema<TRequest, TResponses>;
|
|
1243
|
+
}, TRegistry>;
|
|
1244
|
+
/**
|
|
1245
|
+
* Defines a PUT endpoint.
|
|
1246
|
+
*/
|
|
1247
|
+
put<TRequest extends StandardSchemaV1 | undefined, TResponses extends Record<number | string, StandardSchemaV1>>(config: IgniterCallerSchemaEndpointConfig<TRequest, TResponses>): IgniterCallerSchemaPathBuilder<TMethods & {
|
|
1248
|
+
PUT: IgniterCallerEndpointSchema<TRequest, TResponses>;
|
|
1249
|
+
}, TRegistry>;
|
|
1250
|
+
/**
|
|
1251
|
+
* Defines a PATCH endpoint.
|
|
1252
|
+
*/
|
|
1253
|
+
patch<TRequest extends StandardSchemaV1 | undefined, TResponses extends Record<number | string, StandardSchemaV1>>(config: IgniterCallerSchemaEndpointConfig<TRequest, TResponses>): IgniterCallerSchemaPathBuilder<TMethods & {
|
|
1254
|
+
PATCH: IgniterCallerEndpointSchema<TRequest, TResponses>;
|
|
1255
|
+
}, TRegistry>;
|
|
1256
|
+
/**
|
|
1257
|
+
* Defines a DELETE endpoint.
|
|
1258
|
+
*/
|
|
1259
|
+
delete<TRequest extends StandardSchemaV1 | undefined, TResponses extends Record<number | string, StandardSchemaV1>>(config: IgniterCallerSchemaEndpointConfig<TRequest, TResponses>): IgniterCallerSchemaPathBuilder<TMethods & {
|
|
1260
|
+
DELETE: IgniterCallerEndpointSchema<TRequest, TResponses>;
|
|
1261
|
+
}, TRegistry>;
|
|
1262
|
+
/**
|
|
1263
|
+
* Defines a HEAD endpoint.
|
|
1264
|
+
*/
|
|
1265
|
+
head<TRequest extends StandardSchemaV1 | undefined, TResponses extends Record<number | string, StandardSchemaV1>>(config: IgniterCallerSchemaEndpointConfig<TRequest, TResponses>): IgniterCallerSchemaPathBuilder<TMethods & {
|
|
1266
|
+
HEAD: IgniterCallerEndpointSchema<TRequest, TResponses>;
|
|
1267
|
+
}, TRegistry>;
|
|
1268
|
+
/**
|
|
1269
|
+
* Builds the accumulated method map for the path.
|
|
1270
|
+
*/
|
|
1271
|
+
build(): TMethods;
|
|
1272
|
+
private addMethod;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* @fileoverview Schema builder for @igniter-js/caller.
|
|
1277
|
+
* @module @igniter-js/caller/builders/schema
|
|
1278
|
+
*/
|
|
1279
|
+
|
|
1280
|
+
/**
|
|
1281
|
+
* Path-first builder for caller schemas with registry support.
|
|
1282
|
+
*/
|
|
1283
|
+
declare class IgniterCallerSchema<TSchemas extends IgniterCallerSchemaMap = {}, TRegistry extends IgniterCallerSchemaRegistry = {}> {
|
|
1284
|
+
private readonly schemas;
|
|
1285
|
+
private readonly registry;
|
|
1286
|
+
private constructor();
|
|
1287
|
+
/**
|
|
1288
|
+
* Creates a new empty schema builder.
|
|
1289
|
+
*/
|
|
1290
|
+
static create(): IgniterCallerSchema<{}, {}>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Registers a reusable schema in the registry.
|
|
1293
|
+
*/
|
|
1294
|
+
schema<TKey extends string, TSchema extends StandardSchemaV1>(key: TKey, schema: TSchema, options?: {
|
|
1295
|
+
internal?: boolean;
|
|
1296
|
+
}): IgniterCallerSchema<TSchemas, TRegistry & {
|
|
1297
|
+
[K in TKey]: TSchema;
|
|
1298
|
+
}>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Defines a path with its methods using a fluent builder.
|
|
1301
|
+
*/
|
|
1302
|
+
path<TPath extends string, TMethods extends Partial<Record<IgniterCallerSchemaMethod, IgniterCallerEndpointSchema<any, any>>>>(path: TPath, builder: (pathBuilder: IgniterCallerSchemaPathBuilder<{}, TRegistry>) => IgniterCallerSchemaPathBuilder<TMethods, TRegistry>): IgniterCallerSchema<TSchemas & {
|
|
1303
|
+
[K in TPath]: TMethods;
|
|
1304
|
+
}, TRegistry>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Builds the schema map and attaches inference + runtime helpers.
|
|
1307
|
+
*/
|
|
1308
|
+
build(): IgniterCallerSchemaBuildResult<TSchemas, TRegistry>;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Stable error codes emitted by `IgniterCaller`.
|
|
1313
|
+
*/
|
|
1314
|
+
type IgniterCallerErrorCode = 'IGNITER_CALLER_HTTP_ERROR' | 'IGNITER_CALLER_TIMEOUT' | 'IGNITER_CALLER_REQUEST_VALIDATION_FAILED' | 'IGNITER_CALLER_RESPONSE_VALIDATION_FAILED' | 'IGNITER_CALLER_SCHEMA_DUPLICATE' | 'IGNITER_CALLER_SCHEMA_INVALID' | 'IGNITER_CALLER_UNKNOWN_ERROR';
|
|
1315
|
+
/**
|
|
1316
|
+
* Operation identifiers used to describe where an error happened.
|
|
1317
|
+
*/
|
|
1318
|
+
type IgniterCallerOperation = 'execute' | 'download' | 'buildRequest' | 'parseResponse' | 'validateRequest' | 'validateResponse' | 'buildSchema';
|
|
1319
|
+
/**
|
|
1320
|
+
* Payload used to create an {@link IgniterCallerError}.
|
|
1321
|
+
*/
|
|
1322
|
+
type IgniterCallerErrorPayload = {
|
|
1323
|
+
/** Machine-readable error code. */
|
|
1324
|
+
code: IgniterCallerErrorCode;
|
|
1325
|
+
/** Where the error happened. */
|
|
1326
|
+
operation: IgniterCallerOperation;
|
|
1327
|
+
/** Human-readable message. */
|
|
1328
|
+
message: string;
|
|
1329
|
+
/** Optional HTTP status code when surfacing errors through HTTP boundaries. */
|
|
1330
|
+
statusCode?: number;
|
|
1331
|
+
/** Optional HTTP status text (when available). */
|
|
1332
|
+
statusText?: string;
|
|
1333
|
+
/** Extra diagnostic details (e.g. response body or schema issues). */
|
|
1334
|
+
details?: unknown;
|
|
1335
|
+
/** Arbitrary metadata for debugging. */
|
|
1336
|
+
metadata?: Record<string, unknown>;
|
|
1337
|
+
/** Optional original cause. */
|
|
1338
|
+
cause?: Error;
|
|
1339
|
+
/** Optional logger used by IgniterError. */
|
|
1340
|
+
logger?: IgniterLogger;
|
|
1341
|
+
};
|
|
1342
|
+
/**
|
|
1343
|
+
* Typed error for predictable failures in `IgniterCaller`.
|
|
1344
|
+
*
|
|
1345
|
+
* Designed to be extracted into `@igniter-js/caller`.
|
|
1346
|
+
*/
|
|
1347
|
+
declare class IgniterCallerError extends IgniterError {
|
|
1348
|
+
/** Machine-readable error code. */
|
|
1349
|
+
readonly code: IgniterCallerErrorCode;
|
|
1350
|
+
/** Operation that produced the error. */
|
|
1351
|
+
readonly operation: IgniterCallerOperation;
|
|
1352
|
+
/** Optional HTTP status text. */
|
|
1353
|
+
readonly statusText?: string;
|
|
1354
|
+
/** Optional original error cause. */
|
|
1355
|
+
readonly cause?: Error;
|
|
1356
|
+
/**
|
|
1357
|
+
* Creates a new typed caller error.
|
|
1011
1358
|
*
|
|
1012
|
-
* @param
|
|
1359
|
+
* @param payload - Error payload with code, message, and metadata.
|
|
1013
1360
|
*/
|
|
1014
|
-
|
|
1361
|
+
constructor(payload: IgniterCallerErrorPayload);
|
|
1015
1362
|
/**
|
|
1016
|
-
*
|
|
1363
|
+
* Type guard for `IgniterCallerError`.
|
|
1364
|
+
*
|
|
1365
|
+
* @param error - Value to check.
|
|
1017
1366
|
*/
|
|
1018
|
-
static
|
|
1367
|
+
static is(error: unknown): error is IgniterCallerError;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* Body utilities for `IgniterCaller`.
|
|
1372
|
+
*/
|
|
1373
|
+
declare class IgniterCallerBodyUtils {
|
|
1019
1374
|
/**
|
|
1020
|
-
*
|
|
1375
|
+
* Returns true when the request body should be passed to `fetch` as-is.
|
|
1376
|
+
*
|
|
1377
|
+
* @param body - Request body to inspect.
|
|
1378
|
+
* @returns True if the body should be sent as raw data.
|
|
1021
1379
|
*/
|
|
1022
|
-
|
|
1380
|
+
static isRawBody(body: unknown): boolean;
|
|
1023
1381
|
/**
|
|
1024
|
-
*
|
|
1382
|
+
* Removes Content-Type for FormData so fetch can set boundaries automatically.
|
|
1383
|
+
*
|
|
1384
|
+
* @param headers - Request headers map.
|
|
1385
|
+
* @param body - Request body.
|
|
1386
|
+
* @returns Updated headers without Content-Type when needed.
|
|
1025
1387
|
*/
|
|
1026
|
-
|
|
1388
|
+
static normalizeHeadersForBody(headers: Record<string, string> | undefined, body: unknown): Record<string, string> | undefined;
|
|
1027
1389
|
}
|
|
1028
1390
|
|
|
1029
1391
|
/**
|
|
@@ -1035,6 +1397,10 @@ declare class IgniterCallerSchemaUtils {
|
|
|
1035
1397
|
/**
|
|
1036
1398
|
* Matches a URL path against schema map paths (supports path parameters).
|
|
1037
1399
|
*
|
|
1400
|
+
* @param actualPath - Incoming request path.
|
|
1401
|
+
* @param schemaPath - Schema path pattern.
|
|
1402
|
+
* @returns Match result with params when matched.
|
|
1403
|
+
*
|
|
1038
1404
|
* @example
|
|
1039
1405
|
* ```ts
|
|
1040
1406
|
* matchPath('/users/123', '/users/:id') // { matched: true, params: { id: '123' } }
|
|
@@ -1047,6 +1413,11 @@ declare class IgniterCallerSchemaUtils {
|
|
|
1047
1413
|
};
|
|
1048
1414
|
/**
|
|
1049
1415
|
* Finds the schema for a given path and method from the schema map.
|
|
1416
|
+
*
|
|
1417
|
+
* @param schemaMap - Schema map from the builder.
|
|
1418
|
+
* @param path - Request path to match.
|
|
1419
|
+
* @param method - HTTP method to match.
|
|
1420
|
+
* @returns Matching schema and extracted params.
|
|
1050
1421
|
*/
|
|
1051
1422
|
static findSchema(schemaMap: IgniterCallerSchemaMap | undefined, path: string, method: string): {
|
|
1052
1423
|
schema: IgniterCallerEndpointSchema | undefined;
|
|
@@ -1057,12 +1428,21 @@ declare class IgniterCallerSchemaUtils {
|
|
|
1057
1428
|
*
|
|
1058
1429
|
* If the schema provides `~standard.validate`, it will be used.
|
|
1059
1430
|
* Otherwise, returns the input as-is.
|
|
1431
|
+
*
|
|
1432
|
+
* @param schema - StandardSchema instance.
|
|
1433
|
+
* @param input - Input value to validate.
|
|
1434
|
+
* @returns Validated input value.
|
|
1060
1435
|
*/
|
|
1061
1436
|
private static validateWithStandardSchema;
|
|
1062
1437
|
/**
|
|
1063
1438
|
* Validates request body against schema.
|
|
1064
1439
|
*
|
|
1065
|
-
* @
|
|
1440
|
+
* @param data - Request body data.
|
|
1441
|
+
* @param schema - Request schema (if any).
|
|
1442
|
+
* @param options - Validation options.
|
|
1443
|
+
* @param context - Request context for error reporting.
|
|
1444
|
+
* @param logger - Optional logger instance.
|
|
1445
|
+
* @returns Validated data or throws/logs error based on validation mode.
|
|
1066
1446
|
*/
|
|
1067
1447
|
static validateRequest<T>(data: unknown, schema: StandardSchemaV1 | undefined, options: IgniterCallerSchemaValidationOptions | undefined, context: {
|
|
1068
1448
|
url: string;
|
|
@@ -1071,7 +1451,13 @@ declare class IgniterCallerSchemaUtils {
|
|
|
1071
1451
|
/**
|
|
1072
1452
|
* Validates response data against schema.
|
|
1073
1453
|
*
|
|
1074
|
-
* @
|
|
1454
|
+
* @param data - Response payload to validate.
|
|
1455
|
+
* @param schema - Response schema (if any).
|
|
1456
|
+
* @param statusCode - HTTP status code.
|
|
1457
|
+
* @param options - Validation options.
|
|
1458
|
+
* @param context - Request context for error reporting.
|
|
1459
|
+
* @param logger - Optional logger instance.
|
|
1460
|
+
* @returns Validated data or throws/logs error based on validation mode.
|
|
1075
1461
|
*/
|
|
1076
1462
|
static validateResponse<T>(data: unknown, schema: StandardSchemaV1 | undefined, statusCode: number, options: IgniterCallerSchemaValidationOptions | undefined, context: {
|
|
1077
1463
|
url: string;
|
|
@@ -1079,6 +1465,92 @@ declare class IgniterCallerSchemaUtils {
|
|
|
1079
1465
|
}, logger?: IgniterLogger): Promise<T>;
|
|
1080
1466
|
}
|
|
1081
1467
|
|
|
1468
|
+
/**
|
|
1469
|
+
* URL utilities for `IgniterCaller`.
|
|
1470
|
+
*/
|
|
1471
|
+
declare class IgniterCallerUrlUtils {
|
|
1472
|
+
/**
|
|
1473
|
+
* Builds a full URL with optional base URL and query parameters.
|
|
1474
|
+
*
|
|
1475
|
+
* @param params - URL construction parameters.
|
|
1476
|
+
* @returns Full URL string.
|
|
1477
|
+
*/
|
|
1478
|
+
static buildUrl(params: {
|
|
1479
|
+
url: string;
|
|
1480
|
+
baseURL?: string;
|
|
1481
|
+
query?: Record<string, string | number | boolean>;
|
|
1482
|
+
}): string;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* Cache interface for HTTP responses.
|
|
1487
|
+
*
|
|
1488
|
+
* Supports both in-memory caching and persistent store-based caching (Redis, etc).
|
|
1489
|
+
*/
|
|
1490
|
+
declare class IgniterCallerCacheUtils {
|
|
1491
|
+
private static cache;
|
|
1492
|
+
private static store;
|
|
1493
|
+
private static storeOptions;
|
|
1494
|
+
/**
|
|
1495
|
+
* Configures a persistent store adapter for caching.
|
|
1496
|
+
*
|
|
1497
|
+
* When configured, cache operations will use the store (e.g., Redis)
|
|
1498
|
+
* instead of in-memory cache, enabling persistent cache across deployments.
|
|
1499
|
+
*
|
|
1500
|
+
* @param store - Store adapter implementation.
|
|
1501
|
+
* @param options - Store options such as ttl and key prefix.
|
|
1502
|
+
*/
|
|
1503
|
+
static setStore(store: IgniterCallerStoreAdapter, options?: IgniterCallerStoreOptions): void;
|
|
1504
|
+
/**
|
|
1505
|
+
* Gets the configured store adapter.
|
|
1506
|
+
*
|
|
1507
|
+
* @returns Store adapter or null when unset.
|
|
1508
|
+
*/
|
|
1509
|
+
static getStore(): IgniterCallerStoreAdapter | null;
|
|
1510
|
+
/**
|
|
1511
|
+
* Gets cached data if it exists and is not stale.
|
|
1512
|
+
*
|
|
1513
|
+
* @param key - Cache key (without prefix).
|
|
1514
|
+
* @param staleTime - Optional stale time in milliseconds.
|
|
1515
|
+
* @returns Cached value or undefined when missing/stale.
|
|
1516
|
+
*/
|
|
1517
|
+
static get<T>(key: string, staleTime?: number): Promise<T | undefined>;
|
|
1518
|
+
/**
|
|
1519
|
+
* Stores data in cache with current timestamp.
|
|
1520
|
+
*
|
|
1521
|
+
* @param key - Cache key (without prefix).
|
|
1522
|
+
* @param data - Data to cache.
|
|
1523
|
+
* @param ttl - Optional TTL override in seconds.
|
|
1524
|
+
*/
|
|
1525
|
+
static set(key: string, data: unknown, ttl?: number): Promise<void>;
|
|
1526
|
+
/**
|
|
1527
|
+
* Clears a specific cache entry.
|
|
1528
|
+
*
|
|
1529
|
+
* @param key - Cache key (without prefix).
|
|
1530
|
+
*/
|
|
1531
|
+
static clear(key: string): Promise<void>;
|
|
1532
|
+
/**
|
|
1533
|
+
* Clears all cache entries matching a pattern.
|
|
1534
|
+
*
|
|
1535
|
+
* @param pattern Glob pattern (e.g., '/users/*') or exact key
|
|
1536
|
+
*/
|
|
1537
|
+
static clearPattern(pattern: string): Promise<void>;
|
|
1538
|
+
/**
|
|
1539
|
+
* Clears all cache entries.
|
|
1540
|
+
*
|
|
1541
|
+
* @returns Promise that resolves when in-memory cache is cleared.
|
|
1542
|
+
*/
|
|
1543
|
+
static clearAll(): Promise<void>;
|
|
1544
|
+
/**
|
|
1545
|
+
* Adds the configured prefix to a key.
|
|
1546
|
+
*/
|
|
1547
|
+
private static getPrefixedKey;
|
|
1548
|
+
/**
|
|
1549
|
+
* Converts a glob pattern to a RegExp.
|
|
1550
|
+
*/
|
|
1551
|
+
private static globToRegex;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1082
1554
|
/**
|
|
1083
1555
|
* Testing utilities for `IgniterCaller`.
|
|
1084
1556
|
*
|
|
@@ -1087,28 +1559,30 @@ declare class IgniterCallerSchemaUtils {
|
|
|
1087
1559
|
declare class IgniterCallerMock {
|
|
1088
1560
|
/**
|
|
1089
1561
|
* Creates a successful mock response.
|
|
1562
|
+
*
|
|
1563
|
+
* @param data - Mock response data.
|
|
1090
1564
|
*/
|
|
1091
1565
|
static mockResponse<T>(data: T): IgniterCallerApiResponse<T>;
|
|
1092
1566
|
/**
|
|
1093
1567
|
* Creates an error mock response.
|
|
1568
|
+
*
|
|
1569
|
+
* @param code - Error code to use.
|
|
1570
|
+
* @param message - Optional error message.
|
|
1094
1571
|
*/
|
|
1095
1572
|
static mockError<T = never>(code: IgniterCallerErrorCode, message?: string): IgniterCallerApiResponse<T>;
|
|
1096
1573
|
/**
|
|
1097
1574
|
* Creates a successful file download mock.
|
|
1575
|
+
*
|
|
1576
|
+
* @param filename - File name for the mock.
|
|
1577
|
+
* @param content - File contents as string or Blob.
|
|
1098
1578
|
*/
|
|
1099
1579
|
static mockFile(filename: string, content: string | Blob): IgniterCallerFileResponse;
|
|
1100
1580
|
/**
|
|
1101
1581
|
* Creates a failed file download mock.
|
|
1582
|
+
*
|
|
1583
|
+
* @param message - Optional error message.
|
|
1102
1584
|
*/
|
|
1103
1585
|
static mockFileError(message?: string): IgniterCallerFileResponse;
|
|
1104
1586
|
}
|
|
1105
1587
|
|
|
1106
|
-
|
|
1107
|
-
static buildUrl(params: {
|
|
1108
|
-
url: string;
|
|
1109
|
-
baseURL?: string;
|
|
1110
|
-
query?: Record<string, string | number | boolean>;
|
|
1111
|
-
}): string;
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
export { type DeletePaths, type EndpointInfo, type ExtractPathParams, type GetPaths, type HeadPaths, IgniterCaller, type IgniterCallerApiResponse, type IgniterCallerBaseRequestOptions, IgniterCallerBodyUtils, IgniterCallerBuilder, type IgniterCallerBuilderFactory, type IgniterCallerBuilderState, IgniterCallerCacheUtils, type IgniterCallerDirectRequestOptions, type IgniterCallerEndpointSchema, IgniterCallerError, type IgniterCallerErrorCode, type IgniterCallerErrorPayload, type IgniterCallerEventCallback, IgniterCallerEvents, type IgniterCallerFileResponse, type IgniterCallerHttpMethod, type IgniterCallerMethodRequestBuilder, IgniterCallerMock, type IgniterCallerOperation, IgniterCallerRequestBuilder, type IgniterCallerRequestBuilderParams, type IgniterCallerRequestInterceptor, type IgniterCallerRequestOptions, type IgniterCallerResponseContentType, type IgniterCallerResponseInterceptor, type IgniterCallerResponseMarker, type IgniterCallerRetryOptions, type IgniterCallerSchemaMap, type IgniterCallerSchemaMethod, IgniterCallerSchemaUtils, type IgniterCallerSchemaValidationOptions, type IgniterCallerStoreAdapter, type IgniterCallerStoreOptions, type IgniterCallerTypedRequestBuilder, type IgniterCallerUrlPattern, IgniterCallerUrlUtils, type IgniterCallerValidatableContentType, type InferAllResponseTypes, type InferRequestType, type InferResponseType, type InferSuccessResponseType, type PatchPaths, type PathsForMethod, type PostPaths, type PutPaths, type ReplaceCallerSchema, type SchemaMapEndpoint, type SchemaMapMethods, type SchemaMapPaths, type SchemaMapRequestType, type SchemaMapResponseType, type TypedRequestBuilder };
|
|
1588
|
+
export { type DeletePaths, type EndpointInfo, type ExtractPathParams, type GetEndpoint, type GetPaths, type HeadPaths, type IIgniterCallerManager, IgniterCaller, type IgniterCallerApiResponse, type IgniterCallerBaseRequestOptions, IgniterCallerBodyUtils, IgniterCallerBuilder, type IgniterCallerBuilderState, IgniterCallerCacheUtils, type IgniterCallerDirectRequestOptions, type IgniterCallerEndpointSchema, IgniterCallerError, type IgniterCallerErrorCode, type IgniterCallerErrorPayload, type IgniterCallerEventCallback, IgniterCallerEvents, type IgniterCallerFileResponse, type IgniterCallerHttpMethod, IgniterCallerManager, type IgniterCallerMethodRequestBuilder, IgniterCallerMock, type IgniterCallerOperation, IgniterCallerRequestBuilder, type IgniterCallerRequestBuilderParams, type IgniterCallerRequestInterceptor, type IgniterCallerRequestOptions, type IgniterCallerResponseContentType, type IgniterCallerResponseInterceptor, type IgniterCallerResponseMarker, type IgniterCallerRetryOptions, IgniterCallerSchema, type IgniterCallerSchemaBuildResult, type IgniterCallerSchemaEndpointConfig, type IgniterCallerSchemaGetters, type IgniterCallerSchemaInfer, type IgniterCallerSchemaInput, type IgniterCallerSchemaMap, type IgniterCallerSchemaMapFrom, type IgniterCallerSchemaMethod, IgniterCallerSchemaPathBuilder, type IgniterCallerSchemaRegistry, IgniterCallerSchemaUtils, type IgniterCallerSchemaValidationOptions, IgniterCallerStoreAdapter, IgniterCallerStoreOptions, type IgniterCallerTypedRequestBuilder, type IgniterCallerUrlPattern, IgniterCallerUrlUtils, type IgniterCallerValidatableContentType, type InferAllResponseTypes, type InferRequestType, type InferResponse, type InferResponseType, type InferSuccessResponse, type InferSuccessResponseType, type PatchPaths, type PathsForMethod, type PostPaths, type PutPaths, type ResolveStatusKey, type SchemaArray, type SchemaMapEndpoint, type SchemaMapMethods, type SchemaMapPaths, type SchemaMapRequestSchema, type SchemaMapRequestType, type SchemaMapResponseSchema, type SchemaMapResponseType, type SchemaMapResponses, type SchemaMapResponsesType, type SchemaNullable, type SchemaOptional, type SchemaRecord, type TypedRequestBuilder };
|