ts-openapi-codegen 2.1.0-beta.7 → 2.1.0-beta.9
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 +7 -0
- package/README.rus.md +7 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiff.cli.test.js +31 -24
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffLomMiracles.test.d.ts +2 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffLomMiracles.test.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffLomMiracles.test.js +47 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffRenameAndInvalidRegex.test.js +8 -7
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffTypeCoercion.test.js +8 -7
- package/dist/cli/analyzeDiff/analyzeDiff.d.ts +14 -2
- package/dist/cli/analyzeDiff/analyzeDiff.d.ts.map +1 -1
- package/dist/cli/analyzeDiff/analyzeDiff.js +56 -13
- package/dist/cli/analyzeDiff/ciSummary.d.ts +6 -3
- package/dist/cli/analyzeDiff/ciSummary.d.ts.map +1 -1
- package/dist/cli/analyzeDiff/ciSummary.js +10 -6
- package/dist/cli/analyzeDiff/ignoreRules.d.ts +0 -6
- package/dist/cli/analyzeDiff/ignoreRules.d.ts.map +1 -1
- package/dist/cli/analyzeDiff/ignoreRules.js +2 -3
- package/dist/cli/analyzeDiff/report.d.ts +0 -1
- package/dist/cli/analyzeDiff/report.d.ts.map +1 -1
- package/dist/cli/analyzeDiff/report.js +1 -3
- package/dist/cli/analyzeDiff/writeLegacyReport.d.ts +2 -0
- package/dist/cli/analyzeDiff/writeLegacyReport.d.ts.map +1 -1
- package/dist/cli/analyzeDiff/writeLegacyReport.js +2 -0
- package/dist/cli/analyzeUsage/analyzeUsage.d.ts +2 -2
- package/dist/cli/analyzeUsage/analyzeUsage.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/analyzeUsage.js +10 -12
- package/dist/cli/analyzeUsage/core/ProjectContext.d.ts +1 -1
- package/dist/cli/analyzeUsage/core/ProjectContext.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/core/ProjectContext.js +5 -10
- package/dist/cli/analyzeUsage/core/Scanner.d.ts +8 -0
- package/dist/cli/analyzeUsage/core/Scanner.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/core/Scanner.js +10 -0
- package/dist/cli/analyzeUsage/rules/ClientRule.d.ts +10 -2
- package/dist/cli/analyzeUsage/rules/ClientRule.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/rules/ClientRule.js +29 -21
- package/dist/cli/analyzeUsage/rules/CoverageRule.d.ts +2 -2
- package/dist/cli/analyzeUsage/rules/CoverageRule.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/rules/CoverageRule.js +16 -24
- package/dist/cli/analyzeUsage/rules/DiagnosticsRule.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/rules/DiagnosticsRule.js +4 -1
- package/dist/cli/analyzeUsage/rules/ImportRule.d.ts +2 -2
- package/dist/cli/analyzeUsage/rules/ImportRule.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/rules/ImportRule.js +9 -11
- package/dist/cli/analyzeUsage/rules/ModelRule.d.ts +2 -2
- package/dist/cli/analyzeUsage/rules/ModelRule.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/rules/ModelRule.js +4 -8
- package/dist/cli/analyzeUsage/rules/SchemaRule.d.ts +2 -2
- package/dist/cli/analyzeUsage/rules/SchemaRule.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/rules/SchemaRule.js +8 -10
- package/dist/cli/analyzeUsage/rules/ServiceRule.d.ts +10 -2
- package/dist/cli/analyzeUsage/rules/ServiceRule.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/rules/ServiceRule.js +27 -23
- package/dist/cli/analyzeUsage/types.d.ts +4 -4
- package/dist/cli/analyzeUsage/types.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/utils/fuzzy.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/utils/report.d.ts +1 -1
- package/dist/cli/analyzeUsage/utils/report.d.ts.map +1 -1
- package/dist/cli/analyzeUsage/utils/report.js +8 -8
- package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.js +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.js +1 -1
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -1
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +9 -1
- package/dist/cli/index.js +3 -2
- package/dist/cli/initOpenApiConfig/utils/__tests__/buildConfig.test.js +2 -8
- package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/cli/interactive/constants.d.ts +0 -4
- package/dist/cli/interactive/constants.d.ts.map +1 -1
- package/dist/cli/interactive/constants.js +1 -5
- package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
- package/dist/cli/previewChanges/utils/formatDiff.d.ts.map +1 -1
- package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts.map +1 -1
- package/dist/cli/previewChanges/utils/updateOutputPaths.js +5 -12
- package/dist/cli/schemas/analyzeUsage.d.ts.map +1 -1
- package/dist/cli/schemas/analyzeUsage.js +4 -1
- package/dist/cli/schemas/generate.d.ts +3 -2
- package/dist/cli/schemas/generate.d.ts.map +1 -1
- package/dist/cli/schemas/generate.js +3 -2
- package/dist/common/Consts.d.ts.map +1 -1
- package/dist/common/Consts.js +1 -2
- package/dist/common/Logger.d.ts.map +1 -1
- package/dist/common/Logger.js +1 -1
- package/dist/common/LoggerMessages.d.ts +15 -3
- package/dist/common/LoggerMessages.d.ts.map +1 -1
- package/dist/common/LoggerMessages.js +18 -7
- package/dist/common/TEslintFixOptions.d.ts +20 -0
- package/dist/common/TEslintFixOptions.d.ts.map +1 -0
- package/dist/common/TEslintFixOptions.js +15 -0
- package/dist/common/TRawOptions.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +2 -4
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.js +1 -2
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts +3 -2
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.js +10 -4
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +4 -4
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +7 -1
- package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.js +4 -2
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.js +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.js +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.js +1 -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/OptionsSchemaV1.d.ts +2 -2
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +2 -2
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.js +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +1 -1
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +3 -2
- package/dist/common/VersionedSchema/Utils/__tests__/allUtils.test.js +4 -16
- package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts +1 -1
- package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.js +1 -1
- package/dist/common/VersionedSchema/Utils/createTrivialMigration.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/createTrivialMigration.js +1 -1
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +1 -3
- package/dist/common/VersionedSchema/Utils/getLatestVersionFromMigrationPlans.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +1 -3
- package/dist/common/VersionedSchema/Utils/replaceInvalidKeysWithMappedNames.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/replaceInvalidKeysWithMappedNames.js +1 -1
- package/dist/common/VersionedSchema/Utils/validateAndSuggestKeyCorrections.d.ts.map +1 -1
- package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts +1 -1
- package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts.map +1 -1
- package/dist/common/utils/__tests__/eslintFix.test.js +25 -67
- package/dist/common/utils/__tests__/extractEslintFixOptions.test.d.ts +2 -0
- package/dist/common/utils/__tests__/extractEslintFixOptions.test.d.ts.map +1 -0
- package/dist/common/utils/__tests__/extractEslintFixOptions.test.js +28 -0
- package/dist/common/utils/__tests__/format.test.js +26 -17
- package/dist/common/utils/__tests__/prepareTempTsConfig.test.d.ts +2 -0
- package/dist/common/utils/__tests__/prepareTempTsConfig.test.d.ts.map +1 -0
- package/dist/common/utils/__tests__/prepareTempTsConfig.test.js +78 -0
- package/dist/common/utils/codegenTempDir.d.ts +20 -0
- package/dist/common/utils/codegenTempDir.d.ts.map +1 -0
- package/dist/common/utils/codegenTempDir.js +42 -0
- package/dist/common/utils/convertArrayToObject.d.ts.map +1 -1
- package/dist/common/utils/convertArrayToObject.js +3 -8
- package/dist/common/utils/eslintFix.d.ts +48 -4
- package/dist/common/utils/eslintFix.d.ts.map +1 -1
- package/dist/common/utils/eslintFix.js +121 -15
- package/dist/common/utils/format.d.ts +1 -1
- package/dist/common/utils/format.d.ts.map +1 -1
- package/dist/common/utils/format.js +23 -11
- package/dist/common/utils/jsonPath.d.ts.map +1 -1
- package/dist/common/utils/prepareTempEslintConfig.d.ts +18 -0
- package/dist/common/utils/prepareTempEslintConfig.d.ts.map +1 -0
- package/dist/common/utils/prepareTempEslintConfig.js +55 -0
- package/dist/common/utils/prepareTempTsConfig.d.ts +23 -0
- package/dist/common/utils/prepareTempTsConfig.d.ts.map +1 -0
- package/dist/common/utils/prepareTempTsConfig.js +105 -0
- package/dist/core/Context.d.ts.map +1 -1
- package/dist/core/Context.js +2 -6
- package/dist/core/OpenApiClient.d.ts +15 -0
- package/dist/core/OpenApiClient.d.ts.map +1 -1
- package/dist/core/OpenApiClient.js +68 -10
- package/dist/core/WriteClient.d.ts +73 -17
- package/dist/core/WriteClient.d.ts.map +1 -1
- package/dist/core/WriteClient.js +72 -18
- package/dist/core/__tests__/WriteClient.test.js +1 -1
- package/dist/core/api/v2/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationResponses.js +1 -3
- package/dist/core/api/v2/parser/getServiceName.d.ts +1 -1
- package/dist/core/api/v3/parser/getOperation.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationParameters.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponses.js +1 -3
- package/dist/core/api/v3/parser/getServiceName.d.ts +1 -1
- package/dist/core/governance/evaluateGovernanceRules.d.ts.map +1 -1
- package/dist/core/governance/evaluateGovernanceRules.js +1 -3
- package/dist/core/governance/loadGovernanceConfig.d.ts.map +1 -1
- package/dist/core/governance/loadGovernanceConfig.js +2 -4
- package/dist/core/plugins/GeneratorPlugin.model.d.ts.map +1 -1
- package/dist/core/plugins/applySemanticDiffPluginHooks.d.ts.map +1 -1
- package/dist/core/semanticDiff/__tests__/analyzeOpenApiDiff.test.js +79 -21
- package/dist/core/semanticDiff/__tests__/semanticDiffReportSchema.test.js +20 -1
- package/dist/core/semanticDiff/analyzeOpenApiDiff.d.ts +58 -6
- package/dist/core/semanticDiff/analyzeOpenApiDiff.d.ts.map +1 -1
- package/dist/core/semanticDiff/analyzeOpenApiDiff.js +47 -19
- package/dist/core/semanticDiff/semanticDiffReportSchema.d.ts +9 -1
- package/dist/core/semanticDiff/semanticDiffReportSchema.d.ts.map +1 -1
- package/dist/core/semanticDiff/semanticDiffReportSchema.js +137 -53
- package/dist/core/strict/validateOpenApiStrict.d.ts.map +1 -1
- package/dist/core/types/Consts.js +1 -1
- package/dist/core/types/DiffReport.model.d.ts +101 -0
- package/dist/core/types/DiffReport.model.d.ts.map +1 -0
- package/dist/core/types/DiffReport.model.js +5 -0
- package/dist/core/types/base/ClientArtifacts.model.d.ts +3 -3
- package/dist/core/types/base/ClientArtifacts.model.d.ts.map +1 -1
- package/dist/core/types/base/ExportedModel.model.d.ts +1 -1
- package/dist/core/types/base/ExportedModel.model.d.ts.map +1 -1
- package/dist/core/types/base/ExportedService.model.d.ts.map +1 -1
- package/dist/core/types/base/OutputPaths.model.d.ts.map +1 -1
- package/dist/core/types/base/PrefixArtifacts.model.d.ts.map +1 -1
- package/dist/core/types/base/PropertyGroup.model.d.ts +1 -1
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts +1 -1
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts.map +1 -1
- package/dist/core/types/shared/Model.model.d.ts +36 -0
- package/dist/core/types/shared/Model.model.d.ts.map +1 -1
- package/dist/core/utils/__tests__/applyDiffReportToClient.test.js +182 -0
- package/dist/core/utils/__tests__/buildMiraclesFromSemanticChanges.test.d.ts +2 -0
- package/dist/core/utils/__tests__/buildMiraclesFromSemanticChanges.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/buildMiraclesFromSemanticChanges.test.js +77 -0
- package/dist/core/utils/__tests__/expandOpenApiRefsForSemanticDiff.test.d.ts +2 -0
- package/dist/core/utils/__tests__/expandOpenApiRefsForSemanticDiff.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/expandOpenApiRefsForSemanticDiff.test.js +159 -0
- package/dist/core/utils/__tests__/loadDiffReport.test.js +131 -0
- package/dist/core/utils/__tests__/modelHelpers.test.js +27 -9
- package/dist/core/utils/__tests__/postProcessModelImports.test.js +1 -4
- package/dist/core/utils/__tests__/postProcessServiceImports.test.js +1 -4
- package/dist/core/utils/__tests__/prepareDtoModels.test.js +74 -2
- package/dist/core/utils/__tests__/registerHandlebarHelpers.test.js +27 -0
- package/dist/core/utils/__tests__/resolveClassesModeTypes.test.d.ts +2 -0
- package/dist/core/utils/__tests__/resolveClassesModeTypes.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/resolveClassesModeTypes.test.js +111 -0
- package/dist/core/utils/__tests__/semanticChangesToDiffEntries.test.d.ts +2 -0
- package/dist/core/utils/__tests__/semanticChangesToDiffEntries.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/semanticChangesToDiffEntries.test.js +68 -0
- package/dist/core/utils/__tests__/serviceHelpers.test.js +10 -11
- package/dist/core/utils/__tests__/sortByRequiredExtended.test.js +10 -27
- package/dist/core/utils/__tests__/templateRendering.test.js +71 -0
- package/dist/core/utils/adapters/__tests__/semanticToStructural.test.d.ts +2 -0
- package/dist/core/utils/adapters/__tests__/semanticToStructural.test.d.ts.map +1 -0
- package/dist/core/utils/adapters/__tests__/semanticToStructural.test.js +63 -0
- package/dist/core/utils/adapters/extractMiraclesFromSemantic.d.ts +10 -0
- package/dist/core/utils/adapters/extractMiraclesFromSemantic.d.ts.map +1 -0
- package/dist/core/utils/adapters/extractMiraclesFromSemantic.js +13 -0
- package/dist/core/utils/adapters/index.d.ts +4 -0
- package/dist/core/utils/adapters/index.d.ts.map +1 -0
- package/dist/core/utils/adapters/index.js +8 -0
- package/dist/core/utils/adapters/semanticToStructural.d.ts +12 -0
- package/dist/core/utils/adapters/semanticToStructural.d.ts.map +1 -0
- package/dist/core/utils/adapters/semanticToStructural.js +36 -0
- package/dist/core/utils/appendUniqueLinesToFile.js +1 -1
- package/dist/core/utils/applyDiffReportToClient.d.ts +13 -1
- package/dist/core/utils/applyDiffReportToClient.d.ts.map +1 -1
- package/dist/core/utils/applyDiffReportToClient.js +189 -109
- package/dist/core/utils/areEqual.d.ts +1 -1
- package/dist/core/utils/buildMiraclesFromSemanticChanges.d.ts +25 -0
- package/dist/core/utils/buildMiraclesFromSemanticChanges.d.ts.map +1 -0
- package/dist/core/utils/buildMiraclesFromSemanticChanges.js +146 -0
- package/dist/core/utils/expandOpenApiRefsForSemanticDiff.d.ts +23 -0
- package/dist/core/utils/expandOpenApiRefsForSemanticDiff.d.ts.map +1 -0
- package/dist/core/utils/expandOpenApiRefsForSemanticDiff.js +163 -0
- package/dist/core/utils/getOpenApiSpec.d.ts +18 -0
- package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
- package/dist/core/utils/getOpenApiSpec.js +35 -0
- package/dist/core/utils/getOperationErrors.d.ts +2 -2
- package/dist/core/utils/getOperationErrors.d.ts.map +1 -1
- package/dist/core/utils/getOperationResults.d.ts +1 -1
- package/dist/core/utils/getPropertyGroupSimple.d.ts.map +1 -1
- package/dist/core/utils/getPropertyGroupSimple.js +1 -3
- package/dist/core/utils/isSubdirectory.d.ts.map +1 -1
- package/dist/core/utils/loadDiffReport.d.ts +11 -30
- package/dist/core/utils/loadDiffReport.d.ts.map +1 -1
- package/dist/core/utils/loadDiffReport.js +69 -3
- package/dist/core/utils/loadSemanticOpenApiSpec.d.ts +15 -0
- package/dist/core/utils/loadSemanticOpenApiSpec.d.ts.map +1 -0
- package/dist/core/utils/loadSemanticOpenApiSpec.js +61 -0
- package/dist/core/utils/modelHelpers.d.ts +13 -5
- package/dist/core/utils/modelHelpers.d.ts.map +1 -1
- package/dist/core/utils/modelHelpers.js +28 -23
- package/dist/core/utils/normalizeString.d.ts.map +1 -1
- package/dist/core/utils/normalizeString.js +1 -5
- package/dist/core/utils/postProcessServiceImports.d.ts.map +1 -1
- package/dist/core/utils/postProcessServiceImports.js +1 -3
- package/dist/core/utils/precompileTemplates.js +1 -0
- package/dist/core/utils/prepareAlias.d.ts +1 -1
- package/dist/core/utils/prepareDtoModels.d.ts +5 -0
- package/dist/core/utils/prepareDtoModels.d.ts.map +1 -1
- package/dist/core/utils/prepareDtoModels.js +56 -13
- package/dist/core/utils/registerHandlebarHelpers.d.ts +1 -0
- package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarHelpers.js +3 -0
- package/dist/core/utils/registerHandlebarTemplates.d.ts +1 -0
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/resolveClassesModeTypes.d.ts +8 -0
- package/dist/core/utils/resolveClassesModeTypes.d.ts.map +1 -0
- package/dist/core/utils/resolveClassesModeTypes.js +77 -0
- package/dist/core/utils/semanticChangesToDiffEntries.d.ts +37 -0
- package/dist/core/utils/semanticChangesToDiffEntries.d.ts.map +1 -0
- package/dist/core/utils/semanticChangesToDiffEntries.js +99 -0
- package/dist/core/utils/semanticPointerToJsonPath.d.ts +7 -0
- package/dist/core/utils/semanticPointerToJsonPath.d.ts.map +1 -0
- package/dist/core/utils/semanticPointerToJsonPath.js +67 -0
- package/dist/core/utils/serviceHelpers.d.ts +6 -7
- package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
- package/dist/core/utils/serviceHelpers.js +8 -25
- package/dist/core/utils/sortModelByName.d.ts +1 -1
- package/dist/core/utils/writeClientExecutor.d.ts +1 -2
- package/dist/core/utils/writeClientExecutor.d.ts.map +1 -1
- package/dist/core/utils/writeClientExecutor.js +2 -6
- package/dist/core/utils/writeClientModels.d.ts +1 -2
- package/dist/core/utils/writeClientModels.d.ts.map +1 -1
- package/dist/core/utils/writeClientModels.js +4 -6
- package/dist/core/utils/writeClientSchemas.d.ts +1 -3
- package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.js +2 -7
- package/dist/core/utils/writeClientServices.d.ts +15 -16
- package/dist/core/utils/writeClientServices.d.ts.map +1 -1
- package/dist/core/utils/writeClientServices.js +6 -13
- package/dist/templatesCompiled/client/exportModels.d.ts +17 -11
- package/dist/templatesCompiled/client/exportModels.d.ts.map +1 -1
- package/dist/templatesCompiled/client/exportModels.js +96 -49
- package/dist/templatesCompiled/client/exportService.d.ts +13 -10
- package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
- package/dist/templatesCompiled/client/exportService.js +95 -67
- package/dist/templatesCompiled/client/partials/header.d.ts +1 -0
- package/dist/templatesCompiled/client/partials/header.d.ts.map +1 -1
- package/dist/templatesCompiled/client/partials/header.js +11 -2
- package/package.json +130 -136
- package/dist/cli/analyzeDiff/buildLegacyReport.d.ts +0 -17
- package/dist/cli/analyzeDiff/buildLegacyReport.d.ts.map +0 -1
- package/dist/cli/analyzeDiff/buildLegacyReport.js +0 -54
- package/dist/cli/analyzeDiff/diffEngine.d.ts +0 -54
- package/dist/cli/analyzeDiff/diffEngine.d.ts.map +0 -1
- package/dist/cli/analyzeDiff/diffEngine.js +0 -209
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.semanticPointerToJsonPath = semanticPointerToJsonPath;
|
|
4
|
+
const jsonPath_1 = require("../../common/utils/jsonPath");
|
|
5
|
+
const HTTP_METHODS = new Set(['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH', 'TRACE']);
|
|
6
|
+
const OPERATION_SUFFIX_MARKERS = ['parameters', 'requestBody', 'responses'];
|
|
7
|
+
/**
|
|
8
|
+
* Splits semantic operation pointer tail into operation key and nested suffix segments.
|
|
9
|
+
*/
|
|
10
|
+
function splitOperationPointerTail(tail) {
|
|
11
|
+
for (const marker of OPERATION_SUFFIX_MARKERS) {
|
|
12
|
+
const markerIndex = tail.indexOf(`/${marker}`);
|
|
13
|
+
if (markerIndex > 0) {
|
|
14
|
+
return {
|
|
15
|
+
operationKey: tail.slice(0, markerIndex),
|
|
16
|
+
suffix: [
|
|
17
|
+
marker,
|
|
18
|
+
...tail
|
|
19
|
+
.slice(markerIndex + marker.length + 1)
|
|
20
|
+
.split('/')
|
|
21
|
+
.filter(Boolean),
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return { operationKey: tail, suffix: [] };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parses semantic operation key "GET /pets" into HTTP method and route path.
|
|
30
|
+
*/
|
|
31
|
+
function parseOperationKey(operationKey) {
|
|
32
|
+
const match = operationKey.match(/^(GET|PUT|POST|DELETE|OPTIONS|HEAD|PATCH|TRACE)\s+(\S+)$/i);
|
|
33
|
+
if (!match) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const method = match[1].toLowerCase();
|
|
37
|
+
const routePath = match[2];
|
|
38
|
+
if (!HTTP_METHODS.has(match[1].toUpperCase())) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return { method, routePath };
|
|
42
|
+
}
|
|
43
|
+
const decodePointerSegment = (segment) => segment.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
44
|
+
/**
|
|
45
|
+
* Преобразует семантический JSON Pointer в legacy JSONPath, используемый генератором.
|
|
46
|
+
* @param pointer JSON Pointer или уже готовый JSONPath
|
|
47
|
+
* @returns legacy JSONPath
|
|
48
|
+
*/
|
|
49
|
+
function semanticPointerToJsonPath(pointer) {
|
|
50
|
+
if (pointer.startsWith('$')) {
|
|
51
|
+
return pointer;
|
|
52
|
+
}
|
|
53
|
+
if (!pointer.startsWith('#/')) {
|
|
54
|
+
return pointer;
|
|
55
|
+
}
|
|
56
|
+
const body = pointer.slice(2);
|
|
57
|
+
if (body.startsWith('paths/')) {
|
|
58
|
+
const tail = body.slice('paths/'.length);
|
|
59
|
+
const { operationKey, suffix } = splitOperationPointerTail(tail);
|
|
60
|
+
const parsedOperation = parseOperationKey(operationKey);
|
|
61
|
+
if (parsedOperation) {
|
|
62
|
+
return (0, jsonPath_1.toJsonPath)(['paths', parsedOperation.routePath, parsedOperation.method, ...suffix]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const rawSegments = body.split('/').map(decodePointerSegment);
|
|
66
|
+
return (0, jsonPath_1.toJsonPath)(rawSegments);
|
|
67
|
+
}
|
|
@@ -7,12 +7,11 @@ import type { Service } from '../types/shared/Service.model';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function forEachOperationInPath(pathObj: Record<string, any>, cb: (method: string, op: any) => void): void;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @
|
|
15
|
-
* @returns existing or newly created Service
|
|
10
|
+
* Возвращает существующий сервис из map или создаёт новый.
|
|
11
|
+
* @param services map сервисов
|
|
12
|
+
* @param name имя сервиса
|
|
13
|
+
* @param [originName] исходное имя сервиса при создании
|
|
14
|
+
* @returns существующий или новый сервис
|
|
16
15
|
*/
|
|
17
16
|
export declare function ensureService(services: Map<string, Service>, name: string, originName?: string): Service;
|
|
18
17
|
/**
|
|
@@ -29,7 +28,7 @@ export declare function mergeOperationImportsIntoService(service: Service, opera
|
|
|
29
28
|
/**
|
|
30
29
|
* Finalize imports for a service:
|
|
31
30
|
* - Deduplicate and sort imports
|
|
32
|
-
* - Assign aliases for duplicate import names (name, name$
|
|
31
|
+
* - Assign aliases for duplicate import names (first keeps plain name, then name$2, name$3, ...)
|
|
33
32
|
* - Propagate assigned aliases to models referenced in operations (results, parameters)
|
|
34
33
|
*
|
|
35
34
|
* Modifies service in-place and returns it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/serviceHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"serviceHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/serviceHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAM7D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAOhH;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAWxG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,CAMvF;AA+CD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiBhE"}
|
|
@@ -5,6 +5,7 @@ exports.ensureService = ensureService;
|
|
|
5
5
|
exports.mergeOperationImportsIntoService = mergeOperationImportsIntoService;
|
|
6
6
|
exports.finalizeServiceImports = finalizeServiceImports;
|
|
7
7
|
const safeHasOwn_1 = require("../../common/utils/safeHasOwn");
|
|
8
|
+
const modelHelpers_1 = require("./modelHelpers");
|
|
8
9
|
const unique_1 = require("./unique");
|
|
9
10
|
const SUPPORTED_METHODS = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch'];
|
|
10
11
|
/**
|
|
@@ -23,12 +24,11 @@ function forEachOperationInPath(pathObj, cb) {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @
|
|
31
|
-
* @returns existing or newly created Service
|
|
27
|
+
* Возвращает существующий сервис из map или создаёт новый.
|
|
28
|
+
* @param services map сервисов
|
|
29
|
+
* @param name имя сервиса
|
|
30
|
+
* @param [originName] исходное имя сервиса при создании
|
|
31
|
+
* @returns существующий или новый сервис
|
|
32
32
|
*/
|
|
33
33
|
function ensureService(services, name, originName) {
|
|
34
34
|
const existing = services.get(name);
|
|
@@ -100,7 +100,7 @@ function fillModelsByAlias(items = [], value) {
|
|
|
100
100
|
/**
|
|
101
101
|
* Finalize imports for a service:
|
|
102
102
|
* - Deduplicate and sort imports
|
|
103
|
-
* - Assign aliases for duplicate import names (name, name$
|
|
103
|
+
* - Assign aliases for duplicate import names (first keeps plain name, then name$2, name$3, ...)
|
|
104
104
|
* - Propagate assigned aliases to models referenced in operations (results, parameters)
|
|
105
105
|
*
|
|
106
106
|
* Modifies service in-place and returns it.
|
|
@@ -114,24 +114,7 @@ function finalizeServiceImports(service) {
|
|
|
114
114
|
const nameB = b.name.toLowerCase();
|
|
115
115
|
return nameA.localeCompare(nameB, 'en');
|
|
116
116
|
});
|
|
117
|
-
|
|
118
|
-
let index = 1;
|
|
119
|
-
service.imports = service.imports.map(value => {
|
|
120
|
-
if (previous && previous.name === value.name) {
|
|
121
|
-
if (index === 1) {
|
|
122
|
-
previous.alias = `${value.name}$${index}`;
|
|
123
|
-
index++;
|
|
124
|
-
}
|
|
125
|
-
value.alias = `${value.name}$${index}`;
|
|
126
|
-
index++;
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
value.alias = '';
|
|
130
|
-
index = 1;
|
|
131
|
-
}
|
|
132
|
-
previous = value;
|
|
133
|
-
return value;
|
|
134
|
-
});
|
|
117
|
+
(0, modelHelpers_1.assignDuplicateAliases)(service.imports);
|
|
135
118
|
for (const item of service.imports) {
|
|
136
119
|
for (const operation of service.operations) {
|
|
137
120
|
fillModelsByAlias(operation.results, item);
|
|
@@ -8,8 +8,7 @@ interface WriteClientExecutor {
|
|
|
8
8
|
customExecutorPath?: string;
|
|
9
9
|
services: Service[];
|
|
10
10
|
templates: Templates;
|
|
11
|
-
|
|
12
|
-
useEslintFix?: boolean;
|
|
11
|
+
prettierConfigPath?: string;
|
|
13
12
|
}
|
|
14
13
|
declare function deduplicateServicesByName(services: Service[]): Service[];
|
|
15
14
|
export declare function writeClientExecutor(this: WriteClient, options: WriteClientExecutor): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientExecutor.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientExecutor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeClientExecutor.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientExecutor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,UAAU,mBAAmB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,iBAAS,yBAAyB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CASjE;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBxG;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.writeClientExecutor = writeClientExecutor;
|
|
4
4
|
exports.deduplicateServicesByName = deduplicateServicesByName;
|
|
5
5
|
const LoggerMessages_1 = require("../../common/LoggerMessages");
|
|
6
|
-
const eslintFix_1 = require("../../common/utils/eslintFix");
|
|
7
6
|
const format_1 = require("../../common/utils/format");
|
|
8
7
|
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
9
8
|
function deduplicateServicesByName(services) {
|
|
@@ -17,7 +16,7 @@ function deduplicateServicesByName(services) {
|
|
|
17
16
|
});
|
|
18
17
|
}
|
|
19
18
|
async function writeClientExecutor(options) {
|
|
20
|
-
const { outputPath, outputCorePath, templates, services, request, customExecutorPath,
|
|
19
|
+
const { outputPath, outputCorePath, templates, services, request, customExecutorPath, prettierConfigPath } = options;
|
|
21
20
|
const file = (0, pathHelpers_1.resolveHelper)(outputPath, 'createClient.ts');
|
|
22
21
|
const uniqueServices = deduplicateServicesByName(services);
|
|
23
22
|
const hasCustomRequest = !!request;
|
|
@@ -28,10 +27,7 @@ async function writeClientExecutor(options) {
|
|
|
28
27
|
customExecutorPath,
|
|
29
28
|
services: uniqueServices,
|
|
30
29
|
});
|
|
31
|
-
const formattedValue = await (0, format_1.format)(templateResult, undefined,
|
|
30
|
+
const formattedValue = await (0, format_1.format)(templateResult, undefined, prettierConfigPath);
|
|
32
31
|
await this.writeOutputFile(file, formattedValue);
|
|
33
|
-
if (useEslintFix) {
|
|
34
|
-
await (0, eslintFix_1.eslintFix)(file);
|
|
35
|
-
}
|
|
36
32
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.FILE_RECORDED(file));
|
|
37
33
|
}
|
|
@@ -19,8 +19,7 @@ interface IWriteClientModels {
|
|
|
19
19
|
useOptions?: boolean;
|
|
20
20
|
modelsMode?: ModelsMode;
|
|
21
21
|
outputCorePath?: string;
|
|
22
|
-
|
|
23
|
-
useEslintFix?: boolean;
|
|
22
|
+
prettierConfigPath?: string;
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
26
25
|
* Generate Models using the Handlebar template and write to disk.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientModels.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModels.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeClientModels.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModels.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;GAMG;AACH,UAAU,kBAAkB;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuDrG"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.writeClientModels = writeClientModels;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const LoggerMessages_1 = require("../../common/LoggerMessages");
|
|
6
|
-
const eslintFix_1 = require("../../common/utils/eslintFix");
|
|
7
6
|
const format_1 = require("../../common/utils/format");
|
|
8
7
|
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
9
8
|
const ModelsMode_enum_1 = require("../types/enums/ModelsMode.enum");
|
|
@@ -16,7 +15,7 @@ const ModelsMode_enum_1 = require("../types/enums/ModelsMode.enum");
|
|
|
16
15
|
* @param useUnionTypes Use union types instead of enums
|
|
17
16
|
*/
|
|
18
17
|
async function writeClientModels(options) {
|
|
19
|
-
const { models, templates, outputModelsPath, httpClient, useUnionTypes, modelsMode, outputCorePath, useOptions,
|
|
18
|
+
const { models, templates, outputModelsPath, httpClient, useUnionTypes, modelsMode, outputCorePath, useOptions, prettierConfigPath } = options;
|
|
20
19
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.MODELS_START);
|
|
21
20
|
if (modelsMode === ModelsMode_enum_1.ModelsMode.CLASSES) {
|
|
22
21
|
const file = (0, pathHelpers_1.resolveHelper)(outputModelsPath, 'models.ts');
|
|
@@ -30,6 +29,7 @@ async function writeClientModels(options) {
|
|
|
30
29
|
});
|
|
31
30
|
const formattedValue = await (0, format_1.format)(templateResult);
|
|
32
31
|
await this.writeOutputFile(file, formattedValue);
|
|
32
|
+
this.registerLintTarget(file, outputModelsPath);
|
|
33
33
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.FILE_RECORDED(file));
|
|
34
34
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.MODELS_FINISH);
|
|
35
35
|
return;
|
|
@@ -52,11 +52,9 @@ async function writeClientModels(options) {
|
|
|
52
52
|
httpClient,
|
|
53
53
|
useUnionTypes,
|
|
54
54
|
});
|
|
55
|
-
const formattedValue = await (0, format_1.format)(templateResult, undefined,
|
|
55
|
+
const formattedValue = await (0, format_1.format)(templateResult, undefined, prettierConfigPath);
|
|
56
56
|
await this.writeOutputFile(file, formattedValue);
|
|
57
|
-
|
|
58
|
-
await (0, eslintFix_1.eslintFix)(file);
|
|
59
|
-
}
|
|
57
|
+
this.registerLintTarget(file, outputModelsPath);
|
|
60
58
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.FILE_RECORDED(file));
|
|
61
59
|
}
|
|
62
60
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.MODELS_FINISH);
|
|
@@ -19,10 +19,8 @@ interface IWriteClientSchemas {
|
|
|
19
19
|
useUnionTypes: boolean;
|
|
20
20
|
validationLibrary?: ValidationLibrary;
|
|
21
21
|
emptySchemaStrategy: EmptySchemaStrategy;
|
|
22
|
-
|
|
23
|
-
useEslintFix?: boolean;
|
|
22
|
+
prettierConfigPath?: string;
|
|
24
23
|
}
|
|
25
|
-
export declare function isEmptySchemaModel(model: Model): boolean;
|
|
26
24
|
/**
|
|
27
25
|
* Generate Schemas using the Handlebar template and write to disk.
|
|
28
26
|
* @param models Array of Models to write
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientSchemas.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemas.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeClientSchemas.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;GAMG;AACH,UAAU,mBAAmB;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAMD;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAwC1G"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isEmptySchemaModel = isEmptySchemaModel;
|
|
4
3
|
exports.writeClientSchemas = writeClientSchemas;
|
|
5
4
|
const fs_1 = require("fs");
|
|
6
5
|
const LoggerMessages_1 = require("../../common/LoggerMessages");
|
|
7
|
-
const eslintFix_1 = require("../../common/utils/eslintFix");
|
|
8
6
|
const format_1 = require("../../common/utils/format");
|
|
9
7
|
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
10
8
|
const EmptySchemaStrategy_enum_1 = require("../types/enums/EmptySchemaStrategy.enum");
|
|
@@ -20,7 +18,7 @@ function isEmptySchemaModel(model) {
|
|
|
20
18
|
* @param useUnionTypes Use union types instead of enums
|
|
21
19
|
*/
|
|
22
20
|
async function writeClientSchemas(options) {
|
|
23
|
-
const { models, templates, outputSchemasPath, httpClient, useUnionTypes, validationLibrary, emptySchemaStrategy,
|
|
21
|
+
const { models, templates, outputSchemasPath, httpClient, useUnionTypes, validationLibrary, emptySchemaStrategy, prettierConfigPath } = options;
|
|
24
22
|
if (templates.exports.schema) {
|
|
25
23
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.SCHEMAS_START);
|
|
26
24
|
const modelsToWrite = emptySchemaStrategy === EmptySchemaStrategy_enum_1.EmptySchemaStrategy.SKIP ? models.filter(model => !isEmptySchemaModel(model)) : models;
|
|
@@ -41,11 +39,8 @@ async function writeClientSchemas(options) {
|
|
|
41
39
|
validationLibrary,
|
|
42
40
|
emptySchemaStrategy,
|
|
43
41
|
});
|
|
44
|
-
const formattedValue = await (0, format_1.format)(templateResult, undefined,
|
|
42
|
+
const formattedValue = await (0, format_1.format)(templateResult, undefined, prettierConfigPath);
|
|
45
43
|
await this.writeOutputFile(file, formattedValue);
|
|
46
|
-
if (useEslintFix) {
|
|
47
|
-
await (0, eslintFix_1.eslintFix)(file);
|
|
48
|
-
}
|
|
49
44
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.FILE_RECORDED(file));
|
|
50
45
|
}
|
|
51
46
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.SCHEMAS_FINISH);
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { OutputPaths } from '../types/base/OutputPaths.model';
|
|
2
2
|
import { Templates } from '../types/base/Templates.model';
|
|
3
3
|
import { HttpClient } from '../types/enums/HttpClient.enum';
|
|
4
|
+
import { ModelsMode } from '../types/enums/ModelsMode.enum';
|
|
4
5
|
import type { Service } from '../types/shared/Service.model';
|
|
5
6
|
import { WriteClient } from '../WriteClient';
|
|
6
7
|
type TServeceOutputsPath = Omit<OutputPaths, 'output' | 'outputSchemas'>;
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
10
|
-
* @
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
9
|
+
* Параметры записи сервисов клиента.
|
|
10
|
+
* @property services список сервисов для записи
|
|
11
|
+
* @property templates загруженные Handlebars-шаблоны
|
|
12
|
+
* @property outputPaths пути выходных директорий сервисов
|
|
13
|
+
* @property httpClient выбранный HTTP-клиент
|
|
14
|
+
* @property useUnionTypes использовать union types вместо enum
|
|
15
|
+
* @property useOptions использовать options-функции вместо аргументов
|
|
16
|
+
* @property useCancelableRequest использовать cancelable request type
|
|
17
|
+
* @property [modelsMode] режим генерации моделей
|
|
18
|
+
* @property [prettierConfigPath] путь к конфигу Prettier
|
|
15
19
|
*/
|
|
16
20
|
interface IWriteClientServices {
|
|
17
21
|
services: Service[];
|
|
@@ -21,17 +25,12 @@ interface IWriteClientServices {
|
|
|
21
25
|
useUnionTypes: boolean;
|
|
22
26
|
useOptions: boolean;
|
|
23
27
|
useCancelableRequest: boolean;
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
modelsMode?: ModelsMode;
|
|
29
|
+
prettierConfigPath?: string;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @param
|
|
30
|
-
* @param templates The loaded handlebar templates
|
|
31
|
-
* @param outputServicePath Folder options for generating the core, models, and service part
|
|
32
|
-
* @param httpClient The selected httpClient (fetch, xhr or node)
|
|
33
|
-
* @param useUnionTypes Use union types instead of enums
|
|
34
|
-
* @param useOptions Use options or arguments functions
|
|
32
|
+
* Генерирует сервисы по Handlebars-шаблону и записывает их на диск.
|
|
33
|
+
* @param options параметры записи сервисов
|
|
35
34
|
*/
|
|
36
35
|
export declare function writeClientServices(this: WriteClient, options: IWriteClientServices): Promise<void>;
|
|
37
36
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientServices.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientServices.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeClientServices.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientServices.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,KAAK,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC;AAEzE;;;;;;;;;;;GAWG;AACH,UAAU,oBAAoB;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,mBAAmB,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BzG"}
|
|
@@ -2,20 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writeClientServices = writeClientServices;
|
|
4
4
|
const LoggerMessages_1 = require("../../common/LoggerMessages");
|
|
5
|
-
const eslintFix_1 = require("../../common/utils/eslintFix");
|
|
6
5
|
const format_1 = require("../../common/utils/format");
|
|
7
6
|
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param
|
|
11
|
-
* @param templates The loaded handlebar templates
|
|
12
|
-
* @param outputServicePath Folder options for generating the core, models, and service part
|
|
13
|
-
* @param httpClient The selected httpClient (fetch, xhr or node)
|
|
14
|
-
* @param useUnionTypes Use union types instead of enums
|
|
15
|
-
* @param useOptions Use options or arguments functions
|
|
8
|
+
* Генерирует сервисы по Handlebars-шаблону и записывает их на диск.
|
|
9
|
+
* @param options параметры записи сервисов
|
|
16
10
|
*/
|
|
17
11
|
async function writeClientServices(options) {
|
|
18
|
-
const { services, templates, outputPaths, httpClient, useUnionTypes, useOptions, useCancelableRequest,
|
|
12
|
+
const { services, templates, outputPaths, httpClient, useUnionTypes, useOptions, useCancelableRequest, modelsMode, prettierConfigPath } = options;
|
|
19
13
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.SERVICES_START);
|
|
20
14
|
for (const service of services) {
|
|
21
15
|
const file = (0, pathHelpers_1.resolveHelper)(outputPaths.outputServices, `${service.name}.ts`);
|
|
@@ -28,12 +22,11 @@ async function writeClientServices(options) {
|
|
|
28
22
|
outputCore: outputPaths.outputCore,
|
|
29
23
|
outputModels: outputPaths.outputModels,
|
|
30
24
|
useCancelableRequest,
|
|
25
|
+
modelsMode,
|
|
31
26
|
});
|
|
32
|
-
const formattedValue = await (0, format_1.format)(templateResult, undefined,
|
|
27
|
+
const formattedValue = await (0, format_1.format)(templateResult, undefined, prettierConfigPath);
|
|
33
28
|
await this.writeOutputFile(file, formattedValue);
|
|
34
|
-
|
|
35
|
-
await (0, eslintFix_1.eslintFix)(file);
|
|
36
|
-
}
|
|
29
|
+
this.registerLintTarget(file, outputPaths.outputServices);
|
|
37
30
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.FILE_RECORDED(file));
|
|
38
31
|
}
|
|
39
32
|
this.logger.info(LoggerMessages_1.LOGGER_MESSAGES.WRITE_CLIENT.SERVICES_FINISH);
|
|
@@ -11,20 +11,26 @@ declare const _default: {
|
|
|
11
11
|
"12": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
12
12
|
"13": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
13
13
|
"14": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
14
|
-
"16": (container: any, depth0: any, helpers: any, partials: any, data: any) =>
|
|
15
|
-
"
|
|
16
|
-
"19": (container: any, depth0: any, helpers: any, partials: any, data: any) =>
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"24": (container: any, depth0: any, helpers: any, partials: any, data: any) =>
|
|
14
|
+
"16": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
15
|
+
"17": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
16
|
+
"19": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
17
|
+
"21": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
18
|
+
"22": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
19
|
+
"23": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
20
|
+
"24": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
21
21
|
"25": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
22
|
-
"
|
|
22
|
+
"27": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
23
23
|
"28": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
24
|
-
"
|
|
24
|
+
"29": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
25
25
|
"31": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
26
|
-
"33": (container: any, depth0: any, helpers: any, partials: any, data: any) =>
|
|
27
|
-
"
|
|
26
|
+
"33": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
27
|
+
"34": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
28
|
+
"36": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
29
|
+
"38": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
30
|
+
"40": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
31
|
+
"41": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
32
|
+
"42": (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
33
|
+
"43": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
28
34
|
compiler: (string | number)[];
|
|
29
35
|
main: (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
30
36
|
usePartial: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportModels.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/client/exportModels.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exportModels.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/client/exportModels.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBA+VmC"}
|