@powerlines/deepkit 0.7.3 → 0.7.5
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/{capnp-BLx1WTBU.cjs → capnp-BLCHrDSY.cjs} +42 -42
- package/dist/{capnp-BiGNkOmV.mjs → capnp-BqAglxrS.mjs} +265 -265
- package/dist/capnp.cjs +1 -1
- package/dist/capnp.d.cts +42 -44
- package/dist/capnp.d.mts +42 -44
- package/dist/capnp.mjs +1 -1
- package/dist/{chunk-C0xms8kb.cjs → chunk-BmvPcxpV.cjs} +7 -0
- package/dist/chunk-CgI6uo-e.mjs +32 -0
- package/dist/{vendor/type-compiler/compiler-D1z5h1MK.d.cts → compiler-B-zwyGQf.d.cts} +3 -201
- package/dist/{vendor/type-compiler/compiler-Bg8jX6qU.mjs → compiler-BUUdv7wG.mjs} +4 -191
- package/dist/{vendor/type-compiler/compiler-Nkxc4PLJ.d.mts → compiler-BzOZmhWO.d.mts} +3 -201
- package/dist/{vendor/type-compiler/compiler-BUrWMhGi.cjs → compiler-DTp8Jvav.cjs} +207 -394
- package/dist/{vendor/type-compiler/config-B_cKkYZm.d.cts → config-B2hS4_tR.d.mts} +1 -1
- package/dist/config-C0OHvihx.d.mts +1 -0
- package/dist/{vendor/type-compiler/config-y0HNkbCH.mjs → config-CuXC21KA.mjs} +3 -32
- package/dist/{vendor/type-compiler/config-D9DM7Du_.d.mts → config-DCmu3CV2.d.cts} +1 -1
- package/dist/config-GPeRZeGl.d.cts +1 -0
- package/dist/{vendor/type-compiler/config-BEX924PC.cjs → config-GVyELKY1.cjs} +20 -59
- package/dist/esbuild-plugin-BUYqx8_5.cjs +80 -0
- package/dist/esbuild-plugin-CRQUmm86.mjs +75 -0
- package/dist/esbuild-plugin.cjs +2 -47
- package/dist/esbuild-plugin.d.cts +18 -4
- package/dist/esbuild-plugin.d.mts +18 -4
- package/dist/esbuild-plugin.mjs +2 -47
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/reflect-type.cjs +4 -4
- package/dist/reflect-type.d.cts +1 -1
- package/dist/reflect-type.d.mts +1 -1
- package/dist/reflect-type.mjs +2 -2
- package/dist/{reflection-C4IlLDrv.d.cts → reflection-Bhe75GyI.d.mts} +2 -2
- package/dist/{reflection-BB3pXP5l.d.mts → reflection-DGOuMF8F.d.cts} +2 -2
- package/dist/resolve-reflections.cjs +1 -1
- package/dist/rolldown-plugin.cjs +1 -1
- package/dist/{vendor/string-BuMgdahD.mjs → string-CjkshhTG.mjs} +3 -28
- package/dist/{vendor/string-BoXo0wS7.cjs → string-CpVz34Gv.cjs} +6 -39
- package/dist/transformer.cjs +7 -8
- package/dist/transformer.d.cts +1 -1
- package/dist/transformer.d.mts +1 -1
- package/dist/transformer.mjs +3 -4
- package/dist/transpile.cjs +6 -2
- package/dist/transpile.d.cts +1 -1
- package/dist/transpile.d.mts +1 -1
- package/dist/transpile.mjs +5 -1
- package/dist/type-8AL5U7vn.d.cts +2969 -0
- package/dist/type-BDuj5wg2.d.mts +2969 -0
- package/dist/{vendor/type-Dgeqs-rL.mjs → type-BWm74eaQ.mjs} +2 -1
- package/dist/type-C7UXbXfx.cjs +10688 -0
- package/dist/type-DR66Hepn.d.cts +223 -0
- package/dist/type-DfwJ6GTs.d.mts +223 -0
- package/dist/type-ma8o4dJG.mjs +9110 -0
- package/dist/types-BO3PJV5p.d.mts +511 -0
- package/dist/types-Bb6lL3KL.d.cts +511 -0
- package/dist/types.d.cts +3 -5
- package/dist/types.d.mts +3 -5
- package/dist/utilities-CT_jcB5h.mjs +1483 -0
- package/dist/utilities-Dr3TzxMb.cjs +1523 -0
- package/dist/utilities.cjs +8 -116
- package/dist/utilities.d.cts +1 -1
- package/dist/utilities.d.mts +1 -1
- package/dist/utilities.mjs +2 -110
- package/dist/vendor/core.cjs +1 -1
- package/dist/vendor/core.d.cts +158 -637
- package/dist/vendor/core.d.mts +158 -637
- package/dist/vendor/core.mjs +3 -2
- package/dist/vendor/type-compiler/compiler.cjs +1 -1
- package/dist/vendor/type-compiler/compiler.d.cts +1 -1
- package/dist/vendor/type-compiler/compiler.d.mts +1 -1
- package/dist/vendor/type-compiler/compiler.mjs +1 -1
- package/dist/vendor/type-compiler/config.cjs +1 -1
- package/dist/vendor/type-compiler/config.d.cts +1 -1
- package/dist/vendor/type-compiler/config.d.mts +1 -1
- package/dist/vendor/type-compiler/config.mjs +1 -1
- package/dist/vendor/type-compiler/index.cjs +11 -3
- package/dist/vendor/type-compiler/index.d.cts +3 -2
- package/dist/vendor/type-compiler/index.d.mts +3 -2
- package/dist/vendor/type-compiler/index.mjs +3 -2
- package/dist/vendor/type-spec.cjs +1 -1
- package/dist/vendor/type-spec.d.cts +2 -192
- package/dist/vendor/type-spec.d.mts +2 -192
- package/dist/vendor/type-spec.mjs +1 -1
- package/dist/vendor/type.cjs +268 -9374
- package/dist/vendor/type.d.cts +3 -3239
- package/dist/vendor/type.d.mts +3 -3239
- package/dist/vendor/type.mjs +2 -9107
- package/package.json +11 -16
- package/schemas/reflection.d.cts +1 -6
- package/schemas/reflection.d.mts +1 -6
- /package/dist/{vendor/type-BMLjRtLY.cjs → type-DhqntM0q.cjs} +0 -0
|
@@ -0,0 +1,2969 @@
|
|
|
1
|
+
import { c as AbstractClassType, d as CustomError, f as ExtractClassType, r as TypeAnnotation, s as CompilerContext, u as ClassType } from "./types-Bb6lL3KL.cjs";
|
|
2
|
+
import { n as ReflectionOp, r as TypeNumberBrand } from "./type-DR66Hepn.cjs";
|
|
3
|
+
import { Buffer } from "node:buffer";
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/changes.d.ts
|
|
6
|
+
type NumberFields<T> = { [K in keyof T]: T[K] extends number | bigint ? K : never }[keyof T];
|
|
7
|
+
type Expression<T> = { [P in keyof T & string]?: string };
|
|
8
|
+
type Partial$1<T> = { [P in keyof T & string]?: T[P] };
|
|
9
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] } & {
|
|
10
|
+
[deepPath: string]: any;
|
|
11
|
+
};
|
|
12
|
+
interface ChangesInterface<T> {
|
|
13
|
+
$set?: DeepPartial<T> | T;
|
|
14
|
+
$unset?: {
|
|
15
|
+
[path: string]: number;
|
|
16
|
+
};
|
|
17
|
+
$inc?: Partial$1<Pick<T, NumberFields<T>>>;
|
|
18
|
+
}
|
|
19
|
+
declare class Changes<T extends object> {
|
|
20
|
+
$set?: DeepPartial<T> | T;
|
|
21
|
+
$unset?: {
|
|
22
|
+
[path: string]: number;
|
|
23
|
+
};
|
|
24
|
+
$inc?: Partial$1<Pick<T, NumberFields<T>>>;
|
|
25
|
+
empty: boolean;
|
|
26
|
+
fieldNames: string[];
|
|
27
|
+
constructor(changes?: ChangesInterface<T>);
|
|
28
|
+
clear(): void;
|
|
29
|
+
getReturning(): string[];
|
|
30
|
+
protected detectEmpty(): void;
|
|
31
|
+
replaceSet($set: DeepPartial<T> | T): void;
|
|
32
|
+
mergeSet($set: Partial$1<T> | T): void;
|
|
33
|
+
increase(property: NumberFields<T>, increase?: number): void;
|
|
34
|
+
set(property: keyof T & string, value: any): void;
|
|
35
|
+
unset(property: keyof T & string, unset?: boolean): void;
|
|
36
|
+
has(name: keyof T & string): boolean;
|
|
37
|
+
}
|
|
38
|
+
declare class ItemChanges<T extends object> extends Changes<T> {
|
|
39
|
+
protected item: T;
|
|
40
|
+
constructor(changes: ChangesInterface<T> | undefined, item: T);
|
|
41
|
+
increase(property: NumberFields<T>, increase?: number): void;
|
|
42
|
+
set(property: keyof T & string, value: any): void;
|
|
43
|
+
unset(property: keyof T & string, unset?: boolean): void;
|
|
44
|
+
}
|
|
45
|
+
declare const changeSetSymbol: unique symbol;
|
|
46
|
+
declare class AtomicChangeInstance<T extends object> {
|
|
47
|
+
protected object: any;
|
|
48
|
+
readonly changeSet: Changes<T>;
|
|
49
|
+
constructor(object: any);
|
|
50
|
+
increase(property: NumberFields<T>, increase?: number): void;
|
|
51
|
+
}
|
|
52
|
+
declare function atomicChange<T extends object>(object: T): AtomicChangeInstance<T>;
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/reflection/type.d.ts
|
|
55
|
+
declare enum ReflectionVisibility {
|
|
56
|
+
public = 0,
|
|
57
|
+
protected = 1,
|
|
58
|
+
private = 2
|
|
59
|
+
}
|
|
60
|
+
declare enum ReflectionKind {
|
|
61
|
+
never = 0,
|
|
62
|
+
any = 1,
|
|
63
|
+
unknown = 2,
|
|
64
|
+
void = 3,
|
|
65
|
+
object = 4,
|
|
66
|
+
string = 5,
|
|
67
|
+
number = 6,
|
|
68
|
+
boolean = 7,
|
|
69
|
+
symbol = 8,
|
|
70
|
+
bigint = 9,
|
|
71
|
+
null = 10,
|
|
72
|
+
undefined = 11,
|
|
73
|
+
regexp = 12,
|
|
74
|
+
literal = 13,
|
|
75
|
+
templateLiteral = 14,
|
|
76
|
+
property = 15,
|
|
77
|
+
method = 16,
|
|
78
|
+
function = 17,
|
|
79
|
+
parameter = 18,
|
|
80
|
+
promise = 19,
|
|
81
|
+
/**
|
|
82
|
+
* Uint8Array, Date, custom classes, Set, Map, etc
|
|
83
|
+
*/
|
|
84
|
+
class = 20,
|
|
85
|
+
typeParameter = 21,
|
|
86
|
+
enum = 22,
|
|
87
|
+
union = 23,
|
|
88
|
+
intersection = 24,
|
|
89
|
+
array = 25,
|
|
90
|
+
tuple = 26,
|
|
91
|
+
tupleMember = 27,
|
|
92
|
+
enumMember = 28,
|
|
93
|
+
rest = 29,
|
|
94
|
+
objectLiteral = 30,
|
|
95
|
+
indexSignature = 31,
|
|
96
|
+
propertySignature = 32,
|
|
97
|
+
methodSignature = 33,
|
|
98
|
+
infer = 34,
|
|
99
|
+
callSignature = 35
|
|
100
|
+
}
|
|
101
|
+
type TypeDecorator = (annotations: Annotations, decorator: TypeObjectLiteral) => boolean;
|
|
102
|
+
type Annotations = any;
|
|
103
|
+
/**
|
|
104
|
+
* @reflection never
|
|
105
|
+
*/
|
|
106
|
+
interface TypeAnnotations {
|
|
107
|
+
id?: number;
|
|
108
|
+
origin?: Type;
|
|
109
|
+
/**
|
|
110
|
+
* True when this type comes from an inline type, e.g.
|
|
111
|
+
*
|
|
112
|
+
* `type A = T;`. Type of `T` is inlined.
|
|
113
|
+
* `type A = {}`. Type of `{}` is not inlined.
|
|
114
|
+
*
|
|
115
|
+
* If the type is not inlined and the result of a type function, then we assign parents of members accordingly. This is not the caee when a type was inlined.
|
|
116
|
+
*/
|
|
117
|
+
inlined?: true;
|
|
118
|
+
/**
|
|
119
|
+
* If the type was created by a type function, this contains the alias name.
|
|
120
|
+
*/
|
|
121
|
+
typeName?: string;
|
|
122
|
+
/**
|
|
123
|
+
* If the type was created by a type function, this contains the arguments passed the function.
|
|
124
|
+
*/
|
|
125
|
+
typeArguments?: Type[];
|
|
126
|
+
/**
|
|
127
|
+
* Set for index access expressions, e.g. Config['property'].
|
|
128
|
+
*/
|
|
129
|
+
indexAccessOrigin?: {
|
|
130
|
+
container: TypeClass | TypeObjectLiteral;
|
|
131
|
+
index: Type;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* type User = {id: number, user: string};
|
|
135
|
+
* type UserCreate = Pick<User, 'user'>;
|
|
136
|
+
* typeOf<UserCreate>().originTypes[0].typeName = 'Pick'
|
|
137
|
+
* typeOf<UserCreate>().originTypes[0].typeArguments = [User, 'user']
|
|
138
|
+
*/
|
|
139
|
+
originTypes?: {
|
|
140
|
+
typeName: string;
|
|
141
|
+
typeArguments?: Type[];
|
|
142
|
+
}[];
|
|
143
|
+
annotations?: Annotations;
|
|
144
|
+
decorators?: Type[];
|
|
145
|
+
scheduleDecorators?: TypeObjectLiteral[];
|
|
146
|
+
/**
|
|
147
|
+
* A place where arbitrary jit functions and its cache data is stored.
|
|
148
|
+
*/
|
|
149
|
+
jit?: JitContainer;
|
|
150
|
+
}
|
|
151
|
+
declare function applyScheduledAnnotations(type: Type): void;
|
|
152
|
+
declare function hasTypeInformation(object: ClassType | Function): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Object to hold runtime jit data.
|
|
155
|
+
*/
|
|
156
|
+
type JitContainer = any;
|
|
157
|
+
declare function getTypeJitContainer(type: Type): JitContainer;
|
|
158
|
+
declare function clearTypeJitContainer(type: Type): void;
|
|
159
|
+
interface TagsReflection {
|
|
160
|
+
hidden?: boolean;
|
|
161
|
+
ignore?: boolean;
|
|
162
|
+
internal?: boolean;
|
|
163
|
+
runtime?: boolean;
|
|
164
|
+
alias?: string[];
|
|
165
|
+
title?: string;
|
|
166
|
+
readonly?: boolean;
|
|
167
|
+
permission?: string[];
|
|
168
|
+
domain?: string;
|
|
169
|
+
}
|
|
170
|
+
interface TypeNever extends TypeAnnotations {
|
|
171
|
+
kind: ReflectionKind.never;
|
|
172
|
+
parent?: Type;
|
|
173
|
+
}
|
|
174
|
+
interface TypeAny extends TypeAnnotations {
|
|
175
|
+
kind: ReflectionKind.any;
|
|
176
|
+
parent?: Type;
|
|
177
|
+
}
|
|
178
|
+
interface TypeUnknown extends TypeAnnotations {
|
|
179
|
+
kind: ReflectionKind.unknown;
|
|
180
|
+
parent?: Type;
|
|
181
|
+
}
|
|
182
|
+
interface TypeVoid extends TypeAnnotations {
|
|
183
|
+
kind: ReflectionKind.void;
|
|
184
|
+
parent?: Type;
|
|
185
|
+
}
|
|
186
|
+
interface TypeObject extends TypeAnnotations {
|
|
187
|
+
kind: ReflectionKind.object;
|
|
188
|
+
parent?: Type;
|
|
189
|
+
}
|
|
190
|
+
interface TypeString extends TypeAnnotations {
|
|
191
|
+
kind: ReflectionKind.string;
|
|
192
|
+
parent?: Type;
|
|
193
|
+
}
|
|
194
|
+
declare function isIntegerType(type: Type): type is TypeNumber;
|
|
195
|
+
interface TypeNumber extends TypeAnnotations {
|
|
196
|
+
kind: ReflectionKind.number;
|
|
197
|
+
brand?: TypeNumberBrand;
|
|
198
|
+
parent?: Type;
|
|
199
|
+
}
|
|
200
|
+
interface TypeBoolean extends TypeAnnotations {
|
|
201
|
+
kind: ReflectionKind.boolean;
|
|
202
|
+
parent?: Type;
|
|
203
|
+
}
|
|
204
|
+
interface TypeBigInt extends TypeAnnotations {
|
|
205
|
+
kind: ReflectionKind.bigint;
|
|
206
|
+
parent?: Type;
|
|
207
|
+
}
|
|
208
|
+
interface TypeSymbol extends TypeAnnotations {
|
|
209
|
+
kind: ReflectionKind.symbol;
|
|
210
|
+
parent?: Type;
|
|
211
|
+
}
|
|
212
|
+
interface TypeNull extends TypeAnnotations {
|
|
213
|
+
kind: ReflectionKind.null;
|
|
214
|
+
parent?: Type;
|
|
215
|
+
}
|
|
216
|
+
interface TypeUndefined extends TypeAnnotations {
|
|
217
|
+
kind: ReflectionKind.undefined;
|
|
218
|
+
parent?: Type;
|
|
219
|
+
}
|
|
220
|
+
interface TypeLiteral extends TypeAnnotations {
|
|
221
|
+
kind: ReflectionKind.literal;
|
|
222
|
+
literal: symbol | string | number | boolean | bigint | RegExp;
|
|
223
|
+
parent?: Type;
|
|
224
|
+
}
|
|
225
|
+
interface TypeTemplateLiteral extends TypeAnnotations {
|
|
226
|
+
kind: ReflectionKind.templateLiteral;
|
|
227
|
+
types: (TypeString | TypeAny | TypeNumber | TypeLiteral | TypeInfer)[];
|
|
228
|
+
parent?: Type;
|
|
229
|
+
}
|
|
230
|
+
interface TypeRegexp extends TypeAnnotations {
|
|
231
|
+
kind: ReflectionKind.regexp;
|
|
232
|
+
parent?: Type;
|
|
233
|
+
}
|
|
234
|
+
interface TypeBaseMember extends TypeAnnotations {
|
|
235
|
+
visibility: ReflectionVisibility;
|
|
236
|
+
abstract?: true;
|
|
237
|
+
static?: true;
|
|
238
|
+
optional?: true;
|
|
239
|
+
readonly?: true;
|
|
240
|
+
tags?: TagsReflection;
|
|
241
|
+
}
|
|
242
|
+
interface TypeParameter extends TypeAnnotations {
|
|
243
|
+
kind: ReflectionKind.parameter;
|
|
244
|
+
name: string;
|
|
245
|
+
type: Type;
|
|
246
|
+
parent: TypeFunction | TypeMethod | TypeMethodSignature | TypeCallSignature;
|
|
247
|
+
visibility?: ReflectionVisibility;
|
|
248
|
+
readonly?: true;
|
|
249
|
+
optional?: true;
|
|
250
|
+
description?: string;
|
|
251
|
+
/**
|
|
252
|
+
* Set when the parameter has a default value aka initializer.
|
|
253
|
+
*/
|
|
254
|
+
default?: (() => any) | any;
|
|
255
|
+
tags?: TagsReflection;
|
|
256
|
+
}
|
|
257
|
+
interface TypeMethod extends TypeBaseMember {
|
|
258
|
+
kind: ReflectionKind.method;
|
|
259
|
+
parent: TypeClass;
|
|
260
|
+
name: number | string | symbol;
|
|
261
|
+
description?: string;
|
|
262
|
+
parameters: TypeParameter[];
|
|
263
|
+
return: Type;
|
|
264
|
+
}
|
|
265
|
+
interface TypeProperty extends TypeBaseMember {
|
|
266
|
+
kind: ReflectionKind.property;
|
|
267
|
+
parent: TypeClass;
|
|
268
|
+
visibility: ReflectionVisibility;
|
|
269
|
+
name: number | string | symbol;
|
|
270
|
+
description?: string;
|
|
271
|
+
type: Type;
|
|
272
|
+
/**
|
|
273
|
+
* Set when the property has a default value aka initializer.
|
|
274
|
+
*/
|
|
275
|
+
default?: (() => any) | any;
|
|
276
|
+
}
|
|
277
|
+
interface TypeFunction extends TypeAnnotations {
|
|
278
|
+
kind: ReflectionKind.function;
|
|
279
|
+
parent?: Type;
|
|
280
|
+
name?: number | string | symbol;
|
|
281
|
+
description?: string;
|
|
282
|
+
function?: Function;
|
|
283
|
+
parameters: TypeParameter[];
|
|
284
|
+
return: Type;
|
|
285
|
+
tags?: TagsReflection;
|
|
286
|
+
}
|
|
287
|
+
interface TypeCallSignature extends TypeAnnotations {
|
|
288
|
+
kind: ReflectionKind.callSignature;
|
|
289
|
+
parent?: Type;
|
|
290
|
+
parameters: TypeParameter[];
|
|
291
|
+
return: Type;
|
|
292
|
+
tags?: TagsReflection;
|
|
293
|
+
}
|
|
294
|
+
interface TypePromise extends TypeAnnotations {
|
|
295
|
+
kind: ReflectionKind.promise;
|
|
296
|
+
parent?: Type;
|
|
297
|
+
type: Type;
|
|
298
|
+
}
|
|
299
|
+
interface TypeClass extends TypeAnnotations {
|
|
300
|
+
kind: ReflectionKind.class;
|
|
301
|
+
parent?: Type;
|
|
302
|
+
classType: ClassType;
|
|
303
|
+
description?: string;
|
|
304
|
+
/**
|
|
305
|
+
* When the class extends another class and uses on it generic type arguments, then those arguments
|
|
306
|
+
* are in this array.
|
|
307
|
+
* For example `class A extends B<string, boolean> {}` then extendsArguments = [string, boolean].
|
|
308
|
+
* The reference to `B` is not part of TypeClass since this information is available in JavaScript runtime
|
|
309
|
+
* by using `Object.getPrototypeOf(type.classType)`.
|
|
310
|
+
*/
|
|
311
|
+
extendsArguments?: Type[];
|
|
312
|
+
/**
|
|
313
|
+
* When the class implements another interface/type, then those types are in this array.
|
|
314
|
+
*
|
|
315
|
+
* For example `class A implements B<string, boolean> {}` then implements = [B<string, boolean>].
|
|
316
|
+
*/
|
|
317
|
+
implements?: Type[];
|
|
318
|
+
/**
|
|
319
|
+
* When class has generic type arguments, e.g. MyClass<string>, it contains
|
|
320
|
+
* all type arguments. If no type arguments are given, it's undefined.
|
|
321
|
+
*/
|
|
322
|
+
arguments?: Type[];
|
|
323
|
+
/**
|
|
324
|
+
* properties/methods.
|
|
325
|
+
*/
|
|
326
|
+
types: (TypeIndexSignature | TypeProperty | TypeMethod)[];
|
|
327
|
+
tags?: TagsReflection;
|
|
328
|
+
}
|
|
329
|
+
interface TypeEnum extends TypeAnnotations {
|
|
330
|
+
kind: ReflectionKind.enum;
|
|
331
|
+
parent?: Type;
|
|
332
|
+
enum: {
|
|
333
|
+
[name: string]: string | number | undefined | null;
|
|
334
|
+
};
|
|
335
|
+
values: (string | number | undefined | null)[];
|
|
336
|
+
indexType: Type;
|
|
337
|
+
description?: string;
|
|
338
|
+
tags?: TagsReflection;
|
|
339
|
+
}
|
|
340
|
+
interface TypeEnumMember extends TypeAnnotations {
|
|
341
|
+
kind: ReflectionKind.enumMember;
|
|
342
|
+
parent: TypeEnum;
|
|
343
|
+
name: string;
|
|
344
|
+
description?: string;
|
|
345
|
+
default?: (() => string | number) | string | number;
|
|
346
|
+
tags?: TagsReflection;
|
|
347
|
+
}
|
|
348
|
+
interface TypeTypeParameter extends TypeAnnotations {
|
|
349
|
+
kind: ReflectionKind.typeParameter;
|
|
350
|
+
parent?: Type;
|
|
351
|
+
name: string;
|
|
352
|
+
tags?: TagsReflection;
|
|
353
|
+
}
|
|
354
|
+
interface TypeUnion extends TypeAnnotations {
|
|
355
|
+
kind: ReflectionKind.union;
|
|
356
|
+
parent?: Type;
|
|
357
|
+
types: Type[];
|
|
358
|
+
}
|
|
359
|
+
interface TypeIntersection extends TypeAnnotations {
|
|
360
|
+
kind: ReflectionKind.intersection;
|
|
361
|
+
parent?: Type;
|
|
362
|
+
types: Type[];
|
|
363
|
+
}
|
|
364
|
+
interface TypeArray extends TypeAnnotations {
|
|
365
|
+
kind: ReflectionKind.array;
|
|
366
|
+
parent?: Type;
|
|
367
|
+
type: Type;
|
|
368
|
+
tags?: TagsReflection;
|
|
369
|
+
}
|
|
370
|
+
interface TypePropertySignature extends TypeAnnotations {
|
|
371
|
+
kind: ReflectionKind.propertySignature;
|
|
372
|
+
parent: TypeObjectLiteral;
|
|
373
|
+
name: number | string | symbol;
|
|
374
|
+
optional?: true;
|
|
375
|
+
readonly?: true;
|
|
376
|
+
description?: string;
|
|
377
|
+
type: Type;
|
|
378
|
+
/**
|
|
379
|
+
* Set when the property has a default value aka initializer.
|
|
380
|
+
*/
|
|
381
|
+
default?: (() => any) | any;
|
|
382
|
+
tags?: TagsReflection;
|
|
383
|
+
}
|
|
384
|
+
interface TypeMethodSignature extends TypeAnnotations {
|
|
385
|
+
kind: ReflectionKind.methodSignature;
|
|
386
|
+
parent: TypeObjectLiteral;
|
|
387
|
+
name: number | string | symbol;
|
|
388
|
+
optional?: true;
|
|
389
|
+
description?: string;
|
|
390
|
+
parameters: TypeParameter[];
|
|
391
|
+
return: Type;
|
|
392
|
+
tags?: TagsReflection;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Object literals or interfaces.
|
|
396
|
+
*/
|
|
397
|
+
interface TypeObjectLiteral extends TypeAnnotations {
|
|
398
|
+
kind: ReflectionKind.objectLiteral;
|
|
399
|
+
parent?: Type;
|
|
400
|
+
description?: string;
|
|
401
|
+
types: (TypeIndexSignature | TypePropertySignature | TypeMethodSignature | TypeCallSignature)[];
|
|
402
|
+
/**
|
|
403
|
+
* When the interface extends another interface/type, then those types are in this array.
|
|
404
|
+
*
|
|
405
|
+
* For example `interface A extends B<string, boolean> {}` then implements = [B<string, boolean>].
|
|
406
|
+
*/
|
|
407
|
+
implements?: Type[];
|
|
408
|
+
tags?: TagsReflection;
|
|
409
|
+
}
|
|
410
|
+
interface TypeIndexSignature extends TypeAnnotations {
|
|
411
|
+
kind: ReflectionKind.indexSignature;
|
|
412
|
+
parent: TypeClass | TypeObjectLiteral;
|
|
413
|
+
index: Type;
|
|
414
|
+
type: Type;
|
|
415
|
+
/**
|
|
416
|
+
* Set when the property has a default value aka initializer.
|
|
417
|
+
*/
|
|
418
|
+
default?: (() => any) | any;
|
|
419
|
+
tags?: TagsReflection;
|
|
420
|
+
}
|
|
421
|
+
interface TypeInfer extends TypeAnnotations {
|
|
422
|
+
kind: ReflectionKind.infer;
|
|
423
|
+
parent?: Type;
|
|
424
|
+
set(type: Type): void;
|
|
425
|
+
}
|
|
426
|
+
interface TypeTupleMember extends TypeAnnotations {
|
|
427
|
+
kind: ReflectionKind.tupleMember;
|
|
428
|
+
parent: TypeTuple;
|
|
429
|
+
type: Type;
|
|
430
|
+
optional?: true;
|
|
431
|
+
name?: string;
|
|
432
|
+
}
|
|
433
|
+
interface TypeTuple extends TypeAnnotations {
|
|
434
|
+
kind: ReflectionKind.tuple;
|
|
435
|
+
parent?: Type;
|
|
436
|
+
types: TypeTupleMember[];
|
|
437
|
+
}
|
|
438
|
+
interface TypeRest extends TypeAnnotations {
|
|
439
|
+
kind: ReflectionKind.rest;
|
|
440
|
+
parent: TypeTypeParameter | TypeTupleMember;
|
|
441
|
+
type: Type;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* @reflection never
|
|
445
|
+
*/
|
|
446
|
+
type Type = TypeNever | TypeAny | TypeUnknown | TypeVoid | TypeObject | TypeString | TypeNumber | TypeBoolean | TypeBigInt | TypeSymbol | TypeNull | TypeUndefined | TypeLiteral | TypeTemplateLiteral | TypeParameter | TypeFunction | TypeMethod | TypeProperty | TypePromise | TypeClass | TypeEnum | TypeEnumMember | TypeUnion | TypeIntersection | TypeArray | TypeObjectLiteral | TypeIndexSignature | TypePropertySignature | TypeMethodSignature | TypeTypeParameter | TypeInfer | TypeTuple | TypeTupleMember | TypeRest | TypeRegexp | TypeCallSignature;
|
|
447
|
+
type Widen<T> = T extends string ? string : T extends number ? number : T extends bigint ? bigint : T extends boolean ? boolean : T extends symbol ? symbol : T;
|
|
448
|
+
type FindType<T extends Type, LOOKUP extends ReflectionKind> = T extends {
|
|
449
|
+
kind: infer K;
|
|
450
|
+
} ? K extends LOOKUP ? T : never : never;
|
|
451
|
+
/**
|
|
452
|
+
* Merge dynamic runtime types with static types. In the type-system resolves as any, in runtime as the correct type.
|
|
453
|
+
*
|
|
454
|
+
* ```typescript
|
|
455
|
+
* const stringType = {kind: ReflectionKind.string};
|
|
456
|
+
* type t = {a: InlineRuntimeType<typeof stringType>}
|
|
457
|
+
*
|
|
458
|
+
* const value = 34;
|
|
459
|
+
* type t = {a: InlineRuntimeType<typeof value>}
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
type InlineRuntimeType<T extends ReflectionClass<any> | Type | number | string | boolean | bigint> = T extends ReflectionClass<infer K> ? K : any;
|
|
463
|
+
declare function isType(entry: any): entry is Type;
|
|
464
|
+
declare function isBinary(type: Type): boolean;
|
|
465
|
+
declare function isPrimitive<T extends Type>(type: T): boolean;
|
|
466
|
+
declare function isPropertyType(type: Type): type is TypePropertySignature | TypeProperty;
|
|
467
|
+
/**
|
|
468
|
+
* Returns true if the type is TypePropertySignature | TypeProperty and not a static member.
|
|
469
|
+
*/
|
|
470
|
+
declare function isPropertyMemberType(type: Type): type is TypePropertySignature | TypeProperty;
|
|
471
|
+
/**
|
|
472
|
+
* Return all properties created in the constructor (via `constructor(public title: string)`)
|
|
473
|
+
*
|
|
474
|
+
* If a non-property parameter is in the constructor, the type is given instead, e.g. `constructor(public title: string, anotherOne:number)` => [TypeProperty, TypeNumber]
|
|
475
|
+
*/
|
|
476
|
+
declare function getConstructorProperties(type: TypeClass | TypeObjectLiteral): {
|
|
477
|
+
parameters: (TypeProperty | Type)[];
|
|
478
|
+
properties: TypeProperty[];
|
|
479
|
+
};
|
|
480
|
+
type WithAnnotations = TypeAny | TypeUnknown | TypeString | TypeNumber | TypeBigInt | TypeBoolean | TypeArray | TypeTuple | TypeLiteral | TypeNull | TypeUndefined | TypeClass | TypeObjectLiteral | TypeObject | TypeTemplateLiteral | TypeRegexp | TypeSymbol;
|
|
481
|
+
declare function isWithAnnotations(type: ParentLessType): type is WithAnnotations;
|
|
482
|
+
declare function getAnnotations(type: WithAnnotations): Annotations;
|
|
483
|
+
type StackEntry$1 = {
|
|
484
|
+
left: Type;
|
|
485
|
+
right: Type;
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* Checks if the structure of a and b are identical.
|
|
489
|
+
*/
|
|
490
|
+
declare function isSameType(a: Type, b: Type, stack?: StackEntry$1[]): boolean;
|
|
491
|
+
declare function addType<T extends Type>(container: T, type: Type): T;
|
|
492
|
+
declare function isTypeIncluded(types: Type[], type: Type, stack?: StackEntry$1[]): boolean;
|
|
493
|
+
/**
|
|
494
|
+
* `true | (string | number)` => `true | string | number`
|
|
495
|
+
*/
|
|
496
|
+
declare function flatten<T extends Type>(type: T): T;
|
|
497
|
+
/**
|
|
498
|
+
* Flatten nested union types.
|
|
499
|
+
*/
|
|
500
|
+
declare function flattenUnionTypes(types: Type[]): Type[];
|
|
501
|
+
/**
|
|
502
|
+
* empty union => never
|
|
503
|
+
* union with one member => member
|
|
504
|
+
* otherwise the union is returned
|
|
505
|
+
*/
|
|
506
|
+
declare function unboxUnion(union: TypeUnion): Type;
|
|
507
|
+
declare function findMember(index: string | number | symbol | TypeTemplateLiteral, types: Type[]): TypePropertySignature | TypeMethodSignature | TypeMethod | TypeProperty | TypeIndexSignature | undefined;
|
|
508
|
+
interface CStack {
|
|
509
|
+
iterator: Type[];
|
|
510
|
+
i: number;
|
|
511
|
+
round: number;
|
|
512
|
+
}
|
|
513
|
+
declare function emptyObject(type: Type): boolean;
|
|
514
|
+
declare class CartesianProduct {
|
|
515
|
+
protected stack: CStack[];
|
|
516
|
+
private current;
|
|
517
|
+
private next;
|
|
518
|
+
toGroup(type: Type): Type[];
|
|
519
|
+
add(item: Type): void;
|
|
520
|
+
calculate(): Type[][];
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Query a container type and return the result.
|
|
524
|
+
*
|
|
525
|
+
* container[index]
|
|
526
|
+
*
|
|
527
|
+
* e.g. {a: string}['a'] => string
|
|
528
|
+
* e.g. {a: string, b: number}[keyof T] => string | number
|
|
529
|
+
* e.g. [string, number][0] => string
|
|
530
|
+
* e.g. [string, number][number] => string | number
|
|
531
|
+
*/
|
|
532
|
+
declare function indexAccess(container: Type, index: Type): Type;
|
|
533
|
+
declare function merge(types: (TypeObjectLiteral | TypeClass)[]): TypeObjectLiteral;
|
|
534
|
+
declare function narrowOriginalLiteral(type: Type): Type;
|
|
535
|
+
type GetArrayElement<T extends any[]> = [T] extends [Array<infer K>] ? K : never;
|
|
536
|
+
type RemoveParent<T, K extends keyof T> = { [P in K]: T[P] extends Type[] ? RemoveParentHomomorphic<GetArrayElement<T[P]>>[] : T[P] extends Type ? RemoveParentHomomorphic<T[P]> : T[P] };
|
|
537
|
+
type RemoveParentHomomorphic<T> = RemoveParent<T, Exclude<keyof T, "parent">>;
|
|
538
|
+
type RemoveDeepParent<T extends Type> = T extends infer K ? RemoveParentHomomorphic<K> : never;
|
|
539
|
+
type ParentLessType = RemoveDeepParent<Type>;
|
|
540
|
+
/**
|
|
541
|
+
* This function does not do a deep copy, only shallow. A deep copy makes it way to inefficient, so much that router.spec.ts takes up to 20-30seconds
|
|
542
|
+
* to complete instead of barely 30ms.
|
|
543
|
+
*/
|
|
544
|
+
declare function copyAndSetParent<T extends ParentLessType>(inc: T, parent?: Type): FindType<Type, T["kind"]>;
|
|
545
|
+
declare function widenLiteral(type: Type): Type;
|
|
546
|
+
declare function assertType<K extends ReflectionKind, T>(t: Type | undefined, kind: K): asserts t is FindType<Type, K>;
|
|
547
|
+
declare function getClassType(type: Type): ClassType;
|
|
548
|
+
declare function isMember(type: Type): type is TypePropertySignature | TypeProperty | TypeMethodSignature | TypeMethod;
|
|
549
|
+
declare function hasMember(type: TypeObjectLiteral | TypeClass, memberName: number | string | symbol, memberType?: Type): boolean;
|
|
550
|
+
declare function getMember(type: TypeObjectLiteral | TypeClass, memberName: number | string | symbol): TypeMethodSignature | TypeMethod | TypePropertySignature | TypeProperty | void;
|
|
551
|
+
declare function getTypeObjectLiteralFromTypeClass<T extends Type>(type: T): T extends TypeClass ? TypeObjectLiteral : T;
|
|
552
|
+
/**
|
|
553
|
+
* Checks whether `undefined` is allowed as type.
|
|
554
|
+
*/
|
|
555
|
+
declare function isOptional(type: Type): boolean;
|
|
556
|
+
/**
|
|
557
|
+
* Whether a property has an initializer/default value.
|
|
558
|
+
*/
|
|
559
|
+
declare function hasDefaultValue(type: Type): boolean;
|
|
560
|
+
/**
|
|
561
|
+
* Checks whether `null` is allowed as type.
|
|
562
|
+
*/
|
|
563
|
+
declare function isNullable(type: Type): boolean;
|
|
564
|
+
/**
|
|
565
|
+
* Get tags from type.
|
|
566
|
+
*/
|
|
567
|
+
declare function getTags(type: Type): TagsReflection;
|
|
568
|
+
/**
|
|
569
|
+
* Checks whether the \`hidden\` tag was specified for the type.
|
|
570
|
+
*/
|
|
571
|
+
declare function isHidden(type: Type): boolean;
|
|
572
|
+
/**
|
|
573
|
+
* Checks whether the \`ignore\` tag was specified for the type.
|
|
574
|
+
*/
|
|
575
|
+
declare function isIgnore(type: Type): boolean;
|
|
576
|
+
/**
|
|
577
|
+
* Checks whether the \`internal\` tag was specified for the type.
|
|
578
|
+
*/
|
|
579
|
+
declare function isInternal(type: Type): boolean;
|
|
580
|
+
/**
|
|
581
|
+
* Checks whether the \`runtime\` tag was specified for the type.
|
|
582
|
+
*/
|
|
583
|
+
declare function isRuntime(type: Type): boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Returns the values specified by the type's \`alias\` tag(s).
|
|
586
|
+
*/
|
|
587
|
+
declare function getAlias(type: Type): string[];
|
|
588
|
+
/**
|
|
589
|
+
* Checks whether the \`readonly\` tag was specified for the type.
|
|
590
|
+
*/
|
|
591
|
+
declare function isReadonly(type: Type): boolean;
|
|
592
|
+
/**
|
|
593
|
+
* Returns the values specified by the type's \`title\` tag.
|
|
594
|
+
*/
|
|
595
|
+
declare function getTitle(type: Type): string | undefined;
|
|
596
|
+
/**
|
|
597
|
+
* Returns the values specified by the type's \`permission\` tag(s).
|
|
598
|
+
*/
|
|
599
|
+
declare function getPermission(type: Type): string[];
|
|
600
|
+
/**
|
|
601
|
+
* Returns the values specified by the type's \`domain\` tag.
|
|
602
|
+
*/
|
|
603
|
+
declare function getDomain(type: Type): string | undefined;
|
|
604
|
+
/**
|
|
605
|
+
* Integer
|
|
606
|
+
*/
|
|
607
|
+
type integer = number;
|
|
608
|
+
/**
|
|
609
|
+
* Integer 8 bit.
|
|
610
|
+
* Min value -127, max value 128
|
|
611
|
+
*/
|
|
612
|
+
type int8 = number;
|
|
613
|
+
/**
|
|
614
|
+
* Unsigned integer 8 bit.
|
|
615
|
+
* Min value 0, max value 255
|
|
616
|
+
*/
|
|
617
|
+
type uint8 = number;
|
|
618
|
+
/**
|
|
619
|
+
* Integer 16 bit.
|
|
620
|
+
* Min value -32768, max value 32767
|
|
621
|
+
*/
|
|
622
|
+
type int16 = number;
|
|
623
|
+
/**
|
|
624
|
+
* Unsigned integer 16 bit.
|
|
625
|
+
* Min value 0, max value 65535
|
|
626
|
+
*/
|
|
627
|
+
type uint16 = number;
|
|
628
|
+
/**
|
|
629
|
+
* Integer 8 bit.
|
|
630
|
+
* Min value -2147483648, max value 2147483647
|
|
631
|
+
*/
|
|
632
|
+
type int32 = number;
|
|
633
|
+
/**
|
|
634
|
+
* Unsigned integer 32 bit.
|
|
635
|
+
* Min value 0, max value 4294967295
|
|
636
|
+
*/
|
|
637
|
+
type uint32 = number;
|
|
638
|
+
/**
|
|
639
|
+
* Float (same as number, but different semantic for databases).
|
|
640
|
+
*/
|
|
641
|
+
type float = number;
|
|
642
|
+
/**
|
|
643
|
+
* Float 32 bit.
|
|
644
|
+
*/
|
|
645
|
+
type float32 = number;
|
|
646
|
+
/**
|
|
647
|
+
* Float 64 bit.
|
|
648
|
+
*/
|
|
649
|
+
type float64 = number;
|
|
650
|
+
declare class AnnotationDefinition<T = true> {
|
|
651
|
+
readonly id: string;
|
|
652
|
+
symbol: symbol;
|
|
653
|
+
constructor(id: string);
|
|
654
|
+
register(annotations: Annotations, data: T): void;
|
|
655
|
+
reset(annotations: Annotations): void;
|
|
656
|
+
registerType<TType extends Type>(type: TType, data: T): TType;
|
|
657
|
+
replace(annotations: Annotations, annotation: T[]): void;
|
|
658
|
+
replaceType(type: Type, annotation: T[]): void;
|
|
659
|
+
getAnnotations(type: Type): T[];
|
|
660
|
+
getFirst(type: Type): T | undefined;
|
|
661
|
+
hasAnnotations(type: Type): boolean;
|
|
662
|
+
}
|
|
663
|
+
type AnnotationType<T extends AnnotationDefinition<any>> = T extends AnnotationDefinition<infer K> ? K : never;
|
|
664
|
+
type ReferenceActions = "RESTRICT" | "NO ACTION" | "CASCADE" | "SET NULL" | "SET DEFAULT";
|
|
665
|
+
interface ReferenceOptions {
|
|
666
|
+
/**
|
|
667
|
+
* Default is CASCADE.
|
|
668
|
+
*/
|
|
669
|
+
onDelete?: ReferenceActions;
|
|
670
|
+
/**
|
|
671
|
+
* Default is CASCADE.
|
|
672
|
+
*/
|
|
673
|
+
onUpdate?: ReferenceActions;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* note: if this is adjusted, make sure to adjust ReflectionClass, entityAnnotation, and type serializer accordingly.
|
|
677
|
+
*/
|
|
678
|
+
interface EntityOptions {
|
|
679
|
+
name?: string;
|
|
680
|
+
description?: string;
|
|
681
|
+
collection?: string;
|
|
682
|
+
database?: string;
|
|
683
|
+
singleTableInheritance?: boolean;
|
|
684
|
+
indexes?: {
|
|
685
|
+
names: string[];
|
|
686
|
+
options: IndexOptions;
|
|
687
|
+
}[];
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Type to decorate an interface/object literal with entity information.
|
|
691
|
+
*
|
|
692
|
+
* ```typescript
|
|
693
|
+
* interface User extends Entity<{name: 'user'}> {
|
|
694
|
+
* id: number & PrimaryKey & AutoIncrement;
|
|
695
|
+
* username: string & Unique;
|
|
696
|
+
* }
|
|
697
|
+
* ```
|
|
698
|
+
*/
|
|
699
|
+
type Entity<T extends EntityOptions> = {} & TypeAnnotation<"entity", T>;
|
|
700
|
+
/**
|
|
701
|
+
* Marks a property as primary key.
|
|
702
|
+
* ```typescript
|
|
703
|
+
* class Entity {
|
|
704
|
+
* id: number & Primary = 0;
|
|
705
|
+
* }
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
type PrimaryKey = TypeAnnotation<"primaryKey">;
|
|
709
|
+
type TypeKeyOf<T> = T[keyof T];
|
|
710
|
+
type PrimaryKeyFields<T> = any extends T ? any : { [P in keyof T]: Required<T[P]> extends Required<PrimaryKey> ? T[P] : never };
|
|
711
|
+
type PrimaryKeyType<T> = any extends T ? any : TypeKeyOf<PrimaryKeyFields<T>>;
|
|
712
|
+
type ReferenceFields<T> = { [P in keyof T]: Required<T[P]> extends Required<Reference> | Required<BackReference> ? T[P] : never };
|
|
713
|
+
/**
|
|
714
|
+
* Marks a primary property key as auto-increment.
|
|
715
|
+
*
|
|
716
|
+
* ```typescript
|
|
717
|
+
* class Entity {
|
|
718
|
+
* id: number & Primary & AutoIncrement = 0;
|
|
719
|
+
* }
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
type AutoIncrement = TypeAnnotation<"autoIncrement">;
|
|
723
|
+
/**
|
|
724
|
+
* UUID v4, as string, serialized as string in JSON, and binary in database.
|
|
725
|
+
* Use `uuid()` as handy initializer.
|
|
726
|
+
*
|
|
727
|
+
* ```typescript
|
|
728
|
+
* class Entity {
|
|
729
|
+
* id: UUID = uuid();
|
|
730
|
+
* }
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
type UUID = string & TypeAnnotation<"UUIDv4">;
|
|
734
|
+
/**
|
|
735
|
+
* MongoDB's ObjectID type. serialized as string in JSON, ObjectID in database.
|
|
736
|
+
*/
|
|
737
|
+
type MongoId = string & TypeAnnotation<"mongoId">;
|
|
738
|
+
/**
|
|
739
|
+
* Same as `bigint` but serializes to unsigned binary with unlimited size (instead of 8 bytes in most databases).
|
|
740
|
+
* Negative values will be converted to positive (abs(x)).
|
|
741
|
+
*
|
|
742
|
+
* ```typescript
|
|
743
|
+
* class Entity {
|
|
744
|
+
* id: BinaryBigInt = 0n;
|
|
745
|
+
* }
|
|
746
|
+
* ```
|
|
747
|
+
*/
|
|
748
|
+
type BinaryBigInt = bigint & TypeAnnotation<"binaryBigInt">;
|
|
749
|
+
/**
|
|
750
|
+
* Same as `bigint` but serializes to signed binary with unlimited size (instead of 8 bytes in most databases).
|
|
751
|
+
* The binary has an additional leading sign byte and is represented as an uint: 255 for negative, 0 for zero, or 1 for positive.
|
|
752
|
+
*
|
|
753
|
+
* ```typescript
|
|
754
|
+
* class Entity {
|
|
755
|
+
* id: SignedBinaryBigInt = 0n;
|
|
756
|
+
* }
|
|
757
|
+
* ```
|
|
758
|
+
*/
|
|
759
|
+
type SignedBinaryBigInt = bigint & TypeAnnotation<"signedBinaryBigInt">;
|
|
760
|
+
interface BackReferenceOptions {
|
|
761
|
+
/**
|
|
762
|
+
* Necessary for normalised many-to-many relations. This defines the class of the pivot table/collection.
|
|
763
|
+
*/
|
|
764
|
+
via?: ClassType | {};
|
|
765
|
+
/**
|
|
766
|
+
* A reference/backReference can define which reference on the other side
|
|
767
|
+
* reference back. This is necessary when there are multiple outgoing references
|
|
768
|
+
* to the same entity.
|
|
769
|
+
*/
|
|
770
|
+
mappedBy?: string;
|
|
771
|
+
}
|
|
772
|
+
type Reference<Options extends ReferenceOptions = {}> = TypeAnnotation<"reference", Options>;
|
|
773
|
+
type BackReference<Options extends BackReferenceOptions = {}> = TypeAnnotation<"backReference", Options>;
|
|
774
|
+
type EmbeddedMeta<Options> = TypeAnnotation<"embedded", Options>;
|
|
775
|
+
type Embedded<T, Options extends {
|
|
776
|
+
prefix?: string;
|
|
777
|
+
} = {}> = T & EmbeddedMeta<Options>;
|
|
778
|
+
type MapName<Alias extends string, ForSerializer extends string = ""> = TypeAnnotation<"mapName", [Alias, ForSerializer]>;
|
|
779
|
+
declare const referenceAnnotation: AnnotationDefinition<ReferenceOptions>;
|
|
780
|
+
declare const entityAnnotation: {
|
|
781
|
+
set<K extends keyof EntityOptions>(type: Type, name: K, value: EntityOptions[K]): void;
|
|
782
|
+
get(type: Type): EntityOptions;
|
|
783
|
+
symbol: symbol;
|
|
784
|
+
readonly id: string;
|
|
785
|
+
register(annotations: Annotations, data: EntityOptions): void;
|
|
786
|
+
reset(annotations: Annotations): void;
|
|
787
|
+
registerType<TType extends Type>(type: TType, data: EntityOptions): TType;
|
|
788
|
+
replace(annotations: Annotations, annotation: EntityOptions[]): void;
|
|
789
|
+
replaceType(type: Type, annotation: EntityOptions[]): void;
|
|
790
|
+
getAnnotations(type: Type): EntityOptions[];
|
|
791
|
+
getFirst(type: Type): EntityOptions | undefined;
|
|
792
|
+
hasAnnotations(type: Type): boolean;
|
|
793
|
+
};
|
|
794
|
+
declare const mapNameAnnotation: AnnotationDefinition<{
|
|
795
|
+
name: string;
|
|
796
|
+
serializer?: string;
|
|
797
|
+
}>;
|
|
798
|
+
declare const autoIncrementAnnotation: AnnotationDefinition<true>;
|
|
799
|
+
declare const primaryKeyAnnotation: {
|
|
800
|
+
isPrimaryKey(type: Type): boolean;
|
|
801
|
+
symbol: symbol;
|
|
802
|
+
readonly id: string;
|
|
803
|
+
register(annotations: Annotations, data: true): void;
|
|
804
|
+
reset(annotations: Annotations): void;
|
|
805
|
+
registerType<TType extends Type>(type: TType, data: true): TType;
|
|
806
|
+
replace(annotations: Annotations, annotation: true[]): void;
|
|
807
|
+
replaceType(type: Type, annotation: true[]): void;
|
|
808
|
+
getAnnotations(type: Type): true[];
|
|
809
|
+
getFirst(type: Type): true | undefined;
|
|
810
|
+
hasAnnotations(type: Type): boolean;
|
|
811
|
+
};
|
|
812
|
+
interface BackReferenceOptionsResolved {
|
|
813
|
+
/**
|
|
814
|
+
* Necessary for normalised many-to-many relations. This defines the class of the pivot table/collection.
|
|
815
|
+
*/
|
|
816
|
+
via?: TypeClass | TypeObjectLiteral;
|
|
817
|
+
/**
|
|
818
|
+
* A reference/backReference can define which reference on the other side
|
|
819
|
+
* reference back. This is necessary when there are multiple outgoing references
|
|
820
|
+
* to the same entity.
|
|
821
|
+
*/
|
|
822
|
+
mappedBy?: string;
|
|
823
|
+
}
|
|
824
|
+
declare const backReferenceAnnotation: AnnotationDefinition<BackReferenceOptionsResolved>;
|
|
825
|
+
declare const validationAnnotation: AnnotationDefinition<{
|
|
826
|
+
name: string;
|
|
827
|
+
args: Type[];
|
|
828
|
+
}>;
|
|
829
|
+
declare const UUIDAnnotation: AnnotationDefinition<true>;
|
|
830
|
+
declare const mongoIdAnnotation: AnnotationDefinition<true>;
|
|
831
|
+
declare const uuidAnnotation: AnnotationDefinition<true>;
|
|
832
|
+
declare const defaultAnnotation: AnnotationDefinition<Type>;
|
|
833
|
+
declare function isUUIDType(type: Type): boolean;
|
|
834
|
+
declare function isPrimaryKeyType(type: Type): boolean;
|
|
835
|
+
declare function isAutoIncrementType(type: Type): boolean;
|
|
836
|
+
declare function isMongoIdType(type: Type): boolean;
|
|
837
|
+
declare function isBinaryBigIntType(type: Type): boolean;
|
|
838
|
+
declare function isReferenceType(type: Type): boolean;
|
|
839
|
+
declare function getReferenceType(type: Type): ReferenceOptions | undefined;
|
|
840
|
+
declare function isBackReferenceType(type: Type): boolean;
|
|
841
|
+
declare function resolveProperty(type: Type): Type;
|
|
842
|
+
declare function getBackReferenceType(type: Type): BackReferenceOptionsResolved;
|
|
843
|
+
declare function isDateType(type: Type): boolean;
|
|
844
|
+
declare function isSetType(type: Type): boolean;
|
|
845
|
+
declare function isMapType(type: Type): boolean;
|
|
846
|
+
/**
|
|
847
|
+
* Get the key type of a Map or object literal with index signatures.
|
|
848
|
+
*/
|
|
849
|
+
declare function getKeyType(type: Type): Type;
|
|
850
|
+
/**
|
|
851
|
+
* Get the value type of a Map or object literal with index signatures.
|
|
852
|
+
*/
|
|
853
|
+
declare function getValueType(type: Type): Type;
|
|
854
|
+
interface EmbeddedOptions {
|
|
855
|
+
prefix?: string;
|
|
856
|
+
}
|
|
857
|
+
declare const embeddedAnnotation: AnnotationDefinition<EmbeddedOptions>;
|
|
858
|
+
declare function hasEmbedded(type: Type): boolean;
|
|
859
|
+
/**
|
|
860
|
+
* Assigns one or multiple groups to a type.
|
|
861
|
+
*
|
|
862
|
+
* @example
|
|
863
|
+
* ```typescript
|
|
864
|
+
* interface User {
|
|
865
|
+
* username: string;
|
|
866
|
+
* password: string & Group<'credentials'>;
|
|
867
|
+
* }
|
|
868
|
+
* ```
|
|
869
|
+
*/
|
|
870
|
+
type Group<Name extends string> = TypeAnnotation<"group", Name>;
|
|
871
|
+
/**
|
|
872
|
+
* Excludes the type from serialization of all kind.
|
|
873
|
+
*
|
|
874
|
+
* @example
|
|
875
|
+
* ```typescript
|
|
876
|
+
* interface User {
|
|
877
|
+
* username: string;
|
|
878
|
+
* password: string & Excluded;
|
|
879
|
+
* }
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
882
|
+
type Excluded<Name extends string = "*"> = TypeAnnotation<"excluded", Name>;
|
|
883
|
+
/**
|
|
884
|
+
* Assigns arbitrary data to a type that can be read in runtime.
|
|
885
|
+
*
|
|
886
|
+
* @example
|
|
887
|
+
* ```typescript
|
|
888
|
+
* interface User {
|
|
889
|
+
* username: string;
|
|
890
|
+
* password: string & Data<'role', 'admin'>;
|
|
891
|
+
* }
|
|
892
|
+
* ```
|
|
893
|
+
*/
|
|
894
|
+
type Data<Name extends string, Value> = TypeAnnotation<"data", [Name, Value]>;
|
|
895
|
+
/**
|
|
896
|
+
* Resets an already set decorator to undefined.
|
|
897
|
+
*
|
|
898
|
+
* The required Name is the name of the type decorator (its first tuple entry).
|
|
899
|
+
*
|
|
900
|
+
* ```typescript
|
|
901
|
+
* type Password = string & MinLength<6> & Excluded;
|
|
902
|
+
*
|
|
903
|
+
* interface UserCreationPayload {
|
|
904
|
+
* password: Password & ResetAnnotation<'excluded'>
|
|
905
|
+
* }
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
type ResetAnnotation<Name extends string> = TypeAnnotation<"reset", Name>;
|
|
909
|
+
type IndexOptions = {
|
|
910
|
+
name?: string;
|
|
911
|
+
size?: number;
|
|
912
|
+
unique?: boolean;
|
|
913
|
+
spatial?: boolean;
|
|
914
|
+
sparse?: boolean;
|
|
915
|
+
fulltext?: boolean;
|
|
916
|
+
where?: string;
|
|
917
|
+
expireAfterSeconds?: number;
|
|
918
|
+
};
|
|
919
|
+
type Unique<Options extends IndexOptions = {}> = TypeAnnotation<"index", Options & {
|
|
920
|
+
unique: true;
|
|
921
|
+
}>;
|
|
922
|
+
type Index<Options extends IndexOptions = {}> = TypeAnnotation<"index", Options>;
|
|
923
|
+
interface DatabaseFieldOptions {
|
|
924
|
+
/**
|
|
925
|
+
* The name of the column in the database.
|
|
926
|
+
* e.g. `userName: string & DatabaseField<{name: 'user_name'}>`
|
|
927
|
+
*
|
|
928
|
+
* Can alternatively also be configured by using a different NamingStrategy.
|
|
929
|
+
*/
|
|
930
|
+
name?: string;
|
|
931
|
+
/**
|
|
932
|
+
*
|
|
933
|
+
* e.g. `field: string & MySQL<{type: 'VARCHAR(255)'}>`
|
|
934
|
+
*/
|
|
935
|
+
type?: string;
|
|
936
|
+
/**
|
|
937
|
+
* If the property is on a class, its initializer/default value is per default used.
|
|
938
|
+
* This can be overridden using this option.
|
|
939
|
+
* e.g. `field: string & MySQL<{default: 'abc'}>`
|
|
940
|
+
*/
|
|
941
|
+
default?: any;
|
|
942
|
+
/**
|
|
943
|
+
* e.g. `field: string & MySQL<{defaultExpr: 'NOW()'}>`
|
|
944
|
+
*/
|
|
945
|
+
defaultExpr?: any;
|
|
946
|
+
/**
|
|
947
|
+
* If true no default column value is inferred from the property initializer/default value.
|
|
948
|
+
* e.g. `field: string & MySQL<{noDefault: true}> = ''`
|
|
949
|
+
*/
|
|
950
|
+
noDefault?: true;
|
|
951
|
+
/**
|
|
952
|
+
* Skip this property in all queries and database migration files.
|
|
953
|
+
*/
|
|
954
|
+
skip?: true;
|
|
955
|
+
/**
|
|
956
|
+
* Skip this property in database migration files. This excludes the property from the database, but
|
|
957
|
+
* keeps it in the queries.
|
|
958
|
+
*/
|
|
959
|
+
skipMigration?: true;
|
|
960
|
+
}
|
|
961
|
+
interface MySQLOptions extends DatabaseFieldOptions {}
|
|
962
|
+
interface PostgresOptions extends DatabaseFieldOptions {}
|
|
963
|
+
interface SqliteOptions extends DatabaseFieldOptions {}
|
|
964
|
+
type Database<Name extends string, Options extends {
|
|
965
|
+
[name: string]: any;
|
|
966
|
+
}> = TypeAnnotation<"database", [Name, Options]>;
|
|
967
|
+
type MySQL<Options extends MySQLOptions> = Database<"mysql", Options>;
|
|
968
|
+
type Postgres<Options extends PostgresOptions> = Database<"postgres", Options>;
|
|
969
|
+
type SQLite<Options extends SqliteOptions> = Database<"sqlite", Options>;
|
|
970
|
+
type DatabaseField<Options extends DatabaseFieldOptions, Name extends string = "*"> = Database<Name, Options>;
|
|
971
|
+
declare const enum BinaryBigIntType {
|
|
972
|
+
unsigned = 0,
|
|
973
|
+
signed = 1
|
|
974
|
+
}
|
|
975
|
+
declare const binaryBigIntAnnotation: AnnotationDefinition<BinaryBigIntType>;
|
|
976
|
+
declare const groupAnnotation: AnnotationDefinition<string>;
|
|
977
|
+
declare const excludedAnnotation: {
|
|
978
|
+
isExcluded(type: Type, name: string): boolean;
|
|
979
|
+
symbol: symbol;
|
|
980
|
+
readonly id: string;
|
|
981
|
+
register(annotations: Annotations, data: string): void;
|
|
982
|
+
reset(annotations: Annotations): void;
|
|
983
|
+
registerType<TType extends Type>(type: TType, data: string): TType;
|
|
984
|
+
replace(annotations: Annotations, annotation: string[]): void;
|
|
985
|
+
replaceType(type: Type, annotation: string[]): void;
|
|
986
|
+
getAnnotations(type: Type): string[];
|
|
987
|
+
getFirst(type: Type): string | undefined;
|
|
988
|
+
hasAnnotations(type: Type): boolean;
|
|
989
|
+
};
|
|
990
|
+
declare const dataAnnotation: {
|
|
991
|
+
set<T extends Type>(type: T, key: string, value: any): T;
|
|
992
|
+
get(type: Type, key: string): any;
|
|
993
|
+
symbol: symbol;
|
|
994
|
+
readonly id: string;
|
|
995
|
+
register(annotations: Annotations, data: {
|
|
996
|
+
[name: string]: any;
|
|
997
|
+
}): void;
|
|
998
|
+
reset(annotations: Annotations): void;
|
|
999
|
+
registerType<TType extends Type>(type: TType, data: {
|
|
1000
|
+
[name: string]: any;
|
|
1001
|
+
}): TType;
|
|
1002
|
+
replace(annotations: Annotations, annotation: {
|
|
1003
|
+
[name: string]: any;
|
|
1004
|
+
}[]): void;
|
|
1005
|
+
replaceType(type: Type, annotation: {
|
|
1006
|
+
[name: string]: any;
|
|
1007
|
+
}[]): void;
|
|
1008
|
+
getAnnotations(type: Type): {
|
|
1009
|
+
[name: string]: any;
|
|
1010
|
+
}[];
|
|
1011
|
+
getFirst(type: Type): {
|
|
1012
|
+
[name: string]: any;
|
|
1013
|
+
} | undefined;
|
|
1014
|
+
hasAnnotations(type: Type): boolean;
|
|
1015
|
+
};
|
|
1016
|
+
/**
|
|
1017
|
+
* All raw data from `TypeAnnotation<Name, Options>` types.
|
|
1018
|
+
*/
|
|
1019
|
+
declare const typeAnnotation: {
|
|
1020
|
+
/**
|
|
1021
|
+
* Returns the parsed Type to JS objects, e.g. `{name: string}` => `{name: 'xy'}`
|
|
1022
|
+
*/
|
|
1023
|
+
getOption(type: Type, name: string): any;
|
|
1024
|
+
/**
|
|
1025
|
+
* Returns the Type object of the annotation which can be parsed with `typeToObject`.
|
|
1026
|
+
*/
|
|
1027
|
+
getType(type: Type, name: string): Type | undefined;
|
|
1028
|
+
symbol: symbol;
|
|
1029
|
+
readonly id: string;
|
|
1030
|
+
register(annotations: Annotations, data: {
|
|
1031
|
+
name: string;
|
|
1032
|
+
options: Type;
|
|
1033
|
+
}): void;
|
|
1034
|
+
reset(annotations: Annotations): void;
|
|
1035
|
+
registerType<TType extends Type>(type: TType, data: {
|
|
1036
|
+
name: string;
|
|
1037
|
+
options: Type;
|
|
1038
|
+
}): TType;
|
|
1039
|
+
replace(annotations: Annotations, annotation: {
|
|
1040
|
+
name: string;
|
|
1041
|
+
options: Type;
|
|
1042
|
+
}[]): void;
|
|
1043
|
+
replaceType(type: Type, annotation: {
|
|
1044
|
+
name: string;
|
|
1045
|
+
options: Type;
|
|
1046
|
+
}[]): void;
|
|
1047
|
+
getAnnotations(type: Type): {
|
|
1048
|
+
name: string;
|
|
1049
|
+
options: Type;
|
|
1050
|
+
}[];
|
|
1051
|
+
getFirst(type: Type): {
|
|
1052
|
+
name: string;
|
|
1053
|
+
options: Type;
|
|
1054
|
+
} | undefined;
|
|
1055
|
+
hasAnnotations(type: Type): boolean;
|
|
1056
|
+
};
|
|
1057
|
+
declare const indexAnnotation: AnnotationDefinition<IndexOptions>;
|
|
1058
|
+
declare const databaseAnnotation: {
|
|
1059
|
+
getDatabase<T extends DatabaseFieldOptions>(type: Type, name: string): T | undefined;
|
|
1060
|
+
symbol: symbol;
|
|
1061
|
+
readonly id: string;
|
|
1062
|
+
register(annotations: Annotations, data: {
|
|
1063
|
+
name: string;
|
|
1064
|
+
options: {
|
|
1065
|
+
[name: string]: any;
|
|
1066
|
+
};
|
|
1067
|
+
}): void;
|
|
1068
|
+
reset(annotations: Annotations): void;
|
|
1069
|
+
registerType<TType extends Type>(type: TType, data: {
|
|
1070
|
+
name: string;
|
|
1071
|
+
options: {
|
|
1072
|
+
[name: string]: any;
|
|
1073
|
+
};
|
|
1074
|
+
}): TType;
|
|
1075
|
+
replace(annotations: Annotations, annotation: {
|
|
1076
|
+
name: string;
|
|
1077
|
+
options: {
|
|
1078
|
+
[name: string]: any;
|
|
1079
|
+
};
|
|
1080
|
+
}[]): void;
|
|
1081
|
+
replaceType(type: Type, annotation: {
|
|
1082
|
+
name: string;
|
|
1083
|
+
options: {
|
|
1084
|
+
[name: string]: any;
|
|
1085
|
+
};
|
|
1086
|
+
}[]): void;
|
|
1087
|
+
getAnnotations(type: Type): {
|
|
1088
|
+
name: string;
|
|
1089
|
+
options: {
|
|
1090
|
+
[name: string]: any;
|
|
1091
|
+
};
|
|
1092
|
+
}[];
|
|
1093
|
+
getFirst(type: Type): {
|
|
1094
|
+
name: string;
|
|
1095
|
+
options: {
|
|
1096
|
+
[name: string]: any;
|
|
1097
|
+
};
|
|
1098
|
+
} | undefined;
|
|
1099
|
+
hasAnnotations(type: Type): boolean;
|
|
1100
|
+
};
|
|
1101
|
+
declare function registerTypeDecorator(decorator: TypeDecorator): void;
|
|
1102
|
+
/**
|
|
1103
|
+
* Type annotations are object literals with a single optional __meta in it
|
|
1104
|
+
* that has as type a tuple with the name of the annotation as first entry.
|
|
1105
|
+
* The tuple is intersected with the `never` type to make sure it does not
|
|
1106
|
+
* interfere with type checking.
|
|
1107
|
+
*
|
|
1108
|
+
* The processor has currently implemented to not resolve `never & x` to `never`,
|
|
1109
|
+
* so we still have the intersection type in runtime to resolve __meta correctly.
|
|
1110
|
+
*
|
|
1111
|
+
* ```typescript
|
|
1112
|
+
* type MyAnnotation1 = TypeAnnotation<'myAnnotation'>
|
|
1113
|
+
* type MyAnnotation1<T> = TypeAnnotation<'myAnnotation', T>
|
|
1114
|
+
*
|
|
1115
|
+
* //under the hood it is:
|
|
1116
|
+
* type lowLevel1 = { __meta?: never & ['myAnnotation'] }
|
|
1117
|
+
* type lowLevel2<T> = { __meta?: never & ['myAnnotation', T] }
|
|
1118
|
+
* ```
|
|
1119
|
+
*/
|
|
1120
|
+
declare function getAnnotationMeta(type: TypeObjectLiteral): {
|
|
1121
|
+
id: string;
|
|
1122
|
+
options: Type;
|
|
1123
|
+
} | undefined;
|
|
1124
|
+
declare const typeDecorators: TypeDecorator[];
|
|
1125
|
+
declare function typeToObject(type?: Type, state?: {
|
|
1126
|
+
stack: Type[];
|
|
1127
|
+
}): any;
|
|
1128
|
+
declare function memberNameToString(name: number | string | symbol): string;
|
|
1129
|
+
declare const binaryTypes: ClassType[];
|
|
1130
|
+
/**
|
|
1131
|
+
* Returns true if the given type is Date, ArrayBuffer, Uint8Array, etc.
|
|
1132
|
+
*/
|
|
1133
|
+
declare function isGlobalTypeClass(type: Type): type is TypeClass;
|
|
1134
|
+
/**
|
|
1135
|
+
* Returns true if the given type is TypeClass and references a custom (non-global) class.
|
|
1136
|
+
*/
|
|
1137
|
+
declare function isCustomTypeClass(type: Type): type is TypeClass;
|
|
1138
|
+
/**
|
|
1139
|
+
* Returns a type predicate that checks if the given type is a class and is of the given classType.
|
|
1140
|
+
* If withInheritance is true, it also checks if the type is a subclass of the given classType.
|
|
1141
|
+
*/
|
|
1142
|
+
declare function isTypeClassOf(classType: ClassType, withInheritance?: boolean): (type: Type) => boolean;
|
|
1143
|
+
/**
|
|
1144
|
+
* Returns the members of a class or object literal.
|
|
1145
|
+
*/
|
|
1146
|
+
declare function resolveTypeMembers(type: TypeClass | TypeObjectLiteral): (TypeProperty | TypePropertySignature | TypeMethodSignature | TypeMethod | TypeIndexSignature | TypeCallSignature)[];
|
|
1147
|
+
declare function stringifyResolvedType(type: Type): string;
|
|
1148
|
+
declare function stringifyShortResolvedType(type: Type, stateIn?: Partial<StringifyTypeOptions>): string;
|
|
1149
|
+
/**
|
|
1150
|
+
* Returns all (including inherited) constructor properties of a class.
|
|
1151
|
+
*/
|
|
1152
|
+
declare function getDeepConstructorProperties(type: TypeClass): TypeParameter[];
|
|
1153
|
+
/**
|
|
1154
|
+
* Returns the index to `type.values` if the given value is part of the enum, exactly or case-insensitive.
|
|
1155
|
+
* Returns -1 if not found.
|
|
1156
|
+
*/
|
|
1157
|
+
declare function getEnumValueIndexMatcher(type: TypeEnum): (value: string | number | undefined | null) => number;
|
|
1158
|
+
interface StringifyTypeOptions {
|
|
1159
|
+
showNames: boolean;
|
|
1160
|
+
showFullDefinition: boolean;
|
|
1161
|
+
showDescription: boolean;
|
|
1162
|
+
defaultIsOptional: boolean;
|
|
1163
|
+
showHeritage: boolean;
|
|
1164
|
+
showDefaults: boolean;
|
|
1165
|
+
showTags: boolean;
|
|
1166
|
+
defaultValues: any;
|
|
1167
|
+
stringify?: (type: Type) => string | undefined;
|
|
1168
|
+
}
|
|
1169
|
+
declare function stringifyType(type: Type, stateIn?: Partial<StringifyTypeOptions>): string;
|
|
1170
|
+
declare function annotateClass<T>(clazz: ClassType | AbstractClassType, type?: ReceiveType<T>): void;
|
|
1171
|
+
//#endregion
|
|
1172
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/type-serialization.d.ts
|
|
1173
|
+
interface SerializedTypeAnnotations {
|
|
1174
|
+
entityOptions?: EntityOptions;
|
|
1175
|
+
typeName?: string;
|
|
1176
|
+
typeArguments?: SerializedTypeReference[];
|
|
1177
|
+
indexAccessOrigin?: {
|
|
1178
|
+
container: SerializedTypeReference;
|
|
1179
|
+
index: SerializedTypeReference;
|
|
1180
|
+
};
|
|
1181
|
+
decorators?: SerializedTypeReference[];
|
|
1182
|
+
}
|
|
1183
|
+
interface SerializedTypeObjectLiteral extends SerializedTypeAnnotations {
|
|
1184
|
+
kind: ReflectionKind.objectLiteral;
|
|
1185
|
+
types: SerializedTypeReference[];
|
|
1186
|
+
tags?: TagsReflection;
|
|
1187
|
+
}
|
|
1188
|
+
interface SerializedTypeClassType extends SerializedTypeAnnotations {
|
|
1189
|
+
kind: ReflectionKind.class;
|
|
1190
|
+
name?: string;
|
|
1191
|
+
globalObject?: true;
|
|
1192
|
+
classType: string;
|
|
1193
|
+
extendsArguments?: SerializedTypeReference[];
|
|
1194
|
+
arguments?: SerializedTypeReference[];
|
|
1195
|
+
superClass?: SerializedTypeReference;
|
|
1196
|
+
types: SerializedTypeReference[];
|
|
1197
|
+
tags?: TagsReflection;
|
|
1198
|
+
}
|
|
1199
|
+
interface SerializedTypeFunction extends SerializedTypeAnnotations {
|
|
1200
|
+
kind: ReflectionKind.function;
|
|
1201
|
+
name?: number | string | symbol;
|
|
1202
|
+
parameters: SerializedTypeParameter[];
|
|
1203
|
+
return: SerializedTypeReference;
|
|
1204
|
+
tags?: TagsReflection;
|
|
1205
|
+
}
|
|
1206
|
+
type SerializedTypeReference = number;
|
|
1207
|
+
interface SimpleSerializedType extends SerializedTypeAnnotations {
|
|
1208
|
+
kind: ReflectionKind.never | ReflectionKind.any | ReflectionKind.unknown | ReflectionKind.void | ReflectionKind.object | ReflectionKind.string | ReflectionKind.number | ReflectionKind.boolean | ReflectionKind.symbol | ReflectionKind.bigint | ReflectionKind.null | ReflectionKind.undefined | ReflectionKind.regexp;
|
|
1209
|
+
origin?: SerializedTypeReference;
|
|
1210
|
+
}
|
|
1211
|
+
interface SerializedTypeLiteral extends SerializedTypeAnnotations {
|
|
1212
|
+
kind: ReflectionKind.literal;
|
|
1213
|
+
literal: {
|
|
1214
|
+
type: "symbol";
|
|
1215
|
+
name: string;
|
|
1216
|
+
} | string | number | boolean | {
|
|
1217
|
+
type: "bigint";
|
|
1218
|
+
value: string;
|
|
1219
|
+
} | {
|
|
1220
|
+
type: "regex";
|
|
1221
|
+
regex: string;
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
interface SerializedTypeTemplateLiteral extends SerializedTypeAnnotations {
|
|
1225
|
+
kind: ReflectionKind.templateLiteral;
|
|
1226
|
+
types: SerializedTypeReference[];
|
|
1227
|
+
}
|
|
1228
|
+
interface SerializedTypeParameter extends SerializedTypeAnnotations {
|
|
1229
|
+
kind: ReflectionKind.parameter;
|
|
1230
|
+
name: string;
|
|
1231
|
+
type: SerializedTypeReference;
|
|
1232
|
+
visibility?: ReflectionVisibility;
|
|
1233
|
+
readonly?: true;
|
|
1234
|
+
optional?: true;
|
|
1235
|
+
/**
|
|
1236
|
+
* Set when the parameter has a default value aka initializer.
|
|
1237
|
+
*/
|
|
1238
|
+
default?: any;
|
|
1239
|
+
tags?: TagsReflection;
|
|
1240
|
+
}
|
|
1241
|
+
interface SerializedTypeBaseMember extends SerializedTypeAnnotations {
|
|
1242
|
+
visibility: ReflectionVisibility;
|
|
1243
|
+
abstract?: true;
|
|
1244
|
+
optional?: true;
|
|
1245
|
+
readonly?: true;
|
|
1246
|
+
tags?: TagsReflection;
|
|
1247
|
+
}
|
|
1248
|
+
interface SerializedTypeMethod extends SerializedTypeBaseMember {
|
|
1249
|
+
kind: ReflectionKind.method;
|
|
1250
|
+
visibility: ReflectionVisibility;
|
|
1251
|
+
name: number | string | symbol;
|
|
1252
|
+
parameters: SerializedTypeParameter[];
|
|
1253
|
+
optional?: true;
|
|
1254
|
+
abstract?: true;
|
|
1255
|
+
return: SerializedTypeReference;
|
|
1256
|
+
}
|
|
1257
|
+
interface SerializedTypeProperty extends SerializedTypeBaseMember {
|
|
1258
|
+
kind: ReflectionKind.property;
|
|
1259
|
+
visibility: ReflectionVisibility;
|
|
1260
|
+
name: number | string | symbol;
|
|
1261
|
+
optional?: true;
|
|
1262
|
+
readonly?: true;
|
|
1263
|
+
abstract?: true;
|
|
1264
|
+
description?: string;
|
|
1265
|
+
type: SerializedTypeReference;
|
|
1266
|
+
/**
|
|
1267
|
+
* Set when the property has a default value aka initializer.
|
|
1268
|
+
*/
|
|
1269
|
+
default?: any;
|
|
1270
|
+
}
|
|
1271
|
+
interface SerializedTypePromise extends SerializedTypeAnnotations {
|
|
1272
|
+
kind: ReflectionKind.promise;
|
|
1273
|
+
type: SerializedTypeReference;
|
|
1274
|
+
}
|
|
1275
|
+
interface SerializedTypeEnum extends SerializedTypeAnnotations {
|
|
1276
|
+
kind: ReflectionKind.enum;
|
|
1277
|
+
enum: {
|
|
1278
|
+
[name: string]: string | number | undefined | null;
|
|
1279
|
+
};
|
|
1280
|
+
values: (string | number | undefined | null)[];
|
|
1281
|
+
indexType: SerializedTypeReference;
|
|
1282
|
+
tags?: TagsReflection;
|
|
1283
|
+
}
|
|
1284
|
+
interface SerializedTypeUnion extends SerializedTypeAnnotations {
|
|
1285
|
+
kind: ReflectionKind.union;
|
|
1286
|
+
types: SerializedTypeReference[];
|
|
1287
|
+
}
|
|
1288
|
+
interface SerializedTypeIntersection extends SerializedTypeAnnotations {
|
|
1289
|
+
kind: ReflectionKind.intersection;
|
|
1290
|
+
types: SerializedTypeReference[];
|
|
1291
|
+
}
|
|
1292
|
+
interface SerializedTypeArray extends SerializedTypeAnnotations {
|
|
1293
|
+
kind: ReflectionKind.array;
|
|
1294
|
+
type: SerializedTypeReference;
|
|
1295
|
+
tags?: TagsReflection;
|
|
1296
|
+
}
|
|
1297
|
+
interface SerializedTypeIndexSignature extends SerializedTypeAnnotations {
|
|
1298
|
+
kind: ReflectionKind.indexSignature;
|
|
1299
|
+
index: SerializedTypeReference;
|
|
1300
|
+
type: SerializedTypeReference;
|
|
1301
|
+
/**
|
|
1302
|
+
* Set when the parameter has a default value aka initializer.
|
|
1303
|
+
*/
|
|
1304
|
+
default?: any;
|
|
1305
|
+
}
|
|
1306
|
+
interface SerializedTypePropertySignature extends SerializedTypeAnnotations {
|
|
1307
|
+
kind: ReflectionKind.propertySignature;
|
|
1308
|
+
name: number | string | symbol;
|
|
1309
|
+
optional?: true;
|
|
1310
|
+
readonly?: true;
|
|
1311
|
+
description?: string;
|
|
1312
|
+
type: SerializedTypeReference;
|
|
1313
|
+
/**
|
|
1314
|
+
* Set when the parameter has a default value aka initializer.
|
|
1315
|
+
*/
|
|
1316
|
+
default?: any;
|
|
1317
|
+
tags?: TagsReflection;
|
|
1318
|
+
}
|
|
1319
|
+
interface SerializedTypeMethodSignature extends SerializedTypeAnnotations {
|
|
1320
|
+
kind: ReflectionKind.methodSignature;
|
|
1321
|
+
name: number | string | symbol;
|
|
1322
|
+
optional?: true;
|
|
1323
|
+
parameters: SerializedTypeParameter[];
|
|
1324
|
+
return: SerializedTypeReference;
|
|
1325
|
+
tags?: TagsReflection;
|
|
1326
|
+
}
|
|
1327
|
+
interface SerializedTypeTypeParameter extends SerializedTypeAnnotations {
|
|
1328
|
+
kind: ReflectionKind.typeParameter;
|
|
1329
|
+
name: string;
|
|
1330
|
+
}
|
|
1331
|
+
interface SerializedTypeInfer extends SerializedTypeAnnotations {
|
|
1332
|
+
kind: ReflectionKind.infer;
|
|
1333
|
+
}
|
|
1334
|
+
interface SerializedTypeTupleMember extends SerializedTypeAnnotations {
|
|
1335
|
+
kind: ReflectionKind.tupleMember;
|
|
1336
|
+
type: SerializedTypeReference;
|
|
1337
|
+
optional?: true;
|
|
1338
|
+
name?: string;
|
|
1339
|
+
}
|
|
1340
|
+
interface SerializedTypeTuple extends SerializedTypeAnnotations {
|
|
1341
|
+
kind: ReflectionKind.tuple;
|
|
1342
|
+
types: SerializedTypeTupleMember[];
|
|
1343
|
+
}
|
|
1344
|
+
interface SerializedTypeRest extends SerializedTypeAnnotations {
|
|
1345
|
+
kind: ReflectionKind.rest;
|
|
1346
|
+
type: SerializedTypeReference;
|
|
1347
|
+
}
|
|
1348
|
+
type SerializedType = SimpleSerializedType | SerializedTypeLiteral | SerializedTypeTemplateLiteral | SerializedTypeParameter | SerializedTypeFunction | SerializedTypeMethod | SerializedTypeProperty | SerializedTypePromise | SerializedTypeClassType | SerializedTypeEnum | SerializedTypeUnion | SerializedTypeIntersection | SerializedTypeArray | SerializedTypeObjectLiteral | SerializedTypeIndexSignature | SerializedTypePropertySignature | SerializedTypeMethodSignature | SerializedTypeTypeParameter | SerializedTypeInfer | SerializedTypeTuple | SerializedTypeTupleMember | SerializedTypeRest;
|
|
1349
|
+
type SerializedTypes = SerializedType[];
|
|
1350
|
+
interface SerializerState {
|
|
1351
|
+
types: SerializedTypes;
|
|
1352
|
+
disableMethods?: true;
|
|
1353
|
+
refs: Map<Type, number>;
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Converts a (possibly circular/nested) type into a JSON.stringify'able structure suited to be transmitted over the wire and deserialized back to the correct Type object.
|
|
1357
|
+
*/
|
|
1358
|
+
declare function serializeType(type: Type, state?: Partial<SerializerState>): SerializedTypes;
|
|
1359
|
+
interface DeserializeState {
|
|
1360
|
+
types: SerializedTypes;
|
|
1361
|
+
disableReuse?: boolean;
|
|
1362
|
+
deserialized: {
|
|
1363
|
+
[index: number]: {
|
|
1364
|
+
type: Type;
|
|
1365
|
+
refs: Type[];
|
|
1366
|
+
active: boolean;
|
|
1367
|
+
};
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
declare function deserializeType(types?: SerializedTypes, state?: Partial<DeserializeState>): Type;
|
|
1371
|
+
//#endregion
|
|
1372
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/serializer.d.ts
|
|
1373
|
+
/**
|
|
1374
|
+
* Make sure to change the id when a custom naming strategy is implemented, since caches are based on it.
|
|
1375
|
+
*/
|
|
1376
|
+
declare class NamingStrategy {
|
|
1377
|
+
id: string;
|
|
1378
|
+
constructor(id?: string);
|
|
1379
|
+
getPropertyName(type: TypeProperty | TypePropertySignature, forSerializer: string): string | undefined;
|
|
1380
|
+
}
|
|
1381
|
+
declare const underscoreNamingStrategy: {
|
|
1382
|
+
getPropertyName(type: TypeProperty | TypePropertySignature, forSerializer: string): string | undefined;
|
|
1383
|
+
id: string;
|
|
1384
|
+
};
|
|
1385
|
+
/**
|
|
1386
|
+
* Options that can be passed to the serialization/deserialization functions
|
|
1387
|
+
* and change the behavior in runtime (not embedded in JIT).
|
|
1388
|
+
*/
|
|
1389
|
+
interface SerializationOptions {
|
|
1390
|
+
/**
|
|
1391
|
+
* Which groups to include. If a property is not assigned to
|
|
1392
|
+
* a given group, it will be excluded.
|
|
1393
|
+
* Use an empty array to include only non-grouped properties.
|
|
1394
|
+
*/
|
|
1395
|
+
groups?: string[];
|
|
1396
|
+
/**
|
|
1397
|
+
* Which groups to exclude. If a property is assigned to at least
|
|
1398
|
+
* one given group, it will be excluded. Basically the opposite of
|
|
1399
|
+
* `groups`, but you can combine both.
|
|
1400
|
+
* Use an empty array to exclude only non-grouped properties.
|
|
1401
|
+
*/
|
|
1402
|
+
groupsExclude?: string[];
|
|
1403
|
+
/**
|
|
1404
|
+
* Allows more loosely data for certain types. e.g.
|
|
1405
|
+
*
|
|
1406
|
+
* - '1', '0', 'true', 'false' will be converted to true|false for boolean type.
|
|
1407
|
+
* - '1' will be converted to number for number type.
|
|
1408
|
+
* - 1 will be converted to string for string type.
|
|
1409
|
+
*
|
|
1410
|
+
* This will activate all registered type guards with negative specifically.
|
|
1411
|
+
*
|
|
1412
|
+
* This is enabled by default.
|
|
1413
|
+
*/
|
|
1414
|
+
loosely?: boolean;
|
|
1415
|
+
}
|
|
1416
|
+
type SerializeFunction<T = any, R = any> = (data: T, state?: SerializationOptions) => R;
|
|
1417
|
+
declare function getPartialType(type: TypeClass | TypeObjectLiteral): any;
|
|
1418
|
+
/**
|
|
1419
|
+
* Creates a (cached) Partial<T> of the given type and returns a (cached) serializer function for the given registry (serialize or deserialize).
|
|
1420
|
+
*/
|
|
1421
|
+
declare function getPartialSerializeFunction(type: TypeClass | TypeObjectLiteral, registry: TemplateRegistry, namingStrategy?: NamingStrategy): SerializeFunction<any, any>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Returns a (cached) serializer function for the given registry (serialize or deserialize).
|
|
1424
|
+
*/
|
|
1425
|
+
declare function getSerializeFunction(type: Type, registry: TemplateRegistry, namingStrategy?: NamingStrategy, path?: string, jitStack?: JitStack): SerializeFunction;
|
|
1426
|
+
declare function createSerializeFunction(type: Type, registry: TemplateRegistry, namingStrategy?: NamingStrategy, path?: string | RuntimeCode | (string | RuntimeCode)[], jitStack?: JitStack): SerializeFunction;
|
|
1427
|
+
type Guard<T> = (data: any, state?: {
|
|
1428
|
+
errors?: ValidationErrorItem[];
|
|
1429
|
+
}) => data is T;
|
|
1430
|
+
declare function createTypeGuardFunction(type: Type, stateIn?: Partial<TemplateState>, serializerToUse?: Serializer, withLoose?: boolean): undefined | Guard<any>;
|
|
1431
|
+
declare class SerializationError extends CustomError {
|
|
1432
|
+
originalMessage: string;
|
|
1433
|
+
code: string;
|
|
1434
|
+
path: string;
|
|
1435
|
+
constructor(originalMessage: string, code?: string, path?: string);
|
|
1436
|
+
}
|
|
1437
|
+
declare class RuntimeCode {
|
|
1438
|
+
code: string;
|
|
1439
|
+
constructor(code: string);
|
|
1440
|
+
}
|
|
1441
|
+
declare function collapsePath(path: (string | RuntimeCode)[], prefix?: string): string;
|
|
1442
|
+
declare function getPropertyNameString(propertyName?: string | RuntimeCode): string;
|
|
1443
|
+
/**
|
|
1444
|
+
* internal: The jit stack cache is used in both serializer and guards, so its cache key needs to be aware of it
|
|
1445
|
+
*/
|
|
1446
|
+
declare class JitStack {
|
|
1447
|
+
protected stacks: {
|
|
1448
|
+
registry?: TemplateRegistry;
|
|
1449
|
+
map: Map<Type, {
|
|
1450
|
+
fn: Function | undefined;
|
|
1451
|
+
id: number;
|
|
1452
|
+
}>;
|
|
1453
|
+
}[];
|
|
1454
|
+
protected id: number;
|
|
1455
|
+
getStack(registry?: TemplateRegistry): Map<Type, {
|
|
1456
|
+
fn: Function | undefined;
|
|
1457
|
+
id: number;
|
|
1458
|
+
}>;
|
|
1459
|
+
has(registry: TemplateRegistry, type: Type): boolean;
|
|
1460
|
+
get(registry: TemplateRegistry, type: Type): {
|
|
1461
|
+
fn: Function | undefined;
|
|
1462
|
+
id: number;
|
|
1463
|
+
} | undefined;
|
|
1464
|
+
prepare(registry: TemplateRegistry, type: Type): {
|
|
1465
|
+
id: number;
|
|
1466
|
+
prepare: (fn: Function) => {
|
|
1467
|
+
fn: Function | undefined;
|
|
1468
|
+
};
|
|
1469
|
+
};
|
|
1470
|
+
getOrCreate(registry: TemplateRegistry | undefined, type: Type, create: () => Function): {
|
|
1471
|
+
fn: Function | undefined;
|
|
1472
|
+
id: number;
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
declare class ContainerAccessor {
|
|
1476
|
+
container: string | ContainerAccessor;
|
|
1477
|
+
property: string;
|
|
1478
|
+
constructor(container: string | ContainerAccessor, property: string);
|
|
1479
|
+
toString(): string;
|
|
1480
|
+
}
|
|
1481
|
+
declare class TemplateState {
|
|
1482
|
+
originalSetter: string | ContainerAccessor;
|
|
1483
|
+
originalAccessor: string | ContainerAccessor;
|
|
1484
|
+
compilerContext: CompilerContext;
|
|
1485
|
+
registry: TemplateRegistry;
|
|
1486
|
+
namingStrategy: NamingStrategy;
|
|
1487
|
+
jitStack: JitStack;
|
|
1488
|
+
path: (string | RuntimeCode)[];
|
|
1489
|
+
/**
|
|
1490
|
+
* Before and after template content is rendered before/after all other templates.
|
|
1491
|
+
* When a template is put into its own function, before/after templates are run outside of this function.
|
|
1492
|
+
*/
|
|
1493
|
+
template: string;
|
|
1494
|
+
ended: boolean;
|
|
1495
|
+
setter: string | ContainerAccessor;
|
|
1496
|
+
accessor: string | ContainerAccessor;
|
|
1497
|
+
/**
|
|
1498
|
+
* Strict means only use type guards of specificality of 1 (used for is()/validation()).
|
|
1499
|
+
* For deserialization loose is used.
|
|
1500
|
+
*/
|
|
1501
|
+
validation?: "strict" | "loose";
|
|
1502
|
+
/**
|
|
1503
|
+
* When this is set all specificalities are used (used in union type guards to detect which member to pick).
|
|
1504
|
+
*/
|
|
1505
|
+
allSpecificalities?: TypeGuardRegistry;
|
|
1506
|
+
propertyName?: string | RuntimeCode;
|
|
1507
|
+
setterDisabled: boolean;
|
|
1508
|
+
parentTypes: Type[];
|
|
1509
|
+
target: "serialize" | "deserialize";
|
|
1510
|
+
protected handledAnnotations: AnnotationDefinition[];
|
|
1511
|
+
constructor(originalSetter: string | ContainerAccessor, originalAccessor: string | ContainerAccessor, compilerContext: CompilerContext, registry: TemplateRegistry, namingStrategy?: NamingStrategy, jitStack?: JitStack, path?: (string | RuntimeCode)[]);
|
|
1512
|
+
isValidation(): boolean;
|
|
1513
|
+
withValidation(validation: this["validation"]): this;
|
|
1514
|
+
includeAllSpecificalities(guardRegistry: TypeGuardRegistry): this;
|
|
1515
|
+
replaceTemplate(template: string): void;
|
|
1516
|
+
/**
|
|
1517
|
+
* Forks as state, with an empty propertyName.
|
|
1518
|
+
*/
|
|
1519
|
+
fork(setter?: string | ContainerAccessor, accessor?: string | ContainerAccessor, path?: (string | RuntimeCode)[]): TemplateState;
|
|
1520
|
+
fullFork(): TemplateState;
|
|
1521
|
+
forRegistry(registry: TemplateRegistry): this;
|
|
1522
|
+
forPropertyName(name?: string | number | symbol | RuntimeCode): this;
|
|
1523
|
+
disableSetter(): this;
|
|
1524
|
+
enableSetter(): this;
|
|
1525
|
+
/**
|
|
1526
|
+
* Can be used to track which annotation was already handled. Necessary to use with `isAnnotationHandled` to avoid infinite recursive loops
|
|
1527
|
+
* when a serializer template issues sub calls depending on annotation data.
|
|
1528
|
+
*/
|
|
1529
|
+
annotationHandled(annotation: AnnotationDefinition<any>): void;
|
|
1530
|
+
isAnnotationHandled(annotation: AnnotationDefinition<any>): boolean;
|
|
1531
|
+
get isSerialization(): boolean;
|
|
1532
|
+
get isDeserialization(): boolean;
|
|
1533
|
+
extendPath(path: string | RuntimeCode | number | symbol): this;
|
|
1534
|
+
assignValidationError(code: string, message: string): string;
|
|
1535
|
+
throwCode(type: Type | string, error?: string, accessor?: string | ContainerAccessor): string;
|
|
1536
|
+
/**
|
|
1537
|
+
* Adds template code for setting the `this.setter` variable. The expression evaluated in `code` is assigned to `this.setter`.
|
|
1538
|
+
* `this.accessor` will point now to `this.setter`.
|
|
1539
|
+
*/
|
|
1540
|
+
addSetter(code: string | {
|
|
1541
|
+
toString(): string;
|
|
1542
|
+
}): void;
|
|
1543
|
+
addSetterAndReportErrorIfInvalid(errorCode: string, message: string, code: string): void;
|
|
1544
|
+
/**
|
|
1545
|
+
* Adds a converter function that is executed on the current `this.accessor` value.
|
|
1546
|
+
*
|
|
1547
|
+
* @example
|
|
1548
|
+
* ```typescript
|
|
1549
|
+
* serializer.deserializeRegistry.registerClass(Date, (type, state) => {
|
|
1550
|
+
* // make sure to check `v` as it is any!
|
|
1551
|
+
* state.convert((v: any) => {
|
|
1552
|
+
* if ('number' !== typeof v) throw new SerializationError('Expected number');
|
|
1553
|
+
* return new Date(v);
|
|
1554
|
+
* });
|
|
1555
|
+
* });
|
|
1556
|
+
*
|
|
1557
|
+
* serializer.serializeRegistry.registerClass(Date, (type, state) => {
|
|
1558
|
+
* // in serialization `v` is always the specific type
|
|
1559
|
+
* state.convert((v: Date) => v.getTime());
|
|
1560
|
+
* });
|
|
1561
|
+
* ```
|
|
1562
|
+
*/
|
|
1563
|
+
convert(callback: (value: any) => any): void;
|
|
1564
|
+
/**
|
|
1565
|
+
* Allows to add a custom code that is executed on the current `this.accessor` value.
|
|
1566
|
+
*
|
|
1567
|
+
* @example
|
|
1568
|
+
* ```typescript
|
|
1569
|
+
* serializer.deserializeRegistry.addDecorator(
|
|
1570
|
+
* isCustomTypeClass,
|
|
1571
|
+
* (type, state) => {
|
|
1572
|
+
* state.touch((value) => {
|
|
1573
|
+
* if ('onLoad' in value) value.onLoad();
|
|
1574
|
+
* });
|
|
1575
|
+
* }
|
|
1576
|
+
* );
|
|
1577
|
+
* ```
|
|
1578
|
+
*/
|
|
1579
|
+
touch(callback: (value: any) => void): void;
|
|
1580
|
+
/**
|
|
1581
|
+
* Stop executing next templates.
|
|
1582
|
+
*/
|
|
1583
|
+
stop(): void;
|
|
1584
|
+
setVariable(name: string, value?: any): string;
|
|
1585
|
+
setContext(values: {
|
|
1586
|
+
[name: string]: any;
|
|
1587
|
+
}): void;
|
|
1588
|
+
addCode(code: string): void;
|
|
1589
|
+
/**
|
|
1590
|
+
* Adds template code for setting the `this.setter` variable manually, so use `${state.setter} = value`.
|
|
1591
|
+
* `this.accessor` will point now to `this.setter`.
|
|
1592
|
+
*/
|
|
1593
|
+
addCodeForSetter(code: string): void;
|
|
1594
|
+
hasSetterCode(): boolean;
|
|
1595
|
+
}
|
|
1596
|
+
type Template<T extends Type> = (type: T, state: TemplateState) => void;
|
|
1597
|
+
type TemplateHook = (type: Type, state: TemplateState) => void;
|
|
1598
|
+
/**
|
|
1599
|
+
* Just sets the state.setter to state.accessor without any modification.
|
|
1600
|
+
*/
|
|
1601
|
+
declare function noopTemplate(type: Type, state: TemplateState): void;
|
|
1602
|
+
interface TemplateDecorator {
|
|
1603
|
+
predicate: (type: Type) => boolean;
|
|
1604
|
+
template: Template<any>;
|
|
1605
|
+
}
|
|
1606
|
+
declare class TemplateRegistry {
|
|
1607
|
+
serializer: Serializer;
|
|
1608
|
+
protected static ids: number;
|
|
1609
|
+
id: number;
|
|
1610
|
+
protected templates: { [kind in ReflectionKind]?: Template<any>[] };
|
|
1611
|
+
protected decorator: TemplateDecorator[];
|
|
1612
|
+
preHooks: TemplateHook[];
|
|
1613
|
+
postHooks: TemplateHook[];
|
|
1614
|
+
classTemplates: Map<ClassType<any>, Template<any>[]>;
|
|
1615
|
+
constructor(serializer?: Serializer);
|
|
1616
|
+
clear(): void;
|
|
1617
|
+
get(type: Type): Template<Type>[];
|
|
1618
|
+
getDecorator(type: Type): Template<Type>[];
|
|
1619
|
+
/**
|
|
1620
|
+
* Registers a template for all binary classes: ArrayBuffer, Uint8Array, Int8Array, etc.
|
|
1621
|
+
*/
|
|
1622
|
+
registerBinary(template: Template<TypeClass>): void;
|
|
1623
|
+
/**
|
|
1624
|
+
* Registers a template for a given class type.
|
|
1625
|
+
*
|
|
1626
|
+
* As soon as a single template has registered for the given classType the template registry
|
|
1627
|
+
* only returns templates for this particular classType and omits all general purpose ReflectionKind.class templates for this particular classType.
|
|
1628
|
+
*/
|
|
1629
|
+
registerClass(classType: ClassType, template: Template<TypeClass>): void;
|
|
1630
|
+
prependClass(classType: ClassType, template: Template<TypeClass>): void;
|
|
1631
|
+
appendClass(classType: ClassType, template: Template<TypeClass>): void;
|
|
1632
|
+
protected getClassTemplates(classType: ClassType): Template<TypeClass>[];
|
|
1633
|
+
addPreHook(callback: TemplateHook): void;
|
|
1634
|
+
addPostHook(callback: TemplateHook): void;
|
|
1635
|
+
/**
|
|
1636
|
+
* Removes all registered templates.
|
|
1637
|
+
*/
|
|
1638
|
+
unregister(kind: ReflectionKind): void;
|
|
1639
|
+
/**
|
|
1640
|
+
* Registers a new template and replaces all existing (added via register,prepend,append).
|
|
1641
|
+
*/
|
|
1642
|
+
register<T extends ReflectionKind>(kind: T, template: Template<FindType<Type, T>>): void;
|
|
1643
|
+
/**
|
|
1644
|
+
* Registers additional templates that handle type decorators/annotations. The templates can safely assume that the given type in `state.accessor`
|
|
1645
|
+
* is already type-checked to be `T`.
|
|
1646
|
+
*
|
|
1647
|
+
* Decorator templates run last (after normal templates and postHook).
|
|
1648
|
+
*
|
|
1649
|
+
* This split between register and registerForDecorator is made to have a distinction between native type templates and additional user-made templates.
|
|
1650
|
+
* This allows to fetch only decorator templates and decide upon the result whether additional code is necessary or not. (this would not be possible
|
|
1651
|
+
* if everything is added to the `register` call that does always the basic checks).
|
|
1652
|
+
*/
|
|
1653
|
+
addDecorator(predicate: (type: Type) => boolean, template: Template<Type>): void;
|
|
1654
|
+
/**
|
|
1655
|
+
* Removes all registered decorators for a certain type.
|
|
1656
|
+
*/
|
|
1657
|
+
removeDecorator(type: Type): void;
|
|
1658
|
+
prepend<T extends ReflectionKind>(kind: T, template: Template<FindType<Type, T>>): void;
|
|
1659
|
+
append<T extends ReflectionKind>(kind: T, template: Template<FindType<Type, T>>): void;
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1662
|
+
* To avoid circular builds, class/object literal code is extract to its own function.
|
|
1663
|
+
* if this returns true, code is put into state to call an already existing function.
|
|
1664
|
+
*/
|
|
1665
|
+
declare function callExtractedFunctionIfAvailable(state: TemplateState, type: Type): boolean;
|
|
1666
|
+
declare function extractStateToFunctionAndCallIt(state: TemplateState, type: Type): {
|
|
1667
|
+
setFunction: (fn: Function) => {
|
|
1668
|
+
fn: Function | undefined;
|
|
1669
|
+
};
|
|
1670
|
+
id: number;
|
|
1671
|
+
state: TemplateState;
|
|
1672
|
+
};
|
|
1673
|
+
declare function buildFunction(state: TemplateState, type: Type): Function;
|
|
1674
|
+
declare function executeTemplates(state: TemplateState, type: Type, withLoose?: boolean, withCache?: boolean): string;
|
|
1675
|
+
declare function createConverterJSForMember(property: ReflectionProperty | TypeProperty | TypePropertySignature | TypeIndexSignature, state: TemplateState, undefinedSetterCode?: string, nullSetterCode?: string): string;
|
|
1676
|
+
declare function inAccessor(accessor: ContainerAccessor | string): string;
|
|
1677
|
+
declare function deserializeEmbedded(type: TypeClass | TypeObjectLiteral, state: TemplateState, container?: string): string;
|
|
1678
|
+
declare function getIndexCheck(context: CompilerContext, i: string, type: Type): string;
|
|
1679
|
+
/**
|
|
1680
|
+
* Sort, so the order is literal, number, string, symbol. literal comes first as its the most specific type.
|
|
1681
|
+
* We need to do that for numbers since all keys are string|symbol in runtime, and we need to check if a string is numeric first before falling back to string.
|
|
1682
|
+
*/
|
|
1683
|
+
declare function sortSignatures(signatures: TypeIndexSignature[]): void;
|
|
1684
|
+
declare function getStaticDefaultCodeForProperty(member: TypeProperty | TypePropertySignature, setter: string | ContainerAccessor, state: TemplateState): string;
|
|
1685
|
+
declare function getEmbeddedProperty(type: TypeClass | TypeObjectLiteral): TypeProperty | TypePropertySignature | undefined;
|
|
1686
|
+
declare function serializeObjectLiteral(type: TypeObjectLiteral | TypeClass, state: TemplateState): void;
|
|
1687
|
+
declare function typeGuardEmbedded(type: TypeClass | TypeObjectLiteral, state: TemplateState, embedded: EmbeddedOptions): void;
|
|
1688
|
+
declare function typeGuardObjectLiteral(type: TypeObjectLiteral | TypeClass, state: TemplateState): void;
|
|
1689
|
+
declare function serializeArray(type: TypeArray, state: TemplateState): void;
|
|
1690
|
+
declare function typeGuardArray(elementType: Type, state: TemplateState): void;
|
|
1691
|
+
declare function getSetTypeToArray(type: TypeClass): TypeArray;
|
|
1692
|
+
declare function getMapTypeToArray(type: TypeClass): TypeArray;
|
|
1693
|
+
declare function getNTypeToArray(type: TypeClass, n: number): TypeArray;
|
|
1694
|
+
declare function executeTypeArgumentAsArray(type: TypeClass, typeIndex: number, state: TemplateState): void;
|
|
1695
|
+
declare function forwardSetToArray(type: TypeClass, state: TemplateState): void;
|
|
1696
|
+
declare function forwardMapToArray(type: TypeClass, state: TemplateState): void;
|
|
1697
|
+
declare function serializePropertyOrParameter(type: TypePropertySignature | TypeProperty | TypeParameter, state: TemplateState): void;
|
|
1698
|
+
declare function validatePropertyOrParameter(type: TypePropertySignature | TypeProperty | TypeParameter, state: TemplateState): void;
|
|
1699
|
+
declare function handleUnion(type: TypeUnion, state: TemplateState): void;
|
|
1700
|
+
declare function getNameExpression(name: string | number | symbol | undefined, state: TemplateState): string;
|
|
1701
|
+
declare class TypeGuardRegistry {
|
|
1702
|
+
serializer: Serializer;
|
|
1703
|
+
registry: {
|
|
1704
|
+
[specificality: number]: TemplateRegistry;
|
|
1705
|
+
};
|
|
1706
|
+
protected sorted?: [specificality: number, registry: TemplateRegistry][];
|
|
1707
|
+
/**
|
|
1708
|
+
* Lowest specificality first
|
|
1709
|
+
*/
|
|
1710
|
+
getSortedTemplateRegistries(): [specificality: number, registry: TemplateRegistry][];
|
|
1711
|
+
constructor(serializer: Serializer);
|
|
1712
|
+
clear(): void;
|
|
1713
|
+
/**
|
|
1714
|
+
*
|
|
1715
|
+
* @see register() for specificality explanation.
|
|
1716
|
+
*/
|
|
1717
|
+
getRegistry(specificality: number): TemplateRegistry;
|
|
1718
|
+
/**
|
|
1719
|
+
* Registers a new template and replaces all existing (added via register,prepend,append).
|
|
1720
|
+
*
|
|
1721
|
+
* Specificality defines when the given template guard is executed.
|
|
1722
|
+
*
|
|
1723
|
+
* - 1 means its used for JS types - exact types. For example for type string `'string' ==== typeof v` is used. Same for number, bigint, and boolean.
|
|
1724
|
+
* Guards of this specificality are used for the `is()` function.
|
|
1725
|
+
*
|
|
1726
|
+
* - >1 means it acts as a fallback. For example in a union `number | Date`, when a string is given, the Date can allow `string` type as well, so it gets converted to a Date.
|
|
1727
|
+
*
|
|
1728
|
+
* - >0 && <1 means its acts as a priority guard. For example in a `string | Date`, a string of date-format is converted to a Date instead of a string. This is necessary
|
|
1729
|
+
* to support regular JSON.
|
|
1730
|
+
*
|
|
1731
|
+
* - <0, anything below 0 means it can optionally be used for loosely types. This is handy when data comes from a string-only encoding like URL query strings.
|
|
1732
|
+
* In this specificality a numeric string is converted to a number or bigint, a 1|0|true|false string converted to boolean .
|
|
1733
|
+
*/
|
|
1734
|
+
register<T extends ReflectionKind>(specificality: number, kind: T, template: Template<FindType<Type, T>>): void;
|
|
1735
|
+
/**
|
|
1736
|
+
* @see register
|
|
1737
|
+
*/
|
|
1738
|
+
registerClass(specificality: number, classType: ClassType, template: Template<TypeClass>): void;
|
|
1739
|
+
/**
|
|
1740
|
+
* @see register
|
|
1741
|
+
*/
|
|
1742
|
+
registerBinary(specificality: number, template: Template<TypeClass>): void;
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Default serializer that can convert JS data structures to the target type.
|
|
1746
|
+
* It coerces types, converts object literals to class instances, and has type guards for JS types.
|
|
1747
|
+
*
|
|
1748
|
+
* JSONSerializer has the same but for JSON data structures.
|
|
1749
|
+
*/
|
|
1750
|
+
declare class Serializer {
|
|
1751
|
+
name: string;
|
|
1752
|
+
serializeRegistry: TemplateRegistry;
|
|
1753
|
+
deserializeRegistry: TemplateRegistry;
|
|
1754
|
+
typeGuards: TypeGuardRegistry;
|
|
1755
|
+
validators: TemplateRegistry;
|
|
1756
|
+
constructor(name?: string);
|
|
1757
|
+
setExplicitUndefined(type: Type, state: TemplateState): boolean;
|
|
1758
|
+
protected registerValidators(): void;
|
|
1759
|
+
clear(): void;
|
|
1760
|
+
protected registerSerializers(): void;
|
|
1761
|
+
protected registerTypeGuards(): void;
|
|
1762
|
+
}
|
|
1763
|
+
declare const serializableKinds: ReflectionKind[];
|
|
1764
|
+
declare class EmptySerializer extends Serializer {
|
|
1765
|
+
constructor(name?: string);
|
|
1766
|
+
protected registerValidators(): void;
|
|
1767
|
+
protected registerSerializers(): void;
|
|
1768
|
+
}
|
|
1769
|
+
declare const serializer: Serializer;
|
|
1770
|
+
//#endregion
|
|
1771
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/validator.d.ts
|
|
1772
|
+
type ValidatorMeta<Name extends string, Args extends [...args: any[]] = []> = TypeAnnotation<'validator', [Name, Args]>;
|
|
1773
|
+
type ValidateFunction = (value: any, type: Type, options: any) => ValidatorError | void;
|
|
1774
|
+
type Validate<T extends ValidateFunction, Options extends Parameters<T>[2] = unknown> = ValidatorMeta<'function', [T, Options]>;
|
|
1775
|
+
type Pattern<T extends RegExp> = ValidatorMeta<'pattern', [T]>;
|
|
1776
|
+
type Alpha = ValidatorMeta<'alpha'>;
|
|
1777
|
+
type Alphanumeric = ValidatorMeta<'alphanumeric'>;
|
|
1778
|
+
type Ascii = ValidatorMeta<'ascii'>;
|
|
1779
|
+
type Decimal<MinDigits extends number = 1, MaxDigits extends number = 100> = ValidatorMeta<'decimal', [MinDigits, MaxDigits]>;
|
|
1780
|
+
type MultipleOf<Num extends number> = ValidatorMeta<'multipleOf', [Num]>;
|
|
1781
|
+
type MinLength<Length extends number> = ValidatorMeta<'minLength', [Length]>;
|
|
1782
|
+
type MaxLength<Length extends number> = ValidatorMeta<'maxLength', [Length]>;
|
|
1783
|
+
type Includes<T extends string | number | boolean> = ValidatorMeta<'includes', [T]>;
|
|
1784
|
+
type Excludes<T extends string | number | boolean> = ValidatorMeta<'excludes', [T]>;
|
|
1785
|
+
type Minimum<T extends number | bigint> = ValidatorMeta<'minimum', [T]>;
|
|
1786
|
+
type Maximum<T extends number | bigint> = ValidatorMeta<'maximum', [T]>;
|
|
1787
|
+
/**
|
|
1788
|
+
Includes 0. Use PositiveNoZero to exclude 0.
|
|
1789
|
+
*/
|
|
1790
|
+
type Positive = ValidatorMeta<'positive', unknown & [true]>;
|
|
1791
|
+
/**
|
|
1792
|
+
* Includes 0. Use NegativeNoZero to exclude 0.
|
|
1793
|
+
*/
|
|
1794
|
+
type Negative = ValidatorMeta<'negative', [true]>;
|
|
1795
|
+
type PositiveNoZero = ValidatorMeta<'positive', [false]>;
|
|
1796
|
+
type NegativeNoZero = ValidatorMeta<'negative', [false]>;
|
|
1797
|
+
type ExclusiveMinimum<T extends number | bigint> = ValidatorMeta<'exclusiveMinimum', [T]>;
|
|
1798
|
+
type ExclusiveMaximum<T extends number | bigint> = ValidatorMeta<'exclusiveMaximum', [T]>;
|
|
1799
|
+
type BeforeDate<T extends number> = ValidatorMeta<'beforeDate', [T]>;
|
|
1800
|
+
type AfterDate<T extends number> = ValidatorMeta<'afterDate', [T]>;
|
|
1801
|
+
type BeforeNow = ValidatorMeta<'beforeNow'>;
|
|
1802
|
+
type AfterNow = ValidatorMeta<'afterNow'>;
|
|
1803
|
+
declare const EMAIL_REGEX: RegExp;
|
|
1804
|
+
type Email = string & Pattern<typeof EMAIL_REGEX>;
|
|
1805
|
+
/**
|
|
1806
|
+
* Used in validator functions.
|
|
1807
|
+
*/
|
|
1808
|
+
declare class ValidatorError {
|
|
1809
|
+
readonly code: string;
|
|
1810
|
+
readonly message: string;
|
|
1811
|
+
readonly path?: string | undefined;
|
|
1812
|
+
constructor(code: string, message: string, path?: string | undefined);
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* The structure of a validation error.
|
|
1816
|
+
*
|
|
1817
|
+
* Path defines the shallow or deep path (using dots).
|
|
1818
|
+
* Message is an arbitrary message in english.
|
|
1819
|
+
*
|
|
1820
|
+
* In validators please use and return `new ValidatorError('code', 'message')` instead.
|
|
1821
|
+
*/
|
|
1822
|
+
declare class ValidationErrorItem {
|
|
1823
|
+
/**
|
|
1824
|
+
* The path to the property. Might be a deep path separated by dot.
|
|
1825
|
+
*/
|
|
1826
|
+
readonly path: string;
|
|
1827
|
+
/**
|
|
1828
|
+
* A lower cased error code that can be used to identify this error and translate.
|
|
1829
|
+
*/
|
|
1830
|
+
readonly code: string;
|
|
1831
|
+
/**
|
|
1832
|
+
* Free text of the error.
|
|
1833
|
+
*/
|
|
1834
|
+
readonly message: string;
|
|
1835
|
+
/**
|
|
1836
|
+
* Optional value that caused the error.
|
|
1837
|
+
*/
|
|
1838
|
+
readonly value?: any | undefined;
|
|
1839
|
+
constructor(
|
|
1840
|
+
/**
|
|
1841
|
+
* The path to the property. Might be a deep path separated by dot.
|
|
1842
|
+
*/
|
|
1843
|
+
|
|
1844
|
+
path: string,
|
|
1845
|
+
/**
|
|
1846
|
+
* A lower cased error code that can be used to identify this error and translate.
|
|
1847
|
+
*/
|
|
1848
|
+
|
|
1849
|
+
code: string,
|
|
1850
|
+
/**
|
|
1851
|
+
* Free text of the error.
|
|
1852
|
+
*/
|
|
1853
|
+
|
|
1854
|
+
message: string,
|
|
1855
|
+
/**
|
|
1856
|
+
* Optional value that caused the error.
|
|
1857
|
+
*/
|
|
1858
|
+
|
|
1859
|
+
value?: any | undefined);
|
|
1860
|
+
toString(prefix?: string): string;
|
|
1861
|
+
}
|
|
1862
|
+
declare class ValidationError extends CustomError {
|
|
1863
|
+
readonly errors: ValidationErrorItem[];
|
|
1864
|
+
constructor(errors: ValidationErrorItem[], type?: Type);
|
|
1865
|
+
static from(errors: {
|
|
1866
|
+
path: string;
|
|
1867
|
+
message: string;
|
|
1868
|
+
code?: string;
|
|
1869
|
+
value?: any;
|
|
1870
|
+
}[]): ValidationError;
|
|
1871
|
+
}
|
|
1872
|
+
/**
|
|
1873
|
+
* Returns empty array when valid, or ValidationErrorItem[] with detailed error messages if not valid.
|
|
1874
|
+
*
|
|
1875
|
+
* Returns validation error items when failed. If successful returns an empty array.
|
|
1876
|
+
*/
|
|
1877
|
+
declare function validate<T>(data: any, type?: ReceiveType<T>): ValidationErrorItem[];
|
|
1878
|
+
declare function validateFunction<T>(serializerToUse?: Serializer, type?: ReceiveType<T>): (data: T) => ValidationErrorItem[];
|
|
1879
|
+
/**
|
|
1880
|
+
* Returns true when valid, and false if not.
|
|
1881
|
+
*/
|
|
1882
|
+
declare function validates<T>(data: any, type?: ReceiveType<T>): boolean;
|
|
1883
|
+
//#endregion
|
|
1884
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/reflection/processor.d.ts
|
|
1885
|
+
type RuntimeStackEntry = Type | Object | (() => ClassType | Object) | string | number | boolean | bigint;
|
|
1886
|
+
type Packed = (RuntimeStackEntry | string)[] & {
|
|
1887
|
+
__is?: (data: any) => boolean;
|
|
1888
|
+
} & {
|
|
1889
|
+
__type?: Type;
|
|
1890
|
+
} & {
|
|
1891
|
+
__unpack?: PackStruct;
|
|
1892
|
+
};
|
|
1893
|
+
declare class PackStruct {
|
|
1894
|
+
ops: ReflectionOp[];
|
|
1895
|
+
stack: RuntimeStackEntry[];
|
|
1896
|
+
constructor(ops?: ReflectionOp[], stack?: RuntimeStackEntry[]);
|
|
1897
|
+
}
|
|
1898
|
+
declare function encodeOps(ops: ReflectionOp[]): string;
|
|
1899
|
+
/**
|
|
1900
|
+
* Pack a pack structure (op instructions + pre-defined stack) and create a encoded version of it.
|
|
1901
|
+
*/
|
|
1902
|
+
declare function pack(packOrOps: PackStruct | ReflectionOp[]): Packed;
|
|
1903
|
+
declare function unpack(pack: Packed): PackStruct;
|
|
1904
|
+
declare function resolvePacked(type: Packed, args?: any[], options?: ReflectOptions): Type;
|
|
1905
|
+
/**
|
|
1906
|
+
* Computes a type of given object. This function caches the result on the object itself.
|
|
1907
|
+
* This is the slow path, using the full type virtual machine to resolve the type.
|
|
1908
|
+
* If you want to handle some fast paths (including cache), try using resolveReceiveType() instead.
|
|
1909
|
+
*/
|
|
1910
|
+
declare function resolveRuntimeType(o: ClassType | Function | Packed | any, args?: any[], options?: ReflectOptions): Type;
|
|
1911
|
+
interface Frame {
|
|
1912
|
+
index: number;
|
|
1913
|
+
startIndex: number;
|
|
1914
|
+
variables: number;
|
|
1915
|
+
inputs: RuntimeStackEntry[];
|
|
1916
|
+
previous?: Frame;
|
|
1917
|
+
mappedType?: Loop;
|
|
1918
|
+
distributiveLoop?: Loop;
|
|
1919
|
+
}
|
|
1920
|
+
declare class Loop {
|
|
1921
|
+
fromType: Type;
|
|
1922
|
+
private types;
|
|
1923
|
+
private i;
|
|
1924
|
+
constructor(fromType: Type);
|
|
1925
|
+
next(): Type | undefined;
|
|
1926
|
+
}
|
|
1927
|
+
interface Program {
|
|
1928
|
+
frame: Frame;
|
|
1929
|
+
active: boolean;
|
|
1930
|
+
stack: (RuntimeStackEntry | Type)[];
|
|
1931
|
+
stackPointer: number;
|
|
1932
|
+
program: number;
|
|
1933
|
+
depth: number;
|
|
1934
|
+
initialStack: (RuntimeStackEntry | Type)[];
|
|
1935
|
+
resultType: Type;
|
|
1936
|
+
ops: ReflectionOp[];
|
|
1937
|
+
end: number;
|
|
1938
|
+
inputs: RuntimeStackEntry[];
|
|
1939
|
+
resultTypes?: Type[];
|
|
1940
|
+
started: number;
|
|
1941
|
+
typeParameters?: Type[];
|
|
1942
|
+
previous?: Program;
|
|
1943
|
+
directReturn?: boolean;
|
|
1944
|
+
object?: ClassType | Function | Packed | any;
|
|
1945
|
+
}
|
|
1946
|
+
interface ReflectOptions {
|
|
1947
|
+
/**
|
|
1948
|
+
*
|
|
1949
|
+
*/
|
|
1950
|
+
reuseCached?: boolean;
|
|
1951
|
+
inline?: boolean;
|
|
1952
|
+
typeName?: string;
|
|
1953
|
+
}
|
|
1954
|
+
/**
|
|
1955
|
+
* @reflection never
|
|
1956
|
+
*/
|
|
1957
|
+
declare class Processor {
|
|
1958
|
+
static typeProcessor?: Processor;
|
|
1959
|
+
static get(): Processor;
|
|
1960
|
+
private cache;
|
|
1961
|
+
/**
|
|
1962
|
+
* Linked list of programs to execute. For each external call to external program will this be changed.
|
|
1963
|
+
*/
|
|
1964
|
+
protected program: Program;
|
|
1965
|
+
reflect(object: ClassType | Function | Packed | any, inputs?: RuntimeStackEntry[], options?: ReflectOptions): Type;
|
|
1966
|
+
_reflect(object: ClassType | Function | Packed | any, inputs?: RuntimeStackEntry[], options?: ReflectOptions): Type;
|
|
1967
|
+
run(ops: ReflectionOp[], initialStack: RuntimeStackEntry[], inputs?: RuntimeStackEntry[], object?: ClassType | Function | Packed | any): Type;
|
|
1968
|
+
runProgram(program: Program): Type;
|
|
1969
|
+
/**
|
|
1970
|
+
* Semantic is important here: This triggers true only for the very last op of a program.
|
|
1971
|
+
* If it is checked in OP inline then it could be true or false:
|
|
1972
|
+
*
|
|
1973
|
+
* type t<T> = T; => false since we have nominal past the inline op
|
|
1974
|
+
* typeOf<T>() => true since we have no nominal past the inline op
|
|
1975
|
+
*/
|
|
1976
|
+
protected isEnded(): boolean;
|
|
1977
|
+
/**
|
|
1978
|
+
* Runs all scheduled programs until termination.
|
|
1979
|
+
*/
|
|
1980
|
+
protected loop(until?: Program): Type | RuntimeStackEntry;
|
|
1981
|
+
private handleTuple;
|
|
1982
|
+
private handleIntersection;
|
|
1983
|
+
private handleDistribute;
|
|
1984
|
+
private handleIndexAccess;
|
|
1985
|
+
private handleKeyOf;
|
|
1986
|
+
private handleMappedType;
|
|
1987
|
+
private handleTemplateLiteral;
|
|
1988
|
+
protected push(entry: RuntimeStackEntry, program?: Program): void;
|
|
1989
|
+
protected pop(): RuntimeStackEntry;
|
|
1990
|
+
protected pushFrame(): void;
|
|
1991
|
+
protected popFrame(): RuntimeStackEntry[];
|
|
1992
|
+
/**
|
|
1993
|
+
* Create a new stack frame with the calling convention.
|
|
1994
|
+
*/
|
|
1995
|
+
protected call(program: number, jumpBackTo?: number): void;
|
|
1996
|
+
/**
|
|
1997
|
+
* Removes the stack frame, and puts the latest entry on the stack.
|
|
1998
|
+
*/
|
|
1999
|
+
protected returnFrame(): void;
|
|
2000
|
+
protected pushType(type: Type): void;
|
|
2001
|
+
protected eatParameter(): RuntimeStackEntry;
|
|
2002
|
+
}
|
|
2003
|
+
declare function typeInfer(value: any): Type;
|
|
2004
|
+
declare function getEnumType(values: any[]): Type;
|
|
2005
|
+
//#endregion
|
|
2006
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/reflection/reflection.d.ts
|
|
2007
|
+
/**
|
|
2008
|
+
* Receives the runtime type of template argument.
|
|
2009
|
+
*
|
|
2010
|
+
* Use
|
|
2011
|
+
*
|
|
2012
|
+
* ```typescript
|
|
2013
|
+
*
|
|
2014
|
+
* function f<T>(type?: ReceiveType<T>): Type {
|
|
2015
|
+
* return resolveReceiveType(type);
|
|
2016
|
+
* }
|
|
2017
|
+
*
|
|
2018
|
+
* ```
|
|
2019
|
+
*/
|
|
2020
|
+
type ReceiveType<T> = Packed | Type | ClassType<T>;
|
|
2021
|
+
declare function resolveReceiveType(type?: Packed | Type | ClassType | AbstractClassType | ReflectionClass<any>): Type;
|
|
2022
|
+
declare function reflect(o: any, ...args: any[]): Type;
|
|
2023
|
+
declare function reflectOrUndefined(o: any, ...args: any[]): Type | undefined;
|
|
2024
|
+
declare function valuesOf<T>(args?: any[], p?: ReceiveType<T>): (string | number | symbol | Type)[];
|
|
2025
|
+
declare function propertiesOf<T>(args?: any[], p?: ReceiveType<T>): (string | number | symbol | Type)[];
|
|
2026
|
+
declare function getNominalId<T>(args?: any[], p?: ReceiveType<T>): number | undefined;
|
|
2027
|
+
declare function typeOf<T>(args?: any[], p?: ReceiveType<T>): Type;
|
|
2028
|
+
declare function removeTypeName<T extends Type>(type: T): T;
|
|
2029
|
+
declare function removeNominal<T extends Type | undefined | Type[]>(type: T): T;
|
|
2030
|
+
declare function getProperty(type: TypeObjectLiteral | TypeClass, memberName: number | string | symbol): TypeProperty | TypePropertySignature | undefined;
|
|
2031
|
+
declare function toSignature(type: TypeProperty | TypeMethod | TypePropertySignature | TypeMethodSignature): TypePropertySignature | TypeMethodSignature;
|
|
2032
|
+
declare function hasCircularReference(type: Type): any;
|
|
2033
|
+
declare function visit(type: Type, visitor: (type: Type, path: string) => false | void, onCircular?: () => void): void;
|
|
2034
|
+
/**
|
|
2035
|
+
* @reflection never
|
|
2036
|
+
*/
|
|
2037
|
+
declare class ReflectionParameter {
|
|
2038
|
+
readonly parameter: TypeParameter;
|
|
2039
|
+
readonly reflectionFunction: ReflectionMethod | ReflectionFunction;
|
|
2040
|
+
type: Type;
|
|
2041
|
+
constructor(parameter: TypeParameter, reflectionFunction: ReflectionMethod | ReflectionFunction);
|
|
2042
|
+
getType(): Type;
|
|
2043
|
+
getName(): string;
|
|
2044
|
+
get name(): string;
|
|
2045
|
+
isOptional(): boolean;
|
|
2046
|
+
hasDefault(): boolean;
|
|
2047
|
+
isValueRequired(): boolean;
|
|
2048
|
+
getDefaultValue(): any;
|
|
2049
|
+
setDefaultValue(value: any): void;
|
|
2050
|
+
hasDefaultFunctionExpression(): boolean;
|
|
2051
|
+
applyDecorator(t: TData): void;
|
|
2052
|
+
getVisibility(): ReflectionVisibility | undefined;
|
|
2053
|
+
isPublic(): boolean;
|
|
2054
|
+
isProtected(): boolean;
|
|
2055
|
+
isPrivate(): boolean;
|
|
2056
|
+
isReadonly(): boolean;
|
|
2057
|
+
setTags(tags: TagsReflection): void;
|
|
2058
|
+
getTags(): TagsReflection;
|
|
2059
|
+
isHidden(): boolean;
|
|
2060
|
+
isIgnored(): boolean;
|
|
2061
|
+
isInternal(): boolean;
|
|
2062
|
+
isRuntime(): boolean;
|
|
2063
|
+
getAlias(): string[];
|
|
2064
|
+
getTitle(): string | undefined;
|
|
2065
|
+
getPermission(): string[];
|
|
2066
|
+
getDomain(): string | undefined;
|
|
2067
|
+
/**
|
|
2068
|
+
* True if the parameter becomes a property in the class.
|
|
2069
|
+
* This is the case for parameters in constructors with visibility or readonly.
|
|
2070
|
+
*
|
|
2071
|
+
* ```typescript
|
|
2072
|
+
* class User {
|
|
2073
|
+
* constructor(public name: string) {}
|
|
2074
|
+
* }
|
|
2075
|
+
*/
|
|
2076
|
+
isProperty(): boolean;
|
|
2077
|
+
}
|
|
2078
|
+
/**
|
|
2079
|
+
* @reflection never
|
|
2080
|
+
*/
|
|
2081
|
+
declare class ReflectionFunction {
|
|
2082
|
+
readonly type: TypeMethod | TypeMethodSignature | TypeFunction;
|
|
2083
|
+
parameters: ReflectionParameter[];
|
|
2084
|
+
parameterAliases: Map<string, string>;
|
|
2085
|
+
description: string;
|
|
2086
|
+
constructor(type: TypeMethod | TypeMethodSignature | TypeFunction);
|
|
2087
|
+
static from(fn: Function): ReflectionFunction;
|
|
2088
|
+
getParameterNames(): string[];
|
|
2089
|
+
hasParameter(name: string | number | symbol): boolean;
|
|
2090
|
+
getParameterOrUndefined(name: string | number | symbol): ReflectionParameter | undefined;
|
|
2091
|
+
getParameter(name: string | number | symbol): ReflectionParameter;
|
|
2092
|
+
getParameterType(name: string | number | symbol): Type | undefined;
|
|
2093
|
+
getParameters(): ReflectionParameter[];
|
|
2094
|
+
getReturnType(): Type;
|
|
2095
|
+
getName(): number | string | symbol;
|
|
2096
|
+
getDescription(): string;
|
|
2097
|
+
get name(): string;
|
|
2098
|
+
setTags(tags: TagsReflection): void;
|
|
2099
|
+
getTags(): TagsReflection;
|
|
2100
|
+
isHidden(): boolean;
|
|
2101
|
+
isReadonly(): boolean;
|
|
2102
|
+
isIgnored(): boolean;
|
|
2103
|
+
isInternal(): boolean;
|
|
2104
|
+
isRuntime(): boolean;
|
|
2105
|
+
getAlias(): string[];
|
|
2106
|
+
getTitle(): string | undefined;
|
|
2107
|
+
getPermission(): string[];
|
|
2108
|
+
getDomain(): string | undefined;
|
|
2109
|
+
}
|
|
2110
|
+
/**
|
|
2111
|
+
* @reflection never
|
|
2112
|
+
*/
|
|
2113
|
+
declare class ReflectionMethod extends ReflectionFunction {
|
|
2114
|
+
type: TypeMethod | TypeMethodSignature;
|
|
2115
|
+
reflectionClass: ReflectionClass<any>;
|
|
2116
|
+
/**
|
|
2117
|
+
* Whether this method acts as validator.
|
|
2118
|
+
*/
|
|
2119
|
+
validator: boolean;
|
|
2120
|
+
constructor(type: TypeMethod | TypeMethodSignature, reflectionClass: ReflectionClass<any>);
|
|
2121
|
+
setType(method: TypeMethod | TypeMethodSignature): void;
|
|
2122
|
+
applyDecorator(data: TData): void;
|
|
2123
|
+
clone(reflectionClass?: ReflectionClass<any>, method?: TypeMethod | TypeMethodSignature): ReflectionMethod;
|
|
2124
|
+
isOptional(): boolean;
|
|
2125
|
+
setTags(tags: TagsReflection): void;
|
|
2126
|
+
getTags(): TagsReflection;
|
|
2127
|
+
isHidden(): boolean;
|
|
2128
|
+
isIgnored(): boolean;
|
|
2129
|
+
isReadonly(): boolean;
|
|
2130
|
+
isInternal(): boolean;
|
|
2131
|
+
isRuntime(): boolean;
|
|
2132
|
+
getAlias(): string[];
|
|
2133
|
+
getTitle(): string | undefined;
|
|
2134
|
+
getPermission(): string[];
|
|
2135
|
+
getDomain(): string | undefined;
|
|
2136
|
+
}
|
|
2137
|
+
declare function resolveForeignReflectionClass(property: ReflectionProperty): ReflectionClass<any>;
|
|
2138
|
+
/**
|
|
2139
|
+
* Resolved the class/object ReflectionClass of the given TypeClass|TypeObjectLiteral
|
|
2140
|
+
*/
|
|
2141
|
+
declare function resolveClassType(type: Type): ReflectionClass<any>;
|
|
2142
|
+
/**
|
|
2143
|
+
* @reflection never
|
|
2144
|
+
*/
|
|
2145
|
+
declare class ReflectionProperty {
|
|
2146
|
+
property: TypeProperty | TypePropertySignature;
|
|
2147
|
+
reflectionClass: ReflectionClass<any>;
|
|
2148
|
+
jsonType?: Type;
|
|
2149
|
+
serializer?: SerializerFn;
|
|
2150
|
+
deserializer?: SerializerFn;
|
|
2151
|
+
data: {
|
|
2152
|
+
[name: string]: any;
|
|
2153
|
+
};
|
|
2154
|
+
/**
|
|
2155
|
+
* The type of the property, not the property itself.
|
|
2156
|
+
*
|
|
2157
|
+
* Note: If the property is optional via `property?: T`, this information
|
|
2158
|
+
* is not available here. It's on `property`.
|
|
2159
|
+
* Use `isOptional()` instead, which handles this case plus the case
|
|
2160
|
+
* where optionality is given via union of T and undefined.
|
|
2161
|
+
*/
|
|
2162
|
+
type: Type;
|
|
2163
|
+
symbol: symbol;
|
|
2164
|
+
protected cachedResolvedReflectionClass?: ReflectionClass<any>;
|
|
2165
|
+
constructor(property: TypeProperty | TypePropertySignature, reflectionClass: ReflectionClass<any>);
|
|
2166
|
+
setType(type: Type): void;
|
|
2167
|
+
isPrimaryKey(): boolean;
|
|
2168
|
+
isEmbedded(): boolean;
|
|
2169
|
+
/**
|
|
2170
|
+
* Returns the sub type if available (for arrays for example).
|
|
2171
|
+
*
|
|
2172
|
+
* @throws Error if the property type does not support sub types.
|
|
2173
|
+
*/
|
|
2174
|
+
getSubType(): Type;
|
|
2175
|
+
/**
|
|
2176
|
+
* If undefined, it's not an embedded class.
|
|
2177
|
+
*/
|
|
2178
|
+
getEmbedded(): {
|
|
2179
|
+
prefix?: string;
|
|
2180
|
+
} | undefined;
|
|
2181
|
+
isBackReference(): boolean;
|
|
2182
|
+
isDatabaseSkipped(database: string): boolean;
|
|
2183
|
+
isDatabaseMigrationSkipped(database: string): boolean;
|
|
2184
|
+
getBackReference(): BackReferenceOptionsResolved;
|
|
2185
|
+
isAutoIncrement(): boolean;
|
|
2186
|
+
isReference(): boolean;
|
|
2187
|
+
isArray(): boolean;
|
|
2188
|
+
isDate(): boolean;
|
|
2189
|
+
isNumber(): boolean;
|
|
2190
|
+
getForeignKeyName(): string;
|
|
2191
|
+
getReference(): ReferenceOptions | undefined;
|
|
2192
|
+
getGroups(): string[];
|
|
2193
|
+
isInGroup(...group: string[]): boolean;
|
|
2194
|
+
getExcluded(): string[];
|
|
2195
|
+
isSerializerExcluded(name: string): boolean;
|
|
2196
|
+
getData(): {
|
|
2197
|
+
[name: string]: any;
|
|
2198
|
+
};
|
|
2199
|
+
/**
|
|
2200
|
+
* Returns the ReflectionClass of the reference class/object literal.
|
|
2201
|
+
*
|
|
2202
|
+
* @throws Error if the property is not from type TypeClass or TypeObjectLiteral
|
|
2203
|
+
*/
|
|
2204
|
+
getResolvedReflectionClass(): ReflectionClass<any>;
|
|
2205
|
+
/**
|
|
2206
|
+
* If undefined the property is not an index.
|
|
2207
|
+
* A unique property is defined as index with IndexOptions.unique=true.
|
|
2208
|
+
*/
|
|
2209
|
+
getIndex(): IndexOptions | undefined;
|
|
2210
|
+
/**
|
|
2211
|
+
* Returns database specific options, if defined
|
|
2212
|
+
*
|
|
2213
|
+
* ```typescript
|
|
2214
|
+
* interface User {
|
|
2215
|
+
* logins: number & DatabaseField<{type: 'integer(8)'}>;
|
|
2216
|
+
*
|
|
2217
|
+
* //of for a specific db engine
|
|
2218
|
+
* logins: number & Sqlite<{type: 'integer(8)'}>;
|
|
2219
|
+
* }
|
|
2220
|
+
*
|
|
2221
|
+
* ```
|
|
2222
|
+
*/
|
|
2223
|
+
getDatabase<T extends DatabaseFieldOptions>(name: string): T | undefined;
|
|
2224
|
+
clone(reflectionClass?: ReflectionClass<any>, property?: TypeProperty | TypePropertySignature): ReflectionProperty;
|
|
2225
|
+
applyDecorator(data: TData): void;
|
|
2226
|
+
getName(): number | string | symbol;
|
|
2227
|
+
getNameAsString(): string;
|
|
2228
|
+
get name(): string;
|
|
2229
|
+
getKind(): ReflectionKind;
|
|
2230
|
+
getType(): Type;
|
|
2231
|
+
getDescription(): string;
|
|
2232
|
+
/**
|
|
2233
|
+
* Whether a value is required from serialization point of view.
|
|
2234
|
+
* If this property has for example a default value (set via constructor or manually via t.default),
|
|
2235
|
+
* then the value is not required to instantiate the property value.
|
|
2236
|
+
*/
|
|
2237
|
+
isValueRequired(): boolean;
|
|
2238
|
+
/**
|
|
2239
|
+
* Returns true when `undefined` or a missing value is allowed at the class itself.
|
|
2240
|
+
* This is now only true when `optional` is set, but also when type is `any`.
|
|
2241
|
+
*/
|
|
2242
|
+
isActualOptional(): boolean;
|
|
2243
|
+
/**
|
|
2244
|
+
* If the property is actual optional or is an union with undefined in it.
|
|
2245
|
+
*/
|
|
2246
|
+
isOptional(): boolean;
|
|
2247
|
+
setOptional(v: boolean): void;
|
|
2248
|
+
isNullable(): boolean;
|
|
2249
|
+
isReadonly(): boolean;
|
|
2250
|
+
isAbstract(): boolean;
|
|
2251
|
+
hasDefault(): boolean;
|
|
2252
|
+
getDefaultValue(): any;
|
|
2253
|
+
setDefaultValue(value: any): void;
|
|
2254
|
+
hasDefaultFunctionExpression(): boolean;
|
|
2255
|
+
getDefaultValueFunction(): (() => any) | undefined;
|
|
2256
|
+
getVisibility(): ReflectionVisibility | undefined;
|
|
2257
|
+
isPublic(): boolean;
|
|
2258
|
+
isProtected(): boolean;
|
|
2259
|
+
isPrivate(): boolean;
|
|
2260
|
+
setTags(tags: TagsReflection): void;
|
|
2261
|
+
getTags(): TagsReflection;
|
|
2262
|
+
isHidden(): boolean;
|
|
2263
|
+
isIgnored(): boolean;
|
|
2264
|
+
isInternal(): boolean;
|
|
2265
|
+
isRuntime(): boolean;
|
|
2266
|
+
getAlias(): string[];
|
|
2267
|
+
getTitle(): string | undefined;
|
|
2268
|
+
getPermission(): string[];
|
|
2269
|
+
getDomain(): string | undefined;
|
|
2270
|
+
}
|
|
2271
|
+
declare const reflectionClassSymbol: unique symbol;
|
|
2272
|
+
interface SerializerFn {
|
|
2273
|
+
(value: any, property: ReflectionProperty): any;
|
|
2274
|
+
}
|
|
2275
|
+
declare class TData {
|
|
2276
|
+
validator: boolean;
|
|
2277
|
+
validators: ValidateFunction[];
|
|
2278
|
+
type?: Packed | Type | ClassType;
|
|
2279
|
+
data: {
|
|
2280
|
+
[name: string]: any;
|
|
2281
|
+
};
|
|
2282
|
+
serializer?: SerializerFn;
|
|
2283
|
+
deserializer?: SerializerFn;
|
|
2284
|
+
}
|
|
2285
|
+
declare class EntityData {
|
|
2286
|
+
name?: string;
|
|
2287
|
+
collectionName?: string;
|
|
2288
|
+
databaseSchemaName?: string;
|
|
2289
|
+
disableConstructor: boolean;
|
|
2290
|
+
data: {
|
|
2291
|
+
[name: string]: any;
|
|
2292
|
+
};
|
|
2293
|
+
indexes: {
|
|
2294
|
+
names: string[];
|
|
2295
|
+
options: IndexOptions;
|
|
2296
|
+
}[];
|
|
2297
|
+
singleTableInheritance?: true;
|
|
2298
|
+
}
|
|
2299
|
+
/**
|
|
2300
|
+
* @reflection never
|
|
2301
|
+
*/
|
|
2302
|
+
declare class ReflectionClass<T> {
|
|
2303
|
+
readonly type: TypeClass | TypeObjectLiteral;
|
|
2304
|
+
readonly parent?: ReflectionClass<any> | undefined;
|
|
2305
|
+
/**
|
|
2306
|
+
* The description, extracted from the class JSDoc @description.
|
|
2307
|
+
*/
|
|
2308
|
+
description: string;
|
|
2309
|
+
/**
|
|
2310
|
+
* The tags, extracted from the class JSDoc @tag.
|
|
2311
|
+
*/
|
|
2312
|
+
tags?: TagsReflection;
|
|
2313
|
+
/**
|
|
2314
|
+
* A place where arbitrary data is stored, usually set via decorator t.data.
|
|
2315
|
+
*/
|
|
2316
|
+
data: {
|
|
2317
|
+
[name: string]: any;
|
|
2318
|
+
};
|
|
2319
|
+
/**
|
|
2320
|
+
* The unique entity name.
|
|
2321
|
+
*
|
|
2322
|
+
* ```typescript
|
|
2323
|
+
* @entity.name('user')
|
|
2324
|
+
* class User {
|
|
2325
|
+
*
|
|
2326
|
+
* }
|
|
2327
|
+
* ```
|
|
2328
|
+
*/
|
|
2329
|
+
name?: string;
|
|
2330
|
+
databaseSchemaName?: string;
|
|
2331
|
+
disableConstructor: boolean;
|
|
2332
|
+
/**
|
|
2333
|
+
* The collection name, used in database context (also known as table name).
|
|
2334
|
+
*
|
|
2335
|
+
* Usually, if this is not set, `name` will be used.
|
|
2336
|
+
*
|
|
2337
|
+
* ```typescript
|
|
2338
|
+
* @entity.collection('users').name('user')
|
|
2339
|
+
* class User {
|
|
2340
|
+
*
|
|
2341
|
+
* }
|
|
2342
|
+
* ```
|
|
2343
|
+
*/
|
|
2344
|
+
collectionName?: string;
|
|
2345
|
+
/**
|
|
2346
|
+
* True when @entity.singleTableInheritance was set.
|
|
2347
|
+
*/
|
|
2348
|
+
singleTableInheritance: boolean;
|
|
2349
|
+
/**
|
|
2350
|
+
* Contains all indexed, multi-field using entity.index and all indexes from properties.
|
|
2351
|
+
*
|
|
2352
|
+
* ```typescript
|
|
2353
|
+
* @entity
|
|
2354
|
+
* .collection('users')
|
|
2355
|
+
* .name('user')
|
|
2356
|
+
* .index(['username', 'email'])
|
|
2357
|
+
* .index(['email', 'region'], {unique: true})
|
|
2358
|
+
* class User {
|
|
2359
|
+
* username: string;
|
|
2360
|
+
* email: string;
|
|
2361
|
+
* }
|
|
2362
|
+
* ```
|
|
2363
|
+
*/
|
|
2364
|
+
indexes: {
|
|
2365
|
+
names: string[];
|
|
2366
|
+
options: IndexOptions;
|
|
2367
|
+
}[];
|
|
2368
|
+
protected propertyNames: string[];
|
|
2369
|
+
protected methodNames: string[];
|
|
2370
|
+
protected properties: ReflectionProperty[];
|
|
2371
|
+
protected propertyAliases: Map<string, string>;
|
|
2372
|
+
protected methods: ReflectionMethod[];
|
|
2373
|
+
protected methodAliases: Map<string, string>;
|
|
2374
|
+
/**
|
|
2375
|
+
* References and back references.
|
|
2376
|
+
*/
|
|
2377
|
+
protected references: ReflectionProperty[];
|
|
2378
|
+
protected primaries: ReflectionProperty[];
|
|
2379
|
+
protected autoIncrements: ReflectionProperty[];
|
|
2380
|
+
/**
|
|
2381
|
+
* If a custom validator method was set via @t.validator, then this is the method name.
|
|
2382
|
+
*/
|
|
2383
|
+
validationMethod?: string | symbol | number | TypeTemplateLiteral;
|
|
2384
|
+
/**
|
|
2385
|
+
* A class using @t.singleTableInheritance registers itself in this array in its super class.
|
|
2386
|
+
*/
|
|
2387
|
+
subClasses: ReflectionClass<any>[];
|
|
2388
|
+
constructor(type: TypeClass | TypeObjectLiteral, parent?: ReflectionClass<any> | undefined);
|
|
2389
|
+
clone(): ReflectionClass<any>;
|
|
2390
|
+
toString(): string;
|
|
2391
|
+
getPropertiesDeclaredInConstructor(): ReflectionProperty[];
|
|
2392
|
+
clearJitContainer(): void;
|
|
2393
|
+
getJitContainer(): any;
|
|
2394
|
+
getClassType(): ClassType;
|
|
2395
|
+
getClassName(): string;
|
|
2396
|
+
createDefaultObject(): object;
|
|
2397
|
+
getName(): string;
|
|
2398
|
+
getDescription(): string;
|
|
2399
|
+
getCollectionName(): string;
|
|
2400
|
+
hasProperty(name: string | symbol | number): boolean;
|
|
2401
|
+
hasMethod(name: string | symbol | number): boolean;
|
|
2402
|
+
getPrimary(): ReflectionProperty;
|
|
2403
|
+
getAutoIncrement(): ReflectionProperty | undefined;
|
|
2404
|
+
isSchemaOf(classType: ClassType): boolean;
|
|
2405
|
+
hasPrimary(): boolean;
|
|
2406
|
+
getPrimaries(): ReflectionProperty[];
|
|
2407
|
+
/**
|
|
2408
|
+
* Returns the ReflectionClass object from parent/super class, if available.
|
|
2409
|
+
*/
|
|
2410
|
+
getSuperReflectionClass(): ReflectionClass<any> | undefined;
|
|
2411
|
+
removeProperty(name: string | number | symbol): void;
|
|
2412
|
+
registerProperty(property: ReflectionProperty): void;
|
|
2413
|
+
addProperty(prop: {
|
|
2414
|
+
name: number | string | symbol;
|
|
2415
|
+
optional?: true;
|
|
2416
|
+
readonly?: true;
|
|
2417
|
+
description?: string;
|
|
2418
|
+
visibility?: ReflectionVisibility;
|
|
2419
|
+
type: Type;
|
|
2420
|
+
default?: any;
|
|
2421
|
+
tags?: TagsReflection;
|
|
2422
|
+
}): ReflectionProperty;
|
|
2423
|
+
registerMethod(method: ReflectionMethod): void;
|
|
2424
|
+
add(member: Type): void;
|
|
2425
|
+
assignedSingleTableInheritanceSubClassesByIdentifier?: {
|
|
2426
|
+
[id: string]: ReflectionClass<any>;
|
|
2427
|
+
};
|
|
2428
|
+
getAssignedSingleTableInheritanceSubClassesByIdentifier(): {
|
|
2429
|
+
[id: string]: ReflectionClass<any>;
|
|
2430
|
+
} | undefined;
|
|
2431
|
+
hasSingleTableInheritanceSubClasses(): boolean;
|
|
2432
|
+
getSingleTableInheritanceDiscriminantName(): string;
|
|
2433
|
+
applyDecorator(data: EntityData): void;
|
|
2434
|
+
static from<T>(classTypeIn?: ReceiveType<T> | AbstractClassType<T> | TypeClass | TypeObjectLiteral | ReflectionClass<any>, args?: any[]): ReflectionClass<T>;
|
|
2435
|
+
getIndexSignatures(): void;
|
|
2436
|
+
getPropertyNames(): (string | number | symbol)[];
|
|
2437
|
+
getProperties(): ReflectionProperty[];
|
|
2438
|
+
getPropertiesInGroup(...group: string[]): ReflectionProperty[];
|
|
2439
|
+
getMethodNames(): (string | number | symbol)[];
|
|
2440
|
+
getMethods(): ReflectionMethod[];
|
|
2441
|
+
/**
|
|
2442
|
+
* Returns references and back references.
|
|
2443
|
+
*/
|
|
2444
|
+
getReferences(): ReflectionProperty[];
|
|
2445
|
+
getConstructorOrUndefined(): ReflectionMethod | undefined;
|
|
2446
|
+
getPropertyOrUndefined(name: string | number | symbol | TypeTemplateLiteral): ReflectionProperty | undefined;
|
|
2447
|
+
getProperty(name: string | number | symbol): ReflectionProperty;
|
|
2448
|
+
getMethodParameters(name: string | number | symbol): ReflectionParameter[];
|
|
2449
|
+
getMethodOrUndefined(name: string | number | symbol | TypeTemplateLiteral): ReflectionMethod | undefined;
|
|
2450
|
+
getMethod(name: string | number | symbol): ReflectionMethod;
|
|
2451
|
+
hasCircularReference(): boolean;
|
|
2452
|
+
serializeType(): SerializedTypes;
|
|
2453
|
+
setTags(tags: TagsReflection): void;
|
|
2454
|
+
getTags(): TagsReflection;
|
|
2455
|
+
isHidden(): boolean;
|
|
2456
|
+
isIgnored(): boolean;
|
|
2457
|
+
isInternal(): boolean;
|
|
2458
|
+
isRuntime(): boolean;
|
|
2459
|
+
isReadonly(): boolean;
|
|
2460
|
+
getAlias(): string[];
|
|
2461
|
+
getTitle(): string | undefined;
|
|
2462
|
+
getPermission(): string[];
|
|
2463
|
+
getDomain(): string | undefined;
|
|
2464
|
+
/**
|
|
2465
|
+
* All references have a counter-part. This methods finds it and errors if not possible.
|
|
2466
|
+
*
|
|
2467
|
+
* If the given reference is a owning reference it finds the correct backReference,
|
|
2468
|
+
* which can be found by checking all reference options.mappedBy.
|
|
2469
|
+
*
|
|
2470
|
+
* If the given reference is a back reference it finds the owning reference,
|
|
2471
|
+
* which can be found by using its options.mappedBy.
|
|
2472
|
+
*
|
|
2473
|
+
* Alternatively we simply check for resolvedClassType to be given `classType`, and if only one
|
|
2474
|
+
* found, we return it. When more than one found, we throw an error saying the user he
|
|
2475
|
+
* should make its relation mapping not ambiguous.
|
|
2476
|
+
*/
|
|
2477
|
+
findReverseReference(toClassType: ClassType, fromReference: ReflectionProperty): ReflectionProperty;
|
|
2478
|
+
extractPrimaryKey(item: object): Partial<T>;
|
|
2479
|
+
}
|
|
2480
|
+
//#endregion
|
|
2481
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/change-detector.d.ts
|
|
2482
|
+
/**
|
|
2483
|
+
* This is a comparator function for the snapshots. They are either string, number, boolean, array, or objects.
|
|
2484
|
+
* No date, moment, or custom classes involved here.
|
|
2485
|
+
*/
|
|
2486
|
+
declare function genericEqual(a: any, b: any): boolean;
|
|
2487
|
+
declare function getChangeDetector<T extends object>(classSchema: ReflectionClass<T>): (last: any, current: any, item: T) => ItemChanges<T> | undefined;
|
|
2488
|
+
declare function buildChanges<T extends object>(classSchema: ReflectionClass<T>, lastSnapshot: any, item: T): Changes<T>;
|
|
2489
|
+
//#endregion
|
|
2490
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/core.d.ts
|
|
2491
|
+
declare enum UnpopulatedCheck {
|
|
2492
|
+
None = 0,
|
|
2493
|
+
//returns undefined
|
|
2494
|
+
Throw = 1,
|
|
2495
|
+
//throws regular error
|
|
2496
|
+
ReturnSymbol = 2
|
|
2497
|
+
}
|
|
2498
|
+
declare const unpopulatedSymbol: unique symbol;
|
|
2499
|
+
interface TypeSettings {
|
|
2500
|
+
registeredEntities: {
|
|
2501
|
+
[name: string]: ClassType;
|
|
2502
|
+
};
|
|
2503
|
+
unpopulatedCheck: UnpopulatedCheck;
|
|
2504
|
+
}
|
|
2505
|
+
declare const typeSettings: TypeSettings;
|
|
2506
|
+
interface TypedArrayClassType<T> {
|
|
2507
|
+
new (...args: any[]): T;
|
|
2508
|
+
readonly BYTES_PER_ELEMENT: number;
|
|
2509
|
+
}
|
|
2510
|
+
interface TypedArray {
|
|
2511
|
+
/**
|
|
2512
|
+
* The size in bytes of each element in the array.
|
|
2513
|
+
*/
|
|
2514
|
+
readonly BYTES_PER_ELEMENT: number;
|
|
2515
|
+
/**
|
|
2516
|
+
* The ArrayBuffer instance referenced by the array.
|
|
2517
|
+
*/
|
|
2518
|
+
readonly buffer: ArrayBufferLike;
|
|
2519
|
+
/**
|
|
2520
|
+
* The length of the array.
|
|
2521
|
+
*/
|
|
2522
|
+
readonly length: number;
|
|
2523
|
+
/**
|
|
2524
|
+
* The length in bytes of the array.
|
|
2525
|
+
*/
|
|
2526
|
+
readonly byteLength: number;
|
|
2527
|
+
/**
|
|
2528
|
+
* The offset in bytes of the array.
|
|
2529
|
+
*/
|
|
2530
|
+
readonly byteOffset: number;
|
|
2531
|
+
}
|
|
2532
|
+
declare function nodeBufferToTypedArray<K>(buf: Buffer, type: TypedArrayClassType<K>): K;
|
|
2533
|
+
/**
|
|
2534
|
+
* When using Buffer.from() node is using a buffer from the buffer pool.
|
|
2535
|
+
* This makes it necessary to create the given TypedArray using byteOffset and byteLength accordingly.
|
|
2536
|
+
*
|
|
2537
|
+
* Note: The created TypedArray.buffer is pointing probably to a larger Buffer. Make sure
|
|
2538
|
+
* to use byteLength/byeOffset correctly or use typedArrayToArrayBuffer() if you want to use
|
|
2539
|
+
* a raw ArrayBuffer that represents the actual data correctly.
|
|
2540
|
+
*/
|
|
2541
|
+
declare function base64ToTypedArray<K>(base64: string, type: TypedArrayClassType<K>): K;
|
|
2542
|
+
/**
|
|
2543
|
+
* Creates a new fresh ArrayBuffer with given data.
|
|
2544
|
+
* Note: Regular Buffer.from(base64, 'base64) creates in Node a shared buffer, this function makes
|
|
2545
|
+
* sure a copy happens and the ArrayBuffer is not shared.
|
|
2546
|
+
*/
|
|
2547
|
+
declare function base64ToArrayBuffer(base64: string): ArrayBuffer;
|
|
2548
|
+
/**
|
|
2549
|
+
* When using Buffer.from() node is using a buffer from the buffer pool.
|
|
2550
|
+
* This makes it necessary to create the a new ArrayType using slice to make a copy.
|
|
2551
|
+
*
|
|
2552
|
+
* This makes a copy.
|
|
2553
|
+
*/
|
|
2554
|
+
declare function nodeBufferToArrayBuffer<K>(buf: Uint8Array | ArrayBuffer): ArrayBuffer;
|
|
2555
|
+
/**
|
|
2556
|
+
* In node environment the TypedArray.buffer is probably a larger buffer from the buffer pool.
|
|
2557
|
+
* This makes it necessary to create a Buffer with offset & length so that it accurately represents
|
|
2558
|
+
* the given TypedArray.
|
|
2559
|
+
*/
|
|
2560
|
+
declare function typedArrayToBuffer<K>(typedArray: TypedArray): Buffer;
|
|
2561
|
+
declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
2562
|
+
declare function typedArrayToBase64(typedArray: TypedArray): string;
|
|
2563
|
+
/**
|
|
2564
|
+
* Same as Buffer.from() but creates a ArrayBuffer that is not shared.
|
|
2565
|
+
*/
|
|
2566
|
+
declare function arrayBufferFrom(data: string, encoding?: string): ArrayBuffer;
|
|
2567
|
+
/**
|
|
2568
|
+
* Same as Buffer.from(arrayBuffer).toString(encoding), but more in line with the current API.
|
|
2569
|
+
*/
|
|
2570
|
+
declare function arrayBufferTo(arrayBuffer: ArrayBuffer, encoding?: string | "utf8" | "base64" | "ascii"): string;
|
|
2571
|
+
//#endregion
|
|
2572
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/decorator-builder.d.ts
|
|
2573
|
+
type ClassDecoratorFn = (classType: AbstractClassType, property?: string, parameterIndexOrDescriptor?: any) => void;
|
|
2574
|
+
type PropertyDecoratorFn = (prototype: object, property?: number | string | symbol, parameterIndexOrDescriptor?: any) => void;
|
|
2575
|
+
type FluidDecorator<T, D extends Function> = { [name in keyof T]: T[name] extends ((...args: infer K) => any) ? (...args: K) => D & FluidDecorator<T, D> : D & FluidDecorator<T, D> & {
|
|
2576
|
+
_data: ExtractApiDataType<T>;
|
|
2577
|
+
} };
|
|
2578
|
+
declare function createFluidDecorator<API extends APIClass<any> | APIProperty<any>, D extends Function>(api: API, modifier: {
|
|
2579
|
+
name: string;
|
|
2580
|
+
args?: any;
|
|
2581
|
+
Ω?: any;
|
|
2582
|
+
}[], collapse: (modifier: {
|
|
2583
|
+
name: string;
|
|
2584
|
+
args?: any;
|
|
2585
|
+
}[], target: any, property?: string, parameterIndexOrDescriptor?: any) => void, returnCollapse?: boolean, fluidFunctionSymbol?: symbol): FluidDecorator<ExtractClass<API>, D>;
|
|
2586
|
+
type UnionToIntersection$1<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
2587
|
+
type Merge<U> = { [K in keyof U]: U[K] extends ((...a: infer A) => infer R) ? R extends DualDecorator ? (...a: A) => PropertyDecoratorFn & R & U : (...a: A) => R : never };
|
|
2588
|
+
/**
|
|
2589
|
+
* A dual decorator is a decorator that can be used on a class and class property.
|
|
2590
|
+
*/
|
|
2591
|
+
type DualDecorator = void & {
|
|
2592
|
+
__DualDecorator?: true;
|
|
2593
|
+
};
|
|
2594
|
+
declare function mergeDecorator<T extends any[]>(...args: T): Merge<Omit<UnionToIntersection$1<T[number]>, '_fetch' | 't'>>;
|
|
2595
|
+
interface ClassApiTypeInterface<T> {
|
|
2596
|
+
t: T;
|
|
2597
|
+
onDecorator?: (classType: ClassType, property?: string, parameterIndexOrDescriptor?: any) => void;
|
|
2598
|
+
}
|
|
2599
|
+
type APIClass<T> = ClassType<ClassApiTypeInterface<T>>;
|
|
2600
|
+
type ExtractClass<T> = T extends ClassType<infer K> ? K : never;
|
|
2601
|
+
type ExtractApiDataType<T> = T extends AbstractClassType<infer K> ? K extends {
|
|
2602
|
+
t: infer P;
|
|
2603
|
+
} ? P : never : (T extends {
|
|
2604
|
+
t: infer P;
|
|
2605
|
+
} ? P : never);
|
|
2606
|
+
type ClassDecoratorResult<API extends APIClass<any>> = FluidDecorator<ExtractClass<API>, ClassDecoratorFn> & DecoratorAndFetchSignature<API, ClassDecoratorFn>;
|
|
2607
|
+
declare function createClassDecoratorContext<API extends APIClass<any>, T = ExtractApiDataType<API>>(apiType: API): ClassDecoratorResult<API>;
|
|
2608
|
+
interface PropertyApiTypeInterface<T> {
|
|
2609
|
+
t: T;
|
|
2610
|
+
onDecorator?: (target: ClassType, property: string | undefined, parameterIndexOrDescriptor?: any) => void;
|
|
2611
|
+
}
|
|
2612
|
+
type APIProperty<T> = ClassType<PropertyApiTypeInterface<T>>;
|
|
2613
|
+
type DecoratorAndFetchSignature<API extends APIProperty<any>, FN extends (...args: any[]) => any> = FN & {
|
|
2614
|
+
_fetch: (...args: Parameters<FN>) => ExtractApiDataType<API> | undefined;
|
|
2615
|
+
};
|
|
2616
|
+
type PropertyDecoratorResult<API extends APIProperty<any>> = FluidDecorator<ExtractClass<API>, PropertyDecoratorFn> & DecoratorAndFetchSignature<API, PropertyDecoratorFn>;
|
|
2617
|
+
declare function createPropertyDecoratorContext<API extends APIProperty<any>>(apiType: API): PropertyDecoratorResult<API>;
|
|
2618
|
+
type FreeDecoratorFn<API> = {
|
|
2619
|
+
(target?: any, property?: number | string | symbol, parameterIndexOrDescriptor?: any): ExtractApiDataType<API>;
|
|
2620
|
+
} & {
|
|
2621
|
+
_data: ExtractApiDataType<API>;
|
|
2622
|
+
};
|
|
2623
|
+
type FreeFluidDecorator<API> = { [name in keyof ExtractClass<API>]: ExtractClass<API>[name] extends ((...args: infer K) => any) ? (...args: K) => FreeFluidDecorator<API> : FreeFluidDecorator<API> } & FreeDecoratorFn<API>;
|
|
2624
|
+
type FreeDecoratorResult<API extends APIClass<any>> = FreeFluidDecorator<API> & {
|
|
2625
|
+
_fluidFunctionSymbol: symbol;
|
|
2626
|
+
};
|
|
2627
|
+
declare function createFreeDecoratorContext<API extends APIClass<any>, T = ExtractApiDataType<API>>(apiType: API): FreeDecoratorResult<API>;
|
|
2628
|
+
declare function isDecoratorContext<API extends APIClass<any>>(context: FreeDecoratorResult<API>, fn: Function): fn is FreeFluidDecorator<API>;
|
|
2629
|
+
//#endregion
|
|
2630
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/decorator.d.ts
|
|
2631
|
+
declare class TDecorator {
|
|
2632
|
+
t: TData;
|
|
2633
|
+
onDecorator(target: any, property?: string, parameterIndexOrDescriptor?: any): void;
|
|
2634
|
+
type<T>(type: ReceiveType<T> | ClassType): void;
|
|
2635
|
+
/**
|
|
2636
|
+
* Marks the method as validator. Is executed for each is/validate call.
|
|
2637
|
+
*
|
|
2638
|
+
* ```typescript
|
|
2639
|
+
*
|
|
2640
|
+
* class MyClass {
|
|
2641
|
+
* field1: string;
|
|
2642
|
+
* field2: string;
|
|
2643
|
+
*
|
|
2644
|
+
* @t.validator
|
|
2645
|
+
* validate(): ValidatorError | undefined {
|
|
2646
|
+
* return new ValidatorError('invalid', 'MyClass is invalid');
|
|
2647
|
+
* }
|
|
2648
|
+
* }
|
|
2649
|
+
*
|
|
2650
|
+
* ```
|
|
2651
|
+
*/
|
|
2652
|
+
get validator(): void;
|
|
2653
|
+
validate(...validators: ValidateFunction[]): void;
|
|
2654
|
+
serialize(serializer: SerializerFn): void;
|
|
2655
|
+
deserialize(deserializer: SerializerFn): void;
|
|
2656
|
+
data(name: string, value: any): void;
|
|
2657
|
+
}
|
|
2658
|
+
declare const t: PropertyDecoratorResult<typeof TDecorator>;
|
|
2659
|
+
declare class EntityDecorator {
|
|
2660
|
+
t: EntityData;
|
|
2661
|
+
onDecorator(target: any): void;
|
|
2662
|
+
name(name: string): void;
|
|
2663
|
+
collection(name: string): void;
|
|
2664
|
+
/**
|
|
2665
|
+
* Disables calling the constructor when deserializing.
|
|
2666
|
+
*/
|
|
2667
|
+
disableConstructor(): void;
|
|
2668
|
+
databaseSchema(name: string): void;
|
|
2669
|
+
index(names: string[], options?: IndexOptions): void;
|
|
2670
|
+
singleTableInheritance(): void;
|
|
2671
|
+
data(name: string, value: any): void;
|
|
2672
|
+
/**
|
|
2673
|
+
* Exclude this entity from database migrations.
|
|
2674
|
+
*/
|
|
2675
|
+
excludeMigration(): void;
|
|
2676
|
+
}
|
|
2677
|
+
declare const entity: ClassDecoratorResult<typeof EntityDecorator>;
|
|
2678
|
+
interface DeferredDecorator {
|
|
2679
|
+
data: any;
|
|
2680
|
+
target: any;
|
|
2681
|
+
property?: string;
|
|
2682
|
+
parameterIndexOrDescriptor?: any;
|
|
2683
|
+
}
|
|
2684
|
+
declare function isWithDeferredDecorators(obj: any): obj is {
|
|
2685
|
+
__decorators: DeferredDecorator[];
|
|
2686
|
+
};
|
|
2687
|
+
//#endregion
|
|
2688
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/default.d.ts
|
|
2689
|
+
/**
|
|
2690
|
+
* Returns a sensible default value for a given type.
|
|
2691
|
+
* Sensible means it satisfies the type checker, but not necessarily attached validators.
|
|
2692
|
+
*/
|
|
2693
|
+
declare function defaultValue(type: Type): any;
|
|
2694
|
+
//#endregion
|
|
2695
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/mixin.d.ts
|
|
2696
|
+
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends ((x: infer R) => any) ? R : never;
|
|
2697
|
+
/**
|
|
2698
|
+
* Function to mixin multiple classes together and create a new class, which can be extended from.
|
|
2699
|
+
*
|
|
2700
|
+
* The first entry of the mixin() call will be used as base class.
|
|
2701
|
+
*
|
|
2702
|
+
* @example
|
|
2703
|
+
* ```typescript
|
|
2704
|
+
*
|
|
2705
|
+
* class Timestampable {
|
|
2706
|
+
* createdAt: Date = new Date;
|
|
2707
|
+
* updatedAt: Date = new Date;
|
|
2708
|
+
* }
|
|
2709
|
+
*
|
|
2710
|
+
* class SoftDeleted {
|
|
2711
|
+
* deletedAt?: Date;
|
|
2712
|
+
* deletedBy?: string;
|
|
2713
|
+
* }
|
|
2714
|
+
*
|
|
2715
|
+
* class User extends mixin(Timestampable, SoftDeleted) {
|
|
2716
|
+
* id: number = 0;
|
|
2717
|
+
* constructor(public username: string) {}
|
|
2718
|
+
* }
|
|
2719
|
+
* ```
|
|
2720
|
+
*/
|
|
2721
|
+
declare function mixin<T extends AbstractClassType[]>(...classTypes: T): ClassType<UnionToIntersection<ExtractClassType<T[number]>>>;
|
|
2722
|
+
//#endregion
|
|
2723
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/path.d.ts
|
|
2724
|
+
type Resolver = (path: string) => Type | undefined;
|
|
2725
|
+
declare function resolvePath<T>(path: string, type?: ReceiveType<T>): Type;
|
|
2726
|
+
declare function pathResolver<T>(type?: ReceiveType<T>, jitStack?: JitStack): Resolver;
|
|
2727
|
+
//#endregion
|
|
2728
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/reference.d.ts
|
|
2729
|
+
declare function isReferenceInstance(obj: any): boolean;
|
|
2730
|
+
declare function getReferenceInfo<T>(obj: T): ReferenceInfo<T> | undefined;
|
|
2731
|
+
declare function getReferenceItemInfo<T>(obj: T): ReferenceItemInfo<T> | undefined;
|
|
2732
|
+
declare function getOrCreateReferenceItemInfo<T>(obj: T): ReferenceItemInfo<T>;
|
|
2733
|
+
declare function isReferenceHydrated(obj: any): boolean;
|
|
2734
|
+
declare function markAsHydrated(item: any): void;
|
|
2735
|
+
interface ReferenceInfo<T> {
|
|
2736
|
+
hydrator?: (item: T) => Promise<void>;
|
|
2737
|
+
}
|
|
2738
|
+
interface ReferenceItemInfo<T> {
|
|
2739
|
+
hydrated: boolean;
|
|
2740
|
+
}
|
|
2741
|
+
declare const referenceSymbol: unique symbol;
|
|
2742
|
+
declare const referenceItemSymbol: unique symbol;
|
|
2743
|
+
declare function createReference<T>(type: ClassType<T> | Type | ReflectionClass<any>, pk: {
|
|
2744
|
+
[name: string]: any;
|
|
2745
|
+
}): T;
|
|
2746
|
+
declare function createReferenceClass<T>(reflection: ReflectionClass<any>): ClassType<T>;
|
|
2747
|
+
//#endregion
|
|
2748
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/registry.d.ts
|
|
2749
|
+
interface RegistryDecorator<T> {
|
|
2750
|
+
predicate: (type: Type) => boolean;
|
|
2751
|
+
v: T;
|
|
2752
|
+
}
|
|
2753
|
+
declare class TypeRegistry<T> {
|
|
2754
|
+
protected results: { [kind in ReflectionKind]?: T };
|
|
2755
|
+
classes: Map<ClassType<any>, T>;
|
|
2756
|
+
protected decorators: RegistryDecorator<T>[];
|
|
2757
|
+
clear(): void;
|
|
2758
|
+
get(type: Type): T | undefined;
|
|
2759
|
+
decorator(predicate: (type: Type) => boolean, v: T): void;
|
|
2760
|
+
/**
|
|
2761
|
+
* Registers a template for all binary classes: ArrayBuffer, Uint8Array, Int8Array, etc.
|
|
2762
|
+
*/
|
|
2763
|
+
setBinary(v: T): void;
|
|
2764
|
+
setNumeric(v: T): void;
|
|
2765
|
+
/**
|
|
2766
|
+
* Registers a template for a given class type.
|
|
2767
|
+
*
|
|
2768
|
+
* As soon as a single template has registered for the given classType the template registry
|
|
2769
|
+
* only returns templates for this particular classType and omits all general purpose ReflectionKind.class templates for this particular classType.
|
|
2770
|
+
*/
|
|
2771
|
+
setClass(classType: ClassType, v: T): void;
|
|
2772
|
+
/**
|
|
2773
|
+
* Removes all registered templates.
|
|
2774
|
+
*/
|
|
2775
|
+
remove(kind: ReflectionKind): void;
|
|
2776
|
+
/**
|
|
2777
|
+
* Registers a new template and replaces all existing (added via register,prepend,append).
|
|
2778
|
+
*/
|
|
2779
|
+
set(kind: ReflectionKind | ReflectionKind[] | ((type: Type) => boolean), v: T): void;
|
|
2780
|
+
}
|
|
2781
|
+
//#endregion
|
|
2782
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/utils.d.ts
|
|
2783
|
+
declare class NoTypeReceived extends Error {
|
|
2784
|
+
constructor(message?: string);
|
|
2785
|
+
}
|
|
2786
|
+
/**
|
|
2787
|
+
* Returns a new UUID v4 as string.
|
|
2788
|
+
*/
|
|
2789
|
+
declare function uuid(): string;
|
|
2790
|
+
/**
|
|
2791
|
+
* Writes a new uuid v4 into an existing buffer, and returns the same buffer.
|
|
2792
|
+
*/
|
|
2793
|
+
declare function writeUuid(buffer: Uint8Array, offset?: number): Uint8Array;
|
|
2794
|
+
/**
|
|
2795
|
+
* Stringify an exising Uint8Array buffer.
|
|
2796
|
+
*/
|
|
2797
|
+
declare function stringifyUuid(buffer: Uint8Array, offset?: number): string;
|
|
2798
|
+
type Binary = ArrayBuffer | Uint8Array | Int8Array | Uint8ClampedArray | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array;
|
|
2799
|
+
type JSONPartial<T> = T extends Date ? string : T extends Array<infer K> ? Array<JSONPartial<K>> : T extends Binary ? string : T extends object ? JSONPartialObject<T> : T extends string ? number | T : T extends boolean ? number | string | T : T extends bigint ? number | string | T : T extends number ? bigint | string | T : T;
|
|
2800
|
+
type JSONPartialObject<T> = { [name in keyof T]?: T[name] | null };
|
|
2801
|
+
type JSONSingle<T> = T extends Date ? string | Date : T extends Array<infer K> ? Array<JSONSingle<K>> : T extends Binary ? string : T extends object ? JSONEntity<T> : T extends string ? string | number | boolean | undefined : T extends boolean ? T | number | string : T extends number ? T | string : T;
|
|
2802
|
+
type JSONEntity<T> = { [name in keyof T]: JSONSingle<T[name]> };
|
|
2803
|
+
declare function regExpFromString(v: string): RegExp;
|
|
2804
|
+
//#endregion
|
|
2805
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/serializer-facade.d.ts
|
|
2806
|
+
/**
|
|
2807
|
+
* Casts/coerces a given data structure to the target data type and validates all attached validators.
|
|
2808
|
+
*
|
|
2809
|
+
* Same as validatedDeserialize().
|
|
2810
|
+
*
|
|
2811
|
+
* @throws ValidationError if casting or validation fails
|
|
2812
|
+
*/
|
|
2813
|
+
declare function cast<T>(data: JSONPartial<T> | unknown, options?: SerializationOptions, serializerToUse?: Serializer, namingStrategy?: NamingStrategy, type?: ReceiveType<T>): T;
|
|
2814
|
+
/**
|
|
2815
|
+
* Same as cast but returns a ready to use function. Used to improve performance.
|
|
2816
|
+
*/
|
|
2817
|
+
declare function castFunction<T>(serializerToUse?: Serializer, namingStrategy?: NamingStrategy, type?: ReceiveType<T>): (data: JSONPartial<T> | unknown, options?: SerializationOptions) => T;
|
|
2818
|
+
/**
|
|
2819
|
+
* Deserialize given data structure from JSON data objects to JavaScript objects, without running any validators.
|
|
2820
|
+
*
|
|
2821
|
+
* Types that are already correct will be used as-is.
|
|
2822
|
+
*
|
|
2823
|
+
* ```typescript
|
|
2824
|
+
* interface Data {
|
|
2825
|
+
* created: Date;
|
|
2826
|
+
* }
|
|
2827
|
+
*
|
|
2828
|
+
* const data = deserialize<Data>({created: '2009-02-13T23:31:30.123Z'});
|
|
2829
|
+
* //data is {created: Date(2009-02-13T23:31:30.123Z)}
|
|
2830
|
+
*
|
|
2831
|
+
* @throws ValidationError when deserialization fails.
|
|
2832
|
+
* ```
|
|
2833
|
+
*/
|
|
2834
|
+
declare function deserialize<T>(data: JSONPartial<T> | unknown, options?: SerializationOptions, serializerToUse?: Serializer, namingStrategy?: NamingStrategy, type?: ReceiveType<T>): T;
|
|
2835
|
+
/**
|
|
2836
|
+
* Same as deserialize but returns a ready to use function. Used to improve performance.
|
|
2837
|
+
*/
|
|
2838
|
+
declare function deserializeFunction<T>(serializerToUse?: Serializer, namingStrategy?: NamingStrategy, type?: ReceiveType<T>): SerializeFunction<any, T>;
|
|
2839
|
+
/**
|
|
2840
|
+
* Patch serialization for deep dot paths, e.g. `{'user.shippingAddress.street': 'abc'}`
|
|
2841
|
+
* If a naming strategy is used, it could be converted to `{'user.shipping_address.street': 'abc'}`.
|
|
2842
|
+
*/
|
|
2843
|
+
declare function patch<T>(data: DeepPartial<T>, options?: SerializationOptions, serializerToUse?: Serializer, namingStrategy?: NamingStrategy, type?: ReceiveType<T>): (data: JSONPartial<T> | unknown) => T;
|
|
2844
|
+
/**
|
|
2845
|
+
* Create a serializer/deserializer function including validator for the given type for a patch structure.
|
|
2846
|
+
* This is handy for deep patch structures like e.g '{user.address.street: "new street"}'.
|
|
2847
|
+
*/
|
|
2848
|
+
declare function getPatchSerializeFunction(type: TypeClass | TypeObjectLiteral, registry: TemplateRegistry, namingStrategy?: NamingStrategy): (data: any, state?: SerializationOptions, patch?: {
|
|
2849
|
+
normalizeArrayIndex: boolean;
|
|
2850
|
+
}) => any;
|
|
2851
|
+
/**
|
|
2852
|
+
* Serialize given data structure to JSON data objects (not a JSON string).
|
|
2853
|
+
*
|
|
2854
|
+
* The resulting JSON object can be stringified using JSON.stringify().
|
|
2855
|
+
*
|
|
2856
|
+
* ```typescript
|
|
2857
|
+
* interface Data {
|
|
2858
|
+
* created: Date;
|
|
2859
|
+
* }
|
|
2860
|
+
*
|
|
2861
|
+
* const json = serialize<Data>({created: new Date(1234567890123)});
|
|
2862
|
+
* //json is {created: '2009-02-13T23:31:30.123Z'}
|
|
2863
|
+
*
|
|
2864
|
+
* const jsonString = JSON.stringify(json);
|
|
2865
|
+
* //jsonString is '{"created":"2009-02-13T23:31:30.123Z"}'
|
|
2866
|
+
* ```
|
|
2867
|
+
*
|
|
2868
|
+
* @throws ValidationError when serialization or validation fails.
|
|
2869
|
+
*/
|
|
2870
|
+
declare function serialize<T>(data: T, options?: SerializationOptions, serializerToUse?: Serializer, namingStrategy?: NamingStrategy, type?: ReceiveType<T>): JSONSingle<T>;
|
|
2871
|
+
/**
|
|
2872
|
+
* Same as serialize but returns a ready to use function. Used to improve performance.
|
|
2873
|
+
*/
|
|
2874
|
+
declare function serializeFunction<T>(serializerToUse?: Serializer, namingStrategy?: NamingStrategy, type?: ReceiveType<T>): SerializeFunction<T>;
|
|
2875
|
+
/**
|
|
2876
|
+
* Clones a class instance deeply.
|
|
2877
|
+
*/
|
|
2878
|
+
declare function cloneClass<T>(target: T, options?: SerializationOptions): T;
|
|
2879
|
+
/**
|
|
2880
|
+
* Tries to deserialize given data as T, and throws an error if it's not possible or validation after conversion fails.
|
|
2881
|
+
*
|
|
2882
|
+
* @deprecated use cast() instead
|
|
2883
|
+
*
|
|
2884
|
+
* @throws ValidationError when serialization or validation fails.
|
|
2885
|
+
*/
|
|
2886
|
+
declare function validatedDeserialize<T>(data: any, options?: SerializationOptions, serializerToUse?: Serializer, namingStrategy?: NamingStrategy, type?: ReceiveType<T>): T;
|
|
2887
|
+
//#endregion
|
|
2888
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/snapshot.d.ts
|
|
2889
|
+
declare class SnapshotSerializer extends Serializer {
|
|
2890
|
+
name: string;
|
|
2891
|
+
protected registerSerializers(): void;
|
|
2892
|
+
}
|
|
2893
|
+
declare const snapshotSerializer: SnapshotSerializer;
|
|
2894
|
+
/**
|
|
2895
|
+
* Creates a new JIT compiled function to convert the class instance to a snapshot.
|
|
2896
|
+
* A snapshot is essentially the class instance as `plain` serialization while references are
|
|
2897
|
+
* stored only as their primary keys.
|
|
2898
|
+
*
|
|
2899
|
+
* Generated function is cached.
|
|
2900
|
+
*/
|
|
2901
|
+
declare function getConverterForSnapshot(reflectionClass: ReflectionClass<any>): (value: any) => any;
|
|
2902
|
+
/**
|
|
2903
|
+
* Creates a snapshot using getConverterForSnapshot().
|
|
2904
|
+
*/
|
|
2905
|
+
declare function createSnapshot<T>(reflectionClass: ReflectionClass<T>, item: T): any;
|
|
2906
|
+
/**
|
|
2907
|
+
* Extracts the primary key of a snapshot and converts to class type.
|
|
2908
|
+
*/
|
|
2909
|
+
declare function getPrimaryKeyExtractor<T>(reflectionClass: ReflectionClass<T>): (value: any) => Partial<T>;
|
|
2910
|
+
/**
|
|
2911
|
+
* Creates a primary key hash generator that takes an item from any format
|
|
2912
|
+
* converts it to class format, then to plain, then uses the primitive values to create a string hash.
|
|
2913
|
+
*
|
|
2914
|
+
* This function is designed to work on the plain values (db records or json values)
|
|
2915
|
+
*/
|
|
2916
|
+
declare function getPrimaryKeyHashGenerator(reflectionClass: ReflectionClass<any>, serializerToUse?: Serializer): (value: any) => string;
|
|
2917
|
+
declare function getSimplePrimaryKeyHashGenerator(reflectionClass: ReflectionClass<any>): (data: PrimaryKeyFields<any>) => string;
|
|
2918
|
+
//#endregion
|
|
2919
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/typeguard.d.ts
|
|
2920
|
+
/**
|
|
2921
|
+
* ```typescript
|
|
2922
|
+
* const validator = getValidatorFunction<MyType>();
|
|
2923
|
+
*
|
|
2924
|
+
* const errors: ValidationErrorItem[] = [];
|
|
2925
|
+
* const valid = validator(data, {errors})
|
|
2926
|
+
*
|
|
2927
|
+
* if (errors.length) console.log(errors); //validation failed if not empty
|
|
2928
|
+
* ```
|
|
2929
|
+
*/
|
|
2930
|
+
declare function getValidatorFunction<T>(serializerToUse?: Serializer, receiveType?: ReceiveType<T>): Guard<T>;
|
|
2931
|
+
declare function is<T>(data: any, serializerToUse?: Serializer, errors?: ValidationErrorItem[], receiveType?: ReceiveType<T>): data is T;
|
|
2932
|
+
declare function guard<T>(serializerToUse?: Serializer, receiveType?: ReceiveType<T>): Guard<T>;
|
|
2933
|
+
/**
|
|
2934
|
+
* @throws ValidationError when type is invalid.
|
|
2935
|
+
*/
|
|
2936
|
+
declare function assert<T>(data: any, serializerToUse?: Serializer, receiveType?: ReceiveType<T>): asserts data is T;
|
|
2937
|
+
//#endregion
|
|
2938
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/types.d.ts
|
|
2939
|
+
type AutoId = number & PrimaryKey & AutoIncrement & Positive;
|
|
2940
|
+
//#endregion
|
|
2941
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/validators.d.ts
|
|
2942
|
+
declare const validators: { [name in string]?: (...args: any[]) => (value: any) => ValidatorError | undefined };
|
|
2943
|
+
//#endregion
|
|
2944
|
+
//#region ../../node_modules/.pnpm/@deepkit+type@1.0.5_patch_hash=b103dd6f0287e0e911c8eda19b8f7147926ed1313aee24aa43566163_7860537665a0856c25274a46f4912f7a/node_modules/@deepkit/type/dist/cjs/src/reflection/extends.d.ts
|
|
2945
|
+
type AssignableType = Type | string | boolean | number | symbol | bigint | undefined | null;
|
|
2946
|
+
type StackEntry = {
|
|
2947
|
+
left: Type;
|
|
2948
|
+
right: Type;
|
|
2949
|
+
};
|
|
2950
|
+
/**
|
|
2951
|
+
* The check of `extends` in Typescript. This function can be read as `left extends right`.
|
|
2952
|
+
*
|
|
2953
|
+
* See https://www.typescriptlang.org/docs/handbook/type-compatibility.html#any-unknown-object-void-undefined-null-and-never-assignability
|
|
2954
|
+
* This algo follows strict mode.
|
|
2955
|
+
*
|
|
2956
|
+
* Warning: If you do not pass Type objects, typeInfer() is used which does not use cache (it is designed to be called withing type processor)
|
|
2957
|
+
*/
|
|
2958
|
+
declare function isExtendable(leftValue: AssignableType, rightValue: AssignableType, extendStack?: StackEntry[]): boolean;
|
|
2959
|
+
declare function _isExtendable(left: Type, right: Type, extendStack?: StackEntry[]): boolean;
|
|
2960
|
+
/**
|
|
2961
|
+
* We don't want to embed in each and every file the type definition of Promise<t>,
|
|
2962
|
+
* so we do it ondemand at runtime instead. This saves bundle size.
|
|
2963
|
+
*/
|
|
2964
|
+
declare function createPromiseObjectLiteral(type: TypePromise): TypeObjectLiteral;
|
|
2965
|
+
declare function parametersToTuple(parameters: TypeParameter[]): TypeTuple;
|
|
2966
|
+
declare function extendTemplateLiteral(left: TypeLiteral | TypeTemplateLiteral, right: TypeTemplateLiteral): boolean;
|
|
2967
|
+
//#endregion
|
|
2968
|
+
export { resolvePath as $, TypeParameter as $a, Entity as $i, PositiveNoZero as $n, getMember as $o, serializePropertyOrParameter as $r, primaryKeyAnnotation as $s, ReflectionProperty as $t, JSONPartial as A, TypeAnnotations as Aa, SerializedTypeTypeParameter as Ai, AfterDate as An, dataAnnotation as Ao, deserializeEmbedded as Ar, isMember as As, TypedArray as At, ReferenceItemInfo as B, TypeEnumMember as Ba, AutoIncrement as Bi, Excludes as Bn, float as Bo, getNameExpression as Br, isRuntime as Bs, typeSettings as Bt, getPatchSerializeFunction as C, ReflectionVisibility as Ca, NumberFields as Cc, SerializedTypeProperty as Ci, encodeOps as Cn, assertType as Co, TypeGuardRegistry as Cr, isDateType as Cs, createClassDecoratorContext as Ct, validatedDeserialize as D, SqliteOptions as Da, SerializedTypeTemplateLiteral as Di, resolveRuntimeType as Dn, binaryTypes as Do, createConverterJSForMember as Dr, isIntegerType as Ds, isDecoratorContext as Dt, serializeFunction as E, SignedBinaryBigInt as Ea, changeSetSymbol as Ec, SerializedTypeRest as Ei, resolvePacked as En, binaryBigIntAnnotation as Eo, collapsePath as Er, isIgnore as Es, createPropertyDecoratorContext as Et, stringifyUuid as F, TypeBoolean as Fa, deserializeType as Fi, BeforeDate as Fn, entityAnnotation as Fo, forwardSetToArray as Fr, isPrimitive as Fs, arrayBufferToBase64 as Ft, getReferenceItemInfo as G, TypeLiteral as Ga, BinaryBigIntType as Gi, Maximum as Gn, getAnnotations as Go, getSetTypeToArray as Gr, isTypeIncluded as Gs, genericEqual as Gt, createReferenceClass as H, TypeIndexSignature as Ha, BackReferenceOptions as Hi, ExclusiveMinimum as Hn, float64 as Ho, getPartialType as Hr, isSetType as Hs, typedArrayToBuffer as Ht, uuid as I, TypeCallSignature as Ia, serializeType as Ii, BeforeNow as In, excludedAnnotation as Io, getEmbeddedProperty as Ir, isPropertyMemberType as Is, base64ToArrayBuffer as It, markAsHydrated as J, TypeNever as Ja, DatabaseField as Ji, MultipleOf as Jn, getConstructorProperties as Jo, inAccessor as Jr, mapNameAnnotation as Js, ReceiveType as Jt, isReferenceHydrated as K, TypeMethod as Ka, CartesianProduct as Ki, MinLength as Kn, getBackReferenceType as Ko, getStaticDefaultCodeForProperty as Kr, isUUIDType as Ks, getChangeDetector as Kt, writeUuid as L, TypeClass as La, AnnotationDefinition as Li, Decimal as Ln, findMember as Lo, getIndexCheck as Lr, isPropertyType as Ls, base64ToTypedArray as Lt, JSONSingle as M, TypeArray as Ma, SerializedTypes as Mi, Alpha as Mn, defaultAnnotation as Mo, executeTypeArgumentAsArray as Mr, isNullable as Ms, UnpopulatedCheck as Mt, NoTypeReceived as N, TypeBaseMember as Na, SerializerState as Ni, Alphanumeric as Nn, embeddedAnnotation as No, extractStateToFunctionAndCallIt as Nr, isOptional as Ns, arrayBufferFrom as Nt, Binary as O, TagsReflection as Oa, SerializedTypeTuple as Oi, typeInfer as On, clearTypeJitContainer as Oo, createSerializeFunction as Or, isInternal as Os, mergeDecorator as Ot, regExpFromString as P, TypeBigInt as Pa, SimpleSerializedType as Pi, Ascii as Pn, emptyObject as Po, forwardMapToArray as Pr, isPrimaryKeyType as Ps, arrayBufferTo as Pt, pathResolver as Q, TypeObjectLiteral as Qa, EmbeddedOptions as Qi, Positive as Qn, getKeyType as Qo, serializeObjectLiteral as Qr, narrowOriginalLiteral as Qs, ReflectionParameter as Qt, TypeRegistry as R, TypeDecorator as Ra, AnnotationType as Ri, EMAIL_REGEX as Rn, flatten as Ro, getMapTypeToArray as Rr, isReadonly as Rs, nodeBufferToArrayBuffer as Rt, deserializeFunction as S, ReflectionKind as Sa, ItemChanges as Sc, SerializedTypePromise as Si, RuntimeStackEntry as Sn, applyScheduledAnnotations as So, TemplateState as Sr, isCustomTypeClass as Ss, UnionToIntersection$1 as St, serialize as T, SQLite as Ta, atomicChange as Tc, SerializedTypeReference as Ti, pack as Tn, backReferenceAnnotation as To, callExtractedFunctionIfAvailable as Tr, isHidden as Ts, createFreeDecoratorContext as Tt, getOrCreateReferenceItemInfo as U, TypeInfer as Ua, BackReferenceOptionsResolved as Ui, Includes as Un, getAlias as Uo, getPropertyNameString as Ur, isType as Us, unpopulatedSymbol as Ut, createReference as V, TypeFunction as Va, BackReference as Vi, ExclusiveMaximum as Vn, float32 as Vo, getPartialSerializeFunction as Vr, isSameType as Vs, typedArrayToBase64 as Vt, getReferenceInfo as W, TypeIntersection as Wa, BinaryBigInt as Wi, MaxLength as Wn, getAnnotationMeta as Wo, getSerializeFunction as Wr, isTypeClassOf as Ws, buildChanges as Wt, referenceSymbol as X, TypeNumber as Xa, Embedded as Xi, NegativeNoZero as Xn, getDomain as Xo, serializableKinds as Xr, merge as Xs, ReflectionFunction as Xt, referenceItemSymbol as Y, TypeNull as Ya, DatabaseFieldOptions as Yi, Negative as Yn, getDeepConstructorProperties as Yo, noopTemplate as Yr, memberNameToString as Ys, ReflectionClass as Yt, Resolver as Z, TypeObject as Za, EmbeddedMeta as Zi, Pattern as Zn, getEnumValueIndexMatcher as Zo, serializeArray as Zr, mongoIdAnnotation as Zs, ReflectionMethod as Zt, snapshotSerializer as _, PrimaryKeyType as _a, AtomicChangeInstance as _c, SerializedTypeLiteral as _i, visit as _n, Unique as _o, SerializeFunction as _r, integer as _s, FreeFluidDecorator as _t, parametersToTuple as a, IndexOptions as aa, stringifyShortResolvedType as ac, underscoreNamingStrategy as ai, propertiesOf as an, TypeString as ao, ValidatorMeta as ar, getTypeObjectLiteralFromTypeClass as as, APIClass as at, cloneClass as b, ReferenceFields as ba, DeepPartial as bc, SerializedTypeObjectLiteral as bi, Processor as bn, addType as bo, TemplateHook as br, isBinary as bs, PropertyDecoratorFn as bt, assert as c, MapName as ca, typeDecorators as cc, SerializedTypeAnnotations as ci, reflectionClassSymbol as cn, TypeTuple as co, validates as cr, hasDefaultValue as cs, ClassDecoratorFn as ct, is as d, MySQLOptions as da, uint32 as dc, SerializedTypeClassType as di, resolveClassType as dn, TypeUndefined as do, Guard as dr, hasTypeInformation as ds, DualDecorator as dt, EntityOptions as ea, referenceAnnotation as ec, serializer as ei, SerializerFn as en, TypePromise as eo, Validate as er, getPermission as es, mixin as et, createSnapshot as f, ParentLessType as fa, uint8 as fc, SerializedTypeEnum as fi, resolveForeignReflectionClass as fn, TypeUnion as fo, JitStack as fr, indexAccess as fs, ExtractApiDataType as ft, getSimplePrimaryKeyHashGenerator as g, PrimaryKeyFields as ga, widenLiteral as gc, SerializedTypeIntersection as gi, valuesOf as gn, UUIDAnnotation as go, SerializationOptions as gr, int8 as gs, FreeDecoratorResult as gt, getPrimaryKeyHashGenerator as h, PrimaryKey as ha, validationAnnotation as hc, SerializedTypeInfer as hi, typeOf as hn, UUID as ho, SerializationError as hr, int32 as hs, FreeDecoratorFn as ht, isExtendable as i, Index as ia, stringifyResolvedType as ic, typeGuardObjectLiteral as ii, hasCircularReference as in, TypeRest as io, ValidatorError as ir, getTypeJitContainer as is, t as it, JSONPartialObject as j, TypeAny as ja, SerializedTypeUnion as ji, AfterNow as jn, databaseAnnotation as jo, executeTemplates as jr, isMongoIdType as js, TypedArrayClassType as jt, JSONEntity as k, Type as ka, SerializedTypeTupleMember as ki, unpack as kn, copyAndSetParent as ko, createTypeGuardFunction as kr, isMapType as ks, TypeSettings as kt, getValidatorFunction as l, MongoId as la, typeToObject as lc, SerializedTypeArray as li, removeNominal as ln, TypeTupleMember as lo, ContainerAccessor as lr, hasEmbedded as ls, ClassDecoratorResult as lt, getPrimaryKeyExtractor as m, PostgresOptions as ma, uuidAnnotation as mc, SerializedTypeIndexSignature as mi, toSignature as mn, TypeVoid as mo, RuntimeCode as mr, int16 as ms, FluidDecorator as mt, createPromiseObjectLiteral as n, FindType as na, resolveProperty as nc, typeGuardArray as ni, getNominalId as nn, TypePropertySignature as no, ValidationError as nr, getTags as ns, entity as nt, validators as o, InlineRuntimeType as oa, stringifyType as oc, validatePropertyOrParameter as oi, reflect as on, TypeSymbol as oo, validate as or, getValueType as os, APIProperty as ot, getConverterForSnapshot as p, Postgres as pa, unboxUnion as pc, SerializedTypeFunction as pi, resolveReceiveType as pn, TypeUnknown as po, NamingStrategy as pr, indexAnnotation as ps, ExtractClass as pt, isReferenceInstance as q, TypeMethodSignature as qa, Data as qi, Minimum as qn, getClassType as qo, handleUnion as qr, isWithAnnotations as qs, EntityData as qt, extendTemplateLiteral as r, Group as ra, resolveTypeMembers as rc, typeGuardEmbedded as ri, getProperty as rn, TypeRegexp as ro, ValidationErrorItem as rr, getTitle as rs, isWithDeferredDecorators as rt, AutoId as s, JitContainer as sa, typeAnnotation as sc, SerializedType as si, reflectOrUndefined as sn, TypeTemplateLiteral as so, validateFunction as sr, groupAnnotation as ss, ClassApiTypeInterface as st, _isExtendable as t, Excluded as ta, registerTypeDecorator as tc, sortSignatures as ti, TData as tn, TypeProperty as to, ValidateFunction as tr, getReferenceType as ts, defaultValue as tt, guard as u, MySQL as ua, uint16 as uc, SerializedTypeBaseMember as ui, removeTypeName as un, TypeTypeParameter as uo, EmptySerializer as ur, hasMember as us, DecoratorAndFetchSignature as ut, cast as v, Reference as va, Changes as vc, SerializedTypeMethod as vi, PackStruct as vn, Widen as vo, Serializer as vr, isAutoIncrementType as vs, Merge as vt, patch as w, ResetAnnotation as wa, Partial$1 as wc, SerializedTypePropertySignature as wi, getEnumType as wn, autoIncrementAnnotation as wo, buildFunction as wr, isGlobalTypeClass as ws, createFluidDecorator as wt, deserialize as x, ReferenceOptions as xa, Expression as xc, SerializedTypeParameter as xi, ReflectOptions as xn, annotateClass as xo, TemplateRegistry as xr, isBinaryBigIntType as xs, PropertyDecoratorResult as xt, castFunction as y, ReferenceActions as ya, ChangesInterface as yc, SerializedTypeMethodSignature as yi, Packed as yn, WithAnnotations as yo, Template as yr, isBackReferenceType as ys, PropertyApiTypeInterface as yt, ReferenceInfo as z, TypeEnum as za, Annotations as zi, Email as zn, flattenUnionTypes as zo, getNTypeToArray as zr, isReferenceType as zs, nodeBufferToTypedArray as zt };
|
|
2969
|
+
//# sourceMappingURL=type-8AL5U7vn.d.cts.map
|