@mastra/voice-speechify 0.12.0 → 0.12.1-alpha.0
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/CHANGELOG.md +8 -0
- package/LICENSE.md +15 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +9043 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/base/index.d.ts +31 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/logger/index.d.ts +217 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +147 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/types/index.d.ts +3 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/ZodError.d.ts +164 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/errors.d.ts +5 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/external.d.ts +6 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/helpers/util.d.ts +85 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/index.d.cts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/index.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/locales/en.d.ts +3 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/standard-schema.d.ts +102 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v3/types.d.ts +1034 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/checks.d.ts +1 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/coerce.d.ts +17 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/compat.d.ts +50 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/errors.d.ts +30 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/external.d.ts +16 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/index.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/iso.d.ts +22 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/parse.d.ts +31 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/classic/schemas.d.ts +767 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/api.d.ts +325 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/checks.d.ts +278 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/core.d.ts +70 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/doc.d.ts +14 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/errors.d.ts +221 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/index.d.ts +16 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/json-schema-processors.d.ts +49 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/json-schema.d.ts +88 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/parse.d.ts +49 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/regexes.d.ts +85 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/registries.d.ts +35 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/schemas.d.ts +1184 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/standard-schema.d.ts +126 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/to-json-schema.d.ts +114 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/util.d.ts +200 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/core/versions.d.ts +5 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/index.d.cts +3 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ar.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/az.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/be.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/bg.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ca.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/cs.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/da.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/de.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/el.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/en.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/eo.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/es.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/fa.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/fi.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/fr-CA.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/fr.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/he.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/hr.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/hu.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/hy.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/id.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/index.d.ts +52 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/is.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/it.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ja.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ka.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/kh.d.ts +5 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/km.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ko.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/lt.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/mk.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ms.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/nl.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/no.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ota.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/pl.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ps.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/pt.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ro.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ru.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/sl.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/sv.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ta.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/th.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/tr.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ua.d.ts +5 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/uk.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/ur.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/uz.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/vi.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/yo.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/zh-CN.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/_types/zod/v4/locales/zh-TW.d.ts +4 -0
- package/dist/_types/@internal_voice/dist/index.d.ts +16 -0
- package/dist/_types/@internal_voice/dist/voice/aisdk/index.d.ts +3 -0
- package/dist/_types/@internal_voice/dist/voice/aisdk/speech.d.ts +23 -0
- package/dist/_types/@internal_voice/dist/voice/aisdk/transcription.d.ts +22 -0
- package/dist/_types/@internal_voice/dist/voice/composite-voice.d.ts +72 -0
- package/dist/_types/@internal_voice/dist/voice/default-voice.d.ts +13 -0
- package/dist/_types/@internal_voice/dist/voice/index.d.ts +5 -0
- package/dist/_types/@internal_voice/dist/voice/voice.d.ts +172 -0
- package/dist/docs/SKILL.md +15 -21
- package/dist/docs/{SOURCE_MAP.json → assets/SOURCE_MAP.json} +1 -1
- package/dist/docs/references/docs-agents-adding-voice.md +350 -0
- package/dist/docs/references/docs-voice-overview.md +1188 -0
- package/dist/docs/references/reference-voice-speechify.md +75 -0
- package/dist/index.cjs +260 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +259 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -13
- package/dist/docs/README.md +0 -32
- package/dist/docs/agents/01-adding-voice.md +0 -352
- package/dist/docs/voice/01-overview.md +0 -1019
- package/dist/docs/voice/02-reference.md +0 -62
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type * as errors from "./errors.js";
|
|
2
|
+
import type * as schemas from "./schemas.js";
|
|
3
|
+
import type { Class } from "./util.js";
|
|
4
|
+
type ZodTrait = {
|
|
5
|
+
_zod: {
|
|
6
|
+
def: any;
|
|
7
|
+
[k: string]: any;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
|
|
11
|
+
new (def: D): T;
|
|
12
|
+
init(inst: T, def: D): asserts inst is T;
|
|
13
|
+
}
|
|
14
|
+
/** A special constant with type `never` */
|
|
15
|
+
export declare const NEVER: never;
|
|
16
|
+
export declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: string, initializer: (inst: T, def: D) => void, params?: {
|
|
17
|
+
Parent?: typeof Class;
|
|
18
|
+
}): $constructor<T, D>;
|
|
19
|
+
export declare const $brand: unique symbol;
|
|
20
|
+
export type $brand<T extends string | number | symbol = string | number | symbol> = {
|
|
21
|
+
[$brand]: {
|
|
22
|
+
[k in T]: true;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type $ZodBranded<T extends schemas.SomeType, Brand extends string | number | symbol, Dir extends "in" | "out" | "inout" = "out"> = T & (Dir extends "inout" ? {
|
|
26
|
+
_zod: {
|
|
27
|
+
input: input<T> & $brand<Brand>;
|
|
28
|
+
output: output<T> & $brand<Brand>;
|
|
29
|
+
};
|
|
30
|
+
} : Dir extends "in" ? {
|
|
31
|
+
_zod: {
|
|
32
|
+
input: input<T> & $brand<Brand>;
|
|
33
|
+
};
|
|
34
|
+
} : {
|
|
35
|
+
_zod: {
|
|
36
|
+
output: output<T> & $brand<Brand>;
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
export type $ZodNarrow<T extends schemas.SomeType, Out> = T & {
|
|
40
|
+
_zod: {
|
|
41
|
+
output: Out;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare class $ZodAsyncError extends Error {
|
|
45
|
+
constructor();
|
|
46
|
+
}
|
|
47
|
+
export declare class $ZodEncodeError extends Error {
|
|
48
|
+
constructor(name: string);
|
|
49
|
+
}
|
|
50
|
+
export type input<T> = T extends {
|
|
51
|
+
_zod: {
|
|
52
|
+
input: any;
|
|
53
|
+
};
|
|
54
|
+
} ? T["_zod"]["input"] : unknown;
|
|
55
|
+
export type output<T> = T extends {
|
|
56
|
+
_zod: {
|
|
57
|
+
output: any;
|
|
58
|
+
};
|
|
59
|
+
} ? T["_zod"]["output"] : unknown;
|
|
60
|
+
export type { output as infer };
|
|
61
|
+
export interface $ZodConfig {
|
|
62
|
+
/** Custom error map. Overrides `config().localeError`. */
|
|
63
|
+
customError?: errors.$ZodErrorMap | undefined;
|
|
64
|
+
/** Localized error map. Lowest priority. */
|
|
65
|
+
localeError?: errors.$ZodErrorMap | undefined;
|
|
66
|
+
/** Disable JIT schema compilation. Useful in environments that disallow `eval`. */
|
|
67
|
+
jitless?: boolean | undefined;
|
|
68
|
+
}
|
|
69
|
+
export declare const globalConfig: $ZodConfig;
|
|
70
|
+
export declare function config(newConfig?: Partial<$ZodConfig>): $ZodConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type ModeWriter = (doc: Doc, modes: {
|
|
2
|
+
execution: "sync" | "async";
|
|
3
|
+
}) => void;
|
|
4
|
+
export declare class Doc {
|
|
5
|
+
args: string[];
|
|
6
|
+
content: string[];
|
|
7
|
+
indent: number;
|
|
8
|
+
constructor(args?: string[]);
|
|
9
|
+
indented(fn: (doc: Doc) => void): void;
|
|
10
|
+
write(fn: ModeWriter): void;
|
|
11
|
+
write(line: string): void;
|
|
12
|
+
compile(): any;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import type { $ZodCheck, $ZodStringFormats } from "./checks.js";
|
|
2
|
+
import { $constructor } from "./core.js";
|
|
3
|
+
import type { $ZodType } from "./schemas.js";
|
|
4
|
+
import type { StandardSchemaV1 } from "./standard-schema.js";
|
|
5
|
+
import * as util from "./util.js";
|
|
6
|
+
export interface $ZodIssueBase {
|
|
7
|
+
readonly code?: string;
|
|
8
|
+
readonly input?: unknown;
|
|
9
|
+
readonly path: PropertyKey[];
|
|
10
|
+
readonly message: string;
|
|
11
|
+
}
|
|
12
|
+
export type $ZodInvalidTypeExpected = "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "undefined" | "null" | "never" | "void" | "date" | "array" | "object" | "tuple" | "record" | "map" | "set" | "file" | "nonoptional" | "nan" | "function" | (string & {});
|
|
13
|
+
export interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
|
|
14
|
+
readonly code: "invalid_type";
|
|
15
|
+
readonly expected: $ZodInvalidTypeExpected;
|
|
16
|
+
readonly input?: Input;
|
|
17
|
+
}
|
|
18
|
+
export interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
|
|
19
|
+
readonly code: "too_big";
|
|
20
|
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
21
|
+
readonly maximum: number | bigint;
|
|
22
|
+
readonly inclusive?: boolean;
|
|
23
|
+
readonly exact?: boolean;
|
|
24
|
+
readonly input?: Input;
|
|
25
|
+
}
|
|
26
|
+
export interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
|
|
27
|
+
readonly code: "too_small";
|
|
28
|
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
29
|
+
readonly minimum: number | bigint;
|
|
30
|
+
/** True if the allowable range includes the minimum */
|
|
31
|
+
readonly inclusive?: boolean;
|
|
32
|
+
/** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
|
|
33
|
+
readonly exact?: boolean;
|
|
34
|
+
readonly input?: Input;
|
|
35
|
+
}
|
|
36
|
+
export interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
|
|
37
|
+
readonly code: "invalid_format";
|
|
38
|
+
readonly format: $ZodStringFormats | (string & {});
|
|
39
|
+
readonly pattern?: string;
|
|
40
|
+
readonly input?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
|
|
43
|
+
readonly code: "not_multiple_of";
|
|
44
|
+
readonly divisor: number;
|
|
45
|
+
readonly input?: Input;
|
|
46
|
+
}
|
|
47
|
+
export interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
|
|
48
|
+
readonly code: "unrecognized_keys";
|
|
49
|
+
readonly keys: string[];
|
|
50
|
+
readonly input?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {
|
|
53
|
+
readonly code: "invalid_union";
|
|
54
|
+
readonly errors: $ZodIssue[][];
|
|
55
|
+
readonly input?: unknown;
|
|
56
|
+
readonly discriminator?: string | undefined;
|
|
57
|
+
readonly options?: util.Primitive[];
|
|
58
|
+
readonly inclusive?: true;
|
|
59
|
+
}
|
|
60
|
+
interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {
|
|
61
|
+
readonly code: "invalid_union";
|
|
62
|
+
readonly errors: [];
|
|
63
|
+
readonly input?: unknown;
|
|
64
|
+
readonly discriminator?: string | undefined;
|
|
65
|
+
readonly inclusive: false;
|
|
66
|
+
}
|
|
67
|
+
export type $ZodIssueInvalidUnion = $ZodIssueInvalidUnionNoMatch | $ZodIssueInvalidUnionMultipleMatch;
|
|
68
|
+
export interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
|
|
69
|
+
readonly code: "invalid_key";
|
|
70
|
+
readonly origin: "map" | "record";
|
|
71
|
+
readonly issues: $ZodIssue[];
|
|
72
|
+
readonly input?: Input;
|
|
73
|
+
}
|
|
74
|
+
export interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
|
|
75
|
+
readonly code: "invalid_element";
|
|
76
|
+
readonly origin: "map" | "set";
|
|
77
|
+
readonly key: unknown;
|
|
78
|
+
readonly issues: $ZodIssue[];
|
|
79
|
+
readonly input?: Input;
|
|
80
|
+
}
|
|
81
|
+
export interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
|
|
82
|
+
readonly code: "invalid_value";
|
|
83
|
+
readonly values: util.Primitive[];
|
|
84
|
+
readonly input?: Input;
|
|
85
|
+
}
|
|
86
|
+
export interface $ZodIssueCustom extends $ZodIssueBase {
|
|
87
|
+
readonly code: "custom";
|
|
88
|
+
readonly params?: Record<string, any> | undefined;
|
|
89
|
+
readonly input?: unknown;
|
|
90
|
+
}
|
|
91
|
+
export interface $ZodIssueStringCommonFormats extends $ZodIssueInvalidStringFormat {
|
|
92
|
+
format: Exclude<$ZodStringFormats, "regex" | "jwt" | "starts_with" | "ends_with" | "includes">;
|
|
93
|
+
}
|
|
94
|
+
export interface $ZodIssueStringInvalidRegex extends $ZodIssueInvalidStringFormat {
|
|
95
|
+
format: "regex";
|
|
96
|
+
pattern: string;
|
|
97
|
+
}
|
|
98
|
+
export interface $ZodIssueStringInvalidJWT extends $ZodIssueInvalidStringFormat {
|
|
99
|
+
format: "jwt";
|
|
100
|
+
algorithm?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface $ZodIssueStringStartsWith extends $ZodIssueInvalidStringFormat {
|
|
103
|
+
format: "starts_with";
|
|
104
|
+
prefix: string;
|
|
105
|
+
}
|
|
106
|
+
export interface $ZodIssueStringEndsWith extends $ZodIssueInvalidStringFormat {
|
|
107
|
+
format: "ends_with";
|
|
108
|
+
suffix: string;
|
|
109
|
+
}
|
|
110
|
+
export interface $ZodIssueStringIncludes extends $ZodIssueInvalidStringFormat {
|
|
111
|
+
format: "includes";
|
|
112
|
+
includes: string;
|
|
113
|
+
}
|
|
114
|
+
export type $ZodStringFormatIssues = $ZodIssueStringCommonFormats | $ZodIssueStringInvalidRegex | $ZodIssueStringInvalidJWT | $ZodIssueStringStartsWith | $ZodIssueStringEndsWith | $ZodIssueStringIncludes;
|
|
115
|
+
export type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
|
|
116
|
+
export type $ZodIssueCode = $ZodIssue["code"];
|
|
117
|
+
export type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
|
|
118
|
+
type RawIssue<T extends $ZodIssueBase> = T extends any ? util.Flatten<util.MakePartial<T, "message" | "path"> & {
|
|
119
|
+
/** The input data */
|
|
120
|
+
readonly input: unknown;
|
|
121
|
+
/** The schema or check that originated this issue. */
|
|
122
|
+
readonly inst?: $ZodType | $ZodCheck;
|
|
123
|
+
/** If `true`, Zod will continue executing checks/refinements after this issue. */
|
|
124
|
+
readonly continue?: boolean | undefined;
|
|
125
|
+
} & Record<string, unknown>> : never;
|
|
126
|
+
export type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
|
|
127
|
+
export interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
|
|
128
|
+
(issue: $ZodRawIssue<T>): {
|
|
129
|
+
message: string;
|
|
130
|
+
} | string | undefined | null;
|
|
131
|
+
}
|
|
132
|
+
export interface $ZodError<T = unknown> extends Error {
|
|
133
|
+
type: T;
|
|
134
|
+
issues: $ZodIssue[];
|
|
135
|
+
_zod: {
|
|
136
|
+
output: T;
|
|
137
|
+
def: $ZodIssue[];
|
|
138
|
+
};
|
|
139
|
+
stack?: string;
|
|
140
|
+
name: string;
|
|
141
|
+
}
|
|
142
|
+
export declare const $ZodError: $constructor<$ZodError>;
|
|
143
|
+
interface $ZodRealError<T = any> extends $ZodError<T> {
|
|
144
|
+
}
|
|
145
|
+
export declare const $ZodRealError: $constructor<$ZodRealError>;
|
|
146
|
+
export type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
|
|
147
|
+
type _FlattenedError<T, U = string> = {
|
|
148
|
+
formErrors: U[];
|
|
149
|
+
fieldErrors: {
|
|
150
|
+
[P in keyof T]?: U[];
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export declare function flattenError<T>(error: $ZodError<T>): _FlattenedError<T>;
|
|
154
|
+
export declare function flattenError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): _FlattenedError<T, U>;
|
|
155
|
+
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? {
|
|
156
|
+
[K in keyof T]?: $ZodFormattedError<T[K], U>;
|
|
157
|
+
} : T extends any[] ? {
|
|
158
|
+
[k: number]: $ZodFormattedError<T[number], U>;
|
|
159
|
+
} : T extends object ? util.Flatten<{
|
|
160
|
+
[K in keyof T]?: $ZodFormattedError<T[K], U>;
|
|
161
|
+
}> : any;
|
|
162
|
+
export type $ZodFormattedError<T, U = string> = {
|
|
163
|
+
_errors: U[];
|
|
164
|
+
} & util.Flatten<_ZodFormattedError<T, U>>;
|
|
165
|
+
export declare function formatError<T>(error: $ZodError<T>): $ZodFormattedError<T>;
|
|
166
|
+
export declare function formatError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;
|
|
167
|
+
export type $ZodErrorTree<T, U = string> = T extends util.Primitive ? {
|
|
168
|
+
errors: U[];
|
|
169
|
+
} : T extends [any, ...any[]] ? {
|
|
170
|
+
errors: U[];
|
|
171
|
+
items?: {
|
|
172
|
+
[K in keyof T]?: $ZodErrorTree<T[K], U>;
|
|
173
|
+
};
|
|
174
|
+
} : T extends any[] ? {
|
|
175
|
+
errors: U[];
|
|
176
|
+
items?: Array<$ZodErrorTree<T[number], U>>;
|
|
177
|
+
} : T extends object ? {
|
|
178
|
+
errors: U[];
|
|
179
|
+
properties?: {
|
|
180
|
+
[K in keyof T]?: $ZodErrorTree<T[K], U>;
|
|
181
|
+
};
|
|
182
|
+
} : {
|
|
183
|
+
errors: U[];
|
|
184
|
+
};
|
|
185
|
+
export declare function treeifyError<T>(error: $ZodError<T>): $ZodErrorTree<T>;
|
|
186
|
+
export declare function treeifyError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodErrorTree<T, U>;
|
|
187
|
+
/** Format a ZodError as a human-readable string in the following form.
|
|
188
|
+
*
|
|
189
|
+
* From
|
|
190
|
+
*
|
|
191
|
+
* ```ts
|
|
192
|
+
* ZodError {
|
|
193
|
+
* issues: [
|
|
194
|
+
* {
|
|
195
|
+
* expected: 'string',
|
|
196
|
+
* code: 'invalid_type',
|
|
197
|
+
* path: [ 'username' ],
|
|
198
|
+
* message: 'Invalid input: expected string'
|
|
199
|
+
* },
|
|
200
|
+
* {
|
|
201
|
+
* expected: 'number',
|
|
202
|
+
* code: 'invalid_type',
|
|
203
|
+
* path: [ 'favoriteNumbers', 1 ],
|
|
204
|
+
* message: 'Invalid input: expected number'
|
|
205
|
+
* }
|
|
206
|
+
* ];
|
|
207
|
+
* }
|
|
208
|
+
* ```
|
|
209
|
+
*
|
|
210
|
+
* to
|
|
211
|
+
*
|
|
212
|
+
* ```
|
|
213
|
+
* username
|
|
214
|
+
* ✖ Expected number, received string at "username
|
|
215
|
+
* favoriteNumbers[0]
|
|
216
|
+
* ✖ Invalid input: expected number
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
export declare function toDotPath(_path: readonly (string | number | symbol | StandardSchemaV1.PathSegment)[]): string;
|
|
220
|
+
export declare function prettifyError(error: StandardSchemaV1.FailureResult): string;
|
|
221
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./core.js";
|
|
2
|
+
export * from "./parse.js";
|
|
3
|
+
export * from "./errors.js";
|
|
4
|
+
export * from "./schemas.js";
|
|
5
|
+
export * from "./checks.js";
|
|
6
|
+
export * from "./versions.js";
|
|
7
|
+
export * as util from "./util.js";
|
|
8
|
+
export * as regexes from "./regexes.js";
|
|
9
|
+
export * as locales from "../locales/index.js";
|
|
10
|
+
export * from "./registries.js";
|
|
11
|
+
export * from "./doc.js";
|
|
12
|
+
export * from "./api.js";
|
|
13
|
+
export * from "./to-json-schema.js";
|
|
14
|
+
export { toJSONSchema } from "./json-schema-processors.js";
|
|
15
|
+
export { JSONSchemaGenerator } from "./json-schema-generator.js";
|
|
16
|
+
export * as JSONSchema from "./json-schema.js";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type * as JSONSchema from "./json-schema.js";
|
|
2
|
+
import type { $ZodRegistry } from "./registries.js";
|
|
3
|
+
import type * as schemas from "./schemas.js";
|
|
4
|
+
import { type JSONSchemaGeneratorParams, type ProcessParams, type Seen } from "./to-json-schema.js";
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for the emit method of JSONSchemaGenerator.
|
|
7
|
+
* @deprecated Use toJSONSchema function instead
|
|
8
|
+
*/
|
|
9
|
+
export type EmitParams = Pick<JSONSchemaGeneratorParams, "cycles" | "reused" | "external">;
|
|
10
|
+
/**
|
|
11
|
+
* Parameters for JSONSchemaGenerator constructor.
|
|
12
|
+
* @deprecated Use toJSONSchema function instead
|
|
13
|
+
*/
|
|
14
|
+
type JSONSchemaGeneratorConstructorParams = Pick<JSONSchemaGeneratorParams, "metadata" | "target" | "unrepresentable" | "override" | "io">;
|
|
15
|
+
/**
|
|
16
|
+
* Legacy class-based interface for JSON Schema generation.
|
|
17
|
+
* This class wraps the new functional implementation to provide backward compatibility.
|
|
18
|
+
*
|
|
19
|
+
* @deprecated Use the `toJSONSchema` function instead for new code.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // Legacy usage (still supported)
|
|
24
|
+
* const gen = new JSONSchemaGenerator({ target: "draft-07" });
|
|
25
|
+
* gen.process(schema);
|
|
26
|
+
* const result = gen.emit(schema);
|
|
27
|
+
*
|
|
28
|
+
* // Preferred modern usage
|
|
29
|
+
* const result = toJSONSchema(schema, { target: "draft-07" });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class JSONSchemaGenerator {
|
|
33
|
+
private ctx;
|
|
34
|
+
/** @deprecated Access via ctx instead */
|
|
35
|
+
get metadataRegistry(): $ZodRegistry<Record<string, any>>;
|
|
36
|
+
/** @deprecated Access via ctx instead */
|
|
37
|
+
get target(): ({} & string) | "draft-2020-12" | "draft-07" | "openapi-3.0" | "draft-04";
|
|
38
|
+
/** @deprecated Access via ctx instead */
|
|
39
|
+
get unrepresentable(): "any" | "throw";
|
|
40
|
+
/** @deprecated Access via ctx instead */
|
|
41
|
+
get override(): (ctx: {
|
|
42
|
+
zodSchema: schemas.$ZodType;
|
|
43
|
+
jsonSchema: JSONSchema.BaseSchema;
|
|
44
|
+
path: (string | number)[];
|
|
45
|
+
}) => void;
|
|
46
|
+
/** @deprecated Access via ctx instead */
|
|
47
|
+
get io(): "input" | "output";
|
|
48
|
+
/** @deprecated Access via ctx instead */
|
|
49
|
+
get counter(): number;
|
|
50
|
+
set counter(value: number);
|
|
51
|
+
/** @deprecated Access via ctx instead */
|
|
52
|
+
get seen(): Map<schemas.$ZodType, Seen>;
|
|
53
|
+
constructor(params?: JSONSchemaGeneratorConstructorParams);
|
|
54
|
+
/**
|
|
55
|
+
* Process a schema to prepare it for JSON Schema generation.
|
|
56
|
+
* This must be called before emit().
|
|
57
|
+
*/
|
|
58
|
+
process(schema: schemas.$ZodType, _params?: ProcessParams): JSONSchema.BaseSchema;
|
|
59
|
+
/**
|
|
60
|
+
* Emit the final JSON Schema after processing.
|
|
61
|
+
* Must call process() first.
|
|
62
|
+
*/
|
|
63
|
+
emit(schema: schemas.$ZodType, _params?: EmitParams): JSONSchema.BaseSchema;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { $ZodRegistry } from "./registries.js";
|
|
2
|
+
import type * as schemas from "./schemas.js";
|
|
3
|
+
import { type Processor, type RegistryToJSONSchemaParams, type ToJSONSchemaParams, type ZodStandardJSONSchemaPayload } from "./to-json-schema.js";
|
|
4
|
+
export declare const stringProcessor: Processor<schemas.$ZodString>;
|
|
5
|
+
export declare const numberProcessor: Processor<schemas.$ZodNumber>;
|
|
6
|
+
export declare const booleanProcessor: Processor<schemas.$ZodBoolean>;
|
|
7
|
+
export declare const bigintProcessor: Processor<schemas.$ZodBigInt>;
|
|
8
|
+
export declare const symbolProcessor: Processor<schemas.$ZodSymbol>;
|
|
9
|
+
export declare const nullProcessor: Processor<schemas.$ZodNull>;
|
|
10
|
+
export declare const undefinedProcessor: Processor<schemas.$ZodUndefined>;
|
|
11
|
+
export declare const voidProcessor: Processor<schemas.$ZodVoid>;
|
|
12
|
+
export declare const neverProcessor: Processor<schemas.$ZodNever>;
|
|
13
|
+
export declare const anyProcessor: Processor<schemas.$ZodAny>;
|
|
14
|
+
export declare const unknownProcessor: Processor<schemas.$ZodUnknown>;
|
|
15
|
+
export declare const dateProcessor: Processor<schemas.$ZodDate>;
|
|
16
|
+
export declare const enumProcessor: Processor<schemas.$ZodEnum>;
|
|
17
|
+
export declare const literalProcessor: Processor<schemas.$ZodLiteral>;
|
|
18
|
+
export declare const nanProcessor: Processor<schemas.$ZodNaN>;
|
|
19
|
+
export declare const templateLiteralProcessor: Processor<schemas.$ZodTemplateLiteral>;
|
|
20
|
+
export declare const fileProcessor: Processor<schemas.$ZodFile>;
|
|
21
|
+
export declare const successProcessor: Processor<schemas.$ZodSuccess>;
|
|
22
|
+
export declare const customProcessor: Processor<schemas.$ZodCustom>;
|
|
23
|
+
export declare const functionProcessor: Processor<schemas.$ZodFunction>;
|
|
24
|
+
export declare const transformProcessor: Processor<schemas.$ZodTransform>;
|
|
25
|
+
export declare const mapProcessor: Processor<schemas.$ZodMap>;
|
|
26
|
+
export declare const setProcessor: Processor<schemas.$ZodSet>;
|
|
27
|
+
export declare const arrayProcessor: Processor<schemas.$ZodArray>;
|
|
28
|
+
export declare const objectProcessor: Processor<schemas.$ZodObject>;
|
|
29
|
+
export declare const unionProcessor: Processor<schemas.$ZodUnion>;
|
|
30
|
+
export declare const intersectionProcessor: Processor<schemas.$ZodIntersection>;
|
|
31
|
+
export declare const tupleProcessor: Processor<schemas.$ZodTuple>;
|
|
32
|
+
export declare const recordProcessor: Processor<schemas.$ZodRecord>;
|
|
33
|
+
export declare const nullableProcessor: Processor<schemas.$ZodNullable>;
|
|
34
|
+
export declare const nonoptionalProcessor: Processor<schemas.$ZodNonOptional>;
|
|
35
|
+
export declare const defaultProcessor: Processor<schemas.$ZodDefault>;
|
|
36
|
+
export declare const prefaultProcessor: Processor<schemas.$ZodPrefault>;
|
|
37
|
+
export declare const catchProcessor: Processor<schemas.$ZodCatch>;
|
|
38
|
+
export declare const pipeProcessor: Processor<schemas.$ZodPipe>;
|
|
39
|
+
export declare const readonlyProcessor: Processor<schemas.$ZodReadonly>;
|
|
40
|
+
export declare const promiseProcessor: Processor<schemas.$ZodPromise>;
|
|
41
|
+
export declare const optionalProcessor: Processor<schemas.$ZodOptional>;
|
|
42
|
+
export declare const lazyProcessor: Processor<schemas.$ZodLazy>;
|
|
43
|
+
export declare const allProcessors: Record<string, Processor<any>>;
|
|
44
|
+
export declare function toJSONSchema<T extends schemas.$ZodType>(schema: T, params?: ToJSONSchemaParams): ZodStandardJSONSchemaPayload<T>;
|
|
45
|
+
export declare function toJSONSchema(registry: $ZodRegistry<{
|
|
46
|
+
id?: string | undefined;
|
|
47
|
+
}>, params?: RegistryToJSONSchemaParams): {
|
|
48
|
+
schemas: Record<string, ZodStandardJSONSchemaPayload<schemas.$ZodType>>;
|
|
49
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export type Schema = ObjectSchema | ArraySchema | StringSchema | NumberSchema | IntegerSchema | BooleanSchema | NullSchema;
|
|
2
|
+
export type _JSONSchema = boolean | JSONSchema;
|
|
3
|
+
export type JSONSchema = {
|
|
4
|
+
[k: string]: unknown;
|
|
5
|
+
$schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
|
|
6
|
+
$id?: string;
|
|
7
|
+
$anchor?: string;
|
|
8
|
+
$ref?: string;
|
|
9
|
+
$dynamicRef?: string;
|
|
10
|
+
$dynamicAnchor?: string;
|
|
11
|
+
$vocabulary?: Record<string, boolean>;
|
|
12
|
+
$comment?: string;
|
|
13
|
+
$defs?: Record<string, JSONSchema>;
|
|
14
|
+
type?: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
|
|
15
|
+
additionalItems?: _JSONSchema;
|
|
16
|
+
unevaluatedItems?: _JSONSchema;
|
|
17
|
+
prefixItems?: _JSONSchema[];
|
|
18
|
+
items?: _JSONSchema | _JSONSchema[];
|
|
19
|
+
contains?: _JSONSchema;
|
|
20
|
+
additionalProperties?: _JSONSchema;
|
|
21
|
+
unevaluatedProperties?: _JSONSchema;
|
|
22
|
+
properties?: Record<string, _JSONSchema>;
|
|
23
|
+
patternProperties?: Record<string, _JSONSchema>;
|
|
24
|
+
dependentSchemas?: Record<string, _JSONSchema>;
|
|
25
|
+
propertyNames?: _JSONSchema;
|
|
26
|
+
if?: _JSONSchema;
|
|
27
|
+
then?: _JSONSchema;
|
|
28
|
+
else?: _JSONSchema;
|
|
29
|
+
allOf?: JSONSchema[];
|
|
30
|
+
anyOf?: JSONSchema[];
|
|
31
|
+
oneOf?: JSONSchema[];
|
|
32
|
+
not?: _JSONSchema;
|
|
33
|
+
multipleOf?: number;
|
|
34
|
+
maximum?: number;
|
|
35
|
+
exclusiveMaximum?: number | boolean;
|
|
36
|
+
minimum?: number;
|
|
37
|
+
exclusiveMinimum?: number | boolean;
|
|
38
|
+
maxLength?: number;
|
|
39
|
+
minLength?: number;
|
|
40
|
+
pattern?: string;
|
|
41
|
+
maxItems?: number;
|
|
42
|
+
minItems?: number;
|
|
43
|
+
uniqueItems?: boolean;
|
|
44
|
+
maxContains?: number;
|
|
45
|
+
minContains?: number;
|
|
46
|
+
maxProperties?: number;
|
|
47
|
+
minProperties?: number;
|
|
48
|
+
required?: string[];
|
|
49
|
+
dependentRequired?: Record<string, string[]>;
|
|
50
|
+
enum?: Array<string | number | boolean | null>;
|
|
51
|
+
const?: string | number | boolean | null;
|
|
52
|
+
id?: string;
|
|
53
|
+
title?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
default?: unknown;
|
|
56
|
+
deprecated?: boolean;
|
|
57
|
+
readOnly?: boolean;
|
|
58
|
+
writeOnly?: boolean;
|
|
59
|
+
nullable?: boolean;
|
|
60
|
+
examples?: unknown[];
|
|
61
|
+
format?: string;
|
|
62
|
+
contentMediaType?: string;
|
|
63
|
+
contentEncoding?: string;
|
|
64
|
+
contentSchema?: JSONSchema;
|
|
65
|
+
_prefault?: unknown;
|
|
66
|
+
};
|
|
67
|
+
export type BaseSchema = JSONSchema;
|
|
68
|
+
export interface ObjectSchema extends JSONSchema {
|
|
69
|
+
type: "object";
|
|
70
|
+
}
|
|
71
|
+
export interface ArraySchema extends JSONSchema {
|
|
72
|
+
type: "array";
|
|
73
|
+
}
|
|
74
|
+
export interface StringSchema extends JSONSchema {
|
|
75
|
+
type: "string";
|
|
76
|
+
}
|
|
77
|
+
export interface NumberSchema extends JSONSchema {
|
|
78
|
+
type: "number";
|
|
79
|
+
}
|
|
80
|
+
export interface IntegerSchema extends JSONSchema {
|
|
81
|
+
type: "integer";
|
|
82
|
+
}
|
|
83
|
+
export interface BooleanSchema extends JSONSchema {
|
|
84
|
+
type: "boolean";
|
|
85
|
+
}
|
|
86
|
+
export interface NullSchema extends JSONSchema {
|
|
87
|
+
type: "null";
|
|
88
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as core from "./core.js";
|
|
2
|
+
import * as errors from "./errors.js";
|
|
3
|
+
import type * as schemas from "./schemas.js";
|
|
4
|
+
import * as util from "./util.js";
|
|
5
|
+
export type $ZodErrorClass = {
|
|
6
|
+
new (issues: errors.$ZodIssue[]): errors.$ZodError;
|
|
7
|
+
};
|
|
8
|
+
export type $Parse = <T extends schemas.$ZodType>(schema: T, value: unknown, _ctx?: schemas.ParseContext<errors.$ZodIssue>, _params?: {
|
|
9
|
+
callee?: util.AnyFunc;
|
|
10
|
+
Err?: $ZodErrorClass;
|
|
11
|
+
}) => core.output<T>;
|
|
12
|
+
export declare const _parse: (_Err: $ZodErrorClass) => $Parse;
|
|
13
|
+
export declare const parse: $Parse;
|
|
14
|
+
export type $ParseAsync = <T extends schemas.$ZodType>(schema: T, value: unknown, _ctx?: schemas.ParseContext<errors.$ZodIssue>, _params?: {
|
|
15
|
+
callee?: util.AnyFunc;
|
|
16
|
+
Err?: $ZodErrorClass;
|
|
17
|
+
}) => Promise<core.output<T>>;
|
|
18
|
+
export declare const _parseAsync: (_Err: $ZodErrorClass) => $ParseAsync;
|
|
19
|
+
export declare const parseAsync: $ParseAsync;
|
|
20
|
+
export type $SafeParse = <T extends schemas.$ZodType>(schema: T, value: unknown, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => util.SafeParseResult<core.output<T>>;
|
|
21
|
+
export declare const _safeParse: (_Err: $ZodErrorClass) => $SafeParse;
|
|
22
|
+
export declare const safeParse: $SafeParse;
|
|
23
|
+
export type $SafeParseAsync = <T extends schemas.$ZodType>(schema: T, value: unknown, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => Promise<util.SafeParseResult<core.output<T>>>;
|
|
24
|
+
export declare const _safeParseAsync: (_Err: $ZodErrorClass) => $SafeParseAsync;
|
|
25
|
+
export declare const safeParseAsync: $SafeParseAsync;
|
|
26
|
+
export type $Encode = <T extends schemas.$ZodType>(schema: T, value: core.output<T>, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => core.input<T>;
|
|
27
|
+
export declare const _encode: (_Err: $ZodErrorClass) => $Encode;
|
|
28
|
+
export declare const encode: $Encode;
|
|
29
|
+
export type $Decode = <T extends schemas.$ZodType>(schema: T, value: core.input<T>, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => core.output<T>;
|
|
30
|
+
export declare const _decode: (_Err: $ZodErrorClass) => $Decode;
|
|
31
|
+
export declare const decode: $Decode;
|
|
32
|
+
export type $EncodeAsync = <T extends schemas.$ZodType>(schema: T, value: core.output<T>, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => Promise<core.input<T>>;
|
|
33
|
+
export declare const _encodeAsync: (_Err: $ZodErrorClass) => $EncodeAsync;
|
|
34
|
+
export declare const encodeAsync: $EncodeAsync;
|
|
35
|
+
export type $DecodeAsync = <T extends schemas.$ZodType>(schema: T, value: core.input<T>, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => Promise<core.output<T>>;
|
|
36
|
+
export declare const _decodeAsync: (_Err: $ZodErrorClass) => $DecodeAsync;
|
|
37
|
+
export declare const decodeAsync: $DecodeAsync;
|
|
38
|
+
export type $SafeEncode = <T extends schemas.$ZodType>(schema: T, value: core.output<T>, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => util.SafeParseResult<core.input<T>>;
|
|
39
|
+
export declare const _safeEncode: (_Err: $ZodErrorClass) => $SafeEncode;
|
|
40
|
+
export declare const safeEncode: $SafeEncode;
|
|
41
|
+
export type $SafeDecode = <T extends schemas.$ZodType>(schema: T, value: core.input<T>, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => util.SafeParseResult<core.output<T>>;
|
|
42
|
+
export declare const _safeDecode: (_Err: $ZodErrorClass) => $SafeDecode;
|
|
43
|
+
export declare const safeDecode: $SafeDecode;
|
|
44
|
+
export type $SafeEncodeAsync = <T extends schemas.$ZodType>(schema: T, value: core.output<T>, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => Promise<util.SafeParseResult<core.input<T>>>;
|
|
45
|
+
export declare const _safeEncodeAsync: (_Err: $ZodErrorClass) => $SafeEncodeAsync;
|
|
46
|
+
export declare const safeEncodeAsync: $SafeEncodeAsync;
|
|
47
|
+
export type $SafeDecodeAsync = <T extends schemas.$ZodType>(schema: T, value: core.input<T>, _ctx?: schemas.ParseContext<errors.$ZodIssue>) => Promise<util.SafeParseResult<core.output<T>>>;
|
|
48
|
+
export declare const _safeDecodeAsync: (_Err: $ZodErrorClass) => $SafeDecodeAsync;
|
|
49
|
+
export declare const safeDecodeAsync: $SafeDecodeAsync;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
3
|
+
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
4
|
+
* See https://github.com/paralleldrive/cuid.
|
|
5
|
+
*/
|
|
6
|
+
export declare const cuid: RegExp;
|
|
7
|
+
export declare const cuid2: RegExp;
|
|
8
|
+
export declare const ulid: RegExp;
|
|
9
|
+
export declare const xid: RegExp;
|
|
10
|
+
export declare const ksuid: RegExp;
|
|
11
|
+
export declare const nanoid: RegExp;
|
|
12
|
+
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
13
|
+
export declare const duration: RegExp;
|
|
14
|
+
/** Implements ISO 8601-2 extensions like explicit +- prefixes, mixing weeks with other units, and fractional/negative components. */
|
|
15
|
+
export declare const extendedDuration: RegExp;
|
|
16
|
+
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
17
|
+
export declare const guid: RegExp;
|
|
18
|
+
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
19
|
+
*
|
|
20
|
+
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
21
|
+
export declare const uuid: (version?: number | undefined) => RegExp;
|
|
22
|
+
export declare const uuid4: RegExp;
|
|
23
|
+
export declare const uuid6: RegExp;
|
|
24
|
+
export declare const uuid7: RegExp;
|
|
25
|
+
/** Practical email validation */
|
|
26
|
+
export declare const email: RegExp;
|
|
27
|
+
/** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */
|
|
28
|
+
export declare const html5Email: RegExp;
|
|
29
|
+
/** The classic emailregex.com regex for RFC 5322-compliant emails */
|
|
30
|
+
export declare const rfc5322Email: RegExp;
|
|
31
|
+
/** A loose regex that allows Unicode characters, enforces length limits, and that's about it. */
|
|
32
|
+
export declare const unicodeEmail: RegExp;
|
|
33
|
+
export declare const idnEmail: RegExp;
|
|
34
|
+
export declare const browserEmail: RegExp;
|
|
35
|
+
export declare function emoji(): RegExp;
|
|
36
|
+
export declare const ipv4: RegExp;
|
|
37
|
+
export declare const ipv6: RegExp;
|
|
38
|
+
export declare const mac: (delimiter?: string) => RegExp;
|
|
39
|
+
export declare const cidrv4: RegExp;
|
|
40
|
+
export declare const cidrv6: RegExp;
|
|
41
|
+
export declare const base64: RegExp;
|
|
42
|
+
export declare const base64url: RegExp;
|
|
43
|
+
export declare const hostname: RegExp;
|
|
44
|
+
export declare const domain: RegExp;
|
|
45
|
+
export declare const httpProtocol: RegExp;
|
|
46
|
+
export declare const e164: RegExp;
|
|
47
|
+
export declare const date: RegExp;
|
|
48
|
+
export declare function time(args: {
|
|
49
|
+
precision?: number | null;
|
|
50
|
+
}): RegExp;
|
|
51
|
+
export declare function datetime(args: {
|
|
52
|
+
precision?: number | null;
|
|
53
|
+
offset?: boolean;
|
|
54
|
+
local?: boolean;
|
|
55
|
+
}): RegExp;
|
|
56
|
+
export declare const string: (params?: {
|
|
57
|
+
minimum?: number | undefined;
|
|
58
|
+
maximum?: number | undefined;
|
|
59
|
+
}) => RegExp;
|
|
60
|
+
export declare const bigint: RegExp;
|
|
61
|
+
export declare const integer: RegExp;
|
|
62
|
+
export declare const number: RegExp;
|
|
63
|
+
export declare const boolean: RegExp;
|
|
64
|
+
declare const _null: RegExp;
|
|
65
|
+
export { _null as null };
|
|
66
|
+
declare const _undefined: RegExp;
|
|
67
|
+
export { _undefined as undefined };
|
|
68
|
+
export declare const lowercase: RegExp;
|
|
69
|
+
export declare const uppercase: RegExp;
|
|
70
|
+
export declare const hex: RegExp;
|
|
71
|
+
export declare const md5_hex: RegExp;
|
|
72
|
+
export declare const md5_base64: RegExp;
|
|
73
|
+
export declare const md5_base64url: RegExp;
|
|
74
|
+
export declare const sha1_hex: RegExp;
|
|
75
|
+
export declare const sha1_base64: RegExp;
|
|
76
|
+
export declare const sha1_base64url: RegExp;
|
|
77
|
+
export declare const sha256_hex: RegExp;
|
|
78
|
+
export declare const sha256_base64: RegExp;
|
|
79
|
+
export declare const sha256_base64url: RegExp;
|
|
80
|
+
export declare const sha384_hex: RegExp;
|
|
81
|
+
export declare const sha384_base64: RegExp;
|
|
82
|
+
export declare const sha384_base64url: RegExp;
|
|
83
|
+
export declare const sha512_hex: RegExp;
|
|
84
|
+
export declare const sha512_base64: RegExp;
|
|
85
|
+
export declare const sha512_base64url: RegExp;
|