@microsoft/teamsfx-core 2.0.0 → 2.0.1-alpha.6f92bb6f7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/armInterface.d.ts +0 -5
- package/build/common/armInterface.d.ts.map +1 -1
- package/build/common/deps-checker/checkerFactory.d.ts.map +1 -1
- package/build/common/deps-checker/checkerFactory.js +0 -7
- package/build/common/deps-checker/checkerFactory.js.map +1 -1
- package/build/common/deps-checker/constant/helpLink.d.ts +0 -4
- package/build/common/deps-checker/constant/helpLink.d.ts.map +1 -1
- package/build/common/deps-checker/constant/helpLink.js +1 -9
- package/build/common/deps-checker/constant/helpLink.js.map +1 -1
- package/build/common/deps-checker/constant/message.d.ts +0 -5
- package/build/common/deps-checker/constant/message.d.ts.map +1 -1
- package/build/common/deps-checker/constant/message.js +0 -6
- package/build/common/deps-checker/constant/message.js.map +1 -1
- package/build/common/deps-checker/constant/telemetry.d.ts +2 -33
- package/build/common/deps-checker/constant/telemetry.d.ts.map +1 -1
- package/build/common/deps-checker/constant/telemetry.js +0 -31
- package/build/common/deps-checker/constant/telemetry.js.map +1 -1
- package/build/common/deps-checker/depsChecker.d.ts +0 -3
- package/build/common/deps-checker/depsChecker.d.ts.map +1 -1
- package/build/common/deps-checker/depsChecker.js +0 -3
- package/build/common/deps-checker/depsChecker.js.map +1 -1
- package/build/common/deps-checker/depsError.d.ts +0 -9
- package/build/common/deps-checker/depsError.d.ts.map +1 -1
- package/build/common/deps-checker/depsError.js +1 -22
- package/build/common/deps-checker/depsError.js.map +1 -1
- package/build/common/deps-checker/depsManager.d.ts.map +1 -1
- package/build/common/deps-checker/depsManager.js +0 -3
- package/build/common/deps-checker/depsManager.js.map +1 -1
- package/build/common/deps-checker/internal/funcToolChecker.d.ts +2 -2
- package/build/common/deps-checker/internal/funcToolChecker.d.ts.map +1 -1
- package/build/common/deps-checker/internal/funcToolChecker.js +4 -2
- package/build/common/deps-checker/internal/funcToolChecker.js.map +1 -1
- package/build/common/deps-checker/internal/nodeChecker.d.ts +0 -20
- package/build/common/deps-checker/internal/nodeChecker.d.ts.map +1 -1
- package/build/common/deps-checker/internal/nodeChecker.js +1 -51
- package/build/common/deps-checker/internal/nodeChecker.js.map +1 -1
- package/build/common/local/localEnvManager.d.ts +0 -9
- package/build/common/local/localEnvManager.d.ts.map +1 -1
- package/build/common/local/localEnvManager.js +0 -59
- package/build/common/local/localEnvManager.js.map +1 -1
- package/build/common/projectSettingsHelper.d.ts +1 -7
- package/build/common/projectSettingsHelper.d.ts.map +1 -1
- package/build/common/projectSettingsHelper.js +5 -81
- package/build/common/projectSettingsHelper.js.map +1 -1
- package/build/common/projectSettingsHelperV3.d.ts +0 -1
- package/build/common/projectSettingsHelperV3.d.ts.map +1 -1
- package/build/common/projectSettingsHelperV3.js +1 -10
- package/build/common/projectSettingsHelperV3.js.map +1 -1
- package/build/common/samples.d.ts.map +1 -1
- package/build/common/samples.js +18 -40
- package/build/common/samples.js.map +1 -1
- package/build/common/templates-config.json +2 -2
- package/build/common/tools.d.ts +1 -2
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +5 -70
- package/build/common/tools.js.map +1 -1
- package/build/component/code/utils.d.ts +1 -8
- package/build/component/code/utils.d.ts.map +1 -1
- package/build/component/code/utils.js +5 -144
- package/build/component/code/utils.js.map +1 -1
- package/build/component/constants.d.ts +3 -0
- package/build/component/constants.d.ts.map +1 -1
- package/build/component/constants.js +13 -2
- package/build/component/constants.js.map +1 -1
- package/build/component/coordinator/index.d.ts +7 -7
- package/build/component/coordinator/index.d.ts.map +1 -1
- package/build/component/coordinator/index.js +15 -179
- package/build/component/coordinator/index.js.map +1 -1
- package/build/component/debug/error.d.ts +0 -1
- package/build/component/debug/error.d.ts.map +1 -1
- package/build/component/debug/error.js +1 -11
- package/build/component/debug/error.js.map +1 -1
- package/build/component/debug/index.d.ts.map +1 -1
- package/build/component/debug/index.js +1 -25
- package/build/component/debug/index.js.map +1 -1
- package/build/component/driver/aad/create.d.ts.map +1 -1
- package/build/component/driver/aad/create.js +2 -2
- package/build/component/driver/aad/create.js.map +1 -1
- package/build/component/driver/aad/update.d.ts.map +1 -1
- package/build/component/driver/aad/update.js +6 -20
- package/build/component/driver/aad/update.js.map +1 -1
- package/build/component/driver/botAadApp/create.d.ts.map +1 -1
- package/build/component/driver/botAadApp/create.js +2 -2
- package/build/component/driver/botAadApp/create.js.map +1 -1
- package/build/component/driver/devTool/error/dotnetInstallationUserError.d.ts +1 -1
- package/build/component/driver/devTool/error/dotnetInstallationUserError.d.ts.map +1 -1
- package/build/component/driver/devTool/error/dotnetInstallationUserError.js +4 -2
- package/build/component/driver/devTool/error/dotnetInstallationUserError.js.map +1 -1
- package/build/component/driver/devTool/error/funcInstallationUserError.d.ts +1 -1
- package/build/component/driver/devTool/error/funcInstallationUserError.d.ts.map +1 -1
- package/build/component/driver/devTool/error/funcInstallationUserError.js +4 -2
- package/build/component/driver/devTool/error/funcInstallationUserError.js.map +1 -1
- package/build/component/driver/devTool/installDriver.d.ts +1 -0
- package/build/component/driver/devTool/installDriver.d.ts.map +1 -1
- package/build/component/driver/devTool/installDriver.js +17 -24
- package/build/component/driver/devTool/installDriver.js.map +1 -1
- package/build/component/driver/script/baseBuildDriver.d.ts.map +1 -1
- package/build/component/driver/script/baseBuildDriver.js +2 -2
- package/build/component/driver/script/baseBuildDriver.js.map +1 -1
- package/build/component/driver/script/scriptDriver.d.ts +11 -1
- package/build/component/driver/script/scriptDriver.d.ts.map +1 -1
- package/build/component/driver/script/scriptDriver.js +121 -4
- package/build/component/driver/script/scriptDriver.js.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.d.ts +0 -1
- package/build/component/driver/teamsApp/createAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.js +1 -11
- package/build/component/driver/teamsApp/createAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/validate.d.ts +0 -1
- package/build/component/driver/teamsApp/validate.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validate.js +34 -18
- package/build/component/driver/teamsApp/validate.js.map +1 -1
- package/build/component/feature/bot/question.d.ts.map +1 -1
- package/build/component/feature/bot/question.js +7 -16
- package/build/component/feature/bot/question.js.map +1 -1
- package/build/component/feature/sso.d.ts +0 -4
- package/build/component/feature/sso.d.ts.map +1 -1
- package/build/component/feature/sso.js +10 -144
- package/build/component/feature/sso.js.map +1 -1
- package/build/component/question.d.ts +3 -64
- package/build/component/question.d.ts.map +1 -1
- package/build/component/question.js +61 -663
- package/build/component/question.js.map +1 -1
- package/build/component/registerService.d.ts +0 -14
- package/build/component/registerService.d.ts.map +1 -1
- package/build/component/registerService.js +0 -14
- package/build/component/registerService.js.map +1 -1
- package/build/component/resource/aadApp/aadApp.d.ts.map +1 -1
- package/build/component/resource/aadApp/aadApp.js +6 -24
- package/build/component/resource/aadApp/aadApp.js.map +1 -1
- package/build/component/resource/appManifest/appStudio.js +1 -1
- package/build/component/resource/appManifest/appStudio.js.map +1 -1
- package/build/component/resource/appManifest/utils/ManifestUtils.d.ts +1 -1
- package/build/component/resource/appManifest/utils/ManifestUtils.d.ts.map +1 -1
- package/build/component/resource/appManifest/utils/ManifestUtils.js +1 -9
- package/build/component/resource/appManifest/utils/ManifestUtils.js.map +1 -1
- package/build/component/resource/spfx/utils/questions.d.ts.map +1 -1
- package/build/component/resource/spfx/utils/questions.js +1 -4
- package/build/component/resource/spfx/utils/questions.js.map +1 -1
- package/build/component/utils/backupFiles.d.ts +2 -1
- package/build/component/utils/backupFiles.d.ts.map +1 -1
- package/build/component/utils/backupFiles.js +23 -3
- package/build/component/utils/backupFiles.js.map +1 -1
- package/build/component/utils/charsetUtils.d.ts +3 -0
- package/build/component/utils/charsetUtils.d.ts.map +1 -0
- package/build/component/utils/charsetUtils.js +241 -0
- package/build/component/utils/charsetUtils.js.map +1 -0
- package/build/component/utils/envUtil.d.ts.map +1 -1
- package/build/component/utils/envUtil.js +4 -1
- package/build/component/utils/envUtil.js.map +1 -1
- package/build/component/utils/metadataUtil.d.ts.map +1 -1
- package/build/component/utils/metadataUtil.js +9 -7
- package/build/component/utils/metadataUtil.js.map +1 -1
- package/build/component/utils/pathUtils.d.ts.map +1 -1
- package/build/component/utils/pathUtils.js +8 -7
- package/build/component/utils/pathUtils.js.map +1 -1
- package/build/component/utils/settingsUtil.js +3 -3
- package/build/component/utils/settingsUtil.js.map +1 -1
- package/build/component/utils.d.ts +1 -12
- package/build/component/utils.d.ts.map +1 -1
- package/build/component/utils.js +2 -225
- package/build/component/utils.js.map +1 -1
- package/build/component/workflow.d.ts +0 -1
- package/build/component/workflow.d.ts.map +1 -1
- package/build/component/workflow.js +1 -687
- package/build/component/workflow.js.map +1 -1
- package/build/core/FxCore.d.ts +26 -34
- package/build/core/FxCore.d.ts.map +1 -1
- package/build/core/FxCore.js +86 -654
- package/build/core/FxCore.js.map +1 -1
- package/build/core/FxCoreImplementV3.d.ts +15 -9
- package/build/core/FxCoreImplementV3.d.ts.map +1 -1
- package/build/core/FxCoreImplementV3.js +105 -105
- package/build/core/FxCoreImplementV3.js.map +1 -1
- package/build/core/middleware/envInfoLoaderV3.d.ts +1 -10
- package/build/core/middleware/envInfoLoaderV3.d.ts.map +1 -1
- package/build/core/middleware/envInfoLoaderV3.js +1 -207
- package/build/core/middleware/envInfoLoaderV3.js.map +1 -1
- package/build/core/middleware/projectMigratorV3.d.ts +1 -0
- package/build/core/middleware/projectMigratorV3.d.ts.map +1 -1
- package/build/core/middleware/projectMigratorV3.js +7 -7
- package/build/core/middleware/projectMigratorV3.js.map +1 -1
- package/build/core/middleware/projectSettingsLoader.d.ts +1 -4
- package/build/core/middleware/projectSettingsLoader.d.ts.map +1 -1
- package/build/core/middleware/projectSettingsLoader.js +4 -58
- package/build/core/middleware/projectSettingsLoader.js.map +1 -1
- package/build/core/middleware/projectVersionChecker.d.ts.map +1 -1
- package/build/core/middleware/projectVersionChecker.js +4 -5
- package/build/core/middleware/projectVersionChecker.js.map +1 -1
- package/build/core/middleware/questionModel.d.ts +0 -1
- package/build/core/middleware/questionModel.d.ts.map +1 -1
- package/build/core/middleware/questionModel.js +8 -54
- package/build/core/middleware/questionModel.js.map +1 -1
- package/build/core/middleware/utils/MigrationUtils.d.ts +0 -5
- package/build/core/middleware/utils/MigrationUtils.d.ts.map +1 -1
- package/build/core/middleware/utils/MigrationUtils.js +1 -77
- package/build/core/middleware/utils/MigrationUtils.js.map +1 -1
- package/build/core/question.d.ts +2 -12
- package/build/core/question.d.ts.map +1 -1
- package/build/core/question.js +14 -236
- package/build/core/question.js.map +1 -1
- package/build/core/types.d.ts +3 -3
- package/build/core/types.d.ts.map +1 -1
- package/build/error/common.d.ts +9 -0
- package/build/error/common.d.ts.map +1 -1
- package/build/error/common.js +39 -1
- package/build/error/common.js.map +1 -1
- package/build/error/script.d.ts +1 -1
- package/build/error/script.d.ts.map +1 -1
- package/build/error/script.js +3 -3
- package/build/error/script.js.map +1 -1
- package/build/index.d.ts +0 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -4
- package/build/index.js.map +1 -1
- package/package.json +12 -28
- package/resource/package.nls.json +10 -97
- package/templates/fallback/common.zip +0 -0
- package/templates/fallback/csharp.zip +0 -0
- package/templates/fallback/js.zip +0 -0
- package/templates/fallback/ts.zip +0 -0
- package/build/common/deps-checker/internal/ngrokChecker.d.ts +0 -27
- package/build/common/deps-checker/internal/ngrokChecker.d.ts.map +0 -1
- package/build/common/deps-checker/internal/ngrokChecker.js +0 -222
- package/build/common/deps-checker/internal/ngrokChecker.js.map +0 -1
- package/build/component/connection/apimConfig.d.ts +0 -11
- package/build/component/connection/apimConfig.d.ts.map +0 -1
- package/build/component/connection/apimConfig.js +0 -44
- package/build/component/connection/apimConfig.js.map +0 -1
- package/build/component/connection/azureFunctionConfig.d.ts +0 -9
- package/build/component/connection/azureFunctionConfig.d.ts.map +0 -1
- package/build/component/connection/azureFunctionConfig.js +0 -25
- package/build/component/connection/azureFunctionConfig.js.map +0 -1
- package/build/component/connection/azureResourceConfig.d.ts +0 -11
- package/build/component/connection/azureResourceConfig.d.ts.map +0 -1
- package/build/component/connection/azureResourceConfig.js +0 -72
- package/build/component/connection/azureResourceConfig.js.map +0 -1
- package/build/component/connection/azureWebAppConfig.d.ts +0 -9
- package/build/component/connection/azureWebAppConfig.d.ts.map +0 -1
- package/build/component/connection/azureWebAppConfig.js +0 -25
- package/build/component/connection/azureWebAppConfig.js.map +0 -1
- package/build/component/coordinator/lifecycleStage.d.ts +0 -2
- package/build/component/coordinator/lifecycleStage.d.ts.map +0 -1
- package/build/component/coordinator/lifecycleStage.js +0 -23
- package/build/component/coordinator/lifecycleStage.js.map +0 -1
- package/build/component/core.d.ts +0 -65
- package/build/component/core.d.ts.map +0 -1
- package/build/component/core.js +0 -653
- package/build/component/core.js.map +0 -1
- package/build/component/debug/util/ngrok.d.ts +0 -6
- package/build/component/debug/util/ngrok.d.ts.map +0 -1
- package/build/component/debug/util/ngrok.js +0 -65
- package/build/component/debug/util/ngrok.js.map +0 -1
- package/build/component/feature/api/api.d.ts +0 -8
- package/build/component/feature/api/api.d.ts.map +0 -1
- package/build/component/feature/api/api.js +0 -188
- package/build/component/feature/api/api.js.map +0 -1
- package/build/component/feature/apiconnector/apiConnector.d.ts +0 -11
- package/build/component/feature/apiconnector/apiConnector.d.ts.map +0 -1
- package/build/component/feature/apiconnector/apiConnector.js +0 -43
- package/build/component/feature/apiconnector/apiConnector.js.map +0 -1
- package/build/component/feature/apim.d.ts +0 -8
- package/build/component/feature/apim.d.ts.map +0 -1
- package/build/component/feature/apim.js +0 -123
- package/build/component/feature/apim.js.map +0 -1
- package/build/component/feature/bot/bot.d.ts +0 -12
- package/build/component/feature/bot/bot.d.ts.map +0 -1
- package/build/component/feature/bot/bot.js +0 -309
- package/build/component/feature/bot/bot.js.map +0 -1
- package/build/component/feature/keyVault.d.ts +0 -16
- package/build/component/feature/keyVault.d.ts.map +0 -1
- package/build/component/feature/keyVault.js +0 -90
- package/build/component/feature/keyVault.js.map +0 -1
- package/build/component/feature/spfx.d.ts +0 -9
- package/build/component/feature/spfx.d.ts.map +0 -1
- package/build/component/feature/spfx.js +0 -121
- package/build/component/feature/spfx.js.map +0 -1
- package/build/component/feature/sql.d.ts +0 -10
- package/build/component/feature/sql.d.ts.map +0 -1
- package/build/component/feature/sql.js +0 -80
- package/build/component/feature/sql.js.map +0 -1
- package/build/component/feature/tab.d.ts +0 -10
- package/build/component/feature/tab.d.ts.map +0 -1
- package/build/component/feature/tab.js +0 -238
- package/build/component/feature/tab.js.map +0 -1
- package/build/component/resource/azureSql/actions/configure.d.ts +0 -15
- package/build/component/resource/azureSql/actions/configure.d.ts.map +0 -1
- package/build/component/resource/azureSql/actions/configure.js +0 -92
- package/build/component/resource/azureSql/actions/configure.js.map +0 -1
- package/build/component/resource/azureSql/actions/provision.d.ts +0 -10
- package/build/component/resource/azureSql/actions/provision.d.ts.map +0 -1
- package/build/component/resource/azureSql/actions/provision.js +0 -63
- package/build/component/resource/azureSql/actions/provision.js.map +0 -1
- package/build/component/resource/azureSql/actions/utils.d.ts +0 -12
- package/build/component/resource/azureSql/actions/utils.d.ts.map +0 -1
- package/build/component/resource/azureSql/actions/utils.js +0 -82
- package/build/component/resource/azureSql/actions/utils.js.map +0 -1
- package/build/component/resource/azureSql/azureSql.d.ts +0 -24
- package/build/component/resource/azureSql/azureSql.d.ts.map +0 -1
- package/build/component/resource/azureSql/azureSql.js +0 -75
- package/build/component/resource/azureSql/azureSql.js.map +0 -1
- package/build/component/resource/azureSql/clients/management.d.ts +0 -18
- package/build/component/resource/azureSql/clients/management.d.ts.map +0 -1
- package/build/component/resource/azureSql/clients/management.js +0 -124
- package/build/component/resource/azureSql/clients/management.js.map +0 -1
- package/build/component/resource/azureSql/clients/sql.d.ts +0 -13
- package/build/component/resource/azureSql/clients/sql.d.ts.map +0 -1
- package/build/component/resource/azureSql/clients/sql.js +0 -153
- package/build/component/resource/azureSql/clients/sql.js.map +0 -1
- package/build/component/resource/azureSql/config.d.ts +0 -7
- package/build/component/resource/azureSql/config.d.ts.map +0 -1
- package/build/component/resource/azureSql/config.js +0 -77
- package/build/component/resource/azureSql/config.js.map +0 -1
- package/build/component/resource/azureSql/constants.d.ts +0 -85
- package/build/component/resource/azureSql/constants.d.ts.map +0 -1
- package/build/component/resource/azureSql/constants.js +0 -95
- package/build/component/resource/azureSql/constants.js.map +0 -1
- package/build/component/resource/azureSql/errors.d.ts +0 -63
- package/build/component/resource/azureSql/errors.d.ts.map +0 -1
- package/build/component/resource/azureSql/errors.js +0 -107
- package/build/component/resource/azureSql/errors.js.map +0 -1
- package/build/component/resource/azureSql/index.d.ts +0 -2
- package/build/component/resource/azureSql/index.d.ts.map +0 -1
- package/build/component/resource/azureSql/index.js +0 -7
- package/build/component/resource/azureSql/index.js.map +0 -1
- package/build/component/resource/azureSql/questions.d.ts +0 -6
- package/build/component/resource/azureSql/questions.d.ts.map +0 -1
- package/build/component/resource/azureSql/questions.js +0 -59
- package/build/component/resource/azureSql/questions.js.map +0 -1
- package/build/component/resource/azureSql/results.d.ts +0 -10
- package/build/component/resource/azureSql/results.d.ts.map +0 -1
- package/build/component/resource/azureSql/results.js +0 -34
- package/build/component/resource/azureSql/results.js.map +0 -1
- package/build/component/resource/azureSql/types.d.ts +0 -12
- package/build/component/resource/azureSql/types.d.ts.map +0 -1
- package/build/component/resource/azureSql/types.js +0 -5
- package/build/component/resource/azureSql/types.js.map +0 -1
- package/build/component/resource/azureSql/utils/checkInput.d.ts +0 -10
- package/build/component/resource/azureSql/utils/checkInput.d.ts.map +0 -1
- package/build/component/resource/azureSql/utils/checkInput.js +0 -89
- package/build/component/resource/azureSql/utils/checkInput.js.map +0 -1
- package/build/component/resource/azureSql/utils/common.d.ts +0 -12
- package/build/component/resource/azureSql/utils/common.d.ts.map +0 -1
- package/build/component/resource/azureSql/utils/common.js +0 -51
- package/build/component/resource/azureSql/utils/common.js.map +0 -1
- package/build/component/resource/identity.d.ts +0 -28
- package/build/component/resource/identity.d.ts.map +0 -1
- package/build/component/resource/identity.js +0 -42
- package/build/component/resource/identity.js.map +0 -1
- package/build/component/resource/keyVault.d.ts +0 -29
- package/build/component/resource/keyVault.d.ts.map +0 -1
- package/build/component/resource/keyVault.js +0 -47
- package/build/component/resource/keyVault.js.map +0 -1
- package/build/component/resource/simpleAuth/constants.d.ts +0 -122
- package/build/component/resource/simpleAuth/constants.d.ts.map +0 -1
- package/build/component/resource/simpleAuth/constants.js +0 -163
- package/build/component/resource/simpleAuth/constants.js.map +0 -1
- package/build/component/resource/simpleAuth/errors.d.ts +0 -17
- package/build/component/resource/simpleAuth/errors.d.ts.map +0 -1
- package/build/component/resource/simpleAuth/errors.js +0 -91
- package/build/component/resource/simpleAuth/errors.js.map +0 -1
- package/build/component/resource/simpleAuth/index.d.ts +0 -12
- package/build/component/resource/simpleAuth/index.d.ts.map +0 -1
- package/build/component/resource/simpleAuth/index.js +0 -115
- package/build/component/resource/simpleAuth/index.js.map +0 -1
- package/build/component/resource/simpleAuth/result.d.ts +0 -9
- package/build/component/resource/simpleAuth/result.d.ts.map +0 -1
- package/build/component/resource/simpleAuth/result.js +0 -35
- package/build/component/resource/simpleAuth/result.js.map +0 -1
- package/build/component/resource/simpleAuth/utils/common.d.ts +0 -23
- package/build/component/resource/simpleAuth/utils/common.d.ts.map +0 -1
- package/build/component/resource/simpleAuth/utils/common.js +0 -150
- package/build/component/resource/simpleAuth/utils/common.js.map +0 -1
- package/build/component/resource/simpleAuth/utils/dialog.d.ts +0 -5
- package/build/component/resource/simpleAuth/utils/dialog.d.ts.map +0 -1
- package/build/component/resource/simpleAuth/utils/dialog.js +0 -7
- package/build/component/resource/simpleAuth/utils/dialog.js.map +0 -1
- package/build/component/resource/simpleAuth/utils/telemetry.d.ts +0 -17
- package/build/component/resource/simpleAuth/utils/telemetry.d.ts.map +0 -1
- package/build/component/resource/simpleAuth/utils/telemetry.js +0 -45
- package/build/component/resource/simpleAuth/utils/telemetry.js.map +0 -1
- package/build/core/dependencyChecker.d.ts +0 -1
- package/build/core/dependencyChecker.d.ts.map +0 -1
- package/build/core/dependencyChecker.js +0 -2
- package/build/core/dependencyChecker.js.map +0 -1
- package/build/core/middleware/CommonErrorHandlerMW.d.ts +0 -14
- package/build/core/middleware/CommonErrorHandlerMW.d.ts.map +0 -1
- package/build/core/middleware/CommonErrorHandlerMW.js +0 -63
- package/build/core/middleware/CommonErrorHandlerMW.js.map +0 -1
- package/build/core/middleware/aadManifestMigration.d.ts +0 -3
- package/build/core/middleware/aadManifestMigration.d.ts.map +0 -1
- package/build/core/middleware/aadManifestMigration.js +0 -119
- package/build/core/middleware/aadManifestMigration.js.map +0 -1
- package/build/core/middleware/consolidateLocalRemote.d.ts +0 -5
- package/build/core/middleware/consolidateLocalRemote.d.ts.map +0 -1
- package/build/core/middleware/consolidateLocalRemote.js +0 -378
- package/build/core/middleware/consolidateLocalRemote.js.map +0 -1
- package/build/core/middleware/envInfoWriter.d.ts +0 -8
- package/build/core/middleware/envInfoWriter.d.ts.map +0 -1
- package/build/core/middleware/envInfoWriter.js +0 -76
- package/build/core/middleware/envInfoWriter.js.map +0 -1
- package/build/core/middleware/envInfoWriterV3.d.ts +0 -6
- package/build/core/middleware/envInfoWriterV3.d.ts.map +0 -1
- package/build/core/middleware/envInfoWriterV3.js +0 -67
- package/build/core/middleware/envInfoWriterV3.js.map +0 -1
- package/build/core/middleware/projectMigrator.d.ts +0 -40
- package/build/core/middleware/projectMigrator.d.ts.map +0 -1
- package/build/core/middleware/projectMigrator.js +0 -1014
- package/build/core/middleware/projectMigrator.js.map +0 -1
- package/build/core/middleware/projectSettingsWriter.d.ts +0 -6
- package/build/core/middleware/projectSettingsWriter.d.ts.map +0 -1
- package/build/core/middleware/projectSettingsWriter.js +0 -52
- package/build/core/middleware/projectSettingsWriter.js.map +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT license.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.UtilFunctions = void 0;
|
|
6
|
-
const tools_1 = require("../../../../common/tools");
|
|
7
|
-
const constants_1 = require("../../../constants");
|
|
8
|
-
const sql_1 = require("../clients/sql");
|
|
9
|
-
const constants_2 = require("../constants");
|
|
10
|
-
const errors_1 = require("../errors");
|
|
11
|
-
const results_1 = require("../results");
|
|
12
|
-
const common_1 = require("../utils/common");
|
|
13
|
-
class UtilFunctions {
|
|
14
|
-
static async CheckAndSetAadAdmin(client, aadAdmin, objectId, tenantId) {
|
|
15
|
-
const existAdmin = await client.existAadAdmin(aadAdmin);
|
|
16
|
-
if (!existAdmin) {
|
|
17
|
-
await client.addAADadmin(tenantId, objectId, aadAdmin);
|
|
18
|
-
}
|
|
19
|
-
return existAdmin;
|
|
20
|
-
}
|
|
21
|
-
static async parseLoginToken(azureAccountProvider) {
|
|
22
|
-
// get login user info to set aad admin in sql
|
|
23
|
-
try {
|
|
24
|
-
const credential = await azureAccountProvider.getIdentityCredentialAsync();
|
|
25
|
-
const token = await credential.getToken(tools_1.AzureScopes);
|
|
26
|
-
const accessToken = token === null || token === void 0 ? void 0 : token.token;
|
|
27
|
-
return common_1.parseToken(accessToken);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
throw results_1.SqlResultFactory.SystemError(errors_1.ErrorMessage.SqlUserInfoError.name, errors_1.ErrorMessage.SqlUserInfoError.message(), error);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
static async getSkipAddingUser(config, azureAccountProvider) {
|
|
34
|
-
const skipAddingUser = config[constants_2.Constants.skipAddingSqlUser];
|
|
35
|
-
if (skipAddingUser === undefined) {
|
|
36
|
-
return (await (azureAccountProvider === null || azureAccountProvider === void 0 ? void 0 : azureAccountProvider.getIdentityCredentialAsync())) ? false : true;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return skipAddingUser;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
static getIdentity(ctx) {
|
|
43
|
-
const config = ctx.envInfo.state[constants_1.ComponentNames.Identity];
|
|
44
|
-
const identity = config[constants_2.Constants.identityName];
|
|
45
|
-
if (!identity) {
|
|
46
|
-
const error = results_1.SqlResultFactory.SystemError(errors_1.ErrorMessage.SqlGetConfigError.name, errors_1.ErrorMessage.SqlGetConfigError.message(constants_2.Constants.identityPlugin, constants_2.Constants.identityName));
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
return identity;
|
|
50
|
-
}
|
|
51
|
-
static async addDatabaseUser(logProvider, sqlClient, managementClient) {
|
|
52
|
-
let retryCount = 0;
|
|
53
|
-
const databaseWithUser = {};
|
|
54
|
-
sqlClient.config.databases.forEach((element) => {
|
|
55
|
-
databaseWithUser[element] = false;
|
|
56
|
-
});
|
|
57
|
-
while (true) {
|
|
58
|
-
try {
|
|
59
|
-
for (const database in databaseWithUser) {
|
|
60
|
-
if (!databaseWithUser[database]) {
|
|
61
|
-
await sqlClient.addDatabaseUser(database);
|
|
62
|
-
databaseWithUser[database] = true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
if (!sql_1.SqlClient.isFireWallError(error === null || error === void 0 ? void 0 : error.innerError) ||
|
|
69
|
-
retryCount >= constants_2.Constants.maxRetryTimes) {
|
|
70
|
-
throw error;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
retryCount++;
|
|
74
|
-
logProvider.warning(`[${constants_2.Constants.pluginName}] Retry adding new firewall rule to access azure sql, because the local IP address has changed after added firewall rule for it. [Retry time: ${retryCount}]`);
|
|
75
|
-
await managementClient.addLocalFirewallRule();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.UtilFunctions = UtilFunctions;
|
|
82
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/component/resource/azureSql/actions/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,oDAAuD;AACvD,kDAAoD;AAEpD,wCAA2C;AAC3C,4CAAyC;AACzC,sCAAyC;AACzC,wCAA8C;AAC9C,4CAAwD;AAExD,MAAa,aAAa;IACxB,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAC9B,MAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,QAAgB;QAEhB,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;SACxD;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,oBAA0C;QACrE,8CAA8C;QAC9C,IAAI;YACF,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,0BAA0B,EAAE,CAAC;YAC3E,MAAM,KAAK,GAAG,MAAM,UAAW,CAAC,QAAQ,CAAC,mBAAW,CAAC,CAAC;YACtD,MAAM,WAAW,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;YACjC,OAAO,mBAAU,CAAC,WAAY,CAAC,CAAC;SACjC;QAAC,OAAO,KAAU,EAAE;YACnB,MAAM,0BAAgB,CAAC,WAAW,CAChC,qBAAY,CAAC,gBAAgB,CAAC,IAAI,EAClC,qBAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,EACvC,KAAK,CACN,CAAC;SACH;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAC5B,MAAY,EACZ,oBAA0C;QAE1C,MAAM,cAAc,GAAG,MAAM,CAAC,qBAAS,CAAC,iBAAiB,CAAC,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C;wBAC1C,gBAAgB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;qBACnC;iBACF;gBACD,OAAO;aACR;YAAC,OAAO,KAAK,EAAE;gBACd,IACE,CAAC,eAAS,CAAC,eAAe,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,CAAC;oBAC7C,UAAU,IAAI,qBAAS,CAAC,aAAa,EACrC;oBACA,MAAM,KAAK,CAAC;iBACb;qBAAM;oBACL,UAAU,EAAE,CAAC;oBACb,WAAW,CAAC,OAAO,CACjB,IAAI,qBAAS,CAAC,UAAU,iJAAiJ,UAAU,GAAG,CACvL,CAAC;oBACF,MAAM,gBAAgB,CAAC,oBAAoB,EAAE,CAAC;iBAC/C;aACF;SACF;IACH,CAAC;CACF;AA1FD,sCA0FC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { FxError, Result, CloudResource, ContextV3, InputsWithProjectPath, Bicep, ResourceContextV3 } from "@microsoft/teamsfx-api";
|
|
2
|
-
import "reflect-metadata";
|
|
3
|
-
export declare class AzureSqlResource implements CloudResource {
|
|
4
|
-
readonly name: string;
|
|
5
|
-
readonly outputs: {
|
|
6
|
-
sqlResourceId: {
|
|
7
|
-
key: string;
|
|
8
|
-
bicepVariable: string;
|
|
9
|
-
};
|
|
10
|
-
sqlEndpoint: {
|
|
11
|
-
key: string;
|
|
12
|
-
bicepVariable: string;
|
|
13
|
-
};
|
|
14
|
-
databaseName: {
|
|
15
|
-
key: string;
|
|
16
|
-
bicepVariable: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
readonly finalOutputKeys: string[];
|
|
20
|
-
generateBicep(context: ContextV3, inputs: InputsWithProjectPath): Promise<Result<Bicep[], FxError>>;
|
|
21
|
-
provision(context: ResourceContextV3, inputs: InputsWithProjectPath): Promise<Result<undefined, FxError>>;
|
|
22
|
-
configure(context: ResourceContextV3, inputs: InputsWithProjectPath): Promise<Result<undefined, FxError>>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=azureSql.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"azureSql.d.ts","sourceRoot":"","sources":["../../../../src/component/resource/azureSql/azureSql.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,OAAO,EAEP,MAAM,EACN,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,KAAK,EACL,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAU1B,qBACa,gBAAiB,YAAW,aAAa;IACpD,QAAQ,CAAC,IAAI,SAA2B;IACxC,QAAQ,CAAC,OAAO;;;;;;;;;;;;;MAAmB;IACnC,QAAQ,CAAC,eAAe,WAAiD;IACnE,aAAa,CACjB,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IA+B9B,SAAS,CACb,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAQhC,SAAS,CACb,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;CAQvC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT license.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.AzureSqlResource = void 0;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
|
-
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
8
|
-
require("reflect-metadata");
|
|
9
|
-
const typedi_1 = require("typedi");
|
|
10
|
-
const constants_1 = require("../../constants");
|
|
11
|
-
const configure_1 = require("./actions/configure");
|
|
12
|
-
const provision_1 = require("./actions/provision");
|
|
13
|
-
const path = tslib_1.__importStar(require("path"));
|
|
14
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
15
|
-
const folder_1 = require("../../../folder");
|
|
16
|
-
const tools_1 = require("../../../common/tools");
|
|
17
|
-
const utils_1 = require("../../utils");
|
|
18
|
-
let AzureSqlResource = class AzureSqlResource {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.name = constants_1.ComponentNames.AzureSQL;
|
|
21
|
-
this.outputs = constants_1.AzureSqlOutputs;
|
|
22
|
-
this.finalOutputKeys = ["sqlResourceId", "endpoint", "databaseName"];
|
|
23
|
-
}
|
|
24
|
-
async generateBicep(context, inputs) {
|
|
25
|
-
const prefix = inputs.provisionType === "database"
|
|
26
|
-
? "azureSql.provisionDatabase"
|
|
27
|
-
: "azureSql.provisionServer";
|
|
28
|
-
const mPath = path.join(folder_1.getTemplatesFolder(), "bicep", `${prefix}.module.bicep`);
|
|
29
|
-
const oPath = path.join(folder_1.getTemplatesFolder(), "bicep", `${prefix}.orchestration.bicep`);
|
|
30
|
-
let module = await fs_extra_1.default.readFile(mPath, "utf-8");
|
|
31
|
-
let orch = await fs_extra_1.default.readFile(oPath, "utf-8");
|
|
32
|
-
const suffix = tools_1.getUuid().substring(0, 6);
|
|
33
|
-
const compileCtx = {
|
|
34
|
-
suffix: suffix,
|
|
35
|
-
};
|
|
36
|
-
if (inputs.provisionType === "database") {
|
|
37
|
-
module = await tools_1.generateBicepFromFile(mPath, compileCtx);
|
|
38
|
-
orch = await tools_1.generateBicepFromFile(oPath, compileCtx);
|
|
39
|
-
}
|
|
40
|
-
const bicep = {
|
|
41
|
-
type: "bicep",
|
|
42
|
-
Provision: {
|
|
43
|
-
Modules: { azureSql: module },
|
|
44
|
-
Orchestration: orch,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
if (inputs.provisionType === "server") {
|
|
48
|
-
bicep.Parameters = await fs_extra_1.default.readJson(path.join(folder_1.getTemplatesFolder(), "bicep", "azureSql.parameters.json"));
|
|
49
|
-
}
|
|
50
|
-
return teamsfx_api_1.ok([bicep]);
|
|
51
|
-
}
|
|
52
|
-
async provision(context, inputs) {
|
|
53
|
-
if (utils_1.isLocalEnv(context)) {
|
|
54
|
-
return teamsfx_api_1.ok(undefined);
|
|
55
|
-
}
|
|
56
|
-
const res = await provision_1.ProvisionActionImplement.execute(context, inputs);
|
|
57
|
-
if (res.isErr())
|
|
58
|
-
return teamsfx_api_1.err(res.error);
|
|
59
|
-
return teamsfx_api_1.ok(undefined);
|
|
60
|
-
}
|
|
61
|
-
async configure(context, inputs) {
|
|
62
|
-
if (utils_1.isLocalEnv(context)) {
|
|
63
|
-
return teamsfx_api_1.ok(undefined);
|
|
64
|
-
}
|
|
65
|
-
const res = await configure_1.ConfigureActionImplement.execute(context, inputs);
|
|
66
|
-
if (res.isErr())
|
|
67
|
-
return teamsfx_api_1.err(res.error);
|
|
68
|
-
return teamsfx_api_1.ok(undefined);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
AzureSqlResource = tslib_1.__decorate([
|
|
72
|
-
typedi_1.Service("azure-sql")
|
|
73
|
-
], AzureSqlResource);
|
|
74
|
-
exports.AzureSqlResource = AzureSqlResource;
|
|
75
|
-
//# sourceMappingURL=azureSql.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"azureSql.js","sourceRoot":"","sources":["../../../../src/component/resource/azureSql/azureSql.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,wDAUgC;AAChC,4BAA0B;AAC1B,mCAAiC;AACjC,+CAAkE;AAClE,mDAA+D;AAC/D,mDAA+D;AAC/D,mDAA6B;AAC7B,gEAA0B;AAC1B,4CAAqD;AACrD,iDAAuE;AACvE,uCAAyC;AAEzC,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAA7B;QACW,SAAI,GAAG,0BAAc,CAAC,QAAQ,CAAC;QAC/B,YAAO,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AG,MAAM,kBAAE,CAAC,QAAQ,CAClC,IAAI,CAAC,IAAI,CAAC,2BAAkB,EAAE,EAAE,OAAO,EAAE,0BAA0B,CAAC,CACrE,CAAC;SACH;QACD,OAAO,gBAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACrB,CAAC;IACD,KAAK,CAAC,SAAS,CACb,OAA0B,EAC1B,MAA6B;QAE7B,IAAI,kBAAU,CAAC,OAAO,CAAC,EAAE;YACvB,OAAO,gBAAE,CAAC,SAAS,CAAC,CAAC;SACtB;QACD,MAAM,GAAG,GAAG,MAAM,oCAAwB,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpE,IAAI,GAAG,CAAC,KAAK,EAAE;YAAE,OAAO,iBAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,OAAO,gBAAE,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC;IACD,KAAK,CAAC,SAAS,CACb,OAA0B,EAC1B,MAA6B;QAE7B,IAAI,kBAAU,CAAC,OAAO,CAAC,EAAE;YACvB,OAAO,gBAAE,CAAC,SAAS,CAAC,CAAC;SACtB;QACD,MAAM,GAAG,GAAG,MAAM,oCAAwB,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpE,IAAI,GAAG,CAAC,KAAK,EAAE;YAAE,OAAO,iBAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,OAAO,gBAAE,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC;CACF,CAAA;AA5DY,gBAAgB;IAD5B,gBAAO,CAAC,WAAW,CAAC;GACR,gBAAgB,CA4D5B;AA5DY,4CAAgB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SqlManagementClient } from "@azure/arm-sql";
|
|
2
|
-
import { AzureAccountProvider } from "@microsoft/teamsfx-api";
|
|
3
|
-
import { ManagementConfig } from "../types";
|
|
4
|
-
export declare class ManagementClient {
|
|
5
|
-
manager: SqlManagementClient;
|
|
6
|
-
config: ManagementConfig;
|
|
7
|
-
totalFirewallRuleCount: number;
|
|
8
|
-
private constructor();
|
|
9
|
-
static create(azureAccountProvider: AzureAccountProvider, config: ManagementConfig): Promise<ManagementClient>;
|
|
10
|
-
existAzureSQL(): Promise<boolean>;
|
|
11
|
-
existAadAdmin(aadAdmin: string): Promise<boolean>;
|
|
12
|
-
addAADadmin(tenantId: string, aadAdminObjectId: string, aadAdmin: string): Promise<void>;
|
|
13
|
-
addLocalFirewallRule(): Promise<void>;
|
|
14
|
-
deleteLocalFirewallRule(): Promise<void>;
|
|
15
|
-
getRuleName(suffix: number): string;
|
|
16
|
-
delay(s: number): Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=management.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"management.d.ts","sourceRoot":"","sources":["../../../../../src/component/resource/azureSql/clients/management.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,qBAAa,gBAAgB;IAC3B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,sBAAsB,SAAK;IAE3B,OAAO;WAKa,MAAM,CACxB,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,gBAAgB,CAAC;IAMtB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAoBjC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBjD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBxF,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAkCrC,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB9C,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI7B,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtC"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT license.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.ManagementClient = void 0;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
|
-
const arm_sql_1 = require("@azure/arm-sql");
|
|
8
|
-
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
9
|
-
const errors_1 = require("../errors");
|
|
10
|
-
const constants_1 = require("../constants");
|
|
11
|
-
const results_1 = require("../results");
|
|
12
|
-
class ManagementClient {
|
|
13
|
-
constructor(manager, config) {
|
|
14
|
-
this.totalFirewallRuleCount = 0;
|
|
15
|
-
this.manager = manager;
|
|
16
|
-
this.config = config;
|
|
17
|
-
}
|
|
18
|
-
static async create(azureAccountProvider, config) {
|
|
19
|
-
const credential = await azureAccountProvider.getIdentityCredentialAsync();
|
|
20
|
-
const manager = new arm_sql_1.SqlManagementClient(credential, config.azureSubscriptionId);
|
|
21
|
-
return new ManagementClient(manager, config);
|
|
22
|
-
}
|
|
23
|
-
async existAzureSQL() {
|
|
24
|
-
try {
|
|
25
|
-
const result = await this.manager.servers.checkNameAvailability({
|
|
26
|
-
name: this.config.sqlServer,
|
|
27
|
-
type: "Microsoft.Sql/servers",
|
|
28
|
-
});
|
|
29
|
-
if (result.available) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
throw results_1.SqlResultFactory.SystemError(errors_1.ErrorMessage.SqlCheckError.name, errors_1.ErrorMessage.SqlCheckError.message(this.config.sqlEndpoint, error.message), error);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async existAadAdmin(aadAdmin) {
|
|
41
|
-
var e_1, _a;
|
|
42
|
-
try {
|
|
43
|
-
try {
|
|
44
|
-
for (var _b = tslib_1.__asyncValues(this.manager.serverAzureADAdministrators
|
|
45
|
-
.listByServer(this.config.resourceGroup, this.config.sqlServer)
|
|
46
|
-
.byPage()), _c; _c = await _b.next(), !_c.done;) {
|
|
47
|
-
const page = _c.value;
|
|
48
|
-
for (const item of page) {
|
|
49
|
-
if (item.login === aadAdmin) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
56
|
-
finally {
|
|
57
|
-
try {
|
|
58
|
-
if (_c && !_c.done && (_a = _b.return)) await _a.call(_b);
|
|
59
|
-
}
|
|
60
|
-
finally { if (e_1) throw e_1.error; }
|
|
61
|
-
}
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
throw results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.SqlCheckAdminError.name, errors_1.ErrorMessage.SqlCheckAdminError.message(this.config.sqlServer, error.message), error);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async addAADadmin(tenantId, aadAdminObjectId, aadAdmin) {
|
|
69
|
-
const model = {
|
|
70
|
-
tenantId: tenantId,
|
|
71
|
-
sid: aadAdminObjectId,
|
|
72
|
-
login: aadAdmin,
|
|
73
|
-
administratorType: arm_sql_1.KnownAdministratorType.ActiveDirectory,
|
|
74
|
-
};
|
|
75
|
-
try {
|
|
76
|
-
await this.manager.serverAzureADAdministrators.beginCreateOrUpdateAndWait(this.config.resourceGroup, this.config.sqlServer, arm_sql_1.KnownAdministratorType.ActiveDirectory, model);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
throw results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.SqlAddAdminError.name, errors_1.ErrorMessage.SqlAddAdminError.message(aadAdmin, error.message), error);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
async addLocalFirewallRule() {
|
|
83
|
-
try {
|
|
84
|
-
const response = await axios_1.default.get(constants_1.Constants.echoIpAddress);
|
|
85
|
-
const localIp = response.data;
|
|
86
|
-
const partials = localIp.split(".");
|
|
87
|
-
partials[2] = constants_1.Constants.ipBeginToken;
|
|
88
|
-
partials[3] = constants_1.Constants.ipBeginToken;
|
|
89
|
-
const startIp = partials.join(".");
|
|
90
|
-
partials[2] = constants_1.Constants.ipEndToken;
|
|
91
|
-
partials[3] = constants_1.Constants.ipEndToken;
|
|
92
|
-
const endIp = partials.join(".");
|
|
93
|
-
const model = {
|
|
94
|
-
startIpAddress: startIp,
|
|
95
|
-
endIpAddress: endIp,
|
|
96
|
-
};
|
|
97
|
-
const ruleName = this.getRuleName(this.totalFirewallRuleCount);
|
|
98
|
-
await this.manager.firewallRules.createOrUpdate(this.config.resourceGroup, this.config.sqlServer, ruleName, model);
|
|
99
|
-
this.totalFirewallRuleCount++;
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
throw results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.SqlLocalFirwallError.name, errors_1.ErrorMessage.SqlLocalFirwallError.message(this.config.sqlEndpoint, error.message), error);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async deleteLocalFirewallRule() {
|
|
106
|
-
try {
|
|
107
|
-
await Promise.all(Array.from(Array(this.totalFirewallRuleCount).keys()).map(async (i) => {
|
|
108
|
-
const ruleName = this.getRuleName(i);
|
|
109
|
-
await this.manager.firewallRules.delete(this.config.resourceGroup, this.config.sqlServer, ruleName);
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
throw results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.SqlDeleteLocalFirwallError.name, errors_1.ErrorMessage.SqlDeleteLocalFirwallError.message(this.config.sqlEndpoint, error.message), error);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
getRuleName(suffix) {
|
|
117
|
-
return constants_1.Constants.firewall.localRule + suffix;
|
|
118
|
-
}
|
|
119
|
-
async delay(s) {
|
|
120
|
-
return new Promise((resolve) => setTimeout(resolve, s * 1000));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
exports.ManagementClient = ManagementClient;
|
|
124
|
-
//# sourceMappingURL=management.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"management.js","sourceRoot":"","sources":["../../../../../src/component/resource/azureSql/clients/management.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,4CAKwB;AACxB,0DAA0B;AAC1B,sCAAyC;AACzC,4CAAyC;AACzC,wCAA8C;AAI9C,MAAa,gBAAgB;IAK3B,YAAoB,OAA4B,EAAE,MAAwB;QAF1E,2BAAsB,GAAG,CAAC,CAAC;QAGzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,MAAM,CACxB,oBAA0C,EAC1C,MAAwB;QAExB,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,0BAA0B,EAAE,CAAC;QAC3E,MAAM,OAAO,GAAG,IAAI,6BAAmB,CAAC,UAAW,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACjF,OAAO,IAAI,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC;gBAC9D,IAAI,EAAE,IAAI,CAAC,MAAM,CAA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c;QACxB,OAAO,qBAAS,CAAC,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,CAAS;QACnB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC;CACF;AAjJD,4CAiJC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AzureAccountProvider } from "@microsoft/teamsfx-api";
|
|
2
|
-
import { SqlConfig } from "../types";
|
|
3
|
-
export declare class SqlClient {
|
|
4
|
-
config: SqlConfig;
|
|
5
|
-
token: string;
|
|
6
|
-
private constructor();
|
|
7
|
-
static create(azureAccountProvider: AzureAccountProvider, config: SqlConfig): Promise<SqlClient>;
|
|
8
|
-
addDatabaseUser(database: string): Promise<void>;
|
|
9
|
-
static initToken(azureAccountProvider: AzureAccountProvider, config: SqlConfig): Promise<string>;
|
|
10
|
-
doQuery(cmd: string, database: string): Promise<any[]>;
|
|
11
|
-
static isFireWallError(error: any): boolean;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=sql.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sql.d.ts","sourceRoot":"","sources":["../../../../../src/component/resource/azureSql/clients/sql.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAI9D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,qBAAa,SAAS;IACpB,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO;WAKM,MAAM,CACjB,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,SAAS,CAAC;IAKf,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WA8CzC,SAAS,CACpB,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,MAAM,CAAC;IAyDZ,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;WA2D9C,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;CAMnD"}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT license.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.SqlClient = void 0;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
|
-
const tedious = tslib_1.__importStar(require("tedious"));
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
const errors_1 = require("../errors");
|
|
10
|
-
const results_1 = require("../results");
|
|
11
|
-
const localizeUtils_1 = require("../../../../common/localizeUtils");
|
|
12
|
-
class SqlClient {
|
|
13
|
-
constructor(config, token) {
|
|
14
|
-
this.config = config;
|
|
15
|
-
this.token = token;
|
|
16
|
-
}
|
|
17
|
-
static async create(azureAccountProvider, config) {
|
|
18
|
-
const token = await SqlClient.initToken(azureAccountProvider, config);
|
|
19
|
-
return new SqlClient(config, token);
|
|
20
|
-
}
|
|
21
|
-
async addDatabaseUser(database) {
|
|
22
|
-
var _a;
|
|
23
|
-
try {
|
|
24
|
-
let query;
|
|
25
|
-
query = `IF NOT EXISTS (SELECT name FROM [sys].[database_principals] WHERE name='${this.config.identity}')
|
|
26
|
-
BEGIN
|
|
27
|
-
CREATE USER [${this.config.identity}] FROM EXTERNAL PROVIDER;
|
|
28
|
-
END;`;
|
|
29
|
-
await this.doQuery(query, database);
|
|
30
|
-
query = `sp_addrolemember 'db_datareader', '${this.config.identity}'`;
|
|
31
|
-
await this.doQuery(query, database);
|
|
32
|
-
query = `sp_addrolemember 'db_datawriter', '${this.config.identity}'`;
|
|
33
|
-
await this.doQuery(query, database);
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
const link = constants_1.HelpLinks.default;
|
|
37
|
-
if ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes(errors_1.ErrorMessage.GuestAdminMessage)) {
|
|
38
|
-
const errorMessage = errors_1.ErrorMessage.DatabaseUserCreateError.message(database, this.config.identity);
|
|
39
|
-
const e = results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.DatabaseUserCreateError.name, [errorMessage[0], errorMessage[1] + `. ${errors_1.ErrorMessage.GuestAdminError}`], error, undefined, link);
|
|
40
|
-
e.message += ` ${errors_1.ErrorMessage.LinkHelpMessage(link)}`;
|
|
41
|
-
throw e;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
const errorMessage = errors_1.ErrorMessage.DatabaseUserCreateError.message(database, this.config.identity);
|
|
45
|
-
const e = results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.DatabaseUserCreateError.name, [errorMessage[0], errorMessage[1] + `. ${localizeUtils_1.getLocalizedString("error.sql.GetDetail")}`], error, undefined, link);
|
|
46
|
-
e.message += ` ${errors_1.ErrorMessage.LinkHelpMessage(link)}`;
|
|
47
|
-
throw e;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
static async initToken(azureAccountProvider, config) {
|
|
52
|
-
var _a;
|
|
53
|
-
const credential = await azureAccountProvider.getIdentityCredentialAsync();
|
|
54
|
-
const databaseNames = `(${config.databases.join(",")})`;
|
|
55
|
-
if (!credential) {
|
|
56
|
-
const link = constants_1.HelpLinks.default;
|
|
57
|
-
const reason = errors_1.ErrorMessage.IdentityCredentialUndefine(config.identity, databaseNames);
|
|
58
|
-
const message = errors_1.ErrorMessage.DatabaseUserCreateError.message(databaseNames, config.identity);
|
|
59
|
-
message[0] += `. ${reason}`;
|
|
60
|
-
message[1] += `. ${reason}`;
|
|
61
|
-
throw results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.DatabaseUserCreateError.name, [message[0] + ` ${errors_1.ErrorMessage.LinkHelpMessage(link)}`, message[1]], undefined, undefined, link);
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
const accessToken = await credential.getToken(constants_1.Constants.azureSqlScope);
|
|
65
|
-
return accessToken.token;
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
const link = constants_1.HelpLinks.default;
|
|
69
|
-
if ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes(errors_1.ErrorMessage.DomainCode)) {
|
|
70
|
-
const errorMessage = errors_1.ErrorMessage.DatabaseUserCreateError.message(databaseNames, config.identity);
|
|
71
|
-
const e = results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.DatabaseUserCreateError.name, [
|
|
72
|
-
errorMessage[0] + `. ${errors_1.ErrorMessage.DomainError}`,
|
|
73
|
-
errorMessage[1] + `. ${errors_1.ErrorMessage.DomainError}`,
|
|
74
|
-
], error, undefined, link);
|
|
75
|
-
e.message += ` ${errors_1.ErrorMessage.LinkHelpMessage(link)}`;
|
|
76
|
-
throw e;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
const errorMessage = errors_1.ErrorMessage.DatabaseUserCreateError.message(databaseNames, config.identity);
|
|
80
|
-
const e = results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.DatabaseUserCreateError.name, [errorMessage[0], errorMessage[1] + `. ${localizeUtils_1.getLocalizedString("error.sql.GetDetail")}`], error, undefined, link);
|
|
81
|
-
e.message += `Reason: ${error.message}. ${errors_1.ErrorMessage.LinkHelpMessage(link)}`;
|
|
82
|
-
throw e;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async doQuery(cmd, database) {
|
|
87
|
-
const config = {
|
|
88
|
-
server: this.config.sqlEndpoint,
|
|
89
|
-
authentication: {
|
|
90
|
-
type: "azure-active-directory-access-token",
|
|
91
|
-
options: {
|
|
92
|
-
token: this.token,
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
options: {
|
|
96
|
-
debug: {
|
|
97
|
-
packet: true,
|
|
98
|
-
data: true,
|
|
99
|
-
payload: true,
|
|
100
|
-
token: false,
|
|
101
|
-
log: true,
|
|
102
|
-
},
|
|
103
|
-
rowCollectionOnDone: true,
|
|
104
|
-
database: database,
|
|
105
|
-
encrypt: true,
|
|
106
|
-
requestTimeout: 30000,
|
|
107
|
-
connectTimeout: 30000,
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
const connection = new tedious.Connection(config);
|
|
111
|
-
return new Promise((resolve, reject) => {
|
|
112
|
-
connection.connect((err) => {
|
|
113
|
-
if (err) {
|
|
114
|
-
reject(err);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
connection.on("connect", (err) => {
|
|
118
|
-
if (err) {
|
|
119
|
-
reject(err);
|
|
120
|
-
}
|
|
121
|
-
const request = new tedious.Request(cmd, (err) => {
|
|
122
|
-
if (err) {
|
|
123
|
-
reject(err);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
let res;
|
|
127
|
-
request.on("doneInProc", function (rowCount, more, rows) {
|
|
128
|
-
res = rows;
|
|
129
|
-
});
|
|
130
|
-
request.on("requestCompleted", () => {
|
|
131
|
-
connection.close();
|
|
132
|
-
resolve(res);
|
|
133
|
-
});
|
|
134
|
-
request.on("error", (error) => {
|
|
135
|
-
reject(error);
|
|
136
|
-
});
|
|
137
|
-
connection.execSql(request);
|
|
138
|
-
});
|
|
139
|
-
connection.on("error", (err) => {
|
|
140
|
-
reject(err);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
static isFireWallError(error) {
|
|
145
|
-
var _a;
|
|
146
|
-
if ((error === null || error === void 0 ? void 0 : error.code) === "ELOGIN" && ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.match(errors_1.ErrorMessage.FirewallErrorReg))) {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
exports.SqlClient = SqlClient;
|
|
153
|
-
//# sourceMappingURL=sql.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sql.js","sourceRoot":"","sources":["../../../../../src/component/resource/azureSql/clients/sql.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,yDAAmC;AACnC,4CAAoD;AAEpD,sCAAyC;AACzC,wCAA8C;AAC9C,oEAAsE;AAGtE,MAAa,SAAS;IAIpB,YAAoB,MAAiB,EAAE,KAAa;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,oBAA0C,EAC1C,MAAiB;QAEjB,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;QACtE,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,QAAgB;;QACpC,IAAI;YACF,IAAI,KAAa,CAAC;YAClB,KAAK,GAAG,2EAA2E,IAAI,CAAC,MAAM,CAAC,QAAQ;;qBAExF,IAAI,CAAC,MAAM,CAAC,QAAQ;WAC9B,CAAC;YACN,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACpC,KAAK,GAAG,sCAAsC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC;YACtE,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACpC,KAAK,GAAG,sCAAsC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC;YACtE,MAAM,IAAI,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E,CAAC,OAAO,EAAE,CAAC,KAAU,EAAE,EAAE;oBACjC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC,CAAC,CAAC;gBACH,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;YACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAQ,EAAE,EAAE;gBAClC,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,KAAU;;QACtC,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,QAAQ,KAAI,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,0CAAE,KAAK,CAAC,qBAAY,CAAC,gBAAgB,CAAC,CAAA,EAAE;YACpF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA5LD,8BA4LC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { v3 } from "@microsoft/teamsfx-api";
|
|
2
|
-
import { ManagementConfig, SqlConfig } from "./types";
|
|
3
|
-
export declare function LoadManagementConfig(state: v3.CloudResource): ManagementConfig;
|
|
4
|
-
export declare function LoadSqlConfig(state: v3.CloudResource, identity: string): SqlConfig;
|
|
5
|
-
export declare function loadDatabases(state: v3.CloudResource): Record<string, string>;
|
|
6
|
-
export declare function removeDatabases(state: v3.CloudResource): void;
|
|
7
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/component/resource/azureSql/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAQ5C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEtD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,GAAG,gBAAgB,CAW9E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAQlF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ7E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,GAAG,IAAI,CAM7D"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT license.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.removeDatabases = exports.loadDatabases = exports.LoadSqlConfig = exports.LoadManagementConfig = void 0;
|
|
6
|
-
const tools_1 = require("../../../common/tools");
|
|
7
|
-
const constants_1 = require("./constants");
|
|
8
|
-
const errors_1 = require("./errors");
|
|
9
|
-
const results_1 = require("./results");
|
|
10
|
-
function LoadManagementConfig(state) {
|
|
11
|
-
const subscriptionId = loadSubscriptionId(state);
|
|
12
|
-
const resourceGroup = loadResourceGroup(state);
|
|
13
|
-
const sqlEndpoint = state[constants_1.Constants.sqlEndpoint];
|
|
14
|
-
const sqlServer = sqlEndpoint.split(".")[0];
|
|
15
|
-
return {
|
|
16
|
-
azureSubscriptionId: subscriptionId,
|
|
17
|
-
resourceGroup: resourceGroup,
|
|
18
|
-
sqlEndpoint: sqlEndpoint,
|
|
19
|
-
sqlServer: sqlServer,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
exports.LoadManagementConfig = LoadManagementConfig;
|
|
23
|
-
function LoadSqlConfig(state, identity) {
|
|
24
|
-
const sqlEndpoint = state[constants_1.Constants.sqlEndpoint];
|
|
25
|
-
const databases = loadDatabases(state);
|
|
26
|
-
return {
|
|
27
|
-
sqlEndpoint: sqlEndpoint,
|
|
28
|
-
identity: identity,
|
|
29
|
-
databases: Object.values(databases),
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
exports.LoadSqlConfig = LoadSqlConfig;
|
|
33
|
-
function loadDatabases(state) {
|
|
34
|
-
const databases = {};
|
|
35
|
-
for (const key of Object.keys(state)) {
|
|
36
|
-
if (key.startsWith(constants_1.Constants.databaseName)) {
|
|
37
|
-
databases[key] = state[key];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return databases;
|
|
41
|
-
}
|
|
42
|
-
exports.loadDatabases = loadDatabases;
|
|
43
|
-
function removeDatabases(state) {
|
|
44
|
-
for (const key of Object.keys(state)) {
|
|
45
|
-
if (key.startsWith(constants_1.Constants.databaseName) && key !== constants_1.Constants.databaseName) {
|
|
46
|
-
delete state[key];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.removeDatabases = removeDatabases;
|
|
51
|
-
function loadSubscriptionId(state) {
|
|
52
|
-
let subscriptionId = "";
|
|
53
|
-
const sqlResourceId = state["sqlResourceId"];
|
|
54
|
-
if (sqlResourceId) {
|
|
55
|
-
try {
|
|
56
|
-
subscriptionId = tools_1.getSubscriptionIdFromResourceId(sqlResourceId);
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
throw results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.SqlInvalidConfigError.name, errors_1.ErrorMessage.SqlInvalidConfigError.message(sqlResourceId, error.message), error);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return subscriptionId;
|
|
63
|
-
}
|
|
64
|
-
function loadResourceGroup(state) {
|
|
65
|
-
let resourceGroup = "";
|
|
66
|
-
const sqlResourceId = state["sqlResourceId"];
|
|
67
|
-
if (sqlResourceId) {
|
|
68
|
-
try {
|
|
69
|
-
resourceGroup = tools_1.getResourceGroupNameFromResourceId(sqlResourceId);
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
throw results_1.SqlResultFactory.UserError(errors_1.ErrorMessage.SqlInvalidConfigError.name, errors_1.ErrorMessage.SqlInvalidConfigError.message(sqlResourceId, error.message), error);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return resourceGroup;
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/component/resource/azureSql/config.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,iDAG+B;AAC/B,2CAAwC;AACxC,qCAAwC;AACxC,uCAA6C;AAG7C,SAAgB,oBAAoB,CAAC,KAAuB;IAC1D,MAAM,cAAc,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,aAAa,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,KAAK,CAAC,qBAAS,CAAC,WAAW,CAAW,CAAC;IAC3D,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,OAAO;QACL,mBAAmB,EAAE,cAAc;QACnC,aAAa,EAAE,aAAa;QAC5B,WAAW,EAAE,WAAW;QACxB,SAAS,EAAE,SAAS;KACrB,CAAC;AACJ,CAAC;AAXD,oDAWC;AAED,SAAgB,aAAa,CAAC,KAAuB,EAAE,QAAgB;IACrE,MAAM,WAAW,GAAG,KAAK,CAAC,qBAAS,CAAC,WAAW,CAAW,CAAC;IAC3D,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO;QACL,WAAW,EAAE,WAAW;QACxB,QAAQ,EAAE,QAAQ;QAClB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;KACpC,CAAC;AACJ,CAAC;AARD,sCAQC;AAED,SAAgB,aAAa,CAAC,KAAuB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