@coursebuilder/adapter-drizzle 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RMRO5TA7.js → chunk-22KIKVBY.js} +2 -2
- package/dist/chunk-4HDU7QIB.js +747 -0
- package/dist/{chunk-QM6AYTGN.js → chunk-6CBAFOL3.js} +5 -7
- package/dist/{chunk-NCDVIRG4.js → chunk-AIDEJDKJ.js} +5 -7
- package/dist/{chunk-34QNODEZ.js → chunk-BRGTUNY2.js} +5 -7
- package/dist/{chunk-VID6JINS.js → chunk-FRNVLW7N.js} +690 -330
- package/dist/{chunk-LLWSIKQV.js → chunk-GFUUJRX7.js} +1 -1
- package/dist/{chunk-WULUGMHP.js → chunk-H4MXNDWO.js} +5 -7
- package/dist/{chunk-JWWIIUV3.js → chunk-ICL7XZ2Y.js} +5 -7
- package/dist/{chunk-SBGLYMAH.js → chunk-JD4KFACE.js} +5 -7
- package/dist/{chunk-ZUKX3WXB.js → chunk-KI47TR7F.js} +5 -7
- package/dist/{chunk-FZHAOQVB.js → chunk-KVN3JV7C.js} +5 -7
- package/dist/{chunk-H7XEMCP4.js → chunk-MBQ3TMHH.js} +5 -7
- package/dist/chunk-PFN4YUQZ.js +47 -0
- package/dist/{chunk-ABVLEWR5.js → chunk-SFJM6FKE.js} +5 -7
- package/dist/{chunk-QRRP7Y2V.js → chunk-TA6VLEV5.js} +5 -7
- package/dist/{chunk-BZPXYS6A.js → chunk-TMQIGK3N.js} +5 -7
- package/dist/{chunk-VWMY6XV7.js → chunk-US2EXVMI.js} +5 -7
- package/dist/{chunk-KFQAWBFP.js → chunk-UY3DVPP3.js} +5 -7
- package/dist/{chunk-M5NL4CY4.js → chunk-VEFCDI73.js} +5 -7
- package/dist/{chunk-EFO2N6T7.js → chunk-VZABQCFH.js} +5 -7
- package/dist/index.d.ts +1 -31
- package/dist/index.js +21 -32
- package/dist/lib/mysql/index.cjs +1606 -1100
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.ts +4649 -745
- package/dist/lib/mysql/index.js +21 -117
- package/dist/lib/mysql/schemas/auth/accounts.cjs +125 -22
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.d.ts +180 -178
- package/dist/lib/mysql/schemas/auth/accounts.js +5 -1
- package/dist/lib/mysql/schemas/auth/permissions.cjs +108 -14
- package/dist/lib/mysql/schemas/auth/permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/permissions.d.ts +96 -94
- package/dist/lib/mysql/schemas/auth/permissions.js +5 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs +146 -13
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.d.ts +85 -82
- package/dist/lib/mysql/schemas/auth/role-permissions.js +5 -1
- package/dist/lib/mysql/schemas/auth/roles.cjs +110 -14
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.d.ts +96 -94
- package/dist/lib/mysql/schemas/auth/roles.js +5 -1
- package/dist/lib/mysql/schemas/auth/sessions.cjs +117 -10
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.d.ts +48 -46
- package/dist/lib/mysql/schemas/auth/sessions.js +6 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs +156 -15
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.d.ts +85 -82
- package/dist/lib/mysql/schemas/auth/user-permissions.js +5 -1
- package/dist/lib/mysql/schemas/auth/user-roles.cjs +152 -13
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.d.ts +85 -82
- package/dist/lib/mysql/schemas/auth/user-roles.js +5 -1
- package/dist/lib/mysql/schemas/auth/users.cjs +311 -14
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.d.ts +101 -94
- package/dist/lib/mysql/schemas/auth/users.js +5 -1
- package/dist/lib/mysql/schemas/auth/verification-tokens.cjs +4 -6
- package/dist/lib/mysql/schemas/auth/verification-tokens.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/verification-tokens.d.ts +55 -57
- package/dist/lib/mysql/schemas/auth/verification-tokens.js +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +163 -165
- package/dist/lib/mysql/schemas/commerce/coupon.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-account.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.ts +67 -69
- package/dist/lib/mysql/schemas/commerce/merchant-account.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-charge.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.ts +103 -105
- package/dist/lib/mysql/schemas/commerce/merchant-charge.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.ts +79 -81
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-customer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.ts +79 -81
- package/dist/lib/mysql/schemas/commerce/merchant-customer.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.ts +91 -93
- package/dist/lib/mysql/schemas/commerce/merchant-price.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.ts +79 -81
- package/dist/lib/mysql/schemas/commerce/merchant-product.js +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/merchant-session.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.ts +43 -45
- package/dist/lib/mysql/schemas/commerce/merchant-session.js +1 -1
- package/dist/lib/mysql/schemas/commerce/price.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.d.ts +91 -93
- package/dist/lib/mysql/schemas/commerce/price.js +1 -1
- package/dist/lib/mysql/schemas/commerce/product.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.d.ts +91 -93
- package/dist/lib/mysql/schemas/commerce/product.js +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.ts +127 -129
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +4 -6
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.d.ts +211 -213
- package/dist/lib/mysql/schemas/commerce/purchase.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs +4 -6
- package/dist/lib/mysql/schemas/communication/communication-channel.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-channel.d.ts +91 -93
- package/dist/lib/mysql/schemas/communication/communication-channel.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs +4 -6
- package/dist/lib/mysql/schemas/communication/communication-preference-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.ts +91 -93
- package/dist/lib/mysql/schemas/communication/communication-preference-types.js +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs +193 -20
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.ts +146 -142
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +5 -1
- package/dist/lib/mysql/schemas/content/content-contributions.cjs +202 -17
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.d.ts +110 -106
- package/dist/lib/mysql/schemas/content/content-contributions.js +5 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs +128 -18
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.ts +97 -94
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +5 -1
- package/dist/lib/mysql/schemas/content/content-resource.cjs +199 -18
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.ts +99 -94
- package/dist/lib/mysql/schemas/content/content-resource.js +5 -1
- package/dist/lib/mysql/schemas/content/contribution-types.cjs +113 -16
- package/dist/lib/mysql/schemas/content/contribution-types.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/contribution-types.d.ts +108 -106
- package/dist/lib/mysql/schemas/content/contribution-types.js +5 -1
- package/dist/lib/mysql/schemas/content/resource-progress.cjs +4 -6
- package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.d.ts +79 -81
- package/dist/lib/mysql/schemas/content/resource-progress.js +1 -1
- package/dist/lib/pg.d.ts +1 -1
- package/dist/lib/sqlite.cjs.map +1 -1
- package/dist/lib/sqlite.d.ts +45 -46
- package/dist/lib/sqlite.js +2 -2
- package/dist/lib/utils.cjs.map +1 -1
- package/dist/lib/utils.d.ts +1 -31
- package/dist/lib/utils.js +1 -1
- package/package.json +9 -5
- package/src/index.ts +1 -1
- package/src/lib/mysql/index.ts +115 -77
- package/src/lib/mysql/schemas/auth/accounts.ts +12 -3
- package/src/lib/mysql/schemas/auth/permissions.ts +10 -3
- package/src/lib/mysql/schemas/auth/role-permissions.ts +21 -3
- package/src/lib/mysql/schemas/auth/roles.ts +12 -3
- package/src/lib/mysql/schemas/auth/sessions.ts +12 -3
- package/src/lib/mysql/schemas/auth/user-permissions.ts +21 -3
- package/src/lib/mysql/schemas/auth/user-roles.ts +21 -3
- package/src/lib/mysql/schemas/auth/users.ts +27 -3
- package/src/lib/mysql/schemas/auth/verification-tokens.ts +2 -4
- package/src/lib/mysql/schemas/commerce/coupon.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-account.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-charge.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-coupon.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-customer.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-price.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-product.ts +2 -4
- package/src/lib/mysql/schemas/commerce/merchant-session.ts +2 -4
- package/src/lib/mysql/schemas/commerce/price.ts +2 -4
- package/src/lib/mysql/schemas/commerce/product.ts +2 -4
- package/src/lib/mysql/schemas/commerce/purchase-user-transfer.ts +2 -4
- package/src/lib/mysql/schemas/commerce/purchase.ts +2 -4
- package/src/lib/mysql/schemas/communication/communication-channel.ts +2 -4
- package/src/lib/mysql/schemas/communication/communication-preference-types.ts +20 -25
- package/src/lib/mysql/schemas/communication/communication-preferences.ts +30 -3
- package/src/lib/mysql/schemas/content/content-contributions.ts +31 -3
- package/src/lib/mysql/schemas/content/content-resource-resource.ts +23 -4
- package/src/lib/mysql/schemas/content/content-resource.ts +22 -4
- package/src/lib/mysql/schemas/content/contribution-types.ts +13 -3
- package/src/lib/mysql/schemas/content/resource-progress.ts +2 -4
- package/src/lib/utils.ts +1 -1
- package/dist/chunk-7Z72PW3G.js +0 -60
- package/dist/chunk-C2G2KMWQ.js +0 -48
- package/dist/chunk-GJZCLS2Y.js +0 -29
- package/dist/chunk-HHQK736S.js +0 -40
- package/dist/chunk-I4NIW2NF.js +0 -46
- package/dist/chunk-IHQ3ARH4.js +0 -44
- package/dist/chunk-KEJBPPZC.js +0 -45
- package/dist/chunk-L3XBKPYA.js +0 -47
- package/dist/chunk-MHZHMZ5C.js +0 -47
- package/dist/chunk-MOO56C62.js +0 -46
- package/dist/chunk-RLTOQRJB.js +0 -40
- package/dist/chunk-SWOTLIQI.js +0 -46
- package/dist/chunk-XM4CEU6B.js +0 -54
|
@@ -1,57 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getResourceProgressSchema
|
|
3
|
+
} from "./chunk-UY3DVPP3.js";
|
|
1
4
|
import {
|
|
2
5
|
getPurchaseUserTransferSchema
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VEFCDI73.js";
|
|
4
7
|
import {
|
|
5
8
|
getPurchaseSchema
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
getContentResourceResourceSchema
|
|
9
|
-
} from "./chunk-C2G2KMWQ.js";
|
|
10
|
-
import {
|
|
11
|
-
getContentResourceSchema
|
|
12
|
-
} from "./chunk-KEJBPPZC.js";
|
|
9
|
+
} from "./chunk-BRGTUNY2.js";
|
|
13
10
|
import {
|
|
14
11
|
getMerchantChargeSchema
|
|
15
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ICL7XZ2Y.js";
|
|
16
13
|
import {
|
|
17
14
|
getMerchantCouponSchema
|
|
18
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JD4KFACE.js";
|
|
19
16
|
import {
|
|
20
17
|
getMerchantCustomerSchema
|
|
21
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-MBQ3TMHH.js";
|
|
22
19
|
import {
|
|
23
20
|
getMerchantPriceSchema
|
|
24
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-KI47TR7F.js";
|
|
25
22
|
import {
|
|
26
23
|
getMerchantProductSchema
|
|
27
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-AIDEJDKJ.js";
|
|
28
25
|
import {
|
|
29
26
|
getMerchantSessionSchema
|
|
30
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-H4MXNDWO.js";
|
|
31
28
|
import {
|
|
32
29
|
getPriceSchema
|
|
33
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-TA6VLEV5.js";
|
|
34
31
|
import {
|
|
35
32
|
getProductSchema
|
|
36
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-US2EXVMI.js";
|
|
37
34
|
import {
|
|
35
|
+
getSessionRelationsSchema,
|
|
38
36
|
getSessionsSchema
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import {
|
|
41
|
-
getUsersSchema
|
|
42
|
-
} from "./chunk-L3XBKPYA.js";
|
|
37
|
+
} from "./chunk-PFN4YUQZ.js";
|
|
43
38
|
import {
|
|
44
39
|
getVerificationTokensSchema
|
|
45
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-TMQIGK3N.js";
|
|
46
41
|
import {
|
|
47
42
|
getCouponSchema
|
|
48
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-KVN3JV7C.js";
|
|
49
44
|
import {
|
|
50
45
|
getMerchantAccountSchema
|
|
51
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-VZABQCFH.js";
|
|
47
|
+
import {
|
|
48
|
+
getAccountsRelationsSchema,
|
|
49
|
+
getAccountsSchema,
|
|
50
|
+
getCommunicationPreferencesRelationsSchema,
|
|
51
|
+
getCommunicationPreferencesSchema,
|
|
52
|
+
getContentContributionRelationsSchema,
|
|
53
|
+
getContentContributionsSchema,
|
|
54
|
+
getContentResourceRelationsSchema,
|
|
55
|
+
getContentResourceResourceRelationsSchema,
|
|
56
|
+
getContentResourceResourceSchema,
|
|
57
|
+
getContentResourceSchema,
|
|
58
|
+
getContributionTypesRelationsSchema,
|
|
59
|
+
getContributionTypesSchema,
|
|
60
|
+
getPermissionsRelationsSchema,
|
|
61
|
+
getPermissionsSchema,
|
|
62
|
+
getRolePermissionsRelationsSchema,
|
|
63
|
+
getRolePermissionsSchema,
|
|
64
|
+
getRolesRelationsSchema,
|
|
65
|
+
getRolesSchema,
|
|
66
|
+
getUserPermissionsRelationsSchema,
|
|
67
|
+
getUserPermissionsSchema,
|
|
68
|
+
getUserRolesRelationsSchema,
|
|
69
|
+
getUserRolesSchema,
|
|
70
|
+
getUsersRelationsSchema,
|
|
71
|
+
getUsersSchema
|
|
72
|
+
} from "./chunk-4HDU7QIB.js";
|
|
73
|
+
import {
|
|
74
|
+
getCommunicationChannelSchema
|
|
75
|
+
} from "./chunk-6CBAFOL3.js";
|
|
52
76
|
import {
|
|
53
|
-
|
|
54
|
-
} from "./chunk-
|
|
77
|
+
getCommunicationPreferenceTypesSchema
|
|
78
|
+
} from "./chunk-SFJM6FKE.js";
|
|
55
79
|
import {
|
|
56
80
|
__name
|
|
57
81
|
} from "./chunk-VNI36MMC.js";
|
|
@@ -61,18 +85,27 @@ import { addSeconds, isAfter } from "date-fns";
|
|
|
61
85
|
import { and, eq, sql } from "drizzle-orm";
|
|
62
86
|
import { mysqlTable as defaultMySqlTableFn } from "drizzle-orm/mysql-core";
|
|
63
87
|
|
|
64
|
-
//
|
|
88
|
+
// ../core/dist/chunk-DFHEFTJZ.js
|
|
89
|
+
var __defProp = Object.defineProperty;
|
|
90
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp(target, "name", {
|
|
91
|
+
value,
|
|
92
|
+
configurable: true
|
|
93
|
+
}), "__name");
|
|
94
|
+
|
|
95
|
+
// ../core/dist/chunk-EK2ZQYRJ.js
|
|
65
96
|
var util;
|
|
66
97
|
(function(util2) {
|
|
67
98
|
util2.assertEqual = (val) => val;
|
|
68
99
|
function assertIs(_arg) {
|
|
69
100
|
}
|
|
70
101
|
__name(assertIs, "assertIs");
|
|
102
|
+
__name2(assertIs, "assertIs");
|
|
71
103
|
util2.assertIs = assertIs;
|
|
72
104
|
function assertNever(_x) {
|
|
73
105
|
throw new Error();
|
|
74
106
|
}
|
|
75
107
|
__name(assertNever, "assertNever");
|
|
108
|
+
__name2(assertNever, "assertNever");
|
|
76
109
|
util2.assertNever = assertNever;
|
|
77
110
|
util2.arrayToEnum = (items) => {
|
|
78
111
|
const obj = {};
|
|
@@ -115,6 +148,7 @@ var util;
|
|
|
115
148
|
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
116
149
|
}
|
|
117
150
|
__name(joinValues, "joinValues");
|
|
151
|
+
__name2(joinValues, "joinValues");
|
|
118
152
|
util2.joinValues = joinValues;
|
|
119
153
|
util2.jsonStringifyReplacer = (_, value) => {
|
|
120
154
|
if (typeof value === "bigint") {
|
|
@@ -129,7 +163,6 @@ var objectUtil;
|
|
|
129
163
|
return {
|
|
130
164
|
...first,
|
|
131
165
|
...second
|
|
132
|
-
// second overwrites first
|
|
133
166
|
};
|
|
134
167
|
};
|
|
135
168
|
})(objectUtil || (objectUtil = {}));
|
|
@@ -155,7 +188,7 @@ var ZodParsedType = util.arrayToEnum([
|
|
|
155
188
|
"map",
|
|
156
189
|
"set"
|
|
157
190
|
]);
|
|
158
|
-
var getParsedType = /* @__PURE__ */
|
|
191
|
+
var getParsedType = /* @__PURE__ */ __name2((data) => {
|
|
159
192
|
const t = typeof data;
|
|
160
193
|
switch (t) {
|
|
161
194
|
case "undefined":
|
|
@@ -214,19 +247,25 @@ var ZodIssueCode = util.arrayToEnum([
|
|
|
214
247
|
"not_multiple_of",
|
|
215
248
|
"not_finite"
|
|
216
249
|
]);
|
|
217
|
-
var quotelessJson = /* @__PURE__ */
|
|
250
|
+
var quotelessJson = /* @__PURE__ */ __name2((obj) => {
|
|
218
251
|
const json = JSON.stringify(obj, null, 2);
|
|
219
252
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
220
253
|
}, "quotelessJson");
|
|
221
|
-
var ZodError = class extends Error {
|
|
254
|
+
var ZodError = /* @__PURE__ */ __name(class extends Error {
|
|
222
255
|
constructor(issues) {
|
|
223
256
|
super();
|
|
224
257
|
this.issues = [];
|
|
225
258
|
this.addIssue = (sub) => {
|
|
226
|
-
this.issues = [
|
|
259
|
+
this.issues = [
|
|
260
|
+
...this.issues,
|
|
261
|
+
sub
|
|
262
|
+
];
|
|
227
263
|
};
|
|
228
264
|
this.addIssues = (subs = []) => {
|
|
229
|
-
this.issues = [
|
|
265
|
+
this.issues = [
|
|
266
|
+
...this.issues,
|
|
267
|
+
...subs
|
|
268
|
+
];
|
|
230
269
|
};
|
|
231
270
|
const actualProto = new.target.prototype;
|
|
232
271
|
if (Object.setPrototypeOf) {
|
|
@@ -244,8 +283,10 @@ var ZodError = class extends Error {
|
|
|
244
283
|
const mapper = _mapper || function(issue) {
|
|
245
284
|
return issue.message;
|
|
246
285
|
};
|
|
247
|
-
const fieldErrors = {
|
|
248
|
-
|
|
286
|
+
const fieldErrors = {
|
|
287
|
+
_errors: []
|
|
288
|
+
};
|
|
289
|
+
const processError = /* @__PURE__ */ __name2((error) => {
|
|
249
290
|
for (const issue of error.issues) {
|
|
250
291
|
if (issue.code === "invalid_union") {
|
|
251
292
|
issue.unionErrors.map(processError);
|
|
@@ -262,9 +303,13 @@ var ZodError = class extends Error {
|
|
|
262
303
|
const el = issue.path[i];
|
|
263
304
|
const terminal = i === issue.path.length - 1;
|
|
264
305
|
if (!terminal) {
|
|
265
|
-
curr[el] = curr[el] || {
|
|
306
|
+
curr[el] = curr[el] || {
|
|
307
|
+
_errors: []
|
|
308
|
+
};
|
|
266
309
|
} else {
|
|
267
|
-
curr[el] = curr[el] || {
|
|
310
|
+
curr[el] = curr[el] || {
|
|
311
|
+
_errors: []
|
|
312
|
+
};
|
|
268
313
|
curr[el]._errors.push(mapper(issue));
|
|
269
314
|
}
|
|
270
315
|
curr = curr[el];
|
|
@@ -296,18 +341,21 @@ var ZodError = class extends Error {
|
|
|
296
341
|
formErrors.push(mapper(sub));
|
|
297
342
|
}
|
|
298
343
|
}
|
|
299
|
-
return {
|
|
344
|
+
return {
|
|
345
|
+
formErrors,
|
|
346
|
+
fieldErrors
|
|
347
|
+
};
|
|
300
348
|
}
|
|
301
349
|
get formErrors() {
|
|
302
350
|
return this.flatten();
|
|
303
351
|
}
|
|
304
|
-
};
|
|
305
|
-
|
|
352
|
+
}, "ZodError");
|
|
353
|
+
__name2(ZodError, "ZodError");
|
|
306
354
|
ZodError.create = (issues) => {
|
|
307
355
|
const error = new ZodError(issues);
|
|
308
356
|
return error;
|
|
309
357
|
};
|
|
310
|
-
var errorMap = /* @__PURE__ */
|
|
358
|
+
var errorMap = /* @__PURE__ */ __name2((issue, _ctx) => {
|
|
311
359
|
let message;
|
|
312
360
|
switch (issue.code) {
|
|
313
361
|
case ZodIssueCode.invalid_type:
|
|
@@ -403,20 +451,27 @@ var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
|
|
|
403
451
|
message = _ctx.defaultError;
|
|
404
452
|
util.assertNever(issue);
|
|
405
453
|
}
|
|
406
|
-
return {
|
|
454
|
+
return {
|
|
455
|
+
message
|
|
456
|
+
};
|
|
407
457
|
}, "errorMap");
|
|
408
458
|
var overrideErrorMap = errorMap;
|
|
409
459
|
function setErrorMap(map) {
|
|
410
460
|
overrideErrorMap = map;
|
|
411
461
|
}
|
|
412
462
|
__name(setErrorMap, "setErrorMap");
|
|
463
|
+
__name2(setErrorMap, "setErrorMap");
|
|
413
464
|
function getErrorMap() {
|
|
414
465
|
return overrideErrorMap;
|
|
415
466
|
}
|
|
416
467
|
__name(getErrorMap, "getErrorMap");
|
|
417
|
-
|
|
468
|
+
__name2(getErrorMap, "getErrorMap");
|
|
469
|
+
var makeIssue = /* @__PURE__ */ __name2((params) => {
|
|
418
470
|
const { data, path, errorMaps, issueData } = params;
|
|
419
|
-
const fullPath = [
|
|
471
|
+
const fullPath = [
|
|
472
|
+
...path,
|
|
473
|
+
...issueData.path || []
|
|
474
|
+
];
|
|
420
475
|
const fullIssue = {
|
|
421
476
|
...issueData,
|
|
422
477
|
path: fullPath
|
|
@@ -424,7 +479,10 @@ var makeIssue = /* @__PURE__ */ __name((params) => {
|
|
|
424
479
|
let errorMessage = "";
|
|
425
480
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
426
481
|
for (const map of maps) {
|
|
427
|
-
errorMessage = map(fullIssue, {
|
|
482
|
+
errorMessage = map(fullIssue, {
|
|
483
|
+
data,
|
|
484
|
+
defaultError: errorMessage
|
|
485
|
+
}).message;
|
|
428
486
|
}
|
|
429
487
|
return {
|
|
430
488
|
...issueData,
|
|
@@ -443,13 +501,13 @@ function addIssueToContext(ctx, issueData) {
|
|
|
443
501
|
ctx.schemaErrorMap,
|
|
444
502
|
getErrorMap(),
|
|
445
503
|
errorMap
|
|
446
|
-
// then global default map
|
|
447
504
|
].filter((x) => !!x)
|
|
448
505
|
});
|
|
449
506
|
ctx.common.issues.push(issue);
|
|
450
507
|
}
|
|
451
508
|
__name(addIssueToContext, "addIssueToContext");
|
|
452
|
-
|
|
509
|
+
__name2(addIssueToContext, "addIssueToContext");
|
|
510
|
+
var ParseStatus = /* @__PURE__ */ __name(class {
|
|
453
511
|
constructor() {
|
|
454
512
|
this.value = "valid";
|
|
455
513
|
}
|
|
@@ -470,7 +528,10 @@ var ParseStatus = class {
|
|
|
470
528
|
status.dirty();
|
|
471
529
|
arrayValue.push(s.value);
|
|
472
530
|
}
|
|
473
|
-
return {
|
|
531
|
+
return {
|
|
532
|
+
status: status.value,
|
|
533
|
+
value: arrayValue
|
|
534
|
+
};
|
|
474
535
|
}
|
|
475
536
|
static async mergeObjectAsync(status, pairs) {
|
|
476
537
|
const syncPairs = [];
|
|
@@ -498,25 +559,36 @@ var ParseStatus = class {
|
|
|
498
559
|
finalObject[key.value] = value.value;
|
|
499
560
|
}
|
|
500
561
|
}
|
|
501
|
-
return {
|
|
562
|
+
return {
|
|
563
|
+
status: status.value,
|
|
564
|
+
value: finalObject
|
|
565
|
+
};
|
|
502
566
|
}
|
|
503
|
-
};
|
|
504
|
-
|
|
567
|
+
}, "ParseStatus");
|
|
568
|
+
__name2(ParseStatus, "ParseStatus");
|
|
505
569
|
var INVALID = Object.freeze({
|
|
506
570
|
status: "aborted"
|
|
507
571
|
});
|
|
508
|
-
var DIRTY = /* @__PURE__ */
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
var
|
|
513
|
-
|
|
572
|
+
var DIRTY = /* @__PURE__ */ __name2((value) => ({
|
|
573
|
+
status: "dirty",
|
|
574
|
+
value
|
|
575
|
+
}), "DIRTY");
|
|
576
|
+
var OK = /* @__PURE__ */ __name2((value) => ({
|
|
577
|
+
status: "valid",
|
|
578
|
+
value
|
|
579
|
+
}), "OK");
|
|
580
|
+
var isAborted = /* @__PURE__ */ __name2((x) => x.status === "aborted", "isAborted");
|
|
581
|
+
var isDirty = /* @__PURE__ */ __name2((x) => x.status === "dirty", "isDirty");
|
|
582
|
+
var isValid = /* @__PURE__ */ __name2((x) => x.status === "valid", "isValid");
|
|
583
|
+
var isAsync = /* @__PURE__ */ __name2((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
|
|
514
584
|
var errorUtil;
|
|
515
585
|
(function(errorUtil2) {
|
|
516
|
-
errorUtil2.errToObj = (message) => typeof message === "string" ? {
|
|
586
|
+
errorUtil2.errToObj = (message) => typeof message === "string" ? {
|
|
587
|
+
message
|
|
588
|
+
} : message || {};
|
|
517
589
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
518
590
|
})(errorUtil || (errorUtil = {}));
|
|
519
|
-
var ParseInputLazyPath = class {
|
|
591
|
+
var ParseInputLazyPath = /* @__PURE__ */ __name(class {
|
|
520
592
|
constructor(parent, value, path, key) {
|
|
521
593
|
this._cachedPath = [];
|
|
522
594
|
this.parent = parent;
|
|
@@ -534,11 +606,14 @@ var ParseInputLazyPath = class {
|
|
|
534
606
|
}
|
|
535
607
|
return this._cachedPath;
|
|
536
608
|
}
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
var handleResult = /* @__PURE__ */
|
|
609
|
+
}, "ParseInputLazyPath");
|
|
610
|
+
__name2(ParseInputLazyPath, "ParseInputLazyPath");
|
|
611
|
+
var handleResult = /* @__PURE__ */ __name2((ctx, result) => {
|
|
540
612
|
if (isValid(result)) {
|
|
541
|
-
return {
|
|
613
|
+
return {
|
|
614
|
+
success: true,
|
|
615
|
+
data: result.value
|
|
616
|
+
};
|
|
542
617
|
} else {
|
|
543
618
|
if (!ctx.common.issues.length) {
|
|
544
619
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -563,19 +638,32 @@ function processCreateParams(params) {
|
|
|
563
638
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
564
639
|
}
|
|
565
640
|
if (errorMap2)
|
|
566
|
-
return {
|
|
567
|
-
|
|
641
|
+
return {
|
|
642
|
+
errorMap: errorMap2,
|
|
643
|
+
description
|
|
644
|
+
};
|
|
645
|
+
const customMap = /* @__PURE__ */ __name2((iss, ctx) => {
|
|
568
646
|
if (iss.code !== "invalid_type")
|
|
569
|
-
return {
|
|
647
|
+
return {
|
|
648
|
+
message: ctx.defaultError
|
|
649
|
+
};
|
|
570
650
|
if (typeof ctx.data === "undefined") {
|
|
571
|
-
return {
|
|
651
|
+
return {
|
|
652
|
+
message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError
|
|
653
|
+
};
|
|
572
654
|
}
|
|
573
|
-
return {
|
|
655
|
+
return {
|
|
656
|
+
message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError
|
|
657
|
+
};
|
|
574
658
|
}, "customMap");
|
|
575
|
-
return {
|
|
659
|
+
return {
|
|
660
|
+
errorMap: customMap,
|
|
661
|
+
description
|
|
662
|
+
};
|
|
576
663
|
}
|
|
577
664
|
__name(processCreateParams, "processCreateParams");
|
|
578
|
-
|
|
665
|
+
__name2(processCreateParams, "processCreateParams");
|
|
666
|
+
var ZodType = /* @__PURE__ */ __name(class {
|
|
579
667
|
constructor(def) {
|
|
580
668
|
this.spa = this.safeParseAsync;
|
|
581
669
|
this._def = def;
|
|
@@ -664,7 +752,11 @@ var ZodType = class {
|
|
|
664
752
|
data,
|
|
665
753
|
parsedType: getParsedType(data)
|
|
666
754
|
};
|
|
667
|
-
const result = this._parseSync({
|
|
755
|
+
const result = this._parseSync({
|
|
756
|
+
data,
|
|
757
|
+
path: ctx.path,
|
|
758
|
+
parent: ctx
|
|
759
|
+
});
|
|
668
760
|
return handleResult(ctx, result);
|
|
669
761
|
}
|
|
670
762
|
async parseAsync(data, params) {
|
|
@@ -686,14 +778,20 @@ var ZodType = class {
|
|
|
686
778
|
data,
|
|
687
779
|
parsedType: getParsedType(data)
|
|
688
780
|
};
|
|
689
|
-
const maybeAsyncResult = this._parse({
|
|
781
|
+
const maybeAsyncResult = this._parse({
|
|
782
|
+
data,
|
|
783
|
+
path: ctx.path,
|
|
784
|
+
parent: ctx
|
|
785
|
+
});
|
|
690
786
|
const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
691
787
|
return handleResult(ctx, result);
|
|
692
788
|
}
|
|
693
789
|
refine(check, message) {
|
|
694
|
-
const getIssueProperties = /* @__PURE__ */
|
|
790
|
+
const getIssueProperties = /* @__PURE__ */ __name2((val) => {
|
|
695
791
|
if (typeof message === "string" || typeof message === "undefined") {
|
|
696
|
-
return {
|
|
792
|
+
return {
|
|
793
|
+
message
|
|
794
|
+
};
|
|
697
795
|
} else if (typeof message === "function") {
|
|
698
796
|
return message(val);
|
|
699
797
|
} else {
|
|
@@ -702,7 +800,7 @@ var ZodType = class {
|
|
|
702
800
|
}, "getIssueProperties");
|
|
703
801
|
return this._refinement((val, ctx) => {
|
|
704
802
|
const result = check(val);
|
|
705
|
-
const setError = /* @__PURE__ */
|
|
803
|
+
const setError = /* @__PURE__ */ __name2(() => ctx.addIssue({
|
|
706
804
|
code: ZodIssueCode.custom,
|
|
707
805
|
...getIssueProperties(val)
|
|
708
806
|
}), "setError");
|
|
@@ -738,7 +836,10 @@ var ZodType = class {
|
|
|
738
836
|
return new ZodEffects({
|
|
739
837
|
schema: this,
|
|
740
838
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
741
|
-
effect: {
|
|
839
|
+
effect: {
|
|
840
|
+
type: "refinement",
|
|
841
|
+
refinement
|
|
842
|
+
}
|
|
742
843
|
});
|
|
743
844
|
}
|
|
744
845
|
superRefine(refinement) {
|
|
@@ -760,7 +861,10 @@ var ZodType = class {
|
|
|
760
861
|
return ZodPromise.create(this, this._def);
|
|
761
862
|
}
|
|
762
863
|
or(option) {
|
|
763
|
-
return ZodUnion.create([
|
|
864
|
+
return ZodUnion.create([
|
|
865
|
+
this,
|
|
866
|
+
option
|
|
867
|
+
], this._def);
|
|
764
868
|
}
|
|
765
869
|
and(incoming) {
|
|
766
870
|
return ZodIntersection.create(this, incoming, this._def);
|
|
@@ -770,7 +874,10 @@ var ZodType = class {
|
|
|
770
874
|
...processCreateParams(this._def),
|
|
771
875
|
schema: this,
|
|
772
876
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
773
|
-
effect: {
|
|
877
|
+
effect: {
|
|
878
|
+
type: "transform",
|
|
879
|
+
transform
|
|
880
|
+
}
|
|
774
881
|
});
|
|
775
882
|
}
|
|
776
883
|
default(def) {
|
|
@@ -817,8 +924,8 @@ var ZodType = class {
|
|
|
817
924
|
isNullable() {
|
|
818
925
|
return this.safeParse(null).success;
|
|
819
926
|
}
|
|
820
|
-
};
|
|
821
|
-
|
|
927
|
+
}, "ZodType");
|
|
928
|
+
__name2(ZodType, "ZodType");
|
|
822
929
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
823
930
|
var cuid2Regex = /^[a-z][a-z0-9]*$/;
|
|
824
931
|
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
@@ -828,7 +935,7 @@ var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
|
828
935
|
var emojiRegex;
|
|
829
936
|
var ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
|
|
830
937
|
var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
|
831
|
-
var datetimeRegex = /* @__PURE__ */
|
|
938
|
+
var datetimeRegex = /* @__PURE__ */ __name2((args) => {
|
|
832
939
|
if (args.precision) {
|
|
833
940
|
if (args.offset) {
|
|
834
941
|
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
@@ -859,7 +966,8 @@ function isValidIP(ip, version) {
|
|
|
859
966
|
return false;
|
|
860
967
|
}
|
|
861
968
|
__name(isValidIP, "isValidIP");
|
|
862
|
-
|
|
969
|
+
__name2(isValidIP, "isValidIP");
|
|
970
|
+
var ZodString = /* @__PURE__ */ __name(class extends ZodType {
|
|
863
971
|
_parse(input) {
|
|
864
972
|
if (this._def.coerce) {
|
|
865
973
|
input.data = String(input.data);
|
|
@@ -867,15 +975,11 @@ var ZodString = class extends ZodType {
|
|
|
867
975
|
const parsedType = this._getType(input);
|
|
868
976
|
if (parsedType !== ZodParsedType.string) {
|
|
869
977
|
const ctx2 = this._getOrReturnCtx(input);
|
|
870
|
-
addIssueToContext(
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
received: ctx2.parsedType
|
|
876
|
-
}
|
|
877
|
-
//
|
|
878
|
-
);
|
|
978
|
+
addIssueToContext(ctx2, {
|
|
979
|
+
code: ZodIssueCode.invalid_type,
|
|
980
|
+
expected: ZodParsedType.string,
|
|
981
|
+
received: ctx2.parsedType
|
|
982
|
+
});
|
|
879
983
|
return INVALID;
|
|
880
984
|
}
|
|
881
985
|
const status = new ParseStatus();
|
|
@@ -1027,7 +1131,10 @@ var ZodString = class extends ZodType {
|
|
|
1027
1131
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1028
1132
|
addIssueToContext(ctx, {
|
|
1029
1133
|
code: ZodIssueCode.invalid_string,
|
|
1030
|
-
validation: {
|
|
1134
|
+
validation: {
|
|
1135
|
+
includes: check.value,
|
|
1136
|
+
position: check.position
|
|
1137
|
+
},
|
|
1031
1138
|
message: check.message
|
|
1032
1139
|
});
|
|
1033
1140
|
status.dirty();
|
|
@@ -1041,7 +1148,9 @@ var ZodString = class extends ZodType {
|
|
|
1041
1148
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1042
1149
|
addIssueToContext(ctx, {
|
|
1043
1150
|
code: ZodIssueCode.invalid_string,
|
|
1044
|
-
validation: {
|
|
1151
|
+
validation: {
|
|
1152
|
+
startsWith: check.value
|
|
1153
|
+
},
|
|
1045
1154
|
message: check.message
|
|
1046
1155
|
});
|
|
1047
1156
|
status.dirty();
|
|
@@ -1051,7 +1160,9 @@ var ZodString = class extends ZodType {
|
|
|
1051
1160
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1052
1161
|
addIssueToContext(ctx, {
|
|
1053
1162
|
code: ZodIssueCode.invalid_string,
|
|
1054
|
-
validation: {
|
|
1163
|
+
validation: {
|
|
1164
|
+
endsWith: check.value
|
|
1165
|
+
},
|
|
1055
1166
|
message: check.message
|
|
1056
1167
|
});
|
|
1057
1168
|
status.dirty();
|
|
@@ -1081,7 +1192,10 @@ var ZodString = class extends ZodType {
|
|
|
1081
1192
|
util.assertNever(check);
|
|
1082
1193
|
}
|
|
1083
1194
|
}
|
|
1084
|
-
return {
|
|
1195
|
+
return {
|
|
1196
|
+
status: status.value,
|
|
1197
|
+
value: input.data
|
|
1198
|
+
};
|
|
1085
1199
|
}
|
|
1086
1200
|
_regex(regex, validation, message) {
|
|
1087
1201
|
return this.refinement((data) => regex.test(data), {
|
|
@@ -1093,32 +1207,59 @@ var ZodString = class extends ZodType {
|
|
|
1093
1207
|
_addCheck(check) {
|
|
1094
1208
|
return new ZodString({
|
|
1095
1209
|
...this._def,
|
|
1096
|
-
checks: [
|
|
1210
|
+
checks: [
|
|
1211
|
+
...this._def.checks,
|
|
1212
|
+
check
|
|
1213
|
+
]
|
|
1097
1214
|
});
|
|
1098
1215
|
}
|
|
1099
1216
|
email(message) {
|
|
1100
|
-
return this._addCheck({
|
|
1217
|
+
return this._addCheck({
|
|
1218
|
+
kind: "email",
|
|
1219
|
+
...errorUtil.errToObj(message)
|
|
1220
|
+
});
|
|
1101
1221
|
}
|
|
1102
1222
|
url(message) {
|
|
1103
|
-
return this._addCheck({
|
|
1223
|
+
return this._addCheck({
|
|
1224
|
+
kind: "url",
|
|
1225
|
+
...errorUtil.errToObj(message)
|
|
1226
|
+
});
|
|
1104
1227
|
}
|
|
1105
1228
|
emoji(message) {
|
|
1106
|
-
return this._addCheck({
|
|
1229
|
+
return this._addCheck({
|
|
1230
|
+
kind: "emoji",
|
|
1231
|
+
...errorUtil.errToObj(message)
|
|
1232
|
+
});
|
|
1107
1233
|
}
|
|
1108
1234
|
uuid(message) {
|
|
1109
|
-
return this._addCheck({
|
|
1235
|
+
return this._addCheck({
|
|
1236
|
+
kind: "uuid",
|
|
1237
|
+
...errorUtil.errToObj(message)
|
|
1238
|
+
});
|
|
1110
1239
|
}
|
|
1111
1240
|
cuid(message) {
|
|
1112
|
-
return this._addCheck({
|
|
1241
|
+
return this._addCheck({
|
|
1242
|
+
kind: "cuid",
|
|
1243
|
+
...errorUtil.errToObj(message)
|
|
1244
|
+
});
|
|
1113
1245
|
}
|
|
1114
1246
|
cuid2(message) {
|
|
1115
|
-
return this._addCheck({
|
|
1247
|
+
return this._addCheck({
|
|
1248
|
+
kind: "cuid2",
|
|
1249
|
+
...errorUtil.errToObj(message)
|
|
1250
|
+
});
|
|
1116
1251
|
}
|
|
1117
1252
|
ulid(message) {
|
|
1118
|
-
return this._addCheck({
|
|
1253
|
+
return this._addCheck({
|
|
1254
|
+
kind: "ulid",
|
|
1255
|
+
...errorUtil.errToObj(message)
|
|
1256
|
+
});
|
|
1119
1257
|
}
|
|
1120
1258
|
ip(options) {
|
|
1121
|
-
return this._addCheck({
|
|
1259
|
+
return this._addCheck({
|
|
1260
|
+
kind: "ip",
|
|
1261
|
+
...errorUtil.errToObj(options)
|
|
1262
|
+
});
|
|
1122
1263
|
}
|
|
1123
1264
|
datetime(options) {
|
|
1124
1265
|
var _a;
|
|
@@ -1188,28 +1329,43 @@ var ZodString = class extends ZodType {
|
|
|
1188
1329
|
});
|
|
1189
1330
|
}
|
|
1190
1331
|
/**
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1332
|
+
* @deprecated Use z.string().min(1) instead.
|
|
1333
|
+
* @see {@link ZodString.min}
|
|
1334
|
+
*/
|
|
1194
1335
|
nonempty(message) {
|
|
1195
1336
|
return this.min(1, errorUtil.errToObj(message));
|
|
1196
1337
|
}
|
|
1197
1338
|
trim() {
|
|
1198
1339
|
return new ZodString({
|
|
1199
1340
|
...this._def,
|
|
1200
|
-
checks: [
|
|
1341
|
+
checks: [
|
|
1342
|
+
...this._def.checks,
|
|
1343
|
+
{
|
|
1344
|
+
kind: "trim"
|
|
1345
|
+
}
|
|
1346
|
+
]
|
|
1201
1347
|
});
|
|
1202
1348
|
}
|
|
1203
1349
|
toLowerCase() {
|
|
1204
1350
|
return new ZodString({
|
|
1205
1351
|
...this._def,
|
|
1206
|
-
checks: [
|
|
1352
|
+
checks: [
|
|
1353
|
+
...this._def.checks,
|
|
1354
|
+
{
|
|
1355
|
+
kind: "toLowerCase"
|
|
1356
|
+
}
|
|
1357
|
+
]
|
|
1207
1358
|
});
|
|
1208
1359
|
}
|
|
1209
1360
|
toUpperCase() {
|
|
1210
1361
|
return new ZodString({
|
|
1211
1362
|
...this._def,
|
|
1212
|
-
checks: [
|
|
1363
|
+
checks: [
|
|
1364
|
+
...this._def.checks,
|
|
1365
|
+
{
|
|
1366
|
+
kind: "toUpperCase"
|
|
1367
|
+
}
|
|
1368
|
+
]
|
|
1213
1369
|
});
|
|
1214
1370
|
}
|
|
1215
1371
|
get isDatetime() {
|
|
@@ -1259,8 +1415,8 @@ var ZodString = class extends ZodType {
|
|
|
1259
1415
|
}
|
|
1260
1416
|
return max;
|
|
1261
1417
|
}
|
|
1262
|
-
};
|
|
1263
|
-
|
|
1418
|
+
}, "ZodString");
|
|
1419
|
+
__name2(ZodString, "ZodString");
|
|
1264
1420
|
ZodString.create = (params) => {
|
|
1265
1421
|
var _a;
|
|
1266
1422
|
return new ZodString({
|
|
@@ -1279,7 +1435,8 @@ function floatSafeRemainder(val, step) {
|
|
|
1279
1435
|
return valInt % stepInt / Math.pow(10, decCount);
|
|
1280
1436
|
}
|
|
1281
1437
|
__name(floatSafeRemainder, "floatSafeRemainder");
|
|
1282
|
-
|
|
1438
|
+
__name2(floatSafeRemainder, "floatSafeRemainder");
|
|
1439
|
+
var ZodNumber = /* @__PURE__ */ __name(class extends ZodType {
|
|
1283
1440
|
constructor() {
|
|
1284
1441
|
super(...arguments);
|
|
1285
1442
|
this.min = this.gte;
|
|
@@ -1365,7 +1522,10 @@ var ZodNumber = class extends ZodType {
|
|
|
1365
1522
|
util.assertNever(check);
|
|
1366
1523
|
}
|
|
1367
1524
|
}
|
|
1368
|
-
return {
|
|
1525
|
+
return {
|
|
1526
|
+
status: status.value,
|
|
1527
|
+
value: input.data
|
|
1528
|
+
};
|
|
1369
1529
|
}
|
|
1370
1530
|
gte(value, message) {
|
|
1371
1531
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
@@ -1396,7 +1556,10 @@ var ZodNumber = class extends ZodType {
|
|
|
1396
1556
|
_addCheck(check) {
|
|
1397
1557
|
return new ZodNumber({
|
|
1398
1558
|
...this._def,
|
|
1399
|
-
checks: [
|
|
1559
|
+
checks: [
|
|
1560
|
+
...this._def.checks,
|
|
1561
|
+
check
|
|
1562
|
+
]
|
|
1400
1563
|
});
|
|
1401
1564
|
}
|
|
1402
1565
|
int(message) {
|
|
@@ -1501,8 +1664,8 @@ var ZodNumber = class extends ZodType {
|
|
|
1501
1664
|
}
|
|
1502
1665
|
return Number.isFinite(min) && Number.isFinite(max);
|
|
1503
1666
|
}
|
|
1504
|
-
};
|
|
1505
|
-
|
|
1667
|
+
}, "ZodNumber");
|
|
1668
|
+
__name2(ZodNumber, "ZodNumber");
|
|
1506
1669
|
ZodNumber.create = (params) => {
|
|
1507
1670
|
return new ZodNumber({
|
|
1508
1671
|
checks: [],
|
|
@@ -1511,7 +1674,7 @@ ZodNumber.create = (params) => {
|
|
|
1511
1674
|
...processCreateParams(params)
|
|
1512
1675
|
});
|
|
1513
1676
|
};
|
|
1514
|
-
var ZodBigInt = class extends ZodType {
|
|
1677
|
+
var ZodBigInt = /* @__PURE__ */ __name(class extends ZodType {
|
|
1515
1678
|
constructor() {
|
|
1516
1679
|
super(...arguments);
|
|
1517
1680
|
this.min = this.gte;
|
|
@@ -1574,7 +1737,10 @@ var ZodBigInt = class extends ZodType {
|
|
|
1574
1737
|
util.assertNever(check);
|
|
1575
1738
|
}
|
|
1576
1739
|
}
|
|
1577
|
-
return {
|
|
1740
|
+
return {
|
|
1741
|
+
status: status.value,
|
|
1742
|
+
value: input.data
|
|
1743
|
+
};
|
|
1578
1744
|
}
|
|
1579
1745
|
gte(value, message) {
|
|
1580
1746
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
@@ -1605,7 +1771,10 @@ var ZodBigInt = class extends ZodType {
|
|
|
1605
1771
|
_addCheck(check) {
|
|
1606
1772
|
return new ZodBigInt({
|
|
1607
1773
|
...this._def,
|
|
1608
|
-
checks: [
|
|
1774
|
+
checks: [
|
|
1775
|
+
...this._def.checks,
|
|
1776
|
+
check
|
|
1777
|
+
]
|
|
1609
1778
|
});
|
|
1610
1779
|
}
|
|
1611
1780
|
positive(message) {
|
|
@@ -1667,8 +1836,8 @@ var ZodBigInt = class extends ZodType {
|
|
|
1667
1836
|
}
|
|
1668
1837
|
return max;
|
|
1669
1838
|
}
|
|
1670
|
-
};
|
|
1671
|
-
|
|
1839
|
+
}, "ZodBigInt");
|
|
1840
|
+
__name2(ZodBigInt, "ZodBigInt");
|
|
1672
1841
|
ZodBigInt.create = (params) => {
|
|
1673
1842
|
var _a;
|
|
1674
1843
|
return new ZodBigInt({
|
|
@@ -1678,7 +1847,7 @@ ZodBigInt.create = (params) => {
|
|
|
1678
1847
|
...processCreateParams(params)
|
|
1679
1848
|
});
|
|
1680
1849
|
};
|
|
1681
|
-
var ZodBoolean = class extends ZodType {
|
|
1850
|
+
var ZodBoolean = /* @__PURE__ */ __name(class extends ZodType {
|
|
1682
1851
|
_parse(input) {
|
|
1683
1852
|
if (this._def.coerce) {
|
|
1684
1853
|
input.data = Boolean(input.data);
|
|
@@ -1695,8 +1864,8 @@ var ZodBoolean = class extends ZodType {
|
|
|
1695
1864
|
}
|
|
1696
1865
|
return OK(input.data);
|
|
1697
1866
|
}
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1867
|
+
}, "ZodBoolean");
|
|
1868
|
+
__name2(ZodBoolean, "ZodBoolean");
|
|
1700
1869
|
ZodBoolean.create = (params) => {
|
|
1701
1870
|
return new ZodBoolean({
|
|
1702
1871
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
@@ -1704,7 +1873,7 @@ ZodBoolean.create = (params) => {
|
|
|
1704
1873
|
...processCreateParams(params)
|
|
1705
1874
|
});
|
|
1706
1875
|
};
|
|
1707
|
-
var ZodDate = class extends ZodType {
|
|
1876
|
+
var ZodDate = /* @__PURE__ */ __name(class extends ZodType {
|
|
1708
1877
|
_parse(input) {
|
|
1709
1878
|
if (this._def.coerce) {
|
|
1710
1879
|
input.data = new Date(input.data);
|
|
@@ -1767,7 +1936,10 @@ var ZodDate = class extends ZodType {
|
|
|
1767
1936
|
_addCheck(check) {
|
|
1768
1937
|
return new ZodDate({
|
|
1769
1938
|
...this._def,
|
|
1770
|
-
checks: [
|
|
1939
|
+
checks: [
|
|
1940
|
+
...this._def.checks,
|
|
1941
|
+
check
|
|
1942
|
+
]
|
|
1771
1943
|
});
|
|
1772
1944
|
}
|
|
1773
1945
|
min(minDate, message) {
|
|
@@ -1804,8 +1976,8 @@ var ZodDate = class extends ZodType {
|
|
|
1804
1976
|
}
|
|
1805
1977
|
return max != null ? new Date(max) : null;
|
|
1806
1978
|
}
|
|
1807
|
-
};
|
|
1808
|
-
|
|
1979
|
+
}, "ZodDate");
|
|
1980
|
+
__name2(ZodDate, "ZodDate");
|
|
1809
1981
|
ZodDate.create = (params) => {
|
|
1810
1982
|
return new ZodDate({
|
|
1811
1983
|
checks: [],
|
|
@@ -1814,7 +1986,7 @@ ZodDate.create = (params) => {
|
|
|
1814
1986
|
...processCreateParams(params)
|
|
1815
1987
|
});
|
|
1816
1988
|
};
|
|
1817
|
-
var ZodSymbol = class extends ZodType {
|
|
1989
|
+
var ZodSymbol = /* @__PURE__ */ __name(class extends ZodType {
|
|
1818
1990
|
_parse(input) {
|
|
1819
1991
|
const parsedType = this._getType(input);
|
|
1820
1992
|
if (parsedType !== ZodParsedType.symbol) {
|
|
@@ -1828,15 +2000,15 @@ var ZodSymbol = class extends ZodType {
|
|
|
1828
2000
|
}
|
|
1829
2001
|
return OK(input.data);
|
|
1830
2002
|
}
|
|
1831
|
-
};
|
|
1832
|
-
|
|
2003
|
+
}, "ZodSymbol");
|
|
2004
|
+
__name2(ZodSymbol, "ZodSymbol");
|
|
1833
2005
|
ZodSymbol.create = (params) => {
|
|
1834
2006
|
return new ZodSymbol({
|
|
1835
2007
|
typeName: ZodFirstPartyTypeKind.ZodSymbol,
|
|
1836
2008
|
...processCreateParams(params)
|
|
1837
2009
|
});
|
|
1838
2010
|
};
|
|
1839
|
-
var ZodUndefined = class extends ZodType {
|
|
2011
|
+
var ZodUndefined = /* @__PURE__ */ __name(class extends ZodType {
|
|
1840
2012
|
_parse(input) {
|
|
1841
2013
|
const parsedType = this._getType(input);
|
|
1842
2014
|
if (parsedType !== ZodParsedType.undefined) {
|
|
@@ -1850,15 +2022,15 @@ var ZodUndefined = class extends ZodType {
|
|
|
1850
2022
|
}
|
|
1851
2023
|
return OK(input.data);
|
|
1852
2024
|
}
|
|
1853
|
-
};
|
|
1854
|
-
|
|
2025
|
+
}, "ZodUndefined");
|
|
2026
|
+
__name2(ZodUndefined, "ZodUndefined");
|
|
1855
2027
|
ZodUndefined.create = (params) => {
|
|
1856
2028
|
return new ZodUndefined({
|
|
1857
2029
|
typeName: ZodFirstPartyTypeKind.ZodUndefined,
|
|
1858
2030
|
...processCreateParams(params)
|
|
1859
2031
|
});
|
|
1860
2032
|
};
|
|
1861
|
-
var ZodNull = class extends ZodType {
|
|
2033
|
+
var ZodNull = /* @__PURE__ */ __name(class extends ZodType {
|
|
1862
2034
|
_parse(input) {
|
|
1863
2035
|
const parsedType = this._getType(input);
|
|
1864
2036
|
if (parsedType !== ZodParsedType.null) {
|
|
@@ -1872,15 +2044,15 @@ var ZodNull = class extends ZodType {
|
|
|
1872
2044
|
}
|
|
1873
2045
|
return OK(input.data);
|
|
1874
2046
|
}
|
|
1875
|
-
};
|
|
1876
|
-
|
|
2047
|
+
}, "ZodNull");
|
|
2048
|
+
__name2(ZodNull, "ZodNull");
|
|
1877
2049
|
ZodNull.create = (params) => {
|
|
1878
2050
|
return new ZodNull({
|
|
1879
2051
|
typeName: ZodFirstPartyTypeKind.ZodNull,
|
|
1880
2052
|
...processCreateParams(params)
|
|
1881
2053
|
});
|
|
1882
2054
|
};
|
|
1883
|
-
var ZodAny = class extends ZodType {
|
|
2055
|
+
var ZodAny = /* @__PURE__ */ __name(class extends ZodType {
|
|
1884
2056
|
constructor() {
|
|
1885
2057
|
super(...arguments);
|
|
1886
2058
|
this._any = true;
|
|
@@ -1888,15 +2060,15 @@ var ZodAny = class extends ZodType {
|
|
|
1888
2060
|
_parse(input) {
|
|
1889
2061
|
return OK(input.data);
|
|
1890
2062
|
}
|
|
1891
|
-
};
|
|
1892
|
-
|
|
2063
|
+
}, "ZodAny");
|
|
2064
|
+
__name2(ZodAny, "ZodAny");
|
|
1893
2065
|
ZodAny.create = (params) => {
|
|
1894
2066
|
return new ZodAny({
|
|
1895
2067
|
typeName: ZodFirstPartyTypeKind.ZodAny,
|
|
1896
2068
|
...processCreateParams(params)
|
|
1897
2069
|
});
|
|
1898
2070
|
};
|
|
1899
|
-
var ZodUnknown = class extends ZodType {
|
|
2071
|
+
var ZodUnknown = /* @__PURE__ */ __name(class extends ZodType {
|
|
1900
2072
|
constructor() {
|
|
1901
2073
|
super(...arguments);
|
|
1902
2074
|
this._unknown = true;
|
|
@@ -1904,15 +2076,15 @@ var ZodUnknown = class extends ZodType {
|
|
|
1904
2076
|
_parse(input) {
|
|
1905
2077
|
return OK(input.data);
|
|
1906
2078
|
}
|
|
1907
|
-
};
|
|
1908
|
-
|
|
2079
|
+
}, "ZodUnknown");
|
|
2080
|
+
__name2(ZodUnknown, "ZodUnknown");
|
|
1909
2081
|
ZodUnknown.create = (params) => {
|
|
1910
2082
|
return new ZodUnknown({
|
|
1911
2083
|
typeName: ZodFirstPartyTypeKind.ZodUnknown,
|
|
1912
2084
|
...processCreateParams(params)
|
|
1913
2085
|
});
|
|
1914
2086
|
};
|
|
1915
|
-
var ZodNever = class extends ZodType {
|
|
2087
|
+
var ZodNever = /* @__PURE__ */ __name(class extends ZodType {
|
|
1916
2088
|
_parse(input) {
|
|
1917
2089
|
const ctx = this._getOrReturnCtx(input);
|
|
1918
2090
|
addIssueToContext(ctx, {
|
|
@@ -1922,15 +2094,15 @@ var ZodNever = class extends ZodType {
|
|
|
1922
2094
|
});
|
|
1923
2095
|
return INVALID;
|
|
1924
2096
|
}
|
|
1925
|
-
};
|
|
1926
|
-
|
|
2097
|
+
}, "ZodNever");
|
|
2098
|
+
__name2(ZodNever, "ZodNever");
|
|
1927
2099
|
ZodNever.create = (params) => {
|
|
1928
2100
|
return new ZodNever({
|
|
1929
2101
|
typeName: ZodFirstPartyTypeKind.ZodNever,
|
|
1930
2102
|
...processCreateParams(params)
|
|
1931
2103
|
});
|
|
1932
2104
|
};
|
|
1933
|
-
var ZodVoid = class extends ZodType {
|
|
2105
|
+
var ZodVoid = /* @__PURE__ */ __name(class extends ZodType {
|
|
1934
2106
|
_parse(input) {
|
|
1935
2107
|
const parsedType = this._getType(input);
|
|
1936
2108
|
if (parsedType !== ZodParsedType.undefined) {
|
|
@@ -1944,15 +2116,15 @@ var ZodVoid = class extends ZodType {
|
|
|
1944
2116
|
}
|
|
1945
2117
|
return OK(input.data);
|
|
1946
2118
|
}
|
|
1947
|
-
};
|
|
1948
|
-
|
|
2119
|
+
}, "ZodVoid");
|
|
2120
|
+
__name2(ZodVoid, "ZodVoid");
|
|
1949
2121
|
ZodVoid.create = (params) => {
|
|
1950
2122
|
return new ZodVoid({
|
|
1951
2123
|
typeName: ZodFirstPartyTypeKind.ZodVoid,
|
|
1952
2124
|
...processCreateParams(params)
|
|
1953
2125
|
});
|
|
1954
2126
|
};
|
|
1955
|
-
var ZodArray = class extends ZodType {
|
|
2127
|
+
var ZodArray = /* @__PURE__ */ __name(class extends ZodType {
|
|
1956
2128
|
_parse(input) {
|
|
1957
2129
|
const { ctx, status } = this._processInputParams(input);
|
|
1958
2130
|
const def = this._def;
|
|
@@ -2007,13 +2179,17 @@ var ZodArray = class extends ZodType {
|
|
|
2007
2179
|
}
|
|
2008
2180
|
}
|
|
2009
2181
|
if (ctx.common.async) {
|
|
2010
|
-
return Promise.all([
|
|
2182
|
+
return Promise.all([
|
|
2183
|
+
...ctx.data
|
|
2184
|
+
].map((item, i) => {
|
|
2011
2185
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
2012
2186
|
})).then((result2) => {
|
|
2013
2187
|
return ParseStatus.mergeArray(status, result2);
|
|
2014
2188
|
});
|
|
2015
2189
|
}
|
|
2016
|
-
const result = [
|
|
2190
|
+
const result = [
|
|
2191
|
+
...ctx.data
|
|
2192
|
+
].map((item, i) => {
|
|
2017
2193
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
2018
2194
|
});
|
|
2019
2195
|
return ParseStatus.mergeArray(status, result);
|
|
@@ -2024,26 +2200,35 @@ var ZodArray = class extends ZodType {
|
|
|
2024
2200
|
min(minLength, message) {
|
|
2025
2201
|
return new ZodArray({
|
|
2026
2202
|
...this._def,
|
|
2027
|
-
minLength: {
|
|
2203
|
+
minLength: {
|
|
2204
|
+
value: minLength,
|
|
2205
|
+
message: errorUtil.toString(message)
|
|
2206
|
+
}
|
|
2028
2207
|
});
|
|
2029
2208
|
}
|
|
2030
2209
|
max(maxLength, message) {
|
|
2031
2210
|
return new ZodArray({
|
|
2032
2211
|
...this._def,
|
|
2033
|
-
maxLength: {
|
|
2212
|
+
maxLength: {
|
|
2213
|
+
value: maxLength,
|
|
2214
|
+
message: errorUtil.toString(message)
|
|
2215
|
+
}
|
|
2034
2216
|
});
|
|
2035
2217
|
}
|
|
2036
2218
|
length(len, message) {
|
|
2037
2219
|
return new ZodArray({
|
|
2038
2220
|
...this._def,
|
|
2039
|
-
exactLength: {
|
|
2221
|
+
exactLength: {
|
|
2222
|
+
value: len,
|
|
2223
|
+
message: errorUtil.toString(message)
|
|
2224
|
+
}
|
|
2040
2225
|
});
|
|
2041
2226
|
}
|
|
2042
2227
|
nonempty(message) {
|
|
2043
2228
|
return this.min(1, message);
|
|
2044
2229
|
}
|
|
2045
|
-
};
|
|
2046
|
-
|
|
2230
|
+
}, "ZodArray");
|
|
2231
|
+
__name2(ZodArray, "ZodArray");
|
|
2047
2232
|
ZodArray.create = (schema, params) => {
|
|
2048
2233
|
return new ZodArray({
|
|
2049
2234
|
type: schema,
|
|
@@ -2081,7 +2266,8 @@ function deepPartialify(schema) {
|
|
|
2081
2266
|
}
|
|
2082
2267
|
}
|
|
2083
2268
|
__name(deepPartialify, "deepPartialify");
|
|
2084
|
-
|
|
2269
|
+
__name2(deepPartialify, "deepPartialify");
|
|
2270
|
+
var ZodObject = /* @__PURE__ */ __name(class extends ZodType {
|
|
2085
2271
|
constructor() {
|
|
2086
2272
|
super(...arguments);
|
|
2087
2273
|
this._cached = null;
|
|
@@ -2093,7 +2279,10 @@ var ZodObject = class extends ZodType {
|
|
|
2093
2279
|
return this._cached;
|
|
2094
2280
|
const shape = this._def.shape();
|
|
2095
2281
|
const keys = util.objectKeys(shape);
|
|
2096
|
-
return this._cached = {
|
|
2282
|
+
return this._cached = {
|
|
2283
|
+
shape,
|
|
2284
|
+
keys
|
|
2285
|
+
};
|
|
2097
2286
|
}
|
|
2098
2287
|
_parse(input) {
|
|
2099
2288
|
const parsedType = this._getType(input);
|
|
@@ -2121,7 +2310,10 @@ var ZodObject = class extends ZodType {
|
|
|
2121
2310
|
const keyValidator = shape[key];
|
|
2122
2311
|
const value = ctx.data[key];
|
|
2123
2312
|
pairs.push({
|
|
2124
|
-
key: {
|
|
2313
|
+
key: {
|
|
2314
|
+
status: "valid",
|
|
2315
|
+
value: key
|
|
2316
|
+
},
|
|
2125
2317
|
value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
|
2126
2318
|
alwaysSet: key in ctx.data
|
|
2127
2319
|
});
|
|
@@ -2131,8 +2323,14 @@ var ZodObject = class extends ZodType {
|
|
|
2131
2323
|
if (unknownKeys === "passthrough") {
|
|
2132
2324
|
for (const key of extraKeys) {
|
|
2133
2325
|
pairs.push({
|
|
2134
|
-
key: {
|
|
2135
|
-
|
|
2326
|
+
key: {
|
|
2327
|
+
status: "valid",
|
|
2328
|
+
value: key
|
|
2329
|
+
},
|
|
2330
|
+
value: {
|
|
2331
|
+
status: "valid",
|
|
2332
|
+
value: ctx.data[key]
|
|
2333
|
+
}
|
|
2136
2334
|
});
|
|
2137
2335
|
}
|
|
2138
2336
|
} else if (unknownKeys === "strict") {
|
|
@@ -2153,11 +2351,11 @@ var ZodObject = class extends ZodType {
|
|
|
2153
2351
|
for (const key of extraKeys) {
|
|
2154
2352
|
const value = ctx.data[key];
|
|
2155
2353
|
pairs.push({
|
|
2156
|
-
key: {
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
),
|
|
2354
|
+
key: {
|
|
2355
|
+
status: "valid",
|
|
2356
|
+
value: key
|
|
2357
|
+
},
|
|
2358
|
+
value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
|
|
2161
2359
|
alwaysSet: key in ctx.data
|
|
2162
2360
|
});
|
|
2163
2361
|
}
|
|
@@ -2243,10 +2441,10 @@ var ZodObject = class extends ZodType {
|
|
|
2243
2441
|
});
|
|
2244
2442
|
}
|
|
2245
2443
|
/**
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2444
|
+
* Prior to zod@1.0.12 there was a bug in the
|
|
2445
|
+
* inferred type of merged objects. Please
|
|
2446
|
+
* upgrade if you are experiencing issues.
|
|
2447
|
+
*/
|
|
2250
2448
|
merge(merging) {
|
|
2251
2449
|
const merged = new ZodObject({
|
|
2252
2450
|
unknownKeys: merging._def.unknownKeys,
|
|
@@ -2295,7 +2493,9 @@ var ZodObject = class extends ZodType {
|
|
|
2295
2493
|
// return merged;
|
|
2296
2494
|
// }
|
|
2297
2495
|
setKey(key, schema) {
|
|
2298
|
-
return this.augment({
|
|
2496
|
+
return this.augment({
|
|
2497
|
+
[key]: schema
|
|
2498
|
+
});
|
|
2299
2499
|
}
|
|
2300
2500
|
// merge<Incoming extends AnyZodObject>(
|
|
2301
2501
|
// merging: Incoming
|
|
@@ -2349,8 +2549,8 @@ var ZodObject = class extends ZodType {
|
|
|
2349
2549
|
});
|
|
2350
2550
|
}
|
|
2351
2551
|
/**
|
|
2352
|
-
|
|
2353
|
-
|
|
2552
|
+
* @deprecated
|
|
2553
|
+
*/
|
|
2354
2554
|
deepPartial() {
|
|
2355
2555
|
return deepPartialify(this);
|
|
2356
2556
|
}
|
|
@@ -2391,8 +2591,8 @@ var ZodObject = class extends ZodType {
|
|
|
2391
2591
|
keyof() {
|
|
2392
2592
|
return createZodEnum(util.objectKeys(this.shape));
|
|
2393
2593
|
}
|
|
2394
|
-
};
|
|
2395
|
-
|
|
2594
|
+
}, "ZodObject");
|
|
2595
|
+
__name2(ZodObject, "ZodObject");
|
|
2396
2596
|
ZodObject.create = (shape, params) => {
|
|
2397
2597
|
return new ZodObject({
|
|
2398
2598
|
shape: () => shape,
|
|
@@ -2420,7 +2620,7 @@ ZodObject.lazycreate = (shape, params) => {
|
|
|
2420
2620
|
...processCreateParams(params)
|
|
2421
2621
|
});
|
|
2422
2622
|
};
|
|
2423
|
-
var ZodUnion = class extends ZodType {
|
|
2623
|
+
var ZodUnion = /* @__PURE__ */ __name(class extends ZodType {
|
|
2424
2624
|
_parse(input) {
|
|
2425
2625
|
const { ctx } = this._processInputParams(input);
|
|
2426
2626
|
const options = this._def.options;
|
|
@@ -2444,6 +2644,7 @@ var ZodUnion = class extends ZodType {
|
|
|
2444
2644
|
return INVALID;
|
|
2445
2645
|
}
|
|
2446
2646
|
__name(handleResults, "handleResults");
|
|
2647
|
+
__name2(handleResults, "handleResults");
|
|
2447
2648
|
if (ctx.common.async) {
|
|
2448
2649
|
return Promise.all(options.map(async (option) => {
|
|
2449
2650
|
const childCtx = {
|
|
@@ -2483,7 +2684,10 @@ var ZodUnion = class extends ZodType {
|
|
|
2483
2684
|
if (result.status === "valid") {
|
|
2484
2685
|
return result;
|
|
2485
2686
|
} else if (result.status === "dirty" && !dirty) {
|
|
2486
|
-
dirty = {
|
|
2687
|
+
dirty = {
|
|
2688
|
+
result,
|
|
2689
|
+
ctx: childCtx
|
|
2690
|
+
};
|
|
2487
2691
|
}
|
|
2488
2692
|
if (childCtx.common.issues.length) {
|
|
2489
2693
|
issues.push(childCtx.common.issues);
|
|
@@ -2504,8 +2708,8 @@ var ZodUnion = class extends ZodType {
|
|
|
2504
2708
|
get options() {
|
|
2505
2709
|
return this._def.options;
|
|
2506
2710
|
}
|
|
2507
|
-
};
|
|
2508
|
-
|
|
2711
|
+
}, "ZodUnion");
|
|
2712
|
+
__name2(ZodUnion, "ZodUnion");
|
|
2509
2713
|
ZodUnion.create = (types, params) => {
|
|
2510
2714
|
return new ZodUnion({
|
|
2511
2715
|
options: types,
|
|
@@ -2513,13 +2717,15 @@ ZodUnion.create = (types, params) => {
|
|
|
2513
2717
|
...processCreateParams(params)
|
|
2514
2718
|
});
|
|
2515
2719
|
};
|
|
2516
|
-
var getDiscriminator = /* @__PURE__ */
|
|
2720
|
+
var getDiscriminator = /* @__PURE__ */ __name2((type) => {
|
|
2517
2721
|
if (type instanceof ZodLazy) {
|
|
2518
2722
|
return getDiscriminator(type.schema);
|
|
2519
2723
|
} else if (type instanceof ZodEffects) {
|
|
2520
2724
|
return getDiscriminator(type.innerType());
|
|
2521
2725
|
} else if (type instanceof ZodLiteral) {
|
|
2522
|
-
return [
|
|
2726
|
+
return [
|
|
2727
|
+
type.value
|
|
2728
|
+
];
|
|
2523
2729
|
} else if (type instanceof ZodEnum) {
|
|
2524
2730
|
return type.options;
|
|
2525
2731
|
} else if (type instanceof ZodNativeEnum) {
|
|
@@ -2527,14 +2733,18 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
|
|
|
2527
2733
|
} else if (type instanceof ZodDefault) {
|
|
2528
2734
|
return getDiscriminator(type._def.innerType);
|
|
2529
2735
|
} else if (type instanceof ZodUndefined) {
|
|
2530
|
-
return [
|
|
2736
|
+
return [
|
|
2737
|
+
void 0
|
|
2738
|
+
];
|
|
2531
2739
|
} else if (type instanceof ZodNull) {
|
|
2532
|
-
return [
|
|
2740
|
+
return [
|
|
2741
|
+
null
|
|
2742
|
+
];
|
|
2533
2743
|
} else {
|
|
2534
2744
|
return null;
|
|
2535
2745
|
}
|
|
2536
2746
|
}, "getDiscriminator");
|
|
2537
|
-
var ZodDiscriminatedUnion = class extends ZodType {
|
|
2747
|
+
var ZodDiscriminatedUnion = /* @__PURE__ */ __name(class extends ZodType {
|
|
2538
2748
|
_parse(input) {
|
|
2539
2749
|
const { ctx } = this._processInputParams(input);
|
|
2540
2750
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
@@ -2552,7 +2762,9 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2552
2762
|
addIssueToContext(ctx, {
|
|
2553
2763
|
code: ZodIssueCode.invalid_union_discriminator,
|
|
2554
2764
|
options: Array.from(this.optionsMap.keys()),
|
|
2555
|
-
path: [
|
|
2765
|
+
path: [
|
|
2766
|
+
discriminator
|
|
2767
|
+
]
|
|
2556
2768
|
});
|
|
2557
2769
|
return INVALID;
|
|
2558
2770
|
}
|
|
@@ -2580,13 +2792,13 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2580
2792
|
return this._def.optionsMap;
|
|
2581
2793
|
}
|
|
2582
2794
|
/**
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2795
|
+
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
2796
|
+
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
2797
|
+
* have a different value for each object in the union.
|
|
2798
|
+
* @param discriminator the name of the discriminator property
|
|
2799
|
+
* @param types an array of object schemas
|
|
2800
|
+
* @param params
|
|
2801
|
+
*/
|
|
2590
2802
|
static create(discriminator, options, params) {
|
|
2591
2803
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
2592
2804
|
for (const type of options) {
|
|
@@ -2609,28 +2821,41 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2609
2821
|
...processCreateParams(params)
|
|
2610
2822
|
});
|
|
2611
2823
|
}
|
|
2612
|
-
};
|
|
2613
|
-
|
|
2824
|
+
}, "ZodDiscriminatedUnion");
|
|
2825
|
+
__name2(ZodDiscriminatedUnion, "ZodDiscriminatedUnion");
|
|
2614
2826
|
function mergeValues(a, b) {
|
|
2615
2827
|
const aType = getParsedType(a);
|
|
2616
2828
|
const bType = getParsedType(b);
|
|
2617
2829
|
if (a === b) {
|
|
2618
|
-
return {
|
|
2830
|
+
return {
|
|
2831
|
+
valid: true,
|
|
2832
|
+
data: a
|
|
2833
|
+
};
|
|
2619
2834
|
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
2620
2835
|
const bKeys = util.objectKeys(b);
|
|
2621
2836
|
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
2622
|
-
const newObj = {
|
|
2837
|
+
const newObj = {
|
|
2838
|
+
...a,
|
|
2839
|
+
...b
|
|
2840
|
+
};
|
|
2623
2841
|
for (const key of sharedKeys) {
|
|
2624
2842
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
2625
2843
|
if (!sharedValue.valid) {
|
|
2626
|
-
return {
|
|
2844
|
+
return {
|
|
2845
|
+
valid: false
|
|
2846
|
+
};
|
|
2627
2847
|
}
|
|
2628
2848
|
newObj[key] = sharedValue.data;
|
|
2629
2849
|
}
|
|
2630
|
-
return {
|
|
2850
|
+
return {
|
|
2851
|
+
valid: true,
|
|
2852
|
+
data: newObj
|
|
2853
|
+
};
|
|
2631
2854
|
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
|
2632
2855
|
if (a.length !== b.length) {
|
|
2633
|
-
return {
|
|
2856
|
+
return {
|
|
2857
|
+
valid: false
|
|
2858
|
+
};
|
|
2634
2859
|
}
|
|
2635
2860
|
const newArray = [];
|
|
2636
2861
|
for (let index = 0; index < a.length; index++) {
|
|
@@ -2638,22 +2863,33 @@ function mergeValues(a, b) {
|
|
|
2638
2863
|
const itemB = b[index];
|
|
2639
2864
|
const sharedValue = mergeValues(itemA, itemB);
|
|
2640
2865
|
if (!sharedValue.valid) {
|
|
2641
|
-
return {
|
|
2866
|
+
return {
|
|
2867
|
+
valid: false
|
|
2868
|
+
};
|
|
2642
2869
|
}
|
|
2643
2870
|
newArray.push(sharedValue.data);
|
|
2644
2871
|
}
|
|
2645
|
-
return {
|
|
2872
|
+
return {
|
|
2873
|
+
valid: true,
|
|
2874
|
+
data: newArray
|
|
2875
|
+
};
|
|
2646
2876
|
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
|
2647
|
-
return {
|
|
2877
|
+
return {
|
|
2878
|
+
valid: true,
|
|
2879
|
+
data: a
|
|
2880
|
+
};
|
|
2648
2881
|
} else {
|
|
2649
|
-
return {
|
|
2882
|
+
return {
|
|
2883
|
+
valid: false
|
|
2884
|
+
};
|
|
2650
2885
|
}
|
|
2651
2886
|
}
|
|
2652
2887
|
__name(mergeValues, "mergeValues");
|
|
2653
|
-
|
|
2888
|
+
__name2(mergeValues, "mergeValues");
|
|
2889
|
+
var ZodIntersection = /* @__PURE__ */ __name(class extends ZodType {
|
|
2654
2890
|
_parse(input) {
|
|
2655
2891
|
const { status, ctx } = this._processInputParams(input);
|
|
2656
|
-
const handleParsed = /* @__PURE__ */
|
|
2892
|
+
const handleParsed = /* @__PURE__ */ __name2((parsedLeft, parsedRight) => {
|
|
2657
2893
|
if (isAborted(parsedLeft) || isAborted(parsedRight)) {
|
|
2658
2894
|
return INVALID;
|
|
2659
2895
|
}
|
|
@@ -2667,7 +2903,10 @@ var ZodIntersection = class extends ZodType {
|
|
|
2667
2903
|
if (isDirty(parsedLeft) || isDirty(parsedRight)) {
|
|
2668
2904
|
status.dirty();
|
|
2669
2905
|
}
|
|
2670
|
-
return {
|
|
2906
|
+
return {
|
|
2907
|
+
status: status.value,
|
|
2908
|
+
value: merged.data
|
|
2909
|
+
};
|
|
2671
2910
|
}, "handleParsed");
|
|
2672
2911
|
if (ctx.common.async) {
|
|
2673
2912
|
return Promise.all([
|
|
@@ -2694,8 +2933,8 @@ var ZodIntersection = class extends ZodType {
|
|
|
2694
2933
|
}));
|
|
2695
2934
|
}
|
|
2696
2935
|
}
|
|
2697
|
-
};
|
|
2698
|
-
|
|
2936
|
+
}, "ZodIntersection");
|
|
2937
|
+
__name2(ZodIntersection, "ZodIntersection");
|
|
2699
2938
|
ZodIntersection.create = (left, right, params) => {
|
|
2700
2939
|
return new ZodIntersection({
|
|
2701
2940
|
left,
|
|
@@ -2704,7 +2943,7 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
2704
2943
|
...processCreateParams(params)
|
|
2705
2944
|
});
|
|
2706
2945
|
};
|
|
2707
|
-
var ZodTuple = class extends ZodType {
|
|
2946
|
+
var ZodTuple = /* @__PURE__ */ __name(class extends ZodType {
|
|
2708
2947
|
_parse(input) {
|
|
2709
2948
|
const { status, ctx } = this._processInputParams(input);
|
|
2710
2949
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
@@ -2736,7 +2975,9 @@ var ZodTuple = class extends ZodType {
|
|
|
2736
2975
|
});
|
|
2737
2976
|
status.dirty();
|
|
2738
2977
|
}
|
|
2739
|
-
const items = [
|
|
2978
|
+
const items = [
|
|
2979
|
+
...ctx.data
|
|
2980
|
+
].map((item, itemIndex) => {
|
|
2740
2981
|
const schema = this._def.items[itemIndex] || this._def.rest;
|
|
2741
2982
|
if (!schema)
|
|
2742
2983
|
return null;
|
|
@@ -2759,8 +3000,8 @@ var ZodTuple = class extends ZodType {
|
|
|
2759
3000
|
rest
|
|
2760
3001
|
});
|
|
2761
3002
|
}
|
|
2762
|
-
};
|
|
2763
|
-
|
|
3003
|
+
}, "ZodTuple");
|
|
3004
|
+
__name2(ZodTuple, "ZodTuple");
|
|
2764
3005
|
ZodTuple.create = (schemas, params) => {
|
|
2765
3006
|
if (!Array.isArray(schemas)) {
|
|
2766
3007
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
@@ -2772,7 +3013,7 @@ ZodTuple.create = (schemas, params) => {
|
|
|
2772
3013
|
...processCreateParams(params)
|
|
2773
3014
|
});
|
|
2774
3015
|
};
|
|
2775
|
-
var ZodRecord = class extends ZodType {
|
|
3016
|
+
var ZodRecord = /* @__PURE__ */ __name(class extends ZodType {
|
|
2776
3017
|
get keySchema() {
|
|
2777
3018
|
return this._def.keyType;
|
|
2778
3019
|
}
|
|
@@ -2823,9 +3064,9 @@ var ZodRecord = class extends ZodType {
|
|
|
2823
3064
|
...processCreateParams(second)
|
|
2824
3065
|
});
|
|
2825
3066
|
}
|
|
2826
|
-
};
|
|
2827
|
-
|
|
2828
|
-
var ZodMap = class extends ZodType {
|
|
3067
|
+
}, "ZodRecord");
|
|
3068
|
+
__name2(ZodRecord, "ZodRecord");
|
|
3069
|
+
var ZodMap = /* @__PURE__ */ __name(class extends ZodType {
|
|
2829
3070
|
get keySchema() {
|
|
2830
3071
|
return this._def.keyType;
|
|
2831
3072
|
}
|
|
@@ -2844,10 +3085,18 @@ var ZodMap = class extends ZodType {
|
|
|
2844
3085
|
}
|
|
2845
3086
|
const keyType = this._def.keyType;
|
|
2846
3087
|
const valueType = this._def.valueType;
|
|
2847
|
-
const pairs = [
|
|
3088
|
+
const pairs = [
|
|
3089
|
+
...ctx.data.entries()
|
|
3090
|
+
].map(([key, value], index) => {
|
|
2848
3091
|
return {
|
|
2849
|
-
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [
|
|
2850
|
-
|
|
3092
|
+
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [
|
|
3093
|
+
index,
|
|
3094
|
+
"key"
|
|
3095
|
+
])),
|
|
3096
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [
|
|
3097
|
+
index,
|
|
3098
|
+
"value"
|
|
3099
|
+
]))
|
|
2851
3100
|
};
|
|
2852
3101
|
});
|
|
2853
3102
|
if (ctx.common.async) {
|
|
@@ -2864,7 +3113,10 @@ var ZodMap = class extends ZodType {
|
|
|
2864
3113
|
}
|
|
2865
3114
|
finalMap.set(key.value, value.value);
|
|
2866
3115
|
}
|
|
2867
|
-
return {
|
|
3116
|
+
return {
|
|
3117
|
+
status: status.value,
|
|
3118
|
+
value: finalMap
|
|
3119
|
+
};
|
|
2868
3120
|
});
|
|
2869
3121
|
} else {
|
|
2870
3122
|
const finalMap = /* @__PURE__ */ new Map();
|
|
@@ -2879,11 +3131,14 @@ var ZodMap = class extends ZodType {
|
|
|
2879
3131
|
}
|
|
2880
3132
|
finalMap.set(key.value, value.value);
|
|
2881
3133
|
}
|
|
2882
|
-
return {
|
|
3134
|
+
return {
|
|
3135
|
+
status: status.value,
|
|
3136
|
+
value: finalMap
|
|
3137
|
+
};
|
|
2883
3138
|
}
|
|
2884
3139
|
}
|
|
2885
|
-
};
|
|
2886
|
-
|
|
3140
|
+
}, "ZodMap");
|
|
3141
|
+
__name2(ZodMap, "ZodMap");
|
|
2887
3142
|
ZodMap.create = (keyType, valueType, params) => {
|
|
2888
3143
|
return new ZodMap({
|
|
2889
3144
|
valueType,
|
|
@@ -2892,7 +3147,7 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
2892
3147
|
...processCreateParams(params)
|
|
2893
3148
|
});
|
|
2894
3149
|
};
|
|
2895
|
-
var ZodSet = class extends ZodType {
|
|
3150
|
+
var ZodSet = /* @__PURE__ */ __name(class extends ZodType {
|
|
2896
3151
|
_parse(input) {
|
|
2897
3152
|
const { status, ctx } = this._processInputParams(input);
|
|
2898
3153
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
@@ -2940,10 +3195,16 @@ var ZodSet = class extends ZodType {
|
|
|
2940
3195
|
status.dirty();
|
|
2941
3196
|
parsedSet.add(element.value);
|
|
2942
3197
|
}
|
|
2943
|
-
return {
|
|
3198
|
+
return {
|
|
3199
|
+
status: status.value,
|
|
3200
|
+
value: parsedSet
|
|
3201
|
+
};
|
|
2944
3202
|
}
|
|
2945
3203
|
__name(finalizeSet, "finalizeSet");
|
|
2946
|
-
|
|
3204
|
+
__name2(finalizeSet, "finalizeSet");
|
|
3205
|
+
const elements = [
|
|
3206
|
+
...ctx.data.values()
|
|
3207
|
+
].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
|
|
2947
3208
|
if (ctx.common.async) {
|
|
2948
3209
|
return Promise.all(elements).then((elements2) => finalizeSet(elements2));
|
|
2949
3210
|
} else {
|
|
@@ -2953,13 +3214,19 @@ var ZodSet = class extends ZodType {
|
|
|
2953
3214
|
min(minSize, message) {
|
|
2954
3215
|
return new ZodSet({
|
|
2955
3216
|
...this._def,
|
|
2956
|
-
minSize: {
|
|
3217
|
+
minSize: {
|
|
3218
|
+
value: minSize,
|
|
3219
|
+
message: errorUtil.toString(message)
|
|
3220
|
+
}
|
|
2957
3221
|
});
|
|
2958
3222
|
}
|
|
2959
3223
|
max(maxSize, message) {
|
|
2960
3224
|
return new ZodSet({
|
|
2961
3225
|
...this._def,
|
|
2962
|
-
maxSize: {
|
|
3226
|
+
maxSize: {
|
|
3227
|
+
value: maxSize,
|
|
3228
|
+
message: errorUtil.toString(message)
|
|
3229
|
+
}
|
|
2963
3230
|
});
|
|
2964
3231
|
}
|
|
2965
3232
|
size(size, message) {
|
|
@@ -2968,8 +3235,8 @@ var ZodSet = class extends ZodType {
|
|
|
2968
3235
|
nonempty(message) {
|
|
2969
3236
|
return this.min(1, message);
|
|
2970
3237
|
}
|
|
2971
|
-
};
|
|
2972
|
-
|
|
3238
|
+
}, "ZodSet");
|
|
3239
|
+
__name2(ZodSet, "ZodSet");
|
|
2973
3240
|
ZodSet.create = (valueType, params) => {
|
|
2974
3241
|
return new ZodSet({
|
|
2975
3242
|
valueType,
|
|
@@ -2979,7 +3246,7 @@ ZodSet.create = (valueType, params) => {
|
|
|
2979
3246
|
...processCreateParams(params)
|
|
2980
3247
|
});
|
|
2981
3248
|
};
|
|
2982
|
-
var ZodFunction = class extends ZodType {
|
|
3249
|
+
var ZodFunction = /* @__PURE__ */ __name(class extends ZodType {
|
|
2983
3250
|
constructor() {
|
|
2984
3251
|
super(...arguments);
|
|
2985
3252
|
this.validate = this.implement;
|
|
@@ -3011,6 +3278,7 @@ var ZodFunction = class extends ZodType {
|
|
|
3011
3278
|
});
|
|
3012
3279
|
}
|
|
3013
3280
|
__name(makeArgsIssue, "makeArgsIssue");
|
|
3281
|
+
__name2(makeArgsIssue, "makeArgsIssue");
|
|
3014
3282
|
function makeReturnsIssue(returns, error) {
|
|
3015
3283
|
return makeIssue({
|
|
3016
3284
|
data: returns,
|
|
@@ -3028,7 +3296,10 @@ var ZodFunction = class extends ZodType {
|
|
|
3028
3296
|
});
|
|
3029
3297
|
}
|
|
3030
3298
|
__name(makeReturnsIssue, "makeReturnsIssue");
|
|
3031
|
-
|
|
3299
|
+
__name2(makeReturnsIssue, "makeReturnsIssue");
|
|
3300
|
+
const params = {
|
|
3301
|
+
errorMap: ctx.common.contextualErrorMap
|
|
3302
|
+
};
|
|
3032
3303
|
const fn = ctx.data;
|
|
3033
3304
|
if (this._def.returns instanceof ZodPromise) {
|
|
3034
3305
|
const me = this;
|
|
@@ -3050,12 +3321,16 @@ var ZodFunction = class extends ZodType {
|
|
|
3050
3321
|
return OK(function(...args) {
|
|
3051
3322
|
const parsedArgs = me._def.args.safeParse(args, params);
|
|
3052
3323
|
if (!parsedArgs.success) {
|
|
3053
|
-
throw new ZodError([
|
|
3324
|
+
throw new ZodError([
|
|
3325
|
+
makeArgsIssue(args, parsedArgs.error)
|
|
3326
|
+
]);
|
|
3054
3327
|
}
|
|
3055
3328
|
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3056
3329
|
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
3057
3330
|
if (!parsedReturns.success) {
|
|
3058
|
-
throw new ZodError([
|
|
3331
|
+
throw new ZodError([
|
|
3332
|
+
makeReturnsIssue(result, parsedReturns.error)
|
|
3333
|
+
]);
|
|
3059
3334
|
}
|
|
3060
3335
|
return parsedReturns.data;
|
|
3061
3336
|
});
|
|
@@ -3095,19 +3370,23 @@ var ZodFunction = class extends ZodType {
|
|
|
3095
3370
|
...processCreateParams(params)
|
|
3096
3371
|
});
|
|
3097
3372
|
}
|
|
3098
|
-
};
|
|
3099
|
-
|
|
3100
|
-
var ZodLazy = class extends ZodType {
|
|
3373
|
+
}, "ZodFunction");
|
|
3374
|
+
__name2(ZodFunction, "ZodFunction");
|
|
3375
|
+
var ZodLazy = /* @__PURE__ */ __name(class extends ZodType {
|
|
3101
3376
|
get schema() {
|
|
3102
3377
|
return this._def.getter();
|
|
3103
3378
|
}
|
|
3104
3379
|
_parse(input) {
|
|
3105
3380
|
const { ctx } = this._processInputParams(input);
|
|
3106
3381
|
const lazySchema = this._def.getter();
|
|
3107
|
-
return lazySchema._parse({
|
|
3382
|
+
return lazySchema._parse({
|
|
3383
|
+
data: ctx.data,
|
|
3384
|
+
path: ctx.path,
|
|
3385
|
+
parent: ctx
|
|
3386
|
+
});
|
|
3108
3387
|
}
|
|
3109
|
-
};
|
|
3110
|
-
|
|
3388
|
+
}, "ZodLazy");
|
|
3389
|
+
__name2(ZodLazy, "ZodLazy");
|
|
3111
3390
|
ZodLazy.create = (getter, params) => {
|
|
3112
3391
|
return new ZodLazy({
|
|
3113
3392
|
getter,
|
|
@@ -3115,7 +3394,7 @@ ZodLazy.create = (getter, params) => {
|
|
|
3115
3394
|
...processCreateParams(params)
|
|
3116
3395
|
});
|
|
3117
3396
|
};
|
|
3118
|
-
var ZodLiteral = class extends ZodType {
|
|
3397
|
+
var ZodLiteral = /* @__PURE__ */ __name(class extends ZodType {
|
|
3119
3398
|
_parse(input) {
|
|
3120
3399
|
if (input.data !== this._def.value) {
|
|
3121
3400
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3126,13 +3405,16 @@ var ZodLiteral = class extends ZodType {
|
|
|
3126
3405
|
});
|
|
3127
3406
|
return INVALID;
|
|
3128
3407
|
}
|
|
3129
|
-
return {
|
|
3408
|
+
return {
|
|
3409
|
+
status: "valid",
|
|
3410
|
+
value: input.data
|
|
3411
|
+
};
|
|
3130
3412
|
}
|
|
3131
3413
|
get value() {
|
|
3132
3414
|
return this._def.value;
|
|
3133
3415
|
}
|
|
3134
|
-
};
|
|
3135
|
-
|
|
3416
|
+
}, "ZodLiteral");
|
|
3417
|
+
__name2(ZodLiteral, "ZodLiteral");
|
|
3136
3418
|
ZodLiteral.create = (value, params) => {
|
|
3137
3419
|
return new ZodLiteral({
|
|
3138
3420
|
value,
|
|
@@ -3148,7 +3430,8 @@ function createZodEnum(values, params) {
|
|
|
3148
3430
|
});
|
|
3149
3431
|
}
|
|
3150
3432
|
__name(createZodEnum, "createZodEnum");
|
|
3151
|
-
|
|
3433
|
+
__name2(createZodEnum, "createZodEnum");
|
|
3434
|
+
var ZodEnum = /* @__PURE__ */ __name(class extends ZodType {
|
|
3152
3435
|
_parse(input) {
|
|
3153
3436
|
if (typeof input.data !== "string") {
|
|
3154
3437
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3202,10 +3485,10 @@ var ZodEnum = class extends ZodType {
|
|
|
3202
3485
|
exclude(values) {
|
|
3203
3486
|
return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
|
3204
3487
|
}
|
|
3205
|
-
};
|
|
3206
|
-
|
|
3488
|
+
}, "ZodEnum");
|
|
3489
|
+
__name2(ZodEnum, "ZodEnum");
|
|
3207
3490
|
ZodEnum.create = createZodEnum;
|
|
3208
|
-
var ZodNativeEnum = class extends ZodType {
|
|
3491
|
+
var ZodNativeEnum = /* @__PURE__ */ __name(class extends ZodType {
|
|
3209
3492
|
_parse(input) {
|
|
3210
3493
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
3211
3494
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3232,8 +3515,8 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
3232
3515
|
get enum() {
|
|
3233
3516
|
return this._def.values;
|
|
3234
3517
|
}
|
|
3235
|
-
};
|
|
3236
|
-
|
|
3518
|
+
}, "ZodNativeEnum");
|
|
3519
|
+
__name2(ZodNativeEnum, "ZodNativeEnum");
|
|
3237
3520
|
ZodNativeEnum.create = (values, params) => {
|
|
3238
3521
|
return new ZodNativeEnum({
|
|
3239
3522
|
values,
|
|
@@ -3241,7 +3524,7 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
3241
3524
|
...processCreateParams(params)
|
|
3242
3525
|
});
|
|
3243
3526
|
};
|
|
3244
|
-
var ZodPromise = class extends ZodType {
|
|
3527
|
+
var ZodPromise = /* @__PURE__ */ __name(class extends ZodType {
|
|
3245
3528
|
unwrap() {
|
|
3246
3529
|
return this._def.type;
|
|
3247
3530
|
}
|
|
@@ -3263,8 +3546,8 @@ var ZodPromise = class extends ZodType {
|
|
|
3263
3546
|
});
|
|
3264
3547
|
}));
|
|
3265
3548
|
}
|
|
3266
|
-
};
|
|
3267
|
-
|
|
3549
|
+
}, "ZodPromise");
|
|
3550
|
+
__name2(ZodPromise, "ZodPromise");
|
|
3268
3551
|
ZodPromise.create = (schema, params) => {
|
|
3269
3552
|
return new ZodPromise({
|
|
3270
3553
|
type: schema,
|
|
@@ -3272,7 +3555,7 @@ ZodPromise.create = (schema, params) => {
|
|
|
3272
3555
|
...processCreateParams(params)
|
|
3273
3556
|
});
|
|
3274
3557
|
};
|
|
3275
|
-
var ZodEffects = class extends ZodType {
|
|
3558
|
+
var ZodEffects = /* @__PURE__ */ __name(class extends ZodType {
|
|
3276
3559
|
innerType() {
|
|
3277
3560
|
return this._def.schema;
|
|
3278
3561
|
}
|
|
@@ -3321,7 +3604,7 @@ var ZodEffects = class extends ZodType {
|
|
|
3321
3604
|
}
|
|
3322
3605
|
}
|
|
3323
3606
|
if (effect.type === "refinement") {
|
|
3324
|
-
const executeRefinement = /* @__PURE__ */
|
|
3607
|
+
const executeRefinement = /* @__PURE__ */ __name2((acc) => {
|
|
3325
3608
|
const result = effect.refinement(acc, checkCtx);
|
|
3326
3609
|
if (ctx.common.async) {
|
|
3327
3610
|
return Promise.resolve(result);
|
|
@@ -3342,15 +3625,25 @@ var ZodEffects = class extends ZodType {
|
|
|
3342
3625
|
if (inner.status === "dirty")
|
|
3343
3626
|
status.dirty();
|
|
3344
3627
|
executeRefinement(inner.value);
|
|
3345
|
-
return {
|
|
3628
|
+
return {
|
|
3629
|
+
status: status.value,
|
|
3630
|
+
value: inner.value
|
|
3631
|
+
};
|
|
3346
3632
|
} else {
|
|
3347
|
-
return this._def.schema._parseAsync({
|
|
3633
|
+
return this._def.schema._parseAsync({
|
|
3634
|
+
data: ctx.data,
|
|
3635
|
+
path: ctx.path,
|
|
3636
|
+
parent: ctx
|
|
3637
|
+
}).then((inner) => {
|
|
3348
3638
|
if (inner.status === "aborted")
|
|
3349
3639
|
return INVALID;
|
|
3350
3640
|
if (inner.status === "dirty")
|
|
3351
3641
|
status.dirty();
|
|
3352
3642
|
return executeRefinement(inner.value).then(() => {
|
|
3353
|
-
return {
|
|
3643
|
+
return {
|
|
3644
|
+
status: status.value,
|
|
3645
|
+
value: inner.value
|
|
3646
|
+
};
|
|
3354
3647
|
});
|
|
3355
3648
|
});
|
|
3356
3649
|
}
|
|
@@ -3368,19 +3661,29 @@ var ZodEffects = class extends ZodType {
|
|
|
3368
3661
|
if (result instanceof Promise) {
|
|
3369
3662
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
3370
3663
|
}
|
|
3371
|
-
return {
|
|
3664
|
+
return {
|
|
3665
|
+
status: status.value,
|
|
3666
|
+
value: result
|
|
3667
|
+
};
|
|
3372
3668
|
} else {
|
|
3373
|
-
return this._def.schema._parseAsync({
|
|
3669
|
+
return this._def.schema._parseAsync({
|
|
3670
|
+
data: ctx.data,
|
|
3671
|
+
path: ctx.path,
|
|
3672
|
+
parent: ctx
|
|
3673
|
+
}).then((base) => {
|
|
3374
3674
|
if (!isValid(base))
|
|
3375
3675
|
return base;
|
|
3376
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3676
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3677
|
+
status: status.value,
|
|
3678
|
+
value: result
|
|
3679
|
+
}));
|
|
3377
3680
|
});
|
|
3378
3681
|
}
|
|
3379
3682
|
}
|
|
3380
3683
|
util.assertNever(effect);
|
|
3381
3684
|
}
|
|
3382
|
-
};
|
|
3383
|
-
|
|
3685
|
+
}, "ZodEffects");
|
|
3686
|
+
__name2(ZodEffects, "ZodEffects");
|
|
3384
3687
|
ZodEffects.create = (schema, effect, params) => {
|
|
3385
3688
|
return new ZodEffects({
|
|
3386
3689
|
schema,
|
|
@@ -3392,12 +3695,15 @@ ZodEffects.create = (schema, effect, params) => {
|
|
|
3392
3695
|
ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
3393
3696
|
return new ZodEffects({
|
|
3394
3697
|
schema,
|
|
3395
|
-
effect: {
|
|
3698
|
+
effect: {
|
|
3699
|
+
type: "preprocess",
|
|
3700
|
+
transform: preprocess
|
|
3701
|
+
},
|
|
3396
3702
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
3397
3703
|
...processCreateParams(params)
|
|
3398
3704
|
});
|
|
3399
3705
|
};
|
|
3400
|
-
var ZodOptional = class extends ZodType {
|
|
3706
|
+
var ZodOptional = /* @__PURE__ */ __name(class extends ZodType {
|
|
3401
3707
|
_parse(input) {
|
|
3402
3708
|
const parsedType = this._getType(input);
|
|
3403
3709
|
if (parsedType === ZodParsedType.undefined) {
|
|
@@ -3408,8 +3714,8 @@ var ZodOptional = class extends ZodType {
|
|
|
3408
3714
|
unwrap() {
|
|
3409
3715
|
return this._def.innerType;
|
|
3410
3716
|
}
|
|
3411
|
-
};
|
|
3412
|
-
|
|
3717
|
+
}, "ZodOptional");
|
|
3718
|
+
__name2(ZodOptional, "ZodOptional");
|
|
3413
3719
|
ZodOptional.create = (type, params) => {
|
|
3414
3720
|
return new ZodOptional({
|
|
3415
3721
|
innerType: type,
|
|
@@ -3417,7 +3723,7 @@ ZodOptional.create = (type, params) => {
|
|
|
3417
3723
|
...processCreateParams(params)
|
|
3418
3724
|
});
|
|
3419
3725
|
};
|
|
3420
|
-
var ZodNullable = class extends ZodType {
|
|
3726
|
+
var ZodNullable = /* @__PURE__ */ __name(class extends ZodType {
|
|
3421
3727
|
_parse(input) {
|
|
3422
3728
|
const parsedType = this._getType(input);
|
|
3423
3729
|
if (parsedType === ZodParsedType.null) {
|
|
@@ -3428,8 +3734,8 @@ var ZodNullable = class extends ZodType {
|
|
|
3428
3734
|
unwrap() {
|
|
3429
3735
|
return this._def.innerType;
|
|
3430
3736
|
}
|
|
3431
|
-
};
|
|
3432
|
-
|
|
3737
|
+
}, "ZodNullable");
|
|
3738
|
+
__name2(ZodNullable, "ZodNullable");
|
|
3433
3739
|
ZodNullable.create = (type, params) => {
|
|
3434
3740
|
return new ZodNullable({
|
|
3435
3741
|
innerType: type,
|
|
@@ -3437,7 +3743,7 @@ ZodNullable.create = (type, params) => {
|
|
|
3437
3743
|
...processCreateParams(params)
|
|
3438
3744
|
});
|
|
3439
3745
|
};
|
|
3440
|
-
var ZodDefault = class extends ZodType {
|
|
3746
|
+
var ZodDefault = /* @__PURE__ */ __name(class extends ZodType {
|
|
3441
3747
|
_parse(input) {
|
|
3442
3748
|
const { ctx } = this._processInputParams(input);
|
|
3443
3749
|
let data = ctx.data;
|
|
@@ -3453,8 +3759,8 @@ var ZodDefault = class extends ZodType {
|
|
|
3453
3759
|
removeDefault() {
|
|
3454
3760
|
return this._def.innerType;
|
|
3455
3761
|
}
|
|
3456
|
-
};
|
|
3457
|
-
|
|
3762
|
+
}, "ZodDefault");
|
|
3763
|
+
__name2(ZodDefault, "ZodDefault");
|
|
3458
3764
|
ZodDefault.create = (type, params) => {
|
|
3459
3765
|
return new ZodDefault({
|
|
3460
3766
|
innerType: type,
|
|
@@ -3463,7 +3769,7 @@ ZodDefault.create = (type, params) => {
|
|
|
3463
3769
|
...processCreateParams(params)
|
|
3464
3770
|
});
|
|
3465
3771
|
};
|
|
3466
|
-
var ZodCatch = class extends ZodType {
|
|
3772
|
+
var ZodCatch = /* @__PURE__ */ __name(class extends ZodType {
|
|
3467
3773
|
_parse(input) {
|
|
3468
3774
|
const { ctx } = this._processInputParams(input);
|
|
3469
3775
|
const newCtx = {
|
|
@@ -3507,8 +3813,8 @@ var ZodCatch = class extends ZodType {
|
|
|
3507
3813
|
removeCatch() {
|
|
3508
3814
|
return this._def.innerType;
|
|
3509
3815
|
}
|
|
3510
|
-
};
|
|
3511
|
-
|
|
3816
|
+
}, "ZodCatch");
|
|
3817
|
+
__name2(ZodCatch, "ZodCatch");
|
|
3512
3818
|
ZodCatch.create = (type, params) => {
|
|
3513
3819
|
return new ZodCatch({
|
|
3514
3820
|
innerType: type,
|
|
@@ -3517,7 +3823,7 @@ ZodCatch.create = (type, params) => {
|
|
|
3517
3823
|
...processCreateParams(params)
|
|
3518
3824
|
});
|
|
3519
3825
|
};
|
|
3520
|
-
var ZodNaN = class extends ZodType {
|
|
3826
|
+
var ZodNaN = /* @__PURE__ */ __name(class extends ZodType {
|
|
3521
3827
|
_parse(input) {
|
|
3522
3828
|
const parsedType = this._getType(input);
|
|
3523
3829
|
if (parsedType !== ZodParsedType.nan) {
|
|
@@ -3529,10 +3835,13 @@ var ZodNaN = class extends ZodType {
|
|
|
3529
3835
|
});
|
|
3530
3836
|
return INVALID;
|
|
3531
3837
|
}
|
|
3532
|
-
return {
|
|
3838
|
+
return {
|
|
3839
|
+
status: "valid",
|
|
3840
|
+
value: input.data
|
|
3841
|
+
};
|
|
3533
3842
|
}
|
|
3534
|
-
};
|
|
3535
|
-
|
|
3843
|
+
}, "ZodNaN");
|
|
3844
|
+
__name2(ZodNaN, "ZodNaN");
|
|
3536
3845
|
ZodNaN.create = (params) => {
|
|
3537
3846
|
return new ZodNaN({
|
|
3538
3847
|
typeName: ZodFirstPartyTypeKind.ZodNaN,
|
|
@@ -3540,7 +3849,7 @@ ZodNaN.create = (params) => {
|
|
|
3540
3849
|
});
|
|
3541
3850
|
};
|
|
3542
3851
|
var BRAND = Symbol("zod_brand");
|
|
3543
|
-
var ZodBranded = class extends ZodType {
|
|
3852
|
+
var ZodBranded = /* @__PURE__ */ __name(class extends ZodType {
|
|
3544
3853
|
_parse(input) {
|
|
3545
3854
|
const { ctx } = this._processInputParams(input);
|
|
3546
3855
|
const data = ctx.data;
|
|
@@ -3553,13 +3862,13 @@ var ZodBranded = class extends ZodType {
|
|
|
3553
3862
|
unwrap() {
|
|
3554
3863
|
return this._def.type;
|
|
3555
3864
|
}
|
|
3556
|
-
};
|
|
3557
|
-
|
|
3558
|
-
var ZodPipeline = class extends ZodType {
|
|
3865
|
+
}, "ZodBranded");
|
|
3866
|
+
__name2(ZodBranded, "ZodBranded");
|
|
3867
|
+
var ZodPipeline = /* @__PURE__ */ __name(class extends ZodType {
|
|
3559
3868
|
_parse(input) {
|
|
3560
3869
|
const { status, ctx } = this._processInputParams(input);
|
|
3561
3870
|
if (ctx.common.async) {
|
|
3562
|
-
const handleAsync = /* @__PURE__ */
|
|
3871
|
+
const handleAsync = /* @__PURE__ */ __name2(async () => {
|
|
3563
3872
|
const inResult = await this._def.in._parseAsync({
|
|
3564
3873
|
data: ctx.data,
|
|
3565
3874
|
path: ctx.path,
|
|
@@ -3609,9 +3918,9 @@ var ZodPipeline = class extends ZodType {
|
|
|
3609
3918
|
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
3610
3919
|
});
|
|
3611
3920
|
}
|
|
3612
|
-
};
|
|
3613
|
-
|
|
3614
|
-
var ZodReadonly = class extends ZodType {
|
|
3921
|
+
}, "ZodPipeline");
|
|
3922
|
+
__name2(ZodPipeline, "ZodPipeline");
|
|
3923
|
+
var ZodReadonly = /* @__PURE__ */ __name(class extends ZodType {
|
|
3615
3924
|
_parse(input) {
|
|
3616
3925
|
const result = this._def.innerType._parse(input);
|
|
3617
3926
|
if (isValid(result)) {
|
|
@@ -3619,8 +3928,8 @@ var ZodReadonly = class extends ZodType {
|
|
|
3619
3928
|
}
|
|
3620
3929
|
return result;
|
|
3621
3930
|
}
|
|
3622
|
-
};
|
|
3623
|
-
|
|
3931
|
+
}, "ZodReadonly");
|
|
3932
|
+
__name2(ZodReadonly, "ZodReadonly");
|
|
3624
3933
|
ZodReadonly.create = (type, params) => {
|
|
3625
3934
|
return new ZodReadonly({
|
|
3626
3935
|
innerType: type,
|
|
@@ -3628,15 +3937,23 @@ ZodReadonly.create = (type, params) => {
|
|
|
3628
3937
|
...processCreateParams(params)
|
|
3629
3938
|
});
|
|
3630
3939
|
};
|
|
3631
|
-
var custom = /* @__PURE__ */
|
|
3940
|
+
var custom = /* @__PURE__ */ __name2((check, params = {}, fatal) => {
|
|
3632
3941
|
if (check)
|
|
3633
3942
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3634
3943
|
var _a, _b;
|
|
3635
3944
|
if (!check(data)) {
|
|
3636
|
-
const p = typeof params === "function" ? params(data) : typeof params === "string" ? {
|
|
3945
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? {
|
|
3946
|
+
message: params
|
|
3947
|
+
} : params;
|
|
3637
3948
|
const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
3638
|
-
const p2 = typeof p === "string" ? {
|
|
3639
|
-
|
|
3949
|
+
const p2 = typeof p === "string" ? {
|
|
3950
|
+
message: p
|
|
3951
|
+
} : p;
|
|
3952
|
+
ctx.addIssue({
|
|
3953
|
+
code: "custom",
|
|
3954
|
+
...p2,
|
|
3955
|
+
fatal: _fatal
|
|
3956
|
+
});
|
|
3640
3957
|
}
|
|
3641
3958
|
});
|
|
3642
3959
|
return ZodAny.create();
|
|
@@ -3683,7 +4000,7 @@ var ZodFirstPartyTypeKind;
|
|
|
3683
4000
|
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
3684
4001
|
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
3685
4002
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
3686
|
-
var instanceOfType = /* @__PURE__ */
|
|
4003
|
+
var instanceOfType = /* @__PURE__ */ __name2((cls, params = {
|
|
3687
4004
|
message: `Input not instance of ${cls.name}`
|
|
3688
4005
|
}) => custom((data) => data instanceof cls, params), "instanceOfType");
|
|
3689
4006
|
var stringType = ZodString.create;
|
|
@@ -3720,18 +4037,30 @@ var optionalType = ZodOptional.create;
|
|
|
3720
4037
|
var nullableType = ZodNullable.create;
|
|
3721
4038
|
var preprocessType = ZodEffects.createWithPreprocess;
|
|
3722
4039
|
var pipelineType = ZodPipeline.create;
|
|
3723
|
-
var ostring = /* @__PURE__ */
|
|
3724
|
-
var onumber = /* @__PURE__ */
|
|
3725
|
-
var oboolean = /* @__PURE__ */
|
|
4040
|
+
var ostring = /* @__PURE__ */ __name2(() => stringType().optional(), "ostring");
|
|
4041
|
+
var onumber = /* @__PURE__ */ __name2(() => numberType().optional(), "onumber");
|
|
4042
|
+
var oboolean = /* @__PURE__ */ __name2(() => booleanType().optional(), "oboolean");
|
|
3726
4043
|
var coerce = {
|
|
3727
|
-
string: (arg) => ZodString.create({
|
|
3728
|
-
|
|
4044
|
+
string: (arg) => ZodString.create({
|
|
4045
|
+
...arg,
|
|
4046
|
+
coerce: true
|
|
4047
|
+
}),
|
|
4048
|
+
number: (arg) => ZodNumber.create({
|
|
4049
|
+
...arg,
|
|
4050
|
+
coerce: true
|
|
4051
|
+
}),
|
|
3729
4052
|
boolean: (arg) => ZodBoolean.create({
|
|
3730
4053
|
...arg,
|
|
3731
4054
|
coerce: true
|
|
3732
4055
|
}),
|
|
3733
|
-
bigint: (arg) => ZodBigInt.create({
|
|
3734
|
-
|
|
4056
|
+
bigint: (arg) => ZodBigInt.create({
|
|
4057
|
+
...arg,
|
|
4058
|
+
coerce: true
|
|
4059
|
+
}),
|
|
4060
|
+
date: (arg) => ZodDate.create({
|
|
4061
|
+
...arg,
|
|
4062
|
+
coerce: true
|
|
4063
|
+
})
|
|
3735
4064
|
};
|
|
3736
4065
|
var NEVER = INVALID;
|
|
3737
4066
|
var z = /* @__PURE__ */ Object.freeze({
|
|
@@ -3850,11 +4179,11 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
3850
4179
|
ZodError
|
|
3851
4180
|
});
|
|
3852
4181
|
|
|
3853
|
-
// ../core/schemas/video-resource.js
|
|
4182
|
+
// ../core/dist/schemas/video-resource.js
|
|
3854
4183
|
var VideoResourceSchema = z.object({
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
4184
|
+
id: z.string(),
|
|
4185
|
+
updatedAt: z.string().optional(),
|
|
4186
|
+
createdAt: z.string().optional(),
|
|
3858
4187
|
title: z.string().optional().nullable(),
|
|
3859
4188
|
duration: z.number().optional().nullable(),
|
|
3860
4189
|
muxPlaybackId: z.string().optional().nullable(),
|
|
@@ -3873,28 +4202,56 @@ var VideoResourceSchema = z.object({
|
|
|
3873
4202
|
});
|
|
3874
4203
|
|
|
3875
4204
|
// src/lib/mysql/index.ts
|
|
3876
|
-
function
|
|
4205
|
+
function getCourseBuilderSchema(mysqlTable) {
|
|
3877
4206
|
return {
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
coupon: getCouponSchema(
|
|
4207
|
+
accounts: getAccountsSchema(mysqlTable),
|
|
4208
|
+
accountsRelations: getAccountsRelationsSchema(mysqlTable),
|
|
4209
|
+
permissions: getPermissionsSchema(mysqlTable),
|
|
4210
|
+
permissionsRelations: getPermissionsRelationsSchema(mysqlTable),
|
|
4211
|
+
rolePermissions: getRolePermissionsSchema(mysqlTable),
|
|
4212
|
+
rolePermissionsRelations: getRolePermissionsRelationsSchema(mysqlTable),
|
|
4213
|
+
roles: getRolesSchema(mysqlTable),
|
|
4214
|
+
rolesRelations: getRolesRelationsSchema(mysqlTable),
|
|
4215
|
+
sessions: getSessionsSchema(mysqlTable),
|
|
4216
|
+
sessionsRelations: getSessionRelationsSchema(mysqlTable),
|
|
4217
|
+
userPermissions: getUserPermissionsSchema(mysqlTable),
|
|
4218
|
+
userPermissionsRelations: getUserPermissionsRelationsSchema(mysqlTable),
|
|
4219
|
+
userRoles: getUserRolesSchema(mysqlTable),
|
|
4220
|
+
userRolesRelations: getUserRolesRelationsSchema(mysqlTable),
|
|
4221
|
+
users: getUsersSchema(mysqlTable),
|
|
4222
|
+
usersRelations: getUsersRelationsSchema(mysqlTable),
|
|
4223
|
+
verificationTokens: getVerificationTokensSchema(mysqlTable),
|
|
4224
|
+
coupon: getCouponSchema(mysqlTable),
|
|
4225
|
+
merchantAccount: getMerchantAccountSchema(mysqlTable),
|
|
4226
|
+
merchantCharge: getMerchantChargeSchema(mysqlTable),
|
|
4227
|
+
merchantCoupon: getMerchantCouponSchema(mysqlTable),
|
|
4228
|
+
merchantCustomer: getMerchantCustomerSchema(mysqlTable),
|
|
4229
|
+
merchantPrice: getMerchantPriceSchema(mysqlTable),
|
|
4230
|
+
merchantProduct: getMerchantProductSchema(mysqlTable),
|
|
4231
|
+
merchantSession: getMerchantSessionSchema(mysqlTable),
|
|
4232
|
+
price: getPriceSchema(mysqlTable),
|
|
4233
|
+
product: getProductSchema(mysqlTable),
|
|
4234
|
+
purchase: getPurchaseSchema(mysqlTable),
|
|
4235
|
+
purchaseUserTransfer: getPurchaseUserTransferSchema(mysqlTable),
|
|
4236
|
+
communicationChannel: getCommunicationChannelSchema(mysqlTable),
|
|
4237
|
+
communicationPreferenceTypes: getCommunicationPreferenceTypesSchema(mysqlTable),
|
|
4238
|
+
communicationPreferences: getCommunicationPreferencesSchema(mysqlTable),
|
|
4239
|
+
communicationPreferencesRelations: getCommunicationPreferencesRelationsSchema(mysqlTable),
|
|
4240
|
+
contentContributions: getContentContributionsSchema(mysqlTable),
|
|
4241
|
+
contentContributionRelations: getContentContributionRelationsSchema(mysqlTable),
|
|
4242
|
+
contentResource: getContentResourceSchema(mysqlTable),
|
|
4243
|
+
contentResourceRelations: getContentResourceRelationsSchema(mysqlTable),
|
|
4244
|
+
contentResourceResource: getContentResourceResourceSchema(mysqlTable),
|
|
4245
|
+
contentResourceResourceRelations: getContentResourceResourceRelationsSchema(mysqlTable),
|
|
4246
|
+
contributionTypes: getContributionTypesSchema(mysqlTable),
|
|
4247
|
+
contributionTypesRelations: getContributionTypesRelationsSchema(mysqlTable),
|
|
4248
|
+
resourceProgress: getResourceProgressSchema(mysqlTable)
|
|
3896
4249
|
};
|
|
3897
4250
|
}
|
|
4251
|
+
__name(getCourseBuilderSchema, "getCourseBuilderSchema");
|
|
4252
|
+
function createTables(mySqlTable) {
|
|
4253
|
+
return getCourseBuilderSchema(mySqlTable);
|
|
4254
|
+
}
|
|
3898
4255
|
__name(createTables, "createTables");
|
|
3899
4256
|
function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
3900
4257
|
const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchase, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, price, product } = createTables(tableFn);
|
|
@@ -3918,9 +4275,9 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
3918
4275
|
}
|
|
3919
4276
|
const query = sql`
|
|
3920
4277
|
SELECT
|
|
3921
|
-
id as
|
|
3922
|
-
CAST(updatedAt AS DATETIME) as
|
|
3923
|
-
CAST(createdAt AS DATETIME) as
|
|
4278
|
+
id as id,
|
|
4279
|
+
CAST(updatedAt AS DATETIME) as updatedAt,
|
|
4280
|
+
CAST(createdAt AS DATETIME) as createdAt,
|
|
3924
4281
|
JSON_EXTRACT (${contentResource.fields}, "$.state") AS state,
|
|
3925
4282
|
JSON_EXTRACT (${contentResource.fields}, "$.duration") AS duration,
|
|
3926
4283
|
JSON_EXTRACT (${contentResource.fields}, "$.muxPlaybackId") AS muxPlaybackId,
|
|
@@ -4029,6 +4386,8 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
4029
4386
|
async deleteUser(id) {
|
|
4030
4387
|
const user = await client.select().from(users).where(eq(users.id, id)).then((res) => res[0] ?? null);
|
|
4031
4388
|
await client.delete(users).where(eq(users.id, id));
|
|
4389
|
+
await client.delete(sessions).where(eq(sessions.userId, id));
|
|
4390
|
+
await client.delete(accounts).where(eq(accounts.userId, id));
|
|
4032
4391
|
return user;
|
|
4033
4392
|
},
|
|
4034
4393
|
async unlinkAccount(account) {
|
|
@@ -4040,7 +4399,8 @@ function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
4040
4399
|
__name(mySqlDrizzleAdapter, "mySqlDrizzleAdapter");
|
|
4041
4400
|
|
|
4042
4401
|
export {
|
|
4402
|
+
getCourseBuilderSchema,
|
|
4043
4403
|
createTables,
|
|
4044
4404
|
mySqlDrizzleAdapter
|
|
4045
4405
|
};
|
|
4046
|
-
//# sourceMappingURL=chunk-
|
|
4406
|
+
//# sourceMappingURL=chunk-FRNVLW7N.js.map
|