zlient 1.0.4 → 1.0.5

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/README.md CHANGED
@@ -6,11 +6,14 @@ A type-safe HTTP client framework with Zod validation for building robust API cl
6
6
 
7
7
  - 🔒 **Type-safe**: Full TypeScript support with automatic type inference
8
8
  - ✅ **Runtime validation**: Zod schemas for request/response validation
9
- - 🔄 **Retry logic**: Built-in configurable retry strategies
9
+ - 🔄 **Retry logic**: Built-in configurable retry strategies with exponential backoff
10
10
  - 🎯 **Authentication**: Multiple auth providers (API Key, Bearer Token, Custom)
11
11
  - 🪝 **Interceptors**: Before request and after response hooks
12
12
  - ⏱️ **Timeouts**: Configurable request timeouts
13
13
  - 📦 **Multiple endpoints**: Easy service separation with base URL mapping
14
+ - 📊 **Observability**: Built-in logging and metrics collection
15
+ - 🎨 **Developer Experience**: Comprehensive JSDoc, helper methods, great error messages
16
+ - 🏢 **Enterprise-ready**: Production-grade logging, metrics, and monitoring support
14
17
 
15
18
  ## Installation
16
19
 
@@ -304,6 +307,76 @@ await endpoint.call(data, {
304
307
  });
305
308
  ```
306
309
 
310
+ ### Logging and Metrics
311
+
312
+ #### Structured Logging
313
+
314
+ ```typescript
315
+ import { HttpClient, ConsoleLogger, LogLevel } from 'zlient';
316
+
317
+ const client = new HttpClient({
318
+ baseUrls: { default: 'https://api.example.com' },
319
+ logger: new ConsoleLogger(LogLevel.INFO),
320
+ });
321
+
322
+ // All requests are automatically logged with duration, status, etc.
323
+ ```
324
+
325
+ #### Metrics Collection
326
+
327
+ ```typescript
328
+ import { HttpClient, InMemoryMetricsCollector } from 'zlient';
329
+
330
+ const metrics = new InMemoryMetricsCollector();
331
+ const client = new HttpClient({
332
+ baseUrls: { default: 'https://api.example.com' },
333
+ metrics,
334
+ });
335
+
336
+ // View metrics summary
337
+ const summary = metrics.getSummary();
338
+ console.log(`Success rate: ${(summary.successful / summary.total * 100).toFixed(2)}%`);
339
+ console.log(`Avg duration: ${summary.avgDurationMs}ms`);
340
+ ```
341
+
342
+ #### Custom Logger/Metrics Integration
343
+
344
+ ```typescript
345
+ import { Logger, LogEntry, MetricsCollector, RequestMetrics } from 'zlient';
346
+
347
+ // Integrate with your logging service (e.g., DataDog, CloudWatch)
348
+ class CustomLogger implements Logger {
349
+ log(entry: LogEntry) {
350
+ // Send to your logging service
351
+ myLoggingService.log(entry);
352
+ }
353
+ }
354
+
355
+ class CustomMetrics implements MetricsCollector {
356
+ collect(metrics: RequestMetrics) {
357
+ // Send to your metrics service (e.g., Prometheus, DataDog)
358
+ dogstatsd.histogram('http.request.duration', metrics.durationMs);
359
+ }
360
+ }
361
+
362
+ const client = new HttpClient({
363
+ baseUrls: { default: 'https://api.example.com' },
364
+ logger: new CustomLogger(),
365
+ metrics: new CustomMetrics(),
366
+ });
367
+ ```
368
+
369
+ ### Convenience Methods
370
+
371
+ ```typescript
372
+ // Use shortcuts instead of full request() method
373
+ const { data: users } = await client.get('/users', { query: { page: 1 } });
374
+ const { data: user } = await client.post('/users', { name: 'John' });
375
+ const { data: updated } = await client.put('/users/1', { name: 'Jane' });
376
+ const { data: patched } = await client.patch('/users/1', { email: 'new@email.com' });
377
+ await client.delete('/users/1');
378
+ ```
379
+
307
380
  ### Error Handling
308
381
 
309
382
  ```typescript
@@ -317,9 +390,19 @@ try {
317
390
  console.error('Status:', error.status);
318
391
  console.error('Details:', error.details);
319
392
 
320
- if (error.zodError) {
321
- console.error('Validation errors:', error.zodError.errors);
393
+ // Check error type
394
+ if (error.isValidationError()) {
395
+ console.error('Validation errors:', error.zodError?.issues);
396
+ }
397
+ if (error.isClientError()) {
398
+ console.error('Client error (4xx)');
322
399
  }
400
+ if (error.isServerError()) {
401
+ console.error('Server error (5xx)');
402
+ }
403
+
404
+ // Get full error details
405
+ console.error(JSON.stringify(error.toJSON(), null, 2));
323
406
  }
324
407
  }
