title: Core.z. Zod String
A2A Node SDK - v0.1.0 / Modules / Core / z / ZodString
Class: ZodString
Hierarchy
-
ZodType<string,ZodStringDef,string>↳
ZodString
Table of contents
Constructors
Properties
Accessors
- description
- isBase64
- isBase64url
- isCIDR
- isCUID
- isCUID2
- isDate
- isDatetime
- isDuration
- isEmail
- isEmoji
- isIP
- isNANOID
- isTime
- isULID
- isURL
- isUUID
- maxLength
- minLength
Methods
- _addCheck
- _getOrReturnCtx
- _getType
- _parse
- _parseAsync
- _parseSync
- _processInputParams
- _refinement
- _regex
- and
- array
- base64
- base64url
- brand
- catch
- cidr
- cuid
- cuid2
- date
- datetime
- default
- describe
- duration
- emoji
- endsWith
- includes
- ip
- isNullable
- isOptional
- jwt
- length
- max
- min
- nanoid
- nonempty
- nullable
- nullish
- optional
- or
- parse
- parseAsync
- pipe
- promise
- readonly
- refine
- refinement
- regex
- safeParse
- safeParseAsync
- startsWith
- superRefine
- time
- toLowerCase
- toUpperCase
- transform
- trim
- ulid
- url
- uuid
- ~validate
Constructors
constructor
• new ZodString(def): ZodString
Parameters
| Name | Type |
|---|---|
def | ZodStringDef |
Returns
Inherited from
Properties
_def
• Readonly _def: ZodStringDef
Inherited from
_input
• Readonly _input: string
Inherited from
_output
• Readonly _output: string
Inherited from
_type
• Readonly _type: string
Inherited from
create
▪ Static create: (params?: { description?: string ; errorMap?: ZodErrorMap ; invalid_type_error?: string ; message?: string ; required_error?: string } & { coerce?: true }) => ZodString
Type declaration
▸ (params?): ZodString
Parameters
| Name | Type |
|---|---|
params? | { description?: string ; errorMap?: ZodErrorMap ; invalid_type_error?: string ; message?: string ; required_error?: string } & { coerce?: true } |
Returns
spa
• spa: (data: unknown, params?: InexactPartial<ParseParams>) => Promise<SafeParseReturnType<string, string>>
Alias of safeParseAsync
Type declaration
▸ (data, params?): Promise<SafeParseReturnType<string, string>>
Parameters
| Name | Type |
|---|---|
data | unknown |
params? | InexactPartial<ParseParams> |
Returns
Promise<SafeParseReturnType<string, string>>
Inherited from
~standard
• ~standard: Props<string, string>
Inherited from
Accessors
description
• get description(): undefined | string
Returns
undefined | string
Inherited from
ZodType.description
isBase64
• get isBase64(): boolean
Returns
boolean
isBase64url
• get isBase64url(): boolean
Returns
boolean
isCIDR
• get isCIDR(): boolean
Returns
boolean
isCUID
• get isCUID(): boolean
Returns
boolean
isCUID2
• get isCUID2(): boolean
Returns
boolean
isDate
• get isDate(): boolean
Returns
boolean
isDatetime
• get isDatetime(): boolean
Returns
boolean
isDuration
• get isDuration(): boolean
Returns
boolean
isEmail
• get isEmail(): boolean
Returns
boolean
isEmoji
• get isEmoji(): boolean
Returns
boolean
isIP
• get isIP(): boolean
Returns
boolean
isNANOID
• get isNANOID(): boolean
Returns
boolean
isTime
• get isTime(): boolean
Returns
boolean
isULID
• get isULID(): boolean
Returns
boolean
isURL
• get isURL(): boolean
Returns
boolean
isUUID
• get isUUID(): boolean
Returns
boolean
maxLength
• get maxLength(): null | number
Returns
null | number
minLength
• get minLength(): null | number
Returns
null | number
Methods
_addCheck
▸ _addCheck(check): ZodString
Parameters
| Name | Type |
|---|---|
check | ZodStringCheck |
Returns
_getOrReturnCtx
▸ _getOrReturnCtx(input, ctx?): ParseContext
Parameters
| Name | Type |
|---|---|
input | ParseInput |
ctx? | ParseContext |
Returns
Inherited from
_getType
▸ _getType(input): string
Parameters
| Name | Type |
|---|---|
input | ParseInput |
Returns
string
Inherited from
_parse
▸ _parse(input): ParseReturnType<string>
Parameters
| Name | Type |
|---|---|
input | ParseInput |
Returns
ParseReturnType<string>
Overrides
_parseAsync
▸ _parseAsync(input): AsyncParseReturnType<string>
Parameters
| Name | Type |
|---|---|
input | ParseInput |
Returns
AsyncParseReturnType<string>
Inherited from
_parseSync
▸ _parseSync(input): SyncParseReturnType<string>
Parameters
| Name | Type |
|---|---|
input | ParseInput |
Returns
SyncParseReturnType<string>
Inherited from
_processInputParams
▸ _processInputParams(input): Object
Parameters
| Name | Type |
|---|---|
input | ParseInput |
Returns
Object
| Name | Type |
|---|---|
ctx | ParseContext |
status | ParseStatus |
Inherited from
_refinement
▸ _refinement(refinement): ZodEffects<ZodString, string, string>
Parameters
| Name | Type |
|---|---|
refinement | (arg: string, ctx: RefinementCtx) => any |
Returns
ZodEffects<ZodString, string, string>
Inherited from
_regex
▸ _regex(regex, validation, message?): ZodEffects<ZodString, string, string>
Parameters
| Name | Type |
|---|---|
regex | RegExp |
validation | StringValidation |
message? | ErrMessage |
Returns
ZodEffects<ZodString, string, string>
and
▸ and<T>(incoming): ZodIntersection<ZodString, T>
Type parameters
| Name | Type |
|---|---|
T | extends ZodTypeAny |
Parameters
| Name | Type |
|---|---|
incoming | T |
Returns
Inherited from
array
▸ array(): ZodArray<ZodString, "many">
Returns
Inherited from
base64
▸ base64(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
base64url
▸ base64url(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
brand
▸ brand<B>(brand?): ZodBranded<ZodString, B>
Type parameters
| Name | Type |
|---|---|
B | extends string | number | symbol |
Parameters
| Name | Type |
|---|---|
brand? | B |
Returns
ZodBranded<ZodString, B>
Inherited from
catch
▸ catch(def): ZodCatch<ZodString>
Parameters
| Name | Type |
|---|---|
def | string |
Returns
Inherited from
▸ catch(def): ZodCatch<ZodString>
Parameters
| Name | Type |
|---|---|
def | (ctx: { error: ZodError<any> ; input: string }) => string |
Returns
Inherited from
cidr
▸ cidr(options?): ZodString
Parameters
| Name | Type |
|---|---|
options? | string | { message?: string ; version?: IpVersion } |
Returns
cuid
▸ cuid(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
cuid2
▸ cuid2(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
date
▸ date(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | string |
Returns
datetime
▸ datetime(options?): ZodString
Parameters
| Name | Type |
|---|---|
options? | string | { local?: boolean ; message?: string ; offset?: boolean ; precision?: null | number } |
Returns
default
▸ default(def): ZodDefault<ZodString>
Parameters
| Name | Type |
|---|---|
def | string |
Returns
Inherited from
▸ default(def): ZodDefault<ZodString>
Parameters
| Name | Type |
|---|---|
def | () => string |
Returns
Inherited from
describe
▸ describe(description): this
Parameters
| Name | Type |
|---|---|
description | string |
Returns
this
Inherited from
duration
▸ duration(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
▸ email(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
emoji
▸ emoji(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
endsWith
▸ endsWith(value, message?): ZodString
Parameters
| Name | Type |
|---|---|
value | string |
message? | ErrMessage |
Returns
includes
▸ includes(value, options?): ZodString
Parameters
| Name | Type |
|---|---|
value | string |
options? | Object |
options.message? | string |
options.position? | number |
Returns
ip
▸ ip(options?): ZodString
Parameters
| Name | Type |
|---|---|
options? | string | { message?: string ; version?: IpVersion } |
Returns
isNullable
▸ isNullable(): boolean
Returns
boolean
Inherited from
isOptional
▸ isOptional(): boolean
Returns
boolean
Inherited from
jwt
▸ jwt(options?): ZodString
Parameters
| Name | Type |
|---|---|
options? | Object |
options.alg? | string |
options.message? | string |
Returns
length
▸ length(len, message?): ZodString
Parameters
| Name | Type |
|---|---|
len | number |
message? | ErrMessage |
Returns
max
▸ max(maxLength, message?): ZodString
Parameters
| Name | Type |
|---|---|
maxLength | number |
message? | ErrMessage |
Returns
min
▸ min(minLength, message?): ZodString
Parameters
| Name | Type |
|---|---|
minLength | number |
message? | ErrMessage |
Returns
nanoid
▸ nanoid(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
nonempty
▸ nonempty(message?): ZodString
Equivalent to .min(1)
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
nullable
▸ nullable(): ZodNullable<ZodString>
Returns
Inherited from
nullish
▸ nullish(): ZodOptional<ZodNullable<ZodString>>
Returns
ZodOptional<ZodNullable<ZodString>>
Inherited from
optional
▸ optional(): ZodOptional<ZodString>
Returns
Inherited from
or
▸ or<T>(option): ZodUnion<[ZodString, T]>
Type parameters
| Name | Type |
|---|---|
T | extends ZodTypeAny |
Parameters
| Name | Type |
|---|---|
option | T |
Returns
Inherited from
parse
▸ parse(data, params?): string
Parameters
| Name | Type |
|---|---|
data | unknown |
params? | InexactPartial<ParseParams> |
Returns
string
Inherited from
parseAsync
▸ parseAsync(data, params?): Promise<string>
Parameters
| Name | Type |
|---|---|
data | unknown |
params? | InexactPartial<ParseParams> |
Returns
Promise<string>
Inherited from
pipe
▸ pipe<T>(target): ZodPipeline<ZodString, T>
Type parameters
| Name | Type |
|---|---|
T | extends ZodTypeAny |
Parameters
| Name | Type |
|---|---|
target | T |
Returns
ZodPipeline<ZodString, T>
Inherited from
promise
▸ promise(): ZodPromise<ZodString>
Returns
Inherited from
readonly
▸ readonly(): ZodReadonly<ZodString>
Returns
Inherited from
refine
▸ refine<RefinedOutput>(check, message?): ZodEffects<ZodString, RefinedOutput, string>
Type parameters
| Name | Type |
|---|---|
RefinedOutput | extends string |
Parameters
| Name | Type |
|---|---|
check | (arg: string) => arg is RefinedOutput |
message? | string | Partial<Omit<ZodCustomIssue, "code">> | (arg: string) => Partial<Omit<ZodCustomIssue, "code">> |
Returns
ZodEffects<ZodString, RefinedOutput, string>
Inherited from
▸ refine(check, message?): ZodEffects<ZodString, string, string>
Parameters
| Name | Type |
|---|---|
check | (arg: string) => unknown |
message? | string | Partial<Omit<ZodCustomIssue, "code">> | (arg: string) => Partial<Omit<ZodCustomIssue, "code">> |
Returns
ZodEffects<ZodString, string, string>
Inherited from
refinement
▸ refinement<RefinedOutput>(check, refinementData): ZodEffects<ZodString, RefinedOutput, string>
Type parameters
| Name | Type |
|---|---|
RefinedOutput | extends string |
Parameters
| Name | Type |
|---|---|
check | (arg: string) => arg is RefinedOutput |
refinementData | IssueData | (arg: string, ctx: RefinementCtx) => IssueData |
Returns
ZodEffects<ZodString, RefinedOutput, string>
Inherited from
▸ refinement(check, refinementData): ZodEffects<ZodString, string, string>
Parameters
| Name | Type |
|---|---|
check | (arg: string) => boolean |
refinementData | IssueData | (arg: string, ctx: RefinementCtx) => IssueData |
Returns
ZodEffects<ZodString, string, string>
Inherited from
regex
▸ regex(regex, message?): ZodString
Parameters
| Name | Type |
|---|---|
regex | RegExp |
message? | ErrMessage |
Returns
safeParse
▸ safeParse(data, params?): SafeParseReturnType<string, string>
Parameters
| Name | Type |
|---|---|
data | unknown |
params? | InexactPartial<ParseParams> |
Returns
SafeParseReturnType<string, string>
Inherited from
safeParseAsync
▸ safeParseAsync(data, params?): Promise<SafeParseReturnType<string, string>>
Parameters
| Name | Type |
|---|---|
data | unknown |
params? | InexactPartial<ParseParams> |
Returns
Promise<SafeParseReturnType<string, string>>
Inherited from
startsWith
▸ startsWith(value, message?): ZodString
Parameters
| Name | Type |
|---|---|
value | string |
message? | ErrMessage |
Returns
superRefine
▸ superRefine<RefinedOutput>(refinement): ZodEffects<ZodString, RefinedOutput, string>
Type parameters
| Name | Type |
|---|---|
RefinedOutput | extends string |
Parameters
| Name | Type |
|---|---|
refinement | (arg: string, ctx: RefinementCtx) => arg is RefinedOutput |
Returns
ZodEffects<ZodString, RefinedOutput, string>
Inherited from
▸ superRefine(refinement): ZodEffects<ZodString, string, string>
Parameters
| Name | Type |
|---|---|
refinement | (arg: string, ctx: RefinementCtx) => void |
Returns
ZodEffects<ZodString, string, string>
Inherited from
▸ superRefine(refinement): ZodEffects<ZodString, string, string>
Parameters
| Name | Type |
|---|---|
refinement | (arg: string, ctx: RefinementCtx) => Promise<void> |
Returns
ZodEffects<ZodString, string, string>
Inherited from
time
▸ time(options?): ZodString
Parameters
| Name | Type |
|---|---|
options? | string | { message?: string ; precision?: null | number } |
Returns
toLowerCase
▸ toLowerCase(): ZodString
Returns
toUpperCase
▸ toUpperCase(): ZodString
Returns
transform
▸ transform<NewOut>(transform): ZodEffects<ZodString, NewOut, string>
Type parameters
| Name |
|---|
NewOut |
Parameters
| Name | Type |
|---|---|
transform | (arg: string, ctx: RefinementCtx) => NewOut | Promise<NewOut> |
Returns
ZodEffects<ZodString, NewOut, string>
Inherited from
trim
▸ trim(): ZodString
Returns
ulid
▸ ulid(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
url
▸ url(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
uuid
▸ uuid(message?): ZodString
Parameters
| Name | Type |
|---|---|
message? | ErrMessage |
Returns
~validate
▸ ~validate(data): Result<string> | Promise<Result<string>>
Parameters
| Name | Type |
|---|---|
data | unknown |
Returns
Result<string> | Promise<Result<string>>