drizzle-kit 0.31.0-f677fb2 → 0.31.1-b08434e
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 +384 -384
- package/api.d.ts +384 -384
- package/api.js +2869 -3772
- package/api.mjs +2872 -3775
- package/bin.cjs +20543 -19762
- package/index.js +3 -3
- package/package.json +1 -3
- package/utils.js +181 -51
- package/utils.mjs +181 -51
package/utils.mjs
CHANGED
@@ -556,7 +556,7 @@ var require_hanji = __commonJS({
|
|
556
556
|
}
|
557
557
|
});
|
558
558
|
|
559
|
-
// ../node_modules/.pnpm/chalk@5.
|
559
|
+
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js
|
560
560
|
var ANSI_BACKGROUND_OFFSET = 10;
|
561
561
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
562
562
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
@@ -742,7 +742,7 @@ function assembleStyles() {
|
|
742
742
|
var ansiStyles = assembleStyles();
|
743
743
|
var ansi_styles_default = ansiStyles;
|
744
744
|
|
745
|
-
// ../node_modules/.pnpm/chalk@5.
|
745
|
+
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
|
746
746
|
import process2 from "node:process";
|
747
747
|
import os from "node:os";
|
748
748
|
import tty from "node:tty";
|
@@ -816,10 +816,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
816
816
|
return 1;
|
817
817
|
}
|
818
818
|
if ("CI" in env) {
|
819
|
-
if ("GITHUB_ACTIONS"
|
819
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
820
820
|
return 3;
|
821
821
|
}
|
822
|
-
if (["TRAVIS", "
|
822
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
823
823
|
return 1;
|
824
824
|
}
|
825
825
|
return min;
|
@@ -868,7 +868,7 @@ var supportsColor = {
|
|
868
868
|
};
|
869
869
|
var supports_color_default = supportsColor;
|
870
870
|
|
871
|
-
// ../node_modules/.pnpm/chalk@5.
|
871
|
+
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
|
872
872
|
function stringReplaceAll(string, substring, replacer) {
|
873
873
|
let index6 = string.indexOf(substring);
|
874
874
|
if (index6 === -1) {
|
@@ -898,7 +898,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index6) {
|
|
898
898
|
return returnValue;
|
899
899
|
}
|
900
900
|
|
901
|
-
// ../node_modules/.pnpm/chalk@5.
|
901
|
+
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
|
902
902
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
903
903
|
var GENERATOR = Symbol("GENERATOR");
|
904
904
|
var STYLER = Symbol("STYLER");
|
@@ -1063,7 +1063,7 @@ 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.24.2/node_modules/zod/lib/index.mjs
|
1067
1067
|
var util;
|
1068
1068
|
(function(util2) {
|
1069
1069
|
util2.assertEqual = (val) => val;
|
@@ -1214,6 +1214,9 @@ var ZodIssueCode = util.arrayToEnum([
|
|
1214
1214
|
"not_finite"
|
1215
1215
|
]);
|
1216
1216
|
var ZodError = class _ZodError extends Error {
|
1217
|
+
get errors() {
|
1218
|
+
return this.issues;
|
1219
|
+
}
|
1217
1220
|
constructor(issues) {
|
1218
1221
|
super();
|
1219
1222
|
this.issues = [];
|
@@ -1232,9 +1235,6 @@ var ZodError = class _ZodError extends Error {
|
|
1232
1235
|
this.name = "ZodError";
|
1233
1236
|
this.issues = issues;
|
1234
1237
|
}
|
1235
|
-
get errors() {
|
1236
|
-
return this.issues;
|
1237
|
-
}
|
1238
1238
|
format(_mapper) {
|
1239
1239
|
const mapper = _mapper || function(issue) {
|
1240
1240
|
return issue.message;
|
@@ -1441,8 +1441,11 @@ function addIssueToContext(ctx, issueData) {
|
|
1441
1441
|
path: ctx.path,
|
1442
1442
|
errorMaps: [
|
1443
1443
|
ctx.common.contextualErrorMap,
|
1444
|
+
// contextual error map is first priority
|
1444
1445
|
ctx.schemaErrorMap,
|
1446
|
+
// then schema-bound map if available
|
1445
1447
|
overrideMap,
|
1448
|
+
// then global override map
|
1446
1449
|
overrideMap === errorMap ? void 0 : errorMap
|
1447
1450
|
// then global default map
|
1448
1451
|
].filter((x) => !!x)
|
@@ -1593,34 +1596,6 @@ function processCreateParams(params) {
|
|
1593
1596
|
return { errorMap: customMap, description };
|
1594
1597
|
}
|
1595
1598
|
var ZodType = class {
|
1596
|
-
constructor(def) {
|
1597
|
-
this.spa = this.safeParseAsync;
|
1598
|
-
this._def = def;
|
1599
|
-
this.parse = this.parse.bind(this);
|
1600
|
-
this.safeParse = this.safeParse.bind(this);
|
1601
|
-
this.parseAsync = this.parseAsync.bind(this);
|
1602
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
1603
|
-
this.spa = this.spa.bind(this);
|
1604
|
-
this.refine = this.refine.bind(this);
|
1605
|
-
this.refinement = this.refinement.bind(this);
|
1606
|
-
this.superRefine = this.superRefine.bind(this);
|
1607
|
-
this.optional = this.optional.bind(this);
|
1608
|
-
this.nullable = this.nullable.bind(this);
|
1609
|
-
this.nullish = this.nullish.bind(this);
|
1610
|
-
this.array = this.array.bind(this);
|
1611
|
-
this.promise = this.promise.bind(this);
|
1612
|
-
this.or = this.or.bind(this);
|
1613
|
-
this.and = this.and.bind(this);
|
1614
|
-
this.transform = this.transform.bind(this);
|
1615
|
-
this.brand = this.brand.bind(this);
|
1616
|
-
this.default = this.default.bind(this);
|
1617
|
-
this.catch = this.catch.bind(this);
|
1618
|
-
this.describe = this.describe.bind(this);
|
1619
|
-
this.pipe = this.pipe.bind(this);
|
1620
|
-
this.readonly = this.readonly.bind(this);
|
1621
|
-
this.isNullable = this.isNullable.bind(this);
|
1622
|
-
this.isOptional = this.isOptional.bind(this);
|
1623
|
-
}
|
1624
1599
|
get description() {
|
1625
1600
|
return this._def.description;
|
1626
1601
|
}
|
@@ -1684,6 +1659,43 @@ var ZodType = class {
|
|
1684
1659
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
1685
1660
|
return handleResult(ctx, result);
|
1686
1661
|
}
|
1662
|
+
"~validate"(data) {
|
1663
|
+
var _a, _b;
|
1664
|
+
const ctx = {
|
1665
|
+
common: {
|
1666
|
+
issues: [],
|
1667
|
+
async: !!this["~standard"].async
|
1668
|
+
},
|
1669
|
+
path: [],
|
1670
|
+
schemaErrorMap: this._def.errorMap,
|
1671
|
+
parent: null,
|
1672
|
+
data,
|
1673
|
+
parsedType: getParsedType(data)
|
1674
|
+
};
|
1675
|
+
if (!this["~standard"].async) {
|
1676
|
+
try {
|
1677
|
+
const result = this._parseSync({ data, path: [], parent: ctx });
|
1678
|
+
return isValid(result) ? {
|
1679
|
+
value: result.value
|
1680
|
+
} : {
|
1681
|
+
issues: ctx.common.issues
|
1682
|
+
};
|
1683
|
+
} catch (err) {
|
1684
|
+
if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
|
1685
|
+
this["~standard"].async = true;
|
1686
|
+
}
|
1687
|
+
ctx.common = {
|
1688
|
+
issues: [],
|
1689
|
+
async: true
|
1690
|
+
};
|
1691
|
+
}
|
1692
|
+
}
|
1693
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
|
1694
|
+
value: result.value
|
1695
|
+
} : {
|
1696
|
+
issues: ctx.common.issues
|
1697
|
+
});
|
1698
|
+
}
|
1687
1699
|
async parseAsync(data, params) {
|
1688
1700
|
const result = await this.safeParseAsync(data, params);
|
1689
1701
|
if (result.success)
|
@@ -1761,6 +1773,39 @@ var ZodType = class {
|
|
1761
1773
|
superRefine(refinement) {
|
1762
1774
|
return this._refinement(refinement);
|
1763
1775
|
}
|
1776
|
+
constructor(def) {
|
1777
|
+
this.spa = this.safeParseAsync;
|
1778
|
+
this._def = def;
|
1779
|
+
this.parse = this.parse.bind(this);
|
1780
|
+
this.safeParse = this.safeParse.bind(this);
|
1781
|
+
this.parseAsync = this.parseAsync.bind(this);
|
1782
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
1783
|
+
this.spa = this.spa.bind(this);
|
1784
|
+
this.refine = this.refine.bind(this);
|
1785
|
+
this.refinement = this.refinement.bind(this);
|
1786
|
+
this.superRefine = this.superRefine.bind(this);
|
1787
|
+
this.optional = this.optional.bind(this);
|
1788
|
+
this.nullable = this.nullable.bind(this);
|
1789
|
+
this.nullish = this.nullish.bind(this);
|
1790
|
+
this.array = this.array.bind(this);
|
1791
|
+
this.promise = this.promise.bind(this);
|
1792
|
+
this.or = this.or.bind(this);
|
1793
|
+
this.and = this.and.bind(this);
|
1794
|
+
this.transform = this.transform.bind(this);
|
1795
|
+
this.brand = this.brand.bind(this);
|
1796
|
+
this.default = this.default.bind(this);
|
1797
|
+
this.catch = this.catch.bind(this);
|
1798
|
+
this.describe = this.describe.bind(this);
|
1799
|
+
this.pipe = this.pipe.bind(this);
|
1800
|
+
this.readonly = this.readonly.bind(this);
|
1801
|
+
this.isNullable = this.isNullable.bind(this);
|
1802
|
+
this.isOptional = this.isOptional.bind(this);
|
1803
|
+
this["~standard"] = {
|
1804
|
+
version: 1,
|
1805
|
+
vendor: "zod",
|
1806
|
+
validate: (data) => this["~validate"](data)
|
1807
|
+
};
|
1808
|
+
}
|
1764
1809
|
optional() {
|
1765
1810
|
return ZodOptional.create(this, this._def);
|
1766
1811
|
}
|
@@ -1771,7 +1816,7 @@ var ZodType = class {
|
|
1771
1816
|
return this.nullable().optional();
|
1772
1817
|
}
|
1773
1818
|
array() {
|
1774
|
-
return ZodArray.create(this
|
1819
|
+
return ZodArray.create(this);
|
1775
1820
|
}
|
1776
1821
|
promise() {
|
1777
1822
|
return ZodPromise.create(this, this._def);
|
@@ -1837,16 +1882,20 @@ var ZodType = class {
|
|
1837
1882
|
};
|
1838
1883
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
1839
1884
|
var cuid2Regex = /^[0-9a-z]+$/;
|
1840
|
-
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
1885
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
1841
1886
|
var 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;
|
1842
1887
|
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
1888
|
+
var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
1843
1889
|
var 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)?)??$/;
|
1844
1890
|
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
1845
1891
|
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
1846
1892
|
var emojiRegex;
|
1847
1893
|
var 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])$/;
|
1848
|
-
var
|
1894
|
+
var ipv4CidrRegex = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/;
|
1895
|
+
var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
1896
|
+
var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
1849
1897
|
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
1898
|
+
var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
1850
1899
|
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])))`;
|
1851
1900
|
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
1852
1901
|
function timeRegexSource(args) {
|
@@ -1879,6 +1928,33 @@ function isValidIP(ip, version) {
|
|
1879
1928
|
}
|
1880
1929
|
return false;
|
1881
1930
|
}
|
1931
|
+
function isValidJWT(jwt, alg) {
|
1932
|
+
if (!jwtRegex.test(jwt))
|
1933
|
+
return false;
|
1934
|
+
try {
|
1935
|
+
const [header] = jwt.split(".");
|
1936
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
1937
|
+
const decoded = JSON.parse(atob(base64));
|
1938
|
+
if (typeof decoded !== "object" || decoded === null)
|
1939
|
+
return false;
|
1940
|
+
if (!decoded.typ || !decoded.alg)
|
1941
|
+
return false;
|
1942
|
+
if (alg && decoded.alg !== alg)
|
1943
|
+
return false;
|
1944
|
+
return true;
|
1945
|
+
} catch (_a) {
|
1946
|
+
return false;
|
1947
|
+
}
|
1948
|
+
}
|
1949
|
+
function isValidCidr(ip, version) {
|
1950
|
+
if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
|
1951
|
+
return true;
|
1952
|
+
}
|
1953
|
+
if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
|
1954
|
+
return true;
|
1955
|
+
}
|
1956
|
+
return false;
|
1957
|
+
}
|
1882
1958
|
var ZodString = class _ZodString extends ZodType {
|
1883
1959
|
_parse(input) {
|
1884
1960
|
if (this._def.coerce) {
|
@@ -2135,6 +2211,26 @@ var ZodString = class _ZodString extends ZodType {
|
|
2135
2211
|
});
|
2136
2212
|
status.dirty();
|
2137
2213
|
}
|
2214
|
+
} else if (check.kind === "jwt") {
|
2215
|
+
if (!isValidJWT(input.data, check.alg)) {
|
2216
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
2217
|
+
addIssueToContext(ctx, {
|
2218
|
+
validation: "jwt",
|
2219
|
+
code: ZodIssueCode.invalid_string,
|
2220
|
+
message: check.message
|
2221
|
+
});
|
2222
|
+
status.dirty();
|
2223
|
+
}
|
2224
|
+
} else if (check.kind === "cidr") {
|
2225
|
+
if (!isValidCidr(input.data, check.version)) {
|
2226
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
2227
|
+
addIssueToContext(ctx, {
|
2228
|
+
validation: "cidr",
|
2229
|
+
code: ZodIssueCode.invalid_string,
|
2230
|
+
message: check.message
|
2231
|
+
});
|
2232
|
+
status.dirty();
|
2233
|
+
}
|
2138
2234
|
} else if (check.kind === "base64") {
|
2139
2235
|
if (!base64Regex.test(input.data)) {
|
2140
2236
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -2145,6 +2241,16 @@ var ZodString = class _ZodString extends ZodType {
|
|
2145
2241
|
});
|
2146
2242
|
status.dirty();
|
2147
2243
|
}
|
2244
|
+
} else if (check.kind === "base64url") {
|
2245
|
+
if (!base64urlRegex.test(input.data)) {
|
2246
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
2247
|
+
addIssueToContext(ctx, {
|
2248
|
+
validation: "base64url",
|
2249
|
+
code: ZodIssueCode.invalid_string,
|
2250
|
+
message: check.message
|
2251
|
+
});
|
2252
|
+
status.dirty();
|
2253
|
+
}
|
2148
2254
|
} else {
|
2149
2255
|
util.assertNever(check);
|
2150
2256
|
}
|
@@ -2191,9 +2297,21 @@ var ZodString = class _ZodString extends ZodType {
|
|
2191
2297
|
base64(message) {
|
2192
2298
|
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
2193
2299
|
}
|
2300
|
+
base64url(message) {
|
2301
|
+
return this._addCheck({
|
2302
|
+
kind: "base64url",
|
2303
|
+
...errorUtil.errToObj(message)
|
2304
|
+
});
|
2305
|
+
}
|
2306
|
+
jwt(options) {
|
2307
|
+
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
2308
|
+
}
|
2194
2309
|
ip(options) {
|
2195
2310
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
2196
2311
|
}
|
2312
|
+
cidr(options) {
|
2313
|
+
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
2314
|
+
}
|
2197
2315
|
datetime(options) {
|
2198
2316
|
var _a, _b;
|
2199
2317
|
if (typeof options === "string") {
|
@@ -2284,8 +2402,7 @@ var ZodString = class _ZodString extends ZodType {
|
|
2284
2402
|
});
|
2285
2403
|
}
|
2286
2404
|
/**
|
2287
|
-
*
|
2288
|
-
* @see {@link ZodString.min}
|
2405
|
+
* Equivalent to `.min(1)`
|
2289
2406
|
*/
|
2290
2407
|
nonempty(message) {
|
2291
2408
|
return this.min(1, errorUtil.errToObj(message));
|
@@ -2347,9 +2464,15 @@ var ZodString = class _ZodString extends ZodType {
|
|
2347
2464
|
get isIP() {
|
2348
2465
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
2349
2466
|
}
|
2467
|
+
get isCIDR() {
|
2468
|
+
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
2469
|
+
}
|
2350
2470
|
get isBase64() {
|
2351
2471
|
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
2352
2472
|
}
|
2473
|
+
get isBase64url() {
|
2474
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
2475
|
+
}
|
2353
2476
|
get minLength() {
|
2354
2477
|
let min = null;
|
2355
2478
|
for (const ch of this._def.checks) {
|
@@ -2627,17 +2750,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
2627
2750
|
}
|
2628
2751
|
_parse(input) {
|
2629
2752
|
if (this._def.coerce) {
|
2630
|
-
|
2753
|
+
try {
|
2754
|
+
input.data = BigInt(input.data);
|
2755
|
+
} catch (_a) {
|
2756
|
+
return this._getInvalidInput(input);
|
2757
|
+
}
|
2631
2758
|
}
|
2632
2759
|
const parsedType = this._getType(input);
|
2633
2760
|
if (parsedType !== ZodParsedType.bigint) {
|
2634
|
-
|
2635
|
-
addIssueToContext(ctx2, {
|
2636
|
-
code: ZodIssueCode.invalid_type,
|
2637
|
-
expected: ZodParsedType.bigint,
|
2638
|
-
received: ctx2.parsedType
|
2639
|
-
});
|
2640
|
-
return INVALID;
|
2761
|
+
return this._getInvalidInput(input);
|
2641
2762
|
}
|
2642
2763
|
let ctx = void 0;
|
2643
2764
|
const status = new ParseStatus();
|
@@ -2684,6 +2805,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
2684
2805
|
}
|
2685
2806
|
return { status: status.value, value: input.data };
|
2686
2807
|
}
|
2808
|
+
_getInvalidInput(input) {
|
2809
|
+
const ctx = this._getOrReturnCtx(input);
|
2810
|
+
addIssueToContext(ctx, {
|
2811
|
+
code: ZodIssueCode.invalid_type,
|
2812
|
+
expected: ZodParsedType.bigint,
|
2813
|
+
received: ctx.parsedType
|
2814
|
+
});
|
2815
|
+
return INVALID;
|
2816
|
+
}
|
2687
2817
|
gte(value, message) {
|
2688
2818
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
2689
2819
|
}
|