@coursebuilder/adapter-drizzle 0.1.3 → 0.1.4
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-XXZQBN6S.js → chunk-2CI3IGR2.js} +4 -4
- package/dist/{chunk-3LWFRGZT.js → chunk-3RJVKNXB.js} +458 -381
- package/dist/{chunk-NXFHRDLS.js → chunk-53266VWH.js} +3 -3
- package/dist/{chunk-OIUOQ3TT.js → chunk-57CX5SOI.js} +2 -2
- package/dist/{chunk-75V6F7LZ.js → chunk-5HT43CVZ.js} +2 -2
- package/dist/{chunk-SFJM6FKE.js → chunk-BX5SO2JG.js} +2 -2
- package/dist/{chunk-LSOPFMDB.js → chunk-FNYW3XKR.js} +3 -3
- package/dist/{chunk-V6QEDDFG.js → chunk-GLPDG7UE.js} +2 -2
- package/dist/{chunk-VNI36MMC.js → chunk-H736K5TN.js} +1 -1
- package/dist/{chunk-6CBAFOL3.js → chunk-J4LBG2TH.js} +2 -2
- package/dist/{chunk-JD4KFACE.js → chunk-JKOYOL7A.js} +2 -2
- package/dist/{chunk-TMQIGK3N.js → chunk-MBB4GIJI.js} +2 -2
- package/dist/{chunk-27KREOQW.js → chunk-PJHGIRZM.js} +2 -2
- package/dist/{chunk-L2TQQYG4.js → chunk-PPBEA4EM.js} +2 -2
- package/dist/{chunk-ULABK6XG.js → chunk-Q5WENQT6.js} +3 -3
- package/dist/{chunk-H4MXNDWO.js → chunk-V23SCQL7.js} +2 -2
- package/dist/{chunk-NZDLUQWP.js → chunk-VDVCCU7D.js} +2 -2
- package/dist/{chunk-IN6G6MTW.js → chunk-VXZRMVNY.js} +2 -2
- package/dist/{chunk-XSXWLOIN.js → chunk-WQ7UXKZC.js} +920 -482
- package/dist/{chunk-JKRFXYAR.js → chunk-Y7QZGEPT.js} +2 -2
- package/dist/index.js +20 -21
- package/dist/lib/mysql/index.cjs +926 -465
- package/dist/lib/mysql/index.cjs.map +1 -1
- package/dist/lib/mysql/index.d.cts +6143 -0
- package/dist/lib/mysql/index.d.ts +41 -9
- package/dist/lib/mysql/index.js +20 -21
- package/dist/lib/mysql/schemas/auth/accounts.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/accounts.d.cts +184 -0
- package/dist/lib/mysql/schemas/auth/accounts.js +10 -11
- package/dist/lib/mysql/schemas/auth/permissions.d.cts +98 -0
- package/dist/lib/mysql/schemas/auth/permissions.js +2 -2
- package/dist/lib/mysql/schemas/auth/role-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/role-permissions.d.cts +89 -0
- package/dist/lib/mysql/schemas/auth/role-permissions.js +11 -12
- package/dist/lib/mysql/schemas/auth/roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/roles.d.cts +100 -0
- package/dist/lib/mysql/schemas/auth/roles.js +10 -11
- package/dist/lib/mysql/schemas/auth/sessions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/sessions.d.cts +52 -0
- package/dist/lib/mysql/schemas/auth/sessions.js +11 -12
- package/dist/lib/mysql/schemas/auth/user-permissions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-permissions.d.cts +89 -0
- package/dist/lib/mysql/schemas/auth/user-permissions.js +10 -11
- package/dist/lib/mysql/schemas/auth/user-roles.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/user-roles.d.cts +89 -0
- package/dist/lib/mysql/schemas/auth/user-roles.js +10 -11
- package/dist/lib/mysql/schemas/auth/users.cjs +1 -1
- package/dist/lib/mysql/schemas/auth/users.cjs.map +1 -1
- package/dist/lib/mysql/schemas/auth/users.d.cts +106 -0
- package/dist/lib/mysql/schemas/auth/users.js +10 -11
- package/dist/lib/mysql/schemas/auth/verification-tokens.d.cts +60 -0
- package/dist/lib/mysql/schemas/auth/verification-tokens.js +2 -2
- package/dist/lib/mysql/schemas/commerce/coupon.cjs +180 -17
- package/dist/lib/mysql/schemas/commerce/coupon.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/coupon.d.cts +172 -0
- package/dist/lib/mysql/schemas/commerce/coupon.d.ts +6 -2
- package/dist/lib/mysql/schemas/commerce/coupon.js +12 -2
- package/dist/lib/mysql/schemas/commerce/merchant-account.d.cts +72 -0
- package/dist/lib/mysql/schemas/commerce/merchant-account.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-charge.d.cts +108 -0
- package/dist/lib/mysql/schemas/commerce/merchant-charge.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.d.cts +84 -0
- package/dist/lib/mysql/schemas/commerce/merchant-coupon.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-customer.d.cts +84 -0
- package/dist/lib/mysql/schemas/commerce/merchant-customer.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-price.d.cts +96 -0
- package/dist/lib/mysql/schemas/commerce/merchant-price.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-product.d.cts +84 -0
- package/dist/lib/mysql/schemas/commerce/merchant-product.js +2 -2
- package/dist/lib/mysql/schemas/commerce/merchant-session.d.cts +48 -0
- package/dist/lib/mysql/schemas/commerce/merchant-session.js +2 -2
- package/dist/lib/mysql/schemas/commerce/price.cjs +4 -1
- package/dist/lib/mysql/schemas/commerce/price.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/price.d.cts +101 -0
- package/dist/lib/mysql/schemas/commerce/price.d.ts +1 -1
- package/dist/lib/mysql/schemas/commerce/price.js +10 -11
- package/dist/lib/mysql/schemas/commerce/product.cjs +4 -1
- package/dist/lib/mysql/schemas/commerce/product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/product.d.cts +114 -0
- package/dist/lib/mysql/schemas/commerce/product.d.ts +12 -0
- package/dist/lib/mysql/schemas/commerce/product.js +10 -11
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.d.cts +132 -0
- package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +2 -2
- package/dist/lib/mysql/schemas/commerce/purchase.cjs +14 -2
- package/dist/lib/mysql/schemas/commerce/purchase.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/purchase.d.cts +225 -0
- package/dist/lib/mysql/schemas/commerce/purchase.d.ts +2 -1
- package/dist/lib/mysql/schemas/commerce/purchase.js +10 -11
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs +3 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.cjs.map +1 -1
- package/dist/lib/mysql/schemas/commerce/upgradable-products.d.cts +101 -0
- package/dist/lib/mysql/schemas/commerce/upgradable-products.js +11 -12
- package/dist/lib/mysql/schemas/communication/communication-channel.d.cts +96 -0
- package/dist/lib/mysql/schemas/communication/communication-channel.js +2 -2
- package/dist/lib/mysql/schemas/communication/communication-preference-types.d.cts +96 -0
- package/dist/lib/mysql/schemas/communication/communication-preference-types.js +2 -2
- package/dist/lib/mysql/schemas/communication/communication-preferences.cjs.map +1 -1
- package/dist/lib/mysql/schemas/communication/communication-preferences.d.cts +150 -0
- package/dist/lib/mysql/schemas/communication/communication-preferences.js +10 -11
- package/dist/lib/mysql/schemas/content/content-contributions.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-contributions.d.cts +114 -0
- package/dist/lib/mysql/schemas/content/content-contributions.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs +3 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-product.d.cts +101 -0
- package/dist/lib/mysql/schemas/content/content-resource-product.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource-resource.d.cts +101 -0
- package/dist/lib/mysql/schemas/content/content-resource-resource.js +10 -11
- package/dist/lib/mysql/schemas/content/content-resource.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/content-resource.d.cts +103 -0
- package/dist/lib/mysql/schemas/content/content-resource.js +10 -11
- package/dist/lib/mysql/schemas/content/contribution-types.d.cts +110 -0
- package/dist/lib/mysql/schemas/content/contribution-types.js +2 -2
- package/dist/lib/mysql/schemas/content/resource-progress.cjs +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.cjs.map +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.d.cts +84 -0
- package/dist/lib/mysql/schemas/content/resource-progress.d.ts +1 -1
- package/dist/lib/mysql/schemas/content/resource-progress.js +2 -2
- package/dist/lib/mysql/utils.cjs.map +1 -1
- package/dist/lib/mysql/utils.d.cts +12 -0
- package/dist/lib/mysql/utils.js +1 -1
- package/dist/lib/mysql/utils.js.map +1 -1
- package/dist/lib/utils.d.cts +22 -0
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +1 -1
- package/package.json +5 -5
- package/src/lib/mysql/index.ts +464 -113
- package/src/lib/mysql/schemas/commerce/coupon.ts +18 -2
- package/src/lib/mysql/schemas/commerce/price.ts +1 -1
- package/src/lib/mysql/schemas/commerce/product.ts +1 -0
- package/src/lib/mysql/schemas/commerce/purchase.ts +6 -1
- package/src/lib/mysql/schemas/content/resource-progress.ts +1 -1
- package/dist/chunk-QK6CINAJ.js +0 -60
package/dist/lib/mysql/index.cjs
CHANGED
|
@@ -26,7 +26,7 @@ __export(mysql_exports, {
|
|
|
26
26
|
mySqlDrizzleAdapter: () => mySqlDrizzleAdapter
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(mysql_exports);
|
|
29
|
-
var
|
|
29
|
+
var import_date_fns2 = require("date-fns");
|
|
30
30
|
var import_drizzle_orm27 = require("drizzle-orm");
|
|
31
31
|
var import_mysql_core32 = require("drizzle-orm/mysql-core");
|
|
32
32
|
var import_uuid = require("uuid");
|
|
@@ -188,7 +188,7 @@ var quotelessJson = /* @__PURE__ */ __name((obj) => {
|
|
|
188
188
|
const json10 = JSON.stringify(obj, null, 2);
|
|
189
189
|
return json10.replace(/"([^"]+)":/g, "$1:");
|
|
190
190
|
}, "quotelessJson");
|
|
191
|
-
var
|
|
191
|
+
var _ZodError = class _ZodError extends Error {
|
|
192
192
|
constructor(issues) {
|
|
193
193
|
super();
|
|
194
194
|
this.issues = [];
|
|
@@ -272,7 +272,8 @@ var ZodError = class extends Error {
|
|
|
272
272
|
return this.flatten();
|
|
273
273
|
}
|
|
274
274
|
};
|
|
275
|
-
__name(
|
|
275
|
+
__name(_ZodError, "ZodError");
|
|
276
|
+
var ZodError = _ZodError;
|
|
276
277
|
ZodError.create = (issues) => {
|
|
277
278
|
const error = new ZodError(issues);
|
|
278
279
|
return error;
|
|
@@ -419,7 +420,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
419
420
|
ctx.common.issues.push(issue);
|
|
420
421
|
}
|
|
421
422
|
__name(addIssueToContext, "addIssueToContext");
|
|
422
|
-
var
|
|
423
|
+
var _ParseStatus = class _ParseStatus {
|
|
423
424
|
constructor() {
|
|
424
425
|
this.value = "valid";
|
|
425
426
|
}
|
|
@@ -450,7 +451,7 @@ var ParseStatus = class {
|
|
|
450
451
|
value: await pair.value
|
|
451
452
|
});
|
|
452
453
|
}
|
|
453
|
-
return
|
|
454
|
+
return _ParseStatus.mergeObjectSync(status, syncPairs);
|
|
454
455
|
}
|
|
455
456
|
static mergeObjectSync(status, pairs) {
|
|
456
457
|
const finalObject = {};
|
|
@@ -471,7 +472,8 @@ var ParseStatus = class {
|
|
|
471
472
|
return { status: status.value, value: finalObject };
|
|
472
473
|
}
|
|
473
474
|
};
|
|
474
|
-
__name(
|
|
475
|
+
__name(_ParseStatus, "ParseStatus");
|
|
476
|
+
var ParseStatus = _ParseStatus;
|
|
475
477
|
var INVALID = Object.freeze({
|
|
476
478
|
status: "aborted"
|
|
477
479
|
});
|
|
@@ -486,7 +488,7 @@ var errorUtil;
|
|
|
486
488
|
errorUtil3.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
487
489
|
errorUtil3.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
488
490
|
})(errorUtil || (errorUtil = {}));
|
|
489
|
-
var
|
|
491
|
+
var _ParseInputLazyPath = class _ParseInputLazyPath {
|
|
490
492
|
constructor(parent, value, path, key) {
|
|
491
493
|
this._cachedPath = [];
|
|
492
494
|
this.parent = parent;
|
|
@@ -505,7 +507,8 @@ var ParseInputLazyPath = class {
|
|
|
505
507
|
return this._cachedPath;
|
|
506
508
|
}
|
|
507
509
|
};
|
|
508
|
-
__name(
|
|
510
|
+
__name(_ParseInputLazyPath, "ParseInputLazyPath");
|
|
511
|
+
var ParseInputLazyPath = _ParseInputLazyPath;
|
|
509
512
|
var handleResult = /* @__PURE__ */ __name((ctx, result) => {
|
|
510
513
|
if (isValid(result)) {
|
|
511
514
|
return { success: true, data: result.value };
|
|
@@ -545,7 +548,7 @@ function processCreateParams(params) {
|
|
|
545
548
|
return { errorMap: customMap, description };
|
|
546
549
|
}
|
|
547
550
|
__name(processCreateParams, "processCreateParams");
|
|
548
|
-
var
|
|
551
|
+
var _ZodType = class _ZodType {
|
|
549
552
|
constructor(def) {
|
|
550
553
|
this.spa = this.safeParseAsync;
|
|
551
554
|
this._def = def;
|
|
@@ -621,11 +624,11 @@ var ZodType = class {
|
|
|
621
624
|
throw result.error;
|
|
622
625
|
}
|
|
623
626
|
safeParse(data, params) {
|
|
624
|
-
var
|
|
627
|
+
var _a41;
|
|
625
628
|
const ctx = {
|
|
626
629
|
common: {
|
|
627
630
|
issues: [],
|
|
628
|
-
async: (
|
|
631
|
+
async: (_a41 = params === null || params === void 0 ? void 0 : params.async) !== null && _a41 !== void 0 ? _a41 : false,
|
|
629
632
|
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
|
|
630
633
|
},
|
|
631
634
|
path: (params === null || params === void 0 ? void 0 : params.path) || [],
|
|
@@ -788,7 +791,8 @@ var ZodType = class {
|
|
|
788
791
|
return this.safeParse(null).success;
|
|
789
792
|
}
|
|
790
793
|
};
|
|
791
|
-
__name(
|
|
794
|
+
__name(_ZodType, "ZodType");
|
|
795
|
+
var ZodType = _ZodType;
|
|
792
796
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
793
797
|
var cuid2Regex = /^[a-z][a-z0-9]*$/;
|
|
794
798
|
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
@@ -829,7 +833,7 @@ function isValidIP(ip, version) {
|
|
|
829
833
|
return false;
|
|
830
834
|
}
|
|
831
835
|
__name(isValidIP, "isValidIP");
|
|
832
|
-
var
|
|
836
|
+
var _ZodString = class _ZodString extends ZodType {
|
|
833
837
|
_parse(input) {
|
|
834
838
|
if (this._def.coerce) {
|
|
835
839
|
input.data = String(input.data);
|
|
@@ -969,7 +973,7 @@ var ZodString = class extends ZodType {
|
|
|
969
973
|
} else if (check.kind === "url") {
|
|
970
974
|
try {
|
|
971
975
|
new URL(input.data);
|
|
972
|
-
} catch (
|
|
976
|
+
} catch (_a41) {
|
|
973
977
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
974
978
|
addIssueToContext(ctx, {
|
|
975
979
|
validation: "url",
|
|
@@ -1061,7 +1065,7 @@ var ZodString = class extends ZodType {
|
|
|
1061
1065
|
});
|
|
1062
1066
|
}
|
|
1063
1067
|
_addCheck(check) {
|
|
1064
|
-
return new
|
|
1068
|
+
return new _ZodString({
|
|
1065
1069
|
...this._def,
|
|
1066
1070
|
checks: [...this._def.checks, check]
|
|
1067
1071
|
});
|
|
@@ -1091,7 +1095,7 @@ var ZodString = class extends ZodType {
|
|
|
1091
1095
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
1092
1096
|
}
|
|
1093
1097
|
datetime(options) {
|
|
1094
|
-
var
|
|
1098
|
+
var _a41;
|
|
1095
1099
|
if (typeof options === "string") {
|
|
1096
1100
|
return this._addCheck({
|
|
1097
1101
|
kind: "datetime",
|
|
@@ -1103,7 +1107,7 @@ var ZodString = class extends ZodType {
|
|
|
1103
1107
|
return this._addCheck({
|
|
1104
1108
|
kind: "datetime",
|
|
1105
1109
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
1106
|
-
offset: (
|
|
1110
|
+
offset: (_a41 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a41 !== void 0 ? _a41 : false,
|
|
1107
1111
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
1108
1112
|
});
|
|
1109
1113
|
}
|
|
@@ -1165,19 +1169,19 @@ var ZodString = class extends ZodType {
|
|
|
1165
1169
|
return this.min(1, errorUtil.errToObj(message));
|
|
1166
1170
|
}
|
|
1167
1171
|
trim() {
|
|
1168
|
-
return new
|
|
1172
|
+
return new _ZodString({
|
|
1169
1173
|
...this._def,
|
|
1170
1174
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1171
1175
|
});
|
|
1172
1176
|
}
|
|
1173
1177
|
toLowerCase() {
|
|
1174
|
-
return new
|
|
1178
|
+
return new _ZodString({
|
|
1175
1179
|
...this._def,
|
|
1176
1180
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1177
1181
|
});
|
|
1178
1182
|
}
|
|
1179
1183
|
toUpperCase() {
|
|
1180
|
-
return new
|
|
1184
|
+
return new _ZodString({
|
|
1181
1185
|
...this._def,
|
|
1182
1186
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1183
1187
|
});
|
|
@@ -1230,13 +1234,14 @@ var ZodString = class extends ZodType {
|
|
|
1230
1234
|
return max;
|
|
1231
1235
|
}
|
|
1232
1236
|
};
|
|
1233
|
-
__name(
|
|
1237
|
+
__name(_ZodString, "ZodString");
|
|
1238
|
+
var ZodString = _ZodString;
|
|
1234
1239
|
ZodString.create = (params) => {
|
|
1235
|
-
var
|
|
1240
|
+
var _a41;
|
|
1236
1241
|
return new ZodString({
|
|
1237
1242
|
checks: [],
|
|
1238
1243
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
1239
|
-
coerce: (
|
|
1244
|
+
coerce: (_a41 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a41 !== void 0 ? _a41 : false,
|
|
1240
1245
|
...processCreateParams(params)
|
|
1241
1246
|
});
|
|
1242
1247
|
};
|
|
@@ -1249,7 +1254,7 @@ function floatSafeRemainder(val, step) {
|
|
|
1249
1254
|
return valInt % stepInt / Math.pow(10, decCount);
|
|
1250
1255
|
}
|
|
1251
1256
|
__name(floatSafeRemainder, "floatSafeRemainder");
|
|
1252
|
-
var
|
|
1257
|
+
var _ZodNumber = class _ZodNumber extends ZodType {
|
|
1253
1258
|
constructor() {
|
|
1254
1259
|
super(...arguments);
|
|
1255
1260
|
this.min = this.gte;
|
|
@@ -1350,7 +1355,7 @@ var ZodNumber = class extends ZodType {
|
|
|
1350
1355
|
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1351
1356
|
}
|
|
1352
1357
|
setLimit(kind, value, inclusive, message) {
|
|
1353
|
-
return new
|
|
1358
|
+
return new _ZodNumber({
|
|
1354
1359
|
...this._def,
|
|
1355
1360
|
checks: [
|
|
1356
1361
|
...this._def.checks,
|
|
@@ -1364,7 +1369,7 @@ var ZodNumber = class extends ZodType {
|
|
|
1364
1369
|
});
|
|
1365
1370
|
}
|
|
1366
1371
|
_addCheck(check) {
|
|
1367
|
-
return new
|
|
1372
|
+
return new _ZodNumber({
|
|
1368
1373
|
...this._def,
|
|
1369
1374
|
checks: [...this._def.checks, check]
|
|
1370
1375
|
});
|
|
@@ -1472,7 +1477,8 @@ var ZodNumber = class extends ZodType {
|
|
|
1472
1477
|
return Number.isFinite(min) && Number.isFinite(max);
|
|
1473
1478
|
}
|
|
1474
1479
|
};
|
|
1475
|
-
__name(
|
|
1480
|
+
__name(_ZodNumber, "ZodNumber");
|
|
1481
|
+
var ZodNumber = _ZodNumber;
|
|
1476
1482
|
ZodNumber.create = (params) => {
|
|
1477
1483
|
return new ZodNumber({
|
|
1478
1484
|
checks: [],
|
|
@@ -1481,7 +1487,7 @@ ZodNumber.create = (params) => {
|
|
|
1481
1487
|
...processCreateParams(params)
|
|
1482
1488
|
});
|
|
1483
1489
|
};
|
|
1484
|
-
var
|
|
1490
|
+
var _ZodBigInt = class _ZodBigInt extends ZodType {
|
|
1485
1491
|
constructor() {
|
|
1486
1492
|
super(...arguments);
|
|
1487
1493
|
this.min = this.gte;
|
|
@@ -1559,7 +1565,7 @@ var ZodBigInt = class extends ZodType {
|
|
|
1559
1565
|
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1560
1566
|
}
|
|
1561
1567
|
setLimit(kind, value, inclusive, message) {
|
|
1562
|
-
return new
|
|
1568
|
+
return new _ZodBigInt({
|
|
1563
1569
|
...this._def,
|
|
1564
1570
|
checks: [
|
|
1565
1571
|
...this._def.checks,
|
|
@@ -1573,7 +1579,7 @@ var ZodBigInt = class extends ZodType {
|
|
|
1573
1579
|
});
|
|
1574
1580
|
}
|
|
1575
1581
|
_addCheck(check) {
|
|
1576
|
-
return new
|
|
1582
|
+
return new _ZodBigInt({
|
|
1577
1583
|
...this._def,
|
|
1578
1584
|
checks: [...this._def.checks, check]
|
|
1579
1585
|
});
|
|
@@ -1638,17 +1644,18 @@ var ZodBigInt = class extends ZodType {
|
|
|
1638
1644
|
return max;
|
|
1639
1645
|
}
|
|
1640
1646
|
};
|
|
1641
|
-
__name(
|
|
1647
|
+
__name(_ZodBigInt, "ZodBigInt");
|
|
1648
|
+
var ZodBigInt = _ZodBigInt;
|
|
1642
1649
|
ZodBigInt.create = (params) => {
|
|
1643
|
-
var
|
|
1650
|
+
var _a41;
|
|
1644
1651
|
return new ZodBigInt({
|
|
1645
1652
|
checks: [],
|
|
1646
1653
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1647
|
-
coerce: (
|
|
1654
|
+
coerce: (_a41 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a41 !== void 0 ? _a41 : false,
|
|
1648
1655
|
...processCreateParams(params)
|
|
1649
1656
|
});
|
|
1650
1657
|
};
|
|
1651
|
-
var
|
|
1658
|
+
var _ZodBoolean = class _ZodBoolean extends ZodType {
|
|
1652
1659
|
_parse(input) {
|
|
1653
1660
|
if (this._def.coerce) {
|
|
1654
1661
|
input.data = Boolean(input.data);
|
|
@@ -1666,7 +1673,8 @@ var ZodBoolean = class extends ZodType {
|
|
|
1666
1673
|
return OK(input.data);
|
|
1667
1674
|
}
|
|
1668
1675
|
};
|
|
1669
|
-
__name(
|
|
1676
|
+
__name(_ZodBoolean, "ZodBoolean");
|
|
1677
|
+
var ZodBoolean = _ZodBoolean;
|
|
1670
1678
|
ZodBoolean.create = (params) => {
|
|
1671
1679
|
return new ZodBoolean({
|
|
1672
1680
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
@@ -1674,7 +1682,7 @@ ZodBoolean.create = (params) => {
|
|
|
1674
1682
|
...processCreateParams(params)
|
|
1675
1683
|
});
|
|
1676
1684
|
};
|
|
1677
|
-
var
|
|
1685
|
+
var _ZodDate = class _ZodDate extends ZodType {
|
|
1678
1686
|
_parse(input) {
|
|
1679
1687
|
if (this._def.coerce) {
|
|
1680
1688
|
input.data = new Date(input.data);
|
|
@@ -1735,7 +1743,7 @@ var ZodDate = class extends ZodType {
|
|
|
1735
1743
|
};
|
|
1736
1744
|
}
|
|
1737
1745
|
_addCheck(check) {
|
|
1738
|
-
return new
|
|
1746
|
+
return new _ZodDate({
|
|
1739
1747
|
...this._def,
|
|
1740
1748
|
checks: [...this._def.checks, check]
|
|
1741
1749
|
});
|
|
@@ -1775,7 +1783,8 @@ var ZodDate = class extends ZodType {
|
|
|
1775
1783
|
return max != null ? new Date(max) : null;
|
|
1776
1784
|
}
|
|
1777
1785
|
};
|
|
1778
|
-
__name(
|
|
1786
|
+
__name(_ZodDate, "ZodDate");
|
|
1787
|
+
var ZodDate = _ZodDate;
|
|
1779
1788
|
ZodDate.create = (params) => {
|
|
1780
1789
|
return new ZodDate({
|
|
1781
1790
|
checks: [],
|
|
@@ -1784,7 +1793,7 @@ ZodDate.create = (params) => {
|
|
|
1784
1793
|
...processCreateParams(params)
|
|
1785
1794
|
});
|
|
1786
1795
|
};
|
|
1787
|
-
var
|
|
1796
|
+
var _ZodSymbol = class _ZodSymbol extends ZodType {
|
|
1788
1797
|
_parse(input) {
|
|
1789
1798
|
const parsedType = this._getType(input);
|
|
1790
1799
|
if (parsedType !== ZodParsedType.symbol) {
|
|
@@ -1799,14 +1808,15 @@ var ZodSymbol = class extends ZodType {
|
|
|
1799
1808
|
return OK(input.data);
|
|
1800
1809
|
}
|
|
1801
1810
|
};
|
|
1802
|
-
__name(
|
|
1811
|
+
__name(_ZodSymbol, "ZodSymbol");
|
|
1812
|
+
var ZodSymbol = _ZodSymbol;
|
|
1803
1813
|
ZodSymbol.create = (params) => {
|
|
1804
1814
|
return new ZodSymbol({
|
|
1805
1815
|
typeName: ZodFirstPartyTypeKind.ZodSymbol,
|
|
1806
1816
|
...processCreateParams(params)
|
|
1807
1817
|
});
|
|
1808
1818
|
};
|
|
1809
|
-
var
|
|
1819
|
+
var _ZodUndefined = class _ZodUndefined extends ZodType {
|
|
1810
1820
|
_parse(input) {
|
|
1811
1821
|
const parsedType = this._getType(input);
|
|
1812
1822
|
if (parsedType !== ZodParsedType.undefined) {
|
|
@@ -1821,14 +1831,15 @@ var ZodUndefined = class extends ZodType {
|
|
|
1821
1831
|
return OK(input.data);
|
|
1822
1832
|
}
|
|
1823
1833
|
};
|
|
1824
|
-
__name(
|
|
1834
|
+
__name(_ZodUndefined, "ZodUndefined");
|
|
1835
|
+
var ZodUndefined = _ZodUndefined;
|
|
1825
1836
|
ZodUndefined.create = (params) => {
|
|
1826
1837
|
return new ZodUndefined({
|
|
1827
1838
|
typeName: ZodFirstPartyTypeKind.ZodUndefined,
|
|
1828
1839
|
...processCreateParams(params)
|
|
1829
1840
|
});
|
|
1830
1841
|
};
|
|
1831
|
-
var
|
|
1842
|
+
var _ZodNull = class _ZodNull extends ZodType {
|
|
1832
1843
|
_parse(input) {
|
|
1833
1844
|
const parsedType = this._getType(input);
|
|
1834
1845
|
if (parsedType !== ZodParsedType.null) {
|
|
@@ -1843,14 +1854,15 @@ var ZodNull = class extends ZodType {
|
|
|
1843
1854
|
return OK(input.data);
|
|
1844
1855
|
}
|
|
1845
1856
|
};
|
|
1846
|
-
__name(
|
|
1857
|
+
__name(_ZodNull, "ZodNull");
|
|
1858
|
+
var ZodNull = _ZodNull;
|
|
1847
1859
|
ZodNull.create = (params) => {
|
|
1848
1860
|
return new ZodNull({
|
|
1849
1861
|
typeName: ZodFirstPartyTypeKind.ZodNull,
|
|
1850
1862
|
...processCreateParams(params)
|
|
1851
1863
|
});
|
|
1852
1864
|
};
|
|
1853
|
-
var
|
|
1865
|
+
var _ZodAny = class _ZodAny extends ZodType {
|
|
1854
1866
|
constructor() {
|
|
1855
1867
|
super(...arguments);
|
|
1856
1868
|
this._any = true;
|
|
@@ -1859,14 +1871,15 @@ var ZodAny = class extends ZodType {
|
|
|
1859
1871
|
return OK(input.data);
|
|
1860
1872
|
}
|
|
1861
1873
|
};
|
|
1862
|
-
__name(
|
|
1874
|
+
__name(_ZodAny, "ZodAny");
|
|
1875
|
+
var ZodAny = _ZodAny;
|
|
1863
1876
|
ZodAny.create = (params) => {
|
|
1864
1877
|
return new ZodAny({
|
|
1865
1878
|
typeName: ZodFirstPartyTypeKind.ZodAny,
|
|
1866
1879
|
...processCreateParams(params)
|
|
1867
1880
|
});
|
|
1868
1881
|
};
|
|
1869
|
-
var
|
|
1882
|
+
var _ZodUnknown = class _ZodUnknown extends ZodType {
|
|
1870
1883
|
constructor() {
|
|
1871
1884
|
super(...arguments);
|
|
1872
1885
|
this._unknown = true;
|
|
@@ -1875,14 +1888,15 @@ var ZodUnknown = class extends ZodType {
|
|
|
1875
1888
|
return OK(input.data);
|
|
1876
1889
|
}
|
|
1877
1890
|
};
|
|
1878
|
-
__name(
|
|
1891
|
+
__name(_ZodUnknown, "ZodUnknown");
|
|
1892
|
+
var ZodUnknown = _ZodUnknown;
|
|
1879
1893
|
ZodUnknown.create = (params) => {
|
|
1880
1894
|
return new ZodUnknown({
|
|
1881
1895
|
typeName: ZodFirstPartyTypeKind.ZodUnknown,
|
|
1882
1896
|
...processCreateParams(params)
|
|
1883
1897
|
});
|
|
1884
1898
|
};
|
|
1885
|
-
var
|
|
1899
|
+
var _ZodNever = class _ZodNever extends ZodType {
|
|
1886
1900
|
_parse(input) {
|
|
1887
1901
|
const ctx = this._getOrReturnCtx(input);
|
|
1888
1902
|
addIssueToContext(ctx, {
|
|
@@ -1893,14 +1907,15 @@ var ZodNever = class extends ZodType {
|
|
|
1893
1907
|
return INVALID;
|
|
1894
1908
|
}
|
|
1895
1909
|
};
|
|
1896
|
-
__name(
|
|
1910
|
+
__name(_ZodNever, "ZodNever");
|
|
1911
|
+
var ZodNever = _ZodNever;
|
|
1897
1912
|
ZodNever.create = (params) => {
|
|
1898
1913
|
return new ZodNever({
|
|
1899
1914
|
typeName: ZodFirstPartyTypeKind.ZodNever,
|
|
1900
1915
|
...processCreateParams(params)
|
|
1901
1916
|
});
|
|
1902
1917
|
};
|
|
1903
|
-
var
|
|
1918
|
+
var _ZodVoid = class _ZodVoid extends ZodType {
|
|
1904
1919
|
_parse(input) {
|
|
1905
1920
|
const parsedType = this._getType(input);
|
|
1906
1921
|
if (parsedType !== ZodParsedType.undefined) {
|
|
@@ -1915,14 +1930,15 @@ var ZodVoid = class extends ZodType {
|
|
|
1915
1930
|
return OK(input.data);
|
|
1916
1931
|
}
|
|
1917
1932
|
};
|
|
1918
|
-
__name(
|
|
1933
|
+
__name(_ZodVoid, "ZodVoid");
|
|
1934
|
+
var ZodVoid = _ZodVoid;
|
|
1919
1935
|
ZodVoid.create = (params) => {
|
|
1920
1936
|
return new ZodVoid({
|
|
1921
1937
|
typeName: ZodFirstPartyTypeKind.ZodVoid,
|
|
1922
1938
|
...processCreateParams(params)
|
|
1923
1939
|
});
|
|
1924
1940
|
};
|
|
1925
|
-
var
|
|
1941
|
+
var _ZodArray = class _ZodArray extends ZodType {
|
|
1926
1942
|
_parse(input) {
|
|
1927
1943
|
const { ctx, status } = this._processInputParams(input);
|
|
1928
1944
|
const def = this._def;
|
|
@@ -1992,19 +2008,19 @@ var ZodArray = class extends ZodType {
|
|
|
1992
2008
|
return this._def.type;
|
|
1993
2009
|
}
|
|
1994
2010
|
min(minLength, message) {
|
|
1995
|
-
return new
|
|
2011
|
+
return new _ZodArray({
|
|
1996
2012
|
...this._def,
|
|
1997
2013
|
minLength: { value: minLength, message: errorUtil.toString(message) }
|
|
1998
2014
|
});
|
|
1999
2015
|
}
|
|
2000
2016
|
max(maxLength, message) {
|
|
2001
|
-
return new
|
|
2017
|
+
return new _ZodArray({
|
|
2002
2018
|
...this._def,
|
|
2003
2019
|
maxLength: { value: maxLength, message: errorUtil.toString(message) }
|
|
2004
2020
|
});
|
|
2005
2021
|
}
|
|
2006
2022
|
length(len, message) {
|
|
2007
|
-
return new
|
|
2023
|
+
return new _ZodArray({
|
|
2008
2024
|
...this._def,
|
|
2009
2025
|
exactLength: { value: len, message: errorUtil.toString(message) }
|
|
2010
2026
|
});
|
|
@@ -2013,7 +2029,8 @@ var ZodArray = class extends ZodType {
|
|
|
2013
2029
|
return this.min(1, message);
|
|
2014
2030
|
}
|
|
2015
2031
|
};
|
|
2016
|
-
__name(
|
|
2032
|
+
__name(_ZodArray, "ZodArray");
|
|
2033
|
+
var ZodArray = _ZodArray;
|
|
2017
2034
|
ZodArray.create = (schema, params) => {
|
|
2018
2035
|
return new ZodArray({
|
|
2019
2036
|
type: schema,
|
|
@@ -2051,7 +2068,7 @@ function deepPartialify(schema) {
|
|
|
2051
2068
|
}
|
|
2052
2069
|
}
|
|
2053
2070
|
__name(deepPartialify, "deepPartialify");
|
|
2054
|
-
var
|
|
2071
|
+
var _ZodObject = class _ZodObject extends ZodType {
|
|
2055
2072
|
constructor() {
|
|
2056
2073
|
super(...arguments);
|
|
2057
2074
|
this._cached = null;
|
|
@@ -2156,13 +2173,13 @@ var ZodObject = class extends ZodType {
|
|
|
2156
2173
|
}
|
|
2157
2174
|
strict(message) {
|
|
2158
2175
|
errorUtil.errToObj;
|
|
2159
|
-
return new
|
|
2176
|
+
return new _ZodObject({
|
|
2160
2177
|
...this._def,
|
|
2161
2178
|
unknownKeys: "strict",
|
|
2162
2179
|
...message !== void 0 ? {
|
|
2163
2180
|
errorMap: (issue, ctx) => {
|
|
2164
|
-
var
|
|
2165
|
-
const defaultError = (_c = (_b = (
|
|
2181
|
+
var _a41, _b, _c, _d;
|
|
2182
|
+
const defaultError = (_c = (_b = (_a41 = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a41, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
|
|
2166
2183
|
if (issue.code === "unrecognized_keys")
|
|
2167
2184
|
return {
|
|
2168
2185
|
message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
|
|
@@ -2175,13 +2192,13 @@ var ZodObject = class extends ZodType {
|
|
|
2175
2192
|
});
|
|
2176
2193
|
}
|
|
2177
2194
|
strip() {
|
|
2178
|
-
return new
|
|
2195
|
+
return new _ZodObject({
|
|
2179
2196
|
...this._def,
|
|
2180
2197
|
unknownKeys: "strip"
|
|
2181
2198
|
});
|
|
2182
2199
|
}
|
|
2183
2200
|
passthrough() {
|
|
2184
|
-
return new
|
|
2201
|
+
return new _ZodObject({
|
|
2185
2202
|
...this._def,
|
|
2186
2203
|
unknownKeys: "passthrough"
|
|
2187
2204
|
});
|
|
@@ -2204,7 +2221,7 @@ var ZodObject = class extends ZodType {
|
|
|
2204
2221
|
// }) as any;
|
|
2205
2222
|
// };
|
|
2206
2223
|
extend(augmentation) {
|
|
2207
|
-
return new
|
|
2224
|
+
return new _ZodObject({
|
|
2208
2225
|
...this._def,
|
|
2209
2226
|
shape: () => ({
|
|
2210
2227
|
...this._def.shape(),
|
|
@@ -2218,7 +2235,7 @@ var ZodObject = class extends ZodType {
|
|
|
2218
2235
|
* upgrade if you are experiencing issues.
|
|
2219
2236
|
*/
|
|
2220
2237
|
merge(merging) {
|
|
2221
|
-
const merged = new
|
|
2238
|
+
const merged = new _ZodObject({
|
|
2222
2239
|
unknownKeys: merging._def.unknownKeys,
|
|
2223
2240
|
catchall: merging._def.catchall,
|
|
2224
2241
|
shape: () => ({
|
|
@@ -2289,7 +2306,7 @@ var ZodObject = class extends ZodType {
|
|
|
2289
2306
|
// return merged;
|
|
2290
2307
|
// }
|
|
2291
2308
|
catchall(index18) {
|
|
2292
|
-
return new
|
|
2309
|
+
return new _ZodObject({
|
|
2293
2310
|
...this._def,
|
|
2294
2311
|
catchall: index18
|
|
2295
2312
|
});
|
|
@@ -2301,7 +2318,7 @@ var ZodObject = class extends ZodType {
|
|
|
2301
2318
|
shape[key] = this.shape[key];
|
|
2302
2319
|
}
|
|
2303
2320
|
});
|
|
2304
|
-
return new
|
|
2321
|
+
return new _ZodObject({
|
|
2305
2322
|
...this._def,
|
|
2306
2323
|
shape: () => shape
|
|
2307
2324
|
});
|
|
@@ -2313,7 +2330,7 @@ var ZodObject = class extends ZodType {
|
|
|
2313
2330
|
shape[key] = this.shape[key];
|
|
2314
2331
|
}
|
|
2315
2332
|
});
|
|
2316
|
-
return new
|
|
2333
|
+
return new _ZodObject({
|
|
2317
2334
|
...this._def,
|
|
2318
2335
|
shape: () => shape
|
|
2319
2336
|
});
|
|
@@ -2334,7 +2351,7 @@ var ZodObject = class extends ZodType {
|
|
|
2334
2351
|
newShape[key] = fieldSchema.optional();
|
|
2335
2352
|
}
|
|
2336
2353
|
});
|
|
2337
|
-
return new
|
|
2354
|
+
return new _ZodObject({
|
|
2338
2355
|
...this._def,
|
|
2339
2356
|
shape: () => newShape
|
|
2340
2357
|
});
|
|
@@ -2353,7 +2370,7 @@ var ZodObject = class extends ZodType {
|
|
|
2353
2370
|
newShape[key] = newField;
|
|
2354
2371
|
}
|
|
2355
2372
|
});
|
|
2356
|
-
return new
|
|
2373
|
+
return new _ZodObject({
|
|
2357
2374
|
...this._def,
|
|
2358
2375
|
shape: () => newShape
|
|
2359
2376
|
});
|
|
@@ -2362,7 +2379,8 @@ var ZodObject = class extends ZodType {
|
|
|
2362
2379
|
return createZodEnum(util.objectKeys(this.shape));
|
|
2363
2380
|
}
|
|
2364
2381
|
};
|
|
2365
|
-
__name(
|
|
2382
|
+
__name(_ZodObject, "ZodObject");
|
|
2383
|
+
var ZodObject = _ZodObject;
|
|
2366
2384
|
ZodObject.create = (shape, params) => {
|
|
2367
2385
|
return new ZodObject({
|
|
2368
2386
|
shape: () => shape,
|
|
@@ -2390,7 +2408,7 @@ ZodObject.lazycreate = (shape, params) => {
|
|
|
2390
2408
|
...processCreateParams(params)
|
|
2391
2409
|
});
|
|
2392
2410
|
};
|
|
2393
|
-
var
|
|
2411
|
+
var _ZodUnion = class _ZodUnion extends ZodType {
|
|
2394
2412
|
_parse(input) {
|
|
2395
2413
|
const { ctx } = this._processInputParams(input);
|
|
2396
2414
|
const options = this._def.options;
|
|
@@ -2475,7 +2493,8 @@ var ZodUnion = class extends ZodType {
|
|
|
2475
2493
|
return this._def.options;
|
|
2476
2494
|
}
|
|
2477
2495
|
};
|
|
2478
|
-
__name(
|
|
2496
|
+
__name(_ZodUnion, "ZodUnion");
|
|
2497
|
+
var ZodUnion = _ZodUnion;
|
|
2479
2498
|
ZodUnion.create = (types, params) => {
|
|
2480
2499
|
return new ZodUnion({
|
|
2481
2500
|
options: types,
|
|
@@ -2504,7 +2523,7 @@ var getDiscriminator = /* @__PURE__ */ __name((type) => {
|
|
|
2504
2523
|
return null;
|
|
2505
2524
|
}
|
|
2506
2525
|
}, "getDiscriminator");
|
|
2507
|
-
var
|
|
2526
|
+
var _ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
2508
2527
|
_parse(input) {
|
|
2509
2528
|
const { ctx } = this._processInputParams(input);
|
|
2510
2529
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
@@ -2571,7 +2590,7 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2571
2590
|
optionsMap.set(value, type);
|
|
2572
2591
|
}
|
|
2573
2592
|
}
|
|
2574
|
-
return new
|
|
2593
|
+
return new _ZodDiscriminatedUnion({
|
|
2575
2594
|
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
|
|
2576
2595
|
discriminator,
|
|
2577
2596
|
options,
|
|
@@ -2580,7 +2599,8 @@ var ZodDiscriminatedUnion = class extends ZodType {
|
|
|
2580
2599
|
});
|
|
2581
2600
|
}
|
|
2582
2601
|
};
|
|
2583
|
-
__name(
|
|
2602
|
+
__name(_ZodDiscriminatedUnion, "ZodDiscriminatedUnion");
|
|
2603
|
+
var ZodDiscriminatedUnion = _ZodDiscriminatedUnion;
|
|
2584
2604
|
function mergeValues(a, b) {
|
|
2585
2605
|
const aType = getParsedType(a);
|
|
2586
2606
|
const bType = getParsedType(b);
|
|
@@ -2620,7 +2640,7 @@ function mergeValues(a, b) {
|
|
|
2620
2640
|
}
|
|
2621
2641
|
}
|
|
2622
2642
|
__name(mergeValues, "mergeValues");
|
|
2623
|
-
var
|
|
2643
|
+
var _ZodIntersection = class _ZodIntersection extends ZodType {
|
|
2624
2644
|
_parse(input) {
|
|
2625
2645
|
const { status, ctx } = this._processInputParams(input);
|
|
2626
2646
|
const handleParsed = /* @__PURE__ */ __name((parsedLeft, parsedRight) => {
|
|
@@ -2665,7 +2685,8 @@ var ZodIntersection = class extends ZodType {
|
|
|
2665
2685
|
}
|
|
2666
2686
|
}
|
|
2667
2687
|
};
|
|
2668
|
-
__name(
|
|
2688
|
+
__name(_ZodIntersection, "ZodIntersection");
|
|
2689
|
+
var ZodIntersection = _ZodIntersection;
|
|
2669
2690
|
ZodIntersection.create = (left, right, params) => {
|
|
2670
2691
|
return new ZodIntersection({
|
|
2671
2692
|
left,
|
|
@@ -2674,7 +2695,7 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
2674
2695
|
...processCreateParams(params)
|
|
2675
2696
|
});
|
|
2676
2697
|
};
|
|
2677
|
-
var
|
|
2698
|
+
var _ZodTuple = class _ZodTuple extends ZodType {
|
|
2678
2699
|
_parse(input) {
|
|
2679
2700
|
const { status, ctx } = this._processInputParams(input);
|
|
2680
2701
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
@@ -2724,13 +2745,14 @@ var ZodTuple = class extends ZodType {
|
|
|
2724
2745
|
return this._def.items;
|
|
2725
2746
|
}
|
|
2726
2747
|
rest(rest) {
|
|
2727
|
-
return new
|
|
2748
|
+
return new _ZodTuple({
|
|
2728
2749
|
...this._def,
|
|
2729
2750
|
rest
|
|
2730
2751
|
});
|
|
2731
2752
|
}
|
|
2732
2753
|
};
|
|
2733
|
-
__name(
|
|
2754
|
+
__name(_ZodTuple, "ZodTuple");
|
|
2755
|
+
var ZodTuple = _ZodTuple;
|
|
2734
2756
|
ZodTuple.create = (schemas, params) => {
|
|
2735
2757
|
if (!Array.isArray(schemas)) {
|
|
2736
2758
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
@@ -2742,7 +2764,7 @@ ZodTuple.create = (schemas, params) => {
|
|
|
2742
2764
|
...processCreateParams(params)
|
|
2743
2765
|
});
|
|
2744
2766
|
};
|
|
2745
|
-
var
|
|
2767
|
+
var _ZodRecord = class _ZodRecord extends ZodType {
|
|
2746
2768
|
get keySchema() {
|
|
2747
2769
|
return this._def.keyType;
|
|
2748
2770
|
}
|
|
@@ -2779,14 +2801,14 @@ var ZodRecord = class extends ZodType {
|
|
|
2779
2801
|
}
|
|
2780
2802
|
static create(first, second, third) {
|
|
2781
2803
|
if (second instanceof ZodType) {
|
|
2782
|
-
return new
|
|
2804
|
+
return new _ZodRecord({
|
|
2783
2805
|
keyType: first,
|
|
2784
2806
|
valueType: second,
|
|
2785
2807
|
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
2786
2808
|
...processCreateParams(third)
|
|
2787
2809
|
});
|
|
2788
2810
|
}
|
|
2789
|
-
return new
|
|
2811
|
+
return new _ZodRecord({
|
|
2790
2812
|
keyType: ZodString.create(),
|
|
2791
2813
|
valueType: first,
|
|
2792
2814
|
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
@@ -2794,8 +2816,9 @@ var ZodRecord = class extends ZodType {
|
|
|
2794
2816
|
});
|
|
2795
2817
|
}
|
|
2796
2818
|
};
|
|
2797
|
-
__name(
|
|
2798
|
-
var
|
|
2819
|
+
__name(_ZodRecord, "ZodRecord");
|
|
2820
|
+
var ZodRecord = _ZodRecord;
|
|
2821
|
+
var _ZodMap = class _ZodMap extends ZodType {
|
|
2799
2822
|
get keySchema() {
|
|
2800
2823
|
return this._def.keyType;
|
|
2801
2824
|
}
|
|
@@ -2853,7 +2876,8 @@ var ZodMap = class extends ZodType {
|
|
|
2853
2876
|
}
|
|
2854
2877
|
}
|
|
2855
2878
|
};
|
|
2856
|
-
__name(
|
|
2879
|
+
__name(_ZodMap, "ZodMap");
|
|
2880
|
+
var ZodMap = _ZodMap;
|
|
2857
2881
|
ZodMap.create = (keyType, valueType, params) => {
|
|
2858
2882
|
return new ZodMap({
|
|
2859
2883
|
valueType,
|
|
@@ -2862,7 +2886,7 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
2862
2886
|
...processCreateParams(params)
|
|
2863
2887
|
});
|
|
2864
2888
|
};
|
|
2865
|
-
var
|
|
2889
|
+
var _ZodSet = class _ZodSet extends ZodType {
|
|
2866
2890
|
_parse(input) {
|
|
2867
2891
|
const { status, ctx } = this._processInputParams(input);
|
|
2868
2892
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
@@ -2921,13 +2945,13 @@ var ZodSet = class extends ZodType {
|
|
|
2921
2945
|
}
|
|
2922
2946
|
}
|
|
2923
2947
|
min(minSize, message) {
|
|
2924
|
-
return new
|
|
2948
|
+
return new _ZodSet({
|
|
2925
2949
|
...this._def,
|
|
2926
2950
|
minSize: { value: minSize, message: errorUtil.toString(message) }
|
|
2927
2951
|
});
|
|
2928
2952
|
}
|
|
2929
2953
|
max(maxSize, message) {
|
|
2930
|
-
return new
|
|
2954
|
+
return new _ZodSet({
|
|
2931
2955
|
...this._def,
|
|
2932
2956
|
maxSize: { value: maxSize, message: errorUtil.toString(message) }
|
|
2933
2957
|
});
|
|
@@ -2939,7 +2963,8 @@ var ZodSet = class extends ZodType {
|
|
|
2939
2963
|
return this.min(1, message);
|
|
2940
2964
|
}
|
|
2941
2965
|
};
|
|
2942
|
-
__name(
|
|
2966
|
+
__name(_ZodSet, "ZodSet");
|
|
2967
|
+
var ZodSet = _ZodSet;
|
|
2943
2968
|
ZodSet.create = (valueType, params) => {
|
|
2944
2969
|
return new ZodSet({
|
|
2945
2970
|
valueType,
|
|
@@ -2949,7 +2974,7 @@ ZodSet.create = (valueType, params) => {
|
|
|
2949
2974
|
...processCreateParams(params)
|
|
2950
2975
|
});
|
|
2951
2976
|
};
|
|
2952
|
-
var
|
|
2977
|
+
var _ZodFunction = class _ZodFunction extends ZodType {
|
|
2953
2978
|
constructor() {
|
|
2954
2979
|
super(...arguments);
|
|
2955
2980
|
this.validate = this.implement;
|
|
@@ -3038,13 +3063,13 @@ var ZodFunction = class extends ZodType {
|
|
|
3038
3063
|
return this._def.returns;
|
|
3039
3064
|
}
|
|
3040
3065
|
args(...items) {
|
|
3041
|
-
return new
|
|
3066
|
+
return new _ZodFunction({
|
|
3042
3067
|
...this._def,
|
|
3043
3068
|
args: ZodTuple.create(items).rest(ZodUnknown.create())
|
|
3044
3069
|
});
|
|
3045
3070
|
}
|
|
3046
3071
|
returns(returnType) {
|
|
3047
|
-
return new
|
|
3072
|
+
return new _ZodFunction({
|
|
3048
3073
|
...this._def,
|
|
3049
3074
|
returns: returnType
|
|
3050
3075
|
});
|
|
@@ -3058,7 +3083,7 @@ var ZodFunction = class extends ZodType {
|
|
|
3058
3083
|
return validatedFunc;
|
|
3059
3084
|
}
|
|
3060
3085
|
static create(args, returns, params) {
|
|
3061
|
-
return new
|
|
3086
|
+
return new _ZodFunction({
|
|
3062
3087
|
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
3063
3088
|
returns: returns || ZodUnknown.create(),
|
|
3064
3089
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
@@ -3066,8 +3091,9 @@ var ZodFunction = class extends ZodType {
|
|
|
3066
3091
|
});
|
|
3067
3092
|
}
|
|
3068
3093
|
};
|
|
3069
|
-
__name(
|
|
3070
|
-
var
|
|
3094
|
+
__name(_ZodFunction, "ZodFunction");
|
|
3095
|
+
var ZodFunction = _ZodFunction;
|
|
3096
|
+
var _ZodLazy = class _ZodLazy extends ZodType {
|
|
3071
3097
|
get schema() {
|
|
3072
3098
|
return this._def.getter();
|
|
3073
3099
|
}
|
|
@@ -3077,7 +3103,8 @@ var ZodLazy = class extends ZodType {
|
|
|
3077
3103
|
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
3078
3104
|
}
|
|
3079
3105
|
};
|
|
3080
|
-
__name(
|
|
3106
|
+
__name(_ZodLazy, "ZodLazy");
|
|
3107
|
+
var ZodLazy = _ZodLazy;
|
|
3081
3108
|
ZodLazy.create = (getter, params) => {
|
|
3082
3109
|
return new ZodLazy({
|
|
3083
3110
|
getter,
|
|
@@ -3085,7 +3112,7 @@ ZodLazy.create = (getter, params) => {
|
|
|
3085
3112
|
...processCreateParams(params)
|
|
3086
3113
|
});
|
|
3087
3114
|
};
|
|
3088
|
-
var
|
|
3115
|
+
var _ZodLiteral = class _ZodLiteral extends ZodType {
|
|
3089
3116
|
_parse(input) {
|
|
3090
3117
|
if (input.data !== this._def.value) {
|
|
3091
3118
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3102,7 +3129,8 @@ var ZodLiteral = class extends ZodType {
|
|
|
3102
3129
|
return this._def.value;
|
|
3103
3130
|
}
|
|
3104
3131
|
};
|
|
3105
|
-
__name(
|
|
3132
|
+
__name(_ZodLiteral, "ZodLiteral");
|
|
3133
|
+
var ZodLiteral = _ZodLiteral;
|
|
3106
3134
|
ZodLiteral.create = (value, params) => {
|
|
3107
3135
|
return new ZodLiteral({
|
|
3108
3136
|
value,
|
|
@@ -3118,7 +3146,7 @@ function createZodEnum(values, params) {
|
|
|
3118
3146
|
});
|
|
3119
3147
|
}
|
|
3120
3148
|
__name(createZodEnum, "createZodEnum");
|
|
3121
|
-
var
|
|
3149
|
+
var _ZodEnum = class _ZodEnum extends ZodType {
|
|
3122
3150
|
_parse(input) {
|
|
3123
3151
|
if (typeof input.data !== "string") {
|
|
3124
3152
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3167,15 +3195,16 @@ var ZodEnum = class extends ZodType {
|
|
|
3167
3195
|
return enumValues;
|
|
3168
3196
|
}
|
|
3169
3197
|
extract(values) {
|
|
3170
|
-
return
|
|
3198
|
+
return _ZodEnum.create(values);
|
|
3171
3199
|
}
|
|
3172
3200
|
exclude(values) {
|
|
3173
|
-
return
|
|
3201
|
+
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
|
|
3174
3202
|
}
|
|
3175
3203
|
};
|
|
3176
|
-
__name(
|
|
3204
|
+
__name(_ZodEnum, "ZodEnum");
|
|
3205
|
+
var ZodEnum = _ZodEnum;
|
|
3177
3206
|
ZodEnum.create = createZodEnum;
|
|
3178
|
-
var
|
|
3207
|
+
var _ZodNativeEnum = class _ZodNativeEnum extends ZodType {
|
|
3179
3208
|
_parse(input) {
|
|
3180
3209
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
3181
3210
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3203,7 +3232,8 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
3203
3232
|
return this._def.values;
|
|
3204
3233
|
}
|
|
3205
3234
|
};
|
|
3206
|
-
__name(
|
|
3235
|
+
__name(_ZodNativeEnum, "ZodNativeEnum");
|
|
3236
|
+
var ZodNativeEnum = _ZodNativeEnum;
|
|
3207
3237
|
ZodNativeEnum.create = (values, params) => {
|
|
3208
3238
|
return new ZodNativeEnum({
|
|
3209
3239
|
values,
|
|
@@ -3211,7 +3241,7 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
3211
3241
|
...processCreateParams(params)
|
|
3212
3242
|
});
|
|
3213
3243
|
};
|
|
3214
|
-
var
|
|
3244
|
+
var _ZodPromise = class _ZodPromise extends ZodType {
|
|
3215
3245
|
unwrap() {
|
|
3216
3246
|
return this._def.type;
|
|
3217
3247
|
}
|
|
@@ -3234,7 +3264,8 @@ var ZodPromise = class extends ZodType {
|
|
|
3234
3264
|
}));
|
|
3235
3265
|
}
|
|
3236
3266
|
};
|
|
3237
|
-
__name(
|
|
3267
|
+
__name(_ZodPromise, "ZodPromise");
|
|
3268
|
+
var ZodPromise = _ZodPromise;
|
|
3238
3269
|
ZodPromise.create = (schema, params) => {
|
|
3239
3270
|
return new ZodPromise({
|
|
3240
3271
|
type: schema,
|
|
@@ -3242,7 +3273,7 @@ ZodPromise.create = (schema, params) => {
|
|
|
3242
3273
|
...processCreateParams(params)
|
|
3243
3274
|
});
|
|
3244
3275
|
};
|
|
3245
|
-
var
|
|
3276
|
+
var _ZodEffects = class _ZodEffects extends ZodType {
|
|
3246
3277
|
innerType() {
|
|
3247
3278
|
return this._def.schema;
|
|
3248
3279
|
}
|
|
@@ -3350,7 +3381,8 @@ var ZodEffects = class extends ZodType {
|
|
|
3350
3381
|
util.assertNever(effect);
|
|
3351
3382
|
}
|
|
3352
3383
|
};
|
|
3353
|
-
__name(
|
|
3384
|
+
__name(_ZodEffects, "ZodEffects");
|
|
3385
|
+
var ZodEffects = _ZodEffects;
|
|
3354
3386
|
ZodEffects.create = (schema, effect, params) => {
|
|
3355
3387
|
return new ZodEffects({
|
|
3356
3388
|
schema,
|
|
@@ -3367,7 +3399,7 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
3367
3399
|
...processCreateParams(params)
|
|
3368
3400
|
});
|
|
3369
3401
|
};
|
|
3370
|
-
var
|
|
3402
|
+
var _ZodOptional = class _ZodOptional extends ZodType {
|
|
3371
3403
|
_parse(input) {
|
|
3372
3404
|
const parsedType = this._getType(input);
|
|
3373
3405
|
if (parsedType === ZodParsedType.undefined) {
|
|
@@ -3379,7 +3411,8 @@ var ZodOptional = class extends ZodType {
|
|
|
3379
3411
|
return this._def.innerType;
|
|
3380
3412
|
}
|
|
3381
3413
|
};
|
|
3382
|
-
__name(
|
|
3414
|
+
__name(_ZodOptional, "ZodOptional");
|
|
3415
|
+
var ZodOptional = _ZodOptional;
|
|
3383
3416
|
ZodOptional.create = (type, params) => {
|
|
3384
3417
|
return new ZodOptional({
|
|
3385
3418
|
innerType: type,
|
|
@@ -3387,7 +3420,7 @@ ZodOptional.create = (type, params) => {
|
|
|
3387
3420
|
...processCreateParams(params)
|
|
3388
3421
|
});
|
|
3389
3422
|
};
|
|
3390
|
-
var
|
|
3423
|
+
var _ZodNullable = class _ZodNullable extends ZodType {
|
|
3391
3424
|
_parse(input) {
|
|
3392
3425
|
const parsedType = this._getType(input);
|
|
3393
3426
|
if (parsedType === ZodParsedType.null) {
|
|
@@ -3399,7 +3432,8 @@ var ZodNullable = class extends ZodType {
|
|
|
3399
3432
|
return this._def.innerType;
|
|
3400
3433
|
}
|
|
3401
3434
|
};
|
|
3402
|
-
__name(
|
|
3435
|
+
__name(_ZodNullable, "ZodNullable");
|
|
3436
|
+
var ZodNullable = _ZodNullable;
|
|
3403
3437
|
ZodNullable.create = (type, params) => {
|
|
3404
3438
|
return new ZodNullable({
|
|
3405
3439
|
innerType: type,
|
|
@@ -3407,7 +3441,7 @@ ZodNullable.create = (type, params) => {
|
|
|
3407
3441
|
...processCreateParams(params)
|
|
3408
3442
|
});
|
|
3409
3443
|
};
|
|
3410
|
-
var
|
|
3444
|
+
var _ZodDefault = class _ZodDefault extends ZodType {
|
|
3411
3445
|
_parse(input) {
|
|
3412
3446
|
const { ctx } = this._processInputParams(input);
|
|
3413
3447
|
let data = ctx.data;
|
|
@@ -3424,7 +3458,8 @@ var ZodDefault = class extends ZodType {
|
|
|
3424
3458
|
return this._def.innerType;
|
|
3425
3459
|
}
|
|
3426
3460
|
};
|
|
3427
|
-
__name(
|
|
3461
|
+
__name(_ZodDefault, "ZodDefault");
|
|
3462
|
+
var ZodDefault = _ZodDefault;
|
|
3428
3463
|
ZodDefault.create = (type, params) => {
|
|
3429
3464
|
return new ZodDefault({
|
|
3430
3465
|
innerType: type,
|
|
@@ -3433,7 +3468,7 @@ ZodDefault.create = (type, params) => {
|
|
|
3433
3468
|
...processCreateParams(params)
|
|
3434
3469
|
});
|
|
3435
3470
|
};
|
|
3436
|
-
var
|
|
3471
|
+
var _ZodCatch = class _ZodCatch extends ZodType {
|
|
3437
3472
|
_parse(input) {
|
|
3438
3473
|
const { ctx } = this._processInputParams(input);
|
|
3439
3474
|
const newCtx = {
|
|
@@ -3478,7 +3513,8 @@ var ZodCatch = class extends ZodType {
|
|
|
3478
3513
|
return this._def.innerType;
|
|
3479
3514
|
}
|
|
3480
3515
|
};
|
|
3481
|
-
__name(
|
|
3516
|
+
__name(_ZodCatch, "ZodCatch");
|
|
3517
|
+
var ZodCatch = _ZodCatch;
|
|
3482
3518
|
ZodCatch.create = (type, params) => {
|
|
3483
3519
|
return new ZodCatch({
|
|
3484
3520
|
innerType: type,
|
|
@@ -3487,7 +3523,7 @@ ZodCatch.create = (type, params) => {
|
|
|
3487
3523
|
...processCreateParams(params)
|
|
3488
3524
|
});
|
|
3489
3525
|
};
|
|
3490
|
-
var
|
|
3526
|
+
var _ZodNaN = class _ZodNaN extends ZodType {
|
|
3491
3527
|
_parse(input) {
|
|
3492
3528
|
const parsedType = this._getType(input);
|
|
3493
3529
|
if (parsedType !== ZodParsedType.nan) {
|
|
@@ -3502,7 +3538,8 @@ var ZodNaN = class extends ZodType {
|
|
|
3502
3538
|
return { status: "valid", value: input.data };
|
|
3503
3539
|
}
|
|
3504
3540
|
};
|
|
3505
|
-
__name(
|
|
3541
|
+
__name(_ZodNaN, "ZodNaN");
|
|
3542
|
+
var ZodNaN = _ZodNaN;
|
|
3506
3543
|
ZodNaN.create = (params) => {
|
|
3507
3544
|
return new ZodNaN({
|
|
3508
3545
|
typeName: ZodFirstPartyTypeKind.ZodNaN,
|
|
@@ -3510,7 +3547,7 @@ ZodNaN.create = (params) => {
|
|
|
3510
3547
|
});
|
|
3511
3548
|
};
|
|
3512
3549
|
var BRAND = Symbol("zod_brand");
|
|
3513
|
-
var
|
|
3550
|
+
var _ZodBranded = class _ZodBranded extends ZodType {
|
|
3514
3551
|
_parse(input) {
|
|
3515
3552
|
const { ctx } = this._processInputParams(input);
|
|
3516
3553
|
const data = ctx.data;
|
|
@@ -3524,8 +3561,9 @@ var ZodBranded = class extends ZodType {
|
|
|
3524
3561
|
return this._def.type;
|
|
3525
3562
|
}
|
|
3526
3563
|
};
|
|
3527
|
-
__name(
|
|
3528
|
-
var
|
|
3564
|
+
__name(_ZodBranded, "ZodBranded");
|
|
3565
|
+
var ZodBranded = _ZodBranded;
|
|
3566
|
+
var _ZodPipeline = class _ZodPipeline extends ZodType {
|
|
3529
3567
|
_parse(input) {
|
|
3530
3568
|
const { status, ctx } = this._processInputParams(input);
|
|
3531
3569
|
if (ctx.common.async) {
|
|
@@ -3573,15 +3611,16 @@ var ZodPipeline = class extends ZodType {
|
|
|
3573
3611
|
}
|
|
3574
3612
|
}
|
|
3575
3613
|
static create(a, b) {
|
|
3576
|
-
return new
|
|
3614
|
+
return new _ZodPipeline({
|
|
3577
3615
|
in: a,
|
|
3578
3616
|
out: b,
|
|
3579
3617
|
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
3580
3618
|
});
|
|
3581
3619
|
}
|
|
3582
3620
|
};
|
|
3583
|
-
__name(
|
|
3584
|
-
var
|
|
3621
|
+
__name(_ZodPipeline, "ZodPipeline");
|
|
3622
|
+
var ZodPipeline = _ZodPipeline;
|
|
3623
|
+
var _ZodReadonly = class _ZodReadonly extends ZodType {
|
|
3585
3624
|
_parse(input) {
|
|
3586
3625
|
const result = this._def.innerType._parse(input);
|
|
3587
3626
|
if (isValid(result)) {
|
|
@@ -3590,7 +3629,8 @@ var ZodReadonly = class extends ZodType {
|
|
|
3590
3629
|
return result;
|
|
3591
3630
|
}
|
|
3592
3631
|
};
|
|
3593
|
-
__name(
|
|
3632
|
+
__name(_ZodReadonly, "ZodReadonly");
|
|
3633
|
+
var ZodReadonly = _ZodReadonly;
|
|
3594
3634
|
ZodReadonly.create = (type, params) => {
|
|
3595
3635
|
return new ZodReadonly({
|
|
3596
3636
|
innerType: type,
|
|
@@ -3601,10 +3641,10 @@ ZodReadonly.create = (type, params) => {
|
|
|
3601
3641
|
var custom = /* @__PURE__ */ __name((check, params = {}, fatal) => {
|
|
3602
3642
|
if (check)
|
|
3603
3643
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3604
|
-
var
|
|
3644
|
+
var _a41, _b;
|
|
3605
3645
|
if (!check(data)) {
|
|
3606
3646
|
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
3607
|
-
const _fatal = (_b = (
|
|
3647
|
+
const _fatal = (_b = (_a41 = p.fatal) !== null && _a41 !== void 0 ? _a41 : fatal) !== null && _b !== void 0 ? _b : true;
|
|
3608
3648
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3609
3649
|
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
|
3610
3650
|
}
|
|
@@ -3820,14 +3860,14 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
3820
3860
|
ZodError
|
|
3821
3861
|
});
|
|
3822
3862
|
|
|
3823
|
-
// ../core/dist/chunk-
|
|
3863
|
+
// ../core/dist/chunk-VLQXSCFN.js
|
|
3824
3864
|
var __defProp2 = Object.defineProperty;
|
|
3825
3865
|
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
|
|
3826
3866
|
value,
|
|
3827
3867
|
configurable: true
|
|
3828
3868
|
}), "__name");
|
|
3829
3869
|
|
|
3830
|
-
// ../core/dist/chunk-
|
|
3870
|
+
// ../core/dist/chunk-KQBRKKMR.js
|
|
3831
3871
|
var util2;
|
|
3832
3872
|
(function(util22) {
|
|
3833
3873
|
util22.assertEqual = (val) => val;
|
|
@@ -3986,7 +4026,8 @@ var quotelessJson2 = /* @__PURE__ */ __name2((obj) => {
|
|
|
3986
4026
|
const json10 = JSON.stringify(obj, null, 2);
|
|
3987
4027
|
return json10.replace(/"([^"]+)":/g, "$1:");
|
|
3988
4028
|
}, "quotelessJson");
|
|
3989
|
-
var
|
|
4029
|
+
var _a;
|
|
4030
|
+
var _ZodError2 = (_a = class extends Error {
|
|
3990
4031
|
constructor(issues) {
|
|
3991
4032
|
super();
|
|
3992
4033
|
this.issues = [];
|
|
@@ -4084,8 +4125,9 @@ var ZodError2 = /* @__PURE__ */ __name(class extends Error {
|
|
|
4084
4125
|
get formErrors() {
|
|
4085
4126
|
return this.flatten();
|
|
4086
4127
|
}
|
|
4087
|
-
}, "
|
|
4088
|
-
__name2(
|
|
4128
|
+
}, __name(_a, "_ZodError"), _a);
|
|
4129
|
+
__name2(_ZodError2, "ZodError");
|
|
4130
|
+
var ZodError2 = _ZodError2;
|
|
4089
4131
|
ZodError2.create = (issues) => {
|
|
4090
4132
|
const error = new ZodError2(issues);
|
|
4091
4133
|
return error;
|
|
@@ -4242,7 +4284,8 @@ function addIssueToContext2(ctx, issueData) {
|
|
|
4242
4284
|
}
|
|
4243
4285
|
__name(addIssueToContext2, "addIssueToContext");
|
|
4244
4286
|
__name2(addIssueToContext2, "addIssueToContext");
|
|
4245
|
-
var
|
|
4287
|
+
var _a2;
|
|
4288
|
+
var _ParseStatus2 = (_a2 = class {
|
|
4246
4289
|
constructor() {
|
|
4247
4290
|
this.value = "valid";
|
|
4248
4291
|
}
|
|
@@ -4276,7 +4319,7 @@ var ParseStatus2 = /* @__PURE__ */ __name(class {
|
|
|
4276
4319
|
value: await pair.value
|
|
4277
4320
|
});
|
|
4278
4321
|
}
|
|
4279
|
-
return
|
|
4322
|
+
return _a2.mergeObjectSync(status, syncPairs);
|
|
4280
4323
|
}
|
|
4281
4324
|
static mergeObjectSync(status, pairs) {
|
|
4282
4325
|
const finalObject = {};
|
|
@@ -4299,8 +4342,9 @@ var ParseStatus2 = /* @__PURE__ */ __name(class {
|
|
|
4299
4342
|
value: finalObject
|
|
4300
4343
|
};
|
|
4301
4344
|
}
|
|
4302
|
-
}, "
|
|
4303
|
-
__name2(
|
|
4345
|
+
}, __name(_a2, "_ParseStatus"), _a2);
|
|
4346
|
+
__name2(_ParseStatus2, "ParseStatus");
|
|
4347
|
+
var ParseStatus2 = _ParseStatus2;
|
|
4304
4348
|
var INVALID2 = Object.freeze({
|
|
4305
4349
|
status: "aborted"
|
|
4306
4350
|
});
|
|
@@ -4323,7 +4367,8 @@ var errorUtil2;
|
|
|
4323
4367
|
} : message || {};
|
|
4324
4368
|
errorUtil22.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
4325
4369
|
})(errorUtil2 || (errorUtil2 = {}));
|
|
4326
|
-
var
|
|
4370
|
+
var _a3;
|
|
4371
|
+
var _ParseInputLazyPath2 = (_a3 = class {
|
|
4327
4372
|
constructor(parent, value, path, key) {
|
|
4328
4373
|
this._cachedPath = [];
|
|
4329
4374
|
this.parent = parent;
|
|
@@ -4341,8 +4386,9 @@ var ParseInputLazyPath2 = /* @__PURE__ */ __name(class {
|
|
|
4341
4386
|
}
|
|
4342
4387
|
return this._cachedPath;
|
|
4343
4388
|
}
|
|
4344
|
-
}, "
|
|
4345
|
-
__name2(
|
|
4389
|
+
}, __name(_a3, "_ParseInputLazyPath"), _a3);
|
|
4390
|
+
__name2(_ParseInputLazyPath2, "ParseInputLazyPath");
|
|
4391
|
+
var ParseInputLazyPath2 = _ParseInputLazyPath2;
|
|
4346
4392
|
var handleResult2 = /* @__PURE__ */ __name2((ctx, result) => {
|
|
4347
4393
|
if (isValid2(result)) {
|
|
4348
4394
|
return {
|
|
@@ -4398,7 +4444,8 @@ function processCreateParams2(params) {
|
|
|
4398
4444
|
}
|
|
4399
4445
|
__name(processCreateParams2, "processCreateParams");
|
|
4400
4446
|
__name2(processCreateParams2, "processCreateParams");
|
|
4401
|
-
var
|
|
4447
|
+
var _a4;
|
|
4448
|
+
var _ZodType2 = (_a4 = class {
|
|
4402
4449
|
constructor(def) {
|
|
4403
4450
|
this.spa = this.safeParseAsync;
|
|
4404
4451
|
this._def = def;
|
|
@@ -4474,11 +4521,11 @@ var ZodType2 = /* @__PURE__ */ __name(class {
|
|
|
4474
4521
|
throw result.error;
|
|
4475
4522
|
}
|
|
4476
4523
|
safeParse(data, params) {
|
|
4477
|
-
var
|
|
4524
|
+
var _a41;
|
|
4478
4525
|
const ctx = {
|
|
4479
4526
|
common: {
|
|
4480
4527
|
issues: [],
|
|
4481
|
-
async: (
|
|
4528
|
+
async: (_a41 = params === null || params === void 0 ? void 0 : params.async) !== null && _a41 !== void 0 ? _a41 : false,
|
|
4482
4529
|
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
|
|
4483
4530
|
},
|
|
4484
4531
|
path: (params === null || params === void 0 ? void 0 : params.path) || [],
|
|
@@ -4659,8 +4706,9 @@ var ZodType2 = /* @__PURE__ */ __name(class {
|
|
|
4659
4706
|
isNullable() {
|
|
4660
4707
|
return this.safeParse(null).success;
|
|
4661
4708
|
}
|
|
4662
|
-
}, "
|
|
4663
|
-
__name2(
|
|
4709
|
+
}, __name(_a4, "_ZodType"), _a4);
|
|
4710
|
+
__name2(_ZodType2, "ZodType");
|
|
4711
|
+
var ZodType2 = _ZodType2;
|
|
4664
4712
|
var cuidRegex2 = /^c[^\s-]{8,}$/i;
|
|
4665
4713
|
var cuid2Regex2 = /^[a-z][a-z0-9]*$/;
|
|
4666
4714
|
var ulidRegex2 = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
@@ -4702,7 +4750,8 @@ function isValidIP2(ip, version) {
|
|
|
4702
4750
|
}
|
|
4703
4751
|
__name(isValidIP2, "isValidIP");
|
|
4704
4752
|
__name2(isValidIP2, "isValidIP");
|
|
4705
|
-
var
|
|
4753
|
+
var _a5;
|
|
4754
|
+
var _ZodString2 = (_a5 = class extends ZodType2 {
|
|
4706
4755
|
_parse(input) {
|
|
4707
4756
|
if (this._def.coerce) {
|
|
4708
4757
|
input.data = String(input.data);
|
|
@@ -4838,7 +4887,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
4838
4887
|
} else if (check.kind === "url") {
|
|
4839
4888
|
try {
|
|
4840
4889
|
new URL(input.data);
|
|
4841
|
-
} catch (
|
|
4890
|
+
} catch (_a41) {
|
|
4842
4891
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
4843
4892
|
addIssueToContext2(ctx, {
|
|
4844
4893
|
validation: "url",
|
|
@@ -4940,7 +4989,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
4940
4989
|
});
|
|
4941
4990
|
}
|
|
4942
4991
|
_addCheck(check) {
|
|
4943
|
-
return new
|
|
4992
|
+
return new _a5({
|
|
4944
4993
|
...this._def,
|
|
4945
4994
|
checks: [
|
|
4946
4995
|
...this._def.checks,
|
|
@@ -4997,7 +5046,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
4997
5046
|
});
|
|
4998
5047
|
}
|
|
4999
5048
|
datetime(options) {
|
|
5000
|
-
var
|
|
5049
|
+
var _a41;
|
|
5001
5050
|
if (typeof options === "string") {
|
|
5002
5051
|
return this._addCheck({
|
|
5003
5052
|
kind: "datetime",
|
|
@@ -5009,7 +5058,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5009
5058
|
return this._addCheck({
|
|
5010
5059
|
kind: "datetime",
|
|
5011
5060
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
5012
|
-
offset: (
|
|
5061
|
+
offset: (_a41 = options === null || options === void 0 ? void 0 : options.offset) !== null && _a41 !== void 0 ? _a41 : false,
|
|
5013
5062
|
...errorUtil2.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
5014
5063
|
});
|
|
5015
5064
|
}
|
|
@@ -5071,7 +5120,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5071
5120
|
return this.min(1, errorUtil2.errToObj(message));
|
|
5072
5121
|
}
|
|
5073
5122
|
trim() {
|
|
5074
|
-
return new
|
|
5123
|
+
return new _a5({
|
|
5075
5124
|
...this._def,
|
|
5076
5125
|
checks: [
|
|
5077
5126
|
...this._def.checks,
|
|
@@ -5082,7 +5131,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5082
5131
|
});
|
|
5083
5132
|
}
|
|
5084
5133
|
toLowerCase() {
|
|
5085
|
-
return new
|
|
5134
|
+
return new _a5({
|
|
5086
5135
|
...this._def,
|
|
5087
5136
|
checks: [
|
|
5088
5137
|
...this._def.checks,
|
|
@@ -5093,7 +5142,7 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5093
5142
|
});
|
|
5094
5143
|
}
|
|
5095
5144
|
toUpperCase() {
|
|
5096
|
-
return new
|
|
5145
|
+
return new _a5({
|
|
5097
5146
|
...this._def,
|
|
5098
5147
|
checks: [
|
|
5099
5148
|
...this._def.checks,
|
|
@@ -5150,14 +5199,15 @@ var ZodString2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5150
5199
|
}
|
|
5151
5200
|
return max;
|
|
5152
5201
|
}
|
|
5153
|
-
}, "
|
|
5154
|
-
__name2(
|
|
5202
|
+
}, __name(_a5, "_ZodString"), _a5);
|
|
5203
|
+
__name2(_ZodString2, "ZodString");
|
|
5204
|
+
var ZodString2 = _ZodString2;
|
|
5155
5205
|
ZodString2.create = (params) => {
|
|
5156
|
-
var
|
|
5206
|
+
var _a41;
|
|
5157
5207
|
return new ZodString2({
|
|
5158
5208
|
checks: [],
|
|
5159
5209
|
typeName: ZodFirstPartyTypeKind2.ZodString,
|
|
5160
|
-
coerce: (
|
|
5210
|
+
coerce: (_a41 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a41 !== void 0 ? _a41 : false,
|
|
5161
5211
|
...processCreateParams2(params)
|
|
5162
5212
|
});
|
|
5163
5213
|
};
|
|
@@ -5171,7 +5221,8 @@ function floatSafeRemainder2(val, step) {
|
|
|
5171
5221
|
}
|
|
5172
5222
|
__name(floatSafeRemainder2, "floatSafeRemainder");
|
|
5173
5223
|
__name2(floatSafeRemainder2, "floatSafeRemainder");
|
|
5174
|
-
var
|
|
5224
|
+
var _a6;
|
|
5225
|
+
var _ZodNumber2 = (_a6 = class extends ZodType2 {
|
|
5175
5226
|
constructor() {
|
|
5176
5227
|
super(...arguments);
|
|
5177
5228
|
this.min = this.gte;
|
|
@@ -5275,7 +5326,7 @@ var ZodNumber2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5275
5326
|
return this.setLimit("max", value, false, errorUtil2.toString(message));
|
|
5276
5327
|
}
|
|
5277
5328
|
setLimit(kind, value, inclusive, message) {
|
|
5278
|
-
return new
|
|
5329
|
+
return new _a6({
|
|
5279
5330
|
...this._def,
|
|
5280
5331
|
checks: [
|
|
5281
5332
|
...this._def.checks,
|
|
@@ -5289,7 +5340,7 @@ var ZodNumber2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5289
5340
|
});
|
|
5290
5341
|
}
|
|
5291
5342
|
_addCheck(check) {
|
|
5292
|
-
return new
|
|
5343
|
+
return new _a6({
|
|
5293
5344
|
...this._def,
|
|
5294
5345
|
checks: [
|
|
5295
5346
|
...this._def.checks,
|
|
@@ -5399,8 +5450,9 @@ var ZodNumber2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5399
5450
|
}
|
|
5400
5451
|
return Number.isFinite(min) && Number.isFinite(max);
|
|
5401
5452
|
}
|
|
5402
|
-
}, "
|
|
5403
|
-
__name2(
|
|
5453
|
+
}, __name(_a6, "_ZodNumber"), _a6);
|
|
5454
|
+
__name2(_ZodNumber2, "ZodNumber");
|
|
5455
|
+
var ZodNumber2 = _ZodNumber2;
|
|
5404
5456
|
ZodNumber2.create = (params) => {
|
|
5405
5457
|
return new ZodNumber2({
|
|
5406
5458
|
checks: [],
|
|
@@ -5409,7 +5461,8 @@ ZodNumber2.create = (params) => {
|
|
|
5409
5461
|
...processCreateParams2(params)
|
|
5410
5462
|
});
|
|
5411
5463
|
};
|
|
5412
|
-
var
|
|
5464
|
+
var _a7;
|
|
5465
|
+
var _ZodBigInt2 = (_a7 = class extends ZodType2 {
|
|
5413
5466
|
constructor() {
|
|
5414
5467
|
super(...arguments);
|
|
5415
5468
|
this.min = this.gte;
|
|
@@ -5490,7 +5543,7 @@ var ZodBigInt2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5490
5543
|
return this.setLimit("max", value, false, errorUtil2.toString(message));
|
|
5491
5544
|
}
|
|
5492
5545
|
setLimit(kind, value, inclusive, message) {
|
|
5493
|
-
return new
|
|
5546
|
+
return new _a7({
|
|
5494
5547
|
...this._def,
|
|
5495
5548
|
checks: [
|
|
5496
5549
|
...this._def.checks,
|
|
@@ -5504,7 +5557,7 @@ var ZodBigInt2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5504
5557
|
});
|
|
5505
5558
|
}
|
|
5506
5559
|
_addCheck(check) {
|
|
5507
|
-
return new
|
|
5560
|
+
return new _a7({
|
|
5508
5561
|
...this._def,
|
|
5509
5562
|
checks: [
|
|
5510
5563
|
...this._def.checks,
|
|
@@ -5571,18 +5624,20 @@ var ZodBigInt2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5571
5624
|
}
|
|
5572
5625
|
return max;
|
|
5573
5626
|
}
|
|
5574
|
-
}, "
|
|
5575
|
-
__name2(
|
|
5627
|
+
}, __name(_a7, "_ZodBigInt"), _a7);
|
|
5628
|
+
__name2(_ZodBigInt2, "ZodBigInt");
|
|
5629
|
+
var ZodBigInt2 = _ZodBigInt2;
|
|
5576
5630
|
ZodBigInt2.create = (params) => {
|
|
5577
|
-
var
|
|
5631
|
+
var _a41;
|
|
5578
5632
|
return new ZodBigInt2({
|
|
5579
5633
|
checks: [],
|
|
5580
5634
|
typeName: ZodFirstPartyTypeKind2.ZodBigInt,
|
|
5581
|
-
coerce: (
|
|
5635
|
+
coerce: (_a41 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a41 !== void 0 ? _a41 : false,
|
|
5582
5636
|
...processCreateParams2(params)
|
|
5583
5637
|
});
|
|
5584
5638
|
};
|
|
5585
|
-
var
|
|
5639
|
+
var _a8;
|
|
5640
|
+
var _ZodBoolean2 = (_a8 = class extends ZodType2 {
|
|
5586
5641
|
_parse(input) {
|
|
5587
5642
|
if (this._def.coerce) {
|
|
5588
5643
|
input.data = Boolean(input.data);
|
|
@@ -5599,8 +5654,9 @@ var ZodBoolean2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5599
5654
|
}
|
|
5600
5655
|
return OK2(input.data);
|
|
5601
5656
|
}
|
|
5602
|
-
}, "
|
|
5603
|
-
__name2(
|
|
5657
|
+
}, __name(_a8, "_ZodBoolean"), _a8);
|
|
5658
|
+
__name2(_ZodBoolean2, "ZodBoolean");
|
|
5659
|
+
var ZodBoolean2 = _ZodBoolean2;
|
|
5604
5660
|
ZodBoolean2.create = (params) => {
|
|
5605
5661
|
return new ZodBoolean2({
|
|
5606
5662
|
typeName: ZodFirstPartyTypeKind2.ZodBoolean,
|
|
@@ -5608,7 +5664,8 @@ ZodBoolean2.create = (params) => {
|
|
|
5608
5664
|
...processCreateParams2(params)
|
|
5609
5665
|
});
|
|
5610
5666
|
};
|
|
5611
|
-
var
|
|
5667
|
+
var _a9;
|
|
5668
|
+
var _ZodDate2 = (_a9 = class extends ZodType2 {
|
|
5612
5669
|
_parse(input) {
|
|
5613
5670
|
if (this._def.coerce) {
|
|
5614
5671
|
input.data = new Date(input.data);
|
|
@@ -5669,7 +5726,7 @@ var ZodDate2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5669
5726
|
};
|
|
5670
5727
|
}
|
|
5671
5728
|
_addCheck(check) {
|
|
5672
|
-
return new
|
|
5729
|
+
return new _a9({
|
|
5673
5730
|
...this._def,
|
|
5674
5731
|
checks: [
|
|
5675
5732
|
...this._def.checks,
|
|
@@ -5711,8 +5768,9 @@ var ZodDate2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5711
5768
|
}
|
|
5712
5769
|
return max != null ? new Date(max) : null;
|
|
5713
5770
|
}
|
|
5714
|
-
}, "
|
|
5715
|
-
__name2(
|
|
5771
|
+
}, __name(_a9, "_ZodDate"), _a9);
|
|
5772
|
+
__name2(_ZodDate2, "ZodDate");
|
|
5773
|
+
var ZodDate2 = _ZodDate2;
|
|
5716
5774
|
ZodDate2.create = (params) => {
|
|
5717
5775
|
return new ZodDate2({
|
|
5718
5776
|
checks: [],
|
|
@@ -5721,7 +5779,8 @@ ZodDate2.create = (params) => {
|
|
|
5721
5779
|
...processCreateParams2(params)
|
|
5722
5780
|
});
|
|
5723
5781
|
};
|
|
5724
|
-
var
|
|
5782
|
+
var _a10;
|
|
5783
|
+
var _ZodSymbol2 = (_a10 = class extends ZodType2 {
|
|
5725
5784
|
_parse(input) {
|
|
5726
5785
|
const parsedType = this._getType(input);
|
|
5727
5786
|
if (parsedType !== ZodParsedType2.symbol) {
|
|
@@ -5735,15 +5794,17 @@ var ZodSymbol2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5735
5794
|
}
|
|
5736
5795
|
return OK2(input.data);
|
|
5737
5796
|
}
|
|
5738
|
-
}, "
|
|
5739
|
-
__name2(
|
|
5797
|
+
}, __name(_a10, "_ZodSymbol"), _a10);
|
|
5798
|
+
__name2(_ZodSymbol2, "ZodSymbol");
|
|
5799
|
+
var ZodSymbol2 = _ZodSymbol2;
|
|
5740
5800
|
ZodSymbol2.create = (params) => {
|
|
5741
5801
|
return new ZodSymbol2({
|
|
5742
5802
|
typeName: ZodFirstPartyTypeKind2.ZodSymbol,
|
|
5743
5803
|
...processCreateParams2(params)
|
|
5744
5804
|
});
|
|
5745
5805
|
};
|
|
5746
|
-
var
|
|
5806
|
+
var _a11;
|
|
5807
|
+
var _ZodUndefined2 = (_a11 = class extends ZodType2 {
|
|
5747
5808
|
_parse(input) {
|
|
5748
5809
|
const parsedType = this._getType(input);
|
|
5749
5810
|
if (parsedType !== ZodParsedType2.undefined) {
|
|
@@ -5757,15 +5818,17 @@ var ZodUndefined2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5757
5818
|
}
|
|
5758
5819
|
return OK2(input.data);
|
|
5759
5820
|
}
|
|
5760
|
-
}, "
|
|
5761
|
-
__name2(
|
|
5821
|
+
}, __name(_a11, "_ZodUndefined"), _a11);
|
|
5822
|
+
__name2(_ZodUndefined2, "ZodUndefined");
|
|
5823
|
+
var ZodUndefined2 = _ZodUndefined2;
|
|
5762
5824
|
ZodUndefined2.create = (params) => {
|
|
5763
5825
|
return new ZodUndefined2({
|
|
5764
5826
|
typeName: ZodFirstPartyTypeKind2.ZodUndefined,
|
|
5765
5827
|
...processCreateParams2(params)
|
|
5766
5828
|
});
|
|
5767
5829
|
};
|
|
5768
|
-
var
|
|
5830
|
+
var _a12;
|
|
5831
|
+
var _ZodNull2 = (_a12 = class extends ZodType2 {
|
|
5769
5832
|
_parse(input) {
|
|
5770
5833
|
const parsedType = this._getType(input);
|
|
5771
5834
|
if (parsedType !== ZodParsedType2.null) {
|
|
@@ -5779,15 +5842,17 @@ var ZodNull2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5779
5842
|
}
|
|
5780
5843
|
return OK2(input.data);
|
|
5781
5844
|
}
|
|
5782
|
-
}, "
|
|
5783
|
-
__name2(
|
|
5845
|
+
}, __name(_a12, "_ZodNull"), _a12);
|
|
5846
|
+
__name2(_ZodNull2, "ZodNull");
|
|
5847
|
+
var ZodNull2 = _ZodNull2;
|
|
5784
5848
|
ZodNull2.create = (params) => {
|
|
5785
5849
|
return new ZodNull2({
|
|
5786
5850
|
typeName: ZodFirstPartyTypeKind2.ZodNull,
|
|
5787
5851
|
...processCreateParams2(params)
|
|
5788
5852
|
});
|
|
5789
5853
|
};
|
|
5790
|
-
var
|
|
5854
|
+
var _a13;
|
|
5855
|
+
var _ZodAny2 = (_a13 = class extends ZodType2 {
|
|
5791
5856
|
constructor() {
|
|
5792
5857
|
super(...arguments);
|
|
5793
5858
|
this._any = true;
|
|
@@ -5795,15 +5860,17 @@ var ZodAny2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5795
5860
|
_parse(input) {
|
|
5796
5861
|
return OK2(input.data);
|
|
5797
5862
|
}
|
|
5798
|
-
}, "
|
|
5799
|
-
__name2(
|
|
5863
|
+
}, __name(_a13, "_ZodAny"), _a13);
|
|
5864
|
+
__name2(_ZodAny2, "ZodAny");
|
|
5865
|
+
var ZodAny2 = _ZodAny2;
|
|
5800
5866
|
ZodAny2.create = (params) => {
|
|
5801
5867
|
return new ZodAny2({
|
|
5802
5868
|
typeName: ZodFirstPartyTypeKind2.ZodAny,
|
|
5803
5869
|
...processCreateParams2(params)
|
|
5804
5870
|
});
|
|
5805
5871
|
};
|
|
5806
|
-
var
|
|
5872
|
+
var _a14;
|
|
5873
|
+
var _ZodUnknown2 = (_a14 = class extends ZodType2 {
|
|
5807
5874
|
constructor() {
|
|
5808
5875
|
super(...arguments);
|
|
5809
5876
|
this._unknown = true;
|
|
@@ -5811,15 +5878,17 @@ var ZodUnknown2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5811
5878
|
_parse(input) {
|
|
5812
5879
|
return OK2(input.data);
|
|
5813
5880
|
}
|
|
5814
|
-
}, "
|
|
5815
|
-
__name2(
|
|
5881
|
+
}, __name(_a14, "_ZodUnknown"), _a14);
|
|
5882
|
+
__name2(_ZodUnknown2, "ZodUnknown");
|
|
5883
|
+
var ZodUnknown2 = _ZodUnknown2;
|
|
5816
5884
|
ZodUnknown2.create = (params) => {
|
|
5817
5885
|
return new ZodUnknown2({
|
|
5818
5886
|
typeName: ZodFirstPartyTypeKind2.ZodUnknown,
|
|
5819
5887
|
...processCreateParams2(params)
|
|
5820
5888
|
});
|
|
5821
5889
|
};
|
|
5822
|
-
var
|
|
5890
|
+
var _a15;
|
|
5891
|
+
var _ZodNever2 = (_a15 = class extends ZodType2 {
|
|
5823
5892
|
_parse(input) {
|
|
5824
5893
|
const ctx = this._getOrReturnCtx(input);
|
|
5825
5894
|
addIssueToContext2(ctx, {
|
|
@@ -5829,15 +5898,17 @@ var ZodNever2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5829
5898
|
});
|
|
5830
5899
|
return INVALID2;
|
|
5831
5900
|
}
|
|
5832
|
-
}, "
|
|
5833
|
-
__name2(
|
|
5901
|
+
}, __name(_a15, "_ZodNever"), _a15);
|
|
5902
|
+
__name2(_ZodNever2, "ZodNever");
|
|
5903
|
+
var ZodNever2 = _ZodNever2;
|
|
5834
5904
|
ZodNever2.create = (params) => {
|
|
5835
5905
|
return new ZodNever2({
|
|
5836
5906
|
typeName: ZodFirstPartyTypeKind2.ZodNever,
|
|
5837
5907
|
...processCreateParams2(params)
|
|
5838
5908
|
});
|
|
5839
5909
|
};
|
|
5840
|
-
var
|
|
5910
|
+
var _a16;
|
|
5911
|
+
var _ZodVoid2 = (_a16 = class extends ZodType2 {
|
|
5841
5912
|
_parse(input) {
|
|
5842
5913
|
const parsedType = this._getType(input);
|
|
5843
5914
|
if (parsedType !== ZodParsedType2.undefined) {
|
|
@@ -5851,15 +5922,17 @@ var ZodVoid2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5851
5922
|
}
|
|
5852
5923
|
return OK2(input.data);
|
|
5853
5924
|
}
|
|
5854
|
-
}, "
|
|
5855
|
-
__name2(
|
|
5925
|
+
}, __name(_a16, "_ZodVoid"), _a16);
|
|
5926
|
+
__name2(_ZodVoid2, "ZodVoid");
|
|
5927
|
+
var ZodVoid2 = _ZodVoid2;
|
|
5856
5928
|
ZodVoid2.create = (params) => {
|
|
5857
5929
|
return new ZodVoid2({
|
|
5858
5930
|
typeName: ZodFirstPartyTypeKind2.ZodVoid,
|
|
5859
5931
|
...processCreateParams2(params)
|
|
5860
5932
|
});
|
|
5861
5933
|
};
|
|
5862
|
-
var
|
|
5934
|
+
var _a17;
|
|
5935
|
+
var _ZodArray2 = (_a17 = class extends ZodType2 {
|
|
5863
5936
|
_parse(input) {
|
|
5864
5937
|
const { ctx, status } = this._processInputParams(input);
|
|
5865
5938
|
const def = this._def;
|
|
@@ -5933,7 +6006,7 @@ var ZodArray2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5933
6006
|
return this._def.type;
|
|
5934
6007
|
}
|
|
5935
6008
|
min(minLength, message) {
|
|
5936
|
-
return new
|
|
6009
|
+
return new _a17({
|
|
5937
6010
|
...this._def,
|
|
5938
6011
|
minLength: {
|
|
5939
6012
|
value: minLength,
|
|
@@ -5942,7 +6015,7 @@ var ZodArray2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5942
6015
|
});
|
|
5943
6016
|
}
|
|
5944
6017
|
max(maxLength, message) {
|
|
5945
|
-
return new
|
|
6018
|
+
return new _a17({
|
|
5946
6019
|
...this._def,
|
|
5947
6020
|
maxLength: {
|
|
5948
6021
|
value: maxLength,
|
|
@@ -5951,7 +6024,7 @@ var ZodArray2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5951
6024
|
});
|
|
5952
6025
|
}
|
|
5953
6026
|
length(len, message) {
|
|
5954
|
-
return new
|
|
6027
|
+
return new _a17({
|
|
5955
6028
|
...this._def,
|
|
5956
6029
|
exactLength: {
|
|
5957
6030
|
value: len,
|
|
@@ -5962,8 +6035,9 @@ var ZodArray2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
5962
6035
|
nonempty(message) {
|
|
5963
6036
|
return this.min(1, message);
|
|
5964
6037
|
}
|
|
5965
|
-
}, "
|
|
5966
|
-
__name2(
|
|
6038
|
+
}, __name(_a17, "_ZodArray"), _a17);
|
|
6039
|
+
__name2(_ZodArray2, "ZodArray");
|
|
6040
|
+
var ZodArray2 = _ZodArray2;
|
|
5967
6041
|
ZodArray2.create = (schema, params) => {
|
|
5968
6042
|
return new ZodArray2({
|
|
5969
6043
|
type: schema,
|
|
@@ -6002,7 +6076,8 @@ function deepPartialify2(schema) {
|
|
|
6002
6076
|
}
|
|
6003
6077
|
__name(deepPartialify2, "deepPartialify");
|
|
6004
6078
|
__name2(deepPartialify2, "deepPartialify");
|
|
6005
|
-
var
|
|
6079
|
+
var _a18;
|
|
6080
|
+
var _ZodObject2 = (_a18 = class extends ZodType2 {
|
|
6006
6081
|
constructor() {
|
|
6007
6082
|
super(...arguments);
|
|
6008
6083
|
this._cached = null;
|
|
@@ -6119,13 +6194,13 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6119
6194
|
}
|
|
6120
6195
|
strict(message) {
|
|
6121
6196
|
errorUtil2.errToObj;
|
|
6122
|
-
return new
|
|
6197
|
+
return new _a18({
|
|
6123
6198
|
...this._def,
|
|
6124
6199
|
unknownKeys: "strict",
|
|
6125
6200
|
...message !== void 0 ? {
|
|
6126
6201
|
errorMap: (issue, ctx) => {
|
|
6127
|
-
var
|
|
6128
|
-
const defaultError = (_c = (_b = (
|
|
6202
|
+
var _a41, _b, _c, _d;
|
|
6203
|
+
const defaultError = (_c = (_b = (_a41 = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a41, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
|
|
6129
6204
|
if (issue.code === "unrecognized_keys")
|
|
6130
6205
|
return {
|
|
6131
6206
|
message: (_d = errorUtil2.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
|
|
@@ -6138,13 +6213,13 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6138
6213
|
});
|
|
6139
6214
|
}
|
|
6140
6215
|
strip() {
|
|
6141
|
-
return new
|
|
6216
|
+
return new _a18({
|
|
6142
6217
|
...this._def,
|
|
6143
6218
|
unknownKeys: "strip"
|
|
6144
6219
|
});
|
|
6145
6220
|
}
|
|
6146
6221
|
passthrough() {
|
|
6147
|
-
return new
|
|
6222
|
+
return new _a18({
|
|
6148
6223
|
...this._def,
|
|
6149
6224
|
unknownKeys: "passthrough"
|
|
6150
6225
|
});
|
|
@@ -6167,7 +6242,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6167
6242
|
// }) as any;
|
|
6168
6243
|
// };
|
|
6169
6244
|
extend(augmentation) {
|
|
6170
|
-
return new
|
|
6245
|
+
return new _a18({
|
|
6171
6246
|
...this._def,
|
|
6172
6247
|
shape: () => ({
|
|
6173
6248
|
...this._def.shape(),
|
|
@@ -6181,7 +6256,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6181
6256
|
* upgrade if you are experiencing issues.
|
|
6182
6257
|
*/
|
|
6183
6258
|
merge(merging) {
|
|
6184
|
-
const merged = new
|
|
6259
|
+
const merged = new _a18({
|
|
6185
6260
|
unknownKeys: merging._def.unknownKeys,
|
|
6186
6261
|
catchall: merging._def.catchall,
|
|
6187
6262
|
shape: () => ({
|
|
@@ -6254,7 +6329,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6254
6329
|
// return merged;
|
|
6255
6330
|
// }
|
|
6256
6331
|
catchall(index18) {
|
|
6257
|
-
return new
|
|
6332
|
+
return new _a18({
|
|
6258
6333
|
...this._def,
|
|
6259
6334
|
catchall: index18
|
|
6260
6335
|
});
|
|
@@ -6266,7 +6341,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6266
6341
|
shape[key] = this.shape[key];
|
|
6267
6342
|
}
|
|
6268
6343
|
});
|
|
6269
|
-
return new
|
|
6344
|
+
return new _a18({
|
|
6270
6345
|
...this._def,
|
|
6271
6346
|
shape: () => shape
|
|
6272
6347
|
});
|
|
@@ -6278,7 +6353,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6278
6353
|
shape[key] = this.shape[key];
|
|
6279
6354
|
}
|
|
6280
6355
|
});
|
|
6281
|
-
return new
|
|
6356
|
+
return new _a18({
|
|
6282
6357
|
...this._def,
|
|
6283
6358
|
shape: () => shape
|
|
6284
6359
|
});
|
|
@@ -6299,7 +6374,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6299
6374
|
newShape[key] = fieldSchema.optional();
|
|
6300
6375
|
}
|
|
6301
6376
|
});
|
|
6302
|
-
return new
|
|
6377
|
+
return new _a18({
|
|
6303
6378
|
...this._def,
|
|
6304
6379
|
shape: () => newShape
|
|
6305
6380
|
});
|
|
@@ -6318,7 +6393,7 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6318
6393
|
newShape[key] = newField;
|
|
6319
6394
|
}
|
|
6320
6395
|
});
|
|
6321
|
-
return new
|
|
6396
|
+
return new _a18({
|
|
6322
6397
|
...this._def,
|
|
6323
6398
|
shape: () => newShape
|
|
6324
6399
|
});
|
|
@@ -6326,8 +6401,9 @@ var ZodObject2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6326
6401
|
keyof() {
|
|
6327
6402
|
return createZodEnum2(util2.objectKeys(this.shape));
|
|
6328
6403
|
}
|
|
6329
|
-
}, "
|
|
6330
|
-
__name2(
|
|
6404
|
+
}, __name(_a18, "_ZodObject"), _a18);
|
|
6405
|
+
__name2(_ZodObject2, "ZodObject");
|
|
6406
|
+
var ZodObject2 = _ZodObject2;
|
|
6331
6407
|
ZodObject2.create = (shape, params) => {
|
|
6332
6408
|
return new ZodObject2({
|
|
6333
6409
|
shape: () => shape,
|
|
@@ -6355,7 +6431,8 @@ ZodObject2.lazycreate = (shape, params) => {
|
|
|
6355
6431
|
...processCreateParams2(params)
|
|
6356
6432
|
});
|
|
6357
6433
|
};
|
|
6358
|
-
var
|
|
6434
|
+
var _a19;
|
|
6435
|
+
var _ZodUnion2 = (_a19 = class extends ZodType2 {
|
|
6359
6436
|
_parse(input) {
|
|
6360
6437
|
const { ctx } = this._processInputParams(input);
|
|
6361
6438
|
const options = this._def.options;
|
|
@@ -6443,8 +6520,9 @@ var ZodUnion2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6443
6520
|
get options() {
|
|
6444
6521
|
return this._def.options;
|
|
6445
6522
|
}
|
|
6446
|
-
}, "
|
|
6447
|
-
__name2(
|
|
6523
|
+
}, __name(_a19, "_ZodUnion"), _a19);
|
|
6524
|
+
__name2(_ZodUnion2, "ZodUnion");
|
|
6525
|
+
var ZodUnion2 = _ZodUnion2;
|
|
6448
6526
|
ZodUnion2.create = (types, params) => {
|
|
6449
6527
|
return new ZodUnion2({
|
|
6450
6528
|
options: types,
|
|
@@ -6479,7 +6557,8 @@ var getDiscriminator2 = /* @__PURE__ */ __name2((type) => {
|
|
|
6479
6557
|
return null;
|
|
6480
6558
|
}
|
|
6481
6559
|
}, "getDiscriminator");
|
|
6482
|
-
var
|
|
6560
|
+
var _a20;
|
|
6561
|
+
var _ZodDiscriminatedUnion2 = (_a20 = class extends ZodType2 {
|
|
6483
6562
|
_parse(input) {
|
|
6484
6563
|
const { ctx } = this._processInputParams(input);
|
|
6485
6564
|
if (ctx.parsedType !== ZodParsedType2.object) {
|
|
@@ -6548,7 +6627,7 @@ var ZodDiscriminatedUnion2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6548
6627
|
optionsMap.set(value, type);
|
|
6549
6628
|
}
|
|
6550
6629
|
}
|
|
6551
|
-
return new
|
|
6630
|
+
return new _a20({
|
|
6552
6631
|
typeName: ZodFirstPartyTypeKind2.ZodDiscriminatedUnion,
|
|
6553
6632
|
discriminator,
|
|
6554
6633
|
options,
|
|
@@ -6556,8 +6635,9 @@ var ZodDiscriminatedUnion2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6556
6635
|
...processCreateParams2(params)
|
|
6557
6636
|
});
|
|
6558
6637
|
}
|
|
6559
|
-
}, "
|
|
6560
|
-
__name2(
|
|
6638
|
+
}, __name(_a20, "_ZodDiscriminatedUnion"), _a20);
|
|
6639
|
+
__name2(_ZodDiscriminatedUnion2, "ZodDiscriminatedUnion");
|
|
6640
|
+
var ZodDiscriminatedUnion2 = _ZodDiscriminatedUnion2;
|
|
6561
6641
|
function mergeValues2(a, b) {
|
|
6562
6642
|
const aType = getParsedType2(a);
|
|
6563
6643
|
const bType = getParsedType2(b);
|
|
@@ -6621,7 +6701,8 @@ function mergeValues2(a, b) {
|
|
|
6621
6701
|
}
|
|
6622
6702
|
__name(mergeValues2, "mergeValues");
|
|
6623
6703
|
__name2(mergeValues2, "mergeValues");
|
|
6624
|
-
var
|
|
6704
|
+
var _a21;
|
|
6705
|
+
var _ZodIntersection2 = (_a21 = class extends ZodType2 {
|
|
6625
6706
|
_parse(input) {
|
|
6626
6707
|
const { status, ctx } = this._processInputParams(input);
|
|
6627
6708
|
const handleParsed = /* @__PURE__ */ __name2((parsedLeft, parsedRight) => {
|
|
@@ -6668,8 +6749,9 @@ var ZodIntersection2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6668
6749
|
}));
|
|
6669
6750
|
}
|
|
6670
6751
|
}
|
|
6671
|
-
}, "
|
|
6672
|
-
__name2(
|
|
6752
|
+
}, __name(_a21, "_ZodIntersection"), _a21);
|
|
6753
|
+
__name2(_ZodIntersection2, "ZodIntersection");
|
|
6754
|
+
var ZodIntersection2 = _ZodIntersection2;
|
|
6673
6755
|
ZodIntersection2.create = (left, right, params) => {
|
|
6674
6756
|
return new ZodIntersection2({
|
|
6675
6757
|
left,
|
|
@@ -6678,7 +6760,8 @@ ZodIntersection2.create = (left, right, params) => {
|
|
|
6678
6760
|
...processCreateParams2(params)
|
|
6679
6761
|
});
|
|
6680
6762
|
};
|
|
6681
|
-
var
|
|
6763
|
+
var _a22;
|
|
6764
|
+
var _ZodTuple2 = (_a22 = class extends ZodType2 {
|
|
6682
6765
|
_parse(input) {
|
|
6683
6766
|
const { status, ctx } = this._processInputParams(input);
|
|
6684
6767
|
if (ctx.parsedType !== ZodParsedType2.array) {
|
|
@@ -6730,13 +6813,14 @@ var ZodTuple2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6730
6813
|
return this._def.items;
|
|
6731
6814
|
}
|
|
6732
6815
|
rest(rest) {
|
|
6733
|
-
return new
|
|
6816
|
+
return new _a22({
|
|
6734
6817
|
...this._def,
|
|
6735
6818
|
rest
|
|
6736
6819
|
});
|
|
6737
6820
|
}
|
|
6738
|
-
}, "
|
|
6739
|
-
__name2(
|
|
6821
|
+
}, __name(_a22, "_ZodTuple"), _a22);
|
|
6822
|
+
__name2(_ZodTuple2, "ZodTuple");
|
|
6823
|
+
var ZodTuple2 = _ZodTuple2;
|
|
6740
6824
|
ZodTuple2.create = (schemas, params) => {
|
|
6741
6825
|
if (!Array.isArray(schemas)) {
|
|
6742
6826
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
@@ -6748,7 +6832,8 @@ ZodTuple2.create = (schemas, params) => {
|
|
|
6748
6832
|
...processCreateParams2(params)
|
|
6749
6833
|
});
|
|
6750
6834
|
};
|
|
6751
|
-
var
|
|
6835
|
+
var _a23;
|
|
6836
|
+
var _ZodRecord2 = (_a23 = class extends ZodType2 {
|
|
6752
6837
|
get keySchema() {
|
|
6753
6838
|
return this._def.keyType;
|
|
6754
6839
|
}
|
|
@@ -6785,23 +6870,25 @@ var ZodRecord2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6785
6870
|
}
|
|
6786
6871
|
static create(first, second, third) {
|
|
6787
6872
|
if (second instanceof ZodType2) {
|
|
6788
|
-
return new
|
|
6873
|
+
return new _a23({
|
|
6789
6874
|
keyType: first,
|
|
6790
6875
|
valueType: second,
|
|
6791
6876
|
typeName: ZodFirstPartyTypeKind2.ZodRecord,
|
|
6792
6877
|
...processCreateParams2(third)
|
|
6793
6878
|
});
|
|
6794
6879
|
}
|
|
6795
|
-
return new
|
|
6880
|
+
return new _a23({
|
|
6796
6881
|
keyType: ZodString2.create(),
|
|
6797
6882
|
valueType: first,
|
|
6798
6883
|
typeName: ZodFirstPartyTypeKind2.ZodRecord,
|
|
6799
6884
|
...processCreateParams2(second)
|
|
6800
6885
|
});
|
|
6801
6886
|
}
|
|
6802
|
-
}, "
|
|
6803
|
-
__name2(
|
|
6804
|
-
var
|
|
6887
|
+
}, __name(_a23, "_ZodRecord"), _a23);
|
|
6888
|
+
__name2(_ZodRecord2, "ZodRecord");
|
|
6889
|
+
var ZodRecord2 = _ZodRecord2;
|
|
6890
|
+
var _a24;
|
|
6891
|
+
var _ZodMap2 = (_a24 = class extends ZodType2 {
|
|
6805
6892
|
get keySchema() {
|
|
6806
6893
|
return this._def.keyType;
|
|
6807
6894
|
}
|
|
@@ -6872,8 +6959,9 @@ var ZodMap2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6872
6959
|
};
|
|
6873
6960
|
}
|
|
6874
6961
|
}
|
|
6875
|
-
}, "
|
|
6876
|
-
__name2(
|
|
6962
|
+
}, __name(_a24, "_ZodMap"), _a24);
|
|
6963
|
+
__name2(_ZodMap2, "ZodMap");
|
|
6964
|
+
var ZodMap2 = _ZodMap2;
|
|
6877
6965
|
ZodMap2.create = (keyType, valueType, params) => {
|
|
6878
6966
|
return new ZodMap2({
|
|
6879
6967
|
valueType,
|
|
@@ -6882,7 +6970,8 @@ ZodMap2.create = (keyType, valueType, params) => {
|
|
|
6882
6970
|
...processCreateParams2(params)
|
|
6883
6971
|
});
|
|
6884
6972
|
};
|
|
6885
|
-
var
|
|
6973
|
+
var _a25;
|
|
6974
|
+
var _ZodSet2 = (_a25 = class extends ZodType2 {
|
|
6886
6975
|
_parse(input) {
|
|
6887
6976
|
const { status, ctx } = this._processInputParams(input);
|
|
6888
6977
|
if (ctx.parsedType !== ZodParsedType2.set) {
|
|
@@ -6947,7 +7036,7 @@ var ZodSet2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6947
7036
|
}
|
|
6948
7037
|
}
|
|
6949
7038
|
min(minSize, message) {
|
|
6950
|
-
return new
|
|
7039
|
+
return new _a25({
|
|
6951
7040
|
...this._def,
|
|
6952
7041
|
minSize: {
|
|
6953
7042
|
value: minSize,
|
|
@@ -6956,7 +7045,7 @@ var ZodSet2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6956
7045
|
});
|
|
6957
7046
|
}
|
|
6958
7047
|
max(maxSize, message) {
|
|
6959
|
-
return new
|
|
7048
|
+
return new _a25({
|
|
6960
7049
|
...this._def,
|
|
6961
7050
|
maxSize: {
|
|
6962
7051
|
value: maxSize,
|
|
@@ -6970,8 +7059,9 @@ var ZodSet2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
6970
7059
|
nonempty(message) {
|
|
6971
7060
|
return this.min(1, message);
|
|
6972
7061
|
}
|
|
6973
|
-
}, "
|
|
6974
|
-
__name2(
|
|
7062
|
+
}, __name(_a25, "_ZodSet"), _a25);
|
|
7063
|
+
__name2(_ZodSet2, "ZodSet");
|
|
7064
|
+
var ZodSet2 = _ZodSet2;
|
|
6975
7065
|
ZodSet2.create = (valueType, params) => {
|
|
6976
7066
|
return new ZodSet2({
|
|
6977
7067
|
valueType,
|
|
@@ -6981,7 +7071,8 @@ ZodSet2.create = (valueType, params) => {
|
|
|
6981
7071
|
...processCreateParams2(params)
|
|
6982
7072
|
});
|
|
6983
7073
|
};
|
|
6984
|
-
var
|
|
7074
|
+
var _a26;
|
|
7075
|
+
var _ZodFunction2 = (_a26 = class extends ZodType2 {
|
|
6985
7076
|
constructor() {
|
|
6986
7077
|
super(...arguments);
|
|
6987
7078
|
this.validate = this.implement;
|
|
@@ -7078,13 +7169,13 @@ var ZodFunction2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7078
7169
|
return this._def.returns;
|
|
7079
7170
|
}
|
|
7080
7171
|
args(...items) {
|
|
7081
|
-
return new
|
|
7172
|
+
return new _a26({
|
|
7082
7173
|
...this._def,
|
|
7083
7174
|
args: ZodTuple2.create(items).rest(ZodUnknown2.create())
|
|
7084
7175
|
});
|
|
7085
7176
|
}
|
|
7086
7177
|
returns(returnType) {
|
|
7087
|
-
return new
|
|
7178
|
+
return new _a26({
|
|
7088
7179
|
...this._def,
|
|
7089
7180
|
returns: returnType
|
|
7090
7181
|
});
|
|
@@ -7098,16 +7189,18 @@ var ZodFunction2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7098
7189
|
return validatedFunc;
|
|
7099
7190
|
}
|
|
7100
7191
|
static create(args, returns, params) {
|
|
7101
|
-
return new
|
|
7192
|
+
return new _a26({
|
|
7102
7193
|
args: args ? args : ZodTuple2.create([]).rest(ZodUnknown2.create()),
|
|
7103
7194
|
returns: returns || ZodUnknown2.create(),
|
|
7104
7195
|
typeName: ZodFirstPartyTypeKind2.ZodFunction,
|
|
7105
7196
|
...processCreateParams2(params)
|
|
7106
7197
|
});
|
|
7107
7198
|
}
|
|
7108
|
-
}, "
|
|
7109
|
-
__name2(
|
|
7110
|
-
var
|
|
7199
|
+
}, __name(_a26, "_ZodFunction"), _a26);
|
|
7200
|
+
__name2(_ZodFunction2, "ZodFunction");
|
|
7201
|
+
var ZodFunction2 = _ZodFunction2;
|
|
7202
|
+
var _a27;
|
|
7203
|
+
var _ZodLazy2 = (_a27 = class extends ZodType2 {
|
|
7111
7204
|
get schema() {
|
|
7112
7205
|
return this._def.getter();
|
|
7113
7206
|
}
|
|
@@ -7120,8 +7213,9 @@ var ZodLazy2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7120
7213
|
parent: ctx
|
|
7121
7214
|
});
|
|
7122
7215
|
}
|
|
7123
|
-
}, "
|
|
7124
|
-
__name2(
|
|
7216
|
+
}, __name(_a27, "_ZodLazy"), _a27);
|
|
7217
|
+
__name2(_ZodLazy2, "ZodLazy");
|
|
7218
|
+
var ZodLazy2 = _ZodLazy2;
|
|
7125
7219
|
ZodLazy2.create = (getter, params) => {
|
|
7126
7220
|
return new ZodLazy2({
|
|
7127
7221
|
getter,
|
|
@@ -7129,7 +7223,8 @@ ZodLazy2.create = (getter, params) => {
|
|
|
7129
7223
|
...processCreateParams2(params)
|
|
7130
7224
|
});
|
|
7131
7225
|
};
|
|
7132
|
-
var
|
|
7226
|
+
var _a28;
|
|
7227
|
+
var _ZodLiteral2 = (_a28 = class extends ZodType2 {
|
|
7133
7228
|
_parse(input) {
|
|
7134
7229
|
if (input.data !== this._def.value) {
|
|
7135
7230
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -7148,8 +7243,9 @@ var ZodLiteral2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7148
7243
|
get value() {
|
|
7149
7244
|
return this._def.value;
|
|
7150
7245
|
}
|
|
7151
|
-
}, "
|
|
7152
|
-
__name2(
|
|
7246
|
+
}, __name(_a28, "_ZodLiteral"), _a28);
|
|
7247
|
+
__name2(_ZodLiteral2, "ZodLiteral");
|
|
7248
|
+
var ZodLiteral2 = _ZodLiteral2;
|
|
7153
7249
|
ZodLiteral2.create = (value, params) => {
|
|
7154
7250
|
return new ZodLiteral2({
|
|
7155
7251
|
value,
|
|
@@ -7166,7 +7262,8 @@ function createZodEnum2(values, params) {
|
|
|
7166
7262
|
}
|
|
7167
7263
|
__name(createZodEnum2, "createZodEnum");
|
|
7168
7264
|
__name2(createZodEnum2, "createZodEnum");
|
|
7169
|
-
var
|
|
7265
|
+
var _a29;
|
|
7266
|
+
var _ZodEnum2 = (_a29 = class extends ZodType2 {
|
|
7170
7267
|
_parse(input) {
|
|
7171
7268
|
if (typeof input.data !== "string") {
|
|
7172
7269
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -7215,15 +7312,17 @@ var ZodEnum2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7215
7312
|
return enumValues;
|
|
7216
7313
|
}
|
|
7217
7314
|
extract(values) {
|
|
7218
|
-
return
|
|
7315
|
+
return _a29.create(values);
|
|
7219
7316
|
}
|
|
7220
7317
|
exclude(values) {
|
|
7221
|
-
return
|
|
7318
|
+
return _a29.create(this.options.filter((opt) => !values.includes(opt)));
|
|
7222
7319
|
}
|
|
7223
|
-
}, "
|
|
7224
|
-
__name2(
|
|
7320
|
+
}, __name(_a29, "_ZodEnum"), _a29);
|
|
7321
|
+
__name2(_ZodEnum2, "ZodEnum");
|
|
7322
|
+
var ZodEnum2 = _ZodEnum2;
|
|
7225
7323
|
ZodEnum2.create = createZodEnum2;
|
|
7226
|
-
var
|
|
7324
|
+
var _a30;
|
|
7325
|
+
var _ZodNativeEnum2 = (_a30 = class extends ZodType2 {
|
|
7227
7326
|
_parse(input) {
|
|
7228
7327
|
const nativeEnumValues = util2.getValidEnumValues(this._def.values);
|
|
7229
7328
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -7250,8 +7349,9 @@ var ZodNativeEnum2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7250
7349
|
get enum() {
|
|
7251
7350
|
return this._def.values;
|
|
7252
7351
|
}
|
|
7253
|
-
}, "
|
|
7254
|
-
__name2(
|
|
7352
|
+
}, __name(_a30, "_ZodNativeEnum"), _a30);
|
|
7353
|
+
__name2(_ZodNativeEnum2, "ZodNativeEnum");
|
|
7354
|
+
var ZodNativeEnum2 = _ZodNativeEnum2;
|
|
7255
7355
|
ZodNativeEnum2.create = (values, params) => {
|
|
7256
7356
|
return new ZodNativeEnum2({
|
|
7257
7357
|
values,
|
|
@@ -7259,7 +7359,8 @@ ZodNativeEnum2.create = (values, params) => {
|
|
|
7259
7359
|
...processCreateParams2(params)
|
|
7260
7360
|
});
|
|
7261
7361
|
};
|
|
7262
|
-
var
|
|
7362
|
+
var _a31;
|
|
7363
|
+
var _ZodPromise2 = (_a31 = class extends ZodType2 {
|
|
7263
7364
|
unwrap() {
|
|
7264
7365
|
return this._def.type;
|
|
7265
7366
|
}
|
|
@@ -7281,8 +7382,9 @@ var ZodPromise2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7281
7382
|
});
|
|
7282
7383
|
}));
|
|
7283
7384
|
}
|
|
7284
|
-
}, "
|
|
7285
|
-
__name2(
|
|
7385
|
+
}, __name(_a31, "_ZodPromise"), _a31);
|
|
7386
|
+
__name2(_ZodPromise2, "ZodPromise");
|
|
7387
|
+
var ZodPromise2 = _ZodPromise2;
|
|
7286
7388
|
ZodPromise2.create = (schema, params) => {
|
|
7287
7389
|
return new ZodPromise2({
|
|
7288
7390
|
type: schema,
|
|
@@ -7290,7 +7392,8 @@ ZodPromise2.create = (schema, params) => {
|
|
|
7290
7392
|
...processCreateParams2(params)
|
|
7291
7393
|
});
|
|
7292
7394
|
};
|
|
7293
|
-
var
|
|
7395
|
+
var _a32;
|
|
7396
|
+
var _ZodEffects2 = (_a32 = class extends ZodType2 {
|
|
7294
7397
|
innerType() {
|
|
7295
7398
|
return this._def.schema;
|
|
7296
7399
|
}
|
|
@@ -7417,8 +7520,9 @@ var ZodEffects2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7417
7520
|
}
|
|
7418
7521
|
util2.assertNever(effect);
|
|
7419
7522
|
}
|
|
7420
|
-
}, "
|
|
7421
|
-
__name2(
|
|
7523
|
+
}, __name(_a32, "_ZodEffects"), _a32);
|
|
7524
|
+
__name2(_ZodEffects2, "ZodEffects");
|
|
7525
|
+
var ZodEffects2 = _ZodEffects2;
|
|
7422
7526
|
ZodEffects2.create = (schema, effect, params) => {
|
|
7423
7527
|
return new ZodEffects2({
|
|
7424
7528
|
schema,
|
|
@@ -7438,7 +7542,8 @@ ZodEffects2.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
7438
7542
|
...processCreateParams2(params)
|
|
7439
7543
|
});
|
|
7440
7544
|
};
|
|
7441
|
-
var
|
|
7545
|
+
var _a33;
|
|
7546
|
+
var _ZodOptional2 = (_a33 = class extends ZodType2 {
|
|
7442
7547
|
_parse(input) {
|
|
7443
7548
|
const parsedType = this._getType(input);
|
|
7444
7549
|
if (parsedType === ZodParsedType2.undefined) {
|
|
@@ -7449,8 +7554,9 @@ var ZodOptional2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7449
7554
|
unwrap() {
|
|
7450
7555
|
return this._def.innerType;
|
|
7451
7556
|
}
|
|
7452
|
-
}, "
|
|
7453
|
-
__name2(
|
|
7557
|
+
}, __name(_a33, "_ZodOptional"), _a33);
|
|
7558
|
+
__name2(_ZodOptional2, "ZodOptional");
|
|
7559
|
+
var ZodOptional2 = _ZodOptional2;
|
|
7454
7560
|
ZodOptional2.create = (type, params) => {
|
|
7455
7561
|
return new ZodOptional2({
|
|
7456
7562
|
innerType: type,
|
|
@@ -7458,7 +7564,8 @@ ZodOptional2.create = (type, params) => {
|
|
|
7458
7564
|
...processCreateParams2(params)
|
|
7459
7565
|
});
|
|
7460
7566
|
};
|
|
7461
|
-
var
|
|
7567
|
+
var _a34;
|
|
7568
|
+
var _ZodNullable2 = (_a34 = class extends ZodType2 {
|
|
7462
7569
|
_parse(input) {
|
|
7463
7570
|
const parsedType = this._getType(input);
|
|
7464
7571
|
if (parsedType === ZodParsedType2.null) {
|
|
@@ -7469,8 +7576,9 @@ var ZodNullable2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7469
7576
|
unwrap() {
|
|
7470
7577
|
return this._def.innerType;
|
|
7471
7578
|
}
|
|
7472
|
-
}, "
|
|
7473
|
-
__name2(
|
|
7579
|
+
}, __name(_a34, "_ZodNullable"), _a34);
|
|
7580
|
+
__name2(_ZodNullable2, "ZodNullable");
|
|
7581
|
+
var ZodNullable2 = _ZodNullable2;
|
|
7474
7582
|
ZodNullable2.create = (type, params) => {
|
|
7475
7583
|
return new ZodNullable2({
|
|
7476
7584
|
innerType: type,
|
|
@@ -7478,7 +7586,8 @@ ZodNullable2.create = (type, params) => {
|
|
|
7478
7586
|
...processCreateParams2(params)
|
|
7479
7587
|
});
|
|
7480
7588
|
};
|
|
7481
|
-
var
|
|
7589
|
+
var _a35;
|
|
7590
|
+
var _ZodDefault2 = (_a35 = class extends ZodType2 {
|
|
7482
7591
|
_parse(input) {
|
|
7483
7592
|
const { ctx } = this._processInputParams(input);
|
|
7484
7593
|
let data = ctx.data;
|
|
@@ -7494,8 +7603,9 @@ var ZodDefault2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7494
7603
|
removeDefault() {
|
|
7495
7604
|
return this._def.innerType;
|
|
7496
7605
|
}
|
|
7497
|
-
}, "
|
|
7498
|
-
__name2(
|
|
7606
|
+
}, __name(_a35, "_ZodDefault"), _a35);
|
|
7607
|
+
__name2(_ZodDefault2, "ZodDefault");
|
|
7608
|
+
var ZodDefault2 = _ZodDefault2;
|
|
7499
7609
|
ZodDefault2.create = (type, params) => {
|
|
7500
7610
|
return new ZodDefault2({
|
|
7501
7611
|
innerType: type,
|
|
@@ -7504,7 +7614,8 @@ ZodDefault2.create = (type, params) => {
|
|
|
7504
7614
|
...processCreateParams2(params)
|
|
7505
7615
|
});
|
|
7506
7616
|
};
|
|
7507
|
-
var
|
|
7617
|
+
var _a36;
|
|
7618
|
+
var _ZodCatch2 = (_a36 = class extends ZodType2 {
|
|
7508
7619
|
_parse(input) {
|
|
7509
7620
|
const { ctx } = this._processInputParams(input);
|
|
7510
7621
|
const newCtx = {
|
|
@@ -7548,8 +7659,9 @@ var ZodCatch2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7548
7659
|
removeCatch() {
|
|
7549
7660
|
return this._def.innerType;
|
|
7550
7661
|
}
|
|
7551
|
-
}, "
|
|
7552
|
-
__name2(
|
|
7662
|
+
}, __name(_a36, "_ZodCatch"), _a36);
|
|
7663
|
+
__name2(_ZodCatch2, "ZodCatch");
|
|
7664
|
+
var ZodCatch2 = _ZodCatch2;
|
|
7553
7665
|
ZodCatch2.create = (type, params) => {
|
|
7554
7666
|
return new ZodCatch2({
|
|
7555
7667
|
innerType: type,
|
|
@@ -7558,7 +7670,8 @@ ZodCatch2.create = (type, params) => {
|
|
|
7558
7670
|
...processCreateParams2(params)
|
|
7559
7671
|
});
|
|
7560
7672
|
};
|
|
7561
|
-
var
|
|
7673
|
+
var _a37;
|
|
7674
|
+
var _ZodNaN2 = (_a37 = class extends ZodType2 {
|
|
7562
7675
|
_parse(input) {
|
|
7563
7676
|
const parsedType = this._getType(input);
|
|
7564
7677
|
if (parsedType !== ZodParsedType2.nan) {
|
|
@@ -7575,8 +7688,9 @@ var ZodNaN2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7575
7688
|
value: input.data
|
|
7576
7689
|
};
|
|
7577
7690
|
}
|
|
7578
|
-
}, "
|
|
7579
|
-
__name2(
|
|
7691
|
+
}, __name(_a37, "_ZodNaN"), _a37);
|
|
7692
|
+
__name2(_ZodNaN2, "ZodNaN");
|
|
7693
|
+
var ZodNaN2 = _ZodNaN2;
|
|
7580
7694
|
ZodNaN2.create = (params) => {
|
|
7581
7695
|
return new ZodNaN2({
|
|
7582
7696
|
typeName: ZodFirstPartyTypeKind2.ZodNaN,
|
|
@@ -7584,7 +7698,8 @@ ZodNaN2.create = (params) => {
|
|
|
7584
7698
|
});
|
|
7585
7699
|
};
|
|
7586
7700
|
var BRAND2 = Symbol("zod_brand");
|
|
7587
|
-
var
|
|
7701
|
+
var _a38;
|
|
7702
|
+
var _ZodBranded2 = (_a38 = class extends ZodType2 {
|
|
7588
7703
|
_parse(input) {
|
|
7589
7704
|
const { ctx } = this._processInputParams(input);
|
|
7590
7705
|
const data = ctx.data;
|
|
@@ -7597,9 +7712,11 @@ var ZodBranded2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7597
7712
|
unwrap() {
|
|
7598
7713
|
return this._def.type;
|
|
7599
7714
|
}
|
|
7600
|
-
}, "
|
|
7601
|
-
__name2(
|
|
7602
|
-
var
|
|
7715
|
+
}, __name(_a38, "_ZodBranded"), _a38);
|
|
7716
|
+
__name2(_ZodBranded2, "ZodBranded");
|
|
7717
|
+
var ZodBranded2 = _ZodBranded2;
|
|
7718
|
+
var _a39;
|
|
7719
|
+
var _ZodPipeline2 = (_a39 = class extends ZodType2 {
|
|
7603
7720
|
_parse(input) {
|
|
7604
7721
|
const { status, ctx } = this._processInputParams(input);
|
|
7605
7722
|
if (ctx.common.async) {
|
|
@@ -7647,15 +7764,17 @@ var ZodPipeline2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7647
7764
|
}
|
|
7648
7765
|
}
|
|
7649
7766
|
static create(a, b) {
|
|
7650
|
-
return new
|
|
7767
|
+
return new _a39({
|
|
7651
7768
|
in: a,
|
|
7652
7769
|
out: b,
|
|
7653
7770
|
typeName: ZodFirstPartyTypeKind2.ZodPipeline
|
|
7654
7771
|
});
|
|
7655
7772
|
}
|
|
7656
|
-
}, "
|
|
7657
|
-
__name2(
|
|
7658
|
-
var
|
|
7773
|
+
}, __name(_a39, "_ZodPipeline"), _a39);
|
|
7774
|
+
__name2(_ZodPipeline2, "ZodPipeline");
|
|
7775
|
+
var ZodPipeline2 = _ZodPipeline2;
|
|
7776
|
+
var _a40;
|
|
7777
|
+
var _ZodReadonly2 = (_a40 = class extends ZodType2 {
|
|
7659
7778
|
_parse(input) {
|
|
7660
7779
|
const result = this._def.innerType._parse(input);
|
|
7661
7780
|
if (isValid2(result)) {
|
|
@@ -7663,8 +7782,9 @@ var ZodReadonly2 = /* @__PURE__ */ __name(class extends ZodType2 {
|
|
|
7663
7782
|
}
|
|
7664
7783
|
return result;
|
|
7665
7784
|
}
|
|
7666
|
-
}, "
|
|
7667
|
-
__name2(
|
|
7785
|
+
}, __name(_a40, "_ZodReadonly"), _a40);
|
|
7786
|
+
__name2(_ZodReadonly2, "ZodReadonly");
|
|
7787
|
+
var ZodReadonly2 = _ZodReadonly2;
|
|
7668
7788
|
ZodReadonly2.create = (type, params) => {
|
|
7669
7789
|
return new ZodReadonly2({
|
|
7670
7790
|
innerType: type,
|
|
@@ -7675,12 +7795,12 @@ ZodReadonly2.create = (type, params) => {
|
|
|
7675
7795
|
var custom2 = /* @__PURE__ */ __name2((check, params = {}, fatal) => {
|
|
7676
7796
|
if (check)
|
|
7677
7797
|
return ZodAny2.create().superRefine((data, ctx) => {
|
|
7678
|
-
var
|
|
7798
|
+
var _a41, _b;
|
|
7679
7799
|
if (!check(data)) {
|
|
7680
7800
|
const p = typeof params === "function" ? params(data) : typeof params === "string" ? {
|
|
7681
7801
|
message: params
|
|
7682
7802
|
} : params;
|
|
7683
|
-
const _fatal = (_b = (
|
|
7803
|
+
const _fatal = (_b = (_a41 = p.fatal) !== null && _a41 !== void 0 ? _a41 : fatal) !== null && _b !== void 0 ? _b : true;
|
|
7684
7804
|
const p2 = typeof p === "string" ? {
|
|
7685
7805
|
message: p
|
|
7686
7806
|
} : p;
|
|
@@ -7914,7 +8034,7 @@ var z2 = /* @__PURE__ */ Object.freeze({
|
|
|
7914
8034
|
ZodError: ZodError2
|
|
7915
8035
|
});
|
|
7916
8036
|
|
|
7917
|
-
// ../core/dist/chunk-
|
|
8037
|
+
// ../core/dist/chunk-OMI2MGEL.js
|
|
7918
8038
|
var purchaseUserTransferSchema = z2.object({
|
|
7919
8039
|
id: z2.string().max(191),
|
|
7920
8040
|
transferState: z2.enum([
|
|
@@ -7928,7 +8048,7 @@ var purchaseUserTransferSchema = z2.object({
|
|
|
7928
8048
|
]).default("AVAILABLE"),
|
|
7929
8049
|
purchaseId: z2.string().max(191),
|
|
7930
8050
|
sourceUserId: z2.string().max(191),
|
|
7931
|
-
targetUserId: z2.string().max(191).optional(),
|
|
8051
|
+
targetUserId: z2.string().max(191).optional().nullable(),
|
|
7932
8052
|
createdAt: z2.date().nullable(),
|
|
7933
8053
|
expiresAt: z2.date().nullable(),
|
|
7934
8054
|
canceledAt: z2.date().nullable(),
|
|
@@ -7936,20 +8056,20 @@ var purchaseUserTransferSchema = z2.object({
|
|
|
7936
8056
|
completedAt: z2.date().nullable()
|
|
7937
8057
|
});
|
|
7938
8058
|
|
|
7939
|
-
// ../core/dist/chunk-
|
|
8059
|
+
// ../core/dist/chunk-UKYAUN7W.js
|
|
7940
8060
|
var resourceProgressSchema = z2.object({
|
|
7941
8061
|
userId: z2.string().max(191),
|
|
7942
8062
|
contentResourceId: z2.string().max(191).optional().nullable(),
|
|
7943
|
-
|
|
8063
|
+
fields: z2.record(z2.any()).default({}),
|
|
7944
8064
|
completedAt: z2.date().nullable(),
|
|
7945
8065
|
updatedAt: z2.date().nullable(),
|
|
7946
8066
|
createdAt: z2.date().nullable()
|
|
7947
8067
|
});
|
|
7948
8068
|
|
|
7949
|
-
// ../core/dist/chunk-
|
|
8069
|
+
// ../core/dist/chunk-3K3P6UHD.js
|
|
7950
8070
|
var upgradableProductSchema = z2.object({
|
|
7951
|
-
upgradableToId: z2.string().
|
|
7952
|
-
upgradableFromId: z2.string().
|
|
8071
|
+
upgradableToId: z2.string().max(255),
|
|
8072
|
+
upgradableFromId: z2.string().max(255),
|
|
7953
8073
|
position: z2.number().default(0),
|
|
7954
8074
|
metadata: z2.record(z2.any()).default({}),
|
|
7955
8075
|
createdAt: z2.date().nullable(),
|
|
@@ -7957,7 +8077,7 @@ var upgradableProductSchema = z2.object({
|
|
|
7957
8077
|
deletedAt: z2.date().nullable()
|
|
7958
8078
|
});
|
|
7959
8079
|
|
|
7960
|
-
// ../core/dist/chunk-
|
|
8080
|
+
// ../core/dist/chunk-QWXG37EL.js
|
|
7961
8081
|
var VideoResourceSchema = z2.object({
|
|
7962
8082
|
id: z2.string(),
|
|
7963
8083
|
updatedAt: z2.string().optional(),
|
|
@@ -7979,42 +8099,18 @@ var VideoResourceSchema = z2.object({
|
|
|
7979
8099
|
])
|
|
7980
8100
|
});
|
|
7981
8101
|
|
|
7982
|
-
// ../core/dist/chunk-
|
|
7983
|
-
var
|
|
7984
|
-
id: z2.string().length(191),
|
|
7985
|
-
status: z2.number().int().default(0),
|
|
7986
|
-
identifier: z2.string().length(191),
|
|
7987
|
-
userId: z2.string().length(191),
|
|
7988
|
-
merchantAccountId: z2.string().length(191),
|
|
7989
|
-
merchantProductId: z2.string().length(191),
|
|
7990
|
-
createdAt: z2.date().nullable(),
|
|
7991
|
-
merchantCustomerId: z2.string().length(191)
|
|
7992
|
-
});
|
|
7993
|
-
|
|
7994
|
-
// ../core/dist/chunk-NTKCZFHE.js
|
|
7995
|
-
var merchantCouponSchema = z2.object({
|
|
7996
|
-
id: z2.string().max(191),
|
|
7997
|
-
identifier: z2.string().max(191).optional().nullable(),
|
|
7998
|
-
status: z2.number().int().default(0),
|
|
7999
|
-
merchantAccountId: z2.string().max(191),
|
|
8000
|
-
percentageDiscount: z2.coerce.number().refine((value) => {
|
|
8001
|
-
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
8002
|
-
return decimalPlaces <= 2;
|
|
8003
|
-
}),
|
|
8004
|
-
type: z2.string().max(191).optional().nullable()
|
|
8005
|
-
});
|
|
8006
|
-
|
|
8007
|
-
// ../core/dist/chunk-BRSSFQ7G.js
|
|
8008
|
-
var merchantCustomerSchema = z2.object({
|
|
8102
|
+
// ../core/dist/chunk-QWVS7RLZ.js
|
|
8103
|
+
var merchantPriceSchema = z2.object({
|
|
8009
8104
|
id: z2.string().max(191),
|
|
8010
|
-
userId: z2.string().max(191),
|
|
8011
8105
|
merchantAccountId: z2.string().max(191),
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8106
|
+
merchantProductId: z2.string().max(191),
|
|
8107
|
+
status: z2.number().int().default(0),
|
|
8108
|
+
identifier: z2.string().max(191).optional().nullable(),
|
|
8109
|
+
createdAt: z2.date(),
|
|
8110
|
+
priceId: z2.string().max(191).optional().nullable()
|
|
8015
8111
|
});
|
|
8016
8112
|
|
|
8017
|
-
// ../core/dist/chunk-
|
|
8113
|
+
// ../core/dist/chunk-5FAFQVN5.js
|
|
8018
8114
|
var merchantProductSchema = z2.object({
|
|
8019
8115
|
id: z2.string().max(191),
|
|
8020
8116
|
merchantAccountId: z2.string().max(191),
|
|
@@ -8024,21 +8120,21 @@ var merchantProductSchema = z2.object({
|
|
|
8024
8120
|
createdAt: z2.date().nullable()
|
|
8025
8121
|
});
|
|
8026
8122
|
|
|
8027
|
-
// ../core/dist/chunk-
|
|
8123
|
+
// ../core/dist/chunk-E2O65L6F.js
|
|
8028
8124
|
var userSchema = z2.object({
|
|
8029
|
-
id: z2.string().
|
|
8030
|
-
name: z2.string().
|
|
8125
|
+
id: z2.string().max(255),
|
|
8126
|
+
name: z2.string().max(255).optional().nullable(),
|
|
8031
8127
|
role: z2.enum([
|
|
8032
8128
|
"user",
|
|
8033
8129
|
"admin"
|
|
8034
8130
|
]).default("user"),
|
|
8035
|
-
email: z2.string().
|
|
8131
|
+
email: z2.string().max(255).email(),
|
|
8036
8132
|
emailVerified: z2.date().nullable(),
|
|
8037
|
-
image: z2.string().
|
|
8133
|
+
image: z2.string().max(255).optional().nullable(),
|
|
8038
8134
|
createdAt: z2.date().nullable()
|
|
8039
8135
|
});
|
|
8040
8136
|
|
|
8041
|
-
// ../core/dist/chunk-
|
|
8137
|
+
// ../core/dist/chunk-BEN776QX.js
|
|
8042
8138
|
var priceSchema = z2.object({
|
|
8043
8139
|
id: z2.string().max(191),
|
|
8044
8140
|
productId: z2.string().max(191).optional().nullable(),
|
|
@@ -8049,28 +8145,99 @@ var priceSchema = z2.object({
|
|
|
8049
8145
|
return decimalPlaces <= 2;
|
|
8050
8146
|
}),
|
|
8051
8147
|
createdAt: z2.date().nullable(),
|
|
8052
|
-
|
|
8148
|
+
fields: z2.record(z2.any()).default({})
|
|
8053
8149
|
});
|
|
8054
8150
|
|
|
8055
|
-
// ../core/dist/chunk-
|
|
8151
|
+
// ../core/dist/chunk-DBONTSXM.js
|
|
8152
|
+
var ContentResourceResourceSchema = z2.object({
|
|
8153
|
+
resourceId: z2.string(),
|
|
8154
|
+
resourceOfId: z2.string(),
|
|
8155
|
+
position: z2.number().default(0),
|
|
8156
|
+
metadata: z2.record(z2.string(), z2.any()).default({}).nullable(),
|
|
8157
|
+
createdAt: z2.date().nullable(),
|
|
8158
|
+
updatedAt: z2.date().nullable(),
|
|
8159
|
+
deletedAt: z2.date().nullable(),
|
|
8160
|
+
resource: z2.any()
|
|
8161
|
+
});
|
|
8162
|
+
var ContentResourceSchema = z2.object({
|
|
8163
|
+
id: z2.string(),
|
|
8164
|
+
type: z2.string(),
|
|
8165
|
+
createdById: z2.string(),
|
|
8166
|
+
fields: z2.record(z2.string(), z2.any()).default({}).nullable().optional(),
|
|
8167
|
+
createdAt: z2.date().nullable(),
|
|
8168
|
+
updatedAt: z2.date().nullable(),
|
|
8169
|
+
deletedAt: z2.date().nullable(),
|
|
8170
|
+
resources: z2.array(ContentResourceResourceSchema).default([]).nullable()
|
|
8171
|
+
});
|
|
8172
|
+
var ContentResourceProductSchema = z2.object({
|
|
8173
|
+
resourceId: z2.string(),
|
|
8174
|
+
productId: z2.string(),
|
|
8175
|
+
position: z2.number().default(0),
|
|
8176
|
+
metadata: z2.record(z2.string(), z2.any()).default({}).nullable(),
|
|
8177
|
+
createdAt: z2.date().nullable(),
|
|
8178
|
+
updatedAt: z2.date().nullable(),
|
|
8179
|
+
deletedAt: z2.date().nullable(),
|
|
8180
|
+
resource: z2.any(),
|
|
8181
|
+
product: z2.any()
|
|
8182
|
+
});
|
|
8183
|
+
var ResourceStateSchema = z2.union([
|
|
8184
|
+
z2.literal("draft"),
|
|
8185
|
+
z2.literal("published"),
|
|
8186
|
+
z2.literal("archived"),
|
|
8187
|
+
z2.literal("deleted")
|
|
8188
|
+
]);
|
|
8189
|
+
var ResourceVisibilitySchema = z2.union([
|
|
8190
|
+
z2.literal("public"),
|
|
8191
|
+
z2.literal("private"),
|
|
8192
|
+
z2.literal("unlisted")
|
|
8193
|
+
]);
|
|
8194
|
+
|
|
8195
|
+
// ../core/dist/chunk-EHEPZVSG.js
|
|
8056
8196
|
var productSchema = z2.object({
|
|
8057
8197
|
id: z2.string().max(191),
|
|
8058
8198
|
name: z2.string().max(191),
|
|
8059
8199
|
key: z2.string().max(191).optional().nullable(),
|
|
8060
|
-
|
|
8200
|
+
type: z2.enum([
|
|
8201
|
+
"live",
|
|
8202
|
+
"self-paced"
|
|
8203
|
+
]).default("self-paced"),
|
|
8204
|
+
fields: z2.object({
|
|
8205
|
+
body: z2.string().nullable().optional(),
|
|
8206
|
+
description: z2.string().optional().nullable(),
|
|
8207
|
+
slug: z2.string(),
|
|
8208
|
+
image: z2.object({
|
|
8209
|
+
url: z2.string().url(),
|
|
8210
|
+
alt: z2.string().optional().nullable(),
|
|
8211
|
+
width: z2.number(),
|
|
8212
|
+
height: z2.number()
|
|
8213
|
+
}).optional().nullable(),
|
|
8214
|
+
action: z2.string().optional().nullable().default("Buy Now"),
|
|
8215
|
+
state: z2.enum([
|
|
8216
|
+
"draft",
|
|
8217
|
+
"published",
|
|
8218
|
+
"archived",
|
|
8219
|
+
"deleted"
|
|
8220
|
+
]).default("draft"),
|
|
8221
|
+
visibility: z2.enum([
|
|
8222
|
+
"public",
|
|
8223
|
+
"private",
|
|
8224
|
+
"unlisted"
|
|
8225
|
+
]).default("unlisted")
|
|
8226
|
+
}),
|
|
8061
8227
|
createdAt: z2.date().nullable(),
|
|
8062
8228
|
status: z2.number().int().default(0),
|
|
8063
8229
|
quantityAvailable: z2.number().int().default(-1),
|
|
8064
|
-
price: priceSchema.nullable().optional()
|
|
8230
|
+
price: priceSchema.nullable().optional(),
|
|
8231
|
+
resources: z2.array(ContentResourceProductSchema).default([]).nullable()
|
|
8065
8232
|
});
|
|
8066
8233
|
|
|
8067
|
-
// ../core/dist/chunk-
|
|
8234
|
+
// ../core/dist/chunk-VQL6W6PO.js
|
|
8068
8235
|
var couponSchema = z2.object({
|
|
8069
8236
|
id: z2.string(),
|
|
8070
8237
|
code: z2.string().max(191).optional().nullable(),
|
|
8071
8238
|
createdAt: z2.date().nullable(),
|
|
8072
8239
|
expires: z2.date().nullable(),
|
|
8073
|
-
|
|
8240
|
+
fields: z2.record(z2.any()).default({}),
|
|
8074
8241
|
maxUses: z2.number().int().default(-1),
|
|
8075
8242
|
default: z2.boolean().default(false),
|
|
8076
8243
|
merchantCouponId: z2.string().max(191).optional().nullable(),
|
|
@@ -8081,10 +8248,11 @@ var couponSchema = z2.object({
|
|
|
8081
8248
|
return decimalPlaces <= 2;
|
|
8082
8249
|
}),
|
|
8083
8250
|
restrictedToProductId: z2.string().max(191).optional().nullable(),
|
|
8084
|
-
bulkPurchaseId: z2.string().max(191).optional().nullable()
|
|
8251
|
+
bulkPurchaseId: z2.string().max(191).optional().nullable(),
|
|
8252
|
+
bulkCouponPurchases: z2.any().optional().nullable()
|
|
8085
8253
|
});
|
|
8086
8254
|
|
|
8087
|
-
// ../core/dist/chunk-
|
|
8255
|
+
// ../core/dist/chunk-L7DZR25Q.js
|
|
8088
8256
|
var purchaseSchema = z2.object({
|
|
8089
8257
|
id: z2.string().max(191),
|
|
8090
8258
|
userId: z2.string().max(191).optional().nullable(),
|
|
@@ -8105,44 +8273,83 @@ var purchaseSchema = z2.object({
|
|
|
8105
8273
|
bulkCouponId: z2.string().max(191).optional().nullable(),
|
|
8106
8274
|
merchantSessionId: z2.string().max(191).optional().nullable(),
|
|
8107
8275
|
redeemedBulkCouponId: z2.string().max(191).optional().nullable(),
|
|
8108
|
-
|
|
8276
|
+
fields: z2.record(z2.any()).default({}),
|
|
8109
8277
|
user: userSchema.optional().nullable(),
|
|
8110
8278
|
bulkCoupon: couponSchema.optional().nullable(),
|
|
8111
8279
|
product: productSchema.optional().nullable()
|
|
8112
8280
|
});
|
|
8113
8281
|
|
|
8114
|
-
// ../core/dist/
|
|
8115
|
-
var
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8282
|
+
// ../core/dist/chunk-5RZIDLCA.js
|
|
8283
|
+
var merchantChargeSchema = z2.object({
|
|
8284
|
+
id: z2.string().max(191),
|
|
8285
|
+
status: z2.number().int().default(0),
|
|
8286
|
+
identifier: z2.string().max(191),
|
|
8287
|
+
userId: z2.string().max(191),
|
|
8288
|
+
merchantAccountId: z2.string().max(191),
|
|
8289
|
+
merchantProductId: z2.string().max(191),
|
|
8120
8290
|
createdAt: z2.date().nullable(),
|
|
8121
|
-
|
|
8122
|
-
deletedAt: z2.date().nullable(),
|
|
8123
|
-
resource: z2.any()
|
|
8291
|
+
merchantCustomerId: z2.string().max(191)
|
|
8124
8292
|
});
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8293
|
+
|
|
8294
|
+
// ../core/dist/chunk-GSATJJT4.js
|
|
8295
|
+
var merchantCouponSchema = z2.object({
|
|
8296
|
+
id: z2.string().max(191),
|
|
8297
|
+
identifier: z2.string().max(191).optional().nullable(),
|
|
8298
|
+
status: z2.number().int().default(0),
|
|
8299
|
+
merchantAccountId: z2.string().max(191),
|
|
8300
|
+
percentageDiscount: z2.coerce.number().refine((value) => {
|
|
8301
|
+
const decimalPlaces = value.toString().split(".")[1]?.length || 0;
|
|
8302
|
+
return decimalPlaces <= 2;
|
|
8303
|
+
}),
|
|
8304
|
+
type: z2.string().max(191).optional().nullable()
|
|
8305
|
+
});
|
|
8306
|
+
|
|
8307
|
+
// ../core/dist/chunk-LQYMTPOB.js
|
|
8308
|
+
var merchantCustomerSchema = z2.object({
|
|
8309
|
+
id: z2.string().max(191),
|
|
8310
|
+
userId: z2.string().max(191),
|
|
8311
|
+
merchantAccountId: z2.string().max(191),
|
|
8312
|
+
identifier: z2.string().max(191),
|
|
8130
8313
|
createdAt: z2.date().nullable(),
|
|
8131
|
-
|
|
8132
|
-
deletedAt: z2.date().nullable(),
|
|
8133
|
-
resources: z2.array(ContentResourceResourceSchema).default([]).nullable()
|
|
8314
|
+
status: z2.number().int().default(0)
|
|
8134
8315
|
});
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
z2.
|
|
8139
|
-
z2.
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
z2.
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8316
|
+
|
|
8317
|
+
// ../core/dist/schemas/merchant-account-schema.js
|
|
8318
|
+
var merchantAccountSchema = z2.object({
|
|
8319
|
+
id: z2.string().max(191),
|
|
8320
|
+
label: z2.string().max(191),
|
|
8321
|
+
identifier: z2.string().max(191),
|
|
8322
|
+
createdAt: z2.date().nullable(),
|
|
8323
|
+
status: z2.number().int().default(0)
|
|
8324
|
+
});
|
|
8325
|
+
|
|
8326
|
+
// ../core/dist/lib/utils/validate-coupon.js
|
|
8327
|
+
var import_date_fns = require("date-fns");
|
|
8328
|
+
var validateCoupon = /* @__PURE__ */ __name2((coupon, productIds = []) => {
|
|
8329
|
+
if (!coupon) {
|
|
8330
|
+
return {
|
|
8331
|
+
isValid: false,
|
|
8332
|
+
isRedeemable: false,
|
|
8333
|
+
error: "coupon-not-found"
|
|
8334
|
+
};
|
|
8335
|
+
}
|
|
8336
|
+
const isUsedUp = coupon.maxUses > 0 ? coupon.usedCount >= coupon.maxUses : false;
|
|
8337
|
+
const isExpired = coupon.expires ? (0, import_date_fns.isBefore)(new Date(coupon.expires), /* @__PURE__ */ new Date()) : false;
|
|
8338
|
+
if (coupon.restrictedToProductId && !productIds.includes(coupon.restrictedToProductId)) {
|
|
8339
|
+
return {
|
|
8340
|
+
isValid: false,
|
|
8341
|
+
isRedeemable: false,
|
|
8342
|
+
error: "coupon-not-valid-for-product"
|
|
8343
|
+
};
|
|
8344
|
+
}
|
|
8345
|
+
const isValid3 = !isUsedUp && !isExpired;
|
|
8346
|
+
return {
|
|
8347
|
+
isExpired,
|
|
8348
|
+
isUsedUp,
|
|
8349
|
+
isRedeemable: isValid3 && coupon.percentageDiscount >= 1 && !coupon.default,
|
|
8350
|
+
isValid: isValid3
|
|
8351
|
+
};
|
|
8352
|
+
}, "validateCoupon");
|
|
8146
8353
|
|
|
8147
8354
|
// src/lib/mysql/schemas/auth/accounts.ts
|
|
8148
8355
|
var import_drizzle_orm19 = require("drizzle-orm");
|
|
@@ -8175,7 +8382,7 @@ function getCouponSchema(mysqlTable) {
|
|
|
8175
8382
|
mode: "date",
|
|
8176
8383
|
fsp: 3
|
|
8177
8384
|
}),
|
|
8178
|
-
|
|
8385
|
+
fields: (0, import_mysql_core.json)("fields").$type().default({}),
|
|
8179
8386
|
maxUses: (0, import_mysql_core.int)("maxUses").default(-1).notNull(),
|
|
8180
8387
|
default: (0, import_mysql_core.boolean)("default").default(false).notNull(),
|
|
8181
8388
|
merchantCouponId: (0, import_mysql_core.varchar)("merchantCouponId", {
|
|
@@ -8207,6 +8414,16 @@ function getCouponSchema(mysqlTable) {
|
|
|
8207
8414
|
});
|
|
8208
8415
|
}
|
|
8209
8416
|
__name(getCouponSchema, "getCouponSchema");
|
|
8417
|
+
function getCouponRelationsSchema(mysqlTable) {
|
|
8418
|
+
const purchase = getPurchaseSchema(mysqlTable);
|
|
8419
|
+
const coupon = getCouponSchema(mysqlTable);
|
|
8420
|
+
return (0, import_drizzle_orm.relations)(coupon, ({ many }) => ({
|
|
8421
|
+
bulkCouponPurchases: many(purchase, {
|
|
8422
|
+
relationName: "redeemedBulkCoupon"
|
|
8423
|
+
})
|
|
8424
|
+
}));
|
|
8425
|
+
}
|
|
8426
|
+
__name(getCouponRelationsSchema, "getCouponRelationsSchema");
|
|
8210
8427
|
|
|
8211
8428
|
// src/lib/mysql/schemas/commerce/merchant-charge.ts
|
|
8212
8429
|
var import_drizzle_orm2 = require("drizzle-orm");
|
|
@@ -8573,7 +8790,7 @@ function getPriceSchema(mysqlTable) {
|
|
|
8573
8790
|
mode: "date",
|
|
8574
8791
|
fsp: 3
|
|
8575
8792
|
}).default(import_drizzle_orm8.sql`CURRENT_TIMESTAMP(3)`).notNull(),
|
|
8576
|
-
|
|
8793
|
+
fields: (0, import_mysql_core9.json)("fields").$type().default({})
|
|
8577
8794
|
}, (table) => {
|
|
8578
8795
|
return {
|
|
8579
8796
|
priceId: (0, import_mysql_core9.primaryKey)({
|
|
@@ -8599,6 +8816,9 @@ function getProductSchema(mysqlTable) {
|
|
|
8599
8816
|
key: (0, import_mysql_core10.varchar)("key", {
|
|
8600
8817
|
length: 191
|
|
8601
8818
|
}),
|
|
8819
|
+
type: (0, import_mysql_core10.varchar)("type", {
|
|
8820
|
+
length: 191
|
|
8821
|
+
}),
|
|
8602
8822
|
fields: (0, import_mysql_core10.json)("fields").$type().default({}),
|
|
8603
8823
|
createdAt: (0, import_mysql_core10.timestamp)("createdAt", {
|
|
8604
8824
|
mode: "date",
|
|
@@ -8702,7 +8922,7 @@ function getPurchaseSchema(mysqlTable) {
|
|
|
8702
8922
|
redeemedBulkCouponId: (0, import_mysql_core11.varchar)("redeemedBulkCouponId", {
|
|
8703
8923
|
length: 191
|
|
8704
8924
|
}),
|
|
8705
|
-
|
|
8925
|
+
fields: (0, import_mysql_core11.json)("fields").$type().default({})
|
|
8706
8926
|
}, (table) => {
|
|
8707
8927
|
return {
|
|
8708
8928
|
purchaseId: (0, import_mysql_core11.primaryKey)({
|
|
@@ -8724,6 +8944,15 @@ function getPurchaseRelationsSchema(mysqlTable) {
|
|
|
8724
8944
|
const merchantSessions = getMerchantSessionSchema(mysqlTable);
|
|
8725
8945
|
const coupons = getCouponSchema(mysqlTable);
|
|
8726
8946
|
return (0, import_drizzle_orm10.relations)(purchases, ({ many, one }) => ({
|
|
8947
|
+
redeemedBulkCoupon: one(coupons, {
|
|
8948
|
+
fields: [
|
|
8949
|
+
purchases.redeemedBulkCouponId
|
|
8950
|
+
],
|
|
8951
|
+
references: [
|
|
8952
|
+
coupons.id
|
|
8953
|
+
],
|
|
8954
|
+
relationName: "redeemedBulkCoupon"
|
|
8955
|
+
}),
|
|
8727
8956
|
user: one(users, {
|
|
8728
8957
|
fields: [
|
|
8729
8958
|
purchases.userId
|
|
@@ -9733,7 +9962,7 @@ function getResourceProgressSchema(mysqlTable) {
|
|
|
9733
9962
|
contentResourceId: (0, import_mysql_core31.varchar)("contentResourceId", {
|
|
9734
9963
|
length: 191
|
|
9735
9964
|
}),
|
|
9736
|
-
|
|
9965
|
+
fields: (0, import_mysql_core31.json)("fields").$type().default({}),
|
|
9737
9966
|
completedAt: (0, import_mysql_core31.datetime)("completedAt", {
|
|
9738
9967
|
mode: "date",
|
|
9739
9968
|
fsp: 3
|
|
@@ -9783,6 +10012,7 @@ function getCourseBuilderSchema(mysqlTable) {
|
|
|
9783
10012
|
usersRelations: getUsersRelationsSchema(mysqlTable),
|
|
9784
10013
|
verificationTokens: getVerificationTokensSchema(mysqlTable),
|
|
9785
10014
|
coupon: getCouponSchema(mysqlTable),
|
|
10015
|
+
couponRelations: getCouponRelationsSchema(mysqlTable),
|
|
9786
10016
|
merchantAccount: getMerchantAccountSchema(mysqlTable),
|
|
9787
10017
|
merchantCharge: getMerchantChargeSchema(mysqlTable),
|
|
9788
10018
|
merchantCoupon: getMerchantCouponSchema(mysqlTable),
|
|
@@ -9821,9 +10051,126 @@ function createTables(mySqlTable) {
|
|
|
9821
10051
|
}
|
|
9822
10052
|
__name(createTables, "createTables");
|
|
9823
10053
|
function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
9824
|
-
const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts } = createTables(tableFn);
|
|
10054
|
+
const { users, accounts, sessions, verificationTokens, contentResource, contentResourceResource, purchases: purchaseTable, purchaseUserTransfer, coupon, merchantCoupon, merchantCharge, merchantAccount, merchantPrice, merchantCustomer, merchantSession, merchantProduct, prices, products, upgradableProducts, resourceProgress } = createTables(tableFn);
|
|
9825
10055
|
return {
|
|
9826
10056
|
client,
|
|
10057
|
+
async redeemFullPriceCoupon(options) {
|
|
10058
|
+
const { email: baseEmail, couponId, productIds, currentUserId, redeemingProductId } = options;
|
|
10059
|
+
const email = String(baseEmail).replace(" ", "+");
|
|
10060
|
+
const coupon2 = await this.getCouponWithBulkPurchases(couponId);
|
|
10061
|
+
const productId = coupon2 && coupon2.restrictedToProductId || redeemingProductId;
|
|
10062
|
+
if (!productId)
|
|
10063
|
+
throw new Error(`unable-to-find-any-product-id`);
|
|
10064
|
+
const couponValidation = validateCoupon(coupon2, productIds);
|
|
10065
|
+
if (coupon2 && couponValidation.isRedeemable) {
|
|
10066
|
+
const bulkCouponRedemption = Boolean(coupon2.bulkCouponPurchases[0]?.bulkCouponId);
|
|
10067
|
+
const { user } = await this.findOrCreateUser(email);
|
|
10068
|
+
if (!user)
|
|
10069
|
+
throw new Error(`unable-to-create-user-${email}`);
|
|
10070
|
+
const currentUser = currentUserId ? await this.getUserById(currentUserId) : null;
|
|
10071
|
+
const redeemingForCurrentUser = currentUser?.id === user.id;
|
|
10072
|
+
const existingPurchases = await this.getExistingNonBulkValidPurchasesOfProduct({
|
|
10073
|
+
userId: user.id,
|
|
10074
|
+
productId
|
|
10075
|
+
});
|
|
10076
|
+
if (existingPurchases.length > 0)
|
|
10077
|
+
throw new Error(`already-purchased-${email}`);
|
|
10078
|
+
const purchaseId = `purchase-${(0, import_uuid.v4)()}`;
|
|
10079
|
+
await this.createPurchase({
|
|
10080
|
+
id: purchaseId,
|
|
10081
|
+
userId: user.id,
|
|
10082
|
+
couponId: bulkCouponRedemption ? null : coupon2.id,
|
|
10083
|
+
redeemedBulkCouponId: bulkCouponRedemption ? coupon2.id : null,
|
|
10084
|
+
productId,
|
|
10085
|
+
totalAmount: "0",
|
|
10086
|
+
metadata: {
|
|
10087
|
+
couponUsedId: bulkCouponRedemption ? null : coupon2.id
|
|
10088
|
+
}
|
|
10089
|
+
});
|
|
10090
|
+
const newPurchase = await this.getPurchase(purchaseId);
|
|
10091
|
+
await this.incrementCouponUsedCount(coupon2.id);
|
|
10092
|
+
await this.createPurchaseTransfer({
|
|
10093
|
+
sourceUserId: user.id,
|
|
10094
|
+
purchaseId,
|
|
10095
|
+
expiresAt: new Date(Date.now() + 1e3 * 60 * 60 * 24 * 7)
|
|
10096
|
+
});
|
|
10097
|
+
return {
|
|
10098
|
+
purchase: newPurchase,
|
|
10099
|
+
redeemingForCurrentUser
|
|
10100
|
+
};
|
|
10101
|
+
}
|
|
10102
|
+
return null;
|
|
10103
|
+
},
|
|
10104
|
+
createPurchaseTransfer: async (options) => {
|
|
10105
|
+
const id = `put_${(0, import_uuid.v4)()}`;
|
|
10106
|
+
await client.insert(purchaseUserTransfer).values({
|
|
10107
|
+
id,
|
|
10108
|
+
purchaseId: options.purchaseId,
|
|
10109
|
+
sourceUserId: options.sourceUserId,
|
|
10110
|
+
expiresAt: options.expiresAt
|
|
10111
|
+
});
|
|
10112
|
+
},
|
|
10113
|
+
incrementCouponUsedCount: async (couponId) => {
|
|
10114
|
+
await client.update(coupon).set({
|
|
10115
|
+
usedCount: import_drizzle_orm27.sql`${coupon.usedCount} + 1`
|
|
10116
|
+
}).where((0, import_drizzle_orm27.eq)(coupon.id, couponId));
|
|
10117
|
+
},
|
|
10118
|
+
getExistingNonBulkValidPurchasesOfProduct: async ({ userId, productId }) => {
|
|
10119
|
+
const existingPurchases = await client.query.purchases.findMany({
|
|
10120
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(purchaseTable.userId, userId), productId ? (0, import_drizzle_orm27.eq)(purchaseTable.productId, productId) : void 0, (0, import_drizzle_orm27.eq)(purchaseTable.status, "Valid"), (0, import_drizzle_orm27.isNull)(purchaseTable.bulkCouponId))
|
|
10121
|
+
});
|
|
10122
|
+
return z.array(purchaseSchema).parse(existingPurchases);
|
|
10123
|
+
},
|
|
10124
|
+
createMerchantCustomer: async (options) => {
|
|
10125
|
+
await client.insert(merchantCustomer).values({
|
|
10126
|
+
id: `mc_${(0, import_uuid.v4)()}`,
|
|
10127
|
+
identifier: options.identifier,
|
|
10128
|
+
merchantAccountId: options.merchantAccountId,
|
|
10129
|
+
userId: options.userId,
|
|
10130
|
+
status: 1
|
|
10131
|
+
});
|
|
10132
|
+
return merchantCustomerSchema.parse(await client.query.merchantCustomer.findFirst({
|
|
10133
|
+
where: (0, import_drizzle_orm27.eq)(merchantCustomer.identifier, options.identifier)
|
|
10134
|
+
}));
|
|
10135
|
+
},
|
|
10136
|
+
getMerchantAccount: async (options) => {
|
|
10137
|
+
return merchantAccountSchema.parse(await client.query.merchantAccount.findFirst({
|
|
10138
|
+
where: (0, import_drizzle_orm27.eq)(merchantAccount.label, options.provider)
|
|
10139
|
+
}));
|
|
10140
|
+
},
|
|
10141
|
+
getMerchantPriceForProductId: async (productId) => {
|
|
10142
|
+
const merchantPriceData = await client.query.merchantPrice.findFirst({
|
|
10143
|
+
where: (0, import_drizzle_orm27.eq)(merchantPrice.merchantProductId, productId)
|
|
10144
|
+
});
|
|
10145
|
+
const parsedMerchantPrice = merchantPriceSchema.safeParse(merchantPriceData);
|
|
10146
|
+
if (!parsedMerchantPrice.success) {
|
|
10147
|
+
console.error("Error parsing merchant price", JSON.stringify(parsedMerchantPrice.error));
|
|
10148
|
+
return null;
|
|
10149
|
+
}
|
|
10150
|
+
return parsedMerchantPrice.data;
|
|
10151
|
+
},
|
|
10152
|
+
getMerchantProductForProductId: async (productId) => {
|
|
10153
|
+
const merchantProductData = await client.query.merchantProduct.findFirst({
|
|
10154
|
+
where: (0, import_drizzle_orm27.eq)(merchantProduct.productId, productId)
|
|
10155
|
+
});
|
|
10156
|
+
if (!merchantProductData)
|
|
10157
|
+
return null;
|
|
10158
|
+
return merchantProductSchema.parse(merchantProductData);
|
|
10159
|
+
},
|
|
10160
|
+
getMerchantCustomerForUserId: async (userId) => {
|
|
10161
|
+
const merchantCustomerData = await client.query.merchantCustomer.findFirst({
|
|
10162
|
+
where: (0, import_drizzle_orm27.eq)(merchantCustomer.userId, userId)
|
|
10163
|
+
});
|
|
10164
|
+
if (!merchantCustomerData)
|
|
10165
|
+
return null;
|
|
10166
|
+
return merchantCustomerSchema.parse(merchantCustomerData);
|
|
10167
|
+
},
|
|
10168
|
+
getUpgradableProducts: async (options) => {
|
|
10169
|
+
const { upgradableFromId, upgradableToId } = options;
|
|
10170
|
+
return z.array(upgradableProductSchema).parse(await client.query.upgradableProducts.findMany({
|
|
10171
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(upgradableProducts.upgradableFromId, upgradableFromId), (0, import_drizzle_orm27.eq)(upgradableProducts.upgradableToId, upgradableToId))
|
|
10172
|
+
}));
|
|
10173
|
+
},
|
|
9827
10174
|
availableUpgradesForProduct(purchases, productId) {
|
|
9828
10175
|
const previousPurchaseProductIds = purchases.map(({ productId: productId2 }) => productId2);
|
|
9829
10176
|
return client.query.upgradableProducts.findMany({
|
|
@@ -9833,8 +10180,38 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
9833
10180
|
clearLessonProgressForUser(options) {
|
|
9834
10181
|
throw new Error("Method not implemented.");
|
|
9835
10182
|
},
|
|
9836
|
-
completeLessonProgressForUser(options) {
|
|
9837
|
-
|
|
10183
|
+
async completeLessonProgressForUser(options) {
|
|
10184
|
+
if (!options.lessonId) {
|
|
10185
|
+
throw new Error("No lessonId provided");
|
|
10186
|
+
}
|
|
10187
|
+
let lessonProgress = await client.query.resourceProgress.findFirst({
|
|
10188
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(resourceProgress.userId, options.userId), (0, import_drizzle_orm27.eq)(resourceProgress.contentResourceId, options.lessonId))
|
|
10189
|
+
});
|
|
10190
|
+
const now = /* @__PURE__ */ new Date();
|
|
10191
|
+
if (lessonProgress) {
|
|
10192
|
+
if (!lessonProgress.completedAt) {
|
|
10193
|
+
await client.update(resourceProgress).set({
|
|
10194
|
+
completedAt: now,
|
|
10195
|
+
updatedAt: now
|
|
10196
|
+
}).where((0, import_drizzle_orm27.eq)(resourceProgress.contentResourceId, options.lessonId));
|
|
10197
|
+
}
|
|
10198
|
+
} else {
|
|
10199
|
+
await client.insert(resourceProgress).values({
|
|
10200
|
+
userId: options.userId,
|
|
10201
|
+
contentResourceId: options.lessonId,
|
|
10202
|
+
completedAt: now,
|
|
10203
|
+
updatedAt: now
|
|
10204
|
+
});
|
|
10205
|
+
}
|
|
10206
|
+
lessonProgress = await client.query.resourceProgress.findFirst({
|
|
10207
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(resourceProgress.userId, options.userId), (0, import_drizzle_orm27.eq)(resourceProgress.contentResourceId, options.lessonId))
|
|
10208
|
+
});
|
|
10209
|
+
const parsedLessonProgress = resourceProgressSchema.safeParse(lessonProgress);
|
|
10210
|
+
if (!parsedLessonProgress.success) {
|
|
10211
|
+
console.error("Error parsing lesson progress", lessonProgress);
|
|
10212
|
+
return null;
|
|
10213
|
+
}
|
|
10214
|
+
return parsedLessonProgress.data;
|
|
9838
10215
|
},
|
|
9839
10216
|
couponForIdOrCode(options) {
|
|
9840
10217
|
throw new Error("Method not implemented.");
|
|
@@ -9846,7 +10223,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
9846
10223
|
const existingMerchantCharge = merchantChargeSchema.nullable().parse(await client.query.merchantCharge.findFirst({
|
|
9847
10224
|
where: (0, import_drizzle_orm27.eq)(merchantCharge.identifier, stripeChargeId)
|
|
9848
10225
|
}) || null);
|
|
9849
|
-
const existingPurchaseForCharge = existingMerchantCharge ? await client.query.
|
|
10226
|
+
const existingPurchaseForCharge = existingMerchantCharge ? await client.query.purchases.findFirst({
|
|
9850
10227
|
where: (0, import_drizzle_orm27.eq)(purchaseTable.merchantChargeId, existingMerchantCharge.id),
|
|
9851
10228
|
with: {
|
|
9852
10229
|
user: true,
|
|
@@ -9855,11 +10232,11 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
9855
10232
|
}
|
|
9856
10233
|
}) : null;
|
|
9857
10234
|
if (existingPurchaseForCharge) {
|
|
9858
|
-
return
|
|
10235
|
+
return existingPurchaseForCharge.id;
|
|
9859
10236
|
}
|
|
9860
|
-
const merchantChargeId = (0, import_uuid.v4)()
|
|
9861
|
-
const purchaseId2 = (0, import_uuid.v4)()
|
|
9862
|
-
const newMerchantCharge =
|
|
10237
|
+
const merchantChargeId = `mc_${(0, import_uuid.v4)()}`;
|
|
10238
|
+
const purchaseId2 = `purch_${(0, import_uuid.v4)()}`;
|
|
10239
|
+
const newMerchantCharge = await client.insert(merchantCharge).values({
|
|
9863
10240
|
id: merchantChargeId,
|
|
9864
10241
|
userId,
|
|
9865
10242
|
identifier: stripeChargeId,
|
|
@@ -9873,21 +10250,29 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
9873
10250
|
"Restricted"
|
|
9874
10251
|
]))
|
|
9875
10252
|
}) || null);
|
|
9876
|
-
const existingBulkCoupon = couponSchema.nullable().parse(await client.select().from(coupon).leftJoin(purchaseTable, (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(coupon.id, purchaseTable.bulkCouponId), (0, import_drizzle_orm27.eq)(purchaseTable.userId, userId))).
|
|
10253
|
+
const existingBulkCoupon = couponSchema.nullable().parse(await client.select().from(coupon).leftJoin(purchaseTable, (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(coupon.id, purchaseTable.bulkCouponId), (0, import_drizzle_orm27.eq)(purchaseTable.userId, userId))).where((0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(coupon.restrictedToProductId, productId), (0, import_drizzle_orm27.eq)(purchaseTable.userId, userId))).then((res) => {
|
|
10254
|
+
console.log({
|
|
10255
|
+
res
|
|
10256
|
+
});
|
|
10257
|
+
return res[0]?.coupons ?? null;
|
|
10258
|
+
}));
|
|
10259
|
+
console.log({
|
|
10260
|
+
existingBulkCoupon
|
|
10261
|
+
});
|
|
9877
10262
|
const isBulkPurchase = quantity > 1 || Boolean(existingBulkCoupon) || options.bulk || Boolean(existingPurchase?.status === "Valid");
|
|
9878
10263
|
let bulkCouponId = null;
|
|
9879
10264
|
let couponToUpdate = null;
|
|
9880
10265
|
if (isBulkPurchase) {
|
|
9881
10266
|
bulkCouponId = existingBulkCoupon !== null ? existingBulkCoupon.id : (0, import_uuid.v4)();
|
|
9882
10267
|
if (existingBulkCoupon !== null) {
|
|
9883
|
-
couponToUpdate =
|
|
10268
|
+
couponToUpdate = await client.update(coupon).set({
|
|
9884
10269
|
maxUses: (existingBulkCoupon?.maxUses || 0) + quantity
|
|
9885
10270
|
}).where((0, import_drizzle_orm27.eq)(coupon.id, bulkCouponId));
|
|
9886
10271
|
} else {
|
|
9887
10272
|
const merchantCouponToUse = stripeCouponId ? merchantCouponSchema.nullable().parse(await client.query.merchantCoupon.findFirst({
|
|
9888
10273
|
where: (0, import_drizzle_orm27.eq)(merchantCoupon.identifier, stripeCouponId)
|
|
9889
10274
|
})) : null;
|
|
9890
|
-
couponToUpdate = await
|
|
10275
|
+
couponToUpdate = await client.insert(coupon).values({
|
|
9891
10276
|
id: bulkCouponId,
|
|
9892
10277
|
percentageDiscount: "1.0",
|
|
9893
10278
|
restrictedToProductId: productId,
|
|
@@ -9899,20 +10284,29 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
9899
10284
|
});
|
|
9900
10285
|
}
|
|
9901
10286
|
}
|
|
9902
|
-
const merchantSessionId = (0, import_uuid.v4)()
|
|
9903
|
-
const newMerchantSession =
|
|
10287
|
+
const merchantSessionId = `ms_${(0, import_uuid.v4)()}`;
|
|
10288
|
+
const newMerchantSession = await client.insert(merchantSession).values({
|
|
9904
10289
|
id: merchantSessionId,
|
|
9905
10290
|
identifier: checkoutSessionId,
|
|
9906
10291
|
merchantAccountId
|
|
9907
10292
|
});
|
|
10293
|
+
console.log({
|
|
10294
|
+
newMerchantSession
|
|
10295
|
+
});
|
|
9908
10296
|
const merchantCouponUsed = stripeCouponId ? await client.query.merchantCoupon.findFirst({
|
|
9909
10297
|
where: (0, import_drizzle_orm27.eq)(merchantCoupon.identifier, stripeCouponId)
|
|
9910
10298
|
}) : null;
|
|
10299
|
+
console.log({
|
|
10300
|
+
merchantCouponUsed
|
|
10301
|
+
});
|
|
9911
10302
|
const pppMerchantCoupon = appliedPPPStripeCouponId ? await client.query.merchantCoupon.findFirst({
|
|
9912
10303
|
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(merchantCoupon.identifier, appliedPPPStripeCouponId), (0, import_drizzle_orm27.eq)(merchantCoupon.type, "ppp"))
|
|
9913
10304
|
}) : null;
|
|
10305
|
+
console.log({
|
|
10306
|
+
pppMerchantCoupon
|
|
10307
|
+
});
|
|
9914
10308
|
const newPurchaseStatus = merchantCouponUsed?.type === "ppp" || pppMerchantCoupon ? "Restricted" : "Valid";
|
|
9915
|
-
const newPurchase =
|
|
10309
|
+
const newPurchase = await client.insert(purchaseTable).values({
|
|
9916
10310
|
id: purchaseId2,
|
|
9917
10311
|
status: newPurchaseStatus,
|
|
9918
10312
|
userId,
|
|
@@ -9925,22 +10319,22 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
9925
10319
|
upgradedFromId: upgradedFromPurchaseId || null,
|
|
9926
10320
|
couponId: usedCouponId || null
|
|
9927
10321
|
});
|
|
10322
|
+
console.log({
|
|
10323
|
+
newPurchase
|
|
10324
|
+
});
|
|
9928
10325
|
const oneWeekInMilliseconds = 1e3 * 60 * 60 * 24 * 7;
|
|
9929
|
-
const newPurchaseUserTransfer =
|
|
9930
|
-
id: (0, import_uuid.v4)()
|
|
10326
|
+
const newPurchaseUserTransfer = await client.insert(purchaseUserTransfer).values({
|
|
10327
|
+
id: `put_${(0, import_uuid.v4)()}`,
|
|
9931
10328
|
purchaseId: purchaseId2,
|
|
9932
10329
|
expiresAt: existingPurchase ? /* @__PURE__ */ new Date() : new Date(Date.now() + oneWeekInMilliseconds),
|
|
9933
10330
|
sourceUserId: userId
|
|
9934
10331
|
});
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
couponToUpdate
|
|
9942
|
-
] : []
|
|
9943
|
-
]);
|
|
10332
|
+
console.log({
|
|
10333
|
+
newPurchaseUserTransfer
|
|
10334
|
+
});
|
|
10335
|
+
console.log("inside", {
|
|
10336
|
+
purchaseId: purchaseId2
|
|
10337
|
+
});
|
|
9944
10338
|
return purchaseId2;
|
|
9945
10339
|
} catch (error) {
|
|
9946
10340
|
console.error(error);
|
|
@@ -9948,15 +10342,52 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
9948
10342
|
throw error;
|
|
9949
10343
|
}
|
|
9950
10344
|
});
|
|
9951
|
-
|
|
10345
|
+
console.log("putside", {
|
|
10346
|
+
purchaseId
|
|
10347
|
+
});
|
|
10348
|
+
const parsedPurchase = purchaseSchema.safeParse(await client.query.purchases.findFirst({
|
|
9952
10349
|
where: (0, import_drizzle_orm27.eq)(purchaseTable.id, purchaseId)
|
|
9953
10350
|
}));
|
|
10351
|
+
if (!parsedPurchase.success) {
|
|
10352
|
+
console.error("Error parsing purchase", parsedPurchase, JSON.stringify(parsedPurchase, null, 2));
|
|
10353
|
+
throw new Error("Error parsing purchase");
|
|
10354
|
+
}
|
|
10355
|
+
return parsedPurchase.data;
|
|
9954
10356
|
},
|
|
9955
|
-
findOrCreateMerchantCustomer(options) {
|
|
9956
|
-
|
|
10357
|
+
async findOrCreateMerchantCustomer(options) {
|
|
10358
|
+
const merchantCustomer2 = merchantCustomerSchema.nullable().optional().parse(await client.query.merchantCustomer.findFirst({
|
|
10359
|
+
where: (merchantCustomer3, { eq: eq2 }) => eq2(merchantCustomer3.identifier, options.identifier)
|
|
10360
|
+
}));
|
|
10361
|
+
if (merchantCustomer2) {
|
|
10362
|
+
return merchantCustomer2;
|
|
10363
|
+
}
|
|
10364
|
+
return await this.createMerchantCustomer({
|
|
10365
|
+
identifier: options.identifier,
|
|
10366
|
+
merchantAccountId: options.merchantAccountId,
|
|
10367
|
+
userId: options.user.id
|
|
10368
|
+
});
|
|
9957
10369
|
},
|
|
9958
|
-
findOrCreateUser(email, name) {
|
|
9959
|
-
|
|
10370
|
+
async findOrCreateUser(email, name) {
|
|
10371
|
+
const user = await this.getUserByEmail?.(email);
|
|
10372
|
+
if (!user) {
|
|
10373
|
+
const newUser = await this.createUser?.({
|
|
10374
|
+
id: `u_${(0, import_uuid.v4)()}`,
|
|
10375
|
+
email,
|
|
10376
|
+
name,
|
|
10377
|
+
emailVerified: null
|
|
10378
|
+
});
|
|
10379
|
+
if (!newUser) {
|
|
10380
|
+
throw new Error("Could not create user");
|
|
10381
|
+
}
|
|
10382
|
+
return {
|
|
10383
|
+
user: newUser,
|
|
10384
|
+
isNewUser: true
|
|
10385
|
+
};
|
|
10386
|
+
}
|
|
10387
|
+
return {
|
|
10388
|
+
user,
|
|
10389
|
+
isNewUser: false
|
|
10390
|
+
};
|
|
9960
10391
|
},
|
|
9961
10392
|
async getCoupon(couponIdOrCode) {
|
|
9962
10393
|
return couponSchema.nullable().parse(await client.select().from(coupon).where((0, import_drizzle_orm27.or)((0, import_drizzle_orm27.eq)(coupon.id, couponIdOrCode), (0, import_drizzle_orm27.eq)(coupon.code, couponIdOrCode))).then((res) => res[0] ?? null));
|
|
@@ -9976,8 +10407,17 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
9976
10407
|
getLessonProgresses() {
|
|
9977
10408
|
throw new Error("Method not implemented.");
|
|
9978
10409
|
},
|
|
9979
|
-
getMerchantCharge(merchantChargeId) {
|
|
9980
|
-
|
|
10410
|
+
async getMerchantCharge(merchantChargeId) {
|
|
10411
|
+
const mCharge = await client.query.merchantCharge.findFirst({
|
|
10412
|
+
where: (0, import_drizzle_orm27.eq)(merchantCharge.id, merchantChargeId)
|
|
10413
|
+
});
|
|
10414
|
+
console.log("mCharge", mCharge);
|
|
10415
|
+
const parsed = merchantChargeSchema.safeParse(mCharge);
|
|
10416
|
+
if (!parsed.success) {
|
|
10417
|
+
console.error("Error parsing merchantCharge", mCharge);
|
|
10418
|
+
return null;
|
|
10419
|
+
}
|
|
10420
|
+
return parsed.data;
|
|
9981
10421
|
},
|
|
9982
10422
|
async getMerchantCouponsForTypeAndPercent(params) {
|
|
9983
10423
|
return z.array(merchantCouponSchema).parse(await client.query.merchantCoupon.findMany({
|
|
@@ -10037,48 +10477,10 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
10037
10477
|
const newPurchase = await this.getPurchase(newPurchaseId);
|
|
10038
10478
|
return purchaseSchema.parse(newPurchase);
|
|
10039
10479
|
},
|
|
10040
|
-
async getPurchaseDetails(purchaseId, userId) {
|
|
10041
|
-
const allPurchases = await this.getPurchasesForUser(userId);
|
|
10042
|
-
const thePurchase = await client.query.purchases.findFirst({
|
|
10043
|
-
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(purchaseTable.id, purchaseId), (0, import_drizzle_orm27.eq)(purchaseTable.userId, userId)),
|
|
10044
|
-
with: {
|
|
10045
|
-
user: true,
|
|
10046
|
-
product: true,
|
|
10047
|
-
bulkCoupon: true
|
|
10048
|
-
}
|
|
10049
|
-
});
|
|
10050
|
-
const parsedPurchase = purchaseSchema.safeParse(thePurchase);
|
|
10051
|
-
if (!parsedPurchase.success) {
|
|
10052
|
-
console.error("Error parsing purchase", parsedPurchase);
|
|
10053
|
-
return {
|
|
10054
|
-
availableUpgrades: []
|
|
10055
|
-
};
|
|
10056
|
-
}
|
|
10057
|
-
const purchaseCanUpgrade = [
|
|
10058
|
-
"Valid",
|
|
10059
|
-
"Restricted"
|
|
10060
|
-
].includes(parsedPurchase.data.state || "");
|
|
10061
|
-
if (!purchaseCanUpgrade) {
|
|
10062
|
-
return {
|
|
10063
|
-
availableUpgrades: []
|
|
10064
|
-
};
|
|
10065
|
-
}
|
|
10066
|
-
const availableUpgrades = await client.query.upgradableProducts.findMany({
|
|
10067
|
-
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(upgradableProducts.upgradableFromId, parsedPurchase.data.product?.id), (0, import_drizzle_orm27.not)((0, import_drizzle_orm27.inArray)(upgradableProducts.upgradableToId, allPurchases.map((p) => p.product?.id)))),
|
|
10068
|
-
with: {
|
|
10069
|
-
upgradableTo: true,
|
|
10070
|
-
upgradableFrom: true
|
|
10071
|
-
}
|
|
10072
|
-
});
|
|
10073
|
-
const existingPurchase = allPurchases.find((p) => p.product?.id === parsedPurchase.data.product?.id);
|
|
10074
|
-
return Promise.resolve({
|
|
10075
|
-
availableUpgrades: z.array(upgradableProductSchema).parse(availableUpgrades),
|
|
10076
|
-
existingPurchase,
|
|
10077
|
-
purchase: parsedPurchase.data
|
|
10078
|
-
});
|
|
10079
|
-
},
|
|
10080
10480
|
async getPurchaseForStripeCharge(stripeChargeId) {
|
|
10081
|
-
const purchase = purchaseSchema.safeParse(await client.select().from(purchaseTable).leftJoin(merchantCharge, (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(merchantCharge.identifier, stripeChargeId), (0, import_drizzle_orm27.eq)(merchantCharge.id, purchaseTable.merchantChargeId))).then((res) =>
|
|
10481
|
+
const purchase = purchaseSchema.safeParse(await client.select().from(purchaseTable).leftJoin(merchantCharge, (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(merchantCharge.identifier, stripeChargeId), (0, import_drizzle_orm27.eq)(merchantCharge.id, purchaseTable.merchantChargeId))).then((res) => {
|
|
10482
|
+
return res[0]?.purchases ?? null;
|
|
10483
|
+
}));
|
|
10082
10484
|
if (!purchase.success) {
|
|
10083
10485
|
return null;
|
|
10084
10486
|
}
|
|
@@ -10110,11 +10512,70 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
10110
10512
|
});
|
|
10111
10513
|
const parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases);
|
|
10112
10514
|
if (!parsedPurchases.success) {
|
|
10113
|
-
console.error("Error parsing purchases", parsedPurchases);
|
|
10515
|
+
console.error("Error parsing purchases", JSON.stringify(parsedPurchases.error));
|
|
10114
10516
|
return [];
|
|
10115
10517
|
}
|
|
10116
10518
|
return parsedPurchases.data;
|
|
10117
10519
|
},
|
|
10520
|
+
async getPurchaseDetails(purchaseId, userId) {
|
|
10521
|
+
const visiblePurchaseStates = [
|
|
10522
|
+
"Valid",
|
|
10523
|
+
"Refunded",
|
|
10524
|
+
"Restricted"
|
|
10525
|
+
];
|
|
10526
|
+
const userPurchases = await client.query.purchases.findMany({
|
|
10527
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm27.inArray)(purchaseTable.status, visiblePurchaseStates)),
|
|
10528
|
+
with: {
|
|
10529
|
+
user: true,
|
|
10530
|
+
product: true,
|
|
10531
|
+
bulkCoupon: true
|
|
10532
|
+
},
|
|
10533
|
+
orderBy: (0, import_drizzle_orm27.asc)(purchaseTable.createdAt)
|
|
10534
|
+
});
|
|
10535
|
+
const parsedPurchases = z.array(purchaseSchema).safeParse(userPurchases);
|
|
10536
|
+
const allPurchases = parsedPurchases.success ? parsedPurchases.data : [];
|
|
10537
|
+
console.log("\u{1F9A6}", {
|
|
10538
|
+
allPurchases
|
|
10539
|
+
});
|
|
10540
|
+
const thePurchase = await client.query.purchases.findFirst({
|
|
10541
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(purchaseTable.id, purchaseId), (0, import_drizzle_orm27.eq)(purchaseTable.userId, userId)),
|
|
10542
|
+
with: {
|
|
10543
|
+
user: true,
|
|
10544
|
+
product: true,
|
|
10545
|
+
bulkCoupon: true
|
|
10546
|
+
}
|
|
10547
|
+
});
|
|
10548
|
+
const parsedPurchase = purchaseSchema.safeParse(thePurchase);
|
|
10549
|
+
if (!parsedPurchase.success) {
|
|
10550
|
+
console.error("Error parsing purchase", parsedPurchase);
|
|
10551
|
+
return {
|
|
10552
|
+
availableUpgrades: []
|
|
10553
|
+
};
|
|
10554
|
+
}
|
|
10555
|
+
console.log("\u{1F9A6}", {
|
|
10556
|
+
parsedPurchase: parsedPurchase.data
|
|
10557
|
+
});
|
|
10558
|
+
const purchaseCanUpgrade = [
|
|
10559
|
+
"Valid",
|
|
10560
|
+
"Restricted"
|
|
10561
|
+
].includes(parsedPurchase.data.state || "");
|
|
10562
|
+
let availableUpgrades = [];
|
|
10563
|
+
if (purchaseCanUpgrade) {
|
|
10564
|
+
availableUpgrades = await client.query.upgradableProducts.findMany({
|
|
10565
|
+
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(upgradableProducts.upgradableFromId, parsedPurchase.data.product?.id), (0, import_drizzle_orm27.not)((0, import_drizzle_orm27.inArray)(upgradableProducts.upgradableToId, allPurchases.map((p) => p.product?.id)))),
|
|
10566
|
+
with: {
|
|
10567
|
+
upgradableTo: true,
|
|
10568
|
+
upgradableFrom: true
|
|
10569
|
+
}
|
|
10570
|
+
});
|
|
10571
|
+
}
|
|
10572
|
+
const existingPurchase = allPurchases.find((p) => p.product?.id === parsedPurchase.data.product?.id);
|
|
10573
|
+
return Promise.resolve({
|
|
10574
|
+
availableUpgrades: z.array(upgradableProductSchema).parse(availableUpgrades),
|
|
10575
|
+
existingPurchase,
|
|
10576
|
+
purchase: parsedPurchase.data
|
|
10577
|
+
});
|
|
10578
|
+
},
|
|
10118
10579
|
async getUserById(userId) {
|
|
10119
10580
|
return userSchema.nullable().parse(await client.query.users.findFirst({
|
|
10120
10581
|
where: (0, import_drizzle_orm27.eq)(users.id, userId)
|
|
@@ -10132,13 +10593,13 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
10132
10593
|
const purchases = await client.query.purchases.findMany({
|
|
10133
10594
|
where: (0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(purchaseTable.userId, userId), (0, import_drizzle_orm27.inArray)(purchaseTable.productId, upgradableFrom))
|
|
10134
10595
|
});
|
|
10135
|
-
const
|
|
10596
|
+
const productsPurchased = z.array(z.string()).parse(purchases.map((purchase) => {
|
|
10136
10597
|
return purchase.productId;
|
|
10137
10598
|
}));
|
|
10138
|
-
if (
|
|
10599
|
+
if (productsPurchased.length === 0)
|
|
10139
10600
|
return [];
|
|
10140
10601
|
const foundPrices = await client.query.prices.findMany({
|
|
10141
|
-
where: (0, import_drizzle_orm27.
|
|
10602
|
+
where: (0, import_drizzle_orm27.inArray)(prices.productId, productsPurchased)
|
|
10142
10603
|
});
|
|
10143
10604
|
return z.array(priceSchema).parse(foundPrices);
|
|
10144
10605
|
},
|
|
@@ -10372,9 +10833,9 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core32.mysqlTable) {
|
|
|
10372
10833
|
const deletedToken = await client.select().from(verificationTokens).where((0, import_drizzle_orm27.and)((0, import_drizzle_orm27.eq)(verificationTokens.identifier, token.identifier), (0, import_drizzle_orm27.eq)(verificationTokens.token, token.token))).then((res) => res[0]) ?? null;
|
|
10373
10834
|
if (deletedToken?.createdAt) {
|
|
10374
10835
|
const TIMEOUT_IN_SECONDS = 90;
|
|
10375
|
-
const expireMultipleClicks = (0,
|
|
10836
|
+
const expireMultipleClicks = (0, import_date_fns2.addSeconds)(deletedToken.createdAt, TIMEOUT_IN_SECONDS);
|
|
10376
10837
|
const now = /* @__PURE__ */ new Date();
|
|
10377
|
-
if ((0,
|
|
10838
|
+
if ((0, import_date_fns2.isAfter)(expireMultipleClicks, now)) {
|
|
10378
10839
|
const { id: _, ...verificationToken } = token;
|
|
10379
10840
|
return deletedToken;
|
|
10380
10841
|
} else {
|