ts-openapi-codegen 1.0.0-beta.8 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +221 -123
- package/README.rus.md +725 -0
- package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts +12 -0
- package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/checkConfig.js +66 -0
- package/dist/cli/checkAndUpdateConfig/constants.d.ts +13 -0
- package/dist/cli/checkAndUpdateConfig/constants.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/constants.js +29 -0
- package/dist/cli/checkAndUpdateConfig/types.d.ts +20 -0
- package/dist/cli/checkAndUpdateConfig/types.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/types.js +12 -0
- package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts +12 -0
- package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/updateConfig.js +56 -0
- package/dist/cli/checkAndUpdateConfig/utils/generateConfigExample.d.ts +2 -0
- package/dist/cli/checkAndUpdateConfig/utils/generateConfigExample.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/generateConfigExample.js +11 -0
- package/dist/cli/checkAndUpdateConfig/utils/prepareConfigData.d.ts +14 -0
- package/dist/cli/checkAndUpdateConfig/utils/prepareConfigData.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/prepareConfigData.js +30 -0
- package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.d.ts +17 -0
- package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.js +29 -0
- package/dist/cli/checkAndUpdateConfig/utils/rewriteConfigFile.d.ts +2 -0
- package/dist/cli/checkAndUpdateConfig/utils/rewriteConfigFile.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/rewriteConfigFile.js +11 -0
- package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.d.ts +29 -0
- package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.js +49 -0
- package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.d.ts +6 -0
- package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.js +22 -0
- package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts +17 -0
- package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.js +53 -0
- package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts +34 -0
- package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.js +41 -0
- package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.d.ts +6 -0
- package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.d.ts.map +1 -0
- package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.js +18 -0
- package/dist/cli/generate/runGenerateOpenApi.d.ts +2 -2
- package/dist/cli/generate/runGenerateOpenApi.d.ts.map +1 -1
- package/dist/cli/generate/runGenerateOpenApi.js +20 -37
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +56 -30
- package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.js +11 -18
- package/dist/cli/interactive/confirmDialog.d.ts +17 -0
- package/dist/cli/interactive/confirmDialog.d.ts.map +1 -0
- package/dist/cli/interactive/confirmDialog.js +36 -0
- package/dist/cli/interactive/constants.d.ts +7 -0
- package/dist/cli/interactive/constants.d.ts.map +1 -0
- package/dist/cli/interactive/constants.js +25 -0
- package/dist/cli/interactive/selectDialog.d.ts +17 -0
- package/dist/cli/interactive/selectDialog.d.ts.map +1 -0
- package/dist/cli/interactive/selectDialog.js +43 -0
- package/dist/cli/interactive/types.d.ts +40 -0
- package/dist/cli/interactive/types.d.ts.map +1 -0
- package/dist/cli/interactive/types.js +12 -0
- package/dist/common/Consts.d.ts +4 -0
- package/dist/common/Consts.d.ts.map +1 -1
- package/dist/common/Consts.js +31 -1
- package/dist/common/Enums.d.ts +4 -0
- package/dist/common/Enums.d.ts.map +1 -1
- package/dist/common/Enums.js +6 -1
- package/dist/common/Logger.d.ts +1 -1
- package/dist/common/Logger.d.ts.map +1 -1
- package/dist/common/Logger.js +7 -39
- package/dist/common/LoggerMessages.d.ts +64 -0
- package/dist/common/LoggerMessages.d.ts.map +1 -0
- package/dist/common/LoggerMessages.js +82 -0
- package/dist/common/TRawOptions.d.ts +40 -0
- package/dist/common/TRawOptions.d.ts.map +1 -0
- package/dist/common/UpdateNotifier.d.ts +36 -2
- package/dist/common/UpdateNotifier.d.ts.map +1 -1
- package/dist/common/UpdateNotifier.js +150 -57
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts +8 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +31 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts +8 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +33 -0
- package/dist/common/VersionedSchema/Enums.d.ts +2 -1
- package/dist/common/VersionedSchema/Enums.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Enums.js +1 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.js +10 -19
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.js +10 -10
- package/dist/common/VersionedSchema/Types.d.ts +10 -0
- package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts +3 -0
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts.map +1 -0
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.js +28 -0
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts +7 -0
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts.map +1 -0
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.js +42 -0
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts +3 -0
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts.map +1 -0
- package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.js +10 -0
- package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts +11 -0
- package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.js +19 -0
- package/dist/common/VersionedSchema/Utils/createTrivialMigration.d.ts +7 -0
- package/dist/common/VersionedSchema/Utils/createTrivialMigration.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/createTrivialMigration.js +15 -0
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts +1 -7
- package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts +3 -0
- package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.js +14 -0
- package/dist/common/VersionedSchema/Utils/getKeyByMapValue.d.ts +2 -0
- package/dist/common/VersionedSchema/Utils/getKeyByMapValue.d.ts.map +1 -0
- package/dist/common/VersionedSchema/Utils/getKeyByMapValue.js +11 -0
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts +5 -2
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +31 -17
- package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts.map +1 -0
- package/dist/common/utils/__tests__/convertArrayToObject.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/convertArrayToObject.test.js +14 -14
- package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/determineBestMatchingSchemaVersion.test.js +5 -5
- package/dist/common/utils/__tests__/generateKeyMappingForInvalidKeys.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/generateKeyMappingForInvalidKeys.test.js +4 -4
- package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/getUniqueKeysFromSchemas.test.js +4 -4
- package/dist/common/utils/__tests__/getUniqueObjectKeys.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/getUniqueObjectKeys.test.js +5 -5
- package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/mergeObjectSchemas.test.js +5 -5
- package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/migrationForMultiOptions.test.js +21 -15
- package/dist/common/utils/__tests__/migrationForOptions.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/migrationForOptions.test.js +13 -9
- package/dist/common/utils/__tests__/pathHelpers.test.d.ts.map +1 -0
- package/dist/{core → common}/utils/__tests__/pathHelpers.test.js +8 -8
- package/dist/common/utils/__tests__/replaceInvalidKeysWithMappedNames.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/replaceInvalidKeysWithMappedNames.test.js +5 -5
- package/dist/common/utils/__tests__/validateAndSuggestKeyCorrections.test.d.ts.map +1 -0
- package/dist/common/{__tests__ → utils/__tests__}/validateAndSuggestKeyCorrections.test.js +5 -5
- package/dist/common/utils/convertArrayToObject.d.ts +2 -0
- package/dist/common/utils/convertArrayToObject.d.ts.map +1 -0
- package/dist/common/{Utils.js → utils/convertArrayToObject.js} +0 -20
- package/dist/{core/utils/fileSystem.d.ts → common/utils/fileSystemHelpers.d.ts} +8 -5
- package/dist/common/utils/fileSystemHelpers.d.ts.map +1 -0
- package/dist/common/utils/fileSystemHelpers.js +85 -0
- package/dist/common/utils/format.d.ts +3 -0
- package/dist/common/utils/format.d.ts.map +1 -0
- package/dist/{core → common}/utils/format.js +2 -2
- package/dist/common/utils/loadConfigIfExists.d.ts +2 -0
- package/dist/common/utils/loadConfigIfExists.d.ts.map +1 -0
- package/dist/common/utils/loadConfigIfExists.js +22 -0
- package/dist/common/utils/pathHelpers.d.ts +6 -0
- package/dist/common/utils/pathHelpers.d.ts.map +1 -0
- package/dist/{core → common}/utils/pathHelpers.js +16 -20
- package/dist/common/utils/safeHasOwn.d.ts +2 -0
- package/dist/common/utils/safeHasOwn.d.ts.map +1 -0
- package/dist/common/utils/safeHasOwn.js +9 -0
- package/dist/core/Context.d.ts.map +1 -1
- package/dist/core/Context.js +3 -3
- package/dist/core/OpenApiClient.d.ts +13 -0
- package/dist/core/OpenApiClient.d.ts.map +1 -0
- package/dist/core/OpenApiClient.js +175 -0
- package/dist/core/WriteClient.d.ts +1 -1
- package/dist/core/WriteClient.d.ts.map +1 -1
- package/dist/core/WriteClient.js +20 -20
- package/dist/core/__tests__/WriteClient.test.js +61 -60
- package/dist/core/api/v2/Parser.d.ts.map +1 -1
- package/dist/core/api/v2/Parser.js +2 -9
- package/dist/core/api/v2/parser/__tests__/getServer.test.js +2 -2
- package/dist/core/api/v2/parser/__tests__/getType.test.js +3 -3
- package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModelProperties.js +2 -5
- package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModels.js +2 -1
- package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationParameter.js +2 -1
- package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationResponse.js +2 -5
- package/dist/core/api/v2/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationResponses.js +2 -5
- package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getServices.js +2 -5
- package/dist/core/api/v2/parser/getType.js +4 -4
- package/dist/core/api/v3/Parser.d.ts +1 -1
- package/dist/core/api/v3/Parser.d.ts.map +1 -1
- package/dist/core/api/v3/Parser.js +2 -9
- package/dist/core/api/v3/parser/__tests__/getServer.test.js +3 -3
- package/dist/core/api/v3/parser/__tests__/getType.test.js +3 -3
- package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModelProperties.js +2 -5
- package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModels.js +2 -1
- package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponse.js +2 -5
- package/dist/core/api/v3/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponses.js +2 -5
- package/dist/core/api/v3/parser/getServer.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getServer.js +2 -5
- package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getServices.js +2 -5
- package/dist/core/api/v3/parser/getType.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getType.js +5 -13
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -161
- package/dist/core/types/Consts.d.ts +5 -1
- package/dist/core/types/Consts.d.ts.map +1 -1
- package/dist/core/types/Consts.js +6 -2
- package/dist/core/types/base/Root.model.d.ts +1 -0
- package/dist/core/types/base/Root.model.d.ts.map +1 -1
- package/dist/core/utils/__tests__/escapeDescription.test.js +3 -3
- package/dist/core/utils/__tests__/escapeName.test.js +2 -2
- package/dist/core/utils/__tests__/flatMap.test.js +2 -2
- package/dist/core/utils/__tests__/getAbsolutePath.test.js +6 -6
- package/dist/core/utils/__tests__/getClassName.test.js +2 -2
- package/dist/core/utils/__tests__/getComment.test.js +2 -2
- package/dist/core/utils/__tests__/getEnumFromDescription.test.js +2 -2
- package/dist/core/utils/__tests__/getFileName.test.js +2 -2
- package/dist/core/utils/__tests__/getGatheringRefs.test.js +2 -2
- package/dist/core/utils/__tests__/getMappedType.test.js +2 -2
- package/dist/core/utils/__tests__/getModelNames.test.js +2 -2
- package/dist/core/utils/__tests__/getOpenApiVersion.test.js +2 -2
- package/dist/core/utils/__tests__/getOperationName.test.js +2 -2
- package/dist/core/utils/__tests__/getOperationParameterName.test.js +2 -2
- package/dist/core/utils/__tests__/getOperationPath.test.js +2 -2
- package/dist/core/utils/__tests__/getOperationResponseCode.test.js +2 -2
- package/dist/core/utils/__tests__/getPattern.test.js +2 -2
- package/dist/core/utils/__tests__/getRefFromSchema.test.js +2 -2
- package/dist/core/utils/__tests__/getRefs.test.js +2 -2
- package/dist/core/utils/__tests__/getRelativeModelPath.test.js +3 -3
- package/dist/core/utils/__tests__/getServiceClassName.test.js +2 -2
- package/dist/core/utils/__tests__/getServiceNames.test.js +2 -2
- package/dist/core/utils/__tests__/getServiceVersion.test.js +2 -2
- package/dist/core/utils/__tests__/isString.test.js +2 -2
- package/dist/core/utils/__tests__/isSubdirectory.test.js +10 -10
- package/dist/core/utils/__tests__/registerHandlebarHelpers.test.js +2 -2
- package/dist/core/utils/__tests__/registerHandlebarTemplates.test.js +2 -2
- package/dist/core/utils/__tests__/replaceString.test.js +2 -2
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.js +360 -51
- package/dist/core/utils/__tests__/sort.test.js +2 -2
- package/dist/core/utils/__tests__/sortByRequiredExtended.test.js +11 -11
- package/dist/core/utils/__tests__/sortByRequiredSimple.test.js +11 -11
- package/dist/core/utils/__tests__/sortModelsByName.test.js +2 -2
- package/dist/core/utils/__tests__/sortServicesByName.test.js +2 -2
- package/dist/core/utils/__tests__/stripNamespace.test.js +2 -2
- package/dist/core/utils/__tests__/unique.test.js +2 -2
- package/dist/core/utils/__tests__/writeClientCore.test.js +52 -50
- package/dist/core/utils/__tests__/writeClientFullIndex.test.js +39 -37
- package/dist/core/utils/__tests__/writeClientModels.test.js +65 -63
- package/dist/core/utils/__tests__/writeClientSchemas.test.js +65 -63
- package/dist/core/utils/__tests__/writeClientServices.test.js +60 -58
- package/dist/core/utils/appendUniqueLinesToFile.js +4 -4
- package/dist/core/utils/createNormalizedRef.js +2 -2
- package/dist/core/utils/getAbsolutePath.js +3 -3
- package/dist/core/utils/getModelNameWithPrefix.d.ts +3 -0
- package/dist/core/utils/getModelNameWithPrefix.d.ts.map +1 -0
- package/dist/core/utils/getModelNameWithPrefix.js +15 -0
- package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
- package/dist/core/utils/getOpenApiSpec.js +4 -4
- package/dist/core/utils/getOutputPaths.d.ts.map +1 -1
- package/dist/core/utils/getOutputPaths.js +6 -6
- package/dist/core/utils/getPattern.d.ts.map +1 -1
- package/dist/core/utils/getPattern.js +2 -1
- package/dist/core/utils/getRelativeModelPath.d.ts.map +1 -1
- package/dist/core/utils/getRelativeModelPath.js +2 -6
- package/dist/core/utils/isSubdirectory.d.ts.map +1 -1
- package/dist/core/utils/isSubdirectory.js +4 -3
- package/dist/core/utils/mapPathToTargetDirSafe.d.ts.map +1 -1
- package/dist/core/utils/mapPathToTargetDirSafe.js +11 -12
- package/dist/core/utils/modelHelpers.d.ts.map +1 -1
- package/dist/core/utils/modelHelpers.js +18 -6
- package/dist/core/utils/normalizeString.d.ts +2 -0
- package/dist/core/utils/normalizeString.d.ts.map +1 -0
- package/dist/core/utils/normalizeString.js +14 -0
- package/dist/core/utils/normalizedAbsolutePath.js +3 -3
- package/dist/core/utils/parseRef.d.ts.map +1 -1
- package/dist/core/utils/parseRef.js +7 -10
- package/dist/core/utils/precompileTemplates.js +14 -10
- package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarHelpers.js +24 -0
- package/dist/core/utils/replaceString.d.ts.map +1 -1
- package/dist/core/utils/replaceString.js +2 -1
- package/dist/core/utils/resolveRefPath.d.ts.map +1 -1
- package/dist/core/utils/resolveRefPath.js +3 -3
- package/dist/core/utils/resolveRefToImportPath.d.ts +8 -2
- package/dist/core/utils/resolveRefToImportPath.d.ts.map +1 -1
- package/dist/core/utils/resolveRefToImportPath.js +91 -31
- package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
- package/dist/core/utils/serviceHelpers.js +2 -1
- package/dist/core/utils/stripNamespace.js +5 -5
- package/dist/core/utils/writeClientCore.d.ts.map +1 -1
- package/dist/core/utils/writeClientCore.js +12 -12
- package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientCoreIndex.js +2 -2
- package/dist/core/utils/writeClientFullIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientFullIndex.js +4 -4
- package/dist/core/utils/writeClientModels.d.ts.map +1 -1
- package/dist/core/utils/writeClientModels.js +7 -7
- package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientModelsIndex.js +2 -2
- 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 +2 -2
- package/dist/core/utils/writeClientServices.d.ts.map +1 -1
- package/dist/core/utils/writeClientServices.js +5 -5
- package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientServicesIndex.js +2 -2
- package/dist/core/utils/writeClientSimpleIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientSimpleIndex.js +4 -4
- package/dist/templatesCompiled/client/exportModel.js +4 -4
- package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
- package/dist/templatesCompiled/client/exportService.js +12 -13
- package/dist/templatesCompiled/client/indexFull.d.ts.map +1 -1
- package/dist/templatesCompiled/client/indexFull.js +35 -29
- package/dist/templatesCompiled/client/partials/parameters.d.ts +3 -2
- package/dist/templatesCompiled/client/partials/parameters.d.ts.map +1 -1
- package/dist/templatesCompiled/client/partials/parameters.js +25 -20
- package/dist/templatesCompiled/client/partials/parametersDefinition.d.ts +4 -2
- package/dist/templatesCompiled/client/partials/parametersDefinition.d.ts.map +1 -1
- package/dist/templatesCompiled/client/partials/parametersDefinition.js +31 -10
- package/package.json +15 -13
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts +0 -5
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts.map +0 -1
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.js +0 -45
- package/dist/common/Options.d.ts +0 -26
- package/dist/common/Options.d.ts.map +0 -1
- package/dist/common/Utils.d.ts +0 -3
- package/dist/common/Utils.d.ts.map +0 -1
- package/dist/common/__tests__/__mock__/mockJoiSchema.d.ts.map +0 -1
- package/dist/common/__tests__/convertArrayToObject.test.d.ts.map +0 -1
- package/dist/common/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +0 -1
- package/dist/common/__tests__/generateKeyMappingForInvalidKeys.test.d.ts.map +0 -1
- package/dist/common/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +0 -1
- package/dist/common/__tests__/getUniqueObjectKeys.test.d.ts.map +0 -1
- package/dist/common/__tests__/mergeObjectSchemas.test.d.ts.map +0 -1
- package/dist/common/__tests__/migrationForMultiOptions.test.d.ts.map +0 -1
- package/dist/common/__tests__/migrationForOptions.test.d.ts.map +0 -1
- package/dist/common/__tests__/replaceInvalidKeysWithMappedNames.test.d.ts.map +0 -1
- package/dist/common/__tests__/validateAndSuggestKeyCorrections.test.d.ts.map +0 -1
- package/dist/core/utils/__tests__/getRelativeModelImportPath.test.d.ts +0 -2
- package/dist/core/utils/__tests__/getRelativeModelImportPath.test.d.ts.map +0 -1
- package/dist/core/utils/__tests__/getRelativeModelImportPath.test.js +0 -82
- package/dist/core/utils/__tests__/pathHelpers.test.d.ts.map +0 -1
- package/dist/core/utils/fileSystem.d.ts.map +0 -1
- package/dist/core/utils/fileSystem.js +0 -26
- package/dist/core/utils/format.d.ts +0 -2
- package/dist/core/utils/format.d.ts.map +0 -1
- package/dist/core/utils/getRelativeModelImportPath.d.ts +0 -9
- package/dist/core/utils/getRelativeModelImportPath.d.ts.map +0 -1
- package/dist/core/utils/getRelativeModelImportPath.js +0 -45
- package/dist/core/utils/isDirectory.d.ts +0 -2
- package/dist/core/utils/isDirectory.d.ts.map +0 -1
- package/dist/core/utils/isDirectory.js +0 -13
- package/dist/core/utils/pathHelpers.d.ts +0 -7
- package/dist/core/utils/pathHelpers.d.ts.map +0 -1
- package/dist/core/utils/prepareOptions.d.ts +0 -8
- package/dist/core/utils/prepareOptions.d.ts.map +0 -1
- package/dist/core/utils/prepareOptions.js +0 -31
- /package/dist/common/{Options.js → TRawOptions.js} +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/__mock__/mockJoiSchema.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/__mock__/mockJoiSchema.js +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/convertArrayToObject.test.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/determineBestMatchingSchemaVersion.test.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/generateKeyMappingForInvalidKeys.test.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/getUniqueKeysFromSchemas.test.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/getUniqueObjectKeys.test.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/mergeObjectSchemas.test.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/migrationForMultiOptions.test.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/migrationForOptions.test.d.ts +0 -0
- /package/dist/{core → common}/utils/__tests__/pathHelpers.test.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/replaceInvalidKeysWithMappedNames.test.d.ts +0 -0
- /package/dist/common/{__tests__ → utils/__tests__}/validateAndSuggestKeyCorrections.test.d.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeString = normalizeString;
|
|
4
|
+
const Consts_1 = require("../types/Consts");
|
|
5
|
+
function normalizeString(value) {
|
|
6
|
+
if (!value) {
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
return value
|
|
10
|
+
.replace(Consts_1.REGEX_BACKSLASH, '/')
|
|
11
|
+
.replace(Consts_1.REGEX_MULTIPLE_SLASHES, '/')
|
|
12
|
+
.replace(Consts_1.REGEX_DOT_SLASH, '/')
|
|
13
|
+
.replace(Consts_1.REGEX_LEADING_DOT_SLASH, './');
|
|
14
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizedAbsolutePath = normalizedAbsolutePath;
|
|
4
|
-
const pathHelpers_1 = require("
|
|
4
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
5
5
|
/**
|
|
6
6
|
* Converts the path to an absolute one and normalizes it.
|
|
7
7
|
* @* @param path Value is the value of the path to convert.
|
|
8
8
|
*/
|
|
9
9
|
function normalizedAbsolutePath(pathValue) {
|
|
10
|
-
const absolute = (0, pathHelpers_1.
|
|
11
|
-
return (0, pathHelpers_1.
|
|
10
|
+
const absolute = (0, pathHelpers_1.resolveHelper)(pathValue);
|
|
11
|
+
return (0, pathHelpers_1.normalizeHelper)(absolute);
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseRef.d.ts","sourceRoot":"","sources":["../../../src/core/utils/parseRef.ts"],"names":[],"mappings":"AAEA,oBAAY,OAAO;IACf,cAAc,mBAAmB;IACjC,aAAa,kBAAkB;IAC/B,sBAAsB,2BAA2B;IACjD,QAAQ,aAAa;IACrB,aAAa,kBAAkB;CAClC;AAED,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"parseRef.d.ts","sourceRoot":"","sources":["../../../src/core/utils/parseRef.ts"],"names":[],"mappings":"AAEA,oBAAY,OAAO;IACf,cAAc,mBAAmB;IACjC,aAAa,kBAAkB;IAC/B,sBAAsB,2BAA2B;IACjD,QAAQ,aAAa;IACrB,aAAa,kBAAkB;CAClC;AAED,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAgD/C"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.RefType = void 0;
|
|
7
4
|
exports.parseRef = parseRef;
|
|
8
|
-
const path_1 =
|
|
5
|
+
const path_1 = require("path");
|
|
9
6
|
var RefType;
|
|
10
7
|
(function (RefType) {
|
|
11
8
|
RefType["LOCAL_FRAGMENT"] = "local_fragment";
|
|
@@ -25,17 +22,17 @@ function parseRef(ref) {
|
|
|
25
22
|
if (ref.startsWith('http://') || ref.startsWith('https://')) {
|
|
26
23
|
return {
|
|
27
24
|
type: RefType.HTTP_URL,
|
|
28
|
-
originalRef: ref
|
|
25
|
+
originalRef: ref,
|
|
29
26
|
};
|
|
30
27
|
}
|
|
31
28
|
// Absolute paths (POSIX/Windows handled by path.isAbsolute)
|
|
32
|
-
if (path_1.
|
|
29
|
+
if ((0, path_1.isAbsolute)(ref)) {
|
|
33
30
|
const [filePath, fragment] = ref.split('#');
|
|
34
31
|
return {
|
|
35
32
|
type: RefType.ABSOLUTE_PATH,
|
|
36
33
|
filePath,
|
|
37
34
|
fragment: fragment ? `#${fragment}` : undefined,
|
|
38
|
-
originalRef: ref
|
|
35
|
+
originalRef: ref,
|
|
39
36
|
};
|
|
40
37
|
}
|
|
41
38
|
// Local fragment
|
|
@@ -43,7 +40,7 @@ function parseRef(ref) {
|
|
|
43
40
|
return {
|
|
44
41
|
type: RefType.LOCAL_FRAGMENT,
|
|
45
42
|
fragment: ref,
|
|
46
|
-
originalRef: ref
|
|
43
|
+
originalRef: ref,
|
|
47
44
|
};
|
|
48
45
|
}
|
|
49
46
|
// External file references (may include fragment)
|
|
@@ -53,12 +50,12 @@ function parseRef(ref) {
|
|
|
53
50
|
type: RefType.EXTERNAL_FILE_FRAGMENT,
|
|
54
51
|
filePath,
|
|
55
52
|
fragment: `#${fragment}`,
|
|
56
|
-
originalRef: ref
|
|
53
|
+
originalRef: ref,
|
|
57
54
|
};
|
|
58
55
|
}
|
|
59
56
|
return {
|
|
60
57
|
type: RefType.EXTERNAL_FILE,
|
|
61
58
|
filePath,
|
|
62
|
-
originalRef: ref
|
|
59
|
+
originalRef: ref,
|
|
63
60
|
};
|
|
64
61
|
}
|
|
@@ -5,11 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const fs_1 = __importDefault(require("fs"));
|
|
7
7
|
const handlebars_1 = __importDefault(require("handlebars"));
|
|
8
|
-
const path_1 =
|
|
8
|
+
const path_1 = require("path");
|
|
9
9
|
const Enums_1 = require("../../common/Enums");
|
|
10
10
|
const Logger_1 = require("../../common/Logger");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
12
|
+
const Consts_1 = require("../../core/types/Consts");
|
|
13
|
+
const templatesDir = (0, pathHelpers_1.resolveHelper)(__dirname, '../../templates');
|
|
14
|
+
const compiledDir = (0, pathHelpers_1.resolveHelper)(__dirname, '../../templatesCompiled');
|
|
13
15
|
const header = `// This is an automatically generated file for the hbs template.
|
|
14
16
|
// You don't need to change it, run npm run build:hbs to update it.
|
|
15
17
|
/* istanbul ignore file */
|
|
@@ -36,15 +38,14 @@ const precompileTemplates = () => {
|
|
|
36
38
|
if (file.name === '__mocks__') {
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
|
-
const filePath =
|
|
41
|
+
const filePath = (0, pathHelpers_1.joinHelper)(dir, file.name);
|
|
40
42
|
if (file.isDirectory()) {
|
|
41
43
|
walk(filePath);
|
|
42
44
|
}
|
|
43
|
-
else if (file.isFile() && path_1.
|
|
44
|
-
const templateName =
|
|
45
|
-
.relative(templatesDir, filePath)
|
|
45
|
+
else if (file.isFile() && (0, path_1.extname)(file.name) === '.hbs') {
|
|
46
|
+
const templateName = (0, pathHelpers_1.relativeHelper)(templatesDir, filePath)
|
|
46
47
|
.replace(/\.hbs$/, '')
|
|
47
|
-
.replace(
|
|
48
|
+
.replace(Consts_1.REGEX_BACKSLASH, '/');
|
|
48
49
|
const templateContent = fs_1.default.readFileSync(filePath, 'utf8');
|
|
49
50
|
const precompiled = handlebars_1.default.precompile(templateContent, {
|
|
50
51
|
strict: true,
|
|
@@ -58,11 +59,14 @@ const precompileTemplates = () => {
|
|
|
58
59
|
union: true,
|
|
59
60
|
intersection: true,
|
|
60
61
|
enumerator: true,
|
|
62
|
+
containsSystemName: true,
|
|
63
|
+
normalizePath: true,
|
|
64
|
+
joinPath: true,
|
|
61
65
|
},
|
|
62
66
|
});
|
|
63
67
|
const tsContent = header + precompiled;
|
|
64
|
-
const outputFilePath =
|
|
65
|
-
const outputDir =
|
|
68
|
+
const outputFilePath = (0, pathHelpers_1.joinHelper)(compiledDir, `${templateName}.ts`);
|
|
69
|
+
const outputDir = (0, pathHelpers_1.dirNameHelper)(outputFilePath);
|
|
66
70
|
if (!fs_1.default.existsSync(outputDir)) {
|
|
67
71
|
fs_1.default.mkdirSync(outputDir, { recursive: true });
|
|
68
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerHandlebarHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarHelpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerHandlebarHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/registerHandlebarHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAK5D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CA+E5H"}
|
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.registerHandlebarHelpers = registerHandlebarHelpers;
|
|
37
37
|
const Handlebars = __importStar(require("handlebars/runtime"));
|
|
38
|
+
const Consts_1 = require("../types/Consts");
|
|
38
39
|
const unique_1 = require("./unique");
|
|
39
40
|
function registerHandlebarHelpers(root) {
|
|
40
41
|
Handlebars.registerHelper('equals', function (a, b, options) {
|
|
@@ -80,4 +81,27 @@ function registerHandlebarHelpers(root) {
|
|
|
80
81
|
const hasReservedWords = RESERVED_WORDS.test(value);
|
|
81
82
|
return hasReservedWords ? options.fn(this) : options.inverse(this);
|
|
82
83
|
});
|
|
84
|
+
Handlebars.registerHelper('normalizePath', function (path) {
|
|
85
|
+
if (!path || typeof path !== 'string') {
|
|
86
|
+
return './';
|
|
87
|
+
}
|
|
88
|
+
let normalizedPath = path
|
|
89
|
+
.replace(Consts_1.REGEX_BACKSLASH, '/')
|
|
90
|
+
.replace(Consts_1.REGEX_MULTIPLE_SLASHES, '/')
|
|
91
|
+
.replace(Consts_1.REGEX_DOT_SLASH, '/')
|
|
92
|
+
.replace(Consts_1.REGEX_LEADING_DOT_SLASH, './')
|
|
93
|
+
.replace(Consts_1.REGEX_TRAILING_SLASH, '');
|
|
94
|
+
if (!normalizedPath.startsWith('./')) {
|
|
95
|
+
normalizedPath = `./${normalizedPath}`;
|
|
96
|
+
}
|
|
97
|
+
if (normalizedPath === '.') {
|
|
98
|
+
return './';
|
|
99
|
+
}
|
|
100
|
+
return normalizedPath;
|
|
101
|
+
});
|
|
102
|
+
Handlebars.registerHelper('joinPath', function (firstPath, secondPath) {
|
|
103
|
+
const cleanedFirstPath = firstPath.endsWith('./') ? firstPath.slice(0, -2) : firstPath;
|
|
104
|
+
const cleanedSecondPath = secondPath.startsWith('./') ? secondPath.slice(2) : secondPath;
|
|
105
|
+
return `${cleanedFirstPath}/${cleanedSecondPath}`.replace(Consts_1.REGEX_BACKSLASH, '/').replace(Consts_1.REGEX_MULTIPLE_SLASHES, '/');
|
|
106
|
+
});
|
|
83
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replaceString.d.ts","sourceRoot":"","sources":["../../../src/core/utils/replaceString.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"replaceString.d.ts","sourceRoot":"","sources":["../../../src/core/utils/replaceString.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAMvE"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceString = replaceString;
|
|
4
|
+
const Consts_1 = require("../types/Consts");
|
|
4
5
|
function replaceString(value) {
|
|
5
6
|
if (!value) {
|
|
6
7
|
return value;
|
|
7
8
|
}
|
|
8
|
-
const searchRegExp =
|
|
9
|
+
const searchRegExp = Consts_1.REGEX_BACKSLASH;
|
|
9
10
|
return value.replace(searchRegExp, '/');
|
|
10
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRefPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefPath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveRefPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefPath.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAW,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CA4BnF"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveRefPath = resolveRefPath;
|
|
4
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
4
5
|
const advancedDeduplicatePath_1 = require("./advancedDeduplicatePath");
|
|
5
6
|
const parseRef_1 = require("./parseRef");
|
|
6
|
-
const pathHelpers_1 = require("./pathHelpers");
|
|
7
7
|
/**
|
|
8
8
|
* Resolve a parsed reference to an absolute path (when applicable).
|
|
9
9
|
* parentFilePath is expected to be a file path (absolute or relative).
|
|
10
10
|
*/
|
|
11
11
|
function resolveRefPath(parsedRef, parentFilePath) {
|
|
12
12
|
// For correct operation, parentDir must be the path to the directory, not the file.
|
|
13
|
-
const parentDir = (0, pathHelpers_1.
|
|
13
|
+
const parentDir = (0, pathHelpers_1.dirNameHelper)(parentFilePath.split('#')[0]);
|
|
14
14
|
switch (parsedRef.type) {
|
|
15
15
|
case parseRef_1.RefType.LOCAL_FRAGMENT:
|
|
16
16
|
// For local fragments, use the parent file path
|
|
@@ -19,7 +19,7 @@ function resolveRefPath(parsedRef, parentFilePath) {
|
|
|
19
19
|
case parseRef_1.RefType.EXTERNAL_FILE_FRAGMENT:
|
|
20
20
|
// Resolve relative to parent file directory
|
|
21
21
|
if (parsedRef.filePath) {
|
|
22
|
-
const resolvedPath = (0, pathHelpers_1.
|
|
22
|
+
const resolvedPath = (0, pathHelpers_1.resolveHelper)(parentDir, parsedRef.filePath);
|
|
23
23
|
// Clean any duplicate path segments
|
|
24
24
|
return (0, advancedDeduplicatePath_1.advancedDeduplicatePath)(resolvedPath);
|
|
25
25
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
interface IParams {
|
|
2
2
|
mainSpecPath: string;
|
|
3
3
|
parentFilePath: string;
|
|
4
4
|
refValuePath: string;
|
|
5
5
|
outputModelsPath: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Resolves $ref reference to import path for generated code.
|
|
9
|
+
* Handles HTTP URLs, local fragments, external file fragments, external files, and absolute paths.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveRefToImportPath({ mainSpecPath, parentFilePath, refValuePath, outputModelsPath }: IParams): string;
|
|
12
|
+
export {};
|
|
7
13
|
//# sourceMappingURL=resolveRefToImportPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRefToImportPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefToImportPath.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveRefToImportPath.d.ts","sourceRoot":"","sources":["../../../src/core/utils/resolveRefToImportPath.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAyFD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,OAAO,UAiE/G"}
|
|
@@ -2,44 +2,104 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveRefToImportPath = resolveRefToImportPath;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
|
|
6
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
7
7
|
const mapPathToTargetDirSafe_1 = require("./mapPathToTargetDirSafe");
|
|
8
8
|
const parseRef_1 = require("./parseRef");
|
|
9
|
-
const pathHelpers_1 = require("./pathHelpers");
|
|
10
9
|
const stripNamespace_1 = require("./stripNamespace");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Resolves model path and returns relative path or fallback name.
|
|
12
|
+
* Returns fallback if the path is outside outputModelsPath, otherwise returns relative path.
|
|
13
|
+
*/
|
|
14
|
+
function resolveModelPath(absModelPath, absOutputModelsPath, fallbackName) {
|
|
15
|
+
if (!absModelPath.startsWith(absOutputModelsPath + '/') && absModelPath !== absOutputModelsPath) {
|
|
16
|
+
return `./${fallbackName}`;
|
|
17
|
+
}
|
|
18
|
+
return (0, pathHelpers_1.relativeHelper)(absOutputModelsPath, absModelPath);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolves fragment reference (LOCAL_FRAGMENT or EXTERNAL_FILE_FRAGMENT).
|
|
22
|
+
* Both types use the same logic: resolve model path based on parent file location.
|
|
23
|
+
*/
|
|
24
|
+
function resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath) {
|
|
25
|
+
const cleanParentForLocal = (0, stripNamespace_1.stripNamespace)(parentFilePath || mainSpecPath);
|
|
26
|
+
const parentDirInSource = (0, pathHelpers_1.dirNameHelper)(cleanParentForLocal);
|
|
27
|
+
const parentDirInOutput = (0, mapPathToTargetDirSafe_1.mapPathToTargetDirSafe)(parentDirInSource, sourceRoot, outputModelsPath);
|
|
28
|
+
const modelFilePathInOutput = (0, pathHelpers_1.resolveHelper)(parentDirInOutput, modelName);
|
|
29
|
+
const absModelPath = (0, pathHelpers_1.resolveHelper)(modelFilePathInOutput);
|
|
30
|
+
return resolveModelPath(absModelPath, absOutputModelsPath, modelName);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolves external file or absolute path reference.
|
|
34
|
+
* Maps the target file path to output directory and returns relative path or fallback.
|
|
35
|
+
*/
|
|
36
|
+
function resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath) {
|
|
37
|
+
const targetPathInOutput = (0, mapPathToTargetDirSafe_1.mapPathToTargetDirSafe)(targetFileAbs, sourceRoot, outputModelsPath);
|
|
38
|
+
const absTargetPath = (0, pathHelpers_1.resolveHelper)(targetPathInOutput);
|
|
39
|
+
const fallbackName = (0, stripNamespace_1.stripNamespace)((0, path_1.basename)(targetFileAbs));
|
|
40
|
+
return resolveModelPath(absTargetPath, absOutputModelsPath, fallbackName);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Prepares parent directory for resolving relative references.
|
|
44
|
+
* Handles both file and directory paths.
|
|
45
|
+
*/
|
|
46
|
+
function prepareParentDirForResolve(parentFilePath, mainSpecPath, sourceRoot) {
|
|
47
|
+
const parentParsed = parentFilePath ? (0, parseRef_1.parseRef)(parentFilePath) : null;
|
|
48
|
+
const parentRaw = parentParsed?.filePath ? parentParsed.filePath : '';
|
|
49
|
+
const parentClean = (0, stripNamespace_1.stripNamespace)(parentRaw);
|
|
50
|
+
let parentDirForResolve = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(sourceRoot) ? (0, pathHelpers_1.dirNameHelper)(sourceRoot) : sourceRoot;
|
|
51
|
+
if (parentClean) {
|
|
52
|
+
parentDirForResolve = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(parentRaw) ? (0, pathHelpers_1.dirNameHelper)(parentClean) : parentClean;
|
|
53
|
+
}
|
|
54
|
+
return parentDirForResolve.endsWith('/') ? parentDirForResolve : parentDirForResolve + '/';
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Removes parent basename prefix from reference value if present.
|
|
58
|
+
* This handles cases where refValuePath starts with parent directory name.
|
|
59
|
+
*/
|
|
60
|
+
function removeParentBasenamePrefix(refValueClean, parentDirForResolveWithSep) {
|
|
61
|
+
const baseNameParent = (0, path_1.basename)(parentDirForResolveWithSep);
|
|
62
|
+
const baseNameParentWithSep = baseNameParent.endsWith('/') ? baseNameParent : baseNameParent + '/';
|
|
63
|
+
return refValueClean.startsWith(baseNameParentWithSep)
|
|
64
|
+
? refValueClean.replace(baseNameParentWithSep, '')
|
|
65
|
+
: refValueClean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Resolves $ref reference to import path for generated code.
|
|
69
|
+
* Handles HTTP URLs, local fragments, external file fragments, external files, and absolute paths.
|
|
70
|
+
*/
|
|
71
|
+
function resolveRefToImportPath({ mainSpecPath, parentFilePath, refValuePath, outputModelsPath }) {
|
|
72
|
+
const absOutputModelsPath = (0, pathHelpers_1.resolveHelper)(outputModelsPath);
|
|
73
|
+
const sourceRoot = fileSystemHelpers_1.fileSystemHelpers.isDirectory(mainSpecPath) ? mainSpecPath : (0, pathHelpers_1.dirNameHelper)(mainSpecPath);
|
|
14
74
|
const parsed = (0, parseRef_1.parseRef)(refValuePath);
|
|
15
|
-
//
|
|
75
|
+
// HTTP URLs are returned as-is
|
|
76
|
+
if (parsed.type === parseRef_1.RefType.HTTP_URL) {
|
|
77
|
+
return refValuePath;
|
|
78
|
+
}
|
|
79
|
+
// LOCAL_FRAGMENT: reference to component in the same file (e.g., #/components/schemas/User)
|
|
16
80
|
if (parsed.type === parseRef_1.RefType.LOCAL_FRAGMENT) {
|
|
17
|
-
// stripNamespace transform "#/components/schemas/AccountField" → "AccountField"
|
|
18
81
|
const modelName = (0, stripNamespace_1.stripNamespace)(refValuePath);
|
|
19
|
-
|
|
20
|
-
const cleanParent = (0, stripNamespace_1.stripNamespace)(parentFilePath || mainSpecPath);
|
|
21
|
-
const parentDirInSource = (0, path_1.dirname)(cleanParent);
|
|
22
|
-
const parentDirInOutput = (0, mapPathToTargetDirSafe_1.mapPathToTargetDirSafe)(parentDirInSource, sourceRoot, outputModelsPath);
|
|
23
|
-
// Crearea căii către fișierul model
|
|
24
|
-
const modelFilePathInOutput = (0, path_1.resolve)(parentDirInOutput, modelName);
|
|
25
|
-
const absModelPath = (0, path_1.resolve)(modelFilePathInOutput);
|
|
26
|
-
if (!absModelPath.startsWith(absOutputModelsPath + '/') && absModelPath !== absOutputModelsPath) {
|
|
27
|
-
return `./${modelName}`;
|
|
28
|
-
}
|
|
29
|
-
const relativePath = (0, path_1.relative)(absOutputModelsPath, absModelPath);
|
|
30
|
-
return `./${relativePath.replace(/\\/g, '/')}`;
|
|
82
|
+
return resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath);
|
|
31
83
|
}
|
|
32
|
-
//
|
|
33
|
-
|
|
84
|
+
// EXTERNAL_FILE_FRAGMENT: reference to component in external file (e.g., ./file.yaml#/components/schemas/User)
|
|
85
|
+
if (parsed.type === parseRef_1.RefType.EXTERNAL_FILE_FRAGMENT) {
|
|
86
|
+
const refFileRaw = parsed?.fragment ? parsed.fragment : '';
|
|
87
|
+
const modelName = (0, stripNamespace_1.stripNamespace)(refFileRaw || '') || '';
|
|
88
|
+
return resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath);
|
|
89
|
+
}
|
|
90
|
+
// Prepare parent directory for resolving relative references
|
|
91
|
+
// This is used for both EXTERNAL_FILE and ABSOLUTE_PATH (default case)
|
|
92
|
+
const parentDirForResolveWithSep = prepareParentDirForResolve(parentFilePath, mainSpecPath, sourceRoot);
|
|
34
93
|
const refValueClean = (0, stripNamespace_1.stripNamespace)(refValuePath || '') || refValuePath;
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const fallbackName = (0, stripNamespace_1.stripNamespace)((0, path_1.basename)(targetFileAbs));
|
|
41
|
-
return `./${fallbackName}`;
|
|
94
|
+
const currentRefValue = removeParentBasenamePrefix(refValueClean, parentDirForResolveWithSep);
|
|
95
|
+
// EXTERNAL_FILE: reference to external file (e.g., ./file.yaml)
|
|
96
|
+
if (parsed.type === parseRef_1.RefType.EXTERNAL_FILE) {
|
|
97
|
+
const targetFileAbs = (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, currentRefValue);
|
|
98
|
+
return resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath);
|
|
42
99
|
}
|
|
43
|
-
|
|
44
|
-
|
|
100
|
+
// ABSOLUTE_PATH (default case): absolute path reference
|
|
101
|
+
const targetFileAbs = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(refValueClean)
|
|
102
|
+
? (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, refValueClean)
|
|
103
|
+
: (0, pathHelpers_1.resolveHelper)(parentDirForResolveWithSep, refValueClean);
|
|
104
|
+
return resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath);
|
|
45
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/serviceHelpers.ts"],"names":[],"mappings":"
|
|
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;AAK7D;;;;;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;;;;;;;GAOG;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;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiChE"}
|
|
@@ -4,6 +4,7 @@ exports.forEachOperationInPath = forEachOperationInPath;
|
|
|
4
4
|
exports.ensureService = ensureService;
|
|
5
5
|
exports.mergeOperationImportsIntoService = mergeOperationImportsIntoService;
|
|
6
6
|
exports.finalizeServiceImports = finalizeServiceImports;
|
|
7
|
+
const safeHasOwn_1 = require("../../common/utils/safeHasOwn");
|
|
7
8
|
const unique_1 = require("./unique");
|
|
8
9
|
const SUPPORTED_METHODS = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch'];
|
|
9
10
|
/**
|
|
@@ -14,7 +15,7 @@ const SUPPORTED_METHODS = ['get', 'put', 'post', 'delete', 'options', 'head', 'p
|
|
|
14
15
|
*/
|
|
15
16
|
function forEachOperationInPath(pathObj, cb) {
|
|
16
17
|
for (const method in pathObj) {
|
|
17
|
-
if (!
|
|
18
|
+
if (!(0, safeHasOwn_1.safeHasOwn)(pathObj, method))
|
|
18
19
|
continue;
|
|
19
20
|
if (SUPPORTED_METHODS.includes(method) && pathObj[method]) {
|
|
20
21
|
cb(method, pathObj[method]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stripNamespace = stripNamespace;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
-
const pathHelpers_1 = require("
|
|
5
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
6
6
|
const getClassName_1 = require("./getClassName");
|
|
7
7
|
const getMappedType_1 = require("./getMappedType");
|
|
8
8
|
/**
|
|
@@ -15,10 +15,10 @@ function stripNamespace(value) {
|
|
|
15
15
|
}
|
|
16
16
|
if (!value.match(/^(http:\/\/|https:\/\/|#\/)/g) && !(0, getMappedType_1.hasMappedType)(value) && !value.match(/^array\[[a-z]+\]$/g)) {
|
|
17
17
|
const foundFile = value.match(/^(.*)#/);
|
|
18
|
-
const directoryName = foundFile ? (0, pathHelpers_1.
|
|
18
|
+
const directoryName = foundFile ? (0, pathHelpers_1.dirNameHelper)(foundFile[1]) : (0, pathHelpers_1.dirNameHelper)(value);
|
|
19
19
|
const extName = (0, path_1.extname)(value);
|
|
20
20
|
const baseName = extName.toLowerCase().match(/(\.json|\.yaml|\.yml)$/g) ? (0, getClassName_1.getClassName)((0, path_1.basename)(value, extName)) : (0, getClassName_1.getClassName)((0, path_1.basename)(value));
|
|
21
|
-
return directoryName ? (0, pathHelpers_1.
|
|
21
|
+
return directoryName ? (0, pathHelpers_1.joinHelper)(directoryName, baseName) : baseName;
|
|
22
22
|
}
|
|
23
23
|
const clearValue = value
|
|
24
24
|
.trim()
|
|
@@ -35,7 +35,7 @@ function stripNamespace(value) {
|
|
|
35
35
|
.replace(/^#\/parameters\//, '')
|
|
36
36
|
.replace(/^#\/responses\//, '')
|
|
37
37
|
.replace(/^#\/securityDefinitions\//, '');
|
|
38
|
-
const directoryName = (0, pathHelpers_1.
|
|
38
|
+
const directoryName = (0, pathHelpers_1.dirNameHelper)(clearValue);
|
|
39
39
|
const baseName = (0, getClassName_1.getClassName)((0, path_1.basename)(clearValue));
|
|
40
|
-
return directoryName ? (0, pathHelpers_1.
|
|
40
|
+
return directoryName ? (0, pathHelpers_1.joinHelper)(directoryName, baseName) : baseName;
|
|
41
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientCore.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"writeClientCore.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;;GAOG;AACH,UAAU,gBAAgB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCjG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writeClientCore = writeClientCore;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
|
|
5
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
6
6
|
/**
|
|
7
7
|
* Generate OpenAPI core files, this includes the basic boilerplate code to handle requests.
|
|
8
8
|
* @param client Client object, containing, models, schemas and services
|
|
@@ -22,22 +22,22 @@ async function writeClientCore(options) {
|
|
|
22
22
|
useSeparatedIndexes,
|
|
23
23
|
};
|
|
24
24
|
this.logger.info("The recording of the kernel files begins");
|
|
25
|
-
await
|
|
26
|
-
await
|
|
27
|
-
await
|
|
28
|
-
await
|
|
25
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'OpenAPI.ts'), templates.core.settings(context));
|
|
26
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'ApiError.ts'), templates.core.apiError({}));
|
|
27
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'ApiRequestOptions.ts'), templates.core.apiRequestOptions({}));
|
|
28
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'ApiResult.ts'), templates.core.apiResult({}));
|
|
29
29
|
if (useCancelableRequest) {
|
|
30
|
-
await
|
|
30
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'CancelablePromise.ts'), templates.core.cancelablePromise({}));
|
|
31
31
|
}
|
|
32
|
-
await
|
|
33
|
-
await
|
|
32
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'HttpStatusCode.ts'), templates.core.httpStatusCode({}));
|
|
33
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'request.ts'), templates.core.request(context));
|
|
34
34
|
if (request) {
|
|
35
|
-
const requestFile = (0,
|
|
36
|
-
const requestFileExists = await
|
|
35
|
+
const requestFile = (0, pathHelpers_1.resolveHelper)(process.cwd(), request);
|
|
36
|
+
const requestFileExists = await fileSystemHelpers_1.fileSystemHelpers.exists(requestFile);
|
|
37
37
|
if (!requestFileExists) {
|
|
38
38
|
throw new Error(`Custom request file "${requestFile}" does not exists`);
|
|
39
39
|
}
|
|
40
|
-
await
|
|
40
|
+
await fileSystemHelpers_1.fileSystemHelpers.copyFile(requestFile, (0, pathHelpers_1.resolveHelper)(outputCorePath, 'request.ts'));
|
|
41
41
|
}
|
|
42
42
|
this.logger.info("The writing of the kernel files has been completed successfully");
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientCoreIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCoreIndex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeClientCoreIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCoreIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,UAAU,aAAa;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBAcnF"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writeClientCoreIndex = writeClientCoreIndex;
|
|
4
|
-
const
|
|
4
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
5
5
|
const appendUniqueLinesToFile_1 = require("./appendUniqueLinesToFile");
|
|
6
6
|
async function writeClientCoreIndex(options) {
|
|
7
7
|
const { templates, outputCorePath, useCancelableRequest, useSeparatedIndexes } = options;
|
|
8
8
|
if (!useSeparatedIndexes) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
const filePath = (0,
|
|
11
|
+
const filePath = (0, pathHelpers_1.resolveHelper)(outputCorePath, 'index.ts');
|
|
12
12
|
this.logger.info(`Data has been written to a file: ${filePath}`);
|
|
13
13
|
const content = templates.indexes.core({ useCancelableRequest });
|
|
14
14
|
await (0, appendUniqueLinesToFile_1.appendUniqueLinesToFile)(filePath, content);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientFullIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientFullIndex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeClientFullIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientFullIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBrG"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writeClientFullIndex = writeClientFullIndex;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
5
|
+
const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
|
|
6
6
|
/**
|
|
7
7
|
* Generate the OpenAPI client index file using the Handlebar template and write it to disk.
|
|
8
8
|
* The index file just contains all the exports you need to use the client as a standalone
|
|
@@ -10,9 +10,9 @@ const fileSystem_1 = require("./fileSystem");
|
|
|
10
10
|
*/
|
|
11
11
|
async function writeClientFullIndex(options) {
|
|
12
12
|
const { templates, outputPath, core, models, schemas, services } = options;
|
|
13
|
-
const resolvePathIndex = (0,
|
|
13
|
+
const resolvePathIndex = (0, pathHelpers_1.resolveHelper)(outputPath, 'index.ts');
|
|
14
14
|
this.logger.info(`Data has been written to a file: ${resolvePathIndex}`);
|
|
15
|
-
await
|
|
15
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile(resolvePathIndex, templates.indexes.full({
|
|
16
16
|
core,
|
|
17
17
|
models,
|
|
18
18
|
schemas,
|
|
@@ -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,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;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;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCrG"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writeClientModels = writeClientModels;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
|
|
6
|
+
const format_1 = require("../../common/utils/format");
|
|
7
|
+
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
8
8
|
/**
|
|
9
9
|
* Generate Models using the Handlebar template and write to disk.
|
|
10
10
|
* @param models Array of Models to write
|
|
@@ -21,13 +21,13 @@ async function writeClientModels(options) {
|
|
|
21
21
|
if (!modelFolderPath) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
const dir = (0, pathHelpers_1.
|
|
24
|
+
const dir = (0, pathHelpers_1.dirNameHelper)(modelFolderPath);
|
|
25
25
|
if (dir) {
|
|
26
|
-
const directory = (0, pathHelpers_1.
|
|
26
|
+
const directory = (0, pathHelpers_1.resolveHelper)(outputModelsPath, dir);
|
|
27
27
|
this.logger.info(`A directory is being created: ${directory}`);
|
|
28
28
|
(0, fs_1.mkdirSync)(directory, { recursive: true });
|
|
29
29
|
}
|
|
30
|
-
const file = (0, pathHelpers_1.
|
|
30
|
+
const file = (0, pathHelpers_1.resolveHelper)(outputModelsPath, `${modelFolderPath}.ts`);
|
|
31
31
|
this.logger.info(`The recording of the file data begins: ${file}`);
|
|
32
32
|
const templateResult = templates.exports.model({
|
|
33
33
|
...model,
|
|
@@ -35,7 +35,7 @@ async function writeClientModels(options) {
|
|
|
35
35
|
useUnionTypes,
|
|
36
36
|
});
|
|
37
37
|
const formattedValue = await (0, format_1.format)(templateResult);
|
|
38
|
-
await
|
|
38
|
+
await fileSystemHelpers_1.fileSystemHelpers.writeFile(file, formattedValue);
|
|
39
39
|
this.logger.info(`File recording completed: ${file}`);
|
|
40
40
|
}
|
|
41
41
|
this.logger.info('Model file recording completed successfully');
|