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 +86 -3
- package/dist/auth.d.ts +60 -13
- package/dist/auth.d.ts.map +1 -1
- package/dist/endpoint/BaseEndpoint.d.ts +45 -2
- package/dist/endpoint/BaseEndpoint.d.ts.map +1 -1
- package/dist/http/HttpClient.d.ts +131 -0
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/index.cjs +634 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +628 -87
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +63 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/metrics.d.ts +73 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/schemas/common.d.ts +57 -5
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/types.d.ts +125 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/validation.d.ts +39 -0
- package/dist/validation.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/validation.d.ts
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SafeParseResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Safely parse data with a Zod schema without throwing.
|
|
5
|
+
* Returns a result object with success status and data or error.
|
|
6
|
+
*
|
|
7
|
+
* @param schema - Zod schema to validate against
|
|
8
|
+
* @param data - Data to validate
|
|
9
|
+
* @returns Result object with success flag and data/error
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const result = safeParse(UserSchema, userData);
|
|
14
|
+
* if (result.success) {
|
|
15
|
+
* console.log(result.data);
|
|
16
|
+
* } else {
|
|
17
|
+
* console.error(result.error);
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
3
21
|
export declare function safeParse<T>(schema: z.ZodTypeAny, data: unknown): SafeParseResult<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Parse data with a Zod schema, throwing an ApiError on validation failure.
|
|
24
|
+
* Use this when you want to fail fast on invalid data.
|
|
25
|
+
*
|
|
26
|
+
* @param schema - Zod schema to validate against
|
|
27
|
+
* @param data - Data to validate
|
|
28
|
+
* @returns Validated and typed data
|
|
29
|
+
* @throws {ApiError} If validation fails
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* try {
|
|
34
|
+
* const user = parseOrThrow(UserSchema, userData);
|
|
35
|
+
* console.log(user);
|
|
36
|
+
* } catch (error) {
|
|
37
|
+
* if (error instanceof ApiError && error.zodError) {
|
|
38
|
+
* console.error('Validation failed:', error.zodError.issues);
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
4
43
|
export declare function parseOrThrow<T>(schema: z.ZodTypeAny, data: unknown): T;
|
|
5
44
|
//# sourceMappingURL=validation.d.ts.map
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../lib/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAY,eAAe,EAAE,MAAM,SAAS,CAAC;AAEpD,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,GAAG,eAAe,CAAC,CAAC,CAAC,CAIpF;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,GAAG,CAAC,CAMtE"}
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../lib/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAY,eAAe,EAAE,MAAM,SAAS,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,GAAG,eAAe,CAAC,CAAC,CAAC,CAIpF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,GAAG,CAAC,CAMtE"}
|