ts-openapi-codegen 2.1.0-beta.6 → 2.1.0-beta.7
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/analyzeDiff/__tests__/analyzeDiff.cli.test.js +9 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffRenameAndInvalidRegex.test.js +9 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffTypeCoercion.test.js +9 -0
- package/dist/cli/analyzeUsage/analyzeUsage.d.ts +4 -0
- package/dist/cli/analyzeUsage/analyzeUsage.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/analyzeUsage.js +62 -0
- package/dist/cli/analyzeUsage/core/Analyzer.d.ts +9 -0
- package/dist/cli/analyzeUsage/core/Analyzer.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/core/Analyzer.js +29 -0
- package/dist/cli/analyzeUsage/core/ProjectContext.d.ts +10 -0
- package/dist/cli/analyzeUsage/core/ProjectContext.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/core/ProjectContext.js +63 -0
- package/dist/cli/analyzeUsage/core/Scanner.d.ts +15 -0
- package/dist/cli/analyzeUsage/core/Scanner.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/core/Scanner.js +115 -0
- package/dist/cli/analyzeUsage/rules/ClientRule.d.ts +6 -0
- package/dist/cli/analyzeUsage/rules/ClientRule.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/rules/ClientRule.js +78 -0
- package/dist/cli/analyzeUsage/rules/CoverageRule.d.ts +7 -0
- package/dist/cli/analyzeUsage/rules/CoverageRule.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/rules/CoverageRule.js +63 -0
- package/dist/cli/analyzeUsage/rules/DiagnosticsRule.d.ts +6 -0
- package/dist/cli/analyzeUsage/rules/DiagnosticsRule.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/rules/DiagnosticsRule.js +60 -0
- package/dist/cli/analyzeUsage/rules/ImportRule.d.ts +6 -0
- package/dist/cli/analyzeUsage/rules/ImportRule.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/rules/ImportRule.js +52 -0
- package/dist/cli/analyzeUsage/rules/ModelRule.d.ts +6 -0
- package/dist/cli/analyzeUsage/rules/ModelRule.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/rules/ModelRule.js +38 -0
- package/dist/cli/analyzeUsage/rules/SchemaRule.d.ts +6 -0
- package/dist/cli/analyzeUsage/rules/SchemaRule.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/rules/SchemaRule.js +48 -0
- package/dist/cli/analyzeUsage/rules/ServiceRule.d.ts +7 -0
- package/dist/cli/analyzeUsage/rules/ServiceRule.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/rules/ServiceRule.js +92 -0
- package/dist/cli/analyzeUsage/types.d.ts +52 -0
- package/dist/cli/analyzeUsage/types.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/types.js +2 -0
- package/dist/cli/analyzeUsage/utils/fuzzy.d.ts +5 -0
- package/dist/cli/analyzeUsage/utils/fuzzy.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/utils/fuzzy.js +38 -0
- package/dist/cli/analyzeUsage/utils/report.d.ts +16 -0
- package/dist/cli/analyzeUsage/utils/report.d.ts.map +1 -0
- package/dist/cli/analyzeUsage/utils/report.js +85 -0
- package/dist/cli/checkAndUpdateConfig/__tests__/checkConfig.test.js +10 -20
- package/dist/cli/checkAndUpdateConfig/__tests__/updateConfig.test.js +10 -20
- package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts +2 -1
- package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/checkConfig.js +8 -4
- package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts +2 -1
- package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/updateConfig.js +6 -3
- package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.js +19 -1
- package/dist/cli/generateOpenApiClient/__tests__/generateOpenApiClient.strict.test.js +18 -9
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts +2 -5
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -1
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +12 -16
- package/dist/cli/index.js +41 -9
- package/dist/cli/initOpenApiConfig/__tests__/init.test.js +4 -14
- package/dist/cli/initOpenApiConfig/__tests__/initConfig.test.js +3 -1
- package/dist/cli/initOpenApiConfig/init.d.ts +2 -1
- package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/init.js +3 -3
- package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts +0 -1
- package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/initCustomRequest.js +1 -2
- package/dist/cli/initOpenApiConfig/utils/__tests__/validateSpecFiles.test.js +9 -0
- package/dist/cli/initOpenApiConfig/utils/buildConfig.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/utils/buildConfig.js +0 -4
- package/dist/cli/previewChanges/previewChanges.d.ts +2 -1
- package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
- package/dist/cli/previewChanges/previewChanges.js +6 -6
- package/dist/cli/schemas/analyzeUsage.d.ts +13 -0
- package/dist/cli/schemas/analyzeUsage.d.ts.map +1 -0
- package/dist/cli/schemas/analyzeUsage.js +38 -0
- package/dist/cli/schemas/generate.d.ts +7 -0
- package/dist/cli/schemas/generate.d.ts.map +1 -1
- package/dist/cli/schemas/generate.js +4 -0
- package/dist/cli/schemas/index.d.ts +2 -2
- package/dist/cli/schemas/index.d.ts.map +1 -1
- package/dist/cli/schemas/index.js +1 -1
- package/dist/cli/schemas/init.d.ts +0 -1
- package/dist/cli/schemas/init.d.ts.map +1 -1
- package/dist/cli/schemas/init.js +0 -1
- package/dist/cli/types.d.ts +6 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +2 -0
- package/dist/common/Consts.d.ts +1 -0
- package/dist/common/Consts.d.ts.map +1 -1
- package/dist/common/Consts.js +6 -2
- package/dist/common/Logger.js +2 -2
- package/dist/common/LoggerMessages.d.ts +59 -12
- package/dist/common/LoggerMessages.d.ts.map +1 -1
- package/dist/common/LoggerMessages.js +62 -15
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts +0 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts +0 -2
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +0 -2
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts +0 -2
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.d.ts +0 -2
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts +7 -2
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.js +5 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +14 -11
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.d.ts +0 -2
- package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.js +0 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.js +0 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +0 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +0 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +0 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.js +0 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +0 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +0 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +8 -9
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +1 -1
- package/dist/common/utils/__tests__/convertArrayToObject.test.js +0 -3
- package/dist/common/utils/convertArrayToObject.d.ts.map +1 -1
- package/dist/common/utils/convertArrayToObject.js +0 -2
- package/dist/core/OpenApiClient.d.ts +12 -1
- package/dist/core/OpenApiClient.d.ts.map +1 -1
- package/dist/core/OpenApiClient.js +193 -16
- package/dist/core/WriteClient.d.ts +12 -3
- package/dist/core/WriteClient.d.ts.map +1 -1
- package/dist/core/WriteClient.js +25 -5
- package/dist/core/plugins/getBuiltinPlugins.d.ts.map +1 -1
- package/dist/core/plugins/loadGeneratorPlugins.d.ts.map +1 -1
- package/dist/core/plugins/loadGeneratorPlugins.js +1 -1
- package/dist/core/types/shared/Client.model.d.ts +1 -1
- package/dist/core/types/shared/Client.model.d.ts.map +1 -1
- package/dist/core/types/shared/Model.model.d.ts +1 -1
- package/dist/core/types/shared/Model.model.d.ts.map +1 -1
- package/dist/core/utils/__tests__/prepareDtoModels.test.js +95 -0
- package/dist/core/utils/__tests__/writeClientServices.test.js +0 -1
- package/dist/core/utils/loadDiffReport.d.ts.map +1 -1
- package/dist/core/utils/loadDiffReport.js +5 -4
- package/dist/core/utils/precompileTemplates.js +3 -2
- package/dist/core/utils/prepareDtoModels.d.ts.map +1 -1
- package/dist/core/utils/prepareDtoModels.js +1 -7
- package/dist/core/utils/writeClientCore.d.ts +0 -2
- package/dist/core/utils/writeClientCore.d.ts.map +1 -1
- package/dist/core/utils/writeClientCore.js +19 -18
- package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientCoreIndex.js +14 -4
- package/dist/core/utils/writeClientExecutor.d.ts.map +1 -1
- package/dist/core/utils/writeClientExecutor.js +4 -4
- package/dist/core/utils/writeClientFullIndex.js +4 -4
- package/dist/core/utils/writeClientModels.d.ts.map +1 -1
- package/dist/core/utils/writeClientModels.js +10 -10
- package/dist/core/utils/writeClientModelsIndex.d.ts +1 -1
- package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientModelsIndex.js +14 -4
- package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.js +7 -7
- package/dist/core/utils/writeClientSchemasIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemasIndex.js +14 -4
- package/dist/core/utils/writeClientServices.d.ts +0 -2
- package/dist/core/utils/writeClientServices.d.ts.map +1 -1
- package/dist/core/utils/writeClientServices.js +7 -8
- package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientServicesIndex.js +14 -4
- package/dist/core/utils/writeClientSimpleIndex.js +4 -4
- package/dist/templatesCompiled/cli/customRequest.d.ts +2 -6
- package/dist/templatesCompiled/cli/customRequest.d.ts.map +1 -1
- package/dist/templatesCompiled/cli/customRequest.js +8 -28
- package/dist/templatesCompiled/cli/customRequestExecutor.d.ts +0 -3
- package/dist/templatesCompiled/cli/customRequestExecutor.d.ts.map +1 -1
- package/dist/templatesCompiled/cli/customRequestExecutor.js +5 -28
- package/dist/templatesCompiled/client/core/axios/request.d.ts +2 -6
- package/dist/templatesCompiled/client/core/axios/request.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/axios/request.js +2 -22
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts +2 -5
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.js +12 -42
- package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts +0 -2
- package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/executor/requestExecutor.js +3 -11
- package/dist/templatesCompiled/client/core/fetch/request.d.ts +2 -6
- package/dist/templatesCompiled/client/core/fetch/request.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/fetch/request.js +2 -22
- package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts +0 -2
- package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/interceptors/withInterceptors.js +3 -11
- package/dist/templatesCompiled/client/core/node/request.d.ts +2 -6
- package/dist/templatesCompiled/client/core/node/request.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/node/request.js +2 -22
- package/dist/templatesCompiled/client/core/xhr/request.d.ts +2 -6
- package/dist/templatesCompiled/client/core/xhr/request.d.ts.map +1 -1
- package/dist/templatesCompiled/client/core/xhr/request.js +2 -22
- package/dist/templatesCompiled/client/exportService.d.ts +9 -11
- package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
- package/dist/templatesCompiled/client/exportService.js +64 -82
- package/dist/test/helpers/silenceLoggers.d.ts +11 -0
- package/dist/test/helpers/silenceLoggers.d.ts.map +1 -0
- package/dist/test/helpers/silenceLoggers.js +88 -0
- package/package.json +4 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OpenApiClient = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
4
5
|
const Consts_1 = require("../common/Consts");
|
|
5
6
|
const Logger_1 = require("../common/Logger");
|
|
6
7
|
const LoggerMessages_1 = require("../common/LoggerMessages");
|
|
@@ -16,6 +17,7 @@ const EmptySchemaStrategy_enum_1 = require("./types/enums/EmptySchemaStrategy.en
|
|
|
16
17
|
const ModelsMode_enum_1 = require("./types/enums/ModelsMode.enum");
|
|
17
18
|
const ValidationLibrary_enum_1 = require("./types/enums/ValidationLibrary.enum");
|
|
18
19
|
const applyDiffReportToClient_1 = require("./utils/applyDiffReportToClient");
|
|
20
|
+
const GenerationCache_1 = require("./utils/GenerationCache");
|
|
19
21
|
const getOpenApiSpec_1 = require("./utils/getOpenApiSpec");
|
|
20
22
|
const getOpenApiVersion_1 = require("./utils/getOpenApiVersion");
|
|
21
23
|
const getOutputPaths_1 = require("./utils/getOutputPaths");
|
|
@@ -25,6 +27,8 @@ const prepareDtoModels_1 = require("./utils/prepareDtoModels");
|
|
|
25
27
|
const registerHandlebarTemplates_1 = require("./utils/registerHandlebarTemplates");
|
|
26
28
|
const WriteClient_1 = require("./WriteClient");
|
|
27
29
|
class OpenApiClient {
|
|
30
|
+
static CACHE_FINGERPRINT_VERSION = 1;
|
|
31
|
+
static DEFAULT_CACHE_FILENAME = '.openapi-codegen-cache.json';
|
|
28
32
|
_writeClient = null;
|
|
29
33
|
get writeClient() {
|
|
30
34
|
if (!this._writeClient) {
|
|
@@ -52,7 +56,6 @@ class OpenApiClient {
|
|
|
52
56
|
enumPrefix: rawOptions.enumPrefix,
|
|
53
57
|
typePrefix: rawOptions.typePrefix,
|
|
54
58
|
useCancelableRequest: rawOptions.useCancelableRequest,
|
|
55
|
-
useRequestRaw: rawOptions.useRequestRaw,
|
|
56
59
|
logLevel: rawOptions.logLevel,
|
|
57
60
|
logTarget: rawOptions.logTarget,
|
|
58
61
|
sortByRequired: rawOptions.sortByRequired,
|
|
@@ -65,6 +68,10 @@ class OpenApiClient {
|
|
|
65
68
|
strictOpenapi: rawOptions.strictOpenapi,
|
|
66
69
|
reportFile: rawOptions.reportFile,
|
|
67
70
|
governanceConfig: rawOptions.governanceConfig,
|
|
71
|
+
cache: rawOptions.cache,
|
|
72
|
+
cachePath: rawOptions.cachePath,
|
|
73
|
+
cacheStrategy: rawOptions.cacheStrategy,
|
|
74
|
+
cacheDebug: rawOptions.cacheDebug,
|
|
68
75
|
}));
|
|
69
76
|
}
|
|
70
77
|
else {
|
|
@@ -89,7 +96,6 @@ class OpenApiClient {
|
|
|
89
96
|
enumPrefix: rawOptions.enumPrefix,
|
|
90
97
|
typePrefix: rawOptions.typePrefix,
|
|
91
98
|
useCancelableRequest: rawOptions.useCancelableRequest,
|
|
92
|
-
useRequestRaw: rawOptions.useRequestRaw,
|
|
93
99
|
logLevel: rawOptions.logLevel,
|
|
94
100
|
logTarget: rawOptions.logTarget,
|
|
95
101
|
sortByRequired: rawOptions.sortByRequired,
|
|
@@ -102,6 +108,10 @@ class OpenApiClient {
|
|
|
102
108
|
strictOpenapi: rawOptions.strictOpenapi,
|
|
103
109
|
reportFile: rawOptions.reportFile,
|
|
104
110
|
governanceConfig: rawOptions.governanceConfig,
|
|
111
|
+
cache: rawOptions.cache,
|
|
112
|
+
cachePath: rawOptions.cachePath,
|
|
113
|
+
cacheStrategy: rawOptions.cacheStrategy,
|
|
114
|
+
cacheDebug: rawOptions.cacheDebug,
|
|
105
115
|
},
|
|
106
116
|
];
|
|
107
117
|
}
|
|
@@ -126,7 +136,6 @@ class OpenApiClient {
|
|
|
126
136
|
enumPrefix: item.enumPrefix || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.enumPrefix,
|
|
127
137
|
typePrefix: item.typePrefix || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.typePrefix,
|
|
128
138
|
useCancelableRequest: item.useCancelableRequest ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.useCancelableRequest,
|
|
129
|
-
useRequestRaw: item.useRequestRaw ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.useRequestRaw,
|
|
130
139
|
logLevel: item.logLevel || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.logLevel,
|
|
131
140
|
logTarget: item.logTarget || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.logTarget,
|
|
132
141
|
sortByRequired: item.sortByRequired ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.sortByRequired,
|
|
@@ -144,15 +153,55 @@ class OpenApiClient {
|
|
|
144
153
|
useProjectPrettier: item.useProjectPrettier ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.useProjectPrettier,
|
|
145
154
|
useEslintFix: item.useEslintFix ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.useEslintFix,
|
|
146
155
|
governanceConfig: item.governanceConfig || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.governanceConfig,
|
|
156
|
+
cache: item.cache ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.cache,
|
|
157
|
+
cachePath: item.cachePath || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.cachePath,
|
|
158
|
+
cacheStrategy: item.cacheStrategy ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.cacheStrategy,
|
|
159
|
+
cacheDebug: item.cacheDebug ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.cacheDebug,
|
|
147
160
|
};
|
|
148
161
|
}
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
for (const
|
|
152
|
-
|
|
153
|
-
|
|
162
|
+
getOutputRoots(items) {
|
|
163
|
+
const roots = new Set();
|
|
164
|
+
for (const item of items) {
|
|
165
|
+
const outputDirs = [item.output, item.outputCore, item.outputSchemas, item.outputModels, item.outputServices];
|
|
166
|
+
for (const dir of outputDirs) {
|
|
167
|
+
if (dir) {
|
|
168
|
+
roots.add((0, pathHelpers_1.resolveHelper)(process.cwd(), dir));
|
|
169
|
+
}
|
|
154
170
|
}
|
|
155
171
|
}
|
|
172
|
+
return Array.from(roots);
|
|
173
|
+
}
|
|
174
|
+
async cleanupStaleOutputs(items) {
|
|
175
|
+
const outputRoots = this.getOutputRoots(items);
|
|
176
|
+
const expectedFiles = this.writeClient.getExpectedOutputFiles();
|
|
177
|
+
for (const root of outputRoots) {
|
|
178
|
+
await this.removeStaleFilesInDirectory(root, expectedFiles);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async removeStaleFilesInDirectory(path, expectedFiles) {
|
|
182
|
+
const stats = await fs_1.promises.stat(path).catch(() => null);
|
|
183
|
+
if (!stats) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
if (stats.isFile()) {
|
|
187
|
+
if (!expectedFiles.has(path)) {
|
|
188
|
+
await fileSystemHelpers_1.fileSystemHelpers.rmdir(path);
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
const entries = await fs_1.promises.readdir(path);
|
|
194
|
+
let hasAnyFile = false;
|
|
195
|
+
for (const entry of entries) {
|
|
196
|
+
const childPath = (0, pathHelpers_1.resolveHelper)(path, entry);
|
|
197
|
+
const childHasFiles = await this.removeStaleFilesInDirectory(childPath, expectedFiles);
|
|
198
|
+
hasAnyFile = hasAnyFile || childHasFiles;
|
|
199
|
+
}
|
|
200
|
+
if (!hasAnyFile) {
|
|
201
|
+
await fileSystemHelpers_1.fileSystemHelpers.rmdir(path);
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
156
205
|
}
|
|
157
206
|
async generateCodeForItems(items) {
|
|
158
207
|
if (items.length === 0) {
|
|
@@ -161,12 +210,27 @@ class OpenApiClient {
|
|
|
161
210
|
this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.STARTED(items.length));
|
|
162
211
|
try {
|
|
163
212
|
const start = process.hrtime.bigint();
|
|
164
|
-
|
|
165
|
-
|
|
213
|
+
const cacheEnabled = items[0]?.cache === true;
|
|
214
|
+
const generationCaches = new Map();
|
|
215
|
+
if (!cacheEnabled) {
|
|
216
|
+
this.warnOnSharedOutputsWithoutCache(items);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
for (const outputRoot of this.getUniqueResolvedOutputs(items)) {
|
|
220
|
+
const sampleItem = items.find(item => this.resolveOutputRoot(item.output) === outputRoot);
|
|
221
|
+
if (!sampleItem) {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
const cachePath = this.resolveCachePathForOutput(sampleItem.output, sampleItem.cachePath);
|
|
225
|
+
const generationCache = new GenerationCache_1.GenerationCache(cachePath);
|
|
226
|
+
await generationCache.load();
|
|
227
|
+
generationCaches.set(outputRoot, generationCache);
|
|
228
|
+
}
|
|
166
229
|
}
|
|
167
230
|
for (const option of items) {
|
|
168
231
|
const fileStart = process.hrtime.bigint();
|
|
169
|
-
|
|
232
|
+
const generationCache = cacheEnabled ? generationCaches.get(this.resolveOutputRoot(option.output)) ?? null : null;
|
|
233
|
+
await this.generateSingle(option, generationCache);
|
|
170
234
|
const fileEnd = process.hrtime.bigint();
|
|
171
235
|
const fileDurationInSeconds = Number(fileEnd - fileStart) / 1e9;
|
|
172
236
|
this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.DURATION_FOR_FILE(option.input, fileDurationInSeconds.toFixed(3)));
|
|
@@ -177,6 +241,14 @@ class OpenApiClient {
|
|
|
177
241
|
else {
|
|
178
242
|
await this.writeClient.combineAndWrite();
|
|
179
243
|
}
|
|
244
|
+
await this.cleanupStaleOutputs(items);
|
|
245
|
+
if (cacheEnabled) {
|
|
246
|
+
for (const generationCache of generationCaches.values()) {
|
|
247
|
+
await generationCache.save();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const writeStats = this.writeClient.getWriteStats();
|
|
251
|
+
this.writeClient.logger.info(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.WRITE_STATS(writeStats.written, writeStats.unchanged));
|
|
180
252
|
this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.FINISHED);
|
|
181
253
|
const end = process.hrtime.bigint();
|
|
182
254
|
const durationInSeconds = Number(end - start) / 1e9;
|
|
@@ -188,8 +260,34 @@ class OpenApiClient {
|
|
|
188
260
|
}
|
|
189
261
|
this.writeClient.logger.shutdownLogger();
|
|
190
262
|
}
|
|
191
|
-
|
|
192
|
-
|
|
263
|
+
getUniqueResolvedOutputs(items) {
|
|
264
|
+
return Array.from(new Set(items.map(item => this.resolveOutputRoot(item.output))));
|
|
265
|
+
}
|
|
266
|
+
resolveOutputRoot(output) {
|
|
267
|
+
return (0, pathHelpers_1.resolveHelper)(process.cwd(), output);
|
|
268
|
+
}
|
|
269
|
+
resolveCachePathForOutput(output, cachePath) {
|
|
270
|
+
if (cachePath.startsWith('/') || /^[A-Za-z]:[\\/]/.test(cachePath)) {
|
|
271
|
+
return cachePath;
|
|
272
|
+
}
|
|
273
|
+
return (0, pathHelpers_1.resolveHelper)(this.resolveOutputRoot(output), cachePath || OpenApiClient.DEFAULT_CACHE_FILENAME);
|
|
274
|
+
}
|
|
275
|
+
warnOnSharedOutputsWithoutCache(items) {
|
|
276
|
+
const countByOutput = new Map();
|
|
277
|
+
for (const item of items) {
|
|
278
|
+
const output = this.resolveOutputRoot(item.output);
|
|
279
|
+
countByOutput.set(output, (countByOutput.get(output) ?? 0) + 1);
|
|
280
|
+
}
|
|
281
|
+
const duplicatedOutputs = Array.from(countByOutput.entries())
|
|
282
|
+
.filter(([, count]) => count > 1)
|
|
283
|
+
.map(([output]) => output);
|
|
284
|
+
if (duplicatedOutputs.length === 0) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
this.writeClient.logger.warn(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.CACHE_SHARED_OUTPUT_WARNING(duplicatedOutputs.map(output => `- ${output}`).join('\n')));
|
|
288
|
+
}
|
|
289
|
+
async generateSingle(item, generationCache) {
|
|
290
|
+
const { input, output, outputCore, outputServices, outputModels, outputSchemas, httpClient, useOptions, useUnionTypes, excludeCoreServiceFiles, request, plugins, customExecutorPath, interfacePrefix, enumPrefix, typePrefix, useCancelableRequest, sortByRequired, useSeparatedIndexes, validationLibrary = ValidationLibrary_enum_1.ValidationLibrary.NONE, emptySchemaStrategy = EmptySchemaStrategy_enum_1.EmptySchemaStrategy.KEEP, useHistory, diffReport, modelsMode = ModelsMode_enum_1.ModelsMode.INTERFACES, strictOpenapi, reportFile, useProjectPrettier = false, useEslintFix = false, governanceConfig, } = item;
|
|
193
291
|
const outputPaths = (0, getOutputPaths_1.getOutputPaths)({
|
|
194
292
|
output,
|
|
195
293
|
outputCore,
|
|
@@ -198,6 +296,28 @@ class OpenApiClient {
|
|
|
198
296
|
outputSchemas,
|
|
199
297
|
});
|
|
200
298
|
const absoluteInput = (0, pathHelpers_1.resolveHelper)(process.cwd(), input);
|
|
299
|
+
const cacheKey = this.getCacheKey(item, absoluteInput);
|
|
300
|
+
const cacheFingerprint = await this.getCacheFingerprint(item, absoluteInput);
|
|
301
|
+
const useEntityCache = item.cache && item.cacheStrategy === 'entity' && generationCache !== null;
|
|
302
|
+
if (useEntityCache) {
|
|
303
|
+
const cachedEntry = generationCache.get(cacheKey);
|
|
304
|
+
if (cachedEntry && cachedEntry.fingerprint === cacheFingerprint) {
|
|
305
|
+
const allFilesExist = await this.filesExist(cachedEntry.files);
|
|
306
|
+
if (allFilesExist) {
|
|
307
|
+
for (const filePath of cachedEntry.files) {
|
|
308
|
+
this.writeClient.registerOutputFile(filePath);
|
|
309
|
+
}
|
|
310
|
+
if (item.cacheDebug) {
|
|
311
|
+
this.writeClient.logger.info(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.CACHE_HIT(input));
|
|
312
|
+
}
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (item.cacheDebug) {
|
|
317
|
+
this.writeClient.logger.info(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.CACHE_MISS(input));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
const knownFilesBefore = new Set(this.writeClient.getExpectedOutputFilesArray());
|
|
201
321
|
const generatorPlugins = await (0, loadGeneratorPlugins_1.loadGeneratorPlugins)(plugins);
|
|
202
322
|
const context = new Context_1.Context({
|
|
203
323
|
input: absoluteInput,
|
|
@@ -217,7 +337,7 @@ class OpenApiClient {
|
|
|
217
337
|
governanceConfig: governancePolicy,
|
|
218
338
|
});
|
|
219
339
|
const reportPath = await (0, validateOpenApiStrict_1.writeOpenApiStrictReport)(strictReport, reportFile);
|
|
220
|
-
this.writeClient.logger.forceInfo(
|
|
340
|
+
this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.STRICT_REPORT_CREATED(reportPath));
|
|
221
341
|
if (strictReport.summary.errors > 0) {
|
|
222
342
|
throw new Error(`Strict OpenAPI validation failed with ${strictReport.summary.errors} error(s). Report: ${reportPath}`);
|
|
223
343
|
}
|
|
@@ -261,7 +381,6 @@ class OpenApiClient {
|
|
|
261
381
|
request,
|
|
262
382
|
customExecutorPath,
|
|
263
383
|
useCancelableRequest,
|
|
264
|
-
useRequestRaw,
|
|
265
384
|
useSeparatedIndexes,
|
|
266
385
|
validationLibrary,
|
|
267
386
|
emptySchemaStrategy,
|
|
@@ -296,7 +415,6 @@ class OpenApiClient {
|
|
|
296
415
|
request,
|
|
297
416
|
customExecutorPath,
|
|
298
417
|
useCancelableRequest,
|
|
299
|
-
useRequestRaw,
|
|
300
418
|
useSeparatedIndexes,
|
|
301
419
|
validationLibrary,
|
|
302
420
|
emptySchemaStrategy,
|
|
@@ -307,6 +425,65 @@ class OpenApiClient {
|
|
|
307
425
|
break;
|
|
308
426
|
}
|
|
309
427
|
}
|
|
428
|
+
const generatedFiles = this.writeClient.getExpectedOutputFilesArray().filter(filePath => !knownFilesBefore.has(filePath));
|
|
429
|
+
if (item.cache && generationCache) {
|
|
430
|
+
generationCache.set({
|
|
431
|
+
key: cacheKey,
|
|
432
|
+
fingerprint: cacheFingerprint,
|
|
433
|
+
files: generatedFiles,
|
|
434
|
+
updatedAt: Date.now(),
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
getCacheKey(item, absoluteInput) {
|
|
439
|
+
return GenerationCache_1.GenerationCache.hash(JSON.stringify({
|
|
440
|
+
input: absoluteInput,
|
|
441
|
+
output: item.output,
|
|
442
|
+
outputCore: item.outputCore,
|
|
443
|
+
outputServices: item.outputServices,
|
|
444
|
+
outputModels: item.outputModels,
|
|
445
|
+
outputSchemas: item.outputSchemas,
|
|
446
|
+
}));
|
|
447
|
+
}
|
|
448
|
+
async getCacheFingerprint(item, absoluteInput) {
|
|
449
|
+
const specContent = await fileSystemHelpers_1.fileSystemHelpers.readFile(absoluteInput, 'utf8');
|
|
450
|
+
const fingerprint = {
|
|
451
|
+
cacheFingerprintVersion: OpenApiClient.CACHE_FINGERPRINT_VERSION,
|
|
452
|
+
generatorVersion: process.env.npm_package_version || 'dev',
|
|
453
|
+
specHash: GenerationCache_1.GenerationCache.hash(specContent),
|
|
454
|
+
options: {
|
|
455
|
+
httpClient: item.httpClient,
|
|
456
|
+
useOptions: item.useOptions,
|
|
457
|
+
useUnionTypes: item.useUnionTypes,
|
|
458
|
+
includeSchemasFiles: item.includeSchemasFiles,
|
|
459
|
+
excludeCoreServiceFiles: item.excludeCoreServiceFiles,
|
|
460
|
+
request: item.request,
|
|
461
|
+
plugins: item.plugins,
|
|
462
|
+
customExecutorPath: item.customExecutorPath,
|
|
463
|
+
interfacePrefix: item.interfacePrefix,
|
|
464
|
+
enumPrefix: item.enumPrefix,
|
|
465
|
+
typePrefix: item.typePrefix,
|
|
466
|
+
useCancelableRequest: item.useCancelableRequest,
|
|
467
|
+
sortByRequired: item.sortByRequired,
|
|
468
|
+
useSeparatedIndexes: item.useSeparatedIndexes,
|
|
469
|
+
validationLibrary: item.validationLibrary,
|
|
470
|
+
emptySchemaStrategy: item.emptySchemaStrategy,
|
|
471
|
+
useHistory: item.useHistory,
|
|
472
|
+
diffReport: item.diffReport,
|
|
473
|
+
modelsMode: item.modelsMode,
|
|
474
|
+
strictOpenapi: item.strictOpenapi,
|
|
475
|
+
},
|
|
476
|
+
};
|
|
477
|
+
return GenerationCache_1.GenerationCache.hash(JSON.stringify(fingerprint));
|
|
478
|
+
}
|
|
479
|
+
async filesExist(paths) {
|
|
480
|
+
for (const filePath of paths) {
|
|
481
|
+
const exists = await fileSystemHelpers_1.fileSystemHelpers.exists(filePath);
|
|
482
|
+
if (!exists) {
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return true;
|
|
310
487
|
}
|
|
311
488
|
async loadDiffReportIfNeeded(params) {
|
|
312
489
|
return (0, loadDiffReport_1.loadDiffReport)({
|
|
@@ -18,6 +18,7 @@ import { writeClientSchemasIndex } from './utils/writeClientSchemasIndex';
|
|
|
18
18
|
import { writeClientServices } from './utils/writeClientServices';
|
|
19
19
|
import { writeClientServicesIndex } from './utils/writeClientServicesIndex';
|
|
20
20
|
import { writeClientSimpleIndex } from './utils/writeClientSimpleIndex';
|
|
21
|
+
import { WriteFileIfChangedResult } from './utils/writeFileIfChanged';
|
|
21
22
|
/**
|
|
22
23
|
* @param client Client object with all the models, services, etc.
|
|
23
24
|
* @param templates Templates wrapper with all loaded Handlebars templates
|
|
@@ -28,7 +29,6 @@ import { writeClientSimpleIndex } from './utils/writeClientSimpleIndex';
|
|
|
28
29
|
* @param excludeCoreServiceFiles The generation of the core and services is excluded
|
|
29
30
|
* @param request: Path to custom request file
|
|
30
31
|
* @param useCancelableRequest Use cancelable request type.
|
|
31
|
-
* @param useRequestRaw Generate requestRaw methods and ApiResult-based raw stack.
|
|
32
32
|
* @param useSeparatedIndexes Use separate index files for the core, models, schemas, and services
|
|
33
33
|
* @param validationLibrary Validation library to use for schema validation
|
|
34
34
|
*/
|
|
@@ -43,7 +43,6 @@ type TWriteClientProps = {
|
|
|
43
43
|
request?: string;
|
|
44
44
|
customExecutorPath?: string;
|
|
45
45
|
useCancelableRequest?: boolean;
|
|
46
|
-
useRequestRaw?: boolean;
|
|
47
46
|
useSeparatedIndexes?: boolean;
|
|
48
47
|
validationLibrary?: ValidationLibrary;
|
|
49
48
|
emptySchemaStrategy: EmptySchemaStrategy;
|
|
@@ -51,7 +50,7 @@ type TWriteClientProps = {
|
|
|
51
50
|
useProjectPrettier?: boolean;
|
|
52
51
|
useEslintFix?: boolean;
|
|
53
52
|
};
|
|
54
|
-
type TAPIClientGeneratorConfig = Omit<TWriteClientProps, 'httpClient' | 'useOptions' | 'request' | 'useCancelableRequest' | '
|
|
53
|
+
type TAPIClientGeneratorConfig = Omit<TWriteClientProps, 'httpClient' | 'useOptions' | 'request' | 'useCancelableRequest' | 'useSeparatedIndexes'> & {
|
|
55
54
|
schemaModels: Model[];
|
|
56
55
|
};
|
|
57
56
|
/**
|
|
@@ -59,6 +58,8 @@ type TAPIClientGeneratorConfig = Omit<TWriteClientProps, 'httpClient' | 'useOpti
|
|
|
59
58
|
*/
|
|
60
59
|
export declare class WriteClient {
|
|
61
60
|
private config;
|
|
61
|
+
private expectedOutputFiles;
|
|
62
|
+
private writeStats;
|
|
62
63
|
private _logger;
|
|
63
64
|
constructor(logger?: Logger);
|
|
64
65
|
/**
|
|
@@ -74,6 +75,14 @@ export declare class WriteClient {
|
|
|
74
75
|
combineAndWrite(): Promise<void>;
|
|
75
76
|
combineAndWrightSimple(): Promise<void>;
|
|
76
77
|
get logger(): Logger;
|
|
78
|
+
writeOutputFile(filePath: string, content: string): Promise<WriteFileIfChangedResult>;
|
|
79
|
+
registerOutputFile(filePath: string): void;
|
|
80
|
+
getExpectedOutputFiles(): Set<string>;
|
|
81
|
+
getExpectedOutputFilesArray(): string[];
|
|
82
|
+
getWriteStats(): {
|
|
83
|
+
written: number;
|
|
84
|
+
unchanged: number;
|
|
85
|
+
};
|
|
77
86
|
private buildSimpleClientIndexMap;
|
|
78
87
|
private buildClientIndexMap;
|
|
79
88
|
private finalizeAndWrite;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WriteClient.d.ts","sourceRoot":"","sources":["../../src/core/WriteClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAM1C,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;A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AClD,mBAAmB,6BAAuB;IAC1C,wBAAwB,kCAA4B;IACpD,sBAAsB,gCAA0B;IAChD,mBAAmB,6BAAuB;CACpD"}
|
package/dist/core/WriteClient.js
CHANGED
|
@@ -21,11 +21,14 @@ const writeClientSchemasIndex_1 = require("./utils/writeClientSchemasIndex");
|
|
|
21
21
|
const writeClientServices_1 = require("./utils/writeClientServices");
|
|
22
22
|
const writeClientServicesIndex_1 = require("./utils/writeClientServicesIndex");
|
|
23
23
|
const writeClientSimpleIndex_1 = require("./utils/writeClientSimpleIndex");
|
|
24
|
+
const writeFileIfChanged_1 = require("./utils/writeFileIfChanged");
|
|
24
25
|
/**
|
|
25
26
|
* The client which is writing all items and keep the parameters to write index file
|
|
26
27
|
*/
|
|
27
28
|
class WriteClient {
|
|
28
29
|
config = new Map();
|
|
30
|
+
expectedOutputFiles = new Set();
|
|
31
|
+
writeStats = { written: 0, unchanged: 0 };
|
|
29
32
|
_logger;
|
|
30
33
|
constructor(logger) {
|
|
31
34
|
this._logger =
|
|
@@ -40,14 +43,14 @@ class WriteClient {
|
|
|
40
43
|
* Write our OpenAPI client, using the given templates at the given output
|
|
41
44
|
*/
|
|
42
45
|
async writeClient(options) {
|
|
43
|
-
const { client, templates, outputPaths, httpClient, useOptions, useUnionTypes, excludeCoreServiceFiles = false, request, customExecutorPath, useCancelableRequest = false,
|
|
46
|
+
const { client, templates, outputPaths, httpClient, useOptions, useUnionTypes, excludeCoreServiceFiles = false, request, customExecutorPath, useCancelableRequest = false, useSeparatedIndexes = false, validationLibrary = ValidationLibrary_enum_1.ValidationLibrary.NONE, emptySchemaStrategy, modelsMode, useProjectPrettier = false, useEslintFix = false, } = options;
|
|
44
47
|
if (!excludeCoreServiceFiles) {
|
|
45
48
|
const executorPath = (0, pathHelpers_1.resolveHelper)(outputPaths.outputCore, 'executor');
|
|
46
49
|
const interceptorsPath = (0, pathHelpers_1.resolveHelper)(outputPaths.outputCore, 'interceptors');
|
|
47
50
|
await fileSystemHelpers_1.fileSystemHelpers.mkdir(outputPaths.outputCore);
|
|
48
51
|
await fileSystemHelpers_1.fileSystemHelpers.mkdir(executorPath);
|
|
49
52
|
await fileSystemHelpers_1.fileSystemHelpers.mkdir(interceptorsPath);
|
|
50
|
-
await this.writeClientCore({ client, templates, outputCorePath: outputPaths.outputCore, httpClient, request, useCancelableRequest,
|
|
53
|
+
await this.writeClientCore({ client, templates, outputCorePath: outputPaths.outputCore, httpClient, request, useCancelableRequest, modelsMode });
|
|
51
54
|
await this.writeClientCoreIndex({
|
|
52
55
|
templates,
|
|
53
56
|
outputCorePath: outputPaths.outputCore,
|
|
@@ -69,7 +72,6 @@ class WriteClient {
|
|
|
69
72
|
useUnionTypes,
|
|
70
73
|
useOptions,
|
|
71
74
|
useCancelableRequest,
|
|
72
|
-
useRequestRaw,
|
|
73
75
|
useProjectPrettier,
|
|
74
76
|
useEslintFix,
|
|
75
77
|
});
|
|
@@ -159,8 +161,8 @@ class WriteClient {
|
|
|
159
161
|
await fileSystemHelpers_1.fileSystemHelpers.mkdir(outputPaths.outputModels);
|
|
160
162
|
const shouldInlineDtoCore = modelsMode === ModelsMode_enum_1.ModelsMode.CLASSES && excludeCoreServiceFiles;
|
|
161
163
|
if (shouldInlineDtoCore) {
|
|
162
|
-
await
|
|
163
|
-
await
|
|
164
|
+
await this.writeOutputFile((0, pathHelpers_1.resolveHelper)(outputPaths.outputModels, 'BaseDto.ts'), templates.core.baseDto({}));
|
|
165
|
+
await this.writeOutputFile((0, pathHelpers_1.resolveHelper)(outputPaths.outputModels, 'dtoUtils.ts'), templates.core.dtoUtils({}));
|
|
164
166
|
}
|
|
165
167
|
await this.writeClientModels({
|
|
166
168
|
models: client.models,
|
|
@@ -219,6 +221,24 @@ class WriteClient {
|
|
|
219
221
|
get logger() {
|
|
220
222
|
return this._logger;
|
|
221
223
|
}
|
|
224
|
+
async writeOutputFile(filePath, content) {
|
|
225
|
+
this.expectedOutputFiles.add((0, pathHelpers_1.resolveHelper)(process.cwd(), filePath));
|
|
226
|
+
const result = await (0, writeFileIfChanged_1.writeFileIfChanged)(filePath, content);
|
|
227
|
+
this.writeStats[result] += 1;
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
registerOutputFile(filePath) {
|
|
231
|
+
this.expectedOutputFiles.add((0, pathHelpers_1.resolveHelper)(process.cwd(), filePath));
|
|
232
|
+
}
|
|
233
|
+
getExpectedOutputFiles() {
|
|
234
|
+
return this.expectedOutputFiles;
|
|
235
|
+
}
|
|
236
|
+
getExpectedOutputFilesArray() {
|
|
237
|
+
return Array.from(this.expectedOutputFiles);
|
|
238
|
+
}
|
|
239
|
+
getWriteStats() {
|
|
240
|
+
return { ...this.writeStats };
|
|
241
|
+
}
|
|
222
242
|
buildSimpleClientIndexMap() {
|
|
223
243
|
const result = new Map();
|
|
224
244
|
for (const [key, value] of this.config.entries()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBuiltinPlugins.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/getBuiltinPlugins.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBuiltinPlugins.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/getBuiltinPlugins.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,sBAAsB,EAAE,CAE5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadGeneratorPlugins.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/loadGeneratorPlugins.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadGeneratorPlugins.d.ts","sourceRoot":"","sources":["../../../src/core/plugins/loadGeneratorPlugins.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAgDjE;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAcnG"}
|
|
@@ -34,9 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.loadGeneratorPlugins = loadGeneratorPlugins;
|
|
37
|
+
const node_url_1 = require("node:url");
|
|
37
38
|
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
38
39
|
const getBuiltinPlugins_1 = require("./getBuiltinPlugins");
|
|
39
|
-
const node_url_1 = require("node:url");
|
|
40
40
|
/**
|
|
41
41
|
* Type guard for runtime plugin objects.
|
|
42
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/shared/Client.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Client.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/shared/Client.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,WAAW,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Enum } from './Enum.model';
|
|
2
1
|
import type { DiffInfo } from './DiffInfo.model';
|
|
2
|
+
import type { Enum } from './Enum.model';
|
|
3
3
|
import { Import } from './Import.model';
|
|
4
4
|
import type { Schema } from './Schema.model';
|
|
5
5
|
export interface Model extends Schema {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Model.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/shared/Model.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Model.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/shared/Model.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,WAAW,KAAM,SAAQ,MAAM;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACjH,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,UAAU,EAAE,KAAK,EAAE,CAAC;IACpB,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE;QACT,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;KACvB,EAAE,CAAC;IACJ,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -113,4 +113,99 @@ const createInterfaceModel = (name, properties) => ({
|
|
|
113
113
|
node_assert_1.default.strictEqual(preparedUser?.dtoGetters?.[0].oldName, 'oldName');
|
|
114
114
|
node_assert_1.default.strictEqual(preparedUser?.dtoGetters?.[0].newName, 'fullName');
|
|
115
115
|
});
|
|
116
|
+
(0, node_test_1.test)('resolves one-of and dictionary property types', () => {
|
|
117
|
+
const tag = createPrimitiveModel('tag', 'string');
|
|
118
|
+
const tagRef = {
|
|
119
|
+
...createPrimitiveModel('value', 'string'),
|
|
120
|
+
export: 'reference',
|
|
121
|
+
type: 'string',
|
|
122
|
+
isRequired: true,
|
|
123
|
+
};
|
|
124
|
+
const oneOfProp = {
|
|
125
|
+
...createPrimitiveModel('payload', 'string | number'),
|
|
126
|
+
export: 'one-of',
|
|
127
|
+
properties: [createPrimitiveModel('a', 'string'), createPrimitiveModel('b', 'number')],
|
|
128
|
+
isRequired: true,
|
|
129
|
+
};
|
|
130
|
+
const dictProp = {
|
|
131
|
+
...createPrimitiveModel('tags', 'Record<string, string>'),
|
|
132
|
+
export: 'dictionary',
|
|
133
|
+
link: tagRef,
|
|
134
|
+
isRequired: false,
|
|
135
|
+
};
|
|
136
|
+
const container = createInterfaceModel('IContainer', [oneOfProp, dictProp]);
|
|
137
|
+
const client = {
|
|
138
|
+
version: '1.0.0',
|
|
139
|
+
server: 'http://localhost',
|
|
140
|
+
models: [container, tag],
|
|
141
|
+
services: [],
|
|
142
|
+
};
|
|
143
|
+
const prepared = (0, prepareDtoModels_1.prepareDtoModels)(client);
|
|
144
|
+
const preparedContainer = prepared.models.find(model => model.name === 'IContainer');
|
|
145
|
+
const preparedOneOf = preparedContainer?.properties.find(prop => prop.name === 'payload');
|
|
146
|
+
const preparedDict = preparedContainer?.properties.find(prop => prop.name === 'tags');
|
|
147
|
+
node_assert_1.default.ok(preparedOneOf?.dtoType?.includes('|'));
|
|
148
|
+
node_assert_1.default.match(preparedDict?.dtoType ?? '', /Record<string, string>/);
|
|
149
|
+
});
|
|
150
|
+
(0, node_test_1.test)('resolves enum property types in dtoType', () => {
|
|
151
|
+
const statusEnum = {
|
|
152
|
+
...createPrimitiveModel('Status', 'string'),
|
|
153
|
+
export: 'enum',
|
|
154
|
+
enum: [
|
|
155
|
+
{ name: 'Active', value: "'active'", type: 'string', description: null },
|
|
156
|
+
{ name: 'Inactive', value: "'inactive'", type: 'string', description: null },
|
|
157
|
+
],
|
|
158
|
+
};
|
|
159
|
+
const statusProp = {
|
|
160
|
+
...createPrimitiveModel('status', 'string'),
|
|
161
|
+
export: 'enum',
|
|
162
|
+
enum: statusEnum.enum,
|
|
163
|
+
isRequired: true,
|
|
164
|
+
};
|
|
165
|
+
const model = createInterfaceModel('IUser', [statusProp]);
|
|
166
|
+
const client = {
|
|
167
|
+
version: '1.0.0',
|
|
168
|
+
server: 'http://localhost',
|
|
169
|
+
models: [model, statusEnum],
|
|
170
|
+
services: [],
|
|
171
|
+
};
|
|
172
|
+
const prepared = (0, prepareDtoModels_1.prepareDtoModels)(client);
|
|
173
|
+
const property = prepared.models[0]?.properties[0];
|
|
174
|
+
node_assert_1.default.match(property?.dtoType ?? '', /active/);
|
|
175
|
+
node_assert_1.default.match(property?.dtoType ?? '', /inactive/);
|
|
176
|
+
});
|
|
177
|
+
(0, node_test_1.test)('uses optional toJSON for non-required reference properties', () => {
|
|
178
|
+
const profile = createInterfaceModel('IProfile', [createPrimitiveModel('bio', 'string')]);
|
|
179
|
+
const profileRef = {
|
|
180
|
+
...createPrimitiveModel('profile', 'IProfile'),
|
|
181
|
+
export: 'reference',
|
|
182
|
+
type: 'IProfile',
|
|
183
|
+
isRequired: false,
|
|
184
|
+
};
|
|
185
|
+
const user = createInterfaceModel('IUser', [profileRef]);
|
|
186
|
+
const client = {
|
|
187
|
+
version: '1.0.0',
|
|
188
|
+
server: 'http://localhost',
|
|
189
|
+
models: [user, profile],
|
|
190
|
+
services: [],
|
|
191
|
+
};
|
|
192
|
+
const prepared = (0, prepareDtoModels_1.prepareDtoModels)(client);
|
|
193
|
+
const property = prepared.models.find(m => m.name === 'IUser')?.properties[0];
|
|
194
|
+
node_assert_1.default.match(property?.dtoInit ?? '', /\? new IProfileDto/);
|
|
195
|
+
node_assert_1.default.match(property?.dtoToJSON ?? '', /\? this.profile.toJSON/);
|
|
196
|
+
});
|
|
197
|
+
(0, node_test_1.test)('uses bracket accessor for quoted property names', () => {
|
|
198
|
+
const quotedProp = createPrimitiveModel("'weird-name'", 'string');
|
|
199
|
+
const model = createInterfaceModel('IQuoted', [quotedProp]);
|
|
200
|
+
const client = {
|
|
201
|
+
version: '1.0.0',
|
|
202
|
+
server: 'http://localhost',
|
|
203
|
+
models: [model],
|
|
204
|
+
services: [],
|
|
205
|
+
};
|
|
206
|
+
const prepared = (0, prepareDtoModels_1.prepareDtoModels)(client);
|
|
207
|
+
const property = prepared.models[0]?.properties[0];
|
|
208
|
+
node_assert_1.default.strictEqual(property?.dtoInit, "data['weird-name']");
|
|
209
|
+
node_assert_1.default.strictEqual(property?.dtoTarget, "['weird-name']");
|
|
210
|
+
});
|
|
116
211
|
});
|
|
@@ -38,7 +38,6 @@ const templates_1 = require("../__mocks__/templates");
|
|
|
38
38
|
useUnionTypes: false,
|
|
39
39
|
useOptions: false,
|
|
40
40
|
useCancelableRequest: false,
|
|
41
|
-
useRequestRaw: true,
|
|
42
41
|
});
|
|
43
42
|
node_assert_1.default.ok(writeFileCalls.some(([filePath, content]) => filePath.toString().includes('MyService.ts') && content.toString().includes('service')), 'Expected writeFile to be called with service content for MyService.ts');
|
|
44
43
|
// Restoring the original function
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadDiffReport.d.ts","sourceRoot":"","sources":["../../../src/core/utils/loadDiffReport.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"loadDiffReport.d.ts","sourceRoot":"","sources":["../../../src/core/utils/loadDiffReport.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC7C,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,KAAK,CAAC,EAAE;QACJ,Y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