@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,511 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/cjs/src/core.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Makes sure the error once printed using console.log contains the actual class name.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```
|
|
7
|
+
* class MyApiError extends CustomerError {}
|
|
8
|
+
*
|
|
9
|
+
* throw MyApiError() // prints MyApiError instead of simply "Error".
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
declare class CustomError extends Error {
|
|
15
|
+
name: string;
|
|
16
|
+
constructor(...args: any[]);
|
|
17
|
+
}
|
|
18
|
+
interface CustomError {
|
|
19
|
+
cause?: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
interface ClassType<T = any> {
|
|
25
|
+
new (...args: any[]): T;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
type AbstractClassType<T = any> = abstract new (...args: any[]) => T;
|
|
31
|
+
type ExtractClassType<T> = T extends AbstractClassType<infer K> ? K : never;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the class name either of the class definition or of the class of an instance.
|
|
34
|
+
*
|
|
35
|
+
* Note when code is minimized/uglified this output will change. You should disable in your compile the
|
|
36
|
+
* className modification.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* class User {}
|
|
41
|
+
*
|
|
42
|
+
* expect(getClassName(User)).toBe('User');
|
|
43
|
+
* expect(getClassName(new User())).toBe('User');
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
declare function getClassName<T>(classTypeOrInstance: ClassType<T> | Object): string;
|
|
49
|
+
/**
|
|
50
|
+
* Same as getClassName but appends the propertyName.
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
declare function getClassPropertyName<T>(classType: ClassType<T> | Object, propertyName: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
declare function applyDefaults<T>(classType: ClassType<T>, target: {
|
|
58
|
+
[k: string]: any;
|
|
59
|
+
}): T;
|
|
60
|
+
/**
|
|
61
|
+
* Tries to identify the object by normalised result of Object.toString(obj).
|
|
62
|
+
*/
|
|
63
|
+
declare function identifyType(obj: any): string;
|
|
64
|
+
/**
|
|
65
|
+
* Returns true if the given obj is a plain object, and no class instance.
|
|
66
|
+
*
|
|
67
|
+
* isPlainObject(\{\}) === true
|
|
68
|
+
* isPlainObject(new ClassXY) === false
|
|
69
|
+
*
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
declare function isPlainObject(obj: any): obj is object;
|
|
73
|
+
/**
|
|
74
|
+
* Returns the ClassType for a given instance.
|
|
75
|
+
*/
|
|
76
|
+
declare function getClassTypeFromInstance<T>(target: T): ClassType<T>;
|
|
77
|
+
/**
|
|
78
|
+
* Returns true when target is a class instance.
|
|
79
|
+
*/
|
|
80
|
+
declare function isClassInstance(target: any): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Returns a human-readable string representation from the given value.
|
|
83
|
+
*/
|
|
84
|
+
declare function stringifyValueWithType(value: any, depth?: number): string;
|
|
85
|
+
/**
|
|
86
|
+
* Changes the class of a given instance and returns the new object.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
*
|
|
91
|
+
* class Model1 {
|
|
92
|
+
* id: number = 0;
|
|
93
|
+
* }
|
|
94
|
+
*
|
|
95
|
+
* class Model2 {
|
|
96
|
+
* id: number = 0;
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* const model1 = new Model1();
|
|
100
|
+
* const model2 = changeClass(model1, Model2);
|
|
101
|
+
* model2 instanceof Model2; //true
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
declare function changeClass<T>(value: object, newClass: ClassType<T>): T;
|
|
105
|
+
declare function prettyPrintObject(object: object, depth?: number): string;
|
|
106
|
+
/**
|
|
107
|
+
* Returns true if given obj is a function.
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
declare function isFunction(obj: any): obj is Function;
|
|
112
|
+
declare const AsyncFunction: {
|
|
113
|
+
new (...args: string[]): Function;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Returns true if given obj is a async function.
|
|
117
|
+
*
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
declare function isAsyncFunction(obj: any): obj is (...args: any[]) => Promise<any>;
|
|
121
|
+
/**
|
|
122
|
+
* Returns true if given obj is a promise like object.
|
|
123
|
+
*
|
|
124
|
+
* Note: There's not way to check if it's actually a Promise using instanceof since
|
|
125
|
+
* there are a lot of different implementations around.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
declare function isPromise<T>(obj: any | Promise<T>): obj is Promise<T>;
|
|
130
|
+
/**
|
|
131
|
+
* Returns true if given obj is a ES6 class (ES5 fake classes are not supported).
|
|
132
|
+
*
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
declare function isClass(obj: any): obj is AbstractClassType;
|
|
136
|
+
declare function isGlobalClass(obj: any): obj is AbstractClassType;
|
|
137
|
+
/**
|
|
138
|
+
* Returns true for real objects: object literals ({}) or class instances (new MyClass).
|
|
139
|
+
*
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
142
|
+
declare function isObject(obj: any): obj is {
|
|
143
|
+
[key: string]: any;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Returns true if given obj is a plain object, and no Date, Array, Map, Set, etc.
|
|
147
|
+
*
|
|
148
|
+
* This is different to isObject and used in the type system to differentiate
|
|
149
|
+
* between JS objects in general and what we define as ReflectionKind.objectLiteral.
|
|
150
|
+
* Since we have Date, Set, Map, etc. in the type system, we need to differentiate
|
|
151
|
+
* between them and all other object literals.
|
|
152
|
+
*/
|
|
153
|
+
declare function isObjectLiteral(obj: any): obj is {
|
|
154
|
+
[key: string]: any;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
declare const isArray: (obj: any) => obj is any[];
|
|
160
|
+
/**
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
163
|
+
declare function isNull(obj: any): obj is null;
|
|
164
|
+
/**
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
declare function isUndefined(obj: any): obj is undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Checks if obj is not null and not undefined.
|
|
170
|
+
*
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
declare function isSet(obj: any): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
declare function isNumber(obj: any): obj is number;
|
|
178
|
+
/**
|
|
179
|
+
* Returns true if given value is strictly a numeric string value (or a number).
|
|
180
|
+
*
|
|
181
|
+
* ```typescript
|
|
182
|
+
* isNumeric(12); //true
|
|
183
|
+
* isNumeric('12'); //true
|
|
184
|
+
* isNumeric('12.3'); //true
|
|
185
|
+
* isNumeric('12.3 '); //false
|
|
186
|
+
* isNumeric('12px'); //false
|
|
187
|
+
* ```
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
190
|
+
declare function isNumeric(s: string | number): boolean;
|
|
191
|
+
declare const isInteger: (obj: any) => obj is number;
|
|
192
|
+
/**
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
declare function isString(obj: any): obj is string;
|
|
196
|
+
/**
|
|
197
|
+
* @public
|
|
198
|
+
*/
|
|
199
|
+
declare function indexOf<T>(array: T[], item: T): number;
|
|
200
|
+
/**
|
|
201
|
+
* @public
|
|
202
|
+
*/
|
|
203
|
+
declare function sleep(seconds: number): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* Creates a shallow copy of given array.
|
|
206
|
+
*
|
|
207
|
+
* @public
|
|
208
|
+
*/
|
|
209
|
+
declare function copy<T>(v: T[]): T[];
|
|
210
|
+
/**
|
|
211
|
+
* Checks whether given array or object is empty (no keys). If given object is falsy, returns false.
|
|
212
|
+
*
|
|
213
|
+
* @public
|
|
214
|
+
*/
|
|
215
|
+
declare function empty<T>(value?: T[] | object | {}): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Returns the size of given array or object.
|
|
218
|
+
*
|
|
219
|
+
* @public
|
|
220
|
+
*/
|
|
221
|
+
declare function size<T>(array: T[] | {
|
|
222
|
+
[key: string]: T;
|
|
223
|
+
}): number;
|
|
224
|
+
/**
|
|
225
|
+
* Returns the first key of a given object.
|
|
226
|
+
*
|
|
227
|
+
* @public
|
|
228
|
+
*/
|
|
229
|
+
declare function firstKey(v: {
|
|
230
|
+
[key: string]: any;
|
|
231
|
+
} | object): string | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* Returns the last key of a given object.
|
|
234
|
+
*
|
|
235
|
+
* @public
|
|
236
|
+
*/
|
|
237
|
+
declare function lastKey(v: {
|
|
238
|
+
[key: string]: any;
|
|
239
|
+
} | object): string | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* Returns the first value of given array or object.
|
|
242
|
+
*
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
declare function first<T>(v: {
|
|
246
|
+
[key: string]: T;
|
|
247
|
+
} | T[]): T | undefined;
|
|
248
|
+
/**
|
|
249
|
+
* Returns the last value of given array or object.
|
|
250
|
+
*
|
|
251
|
+
* @public
|
|
252
|
+
*/
|
|
253
|
+
declare function last<T>(v: {
|
|
254
|
+
[key: string]: T;
|
|
255
|
+
} | T[]): T | undefined;
|
|
256
|
+
/**
|
|
257
|
+
* Returns the average of a number array.
|
|
258
|
+
*
|
|
259
|
+
* @public
|
|
260
|
+
*/
|
|
261
|
+
declare function average(array: number[]): number;
|
|
262
|
+
/**
|
|
263
|
+
* @public
|
|
264
|
+
*/
|
|
265
|
+
declare function prependObjectKeys(o: {
|
|
266
|
+
[k: string]: any;
|
|
267
|
+
}, prependText: string): {
|
|
268
|
+
[k: string]: any;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* @public
|
|
272
|
+
*/
|
|
273
|
+
declare function appendObject(origin: {
|
|
274
|
+
[k: string]: any;
|
|
275
|
+
}, extend: {
|
|
276
|
+
[k: string]: any;
|
|
277
|
+
}, prependKeyName?: string): void;
|
|
278
|
+
/**
|
|
279
|
+
* A better alternative to "new Promise()" that supports error handling and maintains the stack trace for Error.stack.
|
|
280
|
+
*
|
|
281
|
+
* When you use `new Promise()` you need to wrap your code inside a try-catch to call `reject` on error.
|
|
282
|
+
* asyncOperation() does this automatically.
|
|
283
|
+
*
|
|
284
|
+
* When you use `new Promise()` you will lose the stack trace when `reject(new Error())` is called.
|
|
285
|
+
* asyncOperation() makes sure the error stack trace is the correct one.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* await asyncOperation(async (resolve, reject) => {
|
|
290
|
+
* await doSomething(); //if this fails, reject() will automatically be called
|
|
291
|
+
* stream.on('data', (data) => {
|
|
292
|
+
* resolve(data); //at some point you MUST call resolve(data)
|
|
293
|
+
* });
|
|
294
|
+
* });
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
297
|
+
* @public
|
|
298
|
+
* @reflection never
|
|
299
|
+
*/
|
|
300
|
+
declare function asyncOperation<T>(executor: (resolve: (value: T) => void, reject: (error: any) => void) => void | Promise<void>): Promise<T>;
|
|
301
|
+
/**
|
|
302
|
+
* When an API is called that returns a promise that loses the stack trace on error, you can use fixAsyncOperation().
|
|
303
|
+
*
|
|
304
|
+
* ```typescript
|
|
305
|
+
* cons storage = new BrokenPromiseStorage();
|
|
306
|
+
* const files = await fixAsyncOperation(storage.files('/'));
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
declare function fixAsyncOperation<T>(promise: Promise<T>): Promise<T>;
|
|
310
|
+
/**
|
|
311
|
+
* @public
|
|
312
|
+
*/
|
|
313
|
+
declare function mergePromiseStack<T>(promise: Promise<T>, stack?: string): Promise<T>;
|
|
314
|
+
/**
|
|
315
|
+
* @beta
|
|
316
|
+
*/
|
|
317
|
+
declare function createStack(removeCallee?: boolean): string;
|
|
318
|
+
/**
|
|
319
|
+
* @beta
|
|
320
|
+
*/
|
|
321
|
+
declare function mergeStack(error: Error, stack: string): void;
|
|
322
|
+
/**
|
|
323
|
+
* Makes sure the given value is an error. If it's not an error, it creates a new error with the given value as message.
|
|
324
|
+
*/
|
|
325
|
+
declare function ensureError(error?: any, classType?: ClassType): Error;
|
|
326
|
+
declare function collectForMicrotask<T>(callback: (args: T[]) => void): (arg: T) => void;
|
|
327
|
+
/**
|
|
328
|
+
* Returns the current time as seconds.
|
|
329
|
+
*
|
|
330
|
+
* @public
|
|
331
|
+
*/
|
|
332
|
+
declare function time(): number;
|
|
333
|
+
/**
|
|
334
|
+
* @public
|
|
335
|
+
*/
|
|
336
|
+
declare function getPathValue(bag: {
|
|
337
|
+
[field: string]: any;
|
|
338
|
+
}, parameterPath: string, defaultValue?: any): any;
|
|
339
|
+
/**
|
|
340
|
+
* @public
|
|
341
|
+
*/
|
|
342
|
+
declare function setPathValue(bag: object, parameterPath: string, value: any): void;
|
|
343
|
+
/**
|
|
344
|
+
* @public
|
|
345
|
+
*/
|
|
346
|
+
declare function deletePathValue(bag: object, parameterPath: string): void;
|
|
347
|
+
/**
|
|
348
|
+
* Returns the human-readable byte representation.
|
|
349
|
+
*
|
|
350
|
+
* @public
|
|
351
|
+
*/
|
|
352
|
+
declare function humanBytes(bytes: number, si?: boolean): string;
|
|
353
|
+
/**
|
|
354
|
+
* Returns the number of properties on `obj`. This is 20x faster than Object.keys(obj).length.
|
|
355
|
+
*/
|
|
356
|
+
declare function getObjectKeysSize(obj: object): number;
|
|
357
|
+
declare function isConstructable(fn: any): boolean;
|
|
358
|
+
declare function isPrototypeOfBase(prototype: AbstractClassType | undefined, base: ClassType): boolean;
|
|
359
|
+
declare function getParentClass(classType: ClassType): ClassType | undefined;
|
|
360
|
+
declare function getInheritanceChain(classType: ClassType): ClassType[];
|
|
361
|
+
declare function inDebugMode(): boolean;
|
|
362
|
+
/**
|
|
363
|
+
* Create a new class with the given name.
|
|
364
|
+
* This is currently the only know way to make it workable in browsers too.
|
|
365
|
+
*/
|
|
366
|
+
declare function createDynamicClass(name: string, base?: ClassType): ClassType;
|
|
367
|
+
declare function isIterable(value: any): boolean;
|
|
368
|
+
declare function iterableSize(value: Array<unknown> | Set<unknown> | Map<unknown, unknown>): number;
|
|
369
|
+
/**
|
|
370
|
+
* Returns __filename, works in both cjs and esm.
|
|
371
|
+
*/
|
|
372
|
+
declare function getCurrentFileName(): string;
|
|
373
|
+
/**
|
|
374
|
+
* Escape special characters in a regex string, so it can be used as a literal string.
|
|
375
|
+
*/
|
|
376
|
+
declare function escapeRegExp(string: string): string;
|
|
377
|
+
declare function hasProperty(object: any, property: any): boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Returns an iterator of numbers from start (inclusive) to stop (exclusive) by step.
|
|
380
|
+
*/
|
|
381
|
+
declare function range(startOrLength: number, stop?: number, step?: number): IterableIterator<number>;
|
|
382
|
+
/**
|
|
383
|
+
* Returns an array of numbers from start (inclusive) to stop (exclusive) by step.
|
|
384
|
+
*
|
|
385
|
+
* Works the same as python's range function.
|
|
386
|
+
*/
|
|
387
|
+
declare function rangeArray(startOrLength: number, stop?: number, step?: number): number[];
|
|
388
|
+
/**
|
|
389
|
+
* Returns a combined array of the given arrays.
|
|
390
|
+
*
|
|
391
|
+
* Works the same as python's zip function.
|
|
392
|
+
*/
|
|
393
|
+
declare function zip<T extends (readonly unknown[])[]>(...args: T): { [K in keyof T]: T[K] extends (infer V)[] ? V : never }[];
|
|
394
|
+
/**
|
|
395
|
+
* Forwards the runtime type arguments from function x to function y.
|
|
396
|
+
* This is necessary when a generic function is overridden and forwarded to something else.
|
|
397
|
+
*
|
|
398
|
+
* ```typescript
|
|
399
|
+
* let generic = <T>(type?: ReceiveType<T>) => undefined;
|
|
400
|
+
*
|
|
401
|
+
* let forwarded<T> = () => {
|
|
402
|
+
* forwardTypeArguments(forwarded, generic); //all type arguments are forwarded to generic()
|
|
403
|
+
* generic(); //call as usual
|
|
404
|
+
* }
|
|
405
|
+
*
|
|
406
|
+
* forwarded<any>(); //generic receives any in runtime.
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* Note that generic.bind(this) will not work, as bind() creates a new function and forwarded type arguments can not
|
|
410
|
+
* reach the original function anymore.
|
|
411
|
+
*
|
|
412
|
+
* ```typescript
|
|
413
|
+
* let forwarded<T> = () => {
|
|
414
|
+
* const bound = generic.bind(this);
|
|
415
|
+
* forwardTypeArguments(forwarded, bound); //can not be forwarded anymore
|
|
416
|
+
* bound(); //fails
|
|
417
|
+
* }
|
|
418
|
+
* ```
|
|
419
|
+
*
|
|
420
|
+
* This is a limitation of JavaScript. In this case you have to manually forward type arguments.
|
|
421
|
+
*
|
|
422
|
+
* ```typescript
|
|
423
|
+
* let forwarded<T> = (type?: ReceiveType<T>) => {
|
|
424
|
+
* const bound = generic.bind(this);
|
|
425
|
+
* bound(type);
|
|
426
|
+
* }
|
|
427
|
+
* ```
|
|
428
|
+
*/
|
|
429
|
+
declare function forwardTypeArguments(x: any, y: any): void;
|
|
430
|
+
declare function formatError(error: any, withStack?: boolean): string;
|
|
431
|
+
/**
|
|
432
|
+
* Asserts that the given object is an instance of the given class.
|
|
433
|
+
*/
|
|
434
|
+
declare function assertInstanceOf<T>(object: any, constructor: {
|
|
435
|
+
new (...args: any[]): T;
|
|
436
|
+
}): asserts object is T;
|
|
437
|
+
/**
|
|
438
|
+
* Asserts that the given value is defined (not null and not undefined).
|
|
439
|
+
*/
|
|
440
|
+
declare function assertDefined<T>(value: T): asserts value is NonNullable<T>;
|
|
441
|
+
declare type __ΩCustomError = any[];
|
|
442
|
+
declare type __ΩClassType = any[];
|
|
443
|
+
declare type __ΩAbstractClassType = any[];
|
|
444
|
+
declare type __ΩExtractClassType = any[];
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/cjs/src/compiler.d.ts
|
|
447
|
+
declare class CompilerContext {
|
|
448
|
+
readonly context: Map<string, any>;
|
|
449
|
+
protected constVariables: Map<any, string>;
|
|
450
|
+
maxReservedVariable: number;
|
|
451
|
+
protected reservedNames: Set<string>;
|
|
452
|
+
protected variableContext: {
|
|
453
|
+
[name: string]: any;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* Code that is executed in the context, but before the actual function is generated.
|
|
457
|
+
* This helps for example to initialize dynamically some context variables.
|
|
458
|
+
*/
|
|
459
|
+
preCode: string;
|
|
460
|
+
initialiseVariables: string[];
|
|
461
|
+
config: {
|
|
462
|
+
indent: boolean;
|
|
463
|
+
};
|
|
464
|
+
constructor(config?: Partial<CompilerContext['config']>);
|
|
465
|
+
reserveName(name: string): string;
|
|
466
|
+
set(values: {
|
|
467
|
+
[name: string]: any;
|
|
468
|
+
}): void;
|
|
469
|
+
/**
|
|
470
|
+
* Returns always the same variable name for the same value.
|
|
471
|
+
* The variable name should not be set afterwards.
|
|
472
|
+
*/
|
|
473
|
+
reserveConst(value: any, name?: string): string;
|
|
474
|
+
reserveVariable(name?: string, value?: any): string;
|
|
475
|
+
raw(functionCode: string): Function;
|
|
476
|
+
protected format(code: string): string;
|
|
477
|
+
build(functionCode: string, ...args: string[]): any;
|
|
478
|
+
buildAsync(functionCode: string, ...args: string[]): Function;
|
|
479
|
+
}
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region ../../node_modules/.pnpm/@deepkit+core@1.0.5_patch_hash=8c3beca4372c6a8941162780ddd0f977ef3d461c2018f0809f86f416260ba440/node_modules/@deepkit/core/dist/cjs/src/types.d.ts
|
|
482
|
+
/**
|
|
483
|
+
* Type to use for custom type annotations.
|
|
484
|
+
*
|
|
485
|
+
* Adds runtime meta information to a type without influencing the type itself.
|
|
486
|
+
* This is like an intrinsic type, but only for runtime.
|
|
487
|
+
*
|
|
488
|
+
* ```typescript
|
|
489
|
+
* import { TypeAnnotation } from '@deepkit/core';
|
|
490
|
+
* import { typeAnnotation } from '@deepkit/type';
|
|
491
|
+
*
|
|
492
|
+
* type PrimaryKey = TypeAnnotation<'primaryKey'>;
|
|
493
|
+
* type UserId = string & PrimaryKey;
|
|
494
|
+
*
|
|
495
|
+
* const type = typeOf<UserId>();
|
|
496
|
+
* const metaData = typeAnnotation.getType(type, 'primaryKey');
|
|
497
|
+
* ```
|
|
498
|
+
*
|
|
499
|
+
* Runtime type is `{ __meta?: never & [T, Options] };`
|
|
500
|
+
*
|
|
501
|
+
* @intrinsic
|
|
502
|
+
*/
|
|
503
|
+
type TypeAnnotation<T extends string, Options = never> = unknown;
|
|
504
|
+
type InjectMeta<T = never> = TypeAnnotation<'inject', T>;
|
|
505
|
+
type Inject<Type, Token = never> = Type & InjectMeta<Token>;
|
|
506
|
+
declare type __ΩTypeAnnotation = any[];
|
|
507
|
+
declare type __ΩInjectMeta = any[];
|
|
508
|
+
declare type __ΩInject = any[];
|
|
509
|
+
//#endregion
|
|
510
|
+
export { isClassInstance as $, ensureError as A, zip as At, getCurrentFileName as B, changeClass as C, range as Ct, createStack as D, sleep as Dt, createDynamicClass as E, size as Et, formatError as F, hasProperty as G, getObjectKeysSize as H, forwardTypeArguments as I, inDebugMode as J, humanBytes as K, getClassName as L, first as M, firstKey as N, deletePathValue as O, stringifyValueWithType as Ot, fixAsyncOperation as P, isClass as Q, getClassPropertyName as R, average as S, prettyPrintObject as St, copy as T, setPathValue as Tt, getParentClass as U, getInheritanceChain as V, getPathValue as W, isArray as X, indexOf as Y, isAsyncFunction as Z, appendObject as _, last as _t, __ΩInjectMeta as a, isNull as at, assertInstanceOf as b, mergeStack as bt, AbstractClassType as c, isObject as ct, CustomError as d, isPromise as dt, isConstructable as et, ExtractClassType as f, isPrototypeOfBase as ft, __ΩExtractClassType as g, iterableSize as gt, __ΩCustomError as h, isUndefined as ht, __ΩInject as i, isIterable as it, escapeRegExp as j, empty as k, time as kt, AsyncFunction as l, isObjectLiteral as lt, __ΩClassType as m, isString as mt, InjectMeta as n, isGlobalClass as nt, __ΩTypeAnnotation as o, isNumber as ot, __ΩAbstractClassType as p, isSet as pt, identifyType as q, TypeAnnotation as r, isInteger as rt, CompilerContext as s, isNumeric as st, Inject as t, isFunction as tt, ClassType as u, isPlainObject as ut, applyDefaults as v, lastKey as vt, collectForMicrotask as w, rangeArray as wt, asyncOperation as x, prependObjectKeys as xt, assertDefined as y, mergePromiseStack as yt, getClassTypeFromInstance as z };
|
|
511
|
+
//# sourceMappingURL=types-Bb6lL3KL.d.cts.map
|
package/dist/types.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { S as SerializedTypes } from "./reflection-
|
|
1
|
+
import { S as SerializedTypes } from "./reflection-DGOuMF8F.cjs";
|
|
2
|
+
import { Yt as ReflectionClass } from "./type-8AL5U7vn.cjs";
|
|
2
3
|
|
|
3
4
|
//#region src/types.d.ts
|
|
4
5
|
type Reflection<T extends Record<string, any> = Record<string, any>> = ReflectionClass<T> & {
|
|
@@ -7,9 +8,6 @@ type Reflection<T extends Record<string, any> = Record<string, any>> = Reflectio
|
|
|
7
8
|
};
|
|
8
9
|
type ReflectionRecord<T extends Record<string, any> = Record<string, any>> = Record<string, Reflection<T>>;
|
|
9
10
|
interface ContextReflectionRecord<T extends Record<string, any> = Record<string, any>> extends Record<string, Reflection<T> | ContextReflectionRecord<T>> {}
|
|
10
|
-
declare type __ΩReflection = any[];
|
|
11
|
-
declare type __ΩReflectionRecord = any[];
|
|
12
|
-
declare type __ΩContextReflectionRecord = any[];
|
|
13
11
|
//#endregion
|
|
14
|
-
export { ContextReflectionRecord, Reflection, ReflectionRecord
|
|
12
|
+
export { ContextReflectionRecord, Reflection, ReflectionRecord };
|
|
15
13
|
//# sourceMappingURL=types.d.cts.map
|
package/dist/types.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { S as SerializedTypes } from "./reflection-
|
|
1
|
+
import { S as SerializedTypes } from "./reflection-Bhe75GyI.mjs";
|
|
2
|
+
import { Yt as ReflectionClass } from "./type-BDuj5wg2.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/types.d.ts
|
|
4
5
|
type Reflection<T extends Record<string, any> = Record<string, any>> = ReflectionClass<T> & {
|
|
@@ -7,9 +8,6 @@ type Reflection<T extends Record<string, any> = Record<string, any>> = Reflectio
|
|
|
7
8
|
};
|
|
8
9
|
type ReflectionRecord<T extends Record<string, any> = Record<string, any>> = Record<string, Reflection<T>>;
|
|
9
10
|
interface ContextReflectionRecord<T extends Record<string, any> = Record<string, any>> extends Record<string, Reflection<T> | ContextReflectionRecord<T>> {}
|
|
10
|
-
declare type __ΩReflection = any[];
|
|
11
|
-
declare type __ΩReflectionRecord = any[];
|
|
12
|
-
declare type __ΩContextReflectionRecord = any[];
|
|
13
11
|
//#endregion
|
|
14
|
-
export { ContextReflectionRecord, Reflection, ReflectionRecord
|
|
12
|
+
export { ContextReflectionRecord, Reflection, ReflectionRecord };
|
|
15
13
|
//# sourceMappingURL=types.d.mts.map
|