ts-openapi-codegen 1.0.0-beta.5 → 1.0.0-beta.6
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/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts +5 -0
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts.map +1 -0
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.js +40 -0
- package/dist/cli/index.js +46 -5
- package/dist/cli/utils.d.ts +5 -0
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js +22 -0
- package/dist/common/UpdateNotifier.d.ts +24 -0
- package/dist/common/UpdateNotifier.d.ts.map +1 -0
- package/dist/common/UpdateNotifier.js +120 -0
- package/dist/core/{utils/writeClient.d.ts → WriteClient.d.ts} +13 -6
- package/dist/core/WriteClient.d.ts.map +1 -0
- package/dist/core/{utils/writeClient.js → WriteClient.js} +69 -78
- package/dist/core/__tests__/WriteClient.test.d.ts +2 -0
- package/dist/core/__tests__/WriteClient.test.d.ts.map +1 -0
- package/dist/core/{utils/__tests__/writeClient.test.js → __tests__/WriteClient.test.js} +5 -5
- package/dist/core/index.js +2 -2
- package/dist/core/utils/prepareAlias.d.ts +7 -0
- package/dist/core/utils/prepareAlias.d.ts.map +1 -0
- package/dist/core/utils/prepareAlias.js +24 -0
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.js +2 -0
- package/dist/core/utils/sortModelByName.d.ts +3 -0
- package/dist/core/utils/sortModelByName.d.ts.map +1 -0
- package/dist/core/utils/sortModelByName.js +12 -0
- package/dist/templatesCompiled/partials/isReadOnly.d.ts +1 -1
- package/dist/templatesCompiled/partials/isReadOnly.d.ts.map +1 -1
- package/dist/templatesCompiled/partials/isReadOnly.js +1 -2
- package/dist/templatesCompiled/partials/isRequiredDefinition.d.ts +9 -0
- package/dist/templatesCompiled/partials/isRequiredDefinition.d.ts.map +1 -0
- package/dist/templatesCompiled/partials/isRequiredDefinition.js +27 -0
- package/dist/templatesCompiled/partials/parametersDefinition.js +1 -1
- package/package.json +9 -1
- package/dist/core/utils/__tests__/writeClient.test.d.ts +0 -2
- package/dist/core/utils/__tests__/writeClient.test.d.ts.map +0 -1
- package/dist/core/utils/writeClient.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chekOpenApiConfig.d.ts","sourceRoot":"","sources":["../../../src/cli/chekOpenApiConfig/chekOpenApiConfig.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,iBAAiB,SA4BhC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chekOpenApiConfig = chekOpenApiConfig;
|
|
4
|
+
const Enums_1 = require("../../common/Enums");
|
|
5
|
+
const Logger_1 = require("../../common/Logger");
|
|
6
|
+
const Utils_1 = require("../../common/Utils");
|
|
7
|
+
const MultiOptionsVersionedSchemas_1 = require("../../common/VersionedSchema/MultiOptionsVersionedSchemas");
|
|
8
|
+
const OptionsVersionedSchemas_1 = require("../../common/VersionedSchema/OptionsVersionedSchemas");
|
|
9
|
+
const getErrorFieldsFromValidation_1 = require("../../common/VersionedSchema/Utils/getErrorFieldsFromValidation");
|
|
10
|
+
const isInstanceOfMultiOptions_1 = require("../../core/utils/isInstanceOfMultiOptions");
|
|
11
|
+
/**
|
|
12
|
+
* The function checks whether the configuration file data is filled in correctly
|
|
13
|
+
*/
|
|
14
|
+
function chekOpenApiConfig() {
|
|
15
|
+
const logger = new Logger_1.Logger({
|
|
16
|
+
level: Enums_1.ELogLevel.INFO,
|
|
17
|
+
instanceId: 'check-openapi-config',
|
|
18
|
+
logOutput: Enums_1.ELogOutput.CONSOLE,
|
|
19
|
+
});
|
|
20
|
+
try {
|
|
21
|
+
const configData = (0, Utils_1.loadConfigIfExists)();
|
|
22
|
+
if (!configData) {
|
|
23
|
+
logger.error('The configuration file is missing');
|
|
24
|
+
}
|
|
25
|
+
const preparedOptions = (0, Utils_1.convertArrayToObject)(configData);
|
|
26
|
+
const isMultiOptions = (0, isInstanceOfMultiOptions_1.isInstanceOfMultioptions)(preparedOptions);
|
|
27
|
+
const currentMigrationPlan = isMultiOptions ? MultiOptionsVersionedSchemas_1.multiOptionsVersionedSchema : OptionsVersionedSchemas_1.optionsVersionedSchemas;
|
|
28
|
+
const currentSchema = currentMigrationPlan
|
|
29
|
+
.map((sch, idx) => ({ ...sch, index: idx + 1 }))
|
|
30
|
+
.reduce((prev, curr) => (curr.index > prev.index ? curr : prev));
|
|
31
|
+
const { error } = currentSchema.schema.validate(preparedOptions);
|
|
32
|
+
if (error) {
|
|
33
|
+
const details = (0, getErrorFieldsFromValidation_1.getErrorFieldsFromValidation)(error).map((e) => `${e.path}: ${e.type}`).join(',');
|
|
34
|
+
logger.error(`The configuration file data is specified incorrectly: ${details}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
logger.error(error.message);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const commander_1 = require("commander");
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
4
9
|
const Enums_1 = require("../common/Enums");
|
|
10
|
+
const Logger_1 = require("../common/Logger");
|
|
11
|
+
const UpdateNotifier_1 = require("../common/UpdateNotifier");
|
|
5
12
|
const Enums_2 = require("../core/types/Enums");
|
|
13
|
+
const chekOpenApiConfig_1 = require("./chekOpenApiConfig/chekOpenApiConfig");
|
|
6
14
|
const runGenerateOpenApi_1 = require("./generate/runGenerateOpenApi");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
15
|
+
const utils_1 = require("./utils");
|
|
16
|
+
const packageDetails = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, '../../package.json'), 'utf-8'));
|
|
17
|
+
const APP_NAME = packageDetails.name || 'ts-openapi-codegen-cli';
|
|
18
|
+
const APP_VERSION = packageDetails.version || '1.0.0';
|
|
19
|
+
const APP_DESCRIPTION = packageDetails.description || 'Description';
|
|
20
|
+
const updateNotifier = new UpdateNotifier_1.UpdateNotifier(APP_NAME, APP_VERSION);
|
|
9
21
|
const program = new commander_1.Command();
|
|
10
|
-
program.version(APP_VERSION).name(APP_NAME).description(
|
|
22
|
+
program.version(APP_VERSION).name(APP_NAME).description(APP_DESCRIPTION).addHelpText('before', (0, utils_1.getCLIName)(APP_NAME));
|
|
11
23
|
program
|
|
12
24
|
.command('generate')
|
|
25
|
+
.description('Starts code generation based on the provided opeanpi specifications')
|
|
26
|
+
.addHelpText('before', (0, utils_1.getCLIName)(APP_NAME))
|
|
13
27
|
.usage('[options]')
|
|
14
|
-
.version(APP_VERSION)
|
|
15
28
|
.option('-i, --input <value>', 'OpenAPI specification, can be a path, url or string content (required)', '')
|
|
16
29
|
.option('-o, --output <value>', 'Output directory (required)', '')
|
|
17
30
|
.option('-oc, --outputCore <value>', 'Output directory for core files')
|
|
@@ -34,7 +47,35 @@ program
|
|
|
34
47
|
.addOption(new commander_1.Option('-l, --logLevel <level>', 'Logging level').choices([...Object.values(Enums_1.ELogLevel)]).default(Enums_1.ELogLevel.ERROR))
|
|
35
48
|
.addOption(new commander_1.Option('-t, --logTarget <target>', 'Target of logging').choices([...Object.values(Enums_1.ELogOutput)]).default(Enums_1.ELogOutput.CONSOLE))
|
|
36
49
|
.option('-s, --sortByRequired', 'Property sorting strategy: simplified or extended')
|
|
50
|
+
.hook('preAction', () => {
|
|
51
|
+
updateNotifier.checkAndNotify();
|
|
52
|
+
})
|
|
37
53
|
.action(async (options) => {
|
|
38
54
|
await (0, runGenerateOpenApi_1.runGenerateOpenApi)(options);
|
|
39
55
|
});
|
|
40
|
-
program
|
|
56
|
+
program
|
|
57
|
+
.command('check-openapi-config')
|
|
58
|
+
.description('Starts checking whether the configuration file data is filled in correctly.')
|
|
59
|
+
.addHelpText('before', (0, utils_1.getCLIName)(APP_NAME))
|
|
60
|
+
.hook('preAction', () => {
|
|
61
|
+
updateNotifier.checkAndNotify();
|
|
62
|
+
})
|
|
63
|
+
.action(() => {
|
|
64
|
+
(0, chekOpenApiConfig_1.chekOpenApiConfig)();
|
|
65
|
+
});
|
|
66
|
+
try {
|
|
67
|
+
program.parse(process.argv);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (error.code === 'commander.unknownOption') {
|
|
71
|
+
const errorMessage = error?.message ?? '';
|
|
72
|
+
if (errorMessage) {
|
|
73
|
+
const logger = new Logger_1.Logger({
|
|
74
|
+
level: Enums_1.ELogLevel.INFO,
|
|
75
|
+
instanceId: 'check-openapi-config',
|
|
76
|
+
logOutput: Enums_1.ELogOutput.CONSOLE,
|
|
77
|
+
});
|
|
78
|
+
logger.error(errorMessage);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
package/dist/cli/utils.d.ts
CHANGED
|
@@ -16,4 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function isNil(value: any): boolean;
|
|
18
18
|
export declare function isValidJson(value: any): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the stylized package name to display in the terminal
|
|
21
|
+
* @param appName Package name
|
|
22
|
+
*/
|
|
23
|
+
export declare function getCLIName(appName: string): string;
|
|
19
24
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/cli/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/cli/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/cli/utils.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,GAAG,WAE/B;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,WAOrC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,UAazC"}
|
package/dist/cli/utils.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.isNil = isNil;
|
|
4
7
|
exports.isValidJson = isValidJson;
|
|
8
|
+
exports.getCLIName = getCLIName;
|
|
9
|
+
const figlet_1 = __importDefault(require("figlet"));
|
|
5
10
|
/**
|
|
6
11
|
* Checks if `value` is `null` or `undefined`.
|
|
7
12
|
*
|
|
@@ -30,3 +35,20 @@ function isValidJson(value) {
|
|
|
30
35
|
return false;
|
|
31
36
|
}
|
|
32
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the stylized package name to display in the terminal
|
|
40
|
+
* @param appName Package name
|
|
41
|
+
*/
|
|
42
|
+
function getCLIName(appName) {
|
|
43
|
+
const name = figlet_1.default.textSync(appName, {
|
|
44
|
+
horizontalLayout: 'default',
|
|
45
|
+
verticalLayout: 'default',
|
|
46
|
+
width: 75,
|
|
47
|
+
whitespaceBreak: true,
|
|
48
|
+
});
|
|
49
|
+
return `
|
|
50
|
+
|
|
51
|
+
${name}
|
|
52
|
+
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A class for tracking the release of a newer version of the generator
|
|
3
|
+
*/
|
|
4
|
+
export declare class UpdateNotifier {
|
|
5
|
+
private _packageName;
|
|
6
|
+
private _packageVersion;
|
|
7
|
+
private _configStore;
|
|
8
|
+
private _packageStoreInfo;
|
|
9
|
+
private _logger;
|
|
10
|
+
constructor(packageName: string, packageVersion: string);
|
|
11
|
+
/**
|
|
12
|
+
* Requests the latest version of the generator via npm
|
|
13
|
+
*/
|
|
14
|
+
private fetchNpmPackageInfo;
|
|
15
|
+
/**
|
|
16
|
+
* Checks for updates and writes useful information to the cache
|
|
17
|
+
*/
|
|
18
|
+
private checkUpdate;
|
|
19
|
+
/**
|
|
20
|
+
* Checks for updates and notifies about the possibility to install a new version.
|
|
21
|
+
*/
|
|
22
|
+
checkAndNotify(): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=UpdateNotifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateNotifier.d.ts","sourceRoot":"","sources":["../../src/common/UpdateNotifier.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,qBAAa,cAAc;IACvB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,YAAY,CAA4B;IAChD,OAAO,CAAC,iBAAiB,CAAkC;IAC3D,OAAO,CAAC,OAAO,CAAS;gBAEZ,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IA0BvD;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAkB3B;;OAEG;IACH,OAAO,CAAC,WAAW;IAwBnB;;OAEG;IACH,cAAc;CAmCjB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UpdateNotifier = void 0;
|
|
7
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
const configstore_1 = __importDefault(require("configstore"));
|
|
11
|
+
const semver_1 = __importDefault(require("semver"));
|
|
12
|
+
const Enums_1 = require("./Enums");
|
|
13
|
+
const Logger_1 = require("./Logger");
|
|
14
|
+
// one week
|
|
15
|
+
const UPDATE_CHECK_INTERVAL = 1000 * 60 * 60 * 24 * 7;
|
|
16
|
+
const INCLUDED_RELEASE_TYPES = ['major', 'minor'];
|
|
17
|
+
/**
|
|
18
|
+
* A class for tracking the release of a newer version of the generator
|
|
19
|
+
*/
|
|
20
|
+
class UpdateNotifier {
|
|
21
|
+
_packageName;
|
|
22
|
+
_packageVersion;
|
|
23
|
+
_configStore = null;
|
|
24
|
+
_packageStoreInfo = null;
|
|
25
|
+
_logger;
|
|
26
|
+
constructor(packageName, packageVersion) {
|
|
27
|
+
this._logger = new Logger_1.Logger({
|
|
28
|
+
instanceId: '',
|
|
29
|
+
level: Enums_1.ELogLevel.INFO,
|
|
30
|
+
logOutput: Enums_1.ELogOutput.CONSOLE,
|
|
31
|
+
});
|
|
32
|
+
if (!packageName || !packageVersion) {
|
|
33
|
+
this._logger.warn(`
|
|
34
|
+
The necessary parameters for checking the version are not specified.
|
|
35
|
+
Current values packageName: ${packageName}, packageVersion: ${packageVersion}
|
|
36
|
+
`);
|
|
37
|
+
}
|
|
38
|
+
this._packageName = packageName;
|
|
39
|
+
this._packageVersion = packageVersion;
|
|
40
|
+
try {
|
|
41
|
+
this._configStore = new configstore_1.default(`-${this._packageName}`, {
|
|
42
|
+
lastUpdateCheck: Date.now(),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
this._logger.warn('The settings store has not been created. The package update will be checked more often than once every 1 week!');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Requests the latest version of the generator via npm
|
|
51
|
+
*/
|
|
52
|
+
fetchNpmPackageInfo() {
|
|
53
|
+
try {
|
|
54
|
+
const latestVersion = (0, child_process_1.execSync)(`npm view ${this._packageName} version`).toString().trim();
|
|
55
|
+
const releaseType = semver_1.default.diff(this._packageVersion, latestVersion);
|
|
56
|
+
return {
|
|
57
|
+
currentVersion: this._packageVersion,
|
|
58
|
+
differenceType: releaseType,
|
|
59
|
+
latestVersion,
|
|
60
|
+
packageName: this._packageName,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
this._logger.warn("Couldn't get information about the latest current version");
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Checks for updates and writes useful information to the cache
|
|
70
|
+
*/
|
|
71
|
+
checkUpdate() {
|
|
72
|
+
if (!this._configStore) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this._packageStoreInfo = this._configStore.get('package_store_info');
|
|
76
|
+
if (this._packageStoreInfo) {
|
|
77
|
+
this._packageStoreInfo.currentVersion = this._packageVersion;
|
|
78
|
+
// clean cache
|
|
79
|
+
this._configStore.delete('package_store_info');
|
|
80
|
+
}
|
|
81
|
+
if (Date.now() - this._configStore.get('lastUpdateCheck') < UPDATE_CHECK_INTERVAL) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const fetchInfo = this.fetchNpmPackageInfo();
|
|
85
|
+
this._configStore.set('lastUpdateCheck', Date.now());
|
|
86
|
+
if (fetchInfo?.differenceType && INCLUDED_RELEASE_TYPES.includes(fetchInfo.differenceType)) {
|
|
87
|
+
this._configStore.set('package_store_info', fetchInfo);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks for updates and notifies about the possibility to install a new version.
|
|
92
|
+
*/
|
|
93
|
+
checkAndNotify() {
|
|
94
|
+
if (!this._configStore) {
|
|
95
|
+
this._logger.warn("Couldn't get information about the latest current version");
|
|
96
|
+
this._logger.shutdownLogger();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.checkUpdate();
|
|
100
|
+
if (!this._packageStoreInfo || !semver_1.default.gt(this._packageStoreInfo.latestVersion, this._packageStoreInfo.currentVersion)) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const { packageName, currentVersion, latestVersion } = this._packageStoreInfo;
|
|
104
|
+
const scriptText = chalk_1.default.yellowBright(`npm i -D ${packageName}@${latestVersion}`);
|
|
105
|
+
const message = `
|
|
106
|
+
An update is available: ${chalk_1.default.gray(currentVersion)} -> ${chalk_1.default.greenBright(latestVersion)}}
|
|
107
|
+
Run ${scriptText} to update
|
|
108
|
+
`;
|
|
109
|
+
console.log((0, boxen_1.default)(message, {
|
|
110
|
+
borderColor: 'cyanBright',
|
|
111
|
+
margin: 1,
|
|
112
|
+
padding: 1,
|
|
113
|
+
title: 'Pay attention',
|
|
114
|
+
titleAlignment: 'center',
|
|
115
|
+
textAlignment: 'center',
|
|
116
|
+
}));
|
|
117
|
+
this._logger.shutdownLogger();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.UpdateNotifier = UpdateNotifier;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Logger } from '
|
|
2
|
-
import { HttpClient } from '
|
|
3
|
-
import { IOutput } from '
|
|
4
|
-
import type { Client } from '
|
|
5
|
-
import { Templates } from './registerHandlebarTemplates';
|
|
1
|
+
import { Logger } from '../common/Logger';
|
|
2
|
+
import { HttpClient } from './types/Enums';
|
|
3
|
+
import { IOutput } from './types/Models';
|
|
4
|
+
import type { Client } from './types/shared/Client.model';
|
|
5
|
+
import { Templates } from './utils/registerHandlebarTemplates';
|
|
6
6
|
/**
|
|
7
7
|
* @param client Client object with all the models, services, etc.
|
|
8
8
|
* @param templates Templates wrapper with all loaded Handlebars templates
|
|
@@ -84,6 +84,13 @@ export declare class WriteClient {
|
|
|
84
84
|
writeClientIndex(options: IWriteClientIndex): Promise<void>;
|
|
85
85
|
combineAndWrite(): Promise<void>;
|
|
86
86
|
get logger(): Logger;
|
|
87
|
+
private buildClientIndexMap;
|
|
88
|
+
private finalizeAndWright;
|
|
89
|
+
private getOutputPath;
|
|
90
|
+
private ensureClientIndex;
|
|
91
|
+
private isSameModel;
|
|
92
|
+
private isSameShema;
|
|
93
|
+
private isSomeService;
|
|
87
94
|
}
|
|
88
95
|
export {};
|
|
89
|
-
//# sourceMappingURL=
|
|
96
|
+
//# sourceMappingURL=WriteClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteClient.d.ts","sourceRoot":"","sources":["../../src/core/WriteClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAU/D;;;;;;;;;;;;;;GAcG;AACH,UAAU,YAAY;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,OAAO,CAAS;;IAUxB;;;;;;;;;;;;;;;OAeG;IACG,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA+DvD;;;OAGG;IACG,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAU3D,eAAe;IAKrB,IAAW,MAAM,WAEhB;IAED,OAAO,CAAC,mBAAmB;YAgEb,iBAAiB;IAU/B,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,aAAa;CAGxB"}
|
|
@@ -1,42 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WriteClient = void 0;
|
|
4
|
-
const Enums_1 = require("
|
|
5
|
-
const Logger_1 = require("
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return 1;
|
|
17
|
-
}
|
|
18
|
-
if (a.name < b.name) {
|
|
19
|
-
return -1;
|
|
20
|
-
}
|
|
21
|
-
return 0;
|
|
22
|
-
}
|
|
23
|
-
function prepareAlias(models) {
|
|
24
|
-
let modelPrevious = undefined;
|
|
25
|
-
let index = 1;
|
|
26
|
-
for (const model of models) {
|
|
27
|
-
if (modelPrevious && model.name === modelPrevious.name) {
|
|
28
|
-
model.alias = `${model.name}$${index}`;
|
|
29
|
-
if (!modelPrevious.alias) {
|
|
30
|
-
modelPrevious.alias = `${modelPrevious.name}$${index - 1}`;
|
|
31
|
-
}
|
|
32
|
-
index++;
|
|
33
|
-
}
|
|
34
|
-
else if (modelPrevious && model.name !== modelPrevious.name) {
|
|
35
|
-
index = 1;
|
|
36
|
-
}
|
|
37
|
-
modelPrevious = model;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
4
|
+
const Enums_1 = require("../common/Enums");
|
|
5
|
+
const Logger_1 = require("../common/Logger");
|
|
6
|
+
const fileSystem_1 = require("./utils/fileSystem");
|
|
7
|
+
const pathHelpers_1 = require("./utils/pathHelpers");
|
|
8
|
+
const prepareAlias_1 = require("./utils/prepareAlias");
|
|
9
|
+
const sortModelByName_1 = require("./utils/sortModelByName");
|
|
10
|
+
const unique_1 = require("./utils/unique");
|
|
11
|
+
const writeClientCore_1 = require("./utils/writeClientCore");
|
|
12
|
+
const writeClientIndex_1 = require("./utils/writeClientIndex");
|
|
13
|
+
const writeClientModels_1 = require("./utils/writeClientModels");
|
|
14
|
+
const writeClientSchemas_1 = require("./utils/writeClientSchemas");
|
|
15
|
+
const writeClientServices_1 = require("./utils/writeClientServices");
|
|
40
16
|
/**
|
|
41
17
|
* The client which is writing all items and keep the parameters to write index file
|
|
42
18
|
*/
|
|
@@ -138,31 +114,26 @@ class WriteClient {
|
|
|
138
114
|
}
|
|
139
115
|
}
|
|
140
116
|
async combineAndWrite() {
|
|
117
|
+
const result = this.buildClientIndexMap();
|
|
118
|
+
await this.finalizeAndWright(result);
|
|
119
|
+
}
|
|
120
|
+
get logger() {
|
|
121
|
+
return this._logger;
|
|
122
|
+
}
|
|
123
|
+
buildClientIndexMap() {
|
|
141
124
|
const result = new Map();
|
|
142
125
|
for (const [key, value] of this.options.entries()) {
|
|
143
126
|
for (const item of value) {
|
|
144
|
-
const { exportCore, outputPaths, exportModels, exportSchemas, exportServices, client, templates } = item;
|
|
145
|
-
const outputCore =
|
|
146
|
-
const outputModels =
|
|
147
|
-
const outputSchemas =
|
|
148
|
-
const outputServices =
|
|
149
|
-
|
|
150
|
-
if (!clientIndex) {
|
|
151
|
-
clientIndex = {
|
|
152
|
-
templates: templates,
|
|
153
|
-
outputPath: key,
|
|
154
|
-
core: [],
|
|
155
|
-
models: [],
|
|
156
|
-
schemas: [],
|
|
157
|
-
services: [],
|
|
158
|
-
};
|
|
159
|
-
result.set(`${key}`, clientIndex);
|
|
160
|
-
}
|
|
127
|
+
const { exportCore, outputPaths, exportModels, exportSchemas, exportServices, client, templates, useUnionTypes } = item;
|
|
128
|
+
const outputCore = this.getOutputPath(outputPaths?.outputCore, key, 'core');
|
|
129
|
+
const outputModels = this.getOutputPath(outputPaths?.outputModels, key, 'models');
|
|
130
|
+
const outputSchemas = this.getOutputPath(outputPaths?.outputSchemas, key, 'schemas');
|
|
131
|
+
const outputServices = this.getOutputPath(outputPaths?.outputServices, key, 'services');
|
|
132
|
+
const clientIndex = this.ensureClientIndex(result, key, templates);
|
|
161
133
|
if (exportCore) {
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
clientIndex.core.push(relativePath);
|
|
134
|
+
const rel = (0, pathHelpers_1.relative)(key, outputCore);
|
|
135
|
+
if (!clientIndex.core.includes(rel)) {
|
|
136
|
+
clientIndex.core.push(rel);
|
|
166
137
|
}
|
|
167
138
|
}
|
|
168
139
|
if (exportModels || exportSchemas) {
|
|
@@ -175,24 +146,15 @@ class WriteClient {
|
|
|
175
146
|
path: model.path,
|
|
176
147
|
package: relativePathModel,
|
|
177
148
|
enum: model.enum && model.enum.length > 0,
|
|
178
|
-
useUnionTypes
|
|
149
|
+
useUnionTypes,
|
|
179
150
|
enums: model.enums && model.enums.length > 0,
|
|
180
151
|
};
|
|
181
|
-
if (exportModels) {
|
|
182
|
-
|
|
183
|
-
item.path === modelFinal.path &&
|
|
184
|
-
item.package === modelFinal.package &&
|
|
185
|
-
item.enum === modelFinal.enum &&
|
|
186
|
-
item.enums === modelFinal.enums &&
|
|
187
|
-
item.useUnionTypes === modelFinal.useUnionTypes);
|
|
188
|
-
if (!value) {
|
|
189
|
-
clientIndex.models.push(modelFinal);
|
|
190
|
-
}
|
|
152
|
+
if (exportModels && clientIndex.models.some(m => this.isSameModel(m, modelFinal))) {
|
|
153
|
+
clientIndex.models.push(modelFinal);
|
|
191
154
|
}
|
|
192
155
|
if (exportSchemas) {
|
|
193
156
|
const schema = { ...modelFinal, package: relativePathSchema };
|
|
194
|
-
|
|
195
|
-
if (!indexValue) {
|
|
157
|
+
if (!clientIndex.schemas.some(s => this.isSameShema(s, schema))) {
|
|
196
158
|
clientIndex.schemas.push(schema);
|
|
197
159
|
}
|
|
198
160
|
}
|
|
@@ -201,8 +163,7 @@ class WriteClient {
|
|
|
201
163
|
if (exportServices) {
|
|
202
164
|
const relativeService = `${(0, pathHelpers_1.relative)(key, outputServices)}`;
|
|
203
165
|
for (const service of client.services) {
|
|
204
|
-
|
|
205
|
-
if (!valueIndex) {
|
|
166
|
+
if (!clientIndex.services.some(s => this.isSomeService(s, service.name, relativeService))) {
|
|
206
167
|
clientIndex.services.push({
|
|
207
168
|
name: service.name,
|
|
208
169
|
package: relativeService,
|
|
@@ -212,16 +173,46 @@ class WriteClient {
|
|
|
212
173
|
}
|
|
213
174
|
}
|
|
214
175
|
}
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
async finalizeAndWright(result) {
|
|
215
179
|
for (const value of result.values()) {
|
|
216
|
-
value.models = value.models.filter(unique_1.unique).sort(sortModelByName);
|
|
217
|
-
prepareAlias(value.models);
|
|
218
|
-
value.schemas = value.schemas.filter(unique_1.unique).sort(sortModelByName);
|
|
219
|
-
prepareAlias(value.schemas);
|
|
180
|
+
value.models = value.models.filter(unique_1.unique).sort(sortModelByName_1.sortModelByName);
|
|
181
|
+
(0, prepareAlias_1.prepareAlias)(value.models);
|
|
182
|
+
value.schemas = value.schemas.filter(unique_1.unique).sort(sortModelByName_1.sortModelByName);
|
|
183
|
+
(0, prepareAlias_1.prepareAlias)(value.schemas);
|
|
220
184
|
await (0, writeClientIndex_1.writeClientIndex)(value);
|
|
221
185
|
}
|
|
222
186
|
}
|
|
223
|
-
|
|
224
|
-
return
|
|
187
|
+
getOutputPath(output, key, fallback) {
|
|
188
|
+
return output ? output : (0, pathHelpers_1.resolve)(key, fallback);
|
|
189
|
+
}
|
|
190
|
+
ensureClientIndex(map, key, templates) {
|
|
191
|
+
if (!map.has(key)) {
|
|
192
|
+
map.set(key, {
|
|
193
|
+
templates,
|
|
194
|
+
outputPath: key,
|
|
195
|
+
core: [],
|
|
196
|
+
models: [],
|
|
197
|
+
schemas: [],
|
|
198
|
+
services: [],
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return map.get(key);
|
|
202
|
+
}
|
|
203
|
+
isSameModel(a, b) {
|
|
204
|
+
return (a.name === b.name &&
|
|
205
|
+
a.path === b.path &&
|
|
206
|
+
a.package === b.package &&
|
|
207
|
+
a.enum === b.enum &&
|
|
208
|
+
a.enums === b.enums &&
|
|
209
|
+
a.useUnionTypes === b.useUnionTypes);
|
|
210
|
+
}
|
|
211
|
+
isSameShema(a, b) {
|
|
212
|
+
return a.name === b.name && a.path === b.path && a.package === b.package;
|
|
213
|
+
}
|
|
214
|
+
isSomeService(a, name, pkg) {
|
|
215
|
+
return a.name === name && a.package === pkg;
|
|
225
216
|
}
|
|
226
217
|
}
|
|
227
218
|
exports.WriteClient = WriteClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteClient.test.d.ts","sourceRoot":"","sources":["../../../src/core/__tests__/WriteClient.test.ts"],"names":[],"mappings":""}
|
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
7
7
|
const node_test_1 = require("node:test");
|
|
8
|
-
const Enums_1 = require("
|
|
9
|
-
const fileSystem_1 = require("../fileSystem");
|
|
10
|
-
const getOutputPaths_1 = require("../getOutputPaths");
|
|
11
|
-
const
|
|
8
|
+
const Enums_1 = require("../types/Enums");
|
|
9
|
+
const fileSystem_1 = require("../utils/fileSystem");
|
|
10
|
+
const getOutputPaths_1 = require("../utils/getOutputPaths");
|
|
11
|
+
const WriteClient_1 = require("../WriteClient");
|
|
12
12
|
(0, node_test_1.test)('@unit: writeClient should write to filesystem', async () => {
|
|
13
13
|
const mkdirCalls = [];
|
|
14
14
|
const writeFileCalls = [];
|
|
@@ -47,7 +47,7 @@ const writeClient_1 = require("../writeClient");
|
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
49
|
const outputPaths = (0, getOutputPaths_1.getOutputPaths)({ output: './dist' });
|
|
50
|
-
await new
|
|
50
|
+
await new WriteClient_1.WriteClient().writeClient({
|
|
51
51
|
client,
|
|
52
52
|
templates,
|
|
53
53
|
outputPaths,
|
package/dist/core/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const isString_1 = require("./utils/isString");
|
|
|
20
20
|
const postProcessClient_1 = require("./utils/postProcessClient");
|
|
21
21
|
const prepareOptions_1 = require("./utils/prepareOptions");
|
|
22
22
|
const registerHandlebarTemplates_1 = require("./utils/registerHandlebarTemplates");
|
|
23
|
-
const
|
|
23
|
+
const WriteClient_1 = require("./WriteClient");
|
|
24
24
|
var Enums_2 = require("./types/Enums");
|
|
25
25
|
Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return Enums_2.HttpClient; } });
|
|
26
26
|
/**
|
|
@@ -128,7 +128,7 @@ async function generate(options) {
|
|
|
128
128
|
preparedOptions = Array.of(options);
|
|
129
129
|
}
|
|
130
130
|
const optionsFinal = preparedOptions.map(op => (0, prepareOptions_1.prepareOptions)(op));
|
|
131
|
-
const writeClient = new
|
|
131
|
+
const writeClient = new WriteClient_1.WriteClient();
|
|
132
132
|
writeClient.logger.forceInfo(`Generation has begun. Total number of specification files: ${optionsFinal.length}`);
|
|
133
133
|
try {
|
|
134
134
|
const start = process.hrtime();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareAlias.d.ts","sourceRoot":"","sources":["../../../src/core/utils/prepareAlias.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAe5C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareAlias = prepareAlias;
|
|
4
|
+
/**
|
|
5
|
+
* Function for creating aliases for names
|
|
6
|
+
* @param models Array of models
|
|
7
|
+
*/
|
|
8
|
+
function prepareAlias(models) {
|
|
9
|
+
let modelPrevious = undefined;
|
|
10
|
+
let index = 1;
|
|
11
|
+
for (const model of models) {
|
|
12
|
+
if (modelPrevious && model.name === modelPrevious.name) {
|
|
13
|
+
model.alias = `${model.name}$${index}`;
|
|
14
|
+
if (!modelPrevious.alias) {
|
|
15
|
+
modelPrevious.alias = `${modelPrevious.name}$${index - 1}`;
|
|
16
|
+
}
|
|
17
|
+
index++;
|
|
18
|
+
}
|
|
19
|
+
else if (modelPrevious && model.name !== modelPrevious.name) {
|
|
20
|
+
index = 1;
|
|
21
|
+
}
|
|
22
|
+
modelPrevious = model;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"registerHandlebarTemplates.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarTemplates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAkFjD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;IACnC,OAAO,EAAE;QACL,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACnC,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACpC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;KACxC,CAAC;IACF,IAAI,EAAE;QACF,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,QAAQ,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACtC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACvC,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC;QACrC,iBAAiB,EAAE,UAAU,CAAC,gBAAgB,CAAC;QAC/C,cAAc,EAAE,UAAU,CAAC,gBAAgB,CAAC;KAC/C,CAAC;CACL;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAqGnI"}
|
|
@@ -96,6 +96,7 @@ const header_1 = __importDefault(require("../../templatesCompiled/partials/heade
|
|
|
96
96
|
const isNullable_1 = __importDefault(require("../../templatesCompiled/partials/isNullable"));
|
|
97
97
|
const isReadOnly_1 = __importDefault(require("../../templatesCompiled/partials/isReadOnly"));
|
|
98
98
|
const isRequired_1 = __importDefault(require("../../templatesCompiled/partials/isRequired"));
|
|
99
|
+
const isRequiredDefinition_1 = __importDefault(require("../../templatesCompiled/partials/isRequiredDefinition"));
|
|
99
100
|
const parameters_1 = __importDefault(require("../../templatesCompiled/partials/parameters"));
|
|
100
101
|
const parametersDefinition_1 = __importDefault(require("../../templatesCompiled/partials/parametersDefinition"));
|
|
101
102
|
const parameterValues_1 = __importDefault(require("../../templatesCompiled/partials/parameterValues"));
|
|
@@ -151,6 +152,7 @@ function registerHandlebarTemplates(root) {
|
|
|
151
152
|
Handlebars.registerPartial('isNullable', Handlebars.template(isNullable_1.default));
|
|
152
153
|
Handlebars.registerPartial('isReadOnly', Handlebars.template(isReadOnly_1.default));
|
|
153
154
|
Handlebars.registerPartial('isRequired', Handlebars.template(isRequired_1.default));
|
|
155
|
+
Handlebars.registerPartial('isRequiredDefinition', Handlebars.template(isRequiredDefinition_1.default));
|
|
154
156
|
Handlebars.registerPartial('parameters', Handlebars.template(parameters_1.default));
|
|
155
157
|
Handlebars.registerPartial('parametersDefinition', Handlebars.template(parametersDefinition_1.default));
|
|
156
158
|
Handlebars.registerPartial('parameterValues', Handlebars.template(parameterValues_1.default));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortModelByName.d.ts","sourceRoot":"","sources":["../../../src/core/utils/sortModelByName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ5D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortModelByName = sortModelByName;
|
|
4
|
+
function sortModelByName(a, b) {
|
|
5
|
+
if (a.name > b.name) {
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
if (a.name < b.name) {
|
|
9
|
+
return -1;
|
|
10
|
+
}
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
"1": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
3
3
|
compiler: (string | number)[];
|
|
4
|
-
main: (container: any, depth0: any, helpers: any, partials: any, data: any) =>
|
|
4
|
+
main: (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
5
5
|
useData: boolean;
|
|
6
6
|
};
|
|
7
7
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isReadOnly.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/partials/isReadOnly.ts"],"names":[],"mappings":";;;;;;AAMA,
|
|
1
|
+
{"version":3,"file":"isReadOnly.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/partials/isReadOnly.ts"],"names":[],"mappings":";;;;;;AAMA,wBAWiB"}
|
|
@@ -15,6 +15,5 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
15
15
|
}
|
|
16
16
|
return undefined;
|
|
17
17
|
};
|
|
18
|
-
return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "isReadOnly"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column":
|
|
19
|
-
+ "\n";
|
|
18
|
+
return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "isReadOnly"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 37 } } })) != null ? stack1 : "");
|
|
20
19
|
}, "useData": true };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"1": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
3
|
+
"3": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
4
|
+
compiler: (string | number)[];
|
|
5
|
+
main: (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
6
|
+
useData: boolean;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=isRequiredDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isRequiredDefinition.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/partials/isRequiredDefinition.ts"],"names":[],"mappings":";;;;;;;AAMA,wBAoBiB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// This is an automatically generated file for the hbs template.
|
|
4
|
+
// You don't need to change it, run npm run build:hbs to update it.
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint: disable */
|
|
7
|
+
/* eslint: disable */
|
|
8
|
+
// @ts-nocheck
|
|
9
|
+
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
|
+
return "?";
|
|
11
|
+
}, "3": function (container, depth0, helpers, partials, data) {
|
|
12
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
14
|
+
return parent[propertyName];
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
};
|
|
18
|
+
return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "default"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 1, "column": 23 }, "end": { "line": 1, "column": 43 } } })) != null ? stack1 : "");
|
|
19
|
+
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
20
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
22
|
+
return parent[propertyName];
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
};
|
|
26
|
+
return ((stack1 = lookupProperty(helpers, "unless").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "isRequired"), { "name": "unless", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.program(3, data, 0), "data": data, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 54 } } })) != null ? stack1 : "");
|
|
27
|
+
}, "useData": true };
|
|
@@ -38,7 +38,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
38
38
|
return undefined;
|
|
39
39
|
};
|
|
40
40
|
return ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 9, "column": 3 }, "end": { "line": 9, "column": 7 } }), depth0)) != null ? stack1 : "")
|
|
41
|
-
+ ((stack1 = container.invokePartial(lookupProperty(partials, "
|
|
41
|
+
+ ((stack1 = container.invokePartial(lookupProperty(partials, "isRequiredDefinition"), depth0, { "name": "isRequiredDefinition", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
42
42
|
+ ": "
|
|
43
43
|
+ ((stack1 = container.invokePartial(lookupProperty(partials, "type"), depth0, { "name": "type", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
44
44
|
+ ",\n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-openapi-codegen",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "Library that generates Typescript clients based on the OpenAPI specification. It bases on openapi-typescript-codegen",
|
|
5
5
|
"author": "Alexey Zverev",
|
|
6
6
|
"homepage": "https://github.com/ozonophore/openapi-codegen.git",
|
|
@@ -59,9 +59,13 @@
|
|
|
59
59
|
"codecov": "codecov --token=89a9fe76-2714-4b5b-83e3-9d809615064d"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
+
"boxen": "^5.1.2",
|
|
62
63
|
"camelcase": "6.2.0",
|
|
64
|
+
"chalk": "^4.1.2",
|
|
63
65
|
"commander": "8.0.0",
|
|
66
|
+
"configstore": "^5.0.1",
|
|
64
67
|
"fast-deep-equal": "^3.1.3",
|
|
68
|
+
"figlet": "^1.8.0",
|
|
65
69
|
"handlebars": "4.7.6",
|
|
66
70
|
"joi": "^17.13.3",
|
|
67
71
|
"json-schema": "0.4.0",
|
|
@@ -69,6 +73,7 @@
|
|
|
69
73
|
"leven": "^4.0.0",
|
|
70
74
|
"mkdirp": "1.0.4",
|
|
71
75
|
"rimraf": "3.0.2",
|
|
76
|
+
"semver": "^7.7.1",
|
|
72
77
|
"winston": "^3.17.0",
|
|
73
78
|
"winston-daily-rotate-file": "^5.0.0"
|
|
74
79
|
},
|
|
@@ -81,13 +86,16 @@
|
|
|
81
86
|
"@eslint/eslintrc": "^3.3.1",
|
|
82
87
|
"@eslint/js": "^9.29.0",
|
|
83
88
|
"@types/axios": "^0.14.0",
|
|
89
|
+
"@types/configstore": "^6.0.2",
|
|
84
90
|
"@types/express": "4.17.13",
|
|
91
|
+
"@types/figlet": "^1.5.8",
|
|
85
92
|
"@types/json-schema": "^7.0.15",
|
|
86
93
|
"@types/lodash-es": "^4.17.12",
|
|
87
94
|
"@types/node": "22.5.1",
|
|
88
95
|
"@types/node-fetch": "2.5.12",
|
|
89
96
|
"@types/prettier": "3.0.0",
|
|
90
97
|
"@types/qs": "6.9.7",
|
|
98
|
+
"@types/semver": "^7.7.0",
|
|
91
99
|
"@types/winston": "^2.4.4",
|
|
92
100
|
"@typescript-eslint/eslint-plugin": "^8.34.1",
|
|
93
101
|
"@typescript-eslint/parser": "^8.34.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeClient.test.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__tests__/writeClient.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeClient.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAG3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAoCzD;;;;;;;;;;;;;;GAcG;AACH,UAAU,YAAY;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,OAAO,CAAS;;IAUxB;;;;;;;;;;;;;;;OAeG;IACG,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA+DvD;;;OAGG;IACG,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAU3D,eAAe;IAuFrB,IAAW,MAAM,WAEhB;CACJ"}
|