zmp-sdk 2.46.5 → 2.47.0-beta.2
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/apis/apis/checkoutKit/index.js +1 -0
- package/apis/apis/checkoutKit/purchase.js +1 -0
- package/apis/apis/checkoutKit/showWidget.js +1 -0
- package/apis/apis/showCustomOAWidget.js +1 -1
- package/apis/apis/showFunctionButtonWidget.js +1 -1
- package/apis/apis/showOAWidget.js +1 -1
- package/apis/common/apis/general/getSystemInfo.js +1 -1
- package/apis/common/apis/general/openShareSheet.js +1 -1
- package/apis/common/apis/general/scanNFC.js +1 -1
- package/apis/common/apis/general/storage/index.js +1 -1
- package/apis/common/eventEmitter.js +1 -1
- package/apis/common/utils.js +1 -1
- package/apis/constants.js +1 -1
- package/apis/index.d.ts +141 -7
- package/apis/index.es.js +1 -1
- package/apis/index.js +1 -1
- package/apis/package.json.js +1 -1
- package/apis/utils/common.js +1 -1
- package/browser.min.js +2 -2
- package/index.d.ts +1611 -1473
- package/index.es.js +2 -2
- package/index.js +2 -2
- package/index.umd.js +3 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,1133 +1,187 @@
|
|
|
1
|
-
import { StreamType as StreamType$1, MediaConstraints as MediaConstraints$1, PhotoConstraint as PhotoConstraint$1, PhotoFrame as PhotoFrame$1, MediaDevice as MediaDevice$1, CameraEvents as CameraEvents$1 } from '@mp-types';
|
|
1
|
+
import { AsyncVoidCallback as AsyncVoidCallback$1, StreamType as StreamType$1, MediaConstraints as MediaConstraints$1, PhotoConstraint as PhotoConstraint$1, PhotoFrame as PhotoFrame$1, MediaDevice as MediaDevice$1, CameraEvents as CameraEvents$1 } from '@mp-types';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export const objectValues: (obj: any) => any[];
|
|
16
|
-
export const objectKeys: ObjectConstructor["keys"];
|
|
17
|
-
export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
|
18
|
-
export type identity<T> = T;
|
|
19
|
-
export type flatten<T> = identity<{
|
|
20
|
-
[k in keyof T]: T[k];
|
|
21
|
-
}>;
|
|
22
|
-
export type noUndefined<T> = T extends undefined ? never : T;
|
|
23
|
-
export const isInteger: NumberConstructor["isInteger"];
|
|
24
|
-
export function joinValues<T extends any[]>(array: T, separator?: string): string;
|
|
25
|
-
export const jsonStringifyReplacer: (_: string, value: any) => any;
|
|
26
|
-
export {};
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {"none" | "wifi" | "cellular" | "unknown"} NetworkType
|
|
5
|
+
*/
|
|
6
|
+
declare enum NetworkType {
|
|
7
|
+
/** No Network */
|
|
8
|
+
none = "none",
|
|
9
|
+
/** Wi-Fi Network */
|
|
10
|
+
wifi = "wifi",
|
|
11
|
+
/** Cellular Network (2g/3g/4g) */
|
|
12
|
+
cellular = "cellular",
|
|
13
|
+
/** Uncommon network types for Android */
|
|
14
|
+
unknown = "unknown"
|
|
27
15
|
}
|
|
28
|
-
declare
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
date: "date";
|
|
37
|
-
bigint: "bigint";
|
|
38
|
-
symbol: "symbol";
|
|
39
|
-
undefined: "undefined";
|
|
40
|
-
null: "null";
|
|
41
|
-
array: "array";
|
|
42
|
-
object: "object";
|
|
43
|
-
unknown: "unknown";
|
|
44
|
-
promise: "promise";
|
|
45
|
-
void: "void";
|
|
46
|
-
never: "never";
|
|
47
|
-
map: "map";
|
|
48
|
-
set: "set";
|
|
49
|
-
};
|
|
50
|
-
declare type ZodParsedType = keyof typeof ZodParsedType;
|
|
51
|
-
|
|
52
|
-
declare type allKeys<T> = T extends any ? keyof T : never;
|
|
53
|
-
declare type typeToFlattenedError<T, U = string> = {
|
|
54
|
-
formErrors: U[];
|
|
55
|
-
fieldErrors: {
|
|
56
|
-
[P in allKeys<T>]?: U[];
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
declare const ZodIssueCode: {
|
|
60
|
-
invalid_type: "invalid_type";
|
|
61
|
-
invalid_literal: "invalid_literal";
|
|
62
|
-
custom: "custom";
|
|
63
|
-
invalid_union: "invalid_union";
|
|
64
|
-
invalid_union_discriminator: "invalid_union_discriminator";
|
|
65
|
-
invalid_enum_value: "invalid_enum_value";
|
|
66
|
-
unrecognized_keys: "unrecognized_keys";
|
|
67
|
-
invalid_arguments: "invalid_arguments";
|
|
68
|
-
invalid_return_type: "invalid_return_type";
|
|
69
|
-
invalid_date: "invalid_date";
|
|
70
|
-
invalid_string: "invalid_string";
|
|
71
|
-
too_small: "too_small";
|
|
72
|
-
too_big: "too_big";
|
|
73
|
-
invalid_intersection_types: "invalid_intersection_types";
|
|
74
|
-
not_multiple_of: "not_multiple_of";
|
|
75
|
-
not_finite: "not_finite";
|
|
76
|
-
};
|
|
77
|
-
declare type ZodIssueCode = keyof typeof ZodIssueCode;
|
|
78
|
-
declare type ZodIssueBase = {
|
|
79
|
-
path: (string | number)[];
|
|
80
|
-
message?: string;
|
|
81
|
-
};
|
|
82
|
-
interface ZodInvalidTypeIssue extends ZodIssueBase {
|
|
83
|
-
code: typeof ZodIssueCode.invalid_type;
|
|
84
|
-
expected: ZodParsedType;
|
|
85
|
-
received: ZodParsedType;
|
|
16
|
+
declare enum PlatformType {
|
|
17
|
+
/** Windows phone */
|
|
18
|
+
wp = "wp",
|
|
19
|
+
/** Android */
|
|
20
|
+
android = "android",
|
|
21
|
+
/** iOS */
|
|
22
|
+
iOS = "iOS",
|
|
23
|
+
unknown = "unknown"
|
|
86
24
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
25
|
+
declare enum Events {
|
|
26
|
+
AppPaused = "h5.event.paused",
|
|
27
|
+
AppResumed = "h5.event.resumed",
|
|
28
|
+
NetworkChanged = "h5.event.connection.changed",
|
|
29
|
+
OnDataCallback = "h5.event.webview.result",
|
|
30
|
+
WebviewClosed = "h5.event.webview.close",
|
|
31
|
+
OpenApp = "h5.event.open.mp",
|
|
32
|
+
AppClose = "h5.event.action.close",
|
|
33
|
+
PaymentCallback = "payment.callback",
|
|
34
|
+
PaymentResult = "action.payment.result",
|
|
35
|
+
/** Người dùng đã hoàn thành quy trình thanh toán ở CheckoutSDK
|
|
36
|
+
* * Lưu ý: Event sẽ được gửi khi người dùng hoàn tất hoặc hủy quy trình thanh toán.
|
|
37
|
+
* * Đối tác cần sử dụng API checkTransaction để kiểm tra trạng thái thanh toán mới nhất.
|
|
38
|
+
*
|
|
39
|
+
* @link https://mini.zalo.me/documents/checkout-sdk/integration-process/overview/receive-transaction-ma/
|
|
40
|
+
* */
|
|
41
|
+
PaymentDone = "action.payment.done",
|
|
42
|
+
PaymentClose = "action.payment.close",
|
|
43
|
+
DownloadProgress = "h5.event.webview.download.progress"
|
|
91
44
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
45
|
+
declare enum JumpStatus {
|
|
46
|
+
DOING = "doing",
|
|
47
|
+
DONE = "done"
|
|
95
48
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
49
|
+
declare enum ProfileType {
|
|
50
|
+
user = 1,
|
|
51
|
+
oa = 0,
|
|
52
|
+
aliasOA = 2
|
|
99
53
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
54
|
+
declare enum ChatType {
|
|
55
|
+
user = 1,
|
|
56
|
+
oa = 0
|
|
103
57
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
58
|
+
declare enum PostFeedType {
|
|
59
|
+
image = 1,
|
|
60
|
+
multi_image = 2,
|
|
61
|
+
link = 4,
|
|
62
|
+
profile = 5
|
|
108
63
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
argumentsError: ZodError;
|
|
64
|
+
declare enum ScanNFCType {
|
|
65
|
+
cccd = 1
|
|
112
66
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
67
|
+
declare enum ShareSheetType {
|
|
68
|
+
image = 1,
|
|
69
|
+
gif = 11,
|
|
70
|
+
video = 12,
|
|
71
|
+
link = 4,
|
|
72
|
+
oa = 5,
|
|
73
|
+
zmp = 20,
|
|
74
|
+
multi_image = 21,
|
|
75
|
+
zmp_deep_link = 4,
|
|
76
|
+
text = 22
|
|
116
77
|
}
|
|
117
|
-
|
|
118
|
-
|
|
78
|
+
declare enum OrientationType {
|
|
79
|
+
auto = 1,
|
|
80
|
+
portrait = 2,
|
|
81
|
+
landscape = 3
|
|
119
82
|
}
|
|
120
|
-
declare
|
|
121
|
-
|
|
122
|
-
} | {
|
|
123
|
-
endsWith: string;
|
|
124
|
-
};
|
|
125
|
-
interface ZodInvalidStringIssue extends ZodIssueBase {
|
|
126
|
-
code: typeof ZodIssueCode.invalid_string;
|
|
127
|
-
validation: StringValidation;
|
|
83
|
+
declare enum VibrateType {
|
|
84
|
+
oneShot = 0
|
|
128
85
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
86
|
+
declare enum MediaPickerType {
|
|
87
|
+
zcamera = 3,
|
|
88
|
+
zcamera_photo = 1,
|
|
89
|
+
zcamera_video = 2,
|
|
90
|
+
zcamera_scan = 7,
|
|
91
|
+
photo = 4,
|
|
92
|
+
video = 5,
|
|
93
|
+
file = 6
|
|
135
94
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
inclusive: boolean;
|
|
140
|
-
exact?: boolean;
|
|
141
|
-
type: "array" | "string" | "number" | "set" | "date";
|
|
95
|
+
declare enum IAPPayType {
|
|
96
|
+
"SUBSCRIPTION" = "SUBSCRIPTION",
|
|
97
|
+
"ONETIME" = "ONETIME"
|
|
142
98
|
}
|
|
143
|
-
|
|
144
|
-
|
|
99
|
+
declare enum ProrationMode {
|
|
100
|
+
"UNKNOW" = 0,
|
|
101
|
+
"DEFERRED" = 1,
|
|
102
|
+
"IMMEDIATE_AND_CHARGE_FULL_PRICE" = 2
|
|
145
103
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
104
|
+
declare enum StatusBarType {
|
|
105
|
+
normal = 1,
|
|
106
|
+
hidden = 0,
|
|
107
|
+
transparent = 2
|
|
149
108
|
}
|
|
150
|
-
|
|
151
|
-
|
|
109
|
+
declare enum AndroidBottomNavigationBarType {
|
|
110
|
+
show = 1,
|
|
111
|
+
hide = 0
|
|
152
112
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
[k: string]: any;
|
|
157
|
-
};
|
|
113
|
+
declare enum IOSSafeAreaBottomType {
|
|
114
|
+
show = 1,
|
|
115
|
+
hide = 0
|
|
158
116
|
}
|
|
159
|
-
declare
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
117
|
+
declare enum TextAlignType {
|
|
118
|
+
left = 0,
|
|
119
|
+
center = 1
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
type PickAttr<Attr extends keyof T, T = any> = {
|
|
123
|
+
[P in keyof T]: T[Attr];
|
|
124
|
+
}[keyof T];
|
|
125
|
+
type Common = Record<string, any>;
|
|
126
|
+
type FunctionProps = {
|
|
127
|
+
[key: string]: {
|
|
128
|
+
lastCall?: number;
|
|
129
|
+
retry?: number;
|
|
130
|
+
limit?: number;
|
|
131
|
+
};
|
|
163
132
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
declare type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
|
|
190
|
-
declare type IssueData = stripPath<ZodIssueOptionalMessage> & {
|
|
191
|
-
path?: (string | number)[];
|
|
192
|
-
fatal?: boolean;
|
|
133
|
+
type Action<T> = {
|
|
134
|
+
[K in keyof T]: {
|
|
135
|
+
versionLive?: {
|
|
136
|
+
android?: number;
|
|
137
|
+
iOS?: number;
|
|
138
|
+
};
|
|
139
|
+
appSupport?: boolean;
|
|
140
|
+
havePermission?: boolean;
|
|
141
|
+
skipJump?: boolean;
|
|
142
|
+
requireAccessToken?: boolean;
|
|
143
|
+
whiteList?: boolean;
|
|
144
|
+
haveCallback?: boolean;
|
|
145
|
+
errorList?: {
|
|
146
|
+
[L in PlatformType]?: {
|
|
147
|
+
[code: string]: {
|
|
148
|
+
mapTo: {
|
|
149
|
+
code: number;
|
|
150
|
+
message: string;
|
|
151
|
+
};
|
|
152
|
+
message?: string;
|
|
153
|
+
needMoreDetail?: boolean;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
};
|
|
193
158
|
};
|
|
194
|
-
|
|
195
|
-
|
|
159
|
+
type NativeCallBackData = {
|
|
160
|
+
error_code: number;
|
|
161
|
+
error_message: string;
|
|
162
|
+
action: string;
|
|
196
163
|
data: any;
|
|
197
164
|
};
|
|
198
|
-
|
|
165
|
+
type LogData = {
|
|
166
|
+
action: string;
|
|
167
|
+
error: number;
|
|
199
168
|
message: string;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
declare type ParseParams = {
|
|
203
|
-
path: (string | number)[];
|
|
204
|
-
errorMap: ZodErrorMap;
|
|
205
|
-
async: boolean;
|
|
206
|
-
};
|
|
207
|
-
declare type ParsePathComponent = string | number;
|
|
208
|
-
declare type ParsePath = ParsePathComponent[];
|
|
209
|
-
interface ParseContext {
|
|
210
|
-
readonly common: {
|
|
211
|
-
readonly issues: ZodIssue[];
|
|
212
|
-
readonly contextualErrorMap?: ZodErrorMap;
|
|
213
|
-
readonly async: boolean;
|
|
214
|
-
};
|
|
215
|
-
readonly path: ParsePath;
|
|
216
|
-
readonly schemaErrorMap?: ZodErrorMap;
|
|
217
|
-
readonly parent: ParseContext | null;
|
|
218
|
-
readonly data: any;
|
|
219
|
-
readonly parsedType: ZodParsedType;
|
|
220
|
-
}
|
|
221
|
-
declare type ParseInput = {
|
|
222
169
|
data: any;
|
|
223
|
-
path: (string | number)[];
|
|
224
|
-
parent: ParseContext;
|
|
225
|
-
};
|
|
226
|
-
declare class ParseStatus {
|
|
227
|
-
value: "aborted" | "dirty" | "valid";
|
|
228
|
-
dirty(): void;
|
|
229
|
-
abort(): void;
|
|
230
|
-
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
|
231
|
-
static mergeObjectAsync(status: ParseStatus, pairs: {
|
|
232
|
-
key: ParseReturnType<any>;
|
|
233
|
-
value: ParseReturnType<any>;
|
|
234
|
-
}[]): Promise<SyncParseReturnType<any>>;
|
|
235
|
-
static mergeObjectSync(status: ParseStatus, pairs: {
|
|
236
|
-
key: SyncParseReturnType<any>;
|
|
237
|
-
value: SyncParseReturnType<any>;
|
|
238
|
-
alwaysSet?: boolean;
|
|
239
|
-
}[]): SyncParseReturnType;
|
|
240
|
-
}
|
|
241
|
-
declare type INVALID = {
|
|
242
|
-
status: "aborted";
|
|
243
|
-
};
|
|
244
|
-
declare const INVALID: INVALID;
|
|
245
|
-
declare type DIRTY<T> = {
|
|
246
|
-
status: "dirty";
|
|
247
|
-
value: T;
|
|
248
|
-
};
|
|
249
|
-
declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
|
250
|
-
declare type OK<T> = {
|
|
251
|
-
status: "valid";
|
|
252
|
-
value: T;
|
|
253
170
|
};
|
|
254
|
-
declare const OK: <T>(value: T) => OK<T>;
|
|
255
|
-
declare type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
|
256
|
-
declare type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
|
257
|
-
declare type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
|
258
|
-
|
|
259
|
-
declare namespace enumUtil {
|
|
260
|
-
type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
|
261
|
-
type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
|
|
262
|
-
type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
|
|
263
|
-
type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
|
|
264
|
-
export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
|
|
265
|
-
export {};
|
|
266
|
-
}
|
|
267
171
|
|
|
268
|
-
declare
|
|
269
|
-
|
|
270
|
-
|
|
172
|
+
declare const ACTION: {
|
|
173
|
+
GET_DOWNLOADED_STICKER: {
|
|
174
|
+
haveCallback: boolean;
|
|
271
175
|
};
|
|
272
|
-
|
|
273
|
-
|
|
176
|
+
OPEN_SHARE_STICKER: {};
|
|
177
|
+
OPEN_PROFILE: {
|
|
178
|
+
requireAccessToken: boolean;
|
|
274
179
|
};
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
[k in keyof Shape]: ZodOptional<DeepPartial<Shape[k]>>;
|
|
281
|
-
}, Params, Catchall> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
|
|
282
|
-
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
|
283
|
-
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
declare type RefinementCtx = {
|
|
287
|
-
addIssue: (arg: IssueData) => void;
|
|
288
|
-
path: (string | number)[];
|
|
289
|
-
};
|
|
290
|
-
declare type ZodRawShape = {
|
|
291
|
-
[k: string]: ZodTypeAny;
|
|
292
|
-
};
|
|
293
|
-
declare type ZodTypeAny = ZodType<any, any, any>;
|
|
294
|
-
declare type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
|
|
295
|
-
declare type input<T extends ZodType<any, any, any>> = T["_input"];
|
|
296
|
-
declare type output<T extends ZodType<any, any, any>> = T["_output"];
|
|
297
|
-
|
|
298
|
-
declare type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
|
|
299
|
-
interface ZodTypeDef {
|
|
300
|
-
errorMap?: ZodErrorMap;
|
|
301
|
-
description?: string;
|
|
302
|
-
}
|
|
303
|
-
declare type RawCreateParams = {
|
|
304
|
-
errorMap?: ZodErrorMap;
|
|
305
|
-
invalid_type_error?: string;
|
|
306
|
-
required_error?: string;
|
|
307
|
-
description?: string;
|
|
308
|
-
} | undefined;
|
|
309
|
-
declare type SafeParseSuccess<Output> = {
|
|
310
|
-
success: true;
|
|
311
|
-
data: Output;
|
|
312
|
-
};
|
|
313
|
-
declare type SafeParseError<Input> = {
|
|
314
|
-
success: false;
|
|
315
|
-
error: ZodError<Input>;
|
|
316
|
-
};
|
|
317
|
-
declare type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
|
|
318
|
-
declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
319
|
-
readonly _type: Output;
|
|
320
|
-
readonly _output: Output;
|
|
321
|
-
readonly _input: Input;
|
|
322
|
-
readonly _def: Def;
|
|
323
|
-
get description(): string | undefined;
|
|
324
|
-
abstract _parse(input: ParseInput): ParseReturnType<Output>;
|
|
325
|
-
_getType(input: ParseInput): string;
|
|
326
|
-
_getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
|
|
327
|
-
_processInputParams(input: ParseInput): {
|
|
328
|
-
status: ParseStatus;
|
|
329
|
-
ctx: ParseContext;
|
|
330
|
-
};
|
|
331
|
-
_parseSync(input: ParseInput): SyncParseReturnType<Output>;
|
|
332
|
-
_parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
|
|
333
|
-
parse(data: unknown, params?: Partial<ParseParams>): Output;
|
|
334
|
-
safeParse(data: unknown, params?: Partial<ParseParams>): SafeParseReturnType<Input, Output>;
|
|
335
|
-
parseAsync(data: unknown, params?: Partial<ParseParams>): Promise<Output>;
|
|
336
|
-
safeParseAsync(data: unknown, params?: Partial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
337
|
-
/** Alias of safeParseAsync */
|
|
338
|
-
spa: (data: unknown, params?: Partial<ParseParams> | undefined) => Promise<SafeParseReturnType<Input, Output>>;
|
|
339
|
-
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
|
|
340
|
-
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
|
|
341
|
-
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
|
|
342
|
-
refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
|
|
343
|
-
_refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
|
|
344
|
-
superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
|
|
345
|
-
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
|
|
346
|
-
constructor(def: Def);
|
|
347
|
-
optional(): ZodOptional<this>;
|
|
348
|
-
nullable(): ZodNullable<this>;
|
|
349
|
-
nullish(): ZodOptional<ZodNullable<this>>;
|
|
350
|
-
array(): ZodArray<this>;
|
|
351
|
-
promise(): ZodPromise<this>;
|
|
352
|
-
or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>;
|
|
353
|
-
and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
|
|
354
|
-
transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
|
|
355
|
-
default(def: util.noUndefined<Input>): ZodDefault<this>;
|
|
356
|
-
default(def: () => util.noUndefined<Input>): ZodDefault<this>;
|
|
357
|
-
brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
|
|
358
|
-
catch(def: Output): ZodCatch<this>;
|
|
359
|
-
catch(def: () => Output): ZodCatch<this>;
|
|
360
|
-
describe(description: string): this;
|
|
361
|
-
pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
|
|
362
|
-
isOptional(): boolean;
|
|
363
|
-
isNullable(): boolean;
|
|
364
|
-
}
|
|
365
|
-
declare type ZodStringCheck = {
|
|
366
|
-
kind: "min";
|
|
367
|
-
value: number;
|
|
368
|
-
message?: string;
|
|
369
|
-
} | {
|
|
370
|
-
kind: "max";
|
|
371
|
-
value: number;
|
|
372
|
-
message?: string;
|
|
373
|
-
} | {
|
|
374
|
-
kind: "length";
|
|
375
|
-
value: number;
|
|
376
|
-
message?: string;
|
|
377
|
-
} | {
|
|
378
|
-
kind: "email";
|
|
379
|
-
message?: string;
|
|
380
|
-
} | {
|
|
381
|
-
kind: "url";
|
|
382
|
-
message?: string;
|
|
383
|
-
} | {
|
|
384
|
-
kind: "uuid";
|
|
385
|
-
message?: string;
|
|
386
|
-
} | {
|
|
387
|
-
kind: "cuid";
|
|
388
|
-
message?: string;
|
|
389
|
-
} | {
|
|
390
|
-
kind: "cuid2";
|
|
391
|
-
message?: string;
|
|
392
|
-
} | {
|
|
393
|
-
kind: "startsWith";
|
|
394
|
-
value: string;
|
|
395
|
-
message?: string;
|
|
396
|
-
} | {
|
|
397
|
-
kind: "endsWith";
|
|
398
|
-
value: string;
|
|
399
|
-
message?: string;
|
|
400
|
-
} | {
|
|
401
|
-
kind: "regex";
|
|
402
|
-
regex: RegExp;
|
|
403
|
-
message?: string;
|
|
404
|
-
} | {
|
|
405
|
-
kind: "trim";
|
|
406
|
-
message?: string;
|
|
407
|
-
} | {
|
|
408
|
-
kind: "datetime";
|
|
409
|
-
offset: boolean;
|
|
410
|
-
precision: number | null;
|
|
411
|
-
message?: string;
|
|
412
|
-
};
|
|
413
|
-
interface ZodStringDef extends ZodTypeDef {
|
|
414
|
-
checks: ZodStringCheck[];
|
|
415
|
-
typeName: ZodFirstPartyTypeKind.ZodString;
|
|
416
|
-
coerce: boolean;
|
|
417
|
-
}
|
|
418
|
-
declare class ZodString extends ZodType<string, ZodStringDef> {
|
|
419
|
-
_parse(input: ParseInput): ParseReturnType<string>;
|
|
420
|
-
protected _regex: (regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage | undefined) => ZodEffects<this, string, string>;
|
|
421
|
-
_addCheck(check: ZodStringCheck): ZodString;
|
|
422
|
-
email(message?: errorUtil.ErrMessage): ZodString;
|
|
423
|
-
url(message?: errorUtil.ErrMessage): ZodString;
|
|
424
|
-
uuid(message?: errorUtil.ErrMessage): ZodString;
|
|
425
|
-
cuid(message?: errorUtil.ErrMessage): ZodString;
|
|
426
|
-
cuid2(message?: errorUtil.ErrMessage): ZodString;
|
|
427
|
-
datetime(options?: string | {
|
|
428
|
-
message?: string | undefined;
|
|
429
|
-
precision?: number | null;
|
|
430
|
-
offset?: boolean;
|
|
431
|
-
}): ZodString;
|
|
432
|
-
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
|
|
433
|
-
startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
434
|
-
endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
435
|
-
min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
436
|
-
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
437
|
-
length(len: number, message?: errorUtil.ErrMessage): ZodString;
|
|
438
|
-
/**
|
|
439
|
-
* @deprecated Use z.string().min(1) instead.
|
|
440
|
-
* @see {@link ZodString.min}
|
|
441
|
-
*/
|
|
442
|
-
nonempty: (message?: errorUtil.ErrMessage | undefined) => ZodString;
|
|
443
|
-
trim: () => ZodString;
|
|
444
|
-
get isDatetime(): boolean;
|
|
445
|
-
get isEmail(): boolean;
|
|
446
|
-
get isURL(): boolean;
|
|
447
|
-
get isUUID(): boolean;
|
|
448
|
-
get isCUID(): boolean;
|
|
449
|
-
get isCUID2(): boolean;
|
|
450
|
-
get minLength(): number | null;
|
|
451
|
-
get maxLength(): number | null;
|
|
452
|
-
static create: (params?: ({
|
|
453
|
-
errorMap?: ZodErrorMap | undefined;
|
|
454
|
-
invalid_type_error?: string | undefined;
|
|
455
|
-
required_error?: string | undefined;
|
|
456
|
-
description?: string | undefined;
|
|
457
|
-
} & {
|
|
458
|
-
coerce?: true | undefined;
|
|
459
|
-
}) | undefined) => ZodString;
|
|
460
|
-
}
|
|
461
|
-
declare type ZodNumberCheck = {
|
|
462
|
-
kind: "min";
|
|
463
|
-
value: number;
|
|
464
|
-
inclusive: boolean;
|
|
465
|
-
message?: string;
|
|
466
|
-
} | {
|
|
467
|
-
kind: "max";
|
|
468
|
-
value: number;
|
|
469
|
-
inclusive: boolean;
|
|
470
|
-
message?: string;
|
|
471
|
-
} | {
|
|
472
|
-
kind: "int";
|
|
473
|
-
message?: string;
|
|
474
|
-
} | {
|
|
475
|
-
kind: "multipleOf";
|
|
476
|
-
value: number;
|
|
477
|
-
message?: string;
|
|
478
|
-
} | {
|
|
479
|
-
kind: "finite";
|
|
480
|
-
message?: string;
|
|
481
|
-
};
|
|
482
|
-
interface ZodNumberDef extends ZodTypeDef {
|
|
483
|
-
checks: ZodNumberCheck[];
|
|
484
|
-
typeName: ZodFirstPartyTypeKind.ZodNumber;
|
|
485
|
-
coerce: boolean;
|
|
486
|
-
}
|
|
487
|
-
declare class ZodNumber extends ZodType<number, ZodNumberDef> {
|
|
488
|
-
_parse(input: ParseInput): ParseReturnType<number>;
|
|
489
|
-
static create: (params?: ({
|
|
490
|
-
errorMap?: ZodErrorMap | undefined;
|
|
491
|
-
invalid_type_error?: string | undefined;
|
|
492
|
-
required_error?: string | undefined;
|
|
493
|
-
description?: string | undefined;
|
|
494
|
-
} & {
|
|
495
|
-
coerce?: boolean | undefined;
|
|
496
|
-
}) | undefined) => ZodNumber;
|
|
497
|
-
gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
498
|
-
min: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
499
|
-
gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
500
|
-
lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
501
|
-
max: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
502
|
-
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
503
|
-
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
|
|
504
|
-
_addCheck(check: ZodNumberCheck): ZodNumber;
|
|
505
|
-
int(message?: errorUtil.ErrMessage): ZodNumber;
|
|
506
|
-
positive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
507
|
-
negative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
508
|
-
nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
509
|
-
nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
510
|
-
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
511
|
-
finite(message?: errorUtil.ErrMessage): ZodNumber;
|
|
512
|
-
step: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
513
|
-
get minValue(): number | null;
|
|
514
|
-
get maxValue(): number | null;
|
|
515
|
-
get isInt(): boolean;
|
|
516
|
-
get isFinite(): boolean;
|
|
517
|
-
}
|
|
518
|
-
interface ZodBooleanDef extends ZodTypeDef {
|
|
519
|
-
typeName: ZodFirstPartyTypeKind.ZodBoolean;
|
|
520
|
-
coerce: boolean;
|
|
521
|
-
}
|
|
522
|
-
declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef> {
|
|
523
|
-
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
524
|
-
static create: (params?: ({
|
|
525
|
-
errorMap?: ZodErrorMap | undefined;
|
|
526
|
-
invalid_type_error?: string | undefined;
|
|
527
|
-
required_error?: string | undefined;
|
|
528
|
-
description?: string | undefined;
|
|
529
|
-
} & {
|
|
530
|
-
coerce?: boolean | undefined;
|
|
531
|
-
}) | undefined) => ZodBoolean;
|
|
532
|
-
}
|
|
533
|
-
interface ZodAnyDef extends ZodTypeDef {
|
|
534
|
-
typeName: ZodFirstPartyTypeKind.ZodAny;
|
|
535
|
-
}
|
|
536
|
-
declare class ZodAny extends ZodType<any, ZodAnyDef> {
|
|
537
|
-
_any: true;
|
|
538
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
539
|
-
static create: (params?: RawCreateParams) => ZodAny;
|
|
540
|
-
}
|
|
541
|
-
interface ZodUnknownDef extends ZodTypeDef {
|
|
542
|
-
typeName: ZodFirstPartyTypeKind.ZodUnknown;
|
|
543
|
-
}
|
|
544
|
-
declare class ZodUnknown extends ZodType<unknown, ZodUnknownDef> {
|
|
545
|
-
_unknown: true;
|
|
546
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
547
|
-
static create: (params?: RawCreateParams) => ZodUnknown;
|
|
548
|
-
}
|
|
549
|
-
interface ZodVoidDef extends ZodTypeDef {
|
|
550
|
-
typeName: ZodFirstPartyTypeKind.ZodVoid;
|
|
551
|
-
}
|
|
552
|
-
declare class ZodVoid extends ZodType<void, ZodVoidDef> {
|
|
553
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
554
|
-
static create: (params?: RawCreateParams) => ZodVoid;
|
|
555
|
-
}
|
|
556
|
-
interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
557
|
-
type: T;
|
|
558
|
-
typeName: ZodFirstPartyTypeKind.ZodArray;
|
|
559
|
-
exactLength: {
|
|
560
|
-
value: number;
|
|
561
|
-
message?: string;
|
|
562
|
-
} | null;
|
|
563
|
-
minLength: {
|
|
564
|
-
value: number;
|
|
565
|
-
message?: string;
|
|
566
|
-
} | null;
|
|
567
|
-
maxLength: {
|
|
568
|
-
value: number;
|
|
569
|
-
message?: string;
|
|
570
|
-
} | null;
|
|
571
|
-
}
|
|
572
|
-
declare type ArrayCardinality = "many" | "atleastone";
|
|
573
|
-
declare type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
|
|
574
|
-
declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> {
|
|
575
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
576
|
-
get element(): T;
|
|
577
|
-
min(minLength: number, message?: errorUtil.ErrMessage): this;
|
|
578
|
-
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
579
|
-
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
580
|
-
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
581
|
-
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1, "many">;
|
|
582
|
-
}
|
|
583
|
-
declare namespace objectUtil {
|
|
584
|
-
export type MergeShapes<U extends ZodRawShape, V extends ZodRawShape> = {
|
|
585
|
-
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
586
|
-
} & V;
|
|
587
|
-
type optionalKeys<T extends object> = {
|
|
588
|
-
[k in keyof T]: undefined extends T[k] ? k : never;
|
|
589
|
-
}[keyof T];
|
|
590
|
-
type requiredKeys<T extends object> = {
|
|
591
|
-
[k in keyof T]: undefined extends T[k] ? never : k;
|
|
592
|
-
}[keyof T];
|
|
593
|
-
export type addQuestionMarks<T extends object> = Partial<Pick<T, optionalKeys<T>>> & Pick<T, requiredKeys<T>>;
|
|
594
|
-
export type identity<T> = T;
|
|
595
|
-
export type flatten<T extends object> = identity<{
|
|
596
|
-
[k in keyof T]: T[k];
|
|
597
|
-
}>;
|
|
598
|
-
export type noNeverKeys<T extends ZodRawShape> = {
|
|
599
|
-
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
|
600
|
-
}[keyof T];
|
|
601
|
-
export type noNever<T extends ZodRawShape> = identity<{
|
|
602
|
-
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
603
|
-
}>;
|
|
604
|
-
export const mergeShapes: <U extends ZodRawShape, T extends ZodRawShape>(first: U, second: T) => T & U;
|
|
605
|
-
export {};
|
|
606
|
-
}
|
|
607
|
-
declare type extendShape<A, B> = util.flatten<Omit<A, keyof B> & B>;
|
|
608
|
-
declare type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
609
|
-
interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
610
|
-
typeName: ZodFirstPartyTypeKind.ZodObject;
|
|
611
|
-
shape: () => T;
|
|
612
|
-
catchall: Catchall;
|
|
613
|
-
unknownKeys: UnknownKeys;
|
|
614
|
-
}
|
|
615
|
-
declare type baseObjectOutputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
|
|
616
|
-
[k in keyof Shape]: Shape[k]["_output"];
|
|
617
|
-
}>;
|
|
618
|
-
declare type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = ZodTypeAny extends Catchall ? objectUtil.flatten<baseObjectOutputType<Shape>> : objectUtil.flatten<baseObjectOutputType<Shape> & {
|
|
619
|
-
[k: string]: Catchall["_output"];
|
|
620
|
-
}>;
|
|
621
|
-
declare type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.flatten<objectUtil.addQuestionMarks<{
|
|
622
|
-
[k in keyof Shape]: Shape[k]["_input"];
|
|
623
|
-
}>>;
|
|
624
|
-
declare type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = ZodTypeAny extends Catchall ? baseObjectInputType<Shape> : objectUtil.flatten<baseObjectInputType<Shape> & {
|
|
625
|
-
[k: string]: Catchall["_input"];
|
|
626
|
-
}>;
|
|
627
|
-
declare type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
|
|
628
|
-
declare type objectKeyMask<Obj> = {
|
|
629
|
-
[k in keyof Obj]?: true;
|
|
630
|
-
};
|
|
631
|
-
declare type noUnrecognized<Obj extends object, Shape extends object> = {
|
|
632
|
-
[k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;
|
|
633
|
-
};
|
|
634
|
-
declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall>, Input = objectInputType<T, Catchall>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {
|
|
635
|
-
private _cached;
|
|
636
|
-
_getCached(): {
|
|
637
|
-
shape: T;
|
|
638
|
-
keys: string[];
|
|
639
|
-
};
|
|
640
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
641
|
-
get shape(): T;
|
|
642
|
-
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
|
|
643
|
-
strip(): ZodObject<T, "strip", Catchall>;
|
|
644
|
-
passthrough(): ZodObject<T, "passthrough", Catchall>;
|
|
645
|
-
/**
|
|
646
|
-
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
|
|
647
|
-
* If you want to pass through unknown properties, use `.passthrough()` instead.
|
|
648
|
-
*/
|
|
649
|
-
nonstrict: () => ZodObject<T, "passthrough", Catchall>;
|
|
650
|
-
extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
651
|
-
/**
|
|
652
|
-
* @deprecated Use `.extend` instead
|
|
653
|
-
* */
|
|
654
|
-
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, UnknownKeys, Catchall, objectOutputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall>, objectInputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall>>;
|
|
655
|
-
/**
|
|
656
|
-
* Prior to zod@1.0.12 there was a bug in the
|
|
657
|
-
* inferred type of merged objects. Please
|
|
658
|
-
* upgrade if you are experiencing issues.
|
|
659
|
-
*/
|
|
660
|
-
merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
|
|
661
|
-
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
|
|
662
|
-
[k in Key]: Schema;
|
|
663
|
-
}, UnknownKeys, Catchall>;
|
|
664
|
-
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
|
|
665
|
-
pick<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, T>): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
|
|
666
|
-
omit<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, objectKeyMask<T>>): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
|
|
667
|
-
deepPartial(): partialUtil.DeepPartial<this>;
|
|
668
|
-
partial(): ZodObject<{
|
|
669
|
-
[k in keyof T]: ZodOptional<T[k]>;
|
|
670
|
-
}, UnknownKeys, Catchall>;
|
|
671
|
-
partial<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, objectKeyMask<T>>): ZodObject<objectUtil.noNever<{
|
|
672
|
-
[k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k];
|
|
673
|
-
}>, UnknownKeys, Catchall>;
|
|
674
|
-
required(): ZodObject<{
|
|
675
|
-
[k in keyof T]: deoptional<T[k]>;
|
|
676
|
-
}, UnknownKeys, Catchall>;
|
|
677
|
-
required<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, objectKeyMask<T>>): ZodObject<objectUtil.noNever<{
|
|
678
|
-
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
679
|
-
}>, UnknownKeys, Catchall>;
|
|
680
|
-
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
681
|
-
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k in keyof baseObjectOutputType<T_1>]: baseObjectOutputType<T_1>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>;
|
|
682
|
-
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, { [k in keyof baseObjectOutputType<T_1>]: baseObjectOutputType<T_1>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>;
|
|
683
|
-
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k in keyof baseObjectOutputType<T_1>]: baseObjectOutputType<T_1>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>;
|
|
684
|
-
}
|
|
685
|
-
declare type AnyZodObject = ZodObject<any, any, any>;
|
|
686
|
-
declare type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
687
|
-
interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[
|
|
688
|
-
ZodTypeAny,
|
|
689
|
-
ZodTypeAny,
|
|
690
|
-
...ZodTypeAny[]
|
|
691
|
-
]>> extends ZodTypeDef {
|
|
692
|
-
options: T;
|
|
693
|
-
typeName: ZodFirstPartyTypeKind.ZodUnion;
|
|
694
|
-
}
|
|
695
|
-
declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
|
|
696
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
697
|
-
get options(): T;
|
|
698
|
-
static create: <T_1 extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T_1, params?: RawCreateParams) => ZodUnion<T_1>;
|
|
699
|
-
}
|
|
700
|
-
interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
701
|
-
left: T;
|
|
702
|
-
right: U;
|
|
703
|
-
typeName: ZodFirstPartyTypeKind.ZodIntersection;
|
|
704
|
-
}
|
|
705
|
-
declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
706
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
707
|
-
static create: <T_1 extends ZodTypeAny, U_1 extends ZodTypeAny>(left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
|
|
708
|
-
}
|
|
709
|
-
declare type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
710
|
-
declare type AssertArray<T> = T extends any[] ? T : never;
|
|
711
|
-
declare type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
712
|
-
[k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_output"] : never;
|
|
713
|
-
}>;
|
|
714
|
-
declare type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
|
|
715
|
-
declare type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
716
|
-
[k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_input"] : never;
|
|
717
|
-
}>;
|
|
718
|
-
declare type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
|
|
719
|
-
interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
|
|
720
|
-
items: T;
|
|
721
|
-
rest: Rest;
|
|
722
|
-
typeName: ZodFirstPartyTypeKind.ZodTuple;
|
|
723
|
-
}
|
|
724
|
-
declare type AnyZodTuple = ZodTuple<[
|
|
725
|
-
ZodTypeAny,
|
|
726
|
-
...ZodTypeAny[]
|
|
727
|
-
] | [], ZodTypeAny | null>;
|
|
728
|
-
declare class ZodTuple<T extends [ZodTypeAny, ...ZodTypeAny[]] | [] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
|
|
729
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
730
|
-
get items(): T;
|
|
731
|
-
rest<Rest extends ZodTypeAny>(rest: Rest): ZodTuple<T, Rest>;
|
|
732
|
-
static create: <T_1 extends [] | [ZodTypeAny, ...ZodTypeAny[]]>(schemas: T_1, params?: RawCreateParams) => ZodTuple<T_1, null>;
|
|
733
|
-
}
|
|
734
|
-
interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
735
|
-
valueType: Value;
|
|
736
|
-
keyType: Key;
|
|
737
|
-
typeName: ZodFirstPartyTypeKind.ZodRecord;
|
|
738
|
-
}
|
|
739
|
-
declare type KeySchema = ZodType<string | number | symbol, any, any>;
|
|
740
|
-
declare type RecordType<K extends string | number | symbol, V> = [
|
|
741
|
-
string
|
|
742
|
-
] extends [K] ? Record<K, V> : [number] extends [K] ? Record<K, V> : [symbol] extends [K] ? Record<K, V> : Partial<Record<K, V>>;
|
|
743
|
-
declare class ZodRecord<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodType<RecordType<Key["_output"], Value["_output"]>, ZodRecordDef<Key, Value>, RecordType<Key["_input"], Value["_input"]>> {
|
|
744
|
-
get keySchema(): Key;
|
|
745
|
-
get valueSchema(): Value;
|
|
746
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
747
|
-
get element(): Value;
|
|
748
|
-
static create<Value extends ZodTypeAny>(valueType: Value, params?: RawCreateParams): ZodRecord<ZodString, Value>;
|
|
749
|
-
static create<Keys extends KeySchema, Value extends ZodTypeAny>(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord<Keys, Value>;
|
|
750
|
-
}
|
|
751
|
-
interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
752
|
-
args: Args;
|
|
753
|
-
returns: Returns;
|
|
754
|
-
typeName: ZodFirstPartyTypeKind.ZodFunction;
|
|
755
|
-
}
|
|
756
|
-
declare type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
|
|
757
|
-
declare type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
|
|
758
|
-
declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
|
|
759
|
-
_parse(input: ParseInput): ParseReturnType<any>;
|
|
760
|
-
parameters(): Args;
|
|
761
|
-
returnType(): Returns;
|
|
762
|
-
args<Items extends Parameters<typeof ZodTuple["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
|
|
763
|
-
returns<NewReturnType extends ZodType<any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>;
|
|
764
|
-
implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
765
|
-
strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
|
|
766
|
-
validate: <F extends InnerTypeOfFunction<Args, Returns>>(func: F) => ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
767
|
-
static create(): ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>;
|
|
768
|
-
static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>>(args: T): ZodFunction<T, ZodUnknown>;
|
|
769
|
-
static create<T extends AnyZodTuple, U extends ZodTypeAny>(args: T, returns: U): ZodFunction<T, U>;
|
|
770
|
-
static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: RawCreateParams): ZodFunction<T, U>;
|
|
771
|
-
}
|
|
772
|
-
declare type EnumValues = [string, ...string[]];
|
|
773
|
-
declare type Values<T extends EnumValues> = {
|
|
774
|
-
[k in T[number]]: k;
|
|
775
|
-
};
|
|
776
|
-
interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
|
|
777
|
-
values: T;
|
|
778
|
-
typeName: ZodFirstPartyTypeKind.ZodEnum;
|
|
779
|
-
}
|
|
780
|
-
declare type Writeable<T> = {
|
|
781
|
-
-readonly [P in keyof T]: T[P];
|
|
782
|
-
};
|
|
783
|
-
declare type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
|
|
784
|
-
declare type typecast<A, T> = A extends T ? A : never;
|
|
785
|
-
declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
|
|
786
|
-
declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>;
|
|
787
|
-
declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>> {
|
|
788
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
789
|
-
get options(): T;
|
|
790
|
-
get enum(): Values<T>;
|
|
791
|
-
get Values(): Values<T>;
|
|
792
|
-
get Enum(): Values<T>;
|
|
793
|
-
extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract): ZodEnum<Writeable<ToExtract>>;
|
|
794
|
-
exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
|
|
795
|
-
static create: typeof createZodEnum;
|
|
796
|
-
}
|
|
797
|
-
interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
798
|
-
type: T;
|
|
799
|
-
typeName: ZodFirstPartyTypeKind.ZodPromise;
|
|
800
|
-
}
|
|
801
|
-
declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
802
|
-
unwrap(): T;
|
|
803
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
804
|
-
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
|
|
805
|
-
}
|
|
806
|
-
declare type RefinementEffect<T> = {
|
|
807
|
-
type: "refinement";
|
|
808
|
-
refinement: (arg: T, ctx: RefinementCtx) => any;
|
|
809
|
-
};
|
|
810
|
-
declare type TransformEffect<T> = {
|
|
811
|
-
type: "transform";
|
|
812
|
-
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
813
|
-
};
|
|
814
|
-
declare type PreprocessEffect<T> = {
|
|
815
|
-
type: "preprocess";
|
|
816
|
-
transform: (arg: T) => any;
|
|
817
|
-
};
|
|
818
|
-
declare type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
819
|
-
interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
820
|
-
schema: T;
|
|
821
|
-
typeName: ZodFirstPartyTypeKind.ZodEffects;
|
|
822
|
-
effect: Effect<any>;
|
|
823
|
-
}
|
|
824
|
-
declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
|
|
825
|
-
innerType(): T;
|
|
826
|
-
sourceType(): T;
|
|
827
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
828
|
-
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], input<I>>;
|
|
829
|
-
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
833
|
-
innerType: T;
|
|
834
|
-
typeName: ZodFirstPartyTypeKind.ZodOptional;
|
|
835
|
-
}
|
|
836
|
-
declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
837
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
838
|
-
unwrap(): T;
|
|
839
|
-
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodOptional<T_1>;
|
|
840
|
-
}
|
|
841
|
-
interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
842
|
-
innerType: T;
|
|
843
|
-
typeName: ZodFirstPartyTypeKind.ZodNullable;
|
|
844
|
-
}
|
|
845
|
-
declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
846
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
847
|
-
unwrap(): T;
|
|
848
|
-
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodNullable<T_1>;
|
|
849
|
-
}
|
|
850
|
-
interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
851
|
-
innerType: T;
|
|
852
|
-
defaultValue: () => util.noUndefined<T["_input"]>;
|
|
853
|
-
typeName: ZodFirstPartyTypeKind.ZodDefault;
|
|
854
|
-
}
|
|
855
|
-
declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
856
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
857
|
-
removeDefault(): T;
|
|
858
|
-
static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
|
|
859
|
-
errorMap?: ZodErrorMap | undefined;
|
|
860
|
-
invalid_type_error?: string | undefined;
|
|
861
|
-
required_error?: string | undefined;
|
|
862
|
-
description?: string | undefined;
|
|
863
|
-
} & {
|
|
864
|
-
default: T_1["_input"] | (() => util.noUndefined<T_1["_input"]>);
|
|
865
|
-
}) => ZodDefault<T_1>;
|
|
866
|
-
}
|
|
867
|
-
interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny, C extends T["_input"] = T["_input"]> extends ZodTypeDef {
|
|
868
|
-
innerType: T;
|
|
869
|
-
catchValue: () => C;
|
|
870
|
-
typeName: ZodFirstPartyTypeKind.ZodCatch;
|
|
871
|
-
}
|
|
872
|
-
declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
|
|
873
|
-
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
874
|
-
removeCatch(): T;
|
|
875
|
-
static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
|
|
876
|
-
errorMap?: ZodErrorMap | undefined;
|
|
877
|
-
invalid_type_error?: string | undefined;
|
|
878
|
-
required_error?: string | undefined;
|
|
879
|
-
description?: string | undefined;
|
|
880
|
-
} & {
|
|
881
|
-
catch: T_1["_output"] | (() => T_1["_output"]);
|
|
882
|
-
}) => ZodCatch<T_1>;
|
|
883
|
-
}
|
|
884
|
-
interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
|
|
885
|
-
type: T;
|
|
886
|
-
typeName: ZodFirstPartyTypeKind.ZodBranded;
|
|
887
|
-
}
|
|
888
|
-
declare const BRAND: unique symbol;
|
|
889
|
-
declare type BRAND<T extends string | number | symbol> = {
|
|
890
|
-
[BRAND]: {
|
|
891
|
-
[k in T]: true;
|
|
892
|
-
};
|
|
893
|
-
};
|
|
894
|
-
declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
|
|
895
|
-
_parse(input: ParseInput): ParseReturnType<any>;
|
|
896
|
-
unwrap(): T;
|
|
897
|
-
}
|
|
898
|
-
interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
|
|
899
|
-
in: A;
|
|
900
|
-
out: B;
|
|
901
|
-
typeName: ZodFirstPartyTypeKind.ZodPipeline;
|
|
902
|
-
}
|
|
903
|
-
declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
|
|
904
|
-
_parse(input: ParseInput): ParseReturnType<any>;
|
|
905
|
-
static create<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
|
|
906
|
-
}
|
|
907
|
-
declare enum ZodFirstPartyTypeKind {
|
|
908
|
-
ZodString = "ZodString",
|
|
909
|
-
ZodNumber = "ZodNumber",
|
|
910
|
-
ZodNaN = "ZodNaN",
|
|
911
|
-
ZodBigInt = "ZodBigInt",
|
|
912
|
-
ZodBoolean = "ZodBoolean",
|
|
913
|
-
ZodDate = "ZodDate",
|
|
914
|
-
ZodSymbol = "ZodSymbol",
|
|
915
|
-
ZodUndefined = "ZodUndefined",
|
|
916
|
-
ZodNull = "ZodNull",
|
|
917
|
-
ZodAny = "ZodAny",
|
|
918
|
-
ZodUnknown = "ZodUnknown",
|
|
919
|
-
ZodNever = "ZodNever",
|
|
920
|
-
ZodVoid = "ZodVoid",
|
|
921
|
-
ZodArray = "ZodArray",
|
|
922
|
-
ZodObject = "ZodObject",
|
|
923
|
-
ZodUnion = "ZodUnion",
|
|
924
|
-
ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
|
|
925
|
-
ZodIntersection = "ZodIntersection",
|
|
926
|
-
ZodTuple = "ZodTuple",
|
|
927
|
-
ZodRecord = "ZodRecord",
|
|
928
|
-
ZodMap = "ZodMap",
|
|
929
|
-
ZodSet = "ZodSet",
|
|
930
|
-
ZodFunction = "ZodFunction",
|
|
931
|
-
ZodLazy = "ZodLazy",
|
|
932
|
-
ZodLiteral = "ZodLiteral",
|
|
933
|
-
ZodEnum = "ZodEnum",
|
|
934
|
-
ZodEffects = "ZodEffects",
|
|
935
|
-
ZodNativeEnum = "ZodNativeEnum",
|
|
936
|
-
ZodOptional = "ZodOptional",
|
|
937
|
-
ZodNullable = "ZodNullable",
|
|
938
|
-
ZodDefault = "ZodDefault",
|
|
939
|
-
ZodCatch = "ZodCatch",
|
|
940
|
-
ZodPromise = "ZodPromise",
|
|
941
|
-
ZodBranded = "ZodBranded",
|
|
942
|
-
ZodPipeline = "ZodPipeline"
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
declare const eventTypeType: ZodEnum<["APP_INITIALIZING", "APP_READY"]>;
|
|
946
|
-
declare const payloadType: ZodAny;
|
|
947
|
-
declare function logEvent(eventType: TypeOf<typeof eventTypeType>, payload: TypeOf<typeof payloadType>): void;
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* @typedef {"none" | "wifi" | "cellular" | "unknown"} NetworkType
|
|
951
|
-
*/
|
|
952
|
-
declare enum NetworkType {
|
|
953
|
-
/** No Network */
|
|
954
|
-
none = "none",
|
|
955
|
-
/** Wi-Fi Network */
|
|
956
|
-
wifi = "wifi",
|
|
957
|
-
/** Cellular Network (2g/3g/4g) */
|
|
958
|
-
cellular = "cellular",
|
|
959
|
-
/** Uncommon network types for Android */
|
|
960
|
-
unknown = "unknown"
|
|
961
|
-
}
|
|
962
|
-
declare enum PlatformType {
|
|
963
|
-
/** Windows phone */
|
|
964
|
-
wp = "wp",
|
|
965
|
-
/** Android */
|
|
966
|
-
android = "android",
|
|
967
|
-
/** iOS */
|
|
968
|
-
iOS = "iOS",
|
|
969
|
-
unknown = "unknown"
|
|
970
|
-
}
|
|
971
|
-
declare enum Events {
|
|
972
|
-
AppPaused = "h5.event.paused",
|
|
973
|
-
AppResumed = "h5.event.resumed",
|
|
974
|
-
NetworkChanged = "h5.event.connection.changed",
|
|
975
|
-
OnDataCallback = "h5.event.webview.result",
|
|
976
|
-
WebviewClosed = "h5.event.webview.close",
|
|
977
|
-
OpenApp = "h5.event.open.mp",
|
|
978
|
-
AppClose = "h5.event.action.close",
|
|
979
|
-
PaymentCallback = "payment.callback",
|
|
980
|
-
PaymentResult = "action.payment.result",
|
|
981
|
-
/** Người dùng đã hoàn thành quy trình thanh toán ở CheckoutSDK
|
|
982
|
-
* * Lưu ý: Event sẽ được gửi khi người dùng hoàn tất hoặc hủy quy trình thanh toán.
|
|
983
|
-
* * Đối tác cần sử dụng API checkTransaction để kiểm tra trạng thái thanh toán mới nhất.
|
|
984
|
-
*
|
|
985
|
-
* @link https://mini.zalo.me/documents/checkout-sdk/integration-process/overview/receive-transaction-ma/
|
|
986
|
-
* */
|
|
987
|
-
PaymentDone = "action.payment.done",
|
|
988
|
-
PaymentClose = "action.payment.close",
|
|
989
|
-
DownloadProgress = "h5.event.webview.download.progress"
|
|
990
|
-
}
|
|
991
|
-
declare enum JumpStatus {
|
|
992
|
-
DOING = "doing",
|
|
993
|
-
DONE = "done"
|
|
994
|
-
}
|
|
995
|
-
declare enum ProfileType {
|
|
996
|
-
user = 1,
|
|
997
|
-
oa = 0,
|
|
998
|
-
aliasOA = 2
|
|
999
|
-
}
|
|
1000
|
-
declare enum ChatType {
|
|
1001
|
-
user = 1,
|
|
1002
|
-
oa = 0
|
|
1003
|
-
}
|
|
1004
|
-
declare enum PostFeedType {
|
|
1005
|
-
image = 1,
|
|
1006
|
-
multi_image = 2,
|
|
1007
|
-
link = 4,
|
|
1008
|
-
profile = 5
|
|
1009
|
-
}
|
|
1010
|
-
declare enum ScanNFCType {
|
|
1011
|
-
cccd = 1
|
|
1012
|
-
}
|
|
1013
|
-
declare enum ShareSheetType {
|
|
1014
|
-
image = 1,
|
|
1015
|
-
gif = 11,
|
|
1016
|
-
video = 12,
|
|
1017
|
-
link = 4,
|
|
1018
|
-
oa = 5,
|
|
1019
|
-
zmp = 20,
|
|
1020
|
-
multi_image = 21,
|
|
1021
|
-
zmp_deep_link = 4,
|
|
1022
|
-
text = 22
|
|
1023
|
-
}
|
|
1024
|
-
declare enum OrientationType {
|
|
1025
|
-
auto = 1,
|
|
1026
|
-
portrait = 2,
|
|
1027
|
-
landscape = 3
|
|
1028
|
-
}
|
|
1029
|
-
declare enum VibrateType {
|
|
1030
|
-
oneShot = 0
|
|
1031
|
-
}
|
|
1032
|
-
declare enum MediaPickerType {
|
|
1033
|
-
zcamera = 3,
|
|
1034
|
-
zcamera_photo = 1,
|
|
1035
|
-
zcamera_video = 2,
|
|
1036
|
-
zcamera_scan = 7,
|
|
1037
|
-
photo = 4,
|
|
1038
|
-
video = 5,
|
|
1039
|
-
file = 6
|
|
1040
|
-
}
|
|
1041
|
-
declare enum IAPPayType {
|
|
1042
|
-
"SUBSCRIPTION" = "SUBSCRIPTION",
|
|
1043
|
-
"ONETIME" = "ONETIME"
|
|
1044
|
-
}
|
|
1045
|
-
declare enum ProrationMode {
|
|
1046
|
-
"UNKNOW" = 0,
|
|
1047
|
-
"DEFERRED" = 1,
|
|
1048
|
-
"IMMEDIATE_AND_CHARGE_FULL_PRICE" = 2
|
|
1049
|
-
}
|
|
1050
|
-
declare enum StatusBarType {
|
|
1051
|
-
normal = 1,
|
|
1052
|
-
hidden = 0,
|
|
1053
|
-
transparent = 2
|
|
1054
|
-
}
|
|
1055
|
-
declare enum AndroidBottomNavigationBarType {
|
|
1056
|
-
show = 1,
|
|
1057
|
-
hide = 0
|
|
1058
|
-
}
|
|
1059
|
-
declare enum IOSSafeAreaBottomType {
|
|
1060
|
-
show = 1,
|
|
1061
|
-
hide = 0
|
|
1062
|
-
}
|
|
1063
|
-
declare enum TextAlignType {
|
|
1064
|
-
left = 0,
|
|
1065
|
-
center = 1
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
type PickAttr<Attr extends keyof T, T = any> = {
|
|
1069
|
-
[P in keyof T]: T[Attr];
|
|
1070
|
-
}[keyof T];
|
|
1071
|
-
type Common = Record<string, any>;
|
|
1072
|
-
type FunctionProps = {
|
|
1073
|
-
[key: string]: {
|
|
1074
|
-
lastCall?: number;
|
|
1075
|
-
retry?: number;
|
|
1076
|
-
limit?: number;
|
|
1077
|
-
};
|
|
1078
|
-
};
|
|
1079
|
-
type Action<T> = {
|
|
1080
|
-
[K in keyof T]: {
|
|
1081
|
-
versionLive?: {
|
|
1082
|
-
android?: number;
|
|
1083
|
-
iOS?: number;
|
|
1084
|
-
};
|
|
1085
|
-
appSupport?: boolean;
|
|
1086
|
-
havePermission?: boolean;
|
|
1087
|
-
skipJump?: boolean;
|
|
1088
|
-
requireAccessToken?: boolean;
|
|
1089
|
-
whiteList?: boolean;
|
|
1090
|
-
haveCallback?: boolean;
|
|
1091
|
-
errorList?: {
|
|
1092
|
-
[L in PlatformType]?: {
|
|
1093
|
-
[code: string]: {
|
|
1094
|
-
mapTo: {
|
|
1095
|
-
code: number;
|
|
1096
|
-
message: string;
|
|
1097
|
-
};
|
|
1098
|
-
message?: string;
|
|
1099
|
-
needMoreDetail?: boolean;
|
|
1100
|
-
};
|
|
1101
|
-
};
|
|
1102
|
-
};
|
|
1103
|
-
};
|
|
1104
|
-
};
|
|
1105
|
-
type NativeCallBackData = {
|
|
1106
|
-
error_code: number;
|
|
1107
|
-
error_message: string;
|
|
1108
|
-
action: string;
|
|
1109
|
-
data: any;
|
|
1110
|
-
};
|
|
1111
|
-
type LogData = {
|
|
1112
|
-
action: string;
|
|
1113
|
-
error: number;
|
|
1114
|
-
message: string;
|
|
1115
|
-
data: any;
|
|
1116
|
-
};
|
|
1117
|
-
|
|
1118
|
-
declare const ACTION: {
|
|
1119
|
-
GET_DOWNLOADED_STICKER: {
|
|
1120
|
-
haveCallback: boolean;
|
|
1121
|
-
};
|
|
1122
|
-
OPEN_SHARE_STICKER: {};
|
|
1123
|
-
OPEN_PROFILE: {
|
|
1124
|
-
requireAccessToken: boolean;
|
|
1125
|
-
};
|
|
1126
|
-
OPEN_FEED_DETAIL: {};
|
|
1127
|
-
OPEN_FRIEND_RADA: {};
|
|
1128
|
-
OPEN_INAPP: {};
|
|
1129
|
-
OPEN_OUTAPP: {
|
|
1130
|
-
requireAccessToken: boolean;
|
|
180
|
+
OPEN_FEED_DETAIL: {};
|
|
181
|
+
OPEN_FRIEND_RADA: {};
|
|
182
|
+
OPEN_INAPP: {};
|
|
183
|
+
OPEN_OUTAPP: {
|
|
184
|
+
requireAccessToken: boolean;
|
|
1131
185
|
};
|
|
1132
186
|
OPEN_PAGE: {};
|
|
1133
187
|
OPEN_PHOTODETAIL: {};
|
|
@@ -1944,468 +998,1543 @@ type AsyncCallbackFailObject = {
|
|
|
1944
998
|
api?: string | undefined;
|
|
1945
999
|
[key: string]: any;
|
|
1946
1000
|
};
|
|
1947
|
-
type IAPPayTypeType = "SUBSCRIPTION" | "ONETIME";
|
|
1948
|
-
type IAPMethodType = "IAP" | "IAP_SANDBOX";
|
|
1949
|
-
type ProrationModeType = "UNKNOW" | "DEFERRED" | "IMMEDIATE_AND_CHARGE_FULL_PRICE";
|
|
1950
|
-
type AsyncCallback<T = any> = {
|
|
1951
|
-
action?: keyof typeof ACTION;
|
|
1952
|
-
success?: ((res: T) => void) | undefined;
|
|
1953
|
-
fail?: ((err: AsyncCallbackFailObject) => void) | undefined;
|
|
1001
|
+
type IAPPayTypeType = "SUBSCRIPTION" | "ONETIME";
|
|
1002
|
+
type IAPMethodType = "IAP" | "IAP_SANDBOX";
|
|
1003
|
+
type ProrationModeType = "UNKNOW" | "DEFERRED" | "IMMEDIATE_AND_CHARGE_FULL_PRICE";
|
|
1004
|
+
type AsyncCallback<T = any> = {
|
|
1005
|
+
action?: keyof typeof ACTION;
|
|
1006
|
+
success?: ((res: T) => void) | undefined;
|
|
1007
|
+
fail?: ((err: AsyncCallbackFailObject) => void) | undefined;
|
|
1008
|
+
};
|
|
1009
|
+
type AsyncVoidCallback = {
|
|
1010
|
+
action?: keyof typeof ACTION;
|
|
1011
|
+
success?: () => void;
|
|
1012
|
+
fail?: ((err: AsyncCallbackFailObject) => void) | undefined;
|
|
1013
|
+
};
|
|
1014
|
+
type AsyncProgressCallback = {
|
|
1015
|
+
action?: keyof typeof ACTION;
|
|
1016
|
+
onProgress?: (progress: number) => void;
|
|
1017
|
+
success?: () => void;
|
|
1018
|
+
fail?: ((err: AsyncCallbackFailObject) => void) | undefined;
|
|
1019
|
+
};
|
|
1020
|
+
type GetLocationReturns = {
|
|
1021
|
+
/**
|
|
1022
|
+
* @deprecated
|
|
1023
|
+
*/
|
|
1024
|
+
latitude?: string;
|
|
1025
|
+
/**
|
|
1026
|
+
* @deprecated
|
|
1027
|
+
*/
|
|
1028
|
+
longitude?: string;
|
|
1029
|
+
/**
|
|
1030
|
+
* @deprecated
|
|
1031
|
+
*/
|
|
1032
|
+
timestamp?: string;
|
|
1033
|
+
/**
|
|
1034
|
+
* @deprecated
|
|
1035
|
+
*/
|
|
1036
|
+
provider?: string;
|
|
1037
|
+
/**
|
|
1038
|
+
* Là một chuỗi ký tự dùng để truy xuất thông tin vị trí thông qua server. Mỗi Token được cung cấp, bạn sẽ có thể truy xuất thông tin được 1 lần với thời gian hết hạn sau 2 phút.
|
|
1039
|
+
*
|
|
1040
|
+
* @minimumVersion Zalo App: 23.02.01
|
|
1041
|
+
* @minimumVersion ZMP SDK: 2.29.0
|
|
1042
|
+
*/
|
|
1043
|
+
token?: string;
|
|
1044
|
+
};
|
|
1045
|
+
type CameraParams = {
|
|
1046
|
+
mediaConstraints?: MediaConstraints;
|
|
1047
|
+
canvasElement?: HTMLCanvasElement;
|
|
1048
|
+
videoElement: HTMLVideoElement;
|
|
1049
|
+
};
|
|
1050
|
+
interface SystemInfo {
|
|
1051
|
+
/**
|
|
1052
|
+
* Phiên bản đang được sử dụng của Zalo Mini App này.
|
|
1053
|
+
*/
|
|
1054
|
+
version: string;
|
|
1055
|
+
/**
|
|
1056
|
+
* Phiên bản đang sử dụng của ZMP SDK.
|
|
1057
|
+
*/
|
|
1058
|
+
apiVersion: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* Phiên bản của ứng dụng Zalo trên thiết bị.
|
|
1061
|
+
*/
|
|
1062
|
+
zaloVersion: string;
|
|
1063
|
+
/**
|
|
1064
|
+
* Thông tin hệ điều hành của thiết bị.
|
|
1065
|
+
*/
|
|
1066
|
+
platform: "android" | "iOS" | "wp" | "unknown" | "";
|
|
1067
|
+
/**
|
|
1068
|
+
* Ngôn ngữ hiển thị của thiết bị.
|
|
1069
|
+
*/
|
|
1070
|
+
language: string;
|
|
1071
|
+
/**
|
|
1072
|
+
* Ngôn ngữ hiển thị của ứng dụng Zalo trên thiết bị.
|
|
1073
|
+
* @minimumVersion Zalo iOS: 22.03.01.r2
|
|
1074
|
+
* @minimumVersion Zalo Android: 21.09.01
|
|
1075
|
+
* @minimumVersion ZMP SDK: 2.17.3
|
|
1076
|
+
*/
|
|
1077
|
+
zaloLanguage: string;
|
|
1078
|
+
/**
|
|
1079
|
+
* Theme hiện tại của ứng dụng Zalo trên thiết bị.
|
|
1080
|
+
* @minimumVersion Zalo iOS: 22.03.01.r2
|
|
1081
|
+
* @minimumVersion Zalo Android: 21.09.01
|
|
1082
|
+
* @minimumVersion ZMP SDK: 2.17.3
|
|
1083
|
+
*/
|
|
1084
|
+
zaloTheme: string;
|
|
1085
|
+
}
|
|
1086
|
+
type SetStorageReturns = {
|
|
1087
|
+
errorKeys: string[];
|
|
1088
|
+
};
|
|
1089
|
+
type GetStorageReturns = {
|
|
1090
|
+
[key: string]: any;
|
|
1091
|
+
};
|
|
1092
|
+
type StorageInfo = {
|
|
1093
|
+
/**
|
|
1094
|
+
* Không gian hiện tại bị chiếm (tính bằng KB)
|
|
1095
|
+
* @minimumVersion 2.43.0
|
|
1096
|
+
*/
|
|
1097
|
+
currentSize: number;
|
|
1098
|
+
/**
|
|
1099
|
+
* Giới hạn kích thước không gian (tính bằng KB)
|
|
1100
|
+
* @minimumVersion 2.43.0
|
|
1101
|
+
*/
|
|
1102
|
+
limitSize: number;
|
|
1103
|
+
};
|
|
1104
|
+
type RemoveStorageReturns = {
|
|
1105
|
+
errorKeys: string[];
|
|
1106
|
+
};
|
|
1107
|
+
type UserInfo = {
|
|
1108
|
+
/**
|
|
1109
|
+
* Chuỗi định danh người dùng theo Zalo App. Chuỗi này là duy nhất cho mỗi người dùng trên mỗi Zalo App. Các Mini App cùng chung một Zalo App ID sẽ có thể dùng chuỗi này để định danh người dùng. Có thể sử dụng ID này để gửi thông báo tới người dùng qua OA chung của Zalo Mini App, tham khảo tại [đây](https://mini.zalo.me/documents/open-apis/notifications/send/).
|
|
1110
|
+
*/
|
|
1111
|
+
id: string;
|
|
1112
|
+
/**
|
|
1113
|
+
* Tên hiển thị của người dùng.
|
|
1114
|
+
*/
|
|
1115
|
+
name: string;
|
|
1116
|
+
/**
|
|
1117
|
+
* Ảnh đại diện người dùng.
|
|
1118
|
+
*/
|
|
1119
|
+
avatar: string;
|
|
1120
|
+
/**
|
|
1121
|
+
* Chuỗi định danh người dùng theo Official Account. Có thể sử dụng ID này để gửi tin nhắn cho người dùng (xem [cách gửi tin nhắn với idByOA](https://mini.zalo.me/documents/intro/send-message-oa-to-user/)). Chuỗi có giá trị nếu thỏa 1 trong các điều kiện dưới đây:
|
|
1122
|
+
* - Mini App đã được xác thực bởi Official Account, chi tiết xem [tại đây](https://mini.zalo.me/blog/thong-bao-huong-dan-xac-thuc-mini-app-qua-zalo-oa/#3.b).
|
|
1123
|
+
* - Zalo App phải được liên kết với Official Account và người dùng đã follow Official Account đó.
|
|
1124
|
+
*
|
|
1125
|
+
* @minimumVersion 2.23.3
|
|
1126
|
+
*/
|
|
1127
|
+
idByOA?: string;
|
|
1128
|
+
/**
|
|
1129
|
+
* Trạng thái theo dõi Official Account đã được liên kết với Zalo App.
|
|
1130
|
+
*
|
|
1131
|
+
* @minimumVersion 2.23.3
|
|
1132
|
+
*/
|
|
1133
|
+
followedOA?: boolean;
|
|
1134
|
+
/**
|
|
1135
|
+
* Trả về 1 trong 2 giá trị:
|
|
1136
|
+
* - `true`: tài khoản này thuộc nhóm người dùng cần nhà phát triển Mini App xác minh và áp dụng các cơ chế xử lý dữ liệu phù hợp theo quy định Pháp luật, có thể bao gồm nhưng không giới hạn người đã chết hoặc mất tích, người không biết chữ, người khuyết tật, trẻ em,…
|
|
1137
|
+
* - `false`: tài khoản này thuộc nhóm người dùng bình thường.
|
|
1138
|
+
*
|
|
1139
|
+
* @minimumVersion 2.28.0
|
|
1140
|
+
*/
|
|
1141
|
+
isSensitive?: boolean;
|
|
1142
|
+
};
|
|
1143
|
+
type GetUserInfoReturns = {
|
|
1144
|
+
/**
|
|
1145
|
+
* Thông tin người dùng.
|
|
1146
|
+
*/
|
|
1147
|
+
userInfo: UserInfo;
|
|
1148
|
+
};
|
|
1149
|
+
type GetNetworkTypeReturns = {
|
|
1150
|
+
/**
|
|
1151
|
+
* Kiểu kết nối mạng hiện tại với các giá trị:
|
|
1152
|
+
* - `none`: Không có mạng.
|
|
1153
|
+
* - `wifi`: Mạng Wi-Fi.
|
|
1154
|
+
* - `cellular`: Mạng di động (2g/3g/4g).
|
|
1155
|
+
* - `unknown`: Mạng không xác định (Android).
|
|
1156
|
+
*/
|
|
1157
|
+
networkType: NetworkType;
|
|
1158
|
+
};
|
|
1159
|
+
type iBeaconInfo = {
|
|
1160
|
+
/** The iBeacon device broadcast UUID. */
|
|
1161
|
+
uuid: string;
|
|
1162
|
+
/** The iBeacon device primary ID. */
|
|
1163
|
+
major: string;
|
|
1164
|
+
/** The iBeacon device secondary ID. */
|
|
1165
|
+
minor: string;
|
|
1166
|
+
/** The iBeacon device distance. */
|
|
1167
|
+
distance: number;
|
|
1168
|
+
/** The signal strength of the device. */
|
|
1169
|
+
rssi: number;
|
|
1170
|
+
};
|
|
1171
|
+
type GetBeaconDiscoveryReturns = {
|
|
1172
|
+
beacons: Array<iBeaconInfo>;
|
|
1173
|
+
};
|
|
1174
|
+
type ScanQRCodeReturns = {
|
|
1175
|
+
content: string;
|
|
1176
|
+
};
|
|
1177
|
+
type OpenPostFeedReturns = {
|
|
1178
|
+
/**
|
|
1179
|
+
* Trạng thái chia sẻ:
|
|
1180
|
+
* - `0`: User nhấn hủy/cancel bài viết.
|
|
1181
|
+
* - `1`: Đăng bài viết thành công.
|
|
1182
|
+
*/
|
|
1183
|
+
status: 0 | 1;
|
|
1184
|
+
/**
|
|
1185
|
+
* Trạng thái bài chia sẻ:
|
|
1186
|
+
* - `0`: Công khai.
|
|
1187
|
+
* - `1`: Chỉ mình tôi.
|
|
1188
|
+
* - `2`: Chia sẻ cho danh sách bạn.
|
|
1189
|
+
*/
|
|
1190
|
+
shareType: 0 | 1 | 2;
|
|
1191
|
+
/**
|
|
1192
|
+
* Số lượng user nhận được bài chia sẻ trong trường hợp `shareType=2`.
|
|
1193
|
+
*/
|
|
1194
|
+
numberOfUser: number;
|
|
1195
|
+
};
|
|
1196
|
+
type OpenShareSheetReturns = {
|
|
1197
|
+
/**
|
|
1198
|
+
* Trạng thái chia sẻ:
|
|
1199
|
+
* - `0`: User nhấn hủy/cancel bài viết.
|
|
1200
|
+
* - `1`: Đăng bài viết thành công lên nhật ký.
|
|
1201
|
+
* - `2`: Đăng bài viết thành công qua cửa sổ chat.
|
|
1202
|
+
*/
|
|
1203
|
+
status: 0 | 2 | 1;
|
|
1204
|
+
/**
|
|
1205
|
+
* Trạng thái bài chia sẻ:
|
|
1206
|
+
* - `0`: Công khai.
|
|
1207
|
+
* - `1`: Chỉ mình tôi.
|
|
1208
|
+
* - `2`: Chia sẻ cho danh sách bạn.
|
|
1209
|
+
*/
|
|
1210
|
+
shareType: 0 | 2 | 1;
|
|
1211
|
+
/**
|
|
1212
|
+
* Số lượng user nhận được bài chia sẻ trong trường hợp `shareType=2`.
|
|
1213
|
+
*/
|
|
1214
|
+
numberOfUser: number;
|
|
1215
|
+
};
|
|
1216
|
+
type RequestCameraPermissionReturns = {
|
|
1217
|
+
userAllow: boolean;
|
|
1218
|
+
message: string;
|
|
1219
|
+
};
|
|
1220
|
+
type CheckZaloCameraPermissionReturns = {
|
|
1221
|
+
userAllow: boolean;
|
|
1222
|
+
};
|
|
1223
|
+
type OpenBioAuthenticationReturns = {
|
|
1224
|
+
code: number;
|
|
1225
|
+
message: string;
|
|
1226
|
+
data: {
|
|
1227
|
+
domain: string;
|
|
1228
|
+
code: number;
|
|
1229
|
+
message: string;
|
|
1230
|
+
payToken: string;
|
|
1231
|
+
};
|
|
1232
|
+
};
|
|
1233
|
+
type CheckStateBioAuthenticationReturns = {
|
|
1234
|
+
bioState: string;
|
|
1954
1235
|
};
|
|
1955
|
-
type
|
|
1956
|
-
|
|
1957
|
-
success?: () => void;
|
|
1958
|
-
fail?: ((err: AsyncCallbackFailObject) => void) | undefined;
|
|
1236
|
+
type KeepScreenReturns = {
|
|
1237
|
+
success: boolean;
|
|
1959
1238
|
};
|
|
1960
|
-
type
|
|
1961
|
-
|
|
1962
|
-
onProgress?: (progress: number) => void;
|
|
1963
|
-
success?: () => void;
|
|
1964
|
-
fail?: ((err: AsyncCallbackFailObject) => void) | undefined;
|
|
1239
|
+
type OpenWebviewReturns = {
|
|
1240
|
+
success: boolean;
|
|
1965
1241
|
};
|
|
1966
|
-
type
|
|
1242
|
+
type GetAppInfoReturns = {
|
|
1967
1243
|
/**
|
|
1968
|
-
*
|
|
1244
|
+
* Tên Zalo Mini App.
|
|
1969
1245
|
*/
|
|
1970
|
-
|
|
1246
|
+
name: string;
|
|
1971
1247
|
/**
|
|
1972
|
-
*
|
|
1248
|
+
* Mô tả Zalo Mini App.
|
|
1973
1249
|
*/
|
|
1974
|
-
|
|
1250
|
+
description: string;
|
|
1975
1251
|
/**
|
|
1976
|
-
*
|
|
1252
|
+
* Phiên bản live hiện tại.
|
|
1977
1253
|
*/
|
|
1978
|
-
|
|
1254
|
+
version: string;
|
|
1255
|
+
/**
|
|
1256
|
+
* Link chia sẻ Zalo Mini App.
|
|
1257
|
+
*/
|
|
1258
|
+
appUrl: string;
|
|
1259
|
+
/**
|
|
1260
|
+
* Link QR của Zalo Mini App.
|
|
1261
|
+
*/
|
|
1262
|
+
qrCodeUrl: string;
|
|
1263
|
+
/**
|
|
1264
|
+
* Đường dẫn đến hình ảnh logo của Zalo Mini App.
|
|
1265
|
+
*/
|
|
1266
|
+
logoUrl?: string;
|
|
1267
|
+
};
|
|
1268
|
+
type GetPhoneNumberReturns = {
|
|
1979
1269
|
/**
|
|
1980
1270
|
* @deprecated
|
|
1981
1271
|
*/
|
|
1982
|
-
|
|
1272
|
+
number?: string;
|
|
1983
1273
|
/**
|
|
1984
|
-
* Là một chuỗi ký tự dùng để truy xuất thông tin
|
|
1985
|
-
*
|
|
1986
|
-
* @minimumVersion Zalo App: 23.02.01
|
|
1987
|
-
* @minimumVersion ZMP SDK: 2.29.0
|
|
1274
|
+
* Là một chuỗi ký tự dùng để truy xuất thông tin số điện thoại thông qua server. Mỗi token được cung cấp chỉ có thể truy xuất thông tin được 1 lần với thời gian hết hạn sau 2 phút.
|
|
1988
1275
|
*/
|
|
1989
1276
|
token?: string;
|
|
1990
1277
|
};
|
|
1991
|
-
type
|
|
1992
|
-
mediaConstraints?: MediaConstraints;
|
|
1993
|
-
canvasElement?: HTMLCanvasElement;
|
|
1994
|
-
videoElement: HTMLVideoElement;
|
|
1995
|
-
};
|
|
1996
|
-
interface SystemInfo {
|
|
1278
|
+
type ProfileInfo = {
|
|
1997
1279
|
/**
|
|
1998
|
-
*
|
|
1280
|
+
* Tên hiển thị của người dùng.
|
|
1999
1281
|
*/
|
|
2000
|
-
|
|
1282
|
+
name: string;
|
|
2001
1283
|
/**
|
|
2002
|
-
*
|
|
1284
|
+
* Ảnh đại diện người dùng.
|
|
2003
1285
|
*/
|
|
2004
|
-
|
|
1286
|
+
avatar: string;
|
|
1287
|
+
};
|
|
1288
|
+
type PickedProfile = {
|
|
2005
1289
|
/**
|
|
2006
|
-
*
|
|
1290
|
+
* Mã người dùng. Chuỗi này là duy nhất cho mỗi người dùng trên mỗi ứng dụng Zalo App. Các Zalo Mini App cùng chung một Zalo App sẽ dùng được mã người dùng của nhau.
|
|
2007
1291
|
*/
|
|
2008
|
-
|
|
1292
|
+
id: string;
|
|
2009
1293
|
/**
|
|
2010
|
-
* Thông tin
|
|
1294
|
+
* Thông tin của người dùng.
|
|
2011
1295
|
*/
|
|
2012
|
-
|
|
1296
|
+
profile: ProfileInfo;
|
|
2013
1297
|
/**
|
|
2014
|
-
*
|
|
1298
|
+
* Mã lỗi:
|
|
1299
|
+
* - 0: Lấy thông tin của người dùng thành công.
|
|
1300
|
+
* - 1: Lấy thông tin người dùng thất bại.
|
|
2015
1301
|
*/
|
|
2016
|
-
|
|
1302
|
+
code: number;
|
|
2017
1303
|
/**
|
|
2018
|
-
*
|
|
2019
|
-
* @minimumVersion Zalo iOS: 22.03.01.r2
|
|
2020
|
-
* @minimumVersion Zalo Android: 21.09.01
|
|
2021
|
-
* @minimumVersion ZMP SDK: 2.17.3
|
|
1304
|
+
* Thông báo lỗi.
|
|
2022
1305
|
*/
|
|
2023
|
-
|
|
1306
|
+
message: string;
|
|
1307
|
+
};
|
|
1308
|
+
type OpenProfilePickerReturns = {
|
|
2024
1309
|
/**
|
|
2025
|
-
*
|
|
2026
|
-
* @minimumVersion Zalo iOS: 22.03.01.r2
|
|
2027
|
-
* @minimumVersion Zalo Android: 21.09.01
|
|
2028
|
-
* @minimumVersion ZMP SDK: 2.17.3
|
|
1310
|
+
* Danh sách những bạn bè được chọn.
|
|
2029
1311
|
*/
|
|
2030
|
-
|
|
2031
|
-
}
|
|
2032
|
-
type SetStorageReturns = {
|
|
2033
|
-
errorKeys: string[];
|
|
1312
|
+
users: PickedProfile[];
|
|
2034
1313
|
};
|
|
2035
|
-
type
|
|
2036
|
-
|
|
1314
|
+
type OpenMediaPickerReturns = {
|
|
1315
|
+
/**
|
|
1316
|
+
* Toàn bộ nội dung trả về của server upload media.
|
|
1317
|
+
*/
|
|
1318
|
+
data: string;
|
|
2037
1319
|
};
|
|
2038
|
-
type
|
|
1320
|
+
type ContextInfo = {
|
|
2039
1321
|
/**
|
|
2040
|
-
*
|
|
2041
|
-
* @minimumVersion 2.43.0
|
|
1322
|
+
* Ngữ cảnh hiện tại là người dùng hoặc nhóm chat.
|
|
2042
1323
|
*/
|
|
2043
|
-
|
|
1324
|
+
type?: "USER_CHAT" | "GROUP_CHAT" | "";
|
|
2044
1325
|
/**
|
|
2045
|
-
*
|
|
2046
|
-
* @minimumVersion 2.43.0
|
|
1326
|
+
* ID của người dùng hoặc nhóm chat tương ứng.
|
|
2047
1327
|
*/
|
|
2048
|
-
|
|
1328
|
+
id?: string;
|
|
2049
1329
|
};
|
|
2050
|
-
type
|
|
2051
|
-
|
|
1330
|
+
type GetAuthCodeReturns = {
|
|
1331
|
+
authCode: string;
|
|
1332
|
+
authCodeVerify: string;
|
|
2052
1333
|
};
|
|
2053
|
-
type
|
|
1334
|
+
type GetZPITokenReturns = {
|
|
1335
|
+
utoken: string;
|
|
1336
|
+
gtoken: string;
|
|
1337
|
+
zpp: string;
|
|
1338
|
+
zpt: string;
|
|
1339
|
+
};
|
|
1340
|
+
type TempFile = {
|
|
2054
1341
|
/**
|
|
2055
|
-
*
|
|
1342
|
+
* Đường dẫn các temp file đã chọn.
|
|
2056
1343
|
*/
|
|
2057
|
-
|
|
1344
|
+
path: string;
|
|
2058
1345
|
/**
|
|
2059
|
-
*
|
|
1346
|
+
* Kích thước các temp file đã chọn.
|
|
2060
1347
|
*/
|
|
2061
|
-
|
|
1348
|
+
size: number;
|
|
1349
|
+
};
|
|
1350
|
+
type ChooseImageReturns = {
|
|
2062
1351
|
/**
|
|
2063
|
-
*
|
|
1352
|
+
* Đường dẫn các file đã chọn.
|
|
2064
1353
|
*/
|
|
2065
|
-
|
|
1354
|
+
filePaths: string[];
|
|
2066
1355
|
/**
|
|
2067
|
-
*
|
|
2068
|
-
* - Mini App đã được xác thực bởi Official Account, chi tiết xem [tại đây](https://mini.zalo.me/blog/thong-bao-huong-dan-xac-thuc-mini-app-qua-zalo-oa/#3.b).
|
|
2069
|
-
* - Zalo App phải được liên kết với Official Account và người dùng đã follow Official Account đó.
|
|
2070
|
-
*
|
|
2071
|
-
* @minimumVersion 2.23.3
|
|
1356
|
+
* Thông tin các temp files.
|
|
2072
1357
|
*/
|
|
2073
|
-
|
|
1358
|
+
tempFiles: TempFile[];
|
|
1359
|
+
};
|
|
1360
|
+
type CreateOrderReturns = {
|
|
1361
|
+
orderId: string;
|
|
1362
|
+
messageToken?: string;
|
|
1363
|
+
transId?: string;
|
|
1364
|
+
};
|
|
1365
|
+
type SelectPaymentMethodReturns = {
|
|
1366
|
+
method: string;
|
|
1367
|
+
isCustom?: boolean;
|
|
1368
|
+
displayName?: string;
|
|
1369
|
+
subMethod?: string;
|
|
1370
|
+
logo?: string;
|
|
1371
|
+
};
|
|
1372
|
+
type CheckTransactionReturns = {
|
|
1373
|
+
err: number;
|
|
1374
|
+
msg: string;
|
|
1375
|
+
orderId: string;
|
|
1376
|
+
transId: string;
|
|
1377
|
+
resultCode: number;
|
|
1378
|
+
transTime: string;
|
|
1379
|
+
createdAt: string;
|
|
1380
|
+
path?: string;
|
|
1381
|
+
method: string;
|
|
1382
|
+
isCustom: boolean;
|
|
1383
|
+
};
|
|
1384
|
+
type CreateOrderIAPReturns = {
|
|
1385
|
+
orderId: string;
|
|
1386
|
+
};
|
|
1387
|
+
type ScopeValues = (typeof AUTHEN_SCOPE_VALUES)[number] | (typeof GET_SETTINGS_SCOPE_VALUES)[number];
|
|
1388
|
+
type AuthorizeType<T extends ScopeValues> = Partial<{
|
|
1389
|
+
[key in T]: boolean;
|
|
1390
|
+
}>;
|
|
1391
|
+
type GetSettingReturn = {
|
|
2074
1392
|
/**
|
|
2075
|
-
*
|
|
1393
|
+
* Thông tin cấp quyền, tham khảo bảng Scopes.
|
|
2076
1394
|
*
|
|
2077
|
-
*
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
*
|
|
2082
|
-
*
|
|
2083
|
-
*
|
|
1395
|
+
* | Scope | Corresponding APIs | Description |
|
|
1396
|
+
* | --------------------- | --------------------- | ------------------------------- |
|
|
1397
|
+
* | scope.userInfo | `getUserInfo` | Thông tin user (tên, avatar...) |
|
|
1398
|
+
* | scope.userLocation | `getLocation` | Thông tin vị trí user |
|
|
1399
|
+
* | scope.userPhonenumber | `getPhoneNumber` | Số điện thoại |
|
|
1400
|
+
* | scope.camera | `createCameraContext` | Camera |
|
|
1401
|
+
* | scope.micro | `createCameraContext` | Micro |
|
|
2084
1402
|
*
|
|
2085
|
-
*
|
|
1403
|
+
* Với các scope có giá trị trả về là `true`, tương ứng với việc người dùng đã cấp quyền sử dụng API trước đó, Mini Apps có thể truy xuất thông tin một cách trực tiếp.
|
|
2086
1404
|
*/
|
|
2087
|
-
|
|
1405
|
+
authSetting: AuthorizeType<(typeof GET_SETTINGS_SCOPE_VALUES)[number]>;
|
|
1406
|
+
};
|
|
1407
|
+
type SaveFileReturns = {
|
|
1408
|
+
savedPath: string;
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
declare enum CameraEvents {
|
|
1412
|
+
OnFrameCallback = "h5.event.camera.frame",
|
|
1413
|
+
OnStartCallback = "h5.event.camera.start",
|
|
1414
|
+
OnStopCallback = "h5.event.camera.stop"
|
|
1415
|
+
}
|
|
1416
|
+
declare enum FacingMode {
|
|
1417
|
+
FRONT = "user",
|
|
1418
|
+
BACK = "environment"
|
|
1419
|
+
}
|
|
1420
|
+
declare enum PhotoFormat {
|
|
1421
|
+
WEBP = "image/webp",
|
|
1422
|
+
PNG = "image/png",
|
|
1423
|
+
JPEG = "image/jpeg"
|
|
1424
|
+
}
|
|
1425
|
+
declare enum PhotoQuality {
|
|
1426
|
+
HIGH = "high",
|
|
1427
|
+
NORMAL = "normal",
|
|
1428
|
+
LOW = "low"
|
|
1429
|
+
}
|
|
1430
|
+
declare enum StreamType {
|
|
1431
|
+
VIDEO = "video",
|
|
1432
|
+
AUDIO = "audio"
|
|
1433
|
+
}
|
|
1434
|
+
type PhotoFrame = {
|
|
1435
|
+
data: string;
|
|
1436
|
+
width: number;
|
|
1437
|
+
height: number;
|
|
1438
|
+
};
|
|
1439
|
+
type MediaDevice = {
|
|
1440
|
+
kind: string;
|
|
1441
|
+
label: string;
|
|
1442
|
+
deviceId: string;
|
|
1443
|
+
};
|
|
1444
|
+
type MediaConstraints = {
|
|
1445
|
+
width?: number;
|
|
1446
|
+
height?: number;
|
|
1447
|
+
facingMode?: FacingMode;
|
|
1448
|
+
deviceId?: string;
|
|
1449
|
+
audio?: boolean;
|
|
1450
|
+
video?: boolean;
|
|
1451
|
+
mirrored?: boolean;
|
|
2088
1452
|
};
|
|
2089
|
-
type
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
1453
|
+
type PhotoConstraint = {
|
|
1454
|
+
width?: number;
|
|
1455
|
+
height?: number;
|
|
1456
|
+
format?: PhotoFormat;
|
|
1457
|
+
quality?: PhotoQuality;
|
|
1458
|
+
mirrored?: boolean;
|
|
1459
|
+
useVideoSourceSize?: boolean;
|
|
1460
|
+
minScreenshotWidth?: number;
|
|
1461
|
+
minScreenshotHeight?: number;
|
|
2094
1462
|
};
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
1463
|
+
|
|
1464
|
+
declare type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
1465
|
+
|
|
1466
|
+
declare namespace util {
|
|
1467
|
+
type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
|
1468
|
+
export const assertEqual: <A, B>(val: AssertEqual<A, B>) => AssertEqual<A, B>;
|
|
1469
|
+
export function assertIs<T>(_arg: T): void;
|
|
1470
|
+
export function assertNever(_x: never): never;
|
|
1471
|
+
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
1472
|
+
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
|
1473
|
+
export type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
1474
|
+
export const arrayToEnum: <T extends string, U extends [T, ...T[]]>(items: U) => { [k in U[number]]: k; };
|
|
1475
|
+
export const getValidEnumValues: (obj: any) => any[];
|
|
1476
|
+
export const objectValues: (obj: any) => any[];
|
|
1477
|
+
export const objectKeys: ObjectConstructor["keys"];
|
|
1478
|
+
export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
|
|
1479
|
+
export type identity<T> = T;
|
|
1480
|
+
export type flatten<T> = identity<{
|
|
1481
|
+
[k in keyof T]: T[k];
|
|
1482
|
+
}>;
|
|
1483
|
+
export type noUndefined<T> = T extends undefined ? never : T;
|
|
1484
|
+
export const isInteger: NumberConstructor["isInteger"];
|
|
1485
|
+
export function joinValues<T extends any[]>(array: T, separator?: string): string;
|
|
1486
|
+
export const jsonStringifyReplacer: (_: string, value: any) => any;
|
|
1487
|
+
export {};
|
|
1488
|
+
}
|
|
1489
|
+
declare const ZodParsedType: {
|
|
1490
|
+
function: "function";
|
|
1491
|
+
number: "number";
|
|
1492
|
+
string: "string";
|
|
1493
|
+
nan: "nan";
|
|
1494
|
+
integer: "integer";
|
|
1495
|
+
float: "float";
|
|
1496
|
+
boolean: "boolean";
|
|
1497
|
+
date: "date";
|
|
1498
|
+
bigint: "bigint";
|
|
1499
|
+
symbol: "symbol";
|
|
1500
|
+
undefined: "undefined";
|
|
1501
|
+
null: "null";
|
|
1502
|
+
array: "array";
|
|
1503
|
+
object: "object";
|
|
1504
|
+
unknown: "unknown";
|
|
1505
|
+
promise: "promise";
|
|
1506
|
+
void: "void";
|
|
1507
|
+
never: "never";
|
|
1508
|
+
map: "map";
|
|
1509
|
+
set: "set";
|
|
2104
1510
|
};
|
|
2105
|
-
type
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
distance: number;
|
|
2114
|
-
/** The signal strength of the device. */
|
|
2115
|
-
rssi: number;
|
|
1511
|
+
declare type ZodParsedType = keyof typeof ZodParsedType;
|
|
1512
|
+
|
|
1513
|
+
declare type allKeys<T> = T extends any ? keyof T : never;
|
|
1514
|
+
declare type typeToFlattenedError<T, U = string> = {
|
|
1515
|
+
formErrors: U[];
|
|
1516
|
+
fieldErrors: {
|
|
1517
|
+
[P in allKeys<T>]?: U[];
|
|
1518
|
+
};
|
|
2116
1519
|
};
|
|
2117
|
-
|
|
2118
|
-
|
|
1520
|
+
declare const ZodIssueCode: {
|
|
1521
|
+
invalid_type: "invalid_type";
|
|
1522
|
+
invalid_literal: "invalid_literal";
|
|
1523
|
+
custom: "custom";
|
|
1524
|
+
invalid_union: "invalid_union";
|
|
1525
|
+
invalid_union_discriminator: "invalid_union_discriminator";
|
|
1526
|
+
invalid_enum_value: "invalid_enum_value";
|
|
1527
|
+
unrecognized_keys: "unrecognized_keys";
|
|
1528
|
+
invalid_arguments: "invalid_arguments";
|
|
1529
|
+
invalid_return_type: "invalid_return_type";
|
|
1530
|
+
invalid_date: "invalid_date";
|
|
1531
|
+
invalid_string: "invalid_string";
|
|
1532
|
+
too_small: "too_small";
|
|
1533
|
+
too_big: "too_big";
|
|
1534
|
+
invalid_intersection_types: "invalid_intersection_types";
|
|
1535
|
+
not_multiple_of: "not_multiple_of";
|
|
1536
|
+
not_finite: "not_finite";
|
|
2119
1537
|
};
|
|
2120
|
-
type
|
|
2121
|
-
|
|
1538
|
+
declare type ZodIssueCode = keyof typeof ZodIssueCode;
|
|
1539
|
+
declare type ZodIssueBase = {
|
|
1540
|
+
path: (string | number)[];
|
|
1541
|
+
message?: string;
|
|
2122
1542
|
};
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
1543
|
+
interface ZodInvalidTypeIssue extends ZodIssueBase {
|
|
1544
|
+
code: typeof ZodIssueCode.invalid_type;
|
|
1545
|
+
expected: ZodParsedType;
|
|
1546
|
+
received: ZodParsedType;
|
|
1547
|
+
}
|
|
1548
|
+
interface ZodInvalidLiteralIssue extends ZodIssueBase {
|
|
1549
|
+
code: typeof ZodIssueCode.invalid_literal;
|
|
1550
|
+
expected: unknown;
|
|
1551
|
+
received: unknown;
|
|
1552
|
+
}
|
|
1553
|
+
interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
|
|
1554
|
+
code: typeof ZodIssueCode.unrecognized_keys;
|
|
1555
|
+
keys: string[];
|
|
1556
|
+
}
|
|
1557
|
+
interface ZodInvalidUnionIssue extends ZodIssueBase {
|
|
1558
|
+
code: typeof ZodIssueCode.invalid_union;
|
|
1559
|
+
unionErrors: ZodError[];
|
|
1560
|
+
}
|
|
1561
|
+
interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
|
|
1562
|
+
code: typeof ZodIssueCode.invalid_union_discriminator;
|
|
1563
|
+
options: Primitive[];
|
|
1564
|
+
}
|
|
1565
|
+
interface ZodInvalidEnumValueIssue extends ZodIssueBase {
|
|
1566
|
+
received: string | number;
|
|
1567
|
+
code: typeof ZodIssueCode.invalid_enum_value;
|
|
1568
|
+
options: (string | number)[];
|
|
1569
|
+
}
|
|
1570
|
+
interface ZodInvalidArgumentsIssue extends ZodIssueBase {
|
|
1571
|
+
code: typeof ZodIssueCode.invalid_arguments;
|
|
1572
|
+
argumentsError: ZodError;
|
|
1573
|
+
}
|
|
1574
|
+
interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
|
|
1575
|
+
code: typeof ZodIssueCode.invalid_return_type;
|
|
1576
|
+
returnTypeError: ZodError;
|
|
1577
|
+
}
|
|
1578
|
+
interface ZodInvalidDateIssue extends ZodIssueBase {
|
|
1579
|
+
code: typeof ZodIssueCode.invalid_date;
|
|
1580
|
+
}
|
|
1581
|
+
declare type StringValidation = "email" | "url" | "uuid" | "regex" | "cuid" | "cuid2" | "datetime" | {
|
|
1582
|
+
startsWith: string;
|
|
1583
|
+
} | {
|
|
1584
|
+
endsWith: string;
|
|
2141
1585
|
};
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
1586
|
+
interface ZodInvalidStringIssue extends ZodIssueBase {
|
|
1587
|
+
code: typeof ZodIssueCode.invalid_string;
|
|
1588
|
+
validation: StringValidation;
|
|
1589
|
+
}
|
|
1590
|
+
interface ZodTooSmallIssue extends ZodIssueBase {
|
|
1591
|
+
code: typeof ZodIssueCode.too_small;
|
|
1592
|
+
minimum: number;
|
|
1593
|
+
inclusive: boolean;
|
|
1594
|
+
exact?: boolean;
|
|
1595
|
+
type: "array" | "string" | "number" | "set" | "date";
|
|
1596
|
+
}
|
|
1597
|
+
interface ZodTooBigIssue extends ZodIssueBase {
|
|
1598
|
+
code: typeof ZodIssueCode.too_big;
|
|
1599
|
+
maximum: number;
|
|
1600
|
+
inclusive: boolean;
|
|
1601
|
+
exact?: boolean;
|
|
1602
|
+
type: "array" | "string" | "number" | "set" | "date";
|
|
1603
|
+
}
|
|
1604
|
+
interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
|
|
1605
|
+
code: typeof ZodIssueCode.invalid_intersection_types;
|
|
1606
|
+
}
|
|
1607
|
+
interface ZodNotMultipleOfIssue extends ZodIssueBase {
|
|
1608
|
+
code: typeof ZodIssueCode.not_multiple_of;
|
|
1609
|
+
multipleOf: number;
|
|
1610
|
+
}
|
|
1611
|
+
interface ZodNotFiniteIssue extends ZodIssueBase {
|
|
1612
|
+
code: typeof ZodIssueCode.not_finite;
|
|
1613
|
+
}
|
|
1614
|
+
interface ZodCustomIssue extends ZodIssueBase {
|
|
1615
|
+
code: typeof ZodIssueCode.custom;
|
|
1616
|
+
params?: {
|
|
1617
|
+
[k: string]: any;
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
declare type ZodIssueOptionalMessage = ZodInvalidTypeIssue | ZodInvalidLiteralIssue | ZodUnrecognizedKeysIssue | ZodInvalidUnionIssue | ZodInvalidUnionDiscriminatorIssue | ZodInvalidEnumValueIssue | ZodInvalidArgumentsIssue | ZodInvalidReturnTypeIssue | ZodInvalidDateIssue | ZodInvalidStringIssue | ZodTooSmallIssue | ZodTooBigIssue | ZodInvalidIntersectionTypesIssue | ZodNotMultipleOfIssue | ZodNotFiniteIssue | ZodCustomIssue;
|
|
1621
|
+
declare type ZodIssue = ZodIssueOptionalMessage & {
|
|
1622
|
+
fatal?: boolean;
|
|
1623
|
+
message: string;
|
|
1624
|
+
};
|
|
1625
|
+
declare type ZodFormattedError<T, U = string> = {
|
|
1626
|
+
_errors: U[];
|
|
1627
|
+
} & (NonNullable<T> extends [any, ...any[]] ? {
|
|
1628
|
+
[K in keyof NonNullable<T>]?: ZodFormattedError<NonNullable<T>[K], U>;
|
|
1629
|
+
} : NonNullable<T> extends any[] ? {
|
|
1630
|
+
[k: number]: ZodFormattedError<NonNullable<T>[number], U>;
|
|
1631
|
+
} : NonNullable<T> extends object ? {
|
|
1632
|
+
[K in keyof NonNullable<T>]?: ZodFormattedError<NonNullable<T>[K], U>;
|
|
1633
|
+
} : unknown);
|
|
1634
|
+
declare class ZodError<T = any> extends Error {
|
|
1635
|
+
issues: ZodIssue[];
|
|
1636
|
+
get errors(): ZodIssue[];
|
|
1637
|
+
constructor(issues: ZodIssue[]);
|
|
1638
|
+
format(): ZodFormattedError<T>;
|
|
1639
|
+
format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
|
|
1640
|
+
static create: (issues: ZodIssue[]) => ZodError<any>;
|
|
1641
|
+
toString(): string;
|
|
1642
|
+
get message(): string;
|
|
1643
|
+
get isEmpty(): boolean;
|
|
1644
|
+
addIssue: (sub: ZodIssue) => void;
|
|
1645
|
+
addIssues: (subs?: ZodIssue[]) => void;
|
|
1646
|
+
flatten(): typeToFlattenedError<T>;
|
|
1647
|
+
flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
|
|
1648
|
+
get formErrors(): typeToFlattenedError<T, string>;
|
|
1649
|
+
}
|
|
1650
|
+
declare type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
|
|
1651
|
+
declare type IssueData = stripPath<ZodIssueOptionalMessage> & {
|
|
1652
|
+
path?: (string | number)[];
|
|
1653
|
+
fatal?: boolean;
|
|
2161
1654
|
};
|
|
2162
|
-
type
|
|
2163
|
-
|
|
1655
|
+
declare type ErrorMapCtx = {
|
|
1656
|
+
defaultError: string;
|
|
1657
|
+
data: any;
|
|
1658
|
+
};
|
|
1659
|
+
declare type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => {
|
|
2164
1660
|
message: string;
|
|
2165
1661
|
};
|
|
2166
|
-
|
|
2167
|
-
|
|
1662
|
+
|
|
1663
|
+
declare type ParseParams = {
|
|
1664
|
+
path: (string | number)[];
|
|
1665
|
+
errorMap: ZodErrorMap;
|
|
1666
|
+
async: boolean;
|
|
2168
1667
|
};
|
|
2169
|
-
type
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
payToken: string;
|
|
1668
|
+
declare type ParsePathComponent = string | number;
|
|
1669
|
+
declare type ParsePath = ParsePathComponent[];
|
|
1670
|
+
interface ParseContext {
|
|
1671
|
+
readonly common: {
|
|
1672
|
+
readonly issues: ZodIssue[];
|
|
1673
|
+
readonly contextualErrorMap?: ZodErrorMap;
|
|
1674
|
+
readonly async: boolean;
|
|
2177
1675
|
};
|
|
1676
|
+
readonly path: ParsePath;
|
|
1677
|
+
readonly schemaErrorMap?: ZodErrorMap;
|
|
1678
|
+
readonly parent: ParseContext | null;
|
|
1679
|
+
readonly data: any;
|
|
1680
|
+
readonly parsedType: ZodParsedType;
|
|
1681
|
+
}
|
|
1682
|
+
declare type ParseInput = {
|
|
1683
|
+
data: any;
|
|
1684
|
+
path: (string | number)[];
|
|
1685
|
+
parent: ParseContext;
|
|
2178
1686
|
};
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
1687
|
+
declare class ParseStatus {
|
|
1688
|
+
value: "aborted" | "dirty" | "valid";
|
|
1689
|
+
dirty(): void;
|
|
1690
|
+
abort(): void;
|
|
1691
|
+
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
|
1692
|
+
static mergeObjectAsync(status: ParseStatus, pairs: {
|
|
1693
|
+
key: ParseReturnType<any>;
|
|
1694
|
+
value: ParseReturnType<any>;
|
|
1695
|
+
}[]): Promise<SyncParseReturnType<any>>;
|
|
1696
|
+
static mergeObjectSync(status: ParseStatus, pairs: {
|
|
1697
|
+
key: SyncParseReturnType<any>;
|
|
1698
|
+
value: SyncParseReturnType<any>;
|
|
1699
|
+
alwaysSet?: boolean;
|
|
1700
|
+
}[]): SyncParseReturnType;
|
|
1701
|
+
}
|
|
1702
|
+
declare type INVALID = {
|
|
1703
|
+
status: "aborted";
|
|
2184
1704
|
};
|
|
2185
|
-
|
|
2186
|
-
|
|
1705
|
+
declare const INVALID: INVALID;
|
|
1706
|
+
declare type DIRTY<T> = {
|
|
1707
|
+
status: "dirty";
|
|
1708
|
+
value: T;
|
|
2187
1709
|
};
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
name: string;
|
|
2193
|
-
/**
|
|
2194
|
-
* Mô tả Zalo Mini App.
|
|
2195
|
-
*/
|
|
2196
|
-
description: string;
|
|
2197
|
-
/**
|
|
2198
|
-
* Phiên bản live hiện tại.
|
|
2199
|
-
*/
|
|
2200
|
-
version: string;
|
|
2201
|
-
/**
|
|
2202
|
-
* Link chia sẻ Zalo Mini App.
|
|
2203
|
-
*/
|
|
2204
|
-
appUrl: string;
|
|
2205
|
-
/**
|
|
2206
|
-
* Link QR của Zalo Mini App.
|
|
2207
|
-
*/
|
|
2208
|
-
qrCodeUrl: string;
|
|
2209
|
-
/**
|
|
2210
|
-
* Đường dẫn đến hình ảnh logo của Zalo Mini App.
|
|
2211
|
-
*/
|
|
2212
|
-
logoUrl?: string;
|
|
1710
|
+
declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
|
1711
|
+
declare type OK<T> = {
|
|
1712
|
+
status: "valid";
|
|
1713
|
+
value: T;
|
|
2213
1714
|
};
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
1715
|
+
declare const OK: <T>(value: T) => OK<T>;
|
|
1716
|
+
declare type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
|
1717
|
+
declare type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
|
1718
|
+
declare type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
|
1719
|
+
|
|
1720
|
+
declare namespace enumUtil {
|
|
1721
|
+
type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
|
1722
|
+
type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
|
|
1723
|
+
type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
|
|
1724
|
+
type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
|
|
1725
|
+
export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
|
|
1726
|
+
export {};
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
declare namespace errorUtil {
|
|
1730
|
+
type ErrMessage = string | {
|
|
1731
|
+
message?: string;
|
|
1732
|
+
};
|
|
1733
|
+
const errToObj: (message?: ErrMessage | undefined) => {
|
|
1734
|
+
message?: string | undefined;
|
|
1735
|
+
};
|
|
1736
|
+
const toString: (message?: ErrMessage | undefined) => string | undefined;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
declare namespace partialUtil {
|
|
1740
|
+
type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<infer Shape, infer Params, infer Catchall> ? ZodObject<{
|
|
1741
|
+
[k in keyof Shape]: ZodOptional<DeepPartial<Shape[k]>>;
|
|
1742
|
+
}, Params, Catchall> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
|
|
1743
|
+
[k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
|
|
1744
|
+
} extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
declare type RefinementCtx = {
|
|
1748
|
+
addIssue: (arg: IssueData) => void;
|
|
1749
|
+
path: (string | number)[];
|
|
2223
1750
|
};
|
|
2224
|
-
type
|
|
2225
|
-
|
|
2226
|
-
* Tên hiển thị của người dùng.
|
|
2227
|
-
*/
|
|
2228
|
-
name: string;
|
|
2229
|
-
/**
|
|
2230
|
-
* Ảnh đại diện người dùng.
|
|
2231
|
-
*/
|
|
2232
|
-
avatar: string;
|
|
1751
|
+
declare type ZodRawShape = {
|
|
1752
|
+
[k: string]: ZodTypeAny;
|
|
2233
1753
|
};
|
|
2234
|
-
type
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
1754
|
+
declare type ZodTypeAny = ZodType<any, any, any>;
|
|
1755
|
+
declare type TypeOf<T extends ZodType<any, any, any>> = T["_output"];
|
|
1756
|
+
declare type input<T extends ZodType<any, any, any>> = T["_input"];
|
|
1757
|
+
declare type output<T extends ZodType<any, any, any>> = T["_output"];
|
|
1758
|
+
|
|
1759
|
+
declare type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;
|
|
1760
|
+
interface ZodTypeDef {
|
|
1761
|
+
errorMap?: ZodErrorMap;
|
|
1762
|
+
description?: string;
|
|
1763
|
+
}
|
|
1764
|
+
declare type RawCreateParams = {
|
|
1765
|
+
errorMap?: ZodErrorMap;
|
|
1766
|
+
invalid_type_error?: string;
|
|
1767
|
+
required_error?: string;
|
|
1768
|
+
description?: string;
|
|
1769
|
+
} | undefined;
|
|
1770
|
+
declare type SafeParseSuccess<Output> = {
|
|
1771
|
+
success: true;
|
|
1772
|
+
data: Output;
|
|
2253
1773
|
};
|
|
2254
|
-
type
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
*/
|
|
2258
|
-
users: PickedProfile[];
|
|
1774
|
+
declare type SafeParseError<Input> = {
|
|
1775
|
+
success: false;
|
|
1776
|
+
error: ZodError<Input>;
|
|
2259
1777
|
};
|
|
2260
|
-
type
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
1778
|
+
declare type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
|
|
1779
|
+
declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
|
|
1780
|
+
readonly _type: Output;
|
|
1781
|
+
readonly _output: Output;
|
|
1782
|
+
readonly _input: Input;
|
|
1783
|
+
readonly _def: Def;
|
|
1784
|
+
get description(): string | undefined;
|
|
1785
|
+
abstract _parse(input: ParseInput): ParseReturnType<Output>;
|
|
1786
|
+
_getType(input: ParseInput): string;
|
|
1787
|
+
_getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
|
|
1788
|
+
_processInputParams(input: ParseInput): {
|
|
1789
|
+
status: ParseStatus;
|
|
1790
|
+
ctx: ParseContext;
|
|
1791
|
+
};
|
|
1792
|
+
_parseSync(input: ParseInput): SyncParseReturnType<Output>;
|
|
1793
|
+
_parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
|
|
1794
|
+
parse(data: unknown, params?: Partial<ParseParams>): Output;
|
|
1795
|
+
safeParse(data: unknown, params?: Partial<ParseParams>): SafeParseReturnType<Input, Output>;
|
|
1796
|
+
parseAsync(data: unknown, params?: Partial<ParseParams>): Promise<Output>;
|
|
1797
|
+
safeParseAsync(data: unknown, params?: Partial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
1798
|
+
/** Alias of safeParseAsync */
|
|
1799
|
+
spa: (data: unknown, params?: Partial<ParseParams> | undefined) => Promise<SafeParseReturnType<Input, Output>>;
|
|
1800
|
+
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>;
|
|
1801
|
+
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, Output, Input>;
|
|
1802
|
+
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, RefinedOutput, Input>;
|
|
1803
|
+
refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): ZodEffects<this, Output, Input>;
|
|
1804
|
+
_refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
|
|
1805
|
+
superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
|
|
1806
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
|
|
1807
|
+
constructor(def: Def);
|
|
1808
|
+
optional(): ZodOptional<this>;
|
|
1809
|
+
nullable(): ZodNullable<this>;
|
|
1810
|
+
nullish(): ZodOptional<ZodNullable<this>>;
|
|
1811
|
+
array(): ZodArray<this>;
|
|
1812
|
+
promise(): ZodPromise<this>;
|
|
1813
|
+
or<T extends ZodTypeAny>(option: T): ZodUnion<[this, T]>;
|
|
1814
|
+
and<T extends ZodTypeAny>(incoming: T): ZodIntersection<this, T>;
|
|
1815
|
+
transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): ZodEffects<this, NewOut>;
|
|
1816
|
+
default(def: util.noUndefined<Input>): ZodDefault<this>;
|
|
1817
|
+
default(def: () => util.noUndefined<Input>): ZodDefault<this>;
|
|
1818
|
+
brand<B extends string | number | symbol>(brand?: B): ZodBranded<this, B>;
|
|
1819
|
+
catch(def: Output): ZodCatch<this>;
|
|
1820
|
+
catch(def: () => Output): ZodCatch<this>;
|
|
1821
|
+
describe(description: string): this;
|
|
1822
|
+
pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
|
|
1823
|
+
isOptional(): boolean;
|
|
1824
|
+
isNullable(): boolean;
|
|
1825
|
+
}
|
|
1826
|
+
declare type ZodStringCheck = {
|
|
1827
|
+
kind: "min";
|
|
1828
|
+
value: number;
|
|
1829
|
+
message?: string;
|
|
1830
|
+
} | {
|
|
1831
|
+
kind: "max";
|
|
1832
|
+
value: number;
|
|
1833
|
+
message?: string;
|
|
1834
|
+
} | {
|
|
1835
|
+
kind: "length";
|
|
1836
|
+
value: number;
|
|
1837
|
+
message?: string;
|
|
1838
|
+
} | {
|
|
1839
|
+
kind: "email";
|
|
1840
|
+
message?: string;
|
|
1841
|
+
} | {
|
|
1842
|
+
kind: "url";
|
|
1843
|
+
message?: string;
|
|
1844
|
+
} | {
|
|
1845
|
+
kind: "uuid";
|
|
1846
|
+
message?: string;
|
|
1847
|
+
} | {
|
|
1848
|
+
kind: "cuid";
|
|
1849
|
+
message?: string;
|
|
1850
|
+
} | {
|
|
1851
|
+
kind: "cuid2";
|
|
1852
|
+
message?: string;
|
|
1853
|
+
} | {
|
|
1854
|
+
kind: "startsWith";
|
|
1855
|
+
value: string;
|
|
1856
|
+
message?: string;
|
|
1857
|
+
} | {
|
|
1858
|
+
kind: "endsWith";
|
|
1859
|
+
value: string;
|
|
1860
|
+
message?: string;
|
|
1861
|
+
} | {
|
|
1862
|
+
kind: "regex";
|
|
1863
|
+
regex: RegExp;
|
|
1864
|
+
message?: string;
|
|
1865
|
+
} | {
|
|
1866
|
+
kind: "trim";
|
|
1867
|
+
message?: string;
|
|
1868
|
+
} | {
|
|
1869
|
+
kind: "datetime";
|
|
1870
|
+
offset: boolean;
|
|
1871
|
+
precision: number | null;
|
|
1872
|
+
message?: string;
|
|
2265
1873
|
};
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
1874
|
+
interface ZodStringDef extends ZodTypeDef {
|
|
1875
|
+
checks: ZodStringCheck[];
|
|
1876
|
+
typeName: ZodFirstPartyTypeKind.ZodString;
|
|
1877
|
+
coerce: boolean;
|
|
1878
|
+
}
|
|
1879
|
+
declare class ZodString extends ZodType<string, ZodStringDef> {
|
|
1880
|
+
_parse(input: ParseInput): ParseReturnType<string>;
|
|
1881
|
+
protected _regex: (regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage | undefined) => ZodEffects<this, string, string>;
|
|
1882
|
+
_addCheck(check: ZodStringCheck): ZodString;
|
|
1883
|
+
email(message?: errorUtil.ErrMessage): ZodString;
|
|
1884
|
+
url(message?: errorUtil.ErrMessage): ZodString;
|
|
1885
|
+
uuid(message?: errorUtil.ErrMessage): ZodString;
|
|
1886
|
+
cuid(message?: errorUtil.ErrMessage): ZodString;
|
|
1887
|
+
cuid2(message?: errorUtil.ErrMessage): ZodString;
|
|
1888
|
+
datetime(options?: string | {
|
|
1889
|
+
message?: string | undefined;
|
|
1890
|
+
precision?: number | null;
|
|
1891
|
+
offset?: boolean;
|
|
1892
|
+
}): ZodString;
|
|
1893
|
+
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString;
|
|
1894
|
+
startsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
1895
|
+
endsWith(value: string, message?: errorUtil.ErrMessage): ZodString;
|
|
1896
|
+
min(minLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
1897
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): ZodString;
|
|
1898
|
+
length(len: number, message?: errorUtil.ErrMessage): ZodString;
|
|
2271
1899
|
/**
|
|
2272
|
-
*
|
|
1900
|
+
* @deprecated Use z.string().min(1) instead.
|
|
1901
|
+
* @see {@link ZodString.min}
|
|
2273
1902
|
*/
|
|
2274
|
-
|
|
1903
|
+
nonempty: (message?: errorUtil.ErrMessage | undefined) => ZodString;
|
|
1904
|
+
trim: () => ZodString;
|
|
1905
|
+
get isDatetime(): boolean;
|
|
1906
|
+
get isEmail(): boolean;
|
|
1907
|
+
get isURL(): boolean;
|
|
1908
|
+
get isUUID(): boolean;
|
|
1909
|
+
get isCUID(): boolean;
|
|
1910
|
+
get isCUID2(): boolean;
|
|
1911
|
+
get minLength(): number | null;
|
|
1912
|
+
get maxLength(): number | null;
|
|
1913
|
+
static create: (params?: ({
|
|
1914
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1915
|
+
invalid_type_error?: string | undefined;
|
|
1916
|
+
required_error?: string | undefined;
|
|
1917
|
+
description?: string | undefined;
|
|
1918
|
+
} & {
|
|
1919
|
+
coerce?: true | undefined;
|
|
1920
|
+
}) | undefined) => ZodString;
|
|
1921
|
+
}
|
|
1922
|
+
declare type ZodNumberCheck = {
|
|
1923
|
+
kind: "min";
|
|
1924
|
+
value: number;
|
|
1925
|
+
inclusive: boolean;
|
|
1926
|
+
message?: string;
|
|
1927
|
+
} | {
|
|
1928
|
+
kind: "max";
|
|
1929
|
+
value: number;
|
|
1930
|
+
inclusive: boolean;
|
|
1931
|
+
message?: string;
|
|
1932
|
+
} | {
|
|
1933
|
+
kind: "int";
|
|
1934
|
+
message?: string;
|
|
1935
|
+
} | {
|
|
1936
|
+
kind: "multipleOf";
|
|
1937
|
+
value: number;
|
|
1938
|
+
message?: string;
|
|
1939
|
+
} | {
|
|
1940
|
+
kind: "finite";
|
|
1941
|
+
message?: string;
|
|
2275
1942
|
};
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
1943
|
+
interface ZodNumberDef extends ZodTypeDef {
|
|
1944
|
+
checks: ZodNumberCheck[];
|
|
1945
|
+
typeName: ZodFirstPartyTypeKind.ZodNumber;
|
|
1946
|
+
coerce: boolean;
|
|
1947
|
+
}
|
|
1948
|
+
declare class ZodNumber extends ZodType<number, ZodNumberDef> {
|
|
1949
|
+
_parse(input: ParseInput): ParseReturnType<number>;
|
|
1950
|
+
static create: (params?: ({
|
|
1951
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1952
|
+
invalid_type_error?: string | undefined;
|
|
1953
|
+
required_error?: string | undefined;
|
|
1954
|
+
description?: string | undefined;
|
|
1955
|
+
} & {
|
|
1956
|
+
coerce?: boolean | undefined;
|
|
1957
|
+
}) | undefined) => ZodNumber;
|
|
1958
|
+
gte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1959
|
+
min: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
1960
|
+
gt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1961
|
+
lte(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1962
|
+
max: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
1963
|
+
lt(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1964
|
+
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): ZodNumber;
|
|
1965
|
+
_addCheck(check: ZodNumberCheck): ZodNumber;
|
|
1966
|
+
int(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1967
|
+
positive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1968
|
+
negative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1969
|
+
nonpositive(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1970
|
+
nonnegative(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1971
|
+
multipleOf(value: number, message?: errorUtil.ErrMessage): ZodNumber;
|
|
1972
|
+
finite(message?: errorUtil.ErrMessage): ZodNumber;
|
|
1973
|
+
step: (value: number, message?: errorUtil.ErrMessage | undefined) => ZodNumber;
|
|
1974
|
+
get minValue(): number | null;
|
|
1975
|
+
get maxValue(): number | null;
|
|
1976
|
+
get isInt(): boolean;
|
|
1977
|
+
get isFinite(): boolean;
|
|
1978
|
+
}
|
|
1979
|
+
interface ZodBooleanDef extends ZodTypeDef {
|
|
1980
|
+
typeName: ZodFirstPartyTypeKind.ZodBoolean;
|
|
1981
|
+
coerce: boolean;
|
|
1982
|
+
}
|
|
1983
|
+
declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef> {
|
|
1984
|
+
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
1985
|
+
static create: (params?: ({
|
|
1986
|
+
errorMap?: ZodErrorMap | undefined;
|
|
1987
|
+
invalid_type_error?: string | undefined;
|
|
1988
|
+
required_error?: string | undefined;
|
|
1989
|
+
description?: string | undefined;
|
|
1990
|
+
} & {
|
|
1991
|
+
coerce?: boolean | undefined;
|
|
1992
|
+
}) | undefined) => ZodBoolean;
|
|
1993
|
+
}
|
|
1994
|
+
interface ZodAnyDef extends ZodTypeDef {
|
|
1995
|
+
typeName: ZodFirstPartyTypeKind.ZodAny;
|
|
1996
|
+
}
|
|
1997
|
+
declare class ZodAny extends ZodType<any, ZodAnyDef> {
|
|
1998
|
+
_any: true;
|
|
1999
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2000
|
+
static create: (params?: RawCreateParams) => ZodAny;
|
|
2001
|
+
}
|
|
2002
|
+
interface ZodUnknownDef extends ZodTypeDef {
|
|
2003
|
+
typeName: ZodFirstPartyTypeKind.ZodUnknown;
|
|
2004
|
+
}
|
|
2005
|
+
declare class ZodUnknown extends ZodType<unknown, ZodUnknownDef> {
|
|
2006
|
+
_unknown: true;
|
|
2007
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2008
|
+
static create: (params?: RawCreateParams) => ZodUnknown;
|
|
2009
|
+
}
|
|
2010
|
+
interface ZodVoidDef extends ZodTypeDef {
|
|
2011
|
+
typeName: ZodFirstPartyTypeKind.ZodVoid;
|
|
2012
|
+
}
|
|
2013
|
+
declare class ZodVoid extends ZodType<void, ZodVoidDef> {
|
|
2014
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2015
|
+
static create: (params?: RawCreateParams) => ZodVoid;
|
|
2016
|
+
}
|
|
2017
|
+
interface ZodArrayDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2018
|
+
type: T;
|
|
2019
|
+
typeName: ZodFirstPartyTypeKind.ZodArray;
|
|
2020
|
+
exactLength: {
|
|
2021
|
+
value: number;
|
|
2022
|
+
message?: string;
|
|
2023
|
+
} | null;
|
|
2024
|
+
minLength: {
|
|
2025
|
+
value: number;
|
|
2026
|
+
message?: string;
|
|
2027
|
+
} | null;
|
|
2028
|
+
maxLength: {
|
|
2029
|
+
value: number;
|
|
2030
|
+
message?: string;
|
|
2031
|
+
} | null;
|
|
2032
|
+
}
|
|
2033
|
+
declare type ArrayCardinality = "many" | "atleastone";
|
|
2034
|
+
declare type arrayOutputType<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
|
|
2035
|
+
declare class ZodArray<T extends ZodTypeAny, Cardinality extends ArrayCardinality = "many"> extends ZodType<arrayOutputType<T, Cardinality>, ZodArrayDef<T>, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> {
|
|
2036
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2037
|
+
get element(): T;
|
|
2038
|
+
min(minLength: number, message?: errorUtil.ErrMessage): this;
|
|
2039
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
2040
|
+
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
2041
|
+
nonempty(message?: errorUtil.ErrMessage): ZodArray<T, "atleastone">;
|
|
2042
|
+
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodArray<T_1, "many">;
|
|
2043
|
+
}
|
|
2044
|
+
declare namespace objectUtil {
|
|
2045
|
+
export type MergeShapes<U extends ZodRawShape, V extends ZodRawShape> = {
|
|
2046
|
+
[k in Exclude<keyof U, keyof V>]: U[k];
|
|
2047
|
+
} & V;
|
|
2048
|
+
type optionalKeys<T extends object> = {
|
|
2049
|
+
[k in keyof T]: undefined extends T[k] ? k : never;
|
|
2050
|
+
}[keyof T];
|
|
2051
|
+
type requiredKeys<T extends object> = {
|
|
2052
|
+
[k in keyof T]: undefined extends T[k] ? never : k;
|
|
2053
|
+
}[keyof T];
|
|
2054
|
+
export type addQuestionMarks<T extends object> = Partial<Pick<T, optionalKeys<T>>> & Pick<T, requiredKeys<T>>;
|
|
2055
|
+
export type identity<T> = T;
|
|
2056
|
+
export type flatten<T extends object> = identity<{
|
|
2057
|
+
[k in keyof T]: T[k];
|
|
2058
|
+
}>;
|
|
2059
|
+
export type noNeverKeys<T extends ZodRawShape> = {
|
|
2060
|
+
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
|
2061
|
+
}[keyof T];
|
|
2062
|
+
export type noNever<T extends ZodRawShape> = identity<{
|
|
2063
|
+
[k in noNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
2064
|
+
}>;
|
|
2065
|
+
export const mergeShapes: <U extends ZodRawShape, T extends ZodRawShape>(first: U, second: T) => T & U;
|
|
2066
|
+
export {};
|
|
2067
|
+
}
|
|
2068
|
+
declare type extendShape<A, B> = util.flatten<Omit<A, keyof B> & B>;
|
|
2069
|
+
declare type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
2070
|
+
interface ZodObjectDef<T extends ZodRawShape = ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2071
|
+
typeName: ZodFirstPartyTypeKind.ZodObject;
|
|
2072
|
+
shape: () => T;
|
|
2073
|
+
catchall: Catchall;
|
|
2074
|
+
unknownKeys: UnknownKeys;
|
|
2075
|
+
}
|
|
2076
|
+
declare type baseObjectOutputType<Shape extends ZodRawShape> = objectUtil.addQuestionMarks<{
|
|
2077
|
+
[k in keyof Shape]: Shape[k]["_output"];
|
|
2078
|
+
}>;
|
|
2079
|
+
declare type objectOutputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = ZodTypeAny extends Catchall ? objectUtil.flatten<baseObjectOutputType<Shape>> : objectUtil.flatten<baseObjectOutputType<Shape> & {
|
|
2080
|
+
[k: string]: Catchall["_output"];
|
|
2081
|
+
}>;
|
|
2082
|
+
declare type baseObjectInputType<Shape extends ZodRawShape> = objectUtil.flatten<objectUtil.addQuestionMarks<{
|
|
2083
|
+
[k in keyof Shape]: Shape[k]["_input"];
|
|
2084
|
+
}>>;
|
|
2085
|
+
declare type objectInputType<Shape extends ZodRawShape, Catchall extends ZodTypeAny> = ZodTypeAny extends Catchall ? baseObjectInputType<Shape> : objectUtil.flatten<baseObjectInputType<Shape> & {
|
|
2086
|
+
[k: string]: Catchall["_input"];
|
|
2087
|
+
}>;
|
|
2088
|
+
declare type deoptional<T extends ZodTypeAny> = T extends ZodOptional<infer U> ? deoptional<U> : T extends ZodNullable<infer U> ? ZodNullable<deoptional<U>> : T;
|
|
2089
|
+
declare type objectKeyMask<Obj> = {
|
|
2090
|
+
[k in keyof Obj]?: true;
|
|
2279
2091
|
};
|
|
2280
|
-
type
|
|
2281
|
-
|
|
2282
|
-
gtoken: string;
|
|
2283
|
-
zpp: string;
|
|
2284
|
-
zpt: string;
|
|
2092
|
+
declare type noUnrecognized<Obj extends object, Shape extends object> = {
|
|
2093
|
+
[k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;
|
|
2285
2094
|
};
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2095
|
+
declare class ZodObject<T extends ZodRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends ZodTypeAny = ZodTypeAny, Output = objectOutputType<T, Catchall>, Input = objectInputType<T, Catchall>> extends ZodType<Output, ZodObjectDef<T, UnknownKeys, Catchall>, Input> {
|
|
2096
|
+
private _cached;
|
|
2097
|
+
_getCached(): {
|
|
2098
|
+
shape: T;
|
|
2099
|
+
keys: string[];
|
|
2100
|
+
};
|
|
2101
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2102
|
+
get shape(): T;
|
|
2103
|
+
strict(message?: errorUtil.ErrMessage): ZodObject<T, "strict", Catchall>;
|
|
2104
|
+
strip(): ZodObject<T, "strip", Catchall>;
|
|
2105
|
+
passthrough(): ZodObject<T, "passthrough", Catchall>;
|
|
2291
2106
|
/**
|
|
2292
|
-
*
|
|
2107
|
+
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
|
|
2108
|
+
* If you want to pass through unknown properties, use `.passthrough()` instead.
|
|
2293
2109
|
*/
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
type ChooseImageReturns = {
|
|
2110
|
+
nonstrict: () => ZodObject<T, "passthrough", Catchall>;
|
|
2111
|
+
extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
2297
2112
|
/**
|
|
2298
|
-
*
|
|
2299
|
-
*/
|
|
2300
|
-
|
|
2113
|
+
* @deprecated Use `.extend` instead
|
|
2114
|
+
* */
|
|
2115
|
+
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, UnknownKeys, Catchall, objectOutputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall>, objectInputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall>>;
|
|
2301
2116
|
/**
|
|
2302
|
-
*
|
|
2117
|
+
* Prior to zod@1.0.12 there was a bug in the
|
|
2118
|
+
* inferred type of merged objects. Please
|
|
2119
|
+
* upgrade if you are experiencing issues.
|
|
2303
2120
|
*/
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2121
|
+
merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
|
|
2122
|
+
setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & {
|
|
2123
|
+
[k in Key]: Schema;
|
|
2124
|
+
}, UnknownKeys, Catchall>;
|
|
2125
|
+
catchall<Index extends ZodTypeAny>(index: Index): ZodObject<T, UnknownKeys, Index>;
|
|
2126
|
+
pick<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, T>): ZodObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
|
|
2127
|
+
omit<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, objectKeyMask<T>>): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
|
|
2128
|
+
deepPartial(): partialUtil.DeepPartial<this>;
|
|
2129
|
+
partial(): ZodObject<{
|
|
2130
|
+
[k in keyof T]: ZodOptional<T[k]>;
|
|
2131
|
+
}, UnknownKeys, Catchall>;
|
|
2132
|
+
partial<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, objectKeyMask<T>>): ZodObject<objectUtil.noNever<{
|
|
2133
|
+
[k in keyof T]: k extends keyof Mask ? ZodOptional<T[k]> : T[k];
|
|
2134
|
+
}>, UnknownKeys, Catchall>;
|
|
2135
|
+
required(): ZodObject<{
|
|
2136
|
+
[k in keyof T]: deoptional<T[k]>;
|
|
2137
|
+
}, UnknownKeys, Catchall>;
|
|
2138
|
+
required<Mask extends objectKeyMask<T>>(mask: noUnrecognized<Mask, objectKeyMask<T>>): ZodObject<objectUtil.noNever<{
|
|
2139
|
+
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
2140
|
+
}>, UnknownKeys, Catchall>;
|
|
2141
|
+
keyof(): ZodEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
2142
|
+
static create: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k in keyof baseObjectOutputType<T_1>]: baseObjectOutputType<T_1>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>;
|
|
2143
|
+
static strictCreate: <T_1 extends ZodRawShape>(shape: T_1, params?: RawCreateParams) => ZodObject<T_1, "strict", ZodTypeAny, { [k in keyof baseObjectOutputType<T_1>]: baseObjectOutputType<T_1>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>;
|
|
2144
|
+
static lazycreate: <T_1 extends ZodRawShape>(shape: () => T_1, params?: RawCreateParams) => ZodObject<T_1, "strip", ZodTypeAny, { [k in keyof baseObjectOutputType<T_1>]: baseObjectOutputType<T_1>[k]; }, { [k_2 in keyof objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>]: objectUtil.addQuestionMarks<{ [k_1 in keyof T_1]: T_1[k_1]["_input"]; }>[k_2]; }>;
|
|
2145
|
+
}
|
|
2146
|
+
declare type AnyZodObject = ZodObject<any, any, any>;
|
|
2147
|
+
declare type ZodUnionOptions = Readonly<[ZodTypeAny, ...ZodTypeAny[]]>;
|
|
2148
|
+
interface ZodUnionDef<T extends ZodUnionOptions = Readonly<[
|
|
2149
|
+
ZodTypeAny,
|
|
2150
|
+
ZodTypeAny,
|
|
2151
|
+
...ZodTypeAny[]
|
|
2152
|
+
]>> extends ZodTypeDef {
|
|
2153
|
+
options: T;
|
|
2154
|
+
typeName: ZodFirstPartyTypeKind.ZodUnion;
|
|
2155
|
+
}
|
|
2156
|
+
declare class ZodUnion<T extends ZodUnionOptions> extends ZodType<T[number]["_output"], ZodUnionDef<T>, T[number]["_input"]> {
|
|
2157
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2158
|
+
get options(): T;
|
|
2159
|
+
static create: <T_1 extends readonly [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]>(types: T_1, params?: RawCreateParams) => ZodUnion<T_1>;
|
|
2160
|
+
}
|
|
2161
|
+
interface ZodIntersectionDef<T extends ZodTypeAny = ZodTypeAny, U extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2162
|
+
left: T;
|
|
2163
|
+
right: U;
|
|
2164
|
+
typeName: ZodFirstPartyTypeKind.ZodIntersection;
|
|
2165
|
+
}
|
|
2166
|
+
declare class ZodIntersection<T extends ZodTypeAny, U extends ZodTypeAny> extends ZodType<T["_output"] & U["_output"], ZodIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
2167
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2168
|
+
static create: <T_1 extends ZodTypeAny, U_1 extends ZodTypeAny>(left: T_1, right: U_1, params?: RawCreateParams) => ZodIntersection<T_1, U_1>;
|
|
2169
|
+
}
|
|
2170
|
+
declare type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
2171
|
+
declare type AssertArray<T> = T extends any[] ? T : never;
|
|
2172
|
+
declare type OutputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
2173
|
+
[k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_output"] : never;
|
|
2174
|
+
}>;
|
|
2175
|
+
declare type OutputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
|
|
2176
|
+
declare type InputTypeOfTuple<T extends ZodTupleItems | []> = AssertArray<{
|
|
2177
|
+
[k in keyof T]: T[k] extends ZodType<any, any> ? T[k]["_input"] : never;
|
|
2178
|
+
}>;
|
|
2179
|
+
declare type InputTypeOfTupleWithRest<T extends ZodTupleItems | [], Rest extends ZodTypeAny | null = null> = Rest extends ZodTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
|
|
2180
|
+
interface ZodTupleDef<T extends ZodTupleItems | [] = ZodTupleItems, Rest extends ZodTypeAny | null = null> extends ZodTypeDef {
|
|
2181
|
+
items: T;
|
|
2182
|
+
rest: Rest;
|
|
2183
|
+
typeName: ZodFirstPartyTypeKind.ZodTuple;
|
|
2184
|
+
}
|
|
2185
|
+
declare type AnyZodTuple = ZodTuple<[
|
|
2186
|
+
ZodTypeAny,
|
|
2187
|
+
...ZodTypeAny[]
|
|
2188
|
+
] | [], ZodTypeAny | null>;
|
|
2189
|
+
declare class ZodTuple<T extends [ZodTypeAny, ...ZodTypeAny[]] | [] = [ZodTypeAny, ...ZodTypeAny[]], Rest extends ZodTypeAny | null = null> extends ZodType<OutputTypeOfTupleWithRest<T, Rest>, ZodTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
|
|
2190
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2191
|
+
get items(): T;
|
|
2192
|
+
rest<Rest extends ZodTypeAny>(rest: Rest): ZodTuple<T, Rest>;
|
|
2193
|
+
static create: <T_1 extends [] | [ZodTypeAny, ...ZodTypeAny[]]>(schemas: T_1, params?: RawCreateParams) => ZodTuple<T_1, null>;
|
|
2194
|
+
}
|
|
2195
|
+
interface ZodRecordDef<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2196
|
+
valueType: Value;
|
|
2197
|
+
keyType: Key;
|
|
2198
|
+
typeName: ZodFirstPartyTypeKind.ZodRecord;
|
|
2199
|
+
}
|
|
2200
|
+
declare type KeySchema = ZodType<string | number | symbol, any, any>;
|
|
2201
|
+
declare type RecordType<K extends string | number | symbol, V> = [
|
|
2202
|
+
string
|
|
2203
|
+
] extends [K] ? Record<K, V> : [number] extends [K] ? Record<K, V> : [symbol] extends [K] ? Record<K, V> : Partial<Record<K, V>>;
|
|
2204
|
+
declare class ZodRecord<Key extends KeySchema = ZodString, Value extends ZodTypeAny = ZodTypeAny> extends ZodType<RecordType<Key["_output"], Value["_output"]>, ZodRecordDef<Key, Value>, RecordType<Key["_input"], Value["_input"]>> {
|
|
2205
|
+
get keySchema(): Key;
|
|
2206
|
+
get valueSchema(): Value;
|
|
2207
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2208
|
+
get element(): Value;
|
|
2209
|
+
static create<Value extends ZodTypeAny>(valueType: Value, params?: RawCreateParams): ZodRecord<ZodString, Value>;
|
|
2210
|
+
static create<Keys extends KeySchema, Value extends ZodTypeAny>(keySchema: Keys, valueType: Value, params?: RawCreateParams): ZodRecord<Keys, Value>;
|
|
2211
|
+
}
|
|
2212
|
+
interface ZodFunctionDef<Args extends ZodTuple<any, any> = ZodTuple<any, any>, Returns extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2213
|
+
args: Args;
|
|
2214
|
+
returns: Returns;
|
|
2215
|
+
typeName: ZodFirstPartyTypeKind.ZodFunction;
|
|
2216
|
+
}
|
|
2217
|
+
declare type OuterTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
|
|
2218
|
+
declare type InnerTypeOfFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
|
|
2219
|
+
declare class ZodFunction<Args extends ZodTuple<any, any>, Returns extends ZodTypeAny> extends ZodType<OuterTypeOfFunction<Args, Returns>, ZodFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
|
|
2220
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
2221
|
+
parameters(): Args;
|
|
2222
|
+
returnType(): Returns;
|
|
2223
|
+
args<Items extends Parameters<typeof ZodTuple["create"]>[0]>(...items: Items): ZodFunction<ZodTuple<Items, ZodUnknown>, Returns>;
|
|
2224
|
+
returns<NewReturnType extends ZodType<any, any>>(returnType: NewReturnType): ZodFunction<Args, NewReturnType>;
|
|
2225
|
+
implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
2226
|
+
strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
|
|
2227
|
+
validate: <F extends InnerTypeOfFunction<Args, Returns>>(func: F) => ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
2228
|
+
static create(): ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>;
|
|
2229
|
+
static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>>(args: T): ZodFunction<T, ZodUnknown>;
|
|
2230
|
+
static create<T extends AnyZodTuple, U extends ZodTypeAny>(args: T, returns: U): ZodFunction<T, U>;
|
|
2231
|
+
static create<T extends AnyZodTuple = ZodTuple<[], ZodUnknown>, U extends ZodTypeAny = ZodUnknown>(args: T, returns: U, params?: RawCreateParams): ZodFunction<T, U>;
|
|
2232
|
+
}
|
|
2233
|
+
declare type EnumValues = [string, ...string[]];
|
|
2234
|
+
declare type Values<T extends EnumValues> = {
|
|
2235
|
+
[k in T[number]]: k;
|
|
2317
2236
|
};
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
transTime: string;
|
|
2325
|
-
createdAt: string;
|
|
2326
|
-
path?: string;
|
|
2327
|
-
method: string;
|
|
2328
|
-
isCustom: boolean;
|
|
2237
|
+
interface ZodEnumDef<T extends EnumValues = EnumValues> extends ZodTypeDef {
|
|
2238
|
+
values: T;
|
|
2239
|
+
typeName: ZodFirstPartyTypeKind.ZodEnum;
|
|
2240
|
+
}
|
|
2241
|
+
declare type Writeable<T> = {
|
|
2242
|
+
-readonly [P in keyof T]: T[P];
|
|
2329
2243
|
};
|
|
2330
|
-
type
|
|
2331
|
-
|
|
2244
|
+
declare type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
|
|
2245
|
+
declare type typecast<A, T> = A extends T ? A : never;
|
|
2246
|
+
declare function createZodEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): ZodEnum<Writeable<T>>;
|
|
2247
|
+
declare function createZodEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): ZodEnum<T>;
|
|
2248
|
+
declare class ZodEnum<T extends [string, ...string[]]> extends ZodType<T[number], ZodEnumDef<T>> {
|
|
2249
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2250
|
+
get options(): T;
|
|
2251
|
+
get enum(): Values<T>;
|
|
2252
|
+
get Values(): Values<T>;
|
|
2253
|
+
get Enum(): Values<T>;
|
|
2254
|
+
extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract): ZodEnum<Writeable<ToExtract>>;
|
|
2255
|
+
exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude): ZodEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
|
|
2256
|
+
static create: typeof createZodEnum;
|
|
2257
|
+
}
|
|
2258
|
+
interface ZodPromiseDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2259
|
+
type: T;
|
|
2260
|
+
typeName: ZodFirstPartyTypeKind.ZodPromise;
|
|
2261
|
+
}
|
|
2262
|
+
declare class ZodPromise<T extends ZodTypeAny> extends ZodType<Promise<T["_output"]>, ZodPromiseDef<T>, Promise<T["_input"]>> {
|
|
2263
|
+
unwrap(): T;
|
|
2264
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2265
|
+
static create: <T_1 extends ZodTypeAny>(schema: T_1, params?: RawCreateParams) => ZodPromise<T_1>;
|
|
2266
|
+
}
|
|
2267
|
+
declare type RefinementEffect<T> = {
|
|
2268
|
+
type: "refinement";
|
|
2269
|
+
refinement: (arg: T, ctx: RefinementCtx) => any;
|
|
2332
2270
|
};
|
|
2333
|
-
type
|
|
2334
|
-
type
|
|
2335
|
-
|
|
2336
|
-
}>;
|
|
2337
|
-
type GetSettingReturn = {
|
|
2338
|
-
/**
|
|
2339
|
-
* Thông tin cấp quyền, tham khảo bảng Scopes.
|
|
2340
|
-
*
|
|
2341
|
-
* | Scope | Corresponding APIs | Description |
|
|
2342
|
-
* | --------------------- | --------------------- | ------------------------------- |
|
|
2343
|
-
* | scope.userInfo | `getUserInfo` | Thông tin user (tên, avatar...) |
|
|
2344
|
-
* | scope.userLocation | `getLocation` | Thông tin vị trí user |
|
|
2345
|
-
* | scope.userPhonenumber | `getPhoneNumber` | Số điện thoại |
|
|
2346
|
-
* | scope.camera | `createCameraContext` | Camera |
|
|
2347
|
-
* | scope.micro | `createCameraContext` | Micro |
|
|
2348
|
-
*
|
|
2349
|
-
* Với các scope có giá trị trả về là `true`, tương ứng với việc người dùng đã cấp quyền sử dụng API trước đó, Mini Apps có thể truy xuất thông tin một cách trực tiếp.
|
|
2350
|
-
*/
|
|
2351
|
-
authSetting: AuthorizeType<(typeof GET_SETTINGS_SCOPE_VALUES)[number]>;
|
|
2271
|
+
declare type TransformEffect<T> = {
|
|
2272
|
+
type: "transform";
|
|
2273
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
2352
2274
|
};
|
|
2353
|
-
type
|
|
2354
|
-
|
|
2275
|
+
declare type PreprocessEffect<T> = {
|
|
2276
|
+
type: "preprocess";
|
|
2277
|
+
transform: (arg: T) => any;
|
|
2355
2278
|
};
|
|
2279
|
+
declare type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
2280
|
+
interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2281
|
+
schema: T;
|
|
2282
|
+
typeName: ZodFirstPartyTypeKind.ZodEffects;
|
|
2283
|
+
effect: Effect<any>;
|
|
2284
|
+
}
|
|
2285
|
+
declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input<T>> extends ZodType<Output, ZodEffectsDef<T>, Input> {
|
|
2286
|
+
innerType(): T;
|
|
2287
|
+
sourceType(): T;
|
|
2288
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2289
|
+
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], input<I>>;
|
|
2290
|
+
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
2291
|
+
}
|
|
2356
2292
|
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
OnStopCallback = "h5.event.camera.stop"
|
|
2293
|
+
interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2294
|
+
innerType: T;
|
|
2295
|
+
typeName: ZodFirstPartyTypeKind.ZodOptional;
|
|
2361
2296
|
}
|
|
2362
|
-
declare
|
|
2363
|
-
|
|
2364
|
-
|
|
2297
|
+
declare class ZodOptional<T extends ZodTypeAny> extends ZodType<T["_output"] | undefined, ZodOptionalDef<T>, T["_input"] | undefined> {
|
|
2298
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2299
|
+
unwrap(): T;
|
|
2300
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodOptional<T_1>;
|
|
2365
2301
|
}
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
JPEG = "image/jpeg"
|
|
2302
|
+
interface ZodNullableDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2303
|
+
innerType: T;
|
|
2304
|
+
typeName: ZodFirstPartyTypeKind.ZodNullable;
|
|
2370
2305
|
}
|
|
2371
|
-
declare
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2306
|
+
declare class ZodNullable<T extends ZodTypeAny> extends ZodType<T["_output"] | null, ZodNullableDef<T>, T["_input"] | null> {
|
|
2307
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2308
|
+
unwrap(): T;
|
|
2309
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodNullable<T_1>;
|
|
2375
2310
|
}
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2311
|
+
interface ZodDefaultDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
2312
|
+
innerType: T;
|
|
2313
|
+
defaultValue: () => util.noUndefined<T["_input"]>;
|
|
2314
|
+
typeName: ZodFirstPartyTypeKind.ZodDefault;
|
|
2379
2315
|
}
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2316
|
+
declare class ZodDefault<T extends ZodTypeAny> extends ZodType<util.noUndefined<T["_output"]>, ZodDefaultDef<T>, T["_input"] | undefined> {
|
|
2317
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2318
|
+
removeDefault(): T;
|
|
2319
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
|
|
2320
|
+
errorMap?: ZodErrorMap | undefined;
|
|
2321
|
+
invalid_type_error?: string | undefined;
|
|
2322
|
+
required_error?: string | undefined;
|
|
2323
|
+
description?: string | undefined;
|
|
2324
|
+
} & {
|
|
2325
|
+
default: T_1["_input"] | (() => util.noUndefined<T_1["_input"]>);
|
|
2326
|
+
}) => ZodDefault<T_1>;
|
|
2327
|
+
}
|
|
2328
|
+
interface ZodCatchDef<T extends ZodTypeAny = ZodTypeAny, C extends T["_input"] = T["_input"]> extends ZodTypeDef {
|
|
2329
|
+
innerType: T;
|
|
2330
|
+
catchValue: () => C;
|
|
2331
|
+
typeName: ZodFirstPartyTypeKind.ZodCatch;
|
|
2332
|
+
}
|
|
2333
|
+
declare class ZodCatch<T extends ZodTypeAny> extends ZodType<T["_output"], ZodCatchDef<T>, unknown> {
|
|
2334
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
2335
|
+
removeCatch(): T;
|
|
2336
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params: {
|
|
2337
|
+
errorMap?: ZodErrorMap | undefined;
|
|
2338
|
+
invalid_type_error?: string | undefined;
|
|
2339
|
+
required_error?: string | undefined;
|
|
2340
|
+
description?: string | undefined;
|
|
2341
|
+
} & {
|
|
2342
|
+
catch: T_1["_output"] | (() => T_1["_output"]);
|
|
2343
|
+
}) => ZodCatch<T_1>;
|
|
2344
|
+
}
|
|
2345
|
+
interface ZodBrandedDef<T extends ZodTypeAny> extends ZodTypeDef {
|
|
2346
|
+
type: T;
|
|
2347
|
+
typeName: ZodFirstPartyTypeKind.ZodBranded;
|
|
2348
|
+
}
|
|
2349
|
+
declare const BRAND: unique symbol;
|
|
2350
|
+
declare type BRAND<T extends string | number | symbol> = {
|
|
2351
|
+
[BRAND]: {
|
|
2352
|
+
[k in T]: true;
|
|
2353
|
+
};
|
|
2408
2354
|
};
|
|
2355
|
+
declare class ZodBranded<T extends ZodTypeAny, B extends string | number | symbol> extends ZodType<T["_output"] & BRAND<B>, ZodBrandedDef<T>, T["_input"]> {
|
|
2356
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
2357
|
+
unwrap(): T;
|
|
2358
|
+
}
|
|
2359
|
+
interface ZodPipelineDef<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodTypeDef {
|
|
2360
|
+
in: A;
|
|
2361
|
+
out: B;
|
|
2362
|
+
typeName: ZodFirstPartyTypeKind.ZodPipeline;
|
|
2363
|
+
}
|
|
2364
|
+
declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends ZodType<B["_output"], ZodPipelineDef<A, B>, A["_input"]> {
|
|
2365
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
2366
|
+
static create<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
|
|
2367
|
+
}
|
|
2368
|
+
declare enum ZodFirstPartyTypeKind {
|
|
2369
|
+
ZodString = "ZodString",
|
|
2370
|
+
ZodNumber = "ZodNumber",
|
|
2371
|
+
ZodNaN = "ZodNaN",
|
|
2372
|
+
ZodBigInt = "ZodBigInt",
|
|
2373
|
+
ZodBoolean = "ZodBoolean",
|
|
2374
|
+
ZodDate = "ZodDate",
|
|
2375
|
+
ZodSymbol = "ZodSymbol",
|
|
2376
|
+
ZodUndefined = "ZodUndefined",
|
|
2377
|
+
ZodNull = "ZodNull",
|
|
2378
|
+
ZodAny = "ZodAny",
|
|
2379
|
+
ZodUnknown = "ZodUnknown",
|
|
2380
|
+
ZodNever = "ZodNever",
|
|
2381
|
+
ZodVoid = "ZodVoid",
|
|
2382
|
+
ZodArray = "ZodArray",
|
|
2383
|
+
ZodObject = "ZodObject",
|
|
2384
|
+
ZodUnion = "ZodUnion",
|
|
2385
|
+
ZodDiscriminatedUnion = "ZodDiscriminatedUnion",
|
|
2386
|
+
ZodIntersection = "ZodIntersection",
|
|
2387
|
+
ZodTuple = "ZodTuple",
|
|
2388
|
+
ZodRecord = "ZodRecord",
|
|
2389
|
+
ZodMap = "ZodMap",
|
|
2390
|
+
ZodSet = "ZodSet",
|
|
2391
|
+
ZodFunction = "ZodFunction",
|
|
2392
|
+
ZodLazy = "ZodLazy",
|
|
2393
|
+
ZodLiteral = "ZodLiteral",
|
|
2394
|
+
ZodEnum = "ZodEnum",
|
|
2395
|
+
ZodEffects = "ZodEffects",
|
|
2396
|
+
ZodNativeEnum = "ZodNativeEnum",
|
|
2397
|
+
ZodOptional = "ZodOptional",
|
|
2398
|
+
ZodNullable = "ZodNullable",
|
|
2399
|
+
ZodDefault = "ZodDefault",
|
|
2400
|
+
ZodCatch = "ZodCatch",
|
|
2401
|
+
ZodPromise = "ZodPromise",
|
|
2402
|
+
ZodBranded = "ZodBranded",
|
|
2403
|
+
ZodPipeline = "ZodPipeline"
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
declare const purchaseArgs$1: ZodObject<{
|
|
2407
|
+
amount: ZodUnion<[ZodString, ZodNumber]>;
|
|
2408
|
+
desc: ZodString;
|
|
2409
|
+
payload: ZodOptional<ZodObject<{}, "strip", ZodAny, {
|
|
2410
|
+
[x: string]: any;
|
|
2411
|
+
}, {
|
|
2412
|
+
[x: string]: any;
|
|
2413
|
+
}>>;
|
|
2414
|
+
}, "strip", ZodAny, {
|
|
2415
|
+
[x: string]: any;
|
|
2416
|
+
payload?: {
|
|
2417
|
+
[x: string]: any;
|
|
2418
|
+
} | undefined;
|
|
2419
|
+
desc: string;
|
|
2420
|
+
amount: string | number;
|
|
2421
|
+
}, {
|
|
2422
|
+
[x: string]: any;
|
|
2423
|
+
payload?: {
|
|
2424
|
+
[x: string]: any;
|
|
2425
|
+
} | undefined;
|
|
2426
|
+
desc: string;
|
|
2427
|
+
amount: string | number;
|
|
2428
|
+
}>[];
|
|
2429
|
+
/**
|
|
2430
|
+
* ...Implementation of the Checkout Kit Widget Purchase...
|
|
2431
|
+
*
|
|
2432
|
+
* @minimumVersion 2.47.0
|
|
2433
|
+
* @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile.
|
|
2434
|
+
*
|
|
2435
|
+
* @param {string | number} amount - Số tiền cần thanh toán. Có thể là chuỗi hoặc số.
|
|
2436
|
+
* @param {string} desc - Mô tả giao dịch thanh toán.
|
|
2437
|
+
* @param {object} [payload] - Dữ liệu tuỳ chỉnh đi kèm với giao dịch thanh toán. Đây có thể là bất kỳ dữ liệu nào bạn muốn gửi kèm theo giao dịch, ví dụ như thông tin đơn hàng, mã khuyến mãi, v.v.
|
|
2438
|
+
*
|
|
2439
|
+
* @example Hiển thị Widget Checkout Kit và thực hiện thanh toán:
|
|
2440
|
+
* ```ts
|
|
2441
|
+
* import React, { useEffect } from "react";
|
|
2442
|
+
* import { CheckoutKit } from "zmp-sdk/apis";
|
|
2443
|
+
*
|
|
2444
|
+
* function HomePage() {
|
|
2445
|
+
* const handlePurchase = async () => {
|
|
2446
|
+
* try {
|
|
2447
|
+
* const result = await CheckoutKit.purchase({
|
|
2448
|
+
* amount: 10000,
|
|
2449
|
+
* desc: "Thanh toán đơn hàng #12345",
|
|
2450
|
+
* payload: {
|
|
2451
|
+
* orderId: "12345",
|
|
2452
|
+
* },
|
|
2453
|
+
* });
|
|
2454
|
+
* console.log("Thanh toán thành công:", result);
|
|
2455
|
+
* } catch (error) {
|
|
2456
|
+
* console.error("Lỗi thanh toán:", error);
|
|
2457
|
+
* }
|
|
2458
|
+
* };
|
|
2459
|
+
*
|
|
2460
|
+
* useEffect(() => {
|
|
2461
|
+
* CheckoutKit.showWidget({
|
|
2462
|
+
* id: "checkoutKitWidget",
|
|
2463
|
+
* onMethodChange: (data) => {
|
|
2464
|
+
* console.log(data);
|
|
2465
|
+
* },
|
|
2466
|
+
* });
|
|
2467
|
+
* }, []);
|
|
2468
|
+
*
|
|
2469
|
+
* return (
|
|
2470
|
+
* <>
|
|
2471
|
+
* ...
|
|
2472
|
+
* <div id="checkoutKitWidget" />
|
|
2473
|
+
* <button onClick={handlePurchase}>Thanh toán</button>
|
|
2474
|
+
* ...
|
|
2475
|
+
* </>
|
|
2476
|
+
* );
|
|
2477
|
+
* }
|
|
2478
|
+
*
|
|
2479
|
+
* export default HomePage;
|
|
2480
|
+
* ```
|
|
2481
|
+
*/
|
|
2482
|
+
declare function purchase$1(args: AsyncCallback<CreateOrderReturns> & TypeOf<(typeof purchaseArgs$1)[0]>): Promise<CreateOrderReturns>;
|
|
2483
|
+
|
|
2484
|
+
declare const showWidgetArgs: ZodObject<{
|
|
2485
|
+
id: ZodString;
|
|
2486
|
+
onMethodChange: ZodOptional<ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>>;
|
|
2487
|
+
}, "strip", ZodAny, {
|
|
2488
|
+
[x: string]: any;
|
|
2489
|
+
onMethodChange?: ((...args: unknown[]) => unknown) | undefined;
|
|
2490
|
+
id: string;
|
|
2491
|
+
}, {
|
|
2492
|
+
[x: string]: any;
|
|
2493
|
+
onMethodChange?: ((...args: unknown[]) => unknown) | undefined;
|
|
2494
|
+
id: string;
|
|
2495
|
+
}>[];
|
|
2496
|
+
/**
|
|
2497
|
+
* ...Implementation of the Checkout Kit Widget...
|
|
2498
|
+
*
|
|
2499
|
+
* @minimumVersion 2.47.0
|
|
2500
|
+
* @zaloOnly Chỉ hoạt động khi chạy bên trong ứng dụng Zalo mobile.
|
|
2501
|
+
*
|
|
2502
|
+
* @param {string} id - ID của element, nơi cần hiển thị widget.
|
|
2503
|
+
* @param {(data: any) => void} [onMethodChange] - Callback được gọi khi phương thức thanh toán được thay đổi. Callback này nhận vào dữ liệu liên quan đến phương thức thanh toán đã chọn.
|
|
2504
|
+
* @param {(error: string) => void} [fail] - Callback được gọi khi có lỗi xảy ra trong quá trình tương tác với widget. Callback này nhận vào thông tin về lỗi.
|
|
2505
|
+
*
|
|
2506
|
+
* @example Hiển thị Widget Checkout Kit:
|
|
2507
|
+
* ```ts
|
|
2508
|
+
* import React, { useEffect } from "react";
|
|
2509
|
+
* import { CheckoutKit } from "zmp-sdk/apis";
|
|
2510
|
+
*
|
|
2511
|
+
* function HomePage() {
|
|
2512
|
+
* useEffect(() => {
|
|
2513
|
+
* CheckoutKit.showWidget({
|
|
2514
|
+
* id: "checkoutKitWidget",
|
|
2515
|
+
* onMethodChange: (data) => {
|
|
2516
|
+
* console.log(data);
|
|
2517
|
+
* },
|
|
2518
|
+
* });
|
|
2519
|
+
* }, []);
|
|
2520
|
+
*
|
|
2521
|
+
* return (
|
|
2522
|
+
* <>
|
|
2523
|
+
* ...
|
|
2524
|
+
* <div id="checkoutKitWidget" />
|
|
2525
|
+
* ...
|
|
2526
|
+
* </>
|
|
2527
|
+
* );
|
|
2528
|
+
* }
|
|
2529
|
+
*
|
|
2530
|
+
* export default HomePage;
|
|
2531
|
+
* ```
|
|
2532
|
+
*/
|
|
2533
|
+
declare function showWidget(args: AsyncVoidCallback$1 & TypeOf<(typeof showWidgetArgs)[0]>): Promise<void>;
|
|
2534
|
+
|
|
2535
|
+
declare const eventTypeType: ZodEnum<["APP_INITIALIZING", "APP_READY"]>;
|
|
2536
|
+
declare const payloadType: ZodAny;
|
|
2537
|
+
declare function logEvent(eventType: TypeOf<typeof eventTypeType>, payload: TypeOf<typeof payloadType>): void;
|
|
2409
2538
|
|
|
2410
2539
|
/**
|
|
2411
2540
|
* Lấy thông tin của cache theo cơ chế đồng bộ.
|
|
@@ -5444,7 +5573,7 @@ declare const showOAWidgetArgs: ZodObject<{
|
|
|
5444
5573
|
* export default HomePage;
|
|
5445
5574
|
* ```
|
|
5446
5575
|
*/
|
|
5447
|
-
declare function showOAWidget(args: AsyncVoidCallback & TypeOf<(typeof showOAWidgetArgs)[0]>): Promise<void>;
|
|
5576
|
+
declare function showOAWidget(args: AsyncVoidCallback$1 & TypeOf<(typeof showOAWidgetArgs)[0]>): Promise<void>;
|
|
5448
5577
|
|
|
5449
5578
|
declare const showFunctionButtonWidgetArgs: ZodObject<{
|
|
5450
5579
|
id: ZodString;
|
|
@@ -5740,6 +5869,11 @@ declare const showCustomOAWidgetArgs: ZodObject<{
|
|
|
5740
5869
|
*/
|
|
5741
5870
|
declare function showCustomOAWidget(args: AsyncVoidCallback & TypeOf<(typeof showCustomOAWidgetArgs)[0]>): Promise<void>;
|
|
5742
5871
|
|
|
5872
|
+
declare const CheckoutKit: {
|
|
5873
|
+
showWidget: typeof showWidget;
|
|
5874
|
+
purchase: typeof purchase$1;
|
|
5875
|
+
};
|
|
5876
|
+
|
|
5743
5877
|
declare class AppError {
|
|
5744
5878
|
code: number;
|
|
5745
5879
|
message: string | string[];
|
|
@@ -5875,6 +6009,10 @@ declare const otherApis: {
|
|
|
5875
6009
|
logEvent: typeof logEvent;
|
|
5876
6010
|
};
|
|
5877
6011
|
showCustomOAWidget: typeof showCustomOAWidget;
|
|
6012
|
+
CheckoutKit: {
|
|
6013
|
+
showWidget: typeof showWidget;
|
|
6014
|
+
purchase: typeof purchase$1;
|
|
6015
|
+
};
|
|
5878
6016
|
FacingMode: typeof FacingMode;
|
|
5879
6017
|
PhotoFormat: typeof PhotoFormat;
|
|
5880
6018
|
PhotoQuality: typeof PhotoQuality;
|
|
@@ -5882,4 +6020,4 @@ declare const otherApis: {
|
|
|
5882
6020
|
ZMACameraImp: typeof ZMACameraImp;
|
|
5883
6021
|
};
|
|
5884
6022
|
|
|
5885
|
-
export { Action, AndroidBottomNavigationBarType, AppError, AsyncCallback, AsyncCallbackFailObject, AsyncProgressCallback, AsyncVoidCallback, AuthorizeType, CameraEvents, CameraParams, ChatType, CheckStateBioAuthenticationReturns, CheckTransactionReturns, CheckZaloCameraPermissionReturns, CheckoutSDK, ChooseImageReturns, Common, ContextInfo, CreateOrderIAPReturns, CreateOrderReturns, Events as EventName, Events, FacingMode, FunctionProps, GetAppInfoReturns, GetAuthCodeReturns, GetBeaconDiscoveryReturns, GetLocationReturns, GetNetworkTypeReturns, GetPhoneNumberReturns, GetSettingReturn, GetStorageReturns, GetUserInfoReturns, GetZPITokenReturns, IAPMethodType, IAPPayType, IAPPayTypeType, IOSSafeAreaBottomType, JumpStatus, KeepScreenReturns, LogData, MediaConstraints, MediaDevice, MediaPickerType, NativeCallBackData, NetworkType, OpenBioAuthenticationReturns, OpenMediaPickerReturns, OpenPostFeedReturns, OpenProfilePickerReturns, OpenShareSheetReturns, OpenWebviewReturns, OrientationType, Payment, PhotoConstraint, PhotoFormat, PhotoFrame, PhotoQuality, PickAttr, PickedProfile, PlatformType, PostFeedType, ProfileInfo, ProfileType, ProrationMode, ProrationModeType, RemoveStorageReturns, RequestCameraPermissionReturns, SaveFileReturns, ScanNFCType, ScanQRCodeReturns, SelectPaymentMethodReturns, SetStorageReturns, ShareSheetType, StatusBarType, StorageInfo, StreamType, SystemInfo, TempFile, TextAlignType, UserInfo, VibrateType, ZMACamera, ZMACameraImp, addRating, authorize, checkNFC, checkStateBioAuthentication, checkTransaction, checkZaloCameraPermission, chooseImage, clearStorage, closeApp, closeLoading, configAppView, connectWifi, createCameraContext, createOrder, createOrderIAP, createShortcut, otherApis as default, displayAd, downloadFile, events, favoriteApp, followOA, getAccessToken, getAppInfo, getAuthCode, getBeacons, getContext, getContextAsync, getDeviceId, getDeviceIdAsync, getIDToken, getLocation, getNetworkType, getPhoneNumber, getRouteParams, getSetting, getShareableLink, getStorage, getStorageInfo, getSystemInfo, getUserID, getUserInfo, getVersion, getZPIToken, hideKeyboard, iBeaconInfo, interactOA, interactOA as interactOa, checkIsAllowedInteractWithOA as isAllowedInteractWithOA, keepScreen, loadAd, login, minimizeApp, nativeStorage, offConfirmToExit, offKeepScreen, onCallbackData, onConfirmToExit, onKeepScreen, onNetworkStatusChange, openBioAuthentication, openChat, openGroupList, openMediaPicker, openMiniApp, openOutApp, openPermissionSetting, openPhone, openPostFeed, openProfile, openProfilePicker, openSMS, openShareSheet, openWebview, purchase, refreshAd, removeStorage, requestCameraPermission, requestSendNotification, requestUpdateZalo, saveImageToGallery, saveVideoToGallery, scanNFC, scanQRCode, selectPaymentMethod, sendDataToPreviousMiniApp, setAccessToken, setAndroidBottomNavigationBar, setIOSBottomSafeArea, setNavigationBarColor, setNavigationBarLeftButton, setNavigationBarTitle, setStatusBar, setStorage, setupAd, showCustomOAWidget, showFunctionButtonWidget, showOAWidget, showToast, startBeaconDiscovery, stopBeaconDiscovery, trackingManager, unfollowOA, vibrate, viewOAQr };
|
|
6023
|
+
export { Action, AndroidBottomNavigationBarType, AppError, AsyncCallback, AsyncCallbackFailObject, AsyncProgressCallback, AsyncVoidCallback, AuthorizeType, CameraEvents, CameraParams, ChatType, CheckStateBioAuthenticationReturns, CheckTransactionReturns, CheckZaloCameraPermissionReturns, CheckoutKit, CheckoutSDK, ChooseImageReturns, Common, ContextInfo, CreateOrderIAPReturns, CreateOrderReturns, Events as EventName, Events, FacingMode, FunctionProps, GetAppInfoReturns, GetAuthCodeReturns, GetBeaconDiscoveryReturns, GetLocationReturns, GetNetworkTypeReturns, GetPhoneNumberReturns, GetSettingReturn, GetStorageReturns, GetUserInfoReturns, GetZPITokenReturns, IAPMethodType, IAPPayType, IAPPayTypeType, IOSSafeAreaBottomType, JumpStatus, KeepScreenReturns, LogData, MediaConstraints, MediaDevice, MediaPickerType, NativeCallBackData, NetworkType, OpenBioAuthenticationReturns, OpenMediaPickerReturns, OpenPostFeedReturns, OpenProfilePickerReturns, OpenShareSheetReturns, OpenWebviewReturns, OrientationType, Payment, PhotoConstraint, PhotoFormat, PhotoFrame, PhotoQuality, PickAttr, PickedProfile, PlatformType, PostFeedType, ProfileInfo, ProfileType, ProrationMode, ProrationModeType, RemoveStorageReturns, RequestCameraPermissionReturns, SaveFileReturns, ScanNFCType, ScanQRCodeReturns, SelectPaymentMethodReturns, SetStorageReturns, ShareSheetType, StatusBarType, StorageInfo, StreamType, SystemInfo, TempFile, TextAlignType, UserInfo, VibrateType, ZMACamera, ZMACameraImp, addRating, authorize, checkNFC, checkStateBioAuthentication, checkTransaction, checkZaloCameraPermission, chooseImage, clearStorage, closeApp, closeLoading, configAppView, connectWifi, createCameraContext, createOrder, createOrderIAP, createShortcut, otherApis as default, displayAd, downloadFile, events, favoriteApp, followOA, getAccessToken, getAppInfo, getAuthCode, getBeacons, getContext, getContextAsync, getDeviceId, getDeviceIdAsync, getIDToken, getLocation, getNetworkType, getPhoneNumber, getRouteParams, getSetting, getShareableLink, getStorage, getStorageInfo, getSystemInfo, getUserID, getUserInfo, getVersion, getZPIToken, hideKeyboard, iBeaconInfo, interactOA, interactOA as interactOa, checkIsAllowedInteractWithOA as isAllowedInteractWithOA, keepScreen, loadAd, login, minimizeApp, nativeStorage, offConfirmToExit, offKeepScreen, onCallbackData, onConfirmToExit, onKeepScreen, onNetworkStatusChange, openBioAuthentication, openChat, openGroupList, openMediaPicker, openMiniApp, openOutApp, openPermissionSetting, openPhone, openPostFeed, openProfile, openProfilePicker, openSMS, openShareSheet, openWebview, purchase, refreshAd, removeStorage, requestCameraPermission, requestSendNotification, requestUpdateZalo, saveImageToGallery, saveVideoToGallery, scanNFC, scanQRCode, selectPaymentMethod, sendDataToPreviousMiniApp, setAccessToken, setAndroidBottomNavigationBar, setIOSBottomSafeArea, setNavigationBarColor, setNavigationBarLeftButton, setNavigationBarTitle, setStatusBar, setStorage, setupAd, showCustomOAWidget, showFunctionButtonWidget, showOAWidget, showToast, startBeaconDiscovery, stopBeaconDiscovery, trackingManager, unfollowOA, vibrate, viewOAQr };
|