@power-plant/schema 0.0.39 → 0.0.41
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/codegen.cjs +1 -1
- package/dist/codegen.d.cts +1 -1
- package/dist/codegen.d.mts +1 -1
- package/dist/deepkit-DPc7jHOL.cjs +10186 -0
- package/dist/deepkit-h4w2bXJ2.mjs +10156 -0
- package/dist/deepkit-h4w2bXJ2.mjs.map +1 -0
- package/dist/deepkit.cjs +11 -19
- package/dist/deepkit.d.cts +644 -1
- package/dist/deepkit.d.cts.map +1 -0
- package/dist/deepkit.d.mts +644 -1
- package/dist/deepkit.d.mts.map +1 -0
- package/dist/deepkit.mjs +2 -44
- package/dist/{helpers-Hae4JIm0.cjs → helpers-DVg8wtqZ.cjs} +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{rolldown-runtime-BbWMFyz5.cjs → rolldown-runtime-fl3r8ClO.cjs} +3 -22
- package/dist/storage/index.cjs +1 -1
- package/dist/{storage-C1R3j1aG.cjs → storage-C8Lnl5Hw.cjs} +1 -1
- package/dist/{types-BH-Q7QrB.d.cts → types-BxZqs7PE.d.mts} +4 -4
- package/dist/types-BxZqs7PE.d.mts.map +1 -0
- package/dist/{types-BrSNvUQg.d.mts → types-cHmdUpGz.d.cts} +4 -4
- package/dist/{types-BH-Q7QrB.d.cts.map → types-cHmdUpGz.d.cts.map} +1 -1
- package/dist/valibot.cjs +1 -1
- package/dist/valibot.d.cts +1 -1
- package/dist/valibot.d.mts +1 -1
- package/dist/zod.cjs +2 -2
- package/dist/zod.d.cts +1 -1
- package/dist/zod.d.mts +1 -1
- package/package.json +16 -4
- package/dist/deepkit.mjs.map +0 -1
- package/dist/types-BrSNvUQg.d.mts.map +0 -1
package/dist/deepkit.d.mts
CHANGED
|
@@ -1 +1,644 @@
|
|
|
1
|
-
|
|
1
|
+
import ts, { ArrowFunction, Bundle, ClassDeclaration, ClassExpression, CompilerHost, CompilerOptions, ConstructorDeclaration, CustomTransformer, CustomTransformerFactory, Declaration, EntityName, ExportDeclaration, Expression, ExpressionWithTypeArguments, FunctionDeclaration, FunctionExpression, Identifier, ImportDeclaration, JSDocImportTag, MethodDeclaration, ModuleDeclaration, ModuleExportName, Node, NodeArray, NodeFactory, ParseConfigHost, PropertyAccessExpression, QualifiedName, ResolvedModule, ScriptKind, SourceFile, Statement, StringLiteral, Symbol as Symbol$1, SymbolTable, TransformationContext, TypeAliasDeclaration, TypeChecker, TypeParameterDeclaration, TypeReferenceNode } from "typescript";
|
|
2
|
+
import { ReflectionOp } from "@deepkit/type-spec";
|
|
3
|
+
import { TypeAnnotation } from "@deepkit/core";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/ts-types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Contains @internal properties that are not yet in the public API of TS.
|
|
7
|
+
*/
|
|
8
|
+
interface SourceFile$1 extends SourceFile {
|
|
9
|
+
/**
|
|
10
|
+
* If two source files are for the same version of the same package, one will redirect to the other.
|
|
11
|
+
* (See `createRedirectSourceFile` in program.ts.)
|
|
12
|
+
* The redirect will have this set. The redirected-to source file will be in `redirectTargetsMap`.
|
|
13
|
+
*/
|
|
14
|
+
redirectInfo?: any;
|
|
15
|
+
scriptKind?: ScriptKind;
|
|
16
|
+
externalModuleIndicator?: Node;
|
|
17
|
+
commonJsModuleIndicator?: Node;
|
|
18
|
+
jsGlobalAugmentations?: SymbolTable;
|
|
19
|
+
symbol?: Symbol$1;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/reflection-ast.d.ts
|
|
23
|
+
type PackExpression = Expression | string | number | boolean | bigint;
|
|
24
|
+
type JSDocTagValue = string | boolean;
|
|
25
|
+
declare class NodeConverter {
|
|
26
|
+
protected f: NodeFactory;
|
|
27
|
+
constructor(f: NodeFactory);
|
|
28
|
+
toExpression<T extends PackExpression | PackExpression[]>(node?: T): Expression;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region ../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/resolver.d.ts
|
|
32
|
+
/**
|
|
33
|
+
* A utility to resolve a module path and its declaration.
|
|
34
|
+
*
|
|
35
|
+
* It automatically reads a SourceFile, binds and caches it.
|
|
36
|
+
*/
|
|
37
|
+
declare class Resolver {
|
|
38
|
+
compilerOptions: CompilerOptions;
|
|
39
|
+
host: CompilerHost;
|
|
40
|
+
protected sourceFiles: {
|
|
41
|
+
[fileName: string]: SourceFile;
|
|
42
|
+
};
|
|
43
|
+
constructor(compilerOptions: CompilerOptions, host: CompilerHost, sourceFiles: {
|
|
44
|
+
[fileName: string]: SourceFile;
|
|
45
|
+
});
|
|
46
|
+
resolve(from: SourceFile, importOrExportNode: ExportDeclaration | ImportDeclaration | JSDocImportTag): SourceFile | undefined;
|
|
47
|
+
protected resolveImpl(modulePath: StringLiteral, sourceFile: SourceFile): ResolvedModule | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Tries to resolve the .ts/d.ts file path for a given module path.
|
|
50
|
+
* Scans relative paths. Looks into package.json "types" and "exports" (with new 4.7 support)
|
|
51
|
+
*
|
|
52
|
+
* @param sourceFile the SourceFile of the file that contains the import. modulePath is relative to that.
|
|
53
|
+
* @param modulePath the x in 'from x'.
|
|
54
|
+
*/
|
|
55
|
+
resolveSourceFile(sourceFile: SourceFile, modulePath: StringLiteral): SourceFile | undefined;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region ../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/config.d.ts
|
|
59
|
+
/**
|
|
60
|
+
* Default means reflection is enabled for this file.
|
|
61
|
+
* Never means the whole reflection is disabled for this file.
|
|
62
|
+
* Explicit means that reflection is per default disabled for this file, but each symbol/type
|
|
63
|
+
* in it is allowed to enable it using jsdoc `@reflection`.
|
|
64
|
+
*/
|
|
65
|
+
declare const reflectionModes: readonly ["default", "explicit", "never"];
|
|
66
|
+
type Mode = (typeof reflectionModes)[number];
|
|
67
|
+
interface ReflectionConfig {
|
|
68
|
+
/**
|
|
69
|
+
* Allows to exclude type definitions/TS files from being included in the type compilation step.
|
|
70
|
+
* When a global .d.ts is matched, their types won't be embedded (useful to exclude DOM for example)
|
|
71
|
+
*/
|
|
72
|
+
exclude?: string[];
|
|
73
|
+
/**
|
|
74
|
+
* Either a boolean indication general reflection mode,
|
|
75
|
+
* or a list of globs to match against.
|
|
76
|
+
*/
|
|
77
|
+
reflection?: string[] | Mode;
|
|
78
|
+
}
|
|
79
|
+
interface ResolvedConfig extends ReflectionConfig {
|
|
80
|
+
path: string;
|
|
81
|
+
compilerOptions: ts.CompilerOptions;
|
|
82
|
+
mergeStrategy: 'merge' | 'replace';
|
|
83
|
+
}
|
|
84
|
+
interface MatchResult {
|
|
85
|
+
tsConfigPath: string;
|
|
86
|
+
mode: (typeof reflectionModes)[number];
|
|
87
|
+
}
|
|
88
|
+
type Matcher = (path: string) => MatchResult;
|
|
89
|
+
type ConfigResolver = {
|
|
90
|
+
match: Matcher;
|
|
91
|
+
config: ResolvedConfig;
|
|
92
|
+
};
|
|
93
|
+
type ReflectionConfigCache = {
|
|
94
|
+
[path: string]: ConfigResolver;
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region ../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/compiler.d.ts
|
|
98
|
+
declare function encodeOps(ops: ReflectionOp[]): string;
|
|
99
|
+
declare const packSizeByte: number;
|
|
100
|
+
/**
|
|
101
|
+
* It can't be more ops than this given number
|
|
102
|
+
*/
|
|
103
|
+
declare const packSize: number;
|
|
104
|
+
declare function debugPackStruct(sourceFile: SourceFile$1, forType: Node, pack: {
|
|
105
|
+
ops: ReflectionOp[];
|
|
106
|
+
stack: PackExpression[];
|
|
107
|
+
}): void;
|
|
108
|
+
interface Frame {
|
|
109
|
+
variables: {
|
|
110
|
+
name: string;
|
|
111
|
+
index: number;
|
|
112
|
+
}[];
|
|
113
|
+
opIndex: number;
|
|
114
|
+
conditional?: true;
|
|
115
|
+
previous?: Frame;
|
|
116
|
+
}
|
|
117
|
+
type StackEntry = Expression | string | number | boolean;
|
|
118
|
+
declare class CompilerProgram {
|
|
119
|
+
forNode: Node;
|
|
120
|
+
sourceFile?: SourceFile$1;
|
|
121
|
+
protected ops: ReflectionOp[];
|
|
122
|
+
protected stack: StackEntry[];
|
|
123
|
+
protected mainOffset: number;
|
|
124
|
+
protected stackPosition: number;
|
|
125
|
+
protected frame: Frame;
|
|
126
|
+
protected activeCoRoutines: {
|
|
127
|
+
ops: ReflectionOp[];
|
|
128
|
+
}[];
|
|
129
|
+
protected coRoutines: {
|
|
130
|
+
ops: ReflectionOp[];
|
|
131
|
+
}[];
|
|
132
|
+
constructor(forNode: Node, sourceFile?: SourceFile$1);
|
|
133
|
+
buildPackStruct(): {
|
|
134
|
+
ops: ReflectionOp[];
|
|
135
|
+
stack: StackEntry[];
|
|
136
|
+
};
|
|
137
|
+
isEmpty(): boolean;
|
|
138
|
+
pushConditionalFrame(): void;
|
|
139
|
+
pushStack(item: StackEntry): number;
|
|
140
|
+
pushCoRoutine(): void;
|
|
141
|
+
popCoRoutine(): number;
|
|
142
|
+
pushOp(...ops: ReflectionOp[]): void;
|
|
143
|
+
pushOpAtFrame(frame: Frame, ...ops: ReflectionOp[]): void;
|
|
144
|
+
/**
|
|
145
|
+
* Returns the index of the `entry` in the stack, if already exists. If not, add it, and return that new index.
|
|
146
|
+
*/
|
|
147
|
+
findOrAddStackEntry(entry: any): number;
|
|
148
|
+
/**
|
|
149
|
+
* To make room for a stack entry expected on the stack as input for example.
|
|
150
|
+
*/
|
|
151
|
+
increaseStackPosition(): number;
|
|
152
|
+
protected resolveFunctionParameters: Map<ts.Node, number>;
|
|
153
|
+
resolveFunctionParametersIncrease(fn: Node): void;
|
|
154
|
+
resolveFunctionParametersDecrease(fn: Node): void;
|
|
155
|
+
isResolveFunctionParameters(fn: Node): boolean;
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* Each pushFrame() call needs a popFrame() call.
|
|
159
|
+
*/
|
|
160
|
+
pushFrame(implicit?: boolean): Frame;
|
|
161
|
+
findConditionalFrame(): Frame;
|
|
162
|
+
/**
|
|
163
|
+
* Remove stack without doing it as OP in the processor. Some other command calls popFrame() already, which makes popFrameImplicit() an implicit popFrame.
|
|
164
|
+
* e.g. union, class, etc. all call popFrame(). the current CompilerProgram needs to be aware of that, which this function is for.
|
|
165
|
+
*/
|
|
166
|
+
popFrameImplicit(): void;
|
|
167
|
+
moveFrame(): void;
|
|
168
|
+
pushVariable(name: string, frame?: Frame): number;
|
|
169
|
+
pushTemplateParameter(name: string, withDefault?: boolean): number;
|
|
170
|
+
findVariable(name: string, frame?: Frame): {
|
|
171
|
+
frameOffset: number;
|
|
172
|
+
stackIndex: number;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
declare class Cache {
|
|
176
|
+
resolver: ReflectionConfigCache;
|
|
177
|
+
sourceFiles: {
|
|
178
|
+
[fileName: string]: SourceFile$1;
|
|
179
|
+
};
|
|
180
|
+
globalSourceFiles?: SourceFile$1[];
|
|
181
|
+
/**
|
|
182
|
+
* Signals the cache to check if it needs to be cleared.
|
|
183
|
+
*/
|
|
184
|
+
tick(): void;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Read the TypeScript AST and generate pack struct (instructions + pre-defined stack).
|
|
188
|
+
*
|
|
189
|
+
* This transformer extracts type and add the encoded (so its small and low overhead) at classes and functions as property.
|
|
190
|
+
*
|
|
191
|
+
* Deepkit/type can then extract and decode them on-demand.
|
|
192
|
+
*/
|
|
193
|
+
declare class ReflectionTransformer implements CustomTransformer {
|
|
194
|
+
protected context: TransformationContext;
|
|
195
|
+
protected cache: Cache;
|
|
196
|
+
sourceFile: SourceFile$1;
|
|
197
|
+
protected f: NodeFactory;
|
|
198
|
+
protected embedAssignType: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Types added to this map will get a type program directly under it.
|
|
201
|
+
* This is for types used in the very same file.
|
|
202
|
+
*/
|
|
203
|
+
protected compileDeclarations: Map<ts.EnumDeclaration | ts.InterfaceDeclaration | ts.TypeAliasDeclaration, {
|
|
204
|
+
name: EntityName;
|
|
205
|
+
sourceFile: SourceFile$1;
|
|
206
|
+
compiled?: Statement[];
|
|
207
|
+
}>;
|
|
208
|
+
/**
|
|
209
|
+
* Types added to this map will get a type program at the top root level of the program.
|
|
210
|
+
* This is for imported types, which need to be inlined into the current file, as we do not emit type imports (TS will omit them).
|
|
211
|
+
*/
|
|
212
|
+
protected embedDeclarations: Map<ts.Node, {
|
|
213
|
+
name: EntityName;
|
|
214
|
+
sourceFile?: SourceFile$1;
|
|
215
|
+
}>;
|
|
216
|
+
/**
|
|
217
|
+
* When a node was embedded or compiled (from the maps above), we store it here to know to not add it again.
|
|
218
|
+
*/
|
|
219
|
+
protected compiledDeclarations: Set<ts.Node>;
|
|
220
|
+
protected addImports: {
|
|
221
|
+
importDeclaration: ImportDeclaration | JSDocImportTag;
|
|
222
|
+
identifier: Identifier;
|
|
223
|
+
}[];
|
|
224
|
+
protected additionalImports: Map<ts.ImportDeclaration | ts.JSDocImportTag, ts.Statement>;
|
|
225
|
+
protected nodeConverter: NodeConverter;
|
|
226
|
+
protected typeChecker?: TypeChecker;
|
|
227
|
+
protected resolver: Resolver;
|
|
228
|
+
protected host: CompilerHost;
|
|
229
|
+
protected overriddenHost: boolean;
|
|
230
|
+
protected overriddenConfigResolver?: ConfigResolver;
|
|
231
|
+
protected compilerOptions: CompilerOptions;
|
|
232
|
+
/**
|
|
233
|
+
* When a deep call expression was found a script-wide variable is necessary
|
|
234
|
+
* as temporary storage.
|
|
235
|
+
*/
|
|
236
|
+
protected tempResultIdentifier?: Identifier;
|
|
237
|
+
protected parseConfigHost: ParseConfigHost;
|
|
238
|
+
protected intrinsicMetaDeclaration: TypeAliasDeclaration;
|
|
239
|
+
constructor(context: TransformationContext, cache?: Cache);
|
|
240
|
+
forHost(host: CompilerHost): this;
|
|
241
|
+
withReflection(config: ReflectionConfig): this;
|
|
242
|
+
transformBundle(node: Bundle): Bundle;
|
|
243
|
+
getTempResultIdentifier(): Identifier;
|
|
244
|
+
protected getConfigResolver(sourceFile: {
|
|
245
|
+
fileName: string;
|
|
246
|
+
}): ConfigResolver;
|
|
247
|
+
protected getReflectionConfig(sourceFile: {
|
|
248
|
+
fileName: string;
|
|
249
|
+
}): MatchResult;
|
|
250
|
+
protected isWithReflection(sourceFile: SourceFile$1 | undefined, node: Node & {
|
|
251
|
+
__deepkitConfig?: ReflectionConfig;
|
|
252
|
+
}): boolean;
|
|
253
|
+
transformSourceFile(sourceFile: SourceFile$1): SourceFile$1;
|
|
254
|
+
attachAdditionalStatements(statements: NodeArray<Statement> | Statement[]): Statement[];
|
|
255
|
+
protected getModuleType(): 'cjs' | 'esm';
|
|
256
|
+
protected getArrowFunctionΩPropertyAccessIdentifier(node: ArrowFunction): Identifier | undefined;
|
|
257
|
+
protected injectResetΩ<T extends FunctionDeclaration | FunctionExpression | MethodDeclaration | ConstructorDeclaration | ArrowFunction>(node: T): T;
|
|
258
|
+
protected createProgramVarFromNode(node: Node, name: EntityName, sourceFile?: SourceFile$1): Statement[];
|
|
259
|
+
protected extractPackStructOfExpression(node: Expression, program: CompilerProgram): void;
|
|
260
|
+
protected extractPackStructOfType(node: Node | Declaration | ClassDeclaration | ClassExpression, program: CompilerProgram): void;
|
|
261
|
+
protected knownClasses: {
|
|
262
|
+
[name: string]: ReflectionOp;
|
|
263
|
+
};
|
|
264
|
+
protected getGlobalLibs(): SourceFile$1[];
|
|
265
|
+
/**
|
|
266
|
+
* This is a custom resolver based on populated `locals` from the binder. It uses a custom resolution algorithm since
|
|
267
|
+
* we have no access to the binder/TypeChecker directly and instantiating a TypeChecker per file/transformer is incredible slow.
|
|
268
|
+
*/
|
|
269
|
+
protected resolveDeclaration(typeName: EntityName): {
|
|
270
|
+
declaration: Node;
|
|
271
|
+
importDeclaration?: ImportDeclaration | JSDocImportTag;
|
|
272
|
+
typeOnly?: boolean;
|
|
273
|
+
} | void;
|
|
274
|
+
protected getDeclarationVariableName(typeName: EntityName): Identifier;
|
|
275
|
+
/**
|
|
276
|
+
* The semantic of isExcluded is different from checking if the fileName is part
|
|
277
|
+
* of reflection config option. isExcluded checks if the file should be excluded
|
|
278
|
+
* via the exclude option. mainly used to exclude globals and external libraries.
|
|
279
|
+
*/
|
|
280
|
+
protected isExcluded(fileName: string): boolean;
|
|
281
|
+
protected extractPackStructOfTypeReference(type: TypeReferenceNode | ExpressionWithTypeArguments, program: CompilerProgram): void;
|
|
282
|
+
/**
|
|
283
|
+
* Returns the class declaration, function/arrow declaration, or block where type was used.
|
|
284
|
+
*/
|
|
285
|
+
protected getTypeUser(type: Node): Node;
|
|
286
|
+
/**
|
|
287
|
+
* With this function we want to check if `type` is used in the signature itself from the parent of `declaration`.
|
|
288
|
+
* If so, we do not try to infer the type from runtime values.
|
|
289
|
+
*
|
|
290
|
+
* Examples where we do not infer from runtime, `type` being `T` and `declaration` being `<T>` (return false):
|
|
291
|
+
*
|
|
292
|
+
* ```typescript
|
|
293
|
+
* class User<T> {
|
|
294
|
+
* config: T;
|
|
295
|
+
* }
|
|
296
|
+
*
|
|
297
|
+
* class User<T> {
|
|
298
|
+
* constructor(public config: T) {}
|
|
299
|
+
* }
|
|
300
|
+
*
|
|
301
|
+
* function do<T>(item: T): void {}
|
|
302
|
+
* function do<T>(item: T): T {}
|
|
303
|
+
* ```
|
|
304
|
+
*
|
|
305
|
+
* Examples where we infer from runtime (return true):
|
|
306
|
+
*
|
|
307
|
+
* ```typescript
|
|
308
|
+
* function do<T>(item: T) {
|
|
309
|
+
* return typeOf<T>; //<-- because of that
|
|
310
|
+
* }
|
|
311
|
+
*
|
|
312
|
+
* function do<T>(item: T) {
|
|
313
|
+
* class A {
|
|
314
|
+
* config: T; //<-- because of that
|
|
315
|
+
* }
|
|
316
|
+
* return A;
|
|
317
|
+
* }
|
|
318
|
+
*
|
|
319
|
+
* function do<T>(item: T) {
|
|
320
|
+
* class A {
|
|
321
|
+
* doIt() {
|
|
322
|
+
* class B {
|
|
323
|
+
* config: T; //<-- because of that
|
|
324
|
+
* }
|
|
325
|
+
* return B;
|
|
326
|
+
* }
|
|
327
|
+
* }
|
|
328
|
+
* return A;
|
|
329
|
+
* }
|
|
330
|
+
*
|
|
331
|
+
* function do<T>(item: T) {
|
|
332
|
+
* class A {
|
|
333
|
+
* doIt(): T { //<-- because of that
|
|
334
|
+
* }
|
|
335
|
+
* }
|
|
336
|
+
* return A;
|
|
337
|
+
* }
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
protected needsToBeInferred(declaration: TypeParameterDeclaration, type: TypeReferenceNode | ExpressionWithTypeArguments): boolean;
|
|
341
|
+
protected resolveTypeOnlyImport(entityName: EntityName, program: CompilerProgram): void;
|
|
342
|
+
protected resolveTypeName(typeName: string, program: CompilerProgram): void;
|
|
343
|
+
protected resolveTypeParameter(declaration: TypeParameterDeclaration, type: TypeReferenceNode | ExpressionWithTypeArguments, program: CompilerProgram): void;
|
|
344
|
+
protected createAccessorForEntityName(e: QualifiedName): PropertyAccessExpression;
|
|
345
|
+
protected findDeclarationInFile(sourceFile: SourceFile$1 | ModuleDeclaration, declarationName: string): Declaration | undefined;
|
|
346
|
+
protected resolveImportSpecifier(_declarationName: string | ModuleExportName, importOrExport: ExportDeclaration | ImportDeclaration | JSDocImportTag, sourceFile: SourceFile$1): Declaration | undefined;
|
|
347
|
+
protected followExport(declarationName: string, statement: ExportDeclaration, sourceFile: SourceFile$1): Declaration | undefined;
|
|
348
|
+
protected getTypeOfType(type: Node | Declaration): Expression | undefined;
|
|
349
|
+
protected packOpsAndStack(program: CompilerProgram): ts.Expression;
|
|
350
|
+
/**
|
|
351
|
+
* Note: We have to duplicate the expressions as it can be that incoming expression are from another file and contain wrong pos/end properties,
|
|
352
|
+
* so the code generation is then broken when we simply reuse them. Wrong code like ``User.__type = [.toEqual({`` is then generated.
|
|
353
|
+
* This function is probably not complete, but we add new copies when required.
|
|
354
|
+
*/
|
|
355
|
+
protected valueToExpression(value: undefined | PackExpression | PackExpression[]): Expression;
|
|
356
|
+
/**
|
|
357
|
+
* A class is decorated with type information by adding a static variable.
|
|
358
|
+
*
|
|
359
|
+
* class Model {
|
|
360
|
+
* static __types = pack(ReflectionOp.string); //<-- encoded type information
|
|
361
|
+
* title: string;
|
|
362
|
+
* }
|
|
363
|
+
*/
|
|
364
|
+
protected decorateClass(sourceFile: SourceFile$1, node: ClassDeclaration | ClassExpression): Node;
|
|
365
|
+
/**
|
|
366
|
+
* const fn = function() {}
|
|
367
|
+
*
|
|
368
|
+
* => const fn = __assignType(function() {}, [34])
|
|
369
|
+
*/
|
|
370
|
+
protected decorateFunctionExpression(expression: FunctionExpression): ts.FunctionExpression | ts.CallExpression;
|
|
371
|
+
/**
|
|
372
|
+
* function name() {}
|
|
373
|
+
*
|
|
374
|
+
* => function name() {}; name.__type = 34;
|
|
375
|
+
*/
|
|
376
|
+
protected decorateFunctionDeclaration(declaration: FunctionDeclaration): ts.ExportAssignment | ts.FunctionDeclaration | ts.Statement[];
|
|
377
|
+
/**
|
|
378
|
+
* const fn = () => {}
|
|
379
|
+
* => const fn = __assignType(() => {}, [34])
|
|
380
|
+
*/
|
|
381
|
+
protected decorateArrowFunction(expression: ArrowFunction): ts.ArrowFunction | ts.CallExpression;
|
|
382
|
+
/**
|
|
383
|
+
* Object.assign(fn, {__type: []}) is much slower than a custom implementation like
|
|
384
|
+
*
|
|
385
|
+
* assignType(fn, [])
|
|
386
|
+
*
|
|
387
|
+
* where we embed assignType() at the beginning of the type.
|
|
388
|
+
*/
|
|
389
|
+
protected wrapWithAssignType(fn: Expression, type: Expression): ts.CallExpression;
|
|
390
|
+
/**
|
|
391
|
+
* Emit `{ __meta?: never & [name, value] }` — the runtime shape of `TypeAnnotation<name, value>`.
|
|
392
|
+
* Consumed later via `typeAnnotation.getOption(type, name)`.
|
|
393
|
+
*/
|
|
394
|
+
protected emitTypeAnnotation(program: CompilerProgram, name: string, value: JSDocTagValue): void;
|
|
395
|
+
protected collectJSDocAnnotations(node: Node | undefined): {
|
|
396
|
+
description?: string;
|
|
397
|
+
annotations: {
|
|
398
|
+
name: string;
|
|
399
|
+
value: JSDocTagValue;
|
|
400
|
+
}[];
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Run `emitType()` then intersect the result with TypeAnnotations derived from JSDoc/TSDoc.
|
|
404
|
+
* Also sets `ReflectionOp.description` when a description string is available (back-compat).
|
|
405
|
+
*
|
|
406
|
+
* @returns The resolved description string, if any.
|
|
407
|
+
*/
|
|
408
|
+
protected withJSDocTypeAnnotations(program: CompilerProgram, node: Node | undefined, emitType: () => void, options?: {
|
|
409
|
+
applyDescriptionOp?: boolean;
|
|
410
|
+
}): string | undefined;
|
|
411
|
+
/**
|
|
412
|
+
* Checks if reflection was disabled/enabled in file via JSDoc attribute for a particular
|
|
413
|
+
* Node, e.g `@reflection no`. If nothing is found, "reflection" config option needs to be used.
|
|
414
|
+
*/
|
|
415
|
+
protected getExplicitReflectionMode(sourceFile: SourceFile$1 | undefined, node: Node): boolean | undefined;
|
|
416
|
+
}
|
|
417
|
+
declare class DeclarationTransformer extends ReflectionTransformer {
|
|
418
|
+
protected addExports: {
|
|
419
|
+
identifier: string;
|
|
420
|
+
}[];
|
|
421
|
+
transformSourceFile(sourceFile: SourceFile$1): SourceFile$1;
|
|
422
|
+
}
|
|
423
|
+
declare const transformer: CustomTransformerFactory;
|
|
424
|
+
declare const declarationTransformer: CustomTransformerFactory;
|
|
425
|
+
//#endregion
|
|
426
|
+
//#region ../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/loader.d.ts
|
|
427
|
+
declare class DeepkitLoader {
|
|
428
|
+
protected options: CompilerOptions;
|
|
429
|
+
protected host: ts.CompilerHost;
|
|
430
|
+
protected program: ts.Program;
|
|
431
|
+
protected printer: ts.Printer;
|
|
432
|
+
protected cache: Cache;
|
|
433
|
+
protected knownFiles: {
|
|
434
|
+
[path: string]: string;
|
|
435
|
+
};
|
|
436
|
+
protected sourceFiles: {
|
|
437
|
+
[path: string]: SourceFile;
|
|
438
|
+
};
|
|
439
|
+
constructor();
|
|
440
|
+
transform(source: string, path: string): string;
|
|
441
|
+
}
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/deepkit.d.ts
|
|
444
|
+
/**
|
|
445
|
+
* Schema metadata options mirroring JSON Schema metadata keywords.
|
|
446
|
+
*
|
|
447
|
+
* @see https://deepkit.io/en/documentation/runtime-types/types#custom-type-annotations
|
|
448
|
+
*/
|
|
449
|
+
interface SchemaMetaOptions {
|
|
450
|
+
id?: string;
|
|
451
|
+
title?: string;
|
|
452
|
+
description?: string;
|
|
453
|
+
docs?: string;
|
|
454
|
+
alias?: string[];
|
|
455
|
+
tags?: string[];
|
|
456
|
+
deprecated?: boolean;
|
|
457
|
+
hidden?: boolean;
|
|
458
|
+
ignore?: boolean;
|
|
459
|
+
internal?: boolean;
|
|
460
|
+
runtime?: boolean;
|
|
461
|
+
examples?: (unknown | {
|
|
462
|
+
name?: string;
|
|
463
|
+
description?: string;
|
|
464
|
+
value: unknown;
|
|
465
|
+
})[];
|
|
466
|
+
readOnly?: boolean;
|
|
467
|
+
writeOnly?: boolean;
|
|
468
|
+
contentEncoding?: string;
|
|
469
|
+
contentMediaType?: string;
|
|
470
|
+
contentSchema?: string;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Combined schema metadata annotation.
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```ts
|
|
477
|
+
* type Username = string & SchemaMeta<{ title: "Username"; deprecated: true }>;
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
type SchemaMeta<T extends SchemaMetaOptions> = TypeAnnotation<"schemaMeta", T>;
|
|
481
|
+
/**
|
|
482
|
+
* Unique schema / property identifier.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```ts
|
|
486
|
+
* type UserId = string & Id<"user">;
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
type Id<T extends string> = TypeAnnotation<"id", T>;
|
|
490
|
+
/**
|
|
491
|
+
* Human-readable title.
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* ```ts
|
|
495
|
+
* type Name = string & Title<"Display name">;
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
type Title<T extends string> = TypeAnnotation<"title", T>;
|
|
499
|
+
/**
|
|
500
|
+
* Human-readable description.
|
|
501
|
+
*
|
|
502
|
+
* @example
|
|
503
|
+
* ```ts
|
|
504
|
+
* type Bio = string & Description<"Short biography">;
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
type Description<T extends string> = TypeAnnotation<"description", T>;
|
|
508
|
+
/**
|
|
509
|
+
* External documentation URL.
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* ```ts
|
|
513
|
+
* type Token = string & Docs<"https://example.com/docs/token">;
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
type Docs<T extends string> = TypeAnnotation<"docs", T>;
|
|
517
|
+
/**
|
|
518
|
+
* Alternate names for the field.
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```ts
|
|
522
|
+
* type Email = string & Alias<["mail", "e-mail"]>;
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
type Alias<T extends readonly string[]> = TypeAnnotation<"alias", T>;
|
|
526
|
+
/**
|
|
527
|
+
* Categorization tags / groups.
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
* ```ts
|
|
531
|
+
* type Password = string & Tags<["credentials", "secret"]>;
|
|
532
|
+
* ```
|
|
533
|
+
*/
|
|
534
|
+
type Tags<T extends readonly string[]> = TypeAnnotation<"tags", T>;
|
|
535
|
+
/**
|
|
536
|
+
* Marks the field as deprecated.
|
|
537
|
+
*
|
|
538
|
+
* @example
|
|
539
|
+
* ```ts
|
|
540
|
+
* type LegacyId = string & Deprecated;
|
|
541
|
+
* ```
|
|
542
|
+
*/
|
|
543
|
+
type Deprecated = TypeAnnotation<"deprecated">;
|
|
544
|
+
/**
|
|
545
|
+
* Hides the field from documentation / UI surfaces.
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* ```ts
|
|
549
|
+
* type Secret = string & Hidden;
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
type Hidden = TypeAnnotation<"hidden">;
|
|
553
|
+
/**
|
|
554
|
+
* Ignores the field during schema processing.
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```ts
|
|
558
|
+
* type Scratch = string & Ignore;
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
561
|
+
type Ignore = TypeAnnotation<"ignore">;
|
|
562
|
+
/**
|
|
563
|
+
* Marks the field as internal.
|
|
564
|
+
*
|
|
565
|
+
* @example
|
|
566
|
+
* ```ts
|
|
567
|
+
* type InternalId = string & Internal;
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
570
|
+
type Internal = TypeAnnotation<"internal">;
|
|
571
|
+
/**
|
|
572
|
+
* Marks the field as populated only at runtime.
|
|
573
|
+
*
|
|
574
|
+
* @example
|
|
575
|
+
* ```ts
|
|
576
|
+
* type Computed = string & Runtime;
|
|
577
|
+
* ```
|
|
578
|
+
*/
|
|
579
|
+
type Runtime = TypeAnnotation<"runtime">;
|
|
580
|
+
/**
|
|
581
|
+
* Example value shape for documentation.
|
|
582
|
+
*/
|
|
583
|
+
type SchemaExample = unknown | {
|
|
584
|
+
name?: string;
|
|
585
|
+
description?: string;
|
|
586
|
+
value: unknown;
|
|
587
|
+
};
|
|
588
|
+
/**
|
|
589
|
+
* Example values for documentation.
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* ```ts
|
|
593
|
+
* type Status = string & Examples<[{ value: "active" }, { name: "Off", value: "inactive" }]>;
|
|
594
|
+
* ```
|
|
595
|
+
*/
|
|
596
|
+
type Examples<T extends readonly SchemaExample[]> = TypeAnnotation<"examples", T>;
|
|
597
|
+
/**
|
|
598
|
+
* Marks the field as read-only.
|
|
599
|
+
*
|
|
600
|
+
* @example
|
|
601
|
+
* ```ts
|
|
602
|
+
* type CreatedAt = string & ReadOnly;
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
type ReadOnly = TypeAnnotation<"readOnly">;
|
|
606
|
+
/**
|
|
607
|
+
* Marks the field as write-only.
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* ```ts
|
|
611
|
+
* type Password = string & WriteOnly;
|
|
612
|
+
* ```
|
|
613
|
+
*/
|
|
614
|
+
type WriteOnly = TypeAnnotation<"writeOnly">;
|
|
615
|
+
/**
|
|
616
|
+
* Content encoding (e.g. `base64`).
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```ts
|
|
620
|
+
* type Blob = string & ContentEncoding<"base64">;
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
type ContentEncoding<T extends string> = TypeAnnotation<"contentEncoding", T>;
|
|
624
|
+
/**
|
|
625
|
+
* Content media type (e.g. `application/json`).
|
|
626
|
+
*
|
|
627
|
+
* @example
|
|
628
|
+
* ```ts
|
|
629
|
+
* type Payload = string & ContentMediaType<"application/json">;
|
|
630
|
+
* ```
|
|
631
|
+
*/
|
|
632
|
+
type ContentMediaType<T extends string> = TypeAnnotation<"contentMediaType", T>;
|
|
633
|
+
/**
|
|
634
|
+
* Content schema reference.
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* ```ts
|
|
638
|
+
* type Body = string & ContentSchema<"https://example.com/schemas/body.json">;
|
|
639
|
+
* ```
|
|
640
|
+
*/
|
|
641
|
+
type ContentSchema<T extends string> = TypeAnnotation<"contentSchema", T>;
|
|
642
|
+
//#endregion
|
|
643
|
+
export { Alias, Cache, ContentEncoding, ContentMediaType, ContentSchema, DeclarationTransformer, DeepkitLoader, Deprecated, Description, Docs, Examples, Hidden, Id, Ignore, Internal, ReadOnly, ReflectionTransformer, Runtime, SchemaExample, SchemaMeta, SchemaMetaOptions, Tags, Title, WriteOnly, debugPackStruct, declarationTransformer, encodeOps, packSize, packSizeByte, transformer };
|
|
644
|
+
//# sourceMappingURL=deepkit.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepkit.d.mts","names":[],"sources":["../../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/ts-types.d.ts","../../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/reflection-ast.d.ts","../../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/resolver.d.ts","../../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/config.d.ts","../../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/compiler.d.ts","../../../../node_modules/.pnpm/@deepkit+type-compiler@1.0.19_patch_hash=f3a07cea0d3f8fa5a7779d8e740cd5389fb06f7980aa96_4c91b7b6cb5be286e73f280b37a4b0c2/node_modules/@deepkit/type-compiler/dist/cjs/src/loader.d.ts","../src/deepkit.ts"],"x_google_ignoreList":[0,1,2,3,4,5],"mappings":""}
|
package/dist/deepkit.mjs
CHANGED
|
@@ -1,45 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as debugPackStruct, c as packSize, i as ReflectionTransformer, l as packSizeByte, n as Cache, o as declarationTransformer, r as DeclarationTransformer, s as encodeOps, t as DeepkitLoader, u as transformer } from "./deepkit-h4w2bXJ2.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __exportAll = (all, no_symbols) => {
|
|
9
|
-
let target = {};
|
|
10
|
-
for (var name in all) {
|
|
11
|
-
__defProp(target, name, {
|
|
12
|
-
get: all[name],
|
|
13
|
-
enumerable: true
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
if (!no_symbols) {
|
|
17
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
-
}
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
-
key = keys[i];
|
|
25
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
-
__defProp(to, key, {
|
|
27
|
-
get: ((k) => from[k]).bind(null, key),
|
|
28
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return to;
|
|
34
|
-
};
|
|
35
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/deepkit.ts
|
|
39
|
-
var deepkit_exports = /* @__PURE__ */ __exportAll({});
|
|
40
|
-
import * as import__deepkit_type_compiler from "@deepkit/type-compiler";
|
|
41
|
-
__reExport(deepkit_exports, import__deepkit_type_compiler);
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
export { deepkit_exports as t };
|
|
45
|
-
//# sourceMappingURL=deepkit.mjs.map
|
|
3
|
+
export { Cache, DeclarationTransformer, DeepkitLoader, ReflectionTransformer, debugPackStruct, declarationTransformer, encodeOps, packSize, packSizeByte, transformer };
|