drizzle-kit 0.31.1-47df31f → 0.31.1-512acc4
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.js +2098 -1369
- package/api.mjs +2098 -1369
- package/bin.cjs +18989 -20173
- package/package.json +1 -1
- package/utils.js +181 -51
- package/utils.mjs +181 -51
package/package.json
CHANGED
package/utils.js
CHANGED
@@ -580,7 +580,7 @@ __export(utils_exports, {
|
|
580
580
|
});
|
581
581
|
module.exports = __toCommonJS(utils_exports);
|
582
582
|
|
583
|
-
// ../node_modules/.pnpm/chalk@5.
|
583
|
+
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js
|
584
584
|
var ANSI_BACKGROUND_OFFSET = 10;
|
585
585
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
586
586
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
@@ -766,7 +766,7 @@ function assembleStyles() {
|
|
766
766
|
var ansiStyles = assembleStyles();
|
767
767
|
var ansi_styles_default = ansiStyles;
|
768
768
|
|
769
|
-
// ../node_modules/.pnpm/chalk@5.
|
769
|
+
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
|
770
770
|
var import_node_process = __toESM(require("node:process"), 1);
|
771
771
|
var import_node_os = __toESM(require("node:os"), 1);
|
772
772
|
var import_node_tty = __toESM(require("node:tty"), 1);
|
@@ -840,10 +840,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
840
840
|
return 1;
|
841
841
|
}
|
842
842
|
if ("CI" in env) {
|
843
|
-
if ("GITHUB_ACTIONS"
|
843
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
844
844
|
return 3;
|
845
845
|
}
|
846
|
-
if (["TRAVIS", "
|
846
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
847
847
|
return 1;
|
848
848
|
}
|
849
849
|
return min;
|
@@ -892,7 +892,7 @@ var supportsColor = {
|
|
892
892
|
};
|
893
893
|
var supports_color_default = supportsColor;
|
894
894
|
|
895
|
-
// ../node_modules/.pnpm/chalk@5.
|
895
|
+
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
|
896
896
|
function stringReplaceAll(string, substring, replacer) {
|
897
897
|
let index6 = string.indexOf(substring);
|
898
898
|
if (index6 === -1) {
|
@@ -922,7 +922,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index6) {
|
|
922
922
|
return returnValue;
|
923
923
|
}
|
924
924
|
|
925
|
-
// ../node_modules/.pnpm/chalk@5.
|
925
|
+
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
|
926
926
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
927
927
|
var GENERATOR = Symbol("GENERATOR");
|
928
928
|
var STYLER = Symbol("STYLER");
|
@@ -1087,7 +1087,7 @@ function assertUnreachable(x) {
|
|
1087
1087
|
throw new Error("Didn't expect to get here");
|
1088
1088
|
}
|
1089
1089
|
|
1090
|
-
// ../node_modules/.pnpm/zod@3.
|
1090
|
+
// ../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
|
1091
1091
|
var util;
|
1092
1092
|
(function(util2) {
|
1093
1093
|
util2.assertEqual = (val) => val;
|
@@ -1238,6 +1238,9 @@ var ZodIssueCode = util.arrayToEnum([
|
|
1238
1238
|
"not_finite"
|
1239
1239
|
]);
|
1240
1240
|
var ZodError = class _ZodError extends Error {
|
1241
|
+
get errors() {
|
1242
|
+
return this.issues;
|
1243
|
+
}
|
1241
1244
|
constructor(issues) {
|
1242
1245
|
super();
|
1243
1246
|
this.issues = [];
|
@@ -1256,9 +1259,6 @@ var ZodError = class _ZodError extends Error {
|
|
1256
1259
|
this.name = "ZodError";
|
1257
1260
|
this.issues = issues;
|
1258
1261
|
}
|
1259
|
-
get errors() {
|
1260
|
-
return this.issues;
|
1261
|
-
}
|
1262
1262
|
format(_mapper) {
|
1263
1263
|
const mapper = _mapper || function(issue) {
|
1264
1264
|
return issue.message;
|
@@ -1465,8 +1465,11 @@ function addIssueToContext(ctx, issueData) {
|
|
1465
1465
|
path: ctx.path,
|
1466
1466
|
errorMaps: [
|
1467
1467
|
ctx.common.contextualErrorMap,
|
1468
|
+
// contextual error map is first priority
|
1468
1469
|
ctx.schemaErrorMap,
|
1470
|
+
// then schema-bound map if available
|
1469
1471
|
overrideMap,
|
1472
|
+
// then global override map
|
1470
1473
|
overrideMap === errorMap ? void 0 : errorMap
|
1471
1474
|
// then global default map
|
1472
1475
|
].filter((x) => !!x)
|
@@ -1617,34 +1620,6 @@ function processCreateParams(params) {
|
|
1617
1620
|
return { errorMap: customMap, description };
|
1618
1621
|
}
|
1619
1622
|
var ZodType = class {
|
1620
|
-
constructor(def) {
|
1621
|
-
this.spa = this.safeParseAsync;
|
1622
|
-
this._def = def;
|
1623
|
-
this.parse = this.parse.bind(this);
|
1624
|
-
this.safeParse = this.safeParse.bind(this);
|
1625
|
-
this.parseAsync = this.parseAsync.bind(this);
|
1626
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
1627
|
-
this.spa = this.spa.bind(this);
|
1628
|
-
this.refine = this.refine.bind(this);
|
1629
|
-
this.refinement = this.refinement.bind(this);
|
1630
|
-
this.superRefine = this.superRefine.bind(this);
|
1631
|
-
this.optional = this.optional.bind(this);
|
1632
|
-
this.nullable = this.nullable.bind(this);
|
1633
|
-
this.nullish = this.nullish.bind(this);
|
1634
|
-
this.array = this.array.bind(this);
|
1635
|
-
this.promise = this.promise.bind(this);
|
1636
|
-
this.or = this.or.bind(this);
|
1637
|
-
this.and = this.and.bind(this);
|
1638
|
-
this.transform = this.transform.bind(this);
|
1639
|
-
this.brand = this.brand.bind(this);
|
1640
|
-
this.default = this.default.bind(this);
|
1641
|
-
this.catch = this.catch.bind(this);
|
1642
|
-
this.describe = this.describe.bind(this);
|
1643
|
-
this.pipe = this.pipe.bind(this);
|
1644
|
-
this.readonly = this.readonly.bind(this);
|
1645
|
-
this.isNullable = this.isNullable.bind(this);
|
1646
|
-
this.isOptional = this.isOptional.bind(this);
|
1647
|
-
}
|
1648
1623
|
get description() {
|
1649
1624
|
return this._def.description;
|
1650
1625
|
}
|
@@ -1708,6 +1683,43 @@ var ZodType = class {
|
|
1708
1683
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
1709
1684
|
return handleResult(ctx, result);
|
1710
1685
|
}
|
1686
|
+
"~validate"(data) {
|
1687
|
+
var _a, _b;
|
1688
|
+
const ctx = {
|
1689
|
+
common: {
|
1690
|
+
issues: [],
|
1691
|
+
async: !!this["~standard"].async
|
1692
|
+
},
|
1693
|
+
path: [],
|
1694
|
+
schemaErrorMap: this._def.errorMap,
|
1695
|
+
parent: null,
|
1696
|
+
data,
|
1697
|
+
parsedType: getParsedType(data)
|
1698
|
+
};
|
1699
|
+
if (!this["~standard"].async) {
|
1700
|
+
try {
|
1701
|
+
const result = this._parseSync({ data, path: [], parent: ctx });
|
1702
|
+
return isValid(result) ? {
|
1703
|
+
value: result.value
|
1704
|
+
} : {
|
1705
|
+
issues: ctx.common.issues
|
1706
|
+
};
|
1707
|
+
} catch (err) {
|
1708
|
+
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")) {
|
1709
|
+
this["~standard"].async = true;
|
1710
|
+
}
|
1711
|
+
ctx.common = {
|
1712
|
+
issues: [],
|
1713
|
+
async: true
|
1714
|
+
};
|
1715
|
+
}
|
1716
|
+
}
|
1717
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
|
1718
|
+
value: result.value
|
1719
|
+
} : {
|
1720
|
+
issues: ctx.common.issues
|
1721
|
+
});
|
1722
|
+
}
|
1711
1723
|
async parseAsync(data, params) {
|
1712
1724
|
const result = await this.safeParseAsync(data, params);
|
1713
1725
|
if (result.success)
|
@@ -1785,6 +1797,39 @@ var ZodType = class {
|
|
1785
1797
|
superRefine(refinement) {
|
1786
1798
|
return this._refinement(refinement);
|
1787
1799
|
}
|
1800
|
+
constructor(def) {
|
1801
|
+
this.spa = this.safeParseAsync;
|
1802
|
+
this._def = def;
|
1803
|
+
this.parse = this.parse.bind(this);
|
1804
|
+
this.safeParse = this.safeParse.bind(this);
|
1805
|
+
this.parseAsync = this.parseAsync.bind(this);
|
1806
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
1807
|
+
this.spa = this.spa.bind(this);
|
1808
|
+
this.refine = this.refine.bind(this);
|
1809
|
+
this.refinement = this.refinement.bind(this);
|
1810
|
+
this.superRefine = this.superRefine.bind(this);
|
1811
|
+
this.optional = this.optional.bind(this);
|
1812
|
+
this.nullable = this.nullable.bind(this);
|
1813
|
+
this.nullish = this.nullish.bind(this);
|
1814
|
+
this.array = this.array.bind(this);
|
1815
|
+
this.promise = this.promise.bind(this);
|
1816
|
+
this.or = this.or.bind(this);
|
1817
|
+
this.and = this.and.bind(this);
|
1818
|
+
this.transform = this.transform.bind(this);
|
1819
|
+
this.brand = this.brand.bind(this);
|
1820
|
+
this.default = this.default.bind(this);
|
1821
|
+
this.catch = this.catch.bind(this);
|
1822
|
+
this.describe = this.describe.bind(this);
|
1823
|
+
this.pipe = this.pipe.bind(this);
|
1824
|
+
this.readonly = this.readonly.bind(this);
|
1825
|
+
this.isNullable = this.isNullable.bind(this);
|
1826
|
+
this.isOptional = this.isOptional.bind(this);
|
1827
|
+
this["~standard"] = {
|
1828
|
+
version: 1,
|
1829
|
+
vendor: "zod",
|
1830
|
+
validate: (data) => this["~validate"](data)
|
1831
|
+
};
|
1832
|
+
}
|
1788
1833
|
optional() {
|
1789
1834
|
return ZodOptional.create(this, this._def);
|
1790
1835
|
}
|
@@ -1795,7 +1840,7 @@ var ZodType = class {
|
|
1795
1840
|
return this.nullable().optional();
|
1796
1841
|
}
|
1797
1842
|
array() {
|
1798
|
-
return ZodArray.create(this
|
1843
|
+
return ZodArray.create(this);
|
1799
1844
|
}
|
1800
1845
|
promise() {
|
1801
1846
|
return ZodPromise.create(this, this._def);
|
@@ -1861,16 +1906,20 @@ var ZodType = class {
|
|
1861
1906
|
};
|
1862
1907
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
1863
1908
|
var cuid2Regex = /^[0-9a-z]+$/;
|
1864
|
-
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
1909
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
1865
1910
|
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;
|
1866
1911
|
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
1912
|
+
var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
1867
1913
|
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)?)??$/;
|
1868
1914
|
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
1869
1915
|
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
1870
1916
|
var emojiRegex;
|
1871
1917
|
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])$/;
|
1872
|
-
var
|
1918
|
+
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])$/;
|
1919
|
+
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]))$/;
|
1920
|
+
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])$/;
|
1873
1921
|
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
1922
|
+
var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
1874
1923
|
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])))`;
|
1875
1924
|
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
1876
1925
|
function timeRegexSource(args) {
|
@@ -1903,6 +1952,33 @@ function isValidIP(ip, version) {
|
|
1903
1952
|
}
|
1904
1953
|
return false;
|
1905
1954
|
}
|
1955
|
+
function isValidJWT(jwt, alg) {
|
1956
|
+
if (!jwtRegex.test(jwt))
|
1957
|
+
return false;
|
1958
|
+
try {
|
1959
|
+
const [header] = jwt.split(".");
|
1960
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
1961
|
+
const decoded = JSON.parse(atob(base64));
|
1962
|
+
if (typeof decoded !== "object" || decoded === null)
|
1963
|
+
return false;
|
1964
|
+
if (!decoded.typ || !decoded.alg)
|
1965
|
+
return false;
|
1966
|
+
if (alg && decoded.alg !== alg)
|
1967
|
+
return false;
|
1968
|
+
return true;
|
1969
|
+
} catch (_a) {
|
1970
|
+
return false;
|
1971
|
+
}
|
1972
|
+
}
|
1973
|
+
function isValidCidr(ip, version) {
|
1974
|
+
if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
|
1975
|
+
return true;
|
1976
|
+
}
|
1977
|
+
if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
|
1978
|
+
return true;
|
1979
|
+
}
|
1980
|
+
return false;
|
1981
|
+
}
|
1906
1982
|
var ZodString = class _ZodString extends ZodType {
|
1907
1983
|
_parse(input) {
|
1908
1984
|
if (this._def.coerce) {
|
@@ -2159,6 +2235,26 @@ var ZodString = class _ZodString extends ZodType {
|
|
2159
2235
|
});
|
2160
2236
|
status.dirty();
|
2161
2237
|
}
|
2238
|
+
} else if (check.kind === "jwt") {
|
2239
|
+
if (!isValidJWT(input.data, check.alg)) {
|
2240
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
2241
|
+
addIssueToContext(ctx, {
|
2242
|
+
validation: "jwt",
|
2243
|
+
code: ZodIssueCode.invalid_string,
|
2244
|
+
message: check.message
|
2245
|
+
});
|
2246
|
+
status.dirty();
|
2247
|
+
}
|
2248
|
+
} else if (check.kind === "cidr") {
|
2249
|
+
if (!isValidCidr(input.data, check.version)) {
|
2250
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
2251
|
+
addIssueToContext(ctx, {
|
2252
|
+
validation: "cidr",
|
2253
|
+
code: ZodIssueCode.invalid_string,
|
2254
|
+
message: check.message
|
2255
|
+
});
|
2256
|
+
status.dirty();
|
2257
|
+
}
|
2162
2258
|
} else if (check.kind === "base64") {
|
2163
2259
|
if (!base64Regex.test(input.data)) {
|
2164
2260
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -2169,6 +2265,16 @@ var ZodString = class _ZodString extends ZodType {
|
|
2169
2265
|
});
|
2170
2266
|
status.dirty();
|
2171
2267
|
}
|
2268
|
+
} else if (check.kind === "base64url") {
|
2269
|
+
if (!base64urlRegex.test(input.data)) {
|
2270
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
2271
|
+
addIssueToContext(ctx, {
|
2272
|
+
validation: "base64url",
|
2273
|
+
code: ZodIssueCode.invalid_string,
|
2274
|
+
message: check.message
|
2275
|
+
});
|
2276
|
+
status.dirty();
|
2277
|
+
}
|
2172
2278
|
} else {
|
2173
2279
|
util.assertNever(check);
|
2174
2280
|
}
|
@@ -2215,9 +2321,21 @@ var ZodString = class _ZodString extends ZodType {
|
|
2215
2321
|
base64(message) {
|
2216
2322
|
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
2217
2323
|
}
|
2324
|
+
base64url(message) {
|
2325
|
+
return this._addCheck({
|
2326
|
+
kind: "base64url",
|
2327
|
+
...errorUtil.errToObj(message)
|
2328
|
+
});
|
2329
|
+
}
|
2330
|
+
jwt(options) {
|
2331
|
+
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
2332
|
+
}
|
2218
2333
|
ip(options) {
|
2219
2334
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
2220
2335
|
}
|
2336
|
+
cidr(options) {
|
2337
|
+
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
2338
|
+
}
|
2221
2339
|
datetime(options) {
|
2222
2340
|
var _a, _b;
|
2223
2341
|
if (typeof options === "string") {
|
@@ -2308,8 +2426,7 @@ var ZodString = class _ZodString extends ZodType {
|
|
2308
2426
|
});
|
2309
2427
|
}
|
2310
2428
|
/**
|
2311
|
-
*
|
2312
|
-
* @see {@link ZodString.min}
|
2429
|
+
* Equivalent to `.min(1)`
|
2313
2430
|
*/
|
2314
2431
|
nonempty(message) {
|
2315
2432
|
return this.min(1, errorUtil.errToObj(message));
|
@@ -2371,9 +2488,15 @@ var ZodString = class _ZodString extends ZodType {
|
|
2371
2488
|
get isIP() {
|
2372
2489
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
2373
2490
|
}
|
2491
|
+
get isCIDR() {
|
2492
|
+
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
2493
|
+
}
|
2374
2494
|
get isBase64() {
|
2375
2495
|
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
2376
2496
|
}
|
2497
|
+
get isBase64url() {
|
2498
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
2499
|
+
}
|
2377
2500
|
get minLength() {
|
2378
2501
|
let min = null;
|
2379
2502
|
for (const ch of this._def.checks) {
|
@@ -2651,17 +2774,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
2651
2774
|
}
|
2652
2775
|
_parse(input) {
|
2653
2776
|
if (this._def.coerce) {
|
2654
|
-
|
2777
|
+
try {
|
2778
|
+
input.data = BigInt(input.data);
|
2779
|
+
} catch (_a) {
|
2780
|
+
return this._getInvalidInput(input);
|
2781
|
+
}
|
2655
2782
|
}
|
2656
2783
|
const parsedType = this._getType(input);
|
2657
2784
|
if (parsedType !== ZodParsedType.bigint) {
|
2658
|
-
|
2659
|
-
addIssueToContext(ctx2, {
|
2660
|
-
code: ZodIssueCode.invalid_type,
|
2661
|
-
expected: ZodParsedType.bigint,
|
2662
|
-
received: ctx2.parsedType
|
2663
|
-
});
|
2664
|
-
return INVALID;
|
2785
|
+
return this._getInvalidInput(input);
|
2665
2786
|
}
|
2666
2787
|
let ctx = void 0;
|
2667
2788
|
const status = new ParseStatus();
|
@@ -2708,6 +2829,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
2708
2829
|
}
|
2709
2830
|
return { status: status.value, value: input.data };
|
2710
2831
|
}
|
2832
|
+
_getInvalidInput(input) {
|
2833
|
+
const ctx = this._getOrReturnCtx(input);
|
2834
|
+
addIssueToContext(ctx, {
|
2835
|
+
code: ZodIssueCode.invalid_type,
|
2836
|
+
expected: ZodParsedType.bigint,
|
2837
|
+
received: ctx.parsedType
|
2838
|
+
});
|
2839
|
+
return INVALID;
|
2840
|
+
}
|
2711
2841
|
gte(value, message) {
|
2712
2842
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
2713
2843
|
}
|