drizzle-kit 0.31.1 → 0.31.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.d.mts +466 -466
- package/api.d.ts +466 -466
- package/api.js +3000 -2347
- package/api.mjs +3003 -2350
- package/bin.cjs +4960 -4606
- package/package.json +10 -11
- package/utils.js +90 -106
- package/utils.mjs +90 -106
package/utils.mjs
CHANGED
@@ -1063,10 +1063,11 @@ function assertUnreachable(x) {
|
|
1063
1063
|
throw new Error("Didn't expect to get here");
|
1064
1064
|
}
|
1065
1065
|
|
1066
|
-
// ../node_modules/.pnpm/zod@3.
|
1066
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/util.js
|
1067
1067
|
var util;
|
1068
1068
|
(function(util2) {
|
1069
|
-
util2.assertEqual = (
|
1069
|
+
util2.assertEqual = (_) => {
|
1070
|
+
};
|
1070
1071
|
function assertIs(_arg) {
|
1071
1072
|
}
|
1072
1073
|
util2.assertIs = assertIs;
|
@@ -1110,7 +1111,7 @@ var util;
|
|
1110
1111
|
}
|
1111
1112
|
return void 0;
|
1112
1113
|
};
|
1113
|
-
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
1114
|
+
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
1114
1115
|
function joinValues(array, separator = " | ") {
|
1115
1116
|
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
1116
1117
|
}
|
@@ -1162,7 +1163,7 @@ var getParsedType = (data) => {
|
|
1162
1163
|
case "string":
|
1163
1164
|
return ZodParsedType.string;
|
1164
1165
|
case "number":
|
1165
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
1166
|
+
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
1166
1167
|
case "boolean":
|
1167
1168
|
return ZodParsedType.boolean;
|
1168
1169
|
case "function":
|
@@ -1195,6 +1196,8 @@ var getParsedType = (data) => {
|
|
1195
1196
|
return ZodParsedType.unknown;
|
1196
1197
|
}
|
1197
1198
|
};
|
1199
|
+
|
1200
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/ZodError.js
|
1198
1201
|
var ZodIssueCode = util.arrayToEnum([
|
1199
1202
|
"invalid_type",
|
1200
1203
|
"invalid_literal",
|
@@ -1306,6 +1309,8 @@ ZodError.create = (issues) => {
|
|
1306
1309
|
const error = new ZodError(issues);
|
1307
1310
|
return error;
|
1308
1311
|
};
|
1312
|
+
|
1313
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/locales/en.js
|
1309
1314
|
var errorMap = (issue, _ctx) => {
|
1310
1315
|
let message;
|
1311
1316
|
switch (issue.code) {
|
@@ -1404,10 +1409,15 @@ var errorMap = (issue, _ctx) => {
|
|
1404
1409
|
}
|
1405
1410
|
return { message };
|
1406
1411
|
};
|
1407
|
-
var
|
1412
|
+
var en_default = errorMap;
|
1413
|
+
|
1414
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/errors.js
|
1415
|
+
var overrideErrorMap = en_default;
|
1408
1416
|
function getErrorMap() {
|
1409
1417
|
return overrideErrorMap;
|
1410
1418
|
}
|
1419
|
+
|
1420
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/parseUtil.js
|
1411
1421
|
var makeIssue = (params) => {
|
1412
1422
|
const { data, path, errorMaps, issueData } = params;
|
1413
1423
|
const fullPath = [...path, ...issueData.path || []];
|
@@ -1446,7 +1456,7 @@ function addIssueToContext(ctx, issueData) {
|
|
1446
1456
|
// then schema-bound map if available
|
1447
1457
|
overrideMap,
|
1448
1458
|
// then global override map
|
1449
|
-
overrideMap ===
|
1459
|
+
overrideMap === en_default ? void 0 : en_default
|
1450
1460
|
// then global default map
|
1451
1461
|
].filter((x) => !!x)
|
1452
1462
|
});
|
@@ -1515,24 +1525,15 @@ var isAborted = (x) => x.status === "aborted";
|
|
1515
1525
|
var isDirty = (x) => x.status === "dirty";
|
1516
1526
|
var isValid = (x) => x.status === "valid";
|
1517
1527
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
1518
|
-
|
1519
|
-
|
1520
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1521
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1522
|
-
}
|
1523
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
1524
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
1525
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1526
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1527
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
1528
|
-
}
|
1528
|
+
|
1529
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/errorUtil.js
|
1529
1530
|
var errorUtil;
|
1530
1531
|
(function(errorUtil2) {
|
1531
1532
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
1532
|
-
errorUtil2.toString = (message) => typeof message === "string" ? message : message
|
1533
|
+
errorUtil2.toString = (message) => typeof message === "string" ? message : message == null ? void 0 : message.message;
|
1533
1534
|
})(errorUtil || (errorUtil = {}));
|
1534
|
-
|
1535
|
-
|
1535
|
+
|
1536
|
+
// ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/types.js
|
1536
1537
|
var ParseInputLazyPath = class {
|
1537
1538
|
constructor(parent, value, path, key) {
|
1538
1539
|
this._cachedPath = [];
|
@@ -1543,7 +1544,7 @@ var ParseInputLazyPath = class {
|
|
1543
1544
|
}
|
1544
1545
|
get path() {
|
1545
1546
|
if (!this._cachedPath.length) {
|
1546
|
-
if (this._key
|
1547
|
+
if (Array.isArray(this._key)) {
|
1547
1548
|
this._cachedPath.push(...this._path, ...this._key);
|
1548
1549
|
} else {
|
1549
1550
|
this._cachedPath.push(...this._path, this._key);
|
@@ -1581,17 +1582,16 @@ function processCreateParams(params) {
|
|
1581
1582
|
if (errorMap2)
|
1582
1583
|
return { errorMap: errorMap2, description };
|
1583
1584
|
const customMap = (iss, ctx) => {
|
1584
|
-
var _a, _b;
|
1585
1585
|
const { message } = params;
|
1586
1586
|
if (iss.code === "invalid_enum_value") {
|
1587
|
-
return { message: message
|
1587
|
+
return { message: message ?? ctx.defaultError };
|
1588
1588
|
}
|
1589
1589
|
if (typeof ctx.data === "undefined") {
|
1590
|
-
return { message:
|
1590
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
1591
1591
|
}
|
1592
1592
|
if (iss.code !== "invalid_type")
|
1593
1593
|
return { message: ctx.defaultError };
|
1594
|
-
return { message:
|
1594
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
1595
1595
|
};
|
1596
1596
|
return { errorMap: customMap, description };
|
1597
1597
|
}
|
@@ -1643,14 +1643,13 @@ var ZodType = class {
|
|
1643
1643
|
throw result.error;
|
1644
1644
|
}
|
1645
1645
|
safeParse(data, params) {
|
1646
|
-
var _a;
|
1647
1646
|
const ctx = {
|
1648
1647
|
common: {
|
1649
1648
|
issues: [],
|
1650
|
-
async: (
|
1651
|
-
contextualErrorMap: params
|
1649
|
+
async: (params == null ? void 0 : params.async) ?? false,
|
1650
|
+
contextualErrorMap: params == null ? void 0 : params.errorMap
|
1652
1651
|
},
|
1653
|
-
path: (params
|
1652
|
+
path: (params == null ? void 0 : params.path) || [],
|
1654
1653
|
schemaErrorMap: this._def.errorMap,
|
1655
1654
|
parent: null,
|
1656
1655
|
data,
|
@@ -1681,7 +1680,7 @@ var ZodType = class {
|
|
1681
1680
|
issues: ctx.common.issues
|
1682
1681
|
};
|
1683
1682
|
} catch (err) {
|
1684
|
-
if ((_b = (_a = err
|
1683
|
+
if ((_b = (_a = err == null ? void 0 : err.message) == null ? void 0 : _a.toLowerCase()) == null ? void 0 : _b.includes("encountered")) {
|
1685
1684
|
this["~standard"].async = true;
|
1686
1685
|
}
|
1687
1686
|
ctx.common = {
|
@@ -1706,10 +1705,10 @@ var ZodType = class {
|
|
1706
1705
|
const ctx = {
|
1707
1706
|
common: {
|
1708
1707
|
issues: [],
|
1709
|
-
contextualErrorMap: params
|
1708
|
+
contextualErrorMap: params == null ? void 0 : params.errorMap,
|
1710
1709
|
async: true
|
1711
1710
|
},
|
1712
|
-
path: (params
|
1711
|
+
path: (params == null ? void 0 : params.path) || [],
|
1713
1712
|
schemaErrorMap: this._def.errorMap,
|
1714
1713
|
parent: null,
|
1715
1714
|
data,
|
@@ -1899,13 +1898,14 @@ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_
|
|
1899
1898
|
var 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])))`;
|
1900
1899
|
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
1901
1900
|
function timeRegexSource(args) {
|
1902
|
-
let
|
1901
|
+
let secondsRegexSource = `[0-5]\\d`;
|
1903
1902
|
if (args.precision) {
|
1904
|
-
|
1903
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
1905
1904
|
} else if (args.precision == null) {
|
1906
|
-
|
1905
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
1907
1906
|
}
|
1908
|
-
|
1907
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
1908
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
1909
1909
|
}
|
1910
1910
|
function timeRegex(args) {
|
1911
1911
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
@@ -1937,12 +1937,14 @@ function isValidJWT(jwt, alg) {
|
|
1937
1937
|
const decoded = JSON.parse(atob(base64));
|
1938
1938
|
if (typeof decoded !== "object" || decoded === null)
|
1939
1939
|
return false;
|
1940
|
-
if (
|
1940
|
+
if ("typ" in decoded && (decoded == null ? void 0 : decoded.typ) !== "JWT")
|
1941
|
+
return false;
|
1942
|
+
if (!decoded.alg)
|
1941
1943
|
return false;
|
1942
1944
|
if (alg && decoded.alg !== alg)
|
1943
1945
|
return false;
|
1944
1946
|
return true;
|
1945
|
-
} catch
|
1947
|
+
} catch {
|
1946
1948
|
return false;
|
1947
1949
|
}
|
1948
1950
|
}
|
@@ -2101,7 +2103,7 @@ var ZodString = class _ZodString extends ZodType {
|
|
2101
2103
|
} else if (check.kind === "url") {
|
2102
2104
|
try {
|
2103
2105
|
new URL(input.data);
|
2104
|
-
} catch
|
2106
|
+
} catch {
|
2105
2107
|
ctx = this._getOrReturnCtx(input, ctx);
|
2106
2108
|
addIssueToContext(ctx, {
|
2107
2109
|
validation: "url",
|
@@ -2313,7 +2315,6 @@ var ZodString = class _ZodString extends ZodType {
|
|
2313
2315
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
2314
2316
|
}
|
2315
2317
|
datetime(options) {
|
2316
|
-
var _a, _b;
|
2317
2318
|
if (typeof options === "string") {
|
2318
2319
|
return this._addCheck({
|
2319
2320
|
kind: "datetime",
|
@@ -2325,10 +2326,10 @@ var ZodString = class _ZodString extends ZodType {
|
|
2325
2326
|
}
|
2326
2327
|
return this._addCheck({
|
2327
2328
|
kind: "datetime",
|
2328
|
-
precision: typeof (options
|
2329
|
-
offset: (
|
2330
|
-
local: (
|
2331
|
-
...errorUtil.errToObj(options
|
2329
|
+
precision: typeof (options == null ? void 0 : options.precision) === "undefined" ? null : options == null ? void 0 : options.precision,
|
2330
|
+
offset: (options == null ? void 0 : options.offset) ?? false,
|
2331
|
+
local: (options == null ? void 0 : options.local) ?? false,
|
2332
|
+
...errorUtil.errToObj(options == null ? void 0 : options.message)
|
2332
2333
|
});
|
2333
2334
|
}
|
2334
2335
|
date(message) {
|
@@ -2344,8 +2345,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
2344
2345
|
}
|
2345
2346
|
return this._addCheck({
|
2346
2347
|
kind: "time",
|
2347
|
-
precision: typeof (options
|
2348
|
-
...errorUtil.errToObj(options
|
2348
|
+
precision: typeof (options == null ? void 0 : options.precision) === "undefined" ? null : options == null ? void 0 : options.precision,
|
2349
|
+
...errorUtil.errToObj(options == null ? void 0 : options.message)
|
2349
2350
|
});
|
2350
2351
|
}
|
2351
2352
|
duration(message) {
|
@@ -2362,8 +2363,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
2362
2363
|
return this._addCheck({
|
2363
2364
|
kind: "includes",
|
2364
2365
|
value,
|
2365
|
-
position: options
|
2366
|
-
...errorUtil.errToObj(options
|
2366
|
+
position: options == null ? void 0 : options.position,
|
2367
|
+
...errorUtil.errToObj(options == null ? void 0 : options.message)
|
2367
2368
|
});
|
2368
2369
|
}
|
2369
2370
|
startsWith(value, message) {
|
@@ -2495,11 +2496,10 @@ var ZodString = class _ZodString extends ZodType {
|
|
2495
2496
|
}
|
2496
2497
|
};
|
2497
2498
|
ZodString.create = (params) => {
|
2498
|
-
var _a;
|
2499
2499
|
return new ZodString({
|
2500
2500
|
checks: [],
|
2501
2501
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
2502
|
-
coerce: (
|
2502
|
+
coerce: (params == null ? void 0 : params.coerce) ?? false,
|
2503
2503
|
...processCreateParams(params)
|
2504
2504
|
});
|
2505
2505
|
};
|
@@ -2507,9 +2507,9 @@ function floatSafeRemainder(val, step) {
|
|
2507
2507
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
2508
2508
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
2509
2509
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
2510
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
2511
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
2512
|
-
return valInt % stepInt /
|
2510
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
2511
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
2512
|
+
return valInt % stepInt / 10 ** decCount;
|
2513
2513
|
}
|
2514
2514
|
var ZodNumber = class _ZodNumber extends ZodType {
|
2515
2515
|
constructor() {
|
@@ -2719,7 +2719,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
2719
2719
|
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
2720
2720
|
}
|
2721
2721
|
get isFinite() {
|
2722
|
-
let max = null
|
2722
|
+
let max = null;
|
2723
|
+
let min = null;
|
2723
2724
|
for (const ch of this._def.checks) {
|
2724
2725
|
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
2725
2726
|
return true;
|
@@ -2738,7 +2739,7 @@ ZodNumber.create = (params) => {
|
|
2738
2739
|
return new ZodNumber({
|
2739
2740
|
checks: [],
|
2740
2741
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
2741
|
-
coerce: (params
|
2742
|
+
coerce: (params == null ? void 0 : params.coerce) || false,
|
2742
2743
|
...processCreateParams(params)
|
2743
2744
|
});
|
2744
2745
|
};
|
@@ -2752,7 +2753,7 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
2752
2753
|
if (this._def.coerce) {
|
2753
2754
|
try {
|
2754
2755
|
input.data = BigInt(input.data);
|
2755
|
-
} catch
|
2756
|
+
} catch {
|
2756
2757
|
return this._getInvalidInput(input);
|
2757
2758
|
}
|
2758
2759
|
}
|
@@ -2907,11 +2908,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
2907
2908
|
}
|
2908
2909
|
};
|
2909
2910
|
ZodBigInt.create = (params) => {
|
2910
|
-
var _a;
|
2911
2911
|
return new ZodBigInt({
|
2912
2912
|
checks: [],
|
2913
2913
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
2914
|
-
coerce: (
|
2914
|
+
coerce: (params == null ? void 0 : params.coerce) ?? false,
|
2915
2915
|
...processCreateParams(params)
|
2916
2916
|
});
|
2917
2917
|
};
|
@@ -2936,7 +2936,7 @@ var ZodBoolean = class extends ZodType {
|
|
2936
2936
|
ZodBoolean.create = (params) => {
|
2937
2937
|
return new ZodBoolean({
|
2938
2938
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
2939
|
-
coerce: (params
|
2939
|
+
coerce: (params == null ? void 0 : params.coerce) || false,
|
2940
2940
|
...processCreateParams(params)
|
2941
2941
|
});
|
2942
2942
|
};
|
@@ -2955,7 +2955,7 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
2955
2955
|
});
|
2956
2956
|
return INVALID;
|
2957
2957
|
}
|
2958
|
-
if (isNaN(input.data.getTime())) {
|
2958
|
+
if (Number.isNaN(input.data.getTime())) {
|
2959
2959
|
const ctx2 = this._getOrReturnCtx(input);
|
2960
2960
|
addIssueToContext(ctx2, {
|
2961
2961
|
code: ZodIssueCode.invalid_date
|
@@ -3044,7 +3044,7 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
3044
3044
|
ZodDate.create = (params) => {
|
3045
3045
|
return new ZodDate({
|
3046
3046
|
checks: [],
|
3047
|
-
coerce: (params
|
3047
|
+
coerce: (params == null ? void 0 : params.coerce) || false,
|
3048
3048
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
3049
3049
|
...processCreateParams(params)
|
3050
3050
|
});
|
@@ -3319,7 +3319,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3319
3319
|
return this._cached;
|
3320
3320
|
const shape = this._def.shape();
|
3321
3321
|
const keys = util.objectKeys(shape);
|
3322
|
-
|
3322
|
+
this._cached = { shape, keys };
|
3323
|
+
return this._cached;
|
3323
3324
|
}
|
3324
3325
|
_parse(input) {
|
3325
3326
|
const parsedType = this._getType(input);
|
@@ -3369,8 +3370,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3369
3370
|
});
|
3370
3371
|
status.dirty();
|
3371
3372
|
}
|
3372
|
-
} else if (unknownKeys === "strip")
|
3373
|
-
else {
|
3373
|
+
} else if (unknownKeys === "strip") {
|
3374
|
+
} else {
|
3374
3375
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
3375
3376
|
}
|
3376
3377
|
} else {
|
@@ -3417,11 +3418,11 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3417
3418
|
unknownKeys: "strict",
|
3418
3419
|
...message !== void 0 ? {
|
3419
3420
|
errorMap: (issue, ctx) => {
|
3420
|
-
var _a, _b
|
3421
|
-
const defaultError = (
|
3421
|
+
var _a, _b;
|
3422
|
+
const defaultError = ((_b = (_a = this._def).errorMap) == null ? void 0 : _b.call(_a, issue, ctx).message) ?? ctx.defaultError;
|
3422
3423
|
if (issue.code === "unrecognized_keys")
|
3423
3424
|
return {
|
3424
|
-
message:
|
3425
|
+
message: errorUtil.errToObj(message).message ?? defaultError
|
3425
3426
|
};
|
3426
3427
|
return {
|
3427
3428
|
message: defaultError
|
@@ -3552,11 +3553,11 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3552
3553
|
}
|
3553
3554
|
pick(mask) {
|
3554
3555
|
const shape = {};
|
3555
|
-
util.objectKeys(mask)
|
3556
|
+
for (const key of util.objectKeys(mask)) {
|
3556
3557
|
if (mask[key] && this.shape[key]) {
|
3557
3558
|
shape[key] = this.shape[key];
|
3558
3559
|
}
|
3559
|
-
}
|
3560
|
+
}
|
3560
3561
|
return new _ZodObject({
|
3561
3562
|
...this._def,
|
3562
3563
|
shape: () => shape
|
@@ -3564,11 +3565,11 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3564
3565
|
}
|
3565
3566
|
omit(mask) {
|
3566
3567
|
const shape = {};
|
3567
|
-
util.objectKeys(this.shape)
|
3568
|
+
for (const key of util.objectKeys(this.shape)) {
|
3568
3569
|
if (!mask[key]) {
|
3569
3570
|
shape[key] = this.shape[key];
|
3570
3571
|
}
|
3571
|
-
}
|
3572
|
+
}
|
3572
3573
|
return new _ZodObject({
|
3573
3574
|
...this._def,
|
3574
3575
|
shape: () => shape
|
@@ -3582,14 +3583,14 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3582
3583
|
}
|
3583
3584
|
partial(mask) {
|
3584
3585
|
const newShape = {};
|
3585
|
-
util.objectKeys(this.shape)
|
3586
|
+
for (const key of util.objectKeys(this.shape)) {
|
3586
3587
|
const fieldSchema = this.shape[key];
|
3587
3588
|
if (mask && !mask[key]) {
|
3588
3589
|
newShape[key] = fieldSchema;
|
3589
3590
|
} else {
|
3590
3591
|
newShape[key] = fieldSchema.optional();
|
3591
3592
|
}
|
3592
|
-
}
|
3593
|
+
}
|
3593
3594
|
return new _ZodObject({
|
3594
3595
|
...this._def,
|
3595
3596
|
shape: () => newShape
|
@@ -3597,7 +3598,7 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3597
3598
|
}
|
3598
3599
|
required(mask) {
|
3599
3600
|
const newShape = {};
|
3600
|
-
util.objectKeys(this.shape)
|
3601
|
+
for (const key of util.objectKeys(this.shape)) {
|
3601
3602
|
if (mask && !mask[key]) {
|
3602
3603
|
newShape[key] = this.shape[key];
|
3603
3604
|
} else {
|
@@ -3608,7 +3609,7 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
3608
3609
|
}
|
3609
3610
|
newShape[key] = newField;
|
3610
3611
|
}
|
3611
|
-
}
|
3612
|
+
}
|
3612
3613
|
return new _ZodObject({
|
3613
3614
|
...this._def,
|
3614
3615
|
shape: () => newShape
|
@@ -4224,12 +4225,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
4224
4225
|
return makeIssue({
|
4225
4226
|
data: args,
|
4226
4227
|
path: ctx.path,
|
4227
|
-
errorMaps: [
|
4228
|
-
ctx.common.contextualErrorMap,
|
4229
|
-
ctx.schemaErrorMap,
|
4230
|
-
getErrorMap(),
|
4231
|
-
errorMap
|
4232
|
-
].filter((x) => !!x),
|
4228
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
4233
4229
|
issueData: {
|
4234
4230
|
code: ZodIssueCode.invalid_arguments,
|
4235
4231
|
argumentsError: error
|
@@ -4240,12 +4236,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
4240
4236
|
return makeIssue({
|
4241
4237
|
data: returns,
|
4242
4238
|
path: ctx.path,
|
4243
|
-
errorMaps: [
|
4244
|
-
ctx.common.contextualErrorMap,
|
4245
|
-
ctx.schemaErrorMap,
|
4246
|
-
getErrorMap(),
|
4247
|
-
errorMap
|
4248
|
-
].filter((x) => !!x),
|
4239
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
4249
4240
|
issueData: {
|
4250
4241
|
code: ZodIssueCode.invalid_return_type,
|
4251
4242
|
returnTypeError: error
|
@@ -4369,10 +4360,6 @@ function createZodEnum(values, params) {
|
|
4369
4360
|
});
|
4370
4361
|
}
|
4371
4362
|
var ZodEnum = class _ZodEnum extends ZodType {
|
4372
|
-
constructor() {
|
4373
|
-
super(...arguments);
|
4374
|
-
_ZodEnum_cache.set(this, void 0);
|
4375
|
-
}
|
4376
4363
|
_parse(input) {
|
4377
4364
|
if (typeof input.data !== "string") {
|
4378
4365
|
const ctx = this._getOrReturnCtx(input);
|
@@ -4384,10 +4371,10 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
4384
4371
|
});
|
4385
4372
|
return INVALID;
|
4386
4373
|
}
|
4387
|
-
if (!
|
4388
|
-
|
4374
|
+
if (!this._cache) {
|
4375
|
+
this._cache = new Set(this._def.values);
|
4389
4376
|
}
|
4390
|
-
if (!
|
4377
|
+
if (!this._cache.has(input.data)) {
|
4391
4378
|
const ctx = this._getOrReturnCtx(input);
|
4392
4379
|
const expectedValues = this._def.values;
|
4393
4380
|
addIssueToContext(ctx, {
|
@@ -4436,13 +4423,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
4436
4423
|
});
|
4437
4424
|
}
|
4438
4425
|
};
|
4439
|
-
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
4440
4426
|
ZodEnum.create = createZodEnum;
|
4441
4427
|
var ZodNativeEnum = class extends ZodType {
|
4442
|
-
constructor() {
|
4443
|
-
super(...arguments);
|
4444
|
-
_ZodNativeEnum_cache.set(this, void 0);
|
4445
|
-
}
|
4446
4428
|
_parse(input) {
|
4447
4429
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
4448
4430
|
const ctx = this._getOrReturnCtx(input);
|
@@ -4455,10 +4437,10 @@ var ZodNativeEnum = class extends ZodType {
|
|
4455
4437
|
});
|
4456
4438
|
return INVALID;
|
4457
4439
|
}
|
4458
|
-
if (!
|
4459
|
-
|
4440
|
+
if (!this._cache) {
|
4441
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
4460
4442
|
}
|
4461
|
-
if (!
|
4443
|
+
if (!this._cache.has(input.data)) {
|
4462
4444
|
const expectedValues = util.objectValues(nativeEnumValues);
|
4463
4445
|
addIssueToContext(ctx, {
|
4464
4446
|
received: ctx.data,
|
@@ -4473,7 +4455,6 @@ var ZodNativeEnum = class extends ZodType {
|
|
4473
4455
|
return this._def.values;
|
4474
4456
|
}
|
4475
4457
|
};
|
4476
|
-
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
4477
4458
|
ZodNativeEnum.create = (values, params) => {
|
4478
4459
|
return new ZodNativeEnum({
|
4479
4460
|
values,
|
@@ -4614,7 +4595,7 @@ var ZodEffects = class extends ZodType {
|
|
4614
4595
|
parent: ctx
|
4615
4596
|
});
|
4616
4597
|
if (!isValid(base))
|
4617
|
-
return
|
4598
|
+
return INVALID;
|
4618
4599
|
const result = effect.transform(base.value, checkCtx);
|
4619
4600
|
if (result instanceof Promise) {
|
4620
4601
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
@@ -4623,8 +4604,11 @@ var ZodEffects = class extends ZodType {
|
|
4623
4604
|
} else {
|
4624
4605
|
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
4625
4606
|
if (!isValid(base))
|
4626
|
-
return
|
4627
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
4607
|
+
return INVALID;
|
4608
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
4609
|
+
status: status.value,
|
4610
|
+
value: result
|
4611
|
+
}));
|
4628
4612
|
});
|
4629
4613
|
}
|
4630
4614
|
}
|