@keycloakify/angular 0.2.10 → 0.2.12
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/README.md +5 -6
- package/bin/187.index.js +3 -3
- package/bin/{811.index.js → 279.index.js} +196 -724
- package/bin/476.index.js +1 -675
- package/bin/671.index.js +618 -3
- package/bin/942.index.js +617 -2
- package/bin/index.js +686 -21
- package/fesm2022/keycloakify-angular-account-directives-kc-class.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-pages-account.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-pages-applications.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-pages-federatedIdentity.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-pages-log.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-pages-password.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-pages-sessions.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-pages-totp.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-services-account-resource-injector.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-services-i18n.mjs +3 -3
- package/fesm2022/keycloakify-angular-account-template.mjs +3 -3
- package/fesm2022/keycloakify-angular-lib-directives-attributes.mjs +3 -3
- package/fesm2022/keycloakify-angular-lib-pipes-input-type.mjs +3 -3
- package/fesm2022/keycloakify-angular-lib-pipes-is-array-with-empty-object.mjs +3 -3
- package/fesm2022/keycloakify-angular-lib-pipes-kc-sanitize.mjs +3 -3
- package/fesm2022/keycloakify-angular-lib-pipes-to-array.mjs +3 -3
- package/fesm2022/keycloakify-angular-lib-pipes-to-number.mjs +3 -3
- package/fesm2022/keycloakify-angular-lib-services-resource-injector.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-add-remove-buttons-multi-valued-attribute.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-field-errors.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-group-label.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-input-field-by-type.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-input-tag-selects.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-input-tag.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-logout-other-sessions.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-password-wrapper.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-select-tag.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-textarea-tag.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-components-user-profile-form-fields.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-directives-kc-class.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-code.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-delete-account-confirm.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-delete-credential.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-error.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-frontchannel-logout.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-idp-review-user-profile.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-info.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-config-totp.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm-override.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-idp-link-confirm.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-idp-link-email.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-oauth-grant.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-oauth2-device-verify-user-code.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-otp.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-page-expired.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-passkeys-conditional-authenticate.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-password.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-config.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-recovery-authn-code-input.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-reset-otp.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-reset-password.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-update-password.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-update-profile.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-username.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-verify-email.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login-x509-info.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-login.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-logout-confirm.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-register.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-saml-post-form.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-select-authenticator.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-terms.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-update-email.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-webauthn-authenticate.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-webauthn-error.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-pages-webauthn-register.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-services-i18n.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-services-login-resource-injector.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-services-user-profile-form.mjs +3 -3
- package/fesm2022/keycloakify-angular-login-template.mjs +3 -3
- package/package.json +2 -2
- package/src/bin/main.ts +9 -0
- package/bin/986.index.js +0 -1294
|
@@ -1,681 +1,7 @@
|
|
|
1
|
-
export const id =
|
|
2
|
-
export const ids = [
|
|
1
|
+
export const id = 279;
|
|
2
|
+
export const ids = [279];
|
|
3
3
|
export const modules = {
|
|
4
4
|
|
|
5
|
-
/***/ 797:
|
|
6
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// EXPORTS
|
|
10
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
11
|
-
Ay: () => (/* binding */ source)
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// UNUSED EXPORTS: Chalk, backgroundColorNames, backgroundColors, chalkStderr, colorNames, colors, foregroundColorNames, foregroundColors, modifierNames, modifiers, supportsColor, supportsColorStderr
|
|
15
|
-
|
|
16
|
-
;// CONCATENATED MODULE: ./node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
17
|
-
const ANSI_BACKGROUND_OFFSET = 10;
|
|
18
|
-
|
|
19
|
-
const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
|
|
20
|
-
|
|
21
|
-
const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
|
|
22
|
-
|
|
23
|
-
const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
|
|
24
|
-
|
|
25
|
-
const styles = {
|
|
26
|
-
modifier: {
|
|
27
|
-
reset: [0, 0],
|
|
28
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
29
|
-
bold: [1, 22],
|
|
30
|
-
dim: [2, 22],
|
|
31
|
-
italic: [3, 23],
|
|
32
|
-
underline: [4, 24],
|
|
33
|
-
overline: [53, 55],
|
|
34
|
-
inverse: [7, 27],
|
|
35
|
-
hidden: [8, 28],
|
|
36
|
-
strikethrough: [9, 29],
|
|
37
|
-
},
|
|
38
|
-
color: {
|
|
39
|
-
black: [30, 39],
|
|
40
|
-
red: [31, 39],
|
|
41
|
-
green: [32, 39],
|
|
42
|
-
yellow: [33, 39],
|
|
43
|
-
blue: [34, 39],
|
|
44
|
-
magenta: [35, 39],
|
|
45
|
-
cyan: [36, 39],
|
|
46
|
-
white: [37, 39],
|
|
47
|
-
|
|
48
|
-
// Bright color
|
|
49
|
-
blackBright: [90, 39],
|
|
50
|
-
gray: [90, 39], // Alias of `blackBright`
|
|
51
|
-
grey: [90, 39], // Alias of `blackBright`
|
|
52
|
-
redBright: [91, 39],
|
|
53
|
-
greenBright: [92, 39],
|
|
54
|
-
yellowBright: [93, 39],
|
|
55
|
-
blueBright: [94, 39],
|
|
56
|
-
magentaBright: [95, 39],
|
|
57
|
-
cyanBright: [96, 39],
|
|
58
|
-
whiteBright: [97, 39],
|
|
59
|
-
},
|
|
60
|
-
bgColor: {
|
|
61
|
-
bgBlack: [40, 49],
|
|
62
|
-
bgRed: [41, 49],
|
|
63
|
-
bgGreen: [42, 49],
|
|
64
|
-
bgYellow: [43, 49],
|
|
65
|
-
bgBlue: [44, 49],
|
|
66
|
-
bgMagenta: [45, 49],
|
|
67
|
-
bgCyan: [46, 49],
|
|
68
|
-
bgWhite: [47, 49],
|
|
69
|
-
|
|
70
|
-
// Bright color
|
|
71
|
-
bgBlackBright: [100, 49],
|
|
72
|
-
bgGray: [100, 49], // Alias of `bgBlackBright`
|
|
73
|
-
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
|
74
|
-
bgRedBright: [101, 49],
|
|
75
|
-
bgGreenBright: [102, 49],
|
|
76
|
-
bgYellowBright: [103, 49],
|
|
77
|
-
bgBlueBright: [104, 49],
|
|
78
|
-
bgMagentaBright: [105, 49],
|
|
79
|
-
bgCyanBright: [106, 49],
|
|
80
|
-
bgWhiteBright: [107, 49],
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const modifierNames = Object.keys(styles.modifier);
|
|
85
|
-
const foregroundColorNames = Object.keys(styles.color);
|
|
86
|
-
const backgroundColorNames = Object.keys(styles.bgColor);
|
|
87
|
-
const colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
88
|
-
|
|
89
|
-
function assembleStyles() {
|
|
90
|
-
const codes = new Map();
|
|
91
|
-
|
|
92
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
93
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
94
|
-
styles[styleName] = {
|
|
95
|
-
open: `\u001B[${style[0]}m`,
|
|
96
|
-
close: `\u001B[${style[1]}m`,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
group[styleName] = styles[styleName];
|
|
100
|
-
|
|
101
|
-
codes.set(style[0], style[1]);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
Object.defineProperty(styles, groupName, {
|
|
105
|
-
value: group,
|
|
106
|
-
enumerable: false,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
Object.defineProperty(styles, 'codes', {
|
|
111
|
-
value: codes,
|
|
112
|
-
enumerable: false,
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
styles.color.close = '\u001B[39m';
|
|
116
|
-
styles.bgColor.close = '\u001B[49m';
|
|
117
|
-
|
|
118
|
-
styles.color.ansi = wrapAnsi16();
|
|
119
|
-
styles.color.ansi256 = wrapAnsi256();
|
|
120
|
-
styles.color.ansi16m = wrapAnsi16m();
|
|
121
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
122
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
123
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
124
|
-
|
|
125
|
-
// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
|
|
126
|
-
Object.defineProperties(styles, {
|
|
127
|
-
rgbToAnsi256: {
|
|
128
|
-
value(red, green, blue) {
|
|
129
|
-
// We use the extended greyscale palette here, with the exception of
|
|
130
|
-
// black and white. normal palette only has 4 greyscale shades.
|
|
131
|
-
if (red === green && green === blue) {
|
|
132
|
-
if (red < 8) {
|
|
133
|
-
return 16;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (red > 248) {
|
|
137
|
-
return 231;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return Math.round(((red - 8) / 247) * 24) + 232;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return 16
|
|
144
|
-
+ (36 * Math.round(red / 255 * 5))
|
|
145
|
-
+ (6 * Math.round(green / 255 * 5))
|
|
146
|
-
+ Math.round(blue / 255 * 5);
|
|
147
|
-
},
|
|
148
|
-
enumerable: false,
|
|
149
|
-
},
|
|
150
|
-
hexToRgb: {
|
|
151
|
-
value(hex) {
|
|
152
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
153
|
-
if (!matches) {
|
|
154
|
-
return [0, 0, 0];
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
let [colorString] = matches;
|
|
158
|
-
|
|
159
|
-
if (colorString.length === 3) {
|
|
160
|
-
colorString = [...colorString].map(character => character + character).join('');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const integer = Number.parseInt(colorString, 16);
|
|
164
|
-
|
|
165
|
-
return [
|
|
166
|
-
/* eslint-disable no-bitwise */
|
|
167
|
-
(integer >> 16) & 0xFF,
|
|
168
|
-
(integer >> 8) & 0xFF,
|
|
169
|
-
integer & 0xFF,
|
|
170
|
-
/* eslint-enable no-bitwise */
|
|
171
|
-
];
|
|
172
|
-
},
|
|
173
|
-
enumerable: false,
|
|
174
|
-
},
|
|
175
|
-
hexToAnsi256: {
|
|
176
|
-
value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
177
|
-
enumerable: false,
|
|
178
|
-
},
|
|
179
|
-
ansi256ToAnsi: {
|
|
180
|
-
value(code) {
|
|
181
|
-
if (code < 8) {
|
|
182
|
-
return 30 + code;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (code < 16) {
|
|
186
|
-
return 90 + (code - 8);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
let red;
|
|
190
|
-
let green;
|
|
191
|
-
let blue;
|
|
192
|
-
|
|
193
|
-
if (code >= 232) {
|
|
194
|
-
red = (((code - 232) * 10) + 8) / 255;
|
|
195
|
-
green = red;
|
|
196
|
-
blue = red;
|
|
197
|
-
} else {
|
|
198
|
-
code -= 16;
|
|
199
|
-
|
|
200
|
-
const remainder = code % 36;
|
|
201
|
-
|
|
202
|
-
red = Math.floor(code / 36) / 5;
|
|
203
|
-
green = Math.floor(remainder / 6) / 5;
|
|
204
|
-
blue = (remainder % 6) / 5;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const value = Math.max(red, green, blue) * 2;
|
|
208
|
-
|
|
209
|
-
if (value === 0) {
|
|
210
|
-
return 30;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// eslint-disable-next-line no-bitwise
|
|
214
|
-
let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
|
|
215
|
-
|
|
216
|
-
if (value === 2) {
|
|
217
|
-
result += 60;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return result;
|
|
221
|
-
},
|
|
222
|
-
enumerable: false,
|
|
223
|
-
},
|
|
224
|
-
rgbToAnsi: {
|
|
225
|
-
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
226
|
-
enumerable: false,
|
|
227
|
-
},
|
|
228
|
-
hexToAnsi: {
|
|
229
|
-
value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
230
|
-
enumerable: false,
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
return styles;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const ansiStyles = assembleStyles();
|
|
238
|
-
|
|
239
|
-
/* harmony default export */ const ansi_styles = (ansiStyles);
|
|
240
|
-
|
|
241
|
-
// EXTERNAL MODULE: external "node:process"
|
|
242
|
-
var external_node_process_ = __webpack_require__(708);
|
|
243
|
-
// EXTERNAL MODULE: external "node:os"
|
|
244
|
-
var external_node_os_ = __webpack_require__(161);
|
|
245
|
-
// EXTERNAL MODULE: external "node:tty"
|
|
246
|
-
var external_node_tty_ = __webpack_require__(66);
|
|
247
|
-
;// CONCATENATED MODULE: ./node_modules/chalk/source/vendor/supports-color/index.js
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js
|
|
253
|
-
/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
|
|
254
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : external_node_process_.argv) {
|
|
255
|
-
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
256
|
-
const position = argv.indexOf(prefix + flag);
|
|
257
|
-
const terminatorPosition = argv.indexOf('--');
|
|
258
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
const {env} = external_node_process_;
|
|
262
|
-
|
|
263
|
-
let flagForceColor;
|
|
264
|
-
if (
|
|
265
|
-
hasFlag('no-color')
|
|
266
|
-
|| hasFlag('no-colors')
|
|
267
|
-
|| hasFlag('color=false')
|
|
268
|
-
|| hasFlag('color=never')
|
|
269
|
-
) {
|
|
270
|
-
flagForceColor = 0;
|
|
271
|
-
} else if (
|
|
272
|
-
hasFlag('color')
|
|
273
|
-
|| hasFlag('colors')
|
|
274
|
-
|| hasFlag('color=true')
|
|
275
|
-
|| hasFlag('color=always')
|
|
276
|
-
) {
|
|
277
|
-
flagForceColor = 1;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
function envForceColor() {
|
|
281
|
-
if ('FORCE_COLOR' in env) {
|
|
282
|
-
if (env.FORCE_COLOR === 'true') {
|
|
283
|
-
return 1;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (env.FORCE_COLOR === 'false') {
|
|
287
|
-
return 0;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
function translateLevel(level) {
|
|
295
|
-
if (level === 0) {
|
|
296
|
-
return false;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
return {
|
|
300
|
-
level,
|
|
301
|
-
hasBasic: true,
|
|
302
|
-
has256: level >= 2,
|
|
303
|
-
has16m: level >= 3,
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
308
|
-
const noFlagForceColor = envForceColor();
|
|
309
|
-
if (noFlagForceColor !== undefined) {
|
|
310
|
-
flagForceColor = noFlagForceColor;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
314
|
-
|
|
315
|
-
if (forceColor === 0) {
|
|
316
|
-
return 0;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
if (sniffFlags) {
|
|
320
|
-
if (hasFlag('color=16m')
|
|
321
|
-
|| hasFlag('color=full')
|
|
322
|
-
|| hasFlag('color=truecolor')) {
|
|
323
|
-
return 3;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
if (hasFlag('color=256')) {
|
|
327
|
-
return 2;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// Check for Azure DevOps pipelines.
|
|
332
|
-
// Has to be above the `!streamIsTTY` check.
|
|
333
|
-
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
|
|
334
|
-
return 1;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
338
|
-
return 0;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
const min = forceColor || 0;
|
|
342
|
-
|
|
343
|
-
if (env.TERM === 'dumb') {
|
|
344
|
-
return min;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
if (external_node_process_.platform === 'win32') {
|
|
348
|
-
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
349
|
-
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
350
|
-
const osRelease = external_node_os_.release().split('.');
|
|
351
|
-
if (
|
|
352
|
-
Number(osRelease[0]) >= 10
|
|
353
|
-
&& Number(osRelease[2]) >= 10_586
|
|
354
|
-
) {
|
|
355
|
-
return Number(osRelease[2]) >= 14_931 ? 3 : 2;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return 1;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if ('CI' in env) {
|
|
362
|
-
if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {
|
|
363
|
-
return 3;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
367
|
-
return 1;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
return min;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
if ('TEAMCITY_VERSION' in env) {
|
|
374
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
if (env.COLORTERM === 'truecolor') {
|
|
378
|
-
return 3;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
if (env.TERM === 'xterm-kitty') {
|
|
382
|
-
return 3;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
if ('TERM_PROGRAM' in env) {
|
|
386
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
387
|
-
|
|
388
|
-
switch (env.TERM_PROGRAM) {
|
|
389
|
-
case 'iTerm.app': {
|
|
390
|
-
return version >= 3 ? 3 : 2;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
case 'Apple_Terminal': {
|
|
394
|
-
return 2;
|
|
395
|
-
}
|
|
396
|
-
// No default
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
401
|
-
return 2;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
405
|
-
return 1;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if ('COLORTERM' in env) {
|
|
409
|
-
return 1;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
return min;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
function createSupportsColor(stream, options = {}) {
|
|
416
|
-
const level = _supportsColor(stream, {
|
|
417
|
-
streamIsTTY: stream && stream.isTTY,
|
|
418
|
-
...options,
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
return translateLevel(level);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
const supportsColor = {
|
|
425
|
-
stdout: createSupportsColor({isTTY: external_node_tty_.isatty(1)}),
|
|
426
|
-
stderr: createSupportsColor({isTTY: external_node_tty_.isatty(2)}),
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
/* harmony default export */ const supports_color = (supportsColor);
|
|
430
|
-
|
|
431
|
-
;// CONCATENATED MODULE: ./node_modules/chalk/source/utilities.js
|
|
432
|
-
// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.
|
|
433
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
434
|
-
let index = string.indexOf(substring);
|
|
435
|
-
if (index === -1) {
|
|
436
|
-
return string;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
const substringLength = substring.length;
|
|
440
|
-
let endIndex = 0;
|
|
441
|
-
let returnValue = '';
|
|
442
|
-
do {
|
|
443
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
444
|
-
endIndex = index + substringLength;
|
|
445
|
-
index = string.indexOf(substring, endIndex);
|
|
446
|
-
} while (index !== -1);
|
|
447
|
-
|
|
448
|
-
returnValue += string.slice(endIndex);
|
|
449
|
-
return returnValue;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
453
|
-
let endIndex = 0;
|
|
454
|
-
let returnValue = '';
|
|
455
|
-
do {
|
|
456
|
-
const gotCR = string[index - 1] === '\r';
|
|
457
|
-
returnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
|
|
458
|
-
endIndex = index + 1;
|
|
459
|
-
index = string.indexOf('\n', endIndex);
|
|
460
|
-
} while (index !== -1);
|
|
461
|
-
|
|
462
|
-
returnValue += string.slice(endIndex);
|
|
463
|
-
return returnValue;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
;// CONCATENATED MODULE: ./node_modules/chalk/source/index.js
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
const {stdout: stdoutColor, stderr: stderrColor} = supports_color;
|
|
472
|
-
|
|
473
|
-
const GENERATOR = Symbol('GENERATOR');
|
|
474
|
-
const STYLER = Symbol('STYLER');
|
|
475
|
-
const IS_EMPTY = Symbol('IS_EMPTY');
|
|
476
|
-
|
|
477
|
-
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
|
478
|
-
const levelMapping = [
|
|
479
|
-
'ansi',
|
|
480
|
-
'ansi',
|
|
481
|
-
'ansi256',
|
|
482
|
-
'ansi16m',
|
|
483
|
-
];
|
|
484
|
-
|
|
485
|
-
const source_styles = Object.create(null);
|
|
486
|
-
|
|
487
|
-
const applyOptions = (object, options = {}) => {
|
|
488
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
489
|
-
throw new Error('The `level` option should be an integer from 0 to 3');
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// Detect level if not set manually
|
|
493
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
494
|
-
object.level = options.level === undefined ? colorLevel : options.level;
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
class Chalk {
|
|
498
|
-
constructor(options) {
|
|
499
|
-
// eslint-disable-next-line no-constructor-return
|
|
500
|
-
return chalkFactory(options);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
const chalkFactory = options => {
|
|
505
|
-
const chalk = (...strings) => strings.join(' ');
|
|
506
|
-
applyOptions(chalk, options);
|
|
507
|
-
|
|
508
|
-
Object.setPrototypeOf(chalk, createChalk.prototype);
|
|
509
|
-
|
|
510
|
-
return chalk;
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
function createChalk(options) {
|
|
514
|
-
return chalkFactory(options);
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
518
|
-
|
|
519
|
-
for (const [styleName, style] of Object.entries(ansi_styles)) {
|
|
520
|
-
source_styles[styleName] = {
|
|
521
|
-
get() {
|
|
522
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
523
|
-
Object.defineProperty(this, styleName, {value: builder});
|
|
524
|
-
return builder;
|
|
525
|
-
},
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
source_styles.visible = {
|
|
530
|
-
get() {
|
|
531
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
532
|
-
Object.defineProperty(this, 'visible', {value: builder});
|
|
533
|
-
return builder;
|
|
534
|
-
},
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
const getModelAnsi = (model, level, type, ...arguments_) => {
|
|
538
|
-
if (model === 'rgb') {
|
|
539
|
-
if (level === 'ansi16m') {
|
|
540
|
-
return ansi_styles[type].ansi16m(...arguments_);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
if (level === 'ansi256') {
|
|
544
|
-
return ansi_styles[type].ansi256(ansi_styles.rgbToAnsi256(...arguments_));
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
return ansi_styles[type].ansi(ansi_styles.rgbToAnsi(...arguments_));
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
if (model === 'hex') {
|
|
551
|
-
return getModelAnsi('rgb', level, type, ...ansi_styles.hexToRgb(...arguments_));
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
return ansi_styles[type][model](...arguments_);
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
const usedModels = ['rgb', 'hex', 'ansi256'];
|
|
558
|
-
|
|
559
|
-
for (const model of usedModels) {
|
|
560
|
-
source_styles[model] = {
|
|
561
|
-
get() {
|
|
562
|
-
const {level} = this;
|
|
563
|
-
return function (...arguments_) {
|
|
564
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansi_styles.color.close, this[STYLER]);
|
|
565
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
566
|
-
};
|
|
567
|
-
},
|
|
568
|
-
};
|
|
569
|
-
|
|
570
|
-
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
|
571
|
-
source_styles[bgModel] = {
|
|
572
|
-
get() {
|
|
573
|
-
const {level} = this;
|
|
574
|
-
return function (...arguments_) {
|
|
575
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansi_styles.bgColor.close, this[STYLER]);
|
|
576
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
577
|
-
};
|
|
578
|
-
},
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
const proto = Object.defineProperties(() => {}, {
|
|
583
|
-
...source_styles,
|
|
584
|
-
level: {
|
|
585
|
-
enumerable: true,
|
|
586
|
-
get() {
|
|
587
|
-
return this[GENERATOR].level;
|
|
588
|
-
},
|
|
589
|
-
set(level) {
|
|
590
|
-
this[GENERATOR].level = level;
|
|
591
|
-
},
|
|
592
|
-
},
|
|
593
|
-
});
|
|
594
|
-
|
|
595
|
-
const createStyler = (open, close, parent) => {
|
|
596
|
-
let openAll;
|
|
597
|
-
let closeAll;
|
|
598
|
-
if (parent === undefined) {
|
|
599
|
-
openAll = open;
|
|
600
|
-
closeAll = close;
|
|
601
|
-
} else {
|
|
602
|
-
openAll = parent.openAll + open;
|
|
603
|
-
closeAll = close + parent.closeAll;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
return {
|
|
607
|
-
open,
|
|
608
|
-
close,
|
|
609
|
-
openAll,
|
|
610
|
-
closeAll,
|
|
611
|
-
parent,
|
|
612
|
-
};
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
const createBuilder = (self, _styler, _isEmpty) => {
|
|
616
|
-
// Single argument is hot path, implicit coercion is faster than anything
|
|
617
|
-
// eslint-disable-next-line no-implicit-coercion
|
|
618
|
-
const builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
|
619
|
-
|
|
620
|
-
// We alter the prototype because we must return a function, but there is
|
|
621
|
-
// no way to create a function with a different prototype
|
|
622
|
-
Object.setPrototypeOf(builder, proto);
|
|
623
|
-
|
|
624
|
-
builder[GENERATOR] = self;
|
|
625
|
-
builder[STYLER] = _styler;
|
|
626
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
627
|
-
|
|
628
|
-
return builder;
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
const applyStyle = (self, string) => {
|
|
632
|
-
if (self.level <= 0 || !string) {
|
|
633
|
-
return self[IS_EMPTY] ? '' : string;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
let styler = self[STYLER];
|
|
637
|
-
|
|
638
|
-
if (styler === undefined) {
|
|
639
|
-
return string;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
const {openAll, closeAll} = styler;
|
|
643
|
-
if (string.includes('\u001B')) {
|
|
644
|
-
while (styler !== undefined) {
|
|
645
|
-
// Replace any instances already present with a re-opening code
|
|
646
|
-
// otherwise only the part of the string until said closing code
|
|
647
|
-
// will be colored, and the rest will simply be 'plain'.
|
|
648
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
649
|
-
|
|
650
|
-
styler = styler.parent;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
// We can move both next actions out of loop, because remaining actions in loop won't have
|
|
655
|
-
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
|
656
|
-
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
|
657
|
-
const lfIndex = string.indexOf('\n');
|
|
658
|
-
if (lfIndex !== -1) {
|
|
659
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
return openAll + string + closeAll;
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
Object.defineProperties(createChalk.prototype, source_styles);
|
|
666
|
-
|
|
667
|
-
const chalk = createChalk();
|
|
668
|
-
const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
/* harmony default export */ const source = (chalk);
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
/***/ }),
|
|
678
|
-
|
|
679
5
|
/***/ 94:
|
|
680
6
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
681
7
|
|
|
@@ -891,6 +217,9 @@ const quotelessJson = (obj) => {
|
|
|
891
217
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
892
218
|
};
|
|
893
219
|
class ZodError extends Error {
|
|
220
|
+
get errors() {
|
|
221
|
+
return this.issues;
|
|
222
|
+
}
|
|
894
223
|
constructor(issues) {
|
|
895
224
|
super();
|
|
896
225
|
this.issues = [];
|
|
@@ -911,9 +240,6 @@ class ZodError extends Error {
|
|
|
911
240
|
this.name = "ZodError";
|
|
912
241
|
this.issues = issues;
|
|
913
242
|
}
|
|
914
|
-
get errors() {
|
|
915
|
-
return this.issues;
|
|
916
|
-
}
|
|
917
243
|
format(_mapper) {
|
|
918
244
|
const mapper = _mapper ||
|
|
919
245
|
function (issue) {
|
|
@@ -1169,9 +495,9 @@ function addIssueToContext(ctx, issueData) {
|
|
|
1169
495
|
data: ctx.data,
|
|
1170
496
|
path: ctx.path,
|
|
1171
497
|
errorMaps: [
|
|
1172
|
-
ctx.common.contextualErrorMap,
|
|
1173
|
-
ctx.schemaErrorMap,
|
|
1174
|
-
overrideMap,
|
|
498
|
+
ctx.common.contextualErrorMap, // contextual error map is first priority
|
|
499
|
+
ctx.schemaErrorMap, // then schema-bound map if available
|
|
500
|
+
overrideMap, // then global override map
|
|
1175
501
|
overrideMap === errorMap ? undefined : errorMap, // then global default map
|
|
1176
502
|
].filter((x) => !!x),
|
|
1177
503
|
});
|
|
@@ -1347,35 +673,6 @@ function processCreateParams(params) {
|
|
|
1347
673
|
return { errorMap: customMap, description };
|
|
1348
674
|
}
|
|
1349
675
|
class ZodType {
|
|
1350
|
-
constructor(def) {
|
|
1351
|
-
/** Alias of safeParseAsync */
|
|
1352
|
-
this.spa = this.safeParseAsync;
|
|
1353
|
-
this._def = def;
|
|
1354
|
-
this.parse = this.parse.bind(this);
|
|
1355
|
-
this.safeParse = this.safeParse.bind(this);
|
|
1356
|
-
this.parseAsync = this.parseAsync.bind(this);
|
|
1357
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
1358
|
-
this.spa = this.spa.bind(this);
|
|
1359
|
-
this.refine = this.refine.bind(this);
|
|
1360
|
-
this.refinement = this.refinement.bind(this);
|
|
1361
|
-
this.superRefine = this.superRefine.bind(this);
|
|
1362
|
-
this.optional = this.optional.bind(this);
|
|
1363
|
-
this.nullable = this.nullable.bind(this);
|
|
1364
|
-
this.nullish = this.nullish.bind(this);
|
|
1365
|
-
this.array = this.array.bind(this);
|
|
1366
|
-
this.promise = this.promise.bind(this);
|
|
1367
|
-
this.or = this.or.bind(this);
|
|
1368
|
-
this.and = this.and.bind(this);
|
|
1369
|
-
this.transform = this.transform.bind(this);
|
|
1370
|
-
this.brand = this.brand.bind(this);
|
|
1371
|
-
this.default = this.default.bind(this);
|
|
1372
|
-
this.catch = this.catch.bind(this);
|
|
1373
|
-
this.describe = this.describe.bind(this);
|
|
1374
|
-
this.pipe = this.pipe.bind(this);
|
|
1375
|
-
this.readonly = this.readonly.bind(this);
|
|
1376
|
-
this.isNullable = this.isNullable.bind(this);
|
|
1377
|
-
this.isOptional = this.isOptional.bind(this);
|
|
1378
|
-
}
|
|
1379
676
|
get description() {
|
|
1380
677
|
return this._def.description;
|
|
1381
678
|
}
|
|
@@ -1439,6 +736,48 @@ class ZodType {
|
|
|
1439
736
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
1440
737
|
return handleResult(ctx, result);
|
|
1441
738
|
}
|
|
739
|
+
"~validate"(data) {
|
|
740
|
+
var _a, _b;
|
|
741
|
+
const ctx = {
|
|
742
|
+
common: {
|
|
743
|
+
issues: [],
|
|
744
|
+
async: !!this["~standard"].async,
|
|
745
|
+
},
|
|
746
|
+
path: [],
|
|
747
|
+
schemaErrorMap: this._def.errorMap,
|
|
748
|
+
parent: null,
|
|
749
|
+
data,
|
|
750
|
+
parsedType: getParsedType(data),
|
|
751
|
+
};
|
|
752
|
+
if (!this["~standard"].async) {
|
|
753
|
+
try {
|
|
754
|
+
const result = this._parseSync({ data, path: [], parent: ctx });
|
|
755
|
+
return isValid(result)
|
|
756
|
+
? {
|
|
757
|
+
value: result.value,
|
|
758
|
+
}
|
|
759
|
+
: {
|
|
760
|
+
issues: ctx.common.issues,
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
catch (err) {
|
|
764
|
+
if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
|
|
765
|
+
this["~standard"].async = true;
|
|
766
|
+
}
|
|
767
|
+
ctx.common = {
|
|
768
|
+
issues: [],
|
|
769
|
+
async: true,
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)
|
|
774
|
+
? {
|
|
775
|
+
value: result.value,
|
|
776
|
+
}
|
|
777
|
+
: {
|
|
778
|
+
issues: ctx.common.issues,
|
|
779
|
+
});
|
|
780
|
+
}
|
|
1442
781
|
async parseAsync(data, params) {
|
|
1443
782
|
const result = await this.safeParseAsync(data, params);
|
|
1444
783
|
if (result.success)
|
|
@@ -1525,6 +864,40 @@ class ZodType {
|
|
|
1525
864
|
superRefine(refinement) {
|
|
1526
865
|
return this._refinement(refinement);
|
|
1527
866
|
}
|
|
867
|
+
constructor(def) {
|
|
868
|
+
/** Alias of safeParseAsync */
|
|
869
|
+
this.spa = this.safeParseAsync;
|
|
870
|
+
this._def = def;
|
|
871
|
+
this.parse = this.parse.bind(this);
|
|
872
|
+
this.safeParse = this.safeParse.bind(this);
|
|
873
|
+
this.parseAsync = this.parseAsync.bind(this);
|
|
874
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
875
|
+
this.spa = this.spa.bind(this);
|
|
876
|
+
this.refine = this.refine.bind(this);
|
|
877
|
+
this.refinement = this.refinement.bind(this);
|
|
878
|
+
this.superRefine = this.superRefine.bind(this);
|
|
879
|
+
this.optional = this.optional.bind(this);
|
|
880
|
+
this.nullable = this.nullable.bind(this);
|
|
881
|
+
this.nullish = this.nullish.bind(this);
|
|
882
|
+
this.array = this.array.bind(this);
|
|
883
|
+
this.promise = this.promise.bind(this);
|
|
884
|
+
this.or = this.or.bind(this);
|
|
885
|
+
this.and = this.and.bind(this);
|
|
886
|
+
this.transform = this.transform.bind(this);
|
|
887
|
+
this.brand = this.brand.bind(this);
|
|
888
|
+
this.default = this.default.bind(this);
|
|
889
|
+
this.catch = this.catch.bind(this);
|
|
890
|
+
this.describe = this.describe.bind(this);
|
|
891
|
+
this.pipe = this.pipe.bind(this);
|
|
892
|
+
this.readonly = this.readonly.bind(this);
|
|
893
|
+
this.isNullable = this.isNullable.bind(this);
|
|
894
|
+
this.isOptional = this.isOptional.bind(this);
|
|
895
|
+
this["~standard"] = {
|
|
896
|
+
version: 1,
|
|
897
|
+
vendor: "zod",
|
|
898
|
+
validate: (data) => this["~validate"](data),
|
|
899
|
+
};
|
|
900
|
+
}
|
|
1528
901
|
optional() {
|
|
1529
902
|
return ZodOptional.create(this, this._def);
|
|
1530
903
|
}
|
|
@@ -1535,7 +908,7 @@ class ZodType {
|
|
|
1535
908
|
return this.nullable().optional();
|
|
1536
909
|
}
|
|
1537
910
|
array() {
|
|
1538
|
-
return ZodArray.create(this
|
|
911
|
+
return ZodArray.create(this);
|
|
1539
912
|
}
|
|
1540
913
|
promise() {
|
|
1541
914
|
return ZodPromise.create(this, this._def);
|
|
@@ -1601,11 +974,12 @@ class ZodType {
|
|
|
1601
974
|
}
|
|
1602
975
|
const cuidRegex = /^c[^\s-]{8,}$/i;
|
|
1603
976
|
const cuid2Regex = /^[0-9a-z]+$/;
|
|
1604
|
-
const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
|
977
|
+
const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
1605
978
|
// const uuidRegex =
|
|
1606
979
|
// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
1607
980
|
const 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;
|
|
1608
981
|
const nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
982
|
+
const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
1609
983
|
const 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)?)??$/;
|
|
1610
984
|
// from https://stackoverflow.com/a/46181/1550155
|
|
1611
985
|
// old version: too slow, didn't support unicode
|
|
@@ -1627,9 +1001,15 @@ const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
|
1627
1001
|
let emojiRegex;
|
|
1628
1002
|
// faster, simpler, safer
|
|
1629
1003
|
const 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])$/;
|
|
1630
|
-
const
|
|
1004
|
+
const ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
|
|
1005
|
+
// const ipv6Regex =
|
|
1006
|
+
// /^(([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})))$/;
|
|
1007
|
+
const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
1008
|
+
const ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
1631
1009
|
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
|
|
1632
1010
|
const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
1011
|
+
// https://base64.guru/standards/base64url
|
|
1012
|
+
const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
1633
1013
|
// simple
|
|
1634
1014
|
// const dateRegexSource = `\\d{4}-\\d{2}-\\d{2}`;
|
|
1635
1015
|
// no leap year validation
|
|
@@ -1670,6 +1050,38 @@ function isValidIP(ip, version) {
|
|
|
1670
1050
|
}
|
|
1671
1051
|
return false;
|
|
1672
1052
|
}
|
|
1053
|
+
function isValidJWT(jwt, alg) {
|
|
1054
|
+
if (!jwtRegex.test(jwt))
|
|
1055
|
+
return false;
|
|
1056
|
+
try {
|
|
1057
|
+
const [header] = jwt.split(".");
|
|
1058
|
+
// Convert base64url to base64
|
|
1059
|
+
const base64 = header
|
|
1060
|
+
.replace(/-/g, "+")
|
|
1061
|
+
.replace(/_/g, "/")
|
|
1062
|
+
.padEnd(header.length + ((4 - (header.length % 4)) % 4), "=");
|
|
1063
|
+
const decoded = JSON.parse(atob(base64));
|
|
1064
|
+
if (typeof decoded !== "object" || decoded === null)
|
|
1065
|
+
return false;
|
|
1066
|
+
if (!decoded.typ || !decoded.alg)
|
|
1067
|
+
return false;
|
|
1068
|
+
if (alg && decoded.alg !== alg)
|
|
1069
|
+
return false;
|
|
1070
|
+
return true;
|
|
1071
|
+
}
|
|
1072
|
+
catch (_a) {
|
|
1073
|
+
return false;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
function isValidCidr(ip, version) {
|
|
1077
|
+
if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
|
|
1078
|
+
return true;
|
|
1079
|
+
}
|
|
1080
|
+
if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
|
|
1081
|
+
return true;
|
|
1082
|
+
}
|
|
1083
|
+
return false;
|
|
1084
|
+
}
|
|
1673
1085
|
class ZodString extends ZodType {
|
|
1674
1086
|
_parse(input) {
|
|
1675
1087
|
if (this._def.coerce) {
|
|
@@ -1951,6 +1363,28 @@ class ZodString extends ZodType {
|
|
|
1951
1363
|
status.dirty();
|
|
1952
1364
|
}
|
|
1953
1365
|
}
|
|
1366
|
+
else if (check.kind === "jwt") {
|
|
1367
|
+
if (!isValidJWT(input.data, check.alg)) {
|
|
1368
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1369
|
+
addIssueToContext(ctx, {
|
|
1370
|
+
validation: "jwt",
|
|
1371
|
+
code: ZodIssueCode.invalid_string,
|
|
1372
|
+
message: check.message,
|
|
1373
|
+
});
|
|
1374
|
+
status.dirty();
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
else if (check.kind === "cidr") {
|
|
1378
|
+
if (!isValidCidr(input.data, check.version)) {
|
|
1379
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1380
|
+
addIssueToContext(ctx, {
|
|
1381
|
+
validation: "cidr",
|
|
1382
|
+
code: ZodIssueCode.invalid_string,
|
|
1383
|
+
message: check.message,
|
|
1384
|
+
});
|
|
1385
|
+
status.dirty();
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1954
1388
|
else if (check.kind === "base64") {
|
|
1955
1389
|
if (!base64Regex.test(input.data)) {
|
|
1956
1390
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1962,6 +1396,17 @@ class ZodString extends ZodType {
|
|
|
1962
1396
|
status.dirty();
|
|
1963
1397
|
}
|
|
1964
1398
|
}
|
|
1399
|
+
else if (check.kind === "base64url") {
|
|
1400
|
+
if (!base64urlRegex.test(input.data)) {
|
|
1401
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1402
|
+
addIssueToContext(ctx, {
|
|
1403
|
+
validation: "base64url",
|
|
1404
|
+
code: ZodIssueCode.invalid_string,
|
|
1405
|
+
message: check.message,
|
|
1406
|
+
});
|
|
1407
|
+
status.dirty();
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1965
1410
|
else {
|
|
1966
1411
|
util.assertNever(check);
|
|
1967
1412
|
}
|
|
@@ -2008,9 +1453,22 @@ class ZodString extends ZodType {
|
|
|
2008
1453
|
base64(message) {
|
|
2009
1454
|
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
2010
1455
|
}
|
|
1456
|
+
base64url(message) {
|
|
1457
|
+
// base64url encoding is a modification of base64 that can safely be used in URLs and filenames
|
|
1458
|
+
return this._addCheck({
|
|
1459
|
+
kind: "base64url",
|
|
1460
|
+
...errorUtil.errToObj(message),
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
jwt(options) {
|
|
1464
|
+
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
|
1465
|
+
}
|
|
2011
1466
|
ip(options) {
|
|
2012
1467
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
2013
1468
|
}
|
|
1469
|
+
cidr(options) {
|
|
1470
|
+
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
1471
|
+
}
|
|
2014
1472
|
datetime(options) {
|
|
2015
1473
|
var _a, _b;
|
|
2016
1474
|
if (typeof options === "string") {
|
|
@@ -2101,8 +1559,7 @@ class ZodString extends ZodType {
|
|
|
2101
1559
|
});
|
|
2102
1560
|
}
|
|
2103
1561
|
/**
|
|
2104
|
-
*
|
|
2105
|
-
* @see {@link ZodString.min}
|
|
1562
|
+
* Equivalent to `.min(1)`
|
|
2106
1563
|
*/
|
|
2107
1564
|
nonempty(message) {
|
|
2108
1565
|
return this.min(1, errorUtil.errToObj(message));
|
|
@@ -2164,9 +1621,16 @@ class ZodString extends ZodType {
|
|
|
2164
1621
|
get isIP() {
|
|
2165
1622
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
2166
1623
|
}
|
|
1624
|
+
get isCIDR() {
|
|
1625
|
+
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
|
1626
|
+
}
|
|
2167
1627
|
get isBase64() {
|
|
2168
1628
|
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
2169
1629
|
}
|
|
1630
|
+
get isBase64url() {
|
|
1631
|
+
// base64url encoding is a modification of base64 that can safely be used in URLs and filenames
|
|
1632
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
|
1633
|
+
}
|
|
2170
1634
|
get minLength() {
|
|
2171
1635
|
let min = null;
|
|
2172
1636
|
for (const ch of this._def.checks) {
|
|
@@ -2459,17 +1923,16 @@ class ZodBigInt extends ZodType {
|
|
|
2459
1923
|
}
|
|
2460
1924
|
_parse(input) {
|
|
2461
1925
|
if (this._def.coerce) {
|
|
2462
|
-
|
|
1926
|
+
try {
|
|
1927
|
+
input.data = BigInt(input.data);
|
|
1928
|
+
}
|
|
1929
|
+
catch (_a) {
|
|
1930
|
+
return this._getInvalidInput(input);
|
|
1931
|
+
}
|
|
2463
1932
|
}
|
|
2464
1933
|
const parsedType = this._getType(input);
|
|
2465
1934
|
if (parsedType !== ZodParsedType.bigint) {
|
|
2466
|
-
|
|
2467
|
-
addIssueToContext(ctx, {
|
|
2468
|
-
code: ZodIssueCode.invalid_type,
|
|
2469
|
-
expected: ZodParsedType.bigint,
|
|
2470
|
-
received: ctx.parsedType,
|
|
2471
|
-
});
|
|
2472
|
-
return INVALID;
|
|
1935
|
+
return this._getInvalidInput(input);
|
|
2473
1936
|
}
|
|
2474
1937
|
let ctx = undefined;
|
|
2475
1938
|
const status = new ParseStatus();
|
|
@@ -2523,6 +1986,15 @@ class ZodBigInt extends ZodType {
|
|
|
2523
1986
|
}
|
|
2524
1987
|
return { status: status.value, value: input.data };
|
|
2525
1988
|
}
|
|
1989
|
+
_getInvalidInput(input) {
|
|
1990
|
+
const ctx = this._getOrReturnCtx(input);
|
|
1991
|
+
addIssueToContext(ctx, {
|
|
1992
|
+
code: ZodIssueCode.invalid_type,
|
|
1993
|
+
expected: ZodParsedType.bigint,
|
|
1994
|
+
received: ctx.parsedType,
|
|
1995
|
+
});
|
|
1996
|
+
return INVALID;
|
|
1997
|
+
}
|
|
2526
1998
|
gte(value, message) {
|
|
2527
1999
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
2528
2000
|
}
|