@openid4vc/utils 0.3.0-alpha-20251001121503 → 0.3.0-alpha-20251017082202

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/dist/index.d.mts CHANGED
@@ -1,73 +1,65 @@
1
- import z$1, { ZodError, z } from 'zod';
1
+ import z, { ZodError, z as z$1 } from "zod";
2
2
 
3
- declare const _URL: {
4
- new (url: string | URL, base?: string | URL): URL;
5
- prototype: URL;
6
- canParse(url: string | URL, base?: string | URL): boolean;
7
- createObjectURL(obj: Blob | MediaSource): string;
8
- parse(url: string | URL, base?: string | URL): URL | null;
9
- revokeObjectURL(url: string): void;
10
- };
11
- declare const _URLSearchParams: {
12
- new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
13
- prototype: URLSearchParams;
14
- };
15
- type Fetch = typeof fetch;
16
- type FetchResponse = Response;
17
- declare const _Headers: typeof globalThis.Headers;
18
- type FetchHeaders = globalThis.Headers;
19
- type FetchRequestInit = RequestInit;
20
-
21
- declare class InvalidFetchResponseError extends Error {
22
- readonly textResponse: string;
23
- readonly response: FetchResponse;
24
- constructor(message: string, textResponse: string, response: FetchResponse);
25
- }
26
-
27
- declare class JsonParseError extends Error {
28
- constructor(message: string, jsonString: string);
29
- }
30
-
31
- declare class ValidationError extends Error {
32
- zodError: ZodError | undefined;
33
- constructor(message: string, zodError?: z.ZodError);
34
- }
3
+ //#region src/array.d.ts
35
4
 
36
5
  /**
37
6
  * Only primitive types allowed
38
7
  * Must have not duplicate entries (will always return false in this case)
39
8
  */
40
9
  declare function arrayEqualsIgnoreOrder<Item extends string | number | boolean>(a: Array<Item>, b: Array<Item>): boolean;
41
-
10
+ //#endregion
11
+ //#region src/config.d.ts
42
12
  interface Oid4vcTsConfig {
43
- /**
44
- * Whether to allow insecure http urls.
45
- *
46
- * @default false
47
- */
48
- allowInsecureUrls: boolean;
13
+ /**
14
+ * Whether to allow insecure http urls.
15
+ *
16
+ * @default false
17
+ */
18
+ allowInsecureUrls: boolean;
49
19
  }
50
20
  declare function setGlobalConfig(config: Oid4vcTsConfig): void;
51
21
  declare function getGlobalConfig(): Oid4vcTsConfig;
52
-
22
+ //#endregion
23
+ //#region src/globals.d.ts
24
+ declare const _URL: {
25
+ new (url: string | URL, base?: string | URL): URL;
26
+ prototype: URL;
27
+ canParse(url: string | URL, base?: string | URL): boolean;
28
+ createObjectURL(obj: Blob | MediaSource): string;
29
+ parse(url: string | URL, base?: string | URL): URL | null;
30
+ revokeObjectURL(url: string): void;
31
+ };
32
+ declare const _URLSearchParams: {
33
+ new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
34
+ prototype: URLSearchParams;
35
+ };
36
+ type Fetch = typeof fetch;
37
+ type FetchResponse = Response;
38
+ declare const _Headers: typeof globalThis.Headers;
39
+ type FetchHeaders = globalThis.Headers;
40
+ type FetchRequestInit = RequestInit;
41
+ //#endregion
42
+ //#region src/content-type.d.ts
53
43
  declare enum ContentType {
54
- XWwwFormUrlencoded = "application/x-www-form-urlencoded",
55
- Json = "application/json",
56
- JwkSet = "application/jwk-set+json",
57
- OAuthAuthorizationRequestJwt = "application/oauth-authz-req+jwt",
58
- Jwt = "application/jwt",
59
- Html = "text/html"
44
+ XWwwFormUrlencoded = "application/x-www-form-urlencoded",
45
+ Json = "application/json",
46
+ JwkSet = "application/jwk-set+json",
47
+ OAuthAuthorizationRequestJwt = "application/oauth-authz-req+jwt",
48
+ Jwt = "application/jwt",
49
+ Html = "text/html",
60
50
  }
