@trapi/metadata 1.0.0-alpha.7 → 1.0.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/dist/cache/driver.d.ts +13 -13
- package/dist/cache/driver.js +83 -83
- package/dist/cache/index.d.ts +3 -3
- package/dist/cache/index.js +25 -25
- package/dist/cache/type.d.ts +32 -32
- package/dist/cache/type.js +8 -8
- package/dist/cache/utils.d.ts +3 -3
- package/dist/cache/utils.js +52 -52
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +23 -23
- package/dist/config/type.d.ts +36 -36
- package/dist/config/type.js +8 -8
- package/dist/decorator/constants.d.ts +40 -40
- package/dist/decorator/constants.js +52 -52
- package/dist/decorator/constants.js.map +1 -1
- package/dist/decorator/index.d.ts +6 -6
- package/dist/decorator/index.js +28 -28
- package/dist/decorator/preset/index.d.ts +2 -2
- package/dist/decorator/preset/index.js +24 -24
- package/dist/decorator/preset/type.d.ts +5 -5
- package/dist/decorator/preset/type.js +8 -8
- package/dist/decorator/preset/utils/check.d.ts +2 -2
- package/dist/decorator/preset/utils/check.js +17 -17
- package/dist/decorator/preset/utils/index.d.ts +3 -3
- package/dist/decorator/preset/utils/index.js +25 -25
- package/dist/decorator/preset/utils/load.d.ts +2 -2
- package/dist/decorator/preset/utils/load.js +44 -44
- package/dist/decorator/preset/utils/normalize.d.ts +1 -1
- package/dist/decorator/preset/utils/normalize.js +26 -26
- package/dist/decorator/property-manager/index.d.ts +2 -2
- package/dist/decorator/property-manager/index.js +24 -24
- package/dist/decorator/property-manager/module.d.ts +16 -16
- package/dist/decorator/property-manager/module.js +58 -58
- package/dist/decorator/property-manager/utils.d.ts +5 -5
- package/dist/decorator/property-manager/utils.d.ts.map +1 -1
- package/dist/decorator/property-manager/utils.js +91 -91
- package/dist/decorator/resolver/index.d.ts +2 -2
- package/dist/decorator/resolver/index.js +24 -24
- package/dist/decorator/resolver/module.d.ts +26 -26
- package/dist/decorator/resolver/module.js +71 -71
- package/dist/decorator/resolver/type.d.ts +9 -9
- package/dist/decorator/resolver/type.js +2 -2
- package/dist/decorator/sets/class.d.ts +6 -6
- package/dist/decorator/sets/class.js +8 -8
- package/dist/decorator/sets/index.d.ts +7 -7
- package/dist/decorator/sets/index.js +28 -28
- package/dist/decorator/sets/method.d.ts +13 -13
- package/dist/decorator/sets/method.js +8 -8
- package/dist/decorator/sets/mixed.d.ts +11 -11
- package/dist/decorator/sets/mixed.js +8 -8
- package/dist/decorator/sets/parameter.d.ts +20 -20
- package/dist/decorator/sets/parameter.js +8 -8
- package/dist/decorator/sets/request.d.ts +5 -5
- package/dist/decorator/sets/request.js +8 -8
- package/dist/decorator/sets/response.d.ts +16 -16
- package/dist/decorator/sets/response.js +8 -8
- package/dist/decorator/sets/type.d.ts +3 -3
- package/dist/decorator/sets/type.js +2 -2
- package/dist/decorator/type.d.ts +31 -31
- package/dist/decorator/type.js +8 -8
- package/dist/error/base.d.ts +2 -2
- package/dist/error/base.js +12 -12
- package/dist/error/index.d.ts +1 -1
- package/dist/error/index.js +23 -23
- package/dist/generator/abstract.d.ts +18 -18
- package/dist/generator/abstract.js +150 -150
- package/dist/generator/abstract.js.map +1 -1
- package/dist/generator/controller/index.d.ts +2 -2
- package/dist/generator/controller/index.js +24 -24
- package/dist/generator/controller/module.d.ts +12 -12
- package/dist/generator/controller/module.js +67 -67
- package/dist/generator/controller/type.d.ts +46 -46
- package/dist/generator/controller/type.js +2 -2
- package/dist/generator/index.d.ts +6 -6
- package/dist/generator/index.js +28 -28
- package/dist/generator/metadata/index.d.ts +3 -3
- package/dist/generator/metadata/index.js +25 -25
- package/dist/generator/metadata/module.d.ts +38 -38
- package/dist/generator/metadata/module.js +139 -142
- package/dist/generator/metadata/module.js.map +1 -1
- package/dist/generator/metadata/type.d.ts +24 -24
- package/dist/generator/metadata/type.js +2 -2
- package/dist/generator/metadata/utils.d.ts +2 -2
- package/dist/generator/metadata/utils.js +18 -18
- package/dist/generator/method/constants.d.ts +10 -10
- package/dist/generator/method/constants.js +20 -20
- package/dist/generator/method/constants.js.map +1 -1
- package/dist/generator/method/index.d.ts +3 -3
- package/dist/generator/method/index.js +25 -25
- package/dist/generator/method/module.d.ts +18 -18
- package/dist/generator/method/module.js +187 -187
- package/dist/generator/method/type.d.ts +22 -22
- package/dist/generator/method/type.js +8 -8
- package/dist/generator/parameter/constants.d.ts +18 -18
- package/dist/generator/parameter/constants.js +29 -29
- package/dist/generator/parameter/constants.js.map +1 -1
- package/dist/generator/parameter/error.d.ts +34 -34
- package/dist/generator/parameter/error.js +67 -67
- package/dist/generator/parameter/index.d.ts +4 -4
- package/dist/generator/parameter/index.js +26 -26
- package/dist/generator/parameter/module.d.ts +28 -28
- package/dist/generator/parameter/module.js +555 -555
- package/dist/generator/parameter/type.d.ts +24 -24
- package/dist/generator/parameter/type.js +8 -8
- package/dist/generator/type.d.ts +19 -19
- package/dist/generator/type.js +8 -8
- package/dist/index.d.ts +9 -9
- package/dist/index.js +31 -31
- package/dist/module.d.ts +4 -4
- package/dist/module.js +40 -40
- package/dist/resolver/constants.d.ts +26 -26
- package/dist/resolver/constants.js +36 -36
- package/dist/resolver/constants.js.map +1 -1
- package/dist/resolver/error.d.ts +7 -7
- package/dist/resolver/error.js +40 -40
- package/dist/resolver/extension/index.d.ts +2 -2
- package/dist/resolver/extension/index.js +24 -24
- package/dist/resolver/extension/module.d.ts +4 -4
- package/dist/resolver/extension/module.js +26 -26
- package/dist/resolver/extension/type.d.ts +7 -7
- package/dist/resolver/extension/type.js +8 -8
- package/dist/resolver/index.d.ts +5 -5
- package/dist/resolver/index.js +27 -27
- package/dist/resolver/module.d.ts +53 -53
- package/dist/resolver/module.js +1102 -1102
- package/dist/resolver/type.d.ts +138 -138
- package/dist/resolver/type.js +129 -129
- package/dist/type.d.ts +1 -1
- package/dist/type.js +8 -8
- package/dist/utils/array.d.ts +2 -0
- package/dist/utils/array.d.ts.map +1 -0
- package/dist/utils/array.js +22 -0
- package/dist/utils/array.js.map +1 -0
- package/dist/utils/index.d.ts +9 -8
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +31 -30
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/initializer.d.ts +4 -4
- package/dist/utils/initializer.js +130 -130
- package/dist/utils/js-doc/constants.d.ts +18 -18
- package/dist/utils/js-doc/constants.js +29 -29
- package/dist/utils/js-doc/constants.js.map +1 -1
- package/dist/utils/js-doc/index.d.ts +3 -3
- package/dist/utils/js-doc/index.js +25 -25
- package/dist/utils/js-doc/module.d.ts +8 -8
- package/dist/utils/js-doc/module.js +97 -97
- package/dist/utils/js-doc/utils.d.ts +2 -2
- package/dist/utils/js-doc/utils.js +28 -28
- package/dist/utils/node/index.d.ts +2 -2
- package/dist/utils/node/index.js +24 -24
- package/dist/utils/node/module.d.ts +9 -9
- package/dist/utils/node/module.js +51 -51
- package/dist/utils/node/type.d.ts +5 -5
- package/dist/utils/node/type.js +8 -8
- package/dist/utils/object.d.ts +1 -1
- package/dist/utils/object.js +14 -14
- package/dist/utils/path-normalize.d.ts +1 -1
- package/dist/utils/path-normalize.js +16 -16
- package/dist/utils/source-files.d.ts +2 -2
- package/dist/utils/source-files.js +31 -31
- package/dist/utils/tsconfig/index.d.ts +2 -2
- package/dist/utils/tsconfig/index.js +24 -24
- package/dist/utils/tsconfig/module.d.ts +3 -3
- package/dist/utils/tsconfig/module.js +53 -53
- package/dist/utils/tsconfig/type.d.ts +10 -10
- package/dist/utils/tsconfig/type.js +8 -8
- package/dist/utils/validator/constants.d.ts +12 -12
- package/dist/utils/validator/constants.js +22 -22
- package/dist/utils/validator/constants.js.map +1 -1
- package/dist/utils/validator/index.d.ts +3 -3
- package/dist/utils/validator/index.js +25 -25
- package/dist/utils/validator/module.d.ts +3 -3
- package/dist/utils/validator/module.js +141 -141
- package/dist/utils/validator/type.d.ts +5 -5
- package/dist/utils/validator/type.js +8 -8
- package/package.json +6 -7
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { Validator } from '../../utils';
|
|
2
|
-
import type { ArrayType, Type } from '../../resolver';
|
|
3
|
-
import type { Example } from '../type';
|
|
4
|
-
import type { CollectionFormat, ParameterSource } from './constants';
|
|
5
|
-
export interface Parameter {
|
|
6
|
-
parameterName: string;
|
|
7
|
-
description: string;
|
|
8
|
-
in: `${ParameterSource}`;
|
|
9
|
-
name: string;
|
|
10
|
-
required: boolean;
|
|
11
|
-
type: Type;
|
|
12
|
-
collectionFormat?: `${CollectionFormat}`;
|
|
13
|
-
allowEmptyValue?: boolean;
|
|
14
|
-
default?: any;
|
|
15
|
-
maxItems?: number;
|
|
16
|
-
minItems?: number;
|
|
17
|
-
deprecated?: boolean;
|
|
18
|
-
examples?: Example[];
|
|
19
|
-
exampleLabels?: string[];
|
|
20
|
-
validators?: Record<string, Validator>;
|
|
21
|
-
}
|
|
22
|
-
export interface ArrayParameter extends Parameter {
|
|
23
|
-
type: ArrayType;
|
|
24
|
-
}
|
|
1
|
+
import type { Validator } from '../../utils';
|
|
2
|
+
import type { ArrayType, Type } from '../../resolver';
|
|
3
|
+
import type { Example } from '../type';
|
|
4
|
+
import type { CollectionFormat, ParameterSource } from './constants';
|
|
5
|
+
export interface Parameter {
|
|
6
|
+
parameterName: string;
|
|
7
|
+
description: string;
|
|
8
|
+
in: `${ParameterSource}`;
|
|
9
|
+
name: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
type: Type;
|
|
12
|
+
collectionFormat?: `${CollectionFormat}`;
|
|
13
|
+
allowEmptyValue?: boolean;
|
|
14
|
+
default?: any;
|
|
15
|
+
maxItems?: number;
|
|
16
|
+
minItems?: number;
|
|
17
|
+
deprecated?: boolean;
|
|
18
|
+
examples?: Example[];
|
|
19
|
+
exampleLabels?: string[];
|
|
20
|
+
validators?: Record<string, Validator>;
|
|
21
|
+
}
|
|
22
|
+
export interface ArrayParameter extends Parameter {
|
|
23
|
+
type: ArrayType;
|
|
24
|
+
}
|
|
25
25
|
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023.
|
|
4
|
+
* Author Peter Placzek (tada5hi)
|
|
5
|
+
* For the full copyright and license information,
|
|
6
|
+
* view the LICENSE file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
//# sourceMappingURL=type.js.map
|
package/dist/generator/type.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { CompilerOptions } from 'typescript';
|
|
2
|
-
import type { BaseType, NestedObjectLiteralType, RefObjectType } from '../resolver';
|
|
3
|
-
export type { CompilerOptions, };
|
|
4
|
-
export type Security = Record<string, string[]>;
|
|
5
|
-
export interface Example {
|
|
6
|
-
value: unknown | unknown[];
|
|
7
|
-
summary?: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
label?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface Response {
|
|
12
|
-
description: string;
|
|
13
|
-
examples?: Example[];
|
|
14
|
-
headers?: NestedObjectLiteralType | RefObjectType;
|
|
15
|
-
name: string;
|
|
16
|
-
produces?: string[];
|
|
17
|
-
status: string;
|
|
18
|
-
schema?: BaseType;
|
|
19
|
-
}
|
|
1
|
+
import type { CompilerOptions } from 'typescript';
|
|
2
|
+
import type { BaseType, NestedObjectLiteralType, RefObjectType } from '../resolver';
|
|
3
|
+
export type { CompilerOptions, };
|
|
4
|
+
export type Security = Record<string, string[]>;
|
|
5
|
+
export interface Example {
|
|
6
|
+
value: unknown | unknown[];
|
|
7
|
+
summary?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Response {
|
|
12
|
+
description: string;
|
|
13
|
+
examples?: Example[];
|
|
14
|
+
headers?: NestedObjectLiteralType | RefObjectType;
|
|
15
|
+
name: string;
|
|
16
|
+
produces?: string[];
|
|
17
|
+
status: string;
|
|
18
|
+
schema?: BaseType;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/generator/type.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021-2023.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2023.
|
|
4
|
+
* Author Peter Placzek (tada5hi)
|
|
5
|
+
* For the full copyright and license information,
|
|
6
|
+
* view the LICENSE file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
//# sourceMappingURL=type.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from './cache';
|
|
2
|
-
export * from './config';
|
|
3
|
-
export * from './error';
|
|
4
|
-
export * from './generator';
|
|
5
|
-
export * from './decorator';
|
|
6
|
-
export * from './resolver';
|
|
7
|
-
export * from './module';
|
|
8
|
-
export * from './type';
|
|
9
|
-
export * from './utils';
|
|
1
|
+
export * from './cache';
|
|
2
|
+
export * from './config';
|
|
3
|
+
export * from './error';
|
|
4
|
+
export * from './generator';
|
|
5
|
+
export * from './decorator';
|
|
6
|
+
export * from './resolver';
|
|
7
|
+
export * from './module';
|
|
8
|
+
export * from './type';
|
|
9
|
+
export * from './utils';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./cache"), exports);
|
|
24
|
-
__exportStar(require("./config"), exports);
|
|
25
|
-
__exportStar(require("./error"), exports);
|
|
26
|
-
__exportStar(require("./generator"), exports);
|
|
27
|
-
__exportStar(require("./decorator"), exports);
|
|
28
|
-
__exportStar(require("./resolver"), exports);
|
|
29
|
-
__exportStar(require("./module"), exports);
|
|
30
|
-
__exportStar(require("./type"), exports);
|
|
31
|
-
__exportStar(require("./utils"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021.
|
|
4
|
+
* Author Peter Placzek (tada5hi)
|
|
5
|
+
* For the full copyright and license information,
|
|
6
|
+
* view the LICENSE file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
__exportStar(require("./cache"), exports);
|
|
24
|
+
__exportStar(require("./config"), exports);
|
|
25
|
+
__exportStar(require("./error"), exports);
|
|
26
|
+
__exportStar(require("./generator"), exports);
|
|
27
|
+
__exportStar(require("./decorator"), exports);
|
|
28
|
+
__exportStar(require("./resolver"), exports);
|
|
29
|
+
__exportStar(require("./module"), exports);
|
|
30
|
+
__exportStar(require("./type"), exports);
|
|
31
|
+
__exportStar(require("./utils"), exports);
|
|
32
32
|
//# sourceMappingURL=index.js.map
|
package/dist/module.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Options } from './config';
|
|
2
|
-
import type { Metadata } from './generator';
|
|
3
|
-
import type { TsConfig } from './utils';
|
|
4
|
-
export declare function generateMetadata(input: Options | string | string[], tsconfig?: string | TsConfig): Promise<Metadata>;
|
|
1
|
+
import type { Options } from './config';
|
|
2
|
+
import type { Metadata } from './generator';
|
|
3
|
+
import type { TsConfig } from './utils';
|
|
4
|
+
export declare function generateMetadata(input: Options | string | string[], tsconfig?: string | TsConfig): Promise<Metadata>;
|
|
5
5
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/module.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021-2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.generateMetadata = void 0;
|
|
10
|
-
const generator_1 = require("./generator");
|
|
11
|
-
const utils_1 = require("./utils");
|
|
12
|
-
async function generateMetadata(input, tsconfig) {
|
|
13
|
-
let compilerOptions;
|
|
14
|
-
if (tsconfig) {
|
|
15
|
-
if (typeof tsconfig === 'string') {
|
|
16
|
-
tsconfig = await (0, utils_1.softLoadTsconfig)({ name: tsconfig });
|
|
17
|
-
compilerOptions = tsconfig.compilerOptions;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
compilerOptions = tsconfig.compilerOptions || {};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
let options;
|
|
24
|
-
if (typeof input === 'string' || Array.isArray(input)) {
|
|
25
|
-
options = {
|
|
26
|
-
entryPoint: input,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
options = input;
|
|
31
|
-
}
|
|
32
|
-
const sourceFiles = await (0, utils_1.scanSourceFiles)(options.entryPoint);
|
|
33
|
-
const generator = new generator_1.MetadataGenerator({
|
|
34
|
-
sourceFiles,
|
|
35
|
-
compilerOptions,
|
|
36
|
-
options,
|
|
37
|
-
});
|
|
38
|
-
return generator.generate();
|
|
39
|
-
}
|
|
40
|
-
exports.generateMetadata = generateMetadata;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021-2022.
|
|
4
|
+
* Author Peter Placzek (tada5hi)
|
|
5
|
+
* For the full copyright and license information,
|
|
6
|
+
* view the LICENSE file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.generateMetadata = void 0;
|
|
10
|
+
const generator_1 = require("./generator");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
async function generateMetadata(input, tsconfig) {
|
|
13
|
+
let compilerOptions;
|
|
14
|
+
if (tsconfig) {
|
|
15
|
+
if (typeof tsconfig === 'string') {
|
|
16
|
+
tsconfig = await (0, utils_1.softLoadTsconfig)({ name: tsconfig });
|
|
17
|
+
compilerOptions = tsconfig.compilerOptions;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
compilerOptions = tsconfig.compilerOptions || {};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
let options;
|
|
24
|
+
if (typeof input === 'string' || Array.isArray(input)) {
|
|
25
|
+
options = {
|
|
26
|
+
entryPoint: input,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
options = input;
|
|
31
|
+
}
|
|
32
|
+
const sourceFiles = await (0, utils_1.scanSourceFiles)(options.entryPoint);
|
|
33
|
+
const generator = new generator_1.MetadataGenerator({
|
|
34
|
+
sourceFiles,
|
|
35
|
+
compilerOptions,
|
|
36
|
+
options,
|
|
37
|
+
});
|
|
38
|
+
return generator.generate();
|
|
39
|
+
}
|
|
40
|
+
exports.generateMetadata = generateMetadata;
|
|
41
41
|
//# sourceMappingURL=module.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export declare enum TypeName {
|
|
2
|
-
STRING = "string",
|
|
3
|
-
BOOLEAN = "boolean",
|
|
4
|
-
DOUBLE = "double",
|
|
5
|
-
FLOAT = "float",
|
|
6
|
-
FILE = "file",
|
|
7
|
-
INTEGER = "integer",
|
|
8
|
-
LONG = "long",
|
|
9
|
-
ENUM = "enum",
|
|
10
|
-
ARRAY = "array",
|
|
11
|
-
DATETIME = "datetime",
|
|
12
|
-
DATE = "date",
|
|
13
|
-
BINARY = "binary",
|
|
14
|
-
BUFFER = "buffer",
|
|
15
|
-
BYTE = "byte",
|
|
16
|
-
VOID = "void",
|
|
17
|
-
OBJECT = "object",
|
|
18
|
-
ANY = "any",
|
|
19
|
-
UNDEFINED = "undefined",
|
|
20
|
-
REF_ENUM = "refEnum",
|
|
21
|
-
REF_OBJECT = "refObject",
|
|
22
|
-
REF_ALIAS = "refAlias",
|
|
23
|
-
NESTED_OBJECT_LITERAL = "nestedObjectLiteral",
|
|
24
|
-
UNION = "union",
|
|
25
|
-
INTERSECTION = "intersection"
|
|
26
|
-
}
|
|
1
|
+
export declare enum TypeName {
|
|
2
|
+
STRING = "string",
|
|
3
|
+
BOOLEAN = "boolean",
|
|
4
|
+
DOUBLE = "double",
|
|
5
|
+
FLOAT = "float",
|
|
6
|
+
FILE = "file",
|
|
7
|
+
INTEGER = "integer",
|
|
8
|
+
LONG = "long",
|
|
9
|
+
ENUM = "enum",
|
|
10
|
+
ARRAY = "array",
|
|
11
|
+
DATETIME = "datetime",
|
|
12
|
+
DATE = "date",
|
|
13
|
+
BINARY = "binary",
|
|
14
|
+
BUFFER = "buffer",
|
|
15
|
+
BYTE = "byte",
|
|
16
|
+
VOID = "void",
|
|
17
|
+
OBJECT = "object",
|
|
18
|
+
ANY = "any",
|
|
19
|
+
UNDEFINED = "undefined",
|
|
20
|
+
REF_ENUM = "refEnum",
|
|
21
|
+
REF_OBJECT = "refObject",
|
|
22
|
+
REF_ALIAS = "refAlias",
|
|
23
|
+
NESTED_OBJECT_LITERAL = "nestedObjectLiteral",
|
|
24
|
+
UNION = "union",
|
|
25
|
+
INTERSECTION = "intersection"
|
|
26
|
+
}
|
|
27
27
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.TypeName = void 0;
|
|
10
|
-
var TypeName;
|
|
11
|
-
(function (TypeName) {
|
|
12
|
-
TypeName["STRING"] = "string";
|
|
13
|
-
TypeName["BOOLEAN"] = "boolean";
|
|
14
|
-
TypeName["DOUBLE"] = "double";
|
|
15
|
-
TypeName["FLOAT"] = "float";
|
|
16
|
-
TypeName["FILE"] = "file";
|
|
17
|
-
TypeName["INTEGER"] = "integer";
|
|
18
|
-
TypeName["LONG"] = "long";
|
|
19
|
-
TypeName["ENUM"] = "enum";
|
|
20
|
-
TypeName["ARRAY"] = "array";
|
|
21
|
-
TypeName["DATETIME"] = "datetime";
|
|
22
|
-
TypeName["DATE"] = "date";
|
|
23
|
-
TypeName["BINARY"] = "binary";
|
|
24
|
-
TypeName["BUFFER"] = "buffer";
|
|
25
|
-
TypeName["BYTE"] = "byte";
|
|
26
|
-
TypeName["VOID"] = "void";
|
|
27
|
-
TypeName["OBJECT"] = "object";
|
|
28
|
-
TypeName["ANY"] = "any";
|
|
29
|
-
TypeName["UNDEFINED"] = "undefined";
|
|
30
|
-
TypeName["REF_ENUM"] = "refEnum";
|
|
31
|
-
TypeName["REF_OBJECT"] = "refObject";
|
|
32
|
-
TypeName["REF_ALIAS"] = "refAlias";
|
|
33
|
-
TypeName["NESTED_OBJECT_LITERAL"] = "nestedObjectLiteral";
|
|
34
|
-
TypeName["UNION"] = "union";
|
|
35
|
-
TypeName["INTERSECTION"] = "intersection";
|
|
36
|
-
})(TypeName
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023.
|
|
4
|
+
* Author Peter Placzek (tada5hi)
|
|
5
|
+
* For the full copyright and license information,
|
|
6
|
+
* view the LICENSE file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TypeName = void 0;
|
|
10
|
+
var TypeName;
|
|
11
|
+
(function (TypeName) {
|
|
12
|
+
TypeName["STRING"] = "string";
|
|
13
|
+
TypeName["BOOLEAN"] = "boolean";
|
|
14
|
+
TypeName["DOUBLE"] = "double";
|
|
15
|
+
TypeName["FLOAT"] = "float";
|
|
16
|
+
TypeName["FILE"] = "file";
|
|
17
|
+
TypeName["INTEGER"] = "integer";
|
|
18
|
+
TypeName["LONG"] = "long";
|
|
19
|
+
TypeName["ENUM"] = "enum";
|
|
20
|
+
TypeName["ARRAY"] = "array";
|
|
21
|
+
TypeName["DATETIME"] = "datetime";
|
|
22
|
+
TypeName["DATE"] = "date";
|
|
23
|
+
TypeName["BINARY"] = "binary";
|
|
24
|
+
TypeName["BUFFER"] = "buffer";
|
|
25
|
+
TypeName["BYTE"] = "byte";
|
|
26
|
+
TypeName["VOID"] = "void";
|
|
27
|
+
TypeName["OBJECT"] = "object";
|
|
28
|
+
TypeName["ANY"] = "any";
|
|
29
|
+
TypeName["UNDEFINED"] = "undefined";
|
|
30
|
+
TypeName["REF_ENUM"] = "refEnum";
|
|
31
|
+
TypeName["REF_OBJECT"] = "refObject";
|
|
32
|
+
TypeName["REF_ALIAS"] = "refAlias";
|
|
33
|
+
TypeName["NESTED_OBJECT_LITERAL"] = "nestedObjectLiteral";
|
|
34
|
+
TypeName["UNION"] = "union";
|
|
35
|
+
TypeName["INTERSECTION"] = "intersection";
|
|
36
|
+
})(TypeName || (exports.TypeName = TypeName = {}));
|
|
37
37
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/resolver/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,QAyBX;AAzBD,WAAY,QAAQ;IAChB,6BAAiB,CAAA;IACjB,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;IACjB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,iCAAqB,CAAA;IACrB,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,mCAAuB,CAAA;IACvB,gCAAoB,CAAA;IACpB,oCAAwB,CAAA;IACxB,kCAAsB,CAAA;IACtB,yDAA6C,CAAA;IAC7C,2BAAe,CAAA;IACf,yCAA6B,CAAA;AACjC,CAAC,EAzBW,QAAQ,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/resolver/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,QAyBX;AAzBD,WAAY,QAAQ;IAChB,6BAAiB,CAAA;IACjB,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;IACjB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,iCAAqB,CAAA;IACrB,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,mCAAuB,CAAA;IACvB,gCAAoB,CAAA;IACpB,oCAAwB,CAAA;IACxB,kCAAsB,CAAA;IACtB,yDAA6C,CAAA;IAC7C,2BAAe,CAAA;IACf,yCAA6B,CAAA;AACjC,CAAC,EAzBW,QAAQ,wBAAR,QAAQ,QAyBnB"}
|
package/dist/resolver/error.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Node, TypeNode } from 'typescript';
|
|
2
|
-
import { BaseError } from '../error';
|
|
3
|
-
export declare class ResolverError extends BaseError {
|
|
4
|
-
constructor(message: string, node?: Node | TypeNode, onlyCurrent?: boolean);
|
|
5
|
-
}
|
|
6
|
-
export declare function prettyLocationOfNode(node: Node | TypeNode): string;
|
|
7
|
-
export declare function prettyTroubleCause(node: Node | TypeNode, onlyCurrent?: boolean): string;
|
|
1
|
+
import type { Node, TypeNode } from 'typescript';
|
|
2
|
+
import { BaseError } from '../error';
|
|
3
|
+
export declare class ResolverError extends BaseError {
|
|
4
|
+
constructor(message: string, node?: Node | TypeNode, onlyCurrent?: boolean);
|
|
5
|
+
}
|
|
6
|
+
export declare function prettyLocationOfNode(node: Node | TypeNode): string;
|
|
7
|
+
export declare function prettyTroubleCause(node: Node | TypeNode, onlyCurrent?: boolean): string;
|
|
8
8
|
//# sourceMappingURL=error.d.ts.map
|
package/dist/resolver/error.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.prettyTroubleCause = exports.prettyLocationOfNode = exports.ResolverError = void 0;
|
|
10
|
-
const node_path_1 = require("node:path");
|
|
11
|
-
const error_1 = require("../error");
|
|
12
|
-
class ResolverError extends error_1.BaseError {
|
|
13
|
-
constructor(message, node, onlyCurrent = false) {
|
|
14
|
-
super(message);
|
|
15
|
-
if (node) {
|
|
16
|
-
this.message = `${message}\n${prettyLocationOfNode(node)}\n${prettyTroubleCause(node, onlyCurrent)}`;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.ResolverError = ResolverError;
|
|
21
|
-
function prettyLocationOfNode(node) {
|
|
22
|
-
const sourceFile = node.getSourceFile();
|
|
23
|
-
const token = node.getFirstToken() || node.parent.getFirstToken();
|
|
24
|
-
const start = token ? `:${sourceFile.getLineAndCharacterOfPosition(token.getStart()).line + 1}` : '';
|
|
25
|
-
const end = token ? `:${sourceFile.getLineAndCharacterOfPosition(token.getEnd()).line + 1}` : '';
|
|
26
|
-
const normalizedPath = (0, node_path_1.normalize)(`${sourceFile.fileName}${start}${end}`);
|
|
27
|
-
return `At: ${normalizedPath}.`;
|
|
28
|
-
}
|
|
29
|
-
exports.prettyLocationOfNode = prettyLocationOfNode;
|
|
30
|
-
function prettyTroubleCause(node, onlyCurrent = false) {
|
|
31
|
-
let name;
|
|
32
|
-
if (onlyCurrent || !node.parent) {
|
|
33
|
-
name = node.pos !== -1 ? node.getText() : node.name.text;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
name = node.parent.pos !== -1 ? node.parent.getText() : node.parent.name.text;
|
|
37
|
-
}
|
|
38
|
-
return `This was caused by '${name}'`;
|
|
39
|
-
}
|
|
40
|
-
exports.prettyTroubleCause = prettyTroubleCause;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021.
|
|
4
|
+
* Author Peter Placzek (tada5hi)
|
|
5
|
+
* For the full copyright and license information,
|
|
6
|
+
* view the LICENSE file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.prettyTroubleCause = exports.prettyLocationOfNode = exports.ResolverError = void 0;
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
|
+
const error_1 = require("../error");
|
|
12
|
+
class ResolverError extends error_1.BaseError {
|
|
13
|
+
constructor(message, node, onlyCurrent = false) {
|
|
14
|
+
super(message);
|
|
15
|
+
if (node) {
|
|
16
|
+
this.message = `${message}\n${prettyLocationOfNode(node)}\n${prettyTroubleCause(node, onlyCurrent)}`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ResolverError = ResolverError;
|
|
21
|
+
function prettyLocationOfNode(node) {
|
|
22
|
+
const sourceFile = node.getSourceFile();
|
|
23
|
+
const token = node.getFirstToken() || node.parent.getFirstToken();
|
|
24
|
+
const start = token ? `:${sourceFile.getLineAndCharacterOfPosition(token.getStart()).line + 1}` : '';
|
|
25
|
+
const end = token ? `:${sourceFile.getLineAndCharacterOfPosition(token.getEnd()).line + 1}` : '';
|
|
26
|
+
const normalizedPath = (0, node_path_1.normalize)(`${sourceFile.fileName}${start}${end}`);
|
|
27
|
+
return `At: ${normalizedPath}.`;
|
|
28
|
+
}
|
|
29
|
+
exports.prettyLocationOfNode = prettyLocationOfNode;
|
|
30
|
+
function prettyTroubleCause(node, onlyCurrent = false) {
|
|
31
|
+
let name;
|
|
32
|
+
if (onlyCurrent || !node.parent) {
|
|
33
|
+
name = node.pos !== -1 ? node.getText() : node.name.text;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
name = node.parent.pos !== -1 ? node.parent.getText() : node.parent.name.text;
|
|
37
|
+
}
|
|
38
|
+
return `This was caused by '${name}'`;
|
|
39
|
+
}
|
|
40
|
+
exports.prettyTroubleCause = prettyTroubleCause;
|
|
41
41
|
//# sourceMappingURL=error.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './module';
|
|
2
|
-
export * from './type';
|
|
1
|
+
export * from './module';
|
|
2
|
+
export * from './type';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./module"), exports);
|
|
24
|
-
__exportStar(require("./type"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023.
|
|
4
|
+
* Author Peter Placzek (tada5hi)
|
|
5
|
+
* For the full copyright and license information,
|
|
6
|
+
* view the LICENSE file that was distributed with this source code.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
__exportStar(require("./module"), exports);
|
|
24
|
+
__exportStar(require("./type"), exports);
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Node } from 'typescript';
|
|
2
|
-
import type { DecoratorResolver } from '../../decorator';
|
|
3
|
-
import type { Extension } from './type';
|
|
4
|
-
export declare function getNodeExtensions(node: Node, resolver: DecoratorResolver): Extension[];
|
|
1
|
+
import type { Node } from 'typescript';
|
|
2
|
+
import type { DecoratorResolver } from '../../decorator';
|
|
3
|
+
import type { Extension } from './type';
|
|
4
|
+
export declare function getNodeExtensions(node: Node, resolver: DecoratorResolver): Extension[];
|
|
5
5
|
//# sourceMappingURL=module.d.ts.map
|