325
408
  ```
package/dist/auth.d.ts CHANGED
@@ -1,18 +1,56 @@
1
1
  import type { RequestOptions as ReqOpts } from './types';
2
+ /**
3
+ * Extended RequestInit with URL override capability for query-based auth.
4
+ */
5
+ export interface AuthContext {
6
+ url: string;
7
+ init: RequestInit & {
8
+ __urlOverride?: string;
9
+ };
10
+ options?: ReqOpts;
11
+ }
12
+ /**
13
+ * Interface for authentication providers.
14
+ * Implement this to create custom authentication strategies.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * class CustomAuth implements AuthProvider {
19
+ * async apply({ init }) {
20
+ * init.headers = { ...init.headers, 'X-Custom-Auth': 'token' };
21
+ * }
22
+ * }
23
+ * ```
24
+ */
2
25
  export interface AuthProvider {
3
26
  /**
4
27
  * Apply authentication to the outgoing request.
5
28
  * Called after SDK headers are assembled, but before request is sent.
29
+ *
30
+ * @param req - Request context including URL, init, and options
6
31
  */
7
- apply(req: {
8
- url: string;
9
- init: RequestInit;
10
- options?: ReqOpts;
11
- }): Promise<void> | void;
32
+ apply(req: AuthContext): Promise<void> | void;
12
33
  }
34
+ /**
35
+ * No-op authentication provider (no authentication applied).
36
+ * Use this when you don't need authentication.
37
+ */
13
38
  export declare class NoAuth implements AuthProvider {
14
39
  apply(): Promise<void>;
15
40
  }
