drizzle-kit 0.20.17-151701 → 0.20.17-2923a0f
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/bin.cjs +16137 -15013
- package/cli/commands/migrate.d.ts +39 -39
- package/cli/commands/mysqlIntrospect.d.ts +8 -8
- package/cli/commands/pgIntrospect.d.ts +7 -7
- package/cli/commands/sqliteIntrospect.d.ts +12 -12
- package/cli/commands/utils.d.ts +123 -1
- package/cli/connections.d.ts +7 -2
- package/cli/validations/cli.d.ts +45 -45
- package/cli/validations/common.d.ts +27 -27
- package/cli/validations/mysql.d.ts +4 -4
- package/cli/validations/pg.d.ts +4 -4
- package/cli/validations/studio.d.ts +92 -0
- package/cli/views.d.ts +6 -0
- package/index.d.mts +4 -1
- package/index.d.ts +4 -1
- package/package.json +2 -2
- package/payload.js +1096 -430
- package/payload.mjs +899 -233
- package/schemaValidator.d.ts +215 -215
- package/serializer/mysqlSchema.d.ts +892 -892
- package/serializer/pgSchema.d.ts +734 -734
- package/serializer/sqliteSchema.d.ts +457 -457
- package/serializer/studio.d.ts +3 -1
- package/snapshotsDiffer.d.ts +314 -314
- package/utils-studio.js +943 -835
- package/utils-studio.mjs +916 -808
- package/utils.js +839 -214
- package/utils.mjs +814 -189
package/payload.mjs
CHANGED
|
@@ -40,7 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
40
40
|
));
|
|
41
41
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
42
|
|
|
43
|
-
// node_modules/.pnpm/chalk@5.
|
|
43
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
44
44
|
function assembleStyles() {
|
|
45
45
|
const codes = /* @__PURE__ */ new Map();
|
|
46
46
|
for (const [groupName, group] of Object.entries(styles)) {
|
|
@@ -157,7 +157,7 @@ function assembleStyles() {
|
|
|
157
157
|
}
|
|
158
158
|
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
|
159
159
|
var init_ansi_styles = __esm({
|
|
160
|
-
"node_modules/.pnpm/chalk@5.
|
|
160
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
|
161
161
|
ANSI_BACKGROUND_OFFSET = 10;
|
|
162
162
|
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
163
163
|
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
@@ -231,7 +231,7 @@ var init_ansi_styles = __esm({
|
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
233
|
|
|
234
|
-
// node_modules/.pnpm/chalk@5.
|
|
234
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
235
235
|
import process2 from "node:process";
|
|
236
236
|
import os from "node:os";
|
|
237
237
|
import tty from "node:tty";
|
|
@@ -298,7 +298,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
298
298
|
return 1;
|
|
299
299
|
}
|
|
300
300
|
if ("CI" in env) {
|
|
301
|
-
if ("GITHUB_ACTIONS" in env) {
|
|
301
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
|
302
302
|
return 3;
|
|
303
303
|
}
|
|
304
304
|
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
@@ -346,7 +346,7 @@ function createSupportsColor(stream, options = {}) {
|
|
|
346
346
|
}
|
|
347
347
|
var env, flagForceColor, supportsColor, supports_color_default;
|
|
348
348
|
var init_supports_color = __esm({
|
|
349
|
-
"node_modules/.pnpm/chalk@5.
|
|
349
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
|
350
350
|
({ env } = process2);
|
|
351
351
|
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
352
352
|
flagForceColor = 0;
|
|
@@ -361,7 +361,7 @@ var init_supports_color = __esm({
|
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
363
|
|
|
364
|
-
// node_modules/.pnpm/chalk@5.
|
|
364
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
|
365
365
|
function stringReplaceAll(string, substring, replacer) {
|
|
366
366
|
let index4 = string.indexOf(substring);
|
|
367
367
|
if (index4 === -1) {
|
|
@@ -391,21 +391,20 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
|
|
|
391
391
|
return returnValue;
|
|
392
392
|
}
|
|
393
393
|
var init_utilities = __esm({
|
|
394
|
-
"node_modules/.pnpm/chalk@5.
|
|
394
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js"() {
|
|
395
395
|
}
|
|
396
396
|
});
|
|
397
397
|
|
|
398
|
-
// node_modules/.pnpm/chalk@5.
|
|
398
|
+
// node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
|
399
399
|
function createChalk(options) {
|
|
400
400
|
return chalkFactory(options);
|
|
401
401
|
}
|
|
402
402
|
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
|
403
403
|
var init_source = __esm({
|
|
404
|
-
"node_modules/.pnpm/chalk@5.
|
|
404
|
+
"node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js"() {
|
|
405
405
|
init_ansi_styles();
|
|
406
406
|
init_supports_color();
|
|
407
407
|
init_utilities();
|
|
408
|
-
init_ansi_styles();
|
|
409
408
|
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
|
|
410
409
|
GENERATOR = Symbol("GENERATOR");
|
|
411
410
|
STYLER = Symbol("STYLER");
|
|
@@ -1116,11 +1115,12 @@ var init_global = __esm({
|
|
|
1116
1115
|
}
|
|
1117
1116
|
});
|
|
1118
1117
|
|
|
1119
|
-
// node_modules/.pnpm/zod@3.
|
|
1118
|
+
// node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs
|
|
1120
1119
|
function getErrorMap() {
|
|
1121
1120
|
return overrideErrorMap;
|
|
1122
1121
|
}
|
|
1123
1122
|
function addIssueToContext(ctx, issueData) {
|
|
1123
|
+
const overrideMap = getErrorMap();
|
|
1124
1124
|
const issue = makeIssue({
|
|
1125
1125
|
issueData,
|
|
1126
1126
|
data: ctx.data,
|
|
@@ -1128,13 +1128,29 @@ function addIssueToContext(ctx, issueData) {
|
|
|
1128
1128
|
errorMaps: [
|
|
1129
1129
|
ctx.common.contextualErrorMap,
|
|
1130
1130
|
ctx.schemaErrorMap,
|
|
1131
|
-
|
|
1132
|
-
errorMap
|
|
1131
|
+
overrideMap,
|
|
1132
|
+
overrideMap === errorMap ? void 0 : errorMap
|
|
1133
1133
|
// then global default map
|
|
1134
1134
|
].filter((x) => !!x)
|
|
1135
1135
|
});
|
|
1136
1136
|
ctx.common.issues.push(issue);
|
|
1137
1137
|
}
|
|
1138
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
1139
|
+
if (kind === "a" && !f)
|
|
1140
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
1141
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
1142
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1143
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
1144
|
+
}
|
|
1145
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
1146
|
+
if (kind === "m")
|
|
1147
|
+
throw new TypeError("Private method is not writable");
|
|
1148
|
+
if (kind === "a" && !f)
|
|
1149
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
1150
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
1151
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1152
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
1153
|
+
}
|
|
1138
1154
|
function processCreateParams(params) {
|
|
1139
1155
|
if (!params)
|
|
1140
1156
|
return {};
|
|
@@ -1145,15 +1161,50 @@ function processCreateParams(params) {
|
|
|
1145
1161
|
if (errorMap2)
|
|
1146
1162
|
return { errorMap: errorMap2, description };
|
|
1147
1163
|
const customMap = (iss, ctx) => {
|
|
1148
|
-
|
|
1149
|
-
|
|
1164
|
+
var _a, _b;
|
|
1165
|
+
const { message } = params;
|
|
1166
|
+
if (iss.code === "invalid_enum_value") {
|
|
1167
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
1168
|
+
}
|
|
1150
1169
|
if (typeof ctx.data === "undefined") {
|
|
1151
|
-
return { message:
|
|
1170
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
1152
1171
|
}
|
|
1153
|
-
|
|
1172
|
+
if (iss.code !== "invalid_type")
|
|
1173
|
+
return { message: ctx.defaultError };
|
|
1174
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
1154
1175
|
};
|
|
1155
1176
|
return { errorMap: customMap, description };
|
|
1156
1177
|
}
|
|
1178
|
+
function timeRegexSource(args) {
|
|
1179
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
1180
|
+
if (args.precision) {
|
|
1181
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
1182
|
+
} else if (args.precision == null) {
|
|
1183
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
1184
|
+
}
|
|
1185
|
+
return regex;
|
|
1186
|
+
}
|
|
1187
|
+
function timeRegex(args) {
|
|
1188
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
1189
|
+
}
|
|
1190
|
+
function datetimeRegex(args) {
|
|
1191
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
1192
|
+
const opts = [];
|
|
1193
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
1194
|
+
if (args.offset)
|
|
1195
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
1196
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
1197
|
+
return new RegExp(`^${regex}$`);
|
|
1198
|
+
}
|
|
1199
|
+
function isValidIP(ip, version) {
|
|
1200
|
+
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
1201
|
+
return true;
|
|
1202
|
+
}
|
|
1203
|
+
if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
|
|
1204
|
+
return true;
|
|
1205
|
+
}
|
|
1206
|
+
return false;
|
|
1207
|
+
}
|
|
1157
1208
|
function floatSafeRemainder(val, step) {
|
|
1158
1209
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
1159
1210
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
@@ -1174,7 +1225,10 @@ function deepPartialify(schema4) {
|
|
|
1174
1225
|
shape: () => newShape
|
|
1175
1226
|
});
|
|
1176
1227
|
} else if (schema4 instanceof ZodArray) {
|
|
1177
|
-
return ZodArray
|
|
1228
|
+
return new ZodArray({
|
|
1229
|
+
...schema4._def,
|
|
1230
|
+
type: deepPartialify(schema4.element)
|
|
1231
|
+
});
|
|
1178
1232
|
} else if (schema4 instanceof ZodOptional) {
|
|
1179
1233
|
return ZodOptional.create(deepPartialify(schema4.unwrap()));
|
|
1180
1234
|
} else if (schema4 instanceof ZodNullable) {
|
|
@@ -1230,9 +1284,9 @@ function createZodEnum(values, params) {
|
|
|
1230
1284
|
...processCreateParams(params)
|
|
1231
1285
|
});
|
|
1232
1286
|
}
|
|
1233
|
-
var util, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, uuidRegex, emailRegex,
|
|
1287
|
+
var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, coerce;
|
|
1234
1288
|
var init_lib = __esm({
|
|
1235
|
-
"node_modules/.pnpm/zod@3.
|
|
1289
|
+
"node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs"() {
|
|
1236
1290
|
(function(util2) {
|
|
1237
1291
|
util2.assertEqual = (val) => val;
|
|
1238
1292
|
function assertIs(_arg) {
|
|
@@ -1290,6 +1344,15 @@ var init_lib = __esm({
|
|
|
1290
1344
|
return value;
|
|
1291
1345
|
};
|
|
1292
1346
|
})(util || (util = {}));
|
|
1347
|
+
(function(objectUtil2) {
|
|
1348
|
+
objectUtil2.mergeShapes = (first, second) => {
|
|
1349
|
+
return {
|
|
1350
|
+
...first,
|
|
1351
|
+
...second
|
|
1352
|
+
// second overwrites first
|
|
1353
|
+
};
|
|
1354
|
+
};
|
|
1355
|
+
})(objectUtil || (objectUtil = {}));
|
|
1293
1356
|
ZodParsedType = util.arrayToEnum([
|
|
1294
1357
|
"string",
|
|
1295
1358
|
"nan",
|
|
@@ -1371,7 +1434,7 @@ var init_lib = __esm({
|
|
|
1371
1434
|
"not_multiple_of",
|
|
1372
1435
|
"not_finite"
|
|
1373
1436
|
]);
|
|
1374
|
-
ZodError = class extends Error {
|
|
1437
|
+
ZodError = class _ZodError extends Error {
|
|
1375
1438
|
constructor(issues) {
|
|
1376
1439
|
super();
|
|
1377
1440
|
this.issues = [];
|
|
@@ -1429,6 +1492,11 @@ var init_lib = __esm({
|
|
|
1429
1492
|
processError(this);
|
|
1430
1493
|
return fieldErrors;
|
|
1431
1494
|
}
|
|
1495
|
+
static assert(value) {
|
|
1496
|
+
if (!(value instanceof _ZodError)) {
|
|
1497
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1432
1500
|
toString() {
|
|
1433
1501
|
return this.message;
|
|
1434
1502
|
}
|
|
@@ -1495,7 +1563,12 @@ var init_lib = __esm({
|
|
|
1495
1563
|
break;
|
|
1496
1564
|
case ZodIssueCode.invalid_string:
|
|
1497
1565
|
if (typeof issue.validation === "object") {
|
|
1498
|
-
if ("
|
|
1566
|
+
if ("includes" in issue.validation) {
|
|
1567
|
+
message = `Invalid input: must include "${issue.validation.includes}"`;
|
|
1568
|
+
if (typeof issue.validation.position === "number") {
|
|
1569
|
+
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
1570
|
+
}
|
|
1571
|
+
} else if ("startsWith" in issue.validation) {
|
|
1499
1572
|
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
1500
1573
|
} else if ("endsWith" in issue.validation) {
|
|
1501
1574
|
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
@@ -1516,7 +1589,7 @@ var init_lib = __esm({
|
|
|
1516
1589
|
else if (issue.type === "number")
|
|
1517
1590
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
1518
1591
|
else if (issue.type === "date")
|
|
1519
|
-
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
|
|
1592
|
+
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
1520
1593
|
else
|
|
1521
1594
|
message = "Invalid input";
|
|
1522
1595
|
break;
|
|
@@ -1527,8 +1600,10 @@ var init_lib = __esm({
|
|
|
1527
1600
|
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
1528
1601
|
else if (issue.type === "number")
|
|
1529
1602
|
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
1603
|
+
else if (issue.type === "bigint")
|
|
1604
|
+
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
1530
1605
|
else if (issue.type === "date")
|
|
1531
|
-
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
|
|
1606
|
+
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
1532
1607
|
else
|
|
1533
1608
|
message = "Invalid input";
|
|
1534
1609
|
break;
|
|
@@ -1558,6 +1633,13 @@ var init_lib = __esm({
|
|
|
1558
1633
|
...issueData,
|
|
1559
1634
|
path: fullPath
|
|
1560
1635
|
};
|
|
1636
|
+
if (issueData.message !== void 0) {
|
|
1637
|
+
return {
|
|
1638
|
+
...issueData,
|
|
1639
|
+
path: fullPath,
|
|
1640
|
+
message: issueData.message
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1561
1643
|
let errorMessage = "";
|
|
1562
1644
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
1563
1645
|
for (const map of maps) {
|
|
@@ -1566,7 +1648,7 @@ var init_lib = __esm({
|
|
|
1566
1648
|
return {
|
|
1567
1649
|
...issueData,
|
|
1568
1650
|
path: fullPath,
|
|
1569
|
-
message:
|
|
1651
|
+
message: errorMessage
|
|
1570
1652
|
};
|
|
1571
1653
|
};
|
|
1572
1654
|
ParseStatus = class _ParseStatus {
|
|
@@ -1595,9 +1677,11 @@ var init_lib = __esm({
|
|
|
1595
1677
|
static async mergeObjectAsync(status, pairs) {
|
|
1596
1678
|
const syncPairs = [];
|
|
1597
1679
|
for (const pair of pairs) {
|
|
1680
|
+
const key = await pair.key;
|
|
1681
|
+
const value = await pair.value;
|
|
1598
1682
|
syncPairs.push({
|
|
1599
|
-
key
|
|
1600
|
-
value
|
|
1683
|
+
key,
|
|
1684
|
+
value
|
|
1601
1685
|
});
|
|
1602
1686
|
}
|
|
1603
1687
|
return _ParseStatus.mergeObjectSync(status, syncPairs);
|
|
@@ -1614,7 +1698,7 @@ var init_lib = __esm({
|
|
|
1614
1698
|
status.dirty();
|
|
1615
1699
|
if (value.status === "dirty")
|
|
1616
1700
|
status.dirty();
|
|
1617
|
-
if (typeof value.value !== "undefined" || pair.alwaysSet) {
|
|
1701
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
1618
1702
|
finalObject[key.value] = value.value;
|
|
1619
1703
|
}
|
|
1620
1704
|
}
|
|
@@ -1629,20 +1713,28 @@ var init_lib = __esm({
|
|
|
1629
1713
|
isAborted = (x) => x.status === "aborted";
|
|
1630
1714
|
isDirty = (x) => x.status === "dirty";
|
|
1631
1715
|
isValid = (x) => x.status === "valid";
|
|
1632
|
-
isAsync = (x) => typeof Promise !==
|
|
1716
|
+
isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
1633
1717
|
(function(errorUtil2) {
|
|
1634
1718
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
1635
1719
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
1636
1720
|
})(errorUtil || (errorUtil = {}));
|
|
1637
1721
|
ParseInputLazyPath = class {
|
|
1638
1722
|
constructor(parent, value, path2, key) {
|
|
1723
|
+
this._cachedPath = [];
|
|
1639
1724
|
this.parent = parent;
|
|
1640
1725
|
this.data = value;
|
|
1641
1726
|
this._path = path2;
|
|
1642
1727
|
this._key = key;
|
|
1643
1728
|
}
|
|
1644
1729
|
get path() {
|
|
1645
|
-
|
|
1730
|
+
if (!this._cachedPath.length) {
|
|
1731
|
+
if (this._key instanceof Array) {
|
|
1732
|
+
this._cachedPath.push(...this._path, ...this._key);
|
|
1733
|
+
} else {
|
|
1734
|
+
this._cachedPath.push(...this._path, this._key);
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
return this._cachedPath;
|
|
1646
1738
|
}
|
|
1647
1739
|
};
|
|
1648
1740
|
handleResult = (ctx, result) => {
|
|
@@ -1652,8 +1744,16 @@ var init_lib = __esm({
|
|
|
1652
1744
|
if (!ctx.common.issues.length) {
|
|
1653
1745
|
throw new Error("Validation failed but no issues detected.");
|
|
1654
1746
|
}
|
|
1655
|
-
|
|
1656
|
-
|
|
1747
|
+
return {
|
|
1748
|
+
success: false,
|
|
1749
|
+
get error() {
|
|
1750
|
+
if (this._error)
|
|
1751
|
+
return this._error;
|
|
1752
|
+
const error2 = new ZodError(ctx.common.issues);
|
|
1753
|
+
this._error = error2;
|
|
1754
|
+
return this._error;
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1657
1757
|
}
|
|
1658
1758
|
};
|
|
1659
1759
|
ZodType = class {
|
|
@@ -1681,6 +1781,7 @@ var init_lib = __esm({
|
|
|
1681
1781
|
this.catch = this.catch.bind(this);
|
|
1682
1782
|
this.describe = this.describe.bind(this);
|
|
1683
1783
|
this.pipe = this.pipe.bind(this);
|
|
1784
|
+
this.readonly = this.readonly.bind(this);
|
|
1684
1785
|
this.isNullable = this.isNullable.bind(this);
|
|
1685
1786
|
this.isOptional = this.isOptional.bind(this);
|
|
1686
1787
|
}
|
|
@@ -1825,28 +1926,29 @@ var init_lib = __esm({
|
|
|
1825
1926
|
return this._refinement(refinement);
|
|
1826
1927
|
}
|
|
1827
1928
|
optional() {
|
|
1828
|
-
return ZodOptional.create(this);
|
|
1929
|
+
return ZodOptional.create(this, this._def);
|
|
1829
1930
|
}
|
|
1830
1931
|
nullable() {
|
|
1831
|
-
return ZodNullable.create(this);
|
|
1932
|
+
return ZodNullable.create(this, this._def);
|
|
1832
1933
|
}
|
|
1833
1934
|
nullish() {
|
|
1834
|
-
return this.
|
|
1935
|
+
return this.nullable().optional();
|
|
1835
1936
|
}
|
|
1836
1937
|
array() {
|
|
1837
|
-
return ZodArray.create(this);
|
|
1938
|
+
return ZodArray.create(this, this._def);
|
|
1838
1939
|
}
|
|
1839
1940
|
promise() {
|
|
1840
|
-
return ZodPromise.create(this);
|
|
1941
|
+
return ZodPromise.create(this, this._def);
|
|
1841
1942
|
}
|
|
1842
1943
|
or(option) {
|
|
1843
|
-
return ZodUnion.create([this, option]);
|
|
1944
|
+
return ZodUnion.create([this, option], this._def);
|
|
1844
1945
|
}
|
|
1845
1946
|
and(incoming) {
|
|
1846
|
-
return ZodIntersection.create(this, incoming);
|
|
1947
|
+
return ZodIntersection.create(this, incoming, this._def);
|
|
1847
1948
|
}
|
|
1848
1949
|
transform(transform) {
|
|
1849
1950
|
return new ZodEffects({
|
|
1951
|
+
...processCreateParams(this._def),
|
|
1850
1952
|
schema: this,
|
|
1851
1953
|
typeName: ZodFirstPartyTypeKind.ZodEffects,
|
|
1852
1954
|
effect: { type: "transform", transform }
|
|
@@ -1855,6 +1957,7 @@ var init_lib = __esm({
|
|
|
1855
1957
|
default(def) {
|
|
1856
1958
|
const defaultValueFunc = typeof def === "function" ? def : () => def;
|
|
1857
1959
|
return new ZodDefault({
|
|
1960
|
+
...processCreateParams(this._def),
|
|
1858
1961
|
innerType: this,
|
|
1859
1962
|
defaultValue: defaultValueFunc,
|
|
1860
1963
|
typeName: ZodFirstPartyTypeKind.ZodDefault
|
|
@@ -1864,14 +1967,15 @@ var init_lib = __esm({
|
|
|
1864
1967
|
return new ZodBranded({
|
|
1865
1968
|
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
1866
1969
|
type: this,
|
|
1867
|
-
...processCreateParams(
|
|
1970
|
+
...processCreateParams(this._def)
|
|
1868
1971
|
});
|
|
1869
1972
|
}
|
|
1870
1973
|
catch(def) {
|
|
1871
|
-
const
|
|
1974
|
+
const catchValueFunc = typeof def === "function" ? def : () => def;
|
|
1872
1975
|
return new ZodCatch({
|
|
1976
|
+
...processCreateParams(this._def),
|
|
1873
1977
|
innerType: this,
|
|
1874
|
-
|
|
1978
|
+
catchValue: catchValueFunc,
|
|
1875
1979
|
typeName: ZodFirstPartyTypeKind.ZodCatch
|
|
1876
1980
|
});
|
|
1877
1981
|
}
|
|
@@ -1885,6 +1989,9 @@ var init_lib = __esm({
|
|
|
1885
1989
|
pipe(target) {
|
|
1886
1990
|
return ZodPipeline.create(this, target);
|
|
1887
1991
|
}
|
|
1992
|
+
readonly() {
|
|
1993
|
+
return ZodReadonly.create(this);
|
|
1994
|
+
}
|
|
1888
1995
|
isOptional() {
|
|
1889
1996
|
return this.safeParse(void 0).success;
|
|
1890
1997
|
}
|
|
@@ -1893,43 +2000,19 @@ var init_lib = __esm({
|
|
|
1893
2000
|
}
|
|
1894
2001
|
};
|
|
1895
2002
|
cuidRegex = /^c[^\s-]{8,}$/i;
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
} else {
|
|
1909
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
1910
|
-
}
|
|
1911
|
-
} else {
|
|
1912
|
-
if (args.offset) {
|
|
1913
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
|
|
1914
|
-
} else {
|
|
1915
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
};
|
|
2003
|
+
cuid2Regex = /^[0-9a-z]+$/;
|
|
2004
|
+
ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
2005
|
+
uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
2006
|
+
nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
2007
|
+
durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
2008
|
+
emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
2009
|
+
_emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
2010
|
+
ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
2011
|
+
ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
|
2012
|
+
base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
2013
|
+
dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
2014
|
+
dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
1919
2015
|
ZodString = class _ZodString extends ZodType {
|
|
1920
|
-
constructor() {
|
|
1921
|
-
super(...arguments);
|
|
1922
|
-
this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
|
|
1923
|
-
validation,
|
|
1924
|
-
code: ZodIssueCode.invalid_string,
|
|
1925
|
-
...errorUtil.errToObj(message)
|
|
1926
|
-
});
|
|
1927
|
-
this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
|
|
1928
|
-
this.trim = () => new _ZodString({
|
|
1929
|
-
...this._def,
|
|
1930
|
-
checks: [...this._def.checks, { kind: "trim" }]
|
|
1931
|
-
});
|
|
1932
|
-
}
|
|
1933
2016
|
_parse(input) {
|
|
1934
2017
|
if (this._def.coerce) {
|
|
1935
2018
|
input.data = String(input.data);
|
|
@@ -1937,15 +2020,11 @@ var init_lib = __esm({
|
|
|
1937
2020
|
const parsedType = this._getType(input);
|
|
1938
2021
|
if (parsedType !== ZodParsedType.string) {
|
|
1939
2022
|
const ctx2 = this._getOrReturnCtx(input);
|
|
1940
|
-
addIssueToContext(
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
received: ctx2.parsedType
|
|
1946
|
-
}
|
|
1947
|
-
//
|
|
1948
|
-
);
|
|
2023
|
+
addIssueToContext(ctx2, {
|
|
2024
|
+
code: ZodIssueCode.invalid_type,
|
|
2025
|
+
expected: ZodParsedType.string,
|
|
2026
|
+
received: ctx2.parsedType
|
|
2027
|
+
});
|
|
1949
2028
|
return INVALID;
|
|
1950
2029
|
}
|
|
1951
2030
|
const status = new ParseStatus();
|
|
@@ -2013,6 +2092,19 @@ var init_lib = __esm({
|
|
|
2013
2092
|
});
|
|
2014
2093
|
status.dirty();
|
|
2015
2094
|
}
|
|
2095
|
+
} else if (check.kind === "emoji") {
|
|
2096
|
+
if (!emojiRegex) {
|
|
2097
|
+
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
2098
|
+
}
|
|
2099
|
+
if (!emojiRegex.test(input.data)) {
|
|
2100
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2101
|
+
addIssueToContext(ctx, {
|
|
2102
|
+
validation: "emoji",
|
|
2103
|
+
code: ZodIssueCode.invalid_string,
|
|
2104
|
+
message: check.message
|
|
2105
|
+
});
|
|
2106
|
+
status.dirty();
|
|
2107
|
+
}
|
|
2016
2108
|
} else if (check.kind === "uuid") {
|
|
2017
2109
|
if (!uuidRegex.test(input.data)) {
|
|
2018
2110
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2023,6 +2115,16 @@ var init_lib = __esm({
|
|
|
2023
2115
|
});
|
|
2024
2116
|
status.dirty();
|
|
2025
2117
|
}
|
|
2118
|
+
} else if (check.kind === "nanoid") {
|
|
2119
|
+
if (!nanoidRegex.test(input.data)) {
|
|
2120
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2121
|
+
addIssueToContext(ctx, {
|
|
2122
|
+
validation: "nanoid",
|
|
2123
|
+
code: ZodIssueCode.invalid_string,
|
|
2124
|
+
message: check.message
|
|
2125
|
+
});
|
|
2126
|
+
status.dirty();
|
|
2127
|
+
}
|
|
2026
2128
|
} else if (check.kind === "cuid") {
|
|
2027
2129
|
if (!cuidRegex.test(input.data)) {
|
|
2028
2130
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2033,6 +2135,26 @@ var init_lib = __esm({
|
|
|
2033
2135
|
});
|
|
2034
2136
|
status.dirty();
|
|
2035
2137
|
}
|
|
2138
|
+
} else if (check.kind === "cuid2") {
|
|
2139
|
+
if (!cuid2Regex.test(input.data)) {
|
|
2140
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2141
|
+
addIssueToContext(ctx, {
|
|
2142
|
+
validation: "cuid2",
|
|
2143
|
+
code: ZodIssueCode.invalid_string,
|
|
2144
|
+
message: check.message
|
|
2145
|
+
});
|
|
2146
|
+
status.dirty();
|
|
2147
|
+
}
|
|
2148
|
+
} else if (check.kind === "ulid") {
|
|
2149
|
+
if (!ulidRegex.test(input.data)) {
|
|
2150
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2151
|
+
addIssueToContext(ctx, {
|
|
2152
|
+
validation: "ulid",
|
|
2153
|
+
code: ZodIssueCode.invalid_string,
|
|
2154
|
+
message: check.message
|
|
2155
|
+
});
|
|
2156
|
+
status.dirty();
|
|
2157
|
+
}
|
|
2036
2158
|
} else if (check.kind === "url") {
|
|
2037
2159
|
try {
|
|
2038
2160
|
new URL(input.data);
|
|
@@ -2059,6 +2181,20 @@ var init_lib = __esm({
|
|
|
2059
2181
|
}
|
|
2060
2182
|
} else if (check.kind === "trim") {
|
|
2061
2183
|
input.data = input.data.trim();
|
|
2184
|
+
} else if (check.kind === "includes") {
|
|
2185
|
+
if (!input.data.includes(check.value, check.position)) {
|
|
2186
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2187
|
+
addIssueToContext(ctx, {
|
|
2188
|
+
code: ZodIssueCode.invalid_string,
|
|
2189
|
+
validation: { includes: check.value, position: check.position },
|
|
2190
|
+
message: check.message
|
|
2191
|
+
});
|
|
2192
|
+
status.dirty();
|
|
2193
|
+
}
|
|
2194
|
+
} else if (check.kind === "toLowerCase") {
|
|
2195
|
+
input.data = input.data.toLowerCase();
|
|
2196
|
+
} else if (check.kind === "toUpperCase") {
|
|
2197
|
+
input.data = input.data.toUpperCase();
|
|
2062
2198
|
} else if (check.kind === "startsWith") {
|
|
2063
2199
|
if (!input.data.startsWith(check.value)) {
|
|
2064
2200
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2090,12 +2226,71 @@ var init_lib = __esm({
|
|
|
2090
2226
|
});
|
|
2091
2227
|
status.dirty();
|
|
2092
2228
|
}
|
|
2229
|
+
} else if (check.kind === "date") {
|
|
2230
|
+
const regex = dateRegex;
|
|
2231
|
+
if (!regex.test(input.data)) {
|
|
2232
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2233
|
+
addIssueToContext(ctx, {
|
|
2234
|
+
code: ZodIssueCode.invalid_string,
|
|
2235
|
+
validation: "date",
|
|
2236
|
+
message: check.message
|
|
2237
|
+
});
|
|
2238
|
+
status.dirty();
|
|
2239
|
+
}
|
|
2240
|
+
} else if (check.kind === "time") {
|
|
2241
|
+
const regex = timeRegex(check);
|
|
2242
|
+
if (!regex.test(input.data)) {
|
|
2243
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2244
|
+
addIssueToContext(ctx, {
|
|
2245
|
+
code: ZodIssueCode.invalid_string,
|
|
2246
|
+
validation: "time",
|
|
2247
|
+
message: check.message
|
|
2248
|
+
});
|
|
2249
|
+
status.dirty();
|
|
2250
|
+
}
|
|
2251
|
+
} else if (check.kind === "duration") {
|
|
2252
|
+
if (!durationRegex.test(input.data)) {
|
|
2253
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2254
|
+
addIssueToContext(ctx, {
|
|
2255
|
+
validation: "duration",
|
|
2256
|
+
code: ZodIssueCode.invalid_string,
|
|
2257
|
+
message: check.message
|
|
2258
|
+
});
|
|
2259
|
+
status.dirty();
|
|
2260
|
+
}
|
|
2261
|
+
} else if (check.kind === "ip") {
|
|
2262
|
+
if (!isValidIP(input.data, check.version)) {
|
|
2263
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2264
|
+
addIssueToContext(ctx, {
|
|
2265
|
+
validation: "ip",
|
|
2266
|
+
code: ZodIssueCode.invalid_string,
|
|
2267
|
+
message: check.message
|
|
2268
|
+
});
|
|
2269
|
+
status.dirty();
|
|
2270
|
+
}
|
|
2271
|
+
} else if (check.kind === "base64") {
|
|
2272
|
+
if (!base64Regex.test(input.data)) {
|
|
2273
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2274
|
+
addIssueToContext(ctx, {
|
|
2275
|
+
validation: "base64",
|
|
2276
|
+
code: ZodIssueCode.invalid_string,
|
|
2277
|
+
message: check.message
|
|
2278
|
+
});
|
|
2279
|
+
status.dirty();
|
|
2280
|
+
}
|
|
2093
2281
|
} else {
|
|
2094
2282
|
util.assertNever(check);
|
|
2095
2283
|
}
|
|
2096
2284
|
}
|
|
2097
2285
|
return { status: status.value, value: input.data };
|
|
2098
2286
|
}
|
|
2287
|
+
_regex(regex, validation, message) {
|
|
2288
|
+
return this.refinement((data) => regex.test(data), {
|
|
2289
|
+
validation,
|
|
2290
|
+
code: ZodIssueCode.invalid_string,
|
|
2291
|
+
...errorUtil.errToObj(message)
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2099
2294
|
_addCheck(check) {
|
|
2100
2295
|
return new _ZodString({
|
|
2101
2296
|
...this._def,
|
|
@@ -2108,19 +2303,38 @@ var init_lib = __esm({
|
|
|
2108
2303
|
url(message) {
|
|
2109
2304
|
return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
|
|
2110
2305
|
}
|
|
2306
|
+
emoji(message) {
|
|
2307
|
+
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
|
|
2308
|
+
}
|
|
2111
2309
|
uuid(message) {
|
|
2112
2310
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
2113
2311
|
}
|
|
2312
|
+
nanoid(message) {
|
|
2313
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
|
2314
|
+
}
|
|
2114
2315
|
cuid(message) {
|
|
2115
2316
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
2116
2317
|
}
|
|
2318
|
+
cuid2(message) {
|
|
2319
|
+
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
|
|
2320
|
+
}
|
|
2321
|
+
ulid(message) {
|
|
2322
|
+
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
2323
|
+
}
|
|
2324
|
+
base64(message) {
|
|
2325
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
2326
|
+
}
|
|
2327
|
+
ip(options) {
|
|
2328
|
+
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
2329
|
+
}
|
|
2117
2330
|
datetime(options) {
|
|
2118
|
-
var _a;
|
|
2331
|
+
var _a, _b;
|
|
2119
2332
|
if (typeof options === "string") {
|
|
2120
2333
|
return this._addCheck({
|
|
2121
2334
|
kind: "datetime",
|
|
2122
2335
|
precision: null,
|
|
2123
2336
|
offset: false,
|
|
2337
|
+
local: false,
|
|
2124
2338
|
message: options
|
|
2125
2339
|
});
|
|
2126
2340
|
}
|
|
@@ -2128,9 +2342,30 @@ var init_lib = __esm({
|
|
|
2128
2342
|
kind: "datetime",
|
|
2129
2343
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
2130
2344
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
2345
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
2131
2346
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
2132
2347
|
});
|
|
2133
2348
|
}
|
|
2349
|
+
date(message) {
|
|
2350
|
+
return this._addCheck({ kind: "date", message });
|
|
2351
|
+
}
|
|
2352
|
+
time(options) {
|
|
2353
|
+
if (typeof options === "string") {
|
|
2354
|
+
return this._addCheck({
|
|
2355
|
+
kind: "time",
|
|
2356
|
+
precision: null,
|
|
2357
|
+
message: options
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
return this._addCheck({
|
|
2361
|
+
kind: "time",
|
|
2362
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
2363
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
duration(message) {
|
|
2367
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
2368
|
+
}
|
|
2134
2369
|
regex(regex, message) {
|
|
2135
2370
|
return this._addCheck({
|
|
2136
2371
|
kind: "regex",
|
|
@@ -2138,6 +2373,14 @@ var init_lib = __esm({
|
|
|
2138
2373
|
...errorUtil.errToObj(message)
|
|
2139
2374
|
});
|
|
2140
2375
|
}
|
|
2376
|
+
includes(value, options) {
|
|
2377
|
+
return this._addCheck({
|
|
2378
|
+
kind: "includes",
|
|
2379
|
+
value,
|
|
2380
|
+
position: options === null || options === void 0 ? void 0 : options.position,
|
|
2381
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
2382
|
+
});
|
|
2383
|
+
}
|
|
2141
2384
|
startsWith(value, message) {
|
|
2142
2385
|
return this._addCheck({
|
|
2143
2386
|
kind: "startsWith",
|
|
@@ -2173,21 +2416,73 @@ var init_lib = __esm({
|
|
|
2173
2416
|
...errorUtil.errToObj(message)
|
|
2174
2417
|
});
|
|
2175
2418
|
}
|
|
2419
|
+
/**
|
|
2420
|
+
* @deprecated Use z.string().min(1) instead.
|
|
2421
|
+
* @see {@link ZodString.min}
|
|
2422
|
+
*/
|
|
2423
|
+
nonempty(message) {
|
|
2424
|
+
return this.min(1, errorUtil.errToObj(message));
|
|
2425
|
+
}
|
|
2426
|
+
trim() {
|
|
2427
|
+
return new _ZodString({
|
|
2428
|
+
...this._def,
|
|
2429
|
+
checks: [...this._def.checks, { kind: "trim" }]
|
|
2430
|
+
});
|
|
2431
|
+
}
|
|
2432
|
+
toLowerCase() {
|
|
2433
|
+
return new _ZodString({
|
|
2434
|
+
...this._def,
|
|
2435
|
+
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
2436
|
+
});
|
|
2437
|
+
}
|
|
2438
|
+
toUpperCase() {
|
|
2439
|
+
return new _ZodString({
|
|
2440
|
+
...this._def,
|
|
2441
|
+
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2176
2444
|
get isDatetime() {
|
|
2177
2445
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
2178
2446
|
}
|
|
2447
|
+
get isDate() {
|
|
2448
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
2449
|
+
}
|
|
2450
|
+
get isTime() {
|
|
2451
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
2452
|
+
}
|
|
2453
|
+
get isDuration() {
|
|
2454
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
2455
|
+
}
|
|
2179
2456
|
get isEmail() {
|
|
2180
2457
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
2181
2458
|
}
|
|
2182
2459
|
get isURL() {
|
|
2183
2460
|
return !!this._def.checks.find((ch) => ch.kind === "url");
|
|
2184
2461
|
}
|
|
2462
|
+
get isEmoji() {
|
|
2463
|
+
return !!this._def.checks.find((ch) => ch.kind === "emoji");
|
|
2464
|
+
}
|
|
2185
2465
|
get isUUID() {
|
|
2186
2466
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
2187
2467
|
}
|
|
2468
|
+
get isNANOID() {
|
|
2469
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
2470
|
+
}
|
|
2188
2471
|
get isCUID() {
|
|
2189
2472
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
2190
2473
|
}
|
|
2474
|
+
get isCUID2() {
|
|
2475
|
+
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
|
|
2476
|
+
}
|
|
2477
|
+
get isULID() {
|
|
2478
|
+
return !!this._def.checks.find((ch) => ch.kind === "ulid");
|
|
2479
|
+
}
|
|
2480
|
+
get isIP() {
|
|
2481
|
+
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
2482
|
+
}
|
|
2483
|
+
get isBase64() {
|
|
2484
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
2485
|
+
}
|
|
2191
2486
|
get minLength() {
|
|
2192
2487
|
let min = null;
|
|
2193
2488
|
for (const ch of this._def.checks) {
|
|
@@ -2389,6 +2684,19 @@ var init_lib = __esm({
|
|
|
2389
2684
|
message: errorUtil.toString(message)
|
|
2390
2685
|
});
|
|
2391
2686
|
}
|
|
2687
|
+
safe(message) {
|
|
2688
|
+
return this._addCheck({
|
|
2689
|
+
kind: "min",
|
|
2690
|
+
inclusive: true,
|
|
2691
|
+
value: Number.MIN_SAFE_INTEGER,
|
|
2692
|
+
message: errorUtil.toString(message)
|
|
2693
|
+
})._addCheck({
|
|
2694
|
+
kind: "max",
|
|
2695
|
+
inclusive: true,
|
|
2696
|
+
value: Number.MAX_SAFE_INTEGER,
|
|
2697
|
+
message: errorUtil.toString(message)
|
|
2698
|
+
});
|
|
2699
|
+
}
|
|
2392
2700
|
get minValue() {
|
|
2393
2701
|
let min = null;
|
|
2394
2702
|
for (const ch of this._def.checks) {
|
|
@@ -2410,7 +2718,22 @@ var init_lib = __esm({
|
|
|
2410
2718
|
return max;
|
|
2411
2719
|
}
|
|
2412
2720
|
get isInt() {
|
|
2413
|
-
return !!this._def.checks.find((ch) => ch.kind === "int");
|
|
2721
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
2722
|
+
}
|
|
2723
|
+
get isFinite() {
|
|
2724
|
+
let max = null, min = null;
|
|
2725
|
+
for (const ch of this._def.checks) {
|
|
2726
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
2727
|
+
return true;
|
|
2728
|
+
} else if (ch.kind === "min") {
|
|
2729
|
+
if (min === null || ch.value > min)
|
|
2730
|
+
min = ch.value;
|
|
2731
|
+
} else if (ch.kind === "max") {
|
|
2732
|
+
if (max === null || ch.value < max)
|
|
2733
|
+
max = ch.value;
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
return Number.isFinite(min) && Number.isFinite(max);
|
|
2414
2737
|
}
|
|
2415
2738
|
};
|
|
2416
2739
|
ZodNumber.create = (params) => {
|
|
@@ -2421,27 +2744,167 @@ var init_lib = __esm({
|
|
|
2421
2744
|
...processCreateParams(params)
|
|
2422
2745
|
});
|
|
2423
2746
|
};
|
|
2424
|
-
ZodBigInt = class extends ZodType {
|
|
2747
|
+
ZodBigInt = class _ZodBigInt extends ZodType {
|
|
2748
|
+
constructor() {
|
|
2749
|
+
super(...arguments);
|
|
2750
|
+
this.min = this.gte;
|
|
2751
|
+
this.max = this.lte;
|
|
2752
|
+
}
|
|
2425
2753
|
_parse(input) {
|
|
2426
2754
|
if (this._def.coerce) {
|
|
2427
2755
|
input.data = BigInt(input.data);
|
|
2428
2756
|
}
|
|
2429
2757
|
const parsedType = this._getType(input);
|
|
2430
2758
|
if (parsedType !== ZodParsedType.bigint) {
|
|
2431
|
-
const
|
|
2432
|
-
addIssueToContext(
|
|
2759
|
+
const ctx2 = this._getOrReturnCtx(input);
|
|
2760
|
+
addIssueToContext(ctx2, {
|
|
2433
2761
|
code: ZodIssueCode.invalid_type,
|
|
2434
2762
|
expected: ZodParsedType.bigint,
|
|
2435
|
-
received:
|
|
2763
|
+
received: ctx2.parsedType
|
|
2436
2764
|
});
|
|
2437
2765
|
return INVALID;
|
|
2438
2766
|
}
|
|
2439
|
-
|
|
2767
|
+
let ctx = void 0;
|
|
2768
|
+
const status = new ParseStatus();
|
|
2769
|
+
for (const check of this._def.checks) {
|
|
2770
|
+
if (check.kind === "min") {
|
|
2771
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
2772
|
+
if (tooSmall) {
|
|
2773
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2774
|
+
addIssueToContext(ctx, {
|
|
2775
|
+
code: ZodIssueCode.too_small,
|
|
2776
|
+
type: "bigint",
|
|
2777
|
+
minimum: check.value,
|
|
2778
|
+
inclusive: check.inclusive,
|
|
2779
|
+
message: check.message
|
|
2780
|
+
});
|
|
2781
|
+
status.dirty();
|
|
2782
|
+
}
|
|
2783
|
+
} else if (check.kind === "max") {
|
|
2784
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
2785
|
+
if (tooBig) {
|
|
2786
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2787
|
+
addIssueToContext(ctx, {
|
|
2788
|
+
code: ZodIssueCode.too_big,
|
|
2789
|
+
type: "bigint",
|
|
2790
|
+
maximum: check.value,
|
|
2791
|
+
inclusive: check.inclusive,
|
|
2792
|
+
message: check.message
|
|
2793
|
+
});
|
|
2794
|
+
status.dirty();
|
|
2795
|
+
}
|
|
2796
|
+
} else if (check.kind === "multipleOf") {
|
|
2797
|
+
if (input.data % check.value !== BigInt(0)) {
|
|
2798
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2799
|
+
addIssueToContext(ctx, {
|
|
2800
|
+
code: ZodIssueCode.not_multiple_of,
|
|
2801
|
+
multipleOf: check.value,
|
|
2802
|
+
message: check.message
|
|
2803
|
+
});
|
|
2804
|
+
status.dirty();
|
|
2805
|
+
}
|
|
2806
|
+
} else {
|
|
2807
|
+
util.assertNever(check);
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
return { status: status.value, value: input.data };
|
|
2811
|
+
}
|
|
2812
|
+
gte(value, message) {
|
|
2813
|
+
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
2814
|
+
}
|
|
2815
|
+
gt(value, message) {
|
|
2816
|
+
return this.setLimit("min", value, false, errorUtil.toString(message));
|
|
2817
|
+
}
|
|
2818
|
+
lte(value, message) {
|
|
2819
|
+
return this.setLimit("max", value, true, errorUtil.toString(message));
|
|
2820
|
+
}
|
|
2821
|
+
lt(value, message) {
|
|
2822
|
+
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
2823
|
+
}
|
|
2824
|
+
setLimit(kind, value, inclusive, message) {
|
|
2825
|
+
return new _ZodBigInt({
|
|
2826
|
+
...this._def,
|
|
2827
|
+
checks: [
|
|
2828
|
+
...this._def.checks,
|
|
2829
|
+
{
|
|
2830
|
+
kind,
|
|
2831
|
+
value,
|
|
2832
|
+
inclusive,
|
|
2833
|
+
message: errorUtil.toString(message)
|
|
2834
|
+
}
|
|
2835
|
+
]
|
|
2836
|
+
});
|
|
2837
|
+
}
|
|
2838
|
+
_addCheck(check) {
|
|
2839
|
+
return new _ZodBigInt({
|
|
2840
|
+
...this._def,
|
|
2841
|
+
checks: [...this._def.checks, check]
|
|
2842
|
+
});
|
|
2843
|
+
}
|
|
2844
|
+
positive(message) {
|
|
2845
|
+
return this._addCheck({
|
|
2846
|
+
kind: "min",
|
|
2847
|
+
value: BigInt(0),
|
|
2848
|
+
inclusive: false,
|
|
2849
|
+
message: errorUtil.toString(message)
|
|
2850
|
+
});
|
|
2851
|
+
}
|
|
2852
|
+
negative(message) {
|
|
2853
|
+
return this._addCheck({
|
|
2854
|
+
kind: "max",
|
|
2855
|
+
value: BigInt(0),
|
|
2856
|
+
inclusive: false,
|
|
2857
|
+
message: errorUtil.toString(message)
|
|
2858
|
+
});
|
|
2859
|
+
}
|
|
2860
|
+
nonpositive(message) {
|
|
2861
|
+
return this._addCheck({
|
|
2862
|
+
kind: "max",
|
|
2863
|
+
value: BigInt(0),
|
|
2864
|
+
inclusive: true,
|
|
2865
|
+
message: errorUtil.toString(message)
|
|
2866
|
+
});
|
|
2867
|
+
}
|
|
2868
|
+
nonnegative(message) {
|
|
2869
|
+
return this._addCheck({
|
|
2870
|
+
kind: "min",
|
|
2871
|
+
value: BigInt(0),
|
|
2872
|
+
inclusive: true,
|
|
2873
|
+
message: errorUtil.toString(message)
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
multipleOf(value, message) {
|
|
2877
|
+
return this._addCheck({
|
|
2878
|
+
kind: "multipleOf",
|
|
2879
|
+
value,
|
|
2880
|
+
message: errorUtil.toString(message)
|
|
2881
|
+
});
|
|
2882
|
+
}
|
|
2883
|
+
get minValue() {
|
|
2884
|
+
let min = null;
|
|
2885
|
+
for (const ch of this._def.checks) {
|
|
2886
|
+
if (ch.kind === "min") {
|
|
2887
|
+
if (min === null || ch.value > min)
|
|
2888
|
+
min = ch.value;
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
return min;
|
|
2892
|
+
}
|
|
2893
|
+
get maxValue() {
|
|
2894
|
+
let max = null;
|
|
2895
|
+
for (const ch of this._def.checks) {
|
|
2896
|
+
if (ch.kind === "max") {
|
|
2897
|
+
if (max === null || ch.value < max)
|
|
2898
|
+
max = ch.value;
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
return max;
|
|
2440
2902
|
}
|
|
2441
2903
|
};
|
|
2442
2904
|
ZodBigInt.create = (params) => {
|
|
2443
2905
|
var _a;
|
|
2444
2906
|
return new ZodBigInt({
|
|
2907
|
+
checks: [],
|
|
2445
2908
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
2446
2909
|
coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
|
|
2447
2910
|
...processCreateParams(params)
|
|
@@ -2767,13 +3230,13 @@ var init_lib = __esm({
|
|
|
2767
3230
|
}
|
|
2768
3231
|
}
|
|
2769
3232
|
if (ctx.common.async) {
|
|
2770
|
-
return Promise.all(ctx.data.map((item, i) => {
|
|
3233
|
+
return Promise.all([...ctx.data].map((item, i) => {
|
|
2771
3234
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
2772
3235
|
})).then((result2) => {
|
|
2773
3236
|
return ParseStatus.mergeArray(status, result2);
|
|
2774
3237
|
});
|
|
2775
3238
|
}
|
|
2776
|
-
const result = ctx.data.map((item, i) => {
|
|
3239
|
+
const result = [...ctx.data].map((item, i) => {
|
|
2777
3240
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
2778
3241
|
});
|
|
2779
3242
|
return ParseStatus.mergeArray(status, result);
|
|
@@ -2813,31 +3276,12 @@ var init_lib = __esm({
|
|
|
2813
3276
|
...processCreateParams(params)
|
|
2814
3277
|
});
|
|
2815
3278
|
};
|
|
2816
|
-
(function(objectUtil2) {
|
|
2817
|
-
objectUtil2.mergeShapes = (first, second) => {
|
|
2818
|
-
return {
|
|
2819
|
-
...first,
|
|
2820
|
-
...second
|
|
2821
|
-
// second overwrites first
|
|
2822
|
-
};
|
|
2823
|
-
};
|
|
2824
|
-
})(objectUtil || (objectUtil = {}));
|
|
2825
|
-
AugmentFactory = (def) => (augmentation) => {
|
|
2826
|
-
return new ZodObject({
|
|
2827
|
-
...def,
|
|
2828
|
-
shape: () => ({
|
|
2829
|
-
...def.shape(),
|
|
2830
|
-
...augmentation
|
|
2831
|
-
})
|
|
2832
|
-
});
|
|
2833
|
-
};
|
|
2834
3279
|
ZodObject = class _ZodObject extends ZodType {
|
|
2835
3280
|
constructor() {
|
|
2836
3281
|
super(...arguments);
|
|
2837
3282
|
this._cached = null;
|
|
2838
3283
|
this.nonstrict = this.passthrough;
|
|
2839
|
-
this.augment =
|
|
2840
|
-
this.extend = AugmentFactory(this._def);
|
|
3284
|
+
this.augment = this.extend;
|
|
2841
3285
|
}
|
|
2842
3286
|
_getCached() {
|
|
2843
3287
|
if (this._cached !== null)
|
|
@@ -2918,9 +3362,10 @@ var init_lib = __esm({
|
|
|
2918
3362
|
const syncPairs = [];
|
|
2919
3363
|
for (const pair of pairs) {
|
|
2920
3364
|
const key = await pair.key;
|
|
3365
|
+
const value = await pair.value;
|
|
2921
3366
|
syncPairs.push({
|
|
2922
3367
|
key,
|
|
2923
|
-
value
|
|
3368
|
+
value,
|
|
2924
3369
|
alwaysSet: pair.alwaysSet
|
|
2925
3370
|
});
|
|
2926
3371
|
}
|
|
@@ -2967,8 +3412,31 @@ var init_lib = __esm({
|
|
|
2967
3412
|
unknownKeys: "passthrough"
|
|
2968
3413
|
});
|
|
2969
3414
|
}
|
|
2970
|
-
|
|
2971
|
-
|
|
3415
|
+
// const AugmentFactory =
|
|
3416
|
+
// <Def extends ZodObjectDef>(def: Def) =>
|
|
3417
|
+
// <Augmentation extends ZodRawShape>(
|
|
3418
|
+
// augmentation: Augmentation
|
|
3419
|
+
// ): ZodObject<
|
|
3420
|
+
// extendShape<ReturnType<Def["shape"]>, Augmentation>,
|
|
3421
|
+
// Def["unknownKeys"],
|
|
3422
|
+
// Def["catchall"]
|
|
3423
|
+
// > => {
|
|
3424
|
+
// return new ZodObject({
|
|
3425
|
+
// ...def,
|
|
3426
|
+
// shape: () => ({
|
|
3427
|
+
// ...def.shape(),
|
|
3428
|
+
// ...augmentation,
|
|
3429
|
+
// }),
|
|
3430
|
+
// }) as any;
|
|
3431
|
+
// };
|
|
3432
|
+
extend(augmentation) {
|
|
3433
|
+
return new _ZodObject({
|
|
3434
|
+
...this._def,
|
|
3435
|
+
shape: () => ({
|
|
3436
|
+
...this._def.shape(),
|
|
3437
|
+
...augmentation
|
|
3438
|
+
})
|
|
3439
|
+
});
|
|
2972
3440
|
}
|
|
2973
3441
|
/**
|
|
2974
3442
|
* Prior to zod@1.0.12 there was a bug in the
|
|
@@ -2979,11 +3447,73 @@ var init_lib = __esm({
|
|
|
2979
3447
|
const merged = new _ZodObject({
|
|
2980
3448
|
unknownKeys: merging._def.unknownKeys,
|
|
2981
3449
|
catchall: merging._def.catchall,
|
|
2982
|
-
shape: () =>
|
|
3450
|
+
shape: () => ({
|
|
3451
|
+
...this._def.shape(),
|
|
3452
|
+
...merging._def.shape()
|
|
3453
|
+
}),
|
|
2983
3454
|
typeName: ZodFirstPartyTypeKind.ZodObject
|
|
2984
3455
|
});
|
|
2985
3456
|
return merged;
|
|
2986
3457
|
}
|
|
3458
|
+
// merge<
|
|
3459
|
+
// Incoming extends AnyZodObject,
|
|
3460
|
+
// Augmentation extends Incoming["shape"],
|
|
3461
|
+
// NewOutput extends {
|
|
3462
|
+
// [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
|
|
3463
|
+
// ? Augmentation[k]["_output"]
|
|
3464
|
+
// : k extends keyof Output
|
|
3465
|
+
// ? Output[k]
|
|
3466
|
+
// : never;
|
|
3467
|
+
// },
|
|
3468
|
+
// NewInput extends {
|
|
3469
|
+
// [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
|
|
3470
|
+
// ? Augmentation[k]["_input"]
|
|
3471
|
+
// : k extends keyof Input
|
|
3472
|
+
// ? Input[k]
|
|
3473
|
+
// : never;
|
|
3474
|
+
// }
|
|
3475
|
+
// >(
|
|
3476
|
+
// merging: Incoming
|
|
3477
|
+
// ): ZodObject<
|
|
3478
|
+
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
3479
|
+
// Incoming["_def"]["unknownKeys"],
|
|
3480
|
+
// Incoming["_def"]["catchall"],
|
|
3481
|
+
// NewOutput,
|
|
3482
|
+
// NewInput
|
|
3483
|
+
// > {
|
|
3484
|
+
// const merged: any = new ZodObject({
|
|
3485
|
+
// unknownKeys: merging._def.unknownKeys,
|
|
3486
|
+
// catchall: merging._def.catchall,
|
|
3487
|
+
// shape: () =>
|
|
3488
|
+
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
3489
|
+
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
3490
|
+
// }) as any;
|
|
3491
|
+
// return merged;
|
|
3492
|
+
// }
|
|
3493
|
+
setKey(key, schema4) {
|
|
3494
|
+
return this.augment({ [key]: schema4 });
|
|
3495
|
+
}
|
|
3496
|
+
// merge<Incoming extends AnyZodObject>(
|
|
3497
|
+
// merging: Incoming
|
|
3498
|
+
// ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
|
|
3499
|
+
// ZodObject<
|
|
3500
|
+
// extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
|
|
3501
|
+
// Incoming["_def"]["unknownKeys"],
|
|
3502
|
+
// Incoming["_def"]["catchall"]
|
|
3503
|
+
// > {
|
|
3504
|
+
// // const mergedShape = objectUtil.mergeShapes(
|
|
3505
|
+
// // this._def.shape(),
|
|
3506
|
+
// // merging._def.shape()
|
|
3507
|
+
// // );
|
|
3508
|
+
// const merged: any = new ZodObject({
|
|
3509
|
+
// unknownKeys: merging._def.unknownKeys,
|
|
3510
|
+
// catchall: merging._def.catchall,
|
|
3511
|
+
// shape: () =>
|
|
3512
|
+
// objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
3513
|
+
// typeName: ZodFirstPartyTypeKind.ZodObject,
|
|
3514
|
+
// }) as any;
|
|
3515
|
+
// return merged;
|
|
3516
|
+
// }
|
|
2987
3517
|
catchall(index4) {
|
|
2988
3518
|
return new _ZodObject({
|
|
2989
3519
|
...this._def,
|
|
@@ -2992,9 +3522,10 @@ var init_lib = __esm({
|
|
|
2992
3522
|
}
|
|
2993
3523
|
pick(mask) {
|
|
2994
3524
|
const shape = {};
|
|
2995
|
-
util.objectKeys(mask).
|
|
2996
|
-
if (this.shape[key])
|
|
3525
|
+
util.objectKeys(mask).forEach((key) => {
|
|
3526
|
+
if (mask[key] && this.shape[key]) {
|
|
2997
3527
|
shape[key] = this.shape[key];
|
|
3528
|
+
}
|
|
2998
3529
|
});
|
|
2999
3530
|
return new _ZodObject({
|
|
3000
3531
|
...this._def,
|
|
@@ -3003,8 +3534,8 @@ var init_lib = __esm({
|
|
|
3003
3534
|
}
|
|
3004
3535
|
omit(mask) {
|
|
3005
3536
|
const shape = {};
|
|
3006
|
-
util.objectKeys(this.shape).
|
|
3007
|
-
if (
|
|
3537
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
3538
|
+
if (!mask[key]) {
|
|
3008
3539
|
shape[key] = this.shape[key];
|
|
3009
3540
|
}
|
|
3010
3541
|
});
|
|
@@ -3013,29 +3544,22 @@ var init_lib = __esm({
|
|
|
3013
3544
|
shape: () => shape
|
|
3014
3545
|
});
|
|
3015
3546
|
}
|
|
3547
|
+
/**
|
|
3548
|
+
* @deprecated
|
|
3549
|
+
*/
|
|
3016
3550
|
deepPartial() {
|
|
3017
3551
|
return deepPartialify(this);
|
|
3018
3552
|
}
|
|
3019
3553
|
partial(mask) {
|
|
3020
3554
|
const newShape = {};
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
newShape[key] = this.shape[key].optional();
|
|
3027
|
-
}
|
|
3028
|
-
});
|
|
3029
|
-
return new _ZodObject({
|
|
3030
|
-
...this._def,
|
|
3031
|
-
shape: () => newShape
|
|
3032
|
-
});
|
|
3033
|
-
} else {
|
|
3034
|
-
for (const key in this.shape) {
|
|
3035
|
-
const fieldSchema = this.shape[key];
|
|
3555
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
3556
|
+
const fieldSchema = this.shape[key];
|
|
3557
|
+
if (mask && !mask[key]) {
|
|
3558
|
+
newShape[key] = fieldSchema;
|
|
3559
|
+
} else {
|
|
3036
3560
|
newShape[key] = fieldSchema.optional();
|
|
3037
3561
|
}
|
|
3038
|
-
}
|
|
3562
|
+
});
|
|
3039
3563
|
return new _ZodObject({
|
|
3040
3564
|
...this._def,
|
|
3041
3565
|
shape: () => newShape
|
|
@@ -3043,21 +3567,10 @@ var init_lib = __esm({
|
|
|
3043
3567
|
}
|
|
3044
3568
|
required(mask) {
|
|
3045
3569
|
const newShape = {};
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
} else {
|
|
3051
|
-
const fieldSchema = this.shape[key];
|
|
3052
|
-
let newField = fieldSchema;
|
|
3053
|
-
while (newField instanceof ZodOptional) {
|
|
3054
|
-
newField = newField._def.innerType;
|
|
3055
|
-
}
|
|
3056
|
-
newShape[key] = newField;
|
|
3057
|
-
}
|
|
3058
|
-
});
|
|
3059
|
-
} else {
|
|
3060
|
-
for (const key in this.shape) {
|
|
3570
|
+
util.objectKeys(this.shape).forEach((key) => {
|
|
3571
|
+
if (mask && !mask[key]) {
|
|
3572
|
+
newShape[key] = this.shape[key];
|
|
3573
|
+
} else {
|
|
3061
3574
|
const fieldSchema = this.shape[key];
|
|
3062
3575
|
let newField = fieldSchema;
|
|
3063
3576
|
while (newField instanceof ZodOptional) {
|
|
@@ -3065,7 +3578,7 @@ var init_lib = __esm({
|
|
|
3065
3578
|
}
|
|
3066
3579
|
newShape[key] = newField;
|
|
3067
3580
|
}
|
|
3068
|
-
}
|
|
3581
|
+
});
|
|
3069
3582
|
return new _ZodObject({
|
|
3070
3583
|
...this._def,
|
|
3071
3584
|
shape: () => newShape
|
|
@@ -3203,15 +3716,25 @@ var init_lib = __esm({
|
|
|
3203
3716
|
} else if (type instanceof ZodEnum) {
|
|
3204
3717
|
return type.options;
|
|
3205
3718
|
} else if (type instanceof ZodNativeEnum) {
|
|
3206
|
-
return
|
|
3719
|
+
return util.objectValues(type.enum);
|
|
3207
3720
|
} else if (type instanceof ZodDefault) {
|
|
3208
3721
|
return getDiscriminator(type._def.innerType);
|
|
3209
3722
|
} else if (type instanceof ZodUndefined) {
|
|
3210
3723
|
return [void 0];
|
|
3211
3724
|
} else if (type instanceof ZodNull) {
|
|
3212
3725
|
return [null];
|
|
3726
|
+
} else if (type instanceof ZodOptional) {
|
|
3727
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
|
3728
|
+
} else if (type instanceof ZodNullable) {
|
|
3729
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
|
3730
|
+
} else if (type instanceof ZodBranded) {
|
|
3731
|
+
return getDiscriminator(type.unwrap());
|
|
3732
|
+
} else if (type instanceof ZodReadonly) {
|
|
3733
|
+
return getDiscriminator(type.unwrap());
|
|
3734
|
+
} else if (type instanceof ZodCatch) {
|
|
3735
|
+
return getDiscriminator(type._def.innerType);
|
|
3213
3736
|
} else {
|
|
3214
|
-
return
|
|
3737
|
+
return [];
|
|
3215
3738
|
}
|
|
3216
3739
|
};
|
|
3217
3740
|
ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
@@ -3271,7 +3794,7 @@ var init_lib = __esm({
|
|
|
3271
3794
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
3272
3795
|
for (const type of options) {
|
|
3273
3796
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
3274
|
-
if (!discriminatorValues) {
|
|
3797
|
+
if (!discriminatorValues.length) {
|
|
3275
3798
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
3276
3799
|
}
|
|
3277
3800
|
for (const value of discriminatorValues) {
|
|
@@ -3375,7 +3898,7 @@ var init_lib = __esm({
|
|
|
3375
3898
|
});
|
|
3376
3899
|
status.dirty();
|
|
3377
3900
|
}
|
|
3378
|
-
const items = ctx.data.map((item, itemIndex) => {
|
|
3901
|
+
const items = [...ctx.data].map((item, itemIndex) => {
|
|
3379
3902
|
const schema4 = this._def.items[itemIndex] || this._def.rest;
|
|
3380
3903
|
if (!schema4)
|
|
3381
3904
|
return null;
|
|
@@ -3433,7 +3956,8 @@ var init_lib = __esm({
|
|
|
3433
3956
|
for (const key in ctx.data) {
|
|
3434
3957
|
pairs.push({
|
|
3435
3958
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
3436
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
3959
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
3960
|
+
alwaysSet: key in ctx.data
|
|
3437
3961
|
});
|
|
3438
3962
|
}
|
|
3439
3963
|
if (ctx.common.async) {
|
|
@@ -3463,6 +3987,12 @@ var init_lib = __esm({
|
|
|
3463
3987
|
}
|
|
3464
3988
|
};
|
|
3465
3989
|
ZodMap = class extends ZodType {
|
|
3990
|
+
get keySchema() {
|
|
3991
|
+
return this._def.keyType;
|
|
3992
|
+
}
|
|
3993
|
+
get valueSchema() {
|
|
3994
|
+
return this._def.valueType;
|
|
3995
|
+
}
|
|
3466
3996
|
_parse(input) {
|
|
3467
3997
|
const { status, ctx } = this._processInputParams(input);
|
|
3468
3998
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
@@ -3657,27 +4187,29 @@ var init_lib = __esm({
|
|
|
3657
4187
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
3658
4188
|
const fn = ctx.data;
|
|
3659
4189
|
if (this._def.returns instanceof ZodPromise) {
|
|
3660
|
-
|
|
4190
|
+
const me = this;
|
|
4191
|
+
return OK(async function(...args) {
|
|
3661
4192
|
const error2 = new ZodError([]);
|
|
3662
|
-
const parsedArgs = await
|
|
4193
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
3663
4194
|
error2.addIssue(makeArgsIssue(args, e));
|
|
3664
4195
|
throw error2;
|
|
3665
4196
|
});
|
|
3666
|
-
const result = await fn
|
|
3667
|
-
const parsedReturns = await
|
|
4197
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
4198
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
|
|
3668
4199
|
error2.addIssue(makeReturnsIssue(result, e));
|
|
3669
4200
|
throw error2;
|
|
3670
4201
|
});
|
|
3671
4202
|
return parsedReturns;
|
|
3672
4203
|
});
|
|
3673
4204
|
} else {
|
|
3674
|
-
|
|
3675
|
-
|
|
4205
|
+
const me = this;
|
|
4206
|
+
return OK(function(...args) {
|
|
4207
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
3676
4208
|
if (!parsedArgs.success) {
|
|
3677
4209
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
3678
4210
|
}
|
|
3679
|
-
const result = fn
|
|
3680
|
-
const parsedReturns =
|
|
4211
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
4212
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
3681
4213
|
if (!parsedReturns.success) {
|
|
3682
4214
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
3683
4215
|
}
|
|
@@ -3742,6 +4274,7 @@ var init_lib = __esm({
|
|
|
3742
4274
|
if (input.data !== this._def.value) {
|
|
3743
4275
|
const ctx = this._getOrReturnCtx(input);
|
|
3744
4276
|
addIssueToContext(ctx, {
|
|
4277
|
+
received: ctx.data,
|
|
3745
4278
|
code: ZodIssueCode.invalid_literal,
|
|
3746
4279
|
expected: this._def.value
|
|
3747
4280
|
});
|
|
@@ -3760,7 +4293,11 @@ var init_lib = __esm({
|
|
|
3760
4293
|
...processCreateParams(params)
|
|
3761
4294
|
});
|
|
3762
4295
|
};
|
|
3763
|
-
ZodEnum = class extends ZodType {
|
|
4296
|
+
ZodEnum = class _ZodEnum extends ZodType {
|
|
4297
|
+
constructor() {
|
|
4298
|
+
super(...arguments);
|
|
4299
|
+
_ZodEnum_cache.set(this, void 0);
|
|
4300
|
+
}
|
|
3764
4301
|
_parse(input) {
|
|
3765
4302
|
if (typeof input.data !== "string") {
|
|
3766
4303
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3772,7 +4309,10 @@ var init_lib = __esm({
|
|
|
3772
4309
|
});
|
|
3773
4310
|
return INVALID;
|
|
3774
4311
|
}
|
|
3775
|
-
if (this
|
|
4312
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
|
4313
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
|
4314
|
+
}
|
|
4315
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
|
3776
4316
|
const ctx = this._getOrReturnCtx(input);
|
|
3777
4317
|
const expectedValues = this._def.values;
|
|
3778
4318
|
addIssueToContext(ctx, {
|
|
@@ -3808,9 +4348,26 @@ var init_lib = __esm({
|
|
|
3808
4348
|
}
|
|
3809
4349
|
return enumValues;
|
|
3810
4350
|
}
|
|
4351
|
+
extract(values, newDef = this._def) {
|
|
4352
|
+
return _ZodEnum.create(values, {
|
|
4353
|
+
...this._def,
|
|
4354
|
+
...newDef
|
|
4355
|
+
});
|
|
4356
|
+
}
|
|
4357
|
+
exclude(values, newDef = this._def) {
|
|
4358
|
+
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
4359
|
+
...this._def,
|
|
4360
|
+
...newDef
|
|
4361
|
+
});
|
|
4362
|
+
}
|
|
3811
4363
|
};
|
|
4364
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
3812
4365
|
ZodEnum.create = createZodEnum;
|
|
3813
4366
|
ZodNativeEnum = class extends ZodType {
|
|
4367
|
+
constructor() {
|
|
4368
|
+
super(...arguments);
|
|
4369
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
4370
|
+
}
|
|
3814
4371
|
_parse(input) {
|
|
3815
4372
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
3816
4373
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3823,7 +4380,10 @@ var init_lib = __esm({
|
|
|
3823
4380
|
});
|
|
3824
4381
|
return INVALID;
|
|
3825
4382
|
}
|
|
3826
|
-
if (
|
|
4383
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
|
4384
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
|
4385
|
+
}
|
|
4386
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
|
3827
4387
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3828
4388
|
addIssueToContext(ctx, {
|
|
3829
4389
|
received: ctx.data,
|
|
@@ -3838,6 +4398,7 @@ var init_lib = __esm({
|
|
|
3838
4398
|
return this._def.values;
|
|
3839
4399
|
}
|
|
3840
4400
|
};
|
|
4401
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
3841
4402
|
ZodNativeEnum.create = (values, params) => {
|
|
3842
4403
|
return new ZodNativeEnum({
|
|
3843
4404
|
values,
|
|
@@ -3846,6 +4407,9 @@ var init_lib = __esm({
|
|
|
3846
4407
|
});
|
|
3847
4408
|
};
|
|
3848
4409
|
ZodPromise = class extends ZodType {
|
|
4410
|
+
unwrap() {
|
|
4411
|
+
return this._def.type;
|
|
4412
|
+
}
|
|
3849
4413
|
_parse(input) {
|
|
3850
4414
|
const { ctx } = this._processInputParams(input);
|
|
3851
4415
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
@@ -3882,24 +4446,6 @@ var init_lib = __esm({
|
|
|
3882
4446
|
_parse(input) {
|
|
3883
4447
|
const { status, ctx } = this._processInputParams(input);
|
|
3884
4448
|
const effect = this._def.effect || null;
|
|
3885
|
-
if (effect.type === "preprocess") {
|
|
3886
|
-
const processed = effect.transform(ctx.data);
|
|
3887
|
-
if (ctx.common.async) {
|
|
3888
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
3889
|
-
return this._def.schema._parseAsync({
|
|
3890
|
-
data: processed2,
|
|
3891
|
-
path: ctx.path,
|
|
3892
|
-
parent: ctx
|
|
3893
|
-
});
|
|
3894
|
-
});
|
|
3895
|
-
} else {
|
|
3896
|
-
return this._def.schema._parseSync({
|
|
3897
|
-
data: processed,
|
|
3898
|
-
path: ctx.path,
|
|
3899
|
-
parent: ctx
|
|
3900
|
-
});
|
|
3901
|
-
}
|
|
3902
|
-
}
|
|
3903
4449
|
const checkCtx = {
|
|
3904
4450
|
addIssue: (arg) => {
|
|
3905
4451
|
addIssueToContext(ctx, arg);
|
|
@@ -3914,6 +4460,42 @@ var init_lib = __esm({
|
|
|
3914
4460
|
}
|
|
3915
4461
|
};
|
|
3916
4462
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
4463
|
+
if (effect.type === "preprocess") {
|
|
4464
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
4465
|
+
if (ctx.common.async) {
|
|
4466
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
4467
|
+
if (status.value === "aborted")
|
|
4468
|
+
return INVALID;
|
|
4469
|
+
const result = await this._def.schema._parseAsync({
|
|
4470
|
+
data: processed2,
|
|
4471
|
+
path: ctx.path,
|
|
4472
|
+
parent: ctx
|
|
4473
|
+
});
|
|
4474
|
+
if (result.status === "aborted")
|
|
4475
|
+
return INVALID;
|
|
4476
|
+
if (result.status === "dirty")
|
|
4477
|
+
return DIRTY(result.value);
|
|
4478
|
+
if (status.value === "dirty")
|
|
4479
|
+
return DIRTY(result.value);
|
|
4480
|
+
return result;
|
|
4481
|
+
});
|
|
4482
|
+
} else {
|
|
4483
|
+
if (status.value === "aborted")
|
|
4484
|
+
return INVALID;
|
|
4485
|
+
const result = this._def.schema._parseSync({
|
|
4486
|
+
data: processed,
|
|
4487
|
+
path: ctx.path,
|
|
4488
|
+
parent: ctx
|
|
4489
|
+
});
|
|
4490
|
+
if (result.status === "aborted")
|
|
4491
|
+
return INVALID;
|
|
4492
|
+
if (result.status === "dirty")
|
|
4493
|
+
return DIRTY(result.value);
|
|
4494
|
+
if (status.value === "dirty")
|
|
4495
|
+
return DIRTY(result.value);
|
|
4496
|
+
return result;
|
|
4497
|
+
}
|
|
4498
|
+
}
|
|
3917
4499
|
if (effect.type === "refinement") {
|
|
3918
4500
|
const executeRefinement = (acc) => {
|
|
3919
4501
|
const result = effect.refinement(acc, checkCtx);
|
|
@@ -4056,26 +4638,45 @@ var init_lib = __esm({
|
|
|
4056
4638
|
ZodCatch = class extends ZodType {
|
|
4057
4639
|
_parse(input) {
|
|
4058
4640
|
const { ctx } = this._processInputParams(input);
|
|
4641
|
+
const newCtx = {
|
|
4642
|
+
...ctx,
|
|
4643
|
+
common: {
|
|
4644
|
+
...ctx.common,
|
|
4645
|
+
issues: []
|
|
4646
|
+
}
|
|
4647
|
+
};
|
|
4059
4648
|
const result = this._def.innerType._parse({
|
|
4060
|
-
data:
|
|
4061
|
-
path:
|
|
4062
|
-
parent:
|
|
4649
|
+
data: newCtx.data,
|
|
4650
|
+
path: newCtx.path,
|
|
4651
|
+
parent: {
|
|
4652
|
+
...newCtx
|
|
4653
|
+
}
|
|
4063
4654
|
});
|
|
4064
4655
|
if (isAsync(result)) {
|
|
4065
4656
|
return result.then((result2) => {
|
|
4066
4657
|
return {
|
|
4067
4658
|
status: "valid",
|
|
4068
|
-
value: result2.status === "valid" ? result2.value : this._def.
|
|
4659
|
+
value: result2.status === "valid" ? result2.value : this._def.catchValue({
|
|
4660
|
+
get error() {
|
|
4661
|
+
return new ZodError(newCtx.common.issues);
|
|
4662
|
+
},
|
|
4663
|
+
input: newCtx.data
|
|
4664
|
+
})
|
|
4069
4665
|
};
|
|
4070
4666
|
});
|
|
4071
4667
|
} else {
|
|
4072
4668
|
return {
|
|
4073
4669
|
status: "valid",
|
|
4074
|
-
value: result.status === "valid" ? result.value : this._def.
|
|
4670
|
+
value: result.status === "valid" ? result.value : this._def.catchValue({
|
|
4671
|
+
get error() {
|
|
4672
|
+
return new ZodError(newCtx.common.issues);
|
|
4673
|
+
},
|
|
4674
|
+
input: newCtx.data
|
|
4675
|
+
})
|
|
4075
4676
|
};
|
|
4076
4677
|
}
|
|
4077
4678
|
}
|
|
4078
|
-
|
|
4679
|
+
removeCatch() {
|
|
4079
4680
|
return this._def.innerType;
|
|
4080
4681
|
}
|
|
4081
4682
|
};
|
|
@@ -4083,7 +4684,7 @@ var init_lib = __esm({
|
|
|
4083
4684
|
return new ZodCatch({
|
|
4084
4685
|
innerType: type,
|
|
4085
4686
|
typeName: ZodFirstPartyTypeKind.ZodCatch,
|
|
4086
|
-
|
|
4687
|
+
catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
|
|
4087
4688
|
...processCreateParams(params)
|
|
4088
4689
|
});
|
|
4089
4690
|
};
|
|
@@ -4178,6 +4779,25 @@ var init_lib = __esm({
|
|
|
4178
4779
|
});
|
|
4179
4780
|
}
|
|
4180
4781
|
};
|
|
4782
|
+
ZodReadonly = class extends ZodType {
|
|
4783
|
+
_parse(input) {
|
|
4784
|
+
const result = this._def.innerType._parse(input);
|
|
4785
|
+
if (isValid(result)) {
|
|
4786
|
+
result.value = Object.freeze(result.value);
|
|
4787
|
+
}
|
|
4788
|
+
return result;
|
|
4789
|
+
}
|
|
4790
|
+
unwrap() {
|
|
4791
|
+
return this._def.innerType;
|
|
4792
|
+
}
|
|
4793
|
+
};
|
|
4794
|
+
ZodReadonly.create = (type, params) => {
|
|
4795
|
+
return new ZodReadonly({
|
|
4796
|
+
innerType: type,
|
|
4797
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
4798
|
+
...processCreateParams(params)
|
|
4799
|
+
});
|
|
4800
|
+
};
|
|
4181
4801
|
late = {
|
|
4182
4802
|
object: ZodObject.lazycreate
|
|
4183
4803
|
};
|
|
@@ -4217,6 +4837,7 @@ var init_lib = __esm({
|
|
|
4217
4837
|
ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
|
|
4218
4838
|
ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
|
|
4219
4839
|
ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
|
|
4840
|
+
ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
|
|
4220
4841
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
4221
4842
|
stringType = ZodString.create;
|
|
4222
4843
|
numberType = ZodNumber.create;
|
|
@@ -4255,7 +4876,10 @@ var init_lib = __esm({
|
|
|
4255
4876
|
coerce = {
|
|
4256
4877
|
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
4257
4878
|
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
4258
|
-
boolean: (arg) => ZodBoolean.create({
|
|
4879
|
+
boolean: (arg) => ZodBoolean.create({
|
|
4880
|
+
...arg,
|
|
4881
|
+
coerce: true
|
|
4882
|
+
}),
|
|
4259
4883
|
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
4260
4884
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
4261
4885
|
};
|
|
@@ -5077,7 +5701,6 @@ var init_utils = __esm({
|
|
|
5077
5701
|
init_mysqlSchema();
|
|
5078
5702
|
init_pgSchema();
|
|
5079
5703
|
init_sqliteSchema();
|
|
5080
|
-
init_source();
|
|
5081
5704
|
init_global();
|
|
5082
5705
|
copy = (it) => {
|
|
5083
5706
|
return JSON.parse(JSON.stringify(it));
|
|
@@ -5282,10 +5905,9 @@ var sqlToStr;
|
|
|
5282
5905
|
var init_serializer = __esm({
|
|
5283
5906
|
"src/serializer/index.ts"() {
|
|
5284
5907
|
"use strict";
|
|
5285
|
-
init_source();
|
|
5286
5908
|
init_views();
|
|
5287
|
-
sqlToStr = (
|
|
5288
|
-
return
|
|
5909
|
+
sqlToStr = (sql) => {
|
|
5910
|
+
return sql.toQuery({
|
|
5289
5911
|
escapeName: () => {
|
|
5290
5912
|
throw new Error("we don't support params for `sql` default values");
|
|
5291
5913
|
},
|
|
@@ -5570,6 +6192,33 @@ var init_cli = __esm({
|
|
|
5570
6192
|
}
|
|
5571
6193
|
});
|
|
5572
6194
|
|
|
6195
|
+
// src/cli/validations/studio.ts
|
|
6196
|
+
var credentials, studioCliParams, studioConfig;
|
|
6197
|
+
var init_studio = __esm({
|
|
6198
|
+
"src/cli/validations/studio.ts"() {
|
|
6199
|
+
"use strict";
|
|
6200
|
+
init_lib();
|
|
6201
|
+
init_mysql();
|
|
6202
|
+
init_sqlite();
|
|
6203
|
+
init_schemaValidator();
|
|
6204
|
+
init_pg();
|
|
6205
|
+
credentials = intersectionType(
|
|
6206
|
+
postgresCredentials,
|
|
6207
|
+
mysqlCredentials,
|
|
6208
|
+
sqliteCredentials
|
|
6209
|
+
);
|
|
6210
|
+
studioCliParams = objectType({
|
|
6211
|
+
port: coerce.number().optional().default(4983),
|
|
6212
|
+
host: stringType().optional().default("127.0.0.1"),
|
|
6213
|
+
config: stringType().optional()
|
|
6214
|
+
});
|
|
6215
|
+
studioConfig = objectType({
|
|
6216
|
+
dialect: dialect3,
|
|
6217
|
+
schema: unionType([stringType(), stringType().array()])
|
|
6218
|
+
});
|
|
6219
|
+
}
|
|
6220
|
+
});
|
|
6221
|
+
|
|
5573
6222
|
// src/cli/commands/_es5.ts
|
|
5574
6223
|
var es5_exports = {};
|
|
5575
6224
|
__export(es5_exports, {
|
|
@@ -6332,9 +6981,9 @@ var require_src2 = __commonJS({
|
|
|
6332
6981
|
}
|
|
6333
6982
|
});
|
|
6334
6983
|
|
|
6335
|
-
// node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.19.
|
|
6984
|
+
// node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.19.12/node_modules/esbuild-register/dist/node.js
|
|
6336
6985
|
var require_node2 = __commonJS({
|
|
6337
|
-
"node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.19.
|
|
6986
|
+
"node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.19.12/node_modules/esbuild-register/dist/node.js"(exports) {
|
|
6338
6987
|
"use strict";
|
|
6339
6988
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6340
6989
|
function _interopRequireDefault2(obj) {
|
|
@@ -8599,13 +9248,13 @@ var require_node2 = __commonJS({
|
|
|
8599
9248
|
}
|
|
8600
9249
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
8601
9250
|
try {
|
|
8602
|
-
var
|
|
8603
|
-
var value =
|
|
9251
|
+
var info2 = gen[key](arg);
|
|
9252
|
+
var value = info2.value;
|
|
8604
9253
|
} catch (error2) {
|
|
8605
9254
|
reject(error2);
|
|
8606
9255
|
return;
|
|
8607
9256
|
}
|
|
8608
|
-
if (
|
|
9257
|
+
if (info2.done) {
|
|
8609
9258
|
resolve(value);
|
|
8610
9259
|
} else {
|
|
8611
9260
|
Promise.resolve(value).then(_next, _throw);
|
|
@@ -11190,12 +11839,11 @@ var require_node2 = __commonJS({
|
|
|
11190
11839
|
});
|
|
11191
11840
|
|
|
11192
11841
|
// src/cli/commands/utils.ts
|
|
11193
|
-
var import_hanji2, assertES5, safeRegister;
|
|
11842
|
+
var import_hanji2, assertES5, safeRegister, migrateCliParams, migrateConfig;
|
|
11194
11843
|
var init_utils2 = __esm({
|
|
11195
11844
|
"src/cli/commands/utils.ts"() {
|
|
11196
11845
|
"use strict";
|
|
11197
11846
|
init_serializer();
|
|
11198
|
-
init_source();
|
|
11199
11847
|
init_views();
|
|
11200
11848
|
import_hanji2 = __toESM(require_hanji());
|
|
11201
11849
|
init_global();
|
|
@@ -11203,8 +11851,11 @@ var init_utils2 = __esm({
|
|
|
11203
11851
|
init_pg();
|
|
11204
11852
|
init_sqlite();
|
|
11205
11853
|
init_common();
|
|
11854
|
+
init_schemaValidator();
|
|
11206
11855
|
init_cli();
|
|
11207
11856
|
init_outputs();
|
|
11857
|
+
init_studio();
|
|
11858
|
+
init_lib();
|
|
11208
11859
|
assertES5 = async (unregister) => {
|
|
11209
11860
|
try {
|
|
11210
11861
|
init_es5();
|
|
@@ -11246,6 +11897,17 @@ var init_utils2 = __esm({
|
|
|
11246
11897
|
await assertES5(res.unregister);
|
|
11247
11898
|
return res;
|
|
11248
11899
|
};
|
|
11900
|
+
migrateCliParams = objectType({
|
|
11901
|
+
config: stringType().optional()
|
|
11902
|
+
});
|
|
11903
|
+
migrateConfig = objectType({
|
|
11904
|
+
dialect: dialect3,
|
|
11905
|
+
out: stringType().optional().default("drizzle"),
|
|
11906
|
+
migrations: objectType({
|
|
11907
|
+
table: stringType().optional(),
|
|
11908
|
+
schema: stringType().optional()
|
|
11909
|
+
}).optional()
|
|
11910
|
+
});
|
|
11249
11911
|
}
|
|
11250
11912
|
});
|
|
11251
11913
|
|
|
@@ -12172,10 +12834,10 @@ var require_brace_expansion = __commonJS({
|
|
|
12172
12834
|
}
|
|
12173
12835
|
});
|
|
12174
12836
|
|
|
12175
|
-
// node_modules/.pnpm/minimatch@7.4.
|
|
12837
|
+
// node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/brace-expressions.js
|
|
12176
12838
|
var posixClasses, braceEscape, regexpEscape, rangesToString, parseClass;
|
|
12177
12839
|
var init_brace_expressions = __esm({
|
|
12178
|
-
"node_modules/.pnpm/minimatch@7.4.
|
|
12840
|
+
"node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/brace-expressions.js"() {
|
|
12179
12841
|
posixClasses = {
|
|
12180
12842
|
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
12181
12843
|
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
@@ -12287,30 +12949,30 @@ var init_brace_expressions = __esm({
|
|
|
12287
12949
|
}
|
|
12288
12950
|
});
|
|
12289
12951
|
|
|
12290
|
-
// node_modules/.pnpm/minimatch@7.4.
|
|
12952
|
+
// node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/escape.js
|
|
12291
12953
|
var escape;
|
|
12292
12954
|
var init_escape = __esm({
|
|
12293
|
-
"node_modules/.pnpm/minimatch@7.4.
|
|
12955
|
+
"node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/escape.js"() {
|
|
12294
12956
|
escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
12295
12957
|
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
12296
12958
|
};
|
|
12297
12959
|
}
|
|
12298
12960
|
});
|
|
12299
12961
|
|
|
12300
|
-
// node_modules/.pnpm/minimatch@7.4.
|
|
12962
|
+
// node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/unescape.js
|
|
12301
12963
|
var unescape;
|
|
12302
12964
|
var init_unescape = __esm({
|
|
12303
|
-
"node_modules/.pnpm/minimatch@7.4.
|
|
12965
|
+
"node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/unescape.js"() {
|
|
12304
12966
|
unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
12305
12967
|
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
12306
12968
|
};
|
|
12307
12969
|
}
|
|
12308
12970
|
});
|
|
12309
12971
|
|
|
12310
|
-
// node_modules/.pnpm/minimatch@7.4.
|
|
12972
|
+
// node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/index.js
|
|
12311
12973
|
var import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path, sep, GLOBSTAR, plTypes, qmark, star, twoStarDot, twoStarNoDot, charSet, reSpecials, addPatternStartSet, filter, ext, defaults, braceExpand, MAX_PATTERN_LENGTH, assertValidPattern, makeRe, match, globUnescape, globMagic, regExpEscape, Minimatch;
|
|
12312
12974
|
var init_mjs = __esm({
|
|
12313
|
-
"node_modules/.pnpm/minimatch@7.4.
|
|
12975
|
+
"node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/index.js"() {
|
|
12314
12976
|
import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
12315
12977
|
init_brace_expressions();
|
|
12316
12978
|
init_escape();
|
|
@@ -16950,12 +17612,12 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
16950
17612
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
|
|
16951
17613
|
const tableToNameWithSchema = schemaTo ? `"${schemaTo}"."${tableTo}"` : `"${tableTo}"`;
|
|
16952
17614
|
const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
|
|
16953
|
-
let
|
|
16954
|
-
|
|
16955
|
-
|
|
16956
|
-
|
|
16957
|
-
|
|
16958
|
-
return
|
|
17615
|
+
let sql = "DO $$ BEGIN\n";
|
|
17616
|
+
sql += " " + alterStatement + ";\n";
|
|
17617
|
+
sql += "EXCEPTION\n";
|
|
17618
|
+
sql += " WHEN duplicate_object THEN null;\n";
|
|
17619
|
+
sql += "END $$;\n";
|
|
17620
|
+
return sql;
|
|
16959
17621
|
}
|
|
16960
17622
|
};
|
|
16961
17623
|
SqliteCreateForeignKeyConvertor = class extends Convertor {
|
|
@@ -17001,7 +17663,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17001
17663
|
const newFk = PgSquasher.unsquashFK(statement.data);
|
|
17002
17664
|
const oldFk = PgSquasher.unsquashFK(statement.oldFkey);
|
|
17003
17665
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
|
|
17004
|
-
let
|
|
17666
|
+
let sql = `ALTER TABLE ${tableNameWithSchema} DROP CONSTRAINT "${oldFk.name}";
|
|
17005
17667
|
`;
|
|
17006
17668
|
const onDeleteStatement = newFk.onDelete ? ` ON DELETE ${newFk.onDelete}` : "";
|
|
17007
17669
|
const onUpdateStatement = newFk.onUpdate ? ` ON UPDATE ${newFk.onUpdate}` : "";
|
|
@@ -17010,12 +17672,12 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
|
17010
17672
|
const tableFromNameWithSchema = oldFk.schemaTo ? `"${oldFk.schemaTo}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
|
|
17011
17673
|
const tableToNameWithSchema = newFk.schemaTo ? `"${newFk.schemaTo}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
|
|
17012
17674
|
const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
|
|
17013
|
-
|
|
17014
|
-
|
|
17015
|
-
|
|
17016
|
-
|
|
17017
|
-
|
|
17018
|
-
return
|
|
17675
|
+
sql += "DO $$ BEGIN\n";
|
|
17676
|
+
sql += " " + alterStatement + ";\n";
|
|
17677
|
+
sql += "EXCEPTION\n";
|
|
17678
|
+
sql += " WHEN duplicate_object THEN null;\n";
|
|
17679
|
+
sql += "END $$;\n";
|
|
17680
|
+
return sql;
|
|
17019
17681
|
}
|
|
17020
17682
|
};
|
|
17021
17683
|
SqliteAlterForeignKeyConvertor = class extends Convertor {
|
|
@@ -17389,7 +18051,9 @@ function mapSqlToSqliteType(sqlType) {
|
|
|
17389
18051
|
return "text";
|
|
17390
18052
|
} else if (lowered.startsWith("blob")) {
|
|
17391
18053
|
return "blob";
|
|
17392
|
-
} else if (["real", "double", "double precision", "float"].some(
|
|
18054
|
+
} else if (["real", "double", "double precision", "float"].some(
|
|
18055
|
+
(it) => lowered.startsWith(it)
|
|
18056
|
+
)) {
|
|
17393
18057
|
return "real";
|
|
17394
18058
|
} else {
|
|
17395
18059
|
return "numeric";
|
|
@@ -17574,7 +18238,7 @@ The unique constraint ${source_default.underline.blue(
|
|
|
17574
18238
|
`SELECT
|
|
17575
18239
|
m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
|
|
17576
18240
|
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
|
17577
|
-
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table';
|
|
18241
|
+
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock' and m.tbl_name != 'libsql_wasm_func_table' and m.tbl_name != '__drizzle_migrations';
|
|
17578
18242
|
`
|
|
17579
18243
|
);
|
|
17580
18244
|
const tablesWithSeq = [];
|
|
@@ -19386,7 +20050,6 @@ var logSuggestionsAndReturn = async (connection, statements, json1, json2, meta)
|
|
|
19386
20050
|
init_mysqlSerializer();
|
|
19387
20051
|
init_global();
|
|
19388
20052
|
init_migrate();
|
|
19389
|
-
import { sql } from "drizzle-orm";
|
|
19390
20053
|
var generateDrizzleJson = (imports, prevId) => {
|
|
19391
20054
|
const prepared = prepareFromExports(imports);
|
|
19392
20055
|
const id = randomUUID();
|
|
@@ -19421,6 +20084,7 @@ var generateMigration = async (prev, cur) => {
|
|
|
19421
20084
|
};
|
|
19422
20085
|
var pushSchema = async (imports, drizzleInstance) => {
|
|
19423
20086
|
const { applyPgSnapshotsDiff: applyPgSnapshotsDiff2 } = await Promise.resolve().then(() => (init_snapshotsDiffer(), snapshotsDiffer_exports));
|
|
20087
|
+
const { sql } = await import("drizzle-orm");
|
|
19424
20088
|
const db = {
|
|
19425
20089
|
query: async (query, params) => {
|
|
19426
20090
|
const res = await drizzleInstance.execute(sql.raw(query));
|
|
@@ -19482,6 +20146,7 @@ var generateSQLiteMigration = async (prev, cur) => {
|
|
|
19482
20146
|
};
|
|
19483
20147
|
var pushSQLiteSchema = async (imports, drizzleInstance) => {
|
|
19484
20148
|
const { applySqliteSnapshotsDiff: applySqliteSnapshotsDiff2 } = await Promise.resolve().then(() => (init_snapshotsDiffer(), snapshotsDiffer_exports));
|
|
20149
|
+
const { sql } = await import("drizzle-orm");
|
|
19485
20150
|
const db = {
|
|
19486
20151
|
query: async (query, params) => {
|
|
19487
20152
|
const res = drizzleInstance.all(sql.raw(query));
|
|
@@ -19555,6 +20220,7 @@ var pushMySQLSchema = async (imports, drizzleInstance, databaseName) => {
|
|
|
19555
20220
|
const { applyMysqlSnapshotsDiff: applyMysqlSnapshotsDiff2 } = await Promise.resolve().then(() => (init_snapshotsDiffer(), snapshotsDiffer_exports));
|
|
19556
20221
|
const { logSuggestionsAndReturn: logSuggestionsAndReturn3 } = await Promise.resolve().then(() => (init_mysqlPushUtils(), mysqlPushUtils_exports));
|
|
19557
20222
|
const { mysqlPushIntrospect: mysqlPushIntrospect2 } = await Promise.resolve().then(() => (init_mysqlIntrospect(), mysqlIntrospect_exports));
|
|
20223
|
+
const { sql } = await import("drizzle-orm");
|
|
19558
20224
|
const db = {
|
|
19559
20225
|
query: async (query, params) => {
|
|
19560
20226
|
const res = await drizzleInstance.execute(sql.raw(query));
|