ts-openapi-codegen 2.0.0 → 2.1.0-beta.2
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 +95 -2
- package/README.rus.md +95 -2
- package/dist/cli/analyzeDiff/__tests__/analyzeDiff.cli.test.d.ts +2 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiff.cli.test.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiff.cli.test.js +365 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffRenameAndInvalidRegex.test.d.ts +2 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffRenameAndInvalidRegex.test.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffRenameAndInvalidRegex.test.js +142 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffTypeCoercion.test.d.ts +2 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffTypeCoercion.test.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/__tests__/analyzeDiffTypeCoercion.test.js +137 -0
- package/dist/cli/analyzeDiff/analyzeDiff.d.ts +17 -0
- package/dist/cli/analyzeDiff/analyzeDiff.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/analyzeDiff.js +105 -0
- package/dist/cli/analyzeDiff/buildLegacyReport.d.ts +17 -0
- package/dist/cli/analyzeDiff/buildLegacyReport.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/buildLegacyReport.js +54 -0
- package/dist/cli/analyzeDiff/ciSummary.d.ts +6 -0
- package/dist/cli/analyzeDiff/ciSummary.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/ciSummary.js +20 -0
- package/dist/cli/analyzeDiff/diffEngine.d.ts +54 -0
- package/dist/cli/analyzeDiff/diffEngine.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/diffEngine.js +209 -0
- package/dist/cli/analyzeDiff/ignoreRules.d.ts +33 -0
- package/dist/cli/analyzeDiff/ignoreRules.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/ignoreRules.js +93 -0
- package/dist/cli/analyzeDiff/ignoreSemanticChanges.d.ts +10 -0
- package/dist/cli/analyzeDiff/ignoreSemanticChanges.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/ignoreSemanticChanges.js +84 -0
- package/dist/cli/analyzeDiff/logLegacyReport.d.ts +6 -0
- package/dist/cli/analyzeDiff/logLegacyReport.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/logLegacyReport.js +29 -0
- package/dist/cli/analyzeDiff/miracles.d.ts +89 -0
- package/dist/cli/analyzeDiff/miracles.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/miracles.js +325 -0
- package/dist/cli/analyzeDiff/pluginPaths.d.ts +5 -0
- package/dist/cli/analyzeDiff/pluginPaths.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/pluginPaths.js +13 -0
- package/dist/cli/analyzeDiff/report.d.ts +3 -0
- package/dist/cli/analyzeDiff/report.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/report.js +7 -0
- package/dist/cli/analyzeDiff/semanticDiffContext.d.ts +6 -0
- package/dist/cli/analyzeDiff/semanticDiffContext.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/semanticDiffContext.js +16 -0
- package/dist/cli/analyzeDiff/specParser.d.ts +22 -0
- package/dist/cli/analyzeDiff/specParser.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/specParser.js +80 -0
- package/dist/cli/analyzeDiff/types.d.ts +61 -0
- package/dist/cli/analyzeDiff/types.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/types.js +2 -0
- package/dist/cli/analyzeDiff/writeLegacyReport.d.ts +6 -0
- package/dist/cli/analyzeDiff/writeLegacyReport.d.ts.map +1 -0
- package/dist/cli/analyzeDiff/writeLegacyReport.js +21 -0
- package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/checkConfig.js +13 -8
- package/dist/cli/checkAndUpdateConfig/constants.d.ts +0 -9
- package/dist/cli/checkAndUpdateConfig/constants.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/constants.js +1 -10
- package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/updateConfig.js +11 -7
- package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.js +6 -3
- package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.js +3 -2
- package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.d.ts.map +1 -1
- package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.js +2 -2
- package/dist/cli/generateOpenApiClient/__tests__/generateOpenApiClient.strict.test.d.ts +2 -0
- package/dist/cli/generateOpenApiClient/__tests__/generateOpenApiClient.strict.test.d.ts.map +1 -0
- package/dist/cli/generateOpenApiClient/__tests__/generateOpenApiClient.strict.test.js +152 -0
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts +6 -2
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -1
- package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +54 -18
- package/dist/cli/index.js +57 -2
- package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/init.js +19 -6
- package/dist/cli/initOpenApiConfig/initConfig.d.ts +1 -0
- package/dist/cli/initOpenApiConfig/initConfig.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/initConfig.js +47 -24
- package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts +8 -1
- package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/initCustomRequest.js +40 -8
- package/dist/cli/initOpenApiConfig/utils/buildConfig.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/utils/buildConfig.js +60 -0
- package/dist/cli/initOpenApiConfig/utils/validateSpecFile.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/utils/validateSpecFile.js +2 -1
- package/dist/cli/initOpenApiConfig/utils/writeConfigFile.d.ts.map +1 -1
- package/dist/cli/initOpenApiConfig/utils/writeConfigFile.js +2 -1
- package/dist/cli/interactive/confirmDialog.d.ts.map +1 -1
- package/dist/cli/interactive/confirmDialog.js +3 -2
- package/dist/cli/interactive/constants.d.ts +2 -2
- package/dist/cli/interactive/constants.js +8 -8
- package/dist/cli/interactive/selectDialog.d.ts.map +1 -1
- package/dist/cli/interactive/selectDialog.js +11 -6
- package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
- package/dist/cli/previewChanges/previewChanges.js +45 -17
- package/dist/cli/schemas/analyzeDiff.d.ts +14 -0
- package/dist/cli/schemas/analyzeDiff.d.ts.map +1 -0
- package/dist/cli/schemas/analyzeDiff.js +28 -0
- package/dist/cli/schemas/generate.d.ts +9 -0
- package/dist/cli/schemas/generate.d.ts.map +1 -1
- package/dist/cli/schemas/generate.js +9 -0
- package/dist/cli/schemas/index.d.ts +3 -1
- package/dist/cli/schemas/index.d.ts.map +1 -1
- package/dist/cli/schemas/index.js +2 -0
- package/dist/common/Consts.d.ts +1 -0
- package/dist/common/Consts.d.ts.map +1 -1
- package/dist/common/Consts.js +15 -1
- package/dist/common/Logger.d.ts +20 -1
- package/dist/common/Logger.d.ts.map +1 -1
- package/dist/common/Logger.js +70 -9
- package/dist/common/LoggerMessages.d.ts +135 -33
- package/dist/common/LoggerMessages.d.ts.map +1 -1
- package/dist/common/LoggerMessages.js +118 -45
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +7 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts +4 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts +8 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +8 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts +8 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.d.ts +35 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.js +4 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts +79 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts.map +1 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.js +19 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +171 -0
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +2 -0
- package/dist/common/VersionedSchema/CommonSchemas.d.ts +40 -0
- package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
- package/dist/common/VersionedSchema/CommonSchemas.js +34 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts +4 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts +4 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +4 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +4 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -1
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +4 -0
- package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +4 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +4 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +4 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -1
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +4 -0
- package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +23 -3
- package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.js +2 -2
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
- package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +2 -1
- package/dist/common/__tests__/Logger.test.d.ts +2 -0
- package/dist/common/__tests__/Logger.test.d.ts.map +1 -0
- package/dist/common/__tests__/Logger.test.js +100 -0
- package/dist/common/utils/__tests__/convertArrayToObject.test.js +3 -0
- package/dist/common/utils/__tests__/eslintFix.test.d.ts +2 -0
- package/dist/common/utils/__tests__/eslintFix.test.d.ts.map +1 -0
- package/dist/common/utils/__tests__/eslintFix.test.js +134 -0
- package/dist/common/utils/__tests__/format.test.d.ts +2 -0
- package/dist/common/utils/__tests__/format.test.d.ts.map +1 -0
- package/dist/common/utils/__tests__/format.test.js +90 -0
- package/dist/common/utils/convertArrayToObject.d.ts.map +1 -1
- package/dist/common/utils/convertArrayToObject.js +3 -0
- package/dist/common/utils/eslintFix.d.ts +7 -0
- package/dist/common/utils/eslintFix.d.ts.map +1 -0
- package/dist/common/utils/eslintFix.js +78 -0
- package/dist/common/utils/format.d.ts +1 -1
- package/dist/common/utils/format.d.ts.map +1 -1
- package/dist/common/utils/format.js +39 -15
- package/dist/common/utils/jsonPath.d.ts +5 -0
- package/dist/common/utils/jsonPath.d.ts.map +1 -0
- package/dist/common/utils/jsonPath.js +27 -0
- package/dist/common/utils/normalizeObject.d.ts +2 -0
- package/dist/common/utils/normalizeObject.d.ts.map +1 -0
- package/dist/common/utils/normalizeObject.js +63 -0
- package/dist/core/Context.d.ts +8 -1
- package/dist/core/Context.d.ts.map +1 -1
- package/dist/core/Context.js +23 -4
- package/dist/core/OpenApiClient.d.ts +2 -0
- package/dist/core/OpenApiClient.d.ts.map +1 -1
- package/dist/core/OpenApiClient.js +116 -6
- package/dist/core/WriteClient.d.ts +4 -0
- package/dist/core/WriteClient.d.ts.map +1 -1
- package/dist/core/WriteClient.js +38 -4
- package/dist/core/__tests__/WriteClient.test.js +4 -1
- package/dist/core/api/v2/parser/__tests__/getModel.test.d.ts +2 -0
- package/dist/core/api/v2/parser/__tests__/getModel.test.d.ts.map +1 -0
- package/dist/core/api/v2/parser/__tests__/getModel.test.js +34 -0
- package/dist/core/api/v2/parser/getModel.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getModel.js +6 -1
- package/dist/core/api/v2/parser/getOperation.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperation.js +2 -0
- package/dist/core/api/v2/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v2/parser/getOperationResponses.js +9 -1
- package/dist/core/api/v2/types/OpenApiSchema.model.d.ts +2 -0
- package/dist/core/api/v2/types/OpenApiSchema.model.d.ts.map +1 -1
- package/dist/core/api/v3/parser/__tests__/getContent.test.d.ts +2 -0
- package/dist/core/api/v3/parser/__tests__/getContent.test.d.ts.map +1 -0
- package/dist/core/api/v3/parser/__tests__/getContent.test.js +65 -0
- package/dist/core/api/v3/parser/__tests__/getModel.test.d.ts +2 -0
- package/dist/core/api/v3/parser/__tests__/getModel.test.d.ts.map +1 -0
- package/dist/core/api/v3/parser/__tests__/getModel.test.js +34 -0
- package/dist/core/api/v3/parser/getContent.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getContent.js +21 -11
- package/dist/core/api/v3/parser/getModel.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getModel.js +6 -1
- package/dist/core/api/v3/parser/getOperation.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperation.js +2 -0
- package/dist/core/api/v3/parser/getOperationResponses.d.ts.map +1 -1
- package/dist/core/api/v3/parser/getOperationResponses.js +9 -1
- package/dist/core/api/v3/types/OpenApiSchema.model.d.ts +2 -0
- package/dist/core/api/v3/types/OpenApiSchema.model.d.ts.map +1 -1
- package/dist/core/governance/__tests__/evaluateGovernanceRules.test.d.ts +2 -0
- package/dist/core/governance/__tests__/evaluateGovernanceRules.test.d.ts.map +1 -0
- package/dist/core/governance/__tests__/evaluateGovernanceRules.test.js +100 -0
- package/dist/core/governance/__tests__/loadGovernanceConfig.test.d.ts +2 -0
- package/dist/core/governance/__tests__/loadGovernanceConfig.test.d.ts.map +1 -0
- package/dist/core/governance/__tests__/loadGovernanceConfig.test.js +71 -0
- package/dist/core/governance/evaluateGovernanceRules.d.ts +42 -0
- package/dist/core/governance/evaluateGovernanceRules.d.ts.map +1 -0
- package/dist/core/governance/evaluateGovernanceRules.js +134 -0
- package/dist/core/governance/governanceConfigSchema.d.ts +4 -0
- package/dist/core/governance/governanceConfigSchema.d.ts.map +1 -0
- package/dist/core/governance/governanceConfigSchema.js +39 -0
- package/dist/core/governance/loadGovernanceConfig.d.ts +7 -0
- package/dist/core/governance/loadGovernanceConfig.d.ts.map +1 -0
- package/dist/core/governance/loadGovernanceConfig.js +60 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -2
- package/dist/core/plugins/GeneratorPlugin.model.d.ts +42 -0
- package/dist/core/plugins/GeneratorPlugin.model.d.ts.map +1 -0
- package/dist/core/plugins/GeneratorPlugin.model.js +2 -0
- package/dist/core/plugins/__tests__/applySemanticDiffPluginHooks.test.d.ts +2 -0
- package/dist/core/plugins/__tests__/applySemanticDiffPluginHooks.test.d.ts.map +1 -0
- package/dist/core/plugins/__tests__/applySemanticDiffPluginHooks.test.js +115 -0
- package/dist/core/plugins/__tests__/loadGeneratorPlugins.test.d.ts +2 -0
- package/dist/core/plugins/__tests__/loadGeneratorPlugins.test.d.ts.map +1 -0
- package/dist/core/plugins/__tests__/loadGeneratorPlugins.test.js +62 -0
- package/dist/core/plugins/applySemanticDiffPluginHooks.d.ts +28 -0
- package/dist/core/plugins/applySemanticDiffPluginHooks.d.ts.map +1 -0
- package/dist/core/plugins/applySemanticDiffPluginHooks.js +160 -0
- package/dist/core/plugins/builtins/xTypescriptTypePlugin.d.ts +6 -0
- package/dist/core/plugins/builtins/xTypescriptTypePlugin.d.ts.map +1 -0
- package/dist/core/plugins/builtins/xTypescriptTypePlugin.js +13 -0
- package/dist/core/plugins/getBuiltinPlugins.d.ts +6 -0
- package/dist/core/plugins/getBuiltinPlugins.d.ts.map +1 -0
- package/dist/core/plugins/getBuiltinPlugins.js +10 -0
- package/dist/core/plugins/index.d.ts +4 -0
- package/dist/core/plugins/index.d.ts.map +1 -0
- package/dist/core/plugins/index.js +5 -0
- package/dist/core/plugins/loadGeneratorPlugins.d.ts +6 -0
- package/dist/core/plugins/loadGeneratorPlugins.d.ts.map +1 -0
- package/dist/core/plugins/loadGeneratorPlugins.js +94 -0
- package/dist/core/semanticDiff/__tests__/analyzeOpenApiDiff.test.d.ts +2 -0
- package/dist/core/semanticDiff/__tests__/analyzeOpenApiDiff.test.d.ts.map +1 -0
- package/dist/core/semanticDiff/__tests__/analyzeOpenApiDiff.test.js +537 -0
- package/dist/core/semanticDiff/__tests__/semanticDiffReportSchema.test.d.ts +2 -0
- package/dist/core/semanticDiff/__tests__/semanticDiffReportSchema.test.d.ts.map +1 -0
- package/dist/core/semanticDiff/__tests__/semanticDiffReportSchema.test.js +66 -0
- package/dist/core/semanticDiff/analyzeOpenApiDiff.d.ts +45 -0
- package/dist/core/semanticDiff/analyzeOpenApiDiff.d.ts.map +1 -0
- package/dist/core/semanticDiff/analyzeOpenApiDiff.js +640 -0
- package/dist/core/semanticDiff/semanticDiffReportSchema.d.ts +11 -0
- package/dist/core/semanticDiff/semanticDiffReportSchema.d.ts.map +1 -0
- package/dist/core/semanticDiff/semanticDiffReportSchema.js +132 -0
- package/dist/core/strict/__tests__/validateOpenApiStrict.test.d.ts +2 -0
- package/dist/core/strict/__tests__/validateOpenApiStrict.test.d.ts.map +1 -0
- package/dist/core/strict/__tests__/validateOpenApiStrict.test.js +156 -0
- package/dist/core/strict/validateOpenApiStrict.d.ts +43 -0
- package/dist/core/strict/validateOpenApiStrict.d.ts.map +1 -0
- package/dist/core/strict/validateOpenApiStrict.js +253 -0
- package/dist/core/types/base/ClientArtifacts.model.d.ts +2 -0
- package/dist/core/types/base/ClientArtifacts.model.d.ts.map +1 -1
- package/dist/core/types/base/Templates.model.d.ts +3 -0
- package/dist/core/types/base/Templates.model.d.ts.map +1 -1
- package/dist/core/types/enums/ModelsMode.enum.d.ts +5 -0
- package/dist/core/types/enums/ModelsMode.enum.d.ts.map +1 -0
- package/dist/core/types/enums/ModelsMode.enum.js +8 -0
- package/dist/core/types/shared/Client.model.d.ts +2 -0
- package/dist/core/types/shared/Client.model.d.ts.map +1 -1
- package/dist/core/types/shared/DiffInfo.model.d.ts +13 -0
- package/dist/core/types/shared/DiffInfo.model.d.ts.map +1 -0
- package/dist/core/types/shared/DiffInfo.model.js +2 -0
- package/dist/core/types/shared/Miracle.model.d.ts +13 -0
- package/dist/core/types/shared/Miracle.model.d.ts.map +1 -0
- package/dist/core/types/shared/Miracle.model.js +2 -0
- package/dist/core/types/shared/Model.model.d.ts +23 -0
- package/dist/core/types/shared/Model.model.d.ts.map +1 -1
- package/dist/core/types/shared/Operation.model.d.ts +5 -0
- package/dist/core/types/shared/Operation.model.d.ts.map +1 -1
- package/dist/core/utils/__mocks__/templates.d.ts.map +1 -1
- package/dist/core/utils/__mocks__/templates.js +9 -0
- package/dist/core/utils/__tests__/applyDiffReportToClient.test.d.ts +2 -0
- package/dist/core/utils/__tests__/applyDiffReportToClient.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/applyDiffReportToClient.test.js +108 -0
- package/dist/core/utils/__tests__/getMappedType.test.js +2 -0
- package/dist/core/utils/__tests__/getOperationResponseCode.test.js +7 -2
- package/dist/core/utils/__tests__/getOperationResults.test.d.ts +2 -0
- package/dist/core/utils/__tests__/getOperationResults.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/getOperationResults.test.js +43 -0
- package/dist/core/utils/__tests__/prepareDtoModels.test.d.ts +2 -0
- package/dist/core/utils/__tests__/prepareDtoModels.test.d.ts.map +1 -0
- package/dist/core/utils/__tests__/prepareDtoModels.test.js +116 -0
- package/dist/core/utils/__tests__/serviceHelpers.test.js +1 -0
- package/dist/core/utils/__tests__/writeClientModels.test.js +50 -0
- package/dist/core/utils/applyDiffReportToClient.d.ts +14 -0
- package/dist/core/utils/applyDiffReportToClient.d.ts.map +1 -0
- package/dist/core/utils/applyDiffReportToClient.js +367 -0
- package/dist/core/utils/getMappedType.d.ts.map +1 -1
- package/dist/core/utils/getMappedType.js +2 -0
- package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
- package/dist/core/utils/getOpenApiSpec.js +1 -14
- package/dist/core/utils/getOperationResponseCode.d.ts.map +1 -1
- package/dist/core/utils/getOperationResponseCode.js +10 -8
- package/dist/core/utils/loadDiffReport.d.ts +39 -0
- package/dist/core/utils/loadDiffReport.d.ts.map +1 -0
- package/dist/core/utils/loadDiffReport.js +51 -0
- package/dist/core/utils/prepareDtoModels.d.ts +3 -0
- package/dist/core/utils/prepareDtoModels.d.ts.map +1 -0
- package/dist/core/utils/prepareDtoModels.js +189 -0
- package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarHelpers.js +4 -1
- package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
- package/dist/core/utils/registerHandlebarTemplates.js +6 -0
- package/dist/core/utils/validateRawOptions.d.ts +1 -1
- package/dist/core/utils/validateRawOptions.d.ts.map +1 -1
- package/dist/core/utils/validateRawOptions.js +4 -2
- package/dist/core/utils/writeClientCore.d.ts +2 -0
- package/dist/core/utils/writeClientCore.d.ts.map +1 -1
- package/dist/core/utils/writeClientCore.js +6 -1
- package/dist/core/utils/writeClientCoreIndex.d.ts +1 -0
- package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientCoreIndex.js +2 -2
- package/dist/core/utils/writeClientExecutor.d.ts +2 -0
- package/dist/core/utils/writeClientExecutor.d.ts.map +1 -1
- package/dist/core/utils/writeClientExecutor.js +6 -2
- package/dist/core/utils/writeClientFullIndex.d.ts.map +1 -1
- package/dist/core/utils/writeClientFullIndex.js +3 -1
- package/dist/core/utils/writeClientModels.d.ts +6 -0
- package/dist/core/utils/writeClientModels.d.ts.map +1 -1
- package/dist/core/utils/writeClientModels.js +24 -3
- package/dist/core/utils/writeClientModelsIndex.d.ts +2 -0
- 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 +2 -0
- package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
- package/dist/core/utils/writeClientSchemas.js +6 -2
- package/dist/core/utils/writeClientServices.d.ts +2 -0
- package/dist/core/utils/writeClientServices.d.ts.map +1 -1
- package/dist/core/utils/writeClientServices.js +6 -2
- package/dist/templatesCompiled/cli/openApiConfig.d.ts +4 -1
- package/dist/templatesCompiled/cli/openApiConfig.d.ts.map +1 -1
- package/dist/templatesCompiled/cli/openApiConfig.js +88 -37
- package/dist/templatesCompiled/client/core/ApiRequestOptions.js +1 -1
- package/dist/templatesCompiled/client/core/BaseDto.d.ts +8 -0
- package/dist/templatesCompiled/client/core/BaseDto.d.ts.map +1 -0
- package/dist/templatesCompiled/client/core/BaseDto.js +18 -0
- package/dist/templatesCompiled/client/core/axios/getResponseBody.js +1 -1
- package/dist/templatesCompiled/client/core/axios/request.js +2 -2
- package/dist/templatesCompiled/client/core/axios/sendRequest.js +4 -4
- package/dist/templatesCompiled/client/core/dtoUtils.d.ts +8 -0
- package/dist/templatesCompiled/client/core/dtoUtils.d.ts.map +1 -0
- package/dist/templatesCompiled/client/core/dtoUtils.js +18 -0
- package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.js +2 -2
- package/dist/templatesCompiled/client/core/executor/requestExecutor.js +1 -1
- package/dist/templatesCompiled/client/core/fetch/getResponseBody.js +1 -1
- package/dist/templatesCompiled/client/core/fetch/request.js +2 -2
- package/dist/templatesCompiled/client/core/functions/isBinary.js +1 -1
- package/dist/templatesCompiled/client/core/node/getResponseBody.js +1 -1
- package/dist/templatesCompiled/client/core/node/request.js +2 -2
- package/dist/templatesCompiled/client/core/xhr/getResponseBody.js +1 -1
- package/dist/templatesCompiled/client/core/xhr/request.js +2 -2
- package/dist/templatesCompiled/client/core/xhr/sendRequest.js +4 -4
- package/dist/templatesCompiled/client/exportModels.d.ts +34 -0
- package/dist/templatesCompiled/client/exportModels.d.ts.map +1 -0
- package/dist/templatesCompiled/client/exportModels.js +280 -0
- package/dist/templatesCompiled/client/exportService.d.ts +7 -4
- package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
- package/dist/templatesCompiled/client/exportService.js +52 -33
- package/dist/templatesCompiled/client/indexCore.d.ts +3 -1
- package/dist/templatesCompiled/client/indexCore.d.ts.map +1 -1
- package/dist/templatesCompiled/client/indexCore.js +13 -2
- package/dist/templatesCompiled/client/indexFull.d.ts +9 -7
- package/dist/templatesCompiled/client/indexFull.d.ts.map +1 -1
- package/dist/templatesCompiled/client/indexFull.js +52 -34
- package/dist/templatesCompiled/client/indexModels.d.ts +7 -5
- package/dist/templatesCompiled/client/indexModels.d.ts.map +1 -1
- package/dist/templatesCompiled/client/indexModels.js +27 -18
- package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.d.ts +27 -19
- package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.d.ts.map +1 -1
- package/dist/templatesCompiled/client/joi/partials/joiSchemaGeneric.js +144 -63
- package/dist/templatesCompiled/client/jsonschema/exportSchema.d.ts +1 -0
- package/dist/templatesCompiled/client/jsonschema/exportSchema.d.ts.map +1 -1
- package/dist/templatesCompiled/client/jsonschema/exportSchema.js +17 -13
- package/dist/templatesCompiled/client/partials/exportInterface.d.ts +13 -5
- package/dist/templatesCompiled/client/partials/exportInterface.d.ts.map +1 -1
- package/dist/templatesCompiled/client/partials/exportInterface.js +91 -21
- package/dist/templatesCompiled/client/partials/result.d.ts +6 -4
- package/dist/templatesCompiled/client/partials/result.d.ts.map +1 -1
- package/dist/templatesCompiled/client/partials/result.js +16 -6
- package/dist/templatesCompiled/client/partials/serviceOption.d.ts +1 -0
- package/dist/templatesCompiled/client/partials/serviceOption.d.ts.map +1 -1
- package/dist/templatesCompiled/client/partials/serviceOption.js +11 -4
- package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.d.ts +22 -16
- package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.d.ts.map +1 -1
- package/dist/templatesCompiled/client/yup/partials/yupSchemaGeneric.js +72 -60
- package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.d.ts +27 -19
- package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.d.ts.map +1 -1
- package/dist/templatesCompiled/client/zod/partials/zodSchemaGeneric.js +77 -61
- package/package.json +7 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeClientServices.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientServices.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeClientServices.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientServices.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,KAAK,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,UAAU,oBAAoB;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,mBAAmB,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BzG"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.writeClientServices = writeClientServices;
|
|
4
|
+
const eslintFix_1 = require("../../common/utils/eslintFix");
|
|
4
5
|
const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
|
|
5
6
|
const format_1 = require("../../common/utils/format");
|
|
6
7
|
const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
@@ -14,7 +15,7 @@ const pathHelpers_1 = require("../../common/utils/pathHelpers");
|
|
|
14
15
|
* @param useOptions Use options or arguments functions
|
|
15
16
|
*/
|
|
16
17
|
async function writeClientServices(options) {
|
|
17
|
-
const { services, templates, outputPaths, httpClient, useUnionTypes, useOptions, useCancelableRequest } = options;
|
|
18
|
+
const { services, templates, outputPaths, httpClient, useUnionTypes, useOptions, useCancelableRequest, useProjectPrettier, useEslintFix } = options;
|
|
18
19
|
this.logger.info('Recording of service files begins');
|
|
19
20
|
for (const service of services) {
|
|
20
21
|
const file = (0, pathHelpers_1.resolveHelper)(outputPaths.outputServices, `${service.name}.ts`);
|
|
@@ -28,8 +29,11 @@ async function writeClientServices(options) {
|
|
|
28
29
|
outputModels: outputPaths.outputModels,
|
|
29
30
|
useCancelableRequest,
|
|
30
31
|
});
|
|
31
|
-
const formattedValue = await (0, format_1.format)(templateResult);
|
|
32
|
+
const formattedValue = await (0, format_1.format)(templateResult, undefined, useProjectPrettier);
|
|
32
33
|
await fileSystemHelpers_1.fileSystemHelpers.writeFile(file, formattedValue);
|
|
34
|
+
if (useEslintFix) {
|
|
35
|
+
await (0, eslintFix_1.eslintFix)(file);
|
|
36
|
+
}
|
|
33
37
|
this.logger.info(`File recording completed: ${file}`);
|
|
34
38
|
}
|
|
35
39
|
this.logger.info('Service file recording completed successfully');
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
"1": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
3
3
|
"2": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
4
|
-
"
|
|
4
|
+
"3": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
5
|
+
"5": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
6
|
+
"7": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
7
|
+
"9": (container: any, depth0: any, helpers: any, partials: any, data: any) => string;
|
|
5
8
|
compiler: (string | number)[];
|
|
6
9
|
main: (container: any, depth0: any, helpers: any, partials: any, data: any) => any;
|
|
7
10
|
useData: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openApiConfig.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/cli/openApiConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openApiConfig.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/cli/openApiConfig.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,wBA6IiB"}
|
|
@@ -7,81 +7,132 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
/* eslint: disable */
|
|
8
8
|
// @ts-nocheck
|
|
9
9
|
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
|
-
var stack1, alias1 = container.
|
|
10
|
+
var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), alias2 = container.strict, alias3 = container.lambda, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
11
11
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
12
12
|
return parent[propertyName];
|
|
13
13
|
}
|
|
14
14
|
return undefined;
|
|
15
15
|
};
|
|
16
|
-
return "{\n \"items\": "
|
|
17
|
-
+ ((stack1 =
|
|
18
|
-
+ ",\n \"httpClient\": \""
|
|
19
|
-
+ ((stack1 = alias2(
|
|
16
|
+
return "{\n \"items\": [\n"
|
|
17
|
+
+ ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(lookupProperty(data, "root"), "items"), { "name": "each", "hash": {}, "fn": container.program(2, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 10, "column": 9 } } })) != null ? stack1 : "")
|
|
18
|
+
+ " ],\n \"httpClient\": \""
|
|
19
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "httpClient", { "start": { "line": 12, "column": 21 }, "end": { "line": 12, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
20
20
|
+ "\",\n \"sortByRequired\": "
|
|
21
|
-
+ ((stack1 = alias2(
|
|
21
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "sortByRequired", { "start": { "line": 13, "column": 24 }, "end": { "line": 13, "column": 44 } }), depth0)) != null ? stack1 : "")
|
|
22
22
|
+ ",\n \"enumPrefix\": \""
|
|
23
|
-
+ ((stack1 = alias2(
|
|
23
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "enumPrefix", { "start": { "line": 14, "column": 21 }, "end": { "line": 14, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
24
24
|
+ "\",\n \"excludeCoreServiceFiles\": "
|
|
25
|
-
+ ((stack1 = alias2(
|
|
25
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "excludeCoreServiceFiles", { "start": { "line": 15, "column": 33 }, "end": { "line": 15, "column": 62 } }), depth0)) != null ? stack1 : "")
|
|
26
26
|
+ ",\n \"interfacePrefix\": \""
|
|
27
|
-
+ ((stack1 = alias2(
|
|
27
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "interfacePrefix", { "start": { "line": 16, "column": 26 }, "end": { "line": 16, "column": 47 } }), depth0)) != null ? stack1 : "")
|
|
28
28
|
+ "\",\n \"typePrefix\": \""
|
|
29
|
-
+ ((stack1 = alias2(
|
|
29
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "typePrefix", { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
30
30
|
+ "\",\n \"useCancelableRequest\": "
|
|
31
|
-
+ ((stack1 = alias2(
|
|
31
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "useCancelableRequest", { "start": { "line": 18, "column": 30 }, "end": { "line": 18, "column": 56 } }), depth0)) != null ? stack1 : "")
|
|
32
32
|
+ ",\n \"useOptions\": "
|
|
33
|
-
+ ((stack1 = alias2(
|
|
33
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "useOptions", { "start": { "line": 19, "column": 20 }, "end": { "line": 19, "column": 36 } }), depth0)) != null ? stack1 : "")
|
|
34
34
|
+ ",\n \"useSeparatedIndexes\": "
|
|
35
|
-
+ ((stack1 = alias2(
|
|
35
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "useSeparatedIndexes", { "start": { "line": 20, "column": 29 }, "end": { "line": 20, "column": 54 } }), depth0)) != null ? stack1 : "")
|
|
36
36
|
+ ",\n \"useUnionTypes\": "
|
|
37
|
-
+ ((stack1 = alias2(
|
|
38
|
-
+ "
|
|
39
|
-
+ ((stack1 = lookupProperty(helpers, "if").call(
|
|
40
|
-
+ "\n
|
|
37
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "useUnionTypes", { "start": { "line": 21, "column": 23 }, "end": { "line": 21, "column": 42 } }), depth0)) != null ? stack1 : "")
|
|
38
|
+
+ ","
|
|
39
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "request"), { "name": "if", "hash": {}, "fn": container.program(7, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 21, "column": 45 }, "end": { "line": 22, "column": 41 } } })) != null ? stack1 : "")
|
|
40
|
+
+ "\n \"modelsMode\": \""
|
|
41
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "modelsMode", { "start": { "line": 23, "column": 21 }, "end": { "line": 23, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
42
|
+
+ "\",\n \"useHistory\": "
|
|
43
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "useHistory", { "start": { "line": 24, "column": 20 }, "end": { "line": 24, "column": 36 } }), depth0)) != null ? stack1 : "")
|
|
44
|
+
+ ",\n \"diffReport\": \""
|
|
45
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "diffReport", { "start": { "line": 25, "column": 21 }, "end": { "line": 25, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
46
|
+
+ "\""
|
|
47
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "request"), { "name": "if", "hash": {}, "fn": container.program(7, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 25, "column": 40 }, "end": { "line": 26, "column": 41 } } })) != null ? stack1 : "")
|
|
48
|
+
+ ",\n \"models\": {\n \"mode\": \""
|
|
49
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "modelsMode", { "start": { "line": 28, "column": 19 }, "end": { "line": 28, "column": 35 } }), depth0)) != null ? stack1 : "")
|
|
50
|
+
+ "\"\n },\n \"analyze\": {\n \"useHistory\": "
|
|
51
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "useHistory", { "start": { "line": 31, "column": 24 }, "end": { "line": 31, "column": 40 } }), depth0)) != null ? stack1 : "")
|
|
52
|
+
+ ",\n \"reportPath\": \""
|
|
53
|
+
+ ((stack1 = alias3(alias2(lookupProperty(data, "root"), "diffReport", { "start": { "line": 32, "column": 25 }, "end": { "line": 32, "column": 41 } }), depth0)) != null ? stack1 : "")
|
|
54
|
+
+ "\"\n },\n \"miracles\": {\n \"enabled\": true,\n \"confidence\": 1,\n \"types\": [\"RENAME\", \"TYPE_COERCION\"]\n }\n}\n";
|
|
41
55
|
}, "2": function (container, depth0, helpers, partials, data) {
|
|
56
|
+
var stack1, alias1 = container.strict, alias2 = container.lambda, alias3 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
57
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
58
|
+
return parent[propertyName];
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
};
|
|
62
|
+
return " {\n \"input\": \""
|
|
63
|
+
+ ((stack1 = alias2(alias1(depth0, "input", { "start": { "line": 6, "column": 24 }, "end": { "line": 6, "column": 29 } }), depth0)) != null ? stack1 : "")
|
|
64
|
+
+ "\",\n \"output\": \""
|
|
65
|
+
+ ((stack1 = alias2(alias1(depth0, "output", { "start": { "line": 7, "column": 25 }, "end": { "line": 7, "column": 31 } }), depth0)) != null ? stack1 : "")
|
|
66
|
+
+ "\""
|
|
67
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias3, lookupProperty(depth0, "request"), { "name": "if", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 7, "column": 34 }, "end": { "line": 8, "column": 43 } } })) != null ? stack1 : "")
|
|
68
|
+
+ "\n }"
|
|
69
|
+
+ ((stack1 = lookupProperty(helpers, "unless").call(alias3, lookupProperty(data, "last"), { "name": "unless", "hash": {}, "fn": container.program(5, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 9, "column": 9 }, "end": { "line": 9, "column": 38 } } })) != null ? stack1 : "")
|
|
70
|
+
+ "\n";
|
|
71
|
+
}, "3": function (container, depth0, helpers, partials, data) {
|
|
72
|
+
var stack1;
|
|
73
|
+
return ",\n \"request\": \""
|
|
74
|
+
+ ((stack1 = container.lambda(container.strict(depth0, "request", { "start": { "line": 8, "column": 26 }, "end": { "line": 8, "column": 33 } }), depth0)) != null ? stack1 : "")
|
|
75
|
+
+ "\"";
|
|
76
|
+
}, "5": function (container, depth0, helpers, partials, data) {
|
|
77
|
+
return ",";
|
|
78
|
+
}, "7": function (container, depth0, helpers, partials, data) {
|
|
42
79
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
43
80
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
44
81
|
return parent[propertyName];
|
|
45
82
|
}
|
|
46
83
|
return undefined;
|
|
47
84
|
};
|
|
48
|
-
return "\"request\": \""
|
|
49
|
-
+ ((stack1 = container.lambda(container.strict(lookupProperty(data, "root"), "request", { "start": { "line":
|
|
85
|
+
return ",\n \"request\": \""
|
|
86
|
+
+ ((stack1 = container.lambda(container.strict(lookupProperty(data, "root"), "request", { "start": { "line": 22, "column": 18 }, "end": { "line": 22, "column": 31 } }), depth0)) != null ? stack1 : "")
|
|
50
87
|
+ "\"";
|
|
51
|
-
}, "
|
|
52
|
-
var stack1, alias1 = container.strict, alias2 = container.lambda, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
88
|
+
}, "9": function (container, depth0, helpers, partials, data) {
|
|
89
|
+
var stack1, alias1 = container.strict, alias2 = container.lambda, alias3 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
53
90
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
54
91
|
return parent[propertyName];
|
|
55
92
|
}
|
|
56
93
|
return undefined;
|
|
57
94
|
};
|
|
58
95
|
return "{\n \"input\": \""
|
|
59
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "input", { "start": { "line":
|
|
96
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "input", { "start": { "line": 42, "column": 16 }, "end": { "line": 42, "column": 27 } }), depth0)) != null ? stack1 : "")
|
|
60
97
|
+ "\",\n \"output\": \""
|
|
61
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "output", { "start": { "line":
|
|
98
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "output", { "start": { "line": 43, "column": 17 }, "end": { "line": 43, "column": 29 } }), depth0)) != null ? stack1 : "")
|
|
62
99
|
+ "\",\n \"httpClient\": \""
|
|
63
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "httpClient", { "start": { "line":
|
|
100
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "httpClient", { "start": { "line": 44, "column": 21 }, "end": { "line": 44, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
64
101
|
+ "\",\n \"sortByRequired\": "
|
|
65
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "sortByRequired", { "start": { "line":
|
|
102
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "sortByRequired", { "start": { "line": 45, "column": 24 }, "end": { "line": 45, "column": 44 } }), depth0)) != null ? stack1 : "")
|
|
66
103
|
+ ",\n \"enumPrefix\": \""
|
|
67
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "enumPrefix", { "start": { "line":
|
|
104
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "enumPrefix", { "start": { "line": 46, "column": 21 }, "end": { "line": 46, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
68
105
|
+ "\",\n \"excludeCoreServiceFiles\": "
|
|
69
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "excludeCoreServiceFiles", { "start": { "line":
|
|
106
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "excludeCoreServiceFiles", { "start": { "line": 47, "column": 33 }, "end": { "line": 47, "column": 62 } }), depth0)) != null ? stack1 : "")
|
|
70
107
|
+ ",\n \"interfacePrefix\": \""
|
|
71
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "interfacePrefix", { "start": { "line":
|
|
108
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "interfacePrefix", { "start": { "line": 48, "column": 26 }, "end": { "line": 48, "column": 47 } }), depth0)) != null ? stack1 : "")
|
|
72
109
|
+ "\",\n \"typePrefix\": \""
|
|
73
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "typePrefix", { "start": { "line":
|
|
110
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "typePrefix", { "start": { "line": 49, "column": 21 }, "end": { "line": 49, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
74
111
|
+ "\",\n \"useCancelableRequest\": "
|
|
75
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useCancelableRequest", { "start": { "line":
|
|
112
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useCancelableRequest", { "start": { "line": 50, "column": 30 }, "end": { "line": 50, "column": 56 } }), depth0)) != null ? stack1 : "")
|
|
76
113
|
+ ",\n \"useOptions\": "
|
|
77
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useOptions", { "start": { "line":
|
|
114
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useOptions", { "start": { "line": 51, "column": 20 }, "end": { "line": 51, "column": 36 } }), depth0)) != null ? stack1 : "")
|
|
78
115
|
+ ",\n \"useSeparatedIndexes\": "
|
|
79
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useSeparatedIndexes", { "start": { "line":
|
|
116
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useSeparatedIndexes", { "start": { "line": 52, "column": 29 }, "end": { "line": 52, "column": 54 } }), depth0)) != null ? stack1 : "")
|
|
80
117
|
+ ",\n \"useUnionTypes\": "
|
|
81
|
-
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useUnionTypes", { "start": { "line":
|
|
82
|
-
+ "
|
|
83
|
-
+ ((stack1 = lookupProperty(helpers, "if").call(
|
|
84
|
-
+ "\n
|
|
118
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useUnionTypes", { "start": { "line": 53, "column": 23 }, "end": { "line": 53, "column": 42 } }), depth0)) != null ? stack1 : "")
|
|
119
|
+
+ ","
|
|
120
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias3, lookupProperty(lookupProperty(data, "root"), "request"), { "name": "if", "hash": {}, "fn": container.program(7, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 53, "column": 45 }, "end": { "line": 54, "column": 41 } } })) != null ? stack1 : "")
|
|
121
|
+
+ "\n \"modelsMode\": \""
|
|
122
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "modelsMode", { "start": { "line": 55, "column": 21 }, "end": { "line": 55, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
123
|
+
+ "\",\n \"useHistory\": "
|
|
124
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useHistory", { "start": { "line": 56, "column": 20 }, "end": { "line": 56, "column": 36 } }), depth0)) != null ? stack1 : "")
|
|
125
|
+
+ ",\n \"diffReport\": \""
|
|
126
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "diffReport", { "start": { "line": 57, "column": 21 }, "end": { "line": 57, "column": 37 } }), depth0)) != null ? stack1 : "")
|
|
127
|
+
+ "\""
|
|
128
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias3, lookupProperty(lookupProperty(data, "root"), "request"), { "name": "if", "hash": {}, "fn": container.program(7, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 57, "column": 40 }, "end": { "line": 58, "column": 41 } } })) != null ? stack1 : "")
|
|
129
|
+
+ ",\n \"models\": {\n \"mode\": \""
|
|
130
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "modelsMode", { "start": { "line": 60, "column": 19 }, "end": { "line": 60, "column": 35 } }), depth0)) != null ? stack1 : "")
|
|
131
|
+
+ "\"\n },\n \"analyze\": {\n \"useHistory\": "
|
|
132
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "useHistory", { "start": { "line": 63, "column": 24 }, "end": { "line": 63, "column": 40 } }), depth0)) != null ? stack1 : "")
|
|
133
|
+
+ ",\n \"reportPath\": \""
|
|
134
|
+
+ ((stack1 = alias2(alias1(lookupProperty(data, "root"), "diffReport", { "start": { "line": 64, "column": 25 }, "end": { "line": 64, "column": 41 } }), depth0)) != null ? stack1 : "")
|
|
135
|
+
+ "\"\n },\n \"miracles\": {\n \"enabled\": true,\n \"confidence\": 1,\n \"types\": [\"RENAME\", \"TYPE_COERCION\"]\n }\n}\n";
|
|
85
136
|
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
86
137
|
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
87
138
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -89,5 +140,5 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
89
140
|
}
|
|
90
141
|
return undefined;
|
|
91
142
|
};
|
|
92
|
-
return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(lookupProperty(data, "root"), "
|
|
143
|
+
return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(lookupProperty(data, "root"), "items"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.program(9, data, 0), "data": data, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 72, "column": 7 } } })) != null ? stack1 : "");
|
|
93
144
|
}, "useData": true };
|
|
@@ -14,5 +14,5 @@ exports.default = { "compiler": [8, ">= 4.3.0"], "main": function (container, de
|
|
|
14
14
|
return undefined;
|
|
15
15
|
};
|
|
16
16
|
return ((stack1 = container.invokePartial(lookupProperty(partials, "header"), depth0, { "name": "header", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
17
|
-
+ "\nexport type ApiRequestOptions = {\n readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';\n readonly path: string;\n readonly cookies?: Record<string, any>;\n readonly headers?: Record<string, any>;\n readonly query?: Record<string, any>;\n readonly formData?: Record<string, any>;\n readonly body?: any;\n readonly mediaType?: string;\n readonly responseHeader?: string;\n // TODO TS2344: Redesign the logic for generating errors. Use the string value of the error code.\n // @ts-ignore\n readonly errors?: Record<number, string>;\n}\n";
|
|
17
|
+
+ "\nexport type ApiRequestOptions = {\n readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';\n readonly path: string;\n readonly cookies?: Record<string, any>;\n readonly headers?: Record<string, any>;\n readonly query?: Record<string, any>;\n readonly formData?: Record<string, any>;\n readonly body?: any;\n readonly mediaType?: string;\n readonly responseHeader?: string;\n readonly responseType?: 'blob';\n // TODO TS2344: Redesign the logic for generating errors. Use the string value of the error code.\n // @ts-ignore\n readonly errors?: Record<number, string>;\n}\n";
|
|
18
18
|
}, "usePartial": true, "useData": true };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseDto.d.ts","sourceRoot":"","sources":["../../../../src/templatesCompiled/client/core/BaseDto.ts"],"names":[],"mappings":";;;;;;AAMA,wBAUmC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// This is an automatically generated file for the hbs template.
|
|
4
|
+
// You don't need to change it, run npm run build:hbs to update it.
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint: disable */
|
|
7
|
+
/* eslint: disable */
|
|
8
|
+
// @ts-nocheck
|
|
9
|
+
exports.default = { "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
10
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
12
|
+
return parent[propertyName];
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
};
|
|
16
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "header"), depth0, { "name": "header", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
17
|
+
+ "\nexport abstract class BaseDto<Raw> {\n protected readonly _raw: Raw;\n\n protected constructor(data: Raw) {\n this._raw = data;\n }\n\n public abstract toJSON(): Raw;\n\n public clone(): this {\n const ctor = this.constructor as new (data: Raw) => this;\n return new ctor(this.toJSON());\n }\n}\n";
|
|
18
|
+
}, "usePartial": true, "useData": true };
|
|
@@ -7,5 +7,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
/* eslint: disable */
|
|
8
8
|
// @ts-nocheck
|
|
9
9
|
exports.default = { "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
10
|
-
return "function getResponseBody(response: AxiosResponse): any {\n try {\n const contentType = response.headers['content-type'];\n if (contentType) {\n const isJSON = typeof contentType === 'string' && contentType.toLowerCase().startsWith('application/json');\n\n if (isJSON && isString(response.data)) {\n return JSON.parse(response.data);\n } else {\n return response.data;\n }\n }\n } catch (error) {\n console.error(error);\n }\n return null;\n}\n";
|
|
10
|
+
return "function getResponseBody(response: AxiosResponse, options: ApiRequestOptions): any {\n try {\n if (options.responseType === 'blob') {\n return response.data;\n }\n const contentType = response.headers['content-type'];\n if (contentType) {\n const isJSON = typeof contentType === 'string' && contentType.toLowerCase().startsWith('application/json');\n\n if (isJSON && isString(response.data)) {\n return JSON.parse(response.data);\n } else {\n return response.data;\n }\n }\n } catch (error) {\n console.error(error);\n }\n return null;\n}\n";
|
|
11
11
|
}, "useData": true };
|
|
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
10
|
return "import { CancelablePromise } from './CancelablePromise';\n";
|
|
11
11
|
}, "3": function (container, depth0, helpers, partials, data) {
|
|
12
|
-
return " export function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<ApiResult<T>> {\n return new CancelablePromise(async(resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n \n if (!onCancel.isCancelled) {\n const response = await sendRequest<T>(options, url, config, onCancel);\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<T> {\n return new CancelablePromise(async(resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n \n if (!onCancel.isCancelled) {\n const response = await sendRequest<T>(options, url, config, onCancel);\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result.body);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
12
|
+
return " export function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<ApiResult<T>> {\n return new CancelablePromise(async(resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n \n if (!onCancel.isCancelled) {\n const response = await sendRequest<T>(options, url, config, onCancel);\n const responseBody = getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<T> {\n return new CancelablePromise(async(resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n \n if (!onCancel.isCancelled) {\n const response = await sendRequest<T>(options, url, config, onCancel);\n const responseBody = getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result.body);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
13
13
|
}, "5": function (container, depth0, helpers, partials, data) {
|
|
14
|
-
return "export async function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<T> {\n const result = await requestRaw<T>(options, config);\n return result.body;\n}\n\nexport async function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<ApiResult<T>> {\n return new Promise(async (resolve, reject) => {\n try {\n const url = getUrl(options, config);\n const response = await sendRequest(options, url, config);\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
14
|
+
return "export async function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<T> {\n const result = await requestRaw<T>(options, config);\n return result.body;\n}\n\nexport async function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<ApiResult<T>> {\n return new Promise(async (resolve, reject) => {\n try {\n const url = getUrl(options, config);\n const response = await sendRequest(options, url, config);\n const responseBody = getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
15
15
|
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
16
16
|
var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
17
17
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -22,9 +22,9 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
22
22
|
return undefined;
|
|
23
23
|
};
|
|
24
24
|
return ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0), "inverse": container.program(3, data, 0), "data": data, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 6, "column": 7 } } })) != null ? stack1 : "")
|
|
25
|
-
+ " \n const requestConfig: AxiosRequestConfig = {\n method: options.method,\n headers: await getHeaders(options, config),\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n data: getRequestBody(options),\n url,\n"
|
|
26
|
-
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(5, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line":
|
|
25
|
+
+ " \n const requestConfig: AxiosRequestConfig = {\n method: options.method,\n headers: await getHeaders(options, config),\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n data: getRequestBody(options),\n url,\n responseType: options.responseType === 'blob' ? 'blob' : undefined,\n"
|
|
26
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(5, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 11 } } })) != null ? stack1 : "")
|
|
27
27
|
+ " };\n\n"
|
|
28
|
-
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(7, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line":
|
|
29
|
-
+ "\n try {\n return await axios.request(requestConfig);\n } catch (error) {\n const axiosError = error as AxiosError<T>;\n if (axiosError.response) {\n return axiosError.response;\n }\n throw error;\n }\n}";
|
|
28
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(7, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 20, "column": 2 }, "end": { "line": 22, "column": 9 } } })) != null ? stack1 : "")
|
|
29
|
+
+ "\n try {\n return await axios.request(requestConfig);\n } catch (error) {\n const axiosError = error as AxiosError<T>;\n if (axiosError.response) {\n return axiosError.response;\n }\n throw error;\n }\n}\n";
|
|
30
30
|
}, "useData": true };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dtoUtils.d.ts","sourceRoot":"","sources":["../../../../src/templatesCompiled/client/core/dtoUtils.ts"],"names":[],"mappings":";;;;;;AAMA,wBAUmC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// This is an automatically generated file for the hbs template.
|
|
4
|
+
// You don't need to change it, run npm run build:hbs to update it.
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint: disable */
|
|
7
|
+
/* eslint: disable */
|
|
8
|
+
// @ts-nocheck
|
|
9
|
+
exports.default = { "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
10
|
+
var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
12
|
+
return parent[propertyName];
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
};
|
|
16
|
+
return ((stack1 = container.invokePartial(lookupProperty(partials, "header"), depth0, { "name": "header", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
17
|
+
+ "\nexport const fromArray = <T, R>(dtoClass: new (data: R) => T, data?: R[]): T[] => {\n if (!data || data.length === 0) {\n return [];\n }\n\n return data.map(item => new dtoClass(item));\n};\n";
|
|
18
|
+
}, "usePartial": true, "useData": true };
|
|
@@ -17,7 +17,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
17
17
|
}, "9": function (container, depth0, helpers, partials, data) {
|
|
18
18
|
return " requestRaw<TResponse>(config: RequestConfig, options?: TRequestOptions): Promise<ApiResult<TResponse>> {\n return __request(config, options) as Promise<ApiResult<TResponse>>;\n },\n request<TResponse>(config: RequestConfig, options?: TRequestOptions): Promise<TResponse> {\n return __request(config, options) as Promise<TResponse>;\n },\n";
|
|
19
19
|
}, "11": function (container, depth0, helpers, partials, data) {
|
|
20
|
-
return " requestRaw<TResponse>(config: RequestConfig, options?: TRequestOptions): Promise<ApiResult<TResponse>> {\n const baseOptions: ApiRequestOptions = {\n method: config.method as ApiRequestOptions['method'],\n path: config.path,\n headers: config.headers,\n query: config.query,\n body: config.body,\n cookies: config.cookies,\n mediaType: config.requestMediaType,\n };\n\n const mergedOptions: ApiRequestOptions = {\n ...baseOptions,\n ...(mapOptions ? mapOptions(options) : {}),\n };\n\n return __requestRaw<TResponse>(mergedOptions, openApiConfig);\n },\n request<TResponse>(config: RequestConfig, options?: TRequestOptions): Promise<TResponse> {\n const baseOptions: ApiRequestOptions = {\n method: config.method as ApiRequestOptions['method'],\n path: config.path,\n headers: config.headers,\n query: config.query,\n body: config.body,\n cookies: config.cookies,\n mediaType: config.requestMediaType,\n };\n\n const mergedOptions: ApiRequestOptions = {\n ...baseOptions,\n ...(mapOptions ? mapOptions(options) : {}),\n };\n\n return __request<TResponse>(mergedOptions, openApiConfig);\n },\n";
|
|
20
|
+
return " requestRaw<TResponse>(config: RequestConfig, options?: TRequestOptions): Promise<ApiResult<TResponse>> {\n const baseOptions: ApiRequestOptions = {\n method: config.method as ApiRequestOptions['method'],\n path: config.path,\n headers: config.headers,\n query: config.query,\n body: config.body,\n cookies: config.cookies,\n mediaType: config.requestMediaType,\n responseType: config.responseType,\n };\n\n const mergedOptions: ApiRequestOptions = {\n ...baseOptions,\n ...(mapOptions ? mapOptions(options) : {}),\n };\n\n return __requestRaw<TResponse>(mergedOptions, openApiConfig);\n },\n request<TResponse>(config: RequestConfig, options?: TRequestOptions): Promise<TResponse> {\n const baseOptions: ApiRequestOptions = {\n method: config.method as ApiRequestOptions['method'],\n path: config.path,\n headers: config.headers,\n query: config.query,\n body: config.body,\n cookies: config.cookies,\n mediaType: config.requestMediaType,\n responseType: config.responseType,\n };\n\n const mergedOptions: ApiRequestOptions = {\n ...baseOptions,\n ...(mapOptions ? mapOptions(options) : {}),\n };\n\n return __request<TResponse>(mergedOptions, openApiConfig);\n },\n";
|
|
21
21
|
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
22
22
|
var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
23
23
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -32,6 +32,6 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
|
32
32
|
+ "\nexport function createExecutorAdapter<TRequestOptions extends Record<string, any>>(\n"
|
|
33
33
|
+ ((stack1 = lookupProperty(helpers, "unless").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCustomRequest"), { "name": "unless", "hash": {}, "fn": container.program(7, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 17, "column": 0 }, "end": { "line": 20, "column": 11 } } })) != null ? stack1 : "")
|
|
34
34
|
+ "): RequestExecutor<TRequestOptions> {\n return {\n"
|
|
35
|
-
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCustomRequest"), { "name": "if", "hash": {}, "fn": container.program(9, data, 0), "inverse": container.program(11, data, 0), "data": data, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line":
|
|
35
|
+
+ ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCustomRequest"), { "name": "if", "hash": {}, "fn": container.program(9, data, 0), "inverse": container.program(11, data, 0), "data": data, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 69, "column": 15 } } })) != null ? stack1 : "")
|
|
36
36
|
+ " };\n}\n";
|
|
37
37
|
}, "usePartial": true, "useData": true };
|
|
@@ -14,5 +14,5 @@ exports.default = { "compiler": [8, ">= 4.3.0"], "main": function (container, de
|
|
|
14
14
|
return undefined;
|
|
15
15
|
};
|
|
16
16
|
return ((stack1 = container.invokePartial(lookupProperty(partials, "header"), depth0, { "name": "header", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
|
|
17
|
-
+ "\nimport type { ApiResult } from '../ApiResult';\n\nexport interface RequestConfig {\n method: string;\n path: string;\n\n headers?: Record<string, string>;\n query?: Record<string, any>;\n body?: unknown;\n\n requestMediaType?: string;\n cookies?: Record<string, string>;\n}\n\nexport interface RequestExecutor<TOptions = unknown> {\n request<TResponse>(\n config: RequestConfig,\n options?: TOptions\n ): Promise<TResponse>;\n\n requestRaw<TResponse>(\n config: RequestConfig,\n options?: TOptions\n ): Promise<ApiResult<TResponse>>;\n}\n";
|
|
17
|
+
+ "\nimport type { ApiResult } from '../ApiResult';\n\nexport interface RequestConfig {\n method: string;\n path: string;\n\n headers?: Record<string, string>;\n query?: Record<string, any>;\n body?: unknown;\n\n requestMediaType?: string;\n responseType?: 'blob';\n cookies?: Record<string, string>;\n}\n\nexport interface RequestExecutor<TOptions = unknown> {\n request<TResponse>(\n config: RequestConfig,\n options?: TOptions\n ): Promise<TResponse>;\n\n requestRaw<TResponse>(\n config: RequestConfig,\n options?: TOptions\n ): Promise<ApiResult<TResponse>>;\n}\n";
|
|
18
18
|
}, "usePartial": true, "useData": true };
|
|
@@ -7,5 +7,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
/* eslint: disable */
|
|
8
8
|
// @ts-nocheck
|
|
9
9
|
exports.default = { "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
10
|
-
return "async function getResponseBody(response: Response): Promise<any> {\n try {\n const contentType = response.headers.get('Content-Type');\n if (contentType) {\n const isJSON = contentType.toLowerCase().startsWith('application/json');\n if (isJSON) {\n return await response.json();\n } else {\n return await response.text();\n }\n }\n } catch (error) {\n console.error(error);\n }\n return null;\n}\n";
|
|
10
|
+
return "async function getResponseBody(response: Response, options: ApiRequestOptions): Promise<any> {\n try {\n if (options.responseType === 'blob') {\n return await response.blob();\n }\n const contentType = response.headers.get('Content-Type');\n if (contentType) {\n const isJSON = contentType.toLowerCase().startsWith('application/json');\n if (isJSON) {\n return await response.json();\n } else {\n return await response.text();\n }\n }\n } catch (error) {\n console.error(error);\n }\n return null;\n}\n";
|
|
11
11
|
}, "useData": true };
|
|
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
10
|
return "import { CancelablePromise } from './CancelablePromise';\n";
|
|
11
11
|
}, "3": function (container, depth0, helpers, partials, data) {
|
|
12
|
-
return "export function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<ApiResult<T>> {\n return new CancelablePromise(async(resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = await getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n catchErrors(options, result);\n resolve(result);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<T> {\n return new CancelablePromise(async(resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = await getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n catchErrors(options, result);\n resolve(result.body);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
12
|
+
return "export function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<ApiResult<T>> {\n return new CancelablePromise(async(resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = await getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n catchErrors(options, result);\n resolve(result);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<T> {\n return new CancelablePromise(async(resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = await getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n catchErrors(options, result);\n resolve(result.body);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
13
13
|
}, "5": function (container, depth0, helpers, partials, data) {
|
|
14
|
-
return "export async function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<T> {\n const result = await requestRaw<T>(options, config);\n return result.body;\n}\n\nexport async function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<ApiResult<T>> {\n return new Promise(async (resolve, reject) => {\n try {\n const url = getUrl(options, config);\n const response = await sendRequest(options, url, config);\n const responseBody = await getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
14
|
+
return "export async function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<T> {\n const result = await requestRaw<T>(options, config);\n return result.body;\n}\n\nexport async function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<ApiResult<T>> {\n return new Promise(async (resolve, reject) => {\n try {\n const url = getUrl(options, config);\n const response = await sendRequest(options, url, config);\n const responseBody = await getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
15
15
|
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
16
16
|
var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
17
17
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -7,5 +7,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
/* eslint: disable */
|
|
8
8
|
// @ts-nocheck
|
|
9
9
|
exports.default = { "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
10
|
-
return "function isBinary(value: any): value is Buffer | ArrayBuffer | ArrayBufferView {\n const isBuffer = Buffer.isBuffer(value);\n const isArrayBuffer = types.isArrayBuffer(value);\n const isArrayBufferView = types.isArrayBufferView(value);\n return isBuffer || isArrayBuffer || isArrayBufferView;\n}\n";
|
|
10
|
+
return "function isBinary(value: any): value is Buffer | ArrayBuffer | ArrayBufferView | Blob {\n const isBuffer = Buffer.isBuffer(value);\n const isArrayBuffer = types.isArrayBuffer(value);\n const isArrayBufferView = types.isArrayBufferView(value);\n const isBlob = typeof Blob !== 'undefined' && value instanceof Blob;\n return isBuffer || isArrayBuffer || isArrayBufferView || isBlob;\n}\n";
|
|
11
11
|
}, "useData": true };
|
|
@@ -7,5 +7,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
/* eslint: disable */
|
|
8
8
|
// @ts-nocheck
|
|
9
9
|
exports.default = { "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
10
|
-
return "async function getResponseBody(response: Response): Promise<any> {\n try {\n const contentType = response.headers.get('Content-Type');\n if (contentType) {\n const isJSON = contentType.toLowerCase().startsWith('application/json');\n if (isJSON) {\n return await response.json();\n } else {\n return await response.text();\n }\n }\n } catch (error) {\n console.error(error);\n }\n return null;\n}\n";
|
|
10
|
+
return "async function getResponseBody(response: Response, options: ApiRequestOptions): Promise<any> {\n try {\n if (options.responseType === 'blob') {\n return await response.blob();\n }\n const contentType = response.headers.get('Content-Type');\n if (contentType) {\n const isJSON = contentType.toLowerCase().startsWith('application/json');\n if (isJSON) {\n return await response.json();\n } else {\n return await response.text();\n }\n }\n } catch (error) {\n console.error(error);\n }\n return null;\n}\n";
|
|
11
11
|
}, "useData": true };
|
|
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
10
|
return "import { CancelablePromise } from './CancelablePromise';\n";
|
|
11
11
|
}, "3": function (container, depth0, helpers, partials, data) {
|
|
12
|
-
return "export function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<ApiResult<T>> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = await getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<T> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = await getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result.body);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
12
|
+
return "export function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<ApiResult<T>> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = await getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<T> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = await getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result.body);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
13
13
|
}, "5": function (container, depth0, helpers, partials, data) {
|
|
14
|
-
return "export async function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<T> {\n const result = await requestRaw<T>(options, config);\n return result.body;\n}\n\nexport async function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<ApiResult<T>> {\n return new Promise(async (resolve, reject) => {\n try {\n const url = getUrl(options, config);\n const response = await sendRequest(options, url, config);\n const responseBody = await getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
14
|
+
return "export async function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<T> {\n const result = await requestRaw<T>(options, config);\n return result.body;\n}\n\nexport async function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<ApiResult<T>> {\n return new Promise(async (resolve, reject) => {\n try {\n const url = getUrl(options, config);\n const response = await sendRequest(options, url, config);\n const responseBody = await getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n const result: ApiResult<T> = {\n url,\n ok: response.ok,\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
15
15
|
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
16
16
|
var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
17
17
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
@@ -7,5 +7,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
/* eslint: disable */
|
|
8
8
|
// @ts-nocheck
|
|
9
9
|
exports.default = { "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
10
|
-
return "function getResponseBody(xhr: XMLHttpRequest): any {\n try {\n const contentType = xhr.getResponseHeader('Content-Type');\n if (contentType) {\n const isJSON = contentType.toLowerCase().startsWith('application/json');\n if (isJSON) {\n return JSON.parse(xhr.responseText);\n } else {\n return xhr.responseText;\n }\n }\n } catch (error) {\n console.error(error);\n }\n return null;\n}\n";
|
|
10
|
+
return "function getResponseBody(xhr: XMLHttpRequest, options: ApiRequestOptions): any {\n try {\n if (options.responseType === 'blob') {\n return xhr.response;\n }\n const contentType = xhr.getResponseHeader('Content-Type');\n if (contentType) {\n const isJSON = contentType.toLowerCase().startsWith('application/json');\n if (isJSON) {\n return JSON.parse(xhr.responseText);\n } else {\n return xhr.responseText;\n }\n }\n } catch (error) {\n console.error(error);\n }\n return null;\n}\n";
|
|
11
11
|
}, "useData": true };
|
|
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.default = { "1": function (container, depth0, helpers, partials, data) {
|
|
10
10
|
return "import { CancelablePromise } from './CancelablePromise';\n";
|
|
11
11
|
}, "3": function (container, depth0, helpers, partials, data) {
|
|
12
|
-
return "export function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<ApiResult<T>> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<T> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result.body);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
12
|
+
return "export function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<ApiResult<T>> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n\nexport function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): CancelablePromise<T> {\n return new CancelablePromise(async (resolve, reject, onCancel) => {\n try {\n const url = getUrl(options, config);\n\n if (!onCancel.isCancelled) {\n const response = await sendRequest(options, url, config, onCancel);\n const responseBody = getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result.body);\n }\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
13
13
|
}, "5": function (container, depth0, helpers, partials, data) {
|
|
14
|
-
return "export async function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<T> {\n const result = await requestRaw<T>(options, config);\n return result.body;\n}\n\nexport async function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<ApiResult<T>> {\n return new Promise(async (resolve, reject) => {\n try {\n const url = getUrl(options, config);\n const response = await sendRequest(options, url, config);\n const responseBody = getResponseBody(response);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
14
|
+
return "export async function request<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<T> {\n const result = await requestRaw<T>(options, config);\n return result.body;\n}\n\nexport async function requestRaw<T>(options: ApiRequestOptions, config: TOpenAPIConfig): Promise<ApiResult<T>> {\n return new Promise(async (resolve, reject) => {\n try {\n const url = getUrl(options, config);\n const response = await sendRequest(options, url, config);\n const responseBody = getResponseBody(response, options);\n const responseHeader = getResponseHeader(response, options.responseHeader);\n\n const result: ApiResult<T> = {\n url,\n ok: isSuccess(response.status),\n status: response.status,\n statusText: response.statusText,\n body: (responseHeader || responseBody) as T,\n };\n\n catchErrors(options, result);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n });\n}\n";
|
|
15
15
|
}, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
16
16
|
var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
17
17
|
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|