@storm-software/config-tools 1.41.2 → 1.41.4
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/CHANGELOG.md +24 -0
- package/index.cjs +2559 -2364
- package/index.js +2559 -2364
- package/meta.cjs.json +1 -1
- package/meta.esm.json +1 -1
- package/package.json +2 -2
- package/utilities/logger.cjs +255 -72
- package/utilities/logger.js +255 -72
package/utilities/logger.js
CHANGED
|
@@ -1649,7 +1649,7 @@ var getChalk = () => {
|
|
|
1649
1649
|
return _chalk;
|
|
1650
1650
|
};
|
|
1651
1651
|
|
|
1652
|
-
// node_modules/.pnpm/zod@3.
|
|
1652
|
+
// node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs
|
|
1653
1653
|
var util;
|
|
1654
1654
|
(function(util2) {
|
|
1655
1655
|
util2.assertEqual = (val) => val;
|
|
@@ -1803,7 +1803,7 @@ var quotelessJson = (obj) => {
|
|
|
1803
1803
|
const json = JSON.stringify(obj, null, 2);
|
|
1804
1804
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
1805
1805
|
};
|
|
1806
|
-
var ZodError = class extends Error {
|
|
1806
|
+
var ZodError = class _ZodError extends Error {
|
|
1807
1807
|
constructor(issues) {
|
|
1808
1808
|
super();
|
|
1809
1809
|
this.issues = [];
|
|
@@ -1861,6 +1861,11 @@ var ZodError = class extends Error {
|
|
|
1861
1861
|
processError(this);
|
|
1862
1862
|
return fieldErrors;
|
|
1863
1863
|
}
|
|
1864
|
+
static assert(value) {
|
|
1865
|
+
if (!(value instanceof _ZodError)) {
|
|
1866
|
+
throw new Error(`Not a ZodError: ${value}`);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1864
1869
|
toString() {
|
|
1865
1870
|
return this.message;
|
|
1866
1871
|
}
|
|
@@ -2003,6 +2008,13 @@ var makeIssue = (params) => {
|
|
|
2003
2008
|
...issueData,
|
|
2004
2009
|
path: fullPath
|
|
2005
2010
|
};
|
|
2011
|
+
if (issueData.message !== void 0) {
|
|
2012
|
+
return {
|
|
2013
|
+
...issueData,
|
|
2014
|
+
path: fullPath,
|
|
2015
|
+
message: issueData.message
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2006
2018
|
let errorMessage = "";
|
|
2007
2019
|
const maps = errorMaps.filter((m) => !!m).slice().reverse();
|
|
2008
2020
|
for (const map of maps) {
|
|
@@ -2011,11 +2023,12 @@ var makeIssue = (params) => {
|
|
|
2011
2023
|
return {
|
|
2012
2024
|
...issueData,
|
|
2013
2025
|
path: fullPath,
|
|
2014
|
-
message:
|
|
2026
|
+
message: errorMessage
|
|
2015
2027
|
};
|
|
2016
2028
|
};
|
|
2017
2029
|
var EMPTY_PATH = [];
|
|
2018
2030
|
function addIssueToContext(ctx, issueData) {
|
|
2031
|
+
const overrideMap = getErrorMap();
|
|
2019
2032
|
const issue = makeIssue({
|
|
2020
2033
|
issueData,
|
|
2021
2034
|
data: ctx.data,
|
|
@@ -2023,8 +2036,8 @@ function addIssueToContext(ctx, issueData) {
|
|
|
2023
2036
|
errorMaps: [
|
|
2024
2037
|
ctx.common.contextualErrorMap,
|
|
2025
2038
|
ctx.schemaErrorMap,
|
|
2026
|
-
|
|
2027
|
-
errorMap
|
|
2039
|
+
overrideMap,
|
|
2040
|
+
overrideMap === errorMap ? void 0 : errorMap
|
|
2028
2041
|
// then global default map
|
|
2029
2042
|
].filter((x) => !!x)
|
|
2030
2043
|
});
|
|
@@ -2056,9 +2069,11 @@ var ParseStatus = class _ParseStatus {
|
|
|
2056
2069
|
static async mergeObjectAsync(status, pairs) {
|
|
2057
2070
|
const syncPairs = [];
|
|
2058
2071
|
for (const pair of pairs) {
|
|
2072
|
+
const key = await pair.key;
|
|
2073
|
+
const value = await pair.value;
|
|
2059
2074
|
syncPairs.push({
|
|
2060
|
-
key
|
|
2061
|
-
value
|
|
2075
|
+
key,
|
|
2076
|
+
value
|
|
2062
2077
|
});
|
|
2063
2078
|
}
|
|
2064
2079
|
return _ParseStatus.mergeObjectSync(status, syncPairs);
|
|
@@ -2091,11 +2106,29 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
2091
2106
|
var isDirty = (x) => x.status === "dirty";
|
|
2092
2107
|
var isValid = (x) => x.status === "valid";
|
|
2093
2108
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
2109
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
2110
|
+
if (kind === "a" && !f)
|
|
2111
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
2112
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2113
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2114
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2115
|
+
}
|
|
2116
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
2117
|
+
if (kind === "m")
|
|
2118
|
+
throw new TypeError("Private method is not writable");
|
|
2119
|
+
if (kind === "a" && !f)
|
|
2120
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
2121
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2122
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2123
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2124
|
+
}
|
|
2094
2125
|
var errorUtil;
|
|
2095
2126
|
(function(errorUtil2) {
|
|
2096
2127
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
2097
2128
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
2098
2129
|
})(errorUtil || (errorUtil = {}));
|
|
2130
|
+
var _ZodEnum_cache;
|
|
2131
|
+
var _ZodNativeEnum_cache;
|
|
2099
2132
|
var ParseInputLazyPath = class {
|
|
2100
2133
|
constructor(parent, value, path, key) {
|
|
2101
2134
|
this._cachedPath = [];
|
|
@@ -2144,12 +2177,17 @@ function processCreateParams(params) {
|
|
|
2144
2177
|
if (errorMap2)
|
|
2145
2178
|
return { errorMap: errorMap2, description };
|
|
2146
2179
|
const customMap = (iss, ctx) => {
|
|
2147
|
-
|
|
2148
|
-
|
|
2180
|
+
var _a, _b;
|
|
2181
|
+
const { message } = params;
|
|
2182
|
+
if (iss.code === "invalid_enum_value") {
|
|
2183
|
+
return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
|
|
2184
|
+
}
|
|
2149
2185
|
if (typeof ctx.data === "undefined") {
|
|
2150
|
-
return { message:
|
|
2186
|
+
return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
|
|
2151
2187
|
}
|
|
2152
|
-
|
|
2188
|
+
if (iss.code !== "invalid_type")
|
|
2189
|
+
return { message: ctx.defaultError };
|
|
2190
|
+
return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
|
|
2153
2191
|
};
|
|
2154
2192
|
return { errorMap: customMap, description };
|
|
2155
2193
|
}
|
|
@@ -2397,35 +2435,40 @@ var ZodType = class {
|
|
|
2397
2435
|
}
|
|
2398
2436
|
};
|
|
2399
2437
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
2400
|
-
var cuid2Regex = /^[
|
|
2438
|
+
var cuid2Regex = /^[0-9a-z]+$/;
|
|
2401
2439
|
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
2402
2440
|
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;
|
|
2403
|
-
var
|
|
2441
|
+
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
2442
|
+
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)?)??$/;
|
|
2443
|
+
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
2404
2444
|
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
2405
2445
|
var emojiRegex;
|
|
2406
|
-
var ipv4Regex = /^((
|
|
2446
|
+
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])$/;
|
|
2407
2447
|
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})))$/;
|
|
2408
|
-
var
|
|
2448
|
+
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
2449
|
+
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])))`;
|
|
2450
|
+
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
2451
|
+
function timeRegexSource(args) {
|
|
2452
|
+
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
2409
2453
|
if (args.precision) {
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
|
|
2414
|
-
}
|
|
2415
|
-
} else if (args.precision === 0) {
|
|
2416
|
-
if (args.offset) {
|
|
2417
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
2418
|
-
} else {
|
|
2419
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
|
|
2420
|
-
}
|
|
2421
|
-
} else {
|
|
2422
|
-
if (args.offset) {
|
|
2423
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
|
|
2424
|
-
} else {
|
|
2425
|
-
return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
|
|
2426
|
-
}
|
|
2454
|
+
regex = `${regex}\\.\\d{${args.precision}}`;
|
|
2455
|
+
} else if (args.precision == null) {
|
|
2456
|
+
regex = `${regex}(\\.\\d+)?`;
|
|
2427
2457
|
}
|
|
2428
|
-
|
|
2458
|
+
return regex;
|
|
2459
|
+
}
|
|
2460
|
+
function timeRegex(args) {
|
|
2461
|
+
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
2462
|
+
}
|
|
2463
|
+
function datetimeRegex(args) {
|
|
2464
|
+
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
2465
|
+
const opts = [];
|
|
2466
|
+
opts.push(args.local ? `Z?` : `Z`);
|
|
2467
|
+
if (args.offset)
|
|
2468
|
+
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
2469
|
+
regex = `${regex}(${opts.join("|")})`;
|
|
2470
|
+
return new RegExp(`^${regex}$`);
|
|
2471
|
+
}
|
|
2429
2472
|
function isValidIP(ip, version) {
|
|
2430
2473
|
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
2431
2474
|
return true;
|
|
@@ -2443,15 +2486,11 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2443
2486
|
const parsedType = this._getType(input);
|
|
2444
2487
|
if (parsedType !== ZodParsedType.string) {
|
|
2445
2488
|
const ctx2 = this._getOrReturnCtx(input);
|
|
2446
|
-
addIssueToContext(
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
received: ctx2.parsedType
|
|
2452
|
-
}
|
|
2453
|
-
//
|
|
2454
|
-
);
|
|
2489
|
+
addIssueToContext(ctx2, {
|
|
2490
|
+
code: ZodIssueCode.invalid_type,
|
|
2491
|
+
expected: ZodParsedType.string,
|
|
2492
|
+
received: ctx2.parsedType
|
|
2493
|
+
});
|
|
2455
2494
|
return INVALID;
|
|
2456
2495
|
}
|
|
2457
2496
|
const status = new ParseStatus();
|
|
@@ -2542,6 +2581,16 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2542
2581
|
});
|
|
2543
2582
|
status.dirty();
|
|
2544
2583
|
}
|
|
2584
|
+
} else if (check.kind === "nanoid") {
|
|
2585
|
+
if (!nanoidRegex.test(input.data)) {
|
|
2586
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2587
|
+
addIssueToContext(ctx, {
|
|
2588
|
+
validation: "nanoid",
|
|
2589
|
+
code: ZodIssueCode.invalid_string,
|
|
2590
|
+
message: check.message
|
|
2591
|
+
});
|
|
2592
|
+
status.dirty();
|
|
2593
|
+
}
|
|
2545
2594
|
} else if (check.kind === "cuid") {
|
|
2546
2595
|
if (!cuidRegex.test(input.data)) {
|
|
2547
2596
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2643,6 +2692,38 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2643
2692
|
});
|
|
2644
2693
|
status.dirty();
|
|
2645
2694
|
}
|
|
2695
|
+
} else if (check.kind === "date") {
|
|
2696
|
+
const regex = dateRegex;
|
|
2697
|
+
if (!regex.test(input.data)) {
|
|
2698
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2699
|
+
addIssueToContext(ctx, {
|
|
2700
|
+
code: ZodIssueCode.invalid_string,
|
|
2701
|
+
validation: "date",
|
|
2702
|
+
message: check.message
|
|
2703
|
+
});
|
|
2704
|
+
status.dirty();
|
|
2705
|
+
}
|
|
2706
|
+
} else if (check.kind === "time") {
|
|
2707
|
+
const regex = timeRegex(check);
|
|
2708
|
+
if (!regex.test(input.data)) {
|
|
2709
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2710
|
+
addIssueToContext(ctx, {
|
|
2711
|
+
code: ZodIssueCode.invalid_string,
|
|
2712
|
+
validation: "time",
|
|
2713
|
+
message: check.message
|
|
2714
|
+
});
|
|
2715
|
+
status.dirty();
|
|
2716
|
+
}
|
|
2717
|
+
} else if (check.kind === "duration") {
|
|
2718
|
+
if (!durationRegex.test(input.data)) {
|
|
2719
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2720
|
+
addIssueToContext(ctx, {
|
|
2721
|
+
validation: "duration",
|
|
2722
|
+
code: ZodIssueCode.invalid_string,
|
|
2723
|
+
message: check.message
|
|
2724
|
+
});
|
|
2725
|
+
status.dirty();
|
|
2726
|
+
}
|
|
2646
2727
|
} else if (check.kind === "ip") {
|
|
2647
2728
|
if (!isValidIP(input.data, check.version)) {
|
|
2648
2729
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -2653,6 +2734,16 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2653
2734
|
});
|
|
2654
2735
|
status.dirty();
|
|
2655
2736
|
}
|
|
2737
|
+
} else if (check.kind === "base64") {
|
|
2738
|
+
if (!base64Regex.test(input.data)) {
|
|
2739
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
2740
|
+
addIssueToContext(ctx, {
|
|
2741
|
+
validation: "base64",
|
|
2742
|
+
code: ZodIssueCode.invalid_string,
|
|
2743
|
+
message: check.message
|
|
2744
|
+
});
|
|
2745
|
+
status.dirty();
|
|
2746
|
+
}
|
|
2656
2747
|
} else {
|
|
2657
2748
|
util.assertNever(check);
|
|
2658
2749
|
}
|
|
@@ -2684,6 +2775,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2684
2775
|
uuid(message) {
|
|
2685
2776
|
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
|
|
2686
2777
|
}
|
|
2778
|
+
nanoid(message) {
|
|
2779
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
|
|
2780
|
+
}
|
|
2687
2781
|
cuid(message) {
|
|
2688
2782
|
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
|
|
2689
2783
|
}
|
|
@@ -2693,16 +2787,20 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2693
2787
|
ulid(message) {
|
|
2694
2788
|
return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
|
|
2695
2789
|
}
|
|
2790
|
+
base64(message) {
|
|
2791
|
+
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
2792
|
+
}
|
|
2696
2793
|
ip(options) {
|
|
2697
2794
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
2698
2795
|
}
|
|
2699
2796
|
datetime(options) {
|
|
2700
|
-
var _a;
|
|
2797
|
+
var _a, _b;
|
|
2701
2798
|
if (typeof options === "string") {
|
|
2702
2799
|
return this._addCheck({
|
|
2703
2800
|
kind: "datetime",
|
|
2704
2801
|
precision: null,
|
|
2705
2802
|
offset: false,
|
|
2803
|
+
local: false,
|
|
2706
2804
|
message: options
|
|
2707
2805
|
});
|
|
2708
2806
|
}
|
|
@@ -2710,9 +2808,30 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2710
2808
|
kind: "datetime",
|
|
2711
2809
|
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
2712
2810
|
offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
|
|
2811
|
+
local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
|
|
2812
|
+
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
2813
|
+
});
|
|
2814
|
+
}
|
|
2815
|
+
date(message) {
|
|
2816
|
+
return this._addCheck({ kind: "date", message });
|
|
2817
|
+
}
|
|
2818
|
+
time(options) {
|
|
2819
|
+
if (typeof options === "string") {
|
|
2820
|
+
return this._addCheck({
|
|
2821
|
+
kind: "time",
|
|
2822
|
+
precision: null,
|
|
2823
|
+
message: options
|
|
2824
|
+
});
|
|
2825
|
+
}
|
|
2826
|
+
return this._addCheck({
|
|
2827
|
+
kind: "time",
|
|
2828
|
+
precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
|
|
2713
2829
|
...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
|
|
2714
2830
|
});
|
|
2715
2831
|
}
|
|
2832
|
+
duration(message) {
|
|
2833
|
+
return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
|
|
2834
|
+
}
|
|
2716
2835
|
regex(regex, message) {
|
|
2717
2836
|
return this._addCheck({
|
|
2718
2837
|
kind: "regex",
|
|
@@ -2791,6 +2910,15 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2791
2910
|
get isDatetime() {
|
|
2792
2911
|
return !!this._def.checks.find((ch) => ch.kind === "datetime");
|
|
2793
2912
|
}
|
|
2913
|
+
get isDate() {
|
|
2914
|
+
return !!this._def.checks.find((ch) => ch.kind === "date");
|
|
2915
|
+
}
|
|
2916
|
+
get isTime() {
|
|
2917
|
+
return !!this._def.checks.find((ch) => ch.kind === "time");
|
|
2918
|
+
}
|
|
2919
|
+
get isDuration() {
|
|
2920
|
+
return !!this._def.checks.find((ch) => ch.kind === "duration");
|
|
2921
|
+
}
|
|
2794
2922
|
get isEmail() {
|
|
2795
2923
|
return !!this._def.checks.find((ch) => ch.kind === "email");
|
|
2796
2924
|
}
|
|
@@ -2803,6 +2931,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2803
2931
|
get isUUID() {
|
|
2804
2932
|
return !!this._def.checks.find((ch) => ch.kind === "uuid");
|
|
2805
2933
|
}
|
|
2934
|
+
get isNANOID() {
|
|
2935
|
+
return !!this._def.checks.find((ch) => ch.kind === "nanoid");
|
|
2936
|
+
}
|
|
2806
2937
|
get isCUID() {
|
|
2807
2938
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
2808
2939
|
}
|
|
@@ -2815,6 +2946,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
2815
2946
|
get isIP() {
|
|
2816
2947
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
2817
2948
|
}
|
|
2949
|
+
get isBase64() {
|
|
2950
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
2951
|
+
}
|
|
2818
2952
|
get minLength() {
|
|
2819
2953
|
let min = null;
|
|
2820
2954
|
for (const ch of this._def.checks) {
|
|
@@ -3728,9 +3862,10 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
3728
3862
|
const syncPairs = [];
|
|
3729
3863
|
for (const pair of pairs) {
|
|
3730
3864
|
const key = await pair.key;
|
|
3865
|
+
const value = await pair.value;
|
|
3731
3866
|
syncPairs.push({
|
|
3732
3867
|
key,
|
|
3733
|
-
value
|
|
3868
|
+
value,
|
|
3734
3869
|
alwaysSet: pair.alwaysSet
|
|
3735
3870
|
});
|
|
3736
3871
|
}
|
|
@@ -4081,15 +4216,25 @@ var getDiscriminator = (type) => {
|
|
|
4081
4216
|
} else if (type instanceof ZodEnum) {
|
|
4082
4217
|
return type.options;
|
|
4083
4218
|
} else if (type instanceof ZodNativeEnum) {
|
|
4084
|
-
return
|
|
4219
|
+
return util.objectValues(type.enum);
|
|
4085
4220
|
} else if (type instanceof ZodDefault) {
|
|
4086
4221
|
return getDiscriminator(type._def.innerType);
|
|
4087
4222
|
} else if (type instanceof ZodUndefined) {
|
|
4088
4223
|
return [void 0];
|
|
4089
4224
|
} else if (type instanceof ZodNull) {
|
|
4090
4225
|
return [null];
|
|
4226
|
+
} else if (type instanceof ZodOptional) {
|
|
4227
|
+
return [void 0, ...getDiscriminator(type.unwrap())];
|
|
4228
|
+
} else if (type instanceof ZodNullable) {
|
|
4229
|
+
return [null, ...getDiscriminator(type.unwrap())];
|
|
4230
|
+
} else if (type instanceof ZodBranded) {
|
|
4231
|
+
return getDiscriminator(type.unwrap());
|
|
4232
|
+
} else if (type instanceof ZodReadonly) {
|
|
4233
|
+
return getDiscriminator(type.unwrap());
|
|
4234
|
+
} else if (type instanceof ZodCatch) {
|
|
4235
|
+
return getDiscriminator(type._def.innerType);
|
|
4091
4236
|
} else {
|
|
4092
|
-
return
|
|
4237
|
+
return [];
|
|
4093
4238
|
}
|
|
4094
4239
|
};
|
|
4095
4240
|
var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
@@ -4149,7 +4294,7 @@ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
|
4149
4294
|
const optionsMap = /* @__PURE__ */ new Map();
|
|
4150
4295
|
for (const type of options) {
|
|
4151
4296
|
const discriminatorValues = getDiscriminator(type.shape[discriminator]);
|
|
4152
|
-
if (!discriminatorValues) {
|
|
4297
|
+
if (!discriminatorValues.length) {
|
|
4153
4298
|
throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
|
|
4154
4299
|
}
|
|
4155
4300
|
for (const value of discriminatorValues) {
|
|
@@ -4349,7 +4494,8 @@ var ZodRecord = class _ZodRecord extends ZodType {
|
|
|
4349
4494
|
for (const key in ctx.data) {
|
|
4350
4495
|
pairs.push({
|
|
4351
4496
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
|
|
4352
|
-
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
|
|
4497
|
+
value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
|
|
4498
|
+
alwaysSet: key in ctx.data
|
|
4353
4499
|
});
|
|
4354
4500
|
}
|
|
4355
4501
|
if (ctx.common.async) {
|
|
@@ -4693,6 +4839,10 @@ function createZodEnum(values, params) {
|
|
|
4693
4839
|
});
|
|
4694
4840
|
}
|
|
4695
4841
|
var ZodEnum = class _ZodEnum extends ZodType {
|
|
4842
|
+
constructor() {
|
|
4843
|
+
super(...arguments);
|
|
4844
|
+
_ZodEnum_cache.set(this, void 0);
|
|
4845
|
+
}
|
|
4696
4846
|
_parse(input) {
|
|
4697
4847
|
if (typeof input.data !== "string") {
|
|
4698
4848
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -4704,7 +4854,10 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
4704
4854
|
});
|
|
4705
4855
|
return INVALID;
|
|
4706
4856
|
}
|
|
4707
|
-
if (this
|
|
4857
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
|
|
4858
|
+
__classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
|
|
4859
|
+
}
|
|
4860
|
+
if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
|
|
4708
4861
|
const ctx = this._getOrReturnCtx(input);
|
|
4709
4862
|
const expectedValues = this._def.values;
|
|
4710
4863
|
addIssueToContext(ctx, {
|
|
@@ -4740,15 +4893,26 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
4740
4893
|
}
|
|
4741
4894
|
return enumValues;
|
|
4742
4895
|
}
|
|
4743
|
-
extract(values) {
|
|
4744
|
-
return _ZodEnum.create(values
|
|
4896
|
+
extract(values, newDef = this._def) {
|
|
4897
|
+
return _ZodEnum.create(values, {
|
|
4898
|
+
...this._def,
|
|
4899
|
+
...newDef
|
|
4900
|
+
});
|
|
4745
4901
|
}
|
|
4746
|
-
exclude(values) {
|
|
4747
|
-
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt))
|
|
4902
|
+
exclude(values, newDef = this._def) {
|
|
4903
|
+
return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
|
|
4904
|
+
...this._def,
|
|
4905
|
+
...newDef
|
|
4906
|
+
});
|
|
4748
4907
|
}
|
|
4749
4908
|
};
|
|
4909
|
+
_ZodEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
4750
4910
|
ZodEnum.create = createZodEnum;
|
|
4751
4911
|
var ZodNativeEnum = class extends ZodType {
|
|
4912
|
+
constructor() {
|
|
4913
|
+
super(...arguments);
|
|
4914
|
+
_ZodNativeEnum_cache.set(this, void 0);
|
|
4915
|
+
}
|
|
4752
4916
|
_parse(input) {
|
|
4753
4917
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
4754
4918
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -4761,7 +4925,10 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
4761
4925
|
});
|
|
4762
4926
|
return INVALID;
|
|
4763
4927
|
}
|
|
4764
|
-
if (
|
|
4928
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
|
|
4929
|
+
__classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
|
|
4930
|
+
}
|
|
4931
|
+
if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
|
|
4765
4932
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
4766
4933
|
addIssueToContext(ctx, {
|
|
4767
4934
|
received: ctx.data,
|
|
@@ -4776,6 +4943,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
4776
4943
|
return this._def.values;
|
|
4777
4944
|
}
|
|
4778
4945
|
};
|
|
4946
|
+
_ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
|
|
4779
4947
|
ZodNativeEnum.create = (values, params) => {
|
|
4780
4948
|
return new ZodNativeEnum({
|
|
4781
4949
|
values,
|
|
@@ -4839,26 +5007,38 @@ var ZodEffects = class extends ZodType {
|
|
|
4839
5007
|
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
4840
5008
|
if (effect.type === "preprocess") {
|
|
4841
5009
|
const processed = effect.transform(ctx.data, checkCtx);
|
|
4842
|
-
if (ctx.common.issues.length) {
|
|
4843
|
-
return {
|
|
4844
|
-
status: "dirty",
|
|
4845
|
-
value: ctx.data
|
|
4846
|
-
};
|
|
4847
|
-
}
|
|
4848
5010
|
if (ctx.common.async) {
|
|
4849
|
-
return Promise.resolve(processed).then((processed2) => {
|
|
4850
|
-
|
|
5011
|
+
return Promise.resolve(processed).then(async (processed2) => {
|
|
5012
|
+
if (status.value === "aborted")
|
|
5013
|
+
return INVALID;
|
|
5014
|
+
const result = await this._def.schema._parseAsync({
|
|
4851
5015
|
data: processed2,
|
|
4852
5016
|
path: ctx.path,
|
|
4853
5017
|
parent: ctx
|
|
4854
5018
|
});
|
|
5019
|
+
if (result.status === "aborted")
|
|
5020
|
+
return INVALID;
|
|
5021
|
+
if (result.status === "dirty")
|
|
5022
|
+
return DIRTY(result.value);
|
|
5023
|
+
if (status.value === "dirty")
|
|
5024
|
+
return DIRTY(result.value);
|
|
5025
|
+
return result;
|
|
4855
5026
|
});
|
|
4856
5027
|
} else {
|
|
4857
|
-
|
|
5028
|
+
if (status.value === "aborted")
|
|
5029
|
+
return INVALID;
|
|
5030
|
+
const result = this._def.schema._parseSync({
|
|
4858
5031
|
data: processed,
|
|
4859
5032
|
path: ctx.path,
|
|
4860
5033
|
parent: ctx
|
|
4861
5034
|
});
|
|
5035
|
+
if (result.status === "aborted")
|
|
5036
|
+
return INVALID;
|
|
5037
|
+
if (result.status === "dirty")
|
|
5038
|
+
return DIRTY(result.value);
|
|
5039
|
+
if (status.value === "dirty")
|
|
5040
|
+
return DIRTY(result.value);
|
|
5041
|
+
return result;
|
|
4862
5042
|
}
|
|
4863
5043
|
}
|
|
4864
5044
|
if (effect.type === "refinement") {
|
|
@@ -5152,6 +5332,9 @@ var ZodReadonly = class extends ZodType {
|
|
|
5152
5332
|
}
|
|
5153
5333
|
return result;
|
|
5154
5334
|
}
|
|
5335
|
+
unwrap() {
|
|
5336
|
+
return this._def.innerType;
|
|
5337
|
+
}
|
|
5155
5338
|
};
|
|
5156
5339
|
ZodReadonly.create = (type, params) => {
|
|
5157
5340
|
return new ZodReadonly({
|
|
@@ -5160,7 +5343,7 @@ ZodReadonly.create = (type, params) => {
|
|
|
5160
5343
|
...processCreateParams(params)
|
|
5161
5344
|
});
|
|
5162
5345
|
};
|
|
5163
|
-
|
|
5346
|
+
function custom(check, params = {}, fatal) {
|
|
5164
5347
|
if (check)
|
|
5165
5348
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
5166
5349
|
var _a, _b;
|
|
@@ -5172,7 +5355,7 @@ var custom = (check, params = {}, fatal) => {
|
|
|
5172
5355
|
}
|
|
5173
5356
|
});
|
|
5174
5357
|
return ZodAny.create();
|
|
5175
|
-
}
|
|
5358
|
+
}
|
|
5176
5359
|
var late = {
|
|
5177
5360
|
object: ZodObject.lazycreate
|
|
5178
5361
|
};
|
|
@@ -5291,6 +5474,7 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
5291
5474
|
ZodParsedType,
|
|
5292
5475
|
getParsedType,
|
|
5293
5476
|
ZodType,
|
|
5477
|
+
datetimeRegex,
|
|
5294
5478
|
ZodString,
|
|
5295
5479
|
ZodNumber,
|
|
5296
5480
|
ZodBigInt,
|
|
@@ -5452,7 +5636,7 @@ var StormConfigSchema = z.object({
|
|
|
5452
5636
|
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
5453
5637
|
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
5454
5638
|
repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
5455
|
-
license: z.string().trim().default("Apache
|
|
5639
|
+
license: z.string().trim().default("Apache 2.0").describe("The root directory of the package"),
|
|
5456
5640
|
homepage: z.string().trim().url().default("https://stormsoftware.com").describe("The homepage of the workspace"),
|
|
5457
5641
|
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
5458
5642
|
preid: z.string().optional().describe("A tag specifying the version pre-release identifier"),
|
|
@@ -5519,7 +5703,7 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
5519
5703
|
var DEFAULT_STORM_CONFIG = {
|
|
5520
5704
|
name: "storm",
|
|
5521
5705
|
namespace: "storm-software",
|
|
5522
|
-
license: "Apache
|
|
5706
|
+
license: "Apache 2.0",
|
|
5523
5707
|
homepage: "https://stormsoftware.com",
|
|
5524
5708
|
owner: "@storm-software/development",
|
|
5525
5709
|
worker: "stormie-bot",
|
|
@@ -5555,7 +5739,6 @@ var getLogFn = (logLevel = LogLevel.INFO, config = {}) => {
|
|
|
5555
5739
|
${_chalk.bold.hex(colors.error ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.fatal ?? "#b62324").whiteBright(
|
|
5556
5740
|
" \u{1F480} Fatal "
|
|
5557
5741
|
)} ${_chalk.hex(colors.error ?? "#f85149")(formatLogMessage(message))}
|
|
5558
|
-
|
|
5559
5742
|
`
|
|
5560
5743
|
);
|
|
5561
5744
|
};
|
|
@@ -5648,10 +5831,10 @@ var getStopwatch = (name) => {
|
|
|
5648
5831
|
};
|
|
5649
5832
|
};
|
|
5650
5833
|
var formatLogMessage = (message, prefix = "-") => {
|
|
5651
|
-
return typeof message === "string" ? message : typeof message === "object" ?
|
|
5652
|
-
|
|
5653
|
-
${formatLogMessage(message[key], `${prefix}-`)
|
|
5654
|
-
).join("\n") : message;
|
|
5834
|
+
return typeof message === "string" ? message : typeof message === "object" ? `
|
|
5835
|
+
${Object.keys(message).map(
|
|
5836
|
+
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], `${prefix}-`) : message[key]}`
|
|
5837
|
+
).join("\n")}` : message;
|
|
5655
5838
|
};
|
|
5656
5839
|
var _isFunction = (value) => {
|
|
5657
5840
|
try {
|