ts-openapi-codegen 2.1.0-beta.5 → 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/README.md +3 -0
- package/README.rus.md +3 -0
- 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.d.ts +2 -0
- package/dist/cli/checkAndUpdateConfig/__tests__/checkConfig.test.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/__tests__/checkConfig.test.js +53 -0
- package/dist/cli/checkAndUpdateConfig/__tests__/updateConfig.test.d.ts +2 -0
- package/dist/cli/checkAndUpdateConfig/__tests__/updateConfig.test.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/__tests__/updateConfig.test.js +52 -0
- 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/__tests__/prepareConfigData.test.d.ts +2 -0
- package/dist/cli/checkAndUpdateConfig/utils/__tests__/prepareConfigData.test.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/__tests__/prepareConfigData.test.js +20 -0
- package/dist/cli/checkAndUpdateConfig/utils/__tests__/removeDefaultConfigValues.test.d.ts +2 -0
- package/dist/cli/checkAndUpdateConfig/utils/__tests__/removeDefaultConfigValues.test.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/__tests__/removeDefaultConfigValues.test.js +35 -0
- package/dist/cli/checkAndUpdateConfig/utils/__tests__/validateAndMigrateConfigData.test.d.ts +2 -0
- package/dist/cli/checkAndUpdateConfig/utils/__tests__/validateAndMigrateConfigData.test.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/__tests__/validateAndMigrateConfigData.test.js +59 -0
- 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 -7
- package/dist/cli/initOpenApiConfig/__tests__/init.test.d.ts +2 -0
- package/dist/cli/initOpenApiConfig/__tests__/init.test.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/__tests__/init.test.js +20 -0
- package/dist/cli/initOpenApiConfig/__tests__/initConfig.test.d.ts +2 -0
- package/dist/cli/initOpenApiConfig/__tests__/initConfig.test.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/__tests__/initConfig.test.js +49 -0
- 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 -1
- package/dist/cli/initOpenApiConfig/utils/__tests__/buildConfig.test.d.ts +2 -0
- package/dist/cli/initOpenApiConfig/utils/__tests__/buildConfig.test.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/utils/__tests__/buildConfig.test.js +99 -0
- package/dist/cli/initOpenApiConfig/utils/__tests__/findSpecFiles.test.d.ts +2 -0
- package/dist/cli/initOpenApiConfig/utils/__tests__/findSpecFiles.test.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/utils/__tests__/findSpecFiles.test.js +45 -0
- package/dist/cli/initOpenApiConfig/utils/__tests__/validateSpecFiles.test.d.ts +2 -0
- package/dist/cli/initOpenApiConfig/utils/__tests__/validateSpecFiles.test.d.ts.map +1 -0
- package/dist/cli/initOpenApiConfig/utils/__tests__/validateSpecFiles.test.js +61 -0
- 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/previewChanges/utils/__tests__/compareFiles.test.d.ts +2 -0
- package/dist/cli/previewChanges/utils/__tests__/compareFiles.test.d.ts.map +1 -0
- package/dist/cli/previewChanges/utils/__tests__/compareFiles.test.js +52 -0
- package/dist/cli/previewChanges/utils/__tests__/isDirectoryEmpty.test.d.ts +2 -0
- package/dist/cli/previewChanges/utils/__tests__/isDirectoryEmpty.test.d.ts.map +1 -0
- package/dist/cli/previewChanges/utils/__tests__/isDirectoryEmpty.test.js +43 -0
- package/dist/cli/previewChanges/utils/__tests__/readDirectoryRecursive.test.d.ts +2 -0
- package/dist/cli/previewChanges/utils/__tests__/readDirectoryRecursive.test.d.ts.map +1 -0
- package/dist/cli/previewChanges/utils/__tests__/readDirectoryRecursive.test.js +32 -0
- package/dist/cli/previewChanges/utils/__tests__/updateOutputPaths.test.d.ts +2 -0
- package/dist/cli/previewChanges/utils/__tests__/updateOutputPaths.test.d.ts.map +1 -0
- package/dist/cli/previewChanges/utils/__tests__/updateOutputPaths.test.js +68 -0
- package/dist/cli/schemas/__tests__/checkConfigAndUpdate.test.d.ts +2 -0
- package/dist/cli/schemas/__tests__/checkConfigAndUpdate.test.d.ts.map +1 -0
- package/dist/cli/schemas/__tests__/checkConfigAndUpdate.test.js +36 -0
- package/dist/cli/schemas/__tests__/generateOptionsSchema.test.d.ts +2 -0
- package/dist/cli/schemas/__tests__/generateOptionsSchema.test.d.ts.map +1 -0
- package/dist/cli/schemas/__tests__/generateOptionsSchema.test.js +59 -0
- package/dist/cli/schemas/__tests__/initOptionsSchema.test.d.ts +2 -0
- package/dist/cli/schemas/__tests__/initOptionsSchema.test.d.ts.map +1 -0
- package/dist/cli/schemas/__tests__/initOptionsSchema.test.js +43 -0
- package/dist/cli/schemas/__tests__/previewChangesSchema.test.d.ts +2 -0
- package/dist/cli/schemas/__tests__/previewChangesSchema.test.d.ts.map +1 -0
- package/dist/cli/schemas/__tests__/previewChangesSchema.test.js +31 -0
- 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/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 -1
- 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/UnifiedOptionsSchemaV5.d.ts +7 -0
- 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 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.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 +6 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +1 -1
- package/dist/core/OpenApiClient.d.ts +12 -1
- package/dist/core/OpenApiClient.d.ts.map +1 -1
- package/dist/core/OpenApiClient.js +192 -10
- package/dist/core/WriteClient.d.ts +11 -0
- package/dist/core/WriteClient.d.ts.map +1 -1
- package/dist/core/WriteClient.js +23 -2
- 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/GenerationCache.d.ts +18 -0
- package/dist/core/utils/GenerationCache.d.ts.map +1 -0
- package/dist/core/utils/GenerationCache.js +41 -0
- package/dist/core/utils/__tests__/GenerationCache.test.d.ts +2 -0
- package/dist/core/utils/__tests__/GenerationCache.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/GenerationCache.test.js +37 -0
- package/dist/core/utils/__tests__/loadDiffReport.test.d.ts +2 -0
- package/dist/core/utils/__tests__/loadDiffReport.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/loadDiffReport.test.js +97 -0
- package/dist/core/utils/__tests__/prepareDtoModels.test.js +95 -0
- package/dist/core/utils/__tests__/templateRendering.test.d.ts +2 -0
- package/dist/core/utils/__tests__/templateRendering.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/templateRendering.test.js +119 -0
- package/dist/core/utils/__tests__/writeFileIfChanged.test.d.ts +2 -0
- package/dist/core/utils/__tests__/writeFileIfChanged.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/writeFileIfChanged.test.js +30 -0
- 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.map +1 -1
- package/dist/core/utils/writeClientCore.js +18 -16
- 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.map +1 -1
- package/dist/core/utils/writeClientServices.js +6 -6
- 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/core/utils/writeFileIfChanged.d.ts +3 -0
- package/dist/core/utils/writeFileIfChanged.d.ts.map +1 -0
- package/dist/core/utils/writeFileIfChanged.js +22 -0
- 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 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readDirectoryRecursive.test.d.ts","sourceRoot":"","sources":["../../../../../src/cli/previewChanges/utils/__tests__/readDirectoryRecursive.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_test_1 = require("node:test");
|
|
10
|
+
const readDirectoryRecursive_1 = require("../readDirectoryRecursive");
|
|
11
|
+
const createTempDir = (t, prefix) => {
|
|
12
|
+
const root = node_path_1.default.join(__dirname, 'generated');
|
|
13
|
+
node_fs_1.default.mkdirSync(root, { recursive: true });
|
|
14
|
+
const tempDir = node_fs_1.default.mkdtempSync(node_path_1.default.join(root, prefix));
|
|
15
|
+
t.after(() => {
|
|
16
|
+
node_fs_1.default.rmSync(tempDir, { recursive: true, force: true });
|
|
17
|
+
});
|
|
18
|
+
return tempDir;
|
|
19
|
+
};
|
|
20
|
+
(0, node_test_1.describe)('@unit: readDirectoryRecursive', () => {
|
|
21
|
+
(0, node_test_1.test)('returns relative paths for nested files', async (t) => {
|
|
22
|
+
const dir = createTempDir(t, 'read-recursive-');
|
|
23
|
+
const nested = node_path_1.default.join(dir, 'nested');
|
|
24
|
+
node_fs_1.default.mkdirSync(nested, { recursive: true });
|
|
25
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(dir, 'root.ts'), 'export {}');
|
|
26
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(nested, 'child.ts'), 'export {}');
|
|
27
|
+
const files = await (0, readDirectoryRecursive_1.readDirectoryRecursive)(dir);
|
|
28
|
+
node_assert_1.default.ok(files.includes('root.ts'));
|
|
29
|
+
node_assert_1.default.ok(files.some(file => file.endsWith('child.ts')));
|
|
30
|
+
node_assert_1.default.strictEqual(files.length, 2);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateOutputPaths.test.d.ts","sourceRoot":"","sources":["../../../../../src/cli/previewChanges/utils/__tests__/updateOutputPaths.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const node_test_1 = require("node:test");
|
|
9
|
+
const HttpClient_enum_1 = require("../../../../core/types/enums/HttpClient.enum");
|
|
10
|
+
const updateOutputPaths_1 = require("../updateOutputPaths");
|
|
11
|
+
(0, node_test_1.describe)('@unit: updateOutputPaths', () => {
|
|
12
|
+
(0, node_test_1.test)('rewrites output inside generatedDir to previewDir', () => {
|
|
13
|
+
const generatedDir = './test/generated';
|
|
14
|
+
const previewDir = './generated-preview';
|
|
15
|
+
const options = {
|
|
16
|
+
input: './test/spec/v3.json',
|
|
17
|
+
output: node_path_1.default.join(generatedDir, 'api'),
|
|
18
|
+
httpClient: HttpClient_enum_1.HttpClient.FETCH,
|
|
19
|
+
};
|
|
20
|
+
const updated = (0, updateOutputPaths_1.updateOutputPaths)(options, previewDir, generatedDir);
|
|
21
|
+
node_assert_1.default.strictEqual(updated.output, node_path_1.default.join(previewDir, 'api'));
|
|
22
|
+
});
|
|
23
|
+
(0, node_test_1.test)('uses basename when output escapes generatedDir via ../', () => {
|
|
24
|
+
const generatedDir = './test/generated';
|
|
25
|
+
const previewDir = './generated-preview';
|
|
26
|
+
const options = {
|
|
27
|
+
input: './test/spec/v3.json',
|
|
28
|
+
output: '../outside/api',
|
|
29
|
+
httpClient: HttpClient_enum_1.HttpClient.FETCH,
|
|
30
|
+
};
|
|
31
|
+
const updated = (0, updateOutputPaths_1.updateOutputPaths)(options, previewDir, generatedDir);
|
|
32
|
+
node_assert_1.default.strictEqual(updated.output, node_path_1.default.join(previewDir, 'api'));
|
|
33
|
+
});
|
|
34
|
+
(0, node_test_1.test)('rewrites outputCore and sibling paths for flat config', () => {
|
|
35
|
+
const generatedDir = './test/generated';
|
|
36
|
+
const previewDir = './generated-preview';
|
|
37
|
+
const options = {
|
|
38
|
+
input: './test/spec/v3.json',
|
|
39
|
+
output: node_path_1.default.join(generatedDir, 'api'),
|
|
40
|
+
outputCore: node_path_1.default.join(generatedDir, 'api', 'core'),
|
|
41
|
+
outputServices: node_path_1.default.join(generatedDir, 'api', 'services'),
|
|
42
|
+
outputModels: node_path_1.default.join(generatedDir, 'api', 'models'),
|
|
43
|
+
outputSchemas: node_path_1.default.join(generatedDir, 'api', 'schemas'),
|
|
44
|
+
httpClient: HttpClient_enum_1.HttpClient.FETCH,
|
|
45
|
+
};
|
|
46
|
+
const updated = (0, updateOutputPaths_1.updateOutputPaths)(options, previewDir, generatedDir);
|
|
47
|
+
node_assert_1.default.strictEqual(updated.output, node_path_1.default.join(previewDir, 'api'));
|
|
48
|
+
node_assert_1.default.ok(updated.outputCore?.includes('core'));
|
|
49
|
+
node_assert_1.default.ok(updated.outputServices?.includes('services'));
|
|
50
|
+
node_assert_1.default.ok(updated.outputModels?.includes('models'));
|
|
51
|
+
node_assert_1.default.ok(updated.outputSchemas?.includes('schemas'));
|
|
52
|
+
});
|
|
53
|
+
(0, node_test_1.test)('updates items array for multi-option config', () => {
|
|
54
|
+
const generatedDir = './test/generated';
|
|
55
|
+
const previewDir = './generated-preview';
|
|
56
|
+
const options = {
|
|
57
|
+
items: [
|
|
58
|
+
{ input: './a.json', output: node_path_1.default.join(generatedDir, 'client-a') },
|
|
59
|
+
{ input: './b.json', output: node_path_1.default.join(generatedDir, 'client-b') },
|
|
60
|
+
],
|
|
61
|
+
httpClient: HttpClient_enum_1.HttpClient.FETCH,
|
|
62
|
+
};
|
|
63
|
+
const updated = (0, updateOutputPaths_1.updateOutputPaths)(options, previewDir, generatedDir);
|
|
64
|
+
node_assert_1.default.strictEqual(updated.items?.length, 2);
|
|
65
|
+
node_assert_1.default.strictEqual(updated.items?.[0].output, node_path_1.default.join(previewDir, 'client-a'));
|
|
66
|
+
node_assert_1.default.strictEqual(updated.items?.[1].output, node_path_1.default.join(previewDir, 'client-b'));
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkConfigAndUpdate.test.d.ts","sourceRoot":"","sources":["../../../../src/cli/schemas/__tests__/checkConfigAndUpdate.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
+
const node_test_1 = require("node:test");
|
|
8
|
+
const checkConfig_1 = require("../checkConfig");
|
|
9
|
+
const updateConfig_1 = require("../updateConfig");
|
|
10
|
+
(0, node_test_1.describe)('@unit: checkConfig and updateConfig schemas', () => {
|
|
11
|
+
(0, node_test_1.test)('checkConfigOptionsSchema accepts empty options', () => {
|
|
12
|
+
const parsed = checkConfig_1.checkConfigOptionsSchema.safeParse({});
|
|
13
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
14
|
+
});
|
|
15
|
+
(0, node_test_1.test)('checkConfigOptionsSchema accepts openapiConfig path', () => {
|
|
16
|
+
const parsed = checkConfig_1.checkConfigOptionsSchema.safeParse({
|
|
17
|
+
openapiConfig: './custom/openapi.config.json',
|
|
18
|
+
});
|
|
19
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
20
|
+
});
|
|
21
|
+
(0, node_test_1.test)('checkConfigOptionsSchema treats empty openapiConfig as undefined', () => {
|
|
22
|
+
const parsed = checkConfig_1.checkConfigOptionsSchema.safeParse({
|
|
23
|
+
openapiConfig: '',
|
|
24
|
+
});
|
|
25
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
26
|
+
if (parsed.success) {
|
|
27
|
+
node_assert_1.default.strictEqual(parsed.data.openapiConfig, undefined);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
(0, node_test_1.test)('updateConfigOptionsSchema accepts valid paths', () => {
|
|
31
|
+
const parsed = updateConfig_1.updateConfigOptionsSchema.safeParse({
|
|
32
|
+
openapiConfig: './openapi.config.json',
|
|
33
|
+
});
|
|
34
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateOptionsSchema.test.d.ts","sourceRoot":"","sources":["../../../../src/cli/schemas/__tests__/generateOptionsSchema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
+
const node_test_1 = require("node:test");
|
|
8
|
+
const generate_1 = require("../generate");
|
|
9
|
+
(0, node_test_1.describe)('@unit: generateOptionsSchema', () => {
|
|
10
|
+
(0, node_test_1.test)('accepts openapiConfig only', () => {
|
|
11
|
+
const parsed = generate_1.generateOptionsSchema.safeParse({
|
|
12
|
+
openapiConfig: './openapi.config.json',
|
|
13
|
+
});
|
|
14
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
15
|
+
});
|
|
16
|
+
(0, node_test_1.test)('accepts input and output without config', () => {
|
|
17
|
+
const parsed = generate_1.generateOptionsSchema.safeParse({
|
|
18
|
+
input: './spec.json',
|
|
19
|
+
output: './generated',
|
|
20
|
+
});
|
|
21
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
22
|
+
});
|
|
23
|
+
(0, node_test_1.test)('rejects both openapiConfig and input/output', () => {
|
|
24
|
+
const parsed = generate_1.generateOptionsSchema.safeParse({
|
|
25
|
+
openapiConfig: './openapi.config.json',
|
|
26
|
+
input: './spec.json',
|
|
27
|
+
output: './generated',
|
|
28
|
+
});
|
|
29
|
+
node_assert_1.default.strictEqual(parsed.success, false);
|
|
30
|
+
});
|
|
31
|
+
(0, node_test_1.test)('rejects when neither config nor input/output is provided', () => {
|
|
32
|
+
const parsed = generate_1.generateOptionsSchema.safeParse({});
|
|
33
|
+
node_assert_1.default.strictEqual(parsed.success, false);
|
|
34
|
+
});
|
|
35
|
+
(0, node_test_1.test)('requires non-empty input when using direct generation', () => {
|
|
36
|
+
const parsed = generate_1.generateOptionsSchema.safeParse({
|
|
37
|
+
input: ' ',
|
|
38
|
+
output: './generated',
|
|
39
|
+
});
|
|
40
|
+
node_assert_1.default.strictEqual(parsed.success, false);
|
|
41
|
+
});
|
|
42
|
+
(0, node_test_1.test)('requires non-empty output when using direct generation', () => {
|
|
43
|
+
const parsed = generate_1.generateOptionsSchema.safeParse({
|
|
44
|
+
input: './spec.json',
|
|
45
|
+
output: '',
|
|
46
|
+
});
|
|
47
|
+
node_assert_1.default.strictEqual(parsed.success, false);
|
|
48
|
+
});
|
|
49
|
+
(0, node_test_1.test)('accepts cache-related flags with config path', () => {
|
|
50
|
+
const parsed = generate_1.generateOptionsSchema.safeParse({
|
|
51
|
+
openapiConfig: './openapi.config.json',
|
|
52
|
+
cache: true,
|
|
53
|
+
cachePath: '.cache.json',
|
|
54
|
+
cacheStrategy: 'entity',
|
|
55
|
+
cacheDebug: true,
|
|
56
|
+
});
|
|
57
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initOptionsSchema.test.d.ts","sourceRoot":"","sources":["../../../../src/cli/schemas/__tests__/initOptionsSchema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
+
const node_test_1 = require("node:test");
|
|
8
|
+
const init_1 = require("../init");
|
|
9
|
+
(0, node_test_1.describe)('@unit: initOptionsSchema', () => {
|
|
10
|
+
(0, node_test_1.test)('accepts minimal options', () => {
|
|
11
|
+
const parsed = init_1.initOptionsSchema.safeParse({});
|
|
12
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
13
|
+
});
|
|
14
|
+
(0, node_test_1.test)('accepts interactive init flags', () => {
|
|
15
|
+
const parsed = init_1.initOptionsSchema.safeParse({
|
|
16
|
+
specsDir: './openapi',
|
|
17
|
+
request: './src/custom/request.ts',
|
|
18
|
+
useCancelableRequest: true,
|
|
19
|
+
useInteractiveMode: true,
|
|
20
|
+
});
|
|
21
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
22
|
+
});
|
|
23
|
+
(0, node_test_1.test)('converts empty strings to undefined', () => {
|
|
24
|
+
const parsed = init_1.initOptionsSchema.safeParse({
|
|
25
|
+
specsDir: '',
|
|
26
|
+
request: '',
|
|
27
|
+
});
|
|
28
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
29
|
+
if (parsed.success) {
|
|
30
|
+
node_assert_1.default.strictEqual(parsed.data.specsDir, undefined);
|
|
31
|
+
node_assert_1.default.strictEqual(parsed.data.request, undefined);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
(0, node_test_1.test)('treats empty openapiConfig as undefined', () => {
|
|
35
|
+
const parsed = init_1.initOptionsSchema.safeParse({
|
|
36
|
+
openapiConfig: '',
|
|
37
|
+
});
|
|
38
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
39
|
+
if (parsed.success) {
|
|
40
|
+
node_assert_1.default.strictEqual(parsed.data.openapiConfig, undefined);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"previewChangesSchema.test.d.ts","sourceRoot":"","sources":["../../../../src/cli/schemas/__tests__/previewChangesSchema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
7
|
+
const node_test_1 = require("node:test");
|
|
8
|
+
const previewChanges_1 = require("../previewChanges");
|
|
9
|
+
(0, node_test_1.describe)('@unit: previewChangesSchema', () => {
|
|
10
|
+
(0, node_test_1.test)('accepts preview directories', () => {
|
|
11
|
+
const parsed = previewChanges_1.previewChangesSchema.safeParse({
|
|
12
|
+
generatedDir: './test/generated',
|
|
13
|
+
previewDir: './generated-preview',
|
|
14
|
+
diffDir: './diff-preview',
|
|
15
|
+
});
|
|
16
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
17
|
+
});
|
|
18
|
+
(0, node_test_1.test)('treats empty strings as undefined', () => {
|
|
19
|
+
const parsed = previewChanges_1.previewChangesSchema.safeParse({
|
|
20
|
+
generatedDir: '',
|
|
21
|
+
previewDir: '',
|
|
22
|
+
diffDir: '',
|
|
23
|
+
});
|
|
24
|
+
node_assert_1.default.strictEqual(parsed.success, true);
|
|
25
|
+
if (parsed.success) {
|
|
26
|
+
node_assert_1.default.strictEqual(parsed.data.generatedDir, undefined);
|
|
27
|
+
node_assert_1.default.strictEqual(parsed.data.previewDir, undefined);
|
|
28
|
+
node_assert_1.default.strictEqual(parsed.data.diffDir, undefined);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const analyzeUsageOptionsSchema: z.ZodObject<{
|
|
3
|
+
apiRoot: z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>>;
|
|
4
|
+
projectRoot: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
5
|
+
tsconfig: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
6
|
+
reportFile: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
7
|
+
mdReport: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
8
|
+
failOn: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
9
|
+
generatedEntry: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
10
|
+
openapiConfig: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type AnalyzeUsageOptions = z.infer<typeof analyzeUsageOptionsSchema>;
|
|
13
|
+
//# sourceMappingURL=analyzeUsage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzeUsage.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/analyzeUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,yBAAyB;;;;;;;;;iBA+BhC,CAAC;AAEP,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.analyzeUsageOptionsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const Consts_1 = require("../../common/Consts");
|
|
6
|
+
const base_1 = require("./base");
|
|
7
|
+
const failOnCategorySchema = zod_1.z.enum(['unusedExports', 'unresolvedImports', 'structuralChanges', 'typingIssues']);
|
|
8
|
+
exports.analyzeUsageOptionsSchema = zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
...base_1.baseCLIOptionsSchema.shape,
|
|
11
|
+
apiRoot: base_1.emptyStringToUndefined.default(Consts_1.DEFAULT_OUTPUT_API_DIR),
|
|
12
|
+
projectRoot: base_1.emptyStringToUndefined,
|
|
13
|
+
tsconfig: base_1.emptyStringToUndefined,
|
|
14
|
+
reportFile: base_1.emptyStringToUndefined,
|
|
15
|
+
mdReport: base_1.emptyStringToUndefined,
|
|
16
|
+
failOn: base_1.emptyStringToUndefined,
|
|
17
|
+
generatedEntry: base_1.emptyStringToUndefined,
|
|
18
|
+
})
|
|
19
|
+
.superRefine((data, ctx) => {
|
|
20
|
+
if (!data.apiRoot) {
|
|
21
|
+
ctx.addIssue({
|
|
22
|
+
code: 'custom',
|
|
23
|
+
message: '"--api-root" is required for analyze-usage command',
|
|
24
|
+
path: ['apiRoot'],
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (data.failOn && data.failOn !== 'none') {
|
|
28
|
+
for (const category of data.failOn.split(',').map(item => item.trim()).filter(Boolean)) {
|
|
29
|
+
if (!failOnCategorySchema.safeParse(category).success) {
|
|
30
|
+
ctx.addIssue({
|
|
31
|
+
code: 'custom',
|
|
32
|
+
message: `Unsupported --fail-on category: ${category}`,
|
|
33
|
+
path: ['failOn'],
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -11,6 +11,13 @@ export declare const generateOptionsSchema: z.ZodObject<{
|
|
|
11
11
|
useProjectPrettier: z.ZodOptional<z.ZodBoolean>;
|
|
12
12
|
useEslintFix: z.ZodOptional<z.ZodBoolean>;
|
|
13
13
|
governanceConfig: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
14
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
cachePath: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
16
|
+
cacheStrategy: z.ZodOptional<z.ZodEnum<{
|
|
17
|
+
content: "content";
|
|
18
|
+
entity: "entity";
|
|
19
|
+
}>>;
|
|
20
|
+
cacheDebug: z.ZodOptional<z.ZodBoolean>;
|
|
14
21
|
openapiConfig: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
|
|
15
22
|
}, z.core.$strip>;
|
|
16
23
|
export type GenerateOptions = z.infer<typeof generateOptionsSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAGpE,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAGpE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;iBAuD5B,CAAC;AAEP,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -17,6 +17,10 @@ exports.generateOptionsSchema = zod_1.z
|
|
|
17
17
|
useProjectPrettier: zod_1.z.boolean().optional(),
|
|
18
18
|
useEslintFix: zod_1.z.boolean().optional(),
|
|
19
19
|
governanceConfig: base_1.emptyStringToUndefined,
|
|
20
|
+
cache: zod_1.z.boolean().optional(),
|
|
21
|
+
cachePath: base_1.emptyStringToUndefined,
|
|
22
|
+
cacheStrategy: zod_1.z.enum(['content', 'entity']).optional(),
|
|
23
|
+
cacheDebug: zod_1.z.boolean().optional(),
|
|
20
24
|
})
|
|
21
25
|
.superRefine((data, ctx) => {
|
|
22
26
|
const hasInput = !!data.input;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from './analyzeDiff';
|
|
2
|
+
export * from './analyzeUsage';
|
|
2
3
|
export * from './base';
|
|
3
4
|
export * from './checkConfig';
|
|
4
5
|
export * from './generate';
|
|
5
6
|
export * from './init';
|
|
6
7
|
export * from './previewChanges';
|
|
7
8
|
export * from './updateConfig';
|
|
8
|
-
export
|
|
9
|
-
export type CLIOptions = import('./analyzeDiff').AnalyzeDiffOptions | import('./generate').GenerateOptions | import('./checkConfig').CheckConfigOptions | import('./updateConfig').UpdateConfigOptions | import('./init').InitOptions | import('./previewChanges').TPreviewChangesOptions | import('./analyzeDiff').AnalyzeDiffOptions;
|
|
9
|
+
export type CLIOptions = import('./analyzeDiff').AnalyzeDiffOptions | import('./generate').GenerateOptions | import('./checkConfig').CheckConfigOptions | import('./updateConfig').UpdateConfigOptions | import('./init').InitOptions | import('./previewChanges').TPreviewChangesOptions | import('./analyzeDiff').AnalyzeDiffOptions | import('./analyzeUsage').AnalyzeUsageOptions;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAG/B,MAAM,MAAM,UAAU,GAChB,OAAO,eAAe,EAAE,kBAAkB,GAC1C,OAAO,YAAY,EAAE,eAAe,GACpC,OAAO,eAAe,EAAE,kBAAkB,GAC1C,OAAO,gBAAgB,EAAE,mBAAmB,GAC5C,OAAO,QAAQ,EAAE,WAAW,GAC5B,OAAO,kBAAkB,EAAE,sBAAsB,GACjD,OAAO,eAAe,EAAE,kBAAkB,GAC1C,OAAO,gBAAgB,EAAE,mBAAmB,CAAC"}
|
|
@@ -15,10 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./analyzeDiff"), exports);
|
|
18
|
+
__exportStar(require("./analyzeUsage"), exports);
|
|
18
19
|
__exportStar(require("./base"), exports);
|
|
19
20
|
__exportStar(require("./checkConfig"), exports);
|
|
20
21
|
__exportStar(require("./generate"), exports);
|
|
21
22
|
__exportStar(require("./init"), exports);
|
|
22
23
|
__exportStar(require("./previewChanges"), exports);
|
|
23
24
|
__exportStar(require("./updateConfig"), exports);
|
|
24
|
-
__exportStar(require("./analyzeDiff"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
package/dist/common/Consts.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Logger } from './Logger';
|
|
|
2
2
|
import { TStrictFlatOptions } from './TRawOptions';
|
|
3
3
|
export declare const DEFAULT_OPENAPI_CONFIG_FILENAME = "openapi.config.json";
|
|
4
4
|
export declare const DEFAULT_ANALYZE_DIFF_REPORT_PATH = "./openapi-diff-report.json";
|
|
5
|
+
export declare const DEFAULT_ANALYZE_USAGE_REPORT_PATH = "./openapi-usage-report.json";
|
|
5
6
|
export declare const COMMON_DEFAULT_OPTIONS_VALUES: TStrictFlatOptions;
|
|
6
7
|
export declare const APP_LOGGER: Logger;
|
|
7
8
|
export declare const DEFAULT_SPECS_DIR = "openapi/";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Consts.d.ts","sourceRoot":"","sources":["../../src/common/Consts.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AACrE,eAAO,MAAM,gCAAgC,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"Consts.d.ts","sourceRoot":"","sources":["../../src/common/Consts.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AACrE,eAAO,MAAM,gCAAgC,+BAA+B,CAAC;AAC7E,eAAO,MAAM,iCAAiC,gCAAgC,CAAC;AAE/E,eAAO,MAAM,6BAA6B,EAAE,kBAwC3C,CAAC;AAEF,eAAO,MAAM,UAAU,QAIrB,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C,eAAO,MAAM,2BAA2B,4BAA4B,CAAA;AAEpE,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD,eAAO,MAAM,2BAA2B,0CAA0C,CAAC;AAEnF,eAAO,MAAM,wBAAwB,uCAAuC,CAAC"}
|
package/dist/common/Consts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_DIFF_CHANGES_DIR = exports.DEFAULT_PREVIEW_CHANGES_DIR = exports.DEFAULT_OUTPUT_API_DIR = exports.DEFAULT_CUSTOM_REQUEST_PATH = exports.DEFAULT_SPECS_DIR = exports.APP_LOGGER = exports.COMMON_DEFAULT_OPTIONS_VALUES = exports.DEFAULT_ANALYZE_DIFF_REPORT_PATH = exports.DEFAULT_OPENAPI_CONFIG_FILENAME = void 0;
|
|
3
|
+
exports.DEFAULT_DIFF_CHANGES_DIR = exports.DEFAULT_PREVIEW_CHANGES_DIR = exports.DEFAULT_OUTPUT_API_DIR = exports.DEFAULT_CUSTOM_REQUEST_PATH = exports.DEFAULT_SPECS_DIR = exports.APP_LOGGER = exports.COMMON_DEFAULT_OPTIONS_VALUES = exports.DEFAULT_ANALYZE_USAGE_REPORT_PATH = exports.DEFAULT_ANALYZE_DIFF_REPORT_PATH = exports.DEFAULT_OPENAPI_CONFIG_FILENAME = void 0;
|
|
4
4
|
const EmptySchemaStrategy_enum_1 = require("../core/types/enums/EmptySchemaStrategy.enum");
|
|
5
5
|
const HttpClient_enum_1 = require("../core/types/enums/HttpClient.enum");
|
|
6
6
|
const ModelsMode_enum_1 = require("../core/types/enums/ModelsMode.enum");
|
|
@@ -9,6 +9,7 @@ const Enums_1 = require("./Enums");
|
|
|
9
9
|
const Logger_1 = require("./Logger");
|
|
10
10
|
exports.DEFAULT_OPENAPI_CONFIG_FILENAME = 'openapi.config.json';
|
|
11
11
|
exports.DEFAULT_ANALYZE_DIFF_REPORT_PATH = './openapi-diff-report.json';
|
|
12
|
+
exports.DEFAULT_ANALYZE_USAGE_REPORT_PATH = './openapi-usage-report.json';
|
|
12
13
|
exports.COMMON_DEFAULT_OPTIONS_VALUES = {
|
|
13
14
|
input: '',
|
|
14
15
|
output: '',
|
|
@@ -45,6 +46,10 @@ exports.COMMON_DEFAULT_OPTIONS_VALUES = {
|
|
|
45
46
|
useProjectPrettier: false,
|
|
46
47
|
useEslintFix: false,
|
|
47
48
|
governanceConfig: '',
|
|
49
|
+
cache: false,
|
|
50
|
+
cachePath: '.openapi-codegen-cache.json',
|
|
51
|
+
cacheStrategy: 'entity',
|
|
52
|
+
cacheDebug: false,
|
|
48
53
|
};
|
|
49
54
|
exports.APP_LOGGER = new Logger_1.Logger({
|
|
50
55
|
level: Enums_1.ELogLevel.INFO,
|
package/dist/common/Logger.js
CHANGED
|
@@ -84,9 +84,9 @@ class Logger {
|
|
|
84
84
|
const recommendation = LoggerMessages_1.LOGGER_ERROR_RECOMMENDATIONS[code];
|
|
85
85
|
this._logger.error(`${LoggerMessages_1.LOGGER_MESSAGES.ERROR.PREFIX} ${baseMessage}`);
|
|
86
86
|
this._logger.info(LoggerMessages_1.LOGGER_MESSAGES.SEPARATOR);
|
|
87
|
-
this._logger.info(
|
|
87
|
+
this._logger.info(LoggerMessages_1.LOGGER_MESSAGES.LOGGER.NEXT_STEPS(recommendation));
|
|
88
88
|
if (this._currentLevel === Enums_1.ELogLevel.INFO && error) {
|
|
89
|
-
this._logger.warn(
|
|
89
|
+
this._logger.warn(LoggerMessages_1.LOGGER_MESSAGES.ERROR.TECHNICAL_DETAILS(String(error)));
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
warn(message) {
|
|
@@ -26,6 +26,11 @@ export declare const LOGGER_MESSAGES: {
|
|
|
26
26
|
readonly FINISHED_WITH_DURATION: (duration: string) => string;
|
|
27
27
|
readonly DURATION_FOR_FILE: (file: string, duration: string) => string;
|
|
28
28
|
readonly NO_OPTIONS: "No options provided for generation";
|
|
29
|
+
readonly WRITE_STATS: (written: number, unchanged: number) => string;
|
|
30
|
+
readonly CACHE_SHARED_OUTPUT_WARNING: (outputs: string) => string;
|
|
31
|
+
readonly CACHE_HIT: (input: string) => string;
|
|
32
|
+
readonly CACHE_MISS: (input: string) => string;
|
|
33
|
+
readonly STRICT_REPORT_CREATED: (reportPath: string) => string;
|
|
29
34
|
};
|
|
30
35
|
readonly OPENAPI: {
|
|
31
36
|
readonly DEFINING_VERSION: "Defining the version of the openapi specification (2 or 3)";
|
|
@@ -63,6 +68,7 @@ export declare const LOGGER_MESSAGES: {
|
|
|
63
68
|
readonly PREFIX: "Error:";
|
|
64
69
|
readonly GENERIC: (message: string) => string;
|
|
65
70
|
readonly WITH_DETAILS: (message: string, details: string) => string;
|
|
71
|
+
readonly TECHNICAL_DETAILS: (error: string) => string;
|
|
66
72
|
};
|
|
67
73
|
readonly SEPARATOR: "==========================================";
|
|
68
74
|
readonly DIALOG: {
|
|
@@ -90,18 +96,20 @@ export declare const LOGGER_MESSAGES: {
|
|
|
90
96
|
readonly CLEANUP_PREVIEW_DIR: (dir: string) => string;
|
|
91
97
|
readonly CLEANUP_PREVIEW_FAILED: (error: string) => string;
|
|
92
98
|
};
|
|
93
|
-
readonly MIGRATION: {
|
|
94
|
-
readonly OPENAPI_SCHEMA_MIGRATED: "To perform OpenAPI generation, it was necessary to migrate the schema of your data to the current one. To update the configuration in the file, use the command `npm openapi-codegen-cli update-config`";
|
|
95
|
-
};
|
|
96
|
-
readonly FORMATTING: {
|
|
97
|
-
readonly PRETTIER_PROJECT_CONFIG_RESOLVED: (filePath: string) => string;
|
|
98
|
-
readonly PRETTIER_PROJECT_CONFIG_NOT_FOUND: "No project Prettier config found, falling back to built-in options";
|
|
99
|
-
readonly PRETTIER_FORMAT_FAILED: (file: string, error: string) => string;
|
|
100
|
-
readonly ESLINT_NOT_INSTALLED: "ESLint is not installed in this project. Skipping --useEslintFix.";
|
|
101
|
-
readonly ESLINT_FIX_FAILED: (file: string, error: string) => string;
|
|
102
|
-
readonly ESLINT_FIX_APPLIED: (file: string) => string;
|
|
103
|
-
};
|
|
104
99
|
readonly ANALYZE_DIFF: {
|
|
100
|
+
readonly INPUT_REQUIRED: "\"--input\" option is required for analyze-diff command";
|
|
101
|
+
readonly HISTORY_SKIPPED: "History analysis skipped: no base spec provided (use --compare-with or --git)";
|
|
102
|
+
readonly ANALYZING: "\n[openapi-codegen] Analyzing OpenAPI changes...";
|
|
103
|
+
readonly SUMMARY_TITLE: "[openapi-codegen] Analyze-diff summary";
|
|
104
|
+
readonly BASE: (base: string) => string;
|
|
105
|
+
readonly TARGET: (target: string) => string;
|
|
106
|
+
readonly STABILITY_SCORE: (score: number) => string;
|
|
107
|
+
readonly CHANGES: (total: number, added: number, removed: number, changed: number) => string;
|
|
108
|
+
readonly BREAKING_COUNT: (count: number) => string;
|
|
109
|
+
readonly WARNING_COUNT: (count: number) => string;
|
|
110
|
+
readonly IGNORED_COUNT: (count: number) => string;
|
|
111
|
+
readonly REPORT_WRITTEN: (reportPath: string) => string;
|
|
112
|
+
readonly INVALID_IGNORE_PATTERN: (pattern: string, error: string) => string;
|
|
105
113
|
readonly STARTED: (newSpec: string, baseSource: string) => string;
|
|
106
114
|
readonly SKIPPED_NO_BASE: "History analysis skipped: no base spec provided (use --compare-with or --git).";
|
|
107
115
|
readonly VALIDATION_ERROR: (message: string) => string;
|
|
@@ -149,7 +157,6 @@ export declare const LOGGER_MESSAGES: {
|
|
|
149
157
|
readonly CI_FAILURE: "CI mode failed because governance errors were found.";
|
|
150
158
|
readonly IGNORED_CHANGES: (count: number) => string;
|
|
151
159
|
readonly EXECUTION_ERROR: (message: string) => string;
|
|
152
|
-
readonly INVALID_IGNORE_PATTERN: (pattern: string, error: string) => string;
|
|
153
160
|
readonly LEGACY_BASE: (base: string) => string;
|
|
154
161
|
readonly LEGACY_TARGET: (target: string) => string;
|
|
155
162
|
readonly LEGACY_STABILITY_SCORE: (score: number) => string;
|
|
@@ -163,5 +170,45 @@ export declare const LOGGER_MESSAGES: {
|
|
|
163
170
|
readonly LEGACY_WARNINGS: (count: number) => string;
|
|
164
171
|
readonly LEGACY_IGNORED: (count: number) => string;
|
|
165
172
|
};
|
|
173
|
+
readonly DIFF_REPORT: {
|
|
174
|
+
readonly NOT_FOUND: (reportPath: string) => string;
|
|
175
|
+
readonly STALE: (reportPath: string) => string;
|
|
176
|
+
readonly EMPTY: (reportPath: string) => string;
|
|
177
|
+
readonly READ_FAILED: (reportPath: string, message: string) => string;
|
|
178
|
+
};
|
|
179
|
+
readonly TEMPLATES: {
|
|
180
|
+
readonly PRECOMPILE_SUCCESS: "The templates have been successfully precompiled and saved!";
|
|
181
|
+
readonly PRECOMPILE_ERROR: (message: string) => string;
|
|
182
|
+
};
|
|
183
|
+
readonly WRITE_CLIENT: {
|
|
184
|
+
readonly DATA_WRITE_START: (filePath: string) => string;
|
|
185
|
+
readonly FILE_RECORDED: (filePath: string) => string;
|
|
186
|
+
readonly INDEX_DATA_WRITTEN: (filePath: string) => string;
|
|
187
|
+
readonly INDEX_WRITE_COMPLETED: (filePath: string) => string;
|
|
188
|
+
readonly CORE_START: "The recording of the kernel files begins";
|
|
189
|
+
readonly CORE_FINISH: "The writing of the kernel files has been completed successfully";
|
|
190
|
+
readonly MODELS_START: "Recording of model files begins";
|
|
191
|
+
readonly MODELS_FINISH: "Model file recording completed successfully";
|
|
192
|
+
readonly SERVICES_START: "Recording of service files begins";
|
|
193
|
+
readonly SERVICES_FINISH: "Service file recording completed successfully";
|
|
194
|
+
readonly SCHEMAS_START: "The recording of model validation schema files begins.";
|
|
195
|
+
readonly SCHEMAS_FINISH: "The recording of model validation schema files has been completed successfully";
|
|
196
|
+
readonly DIRECTORY_CREATING: (directory: string) => string;
|
|
197
|
+
readonly EXECUTOR_START: (filePath: string) => string;
|
|
198
|
+
};
|
|
199
|
+
readonly LOGGER: {
|
|
200
|
+
readonly NEXT_STEPS: (recommendation: string) => string;
|
|
201
|
+
};
|
|
202
|
+
readonly MIGRATION: {
|
|
203
|
+
readonly OPENAPI_SCHEMA_MIGRATED: "To perform OpenAPI generation, it was necessary to migrate the schema of your data to the current one. To update the configuration in the file, use the command `npm openapi-codegen-cli update-config`";
|
|
204
|
+
};
|
|
205
|
+
readonly FORMATTING: {
|
|
206
|
+
readonly PRETTIER_PROJECT_CONFIG_RESOLVED: (filePath: string) => string;
|
|
207
|
+
readonly PRETTIER_PROJECT_CONFIG_NOT_FOUND: "No project Prettier config found, falling back to built-in options";
|
|
208
|
+
readonly PRETTIER_FORMAT_FAILED: (file: string, error: string) => string;
|
|
209
|
+
readonly ESLINT_NOT_INSTALLED: "ESLint is not installed in this project. Skipping --useEslintFix.";
|
|
210
|
+
readonly ESLINT_FIX_FAILED: (file: string, error: string) => string;
|
|
211
|
+
readonly ESLINT_FIX_APPLIED: (file: string) => string;
|
|
212
|
+
};
|
|
166
213
|
};
|
|
167
214
|
//# sourceMappingURL=LoggerMessages.d.ts.map
|