@trapi/metadata 1.2.3 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -16
- package/dist/index.d.mts +1718 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3310 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +27 -15
- package/dist/cache/client.d.ts +0 -15
- package/dist/cache/client.d.ts.map +0 -1
- package/dist/cache/client.js +0 -98
- package/dist/cache/client.js.map +0 -1
- package/dist/cache/index.d.ts +0 -4
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/index.js +0 -26
- package/dist/cache/index.js.map +0 -1
- package/dist/cache/type.d.ts +0 -33
- package/dist/cache/type.d.ts.map +0 -1
- package/dist/cache/type.js +0 -9
- package/dist/cache/type.js.map +0 -1
- package/dist/cache/utils.d.ts +0 -4
- package/dist/cache/utils.d.ts.map +0 -1
- package/dist/cache/utils.js +0 -53
- package/dist/cache/utils.js.map +0 -1
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -24
- package/dist/config/index.js.map +0 -1
- package/dist/config/type.d.ts +0 -37
- package/dist/config/type.d.ts.map +0 -1
- package/dist/config/type.js +0 -9
- package/dist/config/type.js.map +0 -1
- package/dist/decorator/constants.d.ts +0 -41
- package/dist/decorator/constants.d.ts.map +0 -1
- package/dist/decorator/constants.js +0 -53
- package/dist/decorator/constants.js.map +0 -1
- package/dist/decorator/index.d.ts +0 -7
- package/dist/decorator/index.d.ts.map +0 -1
- package/dist/decorator/index.js +0 -29
- package/dist/decorator/index.js.map +0 -1
- package/dist/decorator/preset/index.d.ts +0 -3
- package/dist/decorator/preset/index.d.ts.map +0 -1
- package/dist/decorator/preset/index.js +0 -25
- package/dist/decorator/preset/index.js.map +0 -1
- package/dist/decorator/preset/type.d.ts +0 -6
- package/dist/decorator/preset/type.d.ts.map +0 -1
- package/dist/decorator/preset/type.js +0 -9
- package/dist/decorator/preset/type.js.map +0 -1
- package/dist/decorator/preset/utils/check.d.ts +0 -3
- package/dist/decorator/preset/utils/check.d.ts.map +0 -1
- package/dist/decorator/preset/utils/check.js +0 -18
- package/dist/decorator/preset/utils/check.js.map +0 -1
- package/dist/decorator/preset/utils/index.d.ts +0 -4
- package/dist/decorator/preset/utils/index.d.ts.map +0 -1
- package/dist/decorator/preset/utils/index.js +0 -26
- package/dist/decorator/preset/utils/index.js.map +0 -1
- package/dist/decorator/preset/utils/load.d.ts +0 -3
- package/dist/decorator/preset/utils/load.d.ts.map +0 -1
- package/dist/decorator/preset/utils/load.js +0 -51
- package/dist/decorator/preset/utils/load.js.map +0 -1
- package/dist/decorator/preset/utils/normalize.d.ts +0 -2
- package/dist/decorator/preset/utils/normalize.d.ts.map +0 -1
- package/dist/decorator/preset/utils/normalize.js +0 -27
- package/dist/decorator/preset/utils/normalize.js.map +0 -1
- package/dist/decorator/property-manager/index.d.ts +0 -3
- package/dist/decorator/property-manager/index.d.ts.map +0 -1
- package/dist/decorator/property-manager/index.js +0 -25
- package/dist/decorator/property-manager/index.js.map +0 -1
- package/dist/decorator/property-manager/module.d.ts +0 -17
- package/dist/decorator/property-manager/module.d.ts.map +0 -1
- package/dist/decorator/property-manager/module.js +0 -59
- package/dist/decorator/property-manager/module.js.map +0 -1
- package/dist/decorator/property-manager/utils.d.ts +0 -6
- package/dist/decorator/property-manager/utils.d.ts.map +0 -1
- package/dist/decorator/property-manager/utils.js +0 -92
- package/dist/decorator/property-manager/utils.js.map +0 -1
- package/dist/decorator/resolver/index.d.ts +0 -3
- package/dist/decorator/resolver/index.d.ts.map +0 -1
- package/dist/decorator/resolver/index.js +0 -25
- package/dist/decorator/resolver/index.js.map +0 -1
- package/dist/decorator/resolver/module.d.ts +0 -27
- package/dist/decorator/resolver/module.d.ts.map +0 -1
- package/dist/decorator/resolver/module.js +0 -72
- package/dist/decorator/resolver/module.js.map +0 -1
- package/dist/decorator/resolver/type.d.ts +0 -10
- package/dist/decorator/resolver/type.d.ts.map +0 -1
- package/dist/decorator/resolver/type.js +0 -3
- package/dist/decorator/resolver/type.js.map +0 -1
- package/dist/decorator/sets/class.d.ts +0 -7
- package/dist/decorator/sets/class.d.ts.map +0 -1
- package/dist/decorator/sets/class.js +0 -9
- package/dist/decorator/sets/class.js.map +0 -1
- package/dist/decorator/sets/index.d.ts +0 -8
- package/dist/decorator/sets/index.d.ts.map +0 -1
- package/dist/decorator/sets/index.js +0 -29
- package/dist/decorator/sets/index.js.map +0 -1
- package/dist/decorator/sets/method.d.ts +0 -14
- package/dist/decorator/sets/method.d.ts.map +0 -1
- package/dist/decorator/sets/method.js +0 -9
- package/dist/decorator/sets/method.js.map +0 -1
- package/dist/decorator/sets/mixed.d.ts +0 -12
- package/dist/decorator/sets/mixed.d.ts.map +0 -1
- package/dist/decorator/sets/mixed.js +0 -9
- package/dist/decorator/sets/mixed.js.map +0 -1
- package/dist/decorator/sets/parameter.d.ts +0 -21
- package/dist/decorator/sets/parameter.d.ts.map +0 -1
- package/dist/decorator/sets/parameter.js +0 -9
- package/dist/decorator/sets/parameter.js.map +0 -1
- package/dist/decorator/sets/request.d.ts +0 -6
- package/dist/decorator/sets/request.d.ts.map +0 -1
- package/dist/decorator/sets/request.js +0 -9
- package/dist/decorator/sets/request.js.map +0 -1
- package/dist/decorator/sets/response.d.ts +0 -17
- package/dist/decorator/sets/response.d.ts.map +0 -1
- package/dist/decorator/sets/response.js +0 -9
- package/dist/decorator/sets/response.js.map +0 -1
- package/dist/decorator/sets/type.d.ts +0 -4
- package/dist/decorator/sets/type.d.ts.map +0 -1
- package/dist/decorator/sets/type.js +0 -3
- package/dist/decorator/sets/type.js.map +0 -1
- package/dist/decorator/type.d.ts +0 -32
- package/dist/decorator/type.d.ts.map +0 -1
- package/dist/decorator/type.js +0 -9
- package/dist/decorator/type.js.map +0 -1
- package/dist/error/base.d.ts +0 -3
- package/dist/error/base.d.ts.map +0 -1
- package/dist/error/base.js +0 -13
- package/dist/error/base.js.map +0 -1
- package/dist/error/index.d.ts +0 -2
- package/dist/error/index.d.ts.map +0 -1
- package/dist/error/index.js +0 -24
- package/dist/error/index.js.map +0 -1
- package/dist/generator/abstract.d.ts +0 -19
- package/dist/generator/abstract.d.ts.map +0 -1
- package/dist/generator/abstract.js +0 -151
- package/dist/generator/abstract.js.map +0 -1
- package/dist/generator/controller/index.d.ts +0 -3
- package/dist/generator/controller/index.d.ts.map +0 -1
- package/dist/generator/controller/index.js +0 -25
- package/dist/generator/controller/index.js.map +0 -1
- package/dist/generator/controller/module.d.ts +0 -13
- package/dist/generator/controller/module.d.ts.map +0 -1
- package/dist/generator/controller/module.js +0 -68
- package/dist/generator/controller/module.js.map +0 -1
- package/dist/generator/controller/type.d.ts +0 -47
- package/dist/generator/controller/type.d.ts.map +0 -1
- package/dist/generator/controller/type.js +0 -3
- package/dist/generator/controller/type.js.map +0 -1
- package/dist/generator/index.d.ts +0 -7
- package/dist/generator/index.d.ts.map +0 -1
- package/dist/generator/index.js +0 -29
- package/dist/generator/index.js.map +0 -1
- package/dist/generator/metadata/index.d.ts +0 -4
- package/dist/generator/metadata/index.d.ts.map +0 -1
- package/dist/generator/metadata/index.js +0 -26
- package/dist/generator/metadata/index.js.map +0 -1
- package/dist/generator/metadata/module.d.ts +0 -39
- package/dist/generator/metadata/module.d.ts.map +0 -1
- package/dist/generator/metadata/module.js +0 -140
- package/dist/generator/metadata/module.js.map +0 -1
- package/dist/generator/metadata/type.d.ts +0 -25
- package/dist/generator/metadata/type.d.ts.map +0 -1
- package/dist/generator/metadata/type.js +0 -3
- package/dist/generator/metadata/type.js.map +0 -1
- package/dist/generator/metadata/utils.d.ts +0 -3
- package/dist/generator/metadata/utils.d.ts.map +0 -1
- package/dist/generator/metadata/utils.js +0 -19
- package/dist/generator/metadata/utils.js.map +0 -1
- package/dist/generator/method/constants.d.ts +0 -11
- package/dist/generator/method/constants.d.ts.map +0 -1
- package/dist/generator/method/constants.js +0 -21
- package/dist/generator/method/constants.js.map +0 -1
- package/dist/generator/method/index.d.ts +0 -4
- package/dist/generator/method/index.d.ts.map +0 -1
- package/dist/generator/method/index.js +0 -26
- package/dist/generator/method/index.js.map +0 -1
- package/dist/generator/method/module.d.ts +0 -19
- package/dist/generator/method/module.d.ts.map +0 -1
- package/dist/generator/method/module.js +0 -188
- package/dist/generator/method/module.js.map +0 -1
- package/dist/generator/method/type.d.ts +0 -23
- package/dist/generator/method/type.d.ts.map +0 -1
- package/dist/generator/method/type.js +0 -9
- package/dist/generator/method/type.js.map +0 -1
- package/dist/generator/parameter/constants.d.ts +0 -19
- package/dist/generator/parameter/constants.d.ts.map +0 -1
- package/dist/generator/parameter/constants.js +0 -30
- package/dist/generator/parameter/constants.js.map +0 -1
- package/dist/generator/parameter/error.d.ts +0 -35
- package/dist/generator/parameter/error.d.ts.map +0 -1
- package/dist/generator/parameter/error.js +0 -68
- package/dist/generator/parameter/error.js.map +0 -1
- package/dist/generator/parameter/index.d.ts +0 -5
- package/dist/generator/parameter/index.d.ts.map +0 -1
- package/dist/generator/parameter/index.js +0 -27
- package/dist/generator/parameter/index.js.map +0 -1
- package/dist/generator/parameter/module.d.ts +0 -29
- package/dist/generator/parameter/module.d.ts.map +0 -1
- package/dist/generator/parameter/module.js +0 -556
- package/dist/generator/parameter/module.js.map +0 -1
- package/dist/generator/parameter/type.d.ts +0 -25
- package/dist/generator/parameter/type.d.ts.map +0 -1
- package/dist/generator/parameter/type.js +0 -9
- package/dist/generator/parameter/type.js.map +0 -1
- package/dist/generator/type.d.ts +0 -20
- package/dist/generator/type.d.ts.map +0 -1
- package/dist/generator/type.js +0 -9
- package/dist/generator/type.js.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -32
- package/dist/index.js.map +0 -1
- package/dist/module.d.ts +0 -5
- package/dist/module.d.ts.map +0 -1
- package/dist/module.js +0 -41
- package/dist/module.js.map +0 -1
- package/dist/resolver/constants.d.ts +0 -36
- package/dist/resolver/constants.d.ts.map +0 -1
- package/dist/resolver/constants.js +0 -47
- package/dist/resolver/constants.js.map +0 -1
- package/dist/resolver/error.d.ts +0 -8
- package/dist/resolver/error.d.ts.map +0 -1
- package/dist/resolver/error.js +0 -41
- package/dist/resolver/error.js.map +0 -1
- package/dist/resolver/extension/index.d.ts +0 -3
- package/dist/resolver/extension/index.d.ts.map +0 -1
- package/dist/resolver/extension/index.js +0 -25
- package/dist/resolver/extension/index.js.map +0 -1
- package/dist/resolver/extension/module.d.ts +0 -5
- package/dist/resolver/extension/module.d.ts.map +0 -1
- package/dist/resolver/extension/module.js +0 -27
- package/dist/resolver/extension/module.js.map +0 -1
- package/dist/resolver/extension/type.d.ts +0 -8
- package/dist/resolver/extension/type.d.ts.map +0 -1
- package/dist/resolver/extension/type.js +0 -9
- package/dist/resolver/extension/type.js.map +0 -1
- package/dist/resolver/index.d.ts +0 -6
- package/dist/resolver/index.d.ts.map +0 -1
- package/dist/resolver/index.js +0 -28
- package/dist/resolver/index.js.map +0 -1
- package/dist/resolver/module.d.ts +0 -57
- package/dist/resolver/module.d.ts.map +0 -1
- package/dist/resolver/module.js +0 -1109
- package/dist/resolver/module.js.map +0 -1
- package/dist/resolver/type.d.ts +0 -139
- package/dist/resolver/type.d.ts.map +0 -1
- package/dist/resolver/type.js +0 -130
- package/dist/resolver/type.js.map +0 -1
- package/dist/type.d.ts +0 -2
- package/dist/type.d.ts.map +0 -1
- package/dist/type.js +0 -9
- package/dist/type.js.map +0 -1
- package/dist/utils/array.d.ts +0 -2
- package/dist/utils/array.d.ts.map +0 -1
- package/dist/utils/array.js +0 -22
- package/dist/utils/array.js.map +0 -1
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -32
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/initializer.d.ts +0 -5
- package/dist/utils/initializer.d.ts.map +0 -1
- package/dist/utils/initializer.js +0 -131
- package/dist/utils/initializer.js.map +0 -1
- package/dist/utils/js-doc/constants.d.ts +0 -19
- package/dist/utils/js-doc/constants.d.ts.map +0 -1
- package/dist/utils/js-doc/constants.js +0 -30
- package/dist/utils/js-doc/constants.js.map +0 -1
- package/dist/utils/js-doc/index.d.ts +0 -4
- package/dist/utils/js-doc/index.d.ts.map +0 -1
- package/dist/utils/js-doc/index.js +0 -26
- package/dist/utils/js-doc/index.js.map +0 -1
- package/dist/utils/js-doc/module.d.ts +0 -9
- package/dist/utils/js-doc/module.d.ts.map +0 -1
- package/dist/utils/js-doc/module.js +0 -98
- package/dist/utils/js-doc/module.js.map +0 -1
- package/dist/utils/js-doc/utils.d.ts +0 -3
- package/dist/utils/js-doc/utils.d.ts.map +0 -1
- package/dist/utils/js-doc/utils.js +0 -29
- package/dist/utils/js-doc/utils.js.map +0 -1
- package/dist/utils/node/index.d.ts +0 -3
- package/dist/utils/node/index.d.ts.map +0 -1
- package/dist/utils/node/index.js +0 -25
- package/dist/utils/node/index.js.map +0 -1
- package/dist/utils/node/module.d.ts +0 -10
- package/dist/utils/node/module.d.ts.map +0 -1
- package/dist/utils/node/module.js +0 -52
- package/dist/utils/node/module.js.map +0 -1
- package/dist/utils/node/type.d.ts +0 -6
- package/dist/utils/node/type.d.ts.map +0 -1
- package/dist/utils/node/type.js +0 -9
- package/dist/utils/node/type.js.map +0 -1
- package/dist/utils/object.d.ts +0 -2
- package/dist/utils/object.d.ts.map +0 -1
- package/dist/utils/object.js +0 -15
- package/dist/utils/object.js.map +0 -1
- package/dist/utils/path-normalize.d.ts +0 -2
- package/dist/utils/path-normalize.d.ts.map +0 -1
- package/dist/utils/path-normalize.js +0 -17
- package/dist/utils/path-normalize.js.map +0 -1
- package/dist/utils/source-files.d.ts +0 -3
- package/dist/utils/source-files.d.ts.map +0 -1
- package/dist/utils/source-files.js +0 -32
- package/dist/utils/source-files.js.map +0 -1
- package/dist/utils/tsconfig/index.d.ts +0 -3
- package/dist/utils/tsconfig/index.d.ts.map +0 -1
- package/dist/utils/tsconfig/index.js +0 -25
- package/dist/utils/tsconfig/index.js.map +0 -1
- package/dist/utils/tsconfig/module.d.ts +0 -4
- package/dist/utils/tsconfig/module.d.ts.map +0 -1
- package/dist/utils/tsconfig/module.js +0 -54
- package/dist/utils/tsconfig/module.js.map +0 -1
- package/dist/utils/tsconfig/type.d.ts +0 -11
- package/dist/utils/tsconfig/type.d.ts.map +0 -1
- package/dist/utils/tsconfig/type.js +0 -9
- package/dist/utils/tsconfig/type.js.map +0 -1
- package/dist/utils/validator/constants.d.ts +0 -13
- package/dist/utils/validator/constants.d.ts.map +0 -1
- package/dist/utils/validator/constants.js +0 -23
- package/dist/utils/validator/constants.js.map +0 -1
- package/dist/utils/validator/index.d.ts +0 -4
- package/dist/utils/validator/index.d.ts.map +0 -1
- package/dist/utils/validator/index.js +0 -26
- package/dist/utils/validator/index.js.map +0 -1
- package/dist/utils/validator/module.d.ts +0 -4
- package/dist/utils/validator/module.d.ts.map +0 -1
- package/dist/utils/validator/module.js +0 -142
- package/dist/utils/validator/module.js.map +0 -1
- package/dist/utils/validator/type.d.ts +0 -6
- package/dist/utils/validator/type.d.ts.map +0 -1
- package/dist/utils/validator/type.js +0 -9
- package/dist/utils/validator/type.js.map +0 -1
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1718 @@
|
|
|
1
|
+
import { BaseError } from "@ebec/core";
|
|
2
|
+
import * as ts from "typescript";
|
|
3
|
+
import { ClassDeclaration, CompilerOptions, EnumDeclaration, EnumMember, Expression, JSDoc, JSDocComment, JSDocTag, MethodDeclaration, Node, NodeArray, ParameterDeclaration, PropertyDeclaration, PropertySignature, SyntaxKind, TypeAliasDeclaration, TypeChecker, TypeNode } from "typescript";
|
|
4
|
+
import { Container } from "validup";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
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
|
+
* Vendor extensions (x-* keys) declared on the controller class.
|
|
364
|
+
*/
|
|
365
|
+
extensions: Extension[];
|
|
366
|
+
/**
|
|
367
|
+
* Is controller hidden, and should
|
|
368
|
+
* not be used/displayed in some scenarios.
|
|
369
|
+
*/
|
|
370
|
+
hidden: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* File Location of the Controller.
|
|
373
|
+
*/
|
|
374
|
+
location: string;
|
|
375
|
+
/**
|
|
376
|
+
* Array of found method ( class functions )
|
|
377
|
+
* for a specific controller (class)
|
|
378
|
+
*/
|
|
379
|
+
methods: Method[];
|
|
380
|
+
name: string;
|
|
381
|
+
/**
|
|
382
|
+
* Relative URL paths the controller mounts at, e.g. ['/users'] or
|
|
383
|
+
* ['/roles', '/realms/:id/roles'] for multi-mounting.
|
|
384
|
+
*
|
|
385
|
+
* Always non-empty; a controller declared with no path argument has
|
|
386
|
+
* `paths: ['']`.
|
|
387
|
+
*/
|
|
388
|
+
paths: string[];
|
|
389
|
+
/**
|
|
390
|
+
* Possible Content-Types to receive
|
|
391
|
+
* data according the definition.
|
|
392
|
+
*
|
|
393
|
+
* i.e. ['application/json']
|
|
394
|
+
*/
|
|
395
|
+
produces: string[];
|
|
396
|
+
responses: Response[];
|
|
397
|
+
/**
|
|
398
|
+
* Tags can be used to group controllers
|
|
399
|
+
* by a name together.
|
|
400
|
+
*
|
|
401
|
+
* i.e. ['auth']
|
|
402
|
+
*/
|
|
403
|
+
tags: string[];
|
|
404
|
+
security?: Security[];
|
|
405
|
+
};
|
|
406
|
+
interface IControllerGenerator {
|
|
407
|
+
isValid(): boolean;
|
|
408
|
+
generate(): Controller | null;
|
|
409
|
+
}
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region src/core/method/constants.d.ts
|
|
412
|
+
declare const MethodName: {
|
|
413
|
+
readonly ALL: "ALL";
|
|
414
|
+
readonly GET: "GET";
|
|
415
|
+
readonly POST: "POST";
|
|
416
|
+
readonly PUT: "PUT";
|
|
417
|
+
readonly DELETE: "DELETE";
|
|
418
|
+
readonly PATCH: "PATCH";
|
|
419
|
+
readonly OPTIONS: "OPTIONS";
|
|
420
|
+
readonly HEAD: "HEAD";
|
|
421
|
+
};
|
|
422
|
+
type MethodName = typeof MethodName[keyof typeof MethodName];
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/core/parameter/error.d.ts
|
|
425
|
+
type UnsupportedTypeContext = {
|
|
426
|
+
decoratorName: string;
|
|
427
|
+
propertyName: string;
|
|
428
|
+
type: BaseType;
|
|
429
|
+
node?: Node;
|
|
430
|
+
};
|
|
431
|
+
type UnsupportedMethodContext = {
|
|
432
|
+
decoratorName: string;
|
|
433
|
+
propertyName: string;
|
|
434
|
+
method: string;
|
|
435
|
+
node?: Node;
|
|
436
|
+
};
|
|
437
|
+
type PathMatchInvalidContext = {
|
|
438
|
+
decoratorName: string;
|
|
439
|
+
propertyName: string;
|
|
440
|
+
path: string;
|
|
441
|
+
node?: Node;
|
|
442
|
+
};
|
|
443
|
+
type ScopeRequiredContext = {
|
|
444
|
+
decoratorName: string;
|
|
445
|
+
node?: Node;
|
|
446
|
+
};
|
|
447
|
+
declare class ParameterError extends MetadataError {
|
|
448
|
+
static typeUnsupported(context: UnsupportedTypeContext): ParameterError;
|
|
449
|
+
static methodUnsupported(context: UnsupportedMethodContext): ParameterError;
|
|
450
|
+
static invalidPathMatch(context: PathMatchInvalidContext): ParameterError;
|
|
451
|
+
static scopeRequired(context: ScopeRequiredContext): ParameterError;
|
|
452
|
+
static invalidExampleSchema(): ParameterError;
|
|
453
|
+
static getCurrentLocation(node: Node): string;
|
|
454
|
+
}
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region src/core/generator/error.d.ts
|
|
457
|
+
declare class GeneratorError extends MetadataError {}
|
|
458
|
+
declare function isGeneratorError(input: unknown): input is GeneratorError & {
|
|
459
|
+
code: string;
|
|
460
|
+
};
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/core/generator/constants.d.ts
|
|
463
|
+
declare const GeneratorErrorCode: {
|
|
464
|
+
readonly CONTROLLER_NO_SOURCE_FILE: "GENERATOR_CONTROLLER_NO_SOURCE_FILE";
|
|
465
|
+
readonly CONTROLLER_NO_NAME: "GENERATOR_CONTROLLER_NO_NAME";
|
|
466
|
+
readonly PARAMETER_GENERATION_FAILED: "GENERATOR_PARAMETER_GENERATION_FAILED";
|
|
467
|
+
readonly BODY_PARAMETER_DUPLICATE: "GENERATOR_BODY_PARAMETER_DUPLICATE";
|
|
468
|
+
readonly BODY_FORM_CONFLICT: "GENERATOR_BODY_FORM_CONFLICT";
|
|
469
|
+
};
|
|
470
|
+
//#endregion
|
|
471
|
+
//#region src/adapters/cache/types.d.ts
|
|
472
|
+
interface CacheOptions {
|
|
473
|
+
/**
|
|
474
|
+
* Specify if the cache driver should be enabled.
|
|
475
|
+
*
|
|
476
|
+
* Default: false
|
|
477
|
+
* */
|
|
478
|
+
enabled: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Directory relative or absolute path. Auto-created on first save.
|
|
481
|
+
*
|
|
482
|
+
* Default: tmpDir()
|
|
483
|
+
*/
|
|
484
|
+
directoryPath: string;
|
|
485
|
+
/**
|
|
486
|
+
* Specify the cache file name. When set, the cache becomes a single-slot
|
|
487
|
+
* store at this exact name (instead of one file per cache key). The
|
|
488
|
+
* in-file `cacheKey` check still rejects mismatches; you just lose
|
|
489
|
+
* multi-key caching.
|
|
490
|
+
*
|
|
491
|
+
* Default: .trapi-metadata-{cacheKey}.json
|
|
492
|
+
*/
|
|
493
|
+
fileName?: string;
|
|
494
|
+
/**
|
|
495
|
+
* Files older than this many milliseconds are pruned opportunistically
|
|
496
|
+
* after each successful save. Set to `0` to disable eviction.
|
|
497
|
+
*
|
|
498
|
+
* Default: 7 days
|
|
499
|
+
*/
|
|
500
|
+
maxAgeMs: number;
|
|
501
|
+
}
|
|
502
|
+
type CacheOptionsInput = Partial<CacheOptions>;
|
|
503
|
+
type CacheData = {
|
|
504
|
+
/**
|
|
505
|
+
* Opaque composite key — sha256 over (schema version, source files content,
|
|
506
|
+
* compiler options, resolved registry shape, preset name). The reader
|
|
507
|
+
* cross-checks this against the expected key to defend against collisions
|
|
508
|
+
* or schema drift.
|
|
509
|
+
*/
|
|
510
|
+
cacheKey: string; /** Stamped at write time; rejected on read if not equal to the current value. */
|
|
511
|
+
schemaVersion: string;
|
|
512
|
+
} & Metadata;
|
|
513
|
+
interface ICacheClient {
|
|
514
|
+
save(data: CacheData): Promise<string | undefined>;
|
|
515
|
+
get(cacheKey: string): Promise<CacheData | undefined>;
|
|
516
|
+
/** Prune cache files older than `maxAgeMs`. Safe to call concurrently. */
|
|
517
|
+
evict(): Promise<void>;
|
|
518
|
+
}
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region src/adapters/cache/client.d.ts
|
|
521
|
+
declare class CacheClient implements ICacheClient {
|
|
522
|
+
private readonly options;
|
|
523
|
+
constructor(input?: string | boolean | CacheOptionsInput);
|
|
524
|
+
save(data: CacheData): Promise<string | undefined>;
|
|
525
|
+
get(cacheKey: string): Promise<CacheData | undefined>;
|
|
526
|
+
/**
|
|
527
|
+
* Prune cache files older than `maxAgeMs`. No-op when disabled or when
|
|
528
|
+
* `maxAgeMs <= 0`. Each unlink is best-effort — a concurrent generator
|
|
529
|
+
* may have already removed the file.
|
|
530
|
+
*/
|
|
531
|
+
evict(): Promise<void>;
|
|
532
|
+
private resolveFilePath;
|
|
533
|
+
private ensureDirectory;
|
|
534
|
+
}
|
|
535
|
+
//#endregion
|
|
536
|
+
//#region src/adapters/cache/constants.d.ts
|
|
537
|
+
/**
|
|
538
|
+
* Bump whenever the on-disk cache shape changes incompatibly
|
|
539
|
+
* (Metadata, Controller, Method, Parameter, resolver type nodes,
|
|
540
|
+
* or the cache wrapper itself). Old cache files with a different
|
|
541
|
+
* version are rejected on read.
|
|
542
|
+
*/
|
|
543
|
+
declare const CACHE_SCHEMA_VERSION = "3";
|
|
544
|
+
declare const CACHE_FILE_PREFIX = ".trapi-metadata-";
|
|
545
|
+
declare const CACHE_FILE_SUFFIX = ".json";
|
|
546
|
+
/** 7 days. */
|
|
547
|
+
declare const CACHE_DEFAULT_MAX_AGE_MS: number;
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region src/adapters/decorator/constants.d.ts
|
|
550
|
+
declare const ParamKind: {
|
|
551
|
+
readonly Body: "body";
|
|
552
|
+
readonly BodyProp: "bodyProp";
|
|
553
|
+
readonly Context: "context";
|
|
554
|
+
readonly Cookie: "cookie";
|
|
555
|
+
readonly Header: "header";
|
|
556
|
+
readonly FormData: "formData";
|
|
557
|
+
readonly Query: "query";
|
|
558
|
+
readonly QueryProp: "queryProp";
|
|
559
|
+
readonly Path: "path";
|
|
560
|
+
};
|
|
561
|
+
type ParamKind = typeof ParamKind[keyof typeof ParamKind];
|
|
562
|
+
declare const CollectionKind: {
|
|
563
|
+
readonly Csv: "csv";
|
|
564
|
+
readonly Ssv: "ssv";
|
|
565
|
+
readonly Tsv: "tsv";
|
|
566
|
+
readonly Pipes: "pipes";
|
|
567
|
+
readonly Multi: "multi";
|
|
568
|
+
};
|
|
569
|
+
type CollectionKind = typeof CollectionKind[keyof typeof CollectionKind];
|
|
570
|
+
declare const DecoratorTargetKind: {
|
|
571
|
+
readonly Class: "class";
|
|
572
|
+
readonly Method: "method";
|
|
573
|
+
readonly Parameter: "parameter";
|
|
574
|
+
readonly Property: "property";
|
|
575
|
+
};
|
|
576
|
+
type DecoratorTargetKind = typeof DecoratorTargetKind[keyof typeof DecoratorTargetKind];
|
|
577
|
+
declare const DecoratorArgumentKindName: {
|
|
578
|
+
readonly Literal: "literal";
|
|
579
|
+
readonly Object: "object";
|
|
580
|
+
readonly Array: "array";
|
|
581
|
+
readonly Identifier: "identifier";
|
|
582
|
+
readonly Unresolvable: "unresolvable";
|
|
583
|
+
};
|
|
584
|
+
type DecoratorArgumentKindName = typeof DecoratorArgumentKindName[keyof typeof DecoratorArgumentKindName];
|
|
585
|
+
declare const MarkerName: {
|
|
586
|
+
readonly Hidden: "hidden";
|
|
587
|
+
readonly Deprecated: "deprecated";
|
|
588
|
+
readonly Extension: "extension";
|
|
589
|
+
};
|
|
590
|
+
type MarkerName = typeof MarkerName[keyof typeof MarkerName];
|
|
591
|
+
declare const NumericKind: {
|
|
592
|
+
readonly Int: "int";
|
|
593
|
+
readonly Long: "long";
|
|
594
|
+
readonly Float: "float";
|
|
595
|
+
readonly Double: "double";
|
|
596
|
+
};
|
|
597
|
+
type NumericKind = typeof NumericKind[keyof typeof NumericKind];
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region src/adapters/decorator/types.d.ts
|
|
600
|
+
type DecoratorTarget = `${DecoratorTargetKind}`;
|
|
601
|
+
type DecoratorArgumentKind = `${DecoratorArgumentKindName}`;
|
|
602
|
+
type DecoratorArgument = {
|
|
603
|
+
raw: unknown;
|
|
604
|
+
kind: DecoratorArgumentKind;
|
|
605
|
+
};
|
|
606
|
+
type DecoratorTypeArgument = {
|
|
607
|
+
resolve: () => Type;
|
|
608
|
+
};
|
|
609
|
+
type DecoratorHost = {
|
|
610
|
+
name: string;
|
|
611
|
+
parentName?: string;
|
|
612
|
+
};
|
|
613
|
+
type DecoratorSource = {
|
|
614
|
+
name: string;
|
|
615
|
+
arguments: DecoratorArgument[];
|
|
616
|
+
typeArguments: DecoratorTypeArgument[];
|
|
617
|
+
target: DecoratorTarget;
|
|
618
|
+
host: DecoratorHost;
|
|
619
|
+
/**
|
|
620
|
+
* Source-file location of the decorator AST node itself (1-based line).
|
|
621
|
+
* Optional because decorator sources can be synthesised in tests without
|
|
622
|
+
* a real source file. Populated by {@link buildDecoratorSources} when the
|
|
623
|
+
* decorator's containing source file is available.
|
|
624
|
+
*/
|
|
625
|
+
location?: {
|
|
626
|
+
file: string;
|
|
627
|
+
line: number;
|
|
628
|
+
};
|
|
629
|
+
};
|
|
630
|
+
type JsDocSource = {
|
|
631
|
+
tag: string;
|
|
632
|
+
text?: string;
|
|
633
|
+
typeExpression?: {
|
|
634
|
+
resolve: () => Type;
|
|
635
|
+
};
|
|
636
|
+
parameterName?: string;
|
|
637
|
+
target: DecoratorTarget;
|
|
638
|
+
host: DecoratorHost;
|
|
639
|
+
};
|
|
640
|
+
type ControllerDraft = {
|
|
641
|
+
name: string;
|
|
642
|
+
location: string;
|
|
643
|
+
paths?: string[];
|
|
644
|
+
hidden: boolean;
|
|
645
|
+
consumes: string[];
|
|
646
|
+
produces: string[];
|
|
647
|
+
tags: string[];
|
|
648
|
+
responses: Response[];
|
|
649
|
+
security: Security[];
|
|
650
|
+
extensions: Extension[];
|
|
651
|
+
};
|
|
652
|
+
type MethodDraft = {
|
|
653
|
+
name: string;
|
|
654
|
+
verb?: MethodType;
|
|
655
|
+
path: string;
|
|
656
|
+
operationId?: string;
|
|
657
|
+
description: string;
|
|
658
|
+
summary?: string;
|
|
659
|
+
deprecated?: boolean;
|
|
660
|
+
hidden: boolean;
|
|
661
|
+
consumes: string[];
|
|
662
|
+
produces: string[];
|
|
663
|
+
tags: string[];
|
|
664
|
+
responses: Response[];
|
|
665
|
+
security: Security[];
|
|
666
|
+
extensions: Extension[];
|
|
667
|
+
parameters: ParameterDraft[];
|
|
668
|
+
type?: BaseType;
|
|
669
|
+
/**
|
|
670
|
+
* Examples that handlers (e.g. `@Example`) want attached to the implicitly
|
|
671
|
+
* generated default response. The orchestrator merges these into the
|
|
672
|
+
* default 200/204 response when finalising the method.
|
|
673
|
+
*/
|
|
674
|
+
defaultResponseExamples: Example[];
|
|
675
|
+
};
|
|
676
|
+
type ParameterDraft = {
|
|
677
|
+
parameterName: string;
|
|
678
|
+
name: string;
|
|
679
|
+
in?: `${ParamKind}`;
|
|
680
|
+
description: string;
|
|
681
|
+
required: boolean;
|
|
682
|
+
type?: Type;
|
|
683
|
+
collectionFormat?: `${CollectionKind}`;
|
|
684
|
+
allowEmptyValue?: boolean;
|
|
685
|
+
default?: unknown;
|
|
686
|
+
maxItems?: number;
|
|
687
|
+
minItems?: number;
|
|
688
|
+
deprecated?: boolean;
|
|
689
|
+
examples: Example[];
|
|
690
|
+
exampleLabels: string[];
|
|
691
|
+
extensions: Extension[];
|
|
692
|
+
validators: Record<string, Validator>;
|
|
693
|
+
};
|
|
694
|
+
type HandlerContext = {
|
|
695
|
+
host: DecoratorHost;
|
|
696
|
+
argument: (index: number) => DecoratorArgument | undefined;
|
|
697
|
+
arguments: () => DecoratorArgument[];
|
|
698
|
+
typeArgument: (index: number) => DecoratorTypeArgument | undefined;
|
|
699
|
+
typeArguments: () => DecoratorTypeArgument[];
|
|
700
|
+
parameterType: () => Type | undefined;
|
|
701
|
+
};
|
|
702
|
+
type JsDocHandlerContext = {
|
|
703
|
+
host: DecoratorHost;
|
|
704
|
+
source: JsDocSource;
|
|
705
|
+
parameterType: () => Type | undefined;
|
|
706
|
+
};
|
|
707
|
+
type Match = {
|
|
708
|
+
name: string;
|
|
709
|
+
on?: DecoratorTarget;
|
|
710
|
+
};
|
|
711
|
+
type JsDocMatch = {
|
|
712
|
+
tag: string;
|
|
713
|
+
on?: DecoratorTarget;
|
|
714
|
+
};
|
|
715
|
+
type ReplacesPolicy = true | string;
|
|
716
|
+
/**
|
|
717
|
+
* Tags a handler with a semantic concept that the type resolver consults.
|
|
718
|
+
*
|
|
719
|
+
* Allows preset authors to rename a decorator (via `match.name`) without
|
|
720
|
+
* breaking type-resolver behaviour: the resolver looks up handlers by marker
|
|
721
|
+
* and reads the canonical decorator name from each handler's `match.name`.
|
|
722
|
+
*/
|
|
723
|
+
type ResolverMarker = `${MarkerName}` | {
|
|
724
|
+
numeric: `${NumericKind}`;
|
|
725
|
+
};
|
|
726
|
+
type HandlerBase = {
|
|
727
|
+
match: Match;
|
|
728
|
+
replaces?: ReplacesPolicy;
|
|
729
|
+
marker?: ResolverMarker;
|
|
730
|
+
};
|
|
731
|
+
type ControllerHandler = HandlerBase & {
|
|
732
|
+
apply: (ctx: HandlerContext, draft: ControllerDraft) => void;
|
|
733
|
+
};
|
|
734
|
+
type MethodHandler = HandlerBase & {
|
|
735
|
+
apply: (ctx: HandlerContext, draft: MethodDraft) => void;
|
|
736
|
+
};
|
|
737
|
+
type ParameterHandler = HandlerBase & {
|
|
738
|
+
apply: (ctx: HandlerContext, draft: ParameterDraft) => void;
|
|
739
|
+
};
|
|
740
|
+
type JsDocHandlerBase = {
|
|
741
|
+
match: JsDocMatch;
|
|
742
|
+
replaces?: ReplacesPolicy;
|
|
743
|
+
marker?: ResolverMarker;
|
|
744
|
+
};
|
|
745
|
+
type ControllerJsDocHandler = JsDocHandlerBase & {
|
|
746
|
+
apply: (ctx: JsDocHandlerContext, draft: ControllerDraft) => void;
|
|
747
|
+
};
|
|
748
|
+
type MethodJsDocHandler = JsDocHandlerBase & {
|
|
749
|
+
apply: (ctx: JsDocHandlerContext, draft: MethodDraft) => void;
|
|
750
|
+
};
|
|
751
|
+
type ParameterJsDocHandler = JsDocHandlerBase & {
|
|
752
|
+
apply: (ctx: JsDocHandlerContext, draft: ParameterDraft) => void;
|
|
753
|
+
};
|
|
754
|
+
type AnyDecoratorHandler = ControllerHandler | MethodHandler | ParameterHandler;
|
|
755
|
+
type AnyJsDocHandler = ControllerJsDocHandler | MethodJsDocHandler | ParameterJsDocHandler;
|
|
756
|
+
type Preset = {
|
|
757
|
+
name: string;
|
|
758
|
+
extends?: string[];
|
|
759
|
+
controllers?: ControllerHandler[];
|
|
760
|
+
methods?: MethodHandler[];
|
|
761
|
+
parameters?: ParameterHandler[];
|
|
762
|
+
controllerJsDoc?: ControllerJsDocHandler[];
|
|
763
|
+
methodJsDoc?: MethodJsDocHandler[];
|
|
764
|
+
parameterJsDoc?: ParameterJsDocHandler[];
|
|
765
|
+
};
|
|
766
|
+
type Registry = {
|
|
767
|
+
controllers: ControllerHandler[];
|
|
768
|
+
methods: MethodHandler[];
|
|
769
|
+
parameters: ParameterHandler[];
|
|
770
|
+
controllerJsDoc: ControllerJsDocHandler[];
|
|
771
|
+
methodJsDoc: MethodJsDocHandler[];
|
|
772
|
+
parameterJsDoc: ParameterJsDocHandler[];
|
|
773
|
+
};
|
|
774
|
+
type PresetResolver = (name: string) => Promise<Preset> | Preset;
|
|
775
|
+
type LoadRegistryOptions = {
|
|
776
|
+
resolver: PresetResolver;
|
|
777
|
+
strict?: boolean;
|
|
778
|
+
};
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region src/adapters/cache/utils.d.ts
|
|
781
|
+
declare function buildCacheOptions(input?: string | boolean | CacheOptionsInput): CacheOptions;
|
|
782
|
+
type CacheKeyParts = {
|
|
783
|
+
schemaVersion: string;
|
|
784
|
+
sourceFilesHash: string;
|
|
785
|
+
compilerOptionsHash: string;
|
|
786
|
+
registryHash: string;
|
|
787
|
+
presetName?: string;
|
|
788
|
+
};
|
|
789
|
+
/**
|
|
790
|
+
* Combines all key contributors into a single sha256 hex string. The order is
|
|
791
|
+
* stable; each part is null-separated to avoid concatenation ambiguity.
|
|
792
|
+
*/
|
|
793
|
+
declare function composeCacheKey(parts: CacheKeyParts): string;
|
|
794
|
+
/**
|
|
795
|
+
* Hash a stable JSON projection of `compilerOptions`. Sorting keys keeps the
|
|
796
|
+
* output deterministic regardless of declaration order in tsconfig.json.
|
|
797
|
+
*/
|
|
798
|
+
declare function hashCompilerOptions(options?: CompilerOptions): string;
|
|
799
|
+
/**
|
|
800
|
+
* Hash the resolved registry's structural shape. Catches structural changes
|
|
801
|
+
* (handler added/removed/renamed, marker changed, replaces policy changed)
|
|
802
|
+
* AND most logic changes via `apply.toString()`. Misses changes that are
|
|
803
|
+
* purely captured-variable shifts in factory-built handlers — acceptable
|
|
804
|
+
* trade-off for catching local preset edits.
|
|
805
|
+
*/
|
|
806
|
+
declare function hashRegistry(registry: Registry): string;
|
|
807
|
+
//#endregion
|
|
808
|
+
//#region src/adapters/decorator/module.d.ts
|
|
809
|
+
declare function loadRegistry(preset: Preset, options: LoadRegistryOptions): Promise<Registry>;
|
|
810
|
+
/**
|
|
811
|
+
* Resolve a preset by string identifier (npm package, relative path, etc.) and
|
|
812
|
+
* return the v2 Preset object. Looks for a `preset` named export, then the
|
|
813
|
+
* default export, then the module itself.
|
|
814
|
+
*/
|
|
815
|
+
declare function resolvePresetByName(input: string): Promise<Preset>;
|
|
816
|
+
/**
|
|
817
|
+
* Resolve a preset by name and immediately materialize its registry, recursively
|
|
818
|
+
* loading `extends` parents through the same resolver.
|
|
819
|
+
*/
|
|
820
|
+
declare function loadRegistryByName(input: string): Promise<Registry>;
|
|
821
|
+
//#endregion
|
|
822
|
+
//#region src/adapters/decorator/orchestrator/types.d.ts
|
|
823
|
+
/**
|
|
824
|
+
* Reported when a decorator on a node has no matching handler in the
|
|
825
|
+
* supplied registry. The orchestrator computes file/line from the host node
|
|
826
|
+
* (1-based line number).
|
|
827
|
+
*/
|
|
828
|
+
type UnmatchedDecoratorReport = {
|
|
829
|
+
name: string;
|
|
830
|
+
target: DecoratorTarget;
|
|
831
|
+
host: DecoratorHost;
|
|
832
|
+
file: string;
|
|
833
|
+
line: number;
|
|
834
|
+
};
|
|
835
|
+
type ApplyHandlersOptions = {
|
|
836
|
+
target: DecoratorTarget;
|
|
837
|
+
host: DecoratorHost;
|
|
838
|
+
resolveTypeNode: (node: TypeNode) => Type;
|
|
839
|
+
parameterType?: () => Type | undefined;
|
|
840
|
+
typeChecker?: TypeChecker;
|
|
841
|
+
/**
|
|
842
|
+
* Optional reporter for decorator sources that no handler matched.
|
|
843
|
+
* The orchestrator builds a {@link DecoratorSource} for every decorator
|
|
844
|
+
* on the node; if iteration finishes without any handler claiming a
|
|
845
|
+
* source, this callback fires once for that source.
|
|
846
|
+
*/
|
|
847
|
+
onUnmatchedDecorator?: (report: UnmatchedDecoratorReport, source: DecoratorSource) => void;
|
|
848
|
+
};
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/adapters/decorator/orchestrator/module.d.ts
|
|
851
|
+
type DecoratorHandlerLike<D> = {
|
|
852
|
+
match: Match;
|
|
853
|
+
apply: (ctx: HandlerContext, draft: D) => void;
|
|
854
|
+
};
|
|
855
|
+
type JsDocHandlerLike<D> = {
|
|
856
|
+
match: JsDocMatch;
|
|
857
|
+
apply: (ctx: JsDocHandlerContext, draft: D) => void;
|
|
858
|
+
};
|
|
859
|
+
declare function buildHandlerContext(source: DecoratorSource, options: ApplyHandlersOptions): HandlerContext;
|
|
860
|
+
declare function buildJsDocHandlerContext(source: JsDocSource, options: ApplyHandlersOptions): JsDocHandlerContext;
|
|
861
|
+
declare function applyDecoratorHandlers<D>(node: Node, handlers: DecoratorHandlerLike<D>[], draft: D, options: ApplyHandlersOptions): void;
|
|
862
|
+
declare function applyJsDocHandlers<D>(node: Node, handlers: JsDocHandlerLike<D>[], draft: D, options: ApplyHandlersOptions): void;
|
|
863
|
+
//#endregion
|
|
864
|
+
//#region src/adapters/decorator/typescript/types.d.ts
|
|
865
|
+
type DecoratorSourceBuilderOptions = {
|
|
866
|
+
target: DecoratorTarget;
|
|
867
|
+
host: DecoratorHost;
|
|
868
|
+
resolveTypeNode: (node: TypeNode) => Type;
|
|
869
|
+
typeChecker?: TypeChecker;
|
|
870
|
+
};
|
|
871
|
+
type JsDocSourceBuilderOptions = {
|
|
872
|
+
target: DecoratorTarget;
|
|
873
|
+
host: DecoratorHost;
|
|
874
|
+
resolveTypeNode: (node: TypeNode) => Type;
|
|
875
|
+
};
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region src/adapters/decorator/typescript/module.d.ts
|
|
878
|
+
declare function buildDecoratorSources(node: Node, options: DecoratorSourceBuilderOptions): DecoratorSource[];
|
|
879
|
+
declare function buildJsDocSources(node: Node, options: JsDocSourceBuilderOptions): JsDocSource[];
|
|
880
|
+
//#endregion
|
|
881
|
+
//#region src/adapters/decorator/typescript/utils.d.ts
|
|
882
|
+
type RawDecorator = {
|
|
883
|
+
name: string;
|
|
884
|
+
arguments: DecoratorArgument[];
|
|
885
|
+
};
|
|
886
|
+
/**
|
|
887
|
+
* Enumerate decorators on a TS node and classify their argument values without
|
|
888
|
+
* going through the registry. Used by read-side consumers (type resolver,
|
|
889
|
+
* extension extraction) that only need decorator names + argument values.
|
|
890
|
+
*/
|
|
891
|
+
declare function readNodeDecorators(node: Node, typeChecker?: TypeChecker): RawDecorator[];
|
|
892
|
+
declare function findDecoratorByName(node: Node, name: string, typeChecker?: TypeChecker): RawDecorator | undefined;
|
|
893
|
+
declare function findDecoratorsByName(node: Node, name: string, typeChecker?: TypeChecker): RawDecorator[];
|
|
894
|
+
declare function hasDecoratorNamed(node: Node, name: string, typeChecker?: TypeChecker): boolean;
|
|
895
|
+
declare function buildDecoratorArgument(expr: Expression, typeChecker?: TypeChecker): DecoratorArgument;
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region src/adapters/decorator/utils.d.ts
|
|
898
|
+
declare function matches(match: Match, source: Pick<DecoratorSource, 'name' | 'target'>): boolean;
|
|
899
|
+
declare function matchesJsDoc(match: JsDocMatch, source: Pick<JsDocSource, 'tag' | 'target'>): boolean;
|
|
900
|
+
declare function newControllerDraft(input: Pick<ControllerDraft, 'name' | 'location'>): ControllerDraft;
|
|
901
|
+
declare function newMethodDraft(input: Pick<MethodDraft, 'name'>): MethodDraft;
|
|
902
|
+
declare function newParameterDraft(input: Pick<ParameterDraft, 'parameterName'>): ParameterDraft;
|
|
903
|
+
declare function createRegistry(): Registry;
|
|
904
|
+
declare function generatePresetLookupPaths(input: string): string[];
|
|
905
|
+
/**
|
|
906
|
+
* Collect the unique decorator names of every handler whose `marker` matches
|
|
907
|
+
* the given predicate. Lets the type resolver discover preset-renamed
|
|
908
|
+
* decorators without hard-coding canonical names.
|
|
909
|
+
*/
|
|
910
|
+
declare function namesForMarker(registry: Registry, predicate: (marker: ResolverMarker) => boolean): Set<string>;
|
|
911
|
+
/**
|
|
912
|
+
* Collect the unique JSDoc tag names of every JSDoc handler whose `marker`
|
|
913
|
+
* matches the given predicate. JSDoc analogue of `namesForMarker`.
|
|
914
|
+
*/
|
|
915
|
+
declare function tagsForMarker(registry: Registry, predicate: (marker: ResolverMarker) => boolean): Set<string>;
|
|
916
|
+
declare function isHiddenMarker(marker: ResolverMarker): boolean;
|
|
917
|
+
declare function isDeprecatedMarker(marker: ResolverMarker): boolean;
|
|
918
|
+
declare function isExtensionMarker(marker: ResolverMarker): boolean;
|
|
919
|
+
declare function numericMarkerKind(marker: ResolverMarker): 'int' | 'long' | 'float' | 'double' | undefined;
|
|
920
|
+
declare const controller: (handler: ControllerHandler) => ControllerHandler;
|
|
921
|
+
declare const method: (handler: MethodHandler) => MethodHandler;
|
|
922
|
+
declare const parameter: (handler: ParameterHandler) => ParameterHandler;
|
|
923
|
+
declare const controllerJsDoc: (handler: ControllerJsDocHandler) => ControllerJsDocHandler;
|
|
924
|
+
declare const methodJsDoc: (handler: MethodJsDocHandler) => MethodJsDocHandler;
|
|
925
|
+
declare const parameterJsDoc: (handler: ParameterJsDocHandler) => ParameterJsDocHandler;
|
|
926
|
+
type AnyDraft = ControllerDraft | MethodDraft | ParameterDraft;
|
|
927
|
+
type DraftApply = (ctx: HandlerContext, draft: AnyDraft) => void;
|
|
928
|
+
declare function into(key: string): {
|
|
929
|
+
positional(index: number): DraftApply;
|
|
930
|
+
typeArgument(index?: number): DraftApply;
|
|
931
|
+
};
|
|
932
|
+
declare function append(key: string): {
|
|
933
|
+
positional(index: number): DraftApply;
|
|
934
|
+
positionalAll(): DraftApply;
|
|
935
|
+
};
|
|
936
|
+
declare function flag(key: string, value?: unknown): DraftApply;
|
|
937
|
+
//#endregion
|
|
938
|
+
//#region src/adapters/decorator/validation/module.d.ts
|
|
939
|
+
declare const matchSchema: z.ZodObject<{
|
|
940
|
+
name: z.ZodString;
|
|
941
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
942
|
+
class: "class";
|
|
943
|
+
method: "method";
|
|
944
|
+
parameter: "parameter";
|
|
945
|
+
property: "property";
|
|
946
|
+
}>>;
|
|
947
|
+
}, z.core.$strip>;
|
|
948
|
+
declare const jsDocMatchSchema: z.ZodObject<{
|
|
949
|
+
tag: z.ZodString;
|
|
950
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
951
|
+
class: "class";
|
|
952
|
+
method: "method";
|
|
953
|
+
parameter: "parameter";
|
|
954
|
+
property: "property";
|
|
955
|
+
}>>;
|
|
956
|
+
}, z.core.$strip>;
|
|
957
|
+
declare const controllerHandlerSchema: z.ZodObject<{
|
|
958
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
959
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
960
|
+
numeric: z.ZodEnum<{
|
|
961
|
+
double: "double";
|
|
962
|
+
float: "float";
|
|
963
|
+
long: "long";
|
|
964
|
+
int: "int";
|
|
965
|
+
}>;
|
|
966
|
+
}, z.core.$strip>]>>;
|
|
967
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
968
|
+
match: z.ZodObject<{
|
|
969
|
+
name: z.ZodString;
|
|
970
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
971
|
+
class: "class";
|
|
972
|
+
method: "method";
|
|
973
|
+
parameter: "parameter";
|
|
974
|
+
property: "property";
|
|
975
|
+
}>>;
|
|
976
|
+
}, z.core.$strip>;
|
|
977
|
+
}, z.core.$strip>;
|
|
978
|
+
declare const methodHandlerSchema: z.ZodObject<{
|
|
979
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
980
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
981
|
+
numeric: z.ZodEnum<{
|
|
982
|
+
double: "double";
|
|
983
|
+
float: "float";
|
|
984
|
+
long: "long";
|
|
985
|
+
int: "int";
|
|
986
|
+
}>;
|
|
987
|
+
}, z.core.$strip>]>>;
|
|
988
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
989
|
+
match: z.ZodObject<{
|
|
990
|
+
name: z.ZodString;
|
|
991
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
992
|
+
class: "class";
|
|
993
|
+
method: "method";
|
|
994
|
+
parameter: "parameter";
|
|
995
|
+
property: "property";
|
|
996
|
+
}>>;
|
|
997
|
+
}, z.core.$strip>;
|
|
998
|
+
}, z.core.$strip>;
|
|
999
|
+
declare const parameterHandlerSchema: z.ZodObject<{
|
|
1000
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1001
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1002
|
+
numeric: z.ZodEnum<{
|
|
1003
|
+
double: "double";
|
|
1004
|
+
float: "float";
|
|
1005
|
+
long: "long";
|
|
1006
|
+
int: "int";
|
|
1007
|
+
}>;
|
|
1008
|
+
}, z.core.$strip>]>>;
|
|
1009
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1010
|
+
match: z.ZodObject<{
|
|
1011
|
+
name: z.ZodString;
|
|
1012
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1013
|
+
class: "class";
|
|
1014
|
+
method: "method";
|
|
1015
|
+
parameter: "parameter";
|
|
1016
|
+
property: "property";
|
|
1017
|
+
}>>;
|
|
1018
|
+
}, z.core.$strip>;
|
|
1019
|
+
}, z.core.$strip>;
|
|
1020
|
+
declare const controllerJsDocHandlerSchema: z.ZodObject<{
|
|
1021
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1022
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1023
|
+
numeric: z.ZodEnum<{
|
|
1024
|
+
double: "double";
|
|
1025
|
+
float: "float";
|
|
1026
|
+
long: "long";
|
|
1027
|
+
int: "int";
|
|
1028
|
+
}>;
|
|
1029
|
+
}, z.core.$strip>]>>;
|
|
1030
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1031
|
+
match: z.ZodObject<{
|
|
1032
|
+
tag: z.ZodString;
|
|
1033
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1034
|
+
class: "class";
|
|
1035
|
+
method: "method";
|
|
1036
|
+
parameter: "parameter";
|
|
1037
|
+
property: "property";
|
|
1038
|
+
}>>;
|
|
1039
|
+
}, z.core.$strip>;
|
|
1040
|
+
}, z.core.$strip>;
|
|
1041
|
+
declare const methodJsDocHandlerSchema: z.ZodObject<{
|
|
1042
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1043
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1044
|
+
numeric: z.ZodEnum<{
|
|
1045
|
+
double: "double";
|
|
1046
|
+
float: "float";
|
|
1047
|
+
long: "long";
|
|
1048
|
+
int: "int";
|
|
1049
|
+
}>;
|
|
1050
|
+
}, z.core.$strip>]>>;
|
|
1051
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1052
|
+
match: z.ZodObject<{
|
|
1053
|
+
tag: z.ZodString;
|
|
1054
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1055
|
+
class: "class";
|
|
1056
|
+
method: "method";
|
|
1057
|
+
parameter: "parameter";
|
|
1058
|
+
property: "property";
|
|
1059
|
+
}>>;
|
|
1060
|
+
}, z.core.$strip>;
|
|
1061
|
+
}, z.core.$strip>;
|
|
1062
|
+
declare const parameterJsDocHandlerSchema: z.ZodObject<{
|
|
1063
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1064
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1065
|
+
numeric: z.ZodEnum<{
|
|
1066
|
+
double: "double";
|
|
1067
|
+
float: "float";
|
|
1068
|
+
long: "long";
|
|
1069
|
+
int: "int";
|
|
1070
|
+
}>;
|
|
1071
|
+
}, z.core.$strip>]>>;
|
|
1072
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1073
|
+
match: z.ZodObject<{
|
|
1074
|
+
tag: z.ZodString;
|
|
1075
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1076
|
+
class: "class";
|
|
1077
|
+
method: "method";
|
|
1078
|
+
parameter: "parameter";
|
|
1079
|
+
property: "property";
|
|
1080
|
+
}>>;
|
|
1081
|
+
}, z.core.$strip>;
|
|
1082
|
+
}, z.core.$strip>;
|
|
1083
|
+
declare const presetSchema: z.ZodObject<{
|
|
1084
|
+
name: z.ZodString;
|
|
1085
|
+
extends: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1086
|
+
controllers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1087
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1088
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1089
|
+
numeric: z.ZodEnum<{
|
|
1090
|
+
double: "double";
|
|
1091
|
+
float: "float";
|
|
1092
|
+
long: "long";
|
|
1093
|
+
int: "int";
|
|
1094
|
+
}>;
|
|
1095
|
+
}, z.core.$strip>]>>;
|
|
1096
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1097
|
+
match: z.ZodObject<{
|
|
1098
|
+
name: z.ZodString;
|
|
1099
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1100
|
+
class: "class";
|
|
1101
|
+
method: "method";
|
|
1102
|
+
parameter: "parameter";
|
|
1103
|
+
property: "property";
|
|
1104
|
+
}>>;
|
|
1105
|
+
}, z.core.$strip>;
|
|
1106
|
+
}, z.core.$strip>>>;
|
|
1107
|
+
methods: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1108
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1109
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1110
|
+
numeric: z.ZodEnum<{
|
|
1111
|
+
double: "double";
|
|
1112
|
+
float: "float";
|
|
1113
|
+
long: "long";
|
|
1114
|
+
int: "int";
|
|
1115
|
+
}>;
|
|
1116
|
+
}, z.core.$strip>]>>;
|
|
1117
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1118
|
+
match: z.ZodObject<{
|
|
1119
|
+
name: z.ZodString;
|
|
1120
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1121
|
+
class: "class";
|
|
1122
|
+
method: "method";
|
|
1123
|
+
parameter: "parameter";
|
|
1124
|
+
property: "property";
|
|
1125
|
+
}>>;
|
|
1126
|
+
}, z.core.$strip>;
|
|
1127
|
+
}, z.core.$strip>>>;
|
|
1128
|
+
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1129
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1130
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1131
|
+
numeric: z.ZodEnum<{
|
|
1132
|
+
double: "double";
|
|
1133
|
+
float: "float";
|
|
1134
|
+
long: "long";
|
|
1135
|
+
int: "int";
|
|
1136
|
+
}>;
|
|
1137
|
+
}, z.core.$strip>]>>;
|
|
1138
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1139
|
+
match: z.ZodObject<{
|
|
1140
|
+
name: z.ZodString;
|
|
1141
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1142
|
+
class: "class";
|
|
1143
|
+
method: "method";
|
|
1144
|
+
parameter: "parameter";
|
|
1145
|
+
property: "property";
|
|
1146
|
+
}>>;
|
|
1147
|
+
}, z.core.$strip>;
|
|
1148
|
+
}, z.core.$strip>>>;
|
|
1149
|
+
controllerJsDoc: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1150
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1151
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1152
|
+
numeric: z.ZodEnum<{
|
|
1153
|
+
double: "double";
|
|
1154
|
+
float: "float";
|
|
1155
|
+
long: "long";
|
|
1156
|
+
int: "int";
|
|
1157
|
+
}>;
|
|
1158
|
+
}, z.core.$strip>]>>;
|
|
1159
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1160
|
+
match: z.ZodObject<{
|
|
1161
|
+
tag: z.ZodString;
|
|
1162
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1163
|
+
class: "class";
|
|
1164
|
+
method: "method";
|
|
1165
|
+
parameter: "parameter";
|
|
1166
|
+
property: "property";
|
|
1167
|
+
}>>;
|
|
1168
|
+
}, z.core.$strip>;
|
|
1169
|
+
}, z.core.$strip>>>;
|
|
1170
|
+
methodJsDoc: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1171
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1172
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1173
|
+
numeric: z.ZodEnum<{
|
|
1174
|
+
double: "double";
|
|
1175
|
+
float: "float";
|
|
1176
|
+
long: "long";
|
|
1177
|
+
int: "int";
|
|
1178
|
+
}>;
|
|
1179
|
+
}, z.core.$strip>]>>;
|
|
1180
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1181
|
+
match: z.ZodObject<{
|
|
1182
|
+
tag: z.ZodString;
|
|
1183
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1184
|
+
class: "class";
|
|
1185
|
+
method: "method";
|
|
1186
|
+
parameter: "parameter";
|
|
1187
|
+
property: "property";
|
|
1188
|
+
}>>;
|
|
1189
|
+
}, z.core.$strip>;
|
|
1190
|
+
}, z.core.$strip>>>;
|
|
1191
|
+
parameterJsDoc: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1192
|
+
replaces: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodString]>>;
|
|
1193
|
+
marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"hidden">, z.ZodLiteral<"deprecated">, z.ZodLiteral<"extension">, z.ZodObject<{
|
|
1194
|
+
numeric: z.ZodEnum<{
|
|
1195
|
+
double: "double";
|
|
1196
|
+
float: "float";
|
|
1197
|
+
long: "long";
|
|
1198
|
+
int: "int";
|
|
1199
|
+
}>;
|
|
1200
|
+
}, z.core.$strip>]>>;
|
|
1201
|
+
apply: z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>;
|
|
1202
|
+
match: z.ZodObject<{
|
|
1203
|
+
tag: z.ZodString;
|
|
1204
|
+
on: z.ZodOptional<z.ZodEnum<{
|
|
1205
|
+
class: "class";
|
|
1206
|
+
method: "method";
|
|
1207
|
+
parameter: "parameter";
|
|
1208
|
+
property: "property";
|
|
1209
|
+
}>>;
|
|
1210
|
+
}, z.core.$strip>;
|
|
1211
|
+
}, z.core.$strip>>>;
|
|
1212
|
+
}, z.core.$strip>;
|
|
1213
|
+
declare function createPresetContainer(): Container<Preset>;
|
|
1214
|
+
declare function validatePreset(input: unknown): Promise<Preset>;
|
|
1215
|
+
//#endregion
|
|
1216
|
+
//#region src/adapters/filesystem/tsconfig/types.d.ts
|
|
1217
|
+
type TsconfigLoadContext = {
|
|
1218
|
+
cwd?: string;
|
|
1219
|
+
name?: string;
|
|
1220
|
+
};
|
|
1221
|
+
type TsCompilerOptions = CompilerOptions;
|
|
1222
|
+
type TsConfig = {
|
|
1223
|
+
compilerOptions?: TsCompilerOptions;
|
|
1224
|
+
[key: string]: any;
|
|
1225
|
+
};
|
|
1226
|
+
//#endregion
|
|
1227
|
+
//#region src/adapters/filesystem/tsconfig/module.d.ts
|
|
1228
|
+
declare function loadTSConfig(context?: TsconfigLoadContext): Promise<TsConfig>;
|
|
1229
|
+
declare function softLoadTsconfig(context?: TsconfigLoadContext): Promise<TsConfig>;
|
|
1230
|
+
//#endregion
|
|
1231
|
+
//#region src/core/config/types.d.ts
|
|
1232
|
+
type EntryPointOptions = {
|
|
1233
|
+
cwd: string;
|
|
1234
|
+
pattern: string;
|
|
1235
|
+
};
|
|
1236
|
+
type EntryPoint = string | string[] | EntryPointOptions | EntryPointOptions[];
|
|
1237
|
+
type MetadataGeneratorOptions = {
|
|
1238
|
+
/**
|
|
1239
|
+
* The entry point to your API.
|
|
1240
|
+
*/
|
|
1241
|
+
entryPoint: EntryPoint;
|
|
1242
|
+
/**
|
|
1243
|
+
* Directory to ignore during TypeScript files scan.
|
|
1244
|
+
* Default: []
|
|
1245
|
+
*/
|
|
1246
|
+
ignore?: string[];
|
|
1247
|
+
/**
|
|
1248
|
+
* Directory to allow during TypeScript files scan.
|
|
1249
|
+
* Default: []
|
|
1250
|
+
*/
|
|
1251
|
+
allow?: string[];
|
|
1252
|
+
/**
|
|
1253
|
+
* Directory to store and cache metadata cache files.
|
|
1254
|
+
* Default: false
|
|
1255
|
+
*/
|
|
1256
|
+
cache?: string | boolean | Partial<CacheOptions>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Load a specific preset configuration.
|
|
1259
|
+
*/
|
|
1260
|
+
preset?: string;
|
|
1261
|
+
/**
|
|
1262
|
+
* Controls how unmatched decorators (decorators with no matching handler
|
|
1263
|
+
* in the resolved registry) are surfaced.
|
|
1264
|
+
*
|
|
1265
|
+
* - `false` / unset (default): silent.
|
|
1266
|
+
* - `true`: emit a single `console.warn` listing every unmatched decorator
|
|
1267
|
+
* at the end of generation. Useful for catching typos (e.g. `@Hiden`
|
|
1268
|
+
* instead of `@Hidden`) and unwired decorators in custom presets.
|
|
1269
|
+
* - `'throw'`: throw a `GeneratorError` instead of warning. Useful as a
|
|
1270
|
+
* CI gate.
|
|
1271
|
+
*
|
|
1272
|
+
* If `onUnmatchedDecorator` is also set, the callback is invoked instead
|
|
1273
|
+
* of warning/throwing — collection still happens, but reporting is yours.
|
|
1274
|
+
*
|
|
1275
|
+
* Note: JSDoc tags are not currently included in strict-mode reporting
|
|
1276
|
+
* because standard documentation tags (`@param`, `@returns`, ...) would
|
|
1277
|
+
* generate excessive noise.
|
|
1278
|
+
*/
|
|
1279
|
+
strict?: boolean | 'throw';
|
|
1280
|
+
/**
|
|
1281
|
+
* Optional callback invoked at the end of generation with all unmatched-
|
|
1282
|
+
* decorator reports collected during the run. Replaces the default
|
|
1283
|
+
* `console.warn` / `throw` behaviour of `strict` — when set, the callback
|
|
1284
|
+
* is the terminal step (no warn, no throw).
|
|
1285
|
+
*
|
|
1286
|
+
* Setting this implicitly enables collection — you don't also need to set
|
|
1287
|
+
* `strict`.
|
|
1288
|
+
*/
|
|
1289
|
+
onUnmatchedDecorator?: (reports: UnmatchedDecoratorReport[]) => void;
|
|
1290
|
+
};
|
|
1291
|
+
type MetadataGenerateOptions = MetadataGeneratorOptions & {
|
|
1292
|
+
/**
|
|
1293
|
+
* Path to tsconfig.json or a TsConfig object.
|
|
1294
|
+
*/
|
|
1295
|
+
tsconfig?: string | TsConfig;
|
|
1296
|
+
};
|
|
1297
|
+
//#endregion
|
|
1298
|
+
//#region src/core/metadata/types.d.ts
|
|
1299
|
+
type MetadataGeneratorContext = {
|
|
1300
|
+
options: MetadataGeneratorOptions;
|
|
1301
|
+
sourceFiles: string[];
|
|
1302
|
+
compilerOptions?: CompilerOptions;
|
|
1303
|
+
};
|
|
1304
|
+
interface IMetadataGenerator {
|
|
1305
|
+
generate(): Promise<Metadata>;
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* The output specification for metadata generation.
|
|
1309
|
+
*/
|
|
1310
|
+
type Metadata = {
|
|
1311
|
+
/**
|
|
1312
|
+
* A Controller is a collection of grouped methods (GET, POST, ...)
|
|
1313
|
+
* for a common URL path (i.e /users) or an more explicit URL path (i.e. /users/:id).
|
|
1314
|
+
*/
|
|
1315
|
+
controllers: Controller[];
|
|
1316
|
+
/**
|
|
1317
|
+
* ReferenceTypes is an object of found types (interfaces, type, ...),
|
|
1318
|
+
* and classes which were detected during code analysis.
|
|
1319
|
+
*/
|
|
1320
|
+
referenceTypes: ReferenceTypes;
|
|
1321
|
+
};
|
|
1322
|
+
/**
|
|
1323
|
+
* Narrow context interface for the type resolver.
|
|
1324
|
+
* Contains only what TypeNodeResolver needs — no generator methods.
|
|
1325
|
+
*/
|
|
1326
|
+
interface IResolverContext {
|
|
1327
|
+
readonly typeChecker: TypeChecker;
|
|
1328
|
+
readonly nodes: Node[];
|
|
1329
|
+
readonly registry: Registry;
|
|
1330
|
+
readonly resolverCache: IResolverCache;
|
|
1331
|
+
isExportedNode(node: Node): boolean;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Callback interface for resolver → generator communication.
|
|
1335
|
+
* Allows the resolver to register discovered reference types
|
|
1336
|
+
* without importing the MetadataGenerator class.
|
|
1337
|
+
*/
|
|
1338
|
+
interface IReferenceTypeRegistry {
|
|
1339
|
+
addReferenceType(type: ReferenceType): void;
|
|
1340
|
+
getReferenceType(refName: string): ReferenceType | undefined;
|
|
1341
|
+
registerDependencyResolver(callback: DependencyResolver): void;
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Context interface for generators.
|
|
1345
|
+
* Extends IResolverContext and IReferenceTypeRegistry so generators
|
|
1346
|
+
* can pass `this.current` directly to TypeNodeResolver.
|
|
1347
|
+
*/
|
|
1348
|
+
interface IGeneratorContext extends IResolverContext, IReferenceTypeRegistry {
|
|
1349
|
+
readonly config: MetadataGeneratorOptions;
|
|
1350
|
+
readonly registry: Registry;
|
|
1351
|
+
/**
|
|
1352
|
+
* Optional sink for unmatched-decorator reports. Generators forward to
|
|
1353
|
+
* this when `config.strict` is enabled. The metadata generator drains the
|
|
1354
|
+
* sink after the controller walk and emits a single warning summary.
|
|
1355
|
+
*/
|
|
1356
|
+
reportUnmatchedDecorator?(report: UnmatchedDecoratorReport): void;
|
|
1357
|
+
}
|
|
1358
|
+
//#endregion
|
|
1359
|
+
//#region src/core/metadata/variable.d.ts
|
|
1360
|
+
type VariableType = 'string' | 'number' | 'bigint' | 'boolean' | 'symbol' | 'undefined' | 'object' | 'function';
|
|
1361
|
+
//#endregion
|
|
1362
|
+
//#region src/core/validator/error.d.ts
|
|
1363
|
+
declare class ValidatorError extends MetadataError {}
|
|
1364
|
+
//#endregion
|
|
1365
|
+
//#region src/core/validator/constants.d.ts
|
|
1366
|
+
declare enum ValidatorName {
|
|
1367
|
+
UNIQUE_ITEMS = "uniqueItems",
|
|
1368
|
+
MINIMUM = "minimum",
|
|
1369
|
+
MAXIMUM = "maximum",
|
|
1370
|
+
MIN_ITEMS = "minItems",
|
|
1371
|
+
MAX_ITEMS = "maxItems",
|
|
1372
|
+
MIN_LENGTH = "minLength",
|
|
1373
|
+
MAX_LENGTH = "maxLength",
|
|
1374
|
+
MIN_DATE = "minDate",
|
|
1375
|
+
MAX_DATE = "maxDate",
|
|
1376
|
+
PATTERN = "pattern"
|
|
1377
|
+
}
|
|
1378
|
+
declare const ValidatorErrorCode: {
|
|
1379
|
+
readonly EXPECTED_NUMBER: "VALIDATOR_EXPECTED_NUMBER";
|
|
1380
|
+
readonly EXPECTED_DATE: "VALIDATOR_EXPECTED_DATE";
|
|
1381
|
+
readonly EXPECTED_STRING: "VALIDATOR_EXPECTED_STRING";
|
|
1382
|
+
};
|
|
1383
|
+
//#endregion
|
|
1384
|
+
//#region src/core/error/config.d.ts
|
|
1385
|
+
declare class ConfigError extends MetadataError {}
|
|
1386
|
+
//#endregion
|
|
1387
|
+
//#region src/core/error/config-codes.d.ts
|
|
1388
|
+
declare const ConfigErrorCode: {
|
|
1389
|
+
readonly TSCONFIG_MALFORMED: "CONFIG_TSCONFIG_MALFORMED";
|
|
1390
|
+
readonly PRESET_NOT_FOUND: "CONFIG_PRESET_NOT_FOUND";
|
|
1391
|
+
readonly PRESET_MISSING: "CONFIG_PRESET_MISSING";
|
|
1392
|
+
};
|
|
1393
|
+
type ConfigErrorCode = typeof ConfigErrorCode[keyof typeof ConfigErrorCode];
|
|
1394
|
+
//#endregion
|
|
1395
|
+
//#region src/adapters/typescript/resolver/types.d.ts
|
|
1396
|
+
type OverrideToken = ts.Token<ts.SyntaxKind.QuestionToken> | ts.Token<ts.SyntaxKind.PlusToken> | ts.Token<ts.SyntaxKind.MinusToken>;
|
|
1397
|
+
type UsableDeclaration = ts.InterfaceDeclaration | ts.ClassDeclaration | ts.PropertySignature | ts.TypeAliasDeclaration | ts.EnumMember;
|
|
1398
|
+
type TypeNodeResolverContext = {
|
|
1399
|
+
[name: string]: ts.TypeReferenceNode | ts.TypeNode;
|
|
1400
|
+
};
|
|
1401
|
+
type SubResolverContext = {
|
|
1402
|
+
readonly typeChecker: ts.TypeChecker;
|
|
1403
|
+
readonly current: IResolverContext & IReferenceTypeRegistry;
|
|
1404
|
+
readonly parentNode?: ts.Node;
|
|
1405
|
+
readonly context: TypeNodeResolverContext;
|
|
1406
|
+
readonly referencer?: ts.TypeNode;
|
|
1407
|
+
resolveType(typeNode: ts.TypeNode, parentNode?: ts.Node, context?: TypeNodeResolverContext, referencer?: ts.TypeNode): Type;
|
|
1408
|
+
propertyFromSignature(sig: ts.PropertySignature, overrideToken?: OverrideToken): ResolverProperty;
|
|
1409
|
+
propertyFromDeclaration(decl: ts.PropertyDeclaration | ts.ParameterDeclaration, overrideToken?: OverrideToken): ResolverProperty;
|
|
1410
|
+
getNodeDescription(node: UsableDeclaration | ts.PropertyDeclaration | ts.ParameterDeclaration | ts.EnumDeclaration): string;
|
|
1411
|
+
getNodeExample(node: UsableDeclaration | ts.PropertyDeclaration | ts.ParameterDeclaration | ts.EnumDeclaration): unknown;
|
|
1412
|
+
getNodeExtensions(node: UsableDeclaration | ts.PropertyDeclaration | ts.ParameterDeclaration | ts.EnumDeclaration): Extension[];
|
|
1413
|
+
};
|
|
1414
|
+
//#endregion
|
|
1415
|
+
//#region src/adapters/typescript/resolver/sub/array.d.ts
|
|
1416
|
+
declare function resolveArrayType(typeNode: ts.TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1417
|
+
//#endregion
|
|
1418
|
+
//#region src/adapters/typescript/resolver/sub/base.d.ts
|
|
1419
|
+
declare class ResolverBase {
|
|
1420
|
+
protected hasPublicModifier(node: Node): boolean;
|
|
1421
|
+
protected hasStaticModifier(node: Node): boolean;
|
|
1422
|
+
protected isAccessibleParameter(node: Node): boolean;
|
|
1423
|
+
}
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region src/adapters/typescript/resolver/sub/indexed-access.d.ts
|
|
1426
|
+
declare function resolveIndexedAccessType(typeNode: ts.TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1427
|
+
//#endregion
|
|
1428
|
+
//#region src/adapters/typescript/resolver/sub/intersection.d.ts
|
|
1429
|
+
declare function resolveIntersectionType(typeNode: ts.TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1430
|
+
//#endregion
|
|
1431
|
+
//#region src/adapters/typescript/resolver/sub/literal.d.ts
|
|
1432
|
+
declare function resolveLiteralType(typeNode: ts.TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1433
|
+
declare function getLiteralValue(typeNode: ts.LiteralTypeNode): string | number | boolean | null;
|
|
1434
|
+
//#endregion
|
|
1435
|
+
//#region src/adapters/typescript/resolver/sub/mapped.d.ts
|
|
1436
|
+
declare function resolveMappedType(typeNode: ts.TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1437
|
+
//#endregion
|
|
1438
|
+
//#region src/adapters/typescript/resolver/sub/object-literal.d.ts
|
|
1439
|
+
declare function resolveObjectLiteralType(typeNode: ts.TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1440
|
+
//#endregion
|
|
1441
|
+
//#region src/adapters/typescript/resolver/sub/primitive.d.ts
|
|
1442
|
+
declare class PrimitiveResolver {
|
|
1443
|
+
protected registry: Registry;
|
|
1444
|
+
constructor(registry: Registry);
|
|
1445
|
+
resolve(node: TypeNode, parentNode?: Node): PrimitiveType | NeverType | VoidType | undefined;
|
|
1446
|
+
resolveSyntaxKind(syntaxKind: SyntaxKind): "string" | "number" | "boolean" | "bigint" | "null" | "undefined" | "void" | "never";
|
|
1447
|
+
}
|
|
1448
|
+
//#endregion
|
|
1449
|
+
//#region src/adapters/typescript/resolver/sub/reference.d.ts
|
|
1450
|
+
declare class ReferenceResolver extends ResolverBase {
|
|
1451
|
+
protected typeChecker: TypeChecker;
|
|
1452
|
+
constructor(typeChecker: TypeChecker);
|
|
1453
|
+
merge(referenceTypes: ReferenceType[]): ReferenceType;
|
|
1454
|
+
mergeManyRefEnums(many: RefEnumType[]): RefEnumType;
|
|
1455
|
+
mergeRefEnums(first: RefEnumType, second: RefEnumType): RefEnumType;
|
|
1456
|
+
mergeManyRefObjects(many: RefObjectType[]): RefObjectType;
|
|
1457
|
+
mergeRefObject(first: RefObjectType, second: RefObjectType): RefObjectType;
|
|
1458
|
+
transformEnum(declaration: EnumDeclaration, enumName: string): RefEnumType;
|
|
1459
|
+
transformEnumMember(declaration: EnumMember, enumName: string): RefEnumType;
|
|
1460
|
+
}
|
|
1461
|
+
//#endregion
|
|
1462
|
+
//#region src/adapters/typescript/resolver/sub/tuple.d.ts
|
|
1463
|
+
declare function resolveTupleType(typeNode: ts.TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1464
|
+
//#endregion
|
|
1465
|
+
//#region src/adapters/typescript/resolver/sub/type-operator.d.ts
|
|
1466
|
+
declare function resolveTypeOperatorType(typeNode: ts.TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1467
|
+
//#endregion
|
|
1468
|
+
//#region src/adapters/typescript/resolver/sub/union.d.ts
|
|
1469
|
+
declare function resolveUnionType(typeNode: ts.TypeNode, ctx: SubResolverContext): Type | undefined;
|
|
1470
|
+
//#endregion
|
|
1471
|
+
//#region src/adapters/typescript/resolver/module.d.ts
|
|
1472
|
+
declare class TypeNodeResolver extends ResolverBase {
|
|
1473
|
+
private static readonly MAX_DEPTH;
|
|
1474
|
+
private readonly typeNode;
|
|
1475
|
+
private readonly current;
|
|
1476
|
+
private readonly parentNode?;
|
|
1477
|
+
private context;
|
|
1478
|
+
private readonly referencer;
|
|
1479
|
+
private readonly depth;
|
|
1480
|
+
private readonly primitiveResolver;
|
|
1481
|
+
private readonly referenceResolver;
|
|
1482
|
+
constructor(typeNode: ts.TypeNode, current: IResolverContext & IReferenceTypeRegistry, parentNode?: ts.Node, context?: TypeNodeResolverContext, referencer?: ts.TypeNode, depth?: number);
|
|
1483
|
+
/**
|
|
1484
|
+
* @deprecated Use resolverCache.clear() on the context instead.
|
|
1485
|
+
* Kept for backward compatibility — no-ops since cache is now instance-scoped.
|
|
1486
|
+
*/
|
|
1487
|
+
static clearCache(): void;
|
|
1488
|
+
resolve(): Type;
|
|
1489
|
+
private createSubResolverContext;
|
|
1490
|
+
private resolveNestedType;
|
|
1491
|
+
private throwUnknownType;
|
|
1492
|
+
private resolveConditionalType;
|
|
1493
|
+
private resolveTypeReference;
|
|
1494
|
+
private static readonly CHECKER_RESOLVABLE_UTILITY_TYPES;
|
|
1495
|
+
private static isCheckerResolvableUtilityType;
|
|
1496
|
+
private resolveUtilityTypeViaChecker;
|
|
1497
|
+
/**
|
|
1498
|
+
* Shared checker delegation: resolves a type node by letting the TS
|
|
1499
|
+
* type checker evaluate it, converting back to a TypeNode, and
|
|
1500
|
+
* recursively resolving the result.
|
|
1501
|
+
*/
|
|
1502
|
+
private resolveTypeViaChecker;
|
|
1503
|
+
/**
|
|
1504
|
+
* Check if a type reference has type arguments that reference unbound
|
|
1505
|
+
* type parameters from this.context (e.g. `Awaited<T>` where T is a
|
|
1506
|
+
* generic parameter mapped in context).
|
|
1507
|
+
*/
|
|
1508
|
+
private hasUnboundContextArgs;
|
|
1509
|
+
private static resolveSpecialReference;
|
|
1510
|
+
private getDateType;
|
|
1511
|
+
private static getDesignatedModels;
|
|
1512
|
+
private getEnumerateType;
|
|
1513
|
+
private getReferenceType;
|
|
1514
|
+
private getTypeAliasReference;
|
|
1515
|
+
private getModelReference;
|
|
1516
|
+
private static getRefTypeName;
|
|
1517
|
+
private contextualizedName;
|
|
1518
|
+
private handleCachingAndCircularReferences;
|
|
1519
|
+
private createCircularDependencyResolver;
|
|
1520
|
+
private static nodeIsUsable;
|
|
1521
|
+
private getModelTypeDeclarations;
|
|
1522
|
+
private getModelTypeDeclaration;
|
|
1523
|
+
private hasFlag;
|
|
1524
|
+
private getSymbolAtLocation;
|
|
1525
|
+
private getModelProperties;
|
|
1526
|
+
private propertyFromSignature;
|
|
1527
|
+
private propertyFromDeclaration;
|
|
1528
|
+
private getModelAdditionalProperties;
|
|
1529
|
+
private typeArgumentsToContext;
|
|
1530
|
+
private getModelInheritedProperties;
|
|
1531
|
+
private getNodeDescription;
|
|
1532
|
+
private static getNodeFormat;
|
|
1533
|
+
private getNodeExample;
|
|
1534
|
+
protected getNodeExtensions(node: UsableDeclaration | ts.PropertyDeclaration | ts.ParameterDeclaration | ts.EnumDeclaration): Extension[];
|
|
1535
|
+
}
|
|
1536
|
+
//#endregion
|
|
1537
|
+
//#region src/adapters/typescript/resolver/cache.d.ts
|
|
1538
|
+
declare class ResolverCache implements IResolverCache {
|
|
1539
|
+
private referenceTypes;
|
|
1540
|
+
private inProgressTypes;
|
|
1541
|
+
getCachedType(name: string): ReferenceType | undefined;
|
|
1542
|
+
setCachedType(name: string, type: ReferenceType): void;
|
|
1543
|
+
isInProgress(name: string): boolean;
|
|
1544
|
+
markInProgress(name: string): void;
|
|
1545
|
+
clearInProgress(name: string): void;
|
|
1546
|
+
clear(): void;
|
|
1547
|
+
}
|
|
1548
|
+
//#endregion
|
|
1549
|
+
//#region src/adapters/typescript/resolver/utils.d.ts
|
|
1550
|
+
declare function getNodeDescription(node: Node, typeChecker: TypeChecker): string;
|
|
1551
|
+
declare function toTypeNodeOrFail(typeChecker: TypeChecker, ...args: Parameters<TypeChecker['typeToTypeNode']>): TypeNode;
|
|
1552
|
+
//#endregion
|
|
1553
|
+
//#region src/adapters/typescript/resolver/extension/module.d.ts
|
|
1554
|
+
declare function getNodeExtensions(node: Node, registry: Registry): Extension[];
|
|
1555
|
+
//#endregion
|
|
1556
|
+
//#region src/adapters/typescript/node-utils/types.d.ts
|
|
1557
|
+
interface NodeDecorator {
|
|
1558
|
+
text: string;
|
|
1559
|
+
arguments: any[];
|
|
1560
|
+
typeArguments: any[];
|
|
1561
|
+
}
|
|
1562
|
+
//#endregion
|
|
1563
|
+
//#region src/adapters/typescript/node-utils/module.d.ts
|
|
1564
|
+
/**
|
|
1565
|
+
* Get Decorators for a specific node.
|
|
1566
|
+
*
|
|
1567
|
+
* @param node
|
|
1568
|
+
* @param isMatching
|
|
1569
|
+
*/
|
|
1570
|
+
declare function getNodeDecorators(node: Node, isMatching?: (data: NodeDecorator) => boolean): NodeDecorator[];
|
|
1571
|
+
//#endregion
|
|
1572
|
+
//#region src/adapters/typescript/initializer.d.ts
|
|
1573
|
+
declare function getInitializerValue(initializer?: ts.Expression, typeChecker?: ts.TypeChecker, type?: Type): unknown;
|
|
1574
|
+
declare const hasInitializer: (node: ts.Node) => node is ts.HasInitializer;
|
|
1575
|
+
//#endregion
|
|
1576
|
+
//#region src/adapters/typescript/js-doc/constants.d.ts
|
|
1577
|
+
declare enum JSDocTagName {
|
|
1578
|
+
ABSTRACT = "abstract",
|
|
1579
|
+
ACCESS = "access",
|
|
1580
|
+
ALIAS = "alias",
|
|
1581
|
+
ASYNC = "async",
|
|
1582
|
+
/**
|
|
1583
|
+
* Alias for @extends
|
|
1584
|
+
*/
|
|
1585
|
+
AUGMENTS = "augments",
|
|
1586
|
+
AUTHOR = "author",
|
|
1587
|
+
DEFAULT = "default",
|
|
1588
|
+
DEPRECATED = "deprecated",
|
|
1589
|
+
DESCRIPTION = "description",
|
|
1590
|
+
EXAMPLE = "example",
|
|
1591
|
+
FORMAT = "format",
|
|
1592
|
+
IGNORE = "ignore",
|
|
1593
|
+
SUMMARY = "summary"
|
|
1594
|
+
}
|
|
1595
|
+
//#endregion
|
|
1596
|
+
//#region src/adapters/typescript/js-doc/module.d.ts
|
|
1597
|
+
declare function getJSDocDescription(node: Node, index?: number): string | undefined;
|
|
1598
|
+
declare function getJSDoc(node: Node, index?: number): undefined | JSDoc;
|
|
1599
|
+
declare function getJSDocTags(node: Node, isMatching?: `${JSDocTagName}` | `${JSDocTagName}`[] | (string & {}) | (string & {})[] | ((tag: JSDocTag) => boolean)): JSDocTag[];
|
|
1600
|
+
declare function hasJSDocTag(node: Node, tagName: ((tag: JSDocTag) => boolean) | `${JSDocTagName}` | (string & {})): boolean;
|
|
1601
|
+
declare function getJSDocTagComment(node: Node, tagName: ((tag: JSDocTag) => boolean) | `${JSDocTagName}`): undefined | string;
|
|
1602
|
+
declare function getJSDocTagNames(node: Node, requireTagName?: boolean): string[];
|
|
1603
|
+
//#endregion
|
|
1604
|
+
//#region src/adapters/typescript/js-doc/utils.d.ts
|
|
1605
|
+
declare function transformJSDocComment(input?: string | NodeArray<JSDocComment>): string | undefined;
|
|
1606
|
+
//#endregion
|
|
1607
|
+
//#region src/adapters/typescript/validator/module.d.ts
|
|
1608
|
+
declare function getDeclarationValidators(declaration: PropertyDeclaration | TypeAliasDeclaration | PropertySignature | ParameterDeclaration, name?: string): Record<string, Validator>;
|
|
1609
|
+
//#endregion
|
|
1610
|
+
//#region src/adapters/filesystem/source-files.d.ts
|
|
1611
|
+
declare function scanSourceFiles(input: EntryPoint): Promise<string[]>;
|
|
1612
|
+
//#endregion
|
|
1613
|
+
//#region src/app/generate.d.ts
|
|
1614
|
+
declare function generateMetadata(options: MetadataGenerateOptions): Promise<Metadata>;
|
|
1615
|
+
//#endregion
|
|
1616
|
+
//#region src/app/generator/metadata/module.d.ts
|
|
1617
|
+
declare class MetadataGenerator implements IGeneratorContext, IMetadataGenerator {
|
|
1618
|
+
readonly nodes: Node[];
|
|
1619
|
+
readonly typeChecker: TypeChecker;
|
|
1620
|
+
registry: Registry;
|
|
1621
|
+
readonly resolverCache: ResolverCache;
|
|
1622
|
+
readonly config: MetadataGeneratorOptions;
|
|
1623
|
+
private readonly program;
|
|
1624
|
+
private cache;
|
|
1625
|
+
private controllers;
|
|
1626
|
+
private referenceTypes;
|
|
1627
|
+
private circularDependencyResolvers;
|
|
1628
|
+
private unmatchedDecorators;
|
|
1629
|
+
constructor(context: MetadataGeneratorContext);
|
|
1630
|
+
generate(): Promise<Metadata>;
|
|
1631
|
+
private assertPresetProducedControllers;
|
|
1632
|
+
reportUnmatchedDecorator(report: UnmatchedDecoratorReport): void;
|
|
1633
|
+
private dispatchUnmatchedDecoratorReports;
|
|
1634
|
+
private formatUnmatchedSummary;
|
|
1635
|
+
protected buildNodesFromSourceFiles(): string;
|
|
1636
|
+
/**
|
|
1637
|
+
* Check if the source file path is in the ignored path list.
|
|
1638
|
+
*
|
|
1639
|
+
* @param filePath
|
|
1640
|
+
* @protected
|
|
1641
|
+
*/
|
|
1642
|
+
protected isIgnoredPath(filePath: string): boolean;
|
|
1643
|
+
/**
|
|
1644
|
+
* Check if the source file path is in the ignored path list.
|
|
1645
|
+
*
|
|
1646
|
+
* @param filePath
|
|
1647
|
+
* @protected
|
|
1648
|
+
*/
|
|
1649
|
+
protected isAllowedPath(filePath: string): boolean;
|
|
1650
|
+
isExportedNode(_node: Node): boolean;
|
|
1651
|
+
addReferenceType(referenceType: ReferenceType): void;
|
|
1652
|
+
getReferenceType(refName: string): ReferenceType;
|
|
1653
|
+
registerDependencyResolver(callback: DependencyResolver): void;
|
|
1654
|
+
private buildControllers;
|
|
1655
|
+
}
|
|
1656
|
+
//#endregion
|
|
1657
|
+
//#region src/app/generator/metadata/utils.d.ts
|
|
1658
|
+
declare function isMetadata(input: unknown): input is Metadata;
|
|
1659
|
+
//#endregion
|
|
1660
|
+
//#region src/app/generator/controller/module.d.ts
|
|
1661
|
+
declare class ControllerGenerator implements IControllerGenerator {
|
|
1662
|
+
protected readonly node: ClassDeclaration;
|
|
1663
|
+
protected readonly current: IGeneratorContext;
|
|
1664
|
+
constructor(node: ClassDeclaration, current: IGeneratorContext);
|
|
1665
|
+
isValid(): boolean;
|
|
1666
|
+
generate(): Controller | null;
|
|
1667
|
+
private applyOptions;
|
|
1668
|
+
protected buildMethods(controllerPaths: string[]): Method[];
|
|
1669
|
+
private collectInheritedMethodDeclarations;
|
|
1670
|
+
private resolveBaseClassDeclaration;
|
|
1671
|
+
}
|
|
1672
|
+
//#endregion
|
|
1673
|
+
//#region src/app/generator/method/module.d.ts
|
|
1674
|
+
declare class MethodGenerator {
|
|
1675
|
+
protected readonly node: MethodDeclaration;
|
|
1676
|
+
protected readonly current: IGeneratorContext;
|
|
1677
|
+
constructor(node: MethodDeclaration, current: IGeneratorContext);
|
|
1678
|
+
getMethodName(): string;
|
|
1679
|
+
generate(controllerPaths: string[]): Method | null;
|
|
1680
|
+
private applyOptions;
|
|
1681
|
+
private resolveReturnType;
|
|
1682
|
+
private buildParameters;
|
|
1683
|
+
}
|
|
1684
|
+
//#endregion
|
|
1685
|
+
//#region src/app/generator/parameter/module.d.ts
|
|
1686
|
+
declare class ParameterGenerator implements IParameterGenerator {
|
|
1687
|
+
private readonly parameter;
|
|
1688
|
+
private readonly method;
|
|
1689
|
+
private readonly paths;
|
|
1690
|
+
private readonly current;
|
|
1691
|
+
constructor(parameter: ts.ParameterDeclaration, method: string, paths: string[], current: IGeneratorContext);
|
|
1692
|
+
generate(): Parameter[];
|
|
1693
|
+
private finalize;
|
|
1694
|
+
private draftToParameter;
|
|
1695
|
+
private decomposeObject;
|
|
1696
|
+
private pathContainsParam;
|
|
1697
|
+
private validatePathDecomposition;
|
|
1698
|
+
private validatePathName;
|
|
1699
|
+
private isLeafTypeSupported;
|
|
1700
|
+
private isLeafOrEnumOrUnion;
|
|
1701
|
+
private resolveType;
|
|
1702
|
+
private getParameterName;
|
|
1703
|
+
private getDescription;
|
|
1704
|
+
private getJsDocExamples;
|
|
1705
|
+
private applyOptions;
|
|
1706
|
+
}
|
|
1707
|
+
//#endregion
|
|
1708
|
+
//#region src/core/utils/array.d.ts
|
|
1709
|
+
declare function isStringArray(input: unknown): input is string[];
|
|
1710
|
+
//#endregion
|
|
1711
|
+
//#region src/core/utils/object.d.ts
|
|
1712
|
+
declare function hasOwnProperty<Y extends PropertyKey>(obj: unknown, prop: Y): obj is Record<Y, unknown>;
|
|
1713
|
+
//#endregion
|
|
1714
|
+
//#region src/core/utils/path-normalize.d.ts
|
|
1715
|
+
declare function normalizePath(str: string): string;
|
|
1716
|
+
//#endregion
|
|
1717
|
+
export { AnyDecoratorHandler, AnyJsDocHandler, AnyType, ApplyHandlersOptions, ArrayParameter, ArrayType, BaseType, BigintType, BinaryType, BooleanType, BufferType, ByteType, CACHE_DEFAULT_MAX_AGE_MS, CACHE_FILE_PREFIX, CACHE_FILE_SUFFIX, CACHE_SCHEMA_VERSION, CacheClient, CacheData, CacheKeyParts, CacheOptions, CacheOptionsInput, CollectionFormat, CollectionKind, ConfigError, ConfigErrorCode, Controller, ControllerDraft, ControllerGenerator, ControllerHandler, ControllerJsDocHandler, DateTimeType, DateType, DecoratorArgument, DecoratorArgumentKind, DecoratorArgumentKindName, DecoratorHost, DecoratorSource, DecoratorSourceBuilderOptions, DecoratorTarget, DecoratorTargetKind, DecoratorTypeArgument, DependencyResolver, DoubleType, EntryPoint, EntryPointOptions, EnumType, Example, Extension, ExtensionType, FileType, FloatType, GeneratorError, GeneratorErrorCode, HandlerContext, ICacheClient, IControllerGenerator, IGeneratorContext, IMetadataGenerator, IParameterGenerator, IReferenceTypeRegistry, IResolverCache, IResolverContext, IntegerType, IntersectionType, JSDocTagName, JsDocHandlerContext, JsDocMatch, JsDocSource, JsDocSourceBuilderOptions, LoadRegistryOptions, LongType, MarkerName, Match, Metadata, MetadataError, MetadataGenerateOptions, MetadataGenerator, MetadataGeneratorContext, MetadataGeneratorOptions, Method, MethodDraft, MethodGenerator, MethodHandler, MethodJsDocHandler, MethodName, MethodType, NestedObjectLiteralType, NeverType, NodeDecorator, NumericKind, ObjectType, OverrideToken, ParamKind, Parameter, ParameterDraft, ParameterError, ParameterErrorCode, ParameterGenerator, ParameterHandler, ParameterJsDocHandler, ParameterSource, Preset, PresetResolver, PrimitiveResolver, PrimitiveType, RawDecorator, RefAliasType, RefEnumType, RefObjectType, ReferenceResolver, ReferenceType, ReferenceTypeBase, ReferenceTypes, Registry, ReplacesPolicy, ResolverBase, ResolverCache, ResolverError, ResolverMarker, ResolverProperty, Response, Security, StringType, SubResolverContext, TsCompilerOptions, TsConfig, TsconfigLoadContext, TupleElement, TupleType, Type, TypeName, TypeNodeResolver, TypeNodeResolverContext, UndefinedType, UnionType, UnmatchedDecoratorReport, UsableDeclaration, UtilityTypeName, Validator, ValidatorError, ValidatorErrorCode, ValidatorMeta, ValidatorName, Validators, VariableType, VoidType, append, applyDecoratorHandlers, applyJsDocHandlers, buildCacheOptions, buildDecoratorArgument, buildDecoratorSources, buildHandlerContext, buildJsDocHandlerContext, buildJsDocSources, composeCacheKey, controller, controllerHandlerSchema, controllerJsDoc, controllerJsDocHandlerSchema, createPresetContainer, createRegistry, findDecoratorByName, findDecoratorsByName, flag, generateMetadata, generatePresetLookupPaths, getDeclarationValidators, getInitializerValue, getJSDoc, getJSDocDescription, getJSDocTagComment, getJSDocTagNames, getJSDocTags, getLiteralValue, getNodeDecorators, getNodeDescription, getNodeExtensions, hasDecoratorNamed, hasInitializer, hasJSDocTag, hasOwnProperty, hashCompilerOptions, hashRegistry, into, isAnyType, isArrayType, isBigintType, isBinaryType, isBooleanType, isBufferType, isByteType, isDateTimeType, isDateType, isDeprecatedMarker, isDoubleType, isEnumType, isExtensionMarker, isFileType, isFloatType, isGeneratorError, isHiddenMarker, isIntegerType, isIntersectionType, isLongType, isMetadata, isNestedObjectLiteralType, isNeverType, isObjectType, isPrimitiveType, isRefAliasType, isRefEnumType, isRefObjectType, isReferenceType, isResolverError, isStringArray, isStringType, isTupleType, isUndefinedType, isUnionType, isVoidType, jsDocMatchSchema, loadRegistry, loadRegistryByName, loadTSConfig, matchSchema, matches, matchesJsDoc, method, methodHandlerSchema, methodJsDoc, methodJsDocHandlerSchema, namesForMarker, newControllerDraft, newMethodDraft, newParameterDraft, normalizePath, numericMarkerKind, parameter, parameterHandlerSchema, parameterJsDoc, parameterJsDocHandlerSchema, presetSchema, prettyLocationOfNode, prettyTroubleCause, readNodeDecorators, resolveArrayType, resolveIndexedAccessType, resolveIntersectionType, resolveLiteralType, resolveMappedType, resolveObjectLiteralType, resolvePresetByName, resolveTupleType, resolveTypeOperatorType, resolveUnionType, scanSourceFiles, softLoadTsconfig, tagsForMarker, toTypeNodeOrFail, transformJSDocComment, validatePreset };
|
|
1718
|
+
//# sourceMappingURL=index.d.mts.map
|