@trapi/metadata 0.4.0 → 1.0.0-alpha.1
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 +36 -72
- package/dist/cache/driver.d.ts +6 -6
- package/dist/cache/driver.d.ts.map +1 -1
- package/dist/cache/driver.js +27 -45
- package/dist/cache/driver.js.map +1 -1
- package/dist/cache/type.d.ts +31 -32
- package/dist/cache/type.d.ts.map +1 -1
- package/dist/cache/utils.d.ts +3 -3
- package/dist/cache/utils.d.ts.map +1 -1
- package/dist/cache/utils.js +29 -24
- package/dist/cache/utils.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/type.d.ts +37 -0
- package/dist/config/type.d.ts.map +1 -0
- package/dist/config/type.js +9 -0
- package/dist/config/type.js.map +1 -0
- package/dist/decorator/constants.d.ts +40 -0
- package/dist/decorator/constants.d.ts.map +1 -0
- package/dist/decorator/constants.js +52 -0
- package/dist/decorator/constants.js.map +1 -0
- package/dist/decorator/index.d.ts +7 -0
- package/dist/decorator/index.d.ts.map +1 -0
- package/dist/decorator/index.js +29 -0
- package/dist/decorator/index.js.map +1 -0
- package/dist/decorator/preset/index.d.ts +3 -0
- package/dist/decorator/preset/index.d.ts.map +1 -0
- package/dist/decorator/preset/index.js +25 -0
- package/dist/decorator/preset/index.js.map +1 -0
- package/dist/decorator/preset/type.d.ts +6 -0
- package/dist/decorator/preset/type.d.ts.map +1 -0
- package/dist/decorator/preset/type.js +9 -0
- package/dist/decorator/preset/type.js.map +1 -0
- package/dist/decorator/preset/utils/check.d.ts +3 -0
- package/dist/decorator/preset/utils/check.d.ts.map +1 -0
- package/dist/decorator/preset/utils/check.js +18 -0
- package/dist/decorator/preset/utils/check.js.map +1 -0
- package/dist/decorator/preset/utils/index.d.ts +4 -0
- package/dist/decorator/preset/utils/index.d.ts.map +1 -0
- package/dist/decorator/preset/utils/index.js +26 -0
- package/dist/decorator/preset/utils/index.js.map +1 -0
- package/dist/decorator/preset/utils/load.d.ts +3 -0
- package/dist/decorator/preset/utils/load.d.ts.map +1 -0
- package/dist/decorator/preset/utils/load.js +48 -0
- package/dist/decorator/preset/utils/load.js.map +1 -0
- package/dist/decorator/preset/utils/normalize.d.ts +2 -0
- package/dist/decorator/preset/utils/normalize.d.ts.map +1 -0
- package/dist/decorator/preset/utils/normalize.js +27 -0
- package/dist/decorator/preset/utils/normalize.js.map +1 -0
- package/dist/decorator/property-manager/index.d.ts +3 -0
- package/dist/decorator/property-manager/index.d.ts.map +1 -0
- package/dist/decorator/property-manager/index.js +25 -0
- package/dist/decorator/property-manager/index.js.map +1 -0
- package/dist/decorator/property-manager/module.d.ts +19 -0
- package/dist/decorator/property-manager/module.d.ts.map +1 -0
- package/dist/decorator/property-manager/module.js +65 -0
- package/dist/decorator/property-manager/module.js.map +1 -0
- package/dist/decorator/property-manager/utils.d.ts +7 -0
- package/dist/decorator/property-manager/utils.d.ts.map +1 -0
- package/dist/decorator/property-manager/utils.js +121 -0
- package/dist/decorator/property-manager/utils.js.map +1 -0
- package/dist/decorator/resolver/index.d.ts +3 -0
- package/dist/decorator/resolver/index.d.ts.map +1 -0
- package/dist/decorator/resolver/index.js +25 -0
- package/dist/decorator/resolver/index.js.map +1 -0
- package/dist/decorator/resolver/module.d.ts +27 -0
- package/dist/decorator/resolver/module.d.ts.map +1 -0
- package/dist/decorator/resolver/module.js +72 -0
- package/dist/decorator/resolver/module.js.map +1 -0
- package/dist/decorator/resolver/type.d.ts +10 -0
- package/dist/decorator/resolver/type.d.ts.map +1 -0
- package/dist/decorator/resolver/type.js +3 -0
- package/dist/decorator/resolver/type.js.map +1 -0
- package/dist/decorator/sets/class.d.ts +7 -0
- package/dist/decorator/sets/class.d.ts.map +1 -0
- package/dist/decorator/sets/class.js +9 -0
- package/dist/decorator/sets/class.js.map +1 -0
- package/dist/decorator/sets/index.d.ts +8 -0
- package/dist/decorator/sets/index.d.ts.map +1 -0
- package/dist/decorator/sets/index.js +29 -0
- package/dist/decorator/sets/index.js.map +1 -0
- package/dist/decorator/sets/method.d.ts +14 -0
- package/dist/decorator/sets/method.d.ts.map +1 -0
- package/dist/decorator/sets/method.js +9 -0
- package/dist/decorator/sets/method.js.map +1 -0
- package/dist/decorator/sets/mixed.d.ts +8 -0
- package/dist/decorator/sets/mixed.d.ts.map +1 -0
- package/dist/decorator/sets/mixed.js +9 -0
- package/dist/decorator/sets/mixed.js.map +1 -0
- package/dist/decorator/sets/parameter.d.ts +21 -0
- package/dist/decorator/sets/parameter.d.ts.map +1 -0
- package/dist/decorator/sets/parameter.js +9 -0
- package/dist/decorator/sets/parameter.js.map +1 -0
- package/dist/decorator/sets/request.d.ts +6 -0
- package/dist/decorator/sets/request.d.ts.map +1 -0
- package/dist/decorator/sets/request.js +9 -0
- package/dist/decorator/sets/request.js.map +1 -0
- package/dist/decorator/sets/response.d.ts +16 -0
- package/dist/decorator/sets/response.d.ts.map +1 -0
- package/dist/decorator/sets/response.js +9 -0
- package/dist/decorator/sets/response.js.map +1 -0
- package/dist/decorator/sets/type.d.ts +4 -0
- package/dist/decorator/sets/type.d.ts.map +1 -0
- package/dist/decorator/sets/type.js +3 -0
- package/dist/decorator/sets/type.js.map +1 -0
- package/dist/decorator/type.d.ts +39 -0
- package/dist/decorator/type.d.ts.map +1 -0
- package/dist/decorator/type.js +9 -0
- package/dist/decorator/type.js.map +1 -0
- package/dist/error/base.d.ts +3 -0
- package/dist/error/base.d.ts.map +1 -0
- package/dist/error/base.js +13 -0
- package/dist/error/base.js.map +1 -0
- package/dist/error/index.d.ts +3 -0
- package/dist/error/index.d.ts.map +1 -0
- package/dist/{errors → error}/index.js +1 -0
- package/dist/error/index.js.map +1 -0
- package/dist/error/parameter-invalid.d.ts +4 -0
- package/dist/error/parameter-invalid.d.ts.map +1 -0
- package/dist/{errors → error}/parameter-invalid.js +2 -1
- package/dist/error/parameter-invalid.js.map +1 -0
- package/dist/generator/{endpoint.d.ts → abstract.d.ts} +9 -8
- package/dist/generator/abstract.d.ts.map +1 -0
- package/dist/generator/{endpoint.js → abstract.js} +26 -25
- package/dist/generator/abstract.js.map +1 -0
- package/dist/generator/controller/index.d.ts +3 -0
- package/dist/generator/controller/index.d.ts.map +1 -0
- package/dist/generator/controller/index.js +25 -0
- package/dist/generator/controller/index.js.map +1 -0
- package/dist/generator/controller/module.d.ts +13 -0
- package/dist/generator/controller/module.d.ts.map +1 -0
- package/dist/generator/{controller.js → controller/module.js} +7 -6
- package/dist/generator/controller/module.js.map +1 -0
- package/dist/generator/controller/type.d.ts +42 -0
- package/dist/generator/controller/type.d.ts.map +1 -0
- package/dist/generator/controller/type.js +3 -0
- package/dist/generator/controller/type.js.map +1 -0
- package/dist/generator/index.d.ts +3 -3
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +3 -3
- package/dist/generator/index.js.map +1 -1
- package/dist/generator/metadata/index.d.ts +3 -0
- package/dist/generator/metadata/index.d.ts.map +1 -0
- package/dist/generator/metadata/index.js +25 -0
- package/dist/generator/metadata/index.js.map +1 -0
- package/dist/generator/{module.d.ts → metadata/module.d.ts} +10 -9
- package/dist/generator/metadata/module.d.ts.map +1 -0
- package/dist/generator/{module.js → metadata/module.js} +22 -39
- package/dist/generator/metadata/module.js.map +1 -0
- package/dist/generator/metadata/type.d.ts +25 -0
- package/dist/generator/metadata/type.d.ts.map +1 -0
- package/dist/generator/metadata/type.js +3 -0
- package/dist/generator/metadata/type.js.map +1 -0
- package/dist/generator/method/constants.d.ts +11 -0
- package/dist/generator/method/constants.d.ts.map +1 -0
- package/dist/generator/method/constants.js +21 -0
- package/dist/generator/method/constants.js.map +1 -0
- package/dist/generator/method/index.d.ts +4 -0
- package/dist/generator/method/index.d.ts.map +1 -0
- package/dist/generator/method/index.js +26 -0
- package/dist/generator/method/index.js.map +1 -0
- package/dist/generator/{method.d.ts → method/module.d.ts} +6 -7
- package/dist/generator/method/module.d.ts.map +1 -0
- package/dist/generator/{method.js → method/module.js} +69 -44
- package/dist/generator/method/module.js.map +1 -0
- package/dist/generator/method/type.d.ts +30 -0
- package/dist/generator/method/type.d.ts.map +1 -0
- package/dist/generator/method/type.js +9 -0
- package/dist/generator/method/type.js.map +1 -0
- package/dist/generator/parameter/index.d.ts +4 -0
- package/dist/generator/parameter/index.d.ts.map +1 -0
- package/dist/generator/parameter/index.js +26 -0
- package/dist/generator/parameter/index.js.map +1 -0
- package/dist/generator/{parameter.d.ts → parameter/module.d.ts} +4 -4
- package/dist/generator/parameter/module.d.ts.map +1 -0
- package/dist/generator/{parameter.js → parameter/module.js} +70 -63
- package/dist/generator/parameter/module.js.map +1 -0
- package/dist/generator/parameter/type.d.ts +22 -0
- package/dist/generator/parameter/type.d.ts.map +1 -0
- package/dist/generator/parameter/type.js +9 -0
- package/dist/generator/parameter/type.js.map +1 -0
- package/dist/generator/parameter/validator.d.ts +4 -0
- package/dist/generator/parameter/validator.d.ts.map +1 -0
- package/dist/generator/parameter/validator.js +130 -0
- package/dist/generator/parameter/validator.js.map +1 -0
- package/dist/generator/type.d.ts +16 -0
- package/dist/generator/type.d.ts.map +1 -0
- package/dist/generator/type.js +9 -0
- package/dist/generator/type.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +4 -3
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +20 -2
- package/dist/module.js.map +1 -1
- package/dist/resolver/error.d.ts +8 -0
- package/dist/resolver/error.d.ts.map +1 -0
- package/dist/resolver/error.js +41 -0
- package/dist/resolver/error.js.map +1 -0
- package/dist/resolver/index.d.ts +4 -0
- package/dist/resolver/index.d.ts.map +1 -0
- package/dist/resolver/index.js +26 -0
- package/dist/resolver/index.js.map +1 -0
- package/dist/resolver/module.d.ts +51 -0
- package/dist/resolver/module.d.ts.map +1 -0
- package/dist/resolver/module.js +1081 -0
- package/dist/resolver/module.js.map +1 -0
- package/dist/resolver/type.d.ts +126 -0
- package/dist/resolver/type.d.ts.map +1 -0
- package/dist/resolver/type.js +54 -0
- package/dist/resolver/type.js.map +1 -0
- package/dist/type.d.ts +0 -149
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js +0 -6
- package/dist/type.js.map +1 -1
- package/dist/utils/index.d.ts +6 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +6 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/initializer.d.ts +5 -0
- package/dist/utils/initializer.d.ts.map +1 -0
- package/dist/utils/initializer.js +131 -0
- package/dist/utils/initializer.js.map +1 -0
- package/dist/utils/js-doc.d.ts +8 -0
- package/dist/utils/js-doc.d.ts.map +1 -0
- package/dist/utils/js-doc.js +101 -0
- package/dist/utils/js-doc.js.map +1 -0
- package/dist/utils/node/index.d.ts +3 -0
- package/dist/utils/node/index.d.ts.map +1 -0
- package/dist/utils/node/index.js +25 -0
- package/dist/utils/node/index.js.map +1 -0
- package/dist/utils/node/module.d.ts +10 -0
- package/dist/utils/node/module.d.ts.map +1 -0
- package/dist/utils/node/module.js +52 -0
- package/dist/utils/node/module.js.map +1 -0
- package/dist/utils/node/type.d.ts +6 -0
- package/dist/utils/node/type.d.ts.map +1 -0
- package/dist/utils/node/type.js +9 -0
- package/dist/utils/node/type.js.map +1 -0
- package/dist/utils/{path.d.ts → path-normalize.d.ts} +1 -1
- package/dist/utils/path-normalize.d.ts.map +1 -0
- package/dist/utils/{path.js → path-normalize.js} +1 -1
- package/dist/utils/path-normalize.js.map +1 -0
- package/dist/utils/source-files.d.ts +3 -0
- package/dist/utils/source-files.d.ts.map +1 -0
- package/dist/utils/source-files.js +32 -0
- package/dist/utils/source-files.js.map +1 -0
- package/dist/utils/tsconfig/index.d.ts +3 -0
- package/dist/utils/tsconfig/index.d.ts.map +1 -0
- package/dist/utils/tsconfig/index.js +25 -0
- package/dist/utils/tsconfig/index.js.map +1 -0
- package/dist/utils/tsconfig/module.d.ts +4 -0
- package/dist/utils/tsconfig/module.d.ts.map +1 -0
- package/dist/utils/tsconfig/module.js +54 -0
- package/dist/utils/tsconfig/module.js.map +1 -0
- package/dist/utils/tsconfig/type.d.ts +10 -0
- package/dist/utils/tsconfig/type.d.ts.map +1 -0
- package/dist/utils/tsconfig/type.js +9 -0
- package/dist/utils/tsconfig/type.js.map +1 -0
- package/package.json +11 -12
- package/dist/config/path.d.ts +0 -3
- package/dist/config/path.d.ts.map +0 -1
- package/dist/config/path.js +0 -32
- package/dist/config/path.js.map +0 -1
- package/dist/errors/index.d.ts +0 -2
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/errors/parameter-invalid.d.ts +0 -3
- package/dist/errors/parameter-invalid.d.ts.map +0 -1
- package/dist/errors/parameter-invalid.js.map +0 -1
- package/dist/generator/controller.d.ts +0 -13
- package/dist/generator/controller.d.ts.map +0 -1
- package/dist/generator/controller.js.map +0 -1
- package/dist/generator/endpoint.d.ts.map +0 -1
- package/dist/generator/endpoint.js.map +0 -1
- package/dist/generator/method.d.ts.map +0 -1
- package/dist/generator/method.js.map +0 -1
- package/dist/generator/module.d.ts.map +0 -1
- package/dist/generator/module.js.map +0 -1
- package/dist/generator/parameter.d.ts.map +0 -1
- package/dist/generator/parameter.js.map +0 -1
- package/dist/generator/utils.d.ts +0 -5
- package/dist/generator/utils.d.ts.map +0 -1
- package/dist/generator/utils.js +0 -18
- package/dist/generator/utils.js.map +0 -1
- package/dist/utils/path.d.ts.map +0 -1
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/typescript.d.ts +0 -8
- package/dist/utils/typescript.d.ts.map +0 -1
- package/dist/utils/typescript.js +0 -41
- package/dist/utils/typescript.js.map +0 -1
package/README.md
CHANGED
|
@@ -30,83 +30,56 @@ npm install --save @trapi/metadata
|
|
|
30
30
|
### Metadata
|
|
31
31
|
The metadata configuration object (Top-Level) is the main configuration object of this library
|
|
32
32
|
and can be defined according the following type scheme:
|
|
33
|
+
|
|
33
34
|
```typescript
|
|
34
|
-
import {
|
|
35
|
-
|
|
35
|
+
import {
|
|
36
|
+
CacheOptions,
|
|
37
|
+
DecoratorConfig
|
|
38
|
+
} from "@trapi/metadata";
|
|
36
39
|
|
|
37
|
-
export type
|
|
40
|
+
export type EntryPointOptions = {
|
|
38
41
|
cwd: string,
|
|
39
42
|
pattern: string
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
export type EntryPoint = string |
|
|
43
|
-
string[] |
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
string[] |
|
|
47
|
+
EntryPointOptions |
|
|
48
|
+
EntryPointOptions[];
|
|
46
49
|
|
|
47
|
-
export interface
|
|
50
|
+
export interface Options {
|
|
48
51
|
/**
|
|
49
52
|
* The entry point to your API.
|
|
50
53
|
*/
|
|
51
54
|
entryPoint: EntryPoint;
|
|
55
|
+
|
|
52
56
|
/**
|
|
53
57
|
* Directory to ignore during TypeScript files scan.
|
|
54
58
|
* Default: []
|
|
55
59
|
*/
|
|
56
60
|
ignore?: string[];
|
|
61
|
+
|
|
57
62
|
/**
|
|
58
|
-
* Directory to
|
|
59
|
-
* Default:
|
|
60
|
-
*/
|
|
61
|
-
cache?: string | boolean | Partial<Cache.Config>;
|
|
62
|
-
/**
|
|
63
|
-
* Decorator config.
|
|
64
|
-
* Default: {
|
|
65
|
-
* library: [],
|
|
66
|
-
* internal: true,
|
|
67
|
-
* map: {}
|
|
68
|
-
* }
|
|
63
|
+
* Directory to allow during TypeScript files scan.
|
|
64
|
+
* Default: []
|
|
69
65
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Cache
|
|
75
|
-
The Cache can be configured by providing different kind of values:
|
|
76
|
-
|
|
77
|
-
- **boolean**:
|
|
78
|
-
- `true`: Cache file will be saved to process.cwd() with generated hash file name and the cache will be cleared at a 10 percent chance.
|
|
79
|
-
- `false`: Cache is disabled.
|
|
80
|
-
- **string** Cache will be saved to `value` directory with generated hash file name ...
|
|
81
|
-
- **object**: obda
|
|
82
|
-
```typescript
|
|
83
|
-
export interface Config {
|
|
66
|
+
allow?: string[],
|
|
67
|
+
|
|
84
68
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
69
|
+
* Directory to store and cache metadata files.
|
|
87
70
|
* Default: false
|
|
88
|
-
* */
|
|
89
|
-
enabled?: boolean,
|
|
90
|
-
/**
|
|
91
|
-
* Directory relative or absolute path.
|
|
92
|
-
*
|
|
93
|
-
* Default: process.cwd()
|
|
94
71
|
*/
|
|
95
|
-
|
|
72
|
+
cache?: string | boolean | Partial<CacheOptions>;
|
|
73
|
+
|
|
96
74
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* Default: metadata-{hash}.json
|
|
75
|
+
* Manual decorator properties configuration.
|
|
100
76
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
77
|
+
decorators?: DecoratorConfig[],
|
|
78
|
+
|
|
103
79
|
/**
|
|
104
|
-
*
|
|
105
|
-
* each time.
|
|
106
|
-
*
|
|
107
|
-
* Default: true
|
|
80
|
+
* Load a specific preset configuration.
|
|
108
81
|
*/
|
|
109
|
-
|
|
82
|
+
preset?: string;
|
|
110
83
|
}
|
|
111
84
|
```
|
|
112
85
|
|
|
@@ -123,27 +96,18 @@ At the moment only the following TypeScript UtilityTypes are supported:
|
|
|
123
96
|
## Usage
|
|
124
97
|
|
|
125
98
|
```typescript
|
|
126
|
-
import {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
directoryPath: path.join(process.cwd(), 'writable')
|
|
139
|
-
},
|
|
140
|
-
decorator: {
|
|
141
|
-
internal: true,
|
|
142
|
-
// Because both libaries does not have any decorator
|
|
143
|
-
// names in common, the represnetation also does not differ and
|
|
144
|
-
// we can use them both :)
|
|
145
|
-
preset: ['decorators-express', 'typescript-rest']
|
|
146
|
-
}
|
|
99
|
+
import {
|
|
100
|
+
generateMetadata,
|
|
101
|
+
Metadata
|
|
102
|
+
} from "@trapi/metadata";
|
|
103
|
+
import path from "node:path";
|
|
104
|
+
import process from "node:process";
|
|
105
|
+
|
|
106
|
+
const metadata : Metadata = await generateMetadata({
|
|
107
|
+
entryPoint: ['src/controllers/**/*.ts'],
|
|
108
|
+
ignore: ['**/node_modules/**'],
|
|
109
|
+
cache: true,
|
|
110
|
+
preset: '@trapi/preset-routup'
|
|
147
111
|
});
|
|
148
112
|
|
|
149
113
|
console.log(metadata);
|
package/dist/cache/driver.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CacheData, CacheOptionsInput } from './type';
|
|
2
2
|
export declare class CacheDriver {
|
|
3
|
-
private readonly
|
|
4
|
-
constructor(
|
|
5
|
-
save(data:
|
|
6
|
-
get(sourceFilesSize: number):
|
|
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
7
|
/**
|
|
8
8
|
* At a 10% chance, clear all cache files :)
|
|
9
9
|
*/
|
|
10
|
-
clear(): void
|
|
10
|
+
clear(): Promise<void>;
|
|
11
11
|
private buildFilePath;
|
|
12
12
|
private buildFileName;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/cache/driver.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/cache/driver.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAgB,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEzE,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;gBAE3B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,iBAAiB;IAMlD,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAYlD,GAAG,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IA4BlE;;OAEG;IAGG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwB5B,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,aAAa;CAMxB"}
|
package/dist/cache/driver.js
CHANGED
|
@@ -5,63 +5,39 @@
|
|
|
5
5
|
* For the full copyright and license information,
|
|
6
6
|
* view the LICENSE file that was distributed with this source code.
|
|
7
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
10
|
};
|
|
34
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
12
|
exports.CacheDriver = void 0;
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
13
|
+
const locter_1 = require("locter");
|
|
14
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
39
16
|
const utils_1 = require("./utils");
|
|
40
17
|
class CacheDriver {
|
|
41
|
-
constructor(
|
|
42
|
-
this.
|
|
18
|
+
constructor(input) {
|
|
19
|
+
this.options = (0, utils_1.buildCacheOptions)(input);
|
|
43
20
|
}
|
|
44
21
|
// -------------------------------------------------------------------------
|
|
45
|
-
save(data) {
|
|
46
|
-
if (!this.
|
|
22
|
+
async save(data) {
|
|
23
|
+
if (!this.options.enabled) {
|
|
47
24
|
return undefined;
|
|
48
25
|
}
|
|
49
26
|
const filePath = this.buildFilePath(undefined, data.sourceFilesSize);
|
|
50
|
-
|
|
27
|
+
await node_fs_1.default.promises.writeFile(filePath, JSON.stringify(data));
|
|
51
28
|
return filePath;
|
|
52
29
|
}
|
|
53
|
-
get(sourceFilesSize) {
|
|
54
|
-
if (!this.
|
|
30
|
+
async get(sourceFilesSize) {
|
|
31
|
+
if (!this.options.enabled) {
|
|
55
32
|
return undefined;
|
|
56
33
|
}
|
|
57
|
-
this.clear();
|
|
34
|
+
await this.clear();
|
|
58
35
|
const filePath = this.buildFilePath(undefined, sourceFilesSize);
|
|
59
36
|
try {
|
|
60
|
-
const
|
|
61
|
-
const content = buffer.toString('utf-8');
|
|
37
|
+
const content = await node_fs_1.default.promises.readFile(filePath, { encoding: 'utf-8' });
|
|
62
38
|
// todo: maybe add shape validation here :)
|
|
63
39
|
const cache = JSON.parse(content);
|
|
64
|
-
if (
|
|
40
|
+
if (!cache || cache.sourceFilesSize !== sourceFilesSize) {
|
|
65
41
|
return undefined;
|
|
66
42
|
}
|
|
67
43
|
return cache;
|
|
@@ -76,26 +52,32 @@ class CacheDriver {
|
|
|
76
52
|
* At a 10% chance, clear all cache files :)
|
|
77
53
|
*/
|
|
78
54
|
/* istanbul ignore next */
|
|
79
|
-
clear() {
|
|
80
|
-
if (!this.
|
|
55
|
+
async clear() {
|
|
56
|
+
if (!this.options.enabled || !this.options.clearAtRandom) {
|
|
81
57
|
return;
|
|
82
58
|
}
|
|
83
59
|
const rand = Math.floor(Math.random() * 100) + 1;
|
|
84
60
|
if (rand > 10) {
|
|
85
61
|
return;
|
|
86
62
|
}
|
|
87
|
-
const files =
|
|
88
|
-
|
|
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);
|
|
89
71
|
}
|
|
90
72
|
// -------------------------------------------------------------------------
|
|
91
73
|
buildFilePath(hash, sourceFilesSize) {
|
|
92
|
-
return
|
|
74
|
+
return node_path_1.default.join(this.options.directoryPath, this.buildFileName(hash, sourceFilesSize));
|
|
93
75
|
}
|
|
94
76
|
buildFileName(hash, sourceFilesSize) {
|
|
95
|
-
if (typeof this.
|
|
96
|
-
return this.
|
|
77
|
+
if (typeof this.options.fileName === 'string') {
|
|
78
|
+
return this.options.fileName;
|
|
97
79
|
}
|
|
98
|
-
return `.swagger-${hash
|
|
80
|
+
return `.swagger-${hash ?? (0, utils_1.generateFileHash)(sourceFilesSize)}.json`;
|
|
99
81
|
}
|
|
100
82
|
}
|
|
101
83
|
exports.CacheDriver = CacheDriver;
|
package/dist/cache/driver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../src/cache/driver.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
1
|
+
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../src/cache/driver.ts"],"names":[],"mappings":"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"}
|
package/dist/cache/type.d.ts
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
clearAtRandom: boolean;
|
|
29
|
-
}
|
|
30
|
-
type Data = {
|
|
31
|
-
sourceFilesSize: number;
|
|
32
|
-
} & GeneratorOutput;
|
|
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;
|
|
33
28
|
}
|
|
29
|
+
export type CacheOptionsInput = Partial<CacheOptions>;
|
|
30
|
+
export type CacheData = {
|
|
31
|
+
sourceFilesSize: number;
|
|
32
|
+
} & Metadata;
|
|
34
33
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/cache/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/cache/type.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/cache/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,YAAY;IACzB;;;;SAIK;IACL,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,aAAa,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEtD,MAAM,MAAM,SAAS,GAAG;IACpB,eAAe,EAAE,MAAM,CAAC;CAC3B,GAAG,QAAQ,CAAC"}
|
package/dist/cache/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/cache/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/cache/utils.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE9D,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,iBAAiB,GAAI,YAAY,CAgC7F;AAED,wBAAgB,gBAAgB,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAQjE"}
|
package/dist/cache/utils.js
CHANGED
|
@@ -9,40 +9,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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 = {
|
|
19
20
|
enabled: true,
|
|
20
|
-
directoryPath:
|
|
21
|
+
directoryPath: input,
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
|
-
if (typeof
|
|
24
|
-
|
|
25
|
-
enabled:
|
|
24
|
+
if (typeof input === 'boolean') {
|
|
25
|
+
input = {
|
|
26
|
+
enabled: input,
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
input = input || {};
|
|
29
30
|
/* istanbul ignore next */
|
|
30
|
-
const isTestEnvironment = !!
|
|
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
|
+
}
|
|
31
38
|
return {
|
|
32
|
-
fileName:
|
|
33
|
-
directoryPath
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
enabled: (_a = config.enabled) !== null && _a !== void 0 ? _a : false,
|
|
37
|
-
clearAtRandom: (_b = config.clearAtRandom) !== null && _b !== void 0 ? _b : !isTestEnvironment,
|
|
39
|
+
fileName: input.fileName,
|
|
40
|
+
directoryPath,
|
|
41
|
+
enabled: input.enabled ?? true,
|
|
42
|
+
clearAtRandom: input.clearAtRandom ?? !isTestEnvironment,
|
|
38
43
|
};
|
|
39
44
|
}
|
|
40
|
-
exports.
|
|
41
|
-
function
|
|
42
|
-
const hash =
|
|
43
|
-
const strSize = (sourceFilesSize
|
|
45
|
+
exports.buildCacheOptions = buildCacheOptions;
|
|
46
|
+
function generateFileHash(sourceFilesSize) {
|
|
47
|
+
const hash = node_crypto_1.default.createHash('sha256');
|
|
48
|
+
const strSize = (sourceFilesSize ?? 0).toString();
|
|
44
49
|
hash.update(strSize);
|
|
45
50
|
return hash.digest('hex');
|
|
46
51
|
}
|
|
47
|
-
exports.
|
|
52
|
+
exports.generateFileHash = generateFileHash;
|
|
48
53
|
//# sourceMappingURL=utils.js.map
|
package/dist/cache/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/cache/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/cache/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,qCAAiC;AACjC,0DAA6B;AAC7B,8DAAiC;AACjC,gEAAmC;AAGnC,SAAgB,iBAAiB,CAAC,KAA4C;IAC1E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,KAAK,GAAG;YACJ,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,KAAK;SACvB,CAAC;KACL;IAED,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;QAC5B,KAAK,GAAG;YACJ,OAAO,EAAE,KAAK;SACjB,CAAC;KACL;IAED,KAAK,GAAG,KAAK,IAAI,EAAE,CAAC;IAEpB,0BAA0B;IAC1B,MAAM,iBAAiB,GAAa,CAAC,CAAC,sBAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,sBAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC;IAE9F,IAAI,aAAa,GAAG,IAAA,gBAAM,GAAE,CAAC;IAC7B,IAAI,OAAO,KAAK,CAAC,aAAa,KAAK,QAAQ,EAAE;QACzC,aAAa,GAAG,mBAAI,CAAC,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;YAClD,KAAK,CAAC,aAAa,CAAC,CAAC;YACrB,mBAAI,CAAC,IAAI,CAAC,sBAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;KACrD;IAED,OAAO;QACH,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,aAAa;QACb,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI;QAC9B,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,CAAC,iBAAiB;KAC3D,CAAC;AACN,CAAC;AAhCD,8CAgCC;AAED,SAAgB,gBAAgB,CAAC,eAAwB;IACrD,MAAM,IAAI,GAAG,qBAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAEzC,MAAM,OAAO,GAAW,CAAC,eAAe,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE1D,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AARD,4CAQC"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './type';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/config/index.js
CHANGED
|
@@ -20,5 +20,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
20
20
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./
|
|
23
|
+
__exportStar(require("./type"), exports);
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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
|
+
}
|
|
37
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/config/type.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAA;CAClB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,iBAAiB,GAAG,iBAAiB,EAAE,CAAC;AAErF,MAAM,WAAW,OAAO;IACpB;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAEjD;;OAEG;IACH,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAE/B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +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 });
|
|
9
|
+
//# sourceMappingURL=type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/config/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare enum DecoratorID {
|
|
2
|
+
SWAGGER_TAGS = "swaggerTags",
|
|
3
|
+
CLASS_PATH = "classPath",
|
|
4
|
+
RESPONSE_DESCRIPTION = "responseDescription",
|
|
5
|
+
RESPONSE_EXAMPLE = "responseExample",
|
|
6
|
+
RESPONSE_PRODUCES = "responseProduces",
|
|
7
|
+
REQUEST_ACCEPT = "requestAccept",
|
|
8
|
+
REQUEST_CONSUMES = "requestConsumes",
|
|
9
|
+
DEPRECATED = "deprecated",
|
|
10
|
+
EXTENSION = "extension",
|
|
11
|
+
HIDDEN = "hidden",
|
|
12
|
+
METHOD_PATH = "methodPath",
|
|
13
|
+
ALL = "all",
|
|
14
|
+
GET = "get",
|
|
15
|
+
POST = "post",
|
|
16
|
+
PUT = "put",
|
|
17
|
+
DELETE = "delete",
|
|
18
|
+
PATCH = "patch",
|
|
19
|
+
OPTIONS = "options",
|
|
20
|
+
HEAD = "head",
|
|
21
|
+
IS_INT = "isInt",
|
|
22
|
+
IS_LONG = "isLong",
|
|
23
|
+
IS_FLOAT = "isFloat",
|
|
24
|
+
IS_DOUBLE = "isDouble",
|
|
25
|
+
CONTEXT = "context",
|
|
26
|
+
PARAM = "param",
|
|
27
|
+
PARAMS = "params",
|
|
28
|
+
QUERY = "query",
|
|
29
|
+
FORM = "form",
|
|
30
|
+
BODY = "body",
|
|
31
|
+
HEADER = "header",
|
|
32
|
+
HEADERS = "headers",
|
|
33
|
+
COOKIE = "cookie",
|
|
34
|
+
COOKIES = "cookies",
|
|
35
|
+
PATH_PARAM = "pathParam",
|
|
36
|
+
PATH_PARAMS = "pathParams",
|
|
37
|
+
FILE_PARAM = "fileParam",
|
|
38
|
+
FILES_PARAM = "filesParam"
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/decorator/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,WAAW;IACnB,YAAY,gBAAgB;IAC5B,UAAU,cAAc;IAExB,oBAAoB,wBAAwB;IAC5C,gBAAgB,oBAAoB;IACpC,iBAAiB,qBAAqB;IAEtC,cAAc,kBAAkB;IAChC,gBAAgB,oBAAoB;IAEpC,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;IAEjB,WAAW,eAAe;IAE1B,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IAGb,MAAM,UAAU;IAChB,OAAO,WAAW;IAClB,QAAQ,YAAY;IACpB,SAAS,aAAa;IAGtB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,UAAU,cAAc;IACxB,WAAW,eAAe;IAC1B,UAAU,cAAc;IACxB,WAAW,eAAe;CAC7B"}
|