@trapi/metadata 1.0.0-alpha.6 → 1.0.0-alpha.8
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/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.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 +142 -142
- 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/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.d.ts.map +1 -1
- package/dist/generator/method/module.js +187 -188
- package/dist/generator/method/module.js.map +1 -1
- package/dist/generator/method/type.d.ts +22 -29
- package/dist/generator/method/type.d.ts.map +1 -1
- 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/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.d.ts.map +1 -1
- package/dist/generator/parameter/module.js +555 -554
- package/dist/generator/parameter/module.js.map +1 -1
- package/dist/generator/parameter/type.d.ts +24 -24
- package/dist/generator/parameter/type.d.ts.map +1 -1
- package/dist/generator/parameter/type.js +8 -8
- package/dist/generator/type.d.ts +19 -18
- package/dist/generator/type.d.ts.map +1 -1
- 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 +27 -0
- package/dist/resolver/constants.d.ts.map +1 -0
- package/dist/resolver/constants.js +37 -0
- package/dist/resolver/constants.js.map +1 -0
- package/dist/resolver/error.d.ts +7 -7
- package/dist/resolver/error.js +40 -40
- package/dist/resolver/extension/index.d.ts +3 -0
- package/dist/resolver/extension/index.d.ts.map +1 -0
- package/dist/resolver/extension/index.js +25 -0
- package/dist/resolver/extension/index.js.map +1 -0
- package/dist/resolver/extension/module.d.ts +5 -0
- package/dist/resolver/extension/module.d.ts.map +1 -0
- package/dist/resolver/extension/module.js +27 -0
- package/dist/resolver/extension/module.js.map +1 -0
- package/dist/resolver/extension/type.d.ts +8 -0
- package/dist/resolver/extension/type.d.ts.map +1 -0
- package/dist/resolver/extension/type.js +9 -0
- package/dist/resolver/extension/type.js.map +1 -0
- package/dist/resolver/index.d.ts +5 -3
- package/dist/resolver/index.d.ts.map +1 -1
- package/dist/resolver/index.js +27 -25
- package/dist/resolver/index.js.map +1 -1
- package/dist/resolver/module.d.ts +53 -50
- package/dist/resolver/module.d.ts.map +1 -1
- package/dist/resolver/module.js +1102 -1088
- package/dist/resolver/module.js.map +1 -1
- package/dist/resolver/type.d.ts +138 -123
- package/dist/resolver/type.d.ts.map +1 -1
- package/dist/resolver/type.js +129 -53
- package/dist/resolver/type.js.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/utils/initializer.js +130 -130
- package/dist/utils/initializer.js.map +1 -1
- package/dist/utils/js-doc/constants.d.ts +18 -18
- package/dist/utils/js-doc/constants.js +29 -29
- 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/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 +5 -6
package/dist/cache/driver.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { CacheData, CacheOptionsInput } from './type';
|
|
2
|
-
export declare class CacheDriver {
|
|
3
|
-
private readonly options;
|
|
4
|
-
constructor(input?: string | boolean | CacheOptionsInput);
|
|
5
|
-
save(data: CacheData): Promise<string | undefined>;
|
|
6
|
-
get(sourceFilesSize: number): Promise<CacheData | undefined>;
|
|
7
|
-
/**
|
|
8
|
-
* At a 10% chance, clear all cache files :)
|
|
9
|
-
*/
|
|
10
|
-
clear(): Promise<void>;
|
|
11
|
-
private buildFilePath;
|
|
12
|
-
private buildFileName;
|
|
13
|
-
}
|
|
1
|
+
import type { CacheData, CacheOptionsInput } from './type';
|
|
2
|
+
export declare class CacheDriver {
|
|
3
|
+
private readonly options;
|
|
4
|
+
constructor(input?: string | boolean | CacheOptionsInput);
|
|
5
|
+
save(data: CacheData): Promise<string | undefined>;
|
|
6
|
+
get(sourceFilesSize: number): Promise<CacheData | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* At a 10% chance, clear all cache files :)
|
|
9
|
+
*/
|
|
10
|
+
clear(): Promise<void>;
|
|
11
|
+
private buildFilePath;
|
|
12
|
+
private buildFileName;
|
|
13
|
+
}
|
|
14
14
|
//# sourceMappingURL=driver.d.ts.map
|
package/dist/cache/driver.js
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CacheDriver = void 0;
|
|
13
|
-
const locter_1 = require("locter");
|
|
14
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
15
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
-
const utils_1 = require("./utils");
|
|
17
|
-
class CacheDriver {
|
|
18
|
-
constructor(input) {
|
|
19
|
-
this.options = (0, utils_1.buildCacheOptions)(input);
|
|
20
|
-
}
|
|
21
|
-
// -------------------------------------------------------------------------
|
|
22
|
-
async save(data) {
|
|
23
|
-
if (!this.options.enabled) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
const filePath = this.buildFilePath(undefined, data.sourceFilesSize);
|
|
27
|
-
await node_fs_1.default.promises.writeFile(filePath, JSON.stringify(data));
|
|
28
|
-
return filePath;
|
|
29
|
-
}
|
|
30
|
-
async get(sourceFilesSize) {
|
|
31
|
-
if (!this.options.enabled) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
await this.clear();
|
|
35
|
-
const filePath = this.buildFilePath(undefined, sourceFilesSize);
|
|
36
|
-
try {
|
|
37
|
-
const content = await node_fs_1.default.promises.readFile(filePath, { encoding: 'utf-8' });
|
|
38
|
-
// todo: maybe add shape validation here :)
|
|
39
|
-
const cache = JSON.parse(content);
|
|
40
|
-
if (!cache || cache.sourceFilesSize !== sourceFilesSize) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
return cache;
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
/* istanbul ignore next */
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// -------------------------------------------------------------------------
|
|
51
|
-
/**
|
|
52
|
-
* At a 10% chance, clear all cache files :)
|
|
53
|
-
*/
|
|
54
|
-
/* istanbul ignore next */
|
|
55
|
-
async clear() {
|
|
56
|
-
if (!this.options.enabled || !this.options.clearAtRandom) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const rand = Math.floor(Math.random() * 100) + 1;
|
|
60
|
-
if (rand > 10) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const files = await (0, locter_1.locateMany)(this.buildFileName('**'), {
|
|
64
|
-
path: this.options.directoryPath,
|
|
65
|
-
});
|
|
66
|
-
const unlinkPromises = [];
|
|
67
|
-
for (let i = 0; files.length; i++) {
|
|
68
|
-
unlinkPromises.push(node_fs_1.default.promises.unlink((0, locter_1.buildFilePath)(files[i])));
|
|
69
|
-
}
|
|
70
|
-
await Promise.all(unlinkPromises);
|
|
71
|
-
}
|
|
72
|
-
// -------------------------------------------------------------------------
|
|
73
|
-
buildFilePath(hash, sourceFilesSize) {
|
|
74
|
-
return node_path_1.default.join(this.options.directoryPath, this.buildFileName(hash, sourceFilesSize));
|
|
75
|
-
}
|
|
76
|
-
buildFileName(hash, sourceFilesSize) {
|
|
77
|
-
if (typeof this.options.fileName === 'string') {
|
|
78
|
-
return this.options.fileName;
|
|
79
|
-
}
|
|
80
|
-
return `.swagger-${hash ?? (0, utils_1.generateFileHash)(sourceFilesSize)}.json`;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.CacheDriver = CacheDriver;
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CacheDriver = void 0;
|
|
13
|
+
const locter_1 = require("locter");
|
|
14
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
|
+
class CacheDriver {
|
|
18
|
+
constructor(input) {
|
|
19
|
+
this.options = (0, utils_1.buildCacheOptions)(input);
|
|
20
|
+
}
|
|
21
|
+
// -------------------------------------------------------------------------
|
|
22
|
+
async save(data) {
|
|
23
|
+
if (!this.options.enabled) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const filePath = this.buildFilePath(undefined, data.sourceFilesSize);
|
|
27
|
+
await node_fs_1.default.promises.writeFile(filePath, JSON.stringify(data));
|
|
28
|
+
return filePath;
|
|
29
|
+
}
|
|
30
|
+
async get(sourceFilesSize) {
|
|
31
|
+
if (!this.options.enabled) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
await this.clear();
|
|
35
|
+
const filePath = this.buildFilePath(undefined, sourceFilesSize);
|
|
36
|
+
try {
|
|
37
|
+
const content = await node_fs_1.default.promises.readFile(filePath, { encoding: 'utf-8' });
|
|
38
|
+
// todo: maybe add shape validation here :)
|
|
39
|
+
const cache = JSON.parse(content);
|
|
40
|
+
if (!cache || cache.sourceFilesSize !== sourceFilesSize) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return cache;
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
/* istanbul ignore next */
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// -------------------------------------------------------------------------
|
|
51
|
+
/**
|
|
52
|
+
* At a 10% chance, clear all cache files :)
|
|
53
|
+
*/
|
|
54
|
+
/* istanbul ignore next */
|
|
55
|
+
async clear() {
|
|
56
|
+
if (!this.options.enabled || !this.options.clearAtRandom) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const rand = Math.floor(Math.random() * 100) + 1;
|
|
60
|
+
if (rand > 10) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const files = await (0, locter_1.locateMany)(this.buildFileName('**'), {
|
|
64
|
+
path: this.options.directoryPath,
|
|
65
|
+
});
|
|
66
|
+
const unlinkPromises = [];
|
|
67
|
+
for (let i = 0; files.length; i++) {
|
|
68
|
+
unlinkPromises.push(node_fs_1.default.promises.unlink((0, locter_1.buildFilePath)(files[i])));
|
|
69
|
+
}
|
|
70
|
+
await Promise.all(unlinkPromises);
|
|
71
|
+
}
|
|
72
|
+
// -------------------------------------------------------------------------
|
|
73
|
+
buildFilePath(hash, sourceFilesSize) {
|
|
74
|
+
return node_path_1.default.join(this.options.directoryPath, this.buildFileName(hash, sourceFilesSize));
|
|
75
|
+
}
|
|
76
|
+
buildFileName(hash, sourceFilesSize) {
|
|
77
|
+
if (typeof this.options.fileName === 'string') {
|
|
78
|
+
return this.options.fileName;
|
|
79
|
+
}
|
|
80
|
+
return `.swagger-${hash ?? (0, utils_1.generateFileHash)(sourceFilesSize)}.json`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.CacheDriver = CacheDriver;
|
|
84
84
|
//# sourceMappingURL=driver.js.map
|
package/dist/cache/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './driver';
|
|
2
|
-
export * from './type';
|
|
3
|
-
export * from './utils';
|
|
1
|
+
export * from './driver';
|
|
2
|
+
export * from './type';
|
|
3
|
+
export * from './utils';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cache/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
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("./driver"), exports);
|
|
24
|
-
__exportStar(require("./type"), exports);
|
|
25
|
-
__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("./driver"), exports);
|
|
24
|
+
__exportStar(require("./type"), exports);
|
|
25
|
+
__exportStar(require("./utils"), exports);
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
package/dist/cache/type.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import type { Metadata } from '../generator';
|
|
2
|
-
export interface CacheOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Specify if the cache driver should be enabled.
|
|
5
|
-
*
|
|
6
|
-
* Default: false
|
|
7
|
-
* */
|
|
8
|
-
enabled: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Directory relative or absolute path.
|
|
11
|
-
*
|
|
12
|
-
* Default: tmpDir()
|
|
13
|
-
*/
|
|
14
|
-
directoryPath: string;
|
|
15
|
-
/**
|
|
16
|
-
* Specify the cache file name.
|
|
17
|
-
*
|
|
18
|
-
* Default: metadata-{hash}.json
|
|
19
|
-
*/
|
|
20
|
-
fileName?: string;
|
|
21
|
-
/**
|
|
22
|
-
* The cache file(s) will be cleared at a 10% percent change
|
|
23
|
-
* each time.
|
|
24
|
-
*
|
|
25
|
-
* Default: true
|
|
26
|
-
*/
|
|
27
|
-
clearAtRandom: boolean;
|
|
28
|
-
}
|
|
29
|
-
export type CacheOptionsInput = Partial<CacheOptions>;
|
|
30
|
-
export type CacheData = {
|
|
31
|
-
sourceFilesSize: number;
|
|
32
|
-
} & Metadata;
|
|
1
|
+
import type { Metadata } from '../generator';
|
|
2
|
+
export interface CacheOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Specify if the cache driver should be enabled.
|
|
5
|
+
*
|
|
6
|
+
* Default: false
|
|
7
|
+
* */
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Directory relative or absolute path.
|
|
11
|
+
*
|
|
12
|
+
* Default: tmpDir()
|
|
13
|
+
*/
|
|
14
|
+
directoryPath: string;
|
|
15
|
+
/**
|
|
16
|
+
* Specify the cache file name.
|
|
17
|
+
*
|
|
18
|
+
* Default: metadata-{hash}.json
|
|
19
|
+
*/
|
|
20
|
+
fileName?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The cache file(s) will be cleared at a 10% percent change
|
|
23
|
+
* each time.
|
|
24
|
+
*
|
|
25
|
+
* Default: true
|
|
26
|
+
*/
|
|
27
|
+
clearAtRandom: boolean;
|
|
28
|
+
}
|
|
29
|
+
export type CacheOptionsInput = Partial<CacheOptions>;
|
|
30
|
+
export type CacheData = {
|
|
31
|
+
sourceFilesSize: number;
|
|
32
|
+
} & Metadata;
|
|
33
33
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/cache/type.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 });
|
|
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
9
|
//# sourceMappingURL=type.js.map
|
package/dist/cache/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CacheOptions, CacheOptionsInput } from './type';
|
|
2
|
-
export declare function buildCacheOptions(input?: string | boolean | CacheOptionsInput): CacheOptions;
|
|
3
|
-
export declare function generateFileHash(sourceFilesSize?: number): string;
|
|
1
|
+
import type { CacheOptions, CacheOptionsInput } from './type';
|
|
2
|
+
export declare function buildCacheOptions(input?: string | boolean | CacheOptionsInput): CacheOptions;
|
|
3
|
+
export declare function generateFileHash(sourceFilesSize?: number): string;
|
|
4
4
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/cache/utils.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.generateFileHash = exports.buildCacheOptions = void 0;
|
|
13
|
-
const node_os_1 = require("node:os");
|
|
14
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
-
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
16
|
-
const node_process_1 = __importDefault(require("node:process"));
|
|
17
|
-
function buildCacheOptions(input) {
|
|
18
|
-
if (typeof input === 'string') {
|
|
19
|
-
input = {
|
|
20
|
-
enabled: true,
|
|
21
|
-
directoryPath: input,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
if (typeof input === 'boolean') {
|
|
25
|
-
input = {
|
|
26
|
-
enabled: input,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
input = input || {};
|
|
30
|
-
/* istanbul ignore next */
|
|
31
|
-
const isTestEnvironment = !!node_process_1.default.env.NODE_ENV && node_process_1.default.env.NODE_ENV === 'test';
|
|
32
|
-
let directoryPath = (0, node_os_1.tmpdir)();
|
|
33
|
-
if (typeof input.directoryPath === 'string') {
|
|
34
|
-
directoryPath = node_path_1.default.isAbsolute(input.directoryPath) ?
|
|
35
|
-
input.directoryPath :
|
|
36
|
-
node_path_1.default.join(node_process_1.default.cwd(), input.directoryPath);
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
fileName: input.fileName,
|
|
40
|
-
directoryPath,
|
|
41
|
-
enabled: input.enabled ?? true,
|
|
42
|
-
clearAtRandom: input.clearAtRandom ?? !isTestEnvironment,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
exports.buildCacheOptions = buildCacheOptions;
|
|
46
|
-
function generateFileHash(sourceFilesSize) {
|
|
47
|
-
const hash = node_crypto_1.default.createHash('sha256');
|
|
48
|
-
const strSize = (sourceFilesSize ?? 0).toString();
|
|
49
|
-
hash.update(strSize);
|
|
50
|
-
return hash.digest('hex');
|
|
51
|
-
}
|
|
52
|
-
exports.generateFileHash = generateFileHash;
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.generateFileHash = exports.buildCacheOptions = void 0;
|
|
13
|
+
const node_os_1 = require("node:os");
|
|
14
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
15
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
16
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
17
|
+
function buildCacheOptions(input) {
|
|
18
|
+
if (typeof input === 'string') {
|
|
19
|
+
input = {
|
|
20
|
+
enabled: true,
|
|
21
|
+
directoryPath: input,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (typeof input === 'boolean') {
|
|
25
|
+
input = {
|
|
26
|
+
enabled: input,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
input = input || {};
|
|
30
|
+
/* istanbul ignore next */
|
|
31
|
+
const isTestEnvironment = !!node_process_1.default.env.NODE_ENV && node_process_1.default.env.NODE_ENV === 'test';
|
|
32
|
+
let directoryPath = (0, node_os_1.tmpdir)();
|
|
33
|
+
if (typeof input.directoryPath === 'string') {
|
|
34
|
+
directoryPath = node_path_1.default.isAbsolute(input.directoryPath) ?
|
|
35
|
+
input.directoryPath :
|
|
36
|
+
node_path_1.default.join(node_process_1.default.cwd(), input.directoryPath);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
fileName: input.fileName,
|
|
40
|
+
directoryPath,
|
|
41
|
+
enabled: input.enabled ?? true,
|
|
42
|
+
clearAtRandom: input.clearAtRandom ?? !isTestEnvironment,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.buildCacheOptions = buildCacheOptions;
|
|
46
|
+
function generateFileHash(sourceFilesSize) {
|
|
47
|
+
const hash = node_crypto_1.default.createHash('sha256');
|
|
48
|
+
const strSize = (sourceFilesSize ?? 0).toString();
|
|
49
|
+
hash.update(strSize);
|
|
50
|
+
return hash.digest('hex');
|
|
51
|
+
}
|
|
52
|
+
exports.generateFileHash = generateFileHash;
|
|
53
53
|
//# sourceMappingURL=utils.js.map
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './type';
|
|
1
|
+
export * from './type';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/config/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
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("./type"), 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("./type"), exports);
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/dist/config/type.d.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type { CacheOptions } from '../cache';
|
|
2
|
-
import type { DecoratorConfig } from '../decorator';
|
|
3
|
-
export type EntryPointOptions = {
|
|
4
|
-
cwd: string;
|
|
5
|
-
pattern: string;
|
|
6
|
-
};
|
|
7
|
-
export type EntryPoint = string | string[] | EntryPointOptions | EntryPointOptions[];
|
|
8
|
-
export interface Options {
|
|
9
|
-
/**
|
|
10
|
-
* The entry point to your API.
|
|
11
|
-
*/
|
|
12
|
-
entryPoint: EntryPoint;
|
|
13
|
-
/**
|
|
14
|
-
* Directory to ignore during TypeScript files scan.
|
|
15
|
-
* Default: []
|
|
16
|
-
*/
|
|
17
|
-
ignore?: string[];
|
|
18
|
-
/**
|
|
19
|
-
* Directory to allow during TypeScript files scan.
|
|
20
|
-
* Default: []
|
|
21
|
-
*/
|
|
22
|
-
allow?: string[];
|
|
23
|
-
/**
|
|
24
|
-
* Directory to store and cache metadata cache files.
|
|
25
|
-
* Default: false
|
|
26
|
-
*/
|
|
27
|
-
cache?: string | boolean | Partial<CacheOptions>;
|
|
28
|
-
/**
|
|
29
|
-
* Manual decorator properties configuration.
|
|
30
|
-
*/
|
|
31
|
-
decorators?: DecoratorConfig[];
|
|
32
|
-
/**
|
|
33
|
-
* Load a specific preset configuration.
|
|
34
|
-
*/
|
|
35
|
-
preset?: string;
|
|
36
|
-
}
|
|
1
|
+
import type { CacheOptions } from '../cache';
|
|
2
|
+
import type { DecoratorConfig } from '../decorator';
|
|
3
|
+
export type EntryPointOptions = {
|
|
4
|
+
cwd: string;
|
|
5
|
+
pattern: string;
|
|
6
|
+
};
|
|
7
|
+
export type EntryPoint = string | string[] | EntryPointOptions | EntryPointOptions[];
|
|
8
|
+
export interface Options {
|
|
9
|
+
/**
|
|
10
|
+
* The entry point to your API.
|
|
11
|
+
*/
|
|
12
|
+
entryPoint: EntryPoint;
|
|
13
|
+
/**
|
|
14
|
+
* Directory to ignore during TypeScript files scan.
|
|
15
|
+
* Default: []
|
|
16
|
+
*/
|
|
17
|
+
ignore?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Directory to allow during TypeScript files scan.
|
|
20
|
+
* Default: []
|
|
21
|
+
*/
|
|
22
|
+
allow?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Directory to store and cache metadata cache files.
|
|
25
|
+
* Default: false
|
|
26
|
+
*/
|
|
27
|
+
cache?: string | boolean | Partial<CacheOptions>;
|
|
28
|
+
/**
|
|
29
|
+
* Manual decorator properties configuration.
|
|
30
|
+
*/
|
|
31
|
+
decorators?: DecoratorConfig[];
|
|
32
|
+
/**
|
|
33
|
+
* Load a specific preset configuration.
|
|
34
|
+
*/
|
|
35
|
+
preset?: string;
|
|
36
|
+
}
|
|
37
37
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/config/type.js
CHANGED
|
@@ -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
|