@logto/connector-google 1.0.0-beta.8 → 1.0.0-beta.9
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/LICENSE +21 -373
- package/lib/index.js +1016 -541
- package/package.json +6 -6
package/lib/index.js
CHANGED
|
@@ -1,6 +1,109 @@
|
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
|
+
/***/ 8697:
|
|
5
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
24
|
+
exports.parseJson = exports.validateConfig = void 0;
|
|
25
|
+
const types_1 = __nccwpck_require__(444);
|
|
26
|
+
__exportStar(__nccwpck_require__(444), exports);
|
|
27
|
+
function validateConfig(config, guard) {
|
|
28
|
+
const result = guard.safeParse(config);
|
|
29
|
+
if (!result.success) {
|
|
30
|
+
throw new types_1.ConnectorError(types_1.ConnectorErrorCodes.InvalidConfig, result.error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.validateConfig = validateConfig;
|
|
34
|
+
const parseJson = (jsonString, errorCode = types_1.ConnectorErrorCodes.InvalidResponse, errorPayload) => {
|
|
35
|
+
try {
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
37
|
+
return JSON.parse(jsonString);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
throw new types_1.ConnectorError(errorCode, errorPayload ?? jsonString);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.parseJson = parseJson;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/***/ }),
|
|
47
|
+
|
|
48
|
+
/***/ 444:
|
|
49
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
50
|
+
|
|
51
|
+
"use strict";
|
|
52
|
+
|
|
53
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
54
|
+
exports.messageTypesGuard = exports.MessageTypes = exports.ConnectorError = exports.ConnectorErrorCodes = exports.ConnectorPlatform = exports.ConnectorType = void 0;
|
|
55
|
+
const zod_1 = __nccwpck_require__(8062);
|
|
56
|
+
// MARK: Foundation
|
|
57
|
+
var ConnectorType;
|
|
58
|
+
(function (ConnectorType) {
|
|
59
|
+
ConnectorType["Email"] = "Email";
|
|
60
|
+
ConnectorType["Sms"] = "Sms";
|
|
61
|
+
ConnectorType["Social"] = "Social";
|
|
62
|
+
})(ConnectorType = exports.ConnectorType || (exports.ConnectorType = {}));
|
|
63
|
+
var ConnectorPlatform;
|
|
64
|
+
(function (ConnectorPlatform) {
|
|
65
|
+
ConnectorPlatform["Native"] = "Native";
|
|
66
|
+
ConnectorPlatform["Universal"] = "Universal";
|
|
67
|
+
ConnectorPlatform["Web"] = "Web";
|
|
68
|
+
})(ConnectorPlatform = exports.ConnectorPlatform || (exports.ConnectorPlatform = {}));
|
|
69
|
+
var ConnectorErrorCodes;
|
|
70
|
+
(function (ConnectorErrorCodes) {
|
|
71
|
+
ConnectorErrorCodes["General"] = "general";
|
|
72
|
+
ConnectorErrorCodes["InvalidMetadata"] = "invalid_metadata";
|
|
73
|
+
ConnectorErrorCodes["UnexpectedType"] = "unexpected_type";
|
|
74
|
+
ConnectorErrorCodes["InvalidConfigGuard"] = "invalid_config_guard";
|
|
75
|
+
ConnectorErrorCodes["InvalidRequestParameters"] = "invalid_request_parameters";
|
|
76
|
+
ConnectorErrorCodes["InsufficientRequestParameters"] = "insufficient_request_parameters";
|
|
77
|
+
ConnectorErrorCodes["InvalidConfig"] = "invalid_config";
|
|
78
|
+
ConnectorErrorCodes["InvalidResponse"] = "invalid_response";
|
|
79
|
+
ConnectorErrorCodes["TemplateNotFound"] = "template_not_found";
|
|
80
|
+
ConnectorErrorCodes["NotImplemented"] = "not_implemented";
|
|
81
|
+
ConnectorErrorCodes["SocialAuthCodeInvalid"] = "social_auth_code_invalid";
|
|
82
|
+
ConnectorErrorCodes["SocialAccessTokenInvalid"] = "social_invalid_access_token";
|
|
83
|
+
ConnectorErrorCodes["SocialIdTokenInvalid"] = "social_invalid_id_token";
|
|
84
|
+
ConnectorErrorCodes["AuthorizationFailed"] = "authorization_failed";
|
|
85
|
+
})(ConnectorErrorCodes = exports.ConnectorErrorCodes || (exports.ConnectorErrorCodes = {}));
|
|
86
|
+
class ConnectorError extends Error {
|
|
87
|
+
constructor(code, data) {
|
|
88
|
+
const message = typeof data === 'string' ? data : 'Connector error occurred.';
|
|
89
|
+
super(message);
|
|
90
|
+
this.code = code;
|
|
91
|
+
this.data = typeof data === 'string' ? { message: data } : data;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.ConnectorError = ConnectorError;
|
|
95
|
+
var MessageTypes;
|
|
96
|
+
(function (MessageTypes) {
|
|
97
|
+
MessageTypes["SignIn"] = "SignIn";
|
|
98
|
+
MessageTypes["Register"] = "Register";
|
|
99
|
+
MessageTypes["ForgotPassword"] = "ForgotPassword";
|
|
100
|
+
MessageTypes["Test"] = "Test";
|
|
101
|
+
})(MessageTypes = exports.MessageTypes || (exports.MessageTypes = {}));
|
|
102
|
+
exports.messageTypesGuard = zod_1.z.nativeEnum(MessageTypes);
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/***/ }),
|
|
106
|
+
|
|
4
107
|
/***/ 8138:
|
|
5
108
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
6
109
|
|
|
@@ -283,7 +386,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
283
386
|
|
|
284
387
|
/***/ }),
|
|
285
388
|
|
|
286
|
-
/***/
|
|
389
|
+
/***/ 5173:
|
|
287
390
|
/***/ ((module, exports) => {
|
|
288
391
|
|
|
289
392
|
"use strict";
|
|
@@ -318,6 +421,7 @@ const objectTypeNames = [
|
|
|
318
421
|
'Observable',
|
|
319
422
|
'Array',
|
|
320
423
|
'Buffer',
|
|
424
|
+
'Blob',
|
|
321
425
|
'Object',
|
|
322
426
|
'RegExp',
|
|
323
427
|
'Date',
|
|
@@ -428,11 +532,12 @@ is.array = (value, assertion) => {
|
|
|
428
532
|
return value.every(assertion);
|
|
429
533
|
};
|
|
430
534
|
is.buffer = (value) => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = value) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.isBuffer) === null || _c === void 0 ? void 0 : _c.call(_b, value)) !== null && _d !== void 0 ? _d : false; };
|
|
535
|
+
is.blob = (value) => isObjectOfType('Blob')(value);
|
|
431
536
|
is.nullOrUndefined = (value) => is.null_(value) || is.undefined(value);
|
|
432
537
|
is.object = (value) => !is.null_(value) && (typeof value === 'object' || is.function_(value));
|
|
433
538
|
is.iterable = (value) => { var _a; return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a[Symbol.iterator]); };
|
|
434
539
|
is.asyncIterable = (value) => { var _a; return is.function_((_a = value) === null || _a === void 0 ? void 0 : _a[Symbol.asyncIterator]); };
|
|
435
|
-
is.generator = (value) => is.iterable(value) && is.function_(value.next) && is.function_(value.throw);
|
|
540
|
+
is.generator = (value) => { var _a, _b; return is.iterable(value) && is.function_((_a = value) === null || _a === void 0 ? void 0 : _a.next) && is.function_((_b = value) === null || _b === void 0 ? void 0 : _b.throw); };
|
|
436
541
|
is.asyncGenerator = (value) => is.asyncIterable(value) && is.function_(value.next) && is.function_(value.throw);
|
|
437
542
|
is.nativePromise = (value) => isObjectOfType('Promise')(value);
|
|
438
543
|
const hasPromiseAPI = (value) => {
|
|
@@ -467,6 +572,7 @@ is.bigUint64Array = isObjectOfType('BigUint64Array');
|
|
|
467
572
|
is.arrayBuffer = isObjectOfType('ArrayBuffer');
|
|
468
573
|
is.sharedArrayBuffer = isObjectOfType('SharedArrayBuffer');
|
|
469
574
|
is.dataView = isObjectOfType('DataView');
|
|
575
|
+
is.enumCase = (value, targetEnum) => Object.values(targetEnum).includes(value);
|
|
470
576
|
is.directInstanceOf = (instance, class_) => Object.getPrototypeOf(instance) === class_.prototype;
|
|
471
577
|
is.urlInstance = (value) => isObjectOfType('URL')(value);
|
|
472
578
|
is.urlString = (value) => {
|
|
@@ -481,7 +587,6 @@ is.urlString = (value) => {
|
|
|
481
587
|
return false;
|
|
482
588
|
}
|
|
483
589
|
};
|
|
484
|
-
// TODO: Use the `not` operator with a type guard here when it's available.
|
|
485
590
|
// Example: `is.truthy = (value: unknown): value is (not false | not 0 | not '' | not undefined | not null) => Boolean(value);`
|
|
486
591
|
is.truthy = (value) => Boolean(value);
|
|
487
592
|
// Example: `is.falsy = (value: unknown): value is (not true | 0 | '' | undefined | null) => Boolean(value);`
|
|
@@ -547,10 +652,12 @@ is.oddInteger = isAbsoluteMod2(1);
|
|
|
547
652
|
is.emptyArray = (value) => is.array(value) && value.length === 0;
|
|
548
653
|
is.nonEmptyArray = (value) => is.array(value) && value.length > 0;
|
|
549
654
|
is.emptyString = (value) => is.string(value) && value.length === 0;
|
|
550
|
-
// TODO: Use `not ''` when the `not` operator is available.
|
|
551
|
-
is.nonEmptyString = (value) => is.string(value) && value.length > 0;
|
|
552
655
|
const isWhiteSpaceString = (value) => is.string(value) && !/\S/.test(value);
|
|
553
656
|
is.emptyStringOrWhitespace = (value) => is.emptyString(value) || isWhiteSpaceString(value);
|
|
657
|
+
// TODO: Use `not ''` when the `not` operator is available.
|
|
658
|
+
is.nonEmptyString = (value) => is.string(value) && value.length > 0;
|
|
659
|
+
// TODO: Use `not ''` when the `not` operator is available.
|
|
660
|
+
is.nonEmptyStringAndNotWhitespace = (value) => is.string(value) && !is.emptyStringOrWhitespace(value);
|
|
554
661
|
is.emptyObject = (value) => is.object(value) && !is.map(value) && !is.set(value) && Object.keys(value).length === 0;
|
|
555
662
|
// TODO: Use `not` operator here to remove `Map` and `Set` from type guard:
|
|
556
663
|
// - https://github.com/Microsoft/TypeScript/pull/29317
|
|
@@ -609,6 +716,7 @@ exports.assert = {
|
|
|
609
716
|
}
|
|
610
717
|
},
|
|
611
718
|
buffer: (value) => assertType(is.buffer(value), 'Buffer', value),
|
|
719
|
+
blob: (value) => assertType(is.blob(value), 'Blob', value),
|
|
612
720
|
nullOrUndefined: (value) => assertType(is.nullOrUndefined(value), "null or undefined" /* nullOrUndefined */, value),
|
|
613
721
|
object: (value) => assertType(is.object(value), 'Object', value),
|
|
614
722
|
iterable: (value) => assertType(is.iterable(value), "Iterable" /* iterable */, value),
|
|
@@ -644,6 +752,7 @@ exports.assert = {
|
|
|
644
752
|
arrayBuffer: (value) => assertType(is.arrayBuffer(value), 'ArrayBuffer', value),
|
|
645
753
|
sharedArrayBuffer: (value) => assertType(is.sharedArrayBuffer(value), 'SharedArrayBuffer', value),
|
|
646
754
|
dataView: (value) => assertType(is.dataView(value), 'DataView', value),
|
|
755
|
+
enumCase: (value, targetEnum) => assertType(is.enumCase(value, targetEnum), 'EnumCase', value),
|
|
647
756
|
urlInstance: (value) => assertType(is.urlInstance(value), 'URL', value),
|
|
648
757
|
urlString: (value) => assertType(is.urlString(value), "string with a URL" /* urlString */, value),
|
|
649
758
|
truthy: (value) => assertType(is.truthy(value), "truthy" /* truthy */, value),
|
|
@@ -662,8 +771,9 @@ exports.assert = {
|
|
|
662
771
|
emptyArray: (value) => assertType(is.emptyArray(value), "empty array" /* emptyArray */, value),
|
|
663
772
|
nonEmptyArray: (value) => assertType(is.nonEmptyArray(value), "non-empty array" /* nonEmptyArray */, value),
|
|
664
773
|
emptyString: (value) => assertType(is.emptyString(value), "empty string" /* emptyString */, value),
|
|
665
|
-
nonEmptyString: (value) => assertType(is.nonEmptyString(value), "non-empty string" /* nonEmptyString */, value),
|
|
666
774
|
emptyStringOrWhitespace: (value) => assertType(is.emptyStringOrWhitespace(value), "empty string or whitespace" /* emptyStringOrWhitespace */, value),
|
|
775
|
+
nonEmptyString: (value) => assertType(is.nonEmptyString(value), "non-empty string" /* nonEmptyString */, value),
|
|
776
|
+
nonEmptyStringAndNotWhitespace: (value) => assertType(is.nonEmptyStringAndNotWhitespace(value), "non-empty string and not whitespace" /* nonEmptyStringAndNotWhitespace */, value),
|
|
667
777
|
emptyObject: (value) => assertType(is.emptyObject(value), "empty object" /* emptyObject */, value),
|
|
668
778
|
nonEmptyObject: (value) => assertType(is.nonEmptyObject(value), "non-empty object" /* nonEmptyObject */, value),
|
|
669
779
|
emptySet: (value) => assertType(is.emptySet(value), "empty set" /* emptySet */, value),
|
|
@@ -1307,10 +1417,10 @@ const urlLib = __nccwpck_require__(7310);
|
|
|
1307
1417
|
const normalizeUrl = __nccwpck_require__(5299);
|
|
1308
1418
|
const getStream = __nccwpck_require__(5288);
|
|
1309
1419
|
const CachePolicy = __nccwpck_require__(1454);
|
|
1310
|
-
const Response = __nccwpck_require__(
|
|
1420
|
+
const Response = __nccwpck_require__(1534);
|
|
1311
1421
|
const lowercaseKeys = __nccwpck_require__(4162);
|
|
1312
|
-
const cloneResponse = __nccwpck_require__(
|
|
1313
|
-
const Keyv = __nccwpck_require__(
|
|
1422
|
+
const cloneResponse = __nccwpck_require__(895);
|
|
1423
|
+
const Keyv = __nccwpck_require__(787);
|
|
1314
1424
|
|
|
1315
1425
|
class CacheableRequest {
|
|
1316
1426
|
constructor(request, cacheAdapter) {
|
|
@@ -1555,7 +1665,7 @@ module.exports = CacheableRequest;
|
|
|
1555
1665
|
|
|
1556
1666
|
/***/ }),
|
|
1557
1667
|
|
|
1558
|
-
/***/
|
|
1668
|
+
/***/ 895:
|
|
1559
1669
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1560
1670
|
|
|
1561
1671
|
"use strict";
|
|
@@ -1578,6 +1688,85 @@ const cloneResponse = response => {
|
|
|
1578
1688
|
module.exports = cloneResponse;
|
|
1579
1689
|
|
|
1580
1690
|
|
|
1691
|
+
/***/ }),
|
|
1692
|
+
|
|
1693
|
+
/***/ 2809:
|
|
1694
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1695
|
+
|
|
1696
|
+
"use strict";
|
|
1697
|
+
|
|
1698
|
+
|
|
1699
|
+
const { promisify } = __nccwpck_require__(3837)
|
|
1700
|
+
const JSONB = __nccwpck_require__(9604)
|
|
1701
|
+
const zlib = __nccwpck_require__(9796)
|
|
1702
|
+
|
|
1703
|
+
const mergeOptions = __nccwpck_require__(113)
|
|
1704
|
+
|
|
1705
|
+
const compress = promisify(zlib.brotliCompress)
|
|
1706
|
+
|
|
1707
|
+
const decompress = promisify(zlib.brotliDecompress)
|
|
1708
|
+
|
|
1709
|
+
const identity = val => val
|
|
1710
|
+
|
|
1711
|
+
const createCompress = ({
|
|
1712
|
+
enable = true,
|
|
1713
|
+
serialize = JSONB.stringify,
|
|
1714
|
+
deserialize = JSONB.parse,
|
|
1715
|
+
compressOptions,
|
|
1716
|
+
decompressOptions
|
|
1717
|
+
} = {}) => {
|
|
1718
|
+
if (!enable) {
|
|
1719
|
+
return { serialize, deserialize, decompress: identity, compress: identity }
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
return {
|
|
1723
|
+
serialize,
|
|
1724
|
+
deserialize,
|
|
1725
|
+
compress: async (data, options = {}) => {
|
|
1726
|
+
if (data === undefined) return data
|
|
1727
|
+
const serializedData = serialize(data)
|
|
1728
|
+
return compress(serializedData, mergeOptions(compressOptions, options))
|
|
1729
|
+
},
|
|
1730
|
+
decompress: async (data, options = {}) => {
|
|
1731
|
+
if (data === undefined) return data
|
|
1732
|
+
return deserialize(
|
|
1733
|
+
await decompress(data, mergeOptions(decompressOptions, options))
|
|
1734
|
+
)
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
module.exports = createCompress
|
|
1740
|
+
module.exports.stringify = JSONB.stringify
|
|
1741
|
+
module.exports.parse = JSONB.parse
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
/***/ }),
|
|
1745
|
+
|
|
1746
|
+
/***/ 113:
|
|
1747
|
+
/***/ ((module) => {
|
|
1748
|
+
|
|
1749
|
+
"use strict";
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
module.exports = (defaultOptions = {}, options = {}) => {
|
|
1753
|
+
const params = {
|
|
1754
|
+
...(defaultOptions.params || {}),
|
|
1755
|
+
...(options.params || {})
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
return {
|
|
1759
|
+
...defaultOptions,
|
|
1760
|
+
...options,
|
|
1761
|
+
...(Object.keys(params).length
|
|
1762
|
+
? {
|
|
1763
|
+
params
|
|
1764
|
+
}
|
|
1765
|
+
: {})
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
|
|
1581
1770
|
/***/ }),
|
|
1582
1771
|
|
|
1583
1772
|
/***/ 2269:
|
|
@@ -1930,13 +2119,13 @@ module.exports.MaxBufferError = MaxBufferError;
|
|
|
1930
2119
|
|
|
1931
2120
|
/***/ }),
|
|
1932
2121
|
|
|
1933
|
-
/***/
|
|
2122
|
+
/***/ 1729:
|
|
1934
2123
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1935
2124
|
|
|
1936
2125
|
"use strict";
|
|
1937
2126
|
|
|
1938
2127
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1939
|
-
const types_1 = __nccwpck_require__(
|
|
2128
|
+
const types_1 = __nccwpck_require__(2580);
|
|
1940
2129
|
function createRejection(error, ...beforeErrorGroups) {
|
|
1941
2130
|
const promise = (async () => {
|
|
1942
2131
|
if (error instanceof types_1.RequestError) {
|
|
@@ -1968,7 +2157,7 @@ exports["default"] = createRejection;
|
|
|
1968
2157
|
|
|
1969
2158
|
/***/ }),
|
|
1970
2159
|
|
|
1971
|
-
/***/
|
|
2160
|
+
/***/ 2234:
|
|
1972
2161
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
1973
2162
|
|
|
1974
2163
|
"use strict";
|
|
@@ -1985,14 +2174,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
1985
2174
|
};
|
|
1986
2175
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1987
2176
|
const events_1 = __nccwpck_require__(2361);
|
|
1988
|
-
const is_1 = __nccwpck_require__(
|
|
2177
|
+
const is_1 = __nccwpck_require__(5173);
|
|
1989
2178
|
const PCancelable = __nccwpck_require__(6419);
|
|
1990
|
-
const types_1 = __nccwpck_require__(
|
|
1991
|
-
const parse_body_1 = __nccwpck_require__(
|
|
1992
|
-
const core_1 = __nccwpck_require__(
|
|
1993
|
-
const proxy_events_1 = __nccwpck_require__(
|
|
1994
|
-
const get_buffer_1 = __nccwpck_require__(
|
|
1995
|
-
const is_response_ok_1 = __nccwpck_require__(
|
|
2179
|
+
const types_1 = __nccwpck_require__(2580);
|
|
2180
|
+
const parse_body_1 = __nccwpck_require__(416);
|
|
2181
|
+
const core_1 = __nccwpck_require__(1032);
|
|
2182
|
+
const proxy_events_1 = __nccwpck_require__(5262);
|
|
2183
|
+
const get_buffer_1 = __nccwpck_require__(7342);
|
|
2184
|
+
const is_response_ok_1 = __nccwpck_require__(6948);
|
|
1996
2185
|
const proxiedRequestEvents = [
|
|
1997
2186
|
'request',
|
|
1998
2187
|
'response',
|
|
@@ -2087,11 +2276,11 @@ function asPromise(normalizedOptions) {
|
|
|
2087
2276
|
request._beforeError(new types_1.RequestError(error.message, error, request));
|
|
2088
2277
|
return;
|
|
2089
2278
|
}
|
|
2279
|
+
globalResponse = response;
|
|
2090
2280
|
if (!is_response_ok_1.isResponseOk(response)) {
|
|
2091
2281
|
request._beforeError(new types_1.HTTPError(response));
|
|
2092
2282
|
return;
|
|
2093
2283
|
}
|
|
2094
|
-
globalResponse = response;
|
|
2095
2284
|
resolve(request.options.resolveBodyOnly ? response.body : response);
|
|
2096
2285
|
});
|
|
2097
2286
|
const onError = (error) => {
|
|
@@ -2146,18 +2335,18 @@ function asPromise(normalizedOptions) {
|
|
|
2146
2335
|
return promise;
|
|
2147
2336
|
}
|
|
2148
2337
|
exports["default"] = asPromise;
|
|
2149
|
-
__exportStar(__nccwpck_require__(
|
|
2338
|
+
__exportStar(__nccwpck_require__(2580), exports);
|
|
2150
2339
|
|
|
2151
2340
|
|
|
2152
2341
|
/***/ }),
|
|
2153
2342
|
|
|
2154
|
-
/***/
|
|
2343
|
+
/***/ 530:
|
|
2155
2344
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
2156
2345
|
|
|
2157
2346
|
"use strict";
|
|
2158
2347
|
|
|
2159
2348
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2160
|
-
const is_1 = __nccwpck_require__(
|
|
2349
|
+
const is_1 = __nccwpck_require__(5173);
|
|
2161
2350
|
const normalizeArguments = (options, defaults) => {
|
|
2162
2351
|
if (is_1.default.null_(options.encoding)) {
|
|
2163
2352
|
throw new TypeError('To get a Buffer, set `options.responseType` to `buffer` instead');
|
|
@@ -2237,13 +2426,13 @@ exports["default"] = normalizeArguments;
|
|
|
2237
2426
|
|
|
2238
2427
|
/***/ }),
|
|
2239
2428
|
|
|
2240
|
-
/***/
|
|
2429
|
+
/***/ 416:
|
|
2241
2430
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
2242
2431
|
|
|
2243
2432
|
"use strict";
|
|
2244
2433
|
|
|
2245
2434
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2246
|
-
const types_1 = __nccwpck_require__(
|
|
2435
|
+
const types_1 = __nccwpck_require__(2580);
|
|
2247
2436
|
const parseBody = (response, responseType, parseJson, encoding) => {
|
|
2248
2437
|
const { rawBody } = response;
|
|
2249
2438
|
try {
|
|
@@ -2270,7 +2459,7 @@ exports["default"] = parseBody;
|
|
|
2270
2459
|
|
|
2271
2460
|
/***/ }),
|
|
2272
2461
|
|
|
2273
|
-
/***/
|
|
2462
|
+
/***/ 2580:
|
|
2274
2463
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
2275
2464
|
|
|
2276
2465
|
"use strict";
|
|
@@ -2287,7 +2476,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
2287
2476
|
};
|
|
2288
2477
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2289
2478
|
exports.CancelError = exports.ParseError = void 0;
|
|
2290
|
-
const core_1 = __nccwpck_require__(
|
|
2479
|
+
const core_1 = __nccwpck_require__(1032);
|
|
2291
2480
|
/**
|
|
2292
2481
|
An error to be thrown when server response code is 2xx, and parsing body fails.
|
|
2293
2482
|
Includes a `response` property.
|
|
@@ -2315,12 +2504,12 @@ class CancelError extends core_1.RequestError {
|
|
|
2315
2504
|
}
|
|
2316
2505
|
}
|
|
2317
2506
|
exports.CancelError = CancelError;
|
|
2318
|
-
__exportStar(__nccwpck_require__(
|
|
2507
|
+
__exportStar(__nccwpck_require__(1032), exports);
|
|
2319
2508
|
|
|
2320
2509
|
|
|
2321
2510
|
/***/ }),
|
|
2322
2511
|
|
|
2323
|
-
/***/
|
|
2512
|
+
/***/ 1879:
|
|
2324
2513
|
/***/ ((__unused_webpack_module, exports) => {
|
|
2325
2514
|
|
|
2326
2515
|
"use strict";
|
|
@@ -2357,7 +2546,7 @@ exports["default"] = calculateRetryDelay;
|
|
|
2357
2546
|
|
|
2358
2547
|
/***/ }),
|
|
2359
2548
|
|
|
2360
|
-
/***/
|
|
2549
|
+
/***/ 1032:
|
|
2361
2550
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
2362
2551
|
|
|
2363
2552
|
"use strict";
|
|
@@ -2378,20 +2567,20 @@ const decompressResponse = __nccwpck_require__(2269);
|
|
|
2378
2567
|
// @ts-expect-error Missing types
|
|
2379
2568
|
const http2wrapper = __nccwpck_require__(7952);
|
|
2380
2569
|
const lowercaseKeys = __nccwpck_require__(4162);
|
|
2381
|
-
const is_1 = __nccwpck_require__(
|
|
2382
|
-
const get_body_size_1 = __nccwpck_require__(
|
|
2383
|
-
const is_form_data_1 = __nccwpck_require__(
|
|
2384
|
-
const proxy_events_1 = __nccwpck_require__(
|
|
2385
|
-
const timed_out_1 = __nccwpck_require__(
|
|
2386
|
-
const url_to_options_1 = __nccwpck_require__(
|
|
2387
|
-
const options_to_url_1 = __nccwpck_require__(
|
|
2388
|
-
const weakable_map_1 = __nccwpck_require__(
|
|
2389
|
-
const get_buffer_1 = __nccwpck_require__(
|
|
2390
|
-
const dns_ip_version_1 = __nccwpck_require__(
|
|
2391
|
-
const is_response_ok_1 = __nccwpck_require__(
|
|
2392
|
-
const deprecation_warning_1 = __nccwpck_require__(
|
|
2393
|
-
const normalize_arguments_1 = __nccwpck_require__(
|
|
2394
|
-
const calculate_retry_delay_1 = __nccwpck_require__(
|
|
2570
|
+
const is_1 = __nccwpck_require__(5173);
|
|
2571
|
+
const get_body_size_1 = __nccwpck_require__(4543);
|
|
2572
|
+
const is_form_data_1 = __nccwpck_require__(8652);
|
|
2573
|
+
const proxy_events_1 = __nccwpck_require__(5262);
|
|
2574
|
+
const timed_out_1 = __nccwpck_require__(7738);
|
|
2575
|
+
const url_to_options_1 = __nccwpck_require__(4892);
|
|
2576
|
+
const options_to_url_1 = __nccwpck_require__(1186);
|
|
2577
|
+
const weakable_map_1 = __nccwpck_require__(2009);
|
|
2578
|
+
const get_buffer_1 = __nccwpck_require__(7342);
|
|
2579
|
+
const dns_ip_version_1 = __nccwpck_require__(3371);
|
|
2580
|
+
const is_response_ok_1 = __nccwpck_require__(6948);
|
|
2581
|
+
const deprecation_warning_1 = __nccwpck_require__(3351);
|
|
2582
|
+
const normalize_arguments_1 = __nccwpck_require__(530);
|
|
2583
|
+
const calculate_retry_delay_1 = __nccwpck_require__(1879);
|
|
2395
2584
|
let globalDnsCache;
|
|
2396
2585
|
const kRequest = Symbol('request');
|
|
2397
2586
|
const kResponse = Symbol('response');
|
|
@@ -3229,6 +3418,14 @@ class Request extends stream_1.Duplex {
|
|
|
3229
3418
|
const redirectUrl = new url_1.URL(redirectBuffer, url);
|
|
3230
3419
|
const redirectString = redirectUrl.toString();
|
|
3231
3420
|
decodeURI(redirectString);
|
|
3421
|
+
// eslint-disable-next-line no-inner-declarations
|
|
3422
|
+
function isUnixSocketURL(url) {
|
|
3423
|
+
return url.protocol === 'unix:' || url.hostname === 'unix';
|
|
3424
|
+
}
|
|
3425
|
+
if (!isUnixSocketURL(url) && isUnixSocketURL(redirectUrl)) {
|
|
3426
|
+
this._beforeError(new RequestError('Cannot redirect to UNIX socket', {}, this));
|
|
3427
|
+
return;
|
|
3428
|
+
}
|
|
3232
3429
|
// Redirecting to a different site, clear sensitive data.
|
|
3233
3430
|
if (redirectUrl.hostname !== url.hostname || redirectUrl.port !== url.port) {
|
|
3234
3431
|
if ('host' in options.headers) {
|
|
@@ -3862,7 +4059,7 @@ exports["default"] = Request;
|
|
|
3862
4059
|
|
|
3863
4060
|
/***/ }),
|
|
3864
4061
|
|
|
3865
|
-
/***/
|
|
4062
|
+
/***/ 3371:
|
|
3866
4063
|
/***/ ((__unused_webpack_module, exports) => {
|
|
3867
4064
|
|
|
3868
4065
|
"use strict";
|
|
@@ -3887,7 +4084,7 @@ exports.dnsLookupIpVersionToFamily = (dnsLookupIpVersion) => {
|
|
|
3887
4084
|
|
|
3888
4085
|
/***/ }),
|
|
3889
4086
|
|
|
3890
|
-
/***/
|
|
4087
|
+
/***/ 4543:
|
|
3891
4088
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3892
4089
|
|
|
3893
4090
|
"use strict";
|
|
@@ -3895,8 +4092,8 @@ exports.dnsLookupIpVersionToFamily = (dnsLookupIpVersion) => {
|
|
|
3895
4092
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3896
4093
|
const fs_1 = __nccwpck_require__(7147);
|
|
3897
4094
|
const util_1 = __nccwpck_require__(3837);
|
|
3898
|
-
const is_1 = __nccwpck_require__(
|
|
3899
|
-
const is_form_data_1 = __nccwpck_require__(
|
|
4095
|
+
const is_1 = __nccwpck_require__(5173);
|
|
4096
|
+
const is_form_data_1 = __nccwpck_require__(8652);
|
|
3900
4097
|
const statAsync = util_1.promisify(fs_1.stat);
|
|
3901
4098
|
exports["default"] = async (body, headers) => {
|
|
3902
4099
|
if (headers && 'content-length' in headers) {
|
|
@@ -3927,7 +4124,7 @@ exports["default"] = async (body, headers) => {
|
|
|
3927
4124
|
|
|
3928
4125
|
/***/ }),
|
|
3929
4126
|
|
|
3930
|
-
/***/
|
|
4127
|
+
/***/ 7342:
|
|
3931
4128
|
/***/ ((__unused_webpack_module, exports) => {
|
|
3932
4129
|
|
|
3933
4130
|
"use strict";
|
|
@@ -3951,19 +4148,19 @@ exports["default"] = getBuffer;
|
|
|
3951
4148
|
|
|
3952
4149
|
/***/ }),
|
|
3953
4150
|
|
|
3954
|
-
/***/
|
|
4151
|
+
/***/ 8652:
|
|
3955
4152
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3956
4153
|
|
|
3957
4154
|
"use strict";
|
|
3958
4155
|
|
|
3959
4156
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3960
|
-
const is_1 = __nccwpck_require__(
|
|
4157
|
+
const is_1 = __nccwpck_require__(5173);
|
|
3961
4158
|
exports["default"] = (body) => is_1.default.nodeStream(body) && is_1.default.function_(body.getBoundary);
|
|
3962
4159
|
|
|
3963
4160
|
|
|
3964
4161
|
/***/ }),
|
|
3965
4162
|
|
|
3966
|
-
/***/
|
|
4163
|
+
/***/ 6948:
|
|
3967
4164
|
/***/ ((__unused_webpack_module, exports) => {
|
|
3968
4165
|
|
|
3969
4166
|
"use strict";
|
|
@@ -3979,7 +4176,7 @@ exports.isResponseOk = (response) => {
|
|
|
3979
4176
|
|
|
3980
4177
|
/***/ }),
|
|
3981
4178
|
|
|
3982
|
-
/***/
|
|
4179
|
+
/***/ 1186:
|
|
3983
4180
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
3984
4181
|
|
|
3985
4182
|
"use strict";
|
|
@@ -4040,7 +4237,7 @@ exports["default"] = (origin, options) => {
|
|
|
4040
4237
|
|
|
4041
4238
|
/***/ }),
|
|
4042
4239
|
|
|
4043
|
-
/***/
|
|
4240
|
+
/***/ 5262:
|
|
4044
4241
|
/***/ ((__unused_webpack_module, exports) => {
|
|
4045
4242
|
|
|
4046
4243
|
"use strict";
|
|
@@ -4065,7 +4262,7 @@ exports["default"] = default_1;
|
|
|
4065
4262
|
|
|
4066
4263
|
/***/ }),
|
|
4067
4264
|
|
|
4068
|
-
/***/
|
|
4265
|
+
/***/ 7738:
|
|
4069
4266
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
4070
4267
|
|
|
4071
4268
|
"use strict";
|
|
@@ -4073,7 +4270,7 @@ exports["default"] = default_1;
|
|
|
4073
4270
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4074
4271
|
exports.TimeoutError = void 0;
|
|
4075
4272
|
const net = __nccwpck_require__(1808);
|
|
4076
|
-
const unhandle_1 = __nccwpck_require__(
|
|
4273
|
+
const unhandle_1 = __nccwpck_require__(3762);
|
|
4077
4274
|
const reentry = Symbol('reentry');
|
|
4078
4275
|
const noop = () => { };
|
|
4079
4276
|
class TimeoutError extends Error {
|
|
@@ -4194,7 +4391,7 @@ exports["default"] = (request, delays, options) => {
|
|
|
4194
4391
|
|
|
4195
4392
|
/***/ }),
|
|
4196
4393
|
|
|
4197
|
-
/***/
|
|
4394
|
+
/***/ 3762:
|
|
4198
4395
|
/***/ ((__unused_webpack_module, exports) => {
|
|
4199
4396
|
|
|
4200
4397
|
"use strict";
|
|
@@ -4224,13 +4421,13 @@ exports["default"] = () => {
|
|
|
4224
4421
|
|
|
4225
4422
|
/***/ }),
|
|
4226
4423
|
|
|
4227
|
-
/***/
|
|
4424
|
+
/***/ 4892:
|
|
4228
4425
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
4229
4426
|
|
|
4230
4427
|
"use strict";
|
|
4231
4428
|
|
|
4232
4429
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4233
|
-
const is_1 = __nccwpck_require__(
|
|
4430
|
+
const is_1 = __nccwpck_require__(5173);
|
|
4234
4431
|
exports["default"] = (url) => {
|
|
4235
4432
|
// Cast to URL
|
|
4236
4433
|
url = url;
|
|
@@ -4256,7 +4453,7 @@ exports["default"] = (url) => {
|
|
|
4256
4453
|
|
|
4257
4454
|
/***/ }),
|
|
4258
4455
|
|
|
4259
|
-
/***/
|
|
4456
|
+
/***/ 2009:
|
|
4260
4457
|
/***/ ((__unused_webpack_module, exports) => {
|
|
4261
4458
|
|
|
4262
4459
|
"use strict";
|
|
@@ -4293,7 +4490,7 @@ exports["default"] = WeakableMap;
|
|
|
4293
4490
|
|
|
4294
4491
|
/***/ }),
|
|
4295
4492
|
|
|
4296
|
-
/***/
|
|
4493
|
+
/***/ 5133:
|
|
4297
4494
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
4298
4495
|
|
|
4299
4496
|
"use strict";
|
|
@@ -4310,11 +4507,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
4310
4507
|
};
|
|
4311
4508
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4312
4509
|
exports.defaultHandler = void 0;
|
|
4313
|
-
const is_1 = __nccwpck_require__(
|
|
4314
|
-
const as_promise_1 = __nccwpck_require__(
|
|
4315
|
-
const create_rejection_1 = __nccwpck_require__(
|
|
4316
|
-
const core_1 = __nccwpck_require__(
|
|
4317
|
-
const deep_freeze_1 = __nccwpck_require__(
|
|
4510
|
+
const is_1 = __nccwpck_require__(5173);
|
|
4511
|
+
const as_promise_1 = __nccwpck_require__(2234);
|
|
4512
|
+
const create_rejection_1 = __nccwpck_require__(1729);
|
|
4513
|
+
const core_1 = __nccwpck_require__(1032);
|
|
4514
|
+
const deep_freeze_1 = __nccwpck_require__(8295);
|
|
4318
4515
|
const errors = {
|
|
4319
4516
|
RequestError: as_promise_1.RequestError,
|
|
4320
4517
|
CacheError: as_promise_1.CacheError,
|
|
@@ -4536,12 +4733,12 @@ const create = (defaults) => {
|
|
|
4536
4733
|
return got;
|
|
4537
4734
|
};
|
|
4538
4735
|
exports["default"] = create;
|
|
4539
|
-
__exportStar(__nccwpck_require__(
|
|
4736
|
+
__exportStar(__nccwpck_require__(5499), exports);
|
|
4540
4737
|
|
|
4541
4738
|
|
|
4542
4739
|
/***/ }),
|
|
4543
4740
|
|
|
4544
|
-
/***/
|
|
4741
|
+
/***/ 5569:
|
|
4545
4742
|
/***/ (function(module, exports, __nccwpck_require__) {
|
|
4546
4743
|
|
|
4547
4744
|
"use strict";
|
|
@@ -4558,7 +4755,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
4558
4755
|
};
|
|
4559
4756
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4560
4757
|
const url_1 = __nccwpck_require__(7310);
|
|
4561
|
-
const create_1 = __nccwpck_require__(
|
|
4758
|
+
const create_1 = __nccwpck_require__(5133);
|
|
4562
4759
|
const defaults = {
|
|
4563
4760
|
options: {
|
|
4564
4761
|
method: 'GET',
|
|
@@ -4675,13 +4872,13 @@ exports["default"] = got;
|
|
|
4675
4872
|
module.exports = got;
|
|
4676
4873
|
module.exports["default"] = got;
|
|
4677
4874
|
module.exports.__esModule = true; // Workaround for TS issue: https://github.com/sindresorhus/got/pull/1267
|
|
4678
|
-
__exportStar(__nccwpck_require__(
|
|
4679
|
-
__exportStar(__nccwpck_require__(
|
|
4875
|
+
__exportStar(__nccwpck_require__(5133), exports);
|
|
4876
|
+
__exportStar(__nccwpck_require__(2234), exports);
|
|
4680
4877
|
|
|
4681
4878
|
|
|
4682
4879
|
/***/ }),
|
|
4683
4880
|
|
|
4684
|
-
/***/
|
|
4881
|
+
/***/ 5499:
|
|
4685
4882
|
/***/ ((__unused_webpack_module, exports) => {
|
|
4686
4883
|
|
|
4687
4884
|
"use strict";
|
|
@@ -4691,13 +4888,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
4691
4888
|
|
|
4692
4889
|
/***/ }),
|
|
4693
4890
|
|
|
4694
|
-
/***/
|
|
4891
|
+
/***/ 8295:
|
|
4695
4892
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
4696
4893
|
|
|
4697
4894
|
"use strict";
|
|
4698
4895
|
|
|
4699
4896
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4700
|
-
const is_1 = __nccwpck_require__(
|
|
4897
|
+
const is_1 = __nccwpck_require__(5173);
|
|
4701
4898
|
function deepFreeze(object) {
|
|
4702
4899
|
for (const value of Object.values(object)) {
|
|
4703
4900
|
if (is_1.default.plainObject(value) || is_1.default.array(value)) {
|
|
@@ -4711,7 +4908,7 @@ exports["default"] = deepFreeze;
|
|
|
4711
4908
|
|
|
4712
4909
|
/***/ }),
|
|
4713
4910
|
|
|
4714
|
-
/***/
|
|
4911
|
+
/***/ 3351:
|
|
4715
4912
|
/***/ ((__unused_webpack_module, exports) => {
|
|
4716
4913
|
|
|
4717
4914
|
"use strict";
|
|
@@ -7025,7 +7222,7 @@ exports.parse = function (s) {
|
|
|
7025
7222
|
|
|
7026
7223
|
/***/ }),
|
|
7027
7224
|
|
|
7028
|
-
/***/
|
|
7225
|
+
/***/ 787:
|
|
7029
7226
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
7030
7227
|
|
|
7031
7228
|
"use strict";
|
|
@@ -7033,68 +7230,186 @@ exports.parse = function (s) {
|
|
|
7033
7230
|
|
|
7034
7231
|
const EventEmitter = __nccwpck_require__(2361);
|
|
7035
7232
|
const JSONB = __nccwpck_require__(9604);
|
|
7233
|
+
const compressBrotli = __nccwpck_require__(2809);
|
|
7036
7234
|
|
|
7037
7235
|
const loadStore = options => {
|
|
7038
7236
|
const adapters = {
|
|
7039
7237
|
redis: '@keyv/redis',
|
|
7238
|
+
rediss: '@keyv/redis',
|
|
7040
7239
|
mongodb: '@keyv/mongo',
|
|
7041
7240
|
mongo: '@keyv/mongo',
|
|
7042
7241
|
sqlite: '@keyv/sqlite',
|
|
7043
7242
|
postgresql: '@keyv/postgres',
|
|
7044
7243
|
postgres: '@keyv/postgres',
|
|
7045
7244
|
mysql: '@keyv/mysql',
|
|
7245
|
+
etcd: '@keyv/etcd',
|
|
7246
|
+
offline: '@keyv/offline',
|
|
7247
|
+
tiered: '@keyv/tiered',
|
|
7046
7248
|
};
|
|
7047
7249
|
if (options.adapter || options.uri) {
|
|
7048
|
-
const adapter = options.adapter || /^[
|
|
7250
|
+
const adapter = options.adapter || /^[^:+]*/.exec(options.uri)[0];
|
|
7049
7251
|
return new (require(adapters[adapter]))(options);
|
|
7050
7252
|
}
|
|
7051
7253
|
|
|
7052
7254
|
return new Map();
|
|
7053
7255
|
};
|
|
7054
7256
|
|
|
7257
|
+
const iterableAdapters = [
|
|
7258
|
+
'sqlite',
|
|
7259
|
+
'postgres',
|
|
7260
|
+
'mysql',
|
|
7261
|
+
'mongo',
|
|
7262
|
+
'redis',
|
|
7263
|
+
'tiered',
|
|
7264
|
+
];
|
|
7265
|
+
|
|
7055
7266
|
class Keyv extends EventEmitter {
|
|
7056
|
-
constructor(uri, options) {
|
|
7267
|
+
constructor(uri, {emitErrors = true, ...options} = {}) {
|
|
7057
7268
|
super();
|
|
7058
|
-
this.opts =
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
options,
|
|
7066
|
-
);
|
|
7269
|
+
this.opts = {
|
|
7270
|
+
namespace: 'keyv',
|
|
7271
|
+
serialize: JSONB.stringify,
|
|
7272
|
+
deserialize: JSONB.parse,
|
|
7273
|
+
...((typeof uri === 'string') ? {uri} : uri),
|
|
7274
|
+
...options,
|
|
7275
|
+
};
|
|
7067
7276
|
|
|
7068
7277
|
if (!this.opts.store) {
|
|
7069
|
-
const adapterOptions =
|
|
7278
|
+
const adapterOptions = {...this.opts};
|
|
7070
7279
|
this.opts.store = loadStore(adapterOptions);
|
|
7071
7280
|
}
|
|
7072
7281
|
|
|
7073
|
-
if (
|
|
7282
|
+
if (this.opts.compress) {
|
|
7283
|
+
const brotli = compressBrotli(this.opts.compress.opts);
|
|
7284
|
+
this.opts.serialize = async ({value, expires}) => brotli.serialize({value: await brotli.compress(value), expires});
|
|
7285
|
+
this.opts.deserialize = async data => {
|
|
7286
|
+
const {value, expires} = brotli.deserialize(data);
|
|
7287
|
+
return {value: await brotli.decompress(value), expires};
|
|
7288
|
+
};
|
|
7289
|
+
}
|
|
7290
|
+
|
|
7291
|
+
if (typeof this.opts.store.on === 'function' && emitErrors) {
|
|
7074
7292
|
this.opts.store.on('error', error => this.emit('error', error));
|
|
7075
7293
|
}
|
|
7076
7294
|
|
|
7077
7295
|
this.opts.store.namespace = this.opts.namespace;
|
|
7296
|
+
|
|
7297
|
+
const generateIterator = iterator => async function * () {
|
|
7298
|
+
for await (const [key, raw] of typeof iterator === 'function'
|
|
7299
|
+
? iterator(this.opts.store.namespace)
|
|
7300
|
+
: iterator) {
|
|
7301
|
+
const data = this.opts.deserialize(raw);
|
|
7302
|
+
if (this.opts.store.namespace && !key.includes(this.opts.store.namespace)) {
|
|
7303
|
+
continue;
|
|
7304
|
+
}
|
|
7305
|
+
|
|
7306
|
+
if (typeof data.expires === 'number' && Date.now() > data.expires) {
|
|
7307
|
+
this.delete(key);
|
|
7308
|
+
continue;
|
|
7309
|
+
}
|
|
7310
|
+
|
|
7311
|
+
yield [this._getKeyUnprefix(key), data.value];
|
|
7312
|
+
}
|
|
7313
|
+
};
|
|
7314
|
+
|
|
7315
|
+
// Attach iterators
|
|
7316
|
+
if (typeof this.opts.store[Symbol.iterator] === 'function' && this.opts.store instanceof Map) {
|
|
7317
|
+
this.iterator = generateIterator(this.opts.store);
|
|
7318
|
+
} else if (typeof this.opts.store.iterator === 'function' && this.opts.store.opts
|
|
7319
|
+
&& this._checkIterableAdaptar()) {
|
|
7320
|
+
this.iterator = generateIterator(this.opts.store.iterator.bind(this.opts.store));
|
|
7321
|
+
}
|
|
7322
|
+
}
|
|
7323
|
+
|
|
7324
|
+
_checkIterableAdaptar() {
|
|
7325
|
+
return iterableAdapters.includes(this.opts.store.opts.dialect)
|
|
7326
|
+
|| iterableAdapters.findIndex(element => this.opts.store.opts.url.includes(element)) >= 0;
|
|
7078
7327
|
}
|
|
7079
7328
|
|
|
7080
7329
|
_getKeyPrefix(key) {
|
|
7081
7330
|
return `${this.opts.namespace}:${key}`;
|
|
7082
7331
|
}
|
|
7083
7332
|
|
|
7333
|
+
_getKeyPrefixArray(keys) {
|
|
7334
|
+
return keys.map(key => `${this.opts.namespace}:${key}`);
|
|
7335
|
+
}
|
|
7336
|
+
|
|
7337
|
+
_getKeyUnprefix(key) {
|
|
7338
|
+
return key
|
|
7339
|
+
.split(':')
|
|
7340
|
+
.splice(1)
|
|
7341
|
+
.join(':');
|
|
7342
|
+
}
|
|
7343
|
+
|
|
7084
7344
|
get(key, options) {
|
|
7085
|
-
const
|
|
7086
|
-
const
|
|
7345
|
+
const {store} = this.opts;
|
|
7346
|
+
const isArray = Array.isArray(key);
|
|
7347
|
+
const keyPrefixed = isArray ? this._getKeyPrefixArray(key) : this._getKeyPrefix(key);
|
|
7348
|
+
if (isArray && store.getMany === undefined) {
|
|
7349
|
+
const promises = [];
|
|
7350
|
+
for (const key of keyPrefixed) {
|
|
7351
|
+
promises.push(Promise.resolve()
|
|
7352
|
+
.then(() => store.get(key))
|
|
7353
|
+
.then(data => (typeof data === 'string') ? this.opts.deserialize(data) : data)
|
|
7354
|
+
.then(data => {
|
|
7355
|
+
if (data === undefined || data === null) {
|
|
7356
|
+
return undefined;
|
|
7357
|
+
}
|
|
7358
|
+
|
|
7359
|
+
if (typeof data.expires === 'number' && Date.now() > data.expires) {
|
|
7360
|
+
return this.delete(key).then(() => undefined);
|
|
7361
|
+
}
|
|
7362
|
+
|
|
7363
|
+
return (options && options.raw) ? data : data.value;
|
|
7364
|
+
}),
|
|
7365
|
+
);
|
|
7366
|
+
}
|
|
7367
|
+
|
|
7368
|
+
return Promise.allSettled(promises)
|
|
7369
|
+
.then(values => {
|
|
7370
|
+
const data = [];
|
|
7371
|
+
for (const value of values) {
|
|
7372
|
+
data.push(value.value);
|
|
7373
|
+
}
|
|
7374
|
+
|
|
7375
|
+
return data;
|
|
7376
|
+
});
|
|
7377
|
+
}
|
|
7378
|
+
|
|
7087
7379
|
return Promise.resolve()
|
|
7088
|
-
.then(() => store.get(keyPrefixed))
|
|
7380
|
+
.then(() => isArray ? store.getMany(keyPrefixed) : store.get(keyPrefixed))
|
|
7089
7381
|
.then(data => (typeof data === 'string') ? this.opts.deserialize(data) : data)
|
|
7090
7382
|
.then(data => {
|
|
7091
|
-
if (data === undefined) {
|
|
7383
|
+
if (data === undefined || data === null) {
|
|
7092
7384
|
return undefined;
|
|
7093
7385
|
}
|
|
7094
7386
|
|
|
7387
|
+
if (isArray) {
|
|
7388
|
+
const result = [];
|
|
7389
|
+
|
|
7390
|
+
for (let row of data) {
|
|
7391
|
+
if ((typeof row === 'string')) {
|
|
7392
|
+
row = this.opts.deserialize(row);
|
|
7393
|
+
}
|
|
7394
|
+
|
|
7395
|
+
if (row === undefined || row === null) {
|
|
7396
|
+
result.push(undefined);
|
|
7397
|
+
continue;
|
|
7398
|
+
}
|
|
7399
|
+
|
|
7400
|
+
if (typeof row.expires === 'number' && Date.now() > row.expires) {
|
|
7401
|
+
this.delete(key).then(() => undefined);
|
|
7402
|
+
result.push(undefined);
|
|
7403
|
+
} else {
|
|
7404
|
+
result.push((options && options.raw) ? row : row.value);
|
|
7405
|
+
}
|
|
7406
|
+
}
|
|
7407
|
+
|
|
7408
|
+
return result;
|
|
7409
|
+
}
|
|
7410
|
+
|
|
7095
7411
|
if (typeof data.expires === 'number' && Date.now() > data.expires) {
|
|
7096
|
-
this.delete(key);
|
|
7097
|
-
return undefined;
|
|
7412
|
+
return this.delete(key).then(() => undefined);
|
|
7098
7413
|
}
|
|
7099
7414
|
|
|
7100
7415
|
return (options && options.raw) ? data : data.value;
|
|
@@ -7111,12 +7426,16 @@ class Keyv extends EventEmitter {
|
|
|
7111
7426
|
ttl = undefined;
|
|
7112
7427
|
}
|
|
7113
7428
|
|
|
7114
|
-
const {
|
|
7429
|
+
const {store} = this.opts;
|
|
7115
7430
|
|
|
7116
7431
|
return Promise.resolve()
|
|
7117
7432
|
.then(() => {
|
|
7118
7433
|
const expires = (typeof ttl === 'number') ? (Date.now() + ttl) : null;
|
|
7119
|
-
|
|
7434
|
+
if (typeof value === 'symbol') {
|
|
7435
|
+
this.emit('error', 'symbol cannot be serialized');
|
|
7436
|
+
}
|
|
7437
|
+
|
|
7438
|
+
value = {value, expires};
|
|
7120
7439
|
return this.opts.serialize(value);
|
|
7121
7440
|
})
|
|
7122
7441
|
.then(value => store.set(keyPrefixed, value, ttl))
|
|
@@ -7124,17 +7443,54 @@ class Keyv extends EventEmitter {
|
|
|
7124
7443
|
}
|
|
7125
7444
|
|
|
7126
7445
|
delete(key) {
|
|
7446
|
+
const {store} = this.opts;
|
|
7447
|
+
if (Array.isArray(key)) {
|
|
7448
|
+
const keyPrefixed = this._getKeyPrefixArray(key);
|
|
7449
|
+
if (store.deleteMany === undefined) {
|
|
7450
|
+
const promises = [];
|
|
7451
|
+
for (const key of keyPrefixed) {
|
|
7452
|
+
promises.push(store.delete(key));
|
|
7453
|
+
}
|
|
7454
|
+
|
|
7455
|
+
return Promise.allSettled(promises)
|
|
7456
|
+
.then(values => values.every(x => x.value === true));
|
|
7457
|
+
}
|
|
7458
|
+
|
|
7459
|
+
return Promise.resolve()
|
|
7460
|
+
.then(() => store.deleteMany(keyPrefixed));
|
|
7461
|
+
}
|
|
7462
|
+
|
|
7127
7463
|
const keyPrefixed = this._getKeyPrefix(key);
|
|
7128
|
-
const { store } = this.opts;
|
|
7129
7464
|
return Promise.resolve()
|
|
7130
7465
|
.then(() => store.delete(keyPrefixed));
|
|
7131
7466
|
}
|
|
7132
7467
|
|
|
7133
7468
|
clear() {
|
|
7134
|
-
const {
|
|
7469
|
+
const {store} = this.opts;
|
|
7135
7470
|
return Promise.resolve()
|
|
7136
7471
|
.then(() => store.clear());
|
|
7137
7472
|
}
|
|
7473
|
+
|
|
7474
|
+
has(key) {
|
|
7475
|
+
const keyPrefixed = this._getKeyPrefix(key);
|
|
7476
|
+
const {store} = this.opts;
|
|
7477
|
+
return Promise.resolve()
|
|
7478
|
+
.then(async () => {
|
|
7479
|
+
if (typeof store.has === 'function') {
|
|
7480
|
+
return store.has(keyPrefixed);
|
|
7481
|
+
}
|
|
7482
|
+
|
|
7483
|
+
const value = await store.get(keyPrefixed);
|
|
7484
|
+
return value !== undefined;
|
|
7485
|
+
});
|
|
7486
|
+
}
|
|
7487
|
+
|
|
7488
|
+
disconnect() {
|
|
7489
|
+
const {store} = this.opts;
|
|
7490
|
+
if (typeof store.disconnect === 'function') {
|
|
7491
|
+
return store.disconnect();
|
|
7492
|
+
}
|
|
7493
|
+
}
|
|
7138
7494
|
}
|
|
7139
7495
|
|
|
7140
7496
|
module.exports = Keyv;
|
|
@@ -10952,7 +11308,7 @@ module.exports = (options = {}, connect = tls.connect) => new Promise((resolve,
|
|
|
10952
11308
|
|
|
10953
11309
|
/***/ }),
|
|
10954
11310
|
|
|
10955
|
-
/***/
|
|
11311
|
+
/***/ 1534:
|
|
10956
11312
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
10957
11313
|
|
|
10958
11314
|
"use strict";
|
|
@@ -11034,16 +11390,18 @@ function wrappy (fn, cb) {
|
|
|
11034
11390
|
|
|
11035
11391
|
/***/ }),
|
|
11036
11392
|
|
|
11037
|
-
/***/
|
|
11393
|
+
/***/ 6597:
|
|
11038
11394
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11039
11395
|
|
|
11040
11396
|
"use strict";
|
|
11041
11397
|
|
|
11042
11398
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11043
|
-
exports.
|
|
11044
|
-
const
|
|
11399
|
+
exports.getErrorMap = exports.setErrorMap = exports.defaultErrorMap = exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
|
|
11400
|
+
const parseUtil_1 = __nccwpck_require__(7822);
|
|
11401
|
+
const util_1 = __nccwpck_require__(809);
|
|
11045
11402
|
exports.ZodIssueCode = util_1.util.arrayToEnum([
|
|
11046
11403
|
"invalid_type",
|
|
11404
|
+
"invalid_literal",
|
|
11047
11405
|
"custom",
|
|
11048
11406
|
"invalid_union",
|
|
11049
11407
|
"invalid_union_discriminator",
|
|
@@ -11067,51 +11425,6 @@ class ZodError extends Error {
|
|
|
11067
11425
|
constructor(issues) {
|
|
11068
11426
|
super();
|
|
11069
11427
|
this.issues = [];
|
|
11070
|
-
this.format = () => {
|
|
11071
|
-
const fieldErrors = { _errors: [] };
|
|
11072
|
-
const processError = (error) => {
|
|
11073
|
-
for (const issue of error.issues) {
|
|
11074
|
-
if (issue.code === "invalid_union") {
|
|
11075
|
-
issue.unionErrors.map(processError);
|
|
11076
|
-
}
|
|
11077
|
-
else if (issue.code === "invalid_return_type") {
|
|
11078
|
-
processError(issue.returnTypeError);
|
|
11079
|
-
}
|
|
11080
|
-
else if (issue.code === "invalid_arguments") {
|
|
11081
|
-
processError(issue.argumentsError);
|
|
11082
|
-
}
|
|
11083
|
-
else if (issue.path.length === 0) {
|
|
11084
|
-
fieldErrors._errors.push(issue.message);
|
|
11085
|
-
}
|
|
11086
|
-
else {
|
|
11087
|
-
let curr = fieldErrors;
|
|
11088
|
-
let i = 0;
|
|
11089
|
-
while (i < issue.path.length) {
|
|
11090
|
-
const el = issue.path[i];
|
|
11091
|
-
const terminal = i === issue.path.length - 1;
|
|
11092
|
-
if (!terminal) {
|
|
11093
|
-
if (typeof el === "string") {
|
|
11094
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
11095
|
-
}
|
|
11096
|
-
else if (typeof el === "number") {
|
|
11097
|
-
const errorArray = [];
|
|
11098
|
-
errorArray._errors = [];
|
|
11099
|
-
curr[el] = curr[el] || errorArray;
|
|
11100
|
-
}
|
|
11101
|
-
}
|
|
11102
|
-
else {
|
|
11103
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
11104
|
-
curr[el]._errors.push(issue.message);
|
|
11105
|
-
}
|
|
11106
|
-
curr = curr[el];
|
|
11107
|
-
i++;
|
|
11108
|
-
}
|
|
11109
|
-
}
|
|
11110
|
-
}
|
|
11111
|
-
};
|
|
11112
|
-
processError(this);
|
|
11113
|
-
return fieldErrors;
|
|
11114
|
-
};
|
|
11115
11428
|
this.addIssue = (sub) => {
|
|
11116
11429
|
this.issues = [...this.issues, sub];
|
|
11117
11430
|
};
|
|
@@ -11132,11 +11445,60 @@ class ZodError extends Error {
|
|
|
11132
11445
|
get errors() {
|
|
11133
11446
|
return this.issues;
|
|
11134
11447
|
}
|
|
11448
|
+
format(_mapper) {
|
|
11449
|
+
const mapper = _mapper ||
|
|
11450
|
+
function (issue) {
|
|
11451
|
+
return issue.message;
|
|
11452
|
+
};
|
|
11453
|
+
const fieldErrors = { _errors: [] };
|
|
11454
|
+
const processError = (error) => {
|
|
11455
|
+
for (const issue of error.issues) {
|
|
11456
|
+
if (issue.code === "invalid_union") {
|
|
11457
|
+
issue.unionErrors.map(processError);
|
|
11458
|
+
}
|
|
11459
|
+
else if (issue.code === "invalid_return_type") {
|
|
11460
|
+
processError(issue.returnTypeError);
|
|
11461
|
+
}
|
|
11462
|
+
else if (issue.code === "invalid_arguments") {
|
|
11463
|
+
processError(issue.argumentsError);
|
|
11464
|
+
}
|
|
11465
|
+
else if (issue.path.length === 0) {
|
|
11466
|
+
fieldErrors._errors.push(mapper(issue));
|
|
11467
|
+
}
|
|
11468
|
+
else {
|
|
11469
|
+
let curr = fieldErrors;
|
|
11470
|
+
let i = 0;
|
|
11471
|
+
while (i < issue.path.length) {
|
|
11472
|
+
const el = issue.path[i];
|
|
11473
|
+
const terminal = i === issue.path.length - 1;
|
|
11474
|
+
if (!terminal) {
|
|
11475
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
11476
|
+
// if (typeof el === "string") {
|
|
11477
|
+
// curr[el] = curr[el] || { _errors: [] };
|
|
11478
|
+
// } else if (typeof el === "number") {
|
|
11479
|
+
// const errorArray: any = [];
|
|
11480
|
+
// errorArray._errors = [];
|
|
11481
|
+
// curr[el] = curr[el] || errorArray;
|
|
11482
|
+
// }
|
|
11483
|
+
}
|
|
11484
|
+
else {
|
|
11485
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
11486
|
+
curr[el]._errors.push(mapper(issue));
|
|
11487
|
+
}
|
|
11488
|
+
curr = curr[el];
|
|
11489
|
+
i++;
|
|
11490
|
+
}
|
|
11491
|
+
}
|
|
11492
|
+
}
|
|
11493
|
+
};
|
|
11494
|
+
processError(this);
|
|
11495
|
+
return fieldErrors;
|
|
11496
|
+
}
|
|
11135
11497
|
toString() {
|
|
11136
11498
|
return this.message;
|
|
11137
11499
|
}
|
|
11138
11500
|
get message() {
|
|
11139
|
-
return JSON.stringify(this.issues,
|
|
11501
|
+
return JSON.stringify(this.issues, parseUtil_1.jsonStringifyReplacer, 2);
|
|
11140
11502
|
}
|
|
11141
11503
|
get isEmpty() {
|
|
11142
11504
|
return this.issues.length === 0;
|
|
@@ -11168,30 +11530,27 @@ const defaultErrorMap = (issue, _ctx) => {
|
|
|
11168
11530
|
let message;
|
|
11169
11531
|
switch (issue.code) {
|
|
11170
11532
|
case exports.ZodIssueCode.invalid_type:
|
|
11171
|
-
if (issue.received ===
|
|
11533
|
+
if (issue.received === util_1.ZodParsedType.undefined) {
|
|
11172
11534
|
message = "Required";
|
|
11173
11535
|
}
|
|
11174
11536
|
else {
|
|
11175
11537
|
message = `Expected ${issue.expected}, received ${issue.received}`;
|
|
11176
11538
|
}
|
|
11177
11539
|
break;
|
|
11540
|
+
case exports.ZodIssueCode.invalid_literal:
|
|
11541
|
+
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, parseUtil_1.jsonStringifyReplacer)}`;
|
|
11542
|
+
break;
|
|
11178
11543
|
case exports.ZodIssueCode.unrecognized_keys:
|
|
11179
|
-
message = `Unrecognized key(s) in object: ${issue.keys
|
|
11180
|
-
.map((k) => `'${k}'`)
|
|
11181
|
-
.join(", ")}`;
|
|
11544
|
+
message = `Unrecognized key(s) in object: ${util_1.util.joinValues(issue.keys, ", ")}`;
|
|
11182
11545
|
break;
|
|
11183
11546
|
case exports.ZodIssueCode.invalid_union:
|
|
11184
11547
|
message = `Invalid input`;
|
|
11185
11548
|
break;
|
|
11186
11549
|
case exports.ZodIssueCode.invalid_union_discriminator:
|
|
11187
|
-
message = `Invalid discriminator value. Expected ${issue.options
|
|
11188
|
-
.map((val) => (typeof val === "string" ? `'${val}'` : val))
|
|
11189
|
-
.join(" | ")}`;
|
|
11550
|
+
message = `Invalid discriminator value. Expected ${util_1.util.joinValues(issue.options)}`;
|
|
11190
11551
|
break;
|
|
11191
11552
|
case exports.ZodIssueCode.invalid_enum_value:
|
|
11192
|
-
message = `Invalid enum value. Expected ${issue.options
|
|
11193
|
-
.map((val) => (typeof val === "string" ? `'${val}'` : val))
|
|
11194
|
-
.join(" | ")}`;
|
|
11553
|
+
message = `Invalid enum value. Expected ${util_1.util.joinValues(issue.options)}, received '${issue.received}'`;
|
|
11195
11554
|
break;
|
|
11196
11555
|
case exports.ZodIssueCode.invalid_arguments:
|
|
11197
11556
|
message = `Invalid function arguments`;
|
|
@@ -11203,10 +11562,23 @@ const defaultErrorMap = (issue, _ctx) => {
|
|
|
11203
11562
|
message = `Invalid date`;
|
|
11204
11563
|
break;
|
|
11205
11564
|
case exports.ZodIssueCode.invalid_string:
|
|
11206
|
-
if (issue.validation
|
|
11565
|
+
if (typeof issue.validation === "object") {
|
|
11566
|
+
if ("startsWith" in issue.validation) {
|
|
11567
|
+
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
11568
|
+
}
|
|
11569
|
+
else if ("endsWith" in issue.validation) {
|
|
11570
|
+
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
11571
|
+
}
|
|
11572
|
+
else {
|
|
11573
|
+
util_1.util.assertNever(issue.validation);
|
|
11574
|
+
}
|
|
11575
|
+
}
|
|
11576
|
+
else if (issue.validation !== "regex") {
|
|
11207
11577
|
message = `Invalid ${issue.validation}`;
|
|
11208
|
-
|
|
11578
|
+
}
|
|
11579
|
+
else {
|
|
11209
11580
|
message = "Invalid";
|
|
11581
|
+
}
|
|
11210
11582
|
break;
|
|
11211
11583
|
case exports.ZodIssueCode.too_small:
|
|
11212
11584
|
if (issue.type === "array")
|
|
@@ -11215,6 +11587,8 @@ const defaultErrorMap = (issue, _ctx) => {
|
|
|
11215
11587
|
message = `String must contain ${issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
11216
11588
|
else if (issue.type === "number")
|
|
11217
11589
|
message = `Number must be greater than ${issue.inclusive ? `or equal to ` : ``}${issue.minimum}`;
|
|
11590
|
+
else if (issue.type === "date")
|
|
11591
|
+
message = `Date must be greater than ${issue.inclusive ? `or equal to ` : ``}${new Date(issue.minimum)}`;
|
|
11218
11592
|
else
|
|
11219
11593
|
message = "Invalid input";
|
|
11220
11594
|
break;
|
|
@@ -11225,6 +11599,8 @@ const defaultErrorMap = (issue, _ctx) => {
|
|
|
11225
11599
|
message = `String must contain ${issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
11226
11600
|
else if (issue.type === "number")
|
|
11227
11601
|
message = `Number must be less than ${issue.inclusive ? `or equal to ` : ``}${issue.maximum}`;
|
|
11602
|
+
else if (issue.type === "date")
|
|
11603
|
+
message = `Date must be smaller than ${issue.inclusive ? `or equal to ` : ``}${new Date(issue.maximum)}`;
|
|
11228
11604
|
else
|
|
11229
11605
|
message = "Invalid input";
|
|
11230
11606
|
break;
|
|
@@ -11244,27 +11620,27 @@ const defaultErrorMap = (issue, _ctx) => {
|
|
|
11244
11620
|
return { message };
|
|
11245
11621
|
};
|
|
11246
11622
|
exports.defaultErrorMap = defaultErrorMap;
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
}
|
|
11623
|
+
let overrideErrorMap = exports.defaultErrorMap;
|
|
11624
|
+
function setErrorMap(map) {
|
|
11625
|
+
overrideErrorMap = map;
|
|
11626
|
+
}
|
|
11251
11627
|
exports.setErrorMap = setErrorMap;
|
|
11628
|
+
function getErrorMap() {
|
|
11629
|
+
return overrideErrorMap;
|
|
11630
|
+
}
|
|
11631
|
+
exports.getErrorMap = getErrorMap;
|
|
11252
11632
|
|
|
11253
11633
|
|
|
11254
11634
|
/***/ }),
|
|
11255
11635
|
|
|
11256
|
-
/***/
|
|
11636
|
+
/***/ 8857:
|
|
11257
11637
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
11258
11638
|
|
|
11259
11639
|
"use strict";
|
|
11260
11640
|
|
|
11261
11641
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11262
11642
|
if (k2 === undefined) k2 = k;
|
|
11263
|
-
|
|
11264
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11265
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11266
|
-
}
|
|
11267
|
-
Object.defineProperty(o, k2, desc);
|
|
11643
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
11268
11644
|
}) : (function(o, m, k, k2) {
|
|
11269
11645
|
if (k2 === undefined) k2 = k;
|
|
11270
11646
|
o[k2] = m[k];
|
|
@@ -11273,15 +11649,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11273
11649
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11274
11650
|
};
|
|
11275
11651
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11276
|
-
|
|
11277
|
-
__exportStar(__nccwpck_require__(
|
|
11278
|
-
__exportStar(__nccwpck_require__(
|
|
11279
|
-
|
|
11652
|
+
exports.ZodParsedType = exports.getParsedType = void 0;
|
|
11653
|
+
__exportStar(__nccwpck_require__(7822), exports);
|
|
11654
|
+
__exportStar(__nccwpck_require__(6836), exports);
|
|
11655
|
+
var util_1 = __nccwpck_require__(809);
|
|
11656
|
+
Object.defineProperty(exports, "getParsedType", ({ enumerable: true, get: function () { return util_1.getParsedType; } }));
|
|
11657
|
+
Object.defineProperty(exports, "ZodParsedType", ({ enumerable: true, get: function () { return util_1.ZodParsedType; } }));
|
|
11658
|
+
__exportStar(__nccwpck_require__(54), exports);
|
|
11659
|
+
__exportStar(__nccwpck_require__(6597), exports);
|
|
11280
11660
|
|
|
11281
11661
|
|
|
11282
11662
|
/***/ }),
|
|
11283
11663
|
|
|
11284
|
-
/***/
|
|
11664
|
+
/***/ 3797:
|
|
11285
11665
|
/***/ ((__unused_webpack_module, exports) => {
|
|
11286
11666
|
|
|
11287
11667
|
"use strict";
|
|
@@ -11297,80 +11677,14 @@ var errorUtil;
|
|
|
11297
11677
|
|
|
11298
11678
|
/***/ }),
|
|
11299
11679
|
|
|
11300
|
-
/***/
|
|
11680
|
+
/***/ 7822:
|
|
11301
11681
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11302
11682
|
|
|
11303
11683
|
"use strict";
|
|
11304
11684
|
|
|
11305
11685
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11306
|
-
exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.addIssueToContext = exports.EMPTY_PATH = exports.makeIssue =
|
|
11307
|
-
const ZodError_1 = __nccwpck_require__(
|
|
11308
|
-
const util_1 = __nccwpck_require__(977);
|
|
11309
|
-
exports.ZodParsedType = util_1.util.arrayToEnum([
|
|
11310
|
-
"string",
|
|
11311
|
-
"nan",
|
|
11312
|
-
"number",
|
|
11313
|
-
"integer",
|
|
11314
|
-
"float",
|
|
11315
|
-
"boolean",
|
|
11316
|
-
"date",
|
|
11317
|
-
"bigint",
|
|
11318
|
-
"symbol",
|
|
11319
|
-
"function",
|
|
11320
|
-
"undefined",
|
|
11321
|
-
"null",
|
|
11322
|
-
"array",
|
|
11323
|
-
"object",
|
|
11324
|
-
"unknown",
|
|
11325
|
-
"promise",
|
|
11326
|
-
"void",
|
|
11327
|
-
"never",
|
|
11328
|
-
"map",
|
|
11329
|
-
"set",
|
|
11330
|
-
]);
|
|
11331
|
-
const getParsedType = (data) => {
|
|
11332
|
-
const t = typeof data;
|
|
11333
|
-
switch (t) {
|
|
11334
|
-
case "undefined":
|
|
11335
|
-
return exports.ZodParsedType.undefined;
|
|
11336
|
-
case "string":
|
|
11337
|
-
return exports.ZodParsedType.string;
|
|
11338
|
-
case "number":
|
|
11339
|
-
return isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
|
|
11340
|
-
case "boolean":
|
|
11341
|
-
return exports.ZodParsedType.boolean;
|
|
11342
|
-
case "function":
|
|
11343
|
-
return exports.ZodParsedType.function;
|
|
11344
|
-
case "bigint":
|
|
11345
|
-
return exports.ZodParsedType.bigint;
|
|
11346
|
-
case "object":
|
|
11347
|
-
if (Array.isArray(data)) {
|
|
11348
|
-
return exports.ZodParsedType.array;
|
|
11349
|
-
}
|
|
11350
|
-
if (data === null) {
|
|
11351
|
-
return exports.ZodParsedType.null;
|
|
11352
|
-
}
|
|
11353
|
-
if (data.then &&
|
|
11354
|
-
typeof data.then === "function" &&
|
|
11355
|
-
data.catch &&
|
|
11356
|
-
typeof data.catch === "function") {
|
|
11357
|
-
return exports.ZodParsedType.promise;
|
|
11358
|
-
}
|
|
11359
|
-
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
11360
|
-
return exports.ZodParsedType.map;
|
|
11361
|
-
}
|
|
11362
|
-
if (typeof Set !== "undefined" && data instanceof Set) {
|
|
11363
|
-
return exports.ZodParsedType.set;
|
|
11364
|
-
}
|
|
11365
|
-
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
11366
|
-
return exports.ZodParsedType.date;
|
|
11367
|
-
}
|
|
11368
|
-
return exports.ZodParsedType.object;
|
|
11369
|
-
default:
|
|
11370
|
-
return exports.ZodParsedType.unknown;
|
|
11371
|
-
}
|
|
11372
|
-
};
|
|
11373
|
-
exports.getParsedType = getParsedType;
|
|
11686
|
+
exports.jsonStringifyReplacer = exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.addIssueToContext = exports.EMPTY_PATH = exports.makeIssue = void 0;
|
|
11687
|
+
const ZodError_1 = __nccwpck_require__(6597);
|
|
11374
11688
|
const makeIssue = (params) => {
|
|
11375
11689
|
const { data, path, errorMaps, issueData } = params;
|
|
11376
11690
|
const fullPath = [...path, ...(issueData.path || [])];
|
|
@@ -11395,15 +11709,15 @@ const makeIssue = (params) => {
|
|
|
11395
11709
|
exports.makeIssue = makeIssue;
|
|
11396
11710
|
exports.EMPTY_PATH = [];
|
|
11397
11711
|
function addIssueToContext(ctx, issueData) {
|
|
11398
|
-
const issue =
|
|
11712
|
+
const issue = exports.makeIssue({
|
|
11399
11713
|
issueData: issueData,
|
|
11400
11714
|
data: ctx.data,
|
|
11401
11715
|
path: ctx.path,
|
|
11402
11716
|
errorMaps: [
|
|
11403
11717
|
ctx.common.contextualErrorMap,
|
|
11404
11718
|
ctx.schemaErrorMap,
|
|
11405
|
-
ZodError_1.
|
|
11406
|
-
ZodError_1.defaultErrorMap,
|
|
11719
|
+
ZodError_1.getErrorMap(),
|
|
11720
|
+
ZodError_1.defaultErrorMap,
|
|
11407
11721
|
].filter((x) => !!x),
|
|
11408
11722
|
});
|
|
11409
11723
|
ctx.common.issues.push(issue);
|
|
@@ -11477,11 +11791,18 @@ const isValid = (x) => x.status === "valid";
|
|
|
11477
11791
|
exports.isValid = isValid;
|
|
11478
11792
|
const isAsync = (x) => typeof Promise !== undefined && x instanceof Promise;
|
|
11479
11793
|
exports.isAsync = isAsync;
|
|
11794
|
+
const jsonStringifyReplacer = (_, value) => {
|
|
11795
|
+
if (typeof value === "bigint") {
|
|
11796
|
+
return value.toString();
|
|
11797
|
+
}
|
|
11798
|
+
return value;
|
|
11799
|
+
};
|
|
11800
|
+
exports.jsonStringifyReplacer = jsonStringifyReplacer;
|
|
11480
11801
|
|
|
11481
11802
|
|
|
11482
11803
|
/***/ }),
|
|
11483
11804
|
|
|
11484
|
-
/***/
|
|
11805
|
+
/***/ 6836:
|
|
11485
11806
|
/***/ ((__unused_webpack_module, exports) => {
|
|
11486
11807
|
|
|
11487
11808
|
"use strict";
|
|
@@ -11491,15 +11812,18 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
11491
11812
|
|
|
11492
11813
|
/***/ }),
|
|
11493
11814
|
|
|
11494
|
-
/***/
|
|
11815
|
+
/***/ 809:
|
|
11495
11816
|
/***/ ((__unused_webpack_module, exports) => {
|
|
11496
11817
|
|
|
11497
11818
|
"use strict";
|
|
11498
11819
|
|
|
11499
11820
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11500
|
-
exports.util = void 0;
|
|
11821
|
+
exports.getParsedType = exports.ZodParsedType = exports.util = void 0;
|
|
11501
11822
|
var util;
|
|
11502
11823
|
(function (util) {
|
|
11824
|
+
util.assertEqual = (val) => val;
|
|
11825
|
+
function assertIs(_arg) { }
|
|
11826
|
+
util.assertIs = assertIs;
|
|
11503
11827
|
function assertNever(_x) {
|
|
11504
11828
|
throw new Error();
|
|
11505
11829
|
}
|
|
@@ -11545,23 +11869,90 @@ var util;
|
|
|
11545
11869
|
util.isInteger = typeof Number.isInteger === "function"
|
|
11546
11870
|
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
|
11547
11871
|
: (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
11872
|
+
function joinValues(array, separator = " | ") {
|
|
11873
|
+
return array
|
|
11874
|
+
.map((val) => (typeof val === "string" ? `'${val}'` : val))
|
|
11875
|
+
.join(separator);
|
|
11876
|
+
}
|
|
11877
|
+
util.joinValues = joinValues;
|
|
11548
11878
|
})(util = exports.util || (exports.util = {}));
|
|
11879
|
+
exports.ZodParsedType = util.arrayToEnum([
|
|
11880
|
+
"string",
|
|
11881
|
+
"nan",
|
|
11882
|
+
"number",
|
|
11883
|
+
"integer",
|
|
11884
|
+
"float",
|
|
11885
|
+
"boolean",
|
|
11886
|
+
"date",
|
|
11887
|
+
"bigint",
|
|
11888
|
+
"symbol",
|
|
11889
|
+
"function",
|
|
11890
|
+
"undefined",
|
|
11891
|
+
"null",
|
|
11892
|
+
"array",
|
|
11893
|
+
"object",
|
|
11894
|
+
"unknown",
|
|
11895
|
+
"promise",
|
|
11896
|
+
"void",
|
|
11897
|
+
"never",
|
|
11898
|
+
"map",
|
|
11899
|
+
"set",
|
|
11900
|
+
]);
|
|
11901
|
+
const getParsedType = (data) => {
|
|
11902
|
+
const t = typeof data;
|
|
11903
|
+
switch (t) {
|
|
11904
|
+
case "undefined":
|
|
11905
|
+
return exports.ZodParsedType.undefined;
|
|
11906
|
+
case "string":
|
|
11907
|
+
return exports.ZodParsedType.string;
|
|
11908
|
+
case "number":
|
|
11909
|
+
return isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
|
|
11910
|
+
case "boolean":
|
|
11911
|
+
return exports.ZodParsedType.boolean;
|
|
11912
|
+
case "function":
|
|
11913
|
+
return exports.ZodParsedType.function;
|
|
11914
|
+
case "bigint":
|
|
11915
|
+
return exports.ZodParsedType.bigint;
|
|
11916
|
+
case "object":
|
|
11917
|
+
if (Array.isArray(data)) {
|
|
11918
|
+
return exports.ZodParsedType.array;
|
|
11919
|
+
}
|
|
11920
|
+
if (data === null) {
|
|
11921
|
+
return exports.ZodParsedType.null;
|
|
11922
|
+
}
|
|
11923
|
+
if (data.then &&
|
|
11924
|
+
typeof data.then === "function" &&
|
|
11925
|
+
data.catch &&
|
|
11926
|
+
typeof data.catch === "function") {
|
|
11927
|
+
return exports.ZodParsedType.promise;
|
|
11928
|
+
}
|
|
11929
|
+
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
11930
|
+
return exports.ZodParsedType.map;
|
|
11931
|
+
}
|
|
11932
|
+
if (typeof Set !== "undefined" && data instanceof Set) {
|
|
11933
|
+
return exports.ZodParsedType.set;
|
|
11934
|
+
}
|
|
11935
|
+
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
11936
|
+
return exports.ZodParsedType.date;
|
|
11937
|
+
}
|
|
11938
|
+
return exports.ZodParsedType.object;
|
|
11939
|
+
default:
|
|
11940
|
+
return exports.ZodParsedType.unknown;
|
|
11941
|
+
}
|
|
11942
|
+
};
|
|
11943
|
+
exports.getParsedType = getParsedType;
|
|
11549
11944
|
|
|
11550
11945
|
|
|
11551
11946
|
/***/ }),
|
|
11552
11947
|
|
|
11553
|
-
/***/
|
|
11948
|
+
/***/ 8062:
|
|
11554
11949
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
11555
11950
|
|
|
11556
11951
|
"use strict";
|
|
11557
11952
|
|
|
11558
11953
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11559
11954
|
if (k2 === undefined) k2 = k;
|
|
11560
|
-
|
|
11561
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11562
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11563
|
-
}
|
|
11564
|
-
Object.defineProperty(o, k2, desc);
|
|
11955
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
11565
11956
|
}) : (function(o, m, k, k2) {
|
|
11566
11957
|
if (k2 === undefined) k2 = k;
|
|
11567
11958
|
o[k2] = m[k];
|
|
@@ -11583,26 +11974,26 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11583
11974
|
};
|
|
11584
11975
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11585
11976
|
exports.z = void 0;
|
|
11586
|
-
const mod = __importStar(__nccwpck_require__(
|
|
11977
|
+
const mod = __importStar(__nccwpck_require__(8857));
|
|
11587
11978
|
exports.z = mod;
|
|
11588
|
-
__exportStar(__nccwpck_require__(
|
|
11979
|
+
__exportStar(__nccwpck_require__(8857), exports);
|
|
11589
11980
|
exports["default"] = mod;
|
|
11590
11981
|
|
|
11591
11982
|
|
|
11592
11983
|
/***/ }),
|
|
11593
11984
|
|
|
11594
|
-
/***/
|
|
11985
|
+
/***/ 54:
|
|
11595
11986
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11596
11987
|
|
|
11597
11988
|
"use strict";
|
|
11598
11989
|
|
|
11599
11990
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11600
|
-
exports
|
|
11601
|
-
exports["void"] = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports["null"] = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = void 0;
|
|
11602
|
-
const errorUtil_1 = __nccwpck_require__(
|
|
11603
|
-
const parseUtil_1 = __nccwpck_require__(
|
|
11604
|
-
const util_1 = __nccwpck_require__(
|
|
11605
|
-
const ZodError_1 = __nccwpck_require__(
|
|
11991
|
+
exports["function"] = exports["enum"] = exports.effect = exports.discriminatedUnion = exports.date = exports.boolean = exports.bigint = exports.array = exports.any = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.custom = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.objectUtil = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.ZodType = void 0;
|
|
11992
|
+
exports["void"] = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports["null"] = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports["instanceof"] = void 0;
|
|
11993
|
+
const errorUtil_1 = __nccwpck_require__(3797);
|
|
11994
|
+
const parseUtil_1 = __nccwpck_require__(7822);
|
|
11995
|
+
const util_1 = __nccwpck_require__(809);
|
|
11996
|
+
const ZodError_1 = __nccwpck_require__(6597);
|
|
11606
11997
|
class ParseInputLazyPath {
|
|
11607
11998
|
constructor(parent, value, path, key) {
|
|
11608
11999
|
this.parent = parent;
|
|
@@ -11615,7 +12006,7 @@ class ParseInputLazyPath {
|
|
|
11615
12006
|
}
|
|
11616
12007
|
}
|
|
11617
12008
|
const handleResult = (ctx, result) => {
|
|
11618
|
-
if (
|
|
12009
|
+
if (parseUtil_1.isValid(result)) {
|
|
11619
12010
|
return { success: true, data: result.value };
|
|
11620
12011
|
}
|
|
11621
12012
|
else {
|
|
@@ -11638,11 +12029,10 @@ function processCreateParams(params) {
|
|
|
11638
12029
|
const customMap = (iss, ctx) => {
|
|
11639
12030
|
if (iss.code !== "invalid_type")
|
|
11640
12031
|
return { message: ctx.defaultError };
|
|
11641
|
-
if (typeof ctx.data === "undefined"
|
|
11642
|
-
return { message: required_error };
|
|
11643
|
-
|
|
11644
|
-
|
|
11645
|
-
return { message: ctx.defaultError };
|
|
12032
|
+
if (typeof ctx.data === "undefined") {
|
|
12033
|
+
return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
|
|
12034
|
+
}
|
|
12035
|
+
return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
|
|
11646
12036
|
};
|
|
11647
12037
|
return { errorMap: customMap, description };
|
|
11648
12038
|
}
|
|
@@ -11677,13 +12067,13 @@ class ZodType {
|
|
|
11677
12067
|
return this._def.description;
|
|
11678
12068
|
}
|
|
11679
12069
|
_getType(input) {
|
|
11680
|
-
return
|
|
12070
|
+
return util_1.getParsedType(input.data);
|
|
11681
12071
|
}
|
|
11682
12072
|
_getOrReturnCtx(input, ctx) {
|
|
11683
12073
|
return (ctx || {
|
|
11684
12074
|
common: input.parent.common,
|
|
11685
12075
|
data: input.data,
|
|
11686
|
-
parsedType:
|
|
12076
|
+
parsedType: util_1.getParsedType(input.data),
|
|
11687
12077
|
schemaErrorMap: this._def.errorMap,
|
|
11688
12078
|
path: input.path,
|
|
11689
12079
|
parent: input.parent,
|
|
@@ -11695,7 +12085,7 @@ class ZodType {
|
|
|
11695
12085
|
ctx: {
|
|
11696
12086
|
common: input.parent.common,
|
|
11697
12087
|
data: input.data,
|
|
11698
|
-
parsedType:
|
|
12088
|
+
parsedType: util_1.getParsedType(input.data),
|
|
11699
12089
|
schemaErrorMap: this._def.errorMap,
|
|
11700
12090
|
path: input.path,
|
|
11701
12091
|
parent: input.parent,
|
|
@@ -11704,7 +12094,7 @@ class ZodType {
|
|
|
11704
12094
|
}
|
|
11705
12095
|
_parseSync(input) {
|
|
11706
12096
|
const result = this._parse(input);
|
|
11707
|
-
if (
|
|
12097
|
+
if (parseUtil_1.isAsync(result)) {
|
|
11708
12098
|
throw new Error("Synchronous parse encountered promise.");
|
|
11709
12099
|
}
|
|
11710
12100
|
return result;
|
|
@@ -11725,14 +12115,13 @@ class ZodType {
|
|
|
11725
12115
|
common: {
|
|
11726
12116
|
issues: [],
|
|
11727
12117
|
async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
|
|
11728
|
-
typeCache: typeof Map !== "undefined" ? new Map() : undefined,
|
|
11729
12118
|
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
|
|
11730
12119
|
},
|
|
11731
12120
|
path: (params === null || params === void 0 ? void 0 : params.path) || [],
|
|
11732
12121
|
schemaErrorMap: this._def.errorMap,
|
|
11733
12122
|
parent: null,
|
|
11734
12123
|
data,
|
|
11735
|
-
parsedType:
|
|
12124
|
+
parsedType: util_1.getParsedType(data),
|
|
11736
12125
|
};
|
|
11737
12126
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
11738
12127
|
return handleResult(ctx, result);
|
|
@@ -11749,16 +12138,15 @@ class ZodType {
|
|
|
11749
12138
|
issues: [],
|
|
11750
12139
|
contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
|
|
11751
12140
|
async: true,
|
|
11752
|
-
typeCache: typeof Map !== "undefined" ? new Map() : undefined,
|
|
11753
12141
|
},
|
|
11754
12142
|
path: (params === null || params === void 0 ? void 0 : params.path) || [],
|
|
11755
12143
|
schemaErrorMap: this._def.errorMap,
|
|
11756
12144
|
parent: null,
|
|
11757
12145
|
data,
|
|
11758
|
-
parsedType:
|
|
12146
|
+
parsedType: util_1.getParsedType(data),
|
|
11759
12147
|
};
|
|
11760
12148
|
const maybeAsyncResult = this._parse({ data, path: [], parent: ctx });
|
|
11761
|
-
const result = await (
|
|
12149
|
+
const result = await (parseUtil_1.isAsync(maybeAsyncResult)
|
|
11762
12150
|
? maybeAsyncResult
|
|
11763
12151
|
: Promise.resolve(maybeAsyncResult));
|
|
11764
12152
|
return handleResult(ctx, result);
|
|
@@ -11822,8 +12210,6 @@ class ZodType {
|
|
|
11822
12210
|
});
|
|
11823
12211
|
}
|
|
11824
12212
|
optional() {
|
|
11825
|
-
("");
|
|
11826
|
-
("asdf");
|
|
11827
12213
|
return ZodOptional.create(this);
|
|
11828
12214
|
}
|
|
11829
12215
|
nullable() {
|
|
@@ -11859,6 +12245,13 @@ class ZodType {
|
|
|
11859
12245
|
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
11860
12246
|
});
|
|
11861
12247
|
}
|
|
12248
|
+
brand() {
|
|
12249
|
+
return new ZodBranded({
|
|
12250
|
+
typeName: ZodFirstPartyTypeKind.ZodBranded,
|
|
12251
|
+
type: this,
|
|
12252
|
+
...processCreateParams(undefined),
|
|
12253
|
+
});
|
|
12254
|
+
}
|
|
11862
12255
|
describe(description) {
|
|
11863
12256
|
const This = this.constructor;
|
|
11864
12257
|
return new This({
|
|
@@ -11892,18 +12285,22 @@ class ZodString extends ZodType {
|
|
|
11892
12285
|
...errorUtil_1.errorUtil.errToObj(message),
|
|
11893
12286
|
});
|
|
11894
12287
|
/**
|
|
11895
|
-
*
|
|
11896
|
-
*
|
|
12288
|
+
* @deprecated Use z.string().min(1) instead.
|
|
12289
|
+
* @see {@link ZodString.min}
|
|
11897
12290
|
*/
|
|
11898
12291
|
this.nonempty = (message) => this.min(1, errorUtil_1.errorUtil.errToObj(message));
|
|
12292
|
+
this.trim = () => new ZodString({
|
|
12293
|
+
...this._def,
|
|
12294
|
+
checks: [...this._def.checks, { kind: "trim" }],
|
|
12295
|
+
});
|
|
11899
12296
|
}
|
|
11900
12297
|
_parse(input) {
|
|
11901
12298
|
const parsedType = this._getType(input);
|
|
11902
|
-
if (parsedType !==
|
|
12299
|
+
if (parsedType !== util_1.ZodParsedType.string) {
|
|
11903
12300
|
const ctx = this._getOrReturnCtx(input);
|
|
11904
|
-
|
|
12301
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
11905
12302
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
11906
|
-
expected:
|
|
12303
|
+
expected: util_1.ZodParsedType.string,
|
|
11907
12304
|
received: ctx.parsedType,
|
|
11908
12305
|
}
|
|
11909
12306
|
//
|
|
@@ -11916,7 +12313,7 @@ class ZodString extends ZodType {
|
|
|
11916
12313
|
if (check.kind === "min") {
|
|
11917
12314
|
if (input.data.length < check.value) {
|
|
11918
12315
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
11919
|
-
|
|
12316
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
11920
12317
|
code: ZodError_1.ZodIssueCode.too_small,
|
|
11921
12318
|
minimum: check.value,
|
|
11922
12319
|
type: "string",
|
|
@@ -11929,7 +12326,7 @@ class ZodString extends ZodType {
|
|
|
11929
12326
|
else if (check.kind === "max") {
|
|
11930
12327
|
if (input.data.length > check.value) {
|
|
11931
12328
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
11932
|
-
|
|
12329
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
11933
12330
|
code: ZodError_1.ZodIssueCode.too_big,
|
|
11934
12331
|
maximum: check.value,
|
|
11935
12332
|
type: "string",
|
|
@@ -11942,7 +12339,7 @@ class ZodString extends ZodType {
|
|
|
11942
12339
|
else if (check.kind === "email") {
|
|
11943
12340
|
if (!emailRegex.test(input.data)) {
|
|
11944
12341
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
11945
|
-
|
|
12342
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
11946
12343
|
validation: "email",
|
|
11947
12344
|
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
11948
12345
|
message: check.message,
|
|
@@ -11953,7 +12350,7 @@ class ZodString extends ZodType {
|
|
|
11953
12350
|
else if (check.kind === "uuid") {
|
|
11954
12351
|
if (!uuidRegex.test(input.data)) {
|
|
11955
12352
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
11956
|
-
|
|
12353
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
11957
12354
|
validation: "uuid",
|
|
11958
12355
|
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
11959
12356
|
message: check.message,
|
|
@@ -11964,7 +12361,7 @@ class ZodString extends ZodType {
|
|
|
11964
12361
|
else if (check.kind === "cuid") {
|
|
11965
12362
|
if (!cuidRegex.test(input.data)) {
|
|
11966
12363
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
11967
|
-
|
|
12364
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
11968
12365
|
validation: "cuid",
|
|
11969
12366
|
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
11970
12367
|
message: check.message,
|
|
@@ -11978,7 +12375,7 @@ class ZodString extends ZodType {
|
|
|
11978
12375
|
}
|
|
11979
12376
|
catch (_a) {
|
|
11980
12377
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
11981
|
-
|
|
12378
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
11982
12379
|
validation: "url",
|
|
11983
12380
|
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
11984
12381
|
message: check.message,
|
|
@@ -11991,7 +12388,7 @@ class ZodString extends ZodType {
|
|
|
11991
12388
|
const testResult = check.regex.test(input.data);
|
|
11992
12389
|
if (!testResult) {
|
|
11993
12390
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
11994
|
-
|
|
12391
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
11995
12392
|
validation: "regex",
|
|
11996
12393
|
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
11997
12394
|
message: check.message,
|
|
@@ -11999,6 +12396,34 @@ class ZodString extends ZodType {
|
|
|
11999
12396
|
status.dirty();
|
|
12000
12397
|
}
|
|
12001
12398
|
}
|
|
12399
|
+
else if (check.kind === "trim") {
|
|
12400
|
+
input.data = input.data.trim();
|
|
12401
|
+
}
|
|
12402
|
+
else if (check.kind === "startsWith") {
|
|
12403
|
+
if (!input.data.startsWith(check.value)) {
|
|
12404
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
12405
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12406
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
12407
|
+
validation: { startsWith: check.value },
|
|
12408
|
+
message: check.message,
|
|
12409
|
+
});
|
|
12410
|
+
status.dirty();
|
|
12411
|
+
}
|
|
12412
|
+
}
|
|
12413
|
+
else if (check.kind === "endsWith") {
|
|
12414
|
+
if (!input.data.endsWith(check.value)) {
|
|
12415
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
12416
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12417
|
+
code: ZodError_1.ZodIssueCode.invalid_string,
|
|
12418
|
+
validation: { endsWith: check.value },
|
|
12419
|
+
message: check.message,
|
|
12420
|
+
});
|
|
12421
|
+
status.dirty();
|
|
12422
|
+
}
|
|
12423
|
+
}
|
|
12424
|
+
else {
|
|
12425
|
+
util_1.util.assertNever(check);
|
|
12426
|
+
}
|
|
12002
12427
|
}
|
|
12003
12428
|
return { status: status.value, value: input.data };
|
|
12004
12429
|
}
|
|
@@ -12027,6 +12452,20 @@ class ZodString extends ZodType {
|
|
|
12027
12452
|
...errorUtil_1.errorUtil.errToObj(message),
|
|
12028
12453
|
});
|
|
12029
12454
|
}
|
|
12455
|
+
startsWith(value, message) {
|
|
12456
|
+
return this._addCheck({
|
|
12457
|
+
kind: "startsWith",
|
|
12458
|
+
value: value,
|
|
12459
|
+
...errorUtil_1.errorUtil.errToObj(message),
|
|
12460
|
+
});
|
|
12461
|
+
}
|
|
12462
|
+
endsWith(value, message) {
|
|
12463
|
+
return this._addCheck({
|
|
12464
|
+
kind: "endsWith",
|
|
12465
|
+
value: value,
|
|
12466
|
+
...errorUtil_1.errorUtil.errToObj(message),
|
|
12467
|
+
});
|
|
12468
|
+
}
|
|
12030
12469
|
min(minLength, message) {
|
|
12031
12470
|
return this._addCheck({
|
|
12032
12471
|
kind: "min",
|
|
@@ -12057,25 +12496,23 @@ class ZodString extends ZodType {
|
|
|
12057
12496
|
return !!this._def.checks.find((ch) => ch.kind === "cuid");
|
|
12058
12497
|
}
|
|
12059
12498
|
get minLength() {
|
|
12060
|
-
let min =
|
|
12061
|
-
this._def.checks
|
|
12499
|
+
let min = null;
|
|
12500
|
+
for (const ch of this._def.checks) {
|
|
12062
12501
|
if (ch.kind === "min") {
|
|
12063
|
-
if (min === null || ch.value > min)
|
|
12502
|
+
if (min === null || ch.value > min)
|
|
12064
12503
|
min = ch.value;
|
|
12065
|
-
}
|
|
12066
12504
|
}
|
|
12067
|
-
}
|
|
12505
|
+
}
|
|
12068
12506
|
return min;
|
|
12069
12507
|
}
|
|
12070
12508
|
get maxLength() {
|
|
12071
12509
|
let max = null;
|
|
12072
|
-
this._def.checks
|
|
12510
|
+
for (const ch of this._def.checks) {
|
|
12073
12511
|
if (ch.kind === "max") {
|
|
12074
|
-
if (max === null || ch.value < max)
|
|
12512
|
+
if (max === null || ch.value < max)
|
|
12075
12513
|
max = ch.value;
|
|
12076
|
-
}
|
|
12077
12514
|
}
|
|
12078
|
-
}
|
|
12515
|
+
}
|
|
12079
12516
|
return max;
|
|
12080
12517
|
}
|
|
12081
12518
|
}
|
|
@@ -12105,11 +12542,11 @@ class ZodNumber extends ZodType {
|
|
|
12105
12542
|
}
|
|
12106
12543
|
_parse(input) {
|
|
12107
12544
|
const parsedType = this._getType(input);
|
|
12108
|
-
if (parsedType !==
|
|
12545
|
+
if (parsedType !== util_1.ZodParsedType.number) {
|
|
12109
12546
|
const ctx = this._getOrReturnCtx(input);
|
|
12110
|
-
|
|
12547
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12111
12548
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12112
|
-
expected:
|
|
12549
|
+
expected: util_1.ZodParsedType.number,
|
|
12113
12550
|
received: ctx.parsedType,
|
|
12114
12551
|
});
|
|
12115
12552
|
return parseUtil_1.INVALID;
|
|
@@ -12120,7 +12557,7 @@ class ZodNumber extends ZodType {
|
|
|
12120
12557
|
if (check.kind === "int") {
|
|
12121
12558
|
if (!util_1.util.isInteger(input.data)) {
|
|
12122
12559
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
12123
|
-
|
|
12560
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12124
12561
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12125
12562
|
expected: "integer",
|
|
12126
12563
|
received: "float",
|
|
@@ -12135,7 +12572,7 @@ class ZodNumber extends ZodType {
|
|
|
12135
12572
|
: input.data <= check.value;
|
|
12136
12573
|
if (tooSmall) {
|
|
12137
12574
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
12138
|
-
|
|
12575
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12139
12576
|
code: ZodError_1.ZodIssueCode.too_small,
|
|
12140
12577
|
minimum: check.value,
|
|
12141
12578
|
type: "number",
|
|
@@ -12151,7 +12588,7 @@ class ZodNumber extends ZodType {
|
|
|
12151
12588
|
: input.data >= check.value;
|
|
12152
12589
|
if (tooBig) {
|
|
12153
12590
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
12154
|
-
|
|
12591
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12155
12592
|
code: ZodError_1.ZodIssueCode.too_big,
|
|
12156
12593
|
maximum: check.value,
|
|
12157
12594
|
type: "number",
|
|
@@ -12164,7 +12601,7 @@ class ZodNumber extends ZodType {
|
|
|
12164
12601
|
else if (check.kind === "multipleOf") {
|
|
12165
12602
|
if (floatSafeRemainder(input.data, check.value) !== 0) {
|
|
12166
12603
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
12167
|
-
|
|
12604
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12168
12605
|
code: ZodError_1.ZodIssueCode.not_multiple_of,
|
|
12169
12606
|
multipleOf: check.value,
|
|
12170
12607
|
message: check.message,
|
|
@@ -12290,16 +12727,16 @@ ZodNumber.create = (params) => {
|
|
|
12290
12727
|
class ZodBigInt extends ZodType {
|
|
12291
12728
|
_parse(input) {
|
|
12292
12729
|
const parsedType = this._getType(input);
|
|
12293
|
-
if (parsedType !==
|
|
12730
|
+
if (parsedType !== util_1.ZodParsedType.bigint) {
|
|
12294
12731
|
const ctx = this._getOrReturnCtx(input);
|
|
12295
|
-
|
|
12732
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12296
12733
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12297
|
-
expected:
|
|
12734
|
+
expected: util_1.ZodParsedType.bigint,
|
|
12298
12735
|
received: ctx.parsedType,
|
|
12299
12736
|
});
|
|
12300
12737
|
return parseUtil_1.INVALID;
|
|
12301
12738
|
}
|
|
12302
|
-
return
|
|
12739
|
+
return parseUtil_1.OK(input.data);
|
|
12303
12740
|
}
|
|
12304
12741
|
}
|
|
12305
12742
|
exports.ZodBigInt = ZodBigInt;
|
|
@@ -12312,16 +12749,16 @@ ZodBigInt.create = (params) => {
|
|
|
12312
12749
|
class ZodBoolean extends ZodType {
|
|
12313
12750
|
_parse(input) {
|
|
12314
12751
|
const parsedType = this._getType(input);
|
|
12315
|
-
if (parsedType !==
|
|
12752
|
+
if (parsedType !== util_1.ZodParsedType.boolean) {
|
|
12316
12753
|
const ctx = this._getOrReturnCtx(input);
|
|
12317
|
-
|
|
12754
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12318
12755
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12319
|
-
expected:
|
|
12756
|
+
expected: util_1.ZodParsedType.boolean,
|
|
12320
12757
|
received: ctx.parsedType,
|
|
12321
12758
|
});
|
|
12322
12759
|
return parseUtil_1.INVALID;
|
|
12323
12760
|
}
|
|
12324
|
-
return
|
|
12761
|
+
return parseUtil_1.OK(input.data);
|
|
12325
12762
|
}
|
|
12326
12763
|
}
|
|
12327
12764
|
exports.ZodBoolean = ZodBoolean;
|
|
@@ -12334,31 +12771,105 @@ ZodBoolean.create = (params) => {
|
|
|
12334
12771
|
class ZodDate extends ZodType {
|
|
12335
12772
|
_parse(input) {
|
|
12336
12773
|
const parsedType = this._getType(input);
|
|
12337
|
-
if (parsedType !==
|
|
12774
|
+
if (parsedType !== util_1.ZodParsedType.date) {
|
|
12338
12775
|
const ctx = this._getOrReturnCtx(input);
|
|
12339
|
-
|
|
12776
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12340
12777
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12341
|
-
expected:
|
|
12778
|
+
expected: util_1.ZodParsedType.date,
|
|
12342
12779
|
received: ctx.parsedType,
|
|
12343
12780
|
});
|
|
12344
12781
|
return parseUtil_1.INVALID;
|
|
12345
12782
|
}
|
|
12346
12783
|
if (isNaN(input.data.getTime())) {
|
|
12347
12784
|
const ctx = this._getOrReturnCtx(input);
|
|
12348
|
-
|
|
12785
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12349
12786
|
code: ZodError_1.ZodIssueCode.invalid_date,
|
|
12350
12787
|
});
|
|
12351
12788
|
return parseUtil_1.INVALID;
|
|
12352
12789
|
}
|
|
12790
|
+
const status = new parseUtil_1.ParseStatus();
|
|
12791
|
+
let ctx = undefined;
|
|
12792
|
+
for (const check of this._def.checks) {
|
|
12793
|
+
if (check.kind === "min") {
|
|
12794
|
+
if (input.data.getTime() < check.value) {
|
|
12795
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
12796
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12797
|
+
code: ZodError_1.ZodIssueCode.too_small,
|
|
12798
|
+
message: check.message,
|
|
12799
|
+
inclusive: true,
|
|
12800
|
+
minimum: check.value,
|
|
12801
|
+
type: "date",
|
|
12802
|
+
});
|
|
12803
|
+
status.dirty();
|
|
12804
|
+
}
|
|
12805
|
+
}
|
|
12806
|
+
else if (check.kind === "max") {
|
|
12807
|
+
if (input.data.getTime() > check.value) {
|
|
12808
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
12809
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12810
|
+
code: ZodError_1.ZodIssueCode.too_big,
|
|
12811
|
+
message: check.message,
|
|
12812
|
+
inclusive: true,
|
|
12813
|
+
maximum: check.value,
|
|
12814
|
+
type: "date",
|
|
12815
|
+
});
|
|
12816
|
+
status.dirty();
|
|
12817
|
+
}
|
|
12818
|
+
}
|
|
12819
|
+
else {
|
|
12820
|
+
util_1.util.assertNever(check);
|
|
12821
|
+
}
|
|
12822
|
+
}
|
|
12353
12823
|
return {
|
|
12354
|
-
status:
|
|
12824
|
+
status: status.value,
|
|
12355
12825
|
value: new Date(input.data.getTime()),
|
|
12356
12826
|
};
|
|
12357
12827
|
}
|
|
12828
|
+
_addCheck(check) {
|
|
12829
|
+
return new ZodDate({
|
|
12830
|
+
...this._def,
|
|
12831
|
+
checks: [...this._def.checks, check],
|
|
12832
|
+
});
|
|
12833
|
+
}
|
|
12834
|
+
min(minDate, message) {
|
|
12835
|
+
return this._addCheck({
|
|
12836
|
+
kind: "min",
|
|
12837
|
+
value: minDate.getTime(),
|
|
12838
|
+
message: errorUtil_1.errorUtil.toString(message),
|
|
12839
|
+
});
|
|
12840
|
+
}
|
|
12841
|
+
max(maxDate, message) {
|
|
12842
|
+
return this._addCheck({
|
|
12843
|
+
kind: "max",
|
|
12844
|
+
value: maxDate.getTime(),
|
|
12845
|
+
message: errorUtil_1.errorUtil.toString(message),
|
|
12846
|
+
});
|
|
12847
|
+
}
|
|
12848
|
+
get minDate() {
|
|
12849
|
+
let min = null;
|
|
12850
|
+
for (const ch of this._def.checks) {
|
|
12851
|
+
if (ch.kind === "min") {
|
|
12852
|
+
if (min === null || ch.value > min)
|
|
12853
|
+
min = ch.value;
|
|
12854
|
+
}
|
|
12855
|
+
}
|
|
12856
|
+
return min != null ? new Date(min) : null;
|
|
12857
|
+
}
|
|
12858
|
+
get maxDate() {
|
|
12859
|
+
let max = null;
|
|
12860
|
+
for (const ch of this._def.checks) {
|
|
12861
|
+
if (ch.kind === "max") {
|
|
12862
|
+
if (max === null || ch.value < max)
|
|
12863
|
+
max = ch.value;
|
|
12864
|
+
}
|
|
12865
|
+
}
|
|
12866
|
+
return max != null ? new Date(max) : null;
|
|
12867
|
+
}
|
|
12358
12868
|
}
|
|
12359
12869
|
exports.ZodDate = ZodDate;
|
|
12360
12870
|
ZodDate.create = (params) => {
|
|
12361
12871
|
return new ZodDate({
|
|
12872
|
+
checks: [],
|
|
12362
12873
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
12363
12874
|
...processCreateParams(params),
|
|
12364
12875
|
});
|
|
@@ -12366,16 +12877,16 @@ ZodDate.create = (params) => {
|
|
|
12366
12877
|
class ZodUndefined extends ZodType {
|
|
12367
12878
|
_parse(input) {
|
|
12368
12879
|
const parsedType = this._getType(input);
|
|
12369
|
-
if (parsedType !==
|
|
12880
|
+
if (parsedType !== util_1.ZodParsedType.undefined) {
|
|
12370
12881
|
const ctx = this._getOrReturnCtx(input);
|
|
12371
|
-
|
|
12882
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12372
12883
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12373
|
-
expected:
|
|
12884
|
+
expected: util_1.ZodParsedType.undefined,
|
|
12374
12885
|
received: ctx.parsedType,
|
|
12375
12886
|
});
|
|
12376
12887
|
return parseUtil_1.INVALID;
|
|
12377
12888
|
}
|
|
12378
|
-
return
|
|
12889
|
+
return parseUtil_1.OK(input.data);
|
|
12379
12890
|
}
|
|
12380
12891
|
}
|
|
12381
12892
|
exports.ZodUndefined = ZodUndefined;
|
|
@@ -12388,16 +12899,16 @@ ZodUndefined.create = (params) => {
|
|
|
12388
12899
|
class ZodNull extends ZodType {
|
|
12389
12900
|
_parse(input) {
|
|
12390
12901
|
const parsedType = this._getType(input);
|
|
12391
|
-
if (parsedType !==
|
|
12902
|
+
if (parsedType !== util_1.ZodParsedType.null) {
|
|
12392
12903
|
const ctx = this._getOrReturnCtx(input);
|
|
12393
|
-
|
|
12904
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12394
12905
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12395
|
-
expected:
|
|
12906
|
+
expected: util_1.ZodParsedType.null,
|
|
12396
12907
|
received: ctx.parsedType,
|
|
12397
12908
|
});
|
|
12398
12909
|
return parseUtil_1.INVALID;
|
|
12399
12910
|
}
|
|
12400
|
-
return
|
|
12911
|
+
return parseUtil_1.OK(input.data);
|
|
12401
12912
|
}
|
|
12402
12913
|
}
|
|
12403
12914
|
exports.ZodNull = ZodNull;
|
|
@@ -12414,7 +12925,7 @@ class ZodAny extends ZodType {
|
|
|
12414
12925
|
this._any = true;
|
|
12415
12926
|
}
|
|
12416
12927
|
_parse(input) {
|
|
12417
|
-
return
|
|
12928
|
+
return parseUtil_1.OK(input.data);
|
|
12418
12929
|
}
|
|
12419
12930
|
}
|
|
12420
12931
|
exports.ZodAny = ZodAny;
|
|
@@ -12431,7 +12942,7 @@ class ZodUnknown extends ZodType {
|
|
|
12431
12942
|
this._unknown = true;
|
|
12432
12943
|
}
|
|
12433
12944
|
_parse(input) {
|
|
12434
|
-
return
|
|
12945
|
+
return parseUtil_1.OK(input.data);
|
|
12435
12946
|
}
|
|
12436
12947
|
}
|
|
12437
12948
|
exports.ZodUnknown = ZodUnknown;
|
|
@@ -12444,9 +12955,9 @@ ZodUnknown.create = (params) => {
|
|
|
12444
12955
|
class ZodNever extends ZodType {
|
|
12445
12956
|
_parse(input) {
|
|
12446
12957
|
const ctx = this._getOrReturnCtx(input);
|
|
12447
|
-
|
|
12958
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12448
12959
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12449
|
-
expected:
|
|
12960
|
+
expected: util_1.ZodParsedType.never,
|
|
12450
12961
|
received: ctx.parsedType,
|
|
12451
12962
|
});
|
|
12452
12963
|
return parseUtil_1.INVALID;
|
|
@@ -12462,16 +12973,16 @@ ZodNever.create = (params) => {
|
|
|
12462
12973
|
class ZodVoid extends ZodType {
|
|
12463
12974
|
_parse(input) {
|
|
12464
12975
|
const parsedType = this._getType(input);
|
|
12465
|
-
if (parsedType !==
|
|
12976
|
+
if (parsedType !== util_1.ZodParsedType.undefined) {
|
|
12466
12977
|
const ctx = this._getOrReturnCtx(input);
|
|
12467
|
-
|
|
12978
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12468
12979
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12469
|
-
expected:
|
|
12980
|
+
expected: util_1.ZodParsedType.void,
|
|
12470
12981
|
received: ctx.parsedType,
|
|
12471
12982
|
});
|
|
12472
12983
|
return parseUtil_1.INVALID;
|
|
12473
12984
|
}
|
|
12474
|
-
return
|
|
12985
|
+
return parseUtil_1.OK(input.data);
|
|
12475
12986
|
}
|
|
12476
12987
|
}
|
|
12477
12988
|
exports.ZodVoid = ZodVoid;
|
|
@@ -12485,17 +12996,17 @@ class ZodArray extends ZodType {
|
|
|
12485
12996
|
_parse(input) {
|
|
12486
12997
|
const { ctx, status } = this._processInputParams(input);
|
|
12487
12998
|
const def = this._def;
|
|
12488
|
-
if (ctx.parsedType !==
|
|
12489
|
-
|
|
12999
|
+
if (ctx.parsedType !== util_1.ZodParsedType.array) {
|
|
13000
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12490
13001
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12491
|
-
expected:
|
|
13002
|
+
expected: util_1.ZodParsedType.array,
|
|
12492
13003
|
received: ctx.parsedType,
|
|
12493
13004
|
});
|
|
12494
13005
|
return parseUtil_1.INVALID;
|
|
12495
13006
|
}
|
|
12496
13007
|
if (def.minLength !== null) {
|
|
12497
13008
|
if (ctx.data.length < def.minLength.value) {
|
|
12498
|
-
|
|
13009
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12499
13010
|
code: ZodError_1.ZodIssueCode.too_small,
|
|
12500
13011
|
minimum: def.minLength.value,
|
|
12501
13012
|
type: "array",
|
|
@@ -12507,7 +13018,7 @@ class ZodArray extends ZodType {
|
|
|
12507
13018
|
}
|
|
12508
13019
|
if (def.maxLength !== null) {
|
|
12509
13020
|
if (ctx.data.length > def.maxLength.value) {
|
|
12510
|
-
|
|
13021
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12511
13022
|
code: ZodError_1.ZodIssueCode.too_big,
|
|
12512
13023
|
maximum: def.maxLength.value,
|
|
12513
13024
|
type: "array",
|
|
@@ -12573,7 +13084,7 @@ var objectUtil;
|
|
|
12573
13084
|
objectUtil.mergeShapes = (first, second) => {
|
|
12574
13085
|
return {
|
|
12575
13086
|
...first,
|
|
12576
|
-
...second,
|
|
13087
|
+
...second,
|
|
12577
13088
|
};
|
|
12578
13089
|
};
|
|
12579
13090
|
})(objectUtil = exports.objectUtil || (exports.objectUtil = {}));
|
|
@@ -12635,19 +13146,23 @@ class ZodObject extends ZodType {
|
|
|
12635
13146
|
}
|
|
12636
13147
|
_parse(input) {
|
|
12637
13148
|
const parsedType = this._getType(input);
|
|
12638
|
-
if (parsedType !==
|
|
13149
|
+
if (parsedType !== util_1.ZodParsedType.object) {
|
|
12639
13150
|
const ctx = this._getOrReturnCtx(input);
|
|
12640
|
-
|
|
13151
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12641
13152
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12642
|
-
expected:
|
|
13153
|
+
expected: util_1.ZodParsedType.object,
|
|
12643
13154
|
received: ctx.parsedType,
|
|
12644
13155
|
});
|
|
12645
13156
|
return parseUtil_1.INVALID;
|
|
12646
13157
|
}
|
|
12647
13158
|
const { status, ctx } = this._processInputParams(input);
|
|
12648
13159
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
12649
|
-
const
|
|
12650
|
-
const
|
|
13160
|
+
const extraKeys = [];
|
|
13161
|
+
for (const key in ctx.data) {
|
|
13162
|
+
if (!shapeKeys.includes(key)) {
|
|
13163
|
+
extraKeys.push(key);
|
|
13164
|
+
}
|
|
13165
|
+
}
|
|
12651
13166
|
const pairs = [];
|
|
12652
13167
|
for (const key of shapeKeys) {
|
|
12653
13168
|
const keyValidator = shape[key];
|
|
@@ -12670,7 +13185,7 @@ class ZodObject extends ZodType {
|
|
|
12670
13185
|
}
|
|
12671
13186
|
else if (unknownKeys === "strict") {
|
|
12672
13187
|
if (extraKeys.length > 0) {
|
|
12673
|
-
|
|
13188
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12674
13189
|
code: ZodError_1.ZodIssueCode.unrecognized_keys,
|
|
12675
13190
|
keys: extraKeys,
|
|
12676
13191
|
});
|
|
@@ -12785,7 +13300,9 @@ class ZodObject extends ZodType {
|
|
|
12785
13300
|
pick(mask) {
|
|
12786
13301
|
const shape = {};
|
|
12787
13302
|
util_1.util.objectKeys(mask).map((key) => {
|
|
12788
|
-
shape
|
|
13303
|
+
// only add to shape if key corresponds to an element of the current shape
|
|
13304
|
+
if (this.shape[key])
|
|
13305
|
+
shape[key] = this.shape[key];
|
|
12789
13306
|
});
|
|
12790
13307
|
return new ZodObject({
|
|
12791
13308
|
...this._def,
|
|
@@ -12849,6 +13366,9 @@ class ZodObject extends ZodType {
|
|
|
12849
13366
|
shape: () => newShape,
|
|
12850
13367
|
});
|
|
12851
13368
|
}
|
|
13369
|
+
keyof() {
|
|
13370
|
+
return createZodEnum(util_1.util.objectKeys(this.shape));
|
|
13371
|
+
}
|
|
12852
13372
|
}
|
|
12853
13373
|
exports.ZodObject = ZodObject;
|
|
12854
13374
|
ZodObject.create = (shape, params) => {
|
|
@@ -12898,7 +13418,7 @@ class ZodUnion extends ZodType {
|
|
|
12898
13418
|
}
|
|
12899
13419
|
// return invalid
|
|
12900
13420
|
const unionErrors = results.map((result) => new ZodError_1.ZodError(result.ctx.common.issues));
|
|
12901
|
-
|
|
13421
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12902
13422
|
code: ZodError_1.ZodIssueCode.invalid_union,
|
|
12903
13423
|
unionErrors,
|
|
12904
13424
|
});
|
|
@@ -12956,7 +13476,7 @@ class ZodUnion extends ZodType {
|
|
|
12956
13476
|
return dirty.result;
|
|
12957
13477
|
}
|
|
12958
13478
|
const unionErrors = issues.map((issues) => new ZodError_1.ZodError(issues));
|
|
12959
|
-
|
|
13479
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12960
13480
|
code: ZodError_1.ZodIssueCode.invalid_union,
|
|
12961
13481
|
unionErrors,
|
|
12962
13482
|
});
|
|
@@ -12978,10 +13498,10 @@ ZodUnion.create = (types, params) => {
|
|
|
12978
13498
|
class ZodDiscriminatedUnion extends ZodType {
|
|
12979
13499
|
_parse(input) {
|
|
12980
13500
|
const { ctx } = this._processInputParams(input);
|
|
12981
|
-
if (ctx.parsedType !==
|
|
12982
|
-
|
|
13501
|
+
if (ctx.parsedType !== util_1.ZodParsedType.object) {
|
|
13502
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12983
13503
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
12984
|
-
expected:
|
|
13504
|
+
expected: util_1.ZodParsedType.object,
|
|
12985
13505
|
received: ctx.parsedType,
|
|
12986
13506
|
});
|
|
12987
13507
|
return parseUtil_1.INVALID;
|
|
@@ -12990,7 +13510,7 @@ class ZodDiscriminatedUnion extends ZodType {
|
|
|
12990
13510
|
const discriminatorValue = ctx.data[discriminator];
|
|
12991
13511
|
const option = this.options.get(discriminatorValue);
|
|
12992
13512
|
if (!option) {
|
|
12993
|
-
|
|
13513
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
12994
13514
|
code: ZodError_1.ZodIssueCode.invalid_union_discriminator,
|
|
12995
13515
|
options: this.validDiscriminatorValues,
|
|
12996
13516
|
path: [discriminator],
|
|
@@ -13055,12 +13575,12 @@ class ZodDiscriminatedUnion extends ZodType {
|
|
|
13055
13575
|
}
|
|
13056
13576
|
exports.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
|
|
13057
13577
|
function mergeValues(a, b) {
|
|
13058
|
-
const aType =
|
|
13059
|
-
const bType =
|
|
13578
|
+
const aType = util_1.getParsedType(a);
|
|
13579
|
+
const bType = util_1.getParsedType(b);
|
|
13060
13580
|
if (a === b) {
|
|
13061
13581
|
return { valid: true, data: a };
|
|
13062
13582
|
}
|
|
13063
|
-
else if (aType ===
|
|
13583
|
+
else if (aType === util_1.ZodParsedType.object && bType === util_1.ZodParsedType.object) {
|
|
13064
13584
|
const bKeys = util_1.util.objectKeys(b);
|
|
13065
13585
|
const sharedKeys = util_1.util
|
|
13066
13586
|
.objectKeys(a)
|
|
@@ -13075,7 +13595,7 @@ function mergeValues(a, b) {
|
|
|
13075
13595
|
}
|
|
13076
13596
|
return { valid: true, data: newObj };
|
|
13077
13597
|
}
|
|
13078
|
-
else if (aType ===
|
|
13598
|
+
else if (aType === util_1.ZodParsedType.array && bType === util_1.ZodParsedType.array) {
|
|
13079
13599
|
if (a.length !== b.length) {
|
|
13080
13600
|
return { valid: false };
|
|
13081
13601
|
}
|
|
@@ -13091,8 +13611,8 @@ function mergeValues(a, b) {
|
|
|
13091
13611
|
}
|
|
13092
13612
|
return { valid: true, data: newArray };
|
|
13093
13613
|
}
|
|
13094
|
-
else if (aType ===
|
|
13095
|
-
bType ===
|
|
13614
|
+
else if (aType === util_1.ZodParsedType.date &&
|
|
13615
|
+
bType === util_1.ZodParsedType.date &&
|
|
13096
13616
|
+a === +b) {
|
|
13097
13617
|
return { valid: true, data: a };
|
|
13098
13618
|
}
|
|
@@ -13104,17 +13624,17 @@ class ZodIntersection extends ZodType {
|
|
|
13104
13624
|
_parse(input) {
|
|
13105
13625
|
const { status, ctx } = this._processInputParams(input);
|
|
13106
13626
|
const handleParsed = (parsedLeft, parsedRight) => {
|
|
13107
|
-
if (
|
|
13627
|
+
if (parseUtil_1.isAborted(parsedLeft) || parseUtil_1.isAborted(parsedRight)) {
|
|
13108
13628
|
return parseUtil_1.INVALID;
|
|
13109
13629
|
}
|
|
13110
13630
|
const merged = mergeValues(parsedLeft.value, parsedRight.value);
|
|
13111
13631
|
if (!merged.valid) {
|
|
13112
|
-
|
|
13632
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13113
13633
|
code: ZodError_1.ZodIssueCode.invalid_intersection_types,
|
|
13114
13634
|
});
|
|
13115
13635
|
return parseUtil_1.INVALID;
|
|
13116
13636
|
}
|
|
13117
|
-
if (
|
|
13637
|
+
if (parseUtil_1.isDirty(parsedLeft) || parseUtil_1.isDirty(parsedRight)) {
|
|
13118
13638
|
status.dirty();
|
|
13119
13639
|
}
|
|
13120
13640
|
return { status: status.value, value: merged.data };
|
|
@@ -13158,16 +13678,16 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
13158
13678
|
class ZodTuple extends ZodType {
|
|
13159
13679
|
_parse(input) {
|
|
13160
13680
|
const { status, ctx } = this._processInputParams(input);
|
|
13161
|
-
if (ctx.parsedType !==
|
|
13162
|
-
|
|
13681
|
+
if (ctx.parsedType !== util_1.ZodParsedType.array) {
|
|
13682
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13163
13683
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
13164
|
-
expected:
|
|
13684
|
+
expected: util_1.ZodParsedType.array,
|
|
13165
13685
|
received: ctx.parsedType,
|
|
13166
13686
|
});
|
|
13167
13687
|
return parseUtil_1.INVALID;
|
|
13168
13688
|
}
|
|
13169
13689
|
if (ctx.data.length < this._def.items.length) {
|
|
13170
|
-
|
|
13690
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13171
13691
|
code: ZodError_1.ZodIssueCode.too_small,
|
|
13172
13692
|
minimum: this._def.items.length,
|
|
13173
13693
|
inclusive: true,
|
|
@@ -13177,7 +13697,7 @@ class ZodTuple extends ZodType {
|
|
|
13177
13697
|
}
|
|
13178
13698
|
const rest = this._def.rest;
|
|
13179
13699
|
if (!rest && ctx.data.length > this._def.items.length) {
|
|
13180
|
-
|
|
13700
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13181
13701
|
code: ZodError_1.ZodIssueCode.too_big,
|
|
13182
13702
|
maximum: this._def.items.length,
|
|
13183
13703
|
inclusive: true,
|
|
@@ -13230,10 +13750,10 @@ class ZodRecord extends ZodType {
|
|
|
13230
13750
|
}
|
|
13231
13751
|
_parse(input) {
|
|
13232
13752
|
const { status, ctx } = this._processInputParams(input);
|
|
13233
|
-
if (ctx.parsedType !==
|
|
13234
|
-
|
|
13753
|
+
if (ctx.parsedType !== util_1.ZodParsedType.object) {
|
|
13754
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13235
13755
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
13236
|
-
expected:
|
|
13756
|
+
expected: util_1.ZodParsedType.object,
|
|
13237
13757
|
received: ctx.parsedType,
|
|
13238
13758
|
});
|
|
13239
13759
|
return parseUtil_1.INVALID;
|
|
@@ -13278,10 +13798,10 @@ exports.ZodRecord = ZodRecord;
|
|
|
13278
13798
|
class ZodMap extends ZodType {
|
|
13279
13799
|
_parse(input) {
|
|
13280
13800
|
const { status, ctx } = this._processInputParams(input);
|
|
13281
|
-
if (ctx.parsedType !==
|
|
13282
|
-
|
|
13801
|
+
if (ctx.parsedType !== util_1.ZodParsedType.map) {
|
|
13802
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13283
13803
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
13284
|
-
expected:
|
|
13804
|
+
expected: util_1.ZodParsedType.map,
|
|
13285
13805
|
received: ctx.parsedType,
|
|
13286
13806
|
});
|
|
13287
13807
|
return parseUtil_1.INVALID;
|
|
@@ -13340,10 +13860,10 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
13340
13860
|
class ZodSet extends ZodType {
|
|
13341
13861
|
_parse(input) {
|
|
13342
13862
|
const { status, ctx } = this._processInputParams(input);
|
|
13343
|
-
if (ctx.parsedType !==
|
|
13344
|
-
|
|
13863
|
+
if (ctx.parsedType !== util_1.ZodParsedType.set) {
|
|
13864
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13345
13865
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
13346
|
-
expected:
|
|
13866
|
+
expected: util_1.ZodParsedType.set,
|
|
13347
13867
|
received: ctx.parsedType,
|
|
13348
13868
|
});
|
|
13349
13869
|
return parseUtil_1.INVALID;
|
|
@@ -13351,7 +13871,7 @@ class ZodSet extends ZodType {
|
|
|
13351
13871
|
const def = this._def;
|
|
13352
13872
|
if (def.minSize !== null) {
|
|
13353
13873
|
if (ctx.data.size < def.minSize.value) {
|
|
13354
|
-
|
|
13874
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13355
13875
|
code: ZodError_1.ZodIssueCode.too_small,
|
|
13356
13876
|
minimum: def.minSize.value,
|
|
13357
13877
|
type: "set",
|
|
@@ -13363,7 +13883,7 @@ class ZodSet extends ZodType {
|
|
|
13363
13883
|
}
|
|
13364
13884
|
if (def.maxSize !== null) {
|
|
13365
13885
|
if (ctx.data.size > def.maxSize.value) {
|
|
13366
|
-
|
|
13886
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13367
13887
|
code: ZodError_1.ZodIssueCode.too_big,
|
|
13368
13888
|
maximum: def.maxSize.value,
|
|
13369
13889
|
type: "set",
|
|
@@ -13429,22 +13949,22 @@ class ZodFunction extends ZodType {
|
|
|
13429
13949
|
}
|
|
13430
13950
|
_parse(input) {
|
|
13431
13951
|
const { ctx } = this._processInputParams(input);
|
|
13432
|
-
if (ctx.parsedType !==
|
|
13433
|
-
|
|
13952
|
+
if (ctx.parsedType !== util_1.ZodParsedType.function) {
|
|
13953
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13434
13954
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
13435
|
-
expected:
|
|
13955
|
+
expected: util_1.ZodParsedType.function,
|
|
13436
13956
|
received: ctx.parsedType,
|
|
13437
13957
|
});
|
|
13438
13958
|
return parseUtil_1.INVALID;
|
|
13439
13959
|
}
|
|
13440
13960
|
function makeArgsIssue(args, error) {
|
|
13441
|
-
return
|
|
13961
|
+
return parseUtil_1.makeIssue({
|
|
13442
13962
|
data: args,
|
|
13443
13963
|
path: ctx.path,
|
|
13444
13964
|
errorMaps: [
|
|
13445
13965
|
ctx.common.contextualErrorMap,
|
|
13446
13966
|
ctx.schemaErrorMap,
|
|
13447
|
-
ZodError_1.
|
|
13967
|
+
ZodError_1.getErrorMap(),
|
|
13448
13968
|
ZodError_1.defaultErrorMap,
|
|
13449
13969
|
].filter((x) => !!x),
|
|
13450
13970
|
issueData: {
|
|
@@ -13454,13 +13974,13 @@ class ZodFunction extends ZodType {
|
|
|
13454
13974
|
});
|
|
13455
13975
|
}
|
|
13456
13976
|
function makeReturnsIssue(returns, error) {
|
|
13457
|
-
return
|
|
13977
|
+
return parseUtil_1.makeIssue({
|
|
13458
13978
|
data: returns,
|
|
13459
13979
|
path: ctx.path,
|
|
13460
13980
|
errorMaps: [
|
|
13461
13981
|
ctx.common.contextualErrorMap,
|
|
13462
13982
|
ctx.schemaErrorMap,
|
|
13463
|
-
ZodError_1.
|
|
13983
|
+
ZodError_1.getErrorMap(),
|
|
13464
13984
|
ZodError_1.defaultErrorMap,
|
|
13465
13985
|
].filter((x) => !!x),
|
|
13466
13986
|
issueData: {
|
|
@@ -13472,7 +13992,7 @@ class ZodFunction extends ZodType {
|
|
|
13472
13992
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
13473
13993
|
const fn = ctx.data;
|
|
13474
13994
|
if (this._def.returns instanceof ZodPromise) {
|
|
13475
|
-
return
|
|
13995
|
+
return parseUtil_1.OK(async (...args) => {
|
|
13476
13996
|
const error = new ZodError_1.ZodError([]);
|
|
13477
13997
|
const parsedArgs = await this._def.args
|
|
13478
13998
|
.parseAsync(args, params)
|
|
@@ -13491,7 +14011,7 @@ class ZodFunction extends ZodType {
|
|
|
13491
14011
|
});
|
|
13492
14012
|
}
|
|
13493
14013
|
else {
|
|
13494
|
-
return
|
|
14014
|
+
return parseUtil_1.OK((...args) => {
|
|
13495
14015
|
const parsedArgs = this._def.args.safeParse(args, params);
|
|
13496
14016
|
if (!parsedArgs.success) {
|
|
13497
14017
|
throw new ZodError_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
@@ -13565,10 +14085,9 @@ class ZodLiteral extends ZodType {
|
|
|
13565
14085
|
_parse(input) {
|
|
13566
14086
|
if (input.data !== this._def.value) {
|
|
13567
14087
|
const ctx = this._getOrReturnCtx(input);
|
|
13568
|
-
|
|
13569
|
-
code: ZodError_1.ZodIssueCode.
|
|
13570
|
-
expected:
|
|
13571
|
-
received: ctx.parsedType,
|
|
14088
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
14089
|
+
code: ZodError_1.ZodIssueCode.invalid_literal,
|
|
14090
|
+
expected: this._def.value,
|
|
13572
14091
|
});
|
|
13573
14092
|
return parseUtil_1.INVALID;
|
|
13574
14093
|
}
|
|
@@ -13586,23 +14105,36 @@ ZodLiteral.create = (value, params) => {
|
|
|
13586
14105
|
...processCreateParams(params),
|
|
13587
14106
|
});
|
|
13588
14107
|
};
|
|
13589
|
-
function createZodEnum(values) {
|
|
14108
|
+
function createZodEnum(values, params) {
|
|
13590
14109
|
return new ZodEnum({
|
|
13591
14110
|
values: values,
|
|
13592
14111
|
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
|
14112
|
+
...processCreateParams(params),
|
|
13593
14113
|
});
|
|
13594
14114
|
}
|
|
13595
14115
|
class ZodEnum extends ZodType {
|
|
13596
14116
|
_parse(input) {
|
|
14117
|
+
if (typeof input.data !== "string") {
|
|
14118
|
+
const ctx = this._getOrReturnCtx(input);
|
|
14119
|
+
const expectedValues = this._def.values;
|
|
14120
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
14121
|
+
expected: util_1.util.joinValues(expectedValues),
|
|
14122
|
+
received: ctx.parsedType,
|
|
14123
|
+
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
14124
|
+
});
|
|
14125
|
+
return parseUtil_1.INVALID;
|
|
14126
|
+
}
|
|
13597
14127
|
if (this._def.values.indexOf(input.data) === -1) {
|
|
13598
14128
|
const ctx = this._getOrReturnCtx(input);
|
|
13599
|
-
|
|
14129
|
+
const expectedValues = this._def.values;
|
|
14130
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
14131
|
+
received: ctx.data,
|
|
13600
14132
|
code: ZodError_1.ZodIssueCode.invalid_enum_value,
|
|
13601
|
-
options:
|
|
14133
|
+
options: expectedValues,
|
|
13602
14134
|
});
|
|
13603
14135
|
return parseUtil_1.INVALID;
|
|
13604
14136
|
}
|
|
13605
|
-
return
|
|
14137
|
+
return parseUtil_1.OK(input.data);
|
|
13606
14138
|
}
|
|
13607
14139
|
get options() {
|
|
13608
14140
|
return this._def.values;
|
|
@@ -13634,15 +14166,27 @@ ZodEnum.create = createZodEnum;
|
|
|
13634
14166
|
class ZodNativeEnum extends ZodType {
|
|
13635
14167
|
_parse(input) {
|
|
13636
14168
|
const nativeEnumValues = util_1.util.getValidEnumValues(this._def.values);
|
|
14169
|
+
const ctx = this._getOrReturnCtx(input);
|
|
14170
|
+
if (ctx.parsedType !== util_1.ZodParsedType.string &&
|
|
14171
|
+
ctx.parsedType !== util_1.ZodParsedType.number) {
|
|
14172
|
+
const expectedValues = util_1.util.objectValues(nativeEnumValues);
|
|
14173
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
14174
|
+
expected: util_1.util.joinValues(expectedValues),
|
|
14175
|
+
received: ctx.parsedType,
|
|
14176
|
+
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
14177
|
+
});
|
|
14178
|
+
return parseUtil_1.INVALID;
|
|
14179
|
+
}
|
|
13637
14180
|
if (nativeEnumValues.indexOf(input.data) === -1) {
|
|
13638
|
-
const
|
|
13639
|
-
|
|
14181
|
+
const expectedValues = util_1.util.objectValues(nativeEnumValues);
|
|
14182
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
14183
|
+
received: ctx.data,
|
|
13640
14184
|
code: ZodError_1.ZodIssueCode.invalid_enum_value,
|
|
13641
|
-
options:
|
|
14185
|
+
options: expectedValues,
|
|
13642
14186
|
});
|
|
13643
14187
|
return parseUtil_1.INVALID;
|
|
13644
14188
|
}
|
|
13645
|
-
return
|
|
14189
|
+
return parseUtil_1.OK(input.data);
|
|
13646
14190
|
}
|
|
13647
14191
|
get enum() {
|
|
13648
14192
|
return this._def.values;
|
|
@@ -13659,19 +14203,19 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
13659
14203
|
class ZodPromise extends ZodType {
|
|
13660
14204
|
_parse(input) {
|
|
13661
14205
|
const { ctx } = this._processInputParams(input);
|
|
13662
|
-
if (ctx.parsedType !==
|
|
14206
|
+
if (ctx.parsedType !== util_1.ZodParsedType.promise &&
|
|
13663
14207
|
ctx.common.async === false) {
|
|
13664
|
-
|
|
14208
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13665
14209
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
13666
|
-
expected:
|
|
14210
|
+
expected: util_1.ZodParsedType.promise,
|
|
13667
14211
|
received: ctx.parsedType,
|
|
13668
14212
|
});
|
|
13669
14213
|
return parseUtil_1.INVALID;
|
|
13670
14214
|
}
|
|
13671
|
-
const promisified = ctx.parsedType ===
|
|
14215
|
+
const promisified = ctx.parsedType === util_1.ZodParsedType.promise
|
|
13672
14216
|
? ctx.data
|
|
13673
14217
|
: Promise.resolve(ctx.data);
|
|
13674
|
-
return
|
|
14218
|
+
return parseUtil_1.OK(promisified.then((data) => {
|
|
13675
14219
|
return this._def.type.parseAsync(data, {
|
|
13676
14220
|
path: ctx.path,
|
|
13677
14221
|
errorMap: ctx.common.contextualErrorMap,
|
|
@@ -13713,22 +14257,22 @@ class ZodEffects extends ZodType {
|
|
|
13713
14257
|
});
|
|
13714
14258
|
}
|
|
13715
14259
|
}
|
|
14260
|
+
const checkCtx = {
|
|
14261
|
+
addIssue: (arg) => {
|
|
14262
|
+
parseUtil_1.addIssueToContext(ctx, arg);
|
|
14263
|
+
if (arg.fatal) {
|
|
14264
|
+
status.abort();
|
|
14265
|
+
}
|
|
14266
|
+
else {
|
|
14267
|
+
status.dirty();
|
|
14268
|
+
}
|
|
14269
|
+
},
|
|
14270
|
+
get path() {
|
|
14271
|
+
return ctx.path;
|
|
14272
|
+
},
|
|
14273
|
+
};
|
|
14274
|
+
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
13716
14275
|
if (effect.type === "refinement") {
|
|
13717
|
-
const checkCtx = {
|
|
13718
|
-
addIssue: (arg) => {
|
|
13719
|
-
(0, parseUtil_1.addIssueToContext)(ctx, arg);
|
|
13720
|
-
if (arg.fatal) {
|
|
13721
|
-
status.abort();
|
|
13722
|
-
}
|
|
13723
|
-
else {
|
|
13724
|
-
status.dirty();
|
|
13725
|
-
}
|
|
13726
|
-
},
|
|
13727
|
-
get path() {
|
|
13728
|
-
return ctx.path;
|
|
13729
|
-
},
|
|
13730
|
-
};
|
|
13731
|
-
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
13732
14276
|
const executeRefinement = (acc
|
|
13733
14277
|
// effect: RefinementEffect<any>
|
|
13734
14278
|
) => {
|
|
@@ -13780,25 +14324,25 @@ class ZodEffects extends ZodType {
|
|
|
13780
14324
|
// if (base.status === "dirty") {
|
|
13781
14325
|
// return { status: "dirty", value: base.value };
|
|
13782
14326
|
// }
|
|
13783
|
-
if (!
|
|
14327
|
+
if (!parseUtil_1.isValid(base))
|
|
13784
14328
|
return base;
|
|
13785
|
-
const result = effect.transform(base.value);
|
|
14329
|
+
const result = effect.transform(base.value, checkCtx);
|
|
13786
14330
|
if (result instanceof Promise) {
|
|
13787
14331
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
13788
14332
|
}
|
|
13789
|
-
return
|
|
14333
|
+
return { status: status.value, value: result };
|
|
13790
14334
|
}
|
|
13791
14335
|
else {
|
|
13792
14336
|
return this._def.schema
|
|
13793
14337
|
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
13794
14338
|
.then((base) => {
|
|
13795
|
-
if (!
|
|
14339
|
+
if (!parseUtil_1.isValid(base))
|
|
13796
14340
|
return base;
|
|
13797
14341
|
// if (base.status === "aborted") return INVALID;
|
|
13798
14342
|
// if (base.status === "dirty") {
|
|
13799
14343
|
// return { status: "dirty", value: base.value };
|
|
13800
14344
|
// }
|
|
13801
|
-
return Promise.resolve(effect.transform(base.value)).then(
|
|
14345
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
|
|
13802
14346
|
});
|
|
13803
14347
|
}
|
|
13804
14348
|
}
|
|
@@ -13826,8 +14370,8 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
13826
14370
|
class ZodOptional extends ZodType {
|
|
13827
14371
|
_parse(input) {
|
|
13828
14372
|
const parsedType = this._getType(input);
|
|
13829
|
-
if (parsedType ===
|
|
13830
|
-
return
|
|
14373
|
+
if (parsedType === util_1.ZodParsedType.undefined) {
|
|
14374
|
+
return parseUtil_1.OK(undefined);
|
|
13831
14375
|
}
|
|
13832
14376
|
return this._def.innerType._parse(input);
|
|
13833
14377
|
}
|
|
@@ -13846,8 +14390,8 @@ ZodOptional.create = (type, params) => {
|
|
|
13846
14390
|
class ZodNullable extends ZodType {
|
|
13847
14391
|
_parse(input) {
|
|
13848
14392
|
const parsedType = this._getType(input);
|
|
13849
|
-
if (parsedType ===
|
|
13850
|
-
return
|
|
14393
|
+
if (parsedType === util_1.ZodParsedType.null) {
|
|
14394
|
+
return parseUtil_1.OK(null);
|
|
13851
14395
|
}
|
|
13852
14396
|
return this._def.innerType._parse(input);
|
|
13853
14397
|
}
|
|
@@ -13867,7 +14411,7 @@ class ZodDefault extends ZodType {
|
|
|
13867
14411
|
_parse(input) {
|
|
13868
14412
|
const { ctx } = this._processInputParams(input);
|
|
13869
14413
|
let data = ctx.data;
|
|
13870
|
-
if (ctx.parsedType ===
|
|
14414
|
+
if (ctx.parsedType === util_1.ZodParsedType.undefined) {
|
|
13871
14415
|
data = this._def.defaultValue();
|
|
13872
14416
|
}
|
|
13873
14417
|
return this._def.innerType._parse({
|
|
@@ -13891,11 +14435,11 @@ ZodDefault.create = (type, params) => {
|
|
|
13891
14435
|
class ZodNaN extends ZodType {
|
|
13892
14436
|
_parse(input) {
|
|
13893
14437
|
const parsedType = this._getType(input);
|
|
13894
|
-
if (parsedType !==
|
|
14438
|
+
if (parsedType !== util_1.ZodParsedType.nan) {
|
|
13895
14439
|
const ctx = this._getOrReturnCtx(input);
|
|
13896
|
-
|
|
14440
|
+
parseUtil_1.addIssueToContext(ctx, {
|
|
13897
14441
|
code: ZodError_1.ZodIssueCode.invalid_type,
|
|
13898
|
-
expected:
|
|
14442
|
+
expected: util_1.ZodParsedType.nan,
|
|
13899
14443
|
received: ctx.parsedType,
|
|
13900
14444
|
});
|
|
13901
14445
|
return parseUtil_1.INVALID;
|
|
@@ -13910,9 +14454,31 @@ ZodNaN.create = (params) => {
|
|
|
13910
14454
|
...processCreateParams(params),
|
|
13911
14455
|
});
|
|
13912
14456
|
};
|
|
13913
|
-
|
|
14457
|
+
exports.BRAND = Symbol("zod_brand");
|
|
14458
|
+
class ZodBranded extends ZodType {
|
|
14459
|
+
_parse(input) {
|
|
14460
|
+
const { ctx } = this._processInputParams(input);
|
|
14461
|
+
const data = ctx.data;
|
|
14462
|
+
return this._def.type._parse({
|
|
14463
|
+
data,
|
|
14464
|
+
path: ctx.path,
|
|
14465
|
+
parent: ctx,
|
|
14466
|
+
});
|
|
14467
|
+
}
|
|
14468
|
+
unwrap() {
|
|
14469
|
+
return this._def.type;
|
|
14470
|
+
}
|
|
14471
|
+
}
|
|
14472
|
+
exports.ZodBranded = ZodBranded;
|
|
14473
|
+
const custom = (check, params = {}, fatal) => {
|
|
13914
14474
|
if (check)
|
|
13915
|
-
return ZodAny.create().
|
|
14475
|
+
return ZodAny.create().superRefine((data, ctx) => {
|
|
14476
|
+
if (!check(data)) {
|
|
14477
|
+
const p = typeof params === "function" ? params(data) : params;
|
|
14478
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
14479
|
+
ctx.addIssue({ code: "custom", ...p2, fatal });
|
|
14480
|
+
}
|
|
14481
|
+
});
|
|
13916
14482
|
return ZodAny.create();
|
|
13917
14483
|
};
|
|
13918
14484
|
exports.custom = custom;
|
|
@@ -13952,10 +14518,11 @@ var ZodFirstPartyTypeKind;
|
|
|
13952
14518
|
ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
|
|
13953
14519
|
ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
|
|
13954
14520
|
ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
|
|
14521
|
+
ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
|
|
13955
14522
|
})(ZodFirstPartyTypeKind = exports.ZodFirstPartyTypeKind || (exports.ZodFirstPartyTypeKind = {}));
|
|
13956
14523
|
const instanceOfType = (cls, params = {
|
|
13957
14524
|
message: `Input not instance of ${cls.name}`,
|
|
13958
|
-
}) =>
|
|
14525
|
+
}) => exports.custom((data) => data instanceof cls, params, true);
|
|
13959
14526
|
exports["instanceof"] = instanceOfType;
|
|
13960
14527
|
const stringType = ZodString.create;
|
|
13961
14528
|
exports.string = stringType;
|
|
@@ -14030,98 +14597,6 @@ const oboolean = () => booleanType().optional();
|
|
|
14030
14597
|
exports.oboolean = oboolean;
|
|
14031
14598
|
|
|
14032
14599
|
|
|
14033
|
-
/***/ }),
|
|
14034
|
-
|
|
14035
|
-
/***/ 7271:
|
|
14036
|
-
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
14037
|
-
|
|
14038
|
-
"use strict";
|
|
14039
|
-
|
|
14040
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14041
|
-
if (k2 === undefined) k2 = k;
|
|
14042
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14043
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14044
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14045
|
-
}
|
|
14046
|
-
Object.defineProperty(o, k2, desc);
|
|
14047
|
-
}) : (function(o, m, k, k2) {
|
|
14048
|
-
if (k2 === undefined) k2 = k;
|
|
14049
|
-
o[k2] = m[k];
|
|
14050
|
-
}));
|
|
14051
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14052
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
14053
|
-
};
|
|
14054
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14055
|
-
exports.validateConfig = void 0;
|
|
14056
|
-
const types_1 = __nccwpck_require__(1523);
|
|
14057
|
-
__exportStar(__nccwpck_require__(1523), exports);
|
|
14058
|
-
function validateConfig(config, guard) {
|
|
14059
|
-
const result = guard.safeParse(config);
|
|
14060
|
-
if (!result.success) {
|
|
14061
|
-
throw new types_1.ConnectorError(types_1.ConnectorErrorCodes.InvalidConfig, result.error);
|
|
14062
|
-
}
|
|
14063
|
-
}
|
|
14064
|
-
exports.validateConfig = validateConfig;
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
/***/ }),
|
|
14068
|
-
|
|
14069
|
-
/***/ 1523:
|
|
14070
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
14071
|
-
|
|
14072
|
-
"use strict";
|
|
14073
|
-
|
|
14074
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14075
|
-
exports.messageTypesGuard = exports.MessageTypes = exports.ConnectorError = exports.ConnectorErrorCodes = exports.ConnectorPlatform = exports.ConnectorType = void 0;
|
|
14076
|
-
const zod_1 = __nccwpck_require__(4786);
|
|
14077
|
-
// MARK: Foundation
|
|
14078
|
-
var ConnectorType;
|
|
14079
|
-
(function (ConnectorType) {
|
|
14080
|
-
ConnectorType["Email"] = "Email";
|
|
14081
|
-
ConnectorType["Sms"] = "Sms";
|
|
14082
|
-
ConnectorType["Social"] = "Social";
|
|
14083
|
-
})(ConnectorType = exports.ConnectorType || (exports.ConnectorType = {}));
|
|
14084
|
-
var ConnectorPlatform;
|
|
14085
|
-
(function (ConnectorPlatform) {
|
|
14086
|
-
ConnectorPlatform["Native"] = "Native";
|
|
14087
|
-
ConnectorPlatform["Universal"] = "Universal";
|
|
14088
|
-
ConnectorPlatform["Web"] = "Web";
|
|
14089
|
-
})(ConnectorPlatform = exports.ConnectorPlatform || (exports.ConnectorPlatform = {}));
|
|
14090
|
-
var ConnectorErrorCodes;
|
|
14091
|
-
(function (ConnectorErrorCodes) {
|
|
14092
|
-
ConnectorErrorCodes["General"] = "general";
|
|
14093
|
-
ConnectorErrorCodes["InvalidMetadata"] = "invalid_metadata";
|
|
14094
|
-
ConnectorErrorCodes["UnexpectedType"] = "unexpected_type";
|
|
14095
|
-
ConnectorErrorCodes["InvalidConfigGuard"] = "invalid_config_guard";
|
|
14096
|
-
ConnectorErrorCodes["InsufficientRequestParameters"] = "insufficient_request_parameters";
|
|
14097
|
-
ConnectorErrorCodes["InvalidConfig"] = "invalid_config";
|
|
14098
|
-
ConnectorErrorCodes["InvalidResponse"] = "invalid_response";
|
|
14099
|
-
ConnectorErrorCodes["TemplateNotFound"] = "template_not_found";
|
|
14100
|
-
ConnectorErrorCodes["NotImplemented"] = "not_implemented";
|
|
14101
|
-
ConnectorErrorCodes["SocialAuthCodeInvalid"] = "social_auth_code_invalid";
|
|
14102
|
-
ConnectorErrorCodes["SocialAccessTokenInvalid"] = "social_invalid_access_token";
|
|
14103
|
-
ConnectorErrorCodes["SocialIdTokenInvalid"] = "social_invalid_id_token";
|
|
14104
|
-
ConnectorErrorCodes["AuthorizationFailed"] = "authorization_failed";
|
|
14105
|
-
})(ConnectorErrorCodes = exports.ConnectorErrorCodes || (exports.ConnectorErrorCodes = {}));
|
|
14106
|
-
class ConnectorError extends Error {
|
|
14107
|
-
constructor(code, data) {
|
|
14108
|
-
const message = typeof data === 'string' ? data : 'Connector error occurred.';
|
|
14109
|
-
super(message);
|
|
14110
|
-
this.code = code;
|
|
14111
|
-
this.data = typeof data === 'string' ? { message: data } : data;
|
|
14112
|
-
}
|
|
14113
|
-
}
|
|
14114
|
-
exports.ConnectorError = ConnectorError;
|
|
14115
|
-
var MessageTypes;
|
|
14116
|
-
(function (MessageTypes) {
|
|
14117
|
-
MessageTypes["SignIn"] = "SignIn";
|
|
14118
|
-
MessageTypes["Register"] = "Register";
|
|
14119
|
-
MessageTypes["ForgotPassword"] = "ForgotPassword";
|
|
14120
|
-
MessageTypes["Test"] = "Test";
|
|
14121
|
-
})(MessageTypes = exports.MessageTypes || (exports.MessageTypes = {}));
|
|
14122
|
-
exports.messageTypesGuard = zod_1.z.nativeEnum(MessageTypes);
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
14600
|
/***/ }),
|
|
14126
14601
|
|
|
14127
14602
|
/***/ 87:
|
|
@@ -14131,7 +14606,7 @@ exports.messageTypesGuard = zod_1.z.nativeEnum(MessageTypes);
|
|
|
14131
14606
|
|
|
14132
14607
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14133
14608
|
exports.defaultTimeout = exports.defaultMetadata = exports.scope = exports.userInfoEndpoint = exports.accessTokenEndpoint = exports.authorizationEndpoint = void 0;
|
|
14134
|
-
const connector_core_1 = __nccwpck_require__(
|
|
14609
|
+
const connector_core_1 = __nccwpck_require__(8697);
|
|
14135
14610
|
exports.authorizationEndpoint = 'https://accounts.google.com/o/oauth2/v2/auth';
|
|
14136
14611
|
exports.accessTokenEndpoint = 'https://oauth2.googleapis.com/token';
|
|
14137
14612
|
exports.userInfoEndpoint = 'https://openidconnect.googleapis.com/v1/userinfo';
|
|
@@ -14149,10 +14624,10 @@ exports.defaultMetadata = {
|
|
|
14149
14624
|
logo: './logo.svg',
|
|
14150
14625
|
logoDark: null,
|
|
14151
14626
|
description: {
|
|
14152
|
-
en: 'Google is
|
|
14153
|
-
'zh-CN': 'Google
|
|
14627
|
+
en: 'Google is a principal search engine technology and email service provider.',
|
|
14628
|
+
'zh-CN': 'Google 是全球性的搜索引擎和邮件服务提供商。',
|
|
14154
14629
|
'tr-TR': 'Google, en büyük arama motoru teknolojisi ve e-posta servis sağlayıcısıdır.',
|
|
14155
|
-
'ko-KR': 'Google은 가장 큰 검색 엔진 기술과 이메일 서비스 제공자입니다.',
|
|
14630
|
+
'ko-KR': 'Google은 가장 큰 검색 엔진 기술과 이메일 서비스 제공자입니다.', // UNTRANSLATED
|
|
14156
14631
|
},
|
|
14157
14632
|
readme: './README.md',
|
|
14158
14633
|
configTemplate: './docs/config-template.json',
|
|
@@ -14196,9 +14671,9 @@ exports.getAccessToken = void 0;
|
|
|
14196
14671
|
* The Implementation of OpenID Connect of Google Identity Platform.
|
|
14197
14672
|
* https://developers.google.com/identity/protocols/oauth2/openid-connect
|
|
14198
14673
|
*/
|
|
14199
|
-
const connector_core_1 = __nccwpck_require__(
|
|
14674
|
+
const connector_core_1 = __nccwpck_require__(8697);
|
|
14200
14675
|
const essentials_1 = __nccwpck_require__(8138);
|
|
14201
|
-
const got_1 = __importStar(__nccwpck_require__(
|
|
14676
|
+
const got_1 = __importStar(__nccwpck_require__(5569));
|
|
14202
14677
|
const constant_1 = __nccwpck_require__(87);
|
|
14203
14678
|
const types_1 = __nccwpck_require__(7760);
|
|
14204
14679
|
const getAuthorizationUri = (getConfig) => async ({ state, redirectUri }) => {
|
|
@@ -14303,7 +14778,7 @@ exports["default"] = createGoogleConnector;
|
|
|
14303
14778
|
|
|
14304
14779
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14305
14780
|
exports.authResponseGuard = exports.userInfoResponseGuard = exports.accessTokenResponseGuard = exports.googleConfigGuard = void 0;
|
|
14306
|
-
const zod_1 = __nccwpck_require__(
|
|
14781
|
+
const zod_1 = __nccwpck_require__(8062);
|
|
14307
14782
|
exports.googleConfigGuard = zod_1.z.object({
|
|
14308
14783
|
clientId: zod_1.z.string(),
|
|
14309
14784
|
clientSecret: zod_1.z.string(),
|