drizzle-kit 0.31.0 → 0.31.1-47df31f
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 +2965 -2309
- package/api.mjs +2965 -2309
- package/bin.cjs +20525 -20068
- package/package.json +10 -11
- package/utils.js +51 -181
- package/utils.mjs +51 -181
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.31.
|
3
|
+
"version": "0.31.1-47df31f",
|
4
4
|
"homepage": "https://orm.drizzle.team",
|
5
5
|
"keywords": [
|
6
6
|
"drizzle",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
"dependencies": {
|
46
46
|
"@drizzle-team/brocli": "^0.10.2",
|
47
47
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
48
|
-
"esbuild": "^0.25.
|
48
|
+
"esbuild": "^0.25.4",
|
49
49
|
"esbuild-register": "^3.5.0"
|
50
50
|
},
|
51
51
|
"devDependencies": {
|
@@ -80,7 +80,7 @@
|
|
80
80
|
"camelcase": "^7.0.1",
|
81
81
|
"chalk": "^5.2.0",
|
82
82
|
"commander": "^12.1.0",
|
83
|
-
"dockerode": "^
|
83
|
+
"dockerode": "^4.0.6",
|
84
84
|
"dotenv": "^16.0.3",
|
85
85
|
"drizzle-kit": "0.25.0-b1faa33",
|
86
86
|
"drizzle-orm": "workspace:./drizzle-orm/dist",
|
@@ -93,27 +93,26 @@
|
|
93
93
|
"get-port": "^6.1.2",
|
94
94
|
"glob": "^8.1.0",
|
95
95
|
"hanji": "^0.0.5",
|
96
|
-
"hono": "^4.
|
96
|
+
"hono": "^4.7.9",
|
97
97
|
"json-diff": "1.0.6",
|
98
98
|
"micromatch": "^4.0.8",
|
99
99
|
"minimatch": "^7.4.3",
|
100
|
-
"mysql2": "3.
|
100
|
+
"mysql2": "3.14.1",
|
101
101
|
"node-fetch": "^3.3.2",
|
102
102
|
"ohm-js": "^17.1.0",
|
103
103
|
"pg": "^8.11.5",
|
104
104
|
"pluralize": "^8.0.0",
|
105
105
|
"postgres": "^3.4.4",
|
106
|
-
"prettier": "^
|
107
|
-
"semver": "^7.
|
106
|
+
"prettier": "^3.5.3",
|
107
|
+
"semver": "^7.7.2",
|
108
108
|
"superjson": "^2.2.1",
|
109
|
-
"tsup": "^8.
|
109
|
+
"tsup": "^8.3.5",
|
110
110
|
"tsx": "^3.12.1",
|
111
111
|
"typescript": "^5.6.3",
|
112
112
|
"uuid": "^9.0.1",
|
113
113
|
"vite-tsconfig-paths": "^4.3.2",
|
114
|
-
"vitest": "^1.
|
115
|
-
"
|
116
|
-
"ws": "^8.16.0",
|
114
|
+
"vitest": "^3.1.3",
|
115
|
+
"ws": "^8.18.2",
|
117
116
|
"zod": "^3.20.2",
|
118
117
|
"zx": "^8.3.2"
|
119
118
|
},
|
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.3.0/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.3.0/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 (
|
843
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
844
844
|
return 3;
|
845
845
|
}
|
846
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
846
|
+
if (["TRAVIS", "CIRCLECI", "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.3.0/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.3.0/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.23.7/node_modules/zod/lib/index.mjs
|
1091
1091
|
var util;
|
1092
1092
|
(function(util2) {
|
1093
1093
|
util2.assertEqual = (val) => val;
|
@@ -1238,9 +1238,6 @@ 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
|
-
}
|
1244
1241
|
constructor(issues) {
|
1245
1242
|
super();
|
1246
1243
|
this.issues = [];
|
@@ -1259,6 +1256,9 @@ var ZodError = class _ZodError extends Error {
|
|
1259
1256
|
this.name = "ZodError";
|
1260
1257
|
this.issues = issues;
|
1261
1258
|
}
|
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,11 +1465,8 @@ function addIssueToContext(ctx, issueData) {
|
|
1465
1465
|
path: ctx.path,
|
1466
1466
|
errorMaps: [
|
1467
1467
|
ctx.common.contextualErrorMap,
|
1468
|
-
// contextual error map is first priority
|
1469
1468
|
ctx.schemaErrorMap,
|
1470
|
-
// then schema-bound map if available
|
1471
1469
|
overrideMap,
|
1472
|
-
// then global override map
|
1473
1470
|
overrideMap === errorMap ? void 0 : errorMap
|
1474
1471
|
// then global default map
|
1475
1472
|
].filter((x) => !!x)
|
@@ -1620,6 +1617,34 @@ function processCreateParams(params) {
|
|
1620
1617
|
return { errorMap: customMap, description };
|
1621
1618
|
}
|
1622
1619
|
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
|
+
}
|
1623
1648
|
get description() {
|
1624
1649
|
return this._def.description;
|
1625
1650
|
}
|
@@ -1683,43 +1708,6 @@ var ZodType = class {
|
|
1683
1708
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
1684
1709
|
return handleResult(ctx, result);
|
1685
1710
|
}
|
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
|
-
}
|
1723
1711
|
async parseAsync(data, params) {
|
1724
1712
|
const result = await this.safeParseAsync(data, params);
|
1725
1713
|
if (result.success)
|
@@ -1797,39 +1785,6 @@ var ZodType = class {
|
|
1797
1785
|
superRefine(refinement) {
|
1798
1786
|
return this._refinement(refinement);
|
1799
1787
|
}
|
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
|
-
}
|
1833
1788
|
optional() {
|
1834
1789
|
return ZodOptional.create(this, this._def);
|
1835
1790
|
}
|
@@ -1840,7 +1795,7 @@ var ZodType = class {
|
|
1840
1795
|
return this.nullable().optional();
|
1841
1796
|
}
|
1842
1797
|
array() {
|
1843
|
-
return ZodArray.create(this);
|
1798
|
+
return ZodArray.create(this, this._def);
|
1844
1799
|
}
|
1845
1800
|
promise() {
|
1846
1801
|
return ZodPromise.create(this, this._def);
|
@@ -1906,20 +1861,16 @@ var ZodType = class {
|
|
1906
1861
|
};
|
1907
1862
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
1908
1863
|
var cuid2Regex = /^[0-9a-z]+$/;
|
1909
|
-
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
1864
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
1910
1865
|
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;
|
1911
1866
|
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
1912
|
-
var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
1913
1867
|
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)?)??$/;
|
1914
1868
|
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
1915
1869
|
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
1916
1870
|
var emojiRegex;
|
1917
1871
|
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])$/;
|
1918
|
-
var
|
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])$/;
|
1872
|
+
var 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})))$/;
|
1921
1873
|
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}(=)?))?$/;
|
1923
1874
|
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])))`;
|
1924
1875
|
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
1925
1876
|
function timeRegexSource(args) {
|
@@ -1952,33 +1903,6 @@ function isValidIP(ip, version) {
|
|
1952
1903
|
}
|
1953
1904
|
return false;
|
1954
1905
|
}
|
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
|
-
}
|
1982
1906
|
var ZodString = class _ZodString extends ZodType {
|
1983
1907
|
_parse(input) {
|
1984
1908
|
if (this._def.coerce) {
|
@@ -2235,26 +2159,6 @@ var ZodString = class _ZodString extends ZodType {
|
|
2235
2159
|
});
|
2236
2160
|
status.dirty();
|
2237
2161
|
}
|
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
|
-
}
|
2258
2162
|
} else if (check.kind === "base64") {
|
2259
2163
|
if (!base64Regex.test(input.data)) {
|
2260
2164
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -2265,16 +2169,6 @@ var ZodString = class _ZodString extends ZodType {
|
|
2265
2169
|
});
|
2266
2170
|
status.dirty();
|
2267
2171
|
}
|
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
|
-
}
|
2278
2172
|
} else {
|
2279
2173
|
util.assertNever(check);
|
2280
2174
|
}
|
@@ -2321,21 +2215,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
2321
2215
|
base64(message) {
|
2322
2216
|
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
2323
2217
|
}
|
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
|
-
}
|
2333
2218
|
ip(options) {
|
2334
2219
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
2335
2220
|
}
|
2336
|
-
cidr(options) {
|
2337
|
-
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
2338
|
-
}
|
2339
2221
|
datetime(options) {
|
2340
2222
|
var _a, _b;
|
2341
2223
|
if (typeof options === "string") {
|
@@ -2426,7 +2308,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
2426
2308
|
});
|
2427
2309
|
}
|
2428
2310
|
/**
|
2429
|
-
*
|
2311
|
+
* @deprecated Use z.string().min(1) instead.
|
2312
|
+
* @see {@link ZodString.min}
|
2430
2313
|
*/
|
2431
2314
|
nonempty(message) {
|
2432
2315
|
return this.min(1, errorUtil.errToObj(message));
|
@@ -2488,15 +2371,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
2488
2371
|
get isIP() {
|
2489
2372
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
2490
2373
|
}
|
2491
|
-
get isCIDR() {
|
2492
|
-
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
2493
|
-
}
|
2494
2374
|
get isBase64() {
|
2495
2375
|
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
2496
2376
|
}
|
2497
|
-
get isBase64url() {
|
2498
|
-
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
2499
|
-
}
|
2500
2377
|
get minLength() {
|
2501
2378
|
let min = null;
|
2502
2379
|
for (const ch of this._def.checks) {
|
@@ -2774,15 +2651,17 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
2774
2651
|
}
|
2775
2652
|
_parse(input) {
|
2776
2653
|
if (this._def.coerce) {
|
2777
|
-
|
2778
|
-
input.data = BigInt(input.data);
|
2779
|
-
} catch (_a) {
|
2780
|
-
return this._getInvalidInput(input);
|
2781
|
-
}
|
2654
|
+
input.data = BigInt(input.data);
|
2782
2655
|
}
|
2783
2656
|
const parsedType = this._getType(input);
|
2784
2657
|
if (parsedType !== ZodParsedType.bigint) {
|
2785
|
-
|
2658
|
+
const ctx2 = this._getOrReturnCtx(input);
|
2659
|
+
addIssueToContext(ctx2, {
|
2660
|
+
code: ZodIssueCode.invalid_type,
|
2661
|
+
expected: ZodParsedType.bigint,
|
2662
|
+
received: ctx2.parsedType
|
2663
|
+
});
|
2664
|
+
return INVALID;
|
2786
2665
|
}
|
2787
2666
|
let ctx = void 0;
|
2788
2667
|
const status = new ParseStatus();
|
@@ -2829,15 +2708,6 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
2829
2708
|
}
|
2830
2709
|
return { status: status.value, value: input.data };
|
2831
2710
|
}
|
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
|
-
}
|
2841
2711
|
gte(value, message) {
|
2842
2712
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
2843
2713
|
}
|