61
51
  declare function isContentType(contentType: ContentType, value: string): boolean;
62
52
  declare function isResponseContentType(contentType: ContentType | ContentType[], response: FetchResponse): boolean;
63
-
53
+ //#endregion
54
+ //#region src/date.d.ts
64
55
  /**
65
56
  * Get the time in seconds since epoch for a date.
66
57
  * If date is not provided the current time will be used.
67
58
  */
68
59
  declare function dateToSeconds(date?: Date): number;
69
60
  declare function addSecondsToDate(date: Date, seconds: number): Date;
70
-
61
+ //#endregion
62
+ //#region src/encoding.d.ts
71
63
  declare function decodeUtf8String(string: string): Uint8Array;
72
64
  declare function encodeToUtf8String(data: Uint8Array): string;
73
65
  /**
@@ -76,49 +68,33 @@ declare function encodeToUtf8String(data: Uint8Array): string;
76
68
  declare function decodeBase64(base64: string): Uint8Array;
77
69
  declare function encodeToBase64(data: Uint8Array | string): string;
78
70
  declare function encodeToBase64Url(data: Uint8Array | string): string;
79
-
80
- declare function isObject(item: unknown): item is Record<string, unknown>;
81
- /**
82
- * Deep merge two objects.
83
- * @param target
84
- * @param ...sources
85
- */
86
- declare function mergeDeep(target: unknown, ...sources: Array<unknown>): unknown;
87
-
88
- type BaseSchema = z$1.ZodTypeAny;
89
- type InferOutputUnion<T extends readonly any[]> = {
90
- [K in keyof T]: z$1.infer<T[K]>;
91
- }[number];
92
- declare function stringToJsonWithErrorHandling(string: string, errorMessage?: string): any;
93
- declare function parseIfJson<T>(data: T): T | Record<string, unknown>;
94
- declare function parseWithErrorHandling<Schema extends BaseSchema>(schema: Schema, data: unknown, customErrorMessage?: string): z$1.infer<Schema>;
95
-
96
- /**
97
- * Combine multiple uri parts into a single uri taking into account slashes.
98
- *
99
- * @param parts the parts to combine
100
- * @returns the combined url
101
- */
102
- declare function joinUriParts(base: string, parts: string[]): string;
103
-
104
- type Simplify<T> = {
105
- [KeyType in keyof T]: T[KeyType];
106
- } & {};
107
- type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
108
- type StringWithAutoCompletion<T extends string> = T | (string & {});
109
- type OrPromise<T> = T | Promise<T>;
110
- type NonEmptyArray<T> = [T, ...T[]];
111
-
112
- declare function getQueryParams(url: string): Record<string, string>;
113
- declare function objectToQueryParams(object: Record<string, unknown>): InstanceType<typeof _URLSearchParams>;
114
-
71
+ //#endregion
72
+ //#region src/error/InvalidFetchResponseError.d.ts
73
+ declare class InvalidFetchResponseError extends Error {
74
+ readonly textResponse: string;
75
+ readonly response: FetchResponse;
76
+ constructor(message: string, textResponse: string, response: FetchResponse);
77
+ }
78
+ //#endregion
79
+ //#region src/error/JsonParseError.d.ts
80
+ declare class JsonParseError extends Error {
81
+ constructor(message: string, jsonString: string);
82
+ }
83
+ //#endregion
84
+ //#region src/error/ValidationError.d.ts
85
+ declare class ValidationError extends Error {
86
+ zodError: ZodError | undefined;
87
+ constructor(message: string, zodError?: z$1.ZodError);
88
+ }
89
+ //#endregion
90
+ //#region src/fetcher.d.ts
115
91
  /**
116
92
  * A type utility which represents the function returned
117
93
  * from createZodFetcher
118
94
  */
