@elysiajs/jwt 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.d.ts +43 -8
- package/dist/cjs/index.js +2466 -68
- package/dist/index.d.ts +43 -8
- package/dist/index.mjs +2452 -0
- package/package.json +54 -54
- package/dist/index.js +0 -66
package/dist/cjs/index.js
CHANGED
|
@@ -1,70 +1,2468 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
throw new Error("Secret can't be empty");
|
|
10
|
-
const key = typeof secret === 'string' ? new TextEncoder().encode(secret) : secret;
|
|
11
|
-
const validator = schema
|
|
12
|
-
? (0, elysia_1.getSchemaValidator)(typebox_1.Type.Intersect([
|
|
13
|
-
schema,
|
|
14
|
-
typebox_1.Type.Object({
|
|
15
|
-
iss: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
16
|
-
sub: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
17
|
-
aud: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Array(typebox_1.Type.String())])),
|
|
18
|
-
jti: typebox_1.Type.Optional(typebox_1.Type.String()),
|
|
19
|
-
nbf: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Number()])),
|
|
20
|
-
exp: typebox_1.Type.Optional(typebox_1.Type.Union([typebox_1.Type.String(), typebox_1.Type.Number()])),
|
|
21
|
-
iat: typebox_1.Type.Optional(typebox_1.Type.String())
|
|
22
|
-
})
|
|
23
|
-
]), {})
|
|
24
|
-
: undefined;
|
|
25
|
-
return new elysia_1.Elysia({
|
|
26
|
-
name: '@elysiajs/jwt',
|
|
27
|
-
seed: {
|
|
28
|
-
name,
|
|
29
|
-
secret,
|
|
30
|
-
alg,
|
|
31
|
-
crit,
|
|
32
|
-
schema,
|
|
33
|
-
nbf,
|
|
34
|
-
exp,
|
|
35
|
-
...payload
|
|
36
|
-
}
|
|
37
|
-
}).decorate(name, {
|
|
38
|
-
sign: (morePayload) => {
|
|
39
|
-
let jwt = new jose_1.SignJWT({
|
|
40
|
-
...payload,
|
|
41
|
-
...morePayload,
|
|
42
|
-
nbf: undefined,
|
|
43
|
-
exp: undefined
|
|
44
|
-
}).setProtectedHeader({
|
|
45
|
-
alg,
|
|
46
|
-
crit
|
|
47
|
-
});
|
|
48
|
-
if (nbf)
|
|
49
|
-
jwt = jwt.setNotBefore(nbf);
|
|
50
|
-
if (exp)
|
|
51
|
-
jwt = jwt.setExpirationTime(exp);
|
|
52
|
-
return jwt.sign(key);
|
|
53
|
-
},
|
|
54
|
-
verify: async (jwt) => {
|
|
55
|
-
if (!jwt)
|
|
56
|
-
return false;
|
|
57
|
-
try {
|
|
58
|
-
const data = (await (0, jose_1.jwtVerify)(jwt, key)).payload;
|
|
59
|
-
if (validator && !validator.Check(data))
|
|
60
|
-
throw new elysia_1.ValidationError('JWT', validator, data);
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
|
-
catch (_) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
68
9
|
};
|
|
69
|
-
|
|
70
|
-
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
default: () => src_default,
|
|
24
|
+
jwt: () => jwt
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
var import_elysia = require("elysia");
|
|
28
|
+
var import_jose = require("jose");
|
|
29
|
+
|
|
30
|
+
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
31
|
+
var value_exports = {};
|
|
32
|
+
__export(value_exports, {
|
|
33
|
+
IsArray: () => IsArray,
|
|
34
|
+
IsAsyncIterator: () => IsAsyncIterator,
|
|
35
|
+
IsBigInt: () => IsBigInt,
|
|
36
|
+
IsBoolean: () => IsBoolean,
|
|
37
|
+
IsDate: () => IsDate,
|
|
38
|
+
IsFunction: () => IsFunction,
|
|
39
|
+
IsIterator: () => IsIterator,
|
|
40
|
+
IsNull: () => IsNull,
|
|
41
|
+
IsNumber: () => IsNumber,
|
|
42
|
+
IsObject: () => IsObject,
|
|
43
|
+
IsRegExp: () => IsRegExp,
|
|
44
|
+
IsString: () => IsString,
|
|
45
|
+
IsSymbol: () => IsSymbol,
|
|
46
|
+
IsUint8Array: () => IsUint8Array,
|
|
47
|
+
IsUndefined: () => IsUndefined
|
|
48
|
+
});
|
|
49
|
+
function IsAsyncIterator(value) {
|
|
50
|
+
return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value;
|
|
51
|
+
}
|
|
52
|
+
function IsArray(value) {
|
|
53
|
+
return Array.isArray(value);
|
|
54
|
+
}
|
|
55
|
+
function IsBigInt(value) {
|
|
56
|
+
return typeof value === "bigint";
|
|
57
|
+
}
|
|
58
|
+
function IsBoolean(value) {
|
|
59
|
+
return typeof value === "boolean";
|
|
60
|
+
}
|
|
61
|
+
function IsDate(value) {
|
|
62
|
+
return value instanceof globalThis.Date;
|
|
63
|
+
}
|
|
64
|
+
function IsFunction(value) {
|
|
65
|
+
return typeof value === "function";
|
|
66
|
+
}
|
|
67
|
+
function IsIterator(value) {
|
|
68
|
+
return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value;
|
|
69
|
+
}
|
|
70
|
+
function IsNull(value) {
|
|
71
|
+
return value === null;
|
|
72
|
+
}
|
|
73
|
+
function IsNumber(value) {
|
|
74
|
+
return typeof value === "number";
|
|
75
|
+
}
|
|
76
|
+
function IsObject(value) {
|
|
77
|
+
return typeof value === "object" && value !== null;
|
|
78
|
+
}
|
|
79
|
+
function IsRegExp(value) {
|
|
80
|
+
return value instanceof globalThis.RegExp;
|
|
81
|
+
}
|
|
82
|
+
function IsString(value) {
|
|
83
|
+
return typeof value === "string";
|
|
84
|
+
}
|
|
85
|
+
function IsSymbol(value) {
|
|
86
|
+
return typeof value === "symbol";
|
|
87
|
+
}
|
|
88
|
+
function IsUint8Array(value) {
|
|
89
|
+
return value instanceof globalThis.Uint8Array;
|
|
90
|
+
}
|
|
91
|
+
function IsUndefined(value) {
|
|
92
|
+
return value === void 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs
|
|
96
|
+
function ArrayType(value) {
|
|
97
|
+
return value.map((value2) => Visit(value2));
|
|
98
|
+
}
|
|
99
|
+
function DateType(value) {
|
|
100
|
+
return new Date(value.getTime());
|
|
101
|
+
}
|
|
102
|
+
function Uint8ArrayType(value) {
|
|
103
|
+
return new Uint8Array(value);
|
|
104
|
+
}
|
|
105
|
+
function RegExpType(value) {
|
|
106
|
+
return new RegExp(value.source, value.flags);
|
|
107
|
+
}
|
|
108
|
+
function ObjectType(value) {
|
|
109
|
+
const result = {};
|
|
110
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
111
|
+
result[key] = Visit(value[key]);
|
|
112
|
+
}
|
|
113
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
114
|
+
result[key] = Visit(value[key]);
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
function Visit(value) {
|
|
119
|
+
return IsArray(value) ? ArrayType(value) : IsDate(value) ? DateType(value) : IsUint8Array(value) ? Uint8ArrayType(value) : IsRegExp(value) ? RegExpType(value) : IsObject(value) ? ObjectType(value) : value;
|
|
120
|
+
}
|
|
121
|
+
function Clone(value) {
|
|
122
|
+
return Visit(value);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs
|
|
126
|
+
function CloneRest(schemas) {
|
|
127
|
+
return schemas.map((schema) => CloneType(schema));
|
|
128
|
+
}
|
|
129
|
+
function CloneType(schema, options = {}) {
|
|
130
|
+
return { ...Clone(schema), ...options };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// node_modules/@sinclair/typebox/build/esm/type/error/error.mjs
|
|
134
|
+
var TypeBoxError = class extends Error {
|
|
135
|
+
constructor(message) {
|
|
136
|
+
super(message);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
141
|
+
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
142
|
+
var ReadonlyKind = Symbol.for("TypeBox.Readonly");
|
|
143
|
+
var OptionalKind = Symbol.for("TypeBox.Optional");
|
|
144
|
+
var Hint = Symbol.for("TypeBox.Hint");
|
|
145
|
+
var Kind = Symbol.for("TypeBox.Kind");
|
|
146
|
+
|
|
147
|
+
// node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
148
|
+
function IsReadonly(value) {
|
|
149
|
+
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
150
|
+
}
|
|
151
|
+
function IsOptional(value) {
|
|
152
|
+
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
153
|
+
}
|
|
154
|
+
function IsAny(value) {
|
|
155
|
+
return IsKindOf(value, "Any");
|
|
156
|
+
}
|
|
157
|
+
function IsArray2(value) {
|
|
158
|
+
return IsKindOf(value, "Array");
|
|
159
|
+
}
|
|
160
|
+
function IsAsyncIterator2(value) {
|
|
161
|
+
return IsKindOf(value, "AsyncIterator");
|
|
162
|
+
}
|
|
163
|
+
function IsBigInt2(value) {
|
|
164
|
+
return IsKindOf(value, "BigInt");
|
|
165
|
+
}
|
|
166
|
+
function IsBoolean2(value) {
|
|
167
|
+
return IsKindOf(value, "Boolean");
|
|
168
|
+
}
|
|
169
|
+
function IsConstructor(value) {
|
|
170
|
+
return IsKindOf(value, "Constructor");
|
|
171
|
+
}
|
|
172
|
+
function IsDate2(value) {
|
|
173
|
+
return IsKindOf(value, "Date");
|
|
174
|
+
}
|
|
175
|
+
function IsFunction2(value) {
|
|
176
|
+
return IsKindOf(value, "Function");
|
|
177
|
+
}
|
|
178
|
+
function IsInteger(value) {
|
|
179
|
+
return IsKindOf(value, "Integer");
|
|
180
|
+
}
|
|
181
|
+
function IsIntersect(value) {
|
|
182
|
+
return IsKindOf(value, "Intersect");
|
|
183
|
+
}
|
|
184
|
+
function IsIterator2(value) {
|
|
185
|
+
return IsKindOf(value, "Iterator");
|
|
186
|
+
}
|
|
187
|
+
function IsKindOf(value, kind) {
|
|
188
|
+
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
189
|
+
}
|
|
190
|
+
function IsLiteral(value) {
|
|
191
|
+
return IsKindOf(value, "Literal");
|
|
192
|
+
}
|
|
193
|
+
function IsMappedKey(value) {
|
|
194
|
+
return IsKindOf(value, "MappedKey");
|
|
195
|
+
}
|
|
196
|
+
function IsMappedResult(value) {
|
|
197
|
+
return IsKindOf(value, "MappedResult");
|
|
198
|
+
}
|
|
199
|
+
function IsNever(value) {
|
|
200
|
+
return IsKindOf(value, "Never");
|
|
201
|
+
}
|
|
202
|
+
function IsNot(value) {
|
|
203
|
+
return IsKindOf(value, "Not");
|
|
204
|
+
}
|
|
205
|
+
function IsNull2(value) {
|
|
206
|
+
return IsKindOf(value, "Null");
|
|
207
|
+
}
|
|
208
|
+
function IsNumber2(value) {
|
|
209
|
+
return IsKindOf(value, "Number");
|
|
210
|
+
}
|
|
211
|
+
function IsObject2(value) {
|
|
212
|
+
return IsKindOf(value, "Object");
|
|
213
|
+
}
|
|
214
|
+
function IsPromise(value) {
|
|
215
|
+
return IsKindOf(value, "Promise");
|
|
216
|
+
}
|
|
217
|
+
function IsRecord(value) {
|
|
218
|
+
return IsKindOf(value, "Record");
|
|
219
|
+
}
|
|
220
|
+
function IsRef(value) {
|
|
221
|
+
return IsKindOf(value, "Ref");
|
|
222
|
+
}
|
|
223
|
+
function IsRegExp2(value) {
|
|
224
|
+
return IsKindOf(value, "RegExp");
|
|
225
|
+
}
|
|
226
|
+
function IsString2(value) {
|
|
227
|
+
return IsKindOf(value, "String");
|
|
228
|
+
}
|
|
229
|
+
function IsSymbol2(value) {
|
|
230
|
+
return IsKindOf(value, "Symbol");
|
|
231
|
+
}
|
|
232
|
+
function IsTemplateLiteral(value) {
|
|
233
|
+
return IsKindOf(value, "TemplateLiteral");
|
|
234
|
+
}
|
|
235
|
+
function IsThis(value) {
|
|
236
|
+
return IsKindOf(value, "This");
|
|
237
|
+
}
|
|
238
|
+
function IsTransform(value) {
|
|
239
|
+
return IsObject(value) && TransformKind in value;
|
|
240
|
+
}
|
|
241
|
+
function IsTuple(value) {
|
|
242
|
+
return IsKindOf(value, "Tuple");
|
|
243
|
+
}
|
|
244
|
+
function IsUndefined2(value) {
|
|
245
|
+
return IsKindOf(value, "Undefined");
|
|
246
|
+
}
|
|
247
|
+
function IsUnion(value) {
|
|
248
|
+
return IsKindOf(value, "Union");
|
|
249
|
+
}
|
|
250
|
+
function IsUint8Array2(value) {
|
|
251
|
+
return IsKindOf(value, "Uint8Array");
|
|
252
|
+
}
|
|
253
|
+
function IsUnknown(value) {
|
|
254
|
+
return IsKindOf(value, "Unknown");
|
|
255
|
+
}
|
|
256
|
+
function IsUnsafe(value) {
|
|
257
|
+
return IsKindOf(value, "Unsafe");
|
|
258
|
+
}
|
|
259
|
+
function IsVoid(value) {
|
|
260
|
+
return IsKindOf(value, "Void");
|
|
261
|
+
}
|
|
262
|
+
function IsKind(value) {
|
|
263
|
+
return IsObject(value) && Kind in value && IsString(value[Kind]);
|
|
264
|
+
}
|
|
265
|
+
function IsSchema(value) {
|
|
266
|
+
return IsAny(value) || IsArray2(value) || IsBoolean2(value) || IsBigInt2(value) || IsAsyncIterator2(value) || IsConstructor(value) || IsDate2(value) || IsFunction2(value) || IsInteger(value) || IsIntersect(value) || IsIterator2(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull2(value) || IsNumber2(value) || IsObject2(value) || IsPromise(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString2(value) || IsSymbol2(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined2(value) || IsUnion(value) || IsUint8Array2(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
|
|
270
|
+
var type_exports = {};
|
|
271
|
+
__export(type_exports, {
|
|
272
|
+
IsAny: () => IsAny2,
|
|
273
|
+
IsArray: () => IsArray3,
|
|
274
|
+
IsAsyncIterator: () => IsAsyncIterator3,
|
|
275
|
+
IsBigInt: () => IsBigInt3,
|
|
276
|
+
IsBoolean: () => IsBoolean3,
|
|
277
|
+
IsConstructor: () => IsConstructor2,
|
|
278
|
+
IsDate: () => IsDate3,
|
|
279
|
+
IsFunction: () => IsFunction3,
|
|
280
|
+
IsInteger: () => IsInteger2,
|
|
281
|
+
IsIntersect: () => IsIntersect2,
|
|
282
|
+
IsIterator: () => IsIterator3,
|
|
283
|
+
IsKind: () => IsKind2,
|
|
284
|
+
IsKindOf: () => IsKindOf2,
|
|
285
|
+
IsLiteral: () => IsLiteral2,
|
|
286
|
+
IsLiteralBoolean: () => IsLiteralBoolean,
|
|
287
|
+
IsLiteralNumber: () => IsLiteralNumber,
|
|
288
|
+
IsLiteralString: () => IsLiteralString,
|
|
289
|
+
IsLiteralValue: () => IsLiteralValue,
|
|
290
|
+
IsMappedKey: () => IsMappedKey2,
|
|
291
|
+
IsMappedResult: () => IsMappedResult2,
|
|
292
|
+
IsNever: () => IsNever2,
|
|
293
|
+
IsNot: () => IsNot2,
|
|
294
|
+
IsNull: () => IsNull3,
|
|
295
|
+
IsNumber: () => IsNumber3,
|
|
296
|
+
IsObject: () => IsObject3,
|
|
297
|
+
IsOptional: () => IsOptional2,
|
|
298
|
+
IsPromise: () => IsPromise2,
|
|
299
|
+
IsProperties: () => IsProperties,
|
|
300
|
+
IsReadonly: () => IsReadonly2,
|
|
301
|
+
IsRecord: () => IsRecord2,
|
|
302
|
+
IsRecursive: () => IsRecursive,
|
|
303
|
+
IsRef: () => IsRef2,
|
|
304
|
+
IsRegExp: () => IsRegExp3,
|
|
305
|
+
IsSchema: () => IsSchema2,
|
|
306
|
+
IsString: () => IsString3,
|
|
307
|
+
IsSymbol: () => IsSymbol3,
|
|
308
|
+
IsTemplateLiteral: () => IsTemplateLiteral2,
|
|
309
|
+
IsThis: () => IsThis2,
|
|
310
|
+
IsTransform: () => IsTransform2,
|
|
311
|
+
IsTuple: () => IsTuple2,
|
|
312
|
+
IsUint8Array: () => IsUint8Array3,
|
|
313
|
+
IsUndefined: () => IsUndefined3,
|
|
314
|
+
IsUnion: () => IsUnion2,
|
|
315
|
+
IsUnionLiteral: () => IsUnionLiteral,
|
|
316
|
+
IsUnknown: () => IsUnknown2,
|
|
317
|
+
IsUnsafe: () => IsUnsafe2,
|
|
318
|
+
IsVoid: () => IsVoid2,
|
|
319
|
+
TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
|
|
320
|
+
});
|
|
321
|
+
var TypeGuardUnknownTypeError = class extends TypeBoxError {
|
|
322
|
+
};
|
|
323
|
+
var KnownTypes = [
|
|
324
|
+
"Any",
|
|
325
|
+
"Array",
|
|
326
|
+
"AsyncIterator",
|
|
327
|
+
"BigInt",
|
|
328
|
+
"Boolean",
|
|
329
|
+
"Constructor",
|
|
330
|
+
"Date",
|
|
331
|
+
"Enum",
|
|
332
|
+
"Function",
|
|
333
|
+
"Integer",
|
|
334
|
+
"Intersect",
|
|
335
|
+
"Iterator",
|
|
336
|
+
"Literal",
|
|
337
|
+
"MappedKey",
|
|
338
|
+
"MappedResult",
|
|
339
|
+
"Not",
|
|
340
|
+
"Null",
|
|
341
|
+
"Number",
|
|
342
|
+
"Object",
|
|
343
|
+
"Promise",
|
|
344
|
+
"Record",
|
|
345
|
+
"Ref",
|
|
346
|
+
"RegExp",
|
|
347
|
+
"String",
|
|
348
|
+
"Symbol",
|
|
349
|
+
"TemplateLiteral",
|
|
350
|
+
"This",
|
|
351
|
+
"Tuple",
|
|
352
|
+
"Undefined",
|
|
353
|
+
"Union",
|
|
354
|
+
"Uint8Array",
|
|
355
|
+
"Unknown",
|
|
356
|
+
"Void"
|
|
357
|
+
];
|
|
358
|
+
function IsPattern(value) {
|
|
359
|
+
try {
|
|
360
|
+
new RegExp(value);
|
|
361
|
+
return true;
|
|
362
|
+
} catch {
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function IsControlCharacterFree(value) {
|
|
367
|
+
if (!IsString(value))
|
|
368
|
+
return false;
|
|
369
|
+
for (let i = 0; i < value.length; i++) {
|
|
370
|
+
const code = value.charCodeAt(i);
|
|
371
|
+
if (code >= 7 && code <= 13 || code === 27 || code === 127) {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
function IsAdditionalProperties(value) {
|
|
378
|
+
return IsOptionalBoolean(value) || IsSchema2(value);
|
|
379
|
+
}
|
|
380
|
+
function IsOptionalBigInt(value) {
|
|
381
|
+
return IsUndefined(value) || IsBigInt(value);
|
|
382
|
+
}
|
|
383
|
+
function IsOptionalNumber(value) {
|
|
384
|
+
return IsUndefined(value) || IsNumber(value);
|
|
385
|
+
}
|
|
386
|
+
function IsOptionalBoolean(value) {
|
|
387
|
+
return IsUndefined(value) || IsBoolean(value);
|
|
388
|
+
}
|
|
389
|
+
function IsOptionalString(value) {
|
|
390
|
+
return IsUndefined(value) || IsString(value);
|
|
391
|
+
}
|
|
392
|
+
function IsOptionalPattern(value) {
|
|
393
|
+
return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value) && IsPattern(value);
|
|
394
|
+
}
|
|
395
|
+
function IsOptionalFormat(value) {
|
|
396
|
+
return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
|
|
397
|
+
}
|
|
398
|
+
function IsOptionalSchema(value) {
|
|
399
|
+
return IsUndefined(value) || IsSchema2(value);
|
|
400
|
+
}
|
|
401
|
+
function IsReadonly2(value) {
|
|
402
|
+
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
403
|
+
}
|
|
404
|
+
function IsOptional2(value) {
|
|
405
|
+
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
406
|
+
}
|
|
407
|
+
function IsAny2(value) {
|
|
408
|
+
return IsKindOf2(value, "Any") && IsOptionalString(value.$id);
|
|
409
|
+
}
|
|
410
|
+
function IsArray3(value) {
|
|
411
|
+
return IsKindOf2(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema2(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
|
|
412
|
+
}
|
|
413
|
+
function IsAsyncIterator3(value) {
|
|
414
|
+
return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
|
|
415
|
+
}
|
|
416
|
+
function IsBigInt3(value) {
|
|
417
|
+
return IsKindOf2(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
|
|
418
|
+
}
|
|
419
|
+
function IsBoolean3(value) {
|
|
420
|
+
return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
|
|
421
|
+
}
|
|
422
|
+
function IsConstructor2(value) {
|
|
423
|
+
return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
|
|
424
|
+
}
|
|
425
|
+
function IsDate3(value) {
|
|
426
|
+
return IsKindOf2(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
|
|
427
|
+
}
|
|
428
|
+
function IsFunction3(value) {
|
|
429
|
+
return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
|
|
430
|
+
}
|
|
431
|
+
function IsInteger2(value) {
|
|
432
|
+
return IsKindOf2(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
|
|
433
|
+
}
|
|
434
|
+
function IsProperties(value) {
|
|
435
|
+
return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema2(schema));
|
|
436
|
+
}
|
|
437
|
+
function IsIntersect2(value) {
|
|
438
|
+
return IsKindOf2(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema2(schema) && !IsTransform2(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
|
|
439
|
+
}
|
|
440
|
+
function IsIterator3(value) {
|
|
441
|
+
return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
|
|
442
|
+
}
|
|
443
|
+
function IsKindOf2(value, kind) {
|
|
444
|
+
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
445
|
+
}
|
|
446
|
+
function IsLiteralString(value) {
|
|
447
|
+
return IsLiteral2(value) && IsString(value.const);
|
|
448
|
+
}
|
|
449
|
+
function IsLiteralNumber(value) {
|
|
450
|
+
return IsLiteral2(value) && IsNumber(value.const);
|
|
451
|
+
}
|
|
452
|
+
function IsLiteralBoolean(value) {
|
|
453
|
+
return IsLiteral2(value) && IsBoolean(value.const);
|
|
454
|
+
}
|
|
455
|
+
function IsLiteral2(value) {
|
|
456
|
+
return IsKindOf2(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue(value.const);
|
|
457
|
+
}
|
|
458
|
+
function IsLiteralValue(value) {
|
|
459
|
+
return IsBoolean(value) || IsNumber(value) || IsString(value);
|
|
460
|
+
}
|
|
461
|
+
function IsMappedKey2(value) {
|
|
462
|
+
return IsKindOf2(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
|
|
463
|
+
}
|
|
464
|
+
function IsMappedResult2(value) {
|
|
465
|
+
return IsKindOf2(value, "MappedResult") && IsProperties(value.properties);
|
|
466
|
+
}
|
|
467
|
+
function IsNever2(value) {
|
|
468
|
+
return IsKindOf2(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
|
|
469
|
+
}
|
|
470
|
+
function IsNot2(value) {
|
|
471
|
+
return IsKindOf2(value, "Not") && IsSchema2(value.not);
|
|
472
|
+
}
|
|
473
|
+
function IsNull3(value) {
|
|
474
|
+
return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
|
|
475
|
+
}
|
|
476
|
+
function IsNumber3(value) {
|
|
477
|
+
return IsKindOf2(value, "Number") && value.type === "number" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
|
|
478
|
+
}
|
|
479
|
+
function IsObject3(value) {
|
|
480
|
+
return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
|
|
481
|
+
}
|
|
482
|
+
function IsPromise2(value) {
|
|
483
|
+
return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
|
|
484
|
+
}
|
|
485
|
+
function IsRecord2(value) {
|
|
486
|
+
return IsKindOf2(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
|
|
487
|
+
const keys = Object.getOwnPropertyNames(schema.patternProperties);
|
|
488
|
+
return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
|
|
489
|
+
})(value);
|
|
490
|
+
}
|
|
491
|
+
function IsRecursive(value) {
|
|
492
|
+
return IsObject(value) && Hint in value && value[Hint] === "Recursive";
|
|
493
|
+
}
|
|
494
|
+
function IsRef2(value) {
|
|
495
|
+
return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
|
|
496
|
+
}
|
|
497
|
+
function IsRegExp3(value) {
|
|
498
|
+
return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
|
|
499
|
+
}
|
|
500
|
+
function IsString3(value) {
|
|
501
|
+
return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
|
|
502
|
+
}
|
|
503
|
+
function IsSymbol3(value) {
|
|
504
|
+
return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
|
|
505
|
+
}
|
|
506
|
+
function IsTemplateLiteral2(value) {
|
|
507
|
+
return IsKindOf2(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
|
|
508
|
+
}
|
|
509
|
+
function IsThis2(value) {
|
|
510
|
+
return IsKindOf2(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
|
|
511
|
+
}
|
|
512
|
+
function IsTransform2(value) {
|
|
513
|
+
return IsObject(value) && TransformKind in value;
|
|
514
|
+
}
|
|
515
|
+
function IsTuple2(value) {
|
|
516
|
+
return IsKindOf2(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && // empty
|
|
517
|
+
(IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema2(schema)));
|
|
518
|
+
}
|
|
519
|
+
function IsUndefined3(value) {
|
|
520
|
+
return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
|
|
521
|
+
}
|
|
522
|
+
function IsUnionLiteral(value) {
|
|
523
|
+
return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
|
|
524
|
+
}
|
|
525
|
+
function IsUnion2(value) {
|
|
526
|
+
return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
|
|
527
|
+
}
|
|
528
|
+
function IsUint8Array3(value) {
|
|
529
|
+
return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
|
|
530
|
+
}
|
|
531
|
+
function IsUnknown2(value) {
|
|
532
|
+
return IsKindOf2(value, "Unknown") && IsOptionalString(value.$id);
|
|
533
|
+
}
|
|
534
|
+
function IsUnsafe2(value) {
|
|
535
|
+
return IsKindOf2(value, "Unsafe");
|
|
536
|
+
}
|
|
537
|
+
function IsVoid2(value) {
|
|
538
|
+
return IsKindOf2(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
|
|
539
|
+
}
|
|
540
|
+
function IsKind2(value) {
|
|
541
|
+
return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
|
|
542
|
+
}
|
|
543
|
+
function IsSchema2(value) {
|
|
544
|
+
return IsObject(value) && (IsAny2(value) || IsArray3(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsConstructor2(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect2(value) || IsIterator3(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull3(value) || IsNumber3(value) || IsObject3(value) || IsPromise2(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined3(value) || IsUnion2(value) || IsUint8Array3(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
|
|
548
|
+
var PatternBoolean = "(true|false)";
|
|
549
|
+
var PatternNumber = "(0|[1-9][0-9]*)";
|
|
550
|
+
var PatternString = "(.*)";
|
|
551
|
+
var PatternBooleanExact = `^${PatternBoolean}$`;
|
|
552
|
+
var PatternNumberExact = `^${PatternNumber}$`;
|
|
553
|
+
var PatternStringExact = `^${PatternString}$`;
|
|
554
|
+
|
|
555
|
+
// node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs
|
|
556
|
+
function SetIncludes(T, S) {
|
|
557
|
+
return T.includes(S);
|
|
558
|
+
}
|
|
559
|
+
function SetDistinct(T) {
|
|
560
|
+
return [...new Set(T)];
|
|
561
|
+
}
|
|
562
|
+
function SetIntersect(T, S) {
|
|
563
|
+
return T.filter((L) => S.includes(L));
|
|
564
|
+
}
|
|
565
|
+
function SetIntersectManyResolve(T, Init) {
|
|
566
|
+
return T.reduce((Acc, L) => {
|
|
567
|
+
return SetIntersect(Acc, L);
|
|
568
|
+
}, Init);
|
|
569
|
+
}
|
|
570
|
+
function SetIntersectMany(T) {
|
|
571
|
+
return T.length === 1 ? T[0] : T.length > 1 ? SetIntersectManyResolve(T.slice(1), T[0]) : [];
|
|
572
|
+
}
|
|
573
|
+
function SetUnionMany(T) {
|
|
574
|
+
const Acc = [];
|
|
575
|
+
for (const L of T)
|
|
576
|
+
Acc.push(...L);
|
|
577
|
+
return Acc;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
// node_modules/@sinclair/typebox/build/esm/type/any/any.mjs
|
|
581
|
+
function Any(options = {}) {
|
|
582
|
+
return { ...options, [Kind]: "Any" };
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// node_modules/@sinclair/typebox/build/esm/type/array/array.mjs
|
|
586
|
+
function Array2(schema, options = {}) {
|
|
587
|
+
return {
|
|
588
|
+
...options,
|
|
589
|
+
[Kind]: "Array",
|
|
590
|
+
type: "array",
|
|
591
|
+
items: CloneType(schema)
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs
|
|
596
|
+
function AsyncIterator(items, options = {}) {
|
|
597
|
+
return {
|
|
598
|
+
...options,
|
|
599
|
+
[Kind]: "AsyncIterator",
|
|
600
|
+
type: "AsyncIterator",
|
|
601
|
+
items: CloneType(items)
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs
|
|
606
|
+
function DiscardKey(value, key) {
|
|
607
|
+
const { [key]: _, ...rest } = value;
|
|
608
|
+
return rest;
|
|
609
|
+
}
|
|
610
|
+
function Discard(value, keys) {
|
|
611
|
+
return keys.reduce((acc, key) => DiscardKey(acc, key), value);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// node_modules/@sinclair/typebox/build/esm/type/never/never.mjs
|
|
615
|
+
function Never(options = {}) {
|
|
616
|
+
return {
|
|
617
|
+
...options,
|
|
618
|
+
[Kind]: "Never",
|
|
619
|
+
not: {}
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs
|
|
624
|
+
function MappedResult(properties) {
|
|
625
|
+
return {
|
|
626
|
+
[Kind]: "MappedResult",
|
|
627
|
+
properties
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs
|
|
632
|
+
function Constructor(parameters, returns, options) {
|
|
633
|
+
return {
|
|
634
|
+
...options,
|
|
635
|
+
[Kind]: "Constructor",
|
|
636
|
+
type: "Constructor",
|
|
637
|
+
parameters: CloneRest(parameters),
|
|
638
|
+
returns: CloneType(returns)
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// node_modules/@sinclair/typebox/build/esm/type/function/function.mjs
|
|
643
|
+
function Function(parameters, returns, options) {
|
|
644
|
+
return {
|
|
645
|
+
...options,
|
|
646
|
+
[Kind]: "Function",
|
|
647
|
+
type: "Function",
|
|
648
|
+
parameters: CloneRest(parameters),
|
|
649
|
+
returns: CloneType(returns)
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs
|
|
654
|
+
function UnionCreate(T, options) {
|
|
655
|
+
return { ...options, [Kind]: "Union", anyOf: CloneRest(T) };
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
|
|
659
|
+
function IsUnionOptional(T) {
|
|
660
|
+
return T.some((L) => IsOptional(L));
|
|
661
|
+
}
|
|
662
|
+
function RemoveOptionalFromRest(T) {
|
|
663
|
+
return T.map((L) => IsOptional(L) ? RemoveOptionalFromType(L) : L);
|
|
664
|
+
}
|
|
665
|
+
function RemoveOptionalFromType(T) {
|
|
666
|
+
return Discard(T, [OptionalKind]);
|
|
667
|
+
}
|
|
668
|
+
function ResolveUnion(T, options) {
|
|
669
|
+
return IsUnionOptional(T) ? Optional(UnionCreate(RemoveOptionalFromRest(T), options)) : UnionCreate(RemoveOptionalFromRest(T), options);
|
|
670
|
+
}
|
|
671
|
+
function UnionEvaluated(T, options = {}) {
|
|
672
|
+
return T.length === 0 ? Never(options) : T.length === 1 ? CloneType(T[0], options) : ResolveUnion(T, options);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// node_modules/@sinclair/typebox/build/esm/type/union/union.mjs
|
|
676
|
+
function Union(T, options = {}) {
|
|
677
|
+
return T.length === 0 ? Never(options) : T.length === 1 ? CloneType(T[0], options) : UnionCreate(T, options);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs
|
|
681
|
+
var TemplateLiteralParserError = class extends TypeBoxError {
|
|
682
|
+
};
|
|
683
|
+
function Unescape(pattern) {
|
|
684
|
+
return pattern.replace(/\\\$/g, "$").replace(/\\\*/g, "*").replace(/\\\^/g, "^").replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")");
|
|
685
|
+
}
|
|
686
|
+
function IsNonEscaped(pattern, index, char) {
|
|
687
|
+
return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92;
|
|
688
|
+
}
|
|
689
|
+
function IsOpenParen(pattern, index) {
|
|
690
|
+
return IsNonEscaped(pattern, index, "(");
|
|
691
|
+
}
|
|
692
|
+
function IsCloseParen(pattern, index) {
|
|
693
|
+
return IsNonEscaped(pattern, index, ")");
|
|
694
|
+
}
|
|
695
|
+
function IsSeparator(pattern, index) {
|
|
696
|
+
return IsNonEscaped(pattern, index, "|");
|
|
697
|
+
}
|
|
698
|
+
function IsGroup(pattern) {
|
|
699
|
+
if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1)))
|
|
700
|
+
return false;
|
|
701
|
+
let count = 0;
|
|
702
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
703
|
+
if (IsOpenParen(pattern, index))
|
|
704
|
+
count += 1;
|
|
705
|
+
if (IsCloseParen(pattern, index))
|
|
706
|
+
count -= 1;
|
|
707
|
+
if (count === 0 && index !== pattern.length - 1)
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
return true;
|
|
711
|
+
}
|
|
712
|
+
function InGroup(pattern) {
|
|
713
|
+
return pattern.slice(1, pattern.length - 1);
|
|
714
|
+
}
|
|
715
|
+
function IsPrecedenceOr(pattern) {
|
|
716
|
+
let count = 0;
|
|
717
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
718
|
+
if (IsOpenParen(pattern, index))
|
|
719
|
+
count += 1;
|
|
720
|
+
if (IsCloseParen(pattern, index))
|
|
721
|
+
count -= 1;
|
|
722
|
+
if (IsSeparator(pattern, index) && count === 0)
|
|
723
|
+
return true;
|
|
724
|
+
}
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
function IsPrecedenceAnd(pattern) {
|
|
728
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
729
|
+
if (IsOpenParen(pattern, index))
|
|
730
|
+
return true;
|
|
731
|
+
}
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
734
|
+
function Or(pattern) {
|
|
735
|
+
let [count, start] = [0, 0];
|
|
736
|
+
const expressions = [];
|
|
737
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
738
|
+
if (IsOpenParen(pattern, index))
|
|
739
|
+
count += 1;
|
|
740
|
+
if (IsCloseParen(pattern, index))
|
|
741
|
+
count -= 1;
|
|
742
|
+
if (IsSeparator(pattern, index) && count === 0) {
|
|
743
|
+
const range2 = pattern.slice(start, index);
|
|
744
|
+
if (range2.length > 0)
|
|
745
|
+
expressions.push(TemplateLiteralParse(range2));
|
|
746
|
+
start = index + 1;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
const range = pattern.slice(start);
|
|
750
|
+
if (range.length > 0)
|
|
751
|
+
expressions.push(TemplateLiteralParse(range));
|
|
752
|
+
if (expressions.length === 0)
|
|
753
|
+
return { type: "const", const: "" };
|
|
754
|
+
if (expressions.length === 1)
|
|
755
|
+
return expressions[0];
|
|
756
|
+
return { type: "or", expr: expressions };
|
|
757
|
+
}
|
|
758
|
+
function And(pattern) {
|
|
759
|
+
function Group(value, index) {
|
|
760
|
+
if (!IsOpenParen(value, index))
|
|
761
|
+
throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`);
|
|
762
|
+
let count = 0;
|
|
763
|
+
for (let scan = index; scan < value.length; scan++) {
|
|
764
|
+
if (IsOpenParen(value, scan))
|
|
765
|
+
count += 1;
|
|
766
|
+
if (IsCloseParen(value, scan))
|
|
767
|
+
count -= 1;
|
|
768
|
+
if (count === 0)
|
|
769
|
+
return [index, scan];
|
|
770
|
+
}
|
|
771
|
+
throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);
|
|
772
|
+
}
|
|
773
|
+
function Range(pattern2, index) {
|
|
774
|
+
for (let scan = index; scan < pattern2.length; scan++) {
|
|
775
|
+
if (IsOpenParen(pattern2, scan))
|
|
776
|
+
return [index, scan];
|
|
777
|
+
}
|
|
778
|
+
return [index, pattern2.length];
|
|
779
|
+
}
|
|
780
|
+
const expressions = [];
|
|
781
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
782
|
+
if (IsOpenParen(pattern, index)) {
|
|
783
|
+
const [start, end] = Group(pattern, index);
|
|
784
|
+
const range = pattern.slice(start, end + 1);
|
|
785
|
+
expressions.push(TemplateLiteralParse(range));
|
|
786
|
+
index = end;
|
|
787
|
+
} else {
|
|
788
|
+
const [start, end] = Range(pattern, index);
|
|
789
|
+
const range = pattern.slice(start, end);
|
|
790
|
+
if (range.length > 0)
|
|
791
|
+
expressions.push(TemplateLiteralParse(range));
|
|
792
|
+
index = end - 1;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
return expressions.length === 0 ? { type: "const", const: "" } : expressions.length === 1 ? expressions[0] : { type: "and", expr: expressions };
|
|
796
|
+
}
|
|
797
|
+
function TemplateLiteralParse(pattern) {
|
|
798
|
+
return IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : IsPrecedenceOr(pattern) ? Or(pattern) : IsPrecedenceAnd(pattern) ? And(pattern) : { type: "const", const: Unescape(pattern) };
|
|
799
|
+
}
|
|
800
|
+
function TemplateLiteralParseExact(pattern) {
|
|
801
|
+
return TemplateLiteralParse(pattern.slice(1, pattern.length - 1));
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs
|
|
805
|
+
var TemplateLiteralFiniteError = class extends TypeBoxError {
|
|
806
|
+
};
|
|
807
|
+
function IsNumberExpression(expression) {
|
|
808
|
+
return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "0" && expression.expr[1].type === "const" && expression.expr[1].const === "[1-9][0-9]*";
|
|
809
|
+
}
|
|
810
|
+
function IsBooleanExpression(expression) {
|
|
811
|
+
return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "true" && expression.expr[1].type === "const" && expression.expr[1].const === "false";
|
|
812
|
+
}
|
|
813
|
+
function IsStringExpression(expression) {
|
|
814
|
+
return expression.type === "const" && expression.const === ".*";
|
|
815
|
+
}
|
|
816
|
+
function IsTemplateLiteralExpressionFinite(expression) {
|
|
817
|
+
return IsNumberExpression(expression) || IsStringExpression(expression) ? false : IsBooleanExpression(expression) ? true : expression.type === "and" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "or" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "const" ? true : (() => {
|
|
818
|
+
throw new TemplateLiteralFiniteError(`Unknown expression type`);
|
|
819
|
+
})();
|
|
820
|
+
}
|
|
821
|
+
function IsTemplateLiteralFinite(schema) {
|
|
822
|
+
const expression = TemplateLiteralParseExact(schema.pattern);
|
|
823
|
+
return IsTemplateLiteralExpressionFinite(expression);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs
|
|
827
|
+
var TemplateLiteralGenerateError = class extends TypeBoxError {
|
|
828
|
+
};
|
|
829
|
+
function* GenerateReduce(buffer) {
|
|
830
|
+
if (buffer.length === 1)
|
|
831
|
+
return yield* buffer[0];
|
|
832
|
+
for (const left of buffer[0]) {
|
|
833
|
+
for (const right of GenerateReduce(buffer.slice(1))) {
|
|
834
|
+
yield `${left}${right}`;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
function* GenerateAnd(expression) {
|
|
839
|
+
return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)]));
|
|
840
|
+
}
|
|
841
|
+
function* GenerateOr(expression) {
|
|
842
|
+
for (const expr of expression.expr)
|
|
843
|
+
yield* TemplateLiteralExpressionGenerate(expr);
|
|
844
|
+
}
|
|
845
|
+
function* GenerateConst(expression) {
|
|
846
|
+
return yield expression.const;
|
|
847
|
+
}
|
|
848
|
+
function* TemplateLiteralExpressionGenerate(expression) {
|
|
849
|
+
return expression.type === "and" ? yield* GenerateAnd(expression) : expression.type === "or" ? yield* GenerateOr(expression) : expression.type === "const" ? yield* GenerateConst(expression) : (() => {
|
|
850
|
+
throw new TemplateLiteralGenerateError("Unknown expression");
|
|
851
|
+
})();
|
|
852
|
+
}
|
|
853
|
+
function TemplateLiteralGenerate(schema) {
|
|
854
|
+
const expression = TemplateLiteralParseExact(schema.pattern);
|
|
855
|
+
return IsTemplateLiteralExpressionFinite(expression) ? [...TemplateLiteralExpressionGenerate(expression)] : [];
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs
|
|
859
|
+
function Literal(value, options = {}) {
|
|
860
|
+
return {
|
|
861
|
+
...options,
|
|
862
|
+
[Kind]: "Literal",
|
|
863
|
+
const: value,
|
|
864
|
+
type: typeof value
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs
|
|
869
|
+
function Boolean(options = {}) {
|
|
870
|
+
return {
|
|
871
|
+
...options,
|
|
872
|
+
[Kind]: "Boolean",
|
|
873
|
+
type: "boolean"
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
// node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs
|
|
878
|
+
function BigInt(options = {}) {
|
|
879
|
+
return {
|
|
880
|
+
...options,
|
|
881
|
+
[Kind]: "BigInt",
|
|
882
|
+
type: "bigint"
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// node_modules/@sinclair/typebox/build/esm/type/number/number.mjs
|
|
887
|
+
function Number(options = {}) {
|
|
888
|
+
return {
|
|
889
|
+
...options,
|
|
890
|
+
[Kind]: "Number",
|
|
891
|
+
type: "number"
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// node_modules/@sinclair/typebox/build/esm/type/string/string.mjs
|
|
896
|
+
function String(options = {}) {
|
|
897
|
+
return { ...options, [Kind]: "String", type: "string" };
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
|
|
901
|
+
function* FromUnion(syntax) {
|
|
902
|
+
const trim = syntax.trim().replace(/"|'/g, "");
|
|
903
|
+
return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number() : trim === "bigint" ? yield BigInt() : trim === "string" ? yield String() : yield (() => {
|
|
904
|
+
const literals = trim.split("|").map((literal) => Literal(literal.trim()));
|
|
905
|
+
return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
|
|
906
|
+
})();
|
|
907
|
+
}
|
|
908
|
+
function* FromTerminal(syntax) {
|
|
909
|
+
if (syntax[1] !== "{") {
|
|
910
|
+
const L = Literal("$");
|
|
911
|
+
const R = FromSyntax(syntax.slice(1));
|
|
912
|
+
return yield* [L, ...R];
|
|
913
|
+
}
|
|
914
|
+
for (let i = 2; i < syntax.length; i++) {
|
|
915
|
+
if (syntax[i] === "}") {
|
|
916
|
+
const L = FromUnion(syntax.slice(2, i));
|
|
917
|
+
const R = FromSyntax(syntax.slice(i + 1));
|
|
918
|
+
return yield* [...L, ...R];
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
yield Literal(syntax);
|
|
922
|
+
}
|
|
923
|
+
function* FromSyntax(syntax) {
|
|
924
|
+
for (let i = 0; i < syntax.length; i++) {
|
|
925
|
+
if (syntax[i] === "$") {
|
|
926
|
+
const L = Literal(syntax.slice(0, i));
|
|
927
|
+
const R = FromTerminal(syntax.slice(i));
|
|
928
|
+
return yield* [L, ...R];
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
yield Literal(syntax);
|
|
932
|
+
}
|
|
933
|
+
function TemplateLiteralSyntax(syntax) {
|
|
934
|
+
return [...FromSyntax(syntax)];
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs
|
|
938
|
+
var TemplateLiteralPatternError = class extends TypeBoxError {
|
|
939
|
+
};
|
|
940
|
+
function Escape(value) {
|
|
941
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
942
|
+
}
|
|
943
|
+
function Visit2(schema, acc) {
|
|
944
|
+
return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber2(schema) ? `${acc}${PatternNumber}` : IsInteger(schema) ? `${acc}${PatternNumber}` : IsBigInt2(schema) ? `${acc}${PatternNumber}` : IsString2(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean2(schema) ? `${acc}${PatternBoolean}` : (() => {
|
|
945
|
+
throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
|
|
946
|
+
})();
|
|
947
|
+
}
|
|
948
|
+
function TemplateLiteralPattern(kinds) {
|
|
949
|
+
return `^${kinds.map((schema) => Visit2(schema, "")).join("")}$`;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs
|
|
953
|
+
function TemplateLiteralToUnion(schema) {
|
|
954
|
+
const R = TemplateLiteralGenerate(schema);
|
|
955
|
+
const L = R.map((S) => Literal(S));
|
|
956
|
+
return UnionEvaluated(L);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs
|
|
960
|
+
function TemplateLiteral(unresolved, options = {}) {
|
|
961
|
+
const pattern = IsString(unresolved) ? TemplateLiteralPattern(TemplateLiteralSyntax(unresolved)) : TemplateLiteralPattern(unresolved);
|
|
962
|
+
return { ...options, [Kind]: "TemplateLiteral", type: "string", pattern };
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
// node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs
|
|
966
|
+
function FromTemplateLiteral(T) {
|
|
967
|
+
const R = TemplateLiteralGenerate(T);
|
|
968
|
+
return R.map((S) => S.toString());
|
|
969
|
+
}
|
|
970
|
+
function FromUnion2(T) {
|
|
971
|
+
const Acc = [];
|
|
972
|
+
for (const L of T)
|
|
973
|
+
Acc.push(...IndexPropertyKeys(L));
|
|
974
|
+
return Acc;
|
|
975
|
+
}
|
|
976
|
+
function FromLiteral(T) {
|
|
977
|
+
return [T.toString()];
|
|
978
|
+
}
|
|
979
|
+
function IndexPropertyKeys(T) {
|
|
980
|
+
return [...new Set(IsTemplateLiteral(T) ? FromTemplateLiteral(T) : IsUnion(T) ? FromUnion2(T.anyOf) : IsLiteral(T) ? FromLiteral(T.const) : IsNumber2(T) ? ["[number]"] : IsInteger(T) ? ["[number]"] : [])];
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
|
|
984
|
+
function FromProperties(T, P, options) {
|
|
985
|
+
const Acc = {};
|
|
986
|
+
for (const K2 of Object.getOwnPropertyNames(P)) {
|
|
987
|
+
Acc[K2] = Index(T, IndexPropertyKeys(P[K2]), options);
|
|
988
|
+
}
|
|
989
|
+
return Acc;
|
|
990
|
+
}
|
|
991
|
+
function FromMappedResult(T, R, options) {
|
|
992
|
+
return FromProperties(T, R.properties, options);
|
|
993
|
+
}
|
|
994
|
+
function IndexFromMappedResult(T, R, options) {
|
|
995
|
+
const P = FromMappedResult(T, R, options);
|
|
996
|
+
return MappedResult(P);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
// node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs
|
|
1000
|
+
function FromRest(T, K) {
|
|
1001
|
+
return T.map((L) => IndexFromPropertyKey(L, K));
|
|
1002
|
+
}
|
|
1003
|
+
function FromIntersectRest(T) {
|
|
1004
|
+
return T.filter((L) => !IsNever(L));
|
|
1005
|
+
}
|
|
1006
|
+
function FromIntersect(T, K) {
|
|
1007
|
+
return IntersectEvaluated(FromIntersectRest(FromRest(T, K)));
|
|
1008
|
+
}
|
|
1009
|
+
function FromUnionRest(T) {
|
|
1010
|
+
return T.some((L) => IsNever(L)) ? [] : T;
|
|
1011
|
+
}
|
|
1012
|
+
function FromUnion3(T, K) {
|
|
1013
|
+
return UnionEvaluated(FromUnionRest(FromRest(T, K)));
|
|
1014
|
+
}
|
|
1015
|
+
function FromTuple(T, K) {
|
|
1016
|
+
return K in T ? T[K] : K === "[number]" ? UnionEvaluated(T) : Never();
|
|
1017
|
+
}
|
|
1018
|
+
function FromArray(T, K) {
|
|
1019
|
+
return K === "[number]" ? T : Never();
|
|
1020
|
+
}
|
|
1021
|
+
function FromProperty(T, K) {
|
|
1022
|
+
return K in T ? T[K] : Never();
|
|
1023
|
+
}
|
|
1024
|
+
function IndexFromPropertyKey(T, K) {
|
|
1025
|
+
return IsIntersect(T) ? FromIntersect(T.allOf, K) : IsUnion(T) ? FromUnion3(T.anyOf, K) : IsTuple(T) ? FromTuple(T.items ?? [], K) : IsArray2(T) ? FromArray(T.items, K) : IsObject2(T) ? FromProperty(T.properties, K) : Never();
|
|
1026
|
+
}
|
|
1027
|
+
function IndexFromPropertyKeys(T, K) {
|
|
1028
|
+
return K.map((L) => IndexFromPropertyKey(T, L));
|
|
1029
|
+
}
|
|
1030
|
+
function FromSchema(T, K) {
|
|
1031
|
+
return UnionEvaluated(IndexFromPropertyKeys(T, K));
|
|
1032
|
+
}
|
|
1033
|
+
function Index(T, K, options = {}) {
|
|
1034
|
+
return IsMappedResult(K) ? CloneType(IndexFromMappedResult(T, K, options)) : IsMappedKey(K) ? CloneType(IndexFromMappedKey(T, K, options)) : IsSchema(K) ? CloneType(FromSchema(T, IndexPropertyKeys(K)), options) : CloneType(FromSchema(T, K), options);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
|
|
1038
|
+
function MappedIndexPropertyKey(T, K, options) {
|
|
1039
|
+
return { [K]: Index(T, [K], options) };
|
|
1040
|
+
}
|
|
1041
|
+
function MappedIndexPropertyKeys(T, K, options) {
|
|
1042
|
+
return K.reduce((Acc, L) => {
|
|
1043
|
+
return { ...Acc, ...MappedIndexPropertyKey(T, L, options) };
|
|
1044
|
+
}, {});
|
|
1045
|
+
}
|
|
1046
|
+
function MappedIndexProperties(T, K, options) {
|
|
1047
|
+
return MappedIndexPropertyKeys(T, K.keys, options);
|
|
1048
|
+
}
|
|
1049
|
+
function IndexFromMappedKey(T, K, options) {
|
|
1050
|
+
const P = MappedIndexProperties(T, K, options);
|
|
1051
|
+
return MappedResult(P);
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
// node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs
|
|
1055
|
+
function Iterator(items, options = {}) {
|
|
1056
|
+
return {
|
|
1057
|
+
...options,
|
|
1058
|
+
[Kind]: "Iterator",
|
|
1059
|
+
type: "Iterator",
|
|
1060
|
+
items: CloneType(items)
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
|
|
1065
|
+
function _Object(properties, options = {}) {
|
|
1066
|
+
const propertyKeys = globalThis.Object.getOwnPropertyNames(properties);
|
|
1067
|
+
const optionalKeys = propertyKeys.filter((key) => IsOptional(properties[key]));
|
|
1068
|
+
const requiredKeys = propertyKeys.filter((name) => !optionalKeys.includes(name));
|
|
1069
|
+
const clonedAdditionalProperties = IsSchema(options.additionalProperties) ? { additionalProperties: CloneType(options.additionalProperties) } : {};
|
|
1070
|
+
const clonedProperties = {};
|
|
1071
|
+
for (const key of propertyKeys)
|
|
1072
|
+
clonedProperties[key] = CloneType(properties[key]);
|
|
1073
|
+
return requiredKeys.length > 0 ? { ...options, ...clonedAdditionalProperties, [Kind]: "Object", type: "object", properties: clonedProperties, required: requiredKeys } : { ...options, ...clonedAdditionalProperties, [Kind]: "Object", type: "object", properties: clonedProperties };
|
|
1074
|
+
}
|
|
1075
|
+
var Object2 = _Object;
|
|
1076
|
+
|
|
1077
|
+
// node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs
|
|
1078
|
+
function Promise2(item, options = {}) {
|
|
1079
|
+
return {
|
|
1080
|
+
...options,
|
|
1081
|
+
[Kind]: "Promise",
|
|
1082
|
+
type: "Promise",
|
|
1083
|
+
item: CloneType(item)
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs
|
|
1088
|
+
function RemoveReadonly(schema) {
|
|
1089
|
+
return Discard(CloneType(schema), [ReadonlyKind]);
|
|
1090
|
+
}
|
|
1091
|
+
function AddReadonly(schema) {
|
|
1092
|
+
return { ...CloneType(schema), [ReadonlyKind]: "Readonly" };
|
|
1093
|
+
}
|
|
1094
|
+
function ReadonlyWithFlag(schema, F) {
|
|
1095
|
+
return F === false ? RemoveReadonly(schema) : AddReadonly(schema);
|
|
1096
|
+
}
|
|
1097
|
+
function Readonly(schema, enable) {
|
|
1098
|
+
const F = enable ?? true;
|
|
1099
|
+
return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
// node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
|
|
1103
|
+
function FromProperties2(K, F) {
|
|
1104
|
+
const Acc = {};
|
|
1105
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(K))
|
|
1106
|
+
Acc[K2] = Readonly(K[K2], F);
|
|
1107
|
+
return Acc;
|
|
1108
|
+
}
|
|
1109
|
+
function FromMappedResult2(R, F) {
|
|
1110
|
+
return FromProperties2(R.properties, F);
|
|
1111
|
+
}
|
|
1112
|
+
function ReadonlyFromMappedResult(R, F) {
|
|
1113
|
+
const P = FromMappedResult2(R, F);
|
|
1114
|
+
return MappedResult(P);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
// node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs
|
|
1118
|
+
function Tuple(items, options = {}) {
|
|
1119
|
+
const [additionalItems, minItems, maxItems] = [false, items.length, items.length];
|
|
1120
|
+
return items.length > 0 ? { ...options, [Kind]: "Tuple", type: "array", items: CloneRest(items), additionalItems, minItems, maxItems } : { ...options, [Kind]: "Tuple", type: "array", minItems, maxItems };
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
// node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs
|
|
1124
|
+
function FromMappedResult3(K, P) {
|
|
1125
|
+
return K in P ? FromSchemaType(K, P[K]) : MappedResult(P);
|
|
1126
|
+
}
|
|
1127
|
+
function MappedKeyToKnownMappedResultProperties(K) {
|
|
1128
|
+
return { [K]: Literal(K) };
|
|
1129
|
+
}
|
|
1130
|
+
function MappedKeyToUnknownMappedResultProperties(P) {
|
|
1131
|
+
const Acc = {};
|
|
1132
|
+
for (const L of P)
|
|
1133
|
+
Acc[L] = Literal(L);
|
|
1134
|
+
return Acc;
|
|
1135
|
+
}
|
|
1136
|
+
function MappedKeyToMappedResultProperties(K, P) {
|
|
1137
|
+
return SetIncludes(P, K) ? MappedKeyToKnownMappedResultProperties(K) : MappedKeyToUnknownMappedResultProperties(P);
|
|
1138
|
+
}
|
|
1139
|
+
function FromMappedKey(K, P) {
|
|
1140
|
+
const R = MappedKeyToMappedResultProperties(K, P);
|
|
1141
|
+
return FromMappedResult3(K, R);
|
|
1142
|
+
}
|
|
1143
|
+
function FromRest2(K, T) {
|
|
1144
|
+
return T.map((L) => FromSchemaType(K, L));
|
|
1145
|
+
}
|
|
1146
|
+
function FromProperties3(K, T) {
|
|
1147
|
+
const Acc = {};
|
|
1148
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(T))
|
|
1149
|
+
Acc[K2] = FromSchemaType(K, T[K2]);
|
|
1150
|
+
return Acc;
|
|
1151
|
+
}
|
|
1152
|
+
function FromSchemaType(K, T) {
|
|
1153
|
+
return (
|
|
1154
|
+
// unevaluated modifier types
|
|
1155
|
+
IsOptional(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) : IsReadonly(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) : (
|
|
1156
|
+
// unevaluated mapped types
|
|
1157
|
+
IsMappedResult(T) ? FromMappedResult3(K, T.properties) : IsMappedKey(T) ? FromMappedKey(K, T.keys) : (
|
|
1158
|
+
// unevaluated types
|
|
1159
|
+
IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns)) : IsFunction2(T) ? Function(FromRest2(K, T.parameters), FromSchemaType(K, T.returns)) : IsAsyncIterator2(T) ? AsyncIterator(FromSchemaType(K, T.items)) : IsIterator2(T) ? Iterator(FromSchemaType(K, T.items)) : IsIntersect(T) ? Intersect(FromRest2(K, T.allOf)) : IsUnion(T) ? Union(FromRest2(K, T.anyOf)) : IsTuple(T) ? Tuple(FromRest2(K, T.items ?? [])) : IsObject2(T) ? Object2(FromProperties3(K, T.properties)) : IsArray2(T) ? Array2(FromSchemaType(K, T.items)) : IsPromise(T) ? Promise2(FromSchemaType(K, T.item)) : T
|
|
1160
|
+
)
|
|
1161
|
+
)
|
|
1162
|
+
);
|
|
1163
|
+
}
|
|
1164
|
+
function MappedFunctionReturnType(K, T) {
|
|
1165
|
+
const Acc = {};
|
|
1166
|
+
for (const L of K)
|
|
1167
|
+
Acc[L] = FromSchemaType(L, T);
|
|
1168
|
+
return Acc;
|
|
1169
|
+
}
|
|
1170
|
+
function Mapped(key, map, options = {}) {
|
|
1171
|
+
const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
1172
|
+
const RT = map({ [Kind]: "MappedKey", keys: K });
|
|
1173
|
+
const R = MappedFunctionReturnType(K, RT);
|
|
1174
|
+
return CloneType(Object2(R), options);
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
// node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs
|
|
1178
|
+
function RemoveOptional(schema) {
|
|
1179
|
+
return Discard(CloneType(schema), [OptionalKind]);
|
|
1180
|
+
}
|
|
1181
|
+
function AddOptional(schema) {
|
|
1182
|
+
return { ...CloneType(schema), [OptionalKind]: "Optional" };
|
|
1183
|
+
}
|
|
1184
|
+
function OptionalWithFlag(schema, F) {
|
|
1185
|
+
return F === false ? RemoveOptional(schema) : AddOptional(schema);
|
|
1186
|
+
}
|
|
1187
|
+
function Optional(schema, enable) {
|
|
1188
|
+
const F = enable ?? true;
|
|
1189
|
+
return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
|
|
1193
|
+
function FromProperties4(P, F) {
|
|
1194
|
+
const Acc = {};
|
|
1195
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
1196
|
+
Acc[K2] = Optional(P[K2], F);
|
|
1197
|
+
return Acc;
|
|
1198
|
+
}
|
|
1199
|
+
function FromMappedResult4(R, F) {
|
|
1200
|
+
return FromProperties4(R.properties, F);
|
|
1201
|
+
}
|
|
1202
|
+
function OptionalFromMappedResult(R, F) {
|
|
1203
|
+
const P = FromMappedResult4(R, F);
|
|
1204
|
+
return MappedResult(P);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
// node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
|
|
1208
|
+
function IntersectCreate(T, options) {
|
|
1209
|
+
const allObjects = T.every((schema) => IsObject2(schema));
|
|
1210
|
+
const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) ? { unevaluatedProperties: CloneType(options.unevaluatedProperties) } : {};
|
|
1211
|
+
return options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects ? { ...options, ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: CloneRest(T) } : { ...options, ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: CloneRest(T) };
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
// node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
|
|
1215
|
+
function IsIntersectOptional(T) {
|
|
1216
|
+
return T.every((L) => IsOptional(L));
|
|
1217
|
+
}
|
|
1218
|
+
function RemoveOptionalFromType2(T) {
|
|
1219
|
+
return Discard(T, [OptionalKind]);
|
|
1220
|
+
}
|
|
1221
|
+
function RemoveOptionalFromRest2(T) {
|
|
1222
|
+
return T.map((L) => IsOptional(L) ? RemoveOptionalFromType2(L) : L);
|
|
1223
|
+
}
|
|
1224
|
+
function ResolveIntersect(T, options) {
|
|
1225
|
+
return IsIntersectOptional(T) ? Optional(IntersectCreate(RemoveOptionalFromRest2(T), options)) : IntersectCreate(RemoveOptionalFromRest2(T), options);
|
|
1226
|
+
}
|
|
1227
|
+
function IntersectEvaluated(T, options = {}) {
|
|
1228
|
+
if (T.length === 0)
|
|
1229
|
+
return Never(options);
|
|
1230
|
+
if (T.length === 1)
|
|
1231
|
+
return CloneType(T[0], options);
|
|
1232
|
+
if (T.some((schema) => IsTransform(schema)))
|
|
1233
|
+
throw new Error("Cannot intersect transform types");
|
|
1234
|
+
return ResolveIntersect(T, options);
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
// node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs
|
|
1238
|
+
function Intersect(T, options = {}) {
|
|
1239
|
+
if (T.length === 0)
|
|
1240
|
+
return Never(options);
|
|
1241
|
+
if (T.length === 1)
|
|
1242
|
+
return CloneType(T[0], options);
|
|
1243
|
+
if (T.some((schema) => IsTransform(schema)))
|
|
1244
|
+
throw new Error("Cannot intersect transform types");
|
|
1245
|
+
return IntersectCreate(T, options);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
// node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs
|
|
1249
|
+
function FromRest3(T) {
|
|
1250
|
+
return T.map((L) => AwaitedResolve(L));
|
|
1251
|
+
}
|
|
1252
|
+
function FromIntersect2(T) {
|
|
1253
|
+
return Intersect(FromRest3(T));
|
|
1254
|
+
}
|
|
1255
|
+
function FromUnion4(T) {
|
|
1256
|
+
return Union(FromRest3(T));
|
|
1257
|
+
}
|
|
1258
|
+
function FromPromise(T) {
|
|
1259
|
+
return AwaitedResolve(T);
|
|
1260
|
+
}
|
|
1261
|
+
function AwaitedResolve(T) {
|
|
1262
|
+
return IsIntersect(T) ? FromIntersect2(T.allOf) : IsUnion(T) ? FromUnion4(T.anyOf) : IsPromise(T) ? FromPromise(T.item) : T;
|
|
1263
|
+
}
|
|
1264
|
+
function Awaited(T, options = {}) {
|
|
1265
|
+
return CloneType(AwaitedResolve(T), options);
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
|
|
1269
|
+
function FromRest4(T) {
|
|
1270
|
+
const Acc = [];
|
|
1271
|
+
for (const L of T)
|
|
1272
|
+
Acc.push(KeyOfPropertyKeys(L));
|
|
1273
|
+
return Acc;
|
|
1274
|
+
}
|
|
1275
|
+
function FromIntersect3(T) {
|
|
1276
|
+
const C = FromRest4(T);
|
|
1277
|
+
const R = SetUnionMany(C);
|
|
1278
|
+
return R;
|
|
1279
|
+
}
|
|
1280
|
+
function FromUnion5(T) {
|
|
1281
|
+
const C = FromRest4(T);
|
|
1282
|
+
const R = SetIntersectMany(C);
|
|
1283
|
+
return R;
|
|
1284
|
+
}
|
|
1285
|
+
function FromTuple2(T) {
|
|
1286
|
+
return T.map((_, I) => I.toString());
|
|
1287
|
+
}
|
|
1288
|
+
function FromArray2(_) {
|
|
1289
|
+
return ["[number]"];
|
|
1290
|
+
}
|
|
1291
|
+
function FromProperties5(T) {
|
|
1292
|
+
return globalThis.Object.getOwnPropertyNames(T);
|
|
1293
|
+
}
|
|
1294
|
+
function FromPatternProperties(patternProperties) {
|
|
1295
|
+
if (!includePatternProperties)
|
|
1296
|
+
return [];
|
|
1297
|
+
const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties);
|
|
1298
|
+
return patternPropertyKeys.map((key) => {
|
|
1299
|
+
return key[0] === "^" && key[key.length - 1] === "$" ? key.slice(1, key.length - 1) : key;
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
function KeyOfPropertyKeys(T) {
|
|
1303
|
+
return IsIntersect(T) ? FromIntersect3(T.allOf) : IsUnion(T) ? FromUnion5(T.anyOf) : IsTuple(T) ? FromTuple2(T.items ?? []) : IsArray2(T) ? FromArray2(T.items) : IsObject2(T) ? FromProperties5(T.properties) : IsRecord(T) ? FromPatternProperties(T.patternProperties) : [];
|
|
1304
|
+
}
|
|
1305
|
+
var includePatternProperties = false;
|
|
1306
|
+
|
|
1307
|
+
// node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs
|
|
1308
|
+
function KeyOfPropertyKeysToRest(T) {
|
|
1309
|
+
return T.map((L) => L === "[number]" ? Number() : Literal(L));
|
|
1310
|
+
}
|
|
1311
|
+
function KeyOf(T, options = {}) {
|
|
1312
|
+
if (IsMappedResult(T)) {
|
|
1313
|
+
return KeyOfFromMappedResult(T, options);
|
|
1314
|
+
} else {
|
|
1315
|
+
const K = KeyOfPropertyKeys(T);
|
|
1316
|
+
const S = KeyOfPropertyKeysToRest(K);
|
|
1317
|
+
const U = UnionEvaluated(S);
|
|
1318
|
+
return CloneType(U, options);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
// node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
|
|
1323
|
+
function FromProperties6(K, options) {
|
|
1324
|
+
const Acc = {};
|
|
1325
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(K))
|
|
1326
|
+
Acc[K2] = KeyOf(K[K2], options);
|
|
1327
|
+
return Acc;
|
|
1328
|
+
}
|
|
1329
|
+
function FromMappedResult5(R, options) {
|
|
1330
|
+
return FromProperties6(R.properties, options);
|
|
1331
|
+
}
|
|
1332
|
+
function KeyOfFromMappedResult(R, options) {
|
|
1333
|
+
const P = FromMappedResult5(R, options);
|
|
1334
|
+
return MappedResult(P);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
// node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs
|
|
1338
|
+
function CompositeKeys(T) {
|
|
1339
|
+
const Acc = [];
|
|
1340
|
+
for (const L of T)
|
|
1341
|
+
Acc.push(...KeyOfPropertyKeys(L));
|
|
1342
|
+
return SetDistinct(Acc);
|
|
1343
|
+
}
|
|
1344
|
+
function FilterNever(T) {
|
|
1345
|
+
return T.filter((L) => !IsNever(L));
|
|
1346
|
+
}
|
|
1347
|
+
function CompositeProperty(T, K) {
|
|
1348
|
+
const Acc = [];
|
|
1349
|
+
for (const L of T)
|
|
1350
|
+
Acc.push(...IndexFromPropertyKeys(L, [K]));
|
|
1351
|
+
return FilterNever(Acc);
|
|
1352
|
+
}
|
|
1353
|
+
function CompositeProperties(T, K) {
|
|
1354
|
+
const Acc = {};
|
|
1355
|
+
for (const L of K) {
|
|
1356
|
+
Acc[L] = IntersectEvaluated(CompositeProperty(T, L));
|
|
1357
|
+
}
|
|
1358
|
+
return Acc;
|
|
1359
|
+
}
|
|
1360
|
+
function Composite(T, options = {}) {
|
|
1361
|
+
const K = CompositeKeys(T);
|
|
1362
|
+
const P = CompositeProperties(T, K);
|
|
1363
|
+
const R = Object2(P, options);
|
|
1364
|
+
return R;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
// node_modules/@sinclair/typebox/build/esm/type/date/date.mjs
|
|
1368
|
+
function Date2(options = {}) {
|
|
1369
|
+
return {
|
|
1370
|
+
...options,
|
|
1371
|
+
[Kind]: "Date",
|
|
1372
|
+
type: "Date"
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
// node_modules/@sinclair/typebox/build/esm/type/null/null.mjs
|
|
1377
|
+
function Null(options = {}) {
|
|
1378
|
+
return {
|
|
1379
|
+
...options,
|
|
1380
|
+
[Kind]: "Null",
|
|
1381
|
+
type: "null"
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
// node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs
|
|
1386
|
+
function Symbol2(options) {
|
|
1387
|
+
return { ...options, [Kind]: "Symbol", type: "symbol" };
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs
|
|
1391
|
+
function Undefined(options = {}) {
|
|
1392
|
+
return { ...options, [Kind]: "Undefined", type: "undefined" };
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs
|
|
1396
|
+
function Uint8Array2(options = {}) {
|
|
1397
|
+
return { ...options, [Kind]: "Uint8Array", type: "Uint8Array" };
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
// node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs
|
|
1401
|
+
function Unknown(options = {}) {
|
|
1402
|
+
return {
|
|
1403
|
+
...options,
|
|
1404
|
+
[Kind]: "Unknown"
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
// node_modules/@sinclair/typebox/build/esm/type/const/const.mjs
|
|
1409
|
+
function FromArray3(T) {
|
|
1410
|
+
return T.map((L) => FromValue(L, false));
|
|
1411
|
+
}
|
|
1412
|
+
function FromProperties7(value) {
|
|
1413
|
+
const Acc = {};
|
|
1414
|
+
for (const K of globalThis.Object.getOwnPropertyNames(value))
|
|
1415
|
+
Acc[K] = Readonly(FromValue(value[K], false));
|
|
1416
|
+
return Acc;
|
|
1417
|
+
}
|
|
1418
|
+
function ConditionalReadonly(T, root) {
|
|
1419
|
+
return root === true ? T : Readonly(T);
|
|
1420
|
+
}
|
|
1421
|
+
function FromValue(value, root) {
|
|
1422
|
+
return IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : IsIterator(value) ? ConditionalReadonly(Any(), root) : IsArray(value) ? Readonly(Tuple(FromArray3(value))) : IsUint8Array(value) ? Uint8Array2() : IsDate(value) ? Date2() : IsObject(value) ? ConditionalReadonly(Object2(FromProperties7(value)), root) : IsFunction(value) ? ConditionalReadonly(Function([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ? BigInt() : IsNumber(value) ? Literal(value) : IsBoolean(value) ? Literal(value) : IsString(value) ? Literal(value) : Object2({});
|
|
1423
|
+
}
|
|
1424
|
+
function Const(T, options = {}) {
|
|
1425
|
+
return CloneType(FromValue(T, true), options);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
// node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
|
|
1429
|
+
function ConstructorParameters(schema, options = {}) {
|
|
1430
|
+
return Tuple(CloneRest(schema.parameters), { ...options });
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
// node_modules/@sinclair/typebox/build/esm/type/deref/deref.mjs
|
|
1434
|
+
function FromRest5(schema, references) {
|
|
1435
|
+
return schema.map((schema2) => Deref(schema2, references));
|
|
1436
|
+
}
|
|
1437
|
+
function FromProperties8(properties, references) {
|
|
1438
|
+
const Acc = {};
|
|
1439
|
+
for (const K of globalThis.Object.getOwnPropertyNames(properties)) {
|
|
1440
|
+
Acc[K] = Deref(properties[K], references);
|
|
1441
|
+
}
|
|
1442
|
+
return Acc;
|
|
1443
|
+
}
|
|
1444
|
+
function FromConstructor(schema, references) {
|
|
1445
|
+
schema.parameters = FromRest5(schema.parameters, references);
|
|
1446
|
+
schema.returns = Deref(schema.returns, references);
|
|
1447
|
+
return schema;
|
|
1448
|
+
}
|
|
1449
|
+
function FromFunction(schema, references) {
|
|
1450
|
+
schema.parameters = FromRest5(schema.parameters, references);
|
|
1451
|
+
schema.returns = Deref(schema.returns, references);
|
|
1452
|
+
return schema;
|
|
1453
|
+
}
|
|
1454
|
+
function FromIntersect4(schema, references) {
|
|
1455
|
+
schema.allOf = FromRest5(schema.allOf, references);
|
|
1456
|
+
return schema;
|
|
1457
|
+
}
|
|
1458
|
+
function FromUnion6(schema, references) {
|
|
1459
|
+
schema.anyOf = FromRest5(schema.anyOf, references);
|
|
1460
|
+
return schema;
|
|
1461
|
+
}
|
|
1462
|
+
function FromTuple3(schema, references) {
|
|
1463
|
+
if (IsUndefined(schema.items))
|
|
1464
|
+
return schema;
|
|
1465
|
+
schema.items = FromRest5(schema.items, references);
|
|
1466
|
+
return schema;
|
|
1467
|
+
}
|
|
1468
|
+
function FromArray4(schema, references) {
|
|
1469
|
+
schema.items = Deref(schema.items, references);
|
|
1470
|
+
return schema;
|
|
1471
|
+
}
|
|
1472
|
+
function FromObject(schema, references) {
|
|
1473
|
+
schema.properties = FromProperties8(schema.properties, references);
|
|
1474
|
+
return schema;
|
|
1475
|
+
}
|
|
1476
|
+
function FromPromise2(schema, references) {
|
|
1477
|
+
schema.item = Deref(schema.item, references);
|
|
1478
|
+
return schema;
|
|
1479
|
+
}
|
|
1480
|
+
function FromAsyncIterator(schema, references) {
|
|
1481
|
+
schema.items = Deref(schema.items, references);
|
|
1482
|
+
return schema;
|
|
1483
|
+
}
|
|
1484
|
+
function FromIterator(schema, references) {
|
|
1485
|
+
schema.items = Deref(schema.items, references);
|
|
1486
|
+
return schema;
|
|
1487
|
+
}
|
|
1488
|
+
function FromRef(schema, references) {
|
|
1489
|
+
const target = references.find((remote) => remote.$id === schema.$ref);
|
|
1490
|
+
if (target === void 0)
|
|
1491
|
+
throw Error(`Unable to dereference schema with $id ${schema.$ref}`);
|
|
1492
|
+
const discard = Discard(target, ["$id"]);
|
|
1493
|
+
return Deref(discard, references);
|
|
1494
|
+
}
|
|
1495
|
+
function DerefResolve(schema, references) {
|
|
1496
|
+
return IsConstructor(schema) ? FromConstructor(schema, references) : IsFunction2(schema) ? FromFunction(schema, references) : IsIntersect(schema) ? FromIntersect4(schema, references) : IsUnion(schema) ? FromUnion6(schema, references) : IsTuple(schema) ? FromTuple3(schema, references) : IsArray2(schema) ? FromArray4(schema, references) : IsObject2(schema) ? FromObject(schema, references) : IsPromise(schema) ? FromPromise2(schema, references) : IsAsyncIterator2(schema) ? FromAsyncIterator(schema, references) : IsIterator2(schema) ? FromIterator(schema, references) : IsRef(schema) ? FromRef(schema, references) : schema;
|
|
1497
|
+
}
|
|
1498
|
+
function Deref(schema, references) {
|
|
1499
|
+
return DerefResolve(CloneType(schema), CloneRest(references));
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
// node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
|
|
1503
|
+
function Enum(item, options = {}) {
|
|
1504
|
+
if (IsUndefined(item))
|
|
1505
|
+
throw new Error("Enum undefined or empty");
|
|
1506
|
+
const values1 = globalThis.Object.getOwnPropertyNames(item).filter((key) => isNaN(key)).map((key) => item[key]);
|
|
1507
|
+
const values2 = [...new Set(values1)];
|
|
1508
|
+
const anyOf = values2.map((value) => Literal(value));
|
|
1509
|
+
return Union(anyOf, { ...options, [Hint]: "Enum" });
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
// node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs
|
|
1513
|
+
var ExtendsResolverError = class extends TypeBoxError {
|
|
1514
|
+
};
|
|
1515
|
+
var ExtendsResult;
|
|
1516
|
+
(function(ExtendsResult2) {
|
|
1517
|
+
ExtendsResult2[ExtendsResult2["Union"] = 0] = "Union";
|
|
1518
|
+
ExtendsResult2[ExtendsResult2["True"] = 1] = "True";
|
|
1519
|
+
ExtendsResult2[ExtendsResult2["False"] = 2] = "False";
|
|
1520
|
+
})(ExtendsResult || (ExtendsResult = {}));
|
|
1521
|
+
function IntoBooleanResult(result) {
|
|
1522
|
+
return result === ExtendsResult.False ? result : ExtendsResult.True;
|
|
1523
|
+
}
|
|
1524
|
+
function Throw(message) {
|
|
1525
|
+
throw new ExtendsResolverError(message);
|
|
1526
|
+
}
|
|
1527
|
+
function IsStructuralRight(right) {
|
|
1528
|
+
return type_exports.IsNever(right) || type_exports.IsIntersect(right) || type_exports.IsUnion(right) || type_exports.IsUnknown(right) || type_exports.IsAny(right);
|
|
1529
|
+
}
|
|
1530
|
+
function StructuralRight(left, right) {
|
|
1531
|
+
return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : Throw("StructuralRight");
|
|
1532
|
+
}
|
|
1533
|
+
function FromAnyRight(left, right) {
|
|
1534
|
+
return ExtendsResult.True;
|
|
1535
|
+
}
|
|
1536
|
+
function FromAny(left, right) {
|
|
1537
|
+
return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) && right.anyOf.some((schema) => type_exports.IsAny(schema) || type_exports.IsUnknown(schema)) ? ExtendsResult.True : type_exports.IsUnion(right) ? ExtendsResult.Union : type_exports.IsUnknown(right) ? ExtendsResult.True : type_exports.IsAny(right) ? ExtendsResult.True : ExtendsResult.Union;
|
|
1538
|
+
}
|
|
1539
|
+
function FromArrayRight(left, right) {
|
|
1540
|
+
return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
1541
|
+
}
|
|
1542
|
+
function FromArray5(left, right) {
|
|
1543
|
+
return type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsArray(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
|
|
1544
|
+
}
|
|
1545
|
+
function FromAsyncIterator2(left, right) {
|
|
1546
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsAsyncIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
|
|
1547
|
+
}
|
|
1548
|
+
function FromBigInt(left, right) {
|
|
1549
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBigInt(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1550
|
+
}
|
|
1551
|
+
function FromBooleanRight(left, right) {
|
|
1552
|
+
return type_exports.IsLiteralBoolean(left) ? ExtendsResult.True : type_exports.IsBoolean(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
1553
|
+
}
|
|
1554
|
+
function FromBoolean(left, right) {
|
|
1555
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBoolean(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1556
|
+
}
|
|
1557
|
+
function FromConstructor2(left, right) {
|
|
1558
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsConstructor(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
|
|
1559
|
+
}
|
|
1560
|
+
function FromDate(left, right) {
|
|
1561
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsDate(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1562
|
+
}
|
|
1563
|
+
function FromFunction2(left, right) {
|
|
1564
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsFunction(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
|
|
1565
|
+
}
|
|
1566
|
+
function FromIntegerRight(left, right) {
|
|
1567
|
+
return type_exports.IsLiteral(left) && value_exports.IsNumber(left.const) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
1568
|
+
}
|
|
1569
|
+
function FromInteger(left, right) {
|
|
1570
|
+
return type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : ExtendsResult.False;
|
|
1571
|
+
}
|
|
1572
|
+
function FromIntersectRight(left, right) {
|
|
1573
|
+
return right.allOf.every((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
1574
|
+
}
|
|
1575
|
+
function FromIntersect5(left, right) {
|
|
1576
|
+
return left.allOf.some((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
1577
|
+
}
|
|
1578
|
+
function FromIterator2(left, right) {
|
|
1579
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
|
|
1580
|
+
}
|
|
1581
|
+
function FromLiteral2(left, right) {
|
|
1582
|
+
return type_exports.IsLiteral(right) && right.const === left.const ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : ExtendsResult.False;
|
|
1583
|
+
}
|
|
1584
|
+
function FromNeverRight(left, right) {
|
|
1585
|
+
return ExtendsResult.False;
|
|
1586
|
+
}
|
|
1587
|
+
function FromNever(left, right) {
|
|
1588
|
+
return ExtendsResult.True;
|
|
1589
|
+
}
|
|
1590
|
+
function UnwrapTNot(schema) {
|
|
1591
|
+
let [current, depth] = [schema, 0];
|
|
1592
|
+
while (true) {
|
|
1593
|
+
if (!type_exports.IsNot(current))
|
|
1594
|
+
break;
|
|
1595
|
+
current = current.not;
|
|
1596
|
+
depth += 1;
|
|
1597
|
+
}
|
|
1598
|
+
return depth % 2 === 0 ? current : Unknown();
|
|
1599
|
+
}
|
|
1600
|
+
function FromNot(left, right) {
|
|
1601
|
+
return type_exports.IsNot(left) ? Visit3(UnwrapTNot(left), right) : type_exports.IsNot(right) ? Visit3(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");
|
|
1602
|
+
}
|
|
1603
|
+
function FromNull(left, right) {
|
|
1604
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsNull(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1605
|
+
}
|
|
1606
|
+
function FromNumberRight(left, right) {
|
|
1607
|
+
return type_exports.IsLiteralNumber(left) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
1608
|
+
}
|
|
1609
|
+
function FromNumber(left, right) {
|
|
1610
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1611
|
+
}
|
|
1612
|
+
function IsObjectPropertyCount(schema, count) {
|
|
1613
|
+
return Object.getOwnPropertyNames(schema.properties).length === count;
|
|
1614
|
+
}
|
|
1615
|
+
function IsObjectStringLike(schema) {
|
|
1616
|
+
return IsObjectArrayLike(schema);
|
|
1617
|
+
}
|
|
1618
|
+
function IsObjectSymbolLike(schema) {
|
|
1619
|
+
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties && type_exports.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && (type_exports.IsString(schema.properties.description.anyOf[0]) && type_exports.IsUndefined(schema.properties.description.anyOf[1]) || type_exports.IsString(schema.properties.description.anyOf[1]) && type_exports.IsUndefined(schema.properties.description.anyOf[0]));
|
|
1620
|
+
}
|
|
1621
|
+
function IsObjectNumberLike(schema) {
|
|
1622
|
+
return IsObjectPropertyCount(schema, 0);
|
|
1623
|
+
}
|
|
1624
|
+
function IsObjectBooleanLike(schema) {
|
|
1625
|
+
return IsObjectPropertyCount(schema, 0);
|
|
1626
|
+
}
|
|
1627
|
+
function IsObjectBigIntLike(schema) {
|
|
1628
|
+
return IsObjectPropertyCount(schema, 0);
|
|
1629
|
+
}
|
|
1630
|
+
function IsObjectDateLike(schema) {
|
|
1631
|
+
return IsObjectPropertyCount(schema, 0);
|
|
1632
|
+
}
|
|
1633
|
+
function IsObjectUint8ArrayLike(schema) {
|
|
1634
|
+
return IsObjectArrayLike(schema);
|
|
1635
|
+
}
|
|
1636
|
+
function IsObjectFunctionLike(schema) {
|
|
1637
|
+
const length = Number();
|
|
1638
|
+
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
|
|
1639
|
+
}
|
|
1640
|
+
function IsObjectConstructorLike(schema) {
|
|
1641
|
+
return IsObjectPropertyCount(schema, 0);
|
|
1642
|
+
}
|
|
1643
|
+
function IsObjectArrayLike(schema) {
|
|
1644
|
+
const length = Number();
|
|
1645
|
+
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
|
|
1646
|
+
}
|
|
1647
|
+
function IsObjectPromiseLike(schema) {
|
|
1648
|
+
const then = Function([Any()], Any());
|
|
1649
|
+
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit3(schema.properties["then"], then)) === ExtendsResult.True;
|
|
1650
|
+
}
|
|
1651
|
+
function Property(left, right) {
|
|
1652
|
+
return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False : type_exports.IsOptional(left) && !type_exports.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
|
|
1653
|
+
}
|
|
1654
|
+
function FromObjectRight(left, right) {
|
|
1655
|
+
return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) || type_exports.IsLiteralString(left) && IsObjectStringLike(right) || type_exports.IsLiteralNumber(left) && IsObjectNumberLike(right) || type_exports.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsBigInt(left) && IsObjectBigIntLike(right) || type_exports.IsString(left) && IsObjectStringLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsNumber(left) && IsObjectNumberLike(right) || type_exports.IsInteger(left) && IsObjectNumberLike(right) || type_exports.IsBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || type_exports.IsDate(left) && IsObjectDateLike(right) || type_exports.IsConstructor(left) && IsObjectConstructorLike(right) || type_exports.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : type_exports.IsRecord(left) && type_exports.IsString(RecordKey(left)) ? (() => {
|
|
1656
|
+
return right[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
|
|
1657
|
+
})() : type_exports.IsRecord(left) && type_exports.IsNumber(RecordKey(left)) ? (() => {
|
|
1658
|
+
return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
|
|
1659
|
+
})() : ExtendsResult.False;
|
|
1660
|
+
}
|
|
1661
|
+
function FromObject2(left, right) {
|
|
1662
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : !type_exports.IsObject(right) ? ExtendsResult.False : (() => {
|
|
1663
|
+
for (const key of Object.getOwnPropertyNames(right.properties)) {
|
|
1664
|
+
if (!(key in left.properties) && !type_exports.IsOptional(right.properties[key])) {
|
|
1665
|
+
return ExtendsResult.False;
|
|
1666
|
+
}
|
|
1667
|
+
if (type_exports.IsOptional(right.properties[key])) {
|
|
1668
|
+
return ExtendsResult.True;
|
|
1669
|
+
}
|
|
1670
|
+
if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
|
|
1671
|
+
return ExtendsResult.False;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
return ExtendsResult.True;
|
|
1675
|
+
})();
|
|
1676
|
+
}
|
|
1677
|
+
function FromPromise3(left, right) {
|
|
1678
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : !type_exports.IsPromise(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.item, right.item));
|
|
1679
|
+
}
|
|
1680
|
+
function RecordKey(schema) {
|
|
1681
|
+
return PatternNumberExact in schema.patternProperties ? Number() : PatternStringExact in schema.patternProperties ? String() : Throw("Unknown record key pattern");
|
|
1682
|
+
}
|
|
1683
|
+
function RecordValue(schema) {
|
|
1684
|
+
return PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
|
|
1685
|
+
}
|
|
1686
|
+
function FromRecordRight(left, right) {
|
|
1687
|
+
const [Key, Value] = [RecordKey(right), RecordValue(right)];
|
|
1688
|
+
return type_exports.IsLiteralString(left) && type_exports.IsNumber(Key) && IntoBooleanResult(Visit3(left, Value)) === ExtendsResult.True ? ExtendsResult.True : type_exports.IsUint8Array(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsString(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsArray(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsObject(left) ? (() => {
|
|
1689
|
+
for (const key of Object.getOwnPropertyNames(left.properties)) {
|
|
1690
|
+
if (Property(Value, left.properties[key]) === ExtendsResult.False) {
|
|
1691
|
+
return ExtendsResult.False;
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
return ExtendsResult.True;
|
|
1695
|
+
})() : ExtendsResult.False;
|
|
1696
|
+
}
|
|
1697
|
+
function FromRecord(left, right) {
|
|
1698
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsRecord(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
|
|
1699
|
+
}
|
|
1700
|
+
function FromRegExp(left, right) {
|
|
1701
|
+
const L = type_exports.IsRegExp(left) ? String() : left;
|
|
1702
|
+
const R = type_exports.IsRegExp(right) ? String() : right;
|
|
1703
|
+
return Visit3(L, R);
|
|
1704
|
+
}
|
|
1705
|
+
function FromStringRight(left, right) {
|
|
1706
|
+
return type_exports.IsLiteral(left) && value_exports.IsString(left.const) ? ExtendsResult.True : type_exports.IsString(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
1707
|
+
}
|
|
1708
|
+
function FromString(left, right) {
|
|
1709
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1710
|
+
}
|
|
1711
|
+
function FromSymbol(left, right) {
|
|
1712
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsSymbol(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1713
|
+
}
|
|
1714
|
+
function FromTemplateLiteral2(left, right) {
|
|
1715
|
+
return type_exports.IsTemplateLiteral(left) ? Visit3(TemplateLiteralToUnion(left), right) : type_exports.IsTemplateLiteral(right) ? Visit3(left, TemplateLiteralToUnion(right)) : Throw("Invalid fallthrough for TemplateLiteral");
|
|
1716
|
+
}
|
|
1717
|
+
function IsArrayOfTuple(left, right) {
|
|
1718
|
+
return type_exports.IsArray(right) && left.items !== void 0 && left.items.every((schema) => Visit3(schema, right.items) === ExtendsResult.True);
|
|
1719
|
+
}
|
|
1720
|
+
function FromTupleRight(left, right) {
|
|
1721
|
+
return type_exports.IsNever(left) ? ExtendsResult.True : type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : ExtendsResult.False;
|
|
1722
|
+
}
|
|
1723
|
+
function FromTuple4(left, right) {
|
|
1724
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : type_exports.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : !type_exports.IsTuple(right) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) || !value_exports.IsUndefined(left.items) && value_exports.IsUndefined(right.items) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) ? ExtendsResult.True : left.items.every((schema, index) => Visit3(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
1725
|
+
}
|
|
1726
|
+
function FromUint8Array(left, right) {
|
|
1727
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsUint8Array(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1728
|
+
}
|
|
1729
|
+
function FromUndefined(left, right) {
|
|
1730
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsVoid(right) ? FromVoidRight(left, right) : type_exports.IsUndefined(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1731
|
+
}
|
|
1732
|
+
function FromUnionRight(left, right) {
|
|
1733
|
+
return right.anyOf.some((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
1734
|
+
}
|
|
1735
|
+
function FromUnion7(left, right) {
|
|
1736
|
+
return left.anyOf.every((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
1737
|
+
}
|
|
1738
|
+
function FromUnknownRight(left, right) {
|
|
1739
|
+
return ExtendsResult.True;
|
|
1740
|
+
}
|
|
1741
|
+
function FromUnknown(left, right) {
|
|
1742
|
+
return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : type_exports.IsArray(right) ? FromArrayRight(left, right) : type_exports.IsTuple(right) ? FromTupleRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsUnknown(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1743
|
+
}
|
|
1744
|
+
function FromVoidRight(left, right) {
|
|
1745
|
+
return type_exports.IsUndefined(left) ? ExtendsResult.True : type_exports.IsUndefined(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
1746
|
+
}
|
|
1747
|
+
function FromVoid(left, right) {
|
|
1748
|
+
return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsVoid(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
1749
|
+
}
|
|
1750
|
+
function Visit3(left, right) {
|
|
1751
|
+
return (
|
|
1752
|
+
// resolvable
|
|
1753
|
+
type_exports.IsTemplateLiteral(left) || type_exports.IsTemplateLiteral(right) ? FromTemplateLiteral2(left, right) : type_exports.IsRegExp(left) || type_exports.IsRegExp(right) ? FromRegExp(left, right) : type_exports.IsNot(left) || type_exports.IsNot(right) ? FromNot(left, right) : (
|
|
1754
|
+
// standard
|
|
1755
|
+
type_exports.IsAny(left) ? FromAny(left, right) : type_exports.IsArray(left) ? FromArray5(left, right) : type_exports.IsBigInt(left) ? FromBigInt(left, right) : type_exports.IsBoolean(left) ? FromBoolean(left, right) : type_exports.IsAsyncIterator(left) ? FromAsyncIterator2(left, right) : type_exports.IsConstructor(left) ? FromConstructor2(left, right) : type_exports.IsDate(left) ? FromDate(left, right) : type_exports.IsFunction(left) ? FromFunction2(left, right) : type_exports.IsInteger(left) ? FromInteger(left, right) : type_exports.IsIntersect(left) ? FromIntersect5(left, right) : type_exports.IsIterator(left) ? FromIterator2(left, right) : type_exports.IsLiteral(left) ? FromLiteral2(left, right) : type_exports.IsNever(left) ? FromNever(left, right) : type_exports.IsNull(left) ? FromNull(left, right) : type_exports.IsNumber(left) ? FromNumber(left, right) : type_exports.IsObject(left) ? FromObject2(left, right) : type_exports.IsRecord(left) ? FromRecord(left, right) : type_exports.IsString(left) ? FromString(left, right) : type_exports.IsSymbol(left) ? FromSymbol(left, right) : type_exports.IsTuple(left) ? FromTuple4(left, right) : type_exports.IsPromise(left) ? FromPromise3(left, right) : type_exports.IsUint8Array(left) ? FromUint8Array(left, right) : type_exports.IsUndefined(left) ? FromUndefined(left, right) : type_exports.IsUnion(left) ? FromUnion7(left, right) : type_exports.IsUnknown(left) ? FromUnknown(left, right) : type_exports.IsVoid(left) ? FromVoid(left, right) : Throw(`Unknown left type operand '${left[Kind]}'`)
|
|
1756
|
+
)
|
|
1757
|
+
);
|
|
1758
|
+
}
|
|
1759
|
+
function ExtendsCheck(left, right) {
|
|
1760
|
+
return Visit3(left, right);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
// node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs
|
|
1764
|
+
function FromProperties9(P, Right, True, False, options) {
|
|
1765
|
+
const Acc = {};
|
|
1766
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
1767
|
+
Acc[K2] = Extends(P[K2], Right, True, False, options);
|
|
1768
|
+
return Acc;
|
|
1769
|
+
}
|
|
1770
|
+
function FromMappedResult6(Left, Right, True, False, options) {
|
|
1771
|
+
return FromProperties9(Left.properties, Right, True, False, options);
|
|
1772
|
+
}
|
|
1773
|
+
function ExtendsFromMappedResult(Left, Right, True, False, options) {
|
|
1774
|
+
const P = FromMappedResult6(Left, Right, True, False, options);
|
|
1775
|
+
return MappedResult(P);
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
// node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs
|
|
1779
|
+
function ExtendsResolve(left, right, trueType, falseType) {
|
|
1780
|
+
const R = ExtendsCheck(left, right);
|
|
1781
|
+
return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
|
|
1782
|
+
}
|
|
1783
|
+
function Extends(L, R, T, F, options = {}) {
|
|
1784
|
+
return IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T, F, options) : IsMappedKey(L) ? CloneType(ExtendsFromMappedKey(L, R, T, F, options)) : CloneType(ExtendsResolve(L, R, T, F), options);
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
// node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
|
|
1788
|
+
function FromPropertyKey(K, U, L, R, options) {
|
|
1789
|
+
return {
|
|
1790
|
+
[K]: Extends(Literal(K), U, L, R, options)
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1793
|
+
function FromPropertyKeys(K, U, L, R, options) {
|
|
1794
|
+
return K.reduce((Acc, LK) => {
|
|
1795
|
+
return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
|
|
1796
|
+
}, {});
|
|
1797
|
+
}
|
|
1798
|
+
function FromMappedKey2(K, U, L, R, options) {
|
|
1799
|
+
return FromPropertyKeys(K.keys, U, L, R, options);
|
|
1800
|
+
}
|
|
1801
|
+
function ExtendsFromMappedKey(T, U, L, R, options) {
|
|
1802
|
+
const P = FromMappedKey2(T, U, L, R, options);
|
|
1803
|
+
return MappedResult(P);
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
// node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs
|
|
1807
|
+
function ExcludeFromTemplateLiteral(L, R) {
|
|
1808
|
+
return Exclude(TemplateLiteralToUnion(L), R);
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs
|
|
1812
|
+
function ExcludeRest(L, R) {
|
|
1813
|
+
const excluded = L.filter((inner) => ExtendsCheck(inner, R) === ExtendsResult.False);
|
|
1814
|
+
return excluded.length === 1 ? excluded[0] : Union(excluded);
|
|
1815
|
+
}
|
|
1816
|
+
function Exclude(L, R, options = {}) {
|
|
1817
|
+
if (IsTemplateLiteral(L))
|
|
1818
|
+
return CloneType(ExcludeFromTemplateLiteral(L, R), options);
|
|
1819
|
+
if (IsMappedResult(L))
|
|
1820
|
+
return CloneType(ExcludeFromMappedResult(L, R), options);
|
|
1821
|
+
return CloneType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
// node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
|
|
1825
|
+
function FromProperties10(P, U) {
|
|
1826
|
+
const Acc = {};
|
|
1827
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
1828
|
+
Acc[K2] = Exclude(P[K2], U);
|
|
1829
|
+
return Acc;
|
|
1830
|
+
}
|
|
1831
|
+
function FromMappedResult7(R, T) {
|
|
1832
|
+
return FromProperties10(R.properties, T);
|
|
1833
|
+
}
|
|
1834
|
+
function ExcludeFromMappedResult(R, T) {
|
|
1835
|
+
const P = FromMappedResult7(R, T);
|
|
1836
|
+
return MappedResult(P);
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
// node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs
|
|
1840
|
+
function ExtractFromTemplateLiteral(L, R) {
|
|
1841
|
+
return Extract(TemplateLiteralToUnion(L), R);
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
// node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs
|
|
1845
|
+
function ExtractRest(L, R) {
|
|
1846
|
+
const extracted = L.filter((inner) => ExtendsCheck(inner, R) !== ExtendsResult.False);
|
|
1847
|
+
return extracted.length === 1 ? extracted[0] : Union(extracted);
|
|
1848
|
+
}
|
|
1849
|
+
function Extract(L, R, options = {}) {
|
|
1850
|
+
if (IsTemplateLiteral(L))
|
|
1851
|
+
return CloneType(ExtractFromTemplateLiteral(L, R), options);
|
|
1852
|
+
if (IsMappedResult(L))
|
|
1853
|
+
return CloneType(ExtractFromMappedResult(L, R), options);
|
|
1854
|
+
return CloneType(IsUnion(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
// node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
|
|
1858
|
+
function FromProperties11(P, T) {
|
|
1859
|
+
const Acc = {};
|
|
1860
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
1861
|
+
Acc[K2] = Extract(P[K2], T);
|
|
1862
|
+
return Acc;
|
|
1863
|
+
}
|
|
1864
|
+
function FromMappedResult8(R, T) {
|
|
1865
|
+
return FromProperties11(R.properties, T);
|
|
1866
|
+
}
|
|
1867
|
+
function ExtractFromMappedResult(R, T) {
|
|
1868
|
+
const P = FromMappedResult8(R, T);
|
|
1869
|
+
return MappedResult(P);
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
// node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
|
|
1873
|
+
function InstanceType(schema, options = {}) {
|
|
1874
|
+
return CloneType(schema.returns, options);
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
// node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs
|
|
1878
|
+
function Integer(options = {}) {
|
|
1879
|
+
return {
|
|
1880
|
+
...options,
|
|
1881
|
+
[Kind]: "Integer",
|
|
1882
|
+
type: "integer"
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs
|
|
1887
|
+
function MappedIntrinsicPropertyKey(K, M, options) {
|
|
1888
|
+
return {
|
|
1889
|
+
[K]: Intrinsic(Literal(K), M, options)
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
function MappedIntrinsicPropertyKeys(K, M, options) {
|
|
1893
|
+
return K.reduce((Acc, L) => {
|
|
1894
|
+
return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
|
|
1895
|
+
}, {});
|
|
1896
|
+
}
|
|
1897
|
+
function MappedIntrinsicProperties(T, M, options) {
|
|
1898
|
+
return MappedIntrinsicPropertyKeys(T["keys"], M, options);
|
|
1899
|
+
}
|
|
1900
|
+
function IntrinsicFromMappedKey(T, M, options) {
|
|
1901
|
+
const P = MappedIntrinsicProperties(T, M, options);
|
|
1902
|
+
return MappedResult(P);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs
|
|
1906
|
+
function ApplyUncapitalize(value) {
|
|
1907
|
+
const [first, rest] = [value.slice(0, 1), value.slice(1)];
|
|
1908
|
+
return [first.toLowerCase(), rest].join("");
|
|
1909
|
+
}
|
|
1910
|
+
function ApplyCapitalize(value) {
|
|
1911
|
+
const [first, rest] = [value.slice(0, 1), value.slice(1)];
|
|
1912
|
+
return [first.toUpperCase(), rest].join("");
|
|
1913
|
+
}
|
|
1914
|
+
function ApplyUppercase(value) {
|
|
1915
|
+
return value.toUpperCase();
|
|
1916
|
+
}
|
|
1917
|
+
function ApplyLowercase(value) {
|
|
1918
|
+
return value.toLowerCase();
|
|
1919
|
+
}
|
|
1920
|
+
function FromTemplateLiteral3(schema, mode, options) {
|
|
1921
|
+
const expression = TemplateLiteralParseExact(schema.pattern);
|
|
1922
|
+
const finite = IsTemplateLiteralExpressionFinite(expression);
|
|
1923
|
+
if (!finite)
|
|
1924
|
+
return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) };
|
|
1925
|
+
const strings = [...TemplateLiteralExpressionGenerate(expression)];
|
|
1926
|
+
const literals = strings.map((value) => Literal(value));
|
|
1927
|
+
const mapped = FromRest6(literals, mode);
|
|
1928
|
+
const union = Union(mapped);
|
|
1929
|
+
return TemplateLiteral([union], options);
|
|
1930
|
+
}
|
|
1931
|
+
function FromLiteralValue(value, mode) {
|
|
1932
|
+
return typeof value === "string" ? mode === "Uncapitalize" ? ApplyUncapitalize(value) : mode === "Capitalize" ? ApplyCapitalize(value) : mode === "Uppercase" ? ApplyUppercase(value) : mode === "Lowercase" ? ApplyLowercase(value) : value : value.toString();
|
|
1933
|
+
}
|
|
1934
|
+
function FromRest6(T, M) {
|
|
1935
|
+
return T.map((L) => Intrinsic(L, M));
|
|
1936
|
+
}
|
|
1937
|
+
function Intrinsic(schema, mode, options = {}) {
|
|
1938
|
+
return (
|
|
1939
|
+
// Intrinsic-Mapped-Inference
|
|
1940
|
+
IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : (
|
|
1941
|
+
// Standard-Inference
|
|
1942
|
+
IsTemplateLiteral(schema) ? FromTemplateLiteral3(schema, mode, schema) : IsUnion(schema) ? Union(FromRest6(schema.anyOf, mode), options) : IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : schema
|
|
1943
|
+
)
|
|
1944
|
+
);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
|
|
1948
|
+
function Capitalize(T, options = {}) {
|
|
1949
|
+
return Intrinsic(T, "Capitalize", options);
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs
|
|
1953
|
+
function Lowercase(T, options = {}) {
|
|
1954
|
+
return Intrinsic(T, "Lowercase", options);
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs
|
|
1958
|
+
function Uncapitalize(T, options = {}) {
|
|
1959
|
+
return Intrinsic(T, "Uncapitalize", options);
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs
|
|
1963
|
+
function Uppercase(T, options = {}) {
|
|
1964
|
+
return Intrinsic(T, "Uppercase", options);
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
// node_modules/@sinclair/typebox/build/esm/type/not/not.mjs
|
|
1968
|
+
function Not(schema, options) {
|
|
1969
|
+
return {
|
|
1970
|
+
...options,
|
|
1971
|
+
[Kind]: "Not",
|
|
1972
|
+
not: CloneType(schema)
|
|
1973
|
+
};
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
// node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs
|
|
1977
|
+
function FromProperties12(P, K, options) {
|
|
1978
|
+
const Acc = {};
|
|
1979
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
1980
|
+
Acc[K2] = Omit(P[K2], K, options);
|
|
1981
|
+
return Acc;
|
|
1982
|
+
}
|
|
1983
|
+
function FromMappedResult9(R, K, options) {
|
|
1984
|
+
return FromProperties12(R.properties, K, options);
|
|
1985
|
+
}
|
|
1986
|
+
function OmitFromMappedResult(R, K, options) {
|
|
1987
|
+
const P = FromMappedResult9(R, K, options);
|
|
1988
|
+
return MappedResult(P);
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
// node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs
|
|
1992
|
+
function FromIntersect6(T, K) {
|
|
1993
|
+
return T.map((T2) => OmitResolve(T2, K));
|
|
1994
|
+
}
|
|
1995
|
+
function FromUnion8(T, K) {
|
|
1996
|
+
return T.map((T2) => OmitResolve(T2, K));
|
|
1997
|
+
}
|
|
1998
|
+
function FromProperty2(T, K) {
|
|
1999
|
+
const { [K]: _, ...R } = T;
|
|
2000
|
+
return R;
|
|
2001
|
+
}
|
|
2002
|
+
function FromProperties13(T, K) {
|
|
2003
|
+
return K.reduce((T2, K2) => FromProperty2(T2, K2), T);
|
|
2004
|
+
}
|
|
2005
|
+
function OmitResolve(T, K) {
|
|
2006
|
+
return IsIntersect(T) ? Intersect(FromIntersect6(T.allOf, K)) : IsUnion(T) ? Union(FromUnion8(T.anyOf, K)) : IsObject2(T) ? Object2(FromProperties13(T.properties, K)) : Object2({});
|
|
2007
|
+
}
|
|
2008
|
+
function Omit(T, K, options = {}) {
|
|
2009
|
+
if (IsMappedKey(K))
|
|
2010
|
+
return OmitFromMappedKey(T, K, options);
|
|
2011
|
+
if (IsMappedResult(T))
|
|
2012
|
+
return OmitFromMappedResult(T, K, options);
|
|
2013
|
+
const I = IsSchema(K) ? IndexPropertyKeys(K) : K;
|
|
2014
|
+
const D = Discard(T, [TransformKind, "$id", "required"]);
|
|
2015
|
+
const R = CloneType(OmitResolve(T, I), options);
|
|
2016
|
+
return { ...D, ...R };
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
// node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
|
|
2020
|
+
function FromPropertyKey2(T, K, options) {
|
|
2021
|
+
return {
|
|
2022
|
+
[K]: Omit(T, [K], options)
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
function FromPropertyKeys2(T, K, options) {
|
|
2026
|
+
return K.reduce((Acc, LK) => {
|
|
2027
|
+
return { ...Acc, ...FromPropertyKey2(T, LK, options) };
|
|
2028
|
+
}, {});
|
|
2029
|
+
}
|
|
2030
|
+
function FromMappedKey3(T, K, options) {
|
|
2031
|
+
return FromPropertyKeys2(T, K.keys, options);
|
|
2032
|
+
}
|
|
2033
|
+
function OmitFromMappedKey(T, K, options) {
|
|
2034
|
+
const P = FromMappedKey3(T, K, options);
|
|
2035
|
+
return MappedResult(P);
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
// node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
|
|
2039
|
+
function Parameters(schema, options = {}) {
|
|
2040
|
+
return Tuple(CloneRest(schema.parameters), { ...options });
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
// node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs
|
|
2044
|
+
function FromRest7(T) {
|
|
2045
|
+
return T.map((L) => PartialResolve(L));
|
|
2046
|
+
}
|
|
2047
|
+
function FromProperties14(T) {
|
|
2048
|
+
const Acc = {};
|
|
2049
|
+
for (const K of globalThis.Object.getOwnPropertyNames(T))
|
|
2050
|
+
Acc[K] = Optional(T[K]);
|
|
2051
|
+
return Acc;
|
|
2052
|
+
}
|
|
2053
|
+
function PartialResolve(T) {
|
|
2054
|
+
return IsIntersect(T) ? Intersect(FromRest7(T.allOf)) : IsUnion(T) ? Union(FromRest7(T.anyOf)) : IsObject2(T) ? Object2(FromProperties14(T.properties)) : Object2({});
|
|
2055
|
+
}
|
|
2056
|
+
function Partial(T, options = {}) {
|
|
2057
|
+
if (IsMappedResult(T))
|
|
2058
|
+
return PartialFromMappedResult(T, options);
|
|
2059
|
+
const D = Discard(T, [TransformKind, "$id", "required"]);
|
|
2060
|
+
const R = CloneType(PartialResolve(T), options);
|
|
2061
|
+
return { ...D, ...R };
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
// node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs
|
|
2065
|
+
function FromProperties15(K, options) {
|
|
2066
|
+
const Acc = {};
|
|
2067
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(K))
|
|
2068
|
+
Acc[K2] = Partial(K[K2], options);
|
|
2069
|
+
return Acc;
|
|
2070
|
+
}
|
|
2071
|
+
function FromMappedResult10(R, options) {
|
|
2072
|
+
return FromProperties15(R.properties, options);
|
|
2073
|
+
}
|
|
2074
|
+
function PartialFromMappedResult(R, options) {
|
|
2075
|
+
const P = FromMappedResult10(R, options);
|
|
2076
|
+
return MappedResult(P);
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
// node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs
|
|
2080
|
+
function FromProperties16(P, K, options) {
|
|
2081
|
+
const Acc = {};
|
|
2082
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
2083
|
+
Acc[K2] = Pick(P[K2], K, options);
|
|
2084
|
+
return Acc;
|
|
2085
|
+
}
|
|
2086
|
+
function FromMappedResult11(R, K, options) {
|
|
2087
|
+
return FromProperties16(R.properties, K, options);
|
|
2088
|
+
}
|
|
2089
|
+
function PickFromMappedResult(R, K, options) {
|
|
2090
|
+
const P = FromMappedResult11(R, K, options);
|
|
2091
|
+
return MappedResult(P);
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
// node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs
|
|
2095
|
+
function FromIntersect7(T, K) {
|
|
2096
|
+
return T.map((T2) => PickResolve(T2, K));
|
|
2097
|
+
}
|
|
2098
|
+
function FromUnion9(T, K) {
|
|
2099
|
+
return T.map((T2) => PickResolve(T2, K));
|
|
2100
|
+
}
|
|
2101
|
+
function FromProperties17(T, K) {
|
|
2102
|
+
const Acc = {};
|
|
2103
|
+
for (const K2 of K)
|
|
2104
|
+
if (K2 in T)
|
|
2105
|
+
Acc[K2] = T[K2];
|
|
2106
|
+
return Acc;
|
|
2107
|
+
}
|
|
2108
|
+
function PickResolve(T, K) {
|
|
2109
|
+
return IsIntersect(T) ? Intersect(FromIntersect7(T.allOf, K)) : IsUnion(T) ? Union(FromUnion9(T.anyOf, K)) : IsObject2(T) ? Object2(FromProperties17(T.properties, K)) : Object2({});
|
|
2110
|
+
}
|
|
2111
|
+
function Pick(T, K, options = {}) {
|
|
2112
|
+
if (IsMappedKey(K))
|
|
2113
|
+
return PickFromMappedKey(T, K, options);
|
|
2114
|
+
if (IsMappedResult(T))
|
|
2115
|
+
return PickFromMappedResult(T, K, options);
|
|
2116
|
+
const I = IsSchema(K) ? IndexPropertyKeys(K) : K;
|
|
2117
|
+
const D = Discard(T, [TransformKind, "$id", "required"]);
|
|
2118
|
+
const R = CloneType(PickResolve(T, I), options);
|
|
2119
|
+
return { ...D, ...R };
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
// node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
|
|
2123
|
+
function FromPropertyKey3(T, K, options) {
|
|
2124
|
+
return {
|
|
2125
|
+
[K]: Pick(T, [K], options)
|
|
2126
|
+
};
|
|
2127
|
+
}
|
|
2128
|
+
function FromPropertyKeys3(T, K, options) {
|
|
2129
|
+
return K.reduce((Acc, LK) => {
|
|
2130
|
+
return { ...Acc, ...FromPropertyKey3(T, LK, options) };
|
|
2131
|
+
}, {});
|
|
2132
|
+
}
|
|
2133
|
+
function FromMappedKey4(T, K, options) {
|
|
2134
|
+
return FromPropertyKeys3(T, K.keys, options);
|
|
2135
|
+
}
|
|
2136
|
+
function PickFromMappedKey(T, K, options) {
|
|
2137
|
+
const P = FromMappedKey4(T, K, options);
|
|
2138
|
+
return MappedResult(P);
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
// node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
|
|
2142
|
+
function ReadonlyOptional(schema) {
|
|
2143
|
+
return Readonly(Optional(schema));
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
// node_modules/@sinclair/typebox/build/esm/type/record/record.mjs
|
|
2147
|
+
function RecordCreateFromPattern(pattern, T, options) {
|
|
2148
|
+
return {
|
|
2149
|
+
...options,
|
|
2150
|
+
[Kind]: "Record",
|
|
2151
|
+
type: "object",
|
|
2152
|
+
patternProperties: { [pattern]: CloneType(T) }
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
function RecordCreateFromKeys(K, T, options) {
|
|
2156
|
+
const Acc = {};
|
|
2157
|
+
for (const K2 of K)
|
|
2158
|
+
Acc[K2] = CloneType(T);
|
|
2159
|
+
return Object2(Acc, { ...options, [Hint]: "Record" });
|
|
2160
|
+
}
|
|
2161
|
+
function FromTemplateLiteralKey(K, T, options) {
|
|
2162
|
+
return IsTemplateLiteralFinite(K) ? RecordCreateFromKeys(IndexPropertyKeys(K), T, options) : RecordCreateFromPattern(K.pattern, T, options);
|
|
2163
|
+
}
|
|
2164
|
+
function FromUnionKey(K, T, options) {
|
|
2165
|
+
return RecordCreateFromKeys(IndexPropertyKeys(Union(K)), T, options);
|
|
2166
|
+
}
|
|
2167
|
+
function FromLiteralKey(K, T, options) {
|
|
2168
|
+
return RecordCreateFromKeys([K.toString()], T, options);
|
|
2169
|
+
}
|
|
2170
|
+
function FromRegExpKey(K, T, options) {
|
|
2171
|
+
return RecordCreateFromPattern(K.source, T, options);
|
|
2172
|
+
}
|
|
2173
|
+
function FromStringKey(K, T, options) {
|
|
2174
|
+
const pattern = IsUndefined(K.pattern) ? PatternStringExact : K.pattern;
|
|
2175
|
+
return RecordCreateFromPattern(pattern, T, options);
|
|
2176
|
+
}
|
|
2177
|
+
function FromIntegerKey(_, T, options) {
|
|
2178
|
+
return RecordCreateFromPattern(PatternNumberExact, T, options);
|
|
2179
|
+
}
|
|
2180
|
+
function FromNumberKey(_, T, options) {
|
|
2181
|
+
return RecordCreateFromPattern(PatternNumberExact, T, options);
|
|
2182
|
+
}
|
|
2183
|
+
function Record(K, T, options = {}) {
|
|
2184
|
+
return IsUnion(K) ? FromUnionKey(K.anyOf, T, options) : IsTemplateLiteral(K) ? FromTemplateLiteralKey(K, T, options) : IsLiteral(K) ? FromLiteralKey(K.const, T, options) : IsInteger(K) ? FromIntegerKey(K, T, options) : IsNumber2(K) ? FromNumberKey(K, T, options) : IsRegExp2(K) ? FromRegExpKey(K, T, options) : IsString2(K) ? FromStringKey(K, T, options) : Never(options);
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
// node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
|
|
2188
|
+
var Ordinal = 0;
|
|
2189
|
+
function Recursive(callback, options = {}) {
|
|
2190
|
+
if (IsUndefined(options.$id))
|
|
2191
|
+
options.$id = `T${Ordinal++}`;
|
|
2192
|
+
const thisType = callback({ [Kind]: "This", $ref: `${options.$id}` });
|
|
2193
|
+
thisType.$id = options.$id;
|
|
2194
|
+
return CloneType({ ...options, [Hint]: "Recursive", ...thisType });
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
// node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs
|
|
2198
|
+
function Ref(unresolved, options = {}) {
|
|
2199
|
+
if (IsString(unresolved))
|
|
2200
|
+
return { ...options, [Kind]: "Ref", $ref: unresolved };
|
|
2201
|
+
if (IsUndefined(unresolved.$id))
|
|
2202
|
+
throw new Error("Reference target type must specify an $id");
|
|
2203
|
+
return {
|
|
2204
|
+
...options,
|
|
2205
|
+
[Kind]: "Ref",
|
|
2206
|
+
$ref: unresolved.$id
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
// node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs
|
|
2211
|
+
function RegExp2(unresolved, options = {}) {
|
|
2212
|
+
const expr = IsString(unresolved) ? new globalThis.RegExp(unresolved) : unresolved;
|
|
2213
|
+
return { ...options, [Kind]: "RegExp", type: "RegExp", source: expr.source, flags: expr.flags };
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
// node_modules/@sinclair/typebox/build/esm/type/required/required.mjs
|
|
2217
|
+
function FromRest8(T) {
|
|
2218
|
+
return T.map((L) => RequiredResolve(L));
|
|
2219
|
+
}
|
|
2220
|
+
function FromProperties18(T) {
|
|
2221
|
+
const Acc = {};
|
|
2222
|
+
for (const K of globalThis.Object.getOwnPropertyNames(T))
|
|
2223
|
+
Acc[K] = Discard(T[K], [OptionalKind]);
|
|
2224
|
+
return Acc;
|
|
2225
|
+
}
|
|
2226
|
+
function RequiredResolve(T) {
|
|
2227
|
+
return IsIntersect(T) ? Intersect(FromRest8(T.allOf)) : IsUnion(T) ? Union(FromRest8(T.anyOf)) : IsObject2(T) ? Object2(FromProperties18(T.properties)) : Object2({});
|
|
2228
|
+
}
|
|
2229
|
+
function Required(T, options = {}) {
|
|
2230
|
+
if (IsMappedResult(T)) {
|
|
2231
|
+
return RequiredFromMappedResult(T, options);
|
|
2232
|
+
} else {
|
|
2233
|
+
const D = Discard(T, [TransformKind, "$id", "required"]);
|
|
2234
|
+
const R = CloneType(RequiredResolve(T), options);
|
|
2235
|
+
return { ...D, ...R };
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
// node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs
|
|
2240
|
+
function FromProperties19(P, options) {
|
|
2241
|
+
const Acc = {};
|
|
2242
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
2243
|
+
Acc[K2] = Required(P[K2], options);
|
|
2244
|
+
return Acc;
|
|
2245
|
+
}
|
|
2246
|
+
function FromMappedResult12(R, options) {
|
|
2247
|
+
return FromProperties19(R.properties, options);
|
|
2248
|
+
}
|
|
2249
|
+
function RequiredFromMappedResult(R, options) {
|
|
2250
|
+
const P = FromMappedResult12(R, options);
|
|
2251
|
+
return MappedResult(P);
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
// node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
|
|
2255
|
+
function RestResolve(T) {
|
|
2256
|
+
return IsIntersect(T) ? CloneRest(T.allOf) : IsUnion(T) ? CloneRest(T.anyOf) : IsTuple(T) ? CloneRest(T.items ?? []) : [];
|
|
2257
|
+
}
|
|
2258
|
+
function Rest(T) {
|
|
2259
|
+
return CloneRest(RestResolve(T));
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
// node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
|
|
2263
|
+
function ReturnType(schema, options = {}) {
|
|
2264
|
+
return CloneType(schema.returns, options);
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
// node_modules/@sinclair/typebox/build/esm/type/strict/strict.mjs
|
|
2268
|
+
function Strict(schema) {
|
|
2269
|
+
return JSON.parse(JSON.stringify(schema));
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
// node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
|
|
2273
|
+
var TransformDecodeBuilder = class {
|
|
2274
|
+
constructor(schema) {
|
|
2275
|
+
this.schema = schema;
|
|
2276
|
+
}
|
|
2277
|
+
Decode(decode) {
|
|
2278
|
+
return new TransformEncodeBuilder(this.schema, decode);
|
|
2279
|
+
}
|
|
2280
|
+
};
|
|
2281
|
+
var TransformEncodeBuilder = class {
|
|
2282
|
+
constructor(schema, decode) {
|
|
2283
|
+
this.schema = schema;
|
|
2284
|
+
this.decode = decode;
|
|
2285
|
+
}
|
|
2286
|
+
EncodeTransform(encode, schema) {
|
|
2287
|
+
const Encode = (value) => schema[TransformKind].Encode(encode(value));
|
|
2288
|
+
const Decode = (value) => this.decode(schema[TransformKind].Decode(value));
|
|
2289
|
+
const Codec = { Encode, Decode };
|
|
2290
|
+
return { ...schema, [TransformKind]: Codec };
|
|
2291
|
+
}
|
|
2292
|
+
EncodeSchema(encode, schema) {
|
|
2293
|
+
const Codec = { Decode: this.decode, Encode: encode };
|
|
2294
|
+
return { ...schema, [TransformKind]: Codec };
|
|
2295
|
+
}
|
|
2296
|
+
Encode(encode) {
|
|
2297
|
+
const schema = CloneType(this.schema);
|
|
2298
|
+
return IsTransform(schema) ? this.EncodeTransform(encode, schema) : this.EncodeSchema(encode, schema);
|
|
2299
|
+
}
|
|
2300
|
+
};
|
|
2301
|
+
function Transform(schema) {
|
|
2302
|
+
return new TransformDecodeBuilder(schema);
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
// node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs
|
|
2306
|
+
function Unsafe(options = {}) {
|
|
2307
|
+
return {
|
|
2308
|
+
...options,
|
|
2309
|
+
[Kind]: options[Kind] ?? "Unsafe"
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
// node_modules/@sinclair/typebox/build/esm/type/void/void.mjs
|
|
2314
|
+
function Void(options = {}) {
|
|
2315
|
+
return {
|
|
2316
|
+
...options,
|
|
2317
|
+
[Kind]: "Void",
|
|
2318
|
+
type: "void"
|
|
2319
|
+
};
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
// node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
|
|
2323
|
+
var type_exports3 = {};
|
|
2324
|
+
__export(type_exports3, {
|
|
2325
|
+
Any: () => Any,
|
|
2326
|
+
Array: () => Array2,
|
|
2327
|
+
AsyncIterator: () => AsyncIterator,
|
|
2328
|
+
Awaited: () => Awaited,
|
|
2329
|
+
BigInt: () => BigInt,
|
|
2330
|
+
Boolean: () => Boolean,
|
|
2331
|
+
Capitalize: () => Capitalize,
|
|
2332
|
+
Composite: () => Composite,
|
|
2333
|
+
Const: () => Const,
|
|
2334
|
+
Constructor: () => Constructor,
|
|
2335
|
+
ConstructorParameters: () => ConstructorParameters,
|
|
2336
|
+
Date: () => Date2,
|
|
2337
|
+
Deref: () => Deref,
|
|
2338
|
+
Enum: () => Enum,
|
|
2339
|
+
Exclude: () => Exclude,
|
|
2340
|
+
Extends: () => Extends,
|
|
2341
|
+
Extract: () => Extract,
|
|
2342
|
+
Function: () => Function,
|
|
2343
|
+
Index: () => Index,
|
|
2344
|
+
InstanceType: () => InstanceType,
|
|
2345
|
+
Integer: () => Integer,
|
|
2346
|
+
Intersect: () => Intersect,
|
|
2347
|
+
Iterator: () => Iterator,
|
|
2348
|
+
KeyOf: () => KeyOf,
|
|
2349
|
+
Literal: () => Literal,
|
|
2350
|
+
Lowercase: () => Lowercase,
|
|
2351
|
+
Mapped: () => Mapped,
|
|
2352
|
+
Never: () => Never,
|
|
2353
|
+
Not: () => Not,
|
|
2354
|
+
Null: () => Null,
|
|
2355
|
+
Number: () => Number,
|
|
2356
|
+
Object: () => Object2,
|
|
2357
|
+
Omit: () => Omit,
|
|
2358
|
+
Optional: () => Optional,
|
|
2359
|
+
Parameters: () => Parameters,
|
|
2360
|
+
Partial: () => Partial,
|
|
2361
|
+
Pick: () => Pick,
|
|
2362
|
+
Promise: () => Promise2,
|
|
2363
|
+
Readonly: () => Readonly,
|
|
2364
|
+
ReadonlyOptional: () => ReadonlyOptional,
|
|
2365
|
+
Record: () => Record,
|
|
2366
|
+
Recursive: () => Recursive,
|
|
2367
|
+
Ref: () => Ref,
|
|
2368
|
+
RegExp: () => RegExp2,
|
|
2369
|
+
Required: () => Required,
|
|
2370
|
+
Rest: () => Rest,
|
|
2371
|
+
ReturnType: () => ReturnType,
|
|
2372
|
+
Strict: () => Strict,
|
|
2373
|
+
String: () => String,
|
|
2374
|
+
Symbol: () => Symbol2,
|
|
2375
|
+
TemplateLiteral: () => TemplateLiteral,
|
|
2376
|
+
Transform: () => Transform,
|
|
2377
|
+
Tuple: () => Tuple,
|
|
2378
|
+
Uint8Array: () => Uint8Array2,
|
|
2379
|
+
Uncapitalize: () => Uncapitalize,
|
|
2380
|
+
Undefined: () => Undefined,
|
|
2381
|
+
Union: () => Union,
|
|
2382
|
+
Unknown: () => Unknown,
|
|
2383
|
+
Unsafe: () => Unsafe,
|
|
2384
|
+
Uppercase: () => Uppercase,
|
|
2385
|
+
Void: () => Void
|
|
2386
|
+
});
|
|
2387
|
+
|
|
2388
|
+
// node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
|
|
2389
|
+
var Type = type_exports3;
|
|
2390
|
+
|
|
2391
|
+
// src/index.ts
|
|
2392
|
+
var jwt = ({
|
|
2393
|
+
name = "jwt",
|
|
2394
|
+
secret,
|
|
2395
|
+
// Start JWT Header
|
|
2396
|
+
alg = "HS256",
|
|
2397
|
+
crit,
|
|
2398
|
+
schema,
|
|
2399
|
+
// End JWT Header
|
|
2400
|
+
// Start JWT Payload
|
|
2401
|
+
nbf,
|
|
2402
|
+
exp,
|
|
2403
|
+
...payload
|
|
2404
|
+
}) => {
|
|
2405
|
+
if (!secret) throw new Error("Secret can't be empty");
|
|
2406
|
+
const key = typeof secret === "string" ? new TextEncoder().encode(secret) : secret;
|
|
2407
|
+
const validator = schema ? (0, import_elysia.getSchemaValidator)(
|
|
2408
|
+
Type.Intersect([
|
|
2409
|
+
schema,
|
|
2410
|
+
Type.Object({
|
|
2411
|
+
iss: Type.Optional(Type.String()),
|
|
2412
|
+
sub: Type.Optional(Type.String()),
|
|
2413
|
+
aud: Type.Optional(
|
|
2414
|
+
Type.Union([Type.String(), Type.Array(Type.String())])
|
|
2415
|
+
),
|
|
2416
|
+
jti: Type.Optional(Type.String()),
|
|
2417
|
+
nbf: Type.Optional(Type.Union([Type.String(), Type.Number()])),
|
|
2418
|
+
exp: Type.Optional(Type.Union([Type.String(), Type.Number()])),
|
|
2419
|
+
iat: Type.Optional(Type.String())
|
|
2420
|
+
})
|
|
2421
|
+
]),
|
|
2422
|
+
{}
|
|
2423
|
+
) : void 0;
|
|
2424
|
+
return new import_elysia.Elysia({
|
|
2425
|
+
name: "@elysiajs/jwt",
|
|
2426
|
+
seed: {
|
|
2427
|
+
name,
|
|
2428
|
+
secret,
|
|
2429
|
+
alg,
|
|
2430
|
+
crit,
|
|
2431
|
+
schema,
|
|
2432
|
+
nbf,
|
|
2433
|
+
exp,
|
|
2434
|
+
...payload
|
|
2435
|
+
}
|
|
2436
|
+
}).decorate(name, {
|
|
2437
|
+
sign(morePayload) {
|
|
2438
|
+
let jwt2 = new import_jose.SignJWT({
|
|
2439
|
+
...payload,
|
|
2440
|
+
...morePayload,
|
|
2441
|
+
nbf: void 0,
|
|
2442
|
+
exp: void 0
|
|
2443
|
+
}).setProtectedHeader({
|
|
2444
|
+
alg,
|
|
2445
|
+
crit
|
|
2446
|
+
});
|
|
2447
|
+
if (nbf) jwt2 = jwt2.setNotBefore(nbf);
|
|
2448
|
+
if (exp) jwt2 = jwt2.setExpirationTime(exp);
|
|
2449
|
+
return jwt2.sign(key);
|
|
2450
|
+
},
|
|
2451
|
+
async verify(jwt2) {
|
|
2452
|
+
if (!jwt2) return false;
|
|
2453
|
+
try {
|
|
2454
|
+
const data = (await (0, import_jose.jwtVerify)(jwt2, key)).payload;
|
|
2455
|
+
if (validator && !validator.Check(data))
|
|
2456
|
+
throw new import_elysia.ValidationError("JWT", validator, data);
|
|
2457
|
+
return data;
|
|
2458
|
+
} catch (_) {
|
|
2459
|
+
return false;
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
});
|
|
2463
|
+
};
|
|
2464
|
+
var src_default = jwt;
|
|
2465
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2466
|
+
0 && (module.exports = {
|
|
2467
|
+
jwt
|
|
2468
|
+
});
|