@open-condo/ui 2.40.0 → 2.41.1
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/dist/components/Card/_utils/index.d.ts +1 -1
- package/dist/components/Card/_utils/index.d.ts.map +1 -1
- package/dist/components/ProgressIndicator/steps.d.ts +3 -3
- package/dist/components/ProgressIndicator/steps.d.ts.map +1 -1
- package/dist/components/Select/hooks/useItems.d.ts +1 -1
- package/dist/components/Select/hooks/useItems.d.ts.map +1 -1
- package/dist/components/Select/select.d.ts.map +1 -1
- package/dist/events.js +201 -402
- package/dist/index.js +30772 -25016
- package/dist/style-vars/variables.css +3 -1
- package/dist/style-vars/variables.less +3 -1
- package/dist/styles.css +7 -7
- package/dist/styles.min.css +2 -2
- package/package.json +8 -8
package/dist/events.js
CHANGED
|
@@ -1767,10 +1767,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1767
1767
|
isValidCondoUIMessage: function() { return /* binding */ isValidCondoUIMessage; }
|
|
1768
1768
|
});
|
|
1769
1769
|
|
|
1770
|
-
;// CONCATENATED MODULE: ./node_modules/zod/
|
|
1770
|
+
;// CONCATENATED MODULE: ./node_modules/zod/v3/helpers/util.js
|
|
1771
1771
|
var util;
|
|
1772
1772
|
(function (util) {
|
|
1773
|
-
util.assertEqual = (
|
|
1773
|
+
util.assertEqual = (_) => { };
|
|
1774
1774
|
function assertIs(_arg) { }
|
|
1775
1775
|
util.assertIs = assertIs;
|
|
1776
1776
|
function assertNever(_x) {
|
|
@@ -1817,11 +1817,9 @@ var util;
|
|
|
1817
1817
|
};
|
|
1818
1818
|
util.isInteger = typeof Number.isInteger === "function"
|
|
1819
1819
|
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
|
1820
|
-
: (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
1820
|
+
: (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
|
1821
1821
|
function joinValues(array, separator = " | ") {
|
|
1822
|
-
return array
|
|
1823
|
-
.map((val) => (typeof val === "string" ? `'${val}'` : val))
|
|
1824
|
-
.join(separator);
|
|
1822
|
+
return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
|
|
1825
1823
|
}
|
|
1826
1824
|
util.joinValues = joinValues;
|
|
1827
1825
|
util.jsonStringifyReplacer = (_, value) => {
|
|
@@ -1870,7 +1868,7 @@ const getParsedType = (data) => {
|
|
|
1870
1868
|
case "string":
|
|
1871
1869
|
return ZodParsedType.string;
|
|
1872
1870
|
case "number":
|
|
1873
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
1871
|
+
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
1874
1872
|
case "boolean":
|
|
1875
1873
|
return ZodParsedType.boolean;
|
|
1876
1874
|
case "function":
|
|
@@ -1886,10 +1884,7 @@ const getParsedType = (data) => {
|
|
|
1886
1884
|
if (data === null) {
|
|
1887
1885
|
return ZodParsedType.null;
|
|
1888
1886
|
}
|
|
1889
|
-
if (data.then &&
|
|
1890
|
-
typeof data.then === "function" &&
|
|
1891
|
-
data.catch &&
|
|
1892
|
-
typeof data.catch === "function") {
|
|
1887
|
+
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
|
1893
1888
|
return ZodParsedType.promise;
|
|
1894
1889
|
}
|
|
1895
1890
|
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
@@ -1907,6 +1902,8 @@ const getParsedType = (data) => {
|
|
|
1907
1902
|
}
|
|
1908
1903
|
};
|
|
1909
1904
|
|
|
1905
|
+
;// CONCATENATED MODULE: ./node_modules/zod/v3/ZodError.js
|
|
1906
|
+
|
|
1910
1907
|
const ZodIssueCode = util.arrayToEnum([
|
|
1911
1908
|
"invalid_type",
|
|
1912
1909
|
"invalid_literal",
|
|
@@ -2021,8 +2018,9 @@ class ZodError extends Error {
|
|
|
2021
2018
|
const formErrors = [];
|
|
2022
2019
|
for (const sub of this.issues) {
|
|
2023
2020
|
if (sub.path.length > 0) {
|
|
2024
|
-
|
|
2025
|
-
fieldErrors[
|
|
2021
|
+
const firstEl = sub.path[0];
|
|
2022
|
+
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
|
|
2023
|
+
fieldErrors[firstEl].push(mapper(sub));
|
|
2026
2024
|
}
|
|
2027
2025
|
else {
|
|
2028
2026
|
formErrors.push(mapper(sub));
|
|
@@ -2039,6 +2037,9 @@ ZodError.create = (issues) => {
|
|
|
2039
2037
|
return error;
|
|
2040
2038
|
};
|
|
2041
2039
|
|
|
2040
|
+
;// CONCATENATED MODULE: ./node_modules/zod/v3/locales/en.js
|
|
2041
|
+
|
|
2042
|
+
|
|
2042
2043
|
const errorMap = (issue, _ctx) => {
|
|
2043
2044
|
let message;
|
|
2044
2045
|
switch (issue.code) {
|
|
@@ -2105,17 +2106,11 @@ const errorMap = (issue, _ctx) => {
|
|
|
2105
2106
|
else if (issue.type === "string")
|
|
2106
2107
|
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
2107
2108
|
else if (issue.type === "number")
|
|
2108
|
-
message = `Number must be ${issue.exact
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
? `greater than or equal to `
|
|
2112
|
-
: `greater than `}${issue.minimum}`;
|
|
2109
|
+
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
2110
|
+
else if (issue.type === "bigint")
|
|
2111
|
+
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
2113
2112
|
else if (issue.type === "date")
|
|
2114
|
-
message = `Date must be ${issue.exact
|
|
2115
|
-
? `exactly equal to `
|
|
2116
|
-
: issue.inclusive
|
|
2117
|
-
? `greater than or equal to `
|
|
2118
|
-
: `greater than `}${new Date(Number(issue.minimum))}`;
|
|
2113
|
+
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
2119
2114
|
else
|
|
2120
2115
|
message = "Invalid input";
|
|
2121
2116
|
break;
|
|
@@ -2125,23 +2120,11 @@ const errorMap = (issue, _ctx) => {
|
|
|
2125
2120
|
else if (issue.type === "string")
|
|
2126
2121
|
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
2127
2122
|
else if (issue.type === "number")
|
|
2128
|
-
message = `Number must be ${issue.exact
|
|
2129
|
-
? `exactly`
|
|
2130
|
-
: issue.inclusive
|
|
2131
|
-
? `less than or equal to`
|
|
2132
|
-
: `less than`} ${issue.maximum}`;
|
|
2123
|
+
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
2133
2124
|
else if (issue.type === "bigint")
|
|
2134
|
-
message = `BigInt must be ${issue.exact
|
|
2135
|
-
? `exactly`
|
|
2136
|
-
: issue.inclusive
|
|
2137
|
-
? `less than or equal to`
|
|
2138
|
-
: `less than`} ${issue.maximum}`;
|
|
2125
|
+
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
2139
2126
|
else if (issue.type === "date")
|
|
2140
|
-
message = `Date must be ${issue.exact
|
|
2141
|
-
? `exactly`
|
|
2142
|
-
: issue.inclusive
|
|
2143
|
-
? `smaller than or equal to`
|
|
2144
|
-
: `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
2127
|
+
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
2145
2128
|
else
|
|
2146
2129
|
message = "Invalid input";
|
|
2147
2130
|
break;
|
|
@@ -2163,8 +2146,12 @@ const errorMap = (issue, _ctx) => {
|
|
|
2163
2146
|
}
|
|
2164
2147
|
return { message };
|
|
2165
2148
|
};
|
|
2149
|
+
/* harmony default export */ var en = (errorMap);
|
|
2150
|
+
|
|
2151
|
+
;// CONCATENATED MODULE: ./node_modules/zod/v3/errors.js
|
|
2152
|
+
|
|
2153
|
+
let overrideErrorMap = en;
|
|
2166
2154
|
|
|
2167
|
-
let overrideErrorMap = errorMap;
|
|
2168
2155
|
function setErrorMap(map) {
|
|
2169
2156
|
overrideErrorMap = map;
|
|
2170
2157
|
}
|
|
@@ -2172,6 +2159,17 @@ function getErrorMap() {
|
|
|
2172
2159
|
return overrideErrorMap;
|
|
2173
2160
|
}
|
|
2174
2161
|
|
|
2162
|
+
;// CONCATENATED MODULE: ./node_modules/zod/v3/helpers/errorUtil.js
|
|
2163
|
+
var errorUtil;
|
|
2164
|
+
(function (errorUtil) {
|
|
2165
|
+
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
2166
|
+
// biome-ignore lint:
|
|
2167
|
+
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
2168
|
+
})(errorUtil || (errorUtil = {}));
|
|
2169
|
+
|
|
2170
|
+
;// CONCATENATED MODULE: ./node_modules/zod/v3/helpers/parseUtil.js
|
|
2171
|
+
|
|
2172
|
+
|
|
2175
2173
|
const makeIssue = (params) => {
|
|
2176
2174
|
const { data, path, errorMaps, issueData } = params;
|
|
2177
2175
|
const fullPath = [...path, ...(issueData.path || [])];
|
|
@@ -2200,7 +2198,7 @@ const makeIssue = (params) => {
|
|
|
2200
2198
|
message: errorMessage,
|
|
2201
2199
|
};
|
|
2202
2200
|
};
|
|
2203
|
-
const EMPTY_PATH = [];
|
|
2201
|
+
const EMPTY_PATH = (/* unused pure expression or super */ null && ([]));
|
|
2204
2202
|
function addIssueToContext(ctx, issueData) {
|
|
2205
2203
|
const overrideMap = getErrorMap();
|
|
2206
2204
|
const issue = makeIssue({
|
|
@@ -2211,7 +2209,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
2211
2209
|
ctx.common.contextualErrorMap, // contextual error map is first priority
|
|
2212
2210
|
ctx.schemaErrorMap, // then schema-bound map if available
|
|
2213
2211
|
overrideMap, // then global override map
|
|
2214
|
-
overrideMap ===
|
|
2212
|
+
overrideMap === en ? undefined : en, // then global default map
|
|
2215
2213
|
].filter((x) => !!x),
|
|
2216
2214
|
});
|
|
2217
2215
|
ctx.common.issues.push(issue);
|
|
@@ -2232,7 +2230,7 @@ class ParseStatus {
|
|
|
2232
2230
|
const arrayValue = [];
|
|
2233
2231
|
for (const s of results) {
|
|
2234
2232
|
if (s.status === "aborted")
|
|
2235
|
-
return
|
|
2233
|
+
return parseUtil_INVALID;
|
|
2236
2234
|
if (s.status === "dirty")
|
|
2237
2235
|
status.dirty();
|
|
2238
2236
|
arrayValue.push(s.value);
|
|
@@ -2256,22 +2254,21 @@ class ParseStatus {
|
|
|
2256
2254
|
for (const pair of pairs) {
|
|
2257
2255
|
const { key, value } = pair;
|
|
2258
2256
|
if (key.status === "aborted")
|
|
2259
|
-
return
|
|
2257
|
+
return parseUtil_INVALID;
|
|
2260
2258
|
if (value.status === "aborted")
|
|
2261
|
-
return
|
|
2259
|
+
return parseUtil_INVALID;
|
|
2262
2260
|
if (key.status === "dirty")
|
|
2263
2261
|
status.dirty();
|
|
2264
2262
|
if (value.status === "dirty")
|
|
2265
2263
|
status.dirty();
|
|
2266
|
-
if (key.value !== "__proto__" &&
|
|
2267
|
-
(typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
2264
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
2268
2265
|
finalObject[key.value] = value.value;
|
|
2269
2266
|
}
|
|
2270
2267
|
}
|
|
2271
2268
|
return { status: status.value, value: finalObject };
|
|
2272
2269
|
}
|
|
2273
2270
|
}
|
|
2274
|
-
const
|
|
2271
|
+
const parseUtil_INVALID = Object.freeze({
|
|
2275
2272
|
status: "aborted",
|
|
2276
2273
|
});
|
|
2277
2274
|
const DIRTY = (value) => ({ status: "dirty", value });
|
|
@@ -2281,46 +2278,12 @@ const isDirty = (x) => x.status === "dirty";
|
|
|
2281
2278
|
const isValid = (x) => x.status === "valid";
|
|
2282
2279
|
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
2283
2280
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
purpose with or without fee is hereby granted.
|
|
2289
|
-
|
|
2290
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2291
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2292
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2293
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2294
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2295
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2296
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
2297
|
-
***************************************************************************** */
|
|
2298
|
-
|
|
2299
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
2300
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
2301
|
-
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");
|
|
2302
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
2306
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
2307
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
2308
|
-
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");
|
|
2309
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2313
|
-
var e = new Error(message);
|
|
2314
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2315
|
-
};
|
|
2281
|
+
;// CONCATENATED MODULE: ./node_modules/zod/v3/types.js
|
|
2282
|
+
|
|
2283
|
+
|
|
2284
|
+
|
|
2316
2285
|
|
|
2317
|
-
var errorUtil;
|
|
2318
|
-
(function (errorUtil) {
|
|
2319
|
-
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
2320
|
-
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
2321
|
-
})(errorUtil || (errorUtil = {}));
|
|
2322
2286
|
|
|
2323
|
-
var _ZodEnum_cache, _ZodNativeEnum_cache;
|
|
2324
2287
|
class ParseInputLazyPath {
|
|
2325
2288
|
constructor(parent, value, path, key) {
|
|
2326
2289
|
this._cachedPath = [];
|
|
@@ -2331,7 +2294,7 @@ class ParseInputLazyPath {
|
|
|
2331
2294
|
}
|
|
2332
2295
|
get path() {
|
|
2333
2296
|
if (!this._cachedPath.length) {
|
|
2334
|
-
if (this._key
|
|
2297
|
+
if (Array.isArray(this._key)) {
|
|
2335
2298
|
this._cachedPath.push(...this._path, ...this._key);
|
|
2336
2299
|
}
|
|
2337
2300
|
else {
|
|
@@ -2371,17 +2334,16 @@ function processCreateParams(params) {
|
|
|
2371
2334
|
if (errorMap)
|
|
2372
2335
|
return { errorMap: errorMap, description };
|
|
2373
2336
|
const customMap = (iss, ctx) => {
|
|
2374
|
-
var _a, _b;
|
|
2375
2337
|
const { message } = params;
|
|
2376
2338
|
if (iss.code === "invalid_enum_value") {
|
|
2377
|
-
return { message: message
|
|
2339
|
+
return { message: message ?? ctx.defaultError };
|
|
2378
2340
|
}
|
|
2379
2341
|
if (typeof ctx.data === "undefined") {
|
|
2380
|
-
return { message:
|
|
2342
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
|
2381
2343
|
}
|
|
2382
2344
|
if (iss.code !== "invalid_type")
|
|
2383
2345
|
return { message: ctx.defaultError };
|
|
2384
|
-
return { message:
|
|
2346
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
|
2385
2347
|
};
|
|
2386
2348
|
return { errorMap: customMap, description };
|
|
2387
2349
|
}
|
|
@@ -2433,14 +2395,13 @@ class ZodType {
|
|
|
2433
2395
|
throw result.error;
|
|
2434
2396
|
}
|
|
2435
2397
|
safeParse(data, params) {
|
|
2436
|
-
var _a;
|
|
2437
2398
|
const ctx = {
|
|
2438
2399
|
common: {
|
|
2439
2400
|
issues: [],
|
|
2440
|
-
async:
|
|
2441
|
-
contextualErrorMap: params
|
|
2401
|
+
async: params?.async ?? false,
|
|
2402
|
+
contextualErrorMap: params?.errorMap,
|
|
2442
2403
|
},
|
|
2443
|
-
path:
|
|
2404
|
+
path: params?.path || [],
|
|
2444
2405
|
schemaErrorMap: this._def.errorMap,
|
|
2445
2406
|
parent: null,
|
|
2446
2407
|
data,
|
|
@@ -2450,7 +2411,6 @@ class ZodType {
|
|
|
2450
2411
|
return handleResult(ctx, result);
|
|
2451
2412
|
}
|
|
2452
2413
|
"~validate"(data) {
|
|
2453
|
-
var _a, _b;
|
|
2454
2414
|
const ctx = {
|
|
2455
2415
|
common: {
|
|
2456
2416
|
issues: [],
|
|
@@ -2474,7 +2434,7 @@ class ZodType {
|
|
|
2474
2434
|
};
|
|
2475
2435
|
}
|
|
2476
2436
|
catch (err) {
|
|
2477
|
-
if (
|
|
2437
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
2478
2438
|
this["~standard"].async = true;
|
|
2479
2439
|
}
|
|
2480
2440
|
ctx.common = {
|
|
@@ -2501,19 +2461,17 @@ class ZodType {
|
|
|
2501
2461
|
const ctx = {
|
|
2502
2462
|
common: {
|
|
2503
2463
|
issues: [],
|
|
2504
|
-
contextualErrorMap: params
|
|
2464
|
+
contextualErrorMap: params?.errorMap,
|
|
2505
2465
|
async: true,
|
|
2506
2466
|
},
|
|
2507
|
-
path:
|
|
2467
|
+
path: params?.path || [],
|
|
2508
2468
|
schemaErrorMap: this._def.errorMap,
|
|
2509
2469
|
parent: null,
|
|
2510
2470
|
data,
|
|
2511
2471
|
parsedType: getParsedType(data),
|
|
2512
2472
|
};
|
|
2513
2473
|
const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
|
|
2514
|
-
const result = await (isAsync(maybeAsyncResult)
|
|
2515
|
-
? maybeAsyncResult
|
|
2516
|
-
: Promise.resolve(maybeAsyncResult));
|
|
2474
|
+
const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
2517
2475
|
return handleResult(ctx, result);
|
|
2518
2476
|
}
|
|
2519
2477
|
refine(check, message) {
|
|
@@ -2557,9 +2515,7 @@ class ZodType {
|
|
|
2557
2515
|
refinement(check, refinementData) {
|
|
2558
2516
|
return this._refinement((val, ctx) => {
|
|
2559
2517
|
if (!check(val)) {
|
|
2560
|
-
ctx.addIssue(typeof refinementData === "function"
|
|
2561
|
-
? refinementData(val, ctx)
|
|
2562
|
-
: refinementData);
|
|
2518
|
+
ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
|
|
2563
2519
|
return false;
|
|
2564
2520
|
}
|
|
2565
2521
|
else {
|
|
@@ -2731,15 +2687,15 @@ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z
|
|
|
2731
2687
|
const 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])))`;
|
|
2732
2688
|
const dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
2733
2689
|
function timeRegexSource(args) {
|
|
2734
|
-
|
|
2735
|
-
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
2690
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
2736
2691
|
if (args.precision) {
|
|
2737
|
-
|
|
2692
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
2738
2693
|
}
|
|
2739
2694
|
else if (args.precision == null) {
|
|
2740
|
-
|
|
2695
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
2741
2696
|
}
|
|
2742
|
-
|
|
2697
|
+
const secondsQuantifier = args.precision ? "+" : "?"; // require seconds if precision is nonzero
|
|
2698
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
2743
2699
|
}
|
|
2744
2700
|
function timeRegex(args) {
|
|
2745
2701
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
@@ -2768,6 +2724,8 @@ function isValidJWT(jwt, alg) {
|
|
|
2768
2724
|
return false;
|
|
2769
2725
|
try {
|
|
2770
2726
|
const [header] = jwt.split(".");
|
|
2727
|
+
if (!header)
|
|
2728
|
+
return false;
|
|
2771
2729
|
// Convert base64url to base64
|
|
2772
2730
|
const base64 = header
|
|
2773
2731
|
.replace(/-/g, "+")
|
|
@@ -2776,13 +2734,15 @@ function isValidJWT(jwt, alg) {
|
|
|
2776
2734
|
const decoded = JSON.parse(atob(base64));
|
|
2777
2735
|
if (typeof decoded !== "object" || decoded === null)
|
|
2778
2736
|
return false;
|
|
2779
|
-
if (
|
|
2737
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
2738
|
+
return false;
|
|
2739
|
+
if (!decoded.alg)
|
|
2780
2740
|
return false;
|
|
2781
2741
|
if (alg && decoded.alg !== alg)
|
|
2782
2742
|
return false;
|
|
2783
2743
|
return true;
|
|
2784
2744
|
}
|
|
2785
|
-
catch
|
|
2745
|
+
catch {
|
|
2786
2746
|
return false;
|
|
2787
2747
|
}
|
|
2788
2748
|
}
|
|
@@ -2808,7 +2768,7 @@ class ZodString extends ZodType {
|
|
|
2808
2768
|
expected: ZodParsedType.string,
|
|
2809
2769
|
received: ctx.parsedType,
|
|
2810
2770
|
});
|
|
2811
|
-
return
|
|
2771
|
+
return parseUtil_INVALID;
|
|
2812
2772
|
}
|
|
2813
2773
|
const status = new ParseStatus();
|
|
2814
2774
|
let ctx = undefined;
|
|
@@ -2953,7 +2913,7 @@ class ZodString extends ZodType {
|
|
|
2953
2913
|
try {
|
|
2954
2914
|
new URL(input.data);
|
|
2955
2915
|
}
|
|
2956
|
-
catch
|
|
2916
|
+
catch {
|
|
2957
2917
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
2958
2918
|
addIssueToContext(ctx, {
|
|
2959
2919
|
validation: "url",
|
|
@@ -3183,7 +3143,6 @@ class ZodString extends ZodType {
|
|
|
3183
3143
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
3184
3144
|
}
|
|
3185
3145
|
datetime(options) {
|
|
3186
|
-
var _a, _b;
|
|
3187
3146
|
if (typeof options === "string") {
|
|
3188
3147
|
return this._addCheck({
|
|
3189
3148
|
kind: "datetime",
|
|
@@ -3195,10 +3154,10 @@ class ZodString extends ZodType {
|
|
|
3195
3154
|
}
|
|
3196
3155
|
return this._addCheck({
|
|
3197
3156
|
kind: "datetime",
|
|
3198
|
-
precision: typeof
|
|
3199
|
-
offset:
|
|
3200
|
-
local:
|
|
3201
|
-
...errorUtil.errToObj(options
|
|
3157
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
3158
|
+
offset: options?.offset ?? false,
|
|
3159
|
+
local: options?.local ?? false,
|
|
3160
|
+
...errorUtil.errToObj(options?.message),
|
|
3202
3161
|
});
|
|
3203
3162
|
}
|
|
3204
3163
|
date(message) {
|
|
@@ -3214,8 +3173,8 @@ class ZodString extends ZodType {
|
|
|
3214
3173
|
}
|
|
3215
3174
|
return this._addCheck({
|
|
3216
3175
|
kind: "time",
|
|
3217
|
-
precision: typeof
|
|
3218
|
-
...errorUtil.errToObj(options
|
|
3176
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
3177
|
+
...errorUtil.errToObj(options?.message),
|
|
3219
3178
|
});
|
|
3220
3179
|
}
|
|
3221
3180
|
duration(message) {
|
|
@@ -3232,8 +3191,8 @@ class ZodString extends ZodType {
|
|
|
3232
3191
|
return this._addCheck({
|
|
3233
3192
|
kind: "includes",
|
|
3234
3193
|
value: value,
|
|
3235
|
-
position: options
|
|
3236
|
-
...errorUtil.errToObj(options
|
|
3194
|
+
position: options?.position,
|
|
3195
|
+
...errorUtil.errToObj(options?.message),
|
|
3237
3196
|
});
|
|
3238
3197
|
}
|
|
3239
3198
|
startsWith(value, message) {
|
|
@@ -3366,11 +3325,10 @@ class ZodString extends ZodType {
|
|
|
3366
3325
|
}
|
|
3367
3326
|
}
|
|
3368
3327
|
ZodString.create = (params) => {
|
|
3369
|
-
var _a;
|
|
3370
3328
|
return new ZodString({
|
|
3371
3329
|
checks: [],
|
|
3372
3330
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
3373
|
-
coerce:
|
|
3331
|
+
coerce: params?.coerce ?? false,
|
|
3374
3332
|
...processCreateParams(params),
|
|
3375
3333
|
});
|
|
3376
3334
|
};
|
|
@@ -3379,9 +3337,9 @@ function floatSafeRemainder(val, step) {
|
|
|
3379
3337
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
3380
3338
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
3381
3339
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
3382
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
|
3383
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
3384
|
-
return (valInt % stepInt) /
|
|
3340
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
3341
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
3342
|
+
return (valInt % stepInt) / 10 ** decCount;
|
|
3385
3343
|
}
|
|
3386
3344
|
class ZodNumber extends ZodType {
|
|
3387
3345
|
constructor() {
|
|
@@ -3402,7 +3360,7 @@ class ZodNumber extends ZodType {
|
|
|
3402
3360
|
expected: ZodParsedType.number,
|
|
3403
3361
|
received: ctx.parsedType,
|
|
3404
3362
|
});
|
|
3405
|
-
return
|
|
3363
|
+
return parseUtil_INVALID;
|
|
3406
3364
|
}
|
|
3407
3365
|
let ctx = undefined;
|
|
3408
3366
|
const status = new ParseStatus();
|
|
@@ -3420,9 +3378,7 @@ class ZodNumber extends ZodType {
|
|
|
3420
3378
|
}
|
|
3421
3379
|
}
|
|
3422
3380
|
else if (check.kind === "min") {
|
|
3423
|
-
const tooSmall = check.inclusive
|
|
3424
|
-
? input.data < check.value
|
|
3425
|
-
: input.data <= check.value;
|
|
3381
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
3426
3382
|
if (tooSmall) {
|
|
3427
3383
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
3428
3384
|
addIssueToContext(ctx, {
|
|
@@ -3437,9 +3393,7 @@ class ZodNumber extends ZodType {
|
|
|
3437
3393
|
}
|
|
3438
3394
|
}
|
|
3439
3395
|
else if (check.kind === "max") {
|
|
3440
|
-
const tooBig = check.inclusive
|
|
3441
|
-
? input.data > check.value
|
|
3442
|
-
: input.data >= check.value;
|
|
3396
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
3443
3397
|
if (tooBig) {
|
|
3444
3398
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
3445
3399
|
addIssueToContext(ctx, {
|
|
@@ -3597,15 +3551,13 @@ class ZodNumber extends ZodType {
|
|
|
3597
3551
|
return max;
|
|
3598
3552
|
}
|
|
3599
3553
|
get isInt() {
|
|
3600
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" ||
|
|
3601
|
-
(ch.kind === "multipleOf" && util.isInteger(ch.value)));
|
|
3554
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util.isInteger(ch.value)));
|
|
3602
3555
|
}
|
|
3603
3556
|
get isFinite() {
|
|
3604
|
-
let max = null
|
|
3557
|
+
let max = null;
|
|
3558
|
+
let min = null;
|
|
3605
3559
|
for (const ch of this._def.checks) {
|
|
3606
|
-
if (ch.kind === "finite" ||
|
|
3607
|
-
ch.kind === "int" ||
|
|
3608
|
-
ch.kind === "multipleOf") {
|
|
3560
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
3609
3561
|
return true;
|
|
3610
3562
|
}
|
|
3611
3563
|
else if (ch.kind === "min") {
|
|
@@ -3624,7 +3576,7 @@ ZodNumber.create = (params) => {
|
|
|
3624
3576
|
return new ZodNumber({
|
|
3625
3577
|
checks: [],
|
|
3626
3578
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
3627
|
-
coerce:
|
|
3579
|
+
coerce: params?.coerce || false,
|
|
3628
3580
|
...processCreateParams(params),
|
|
3629
3581
|
});
|
|
3630
3582
|
};
|
|
@@ -3639,7 +3591,7 @@ class ZodBigInt extends ZodType {
|
|
|
3639
3591
|
try {
|
|
3640
3592
|
input.data = BigInt(input.data);
|
|
3641
3593
|
}
|
|
3642
|
-
catch
|
|
3594
|
+
catch {
|
|
3643
3595
|
return this._getInvalidInput(input);
|
|
3644
3596
|
}
|
|
3645
3597
|
}
|
|
@@ -3651,9 +3603,7 @@ class ZodBigInt extends ZodType {
|
|
|
3651
3603
|
const status = new ParseStatus();
|
|
3652
3604
|
for (const check of this._def.checks) {
|
|
3653
3605
|
if (check.kind === "min") {
|
|
3654
|
-
const tooSmall = check.inclusive
|
|
3655
|
-
? input.data < check.value
|
|
3656
|
-
: input.data <= check.value;
|
|
3606
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
3657
3607
|
if (tooSmall) {
|
|
3658
3608
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
3659
3609
|
addIssueToContext(ctx, {
|
|
@@ -3667,9 +3617,7 @@ class ZodBigInt extends ZodType {
|
|
|
3667
3617
|
}
|
|
3668
3618
|
}
|
|
3669
3619
|
else if (check.kind === "max") {
|
|
3670
|
-
const tooBig = check.inclusive
|
|
3671
|
-
? input.data > check.value
|
|
3672
|
-
: input.data >= check.value;
|
|
3620
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
3673
3621
|
if (tooBig) {
|
|
3674
3622
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
3675
3623
|
addIssueToContext(ctx, {
|
|
@@ -3706,7 +3654,7 @@ class ZodBigInt extends ZodType {
|
|
|
3706
3654
|
expected: ZodParsedType.bigint,
|
|
3707
3655
|
received: ctx.parsedType,
|
|
3708
3656
|
});
|
|
3709
|
-
return
|
|
3657
|
+
return parseUtil_INVALID;
|
|
3710
3658
|
}
|
|
3711
3659
|
gte(value, message) {
|
|
3712
3660
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
@@ -3801,11 +3749,10 @@ class ZodBigInt extends ZodType {
|
|
|
3801
3749
|
}
|
|
3802
3750
|
}
|
|
3803
3751
|
ZodBigInt.create = (params) => {
|
|
3804
|
-
var _a;
|
|
3805
3752
|
return new ZodBigInt({
|
|
3806
3753
|
checks: [],
|
|
3807
3754
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
3808
|
-
coerce:
|
|
3755
|
+
coerce: params?.coerce ?? false,
|
|
3809
3756
|
...processCreateParams(params),
|
|
3810
3757
|
});
|
|
3811
3758
|
};
|
|
@@ -3822,7 +3769,7 @@ class ZodBoolean extends ZodType {
|
|
|
3822
3769
|
expected: ZodParsedType.boolean,
|
|
3823
3770
|
received: ctx.parsedType,
|
|
3824
3771
|
});
|
|
3825
|
-
return
|
|
3772
|
+
return parseUtil_INVALID;
|
|
3826
3773
|
}
|
|
3827
3774
|
return OK(input.data);
|
|
3828
3775
|
}
|
|
@@ -3830,7 +3777,7 @@ class ZodBoolean extends ZodType {
|
|
|
3830
3777
|
ZodBoolean.create = (params) => {
|
|
3831
3778
|
return new ZodBoolean({
|
|
3832
3779
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
3833
|
-
coerce:
|
|
3780
|
+
coerce: params?.coerce || false,
|
|
3834
3781
|
...processCreateParams(params),
|
|
3835
3782
|
});
|
|
3836
3783
|
};
|
|
@@ -3847,14 +3794,14 @@ class ZodDate extends ZodType {
|
|
|
3847
3794
|
expected: ZodParsedType.date,
|
|
3848
3795
|
received: ctx.parsedType,
|
|
3849
3796
|
});
|
|
3850
|
-
return
|
|
3797
|
+
return parseUtil_INVALID;
|
|
3851
3798
|
}
|
|
3852
|
-
if (isNaN(input.data.getTime())) {
|
|
3799
|
+
if (Number.isNaN(input.data.getTime())) {
|
|
3853
3800
|
const ctx = this._getOrReturnCtx(input);
|
|
3854
3801
|
addIssueToContext(ctx, {
|
|
3855
3802
|
code: ZodIssueCode.invalid_date,
|
|
3856
3803
|
});
|
|
3857
|
-
return
|
|
3804
|
+
return parseUtil_INVALID;
|
|
3858
3805
|
}
|
|
3859
3806
|
const status = new ParseStatus();
|
|
3860
3807
|
let ctx = undefined;
|
|
@@ -3940,7 +3887,7 @@ class ZodDate extends ZodType {
|
|
|
3940
3887
|
ZodDate.create = (params) => {
|
|
3941
3888
|
return new ZodDate({
|
|
3942
3889
|
checks: [],
|
|
3943
|
-
coerce:
|
|
3890
|
+
coerce: params?.coerce || false,
|
|
3944
3891
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
3945
3892
|
...processCreateParams(params),
|
|
3946
3893
|
});
|
|
@@ -3955,7 +3902,7 @@ class ZodSymbol extends ZodType {
|
|
|
3955
3902
|
expected: ZodParsedType.symbol,
|
|
3956
3903
|
received: ctx.parsedType,
|
|
3957
3904
|
});
|
|
3958
|
-
return
|
|
3905
|
+
return parseUtil_INVALID;
|
|
3959
3906
|
}
|
|
3960
3907
|
return OK(input.data);
|
|
3961
3908
|
}
|
|
@@ -3976,7 +3923,7 @@ class ZodUndefined extends ZodType {
|
|
|
3976
3923
|
expected: ZodParsedType.undefined,
|
|
3977
3924
|
received: ctx.parsedType,
|
|
3978
3925
|
});
|
|
3979
|
-
return
|
|
3926
|
+
return parseUtil_INVALID;
|
|
3980
3927
|
}
|
|
3981
3928
|
return OK(input.data);
|
|
3982
3929
|
}
|
|
@@ -3997,7 +3944,7 @@ class ZodNull extends ZodType {
|
|
|
3997
3944
|
expected: ZodParsedType.null,
|
|
3998
3945
|
received: ctx.parsedType,
|
|
3999
3946
|
});
|
|
4000
|
-
return
|
|
3947
|
+
return parseUtil_INVALID;
|
|
4001
3948
|
}
|
|
4002
3949
|
return OK(input.data);
|
|
4003
3950
|
}
|
|
@@ -4048,7 +3995,7 @@ class ZodNever extends ZodType {
|
|
|
4048
3995
|
expected: ZodParsedType.never,
|
|
4049
3996
|
received: ctx.parsedType,
|
|
4050
3997
|
});
|
|
4051
|
-
return
|
|
3998
|
+
return parseUtil_INVALID;
|
|
4052
3999
|
}
|
|
4053
4000
|
}
|
|
4054
4001
|
ZodNever.create = (params) => {
|
|
@@ -4067,7 +4014,7 @@ class ZodVoid extends ZodType {
|
|
|
4067
4014
|
expected: ZodParsedType.void,
|
|
4068
4015
|
received: ctx.parsedType,
|
|
4069
4016
|
});
|
|
4070
|
-
return
|
|
4017
|
+
return parseUtil_INVALID;
|
|
4071
4018
|
}
|
|
4072
4019
|
return OK(input.data);
|
|
4073
4020
|
}
|
|
@@ -4088,7 +4035,7 @@ class ZodArray extends ZodType {
|
|
|
4088
4035
|
expected: ZodParsedType.array,
|
|
4089
4036
|
received: ctx.parsedType,
|
|
4090
4037
|
});
|
|
4091
|
-
return
|
|
4038
|
+
return parseUtil_INVALID;
|
|
4092
4039
|
}
|
|
4093
4040
|
if (def.exactLength !== null) {
|
|
4094
4041
|
const tooBig = ctx.data.length > def.exactLength.value;
|
|
@@ -4262,7 +4209,8 @@ class ZodObject extends ZodType {
|
|
|
4262
4209
|
return this._cached;
|
|
4263
4210
|
const shape = this._def.shape();
|
|
4264
4211
|
const keys = util.objectKeys(shape);
|
|
4265
|
-
|
|
4212
|
+
this._cached = { shape, keys };
|
|
4213
|
+
return this._cached;
|
|
4266
4214
|
}
|
|
4267
4215
|
_parse(input) {
|
|
4268
4216
|
const parsedType = this._getType(input);
|
|
@@ -4273,13 +4221,12 @@ class ZodObject extends ZodType {
|
|
|
4273
4221
|
expected: ZodParsedType.object,
|
|
4274
4222
|
received: ctx.parsedType,
|
|
4275
4223
|
});
|
|
4276
|
-
return
|
|
4224
|
+
return parseUtil_INVALID;
|
|
4277
4225
|
}
|
|
4278
4226
|
const { status, ctx } = this._processInputParams(input);
|
|
4279
4227
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
4280
4228
|
const extraKeys = [];
|
|
4281
|
-
if (!(this._def.catchall instanceof ZodNever &&
|
|
4282
|
-
this._def.unknownKeys === "strip")) {
|
|
4229
|
+
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
|
|
4283
4230
|
for (const key in ctx.data) {
|
|
4284
4231
|
if (!shapeKeys.includes(key)) {
|
|
4285
4232
|
extraKeys.push(key);
|
|
@@ -4315,7 +4262,8 @@ class ZodObject extends ZodType {
|
|
|
4315
4262
|
status.dirty();
|
|
4316
4263
|
}
|
|
4317
4264
|
}
|
|
4318
|
-
else if (unknownKeys === "strip")
|
|
4265
|
+
else if (unknownKeys === "strip") {
|
|
4266
|
+
}
|
|
4319
4267
|
else {
|
|
4320
4268
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
|
4321
4269
|
}
|
|
@@ -4367,11 +4315,10 @@ class ZodObject extends ZodType {
|
|
|
4367
4315
|
...(message !== undefined
|
|
4368
4316
|
? {
|
|
4369
4317
|
errorMap: (issue, ctx) => {
|
|
4370
|
-
|
|
4371
|
-
const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
|
|
4318
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
4372
4319
|
if (issue.code === "unrecognized_keys")
|
|
4373
4320
|
return {
|
|
4374
|
-
message:
|
|
4321
|
+
message: errorUtil.errToObj(message).message ?? defaultError,
|
|
4375
4322
|
};
|
|
4376
4323
|
return {
|
|
4377
4324
|
message: defaultError,
|
|
@@ -4503,11 +4450,11 @@ class ZodObject extends ZodType {
|
|
|
4503
4450
|
}
|
|
4504
4451
|
pick(mask) {
|
|
4505
4452
|
const shape = {};
|
|
4506
|
-
util.objectKeys(mask)
|
|
4453
|
+
for (const key of util.objectKeys(mask)) {
|
|
4507
4454
|
if (mask[key] && this.shape[key]) {
|
|
4508
4455
|
shape[key] = this.shape[key];
|
|
4509
4456
|
}
|
|
4510
|
-
}
|
|
4457
|
+
}
|
|
4511
4458
|
return new ZodObject({
|
|
4512
4459
|
...this._def,
|
|
4513
4460
|
shape: () => shape,
|
|
@@ -4515,11 +4462,11 @@ class ZodObject extends ZodType {
|
|
|
4515
4462
|
}
|
|
4516
4463
|
omit(mask) {
|
|
4517
4464
|
const shape = {};
|
|
4518
|
-
util.objectKeys(this.shape)
|
|
4465
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
4519
4466
|
if (!mask[key]) {
|
|
4520
4467
|
shape[key] = this.shape[key];
|
|
4521
4468
|
}
|
|
4522
|
-
}
|
|
4469
|
+
}
|
|
4523
4470
|
return new ZodObject({
|
|
4524
4471
|
...this._def,
|
|
4525
4472
|
shape: () => shape,
|
|
@@ -4533,7 +4480,7 @@ class ZodObject extends ZodType {
|
|
|
4533
4480
|
}
|
|
4534
4481
|
partial(mask) {
|
|
4535
4482
|
const newShape = {};
|
|
4536
|
-
util.objectKeys(this.shape)
|
|
4483
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
4537
4484
|
const fieldSchema = this.shape[key];
|
|
4538
4485
|
if (mask && !mask[key]) {
|
|
4539
4486
|
newShape[key] = fieldSchema;
|
|
@@ -4541,7 +4488,7 @@ class ZodObject extends ZodType {
|
|
|
4541
4488
|
else {
|
|
4542
4489
|
newShape[key] = fieldSchema.optional();
|
|
4543
4490
|
}
|
|
4544
|
-
}
|
|
4491
|
+
}
|
|
4545
4492
|
return new ZodObject({
|
|
4546
4493
|
...this._def,
|
|
4547
4494
|
shape: () => newShape,
|
|
@@ -4549,7 +4496,7 @@ class ZodObject extends ZodType {
|
|
|
4549
4496
|
}
|
|
4550
4497
|
required(mask) {
|
|
4551
4498
|
const newShape = {};
|
|
4552
|
-
util.objectKeys(this.shape)
|
|
4499
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
4553
4500
|
if (mask && !mask[key]) {
|
|
4554
4501
|
newShape[key] = this.shape[key];
|
|
4555
4502
|
}
|
|
@@ -4561,7 +4508,7 @@ class ZodObject extends ZodType {
|
|
|
4561
4508
|
}
|
|
4562
4509
|
newShape[key] = newField;
|
|
4563
4510
|
}
|
|
4564
|
-
}
|
|
4511
|
+
}
|
|
4565
4512
|
return new ZodObject({
|
|
4566
4513
|
...this._def,
|
|
4567
4514
|
shape: () => newShape,
|
|
@@ -4622,7 +4569,7 @@ class ZodUnion extends ZodType {
|
|
|
4622
4569
|
code: ZodIssueCode.invalid_union,
|
|
4623
4570
|
unionErrors,
|
|
4624
4571
|
});
|
|
4625
|
-
return
|
|
4572
|
+
return parseUtil_INVALID;
|
|
4626
4573
|
}
|
|
4627
4574
|
if (ctx.common.async) {
|
|
4628
4575
|
return Promise.all(options.map(async (option) => {
|
|
@@ -4680,7 +4627,7 @@ class ZodUnion extends ZodType {
|
|
|
4680
4627
|
code: ZodIssueCode.invalid_union,
|
|
4681
4628
|
unionErrors,
|
|
4682
4629
|
});
|
|
4683
|
-
return
|
|
4630
|
+
return parseUtil_INVALID;
|
|
4684
4631
|
}
|
|
4685
4632
|
}
|
|
4686
4633
|
get options() {
|
|
@@ -4755,7 +4702,7 @@ class ZodDiscriminatedUnion extends ZodType {
|
|
|
4755
4702
|
expected: ZodParsedType.object,
|
|
4756
4703
|
received: ctx.parsedType,
|
|
4757
4704
|
});
|
|
4758
|
-
return
|
|
4705
|
+
return parseUtil_INVALID;
|
|
4759
4706
|
}
|
|
4760
4707
|
const discriminator = this.discriminator;
|
|
4761
4708
|
const discriminatorValue = ctx.data[discriminator];
|
|
@@ -4766,7 +4713,7 @@ class ZodDiscriminatedUnion extends ZodType {
|
|
|
4766
4713
|
options: Array.from(this.optionsMap.keys()),
|
|
4767
4714
|
path: [discriminator],
|
|
4768
4715
|
});
|
|
4769
|
-
return
|
|
4716
|
+
return parseUtil_INVALID;
|
|
4770
4717
|
}
|
|
4771
4718
|
if (ctx.common.async) {
|
|
4772
4719
|
return option._parseAsync({
|
|
@@ -4833,9 +4780,7 @@ function mergeValues(a, b) {
|
|
|
4833
4780
|
}
|
|
4834
4781
|
else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
4835
4782
|
const bKeys = util.objectKeys(b);
|
|
4836
|
-
const sharedKeys = util
|
|
4837
|
-
.objectKeys(a)
|
|
4838
|
-
.filter((key) => bKeys.indexOf(key) !== -1);
|
|
4783
|
+
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
4839
4784
|
const newObj = { ...a, ...b };
|
|
4840
4785
|
for (const key of sharedKeys) {
|
|
4841
4786
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
@@ -4862,9 +4807,7 @@ function mergeValues(a, b) {
|
|
|
4862
4807
|
}
|
|
4863
4808
|
return { valid: true, data: newArray };
|
|
4864
4809
|
}
|
|
4865
|
-
else if (aType === ZodParsedType.date &&
|
|
4866
|
-
bType === ZodParsedType.date &&
|
|
4867
|
-
+a === +b) {
|
|
4810
|
+
else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
|
4868
4811
|
return { valid: true, data: a };
|
|
4869
4812
|
}
|
|
4870
4813
|
else {
|
|
@@ -4876,14 +4819,14 @@ class ZodIntersection extends ZodType {
|
|
|
4876
4819
|
const { status, ctx } = this._processInputParams(input);
|
|
4877
4820
|
const handleParsed = (parsedLeft, parsedRight) => {
|
|
4878
4821
|
if (isAborted(parsedLeft) || isAborted(parsedRight)) {
|
|
4879
|
-
return
|
|
4822
|
+
return parseUtil_INVALID;
|
|
4880
4823
|
}
|
|
4881
4824
|
const merged = mergeValues(parsedLeft.value, parsedRight.value);
|
|
4882
4825
|
if (!merged.valid) {
|
|
4883
4826
|
addIssueToContext(ctx, {
|
|
4884
4827
|
code: ZodIssueCode.invalid_intersection_types,
|
|
4885
4828
|
});
|
|
4886
|
-
return
|
|
4829
|
+
return parseUtil_INVALID;
|
|
4887
4830
|
}
|
|
4888
4831
|
if (isDirty(parsedLeft) || isDirty(parsedRight)) {
|
|
4889
4832
|
status.dirty();
|
|
@@ -4925,6 +4868,7 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
4925
4868
|
...processCreateParams(params),
|
|
4926
4869
|
});
|
|
4927
4870
|
};
|
|
4871
|
+
// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
4928
4872
|
class ZodTuple extends ZodType {
|
|
4929
4873
|
_parse(input) {
|
|
4930
4874
|
const { status, ctx } = this._processInputParams(input);
|
|
@@ -4934,7 +4878,7 @@ class ZodTuple extends ZodType {
|
|
|
4934
4878
|
expected: ZodParsedType.array,
|
|
4935
4879
|
received: ctx.parsedType,
|
|
4936
4880
|
});
|
|
4937
|
-
return
|
|
4881
|
+
return parseUtil_INVALID;
|
|
4938
4882
|
}
|
|
4939
4883
|
if (ctx.data.length < this._def.items.length) {
|
|
4940
4884
|
addIssueToContext(ctx, {
|
|
@@ -4944,7 +4888,7 @@ class ZodTuple extends ZodType {
|
|
|
4944
4888
|
exact: false,
|
|
4945
4889
|
type: "array",
|
|
4946
4890
|
});
|
|
4947
|
-
return
|
|
4891
|
+
return parseUtil_INVALID;
|
|
4948
4892
|
}
|
|
4949
4893
|
const rest = this._def.rest;
|
|
4950
4894
|
if (!rest && ctx.data.length > this._def.items.length) {
|
|
@@ -5010,7 +4954,7 @@ class ZodRecord extends ZodType {
|
|
|
5010
4954
|
expected: ZodParsedType.object,
|
|
5011
4955
|
received: ctx.parsedType,
|
|
5012
4956
|
});
|
|
5013
|
-
return
|
|
4957
|
+
return parseUtil_INVALID;
|
|
5014
4958
|
}
|
|
5015
4959
|
const pairs = [];
|
|
5016
4960
|
const keyType = this._def.keyType;
|
|
@@ -5064,7 +5008,7 @@ class ZodMap extends ZodType {
|
|
|
5064
5008
|
expected: ZodParsedType.map,
|
|
5065
5009
|
received: ctx.parsedType,
|
|
5066
5010
|
});
|
|
5067
|
-
return
|
|
5011
|
+
return parseUtil_INVALID;
|
|
5068
5012
|
}
|
|
5069
5013
|
const keyType = this._def.keyType;
|
|
5070
5014
|
const valueType = this._def.valueType;
|
|
@@ -5081,7 +5025,7 @@ class ZodMap extends ZodType {
|
|
|
5081
5025
|
const key = await pair.key;
|
|
5082
5026
|
const value = await pair.value;
|
|
5083
5027
|
if (key.status === "aborted" || value.status === "aborted") {
|
|
5084
|
-
return
|
|
5028
|
+
return parseUtil_INVALID;
|
|
5085
5029
|
}
|
|
5086
5030
|
if (key.status === "dirty" || value.status === "dirty") {
|
|
5087
5031
|
status.dirty();
|
|
@@ -5097,7 +5041,7 @@ class ZodMap extends ZodType {
|
|
|
5097
5041
|
const key = pair.key;
|
|
5098
5042
|
const value = pair.value;
|
|
5099
5043
|
if (key.status === "aborted" || value.status === "aborted") {
|
|
5100
|
-
return
|
|
5044
|
+
return parseUtil_INVALID;
|
|
5101
5045
|
}
|
|
5102
5046
|
if (key.status === "dirty" || value.status === "dirty") {
|
|
5103
5047
|
status.dirty();
|
|
@@ -5125,7 +5069,7 @@ class ZodSet extends ZodType {
|
|
|
5125
5069
|
expected: ZodParsedType.set,
|
|
5126
5070
|
received: ctx.parsedType,
|
|
5127
5071
|
});
|
|
5128
|
-
return
|
|
5072
|
+
return parseUtil_INVALID;
|
|
5129
5073
|
}
|
|
5130
5074
|
const def = this._def;
|
|
5131
5075
|
if (def.minSize !== null) {
|
|
@@ -5159,7 +5103,7 @@ class ZodSet extends ZodType {
|
|
|
5159
5103
|
const parsedSet = new Set();
|
|
5160
5104
|
for (const element of elements) {
|
|
5161
5105
|
if (element.status === "aborted")
|
|
5162
|
-
return
|
|
5106
|
+
return parseUtil_INVALID;
|
|
5163
5107
|
if (element.status === "dirty")
|
|
5164
5108
|
status.dirty();
|
|
5165
5109
|
parsedSet.add(element.value);
|
|
@@ -5215,18 +5159,13 @@ class ZodFunction extends ZodType {
|
|
|
5215
5159
|
expected: ZodParsedType.function,
|
|
5216
5160
|
received: ctx.parsedType,
|
|
5217
5161
|
});
|
|
5218
|
-
return
|
|
5162
|
+
return parseUtil_INVALID;
|
|
5219
5163
|
}
|
|
5220
5164
|
function makeArgsIssue(args, error) {
|
|
5221
5165
|
return makeIssue({
|
|
5222
5166
|
data: args,
|
|
5223
5167
|
path: ctx.path,
|
|
5224
|
-
errorMaps: [
|
|
5225
|
-
ctx.common.contextualErrorMap,
|
|
5226
|
-
ctx.schemaErrorMap,
|
|
5227
|
-
getErrorMap(),
|
|
5228
|
-
errorMap,
|
|
5229
|
-
].filter((x) => !!x),
|
|
5168
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en].filter((x) => !!x),
|
|
5230
5169
|
issueData: {
|
|
5231
5170
|
code: ZodIssueCode.invalid_arguments,
|
|
5232
5171
|
argumentsError: error,
|
|
@@ -5237,12 +5176,7 @@ class ZodFunction extends ZodType {
|
|
|
5237
5176
|
return makeIssue({
|
|
5238
5177
|
data: returns,
|
|
5239
5178
|
path: ctx.path,
|
|
5240
|
-
errorMaps: [
|
|
5241
|
-
ctx.common.contextualErrorMap,
|
|
5242
|
-
ctx.schemaErrorMap,
|
|
5243
|
-
getErrorMap(),
|
|
5244
|
-
errorMap,
|
|
5245
|
-
].filter((x) => !!x),
|
|
5179
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en].filter((x) => !!x),
|
|
5246
5180
|
issueData: {
|
|
5247
5181
|
code: ZodIssueCode.invalid_return_type,
|
|
5248
5182
|
returnTypeError: error,
|
|
@@ -5258,9 +5192,7 @@ class ZodFunction extends ZodType {
|
|
|
5258
5192
|
const me = this;
|
|
5259
5193
|
return OK(async function (...args) {
|
|
5260
5194
|
const error = new ZodError([]);
|
|
5261
|
-
const parsedArgs = await me._def.args
|
|
5262
|
-
.parseAsync(args, params)
|
|
5263
|
-
.catch((e) => {
|
|
5195
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
5264
5196
|
error.addIssue(makeArgsIssue(args, e));
|
|
5265
5197
|
throw error;
|
|
5266
5198
|
});
|
|
@@ -5321,9 +5253,7 @@ class ZodFunction extends ZodType {
|
|
|
5321
5253
|
}
|
|
5322
5254
|
static create(args, returns, params) {
|
|
5323
5255
|
return new ZodFunction({
|
|
5324
|
-
args: (args
|
|
5325
|
-
? args
|
|
5326
|
-
: ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
5256
|
+
args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
5327
5257
|
returns: returns || ZodUnknown.create(),
|
|
5328
5258
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
5329
5259
|
...processCreateParams(params),
|
|
@@ -5356,7 +5286,7 @@ class ZodLiteral extends ZodType {
|
|
|
5356
5286
|
code: ZodIssueCode.invalid_literal,
|
|
5357
5287
|
expected: this._def.value,
|
|
5358
5288
|
});
|
|
5359
|
-
return
|
|
5289
|
+
return parseUtil_INVALID;
|
|
5360
5290
|
}
|
|
5361
5291
|
return { status: "valid", value: input.data };
|
|
5362
5292
|
}
|
|
@@ -5379,10 +5309,6 @@ function createZodEnum(values, params) {
|
|
|
5379
5309
|
});
|
|
5380
5310
|
}
|
|
5381
5311
|
class ZodEnum extends ZodType {
|
|
5382
|
-
constructor() {
|
|
5383
|
-
super(...arguments);
|
|
5384
|
-
_ZodEnum_cache.set(this, void 0);
|
|
5385
|
-
}
|
|
5386
5312
|
_parse(input) {
|
|
5387
5313
|
if (typeof input.data !== "string") {
|
|
5388
5314
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -5392,12 +5318,12 @@ class ZodEnum extends ZodType {
|
|
|
5392
5318
|
received: ctx.parsedType,
|
|
5393
5319
|
code: ZodIssueCode.invalid_type,
|
|
5394
5320
|
});
|
|
5395
|
-
return
|
|
5321
|
+
return parseUtil_INVALID;
|
|
5396
5322
|
}
|
|
5397
|
-
if (!
|
|
5398
|
-
|
|
5323
|
+
if (!this._cache) {
|
|
5324
|
+
this._cache = new Set(this._def.values);
|
|
5399
5325
|
}
|
|
5400
|
-
if (!
|
|
5326
|
+
if (!this._cache.has(input.data)) {
|
|
5401
5327
|
const ctx = this._getOrReturnCtx(input);
|
|
5402
5328
|
const expectedValues = this._def.values;
|
|
5403
5329
|
addIssueToContext(ctx, {
|
|
@@ -5405,7 +5331,7 @@ class ZodEnum extends ZodType {
|
|
|
5405
5331
|
code: ZodIssueCode.invalid_enum_value,
|
|
5406
5332
|
options: expectedValues,
|
|
5407
5333
|
});
|
|
5408
|
-
return
|
|
5334
|
+
return parseUtil_INVALID;
|
|
5409
5335
|
}
|
|
5410
5336
|
return OK(input.data);
|
|
5411
5337
|
}
|
|
@@ -5446,37 +5372,31 @@ class ZodEnum extends ZodType {
|
|
|
5446
5372
|
});
|
|
5447
5373
|
}
|
|
5448
5374
|
}
|
|
5449
|
-
_ZodEnum_cache = new WeakMap();
|
|
5450
5375
|
ZodEnum.create = createZodEnum;
|
|
5451
5376
|
class ZodNativeEnum extends ZodType {
|
|
5452
|
-
constructor() {
|
|
5453
|
-
super(...arguments);
|
|
5454
|
-
_ZodNativeEnum_cache.set(this, void 0);
|
|
5455
|
-
}
|
|
5456
5377
|
_parse(input) {
|
|
5457
5378
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
5458
5379
|
const ctx = this._getOrReturnCtx(input);
|
|
5459
|
-
if (ctx.parsedType !== ZodParsedType.string &&
|
|
5460
|
-
ctx.parsedType !== ZodParsedType.number) {
|
|
5380
|
+
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
5461
5381
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
5462
5382
|
addIssueToContext(ctx, {
|
|
5463
5383
|
expected: util.joinValues(expectedValues),
|
|
5464
5384
|
received: ctx.parsedType,
|
|
5465
5385
|
code: ZodIssueCode.invalid_type,
|
|
5466
5386
|
});
|
|
5467
|
-
return
|
|
5387
|
+
return parseUtil_INVALID;
|
|
5468
5388
|
}
|
|
5469
|
-
if (!
|
|
5470
|
-
|
|
5389
|
+
if (!this._cache) {
|
|
5390
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
5471
5391
|
}
|
|
5472
|
-
if (!
|
|
5392
|
+
if (!this._cache.has(input.data)) {
|
|
5473
5393
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
5474
5394
|
addIssueToContext(ctx, {
|
|
5475
5395
|
received: ctx.data,
|
|
5476
5396
|
code: ZodIssueCode.invalid_enum_value,
|
|
5477
5397
|
options: expectedValues,
|
|
5478
5398
|
});
|
|
5479
|
-
return
|
|
5399
|
+
return parseUtil_INVALID;
|
|
5480
5400
|
}
|
|
5481
5401
|
return OK(input.data);
|
|
5482
5402
|
}
|
|
@@ -5484,7 +5404,6 @@ class ZodNativeEnum extends ZodType {
|
|
|
5484
5404
|
return this._def.values;
|
|
5485
5405
|
}
|
|
5486
5406
|
}
|
|
5487
|
-
_ZodNativeEnum_cache = new WeakMap();
|
|
5488
5407
|
ZodNativeEnum.create = (values, params) => {
|
|
5489
5408
|
return new ZodNativeEnum({
|
|
5490
5409
|
values: values,
|
|
@@ -5498,18 +5417,15 @@ class ZodPromise extends ZodType {
|
|
|
5498
5417
|
}
|
|
5499
5418
|
_parse(input) {
|
|
5500
5419
|
const { ctx } = this._processInputParams(input);
|
|
5501
|
-
if (ctx.parsedType !== ZodParsedType.promise &&
|
|
5502
|
-
ctx.common.async === false) {
|
|
5420
|
+
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
5503
5421
|
addIssueToContext(ctx, {
|
|
5504
5422
|
code: ZodIssueCode.invalid_type,
|
|
5505
5423
|
expected: ZodParsedType.promise,
|
|
5506
5424
|
received: ctx.parsedType,
|
|
5507
5425
|
});
|
|
5508
|
-
return
|
|
5426
|
+
return parseUtil_INVALID;
|
|
5509
5427
|
}
|
|
5510
|
-
const promisified = ctx.parsedType === ZodParsedType.promise
|
|
5511
|
-
? ctx.data
|
|
5512
|
-
: Promise.resolve(ctx.data);
|
|
5428
|
+
const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
|
|
5513
5429
|
return OK(promisified.then((data) => {
|
|
5514
5430
|
return this._def.type.parseAsync(data, {
|
|
5515
5431
|
path: ctx.path,
|
|
@@ -5557,14 +5473,14 @@ class ZodEffects extends ZodType {
|
|
|
5557
5473
|
if (ctx.common.async) {
|
|
5558
5474
|
return Promise.resolve(processed).then(async (processed) => {
|
|
5559
5475
|
if (status.value === "aborted")
|
|
5560
|
-
return
|
|
5476
|
+
return parseUtil_INVALID;
|
|
5561
5477
|
const result = await this._def.schema._parseAsync({
|
|
5562
5478
|
data: processed,
|
|
5563
5479
|
path: ctx.path,
|
|
5564
5480
|
parent: ctx,
|
|
5565
5481
|
});
|
|
5566
5482
|
if (result.status === "aborted")
|
|
5567
|
-
return
|
|
5483
|
+
return parseUtil_INVALID;
|
|
5568
5484
|
if (result.status === "dirty")
|
|
5569
5485
|
return DIRTY(result.value);
|
|
5570
5486
|
if (status.value === "dirty")
|
|
@@ -5574,14 +5490,14 @@ class ZodEffects extends ZodType {
|
|
|
5574
5490
|
}
|
|
5575
5491
|
else {
|
|
5576
5492
|
if (status.value === "aborted")
|
|
5577
|
-
return
|
|
5493
|
+
return parseUtil_INVALID;
|
|
5578
5494
|
const result = this._def.schema._parseSync({
|
|
5579
5495
|
data: processed,
|
|
5580
5496
|
path: ctx.path,
|
|
5581
5497
|
parent: ctx,
|
|
5582
5498
|
});
|
|
5583
5499
|
if (result.status === "aborted")
|
|
5584
|
-
return
|
|
5500
|
+
return parseUtil_INVALID;
|
|
5585
5501
|
if (result.status === "dirty")
|
|
5586
5502
|
return DIRTY(result.value);
|
|
5587
5503
|
if (status.value === "dirty")
|
|
@@ -5607,7 +5523,7 @@ class ZodEffects extends ZodType {
|
|
|
5607
5523
|
parent: ctx,
|
|
5608
5524
|
});
|
|
5609
5525
|
if (inner.status === "aborted")
|
|
5610
|
-
return
|
|
5526
|
+
return parseUtil_INVALID;
|
|
5611
5527
|
if (inner.status === "dirty")
|
|
5612
5528
|
status.dirty();
|
|
5613
5529
|
// return value is ignored
|
|
@@ -5615,11 +5531,9 @@ class ZodEffects extends ZodType {
|
|
|
5615
5531
|
return { status: status.value, value: inner.value };
|
|
5616
5532
|
}
|
|
5617
5533
|
else {
|
|
5618
|
-
return this._def.schema
|
|
5619
|
-
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
5620
|
-
.then((inner) => {
|
|
5534
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
|
|
5621
5535
|
if (inner.status === "aborted")
|
|
5622
|
-
return
|
|
5536
|
+
return parseUtil_INVALID;
|
|
5623
5537
|
if (inner.status === "dirty")
|
|
5624
5538
|
status.dirty();
|
|
5625
5539
|
return executeRefinement(inner.value).then(() => {
|
|
@@ -5636,7 +5550,7 @@ class ZodEffects extends ZodType {
|
|
|
5636
5550
|
parent: ctx,
|
|
5637
5551
|
});
|
|
5638
5552
|
if (!isValid(base))
|
|
5639
|
-
return
|
|
5553
|
+
return parseUtil_INVALID;
|
|
5640
5554
|
const result = effect.transform(base.value, checkCtx);
|
|
5641
5555
|
if (result instanceof Promise) {
|
|
5642
5556
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
@@ -5644,12 +5558,13 @@ class ZodEffects extends ZodType {
|
|
|
5644
5558
|
return { status: status.value, value: result };
|
|
5645
5559
|
}
|
|
5646
5560
|
else {
|
|
5647
|
-
return this._def.schema
|
|
5648
|
-
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
5649
|
-
.then((base) => {
|
|
5561
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
5650
5562
|
if (!isValid(base))
|
|
5651
|
-
return
|
|
5652
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
5563
|
+
return parseUtil_INVALID;
|
|
5564
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
5565
|
+
status: status.value,
|
|
5566
|
+
value: result,
|
|
5567
|
+
}));
|
|
5653
5568
|
});
|
|
5654
5569
|
}
|
|
5655
5570
|
}
|
|
@@ -5672,6 +5587,7 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
5672
5587
|
...processCreateParams(params),
|
|
5673
5588
|
});
|
|
5674
5589
|
};
|
|
5590
|
+
|
|
5675
5591
|
class ZodOptional extends ZodType {
|
|
5676
5592
|
_parse(input) {
|
|
5677
5593
|
const parsedType = this._getType(input);
|
|
@@ -5731,9 +5647,7 @@ ZodDefault.create = (type, params) => {
|
|
|
5731
5647
|
return new ZodDefault({
|
|
5732
5648
|
innerType: type,
|
|
5733
5649
|
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
5734
|
-
defaultValue: typeof params.default === "function"
|
|
5735
|
-
? params.default
|
|
5736
|
-
: () => params.default,
|
|
5650
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
5737
5651
|
...processCreateParams(params),
|
|
5738
5652
|
});
|
|
5739
5653
|
};
|
|
@@ -5806,7 +5720,7 @@ class ZodNaN extends ZodType {
|
|
|
5806
5720
|
expected: ZodParsedType.nan,
|
|
5807
5721
|
received: ctx.parsedType,
|
|
5808
5722
|
});
|
|
5809
|
-
return
|
|
5723
|
+
return parseUtil_INVALID;
|
|
5810
5724
|
}
|
|
5811
5725
|
return { status: "valid", value: input.data };
|
|
5812
5726
|
}
|
|
@@ -5843,7 +5757,7 @@ class ZodPipeline extends ZodType {
|
|
|
5843
5757
|
parent: ctx,
|
|
5844
5758
|
});
|
|
5845
5759
|
if (inResult.status === "aborted")
|
|
5846
|
-
return
|
|
5760
|
+
return parseUtil_INVALID;
|
|
5847
5761
|
if (inResult.status === "dirty") {
|
|
5848
5762
|
status.dirty();
|
|
5849
5763
|
return DIRTY(inResult.value);
|
|
@@ -5865,7 +5779,7 @@ class ZodPipeline extends ZodType {
|
|
|
5865
5779
|
parent: ctx,
|
|
5866
5780
|
});
|
|
5867
5781
|
if (inResult.status === "aborted")
|
|
5868
|
-
return
|
|
5782
|
+
return parseUtil_INVALID;
|
|
5869
5783
|
if (inResult.status === "dirty") {
|
|
5870
5784
|
status.dirty();
|
|
5871
5785
|
return {
|
|
@@ -5899,9 +5813,7 @@ class ZodReadonly extends ZodType {
|
|
|
5899
5813
|
}
|
|
5900
5814
|
return data;
|
|
5901
5815
|
};
|
|
5902
|
-
return isAsync(result)
|
|
5903
|
-
? result.then((data) => freeze(data))
|
|
5904
|
-
: freeze(result);
|
|
5816
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
5905
5817
|
}
|
|
5906
5818
|
unwrap() {
|
|
5907
5819
|
return this._def.innerType;
|
|
@@ -5922,11 +5834,7 @@ ZodReadonly.create = (type, params) => {
|
|
|
5922
5834
|
////////////////////////////////////////
|
|
5923
5835
|
////////////////////////////////////////
|
|
5924
5836
|
function cleanParams(params, data) {
|
|
5925
|
-
const p = typeof params === "function"
|
|
5926
|
-
? params(data)
|
|
5927
|
-
: typeof params === "string"
|
|
5928
|
-
? { message: params }
|
|
5929
|
-
: params;
|
|
5837
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
5930
5838
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
5931
5839
|
return p2;
|
|
5932
5840
|
}
|
|
@@ -5944,27 +5852,26 @@ function custom(check, _params = {},
|
|
|
5944
5852
|
fatal) {
|
|
5945
5853
|
if (check)
|
|
5946
5854
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
5947
|
-
var _a, _b;
|
|
5948
5855
|
const r = check(data);
|
|
5949
5856
|
if (r instanceof Promise) {
|
|
5950
5857
|
return r.then((r) => {
|
|
5951
|
-
var _a, _b;
|
|
5952
5858
|
if (!r) {
|
|
5953
5859
|
const params = cleanParams(_params, data);
|
|
5954
|
-
const _fatal =
|
|
5860
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
5955
5861
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
5956
5862
|
}
|
|
5957
5863
|
});
|
|
5958
5864
|
}
|
|
5959
5865
|
if (!r) {
|
|
5960
5866
|
const params = cleanParams(_params, data);
|
|
5961
|
-
const _fatal =
|
|
5867
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
5962
5868
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
5963
5869
|
}
|
|
5964
5870
|
return;
|
|
5965
5871
|
});
|
|
5966
5872
|
return ZodAny.create();
|
|
5967
5873
|
}
|
|
5874
|
+
|
|
5968
5875
|
const late = {
|
|
5969
5876
|
object: ZodObject.lazycreate,
|
|
5970
5877
|
};
|
|
@@ -6007,6 +5914,10 @@ var ZodFirstPartyTypeKind;
|
|
|
6007
5914
|
ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
|
|
6008
5915
|
ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
|
|
6009
5916
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
5917
|
+
// requires TS 4.4+
|
|
5918
|
+
class Class {
|
|
5919
|
+
constructor(..._) { }
|
|
5920
|
+
}
|
|
6010
5921
|
const instanceOfType = (
|
|
6011
5922
|
// const instanceOfType = <T extends new (...args: any[]) => any>(
|
|
6012
5923
|
cls, params = {
|
|
@@ -6059,120 +5970,8 @@ const coerce = {
|
|
|
6059
5970
|
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
6060
5971
|
date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
|
|
6061
5972
|
};
|
|
6062
|
-
const NEVER = INVALID;
|
|
6063
|
-
|
|
6064
|
-
var z = /*#__PURE__*/Object.freeze({
|
|
6065
|
-
__proto__: null,
|
|
6066
|
-
defaultErrorMap: errorMap,
|
|
6067
|
-
setErrorMap: setErrorMap,
|
|
6068
|
-
getErrorMap: getErrorMap,
|
|
6069
|
-
makeIssue: makeIssue,
|
|
6070
|
-
EMPTY_PATH: EMPTY_PATH,
|
|
6071
|
-
addIssueToContext: addIssueToContext,
|
|
6072
|
-
ParseStatus: ParseStatus,
|
|
6073
|
-
INVALID: INVALID,
|
|
6074
|
-
DIRTY: DIRTY,
|
|
6075
|
-
OK: OK,
|
|
6076
|
-
isAborted: isAborted,
|
|
6077
|
-
isDirty: isDirty,
|
|
6078
|
-
isValid: isValid,
|
|
6079
|
-
isAsync: isAsync,
|
|
6080
|
-
get util () { return util; },
|
|
6081
|
-
get objectUtil () { return objectUtil; },
|
|
6082
|
-
ZodParsedType: ZodParsedType,
|
|
6083
|
-
getParsedType: getParsedType,
|
|
6084
|
-
ZodType: ZodType,
|
|
6085
|
-
datetimeRegex: datetimeRegex,
|
|
6086
|
-
ZodString: ZodString,
|
|
6087
|
-
ZodNumber: ZodNumber,
|
|
6088
|
-
ZodBigInt: ZodBigInt,
|
|
6089
|
-
ZodBoolean: ZodBoolean,
|
|
6090
|
-
ZodDate: ZodDate,
|
|
6091
|
-
ZodSymbol: ZodSymbol,
|
|
6092
|
-
ZodUndefined: ZodUndefined,
|
|
6093
|
-
ZodNull: ZodNull,
|
|
6094
|
-
ZodAny: ZodAny,
|
|
6095
|
-
ZodUnknown: ZodUnknown,
|
|
6096
|
-
ZodNever: ZodNever,
|
|
6097
|
-
ZodVoid: ZodVoid,
|
|
6098
|
-
ZodArray: ZodArray,
|
|
6099
|
-
ZodObject: ZodObject,
|
|
6100
|
-
ZodUnion: ZodUnion,
|
|
6101
|
-
ZodDiscriminatedUnion: ZodDiscriminatedUnion,
|
|
6102
|
-
ZodIntersection: ZodIntersection,
|
|
6103
|
-
ZodTuple: ZodTuple,
|
|
6104
|
-
ZodRecord: ZodRecord,
|
|
6105
|
-
ZodMap: ZodMap,
|
|
6106
|
-
ZodSet: ZodSet,
|
|
6107
|
-
ZodFunction: ZodFunction,
|
|
6108
|
-
ZodLazy: ZodLazy,
|
|
6109
|
-
ZodLiteral: ZodLiteral,
|
|
6110
|
-
ZodEnum: ZodEnum,
|
|
6111
|
-
ZodNativeEnum: ZodNativeEnum,
|
|
6112
|
-
ZodPromise: ZodPromise,
|
|
6113
|
-
ZodEffects: ZodEffects,
|
|
6114
|
-
ZodTransformer: ZodEffects,
|
|
6115
|
-
ZodOptional: ZodOptional,
|
|
6116
|
-
ZodNullable: ZodNullable,
|
|
6117
|
-
ZodDefault: ZodDefault,
|
|
6118
|
-
ZodCatch: ZodCatch,
|
|
6119
|
-
ZodNaN: ZodNaN,
|
|
6120
|
-
BRAND: BRAND,
|
|
6121
|
-
ZodBranded: ZodBranded,
|
|
6122
|
-
ZodPipeline: ZodPipeline,
|
|
6123
|
-
ZodReadonly: ZodReadonly,
|
|
6124
|
-
custom: custom,
|
|
6125
|
-
Schema: ZodType,
|
|
6126
|
-
ZodSchema: ZodType,
|
|
6127
|
-
late: late,
|
|
6128
|
-
get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
|
|
6129
|
-
coerce: coerce,
|
|
6130
|
-
any: anyType,
|
|
6131
|
-
array: arrayType,
|
|
6132
|
-
bigint: bigIntType,
|
|
6133
|
-
boolean: booleanType,
|
|
6134
|
-
date: dateType,
|
|
6135
|
-
discriminatedUnion: discriminatedUnionType,
|
|
6136
|
-
effect: effectsType,
|
|
6137
|
-
'enum': enumType,
|
|
6138
|
-
'function': functionType,
|
|
6139
|
-
'instanceof': instanceOfType,
|
|
6140
|
-
intersection: intersectionType,
|
|
6141
|
-
lazy: lazyType,
|
|
6142
|
-
literal: literalType,
|
|
6143
|
-
map: mapType,
|
|
6144
|
-
nan: nanType,
|
|
6145
|
-
nativeEnum: nativeEnumType,
|
|
6146
|
-
never: neverType,
|
|
6147
|
-
'null': nullType,
|
|
6148
|
-
nullable: nullableType,
|
|
6149
|
-
number: numberType,
|
|
6150
|
-
object: objectType,
|
|
6151
|
-
oboolean: oboolean,
|
|
6152
|
-
onumber: onumber,
|
|
6153
|
-
optional: optionalType,
|
|
6154
|
-
ostring: ostring,
|
|
6155
|
-
pipeline: pipelineType,
|
|
6156
|
-
preprocess: preprocessType,
|
|
6157
|
-
promise: promiseType,
|
|
6158
|
-
record: recordType,
|
|
6159
|
-
set: setType,
|
|
6160
|
-
strictObject: strictObjectType,
|
|
6161
|
-
string: stringType,
|
|
6162
|
-
symbol: symbolType,
|
|
6163
|
-
transformer: effectsType,
|
|
6164
|
-
tuple: tupleType,
|
|
6165
|
-
'undefined': undefinedType,
|
|
6166
|
-
union: unionType,
|
|
6167
|
-
unknown: unknownType,
|
|
6168
|
-
'void': voidType,
|
|
6169
|
-
NEVER: NEVER,
|
|
6170
|
-
ZodIssueCode: ZodIssueCode,
|
|
6171
|
-
quotelessJson: quotelessJson,
|
|
6172
|
-
ZodError: ZodError
|
|
6173
|
-
});
|
|
6174
|
-
|
|
6175
5973
|
|
|
5974
|
+
const NEVER = (/* unused pure expression or super */ null && (INVALID));
|
|
6176
5975
|
|
|
6177
5976
|
// EXTERNAL MODULE: ../../node_modules/lodash/get.js
|
|
6178
5977
|
var lodash_get = __webpack_require__(46123);
|
|
@@ -6275,16 +6074,16 @@ function sendAnalyticsChangeEvent(component, data) {
|
|
|
6275
6074
|
|
|
6276
6075
|
// NOTE: catchall is used to validate basic properties values.
|
|
6277
6076
|
// We don't want to validate "exact" shape of the event, since it can differ from version to version
|
|
6278
|
-
var analyticsEventSchema =
|
|
6279
|
-
event:
|
|
6280
|
-
component:
|
|
6281
|
-
location:
|
|
6282
|
-
}).catchall(
|
|
6283
|
-
var condoMessageDataSchema =
|
|
6284
|
-
handler:
|
|
6077
|
+
var analyticsEventSchema = objectType({
|
|
6078
|
+
event: enumType(['click', 'check', 'change']),
|
|
6079
|
+
component: stringType(),
|
|
6080
|
+
location: stringType()
|
|
6081
|
+
}).catchall(unionType([stringType(), arrayType(stringType()), numberType(), booleanType(), undefinedType()]));
|
|
6082
|
+
var condoMessageDataSchema = strictObjectType({
|
|
6083
|
+
handler: literalType(ANALYTICS_HANDLER_NAME),
|
|
6285
6084
|
params: analyticsEventSchema,
|
|
6286
|
-
type:
|
|
6287
|
-
version:
|
|
6085
|
+
type: literalType('condo-ui'),
|
|
6086
|
+
version: stringType()
|
|
6288
6087
|
});
|
|
6289
6088
|
var MAX_ALLOWED_EVENT_PARAMS = 10;
|
|
6290
6089
|
|