41
+ /**
42
+ * API Key authentication provider.
43
+ * Supports both header-based and query parameter-based authentication.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * // Header-based
48
+ * const auth = new ApiKeyAuth({ header: 'X-API-Key', value: 'secret' });
49
+ *
50
+ * // Query parameter-based
51
+ * const auth = new ApiKeyAuth({ query: 'apiKey', value: 'secret' });
52
+ * ```
53
+ */
16
54
  export declare class ApiKeyAuth implements AuthProvider {
17
55
  private opts;
18
56
  constructor(opts: {
@@ -20,17 +58,26 @@ export declare class ApiKeyAuth implements AuthProvider {
20
58
  query?: string;
21
59
  value: string;
22
60
  });
23
- apply({ url, init }: {
24
- url: string;
25
- init: RequestInit;
26
- }): void;
61
+ apply({ url, init }: AuthContext): void;
27
62
  }
63
+ /**
64
+ * Bearer token authentication provider.
65
+ * Supports both static tokens and dynamic token fetching (e.g., for OAuth2 refresh).
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * // Static token
70
+ * const auth = new BearerTokenAuth(() => 'my-token');
71
+ *
72
+ * // Dynamic token with refresh
73
+ * const auth = new BearerTokenAuth(async () => {
74
+ * return await refreshAccessToken();
75
+ * });
76
+ * ```
77
+ */
28
78
  export declare class BearerTokenAuth implements AuthProvider {
29
79
  private getToken;
30
80
  constructor(getToken: () => Promise<string> | string);
31
- apply({ init }: {
32
- url: string;
33
- init: RequestInit;
34
- }): Promise<void>;
81
+ apply({ init }: AuthContext): Promise<void>;
35
82
  }
36
83
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../lib/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,CAAC,GAAG,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACzF;AAED,qBAAa,MAAO,YAAW,YAAY;IACnC,KAAK;CAGZ;AAED,qBAAa,UAAW,YAAW,YAAY;IACjC,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAC5E,KAAK,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE;CASxD;AAED,qBAAa,eAAgB,YAAW,YAAY;IACtC,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,MAAM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ttpClient';
3
3
  import { HTTPMethod, RequestOptions } from '../types';
4
4
  /**
5
- * Generic, strongly-typed endpoint with Zod schemas for request and response.
5
+ * Generic, strongly-typed endpoint with Zod schemas for request and response validation.
6
+ * Extend this class to create type-safe API endpoints.
7
+ *
8
+ * @template ReqSchema - Zod schema for request validation
9
+ * @template ResSchema - Zod schema for response validation
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const UserSchema = z.object({ id: z.number(), name: z.string() });
14
+ * const CreateUserSchema = z.object({ name: z.string() });
15
+ *
16
+ * class GetUser extends BaseEndpoint<typeof CreateUserSchema, typeof UserSchema> {
17
+ * protected method = 'GET' as const;
18
+ * protected path = (args: z.infer<typeof CreateUserSchema>) => `/users/${args.id}`;
19
+ *
20
+ * constructor(client: HttpClient) {
21
+ * super(client, {
22
+ * requestSchema: CreateUserSchema,
23
+ * responseSchema: UserSchema
24
+ * });
25
+ * }
26
+ * }
27
+ * ```
6
28
  */
7
29
  export declare abstract class BaseEndpoint<ReqSchema extends z.ZodTypeAny, ResSchema extends z.ZodTypeAny> {
8
30
  protected client: HttpClient;
31
+ /** HTTP method for this endpoint */
9
32
  protected abstract readonly method: keyof typeof HTTPMethod;
10
- protected abstract readonly path: string | ((params: any) => string);
33
+ /** URL path (can be a function for dynamic paths) */
34
+ protected abstract readonly path: string | ((params: z.infer<ReqSchema>) => string);
35
+ /** Optional request schema for validation */
11
36
  protected readonly requestSchema?: ReqSchema;
37
+ /** Response schema for validation */
12
38
  protected readonly responseSchema: ResSchema;
39
+ /**
40
+ * @param client - HttpClient instance
41
+ * @param cfg - Configuration with request and response schemas
42
+ */
13
43
  constructor(client: HttpClient, cfg: {
14
44
  requestSchema?: ReqSchema;
15
45
  responseSchema: ResSchema;
16
46
  });
17
47
  /**
18
48
  * Call the endpoint with strong typing derived from schemas.
49
+ * Validates request data before sending and response data after receiving.
50
+ *
51
+ * @param args - Request arguments (typed by ReqSchema)
52
+ * @param options - Additional request options
53
+ * @returns Promise resolving to validated response data (typed by ResSchema)
54
+ * @throws {ZodError} If request validation fails
55
+ * @throws {ApiError} If response validation fails or request fails
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const endpoint = new GetUser(client);
60
+ * const user = await endpoint.call({ id: 1 });
61
+ * ```
19
62
  */
20
63
  call(args: z.infer<ReqSchema>, options?: RequestOptions): Promise<z.infer<ResSchema>>;
21
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseEndpoint.d.ts","sourceRoot":"","sources":["../../lib/endpoint/BaseEndpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGtD;;GAEG;AACH,8BAAsB,YAAY,CAAC,SAAS,SAAS,CAAC,CAAC,UAAU,EAAE,SAAS,SAAS,CAAC,CAAC,UAAU;IAO7F,SAAS,CAAC,MAAM,EAAE,UAAU;IAN9B,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,UAAU,CAAC;IAC5D,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC,CAAC;IACrE,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC;IAC7C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAC;gBAGjC,MAAM,EAAE,UAAU,EAC5B,GAAG,EAAE;QAAE,aAAa,CAAC,EAAE,SAAS,CAAC;QAAC,cAAc,EAAE,SAAS,CAAA;KAAE;IAM/D;;OAEG;IACG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC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ethod, RequestOptions } from '../types';
2
2
  import type { AuthProvider } from '../auth';
3
+ import { Logger } from '../logger';
4
+ import { MetricsCollector } from '../metrics';
5
+ /**
6
+ * HTTP client with built-in retry logic, authentication, and interceptors.
7
+ * Supports multiple base URLs, type-safe requests, and comprehensive error handling.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const client = new HttpClient({
12
+ * baseUrls: { default: 'https://api.example.com' },
13
+ * headers: { 'Content-Type': 'application/json' },
14
+ * retry: { maxRetries: 3, baseDelayMs: 1000 },
15
+ * timeout: { requestTimeoutMs: 30000 }
16
+ * });
17
+ *
18
+ * const { data } = await client.request('GET', '/users', undefined, { query: { page: 1 } });
19
+ * ```
20
+ */
3
21
  export declare class HttpClient {
4
22
  private fetchImpl;
5
23
  private baseUrls;
@@ -8,18 +26,131 @@ export declare class HttpClient {
8
26
  private retry;
9
27
  private timeoutMs?;
10
28
  private auth;
29
+ private logger;
30
+ private metrics;
31
+ /**
32
+ * Creates a new HTTP client instance.
33
+ *
34
+ * @param opts - Client configuration options
35
+ * @throws {Error} If no fetch implementation is available
36
+ */
11
37
  constructor(opts: ClientOptions & {
12
38
  auth?: AuthProvider;
39
+ logger?: Logger;
40
+ metrics?: MetricsCollector;
13
41
  });
42
+ /**
43
+ * Set or update the authentication provider.
44
+ *
45
+ * @param auth - Authentication provider instance
46
+ * @example
47
+ * ```ts
48
+ * client.setAuth(new BearerTokenAuth(() => getToken()));
49
+ * ```
50
+ */
14
51
  setAuth(auth: AuthProvider): void;
15
52
  private resolveBaseUrl;
53
+ /**
54
+ * Sleep for a specified duration (used for retry backoff).
55
+ * @private
56
+ */
16
57
  private sleep;
58
+ /**
59
+ * Execute a function with retry logic and exponential backoff.
60
+ * @private
61
+ */
17
62
  private withRetry;
63
+ /**
64
+ * Run all registered before-request hooks.
65
+ * @private
66
+ */
18
67
  private runBeforeHooks;
68
+ /**
69
+ * Run all registered after-response hooks.
70
+ * @private
71
+ */
19
72
  private runAfterHooks;
73
+ /**
74
+ * Make an HTTP request with automatic retry, authentication, and validation.
75
+ *
76
+ * @param method - HTTP method (GET, POST, PUT, etc.)
77
+ * @param path - Request path (will be appended to base URL)
78
+ * @param body - Request body (will be JSON.stringify'd if Content-Type is json)
79
+ * @param options - Additional request options (headers, query params, etc.)
80
+ * @returns Promise resolving to response data and Response object
81
+ * @throws {ApiError} If request fails or response validation fails
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const { data, response } = await client.request('GET', '/users', undefined, {
86
+ * query: { page: 1, limit: 10 },
87
+ * headers: { 'X-Custom': 'value' }
88
+ * });
89
+ * ```
90
+ */
20
91
  request<T = unknown>(method: keyof typeof HTTPMethod, path: string, body?: unknown, options?: RequestOptions): Promise<{
21
92
  data: T;
22
93
  response: Response;
23
94
  }>;
95
+ /**
96
+ * Convenience method for GET requests.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const { data } = await client.get('/users', { query: { page: 1 } });
101
+ * ```
102
+ */
103
+ get<T = unknown>(path: string, options?: RequestOptions): Promise<{
104
+ data: T;
105
+ response: Response;
106
+ }>;
107
+ /**
108
+ * Convenience method for POST requests.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const { data } = await client.post('/users', { name: 'John' });
113
+ * ```
114
+ */
115
+ post<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<{
116
+ data: T;
117
+ response: Response;
118
+ }>;
119
+ /**
120
+ * Convenience method for PUT requests.
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const { data } = await client.put('/users/1', { name: 'John Updated' });
125
+ * ```
126
+ */
127
+ put<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<{
128
+ data: T;
129
+ response: Response;
130
+ }>;
131
+ /**
132
+ * Convenience method for PATCH requests.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * const { data } = await client.patch('/users/1', { name: 'John' });
137
+ * ```
138
+ */
139
+ patch<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<{
140
+ data: T;
141
+ response: Response;
142
+ }>;
143
+ /**
144
+ * Convenience method for DELETE requests.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * const { data } = await client.delete('/users/1');
149
+ * ```
150
+ */
151
+ delete<T = unknown>(path: string, options?: RequestOptions): Promise<{
152
+ data: T;
153
+ response: Response;
154
+ }>;
24
155
  }
25
156
  //# sourceMappingURL=HttpClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../lib/http/HttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,UAAU,EAEV,cAAc,EAGf,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,OAAO,CAAyB;IACxC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,IAAI,CAAe;gBAEf,IAAI,EAAE,aAAa,GAAG;QAAE,IAAI,CAAC,EAAE,YAAY,CAAA;KAAE;IAiBzD,OAAO,CAAC,IAAI,EAAE,YAAY;IAI1B,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,KAAK;YAIC,SAAS;YAoBT,cAAc;YAMd,aAAa;IAMrB,OAAO,CAAC,CAAC,GAAG,OAAO,EACvB,MAAM,EAAE,MAAM,OAAO,UAAU,EAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAAC;CA+E5C"}
1
+ {"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../../lib/http/HttpClient.ts"],"names":[],"mappings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