@trapi/swagger 1.0.0-alpha.8 → 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/config/index.d.ts +2 -2
- package/dist/config/index.js +24 -24
- package/dist/config/type.d.ts +82 -82
- package/dist/config/type.js +8 -8
- package/dist/config/utils.d.ts +2 -2
- package/dist/config/utils.js +53 -53
- package/dist/constants.d.ts +14 -14
- package/dist/constants.js +26 -26
- package/dist/constants.js.map +1 -1
- package/dist/generator/abstract.d.ts +34 -28
- package/dist/generator/abstract.d.ts.map +1 -1
- package/dist/generator/abstract.js +251 -249
- package/dist/generator/abstract.js.map +1 -1
- package/dist/generator/index.d.ts +4 -4
- package/dist/generator/index.js +26 -26
- package/dist/generator/module.d.ts +13 -13
- package/dist/generator/module.js +34 -34
- package/dist/generator/v2/index.d.ts +1 -1
- package/dist/generator/v2/index.js +23 -23
- package/dist/generator/v2/module.d.ts +24 -25
- package/dist/generator/v2/module.d.ts.map +1 -1
- package/dist/generator/v2/module.js +516 -484
- package/dist/generator/v2/module.js.map +1 -1
- package/dist/generator/v3/index.d.ts +1 -1
- package/dist/generator/v3/index.js +23 -23
- package/dist/generator/v3/module.d.ts +29 -29
- package/dist/generator/v3/module.d.ts.map +1 -1
- package/dist/generator/v3/module.js +498 -462
- package/dist/generator/v3/module.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +29 -29
- package/dist/metadata.d.ts +3 -3
- package/dist/metadata.js +13 -13
- package/dist/schema/constants.d.ts +27 -6
- package/dist/schema/constants.d.ts.map +1 -1
- package/dist/schema/constants.js +39 -16
- package/dist/schema/constants.js.map +1 -1
- package/dist/schema/index.d.ts +4 -4
- package/dist/schema/index.js +26 -26
- package/dist/schema/type.d.ts +138 -139
- package/dist/schema/type.d.ts.map +1 -1
- package/dist/schema/type.js +8 -8
- package/dist/schema/v2/constants.d.ts +7 -7
- package/dist/schema/v2/constants.js +17 -17
- package/dist/schema/v2/constants.js.map +1 -1
- package/dist/schema/v2/index.d.ts +2 -2
- package/dist/schema/v2/index.js +24 -24
- package/dist/schema/v2/type.d.ts +115 -115
- package/dist/schema/v2/type.d.ts.map +1 -1
- package/dist/schema/v2/type.js +8 -8
- package/dist/schema/v3/constants.d.ts +6 -6
- package/dist/schema/v3/constants.js +16 -16
- package/dist/schema/v3/constants.js.map +1 -1
- package/dist/schema/v3/index.d.ts +2 -2
- package/dist/schema/v3/index.js +24 -24
- package/dist/schema/v3/type.d.ts +158 -157
- package/dist/schema/v3/type.d.ts.map +1 -1
- package/dist/schema/v3/type.js +8 -8
- package/dist/type.d.ts +48 -48
- package/dist/type.js +8 -8
- package/dist/utils/character.d.ts +2 -2
- package/dist/utils/character.js +20 -20
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/index.js +26 -26
- package/dist/utils/object.d.ts +1 -1
- package/dist/utils/object.js +14 -14
- package/dist/utils/path.d.ts +1 -1
- package/dist/utils/path.js +20 -20
- package/dist/utils/value.d.ts +1 -1
- package/dist/utils/value.js +25 -25
- package/package.json +8 -8
package/dist/config/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './type';
|
|
2
|
-
export * from './utils';
|
|
1
|
+
export * from './type';
|
|
2
|
+
export * from './utils';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/config/index.js
CHANGED
|
@@ -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("./type"), exports);
|
|
24
|
-
__exportStar(require("./utils"), 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("./type"), exports);
|
|
24
|
+
__exportStar(require("./utils"), exports);
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
package/dist/config/type.d.ts
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import type { CollectionFormat, Metadata, Options as MetadataOptions } from '@trapi/metadata';
|
|
2
|
-
import type { SecurityDefinitions } from '../type';
|
|
3
|
-
export type ServerOption = {
|
|
4
|
-
url: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
};
|
|
7
|
-
export interface Options {
|
|
8
|
-
/**
|
|
9
|
-
* Generate a yaml file
|
|
10
|
-
*/
|
|
11
|
-
yaml?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Specify if an output file should be generated.
|
|
14
|
-
*
|
|
15
|
-
* default: true
|
|
16
|
-
*/
|
|
17
|
-
output: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Generated swagger.{json|yaml} will output here.
|
|
20
|
-
*
|
|
21
|
-
* default: process.cwd()
|
|
22
|
-
*/
|
|
23
|
-
outputDirectory: string;
|
|
24
|
-
/**
|
|
25
|
-
* Generated documentation base file name.
|
|
26
|
-
*
|
|
27
|
-
* default: swagger
|
|
28
|
-
*/
|
|
29
|
-
outputFileName: string;
|
|
30
|
-
/**
|
|
31
|
-
* API host, expressTemplate.g. localhost:3000 or https://myapi.com
|
|
32
|
-
*/
|
|
33
|
-
servers?: ServerOption[];
|
|
34
|
-
/**
|
|
35
|
-
* Metadata options or metadata itself.
|
|
36
|
-
*/
|
|
37
|
-
metadata?: MetadataOptions | Metadata;
|
|
38
|
-
/**
|
|
39
|
-
* API version number; defaults to npm package version
|
|
40
|
-
*/
|
|
41
|
-
version?: string;
|
|
42
|
-
/**
|
|
43
|
-
* API name; defaults to npm package name
|
|
44
|
-
*/
|
|
45
|
-
name?: string;
|
|
46
|
-
/**
|
|
47
|
-
* 'API description; defaults to npm package description
|
|
48
|
-
*/
|
|
49
|
-
description?: string;
|
|
50
|
-
/**
|
|
51
|
-
* API license; defaults to npm package license
|
|
52
|
-
*/
|
|
53
|
-
license?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Extend generated swagger spec with this object
|
|
56
|
-
* Note that generated properties will always take precedence over what get specified here
|
|
57
|
-
*/
|
|
58
|
-
specificationExtra?: Record<string, any>;
|
|
59
|
-
/**
|
|
60
|
-
* Security Definitions Object
|
|
61
|
-
* A declaration of the security schemes available to be used in the
|
|
62
|
-
* specification. This does not enforce the security schemes on the operations
|
|
63
|
-
* and only serves to provide the relevant details for each scheme.
|
|
64
|
-
*/
|
|
65
|
-
securityDefinitions?: SecurityDefinitions;
|
|
66
|
-
/**
|
|
67
|
-
* Default consumes property for the entire API
|
|
68
|
-
*/
|
|
69
|
-
consumes?: string[];
|
|
70
|
-
/**
|
|
71
|
-
* Default produces property for the entire API
|
|
72
|
-
*/
|
|
73
|
-
produces?: string[];
|
|
74
|
-
/**
|
|
75
|
-
* Default collectionFormat property for query parameters of array type.
|
|
76
|
-
* Possible values are `csv`, `ssv`, `tsv`, `pipes`, `multi`. If not specified, Swagger defaults to `csv`.
|
|
77
|
-
*/
|
|
78
|
-
collectionFormat?: `${CollectionFormat}`;
|
|
79
|
-
}
|
|
80
|
-
export type OptionsInput = Omit<Partial<Options>, 'servers'> & {
|
|
81
|
-
servers?: string | string[] | ServerOption | ServerOption[];
|
|
82
|
-
};
|
|
1
|
+
import type { CollectionFormat, Metadata, Options as MetadataOptions } from '@trapi/metadata';
|
|
2
|
+
import type { SecurityDefinitions } from '../type';
|
|
3
|
+
export type ServerOption = {
|
|
4
|
+
url: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
};
|
|
7
|
+
export interface Options {
|
|
8
|
+
/**
|
|
9
|
+
* Generate a yaml file
|
|
10
|
+
*/
|
|
11
|
+
yaml?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Specify if an output file should be generated.
|
|
14
|
+
*
|
|
15
|
+
* default: true
|
|
16
|
+
*/
|
|
17
|
+
output: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Generated swagger.{json|yaml} will output here.
|
|
20
|
+
*
|
|
21
|
+
* default: process.cwd()
|
|
22
|
+
*/
|
|
23
|
+
outputDirectory: string;
|
|
24
|
+
/**
|
|
25
|
+
* Generated documentation base file name.
|
|
26
|
+
*
|
|
27
|
+
* default: swagger
|
|
28
|
+
*/
|
|
29
|
+
outputFileName: string;
|
|
30
|
+
/**
|
|
31
|
+
* API host, expressTemplate.g. localhost:3000 or https://myapi.com
|
|
32
|
+
*/
|
|
33
|
+
servers?: ServerOption[];
|
|
34
|
+
/**
|
|
35
|
+
* Metadata options or metadata itself.
|
|
36
|
+
*/
|
|
37
|
+
metadata?: MetadataOptions | Metadata;
|
|
38
|
+
/**
|
|
39
|
+
* API version number; defaults to npm package version
|
|
40
|
+
*/
|
|
41
|
+
version?: string;
|
|
42
|
+
/**
|
|
43
|
+
* API name; defaults to npm package name
|
|
44
|
+
*/
|
|
45
|
+
name?: string;
|
|
46
|
+
/**
|
|
47
|
+
* 'API description; defaults to npm package description
|
|
48
|
+
*/
|
|
49
|
+
description?: string;
|
|
50
|
+
/**
|
|
51
|
+
* API license; defaults to npm package license
|
|
52
|
+
*/
|
|
53
|
+
license?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Extend generated swagger spec with this object
|
|
56
|
+
* Note that generated properties will always take precedence over what get specified here
|
|
57
|
+
*/
|
|
58
|
+
specificationExtra?: Record<string, any>;
|
|
59
|
+
/**
|
|
60
|
+
* Security Definitions Object
|
|
61
|
+
* A declaration of the security schemes available to be used in the
|
|
62
|
+
* specification. This does not enforce the security schemes on the operations
|
|
63
|
+
* and only serves to provide the relevant details for each scheme.
|
|
64
|
+
*/
|
|
65
|
+
securityDefinitions?: SecurityDefinitions;
|
|
66
|
+
/**
|
|
67
|
+
* Default consumes property for the entire API
|
|
68
|
+
*/
|
|
69
|
+
consumes?: string[];
|
|
70
|
+
/**
|
|
71
|
+
* Default produces property for the entire API
|
|
72
|
+
*/
|
|
73
|
+
produces?: string[];
|
|
74
|
+
/**
|
|
75
|
+
* Default collectionFormat property for query parameters of array type.
|
|
76
|
+
* Possible values are `csv`, `ssv`, `tsv`, `pipes`, `multi`. If not specified, Swagger defaults to `csv`.
|
|
77
|
+
*/
|
|
78
|
+
collectionFormat?: `${CollectionFormat}`;
|
|
79
|
+
}
|
|
80
|
+
export type OptionsInput = Omit<Partial<Options>, 'servers'> & {
|
|
81
|
+
servers?: string | string[] | ServerOption | ServerOption[];
|
|
82
|
+
};
|
|
83
83
|
//# 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
|
package/dist/config/utils.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Options, OptionsInput } from './type';
|
|
2
|
-
export declare function buildOptions(input: OptionsInput): Options;
|
|
1
|
+
import type { Options, OptionsInput } from './type';
|
|
2
|
+
export declare function buildOptions(input: OptionsInput): Options;
|
|
3
3
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/config/utils.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.buildOptions = void 0;
|
|
13
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
-
const node_process_1 = __importDefault(require("node:process"));
|
|
15
|
-
function buildOptions(input) {
|
|
16
|
-
const servers = [];
|
|
17
|
-
if (input.servers) {
|
|
18
|
-
if (Array.isArray(input.servers)) {
|
|
19
|
-
for (let i = 0; i < input.servers.length; i++) {
|
|
20
|
-
const server = input.servers[i];
|
|
21
|
-
if (typeof server === 'string') {
|
|
22
|
-
servers.push({ url: server });
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
servers.push(server);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else if (typeof input.servers === 'string') {
|
|
30
|
-
servers.push({ url: input.servers });
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
servers.push(input.servers);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
let outputDirectory;
|
|
37
|
-
if (input.outputDirectory) {
|
|
38
|
-
outputDirectory = node_path_1.default.isAbsolute(input.outputDirectory) ?
|
|
39
|
-
input.outputDirectory :
|
|
40
|
-
node_path_1.default.join(node_process_1.default.cwd(), input.outputDirectory);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
outputDirectory = node_process_1.default.cwd();
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
...input,
|
|
47
|
-
output: input.output ?? true,
|
|
48
|
-
outputDirectory,
|
|
49
|
-
outputFileName: input.outputFileName || 'swagger',
|
|
50
|
-
servers,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
exports.buildOptions = buildOptions;
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.buildOptions = void 0;
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
15
|
+
function buildOptions(input) {
|
|
16
|
+
const servers = [];
|
|
17
|
+
if (input.servers) {
|
|
18
|
+
if (Array.isArray(input.servers)) {
|
|
19
|
+
for (let i = 0; i < input.servers.length; i++) {
|
|
20
|
+
const server = input.servers[i];
|
|
21
|
+
if (typeof server === 'string') {
|
|
22
|
+
servers.push({ url: server });
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
servers.push(server);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else if (typeof input.servers === 'string') {
|
|
30
|
+
servers.push({ url: input.servers });
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
servers.push(input.servers);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
let outputDirectory;
|
|
37
|
+
if (input.outputDirectory) {
|
|
38
|
+
outputDirectory = node_path_1.default.isAbsolute(input.outputDirectory) ?
|
|
39
|
+
input.outputDirectory :
|
|
40
|
+
node_path_1.default.join(node_process_1.default.cwd(), input.outputDirectory);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
outputDirectory = node_process_1.default.cwd();
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
...input,
|
|
47
|
+
output: input.output ?? true,
|
|
48
|
+
outputDirectory,
|
|
49
|
+
outputFileName: input.outputFileName || 'swagger',
|
|
50
|
+
servers,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
exports.buildOptions = buildOptions;
|
|
54
54
|
//# sourceMappingURL=utils.js.map
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare enum Version {
|
|
2
|
-
V2 = "
|
|
3
|
-
V3 = "
|
|
4
|
-
}
|
|
5
|
-
export declare enum DocumentFormat {
|
|
6
|
-
YAML = "yaml",
|
|
7
|
-
JSON = "json"
|
|
8
|
-
}
|
|
9
|
-
export declare enum SecurityType {
|
|
10
|
-
API_KEY = "apiKey",
|
|
11
|
-
BASIC = "basic",
|
|
12
|
-
HTTP = "http",
|
|
13
|
-
OAUTH2 = "oauth2"
|
|
14
|
-
}
|
|
1
|
+
export declare enum Version {
|
|
2
|
+
V2 = "v2",
|
|
3
|
+
V3 = "v3"
|
|
4
|
+
}
|
|
5
|
+
export declare enum DocumentFormat {
|
|
6
|
+
YAML = "yaml",
|
|
7
|
+
JSON = "json"
|
|
8
|
+
}
|
|
9
|
+
export declare enum SecurityType {
|
|
10
|
+
API_KEY = "apiKey",
|
|
11
|
+
BASIC = "basic",
|
|
12
|
+
HTTP = "http",
|
|
13
|
+
OAUTH2 = "oauth2"
|
|
14
|
+
}
|
|
15
15
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
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.SecurityType = exports.DocumentFormat = exports.Version = void 0;
|
|
10
|
-
var Version;
|
|
11
|
-
(function (Version) {
|
|
12
|
-
Version["V2"] = "
|
|
13
|
-
Version["V3"] = "
|
|
14
|
-
})(Version
|
|
15
|
-
var DocumentFormat;
|
|
16
|
-
(function (DocumentFormat) {
|
|
17
|
-
DocumentFormat["YAML"] = "yaml";
|
|
18
|
-
DocumentFormat["JSON"] = "json";
|
|
19
|
-
})(DocumentFormat
|
|
20
|
-
var SecurityType;
|
|
21
|
-
(function (SecurityType) {
|
|
22
|
-
SecurityType["API_KEY"] = "apiKey";
|
|
23
|
-
SecurityType["BASIC"] = "basic";
|
|
24
|
-
SecurityType["HTTP"] = "http";
|
|
25
|
-
SecurityType["OAUTH2"] = "oauth2";
|
|
26
|
-
})(SecurityType
|
|
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.SecurityType = exports.DocumentFormat = exports.Version = void 0;
|
|
10
|
+
var Version;
|
|
11
|
+
(function (Version) {
|
|
12
|
+
Version["V2"] = "v2";
|
|
13
|
+
Version["V3"] = "v3";
|
|
14
|
+
})(Version || (exports.Version = Version = {}));
|
|
15
|
+
var DocumentFormat;
|
|
16
|
+
(function (DocumentFormat) {
|
|
17
|
+
DocumentFormat["YAML"] = "yaml";
|
|
18
|
+
DocumentFormat["JSON"] = "json";
|
|
19
|
+
})(DocumentFormat || (exports.DocumentFormat = DocumentFormat = {}));
|
|
20
|
+
var SecurityType;
|
|
21
|
+
(function (SecurityType) {
|
|
22
|
+
SecurityType["API_KEY"] = "apiKey";
|
|
23
|
+
SecurityType["BASIC"] = "basic";
|
|
24
|
+
SecurityType["HTTP"] = "http";
|
|
25
|
+
SecurityType["OAUTH2"] = "oauth2";
|
|
26
|
+
})(SecurityType || (exports.SecurityType = SecurityType = {}));
|
|
27
27
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,oBAAS,CAAA;IACT,oBAAS,CAAA;AACb,CAAC,EAHW,OAAO,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,oBAAS,CAAA;IACT,oBAAS,CAAA;AACb,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACjB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,kCAAkB,CAAA;IAClB,+BAAe,CAAA;IACf,6BAAa,CAAA;IACb,iCAAiB,CAAA;AACrB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB"}
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
import type { BaseType, EnumType, IntersectionType, Metadata, NestedObjectLiteralType, Parameter, ParameterSource, ReferenceType, ResolverProperty, UnionType, Validators, VariableType } from '@trapi/metadata';
|
|
2
|
-
import type { Options, OptionsInput } from '../config';
|
|
3
|
-
import type { DocumentFormat } from '../constants';
|
|
4
|
-
import type { DocumentFormatData } from '../type';
|
|
5
|
-
import type { BaseSchema, Info, SchemaV2, SchemaV3, SpecV2, SpecV3 } from '../schema';
|
|
6
|
-
export declare abstract class AbstractSpecGenerator<Spec extends SpecV2 | SpecV3, Schema extends SchemaV3 | SchemaV2> {
|
|
7
|
-
protected spec: Spec | undefined;
|
|
8
|
-
protected readonly metadata: Metadata;
|
|
9
|
-
protected readonly config: Options;
|
|
10
|
-
constructor(metadata: Metadata, config: OptionsInput);
|
|
11
|
-
save(): Promise<Record<`${DocumentFormat}`, DocumentFormatData>>;
|
|
12
|
-
abstract build(): Promise<Spec>;
|
|
13
|
-
protected buildInfo(): Info;
|
|
14
|
-
protected
|
|
15
|
-
protected abstract
|
|
16
|
-
protected abstract
|
|
17
|
-
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
protected abstract
|
|
22
|
-
protected abstract
|
|
23
|
-
protected
|
|
24
|
-
protected
|
|
25
|
-
protected
|
|
26
|
-
protected
|
|
27
|
-
protected
|
|
28
|
-
|
|
1
|
+
import type { BaseType, EnumType, Extension, IntersectionType, Metadata, NestedObjectLiteralType, Parameter, ParameterSource, RefAliasType, RefEnumType, RefObjectType, ReferenceType, ResolverProperty, UnionType, Validators, VariableType } from '@trapi/metadata';
|
|
2
|
+
import type { Options, OptionsInput } from '../config';
|
|
3
|
+
import type { DocumentFormat } from '../constants';
|
|
4
|
+
import type { DocumentFormatData } from '../type';
|
|
5
|
+
import type { BaseSchema, Info, SchemaV2, SchemaV3, SpecV2, SpecV3 } from '../schema';
|
|
6
|
+
export declare abstract class AbstractSpecGenerator<Spec extends SpecV2 | SpecV3, Schema extends SchemaV3 | SchemaV2> {
|
|
7
|
+
protected spec: Spec | undefined;
|
|
8
|
+
protected readonly metadata: Metadata;
|
|
9
|
+
protected readonly config: Options;
|
|
10
|
+
constructor(metadata: Metadata, config: OptionsInput);
|
|
11
|
+
save(): Promise<Record<`${DocumentFormat}`, DocumentFormatData>>;
|
|
12
|
+
abstract build(): Promise<Spec>;
|
|
13
|
+
protected buildInfo(): Info;
|
|
14
|
+
protected getSchemaForType(type: BaseType): Schema | BaseSchema<Schema>;
|
|
15
|
+
protected abstract getSchemaForIntersectionType(type: IntersectionType): Schema;
|
|
16
|
+
protected abstract getSchemaForEnumType(enumType: EnumType): Schema;
|
|
17
|
+
private getSchemaForPrimitiveType;
|
|
18
|
+
private getSchemaForArrayType;
|
|
19
|
+
getSchemaForObjectLiteralType(objectLiteral: NestedObjectLiteralType): BaseSchema<Schema>;
|
|
20
|
+
protected abstract getSchemaForReferenceType(referenceType: ReferenceType): Schema;
|
|
21
|
+
protected abstract getSchemaForUnionType(type: UnionType): Schema;
|
|
22
|
+
protected abstract buildSchemaForRefAlias(referenceType: RefAliasType): Schema;
|
|
23
|
+
protected abstract buildSchemaForRefEnum(referenceType: RefEnumType): Schema;
|
|
24
|
+
protected abstract buildSchemaForRefObject(referenceType: RefObjectType): Schema;
|
|
25
|
+
protected buildSchemasForReferenceTypes(extendFn?: (output: Schema, input: ReferenceType) => void): Record<string, Schema>;
|
|
26
|
+
protected isUndefinedProperty(input: ResolverProperty): boolean;
|
|
27
|
+
protected abstract buildProperties(properties: ResolverProperty[]): Record<string, Schema>;
|
|
28
|
+
protected determineTypesUsedInEnum(anEnum: Array<string | number | boolean | null>): VariableType[];
|
|
29
|
+
protected decideEnumType(input: Array<string | number | boolean>): 'string' | 'number' | 'boolean';
|
|
30
|
+
protected getOperationId(name: string): string;
|
|
31
|
+
protected groupParameters(items: Parameter[]): Partial<Record<ParameterSource, Parameter[]>>;
|
|
32
|
+
protected transformExtensions(input?: Extension[]): Record<string, any>;
|
|
33
|
+
protected transformValidators(input?: Validators): Record<string, any>;
|
|
34
|
+
}
|
|
29
35
|
//# sourceMappingURL=abstract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../src/generator/abstract.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAER,QAAQ,EACR,QAAQ,
|
|
1
|
+
{"version":3,"file":"abstract.d.ts","sourceRoot":"","sources":["../../src/generator/abstract.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAER,QAAQ,EACR,QAAQ,EAAE,SAAS,EACnB,gBAAgB,EAChB,QAAQ,EACR,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,YAAY,EAAE,WAAW,EACzB,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAChB,SAAS,EACT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