@trapi/metadata 2.0.0-beta.1 → 2.0.0-beta.3
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/index.d.mts +205 -1281
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +379 -1290
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,480 +1,7 @@
|
|
|
1
1
|
import { BaseError } from "@ebec/core";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { Container } from "validup";
|
|
5
|
-
import { z } from "zod";
|
|
2
|
+
import { ClassDeclaration, CompilerOptions, EnumDeclaration, EnumMember, Expression, HasInitializer, InterfaceDeclaration, JSDoc, JSDocComment, JSDocTag, LiteralTypeNode, MethodDeclaration, Node, NodeArray, ParameterDeclaration, PropertyDeclaration, PropertySignature, SyntaxKind, Token, TypeAliasDeclaration, TypeChecker, TypeNode, TypeReferenceNode } from "typescript";
|
|
3
|
+
import { BaseType, Controller, DecoratorArgument, DecoratorHost, DecoratorSource, DecoratorTarget, DependencyResolver, Extension, HandlerContext, IControllerGenerator, IParameterGenerator, IResolverCache, JsDocHandlerContext, JsDocMatch, JsDocSource, Match, Metadata, Method, NeverType, Parameter, Preset, PrimitiveType, RefEnumType, RefObjectType, ReferenceType, Registry, ResolverProperty, Type, UnmatchedDecoratorReport, Validator, VoidType } from "@trapi/core";
|
|
6
4
|
|
|
7
|
-
//#region src/core/validator/types.d.ts
|
|
8
|
-
interface ValidatorMeta {}
|
|
9
|
-
type Validator = {
|
|
10
|
-
value?: unknown;
|
|
11
|
-
message?: string;
|
|
12
|
-
meta?: ValidatorMeta;
|
|
13
|
-
};
|
|
14
|
-
type Validators = Record<string, Validator>;
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/core/resolver/constants.d.ts
|
|
17
|
-
declare enum TypeName {
|
|
18
|
-
STRING = "string",
|
|
19
|
-
BOOLEAN = "boolean",
|
|
20
|
-
BIGINT = "bigint",
|
|
21
|
-
DOUBLE = "double",
|
|
22
|
-
FLOAT = "float",
|
|
23
|
-
FILE = "file",
|
|
24
|
-
INTEGER = "integer",
|
|
25
|
-
LONG = "long",
|
|
26
|
-
ENUM = "enum",
|
|
27
|
-
ARRAY = "array",
|
|
28
|
-
DATETIME = "datetime",
|
|
29
|
-
DATE = "date",
|
|
30
|
-
BINARY = "binary",
|
|
31
|
-
BUFFER = "buffer",
|
|
32
|
-
BYTE = "byte",
|
|
33
|
-
VOID = "void",
|
|
34
|
-
OBJECT = "object",
|
|
35
|
-
ANY = "any",
|
|
36
|
-
UNDEFINED = "undefined",
|
|
37
|
-
NEVER = "never",
|
|
38
|
-
REF_ENUM = "refEnum",
|
|
39
|
-
REF_OBJECT = "refObject",
|
|
40
|
-
REF_ALIAS = "refAlias",
|
|
41
|
-
NESTED_OBJECT_LITERAL = "nestedObjectLiteral",
|
|
42
|
-
UNION = "union",
|
|
43
|
-
INTERSECTION = "intersection",
|
|
44
|
-
TUPLE = "tuple"
|
|
45
|
-
}
|
|
46
|
-
declare enum UtilityTypeName {
|
|
47
|
-
NON_NULLABLE = "NonNullable",
|
|
48
|
-
OMIT = "Omit",
|
|
49
|
-
PARTIAL = "Partial",
|
|
50
|
-
READONLY = "Readonly",
|
|
51
|
-
RECORD = "Record",
|
|
52
|
-
REQUIRED = "Required",
|
|
53
|
-
PICK = "Pick",
|
|
54
|
-
EXTRACT = "Extract",
|
|
55
|
-
EXCLUDE = "Exclude",
|
|
56
|
-
RETURN_TYPE = "ReturnType",
|
|
57
|
-
PARAMETERS = "Parameters",
|
|
58
|
-
AWAITED = "Awaited",
|
|
59
|
-
INSTANCE_TYPE = "InstanceType",
|
|
60
|
-
CONSTRUCTOR_PARAMETERS = "ConstructorParameters"
|
|
61
|
-
}
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region src/core/resolver/extension.d.ts
|
|
64
|
-
type Extension = {
|
|
65
|
-
key: string;
|
|
66
|
-
value: ExtensionType | ExtensionType[];
|
|
67
|
-
};
|
|
68
|
-
type ExtensionType = string | number | boolean | null | ExtensionType[] | {
|
|
69
|
-
[name: string]: ExtensionType | ExtensionType[];
|
|
70
|
-
};
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/core/resolver/types.d.ts
|
|
73
|
-
type Type = PrimitiveType | ObjectType | EnumType | ArrayType | FileType | DateTimeType | DateType | BinaryType | BufferType | ByteType | AnyType | UndefinedType | NeverType | RefEnumType | RefObjectType | RefAliasType | NestedObjectLiteralType | UnionType | IntersectionType | TupleType | VoidType;
|
|
74
|
-
type BaseType = {
|
|
75
|
-
typeName: `${TypeName}`;
|
|
76
|
-
};
|
|
77
|
-
type AnyType = BaseType & {
|
|
78
|
-
typeName: `${TypeName.ANY}`;
|
|
79
|
-
};
|
|
80
|
-
type UndefinedType = BaseType & {
|
|
81
|
-
typeName: `${TypeName.UNDEFINED}`;
|
|
82
|
-
};
|
|
83
|
-
type StringType = BaseType & {
|
|
84
|
-
typeName: `${TypeName.STRING}`;
|
|
85
|
-
};
|
|
86
|
-
type BooleanType = BaseType & {
|
|
87
|
-
typeName: `${TypeName.BOOLEAN}`;
|
|
88
|
-
};
|
|
89
|
-
type BigintType = BaseType & {
|
|
90
|
-
typeName: `${TypeName.BIGINT}`;
|
|
91
|
-
};
|
|
92
|
-
type DoubleType = BaseType & {
|
|
93
|
-
typeName: `${TypeName.DOUBLE}`;
|
|
94
|
-
};
|
|
95
|
-
type FloatType = BaseType & {
|
|
96
|
-
typeName: `${TypeName.FLOAT}`;
|
|
97
|
-
};
|
|
98
|
-
type IntegerType = BaseType & {
|
|
99
|
-
typeName: `${TypeName.INTEGER}`;
|
|
100
|
-
};
|
|
101
|
-
type LongType = BaseType & {
|
|
102
|
-
typeName: `${TypeName.LONG}`;
|
|
103
|
-
};
|
|
104
|
-
type VoidType = BaseType & {
|
|
105
|
-
typeName: `${TypeName.VOID}`;
|
|
106
|
-
};
|
|
107
|
-
type NeverType = BaseType & {
|
|
108
|
-
typeName: `${TypeName.NEVER}`;
|
|
109
|
-
};
|
|
110
|
-
type DateType = BaseType & {
|
|
111
|
-
typeName: `${TypeName.DATE}`;
|
|
112
|
-
};
|
|
113
|
-
type FileType = BaseType & {
|
|
114
|
-
typeName: `${TypeName.FILE}`;
|
|
115
|
-
};
|
|
116
|
-
type DateTimeType = BaseType & {
|
|
117
|
-
typeName: `${TypeName.DATETIME}`;
|
|
118
|
-
};
|
|
119
|
-
type BinaryType = BaseType & {
|
|
120
|
-
typeName: `${TypeName.BINARY}`;
|
|
121
|
-
};
|
|
122
|
-
type BufferType = BaseType & {
|
|
123
|
-
typeName: `${TypeName.BUFFER}`;
|
|
124
|
-
};
|
|
125
|
-
type ByteType = BaseType & {
|
|
126
|
-
typeName: `${TypeName.BYTE}`;
|
|
127
|
-
};
|
|
128
|
-
type ObjectType = BaseType & {
|
|
129
|
-
typeName: `${TypeName.OBJECT}`;
|
|
130
|
-
};
|
|
131
|
-
type EnumType = BaseType & {
|
|
132
|
-
members: Array<string | number | boolean | null>;
|
|
133
|
-
typeName: `${TypeName.ENUM}`;
|
|
134
|
-
};
|
|
135
|
-
type ArrayType = BaseType & {
|
|
136
|
-
elementType: Type;
|
|
137
|
-
typeName: `${TypeName.ARRAY}`;
|
|
138
|
-
};
|
|
139
|
-
type NestedObjectLiteralType = BaseType & {
|
|
140
|
-
typeName: `${TypeName.NESTED_OBJECT_LITERAL}`;
|
|
141
|
-
properties: ResolverProperty[];
|
|
142
|
-
additionalProperties?: Type;
|
|
143
|
-
};
|
|
144
|
-
type IntersectionType = BaseType & {
|
|
145
|
-
typeName: `${TypeName.INTERSECTION}`;
|
|
146
|
-
members: Type[];
|
|
147
|
-
};
|
|
148
|
-
type UnionType = BaseType & {
|
|
149
|
-
typeName: `${TypeName.UNION}`;
|
|
150
|
-
members: Type[];
|
|
151
|
-
};
|
|
152
|
-
type TupleElement = {
|
|
153
|
-
type: Type;
|
|
154
|
-
name?: string;
|
|
155
|
-
};
|
|
156
|
-
type TupleType = BaseType & {
|
|
157
|
-
typeName: `${TypeName.TUPLE}`;
|
|
158
|
-
elements: TupleElement[];
|
|
159
|
-
};
|
|
160
|
-
type ReferenceType = RefEnumType | RefObjectType | RefAliasType;
|
|
161
|
-
type ReferenceTypes = Record<string, ReferenceType>;
|
|
162
|
-
type DependencyResolver = (referenceTypes: ReferenceTypes) => void;
|
|
163
|
-
type ReferenceTypeBase = BaseType & {
|
|
164
|
-
description?: string;
|
|
165
|
-
typeName: `${TypeName.REF_ALIAS}` | `${TypeName.REF_ENUM}` | `${TypeName.REF_OBJECT}`;
|
|
166
|
-
refName: string;
|
|
167
|
-
example?: unknown;
|
|
168
|
-
deprecated: boolean;
|
|
169
|
-
};
|
|
170
|
-
type RefEnumType = ReferenceTypeBase & {
|
|
171
|
-
typeName: `${TypeName.REF_ENUM}`;
|
|
172
|
-
members: Array<string | number | boolean>;
|
|
173
|
-
memberNames?: string[];
|
|
174
|
-
};
|
|
175
|
-
type RefObjectType = ReferenceTypeBase & {
|
|
176
|
-
typeName: `${TypeName.REF_OBJECT}`;
|
|
177
|
-
properties: ResolverProperty[];
|
|
178
|
-
additionalProperties?: Type;
|
|
179
|
-
};
|
|
180
|
-
type RefAliasType = Omit<ResolverProperty, 'name' | 'required'> & ReferenceTypeBase & {
|
|
181
|
-
typeName: `${TypeName.REF_ALIAS}`;
|
|
182
|
-
};
|
|
183
|
-
type PrimitiveType = AnyType | BinaryType | BooleanType | BufferType | ByteType | DateType | DateTimeType | DoubleType | FloatType | FileType | BigintType | IntegerType | LongType | ObjectType | StringType | UndefinedType;
|
|
184
|
-
type ResolverProperty = {
|
|
185
|
-
default?: any;
|
|
186
|
-
format?: string;
|
|
187
|
-
example?: unknown;
|
|
188
|
-
validators?: Record<string, Validator>;
|
|
189
|
-
description?: string;
|
|
190
|
-
name: string;
|
|
191
|
-
type: Type;
|
|
192
|
-
required: boolean;
|
|
193
|
-
deprecated: boolean;
|
|
194
|
-
extensions?: Extension[];
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* Cache interface for the resolver's type cache.
|
|
198
|
-
*/
|
|
199
|
-
interface IResolverCache {
|
|
200
|
-
getCachedType(name: string): ReferenceType | undefined;
|
|
201
|
-
setCachedType(name: string, type: ReferenceType): void;
|
|
202
|
-
isInProgress(name: string): boolean;
|
|
203
|
-
markInProgress(name: string): void;
|
|
204
|
-
clearInProgress(name: string): void;
|
|
205
|
-
clear(): void;
|
|
206
|
-
}
|
|
207
|
-
//#endregion
|
|
208
|
-
//#region src/core/resolver/type-guards.d.ts
|
|
209
|
-
declare function isAnyType(param: BaseType): param is AnyType;
|
|
210
|
-
declare function isUndefinedType(param: BaseType): param is UndefinedType;
|
|
211
|
-
declare function isStringType(param: BaseType): param is StringType;
|
|
212
|
-
declare function isBooleanType(param: BaseType): param is BooleanType;
|
|
213
|
-
declare function isBigintType(param: BaseType): param is BigintType;
|
|
214
|
-
declare function isDoubleType(param: BaseType): param is DoubleType;
|
|
215
|
-
declare function isFloatType(param: BaseType): param is FloatType;
|
|
216
|
-
declare function isIntegerType(param: BaseType): param is IntegerType;
|
|
217
|
-
declare function isLongType(param: BaseType): param is LongType;
|
|
218
|
-
declare function isVoidType(param: BaseType | undefined): param is VoidType;
|
|
219
|
-
declare function isNeverType(param: BaseType): param is NeverType;
|
|
220
|
-
declare function isDateType(param: BaseType): param is DateType;
|
|
221
|
-
declare function isFileType(param: BaseType): param is FileType;
|
|
222
|
-
declare function isDateTimeType(param: BaseType): param is DateTimeType;
|
|
223
|
-
declare function isBinaryType(param: BaseType): param is BinaryType;
|
|
224
|
-
declare function isBufferType(param: BaseType): param is BufferType;
|
|
225
|
-
declare function isByteType(param: BaseType): param is ByteType;
|
|
226
|
-
declare function isObjectType(param: BaseType): param is ObjectType;
|
|
227
|
-
declare function isEnumType(param: BaseType): param is EnumType;
|
|
228
|
-
declare function isArrayType(param: BaseType): param is ArrayType;
|
|
229
|
-
declare function isNestedObjectLiteralType(param: BaseType): param is NestedObjectLiteralType;
|
|
230
|
-
declare function isIntersectionType(param: BaseType): param is IntersectionType;
|
|
231
|
-
declare function isUnionType(param: BaseType): param is UnionType;
|
|
232
|
-
declare function isTupleType(param: BaseType): param is TupleType;
|
|
233
|
-
declare function isRefEnumType(param: BaseType): param is RefEnumType;
|
|
234
|
-
declare function isRefObjectType(param: BaseType): param is RefObjectType;
|
|
235
|
-
declare function isRefAliasType(param: BaseType): param is RefAliasType;
|
|
236
|
-
declare function isReferenceType(param: BaseType): param is ReferenceType;
|
|
237
|
-
declare function isPrimitiveType(type: BaseType): type is PrimitiveType;
|
|
238
|
-
//#endregion
|
|
239
|
-
//#region src/core/error/base.d.ts
|
|
240
|
-
declare class MetadataError extends BaseError {}
|
|
241
|
-
//#endregion
|
|
242
|
-
//#region src/core/resolver/error.d.ts
|
|
243
|
-
declare class ResolverError extends MetadataError {
|
|
244
|
-
readonly file?: string;
|
|
245
|
-
readonly line?: number;
|
|
246
|
-
constructor(message: string, node?: Node | TypeNode, options?: boolean | {
|
|
247
|
-
onlyCurrent?: boolean;
|
|
248
|
-
cause?: unknown;
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
declare function isResolverError(input: unknown): input is ResolverError;
|
|
252
|
-
declare function prettyLocationOfNode(node: Node | TypeNode): {
|
|
253
|
-
text: string;
|
|
254
|
-
file: string;
|
|
255
|
-
line?: number;
|
|
256
|
-
} | undefined;
|
|
257
|
-
declare function prettyTroubleCause(node: Node | TypeNode, onlyCurrent?: boolean): string;
|
|
258
|
-
//#endregion
|
|
259
|
-
//#region src/core/generator/types.d.ts
|
|
260
|
-
type Security = Record<string, string[]>;
|
|
261
|
-
type Example = {
|
|
262
|
-
value: unknown | unknown[];
|
|
263
|
-
summary?: string;
|
|
264
|
-
description?: string;
|
|
265
|
-
label?: string;
|
|
266
|
-
};
|
|
267
|
-
type Response = {
|
|
268
|
-
description: string;
|
|
269
|
-
examples?: Example[];
|
|
270
|
-
headers?: NestedObjectLiteralType | RefObjectType;
|
|
271
|
-
name: string;
|
|
272
|
-
produces?: string[];
|
|
273
|
-
status: string;
|
|
274
|
-
schema?: BaseType;
|
|
275
|
-
};
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/core/parameter/constants.d.ts
|
|
278
|
-
declare const ParameterSource: {
|
|
279
|
-
readonly BODY: "body";
|
|
280
|
-
readonly BODY_PROP: "bodyProp";
|
|
281
|
-
readonly CONTEXT: "context";
|
|
282
|
-
readonly COOKIE: "cookie";
|
|
283
|
-
readonly HEADER: "header";
|
|
284
|
-
readonly FORM_DATA: "formData";
|
|
285
|
-
readonly QUERY: "query";
|
|
286
|
-
readonly QUERY_PROP: "queryProp";
|
|
287
|
-
readonly PATH: "path";
|
|
288
|
-
};
|
|
289
|
-
type ParameterSource = typeof ParameterSource[keyof typeof ParameterSource];
|
|
290
|
-
declare const CollectionFormat: {
|
|
291
|
-
readonly CSV: "csv";
|
|
292
|
-
readonly SSV: "ssv";
|
|
293
|
-
readonly TSV: "tsv";
|
|
294
|
-
readonly PIPES: "pipes";
|
|
295
|
-
readonly MULTI: "multi";
|
|
296
|
-
};
|
|
297
|
-
type CollectionFormat = typeof CollectionFormat[keyof typeof CollectionFormat];
|
|
298
|
-
declare const ParameterErrorCode: {
|
|
299
|
-
readonly TYPE_UNSUPPORTED: "PARAMETER_TYPE_UNSUPPORTED";
|
|
300
|
-
readonly METHOD_UNSUPPORTED: "PARAMETER_METHOD_UNSUPPORTED";
|
|
301
|
-
readonly PATH_MISMATCH: "PARAMETER_PATH_MISMATCH";
|
|
302
|
-
readonly SCOPE_REQUIRED: "PARAMETER_SCOPE_REQUIRED";
|
|
303
|
-
readonly INVALID_EXAMPLE: "PARAMETER_INVALID_EXAMPLE";
|
|
304
|
-
};
|
|
305
|
-
//#endregion
|
|
306
|
-
//#region src/core/parameter/types.d.ts
|
|
307
|
-
type Parameter = {
|
|
308
|
-
parameterName: string;
|
|
309
|
-
description: string;
|
|
310
|
-
in: `${ParameterSource}`;
|
|
311
|
-
name: string;
|
|
312
|
-
required: boolean;
|
|
313
|
-
type: Type;
|
|
314
|
-
collectionFormat?: `${CollectionFormat}`;
|
|
315
|
-
allowEmptyValue?: boolean;
|
|
316
|
-
default?: any;
|
|
317
|
-
maxItems?: number;
|
|
318
|
-
minItems?: number;
|
|
319
|
-
deprecated?: boolean;
|
|
320
|
-
examples?: Example[];
|
|
321
|
-
exampleLabels?: string[];
|
|
322
|
-
extensions: Extension[];
|
|
323
|
-
validators?: Record<string, Validator>;
|
|
324
|
-
};
|
|
325
|
-
type ArrayParameter = Parameter & {
|
|
326
|
-
type: ArrayType;
|
|
327
|
-
};
|
|
328
|
-
interface IParameterGenerator {
|
|
329
|
-
generate(): Parameter[];
|
|
330
|
-
}
|
|
331
|
-
//#endregion
|
|
332
|
-
//#region src/core/method/types.d.ts
|
|
333
|
-
type Method = {
|
|
334
|
-
operationId?: string;
|
|
335
|
-
deprecated?: boolean;
|
|
336
|
-
description: string;
|
|
337
|
-
method: MethodType;
|
|
338
|
-
extensions: Extension[];
|
|
339
|
-
name: string;
|
|
340
|
-
parameters: Parameter[];
|
|
341
|
-
path: string;
|
|
342
|
-
type: BaseType;
|
|
343
|
-
tags: string[];
|
|
344
|
-
responses: Response[];
|
|
345
|
-
security?: Security[];
|
|
346
|
-
summary?: string;
|
|
347
|
-
consumes: string[];
|
|
348
|
-
produces: string[];
|
|
349
|
-
hidden: boolean;
|
|
350
|
-
};
|
|
351
|
-
type MethodType = 'get' | 'post' | 'put' | 'delete' | 'options' | 'head' | 'patch';
|
|
352
|
-
//#endregion
|
|
353
|
-
//#region src/core/controller/types.d.ts
|
|
354
|
-
type Controller = {
|
|
355
|
-
/**
|
|
356
|
-
* Allowed Content-Types to pass
|
|
357
|
-
* data according the definition.
|
|
358
|
-
*
|
|
359
|
-
* i.e. ['application/json']
|
|
360
|
-
*/
|
|
361
|
-
consumes: string[];
|
|
362
|
-
/**
|
|
363
|
-
* Whether every operation under this controller should be considered
|
|
364
|
-
* deprecated. OpenAPI has no controller-level `deprecated` field — emitters
|
|
365
|
-
* should cascade this flag to each emitted operation (combined with the
|
|
366
|
-
* method's own `deprecated`).
|
|
367
|
-
*/
|
|
368
|
-
deprecated?: boolean;
|
|
369
|
-
/**
|
|
370
|
-
* Vendor extensions (x-* keys) declared on the controller class.
|
|
371
|
-
*/
|
|
372
|
-
extensions: Extension[];
|
|
373
|
-
/**
|
|
374
|
-
* Is controller hidden, and should
|
|
375
|
-
* not be used/displayed in some scenarios.
|
|
376
|
-
*/
|
|
377
|
-
hidden: boolean;
|
|
378
|
-
/**
|
|
379
|
-
* File Location of the Controller.
|
|
380
|
-
*/
|
|
381
|
-
location: string;
|
|
382
|
-
/**
|
|
383
|
-
* Array of found method ( class functions )
|
|
384
|
-
* for a specific controller (class)
|
|
385
|
-
*/
|
|
386
|
-
methods: Method[];
|
|
387
|
-
name: string;
|
|
388
|
-
/**
|
|
389
|
-
* Relative URL paths the controller mounts at, e.g. ['/users'] or
|
|
390
|
-
* ['/roles', '/realms/:id/roles'] for multi-mounting.
|
|
391
|
-
*
|
|
392
|
-
* Always non-empty; a controller declared with no path argument has
|
|
393
|
-
* `paths: ['']`.
|
|
394
|
-
*/
|
|
395
|
-
paths: string[];
|
|
396
|
-
/**
|
|
397
|
-
* Possible Content-Types to receive
|
|
398
|
-
* data according the definition.
|
|
399
|
-
*
|
|
400
|
-
* i.e. ['application/json']
|
|
401
|
-
*/
|
|
402
|
-
produces: string[];
|
|
403
|
-
responses: Response[];
|
|
404
|
-
/**
|
|
405
|
-
* Tags can be used to group controllers
|
|
406
|
-
* by a name together.
|
|
407
|
-
*
|
|
408
|
-
* i.e. ['auth']
|
|
409
|
-
*/
|
|
410
|
-
tags: string[];
|
|
411
|
-
security?: Security[];
|
|
412
|
-
};
|
|
413
|
-
interface IControllerGenerator {
|
|
414
|
-
isValid(): boolean;
|
|
415
|
-
generate(): Controller | null;
|
|
416
|
-
}
|
|
417
|
-
//#endregion
|
|
418
|
-
//#region src/core/method/constants.d.ts
|
|
419
|
-
declare const MethodName: {
|
|
420
|
-
readonly ALL: "ALL";
|
|
421
|
-
readonly GET: "GET";
|
|
422
|
-
readonly POST: "POST";
|
|
423
|
-
readonly PUT: "PUT";
|
|
424
|
-
readonly DELETE: "DELETE";
|
|
425
|
-
readonly PATCH: "PATCH";
|
|
426
|
-
readonly OPTIONS: "OPTIONS";
|
|
427
|
-
readonly HEAD: "HEAD";
|
|
428
|
-
};
|
|
429
|
-
type MethodName = typeof MethodName[keyof typeof MethodName];
|
|
430
|
-
//#endregion
|
|
431
|
-
//#region src/core/parameter/error.d.ts
|
|
432
|
-
type UnsupportedTypeContext = {
|
|
433
|
-
decoratorName: string;
|
|
434
|
-
propertyName: string;
|
|
435
|
-
type: BaseType;
|
|
436
|
-
node?: Node;
|
|
437
|
-
};
|
|
438
|
-
type UnsupportedMethodContext = {
|
|
439
|
-
decoratorName: string;
|
|
440
|
-
propertyName: string;
|
|
441
|
-
method: string;
|
|
442
|
-
node?: Node;
|
|
443
|
-
};
|
|
444
|
-
type PathMatchInvalidContext = {
|
|
445
|
-
decoratorName: string;
|
|
446
|
-
propertyName: string;
|
|
447
|
-
path: string;
|
|
448
|
-
node?: Node;
|
|
449
|
-
};
|
|
450
|
-
type ScopeRequiredContext = {
|
|
451
|
-
decoratorName: string;
|
|
452
|
-
node?: Node;
|
|
453
|
-
};
|
|
454
|
-
declare class ParameterError extends MetadataError {
|
|
455
|
-
static typeUnsupported(context: UnsupportedTypeContext): ParameterError;
|
|
456
|
-
static methodUnsupported(context: UnsupportedMethodContext): ParameterError;
|
|
457
|
-
static invalidPathMatch(context: PathMatchInvalidContext): ParameterError;
|
|
458
|
-
static scopeRequired(context: ScopeRequiredContext): ParameterError;
|
|
459
|
-
static invalidExampleSchema(): ParameterError;
|
|
460
|
-
static getCurrentLocation(node: Node): string;
|
|
461
|
-
}
|
|
462
|
-
//#endregion
|
|
463
|
-
//#region src/core/generator/error.d.ts
|
|
464
|
-
declare class GeneratorError extends MetadataError {}
|
|
465
|
-
declare function isGeneratorError(input: unknown): input is GeneratorError & {
|
|
466
|
-
code: string;
|
|
467
|
-
};
|
|
468
|
-
//#endregion
|
|
469
|
-
//#region src/core/generator/constants.d.ts
|
|
470
|
-
declare const GeneratorErrorCode: {
|
|
471
|
-
readonly CONTROLLER_NO_SOURCE_FILE: "GENERATOR_CONTROLLER_NO_SOURCE_FILE";
|
|
472
|
-
readonly CONTROLLER_NO_NAME: "GENERATOR_CONTROLLER_NO_NAME";
|
|
473
|
-
readonly PARAMETER_GENERATION_FAILED: "GENERATOR_PARAMETER_GENERATION_FAILED";
|
|
474
|
-
readonly BODY_PARAMETER_DUPLICATE: "GENERATOR_BODY_PARAMETER_DUPLICATE";
|
|
475
|
-
readonly BODY_FORM_CONFLICT: "GENERATOR_BODY_FORM_CONFLICT";
|
|
476
|
-
};
|
|
477
|
-
//#endregion
|
|
478
5
|
//#region src/adapters/cache/types.d.ts
|
|
479
6
|
interface CacheOptions {
|
|
480
7
|
/**
|
|
@@ -553,238 +80,6 @@ declare const CACHE_FILE_SUFFIX = ".json";
|
|
|
553
80
|
/** 7 days. */
|
|
554
81
|
declare const CACHE_DEFAULT_MAX_AGE_MS: number;
|
|
555
82
|
//#endregion
|
|
556
|
-
//#region src/adapters/decorator/constants.d.ts
|
|
557
|
-
declare const ParamKind: {
|
|
558
|
-
readonly Body: "body";
|
|
559
|
-
readonly BodyProp: "bodyProp";
|
|
560
|
-
readonly Context: "context";
|
|
561
|
-
readonly Cookie: "cookie";
|
|
562
|
-
readonly Header: "header";
|
|
563
|
-
readonly FormData: "formData";
|
|
564
|
-
readonly Query: "query";
|
|
565
|
-
readonly QueryProp: "queryProp";
|
|
566
|
-
readonly Path: "path";
|
|
567
|
-
};
|
|
568
|
-
type ParamKind = typeof ParamKind[keyof typeof ParamKind];
|
|
569
|
-
declare const CollectionKind: {
|
|
570
|
-
readonly Csv: "csv";
|
|
571
|
-
readonly Ssv: "ssv";
|
|
572
|
-
readonly Tsv: "tsv";
|
|
573
|
-
readonly Pipes: "pipes";
|
|
574
|
-
readonly Multi: "multi";
|
|
575
|
-
};
|
|
576
|
-
type CollectionKind = typeof CollectionKind[keyof typeof CollectionKind];
|
|
577
|
-
declare const DecoratorTargetKind: {
|
|
578
|
-
readonly Class: "class";
|
|
579
|
-
readonly Method: "method";
|
|
580
|
-
readonly Parameter: "parameter";
|
|
581
|
-
readonly Property: "property";
|
|
582
|
-
};
|
|
583
|
-
type DecoratorTargetKind = typeof DecoratorTargetKind[keyof typeof DecoratorTargetKind];
|
|
584
|
-
declare const DecoratorArgumentKindName: {
|
|
585
|
-
readonly Literal: "literal";
|
|
586
|
-
readonly Object: "object";
|
|
587
|
-
readonly Array: "array";
|
|
588
|
-
readonly Identifier: "identifier";
|
|
589
|
-
readonly Unresolvable: "unresolvable";
|
|
590
|
-
};
|
|
591
|
-
type DecoratorArgumentKindName = typeof DecoratorArgumentKindName[keyof typeof DecoratorArgumentKindName];
|
|
592
|
-
declare const MarkerName: {
|
|
593
|
-
readonly Hidden: "hidden";
|
|
594
|
-
readonly Deprecated: "deprecated";
|
|
595
|
-
readonly Extension: "extension";
|
|
596
|
-
};
|
|
597
|
-
type MarkerName = typeof MarkerName[keyof typeof MarkerName];
|
|
598
|
-
declare const NumericKind: {
|
|
599
|
-
readonly Int: "int";
|
|
600
|
-
readonly Long: "long";
|
|
601
|
-
readonly Float: "float";
|
|
602
|
-
readonly Double: "double";
|
|
603
|
-
};
|
|
604
|
-
type NumericKind = typeof NumericKind[keyof typeof NumericKind];
|
|
605
|
-
//#endregion
|
|
606
|
-
//#region src/adapters/decorator/types.d.ts
|
|
607
|
-
type DecoratorTarget = `${DecoratorTargetKind}`;
|
|
608
|
-
type DecoratorArgumentKind = `${DecoratorArgumentKindName}`;
|
|
609
|
-
type DecoratorArgument = {
|
|
610
|
-
raw: unknown;
|
|
611
|
-
kind: DecoratorArgumentKind;
|
|
612
|
-
};
|
|
613
|
-
type DecoratorTypeArgument = {
|
|
614
|
-
resolve: () => Type;
|
|
615
|
-
};
|
|
616
|
-
type DecoratorHost = {
|
|
617
|
-
name: string;
|
|
618
|
-
parentName?: string;
|
|
619
|
-
};
|
|
620
|
-
type DecoratorSource = {
|
|
621
|
-
name: string;
|
|
622
|
-
arguments: DecoratorArgument[];
|
|
623
|
-
typeArguments: DecoratorTypeArgument[];
|
|
624
|
-
target: DecoratorTarget;
|
|
625
|
-
host: DecoratorHost;
|
|
626
|
-
/**
|
|
627
|
-
* Source-file location of the decorator AST node itself (1-based line).
|
|
628
|
-
* Optional because decorator sources can be synthesised in tests without
|
|
629
|
-
* a real source file. Populated by {@link buildDecoratorSources} when the
|
|
630
|
-
* decorator's containing source file is available.
|
|
631
|
-
*/
|
|
632
|
-
location?: {
|
|
633
|
-
file: string;
|
|
634
|
-
line: number;
|
|
635
|
-
};
|
|
636
|
-
};
|
|
637
|
-
type JsDocSource = {
|
|
638
|
-
tag: string;
|
|
639
|
-
text?: string;
|
|
640
|
-
typeExpression?: {
|
|
641
|
-
resolve: () => Type;
|
|
642
|
-
};
|
|
643
|
-
parameterName?: string;
|
|
644
|
-
target: DecoratorTarget;
|
|
645
|
-
host: DecoratorHost;
|
|
646
|
-
};
|
|
647
|
-
type ControllerDraft = {
|
|
648
|
-
name: string;
|
|
649
|
-
location: string;
|
|
650
|
-
paths?: string[];
|
|
651
|
-
hidden: boolean;
|
|
652
|
-
deprecated?: boolean;
|
|
653
|
-
consumes: string[];
|
|
654
|
-
produces: string[];
|
|
655
|
-
tags: string[];
|
|
656
|
-
responses: Response[];
|
|
657
|
-
security: Security[];
|
|
658
|
-
extensions: Extension[];
|
|
659
|
-
};
|
|
660
|
-
type MethodDraft = {
|
|
661
|
-
name: string;
|
|
662
|
-
verb?: MethodType;
|
|
663
|
-
path: string;
|
|
664
|
-
operationId?: string;
|
|
665
|
-
description: string;
|
|
666
|
-
summary?: string;
|
|
667
|
-
deprecated?: boolean;
|
|
668
|
-
hidden: boolean;
|
|
669
|
-
consumes: string[];
|
|
670
|
-
produces: string[];
|
|
671
|
-
tags: string[];
|
|
672
|
-
responses: Response[];
|
|
673
|
-
security: Security[];
|
|
674
|
-
extensions: Extension[];
|
|
675
|
-
parameters: ParameterDraft[];
|
|
676
|
-
type?: BaseType;
|
|
677
|
-
/**
|
|
678
|
-
* Examples that handlers (e.g. `@Example`) want attached to the implicitly
|
|
679
|
-
* generated default response. The orchestrator merges these into the
|
|
680
|
-
* default 200/204 response when finalising the method.
|
|
681
|
-
*/
|
|
682
|
-
defaultResponseExamples: Example[];
|
|
683
|
-
};
|
|
684
|
-
type ParameterDraft = {
|
|
685
|
-
parameterName: string;
|
|
686
|
-
name: string;
|
|
687
|
-
in?: `${ParamKind}`;
|
|
688
|
-
description: string;
|
|
689
|
-
required: boolean;
|
|
690
|
-
type?: Type;
|
|
691
|
-
collectionFormat?: `${CollectionKind}`;
|
|
692
|
-
allowEmptyValue?: boolean;
|
|
693
|
-
default?: unknown;
|
|
694
|
-
maxItems?: number;
|
|
695
|
-
minItems?: number;
|
|
696
|
-
deprecated?: boolean;
|
|
697
|
-
examples: Example[];
|
|
698
|
-
exampleLabels: string[];
|
|
699
|
-
extensions: Extension[];
|
|
700
|
-
validators: Record<string, Validator>;
|
|
701
|
-
};
|
|
702
|
-
type HandlerContext = {
|
|
703
|
-
host: DecoratorHost;
|
|
704
|
-
argument: (index: number) => DecoratorArgument | undefined;
|
|
705
|
-
arguments: () => DecoratorArgument[];
|
|
706
|
-
typeArgument: (index: number) => DecoratorTypeArgument | undefined;
|
|
707
|
-
typeArguments: () => DecoratorTypeArgument[];
|
|
708
|
-
parameterType: () => Type | undefined;
|
|
709
|
-
};
|
|
710
|
-
type JsDocHandlerContext = {
|
|
711
|
-
host: DecoratorHost;
|
|
712
|
-
source: JsDocSource;
|
|
713
|
-
parameterType: () => Type | undefined;
|
|
714
|
-
};
|
|
715
|
-
type Match = {
|
|
716
|
-
name: string;
|
|
717
|
-
on?: DecoratorTarget;
|
|
718
|
-
};
|
|
719
|
-
type JsDocMatch = {
|
|
720
|
-
tag: string;
|
|
721
|
-
on?: DecoratorTarget;
|
|
722
|
-
};
|
|
723
|
-
type ReplacesPolicy = true | string;
|
|
724
|
-
/**
|
|
725
|
-
* Tags a handler with a semantic concept that the type resolver consults.
|
|
726
|
-
*
|
|
727
|
-
* Allows preset authors to rename a decorator (via `match.name`) without
|
|
728
|
-
* breaking type-resolver behaviour: the resolver looks up handlers by marker
|
|
729
|
-
* and reads the canonical decorator name from each handler's `match.name`.
|
|
730
|
-
*/
|
|
731
|
-
type ResolverMarker = `${MarkerName}` | {
|
|
732
|
-
numeric: `${NumericKind}`;
|
|
733
|
-
};
|
|
734
|
-
type HandlerBase = {
|
|
735
|
-
match: Match;
|
|
736
|
-
replaces?: ReplacesPolicy;
|
|
737
|
-
marker?: ResolverMarker;
|
|
738
|
-
};
|
|
739
|
-
type ControllerHandler = HandlerBase & {
|
|
740
|
-
apply: (ctx: HandlerContext, draft: ControllerDraft) => void;
|
|
741
|
-
};
|
|
742
|
-
type MethodHandler = HandlerBase & {
|
|
743
|
-
apply: (ctx: HandlerContext, draft: MethodDraft) => void;
|
|
744
|
-
};
|
|
745
|
-
type ParameterHandler = HandlerBase & {
|
|
746
|
-
apply: (ctx: HandlerContext, draft: ParameterDraft) => void;
|
|
747
|
-
};
|
|
748
|
-
type JsDocHandlerBase = {
|
|
749
|
-
match: JsDocMatch;
|
|
750
|
-
replaces?: ReplacesPolicy;
|
|
751
|
-
marker?: ResolverMarker;
|
|
752
|
-
};
|
|
753
|
-
type ControllerJsDocHandler = JsDocHandlerBase & {
|
|
754
|
-
apply: (ctx: JsDocHandlerContext, draft: ControllerDraft) => void;
|
|
755
|
-
};
|
|
756
|
-
type MethodJsDocHandler = JsDocHandlerBase & {
|
|
757
|
-
apply: (ctx: JsDocHandlerContext, draft: MethodDraft) => void;
|
|
758
|
-
};
|
|
759
|
-
type ParameterJsDocHandler = JsDocHandlerBase & {
|
|
760
|
-
apply: (ctx: JsDocHandlerContext, draft: ParameterDraft) => void;
|
|
761
|
-
};
|
|
762
|
-
type AnyDecoratorHandler = ControllerHandler | MethodHandler | ParameterHandler;
|
|
763
|
-
type AnyJsDocHandler = ControllerJsDocHandler | MethodJsDocHandler | ParameterJsDocHandler;
|
|
764
|
-
type Preset = {
|
|
765
|
-
name: string;
|
|
766
|
-
extends?: string[];
|
|
767
|
-
controllers?: ControllerHandler[];
|
|
768
|
-
methods?: MethodHandler[];
|
|
769
|
-
parameters?: ParameterHandler[];
|
|
770
|
-
controllerJsDoc?: ControllerJsDocHandler[];
|
|
771
|
-
methodJsDoc?: MethodJsDocHandler[];
|
|
772
|
-
parameterJsDoc?: ParameterJsDocHandler[];
|
|
773
|
-
};
|
|
774
|
-
type Registry = {
|
|
775
|
-
controllers: ControllerHandler[];
|
|
776
|
-
methods: MethodHandler[];
|
|
777
|
-
parameters: ParameterHandler[];
|
|
778
|
-
controllerJsDoc: ControllerJsDocHandler[];
|
|
779
|
-
methodJsDoc: MethodJsDocHandler[];
|
|
780
|
-
parameterJsDoc: ParameterJsDocHandler[];
|
|
781
|
-
};
|
|
782
|
-
type PresetResolver = (name: string) => Promise<Preset> | Preset;
|
|
783
|
-
type LoadRegistryOptions = {
|
|
784
|
-
resolver: PresetResolver;
|
|
785
|
-
strict?: boolean;
|
|
786
|
-
};
|
|
787
|
-
//#endregion
|
|
788
83
|
//#region src/adapters/cache/utils.d.ts
|
|
789
84
|
declare function buildCacheOptions(input?: string | boolean | CacheOptionsInput): CacheOptions;
|
|
790
85
|
type CacheKeyParts = {
|
|
@@ -813,507 +108,6 @@ declare function hashCompilerOptions(options?: CompilerOptions): string;
|
|
|
813
108
|
*/
|
|
814
109
|
declare function hashRegistry(registry: Registry): string;
|
|
815
110
|
//#endregion
|
|
816
|
-
//#region src/adapters/decorator/helpers.d.ts
|
|
817
|
-
/**
|
|
818
|
-
* Read a positional argument as a string. Accepts both literal string args
|
|
819
|
-
* (`@Foo('value')`) and identifier references that resolve to a string
|
|
820
|
-
* (`@Foo(SOME_CONSTANT)`). Returns `undefined` for any other argument shape.
|
|
821
|
-
*/
|
|
822
|
-
declare function readString(arg: DecoratorArgument | undefined): string | undefined;
|
|
823
|
-
/**
|
|
824
|
-
* Read a positional argument as a number. Only matches numeric literals.
|
|
825
|
-
*/
|
|
826
|
-
declare function readNumber(arg: DecoratorArgument | undefined): number | undefined;
|
|
827
|
-
/**
|
|
828
|
-
* Read a positional argument as a boolean. Only matches boolean literals.
|
|
829
|
-
*/
|
|
830
|
-
declare function readBoolean(arg: DecoratorArgument | undefined): boolean | undefined;
|
|
831
|
-
/**
|
|
832
|
-
* Read a positional argument that may be either a single string or an array
|
|
833
|
-
* of strings. Returns `undefined` when the argument is missing, when any
|
|
834
|
-
* array element is non-string, or otherwise unresolvable. All-or-nothing:
|
|
835
|
-
* never returns a partial array with non-string items silently dropped.
|
|
836
|
-
*/
|
|
837
|
-
declare function readStringOrStringArray(arg: DecoratorArgument | undefined): string[] | undefined;
|
|
838
|
-
/**
|
|
839
|
-
* Convenience for the common controller path assignment. Reads the first
|
|
840
|
-
* argument as a string-or-string-array and writes it to `draft.paths`,
|
|
841
|
-
* defaulting to `['']` when the argument is missing or unresolvable. Use this
|
|
842
|
-
* inside a `controller({ match, apply })` handler to declare a class as a
|
|
843
|
-
* controller.
|
|
844
|
-
*/
|
|
845
|
-
declare function setControllerPaths(draft: ControllerDraft, arg: DecoratorArgument | undefined): void;
|
|
846
|
-
/**
|
|
847
|
-
* Convenience for the common method path assignment. Reads the first argument
|
|
848
|
-
* as a string and writes it to `draft.path` if present; leaves the field
|
|
849
|
-
* untouched otherwise (the orchestrator initialises it to `''`).
|
|
850
|
-
*/
|
|
851
|
-
declare function setMethodPath(draft: MethodDraft, arg: DecoratorArgument | undefined): void;
|
|
852
|
-
//#endregion
|
|
853
|
-
//#region src/adapters/decorator/module.d.ts
|
|
854
|
-
declare function loadRegistry(preset: Preset, options: LoadRegistryOptions): Promise<Registry>;
|
|
855
|
-
/**
|
|
856
|
-
* Resolve a preset by string identifier (npm package, relative path, etc.) and
|
|
857
|
-
* return the v2 Preset object. Looks for a `preset` named export, then the
|
|
858
|
-
* default export, then the module itself.
|
|
859
|
-
*/
|
|
860
|
-
declare function resolvePresetByName(input: string): Promise<Preset>;
|
|
861
|
-
/**
|
|
862
|
-
* Resolve a preset by name and immediately materialize its registry, recursively
|
|
863
|
-
* loading `extends` parents through the same resolver.
|
|
864
|
-
*/
|
|
865
|
-
declare function loadRegistryByName(input: string): Promise<Registry>;
|
|
866
|
-
//#endregion
|
|
867
|
-
//#region src/adapters/decorator/test-helpers.d.ts
|
|
868
|
-
/**
|
|
869
|
-
* Build a literal-kind {@link DecoratorArgument} from a primitive value.
|
|
870
|
-
* Use this in unit tests to feed handlers a mock argument:
|
|
871
|
-
*
|
|
872
|
-
* ```ts
|
|
873
|
-
* const ctx = createHandlerContext({ args: [literalArg('users')] });
|
|
874
|
-
* controllerHandler.apply(ctx, draft);
|
|
875
|
-
* ```
|
|
876
|
-
*/
|
|
877
|
-
declare function literalArg(raw: string | number | boolean | null): DecoratorArgument;
|
|
878
|
-
/**
|
|
879
|
-
* Build an identifier-kind {@link DecoratorArgument} (e.g. `@Foo(SOME_CONSTANT)`).
|
|
880
|
-
* `raw` is the resolved value the identifier points to — typically a string.
|
|
881
|
-
*/
|
|
882
|
-
declare function identifierArg(raw: unknown): DecoratorArgument;
|
|
883
|
-
/**
|
|
884
|
-
* Build an array-kind {@link DecoratorArgument} (e.g. `@Foo(['a', 'b'])`).
|
|
885
|
-
*/
|
|
886
|
-
declare function arrayArg(raw: unknown[]): DecoratorArgument;
|
|
887
|
-
/**
|
|
888
|
-
* Build an object-kind {@link DecoratorArgument} (e.g. `@Foo({ key: 'value' })`).
|
|
889
|
-
*/
|
|
890
|
-
declare function objectArg(raw: Record<string, unknown>): DecoratorArgument;
|
|
891
|
-
/**
|
|
892
|
-
* Build an unresolvable-kind {@link DecoratorArgument} — represents arguments
|
|
893
|
-
* the source extractor couldn't statically evaluate (e.g. function calls,
|
|
894
|
-
* unknown identifiers).
|
|
895
|
-
*/
|
|
896
|
-
declare function unresolvableArg(): DecoratorArgument;
|
|
897
|
-
/**
|
|
898
|
-
* Build a {@link DecoratorTypeArgument} stub that returns the supplied type
|
|
899
|
-
* when `resolve()` is called.
|
|
900
|
-
*/
|
|
901
|
-
declare function typeArg(type: Type): DecoratorTypeArgument;
|
|
902
|
-
type CreateHandlerContextInput = {
|
|
903
|
-
args?: DecoratorArgument[];
|
|
904
|
-
typeArgs?: DecoratorTypeArgument[];
|
|
905
|
-
host?: DecoratorHost;
|
|
906
|
-
parameterType?: Type;
|
|
907
|
-
};
|
|
908
|
-
/**
|
|
909
|
-
* Construct a {@link HandlerContext} for unit-testing handlers in isolation
|
|
910
|
-
* without spinning up the full TypeScript compiler / `generateMetadata`
|
|
911
|
-
* pipeline. Combine with the `*Arg(...)` builders to feed a handler a
|
|
912
|
-
* controlled mock decorator source.
|
|
913
|
-
*
|
|
914
|
-
* ```ts
|
|
915
|
-
* const ctx = createHandlerContext({ args: [literalArg('users')] });
|
|
916
|
-
* const draft = newControllerDraft({ name: 'UserController', location: '/x.ts' });
|
|
917
|
-
* myHandler.apply(ctx, draft);
|
|
918
|
-
* expect(draft.paths).toEqual(['users']);
|
|
919
|
-
* ```
|
|
920
|
-
*/
|
|
921
|
-
declare function createHandlerContext(input?: CreateHandlerContextInput): HandlerContext;
|
|
922
|
-
//#endregion
|
|
923
|
-
//#region src/adapters/decorator/orchestrator/types.d.ts
|
|
924
|
-
/**
|
|
925
|
-
* Reported when a decorator on a node has no matching handler in the
|
|
926
|
-
* supplied registry. The orchestrator computes file/line from the host node
|
|
927
|
-
* (1-based line number).
|
|
928
|
-
*/
|
|
929
|
-
type UnmatchedDecoratorReport = {
|
|
930
|
-
name: string;
|
|
931
|
-
target: DecoratorTarget;
|
|
932
|
-
host: DecoratorHost;
|
|
933
|
-
file: string;
|
|
934
|
-
line: number;
|
|
935
|
-
};
|
|
936
|
-
type ApplyHandlersOptions = {
|
|
937
|
-
target: DecoratorTarget;
|
|
938
|
-
host: DecoratorHost;
|
|
939
|
-
resolveTypeNode: (node: TypeNode) => Type;
|
|
940
|
-
parameterType?: () => Type | undefined;
|
|
941
|
-
typeChecker?: TypeChecker;
|
|
942
|
-
/**
|
|
943
|
-
* Optional reporter for decorator sources that no handler matched.
|
|
944
|
-
* The orchestrator builds a {@link DecoratorSource} for every decorator
|
|
945
|
-
* on the node; if iteration finishes without any handler claiming a
|
|
946
|
-
* source, this callback fires once for that source.
|
|
947
|
-
*/
|
|
948
|
-
onUnmatchedDecorator?: (report: UnmatchedDecoratorReport, source: DecoratorSource) => void;
|
|
949
|
-
};
|
|
950
|
-
//#endregion
|
|
951
|
-
//#region src/adapters/decorator/orchestrator/module.d.ts
|
|
952
|
-
type DecoratorHandlerLike<D> = {
|
|
953
|
-
match: Match;
|
|
954
|
-
apply: (ctx: HandlerContext, draft: D) => void;
|
|
955
|
-
};
|
|
956
|
-
type JsDocHandlerLike<D> = {
|
|
957
|
-
match: JsDocMatch;
|
|
958
|
-
apply: (ctx: JsDocHandlerContext, draft: D) => void;
|
|
959
|
-
};
|
|
960
|
-
declare function buildHandlerContext(source: DecoratorSource, options: ApplyHandlersOptions): HandlerContext;
|
|
961
|
-
declare function buildJsDocHandlerContext(source: JsDocSource, options: ApplyHandlersOptions): JsDocHandlerContext;
|
|
962
|
-
declare function applyDecoratorHandlers<D>(node: Node, handlers: DecoratorHandlerLike<D>[], draft: D, options: ApplyHandlersOptions): void;
|
|
963
|
-
declare function applyJsDocHandlers<D>(node: Node, handlers: JsDocHandlerLike<D>[], draft: D, options: ApplyHandlersOptions): void;
|
|
964
|
-
//#endregion
|
|
965
|
-
//#region src/adapters/decorator/typescript/types.d.ts
|
|
966
|
-
type DecoratorSourceBuilderOptions = {
|
|
967
|
-
target: DecoratorTarget;
|
|
968
|
-
host: DecoratorHost;
|
|
969
|
-
resolveTypeNode: (node: TypeNode) => Type;
|
|
970
|
-
typeChecker?: TypeChecker;
|
|
971
|
-
};
|
|
972
|
-
type JsDocSourceBuilderOptions = {
|
|
973
|
-
target: DecoratorTarget;
|
|
974
|
-
host: DecoratorHost;
|
|
975
|
-
resolveTypeNode: (node: TypeNode) => Type;
|
|
976
|
-
};
|
|
977
|
-
//#endregion
|
|
978
|
-
//#region src/adapters/decorator/typescript/module.d.ts
|
|
979
|
-
declare function buildDecoratorSources(node: Node, options: DecoratorSourceBuilderOptions): DecoratorSource[];
|
|
980
|
-
declare function buildJsDocSources(node: Node, options: JsDocSourceBuilderOptions): JsDocSource[];
|
|
981
|
-
//#endregion
|
|
982
|
-
//#region src/adapters/decorator/typescript/utils.d.ts
|
|
983
|
-
type RawDecorator = {
|
|
984
|
-
name: string;
|
|
985
|
-
arguments: DecoratorArgument[];
|
|
986
|
-
};
|
|
987
|
-
/**
|
|
988
|
-
* Enumerate decorators on a TS node and classify their argument values without
|
|
989
|
-
* going through the registry. Used by read-side consumers (type resolver,
|
|
990
|
-
* extension extraction) that only need decorator names + argument values.
|
|
991
|
-
*/
|
|
992
|
-
declare function readNodeDecorators(node: Node, typeChecker?: TypeChecker): RawDecorator[];
|
|
993
|
-
declare function findDecoratorByName(node: Node, name: string, typeChecker?: TypeChecker): RawDecorator | undefined;
|
|
994
|
-
declare function findDecoratorsByName(node: Node, name: string, typeChecker?: TypeChecker): RawDecorator[];
|
|
995
|
-
declare function hasDecoratorNamed(node: Node, name: string, typeChecker?: TypeChecker): boolean;
|
|
996
|
-
declare function buildDecoratorArgument(expr: Expression, typeChecker?: TypeChecker): DecoratorArgument;
|
|
997
|
-
//#endregion
|
|
998
|
-
//#region src/adapters/decorator/utils.d.ts
|
|
999
|
-
declare function matches(match: Match, source: Pick<DecoratorSource, 'name' | 'target'>): boolean;
|
|
1000
|
-
declare function matchesJsDoc(match: JsDocMatch, source: Pick<JsDocSource, 'tag' | 'target'>): boolean;
|
|
1001
|
-
declare function newControllerDraft(input: Pick<ControllerDraft, 'name' | 'location'>): ControllerDraft;
|
|
1002
|
-
declare function newMethodDraft(input: Pick<MethodDraft, 'name'>): MethodDraft;
|
|
1003
|
-
declare function newParameterDraft(input: Pick<ParameterDraft, 'parameterName'>): ParameterDraft;
|
|
1004
|
-
declare function createRegistry(): Registry;
|
|
1005
|
-
declare function generatePresetLookupPaths(input: string): string[];
|
|
1006
|
-
/**
|
|
1007
|
-
* Collect the unique decorator names of every handler whose `marker` matches
|
|
1008
|
-
* the given predicate. Lets the type resolver discover preset-renamed
|
|
1009
|
-
* decorators without hard-coding canonical names.
|
|
1010
|
-
*/
|
|
1011
|
-
declare function namesForMarker(registry: Registry, predicate: (marker: ResolverMarker) => boolean): Set<string>;
|
|
1012
|
-
/**
|
|
1013
|
-
* Collect the unique JSDoc tag names of every JSDoc handler whose `marker`
|
|
1014
|
-
* matches the given predicate. JSDoc analogue of `namesForMarker`.
|
|
1015
|
-
*/
|
|
1016
|
-
declare function tagsForMarker(registry: Registry, predicate: (marker: ResolverMarker) => boolean): Set<string>;
|
|
1017
|
-
declare function isHiddenMarker(marker: ResolverMarker): boolean;
|
|
1018
|
-
declare function isDeprecatedMarker(marker: ResolverMarker): boolean;
|
|
1019
|
-
declare function isExtensionMarker(marker: ResolverMarker): boolean;
|
|
1020
|
-
declare function numericMarkerKind(marker: ResolverMarker): 'int' | 'long' | 'float' | 'double' | undefined;
|
|
1021
|
-
declare const controller: (handler: ControllerHandler) => ControllerHandler;
|
|
1022
|
-
declare const method: (handler: MethodHandler) => MethodHandler;
|
|
1023
|
-
declare const parameter: (handler: ParameterHandler) => ParameterHandler;
|
|
1024
|
-
declare const controllerJsDoc: (handler: ControllerJsDocHandler) => ControllerJsDocHandler;
|
|
1025
|
-
declare const methodJsDoc: (handler: MethodJsDocHandler) => MethodJsDocHandler;
|
|
1026
|
-
declare const parameterJsDoc: (handler: ParameterJsDocHandler) => ParameterJsDocHandler;
|
|
1027
|
-
type AnyDraft = ControllerDraft | MethodDraft | ParameterDraft;
|
|
1028
|
-
type DraftApply = (ctx: HandlerContext, draft: AnyDraft) => void;
|
|
1029
|
-
declare function into(key: string): {
|
|
1030
|
-
positional(index: number): DraftApply;
|
|
1031
|
-
typeArgument(index?: number): DraftApply;
|
|
1032
|
-
};
|
|
1033
|
-
declare function append(key: string): {
|
|
1034
|
-
positional(index: number): DraftApply;
|
|
1035
|
-
positionalAll(): DraftApply;
|
|
1036
|
-
};
|
|
1037
|
-
declare function flag(key: string, value?: unknown): DraftApply;
|
|
1038
|
-
//#endregion
|
|
1039
|
-
//#region src/adapters/decorator/validation/module.d.ts
|
|
1040
|
-
declare const matchSchema: z.ZodObject<{
|
|
1041
|
-
name: z.ZodString;
|
|
1042
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1043
|
-
class: "class";
|
|
1044
|
-
method: "method";
|
|
1045
|
-
parameter: "parameter";
|
|
1046
|
-
property: "property";
|
|
1047
|
-
}>>;
|
|
1048
|
-
}, z.core.$strip>;
|
|
1049
|
-
declare const jsDocMatchSchema: z.ZodObject<{
|
|
1050
|
-
tag: z.ZodString;
|
|
1051
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1052
|
-
class: "class";
|
|
1053
|
-
method: "method";
|
|
1054
|
-
parameter: "parameter";
|
|
1055
|
-
property: "property";
|
|
1056
|
-
}>>;
|
|
1057
|
-
}, z.core.$strip>;
|
|
1058
|
-
declare const controllerHandlerSchema: z.ZodObject<{
|
|
1059
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1060
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1061
|
-
numeric: z.ZodEnum<{
|
|
1062
|
-
double: "double";
|
|
1063
|
-
float: "float";
|
|
1064
|
-
long: "long";
|
|
1065
|
-
int: "int";
|
|
1066
|
-
}>;
|
|
1067
|
-
}, z.core.$strip>]>>;
|
|
1068
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1069
|
-
match: z.ZodObject<{
|
|
1070
|
-
name: z.ZodString;
|
|
1071
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1072
|
-
class: "class";
|
|
1073
|
-
method: "method";
|
|
1074
|
-
parameter: "parameter";
|
|
1075
|
-
property: "property";
|
|
1076
|
-
}>>;
|
|
1077
|
-
}, z.core.$strip>;
|
|
1078
|
-
}, z.core.$strip>;
|
|
1079
|
-
declare const methodHandlerSchema: z.ZodObject<{
|
|
1080
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1081
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1082
|
-
numeric: z.ZodEnum<{
|
|
1083
|
-
double: "double";
|
|
1084
|
-
float: "float";
|
|
1085
|
-
long: "long";
|
|
1086
|
-
int: "int";
|
|
1087
|
-
}>;
|
|
1088
|
-
}, z.core.$strip>]>>;
|
|
1089
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1090
|
-
match: z.ZodObject<{
|
|
1091
|
-
name: z.ZodString;
|
|
1092
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1093
|
-
class: "class";
|
|
1094
|
-
method: "method";
|
|
1095
|
-
parameter: "parameter";
|
|
1096
|
-
property: "property";
|
|
1097
|
-
}>>;
|
|
1098
|
-
}, z.core.$strip>;
|
|
1099
|
-
}, z.core.$strip>;
|
|
1100
|
-
declare const parameterHandlerSchema: z.ZodObject<{
|
|
1101
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1102
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1103
|
-
numeric: z.ZodEnum<{
|
|
1104
|
-
double: "double";
|
|
1105
|
-
float: "float";
|
|
1106
|
-
long: "long";
|
|
1107
|
-
int: "int";
|
|
1108
|
-
}>;
|
|
1109
|
-
}, z.core.$strip>]>>;
|
|
1110
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1111
|
-
match: z.ZodObject<{
|
|
1112
|
-
name: z.ZodString;
|
|
1113
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1114
|
-
class: "class";
|
|
1115
|
-
method: "method";
|
|
1116
|
-
parameter: "parameter";
|
|
1117
|
-
property: "property";
|
|
1118
|
-
}>>;
|
|
1119
|
-
}, z.core.$strip>;
|
|
1120
|
-
}, z.core.$strip>;
|
|
1121
|
-
declare const controllerJsDocHandlerSchema: z.ZodObject<{
|
|
1122
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1123
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1124
|
-
numeric: z.ZodEnum<{
|
|
1125
|
-
double: "double";
|
|
1126
|
-
float: "float";
|
|
1127
|
-
long: "long";
|
|
1128
|
-
int: "int";
|
|
1129
|
-
}>;
|
|
1130
|
-
}, z.core.$strip>]>>;
|
|
1131
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1132
|
-
match: z.ZodObject<{
|
|
1133
|
-
tag: z.ZodString;
|
|
1134
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1135
|
-
class: "class";
|
|
1136
|
-
method: "method";
|
|
1137
|
-
parameter: "parameter";
|
|
1138
|
-
property: "property";
|
|
1139
|
-
}>>;
|
|
1140
|
-
}, z.core.$strip>;
|
|
1141
|
-
}, z.core.$strip>;
|
|
1142
|
-
declare const methodJsDocHandlerSchema: z.ZodObject<{
|
|
1143
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1144
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1145
|
-
numeric: z.ZodEnum<{
|
|
1146
|
-
double: "double";
|
|
1147
|
-
float: "float";
|
|
1148
|
-
long: "long";
|
|
1149
|
-
int: "int";
|
|
1150
|
-
}>;
|
|
1151
|
-
}, z.core.$strip>]>>;
|
|
1152
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1153
|
-
match: z.ZodObject<{
|
|
1154
|
-
tag: z.ZodString;
|
|
1155
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1156
|
-
class: "class";
|
|
1157
|
-
method: "method";
|
|
1158
|
-
parameter: "parameter";
|
|
1159
|
-
property: "property";
|
|
1160
|
-
}>>;
|
|
1161
|
-
}, z.core.$strip>;
|
|
1162
|
-
}, z.core.$strip>;
|
|
1163
|
-
declare const parameterJsDocHandlerSchema: z.ZodObject<{
|
|
1164
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1165
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1166
|
-
numeric: z.ZodEnum<{
|
|
1167
|
-
double: "double";
|
|
1168
|
-
float: "float";
|
|
1169
|
-
long: "long";
|
|
1170
|
-
int: "int";
|
|
1171
|
-
}>;
|
|
1172
|
-
}, z.core.$strip>]>>;
|
|
1173
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1174
|
-
match: z.ZodObject<{
|
|
1175
|
-
tag: z.ZodString;
|
|
1176
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1177
|
-
class: "class";
|
|
1178
|
-
method: "method";
|
|
1179
|
-
parameter: "parameter";
|
|
1180
|
-
property: "property";
|
|
1181
|
-
}>>;
|
|
1182
|
-
}, z.core.$strip>;
|
|
1183
|
-
}, z.core.$strip>;
|
|
1184
|
-
declare const presetSchema: z.ZodObject<{
|
|
1185
|
-
name: z.ZodString;
|
|
1186
|
-
extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1187
|
-
controllers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1188
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1189
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1190
|
-
numeric: z.ZodEnum<{
|
|
1191
|
-
double: "double";
|
|
1192
|
-
float: "float";
|
|
1193
|
-
long: "long";
|
|
1194
|
-
int: "int";
|
|
1195
|
-
}>;
|
|
1196
|
-
}, z.core.$strip>]>>;
|
|
1197
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1198
|
-
match: z.ZodObject<{
|
|
1199
|
-
name: z.ZodString;
|
|
1200
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1201
|
-
class: "class";
|
|
1202
|
-
method: "method";
|
|
1203
|
-
parameter: "parameter";
|
|
1204
|
-
property: "property";
|
|
1205
|
-
}>>;
|
|
1206
|
-
}, z.core.$strip>;
|
|
1207
|
-
}, z.core.$strip>>>;
|
|
1208
|
-
methods: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1209
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1210
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1211
|
-
numeric: z.ZodEnum<{
|
|
1212
|
-
double: "double";
|
|
1213
|
-
float: "float";
|
|
1214
|
-
long: "long";
|
|
1215
|
-
int: "int";
|
|
1216
|
-
}>;
|
|
1217
|
-
}, z.core.$strip>]>>;
|
|
1218
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1219
|
-
match: z.ZodObject<{
|
|
1220
|
-
name: z.ZodString;
|
|
1221
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1222
|
-
class: "class";
|
|
1223
|
-
method: "method";
|
|
1224
|
-
parameter: "parameter";
|
|
1225
|
-
property: "property";
|
|
1226
|
-
}>>;
|
|
1227
|
-
}, z.core.$strip>;
|
|
1228
|
-
}, z.core.$strip>>>;
|
|
1229
|
-
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1230
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1231
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1232
|
-
numeric: z.ZodEnum<{
|
|
1233
|
-
double: "double";
|
|
1234
|
-
float: "float";
|
|
1235
|
-
long: "long";
|
|
1236
|
-
int: "int";
|
|
1237
|
-
}>;
|
|
1238
|
-
}, z.core.$strip>]>>;
|
|
1239
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1240
|
-
match: z.ZodObject<{
|
|
1241
|
-
name: z.ZodString;
|
|
1242
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1243
|
-
class: "class";
|
|
1244
|
-
method: "method";
|
|
1245
|
-
parameter: "parameter";
|
|
1246
|
-
property: "property";
|
|
1247
|
-
}>>;
|
|
1248
|
-
}, z.core.$strip>;
|
|
1249
|
-
}, z.core.$strip>>>;
|
|
1250
|
-
controllerJsDoc: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1251
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1252
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1253
|
-
numeric: z.ZodEnum<{
|
|
1254
|
-
double: "double";
|
|
1255
|
-
float: "float";
|
|
1256
|
-
long: "long";
|
|
1257
|
-
int: "int";
|
|
1258
|
-
}>;
|
|
1259
|
-
}, z.core.$strip>]>>;
|
|
1260
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1261
|
-
match: z.ZodObject<{
|
|
1262
|
-
tag: z.ZodString;
|
|
1263
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1264
|
-
class: "class";
|
|
1265
|
-
method: "method";
|
|
1266
|
-
parameter: "parameter";
|
|
1267
|
-
property: "property";
|
|
1268
|
-
}>>;
|
|
1269
|
-
}, z.core.$strip>;
|
|
1270
|
-
}, z.core.$strip>>>;
|
|
1271
|
-
methodJsDoc: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1272
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1273
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1274
|
-
numeric: z.ZodEnum<{
|
|
1275
|
-
double: "double";
|
|
1276
|
-
float: "float";
|
|
1277
|
-
long: "long";
|
|
1278
|
-
int: "int";
|
|
1279
|
-
}>;
|
|
1280
|
-
}, z.core.$strip>]>>;
|
|
1281
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1282
|
-
match: z.ZodObject<{
|
|
1283
|
-
tag: z.ZodString;
|
|
1284
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1285
|
-
class: "class";
|
|
1286
|
-
method: "method";
|
|
1287
|
-
parameter: "parameter";
|
|
1288
|
-
property: "property";
|
|
1289
|
-
}>>;
|
|
1290
|
-
}, z.core.$strip>;
|
|
1291
|
-
}, z.core.$strip>>>;
|
|
1292
|
-
parameterJsDoc: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1293
|
-
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1294
|
-
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1295
|
-
numeric: z.ZodEnum<{
|
|
1296
|
-
double: "double";
|
|
1297
|
-
float: "float";
|
|
1298
|
-
long: "long";
|
|
1299
|
-
int: "int";
|
|
1300
|
-
}>;
|
|
1301
|
-
}, z.core.$strip>]>>;
|
|
1302
|
-
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1303
|
-
match: z.ZodObject<{
|
|
1304
|
-
tag: z.ZodString;
|
|
1305
|
-
on: z.ZodOptional<z.ZodEnum<{
|
|
1306
|
-
class: "class";
|
|
1307
|
-
method: "method";
|
|
1308
|
-
parameter: "parameter";
|
|
1309
|
-
property: "property";
|
|
1310
|
-
}>>;
|
|
1311
|
-
}, z.core.$strip>;
|
|
1312
|
-
}, z.core.$strip>>>;
|
|
1313
|
-
}, z.core.$strip>;
|
|
1314
|
-
declare function createPresetContainer(): Container<Preset>;
|
|
1315
|
-
declare function validatePreset(input: unknown): Promise<Preset>;
|
|
1316
|
-
//#endregion
|
|
1317
111
|
//#region src/adapters/filesystem/tsconfig/types.d.ts
|
|
1318
112
|
type TsconfigLoadContext = {
|
|
1319
113
|
cwd?: string;
|
|
@@ -1356,9 +150,29 @@ type MetadataGeneratorOptions = {
|
|
|
1356
150
|
*/
|
|
1357
151
|
cache?: string | boolean | Partial<CacheOptions>;
|
|
1358
152
|
/**
|
|
1359
|
-
*
|
|
153
|
+
* Decorator preset to load. Either:
|
|
154
|
+
* - a string identifier resolved via {@link resolvePresetByName}
|
|
155
|
+
* (npm package, relative path, or `module:` specifier), or
|
|
156
|
+
* - an inline {@link Preset} object (still walked through `loadRegistry`,
|
|
157
|
+
* so its `extends` chain — if any — is resolved by name).
|
|
158
|
+
*
|
|
159
|
+
* If both `preset` and `registry` are provided, the resolved preset
|
|
160
|
+
* registry comes first and the inline `registry` is appended after.
|
|
161
|
+
* Inline handlers therefore run last (winning on scalar mutations like
|
|
162
|
+
* `into('path')`) and additively contribute on `append`-style fields.
|
|
163
|
+
*/
|
|
164
|
+
preset?: string | Preset;
|
|
165
|
+
/**
|
|
166
|
+
* An already-resolved decorator {@link Registry}. Use this to wire
|
|
167
|
+
* decorator handlers manually without authoring a full {@link Preset}.
|
|
168
|
+
*
|
|
169
|
+
* If provided alongside `preset`, the registry is appended to the
|
|
170
|
+
* preset-derived registry (preset first, registry second). Inline
|
|
171
|
+
* handlers cannot carry `replaces` semantics — those are enforced at
|
|
172
|
+
* preset-load time. To remove a preset handler, author a `Preset` with
|
|
173
|
+
* `replaces` and pass it via `preset` instead.
|
|
1360
174
|
*/
|
|
1361
|
-
|
|
175
|
+
registry?: Registry;
|
|
1362
176
|
/**
|
|
1363
177
|
* Controls how unmatched decorators (decorators with no matching handler
|
|
1364
178
|
* in the resolved registry) are surfaced.
|
|
@@ -1405,21 +219,6 @@ type MetadataGeneratorContext = {
|
|
|
1405
219
|
interface IMetadataGenerator {
|
|
1406
220
|
generate(): Promise<Metadata>;
|
|
1407
221
|
}
|
|
1408
|
-
/**
|
|
1409
|
-
* The output specification for metadata generation.
|
|
1410
|
-
*/
|
|
1411
|
-
type Metadata = {
|
|
1412
|
-
/**
|
|
1413
|
-
* A Controller is a collection of grouped methods (GET, POST, ...)
|
|
1414
|
-
* for a common URL path (i.e /users) or an more explicit URL path (i.e. /users/:id).
|
|
1415
|
-
*/
|
|
1416
|
-
controllers: Controller[];
|
|
1417
|
-
/**
|
|
1418
|
-
* ReferenceTypes is an object of found types (interfaces, type, ...),
|
|
1419
|
-
* and classes which were detected during code analysis.
|
|
1420
|
-
*/
|
|
1421
|
-
referenceTypes: ReferenceTypes;
|
|
1422
|
-
};
|
|
1423
222
|
/**
|
|
1424
223
|
* Narrow context interface for the type resolver.
|
|
1425
224
|
* Contains only what TypeNodeResolver needs — no generator methods.
|
|
@@ -1457,30 +256,8 @@ interface IGeneratorContext extends IResolverContext, IReferenceTypeRegistry {
|
|
|
1457
256
|
reportUnmatchedDecorator?(report: UnmatchedDecoratorReport): void;
|
|
1458
257
|
}
|
|
1459
258
|
//#endregion
|
|
1460
|
-
//#region src/core/
|
|
1461
|
-
|
|
1462
|
-
//#endregion
|
|
1463
|
-
//#region src/core/validator/error.d.ts
|
|
1464
|
-
declare class ValidatorError extends MetadataError {}
|
|
1465
|
-
//#endregion
|
|
1466
|
-
//#region src/core/validator/constants.d.ts
|
|
1467
|
-
declare enum ValidatorName {
|
|
1468
|
-
UNIQUE_ITEMS = "uniqueItems",
|
|
1469
|
-
MINIMUM = "minimum",
|
|
1470
|
-
MAXIMUM = "maximum",
|
|
1471
|
-
MIN_ITEMS = "minItems",
|
|
1472
|
-
MAX_ITEMS = "maxItems",
|
|
1473
|
-
MIN_LENGTH = "minLength",
|
|
1474
|
-
MAX_LENGTH = "maxLength",
|
|
1475
|
-
MIN_DATE = "minDate",
|
|
1476
|
-
MAX_DATE = "maxDate",
|
|
1477
|
-
PATTERN = "pattern"
|
|
1478
|
-
}
|
|
1479
|
-
declare const ValidatorErrorCode: {
|
|
1480
|
-
readonly EXPECTED_NUMBER: "VALIDATOR_EXPECTED_NUMBER";
|
|
1481
|
-
readonly EXPECTED_DATE: "VALIDATOR_EXPECTED_DATE";
|
|
1482
|
-
readonly EXPECTED_STRING: "VALIDATOR_EXPECTED_STRING";
|
|
1483
|
-
};
|
|
259
|
+
//#region src/core/error/base.d.ts
|
|
260
|
+
declare class MetadataError extends BaseError {}
|
|
1484
261
|
//#endregion
|
|
1485
262
|
//#region src/core/error/config.d.ts
|
|
1486
263
|
declare class ConfigError extends MetadataError {}
|
|
@@ -1493,28 +270,115 @@ declare const ConfigErrorCode: {
|
|
|
1493
270
|
};
|
|
1494
271
|
type ConfigErrorCode = typeof ConfigErrorCode[keyof typeof ConfigErrorCode];
|
|
1495
272
|
//#endregion
|
|
273
|
+
//#region src/core/error/generator.d.ts
|
|
274
|
+
declare class GeneratorError extends MetadataError {}
|
|
275
|
+
declare function isGeneratorError(input: unknown): input is GeneratorError & {
|
|
276
|
+
code: string;
|
|
277
|
+
};
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/core/error/generator-codes.d.ts
|
|
280
|
+
declare const GeneratorErrorCode: {
|
|
281
|
+
readonly CONTROLLER_NO_SOURCE_FILE: "GENERATOR_CONTROLLER_NO_SOURCE_FILE";
|
|
282
|
+
readonly CONTROLLER_NO_NAME: "GENERATOR_CONTROLLER_NO_NAME";
|
|
283
|
+
readonly PARAMETER_GENERATION_FAILED: "GENERATOR_PARAMETER_GENERATION_FAILED";
|
|
284
|
+
readonly BODY_PARAMETER_DUPLICATE: "GENERATOR_BODY_PARAMETER_DUPLICATE";
|
|
285
|
+
readonly BODY_FORM_CONFLICT: "GENERATOR_BODY_FORM_CONFLICT";
|
|
286
|
+
readonly STRICT_UNMATCHED_DECORATORS: "GENERATOR_STRICT_UNMATCHED_DECORATORS";
|
|
287
|
+
};
|
|
288
|
+
type GeneratorErrorCode = typeof GeneratorErrorCode[keyof typeof GeneratorErrorCode];
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/core/error/parameter.d.ts
|
|
291
|
+
type UnsupportedTypeContext = {
|
|
292
|
+
decoratorName: string;
|
|
293
|
+
propertyName: string;
|
|
294
|
+
type: BaseType;
|
|
295
|
+
node?: Node;
|
|
296
|
+
};
|
|
297
|
+
type UnsupportedMethodContext = {
|
|
298
|
+
decoratorName: string;
|
|
299
|
+
propertyName: string;
|
|
300
|
+
method: string;
|
|
301
|
+
node?: Node;
|
|
302
|
+
};
|
|
303
|
+
type PathMatchInvalidContext = {
|
|
304
|
+
decoratorName: string;
|
|
305
|
+
propertyName: string;
|
|
306
|
+
path: string;
|
|
307
|
+
node?: Node;
|
|
308
|
+
};
|
|
309
|
+
type ScopeRequiredContext = {
|
|
310
|
+
decoratorName: string;
|
|
311
|
+
node?: Node;
|
|
312
|
+
};
|
|
313
|
+
declare class ParameterError extends MetadataError {
|
|
314
|
+
static typeUnsupported(context: UnsupportedTypeContext): ParameterError;
|
|
315
|
+
static methodUnsupported(context: UnsupportedMethodContext): ParameterError;
|
|
316
|
+
static invalidPathMatch(context: PathMatchInvalidContext): ParameterError;
|
|
317
|
+
static scopeRequired(context: ScopeRequiredContext): ParameterError;
|
|
318
|
+
static invalidExampleSchema(): ParameterError;
|
|
319
|
+
static getCurrentLocation(node: Node): string;
|
|
320
|
+
}
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/core/error/parameter-codes.d.ts
|
|
323
|
+
declare const ParameterErrorCode: {
|
|
324
|
+
readonly TYPE_UNSUPPORTED: "PARAMETER_TYPE_UNSUPPORTED";
|
|
325
|
+
readonly METHOD_UNSUPPORTED: "PARAMETER_METHOD_UNSUPPORTED";
|
|
326
|
+
readonly PATH_MISMATCH: "PARAMETER_PATH_MISMATCH";
|
|
327
|
+
readonly SCOPE_REQUIRED: "PARAMETER_SCOPE_REQUIRED";
|
|
328
|
+
readonly INVALID_EXAMPLE: "PARAMETER_INVALID_EXAMPLE";
|
|
329
|
+
};
|
|
330
|
+
type ParameterErrorCode = typeof ParameterErrorCode[keyof typeof ParameterErrorCode];
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/core/error/resolver.d.ts
|
|
333
|
+
declare class ResolverError extends MetadataError {
|
|
334
|
+
readonly file?: string;
|
|
335
|
+
readonly line?: number;
|
|
336
|
+
constructor(message: string, node?: Node | TypeNode, options?: boolean | {
|
|
337
|
+
onlyCurrent?: boolean;
|
|
338
|
+
cause?: unknown;
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
declare function isResolverError(input: unknown): input is ResolverError;
|
|
342
|
+
declare function prettyLocationOfNode(node: Node | TypeNode): {
|
|
343
|
+
text: string;
|
|
344
|
+
file: string;
|
|
345
|
+
line?: number;
|
|
346
|
+
} | undefined;
|
|
347
|
+
declare function prettyTroubleCause(node: Node | TypeNode, onlyCurrent?: boolean): string;
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/core/error/validator.d.ts
|
|
350
|
+
declare class ValidatorError extends MetadataError {}
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/core/error/validator-codes.d.ts
|
|
353
|
+
declare const ValidatorErrorCode: {
|
|
354
|
+
readonly EXPECTED_NUMBER: "VALIDATOR_EXPECTED_NUMBER";
|
|
355
|
+
readonly EXPECTED_DATE: "VALIDATOR_EXPECTED_DATE";
|
|
356
|
+
readonly EXPECTED_STRING: "VALIDATOR_EXPECTED_STRING";
|
|
357
|
+
};
|
|
358
|
+
type ValidatorErrorCode = typeof ValidatorErrorCode[keyof typeof ValidatorErrorCode];
|
|
359
|
+
//#endregion
|
|
1496
360
|
//#region src/adapters/typescript/resolver/types.d.ts
|
|
1497
|
-
type OverrideToken =
|
|
1498
|
-
type UsableDeclaration =
|
|
361
|
+
type OverrideToken = Token<SyntaxKind.QuestionToken> | Token<SyntaxKind.PlusToken> | Token<SyntaxKind.MinusToken>;
|
|
362
|
+
type UsableDeclaration = InterfaceDeclaration | ClassDeclaration | PropertySignature | TypeAliasDeclaration | EnumMember;
|
|
1499
363
|
type TypeNodeResolverContext = {
|
|
1500
|
-
[name: string]:
|
|
364
|
+
[name: string]: TypeReferenceNode | TypeNode;
|
|
1501
365
|
};
|
|
1502
366
|
type SubResolverContext = {
|
|
1503
|
-
readonly typeChecker:
|
|
367
|
+
readonly typeChecker: TypeChecker;
|
|
1504
368
|
readonly current: IResolverContext & IReferenceTypeRegistry;
|
|
1505
|
-
readonly parentNode?:
|
|
369
|
+
readonly parentNode?: Node;
|
|
1506
370
|
readonly context: TypeNodeResolverContext;
|
|
1507
|
-
readonly referencer?:
|
|
1508
|
-
resolveType(typeNode:
|
|
1509
|
-
propertyFromSignature(sig:
|
|
1510
|
-
propertyFromDeclaration(decl:
|
|
1511
|
-
getNodeDescription(node: UsableDeclaration |
|
|
1512
|
-
getNodeExample(node: UsableDeclaration |
|
|
1513
|
-
getNodeExtensions(node: UsableDeclaration |
|
|
371
|
+
readonly referencer?: TypeNode;
|
|
372
|
+
resolveType(typeNode: TypeNode, parentNode?: Node, context?: TypeNodeResolverContext, referencer?: TypeNode): Type;
|
|
373
|
+
propertyFromSignature(sig: PropertySignature, overrideToken?: OverrideToken): ResolverProperty;
|
|
374
|
+
propertyFromDeclaration(decl: PropertyDeclaration | ParameterDeclaration, overrideToken?: OverrideToken): ResolverProperty;
|
|
375
|
+
getNodeDescription(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration): string;
|
|
376
|
+
getNodeExample(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration): unknown;
|
|
377
|
+
getNodeExtensions(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration): Extension[];
|
|
1514
378
|
};
|
|
1515
379
|
//#endregion
|
|
1516
380
|
//#region src/adapters/typescript/resolver/sub/array.d.ts
|
|
1517
|
-
declare function resolveArrayType(typeNode:
|
|
381
|
+
declare function resolveArrayType(typeNode: TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1518
382
|
//#endregion
|
|
1519
383
|
//#region src/adapters/typescript/resolver/sub/base.d.ts
|
|
1520
384
|
declare class ResolverBase {
|
|
@@ -1524,27 +388,27 @@ declare class ResolverBase {
|
|
|
1524
388
|
}
|
|
1525
389
|
//#endregion
|
|
1526
390
|
//#region src/adapters/typescript/resolver/sub/indexed-access.d.ts
|
|
1527
|
-
declare function resolveIndexedAccessType(typeNode:
|
|
391
|
+
declare function resolveIndexedAccessType(typeNode: TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1528
392
|
//#endregion
|
|
1529
393
|
//#region src/adapters/typescript/resolver/sub/intersection.d.ts
|
|
1530
|
-
declare function resolveIntersectionType(typeNode:
|
|
394
|
+
declare function resolveIntersectionType(typeNode: TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1531
395
|
//#endregion
|
|
1532
396
|
//#region src/adapters/typescript/resolver/sub/literal.d.ts
|
|
1533
|
-
declare function resolveLiteralType(typeNode:
|
|
1534
|
-
declare function getLiteralValue(typeNode:
|
|
397
|
+
declare function resolveLiteralType(typeNode: TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
398
|
+
declare function getLiteralValue(typeNode: LiteralTypeNode): string | number | boolean | null;
|
|
1535
399
|
//#endregion
|
|
1536
400
|
//#region src/adapters/typescript/resolver/sub/mapped.d.ts
|
|
1537
|
-
declare function resolveMappedType(typeNode:
|
|
401
|
+
declare function resolveMappedType(typeNode: TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1538
402
|
//#endregion
|
|
1539
403
|
//#region src/adapters/typescript/resolver/sub/object-literal.d.ts
|
|
1540
|
-
declare function resolveObjectLiteralType(typeNode:
|
|
404
|
+
declare function resolveObjectLiteralType(typeNode: TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1541
405
|
//#endregion
|
|
1542
406
|
//#region src/adapters/typescript/resolver/sub/primitive.d.ts
|
|
1543
407
|
declare class PrimitiveResolver {
|
|
1544
408
|
protected registry: Registry;
|
|
1545
409
|
constructor(registry: Registry);
|
|
1546
410
|
resolve(node: TypeNode, parentNode?: Node): PrimitiveType | NeverType | VoidType | undefined;
|
|
1547
|
-
resolveSyntaxKind(syntaxKind: SyntaxKind): "string" | "
|
|
411
|
+
resolveSyntaxKind(syntaxKind: SyntaxKind): "string" | "boolean" | "void" | "undefined" | "null" | "number" | "bigint" | "never";
|
|
1548
412
|
}
|
|
1549
413
|
//#endregion
|
|
1550
414
|
//#region src/adapters/typescript/resolver/sub/reference.d.ts
|
|
@@ -1561,13 +425,13 @@ declare class ReferenceResolver extends ResolverBase {
|
|
|
1561
425
|
}
|
|
1562
426
|
//#endregion
|
|
1563
427
|
//#region src/adapters/typescript/resolver/sub/tuple.d.ts
|
|
1564
|
-
declare function resolveTupleType(typeNode:
|
|
428
|
+
declare function resolveTupleType(typeNode: TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1565
429
|
//#endregion
|
|
1566
430
|
//#region src/adapters/typescript/resolver/sub/type-operator.d.ts
|
|
1567
|
-
declare function resolveTypeOperatorType(typeNode:
|
|
431
|
+
declare function resolveTypeOperatorType(typeNode: TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1568
432
|
//#endregion
|
|
1569
433
|
//#region src/adapters/typescript/resolver/sub/union.d.ts
|
|
1570
|
-
declare function resolveUnionType(typeNode:
|
|
434
|
+
declare function resolveUnionType(typeNode: TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1571
435
|
//#endregion
|
|
1572
436
|
//#region src/adapters/typescript/resolver/module.d.ts
|
|
1573
437
|
declare class TypeNodeResolver extends ResolverBase {
|
|
@@ -1580,7 +444,7 @@ declare class TypeNodeResolver extends ResolverBase {
|
|
|
1580
444
|
private readonly depth;
|
|
1581
445
|
private readonly primitiveResolver;
|
|
1582
446
|
private readonly referenceResolver;
|
|
1583
|
-
constructor(typeNode:
|
|
447
|
+
constructor(typeNode: TypeNode, current: IResolverContext & IReferenceTypeRegistry, parentNode?: Node, context?: TypeNodeResolverContext, referencer?: TypeNode, depth?: number);
|
|
1584
448
|
/**
|
|
1585
449
|
* @deprecated Use resolverCache.clear() on the context instead.
|
|
1586
450
|
* Kept for backward compatibility — no-ops since cache is now instance-scoped.
|
|
@@ -1632,7 +496,7 @@ declare class TypeNodeResolver extends ResolverBase {
|
|
|
1632
496
|
private getNodeDescription;
|
|
1633
497
|
private static getNodeFormat;
|
|
1634
498
|
private getNodeExample;
|
|
1635
|
-
protected getNodeExtensions(node: UsableDeclaration |
|
|
499
|
+
protected getNodeExtensions(node: UsableDeclaration | PropertyDeclaration | ParameterDeclaration | EnumDeclaration): Extension[];
|
|
1636
500
|
}
|
|
1637
501
|
//#endregion
|
|
1638
502
|
//#region src/adapters/typescript/resolver/cache.d.ts
|
|
@@ -1671,8 +535,8 @@ interface NodeDecorator {
|
|
|
1671
535
|
declare function getNodeDecorators(node: Node, isMatching?: (data: NodeDecorator) => boolean): NodeDecorator[];
|
|
1672
536
|
//#endregion
|
|
1673
537
|
//#region src/adapters/typescript/initializer.d.ts
|
|
1674
|
-
declare function getInitializerValue(initializer?:
|
|
1675
|
-
declare const hasInitializer: (node:
|
|
538
|
+
declare function getInitializerValue(initializer?: Expression, typeChecker?: TypeChecker, type?: Type): unknown;
|
|
539
|
+
declare const hasInitializer: (node: Node) => node is HasInitializer;
|
|
1676
540
|
//#endregion
|
|
1677
541
|
//#region src/adapters/typescript/js-doc/constants.d.ts
|
|
1678
542
|
declare enum JSDocTagName {
|
|
@@ -1708,6 +572,69 @@ declare function transformJSDocComment(input?: string | NodeArray<JSDocComment>)
|
|
|
1708
572
|
//#region src/adapters/typescript/validator/module.d.ts
|
|
1709
573
|
declare function getDeclarationValidators(declaration: PropertyDeclaration | TypeAliasDeclaration | PropertySignature | ParameterDeclaration, name?: string): Record<string, Validator>;
|
|
1710
574
|
//#endregion
|
|
575
|
+
//#region src/adapters/decorator/orchestrator/types.d.ts
|
|
576
|
+
type ApplyHandlersOptions = {
|
|
577
|
+
target: DecoratorTarget;
|
|
578
|
+
host: DecoratorHost;
|
|
579
|
+
resolveTypeNode: (node: TypeNode) => Type;
|
|
580
|
+
parameterType?: () => Type | undefined;
|
|
581
|
+
typeChecker?: TypeChecker;
|
|
582
|
+
/**
|
|
583
|
+
* Optional reporter for decorator sources that no handler matched.
|
|
584
|
+
* The orchestrator builds a {@link DecoratorSource} for every decorator
|
|
585
|
+
* on the node; if iteration finishes without any handler claiming a
|
|
586
|
+
* source, this callback fires once for that source.
|
|
587
|
+
*/
|
|
588
|
+
onUnmatchedDecorator?: (report: UnmatchedDecoratorReport, source: DecoratorSource) => void;
|
|
589
|
+
};
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/adapters/decorator/orchestrator/module.d.ts
|
|
592
|
+
type DecoratorHandlerLike<D> = {
|
|
593
|
+
match: Match;
|
|
594
|
+
apply: (ctx: HandlerContext, draft: D) => void;
|
|
595
|
+
};
|
|
596
|
+
type JsDocHandlerLike<D> = {
|
|
597
|
+
match: JsDocMatch;
|
|
598
|
+
apply: (ctx: JsDocHandlerContext, draft: D) => void;
|
|
599
|
+
};
|
|
600
|
+
declare function buildHandlerContext(source: DecoratorSource, options: ApplyHandlersOptions): HandlerContext;
|
|
601
|
+
declare function buildJsDocHandlerContext(source: JsDocSource, options: ApplyHandlersOptions): JsDocHandlerContext;
|
|
602
|
+
declare function applyDecoratorHandlers<D>(node: Node, handlers: DecoratorHandlerLike<D>[], draft: D, options: ApplyHandlersOptions): void;
|
|
603
|
+
declare function applyJsDocHandlers<D>(node: Node, handlers: JsDocHandlerLike<D>[], draft: D, options: ApplyHandlersOptions): void;
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region src/adapters/decorator/typescript/types.d.ts
|
|
606
|
+
type DecoratorSourceBuilderOptions = {
|
|
607
|
+
target: DecoratorTarget;
|
|
608
|
+
host: DecoratorHost;
|
|
609
|
+
resolveTypeNode: (node: TypeNode) => Type;
|
|
610
|
+
typeChecker?: TypeChecker;
|
|
611
|
+
};
|
|
612
|
+
type JsDocSourceBuilderOptions = {
|
|
613
|
+
target: DecoratorTarget;
|
|
614
|
+
host: DecoratorHost;
|
|
615
|
+
resolveTypeNode: (node: TypeNode) => Type;
|
|
616
|
+
};
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region src/adapters/decorator/typescript/module.d.ts
|
|
619
|
+
declare function buildDecoratorSources(node: Node, options: DecoratorSourceBuilderOptions): DecoratorSource[];
|
|
620
|
+
declare function buildJsDocSources(node: Node, options: JsDocSourceBuilderOptions): JsDocSource[];
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/adapters/decorator/typescript/utils.d.ts
|
|
623
|
+
type RawDecorator = {
|
|
624
|
+
name: string;
|
|
625
|
+
arguments: DecoratorArgument[];
|
|
626
|
+
};
|
|
627
|
+
/**
|
|
628
|
+
* Enumerate decorators on a TS node and classify their argument values without
|
|
629
|
+
* going through the registry. Used by read-side consumers (type resolver,
|
|
630
|
+
* extension extraction) that only need decorator names + argument values.
|
|
631
|
+
*/
|
|
632
|
+
declare function readNodeDecorators(node: Node, typeChecker?: TypeChecker): RawDecorator[];
|
|
633
|
+
declare function findDecoratorByName(node: Node, name: string, typeChecker?: TypeChecker): RawDecorator | undefined;
|
|
634
|
+
declare function findDecoratorsByName(node: Node, name: string, typeChecker?: TypeChecker): RawDecorator[];
|
|
635
|
+
declare function hasDecoratorNamed(node: Node, name: string, typeChecker?: TypeChecker): boolean;
|
|
636
|
+
declare function buildDecoratorArgument(expr: Expression, typeChecker?: TypeChecker): DecoratorArgument;
|
|
637
|
+
//#endregion
|
|
1711
638
|
//#region src/adapters/filesystem/source-files.d.ts
|
|
1712
639
|
declare function scanSourceFiles(input: EntryPoint): Promise<string[]>;
|
|
1713
640
|
//#endregion
|
|
@@ -1755,9 +682,6 @@ declare class MetadataGenerator implements IGeneratorContext, IMetadataGenerator
|
|
|
1755
682
|
private buildControllers;
|
|
1756
683
|
}
|
|
1757
684
|
//#endregion
|
|
1758
|
-
//#region src/app/generator/metadata/utils.d.ts
|
|
1759
|
-
declare function isMetadata(input: unknown): input is Metadata;
|
|
1760
|
-
//#endregion
|
|
1761
685
|
//#region src/app/generator/controller/module.d.ts
|
|
1762
686
|
declare class ControllerGenerator implements IControllerGenerator {
|
|
1763
687
|
protected readonly node: ClassDeclaration;
|
|
@@ -1789,7 +713,7 @@ declare class ParameterGenerator implements IParameterGenerator {
|
|
|
1789
713
|
private readonly method;
|
|
1790
714
|
private readonly paths;
|
|
1791
715
|
private readonly current;
|
|
1792
|
-
constructor(parameter:
|
|
716
|
+
constructor(parameter: ParameterDeclaration, method: string, paths: string[], current: IGeneratorContext);
|
|
1793
717
|
generate(): Parameter[];
|
|
1794
718
|
private finalize;
|
|
1795
719
|
private draftToParameter;
|
|
@@ -1815,5 +739,5 @@ declare function hasOwnProperty<Y extends PropertyKey>(obj: unknown, prop: Y): o
|
|
|
1815
739
|
//#region src/core/utils/path-normalize.d.ts
|
|
1816
740
|
declare function normalizePath(str: string): string;
|
|
1817
741
|
//#endregion
|
|
1818
|
-
export {
|
|
742
|
+
export { ApplyHandlersOptions, CACHE_DEFAULT_MAX_AGE_MS, CACHE_FILE_PREFIX, CACHE_FILE_SUFFIX, CACHE_SCHEMA_VERSION, CacheClient, CacheData, CacheKeyParts, CacheOptions, CacheOptionsInput, ConfigError, ConfigErrorCode, ControllerGenerator, DecoratorSourceBuilderOptions, EntryPoint, EntryPointOptions, GeneratorError, GeneratorErrorCode, ICacheClient, IGeneratorContext, IMetadataGenerator, IReferenceTypeRegistry, IResolverContext, JSDocTagName, JsDocSourceBuilderOptions, MetadataError, MetadataGenerateOptions, MetadataGenerator, MetadataGeneratorContext, MetadataGeneratorOptions, MethodGenerator, NodeDecorator, OverrideToken, ParameterError, ParameterErrorCode, ParameterGenerator, PrimitiveResolver, RawDecorator, ReferenceResolver, ResolverBase, ResolverCache, ResolverError, SubResolverContext, TsCompilerOptions, TsConfig, TsconfigLoadContext, TypeNodeResolver, TypeNodeResolverContext, UsableDeclaration, ValidatorError, ValidatorErrorCode, applyDecoratorHandlers, applyJsDocHandlers, buildCacheOptions, buildDecoratorArgument, buildDecoratorSources, buildHandlerContext, buildJsDocHandlerContext, buildJsDocSources, composeCacheKey, findDecoratorByName, findDecoratorsByName, generateMetadata, getDeclarationValidators, getInitializerValue, getJSDoc, getJSDocDescription, getJSDocTagComment, getJSDocTagNames, getJSDocTags, getLiteralValue, getNodeDecorators, getNodeDescription, getNodeExtensions, hasDecoratorNamed, hasInitializer, hasJSDocTag, hasOwnProperty, hashCompilerOptions, hashRegistry, isGeneratorError, isResolverError, isStringArray, loadTSConfig, normalizePath, prettyLocationOfNode, prettyTroubleCause, readNodeDecorators, resolveArrayType, resolveIndexedAccessType, resolveIntersectionType, resolveLiteralType, resolveMappedType, resolveObjectLiteralType, resolveTupleType, resolveTypeOperatorType, resolveUnionType, scanSourceFiles, softLoadTsconfig, toTypeNodeOrFail, transformJSDocComment };
|
|
1819
743
|
//# sourceMappingURL=index.d.mts.map
|