ts-openapi-codegen 1.0.0-beta.5 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -58
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts +5 -0
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts.map +1 -0
- package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.js +40 -0
- package/dist/cli/generate/runGenerateOpenApi.js +4 -4
- package/dist/cli/index.js +57 -18
- package/dist/cli/utils.d.ts +4 -16
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js +22 -20
- package/dist/common/Options.d.ts +4 -6
- package/dist/common/Options.d.ts.map +1 -1
- package/dist/common/UpdateNotifier.d.ts +24 -0
- package/dist/common/UpdateNotifier.d.ts.map +1 -0
- package/dist/common/UpdateNotifier.js +120 -0
- package/dist/common/Utils.d.ts.map +1 -1
- package/dist/common/Utils.js +8 -9
- package/dist/common/VersionedSchema/CommonSchemas.d.ts +12 -0
- package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.js +27 -1
- package/dist/common/VersionedSchema/{MultiOptionsMigrationPlan.d.ts → MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts} +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsMigrationPlan.js → MultiOptionsVersioned/MultiOptionsMigrationPlan.js} +18 -7
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts +6 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsSchemaV1.js → MultiOptionsVersioned/MultiOptionsSchemaV1.js} +4 -4
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts +6 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsSchemaV2.js → MultiOptionsVersioned/MultiOptionsSchemaV2.js} +4 -4
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +5 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsSchemaV3.js → MultiOptionsVersioned/MultiOptionsSchemaV3.js} +3 -3
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +6 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsSchemaV4.js → MultiOptionsVersioned/MultiOptionsSchemaV4.js} +4 -4
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +6 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.js +22 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts +3 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{MultiOptionsVersionedSchemas.js → MultiOptionsVersioned/MultiOptionsVersionedSchemas.js} +10 -5
- package/dist/common/VersionedSchema/{OptionsMigrationPlans.d.ts → OptionsVersioned/OptionsMigrationPlans.d.ts} +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.js +23 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +6 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{OptionsSchemaV1.js → OptionsVersioned/OptionsSchemaV1.js} +4 -4
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +6 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{OptionsSchemaV2.js → OptionsVersioned/OptionsSchemaV2.js} +4 -4
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +5 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{OptionsSchemaV3.js → OptionsVersioned/OptionsSchemaV3.js} +3 -3
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +6 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.js +17 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts +3 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts.map +1 -0
- package/dist/common/VersionedSchema/{OptionsVersionedSchemas.js → OptionsVersioned/OptionsVersionedSchemas.js} +9 -4
- package/dist/common/VersionedSchema/Types.d.ts +0 -4
- package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
- package/dist/common/__tests__/convertArrayToObject.test.js +62 -59
- package/dist/common/__tests__/mergeObjectSchemas.test.js +1 -1
- package/dist/common/__tests__/migrationForMultiOptions.test.js +9 -5
- package/dist/common/__tests__/migrationForOptions.test.js +17 -8
- package/dist/common/defaultOptions.d.ts.map +1 -1
- package/dist/common/defaultOptions.js +5 -7
- package/dist/core/Context.d.ts +15 -7
- package/dist/core/Context.d.ts.map +1 -1
- package/dist/core/Context.js +3 -0
- package/dist/core/WriteClient.d.ts +94 -0
- package/dist/core/WriteClient.d.ts.map +1 -0
- package/dist/core/WriteClient.js +293 -0
- package/dist/core/__tests__/WriteClient.test.d.ts +2 -0
- package/dist/core/__tests__/WriteClient.test.d.ts.map +1 -0
- package/dist/core/{utils/__tests__/writeClient.test.js → __tests__/WriteClient.test.js} +16 -12
- package/dist/core/api/v2/parser/__tests__/getType.test.js +7 -25
- package/dist/core/api/v2/parser/getModel.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModel.js +5 -2
- package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModelProperties.js +3 -1
- package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModels.js +3 -29
- package/dist/core/api/v2/parser/getOperation.d.ts +1 -1
- package/dist/core/api/v2/parser/getOperation.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperation.js +3 -3
- package/dist/core/api/v2/parser/getOperationParameter.d.ts +1 -1
- package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationParameter.js +4 -2
- package/dist/core/api/v2/parser/getOperationParameters.d.ts +1 -1
- package/dist/core/api/v2/parser/getOperationParameters.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationParameters.js +2 -2
- package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationResponse.js +3 -1
- package/dist/core/api/v2/parser/getOperationResponses.d.ts +1 -1
- package/dist/core/api/v2/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationResponses.js +2 -2
- package/dist/core/api/v2/parser/getServiceName.d.ts +3 -0
- package/dist/core/api/v2/parser/getServiceName.d.ts.map +1 -0
- package/dist/core/api/v2/parser/getServiceName.js +8 -0
- package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getServices.js +21 -32
- package/dist/core/api/v2/parser/getType.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getType.js +13 -9
- package/dist/core/api/v3/parser/__tests__/getType.test.js +6 -24
- package/dist/core/api/v3/parser/getModel.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModel.js +5 -2
- package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModelProperties.js +3 -1
- package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModels.js +3 -29
- package/dist/core/api/v3/parser/getOperation.d.ts +1 -1
- package/dist/core/api/v3/parser/getOperation.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperation.js +4 -4
- package/dist/core/api/v3/parser/getOperationParameter.d.ts +1 -1
- package/dist/core/api/v3/parser/getOperationParameter.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationParameter.js +6 -3
- package/dist/core/api/v3/parser/getOperationParameters.d.ts +1 -1
- package/dist/core/api/v3/parser/getOperationParameters.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationParameters.js +2 -2
- package/dist/core/api/v3/parser/getOperationRequestBody.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationRequestBody.js +3 -1
- package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponse.js +3 -1
- package/dist/core/api/v3/parser/getOperationResponses.d.ts +1 -1
- package/dist/core/api/v3/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponses.js +2 -2
- package/dist/core/api/v3/parser/getServiceName.d.ts +3 -0
- package/dist/core/api/v3/parser/getServiceName.d.ts.map +1 -0
- package/dist/core/api/v3/parser/getServiceName.js +8 -0
- package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getServices.js +18 -84
- package/dist/core/api/v3/parser/getType.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getType.js +22 -10
- package/dist/core/api/v3/types/OpenApiPath.model.d.ts +2 -1
- package/dist/core/api/v3/types/OpenApiPath.model.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +21 -22
- package/dist/core/types/base/ClientArtifacts.model.d.ts +12 -0
- package/dist/core/types/base/ClientArtifacts.model.d.ts.map +1 -0
- package/dist/core/types/base/ExportedModel.model.d.ts +17 -0
- package/dist/core/types/base/ExportedModel.model.d.ts.map +1 -0
- package/dist/core/types/base/ExportedService.model.d.ts +9 -0
- package/dist/core/types/base/ExportedService.model.d.ts.map +1 -0
- package/dist/core/types/base/ExportedService.model.js +2 -0
- package/dist/core/types/base/OutputPaths.model.d.ts +15 -0
- package/dist/core/types/base/OutputPaths.model.d.ts.map +1 -0
- package/dist/core/types/base/OutputPaths.model.js +2 -0
- package/dist/core/types/base/PrefixArtifacts.model.d.ts +6 -0
- package/dist/core/types/base/PrefixArtifacts.model.d.ts.map +1 -0
- package/dist/core/types/base/PrefixArtifacts.model.js +2 -0
- package/dist/core/types/base/PropertyGroup.model.d.ts +4 -0
- package/dist/core/types/base/PropertyGroup.model.d.ts.map +1 -0
- package/dist/core/types/base/PropertyGroup.model.js +2 -0
- package/dist/core/types/base/RefWithtype.model.d.ts +11 -0
- package/dist/core/types/base/RefWithtype.model.d.ts.map +1 -0
- package/dist/core/types/base/RefWithtype.model.js +2 -0
- package/dist/core/types/base/Root.model.d.ts +5 -0
- package/dist/core/types/base/Root.model.d.ts.map +1 -0
- package/dist/core/types/base/Root.model.js +2 -0
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts +10 -0
- package/dist/core/types/base/SimpleClientArtifacts.model.d.ts.map +1 -0
- package/dist/core/types/base/SimpleClientArtifacts.model.js +2 -0
- package/dist/core/types/enums/HttpClient.enum.d.ts +7 -0
- package/dist/core/types/enums/HttpClient.enum.d.ts.map +1 -0
- package/dist/core/types/{Enums.js → enums/HttpClient.enum.js} +1 -9
- package/dist/core/types/enums/TypeRef.enum.d.ts +8 -0
- package/dist/core/types/enums/TypeRef.enum.d.ts.map +1 -0
- package/dist/core/types/enums/TypeRef.enum.js +11 -0
- package/dist/core/utils/__tests__/getAbsolutePath.test.js +1 -1
- package/dist/core/utils/__tests__/getGatheringRefs.test.js +3 -6
- package/dist/core/utils/__tests__/getRefFromSchema.test.js +1 -1
- package/dist/core/utils/__tests__/pathHelpers.test.js +4 -4
- package/dist/core/utils/__tests__/refResolver.test.d.ts +2 -0
- package/dist/core/utils/__tests__/refResolver.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/refResolver.test.js +55 -0
- package/dist/core/utils/__tests__/registerHandlebarHelpers.test.js +2 -2
- package/dist/core/utils/__tests__/registerHandlebarTemplates.test.js +7 -3
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.d.ts +2 -0
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/resolveRefToImportPath.test.js +67 -0
- package/dist/core/utils/__tests__/sortByRequiredExtended.test.js +24 -24
- package/dist/core/utils/__tests__/sortByRequiredSimple.test.js +13 -13
- package/dist/core/utils/__tests__/writeClientCore.test.js +14 -6
- package/dist/core/utils/__tests__/writeClientFullIndex.test.d.ts +2 -0
- package/dist/core/utils/__tests__/writeClientFullIndex.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/{writeClientIndex.test.js → writeClientFullIndex.test.js} +15 -7
- package/dist/core/utils/__tests__/writeClientModels.test.js +15 -7
- package/dist/core/utils/__tests__/writeClientSchemas.test.js +15 -7
- package/dist/core/utils/__tests__/writeClientServices.test.js +15 -7
- package/dist/core/utils/advancedDeduplicatePath.d.ts +5 -0
- package/dist/core/utils/advancedDeduplicatePath.d.ts.map +1 -0
- package/dist/core/utils/advancedDeduplicatePath.js +29 -0
- package/dist/core/utils/appendUniqueLinesToFile.d.ts +2 -0
- package/dist/core/utils/appendUniqueLinesToFile.d.ts.map +1 -0
- package/dist/core/utils/appendUniqueLinesToFile.js +24 -0
- package/dist/core/utils/createNormalizedRef.d.ts +7 -0
- package/dist/core/utils/createNormalizedRef.d.ts.map +1 -0
- package/dist/core/utils/createNormalizedRef.js +24 -0
- package/dist/core/utils/findCommonParent.d.ts +7 -0
- package/dist/core/utils/findCommonParent.d.ts.map +1 -0
- package/dist/core/utils/findCommonParent.js +20 -0
- package/dist/core/utils/getAbsolutePath.d.ts.map +1 -1
- package/dist/core/utils/getAbsolutePath.js +16 -5
- package/dist/core/utils/getGatheringRefs.d.ts +2 -2
- package/dist/core/utils/getGatheringRefs.d.ts.map +1 -1
- package/dist/core/utils/getGatheringRefs.js +26 -17
- package/dist/core/utils/getMappedType.d.ts +0 -1
- package/dist/core/utils/getMappedType.d.ts.map +1 -1
- package/dist/core/utils/getMappedType.js +3 -4
- package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
- package/dist/core/utils/getOpenApiSpec.js +9 -32
- package/dist/core/utils/getOutputPaths.d.ts +2 -2
- package/dist/core/utils/getOutputPaths.d.ts.map +1 -1
- package/dist/core/utils/getPropertyGroupExtended.d.ts +2 -2
- package/dist/core/utils/getPropertyGroupExtended.d.ts.map +1 -1
- package/dist/core/utils/getPropertyGroupSimple.d.ts +2 -2
- package/dist/core/utils/getPropertyGroupSimple.d.ts.map +1 -1
- package/dist/core/utils/getRefFromSchema.js +2 -2
- package/dist/core/utils/getRelativeModelImportPath.js +1 -1
- package/dist/core/utils/getRelativeModelPath.d.ts.map +1 -1
- package/dist/core/utils/getRelativeModelPath.js +5 -0
- package/dist/core/utils/isDirectory.d.ts +2 -0
- package/dist/core/utils/isDirectory.d.ts.map +1 -0
- package/dist/core/utils/isDirectory.js +13 -0
- package/dist/core/utils/isFileName.d.ts +7 -0
- package/dist/core/utils/isFileName.d.ts.map +1 -0
- package/dist/core/utils/isFileName.js +30 -0
- package/dist/core/utils/mapPathToTargetDirSafe.d.ts +10 -0
- package/dist/core/utils/mapPathToTargetDirSafe.d.ts.map +1 -0
- package/dist/core/utils/mapPathToTargetDirSafe.js +49 -0
- package/dist/core/utils/modelHelpers.d.ts +28 -0
- package/dist/core/utils/modelHelpers.d.ts.map +1 -0
- package/dist/core/utils/modelHelpers.js +73 -0
- package/dist/core/utils/normalizeAllRefs.d.ts +6 -0
- package/dist/core/utils/normalizeAllRefs.d.ts.map +1 -0
- package/dist/core/utils/normalizeAllRefs.js +35 -0
- package/dist/core/utils/normalizePath.d.ts +5 -0
- package/dist/core/utils/normalizePath.d.ts.map +1 -0
- package/dist/core/utils/normalizePath.js +19 -0
- package/dist/core/utils/normalizeRef.d.ts +5 -0
- package/dist/core/utils/normalizeRef.d.ts.map +1 -0
- package/dist/core/utils/normalizeRef.js +17 -0
- package/dist/core/utils/parseRef.d.ts +18 -0
- package/dist/core/utils/parseRef.d.ts.map +1 -0
- package/dist/core/utils/parseRef.js +64 -0
- package/dist/core/utils/pathHelpers.d.ts +1 -0
- package/dist/core/utils/pathHelpers.d.ts.map +1 -1
- package/dist/core/utils/pathHelpers.js +23 -3
- package/dist/core/utils/prepareAlias.d.ts +3 -0
- package/dist/core/utils/prepareAlias.d.ts.map +1 -0
- package/dist/core/utils/prepareAlias.js +20 -0
- package/dist/core/utils/prepareOptions.d.ts.map +1 -1
- package/dist/core/utils/prepareOptions.js +5 -7
- package/dist/core/utils/registerHandlebarHelpers.d.ts +1 -1
- package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.d.ts +9 -2
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.js +16 -2
- package/dist/core/utils/resolveRefPath.d.ts +7 -0
- package/dist/core/utils/resolveRefPath.d.ts.map +1 -0
- package/dist/core/utils/resolveRefPath.js +34 -0
- package/dist/core/utils/resolveRefToImportPath.d.ts +7 -0
- package/dist/core/utils/resolveRefToImportPath.d.ts.map +1 -0
- package/dist/core/utils/resolveRefToImportPath.js +45 -0
- package/dist/core/utils/serviceHelpers.d.ts +41 -0
- package/dist/core/utils/serviceHelpers.d.ts.map +1 -0
- package/dist/core/utils/serviceHelpers.js +115 -0
- package/dist/core/utils/sortModelByName.d.ts +3 -0
- package/dist/core/utils/sortModelByName.d.ts.map +1 -0
- package/dist/core/utils/sortModelByName.js +12 -0
- package/dist/core/utils/writeClientCore.d.ts +4 -2
- package/dist/core/utils/writeClientCore.d.ts.map +1 -1
- package/dist/core/utils/writeClientCore.js +4 -1
- package/dist/core/utils/writeClientCoreIndex.d.ts +11 -0
- package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientCoreIndex.js +16 -0
- package/dist/core/utils/writeClientFullIndex.d.ts +9 -0
- package/dist/core/utils/writeClientFullIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientFullIndex.js +22 -0
- package/dist/core/utils/writeClientModels.d.ts +3 -2
- package/dist/core/utils/writeClientModels.d.ts.map +1 -1
- package/dist/core/utils/writeClientModels.js +5 -0
- package/dist/core/utils/writeClientModelsIndex.d.ts +12 -0
- package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientModelsIndex.js +16 -0
- package/dist/core/utils/writeClientSchemas.d.ts +3 -2
- package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.js +5 -0
- package/dist/core/utils/writeClientSchemasIndex.d.ts +12 -0
- package/dist/core/utils/writeClientSchemasIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientSchemasIndex.js +16 -0
- package/dist/core/utils/writeClientServices.d.ts +5 -4
- package/dist/core/utils/writeClientServices.d.ts.map +1 -1
- package/dist/core/utils/writeClientServices.js +4 -0
- package/dist/core/utils/writeClientServicesIndex.d.ts +12 -0
- package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientServicesIndex.js +16 -0
- package/dist/core/utils/writeClientSimpleIndex.d.ts +9 -0
- package/dist/core/utils/writeClientSimpleIndex.d.ts.map +1 -0
- package/dist/core/utils/writeClientSimpleIndex.js +22 -0
- package/dist/templatesCompiled/exportModel.js +2 -2
- package/dist/templatesCompiled/indexCore.d.ts +9 -0
- package/dist/templatesCompiled/indexCore.d.ts.map +1 -0
- package/dist/templatesCompiled/indexCore.js +22 -0
- package/dist/templatesCompiled/{index.d.ts → indexFull.d.ts} +1 -1
- package/dist/templatesCompiled/indexFull.d.ts.map +1 -0
- package/dist/templatesCompiled/indexModels.d.ts +15 -0
- package/dist/templatesCompiled/indexModels.d.ts.map +1 -0
- package/dist/templatesCompiled/indexModels.js +82 -0
- package/dist/templatesCompiled/indexServices.d.ts +10 -0
- package/dist/templatesCompiled/indexServices.d.ts.map +1 -0
- package/dist/templatesCompiled/indexServices.js +35 -0
- package/dist/templatesCompiled/indexShemas.d.ts +11 -0
- package/dist/templatesCompiled/indexShemas.d.ts.map +1 -0
- package/dist/templatesCompiled/indexShemas.js +47 -0
- package/dist/templatesCompiled/indexSimple.d.ts +21 -0
- package/dist/templatesCompiled/indexSimple.d.ts.map +1 -0
- package/dist/templatesCompiled/indexSimple.js +121 -0
- package/dist/templatesCompiled/partials/isReadOnly.d.ts +1 -1
- package/dist/templatesCompiled/partials/isReadOnly.d.ts.map +1 -1
- package/dist/templatesCompiled/partials/isReadOnly.js +1 -2
- package/dist/templatesCompiled/partials/isRequiredDefinition.d.ts +9 -0
- package/dist/templatesCompiled/partials/isRequiredDefinition.d.ts.map +1 -0
- package/dist/templatesCompiled/partials/isRequiredDefinition.js +27 -0
- package/dist/templatesCompiled/partials/parametersDefinition.js +1 -1
- package/package.json +15 -4
- package/dist/common/VersionedSchema/MultiOptionsMigrationPlan.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsSchemaV1.d.ts +0 -6
- package/dist/common/VersionedSchema/MultiOptionsSchemaV1.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsSchemaV2.d.ts +0 -6
- package/dist/common/VersionedSchema/MultiOptionsSchemaV2.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsSchemaV3.d.ts +0 -5
- package/dist/common/VersionedSchema/MultiOptionsSchemaV3.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsSchemaV4.d.ts +0 -6
- package/dist/common/VersionedSchema/MultiOptionsSchemaV4.d.ts.map +0 -1
- package/dist/common/VersionedSchema/MultiOptionsVersionedSchemas.d.ts +0 -3
- package/dist/common/VersionedSchema/MultiOptionsVersionedSchemas.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsMigrationPlans.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsMigrationPlans.js +0 -15
- package/dist/common/VersionedSchema/OptionsSchemaV1.d.ts +0 -6
- package/dist/common/VersionedSchema/OptionsSchemaV1.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsSchemaV2.d.ts +0 -6
- package/dist/common/VersionedSchema/OptionsSchemaV2.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsSchemaV3.d.ts +0 -5
- package/dist/common/VersionedSchema/OptionsSchemaV3.d.ts.map +0 -1
- package/dist/common/VersionedSchema/OptionsVersionedSchemas.d.ts +0 -3
- package/dist/common/VersionedSchema/OptionsVersionedSchemas.d.ts.map +0 -1
- package/dist/core/types/Enums.d.ts +0 -14
- package/dist/core/types/Enums.d.ts.map +0 -1
- package/dist/core/types/Models.d.ts +0 -37
- package/dist/core/types/Models.d.ts.map +0 -1
- package/dist/core/types/shared/ConverterData.model.d.ts +0 -7
- package/dist/core/types/shared/ConverterData.model.d.ts.map +0 -1
- package/dist/core/utils/__tests__/writeClient.test.d.ts +0 -2
- package/dist/core/utils/__tests__/writeClient.test.d.ts.map +0 -1
- package/dist/core/utils/__tests__/writeClientIndex.test.d.ts +0 -2
- package/dist/core/utils/__tests__/writeClientIndex.test.d.ts.map +0 -1
- package/dist/core/utils/writeClient.d.ts +0 -89
- package/dist/core/utils/writeClient.d.ts.map +0 -1
- package/dist/core/utils/writeClient.js +0 -227
- package/dist/core/utils/writeClientIndex.d.ts +0 -59
- package/dist/core/utils/writeClientIndex.d.ts.map +0 -1
- package/dist/core/utils/writeClientIndex.js +0 -27
- package/dist/templatesCompiled/index.d.ts.map +0 -1
- /package/dist/core/types/{Models.js → base/ClientArtifacts.model.js} +0 -0
- /package/dist/core/types/{shared/ConverterData.model.js → base/ExportedModel.model.js} +0 -0
- /package/dist/templatesCompiled/{index.js → indexFull.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-openapi-codegen",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
4
4
|
"description": "Library that generates Typescript clients based on the OpenAPI specification. It bases on openapi-typescript-codegen",
|
|
5
5
|
"author": "Alexey Zverev",
|
|
6
6
|
"homepage": "https://github.com/ozonophore/openapi-codegen.git",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
],
|
|
45
45
|
"scripts": {
|
|
46
46
|
"clean": "rimraf ./dist ./generated ./test/generated ./test/e2e/generated ./samples/generated ./coverage ./node_modules/.cache",
|
|
47
|
-
"build": "tsc -p .",
|
|
47
|
+
"build": "tsc -p . && npm run test:unit",
|
|
48
48
|
"build:hbs": "tsx ./src/core/utils/precompileTemplates.ts",
|
|
49
49
|
"release": "npm run build:hbs && npm run build",
|
|
50
50
|
"run": "node ./test/index.js",
|
|
@@ -56,19 +56,25 @@
|
|
|
56
56
|
"prettier": "prettier \"./src/**/*.ts\" \"./types/index.d.ts\" --check",
|
|
57
57
|
"prettier:fix": "prettier \"./src/**/*.ts\" \"./types/index.d.ts\" --write",
|
|
58
58
|
"prepublish": "npm run clean && npm run release",
|
|
59
|
-
"codecov": "codecov --token=89a9fe76-2714-4b5b-83e3-9d809615064d"
|
|
59
|
+
"codecov": "codecov --token=89a9fe76-2714-4b5b-83e3-9d809615064d",
|
|
60
|
+
"find-deadcode": "ts-prune -e"
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
63
|
+
"@apidevtools/swagger-parser": "12.0.0",
|
|
64
|
+
"boxen": "^5.1.2",
|
|
62
65
|
"camelcase": "6.2.0",
|
|
66
|
+
"chalk": "^4.1.2",
|
|
63
67
|
"commander": "8.0.0",
|
|
68
|
+
"configstore": "^5.0.1",
|
|
64
69
|
"fast-deep-equal": "^3.1.3",
|
|
70
|
+
"figlet": "^1.8.0",
|
|
65
71
|
"handlebars": "4.7.6",
|
|
66
72
|
"joi": "^17.13.3",
|
|
67
73
|
"json-schema": "0.4.0",
|
|
68
|
-
"json-schema-ref-parser": "9.0.7",
|
|
69
74
|
"leven": "^4.0.0",
|
|
70
75
|
"mkdirp": "1.0.4",
|
|
71
76
|
"rimraf": "3.0.2",
|
|
77
|
+
"semver": "^7.7.1",
|
|
72
78
|
"winston": "^3.17.0",
|
|
73
79
|
"winston-daily-rotate-file": "^5.0.0"
|
|
74
80
|
},
|
|
@@ -81,13 +87,17 @@
|
|
|
81
87
|
"@eslint/eslintrc": "^3.3.1",
|
|
82
88
|
"@eslint/js": "^9.29.0",
|
|
83
89
|
"@types/axios": "^0.14.0",
|
|
90
|
+
"@types/configstore": "^6.0.2",
|
|
84
91
|
"@types/express": "4.17.13",
|
|
92
|
+
"@types/figlet": "^1.5.8",
|
|
93
|
+
"@types/glob": "^8.1.0",
|
|
85
94
|
"@types/json-schema": "^7.0.15",
|
|
86
95
|
"@types/lodash-es": "^4.17.12",
|
|
87
96
|
"@types/node": "22.5.1",
|
|
88
97
|
"@types/node-fetch": "2.5.12",
|
|
89
98
|
"@types/prettier": "3.0.0",
|
|
90
99
|
"@types/qs": "6.9.7",
|
|
100
|
+
"@types/semver": "^7.7.0",
|
|
91
101
|
"@types/winston": "^2.4.4",
|
|
92
102
|
"@typescript-eslint/eslint-plugin": "^8.34.1",
|
|
93
103
|
"@typescript-eslint/parser": "^8.34.1",
|
|
@@ -109,6 +119,7 @@
|
|
|
109
119
|
"prettier": "^3.4.2",
|
|
110
120
|
"puppeteer": "10.1.0",
|
|
111
121
|
"qs": "6.10.1",
|
|
122
|
+
"ts-prune": "^0.10.3",
|
|
112
123
|
"tsx": "^4.20.3",
|
|
113
124
|
"typescript": "5.8.3"
|
|
114
125
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MultiOptionsMigrationPlan.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/MultiOptionsMigrationPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAyBpG,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MultiOptionsSchemaV1.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/MultiOptionsSchemaV1.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAMtB;;GAEG;AACH,eAAO,MAAM,oBAAoB,uBAchC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MultiOptionsSchemaV2.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/MultiOptionsSchemaV2.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAMtB;;GAEG;AACH,eAAO,MAAM,oBAAoB,uBAchC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MultiOptionsSchemaV3.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/MultiOptionsSchemaV3.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,oBAAoB,iCAAyE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MultiOptionsSchemaV4.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/MultiOptionsSchemaV4.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAMtB;;GAEG;AACH,eAAO,MAAM,oBAAoB,uBAgBhC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MultiOptionsVersionedSchemas.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/MultiOptionsVersionedSchemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,2BAA2B,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAgB5E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsMigrationPlans.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/OptionsMigrationPlans.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAQ/F,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.optionsMigrationPlans = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Migration plan for option models.
|
|
6
|
-
*/
|
|
7
|
-
exports.optionsMigrationPlans = [{
|
|
8
|
-
fromVersion: '1.0.0',
|
|
9
|
-
toVersion: '1.0.1',
|
|
10
|
-
migrate: ({ client, ...otherProps }) => ({ ...otherProps, httpClient: client })
|
|
11
|
-
}, {
|
|
12
|
-
fromVersion: '1.0.1',
|
|
13
|
-
toVersion: '2.0.0',
|
|
14
|
-
migrate: (input) => ({ ...input, useCancelableRequest: false })
|
|
15
|
-
}];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsSchemaV1.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/OptionsSchemaV1.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAMtB;;GAEG;AACH,eAAO,MAAM,eAAe,uBAQ3B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsSchemaV2.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/OptionsSchemaV2.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAMtB;;GAEG;AACH,eAAO,MAAM,eAAe,uBAQ3B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsSchemaV3.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/OptionsSchemaV3.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,eAAe,iCAAoE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsVersionedSchemas.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/OptionsVersionedSchemas.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,uBAAuB,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAYxE,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The type of object passed via ref
|
|
3
|
-
*/
|
|
4
|
-
export declare enum TypeRef {
|
|
5
|
-
SCHEMA = 0,
|
|
6
|
-
OTHERS = 1
|
|
7
|
-
}
|
|
8
|
-
export declare enum HttpClient {
|
|
9
|
-
FETCH = "fetch",
|
|
10
|
-
XHR = "xhr",
|
|
11
|
-
NODE = "node",
|
|
12
|
-
AXIOS = "axios"
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=Enums.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Enums.d.ts","sourceRoot":"","sources":["../../../src/core/types/Enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,OAAO;IACf,MAAM,IAAA;IACN,MAAM,IAAA;CACT;AAED,oBAAY,UAAU;IAClB,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,KAAK,UAAU;CAClB"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { GROUP_PRIORITY_EXTENDED, GROUP_PRIORITY_SIMPLE } from './Consts';
|
|
2
|
-
import { TypeRef } from './Enums';
|
|
3
|
-
/**
|
|
4
|
-
* @param output The relative location of the output directory(or index)
|
|
5
|
-
* @param outputCore The relative location of the output directory for core
|
|
6
|
-
* @param outputServices The relative location of the output directory for services
|
|
7
|
-
* @param outputModels The relative location of the output directory for models
|
|
8
|
-
* @param outputSchemas The relative location of the output directory for schemas
|
|
9
|
-
*/
|
|
10
|
-
export interface IOutput {
|
|
11
|
-
output: string;
|
|
12
|
-
outputCore: string;
|
|
13
|
-
outputServices: string;
|
|
14
|
-
outputModels: string;
|
|
15
|
-
outputSchemas: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Ref With type
|
|
19
|
-
* @prop value Value
|
|
20
|
-
* @prop type The type of object passed via ref
|
|
21
|
-
*/
|
|
22
|
-
export interface IRefWithtype {
|
|
23
|
-
value: string;
|
|
24
|
-
type: TypeRef;
|
|
25
|
-
}
|
|
26
|
-
export interface $Root {
|
|
27
|
-
path: string;
|
|
28
|
-
fileName?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface Prefix {
|
|
31
|
-
interface: string;
|
|
32
|
-
enum: string;
|
|
33
|
-
type: string;
|
|
34
|
-
}
|
|
35
|
-
export type TPropertyGroupExtended = keyof typeof GROUP_PRIORITY_EXTENDED;
|
|
36
|
-
export type TPropertyGroupSimple = keyof typeof GROUP_PRIORITY_SIMPLE;
|
|
37
|
-
//# sourceMappingURL=Models.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Models.d.ts","sourceRoot":"","sources":["../../../src/core/types/Models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,MAAM;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,uBAAuB,CAAC;AAE1E,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,qBAAqB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConverterData.model.d.ts","sourceRoot":"","sources":["../../../../src/core/types/shared/ConverterData.model.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,CAAC;IACxG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,aAAa,EAAE,CAAC;CAC/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeClient.test.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__tests__/writeClient.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientIndex.test.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/__tests__/writeClientIndex.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Logger } from '../../common/Logger';
|
|
2
|
-
import { HttpClient } from '../types/Enums';
|
|
3
|
-
import { IOutput } from '../types/Models';
|
|
4
|
-
import type { Client } from '../types/shared/Client.model';
|
|
5
|
-
import { Templates } from './registerHandlebarTemplates';
|
|
6
|
-
/**
|
|
7
|
-
* @param client Client object with all the models, services, etc.
|
|
8
|
-
* @param templates Templates wrapper with all loaded Handlebars templates
|
|
9
|
-
* @param outputPaths The relative location of the output directory
|
|
10
|
-
* @param httpClient The selected httpClient (fetch, xhr or node)
|
|
11
|
-
* @param useOptions Use options or arguments functions
|
|
12
|
-
* @param useUnionTypes Use union types instead of enums
|
|
13
|
-
* @param exportCore: Generate core client classes
|
|
14
|
-
* @param exportServices: Generate services
|
|
15
|
-
* @param exportModels: Generate models
|
|
16
|
-
* @param exportSchemas: Generate schemas
|
|
17
|
-
* @param clean: Clean a directory before generation
|
|
18
|
-
* @param request: Path to custom request file
|
|
19
|
-
* @param useCancelableRequest Use cancelable request type.
|
|
20
|
-
*/
|
|
21
|
-
interface IWriteClient {
|
|
22
|
-
client: Client;
|
|
23
|
-
templates: Templates;
|
|
24
|
-
outputPaths: IOutput;
|
|
25
|
-
httpClient: HttpClient;
|
|
26
|
-
useOptions: boolean;
|
|
27
|
-
useUnionTypes: boolean;
|
|
28
|
-
exportCore: boolean;
|
|
29
|
-
exportServices: boolean;
|
|
30
|
-
exportModels: boolean;
|
|
31
|
-
exportSchemas: boolean;
|
|
32
|
-
clean: boolean;
|
|
33
|
-
request?: string;
|
|
34
|
-
useCancelableRequest?: boolean;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @param client Client object with all the models, services, etc.
|
|
38
|
-
* @param templates The loaded handlebar templates
|
|
39
|
-
* @param outputPaths Directory to write the generated files to
|
|
40
|
-
* @param useUnionTypes Use union types instead of enums
|
|
41
|
-
* @param exportCore: Generate core
|
|
42
|
-
* @param exportServices: Generate services
|
|
43
|
-
* @param exportModels: Generate models
|
|
44
|
-
* @param exportSchemas: Generate schemas
|
|
45
|
-
*/
|
|
46
|
-
export interface IWriteClientIndex {
|
|
47
|
-
client: Client;
|
|
48
|
-
templates: Templates;
|
|
49
|
-
outputPaths: IOutput;
|
|
50
|
-
useUnionTypes: boolean;
|
|
51
|
-
exportCore: boolean;
|
|
52
|
-
exportServices: boolean;
|
|
53
|
-
exportModels: boolean;
|
|
54
|
-
exportSchemas: boolean;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* The client which is writing all items and keep the parameters to write index file
|
|
58
|
-
*/
|
|
59
|
-
export declare class WriteClient {
|
|
60
|
-
private options;
|
|
61
|
-
private _logger;
|
|
62
|
-
constructor();
|
|
63
|
-
/**
|
|
64
|
-
* Write our OpenAPI client, using the given templates at the given output
|
|
65
|
-
* @param client Client object with all the models, services, etc.
|
|
66
|
-
* @param templates Templates wrapper with all loaded Handlebars templates
|
|
67
|
-
* @param outputPaths A set of parameters with paths for generating main sections (folders)
|
|
68
|
-
* @param httpClient The selected httpClient (fetch, xhr or node)
|
|
69
|
-
* @param useOptions Use options or arguments functions
|
|
70
|
-
* @param useUnionTypes Use union types instead of enums
|
|
71
|
-
* @param exportCore: Generate core client classes
|
|
72
|
-
* @param exportServices: Generate services
|
|
73
|
-
* @param exportModels: Generate models
|
|
74
|
-
* @param exportSchemas: Generate schemas
|
|
75
|
-
* @param clean: Clean a directory before generation
|
|
76
|
-
* @param request: Path to custom request file
|
|
77
|
-
* @param useCancelableRequest Use cancelable request type.
|
|
78
|
-
*/
|
|
79
|
-
writeClient(options: IWriteClient): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* Method keeps all options that is need to create index file
|
|
82
|
-
* @param options
|
|
83
|
-
*/
|
|
84
|
-
writeClientIndex(options: IWriteClientIndex): Promise<void>;
|
|
85
|
-
combineAndWrite(): Promise<void>;
|
|
86
|
-
get logger(): Logger;
|
|
87
|
-
}
|
|
88
|
-
export {};
|
|
89
|
-
//# sourceMappingURL=writeClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeClient.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAG3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAoCzD;;;;;;;;;;;;;;GAcG;AACH,UAAU,YAAY;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,OAAO,CAAS;;IAUxB;;;;;;;;;;;;;;;OAeG;IACG,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA+DvD;;;OAGG;IACG,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAU3D,eAAe;IAuFrB,IAAW,MAAM,WAEhB;CACJ"}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WriteClient = void 0;
|
|
4
|
-
const Enums_1 = require("../../common/Enums");
|
|
5
|
-
const Logger_1 = require("../../common/Logger");
|
|
6
|
-
const pathHelpers_1 = require("../utils/pathHelpers");
|
|
7
|
-
const fileSystem_1 = require("./fileSystem");
|
|
8
|
-
const unique_1 = require("./unique");
|
|
9
|
-
const writeClientCore_1 = require("./writeClientCore");
|
|
10
|
-
const writeClientIndex_1 = require("./writeClientIndex");
|
|
11
|
-
const writeClientModels_1 = require("./writeClientModels");
|
|
12
|
-
const writeClientSchemas_1 = require("./writeClientSchemas");
|
|
13
|
-
const writeClientServices_1 = require("./writeClientServices");
|
|
14
|
-
function sortModelByName(a, b) {
|
|
15
|
-
if (a.name > b.name) {
|
|
16
|
-
return 1;
|
|
17
|
-
}
|
|
18
|
-
if (a.name < b.name) {
|
|
19
|
-
return -1;
|
|
20
|
-
}
|
|
21
|
-
return 0;
|
|
22
|
-
}
|
|
23
|
-
function prepareAlias(models) {
|
|
24
|
-
let modelPrevious = undefined;
|
|
25
|
-
let index = 1;
|
|
26
|
-
for (const model of models) {
|
|
27
|
-
if (modelPrevious && model.name === modelPrevious.name) {
|
|
28
|
-
model.alias = `${model.name}$${index}`;
|
|
29
|
-
if (!modelPrevious.alias) {
|
|
30
|
-
modelPrevious.alias = `${modelPrevious.name}$${index - 1}`;
|
|
31
|
-
}
|
|
32
|
-
index++;
|
|
33
|
-
}
|
|
34
|
-
else if (modelPrevious && model.name !== modelPrevious.name) {
|
|
35
|
-
index = 1;
|
|
36
|
-
}
|
|
37
|
-
modelPrevious = model;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* The client which is writing all items and keep the parameters to write index file
|
|
42
|
-
*/
|
|
43
|
-
class WriteClient {
|
|
44
|
-
options = new Map();
|
|
45
|
-
_logger;
|
|
46
|
-
constructor() {
|
|
47
|
-
this._logger = new Logger_1.Logger({
|
|
48
|
-
level: Enums_1.ELogLevel.ERROR,
|
|
49
|
-
instanceId: 'client',
|
|
50
|
-
logOutput: Enums_1.ELogOutput.CONSOLE,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Write our OpenAPI client, using the given templates at the given output
|
|
55
|
-
* @param client Client object with all the models, services, etc.
|
|
56
|
-
* @param templates Templates wrapper with all loaded Handlebars templates
|
|
57
|
-
* @param outputPaths A set of parameters with paths for generating main sections (folders)
|
|
58
|
-
* @param httpClient The selected httpClient (fetch, xhr or node)
|
|
59
|
-
* @param useOptions Use options or arguments functions
|
|
60
|
-
* @param useUnionTypes Use union types instead of enums
|
|
61
|
-
* @param exportCore: Generate core client classes
|
|
62
|
-
* @param exportServices: Generate services
|
|
63
|
-
* @param exportModels: Generate models
|
|
64
|
-
* @param exportSchemas: Generate schemas
|
|
65
|
-
* @param clean: Clean a directory before generation
|
|
66
|
-
* @param request: Path to custom request file
|
|
67
|
-
* @param useCancelableRequest Use cancelable request type.
|
|
68
|
-
*/
|
|
69
|
-
async writeClient(options) {
|
|
70
|
-
const { client, templates, outputPaths, httpClient, useOptions, useUnionTypes, exportCore, exportServices, exportModels, exportSchemas, request, useCancelableRequest = false } = options;
|
|
71
|
-
if (exportCore) {
|
|
72
|
-
await fileSystem_1.fileSystem.mkdir(outputPaths.outputCore);
|
|
73
|
-
await (0, writeClientCore_1.writeClientCore)({ client, templates, outputCorePath: outputPaths.outputCore, httpClient, request, useCancelableRequest });
|
|
74
|
-
}
|
|
75
|
-
if (exportServices) {
|
|
76
|
-
const { outputCore, outputServices, outputModels } = outputPaths;
|
|
77
|
-
await fileSystem_1.fileSystem.mkdir(outputPaths.outputServices);
|
|
78
|
-
await (0, writeClientServices_1.writeClientServices)({
|
|
79
|
-
services: client.services,
|
|
80
|
-
templates,
|
|
81
|
-
outputPaths: {
|
|
82
|
-
outputServices,
|
|
83
|
-
outputCore: exportCore ? `${(0, pathHelpers_1.relative)(outputServices, outputCore)}` : '../core/',
|
|
84
|
-
outputModels: exportModels ? `${(0, pathHelpers_1.relative)(outputServices, outputModels)}` : '../models/',
|
|
85
|
-
},
|
|
86
|
-
httpClient,
|
|
87
|
-
useUnionTypes,
|
|
88
|
-
useOptions,
|
|
89
|
-
useCancelableRequest,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
if (exportSchemas) {
|
|
93
|
-
await fileSystem_1.fileSystem.mkdir(outputPaths.outputSchemas);
|
|
94
|
-
await (0, writeClientSchemas_1.writeClientSchemas)({
|
|
95
|
-
models: client.models,
|
|
96
|
-
templates,
|
|
97
|
-
outputSchemasPath: outputPaths.outputSchemas,
|
|
98
|
-
httpClient,
|
|
99
|
-
useUnionTypes,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
if (exportModels) {
|
|
103
|
-
await fileSystem_1.fileSystem.mkdir(outputPaths.outputModels);
|
|
104
|
-
await (0, writeClientModels_1.writeClientModels)({
|
|
105
|
-
models: client.models,
|
|
106
|
-
templates,
|
|
107
|
-
outputModelsPath: outputPaths.outputModels,
|
|
108
|
-
httpClient,
|
|
109
|
-
useUnionTypes,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
if (exportCore || exportServices || exportSchemas || exportModels) {
|
|
113
|
-
await fileSystem_1.fileSystem.mkdir(outputPaths.output);
|
|
114
|
-
await this.writeClientIndex({
|
|
115
|
-
client,
|
|
116
|
-
templates,
|
|
117
|
-
outputPaths,
|
|
118
|
-
useUnionTypes,
|
|
119
|
-
exportCore,
|
|
120
|
-
exportServices,
|
|
121
|
-
exportModels,
|
|
122
|
-
exportSchemas,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Method keeps all options that is need to create index file
|
|
128
|
-
* @param options
|
|
129
|
-
*/
|
|
130
|
-
async writeClientIndex(options) {
|
|
131
|
-
const { outputPaths } = options;
|
|
132
|
-
const values = this.options.get(outputPaths.output);
|
|
133
|
-
if (values) {
|
|
134
|
-
values.push(options);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
this.options.set(outputPaths.output, Array.of(options));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
async combineAndWrite() {
|
|
141
|
-
const result = new Map();
|
|
142
|
-
for (const [key, value] of this.options.entries()) {
|
|
143
|
-
for (const item of value) {
|
|
144
|
-
const { exportCore, outputPaths, exportModels, exportSchemas, exportServices, client, templates } = item;
|
|
145
|
-
const outputCore = outputPaths.outputCore ? outputPaths.outputCore : (0, pathHelpers_1.resolve)(key, 'core');
|
|
146
|
-
const outputModels = outputPaths.outputModels ? outputPaths.outputModels : (0, pathHelpers_1.resolve)(key, 'models');
|
|
147
|
-
const outputSchemas = outputPaths.outputSchemas ? outputPaths.outputSchemas : (0, pathHelpers_1.resolve)(key, 'schemas');
|
|
148
|
-
const outputServices = outputPaths.outputServices ? outputPaths.outputServices : (0, pathHelpers_1.resolve)(key, 'services');
|
|
149
|
-
let clientIndex = result.get(`${key}`);
|
|
150
|
-
if (!clientIndex) {
|
|
151
|
-
clientIndex = {
|
|
152
|
-
templates: templates,
|
|
153
|
-
outputPath: key,
|
|
154
|
-
core: [],
|
|
155
|
-
models: [],
|
|
156
|
-
schemas: [],
|
|
157
|
-
services: [],
|
|
158
|
-
};
|
|
159
|
-
result.set(`${key}`, clientIndex);
|
|
160
|
-
}
|
|
161
|
-
if (exportCore) {
|
|
162
|
-
const relativePath = `${(0, pathHelpers_1.relative)(key, outputCore)}`;
|
|
163
|
-
const clientCore = clientIndex.core.find(item => item === relativePath);
|
|
164
|
-
if (!clientCore) {
|
|
165
|
-
clientIndex.core.push(relativePath);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (exportModels || exportSchemas) {
|
|
169
|
-
const relativePathModel = `${(0, pathHelpers_1.relative)(key, outputModels)}`;
|
|
170
|
-
const relativePathSchema = `${(0, pathHelpers_1.relative)(key, outputSchemas)}`;
|
|
171
|
-
for (const model of client.models) {
|
|
172
|
-
const modelFinal = {
|
|
173
|
-
name: model.name,
|
|
174
|
-
alias: '',
|
|
175
|
-
path: model.path,
|
|
176
|
-
package: relativePathModel,
|
|
177
|
-
enum: model.enum && model.enum.length > 0,
|
|
178
|
-
useUnionTypes: item.useUnionTypes,
|
|
179
|
-
enums: model.enums && model.enums.length > 0,
|
|
180
|
-
};
|
|
181
|
-
if (exportModels) {
|
|
182
|
-
const value = clientIndex.models.find(item => item.name === modelFinal.name &&
|
|
183
|
-
item.path === modelFinal.path &&
|
|
184
|
-
item.package === modelFinal.package &&
|
|
185
|
-
item.enum === modelFinal.enum &&
|
|
186
|
-
item.enums === modelFinal.enums &&
|
|
187
|
-
item.useUnionTypes === modelFinal.useUnionTypes);
|
|
188
|
-
if (!value) {
|
|
189
|
-
clientIndex.models.push(modelFinal);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
if (exportSchemas) {
|
|
193
|
-
const schema = { ...modelFinal, package: relativePathSchema };
|
|
194
|
-
const indexValue = clientIndex.schemas.find(item => item.name === schema.name && item.path === schema.path && item.package === schema.package);
|
|
195
|
-
if (!indexValue) {
|
|
196
|
-
clientIndex.schemas.push(schema);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
if (exportServices) {
|
|
202
|
-
const relativeService = `${(0, pathHelpers_1.relative)(key, outputServices)}`;
|
|
203
|
-
for (const service of client.services) {
|
|
204
|
-
const valueIndex = clientIndex.services.find(item => item.name === service.name && item.package === relativeService);
|
|
205
|
-
if (!valueIndex) {
|
|
206
|
-
clientIndex.services.push({
|
|
207
|
-
name: service.name,
|
|
208
|
-
package: relativeService,
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
for (const value of result.values()) {
|
|
216
|
-
value.models = value.models.filter(unique_1.unique).sort(sortModelByName);
|
|
217
|
-
prepareAlias(value.models);
|
|
218
|
-
value.schemas = value.schemas.filter(unique_1.unique).sort(sortModelByName);
|
|
219
|
-
prepareAlias(value.schemas);
|
|
220
|
-
await (0, writeClientIndex_1.writeClientIndex)(value);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
get logger() {
|
|
224
|
-
return this._logger;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
exports.WriteClient = WriteClient;
|