119
- type ZodFetcher = <Schema extends z$1.ZodTypeAny>(schema: Schema, expectedContentType: ContentType | ContentType[], ...args: Parameters<Fetch>) => Promise<{
120
- response: Awaited<ReturnType<Fetch>>;
121
- result?: z$1.SafeParseReturnType<Schema, z$1.infer<Schema>>;
95
+ type ZodFetcher = <Schema extends z.ZodTypeAny>(schema: Schema, expectedContentType: ContentType | ContentType[], ...args: Parameters<Fetch>) => Promise<{
96
+ response: Awaited<ReturnType<Fetch>>;
97
+ result?: z.SafeParseReturnType<Schema, z.infer<Schema>>;
122
98
  }>;
123
99
  declare function createFetcher(fetcher?: typeof fetch): Fetch;
124
100
  /**
@@ -140,25 +116,65 @@ declare function createFetcher(fetcher?: typeof fetch): Fetch;
140
116
  * );
141
117
  */
142
118
  declare function createZodFetcher(fetcher?: Fetch): ZodFetcher;
143
-
144
- declare const zHttpsUrl: z$1.ZodEffects<z$1.ZodString, string, string>;
145
- declare const zInteger: z$1.ZodNumber;
146
- declare const zHttpMethod: z$1.ZodEnum<["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT", "PATCH"]>;
147
- type HttpMethod = z$1.infer<typeof zHttpMethod>;
148
- declare const zStringToJson: z$1.ZodEffects<z$1.ZodString, any, string>;
149
- declare const zIs: <Schema extends z$1.ZodSchema>(schema: Schema, data: unknown) => data is z$1.infer<typeof schema>;
150
-
151
- declare function formatZodError(error?: z$1.ZodError): string;
152
-
119
+ //#endregion
120
+ //#region src/object.d.ts
121
+ declare function isObject(item: unknown): item is Record<string, unknown>;
122
+ /**
123
+ * Deep merge two objects.
124
+ * @param target
125
+ * @param ...sources
126
+ */
127
+ declare function mergeDeep(target: unknown, ...sources: Array<unknown>): unknown;
128
+ //#endregion
129
+ //#region src/parse.d.ts
130
+ type BaseSchema = z.ZodTypeAny;
131
+ type InferOutputUnion<T extends readonly any[]> = { [K in keyof T]: z.infer<T[K]> }[number];
132
+ declare function stringToJsonWithErrorHandling(string: string, errorMessage?: string): any;
133
+ declare function parseIfJson<T>(data: T): T | Record<string, unknown>;
134
+ declare function parseWithErrorHandling<Schema extends BaseSchema>(schema: Schema, data: unknown, customErrorMessage?: string): z.infer<Schema>;
135
+ //#endregion
136
+ //#region src/path.d.ts
137
+ /**
138
+ * Combine multiple uri parts into a single uri taking into account slashes.
139
+ *
140
+ * @param parts the parts to combine
141
+ * @returns the combined url
142
+ */
143
+ declare function joinUriParts(base: string, parts: string[]): string;
144
+ //#endregion
145
+ //#region src/type.d.ts
146
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
147
+ type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
148
+ type StringWithAutoCompletion<T extends string> = T | (string & {});
149
+ type OrPromise<T> = T | Promise<T>;
150
+ type NonEmptyArray<T> = [T, ...T[]];
151
+ //#endregion
152
+ //#region src/url.d.ts
153
+ declare function getQueryParams(url: string): Record<string, string>;
154
+ declare function objectToQueryParams(object: Record<string, unknown>): InstanceType<typeof _URLSearchParams>;
155
+ //#endregion
156
+ //#region src/validation.d.ts
157
+ declare const zHttpsUrl: z.ZodEffects<z.ZodString, string, string>;
158
+ declare const zInteger: z.ZodNumber;
159
+ declare const zHttpMethod: z.ZodEnum<["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT", "PATCH"]>;
160
+ type HttpMethod = z.infer<typeof zHttpMethod>;
161
+ declare const zStringToJson: z.ZodEffects<z.ZodString, any, string>;
162
+ declare const zIs: <Schema extends z.ZodSchema>(schema: Schema, data: unknown) => data is z.infer<typeof schema>;
163
+ //#endregion
164
+ //#region src/www-authenticate.d.ts
153
165
  interface WwwAuthenticateHeaderChallenge {
154
- scheme: string;
155
- /**
156
- * Record where the keys are the names, and the value can be 0 (null), 1 (string) or multiple (string[])
157
- * entries
158
- */
159
- payload: Record<string, string | string[] | null>;
166
+ scheme: string;
167
+ /**
168
+ * Record where the keys are the names, and the value can be 0 (null), 1 (string) or multiple (string[])
169
+ * entries
170
+ */
171
+ payload: Record<string, string | string[] | null>;
160
172
  }
161
173
  declare function parseWwwAuthenticateHeader(str: string): WwwAuthenticateHeaderChallenge[];
162
174
  declare function encodeWwwAuthenticateHeader(challenges: WwwAuthenticateHeaderChallenge[]): string;
163
-
175
+ //#endregion
176
+ //#region src/zod-error.d.ts
177
+ declare function formatZodError(error?: z.ZodError): string;
178
+ //#endregion
164
179
  export { type BaseSchema, ContentType, type Fetch, type FetchHeaders, type FetchRequestInit, type FetchResponse, _Headers as Headers, type HttpMethod, type InferOutputUnion, InvalidFetchResponseError, JsonParseError, type NonEmptyArray, type Oid4vcTsConfig, type Optional, type OrPromise, type Simplify, type StringWithAutoCompletion, _URL as URL, _URLSearchParams as URLSearchParams, ValidationError, type WwwAuthenticateHeaderChallenge, type ZodFetcher, addSecondsToDate, arrayEqualsIgnoreOrder, createFetcher, createZodFetcher, dateToSeconds, decodeBase64, decodeUtf8String, encodeToBase64, encodeToBase64Url, encodeToUtf8String, encodeWwwAuthenticateHeader, formatZodError, getGlobalConfig, getQueryParams, isContentType, isObject, isResponseContentType, joinUriParts, mergeDeep, objectToQueryParams, parseIfJson, parseWithErrorHandling, parseWwwAuthenticateHeader, setGlobalConfig, stringToJsonWithErrorHandling, zHttpMethod, zHttpsUrl, zInteger, zIs, zStringToJson };
180
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.d.ts CHANGED
@@ -1,73 +1,65 @@
1
- import z$1, { ZodError, z } from 'zod';
1
+ import z, { ZodError, z as z$1 } from "zod";
2
2
 
3
- declare const _URL: {
4
- new (url: string | URL, base?: string | URL): URL;
5
- prototype: URL;
6
- canParse(url: string | URL, base?: string | URL): boolean;
7
- createObjectURL(obj: Blob | MediaSource): string;
8
- parse(url: string | URL, base?: string | URL): URL | null;
9
- revokeObjectURL(url: string): void;
10
- };
11
- declare const _URLSearchParams: {
12
- new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
13
- prototype: URLSearchParams;
14
- };
15
- type Fetch = typeof fetch;
16
- type FetchResponse = Response;
17
- declare const _Headers: typeof globalThis.Headers;
18
- type FetchHeaders = globalThis.Headers;
19
- type FetchRequestInit = RequestInit;
20
-
21
- declare class InvalidFetchResponseError extends Error {
22
- readonly textResponse: string;
23
- readonly response: FetchResponse;
24
- constructor(message: string, textResponse: string, response: FetchResponse);
25
- }
26
-
27
- declare class JsonParseError extends Error {
28
- constructor(message: string, jsonString: string);
29
- }
30
-
31
- declare class ValidationError extends Error {
32
- zodError: ZodError | undefined;
33
- constructor(message: string, zodError?: z.ZodError);
34
- }
3
+ //#region src/array.d.ts
35
4
 
36
5
  /**
37
6
  * Only primitive types allowed
38
7
  * Must have not duplicate entries (will always return false in this case)
39
8
  */
40
9
  declare function arrayEqualsIgnoreOrder<Item extends string | number | boolean>(a: Array<Item>, b: Array<Item>): boolean;
41
-
10
+ //#endregion
11
+ //#region src/config.d.ts
42
12
  interface Oid4vcTsConfig {
43
- /**
44
- * Whether to allow insecure http urls.
45
- *
46
- * @default false
47
- */
48
- allowInsecureUrls: boolean;
13
+ /**
14
+ * Whether to allow insecure http urls.
15
+ *
16
+ * @default false
17
+ */
18
+ allowInsecureUrls: boolean;
49
19
  }
50
20
  declare function setGlobalConfig(config: Oid4vcTsConfig): void;
51
21
  declare function getGlobalConfig(): Oid4vcTsConfig;
52
-
22
+ //#endregion
23
+ //#region src/globals.d.ts
24
+ declare const _URL: {
25
+ new (url: string | URL, base?: string | URL): URL;
26
+ prototype: URL;
27
+ canParse(url: string | URL, base?: string | URL): boolean;
28
+ createObjectURL(obj: Blob | MediaSource): string;
29
+ parse(url: string | URL, base?: string | URL): URL | null;
30
+ revokeObjectURL(url: string): void;
31
+ };
32
+ declare const _URLSearchParams: {
33
+ new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
34
+ prototype: URLSearchParams;
35
+ };
36
+ type Fetch = typeof fetch;
37
+ type FetchResponse = Response;
38
+ declare const _Headers: typeof globalThis.Headers;
39
+ type FetchHeaders = globalThis.Headers;
40
+ type FetchRequestInit = RequestInit;
41
+ //#endregion
42
+ //#region src/content-type.d.ts
53
43
  declare enum ContentType {
54
- XWwwFormUrlencoded = "application/x-www-form-urlencoded",
55
- Json = "application/json",
56
- JwkSet = "application/jwk-set+json",
57
- OAuthAuthorizationRequestJwt = "application/oauth-authz-req+jwt",
58
- Jwt = "application/jwt",
59
- Html = "text/html"
44
+ XWwwFormUrlencoded = "application/x-www-form-urlencoded",
45
+ Json = "application/json",
46
+ JwkSet = "application/jwk-set+json",
47
+ OAuthAuthorizationRequestJwt = "application/oauth-authz-req+jwt",
48
+ Jwt = "application/jwt",
49
+ Html = "text/html",
60
50
  }
61
51
  declare function isContentType(contentType: ContentType, value: string): boolean;
62
52
  declare function isResponseContentType(contentType: ContentType | ContentType[], response: FetchResponse): boolean;
63
-
53
+ //#endregion
54
+ //#region src/date.d.ts
64
55
  /**
65
56
  * Get the time in seconds since epoch for a date.
66
57
  * If date is not provided the current time will be used.
67
58
  */
68
59
  declare function dateToSeconds(date?: Date): number;
69
60
  declare function addSecondsToDate(date: Date, seconds: number): Date;
70
-
61
+ //#endregion
62
+ //#region src/encoding.d.ts
71
63
  declare function decodeUtf8String(string: string): Uint8Array;
72
64
  declare function encodeToUtf8String(data: Uint8Array): string;
73
65
  /**
@@ -76,49 +68,33 @@ declare function encodeToUtf8String(data: Uint8Array): string;
76
68
  declare function decodeBase64(base64: string): Uint8Array;
77
69
  declare function encodeToBase64(data: Uint8Array | string): string;
78
70
  declare function encodeToBase64Url(data: Uint8Array | string): string;
79
-
80
- declare function isObject(item: unknown): item is Record<string, unknown>;
81
- /**
82
- * Deep merge two objects.
83
- * @param target
84
- * @param ...sources
85
- */
86
- declare function mergeDeep(target: unknown, ...sources: Array<unknown>): unknown;
87
-
88
- type BaseSchema = z$1.ZodTypeAny;
89
- type InferOutputUnion<T extends readonly any[]> = {
90
- [K in keyof T]: z$1.infer<T[K]>;
91
- }[number];
92
- declare function stringToJsonWithErrorHandling(string: string, errorMessage?: string): any;
93
- declare function parseIfJson<T>(data: T): T | Record<string, unknown>;
94
- declare function parseWithErrorHandling<Schema extends BaseSchema>(schema: Schema, data: unknown, customErrorMessage?: string): z$1.infer<Schema>;
95
-
96
- /**
97
- * Combine multiple uri parts into a single uri taking into account slashes.
98
- *
99
- * @param parts the parts to combine
100
- * @returns the combined url
101
- */
102
- declare function joinUriParts(base: string, parts: string[]): string;
103
-
104
- type Simplify<T> = {
105
- [KeyType in keyof T]: T[KeyType];
106
- } & {};
107
- type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
108
- type StringWithAutoCompletion<T extends string> = T | (string & {});
109
- type OrPromise<T> = T | Promise<T>;
110
- type NonEmptyArray<T> = [T, ...T[]];
111
-
112
- declare function getQueryParams(url: string): Record<string, string>;
113
- declare function objectToQueryParams(object: Record<string, unknown>): InstanceType<typeof _URLSearchParams>;
114
-
71
+ //#endregion
72
+ //#region src/error/InvalidFetchResponseError.d.ts
73
+ declare class InvalidFetchResponseError extends Error {
74
+ readonly textResponse: string;
75
+ readonly response: FetchResponse;
76
+ constructor(message: string, textResponse: string, response: FetchResponse);
77
+ }
78
+ //#endregion
79
+ //#region src/error/JsonParseError.d.ts
80
+ declare class JsonParseError extends Error {
81
+ constructor(message: string, jsonString: string);
82
+ }
83
+ //#endregion
84
+ //#region src/error/ValidationError.d.ts
85
+ declare class ValidationError extends Error {
86
+ zodError: ZodError | undefined;
87
+ constructor(message: string, zodError?: z$1.ZodError);
88
+ }
89
+ //#endregion
90
+ //#region src/fetcher.d.ts
115
91
  /**
116
92
  * A type utility which represents the function returned
117
93
  * from createZodFetcher
118
94
  */
119
- type ZodFetcher = <Schema extends z$1.ZodTypeAny>(schema: Schema, expectedContentType: ContentType | ContentType[], ...args: Parameters<Fetch>) => Promise<{
120
- response: Awaited<ReturnType<Fetch>>;
121
- result?: z$1.SafeParseReturnType<Schema, z$1.infer<Schema>>;
95
+ type ZodFetcher = <Schema extends z.ZodTypeAny>(schema: Schema, expectedContentType: ContentType | ContentType[], ...args: Parameters<Fetch>) => Promise<{
96
+ response: Awaited<ReturnType<Fetch>>;
97
+ result?: z.SafeParseReturnType<Schema, z.infer<Schema>>;
122
98
  }>;
123
99
  declare function createFetcher(fetcher?: typeof fetch): Fetch;
124
100
  /**
@@ -140,25 +116,65 @@ declare function createFetcher(fetcher?: typeof fetch): Fetch;
140
116
  * );
141
117
  */
142
118
  declare function createZodFetcher(fetcher?: Fetch): ZodFetcher;
143
-
144
- declare const zHttpsUrl: z$1.ZodEffects<z$1.ZodString, string, string>;
145
- declare const zInteger: z$1.ZodNumber;
146
- declare const zHttpMethod: z$1.ZodEnum<["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT", "PATCH"]>;
147
- type HttpMethod = z$1.infer<typeof zHttpMethod>;
148
- declare const zStringToJson: z$1.ZodEffects<z$1.ZodString, any, string>;
149
- declare const zIs: <Schema extends z$1.ZodSchema>(schema: Schema, data: unknown) => data is z$1.infer<typeof schema>;
150
-
151
- declare function formatZodError(error?: z$1.ZodError): string;
152
-
119
+ //#endregion
120
+ //#region src/object.d.ts
121
+ declare function isObject(item: unknown): item is Record<string, unknown>;
122
+ /**
123
+ * Deep merge two objects.
124
+ * @param target
125
+ * @param ...sources
126
+ */
127
+ declare function mergeDeep(target: unknown, ...sources: Array<unknown>): unknown;
128
+ //#endregion
129
+ //#region src/parse.d.ts
130
+ type BaseSchema = z.ZodTypeAny;
131
+ type InferOutputUnion<T extends readonly any[]> = { [K in keyof T]: z.infer<T[K]> }[number];
132
+ declare function stringToJsonWithErrorHandling(string: string, errorMessage?: string): any;
133
+ declare function parseIfJson<T>(data: T): T | Record<string, unknown>;
134
+ declare function parseWithErrorHandling<Schema extends BaseSchema>(schema: Schema, data: unknown, customErrorMessage?: string): z.infer<Schema>;
135
+ //#endregion
136
+ //#region src/path.d.ts
137
+ /**
138
+ * Combine multiple uri parts into a single uri taking into account slashes.
139
+ *
140
+ * @param parts the parts to combine
141
+ * @returns the combined url
142
+ */
143
+ declare function joinUriParts(base: string, parts: string[]): string;
144
+ //#endregion
145
+ //#region src/type.d.ts
146
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
147
+ type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
148
+ type StringWithAutoCompletion<T extends string> = T | (string & {});
149
+ type OrPromise<T> = T | Promise<T>;
150
+ type NonEmptyArray<T> = [T, ...T[]];
151
+ //#endregion
152
+ //#region src/url.d.ts
153
+ declare function getQueryParams(url: string): Record<string, string>;
154
+ declare function objectToQueryParams(object: Record<string, unknown>): InstanceType<typeof _URLSearchParams>;
155
+ //#endregion
156
+ //#region src/validation.d.ts
157
+ declare const zHttpsUrl: z.ZodEffects<z.ZodString, string, string>;
158
+ declare const zInteger: z.ZodNumber;
159
+ declare const zHttpMethod: z.ZodEnum<["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT", "PATCH"]>;
160
+ type HttpMethod = z.infer<typeof zHttpMethod>;
161
+ declare const zStringToJson: z.ZodEffects<z.ZodString, any, string>;
162
+ declare const zIs: <Schema extends z.ZodSchema>(schema: Schema, data: unknown) => data is z.infer<typeof schema>;
163
+ //#endregion
164
+ //#region src/www-authenticate.d.ts
153
165
  interface WwwAuthenticateHeaderChallenge {
154
- scheme: string;
155
- /**
156
- * Record where the keys are the names, and the value can be 0 (null), 1 (string) or multiple (string[])
157
- * entries
158
- */
159
- payload: Record<string, string | string[] | null>;
166
+ scheme: string;
167
+ /**
168
+ * Record where the keys are the names, and the value can be 0 (null), 1 (string) or multiple (string[])
169
+ * entries
170
+ */
171
+ payload: Record<string, string | string[] | null>;
160
172
  }
161
173
  declare function parseWwwAuthenticateHeader(str: string): WwwAuthenticateHeaderChallenge[];
162
174
  declare function encodeWwwAuthenticateHeader(challenges: WwwAuthenticateHeaderChallenge[]): string;
163
-
175
+ //#endregion
176
+ //#region src/zod-error.d.ts
177
+ declare function formatZodError(error?: z.ZodError): string;
178
+ //#endregion
164
179
  export { type BaseSchema, ContentType, type Fetch, type FetchHeaders, type FetchRequestInit, type FetchResponse, _Headers as Headers, type HttpMethod, type InferOutputUnion, InvalidFetchResponseError, JsonParseError, type NonEmptyArray, type Oid4vcTsConfig, type Optional, type OrPromise, type Simplify, type StringWithAutoCompletion, _URL as URL, _URLSearchParams as URLSearchParams, ValidationError, type WwwAuthenticateHeaderChallenge, type ZodFetcher, addSecondsToDate, arrayEqualsIgnoreOrder, createFetcher, createZodFetcher, dateToSeconds, decodeBase64, decodeUtf8String, encodeToBase64, encodeToBase64Url, encodeToUtf8String, encodeWwwAuthenticateHeader, formatZodError, getGlobalConfig, getQueryParams, isContentType, isObject, isResponseContentType, joinUriParts, mergeDeep, objectToQueryParams, parseIfJson, parseWithErrorHandling, parseWwwAuthenticateHeader, setGlobalConfig, stringToJsonWithErrorHandling, zHttpMethod, zHttpsUrl, zInteger, zIs, zStringToJson };
180
+ //# sourceMappingURL=index.d.ts.map