@microsoft/managed-apps-cli 0.19.0 → 0.21.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/LICENSE +17 -149
- package/THIRD-PARTY-NOTICES.txt +9549 -0
- package/dist/AddConnector-4AMM746J.js +41 -0
- package/dist/AuthStatus-ZZIP3LBD.js +11 -0
- package/dist/AuthSwitch-HK7JU2FR.js +13 -0
- package/dist/Bin.js +8 -3
- package/dist/BuildMaafApp-MOTZOLJZ.js +11 -0
- package/dist/Cli-6CCXMCPX.js +54 -0
- package/dist/CreateMaafApp-TUO72CW7.js +20 -0
- package/dist/DeleteMaafApp-MZVGIAX3.js +11 -0
- package/dist/DeployMaafApp-KXATM3E3.js +14 -0
- package/dist/Dev-SHIA5S7X.js +14 -0
- package/dist/EnvironmentVariableAuthenticationProvider-5YTMRAE4.js +11 -0
- package/dist/GetMaafApp-ELB5KMHW.js +11 -0
- package/dist/GetMaafBuildStatus-3W7LI5TJ.js +11 -0
- package/dist/GetSettings-NM6H2U5F.js +11 -0
- package/dist/Init-CH5DUQWA.js +11 -0
- package/dist/ListConnectorActions-7SIFGPYR.js +11 -0
- package/dist/ListConnectors-TRKIWRVQ.js +11 -0
- package/dist/ListMaafApps-RT3PGZSJ.js +11 -0
- package/dist/Login-HG5S7LBC.js +11 -0
- package/dist/Logout-BUPHLOAH.js +11 -0
- package/dist/MockFetch-4CYTSNJ7.js +13 -0
- package/dist/NoOpAuthenticationProvider-DX3XNXF5.js +11 -0
- package/dist/NodeMsalAuthenticationProvider-HTH3V3G2.js +17 -0
- package/dist/Pack-AHKC2MYF.js +8 -0
- package/dist/PlayMaafApp-LWKJU2IN.js +12 -0
- package/dist/RefreshDataSource-ZFZJXJ5L.js +11 -0
- package/dist/RefreshGitAuth-5A3SX2HC.js +11 -0
- package/dist/RemoveDataSource-57JJLK5I.js +14 -0
- package/dist/ServicePrincipalAuthenticationProvider-SVKDZG6X.js +11 -0
- package/dist/SetSetting-RB3F7IXG.js +11 -0
- package/dist/ShareLinkCreate-7BCDPWY6.js +11 -0
- package/dist/ShareLinkList-4BI3WMNN.js +11 -0
- package/dist/ShareLinkRevoke-EEJVCRCY.js +11 -0
- package/dist/ShareList-LJDAEGI3.js +11 -0
- package/dist/ShareMaafApp-QFRXLYUD.js +11 -0
- package/dist/ShowMaafApp-3KK6NUG2.js +11 -0
- package/dist/TelemetrySettings-A474HALH.js +11 -0
- package/dist/UnshareMaafApp-423RNXCN.js +11 -0
- package/dist/acorn-CYBWGE5M.js +23 -0
- package/dist/angular-Q62TJP23.js +11 -0
- package/dist/babel-AOXBHIIS.js +22 -0
- package/dist/chunk-3BRAT6NP.js +11 -0
- package/dist/chunk-3YRE4IQ3.js +132 -0
- package/dist/chunk-5AUOEXAR.js +50 -0
- package/dist/chunk-6FFQN2SO.js +13 -0
- package/dist/chunk-6MXOK2LG.js +11 -0
- package/dist/chunk-7NXJAIJX.js +11 -0
- package/dist/chunk-DREO7EYO.js +20 -0
- package/dist/chunk-EV3TTTOT.js +8 -0
- package/dist/chunk-G33Q5FWT.js +42325 -0
- package/dist/chunk-HBLO3WDD.js +13 -0
- package/dist/chunk-MFPX2RFH.js +11 -0
- package/dist/chunk-NP2KJOYC.js +12 -0
- package/dist/chunk-OL6CTXQR.js +11 -0
- package/dist/chunk-PVAIJSAI.js +11 -0
- package/dist/chunk-QAFCXGBD.js +11 -0
- package/dist/chunk-QSB5P4RM.js +38 -0
- package/dist/chunk-RBG2H562.js +11 -0
- package/dist/chunk-S5HEU7XK.js +11 -0
- package/dist/chunk-TYRVM4PP.js +8 -0
- package/dist/chunk-U36HMOQW.js +77 -0
- package/dist/chunk-UBTSW22U.js +11 -0
- package/dist/chunk-USRRI5H4.js +11 -0
- package/dist/chunk-UT667QSU.js +8 -0
- package/dist/chunk-VFSTQAZ2.js +12 -0
- package/dist/chunk-VNEZZ3RI.js +11 -0
- package/dist/chunk-W7EWOZPO.js +104 -0
- package/dist/chunk-Y5AMO72S.js +10 -0
- package/dist/chunk-YIKNM523.js +15 -0
- package/dist/chunk-YMXXWGRV.js +11 -0
- package/dist/estree-HPTPQIMZ.js +51 -0
- package/dist/flow-B6JUMONE.js +27 -0
- package/dist/glimmer-36KZ3DJ5.js +44 -0
- package/dist/graphql-E6CIFZFV.js +35 -0
- package/dist/html-BUTTPQE6.js +32 -0
- package/dist/markdown-K2C5OZHT.js +69 -0
- package/dist/meriyah-27UE2OSX.js +12 -0
- package/dist/postcss-QUHZLBB7.js +68 -0
- package/dist/typescript-G2G6TDZF.js +28 -0
- package/dist/yaml-W5P5CGFK.js +166 -0
- package/package.json +22 -17
- package/dist/ArgumentProvider.d.ts +0 -144
- package/dist/ArgumentProvider.d.ts.map +0 -1
- package/dist/ArgumentProvider.js +0 -493
- package/dist/ArgumentProvider.js.map +0 -1
- package/dist/Authentication/ActiveAccountStore.d.ts +0 -24
- package/dist/Authentication/ActiveAccountStore.d.ts.map +0 -1
- package/dist/Authentication/ActiveAccountStore.js +0 -54
- package/dist/Authentication/ActiveAccountStore.js.map +0 -1
- package/dist/Authentication/EnvironmentVariableAuthenticationProvider.d.ts +0 -26
- package/dist/Authentication/EnvironmentVariableAuthenticationProvider.d.ts.map +0 -1
- package/dist/Authentication/EnvironmentVariableAuthenticationProvider.js +0 -31
- package/dist/Authentication/EnvironmentVariableAuthenticationProvider.js.map +0 -1
- package/dist/Authentication/NoOpAuthenticationProvider.d.ts +0 -25
- package/dist/Authentication/NoOpAuthenticationProvider.d.ts.map +0 -1
- package/dist/Authentication/NoOpAuthenticationProvider.js +0 -31
- package/dist/Authentication/NoOpAuthenticationProvider.js.map +0 -1
- package/dist/Authentication/NodeMsalAuthenticationProvider.d.ts +0 -103
- package/dist/Authentication/NodeMsalAuthenticationProvider.d.ts.map +0 -1
- package/dist/Authentication/NodeMsalAuthenticationProvider.js +0 -391
- package/dist/Authentication/NodeMsalAuthenticationProvider.js.map +0 -1
- package/dist/Authentication/ServicePrincipalAuthenticationProvider.d.ts +0 -23
- package/dist/Authentication/ServicePrincipalAuthenticationProvider.d.ts.map +0 -1
- package/dist/Authentication/ServicePrincipalAuthenticationProvider.js +0 -60
- package/dist/Authentication/ServicePrincipalAuthenticationProvider.js.map +0 -1
- package/dist/Bin.d.ts +0 -6
- package/dist/Bin.d.ts.map +0 -1
- package/dist/Bin.js.map +0 -1
- package/dist/Cli.d.ts +0 -2
- package/dist/Cli.d.ts.map +0 -1
- package/dist/Cli.js +0 -207
- package/dist/Cli.js.map +0 -1
- package/dist/CliSettings.d.ts +0 -17
- package/dist/CliSettings.d.ts.map +0 -1
- package/dist/CliSettings.js +0 -103
- package/dist/CliSettings.js.map +0 -1
- package/dist/CliUtils.d.ts +0 -100
- package/dist/CliUtils.d.ts.map +0 -1
- package/dist/CliUtils.js +0 -204
- package/dist/CliUtils.js.map +0 -1
- package/dist/Constants/CliConstants.d.ts +0 -6
- package/dist/Constants/CliConstants.d.ts.map +0 -1
- package/dist/Constants/CliConstants.js +0 -6
- package/dist/Constants/CliConstants.js.map +0 -1
- package/dist/Constants/CommandRegistry.d.ts +0 -22
- package/dist/Constants/CommandRegistry.d.ts.map +0 -1
- package/dist/Constants/CommandRegistry.js +0 -245
- package/dist/Constants/CommandRegistry.js.map +0 -1
- package/dist/Constants/HelpStrings.d.ts +0 -432
- package/dist/Constants/HelpStrings.d.ts.map +0 -1
- package/dist/Constants/HelpStrings.js +0 -623
- package/dist/Constants/HelpStrings.js.map +0 -1
- package/dist/Constants.d.ts +0 -18
- package/dist/Constants.d.ts.map +0 -1
- package/dist/Constants.js +0 -41
- package/dist/Constants.js.map +0 -1
- package/dist/Errors/CliError.d.ts +0 -5
- package/dist/Errors/CliError.d.ts.map +0 -1
- package/dist/Errors/CliError.js +0 -7
- package/dist/Errors/CliError.js.map +0 -1
- package/dist/Errors/GitHubErrorMap.d.ts +0 -68
- package/dist/Errors/GitHubErrorMap.d.ts.map +0 -1
- package/dist/Errors/GitHubErrorMap.js +0 -238
- package/dist/Errors/GitHubErrorMap.js.map +0 -1
- package/dist/FS/CliFs.d.ts +0 -41
- package/dist/FS/CliFs.d.ts.map +0 -1
- package/dist/FS/CliFs.js +0 -136
- package/dist/FS/CliFs.js.map +0 -1
- package/dist/HttpClient/CliHttpClient.d.ts +0 -43
- package/dist/HttpClient/CliHttpClient.d.ts.map +0 -1
- package/dist/HttpClient/CliHttpClient.js +0 -320
- package/dist/HttpClient/CliHttpClient.js.map +0 -1
- package/dist/HttpClient/HttpForward.d.ts +0 -9
- package/dist/HttpClient/HttpForward.d.ts.map +0 -1
- package/dist/HttpClient/HttpForward.js +0 -56
- package/dist/HttpClient/HttpForward.js.map +0 -1
- package/dist/Logger/BufferedTelemetryWriter.d.ts +0 -20
- package/dist/Logger/BufferedTelemetryWriter.d.ts.map +0 -1
- package/dist/Logger/BufferedTelemetryWriter.js +0 -163
- package/dist/Logger/BufferedTelemetryWriter.js.map +0 -1
- package/dist/Logger/CliLogger.d.ts +0 -59
- package/dist/Logger/CliLogger.d.ts.map +0 -1
- package/dist/Logger/CliLogger.js +0 -364
- package/dist/Logger/CliLogger.js.map +0 -1
- package/dist/Logger/ConsoleWriter.d.ts +0 -23
- package/dist/Logger/ConsoleWriter.d.ts.map +0 -1
- package/dist/Logger/ConsoleWriter.js +0 -66
- package/dist/Logger/ConsoleWriter.js.map +0 -1
- package/dist/Logger/Constants.d.ts +0 -6
- package/dist/Logger/Constants.d.ts.map +0 -1
- package/dist/Logger/Constants.js +0 -15
- package/dist/Logger/Constants.js.map +0 -1
- package/dist/Logger/LoggerSettings.d.ts +0 -18
- package/dist/Logger/LoggerSettings.d.ts.map +0 -1
- package/dist/Logger/LoggerSettings.js +0 -78
- package/dist/Logger/LoggerSettings.js.map +0 -1
- package/dist/Logger/OneDSWriter.d.ts +0 -26
- package/dist/Logger/OneDSWriter.d.ts.map +0 -1
- package/dist/Logger/OneDSWriter.js +0 -211
- package/dist/Logger/OneDSWriter.js.map +0 -1
- package/dist/Logger/Scrubber/ScrubCustomDimensions.d.ts +0 -5
- package/dist/Logger/Scrubber/ScrubCustomDimensions.d.ts.map +0 -1
- package/dist/Logger/Scrubber/ScrubCustomDimensions.js +0 -46
- package/dist/Logger/Scrubber/ScrubCustomDimensions.js.map +0 -1
- package/dist/Logger/Scrubber/ScrubCustomDimensionsConfig.d.ts +0 -27
- package/dist/Logger/Scrubber/ScrubCustomDimensionsConfig.d.ts.map +0 -1
- package/dist/Logger/Scrubber/ScrubCustomDimensionsConfig.js +0 -168
- package/dist/Logger/Scrubber/ScrubCustomDimensionsConfig.js.map +0 -1
- package/dist/Logger/Scrubber/ScrubUtils.d.ts +0 -8
- package/dist/Logger/Scrubber/ScrubUtils.d.ts.map +0 -1
- package/dist/Logger/Scrubber/ScrubUtils.js +0 -34
- package/dist/Logger/Scrubber/ScrubUtils.js.map +0 -1
- package/dist/Middletier/FunctionsBundler.d.ts +0 -17
- package/dist/Middletier/FunctionsBundler.d.ts.map +0 -1
- package/dist/Middletier/FunctionsBundler.js +0 -169
- package/dist/Middletier/FunctionsBundler.js.map +0 -1
- package/dist/Middletier/PackFunctions.d.ts +0 -53
- package/dist/Middletier/PackFunctions.d.ts.map +0 -1
- package/dist/Middletier/PackFunctions.js +0 -123
- package/dist/Middletier/PackFunctions.js.map +0 -1
- package/dist/Testing/MockFetch.d.ts +0 -23
- package/dist/Testing/MockFetch.d.ts.map +0 -1
- package/dist/Testing/MockFetch.js +0 -177
- package/dist/Testing/MockFetch.js.map +0 -1
- package/dist/Testing/MockRoutes.d.ts +0 -34
- package/dist/Testing/MockRoutes.d.ts.map +0 -1
- package/dist/Testing/MockRoutes.js +0 -226
- package/dist/Testing/MockRoutes.js.map +0 -1
- package/dist/Testing/fixtures/connectors/commondataserviceforapps.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/commondataserviceforapps.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/commondataserviceforapps.js +0 -25
- package/dist/Testing/fixtures/connectors/commondataserviceforapps.js.map +0 -1
- package/dist/Testing/fixtures/connectors/dataverseContactEntity.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/dataverseContactEntity.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/dataverseContactEntity.js +0 -55
- package/dist/Testing/fixtures/connectors/dataverseContactEntity.js.map +0 -1
- package/dist/Testing/fixtures/connectors/excelonlinebusiness.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/excelonlinebusiness.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/excelonlinebusiness.js +0 -1970
- package/dist/Testing/fixtures/connectors/excelonlinebusiness.js.map +0 -1
- package/dist/Testing/fixtures/connectors/kusto.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/kusto.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/kusto.js +0 -1333
- package/dist/Testing/fixtures/connectors/kusto.js.map +0 -1
- package/dist/Testing/fixtures/connectors/msnweather.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/msnweather.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/msnweather.js +0 -917
- package/dist/Testing/fixtures/connectors/msnweather.js.map +0 -1
- package/dist/Testing/fixtures/connectors/office365groups.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/office365groups.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/office365groups.js +0 -2144
- package/dist/Testing/fixtures/connectors/office365groups.js.map +0 -1
- package/dist/Testing/fixtures/connectors/office365users.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/office365users.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/office365users.js +0 -1969
- package/dist/Testing/fixtures/connectors/office365users.js.map +0 -1
- package/dist/Testing/fixtures/connectors/onedriveforbusiness.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/onedriveforbusiness.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/onedriveforbusiness.js +0 -4873
- package/dist/Testing/fixtures/connectors/onedriveforbusiness.js.map +0 -1
- package/dist/Testing/fixtures/connectors/powerappsforappmakers.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/powerappsforappmakers.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/powerappsforappmakers.js +0 -4682
- package/dist/Testing/fixtures/connectors/powerappsforappmakers.js.map +0 -1
- package/dist/Testing/fixtures/connectors/sharepointTestListMetadata.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/sharepointTestListMetadata.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/sharepointTestListMetadata.js +0 -1078
- package/dist/Testing/fixtures/connectors/sharepointTestListMetadata.js.map +0 -1
- package/dist/Testing/fixtures/connectors/sharepointonline.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/sharepointonline.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/sharepointonline.js +0 -28
- package/dist/Testing/fixtures/connectors/sharepointonline.js.map +0 -1
- package/dist/Testing/fixtures/connectors/teams.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/teams.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/teams.js +0 -9987
- package/dist/Testing/fixtures/connectors/teams.js.map +0 -1
- package/dist/Testing/fixtures/connectors/translatorv2.d.ts +0 -6
- package/dist/Testing/fixtures/connectors/translatorv2.d.ts.map +0 -1
- package/dist/Testing/fixtures/connectors/translatorv2.js +0 -307
- package/dist/Testing/fixtures/connectors/translatorv2.js.map +0 -1
- package/dist/Testing/fixtures/index.d.ts +0 -23
- package/dist/Testing/fixtures/index.d.ts.map +0 -1
- package/dist/Testing/fixtures/index.js +0 -96
- package/dist/Testing/fixtures/index.js.map +0 -1
- package/dist/Types/Argument.types.d.ts +0 -28
- package/dist/Types/Argument.types.d.ts.map +0 -1
- package/dist/Types/Argument.types.js +0 -5
- package/dist/Types/Argument.types.js.map +0 -1
- package/dist/Types/Cli.types.d.ts +0 -82
- package/dist/Types/Cli.types.d.ts.map +0 -1
- package/dist/Types/Cli.types.js +0 -5
- package/dist/Types/Cli.types.js.map +0 -1
- package/dist/Types/Command.types.d.ts +0 -69
- package/dist/Types/Command.types.d.ts.map +0 -1
- package/dist/Types/Command.types.js +0 -20
- package/dist/Types/Command.types.js.map +0 -1
- package/dist/Types/Datasource.types.d.ts +0 -30
- package/dist/Types/Datasource.types.d.ts.map +0 -1
- package/dist/Types/Datasource.types.js +0 -5
- package/dist/Types/Datasource.types.js.map +0 -1
- package/dist/Types/LoggerTypes.types.d.ts +0 -18
- package/dist/Types/LoggerTypes.types.d.ts.map +0 -1
- package/dist/Types/LoggerTypes.types.js +0 -5
- package/dist/Types/LoggerTypes.types.js.map +0 -1
- package/dist/Utils/BuildPolling.d.ts +0 -43
- package/dist/Utils/BuildPolling.d.ts.map +0 -1
- package/dist/Utils/BuildPolling.js +0 -139
- package/dist/Utils/BuildPolling.js.map +0 -1
- package/dist/Utils/BuildVerbDescriptionTable.d.ts +0 -29
- package/dist/Utils/BuildVerbDescriptionTable.d.ts.map +0 -1
- package/dist/Utils/BuildVerbDescriptionTable.js +0 -147
- package/dist/Utils/BuildVerbDescriptionTable.js.map +0 -1
- package/dist/Utils/CoerceCliVersion.d.ts +0 -27
- package/dist/Utils/CoerceCliVersion.d.ts.map +0 -1
- package/dist/Utils/CoerceCliVersion.js +0 -67
- package/dist/Utils/CoerceCliVersion.js.map +0 -1
- package/dist/Utils/ConnectorIds.d.ts +0 -12
- package/dist/Utils/ConnectorIds.d.ts.map +0 -1
- package/dist/Utils/ConnectorIds.js +0 -20
- package/dist/Utils/ConnectorIds.js.map +0 -1
- package/dist/Utils/ConsoleOutput.d.ts +0 -86
- package/dist/Utils/ConsoleOutput.d.ts.map +0 -1
- package/dist/Utils/ConsoleOutput.js +0 -162
- package/dist/Utils/ConsoleOutput.js.map +0 -1
- package/dist/Utils/DcfRecovery.d.ts +0 -84
- package/dist/Utils/DcfRecovery.d.ts.map +0 -1
- package/dist/Utils/DcfRecovery.js +0 -246
- package/dist/Utils/DcfRecovery.js.map +0 -1
- package/dist/Utils/DetectPackageManager.d.ts +0 -9
- package/dist/Utils/DetectPackageManager.d.ts.map +0 -1
- package/dist/Utils/DetectPackageManager.js +0 -24
- package/dist/Utils/DetectPackageManager.js.map +0 -1
- package/dist/Utils/DownloadTemplate.d.ts +0 -45
- package/dist/Utils/DownloadTemplate.d.ts.map +0 -1
- package/dist/Utils/DownloadTemplate.js +0 -161
- package/dist/Utils/DownloadTemplate.js.map +0 -1
- package/dist/Utils/EnhanceNetworkError.d.ts +0 -14
- package/dist/Utils/EnhanceNetworkError.d.ts.map +0 -1
- package/dist/Utils/EnhanceNetworkError.js +0 -61
- package/dist/Utils/EnhanceNetworkError.js.map +0 -1
- package/dist/Utils/EnvVars.d.ts +0 -17
- package/dist/Utils/EnvVars.d.ts.map +0 -1
- package/dist/Utils/EnvVars.js +0 -38
- package/dist/Utils/EnvVars.js.map +0 -1
- package/dist/Utils/EnvironmentRoutingUtils.d.ts +0 -81
- package/dist/Utils/EnvironmentRoutingUtils.d.ts.map +0 -1
- package/dist/Utils/EnvironmentRoutingUtils.js +0 -204
- package/dist/Utils/EnvironmentRoutingUtils.js.map +0 -1
- package/dist/Utils/FindAvailablePort.d.ts +0 -39
- package/dist/Utils/FindAvailablePort.d.ts.map +0 -1
- package/dist/Utils/FindAvailablePort.js +0 -105
- package/dist/Utils/FindAvailablePort.js.map +0 -1
- package/dist/Utils/GitCredentialConfig.d.ts +0 -12
- package/dist/Utils/GitCredentialConfig.d.ts.map +0 -1
- package/dist/Utils/GitCredentialConfig.js +0 -32
- package/dist/Utils/GitCredentialConfig.js.map +0 -1
- package/dist/Utils/GitErrorClassifier.d.ts +0 -40
- package/dist/Utils/GitErrorClassifier.d.ts.map +0 -1
- package/dist/Utils/GitErrorClassifier.js +0 -120
- package/dist/Utils/GitErrorClassifier.js.map +0 -1
- package/dist/Utils/GitHubDcfFlow.d.ts +0 -59
- package/dist/Utils/GitHubDcfFlow.d.ts.map +0 -1
- package/dist/Utils/GitHubDcfFlow.js +0 -165
- package/dist/Utils/GitHubDcfFlow.js.map +0 -1
- package/dist/Utils/GitRunner.d.ts +0 -107
- package/dist/Utils/GitRunner.d.ts.map +0 -1
- package/dist/Utils/GitRunner.js +0 -89
- package/dist/Utils/GitRunner.js.map +0 -1
- package/dist/Utils/GitUtils.d.ts +0 -43
- package/dist/Utils/GitUtils.d.ts.map +0 -1
- package/dist/Utils/GitUtils.js +0 -120
- package/dist/Utils/GitUtils.js.map +0 -1
- package/dist/Utils/GitVersionChecker.d.ts +0 -38
- package/dist/Utils/GitVersionChecker.d.ts.map +0 -1
- package/dist/Utils/GitVersionChecker.js +0 -64
- package/dist/Utils/GitVersionChecker.js.map +0 -1
- package/dist/Utils/HelpBanner.d.ts +0 -11
- package/dist/Utils/HelpBanner.d.ts.map +0 -1
- package/dist/Utils/HelpBanner.js +0 -15
- package/dist/Utils/HelpBanner.js.map +0 -1
- package/dist/Utils/MaafAppConfig.d.ts +0 -24
- package/dist/Utils/MaafAppConfig.d.ts.map +0 -1
- package/dist/Utils/MaafAppConfig.js +0 -38
- package/dist/Utils/MaafAppConfig.js.map +0 -1
- package/dist/Utils/NodeVersionChecker.d.ts +0 -10
- package/dist/Utils/NodeVersionChecker.d.ts.map +0 -1
- package/dist/Utils/NodeVersionChecker.js +0 -21
- package/dist/Utils/NodeVersionChecker.js.map +0 -1
- package/dist/Utils/Paging.d.ts +0 -29
- package/dist/Utils/Paging.d.ts.map +0 -1
- package/dist/Utils/Paging.js +0 -102
- package/dist/Utils/Paging.js.map +0 -1
- package/dist/Utils/PinCli.d.ts +0 -33
- package/dist/Utils/PinCli.d.ts.map +0 -1
- package/dist/Utils/PinCli.js +0 -77
- package/dist/Utils/PinCli.js.map +0 -1
- package/dist/Utils/ReadPackageJson.d.ts +0 -9
- package/dist/Utils/ReadPackageJson.d.ts.map +0 -1
- package/dist/Utils/ReadPackageJson.js +0 -13
- package/dist/Utils/ReadPackageJson.js.map +0 -1
- package/dist/Utils/RepoDetails.d.ts +0 -29
- package/dist/Utils/RepoDetails.d.ts.map +0 -1
- package/dist/Utils/RepoDetails.js +0 -37
- package/dist/Utils/RepoDetails.js.map +0 -1
- package/dist/Utils/RepoOption.d.ts +0 -42
- package/dist/Utils/RepoOption.d.ts.map +0 -1
- package/dist/Utils/RepoOption.js +0 -63
- package/dist/Utils/RepoOption.js.map +0 -1
- package/dist/Utils/RepoUrl.d.ts +0 -18
- package/dist/Utils/RepoUrl.d.ts.map +0 -1
- package/dist/Utils/RepoUrl.js +0 -6
- package/dist/Utils/RepoUrl.js.map +0 -1
- package/dist/Utils/ResolveCommand.d.ts +0 -62
- package/dist/Utils/ResolveCommand.d.ts.map +0 -1
- package/dist/Utils/ResolveCommand.js +0 -141
- package/dist/Utils/ResolveCommand.js.map +0 -1
- package/dist/Utils/RunCommand.d.ts +0 -33
- package/dist/Utils/RunCommand.d.ts.map +0 -1
- package/dist/Utils/RunCommand.js +0 -83
- package/dist/Utils/RunCommand.js.map +0 -1
- package/dist/Utils/ShareAccessRouting.d.ts +0 -78
- package/dist/Utils/ShareAccessRouting.d.ts.map +0 -1
- package/dist/Utils/ShareAccessRouting.js +0 -93
- package/dist/Utils/ShareAccessRouting.js.map +0 -1
- package/dist/Utils/Spinner.d.ts +0 -23
- package/dist/Utils/Spinner.d.ts.map +0 -1
- package/dist/Utils/Spinner.js +0 -94
- package/dist/Utils/Spinner.js.map +0 -1
- package/dist/Utils/zipBuildArtifact.d.ts +0 -35
- package/dist/Utils/zipBuildArtifact.d.ts.map +0 -1
- package/dist/Utils/zipBuildArtifact.js +0 -100
- package/dist/Utils/zipBuildArtifact.js.map +0 -1
- package/dist/Verbs/AddAction.d.ts +0 -6
- package/dist/Verbs/AddAction.d.ts.map +0 -1
- package/dist/Verbs/AddAction.js +0 -58
- package/dist/Verbs/AddAction.js.map +0 -1
- package/dist/Verbs/AddConnector.d.ts +0 -26
- package/dist/Verbs/AddConnector.d.ts.map +0 -1
- package/dist/Verbs/AddConnector.js +0 -222
- package/dist/Verbs/AddConnector.js.map +0 -1
- package/dist/Verbs/AddConnectorFlows.d.ts +0 -97
- package/dist/Verbs/AddConnectorFlows.d.ts.map +0 -1
- package/dist/Verbs/AddConnectorFlows.js +0 -298
- package/dist/Verbs/AddConnectorFlows.js.map +0 -1
- package/dist/Verbs/AddDataSource.d.ts +0 -18
- package/dist/Verbs/AddDataSource.d.ts.map +0 -1
- package/dist/Verbs/AddDataSource.js +0 -162
- package/dist/Verbs/AddDataSource.js.map +0 -1
- package/dist/Verbs/AddFlow.d.ts +0 -12
- package/dist/Verbs/AddFlow.d.ts.map +0 -1
- package/dist/Verbs/AddFlow.js +0 -62
- package/dist/Verbs/AddFlow.js.map +0 -1
- package/dist/Verbs/AddTable.d.ts +0 -6
- package/dist/Verbs/AddTable.d.ts.map +0 -1
- package/dist/Verbs/AddTable.js +0 -78
- package/dist/Verbs/AddTable.js.map +0 -1
- package/dist/Verbs/AuthStatus.d.ts +0 -6
- package/dist/Verbs/AuthStatus.d.ts.map +0 -1
- package/dist/Verbs/AuthStatus.js +0 -49
- package/dist/Verbs/AuthStatus.js.map +0 -1
- package/dist/Verbs/AuthSwitch.d.ts +0 -6
- package/dist/Verbs/AuthSwitch.d.ts.map +0 -1
- package/dist/Verbs/AuthSwitch.js +0 -67
- package/dist/Verbs/AuthSwitch.js.map +0 -1
- package/dist/Verbs/BuildMaafApp.d.ts +0 -6
- package/dist/Verbs/BuildMaafApp.d.ts.map +0 -1
- package/dist/Verbs/BuildMaafApp.js +0 -172
- package/dist/Verbs/BuildMaafApp.js.map +0 -1
- package/dist/Verbs/ConnectorHelpers.d.ts +0 -164
- package/dist/Verbs/ConnectorHelpers.d.ts.map +0 -1
- package/dist/Verbs/ConnectorHelpers.js +0 -563
- package/dist/Verbs/ConnectorHelpers.js.map +0 -1
- package/dist/Verbs/CreateMaafApp.d.ts +0 -107
- package/dist/Verbs/CreateMaafApp.d.ts.map +0 -1
- package/dist/Verbs/CreateMaafApp.js +0 -1081
- package/dist/Verbs/CreateMaafApp.js.map +0 -1
- package/dist/Verbs/DeleteMaafApp.d.ts +0 -27
- package/dist/Verbs/DeleteMaafApp.d.ts.map +0 -1
- package/dist/Verbs/DeleteMaafApp.js +0 -114
- package/dist/Verbs/DeleteMaafApp.js.map +0 -1
- package/dist/Verbs/DeployMaafApp.d.ts +0 -6
- package/dist/Verbs/DeployMaafApp.d.ts.map +0 -1
- package/dist/Verbs/DeployMaafApp.js +0 -495
- package/dist/Verbs/DeployMaafApp.js.map +0 -1
- package/dist/Verbs/Dev.d.ts +0 -6
- package/dist/Verbs/Dev.d.ts.map +0 -1
- package/dist/Verbs/Dev.js +0 -276
- package/dist/Verbs/Dev.js.map +0 -1
- package/dist/Verbs/FindDataverseApi.d.ts +0 -12
- package/dist/Verbs/FindDataverseApi.d.ts.map +0 -1
- package/dist/Verbs/FindDataverseApi.js +0 -87
- package/dist/Verbs/FindDataverseApi.js.map +0 -1
- package/dist/Verbs/GetMaafApp.d.ts +0 -6
- package/dist/Verbs/GetMaafApp.d.ts.map +0 -1
- package/dist/Verbs/GetMaafApp.js +0 -80
- package/dist/Verbs/GetMaafApp.js.map +0 -1
- package/dist/Verbs/GetMaafBuildStatus.d.ts +0 -6
- package/dist/Verbs/GetMaafBuildStatus.d.ts.map +0 -1
- package/dist/Verbs/GetMaafBuildStatus.js +0 -132
- package/dist/Verbs/GetMaafBuildStatus.js.map +0 -1
- package/dist/Verbs/GetSettings.d.ts +0 -12
- package/dist/Verbs/GetSettings.d.ts.map +0 -1
- package/dist/Verbs/GetSettings.js +0 -39
- package/dist/Verbs/GetSettings.js.map +0 -1
- package/dist/Verbs/Init.d.ts +0 -6
- package/dist/Verbs/Init.d.ts.map +0 -1
- package/dist/Verbs/Init.js +0 -426
- package/dist/Verbs/Init.js.map +0 -1
- package/dist/Verbs/ListConnectionReferences.d.ts +0 -6
- package/dist/Verbs/ListConnectionReferences.d.ts.map +0 -1
- package/dist/Verbs/ListConnectionReferences.js +0 -56
- package/dist/Verbs/ListConnectionReferences.js.map +0 -1
- package/dist/Verbs/ListConnectorActions.d.ts +0 -6
- package/dist/Verbs/ListConnectorActions.d.ts.map +0 -1
- package/dist/Verbs/ListConnectorActions.js +0 -87
- package/dist/Verbs/ListConnectorActions.js.map +0 -1
- package/dist/Verbs/ListConnectors.d.ts +0 -6
- package/dist/Verbs/ListConnectors.d.ts.map +0 -1
- package/dist/Verbs/ListConnectors.js +0 -91
- package/dist/Verbs/ListConnectors.js.map +0 -1
- package/dist/Verbs/ListDatasets.d.ts +0 -6
- package/dist/Verbs/ListDatasets.d.ts.map +0 -1
- package/dist/Verbs/ListDatasets.js +0 -73
- package/dist/Verbs/ListDatasets.js.map +0 -1
- package/dist/Verbs/ListEnvironmentVariables.d.ts +0 -14
- package/dist/Verbs/ListEnvironmentVariables.d.ts.map +0 -1
- package/dist/Verbs/ListEnvironmentVariables.js +0 -52
- package/dist/Verbs/ListEnvironmentVariables.js.map +0 -1
- package/dist/Verbs/ListFlows.d.ts +0 -13
- package/dist/Verbs/ListFlows.d.ts.map +0 -1
- package/dist/Verbs/ListFlows.js +0 -73
- package/dist/Verbs/ListFlows.js.map +0 -1
- package/dist/Verbs/ListMaafApps.d.ts +0 -84
- package/dist/Verbs/ListMaafApps.d.ts.map +0 -1
- package/dist/Verbs/ListMaafApps.js +0 -221
- package/dist/Verbs/ListMaafApps.js.map +0 -1
- package/dist/Verbs/ListSqlStoredProcedures.d.ts +0 -6
- package/dist/Verbs/ListSqlStoredProcedures.d.ts.map +0 -1
- package/dist/Verbs/ListSqlStoredProcedures.js +0 -75
- package/dist/Verbs/ListSqlStoredProcedures.js.map +0 -1
- package/dist/Verbs/ListTables.d.ts +0 -6
- package/dist/Verbs/ListTables.d.ts.map +0 -1
- package/dist/Verbs/ListTables.js +0 -85
- package/dist/Verbs/ListTables.js.map +0 -1
- package/dist/Verbs/Login.d.ts +0 -6
- package/dist/Verbs/Login.d.ts.map +0 -1
- package/dist/Verbs/Login.js +0 -39
- package/dist/Verbs/Login.js.map +0 -1
- package/dist/Verbs/Logout.d.ts +0 -6
- package/dist/Verbs/Logout.d.ts.map +0 -1
- package/dist/Verbs/Logout.js +0 -34
- package/dist/Verbs/Logout.js.map +0 -1
- package/dist/Verbs/MaafAppPermissions.d.ts +0 -40
- package/dist/Verbs/MaafAppPermissions.d.ts.map +0 -1
- package/dist/Verbs/MaafAppPermissions.js +0 -651
- package/dist/Verbs/MaafAppPermissions.js.map +0 -1
- package/dist/Verbs/Pack.d.ts +0 -71
- package/dist/Verbs/Pack.d.ts.map +0 -1
- package/dist/Verbs/Pack.js +0 -370
- package/dist/Verbs/Pack.js.map +0 -1
- package/dist/Verbs/PlayMaafApp.d.ts +0 -22
- package/dist/Verbs/PlayMaafApp.d.ts.map +0 -1
- package/dist/Verbs/PlayMaafApp.js +0 -147
- package/dist/Verbs/PlayMaafApp.js.map +0 -1
- package/dist/Verbs/RefreshDataSource.d.ts +0 -21
- package/dist/Verbs/RefreshDataSource.d.ts.map +0 -1
- package/dist/Verbs/RefreshDataSource.js +0 -87
- package/dist/Verbs/RefreshDataSource.js.map +0 -1
- package/dist/Verbs/RefreshGitAuth.d.ts +0 -6
- package/dist/Verbs/RefreshGitAuth.d.ts.map +0 -1
- package/dist/Verbs/RefreshGitAuth.js +0 -155
- package/dist/Verbs/RefreshGitAuth.js.map +0 -1
- package/dist/Verbs/RemoveDataSource.d.ts +0 -6
- package/dist/Verbs/RemoveDataSource.d.ts.map +0 -1
- package/dist/Verbs/RemoveDataSource.js +0 -172
- package/dist/Verbs/RemoveDataSource.js.map +0 -1
- package/dist/Verbs/RemoveFlow.d.ts +0 -12
- package/dist/Verbs/RemoveFlow.d.ts.map +0 -1
- package/dist/Verbs/RemoveFlow.js +0 -94
- package/dist/Verbs/RemoveFlow.js.map +0 -1
- package/dist/Verbs/SetSetting.d.ts +0 -12
- package/dist/Verbs/SetSetting.d.ts.map +0 -1
- package/dist/Verbs/SetSetting.js +0 -131
- package/dist/Verbs/SetSetting.js.map +0 -1
- package/dist/Verbs/ShareLinkCreate.d.ts +0 -23
- package/dist/Verbs/ShareLinkCreate.d.ts.map +0 -1
- package/dist/Verbs/ShareLinkCreate.js +0 -73
- package/dist/Verbs/ShareLinkCreate.js.map +0 -1
- package/dist/Verbs/ShareLinkList.d.ts +0 -16
- package/dist/Verbs/ShareLinkList.d.ts.map +0 -1
- package/dist/Verbs/ShareLinkList.js +0 -84
- package/dist/Verbs/ShareLinkList.js.map +0 -1
- package/dist/Verbs/ShareLinkRevoke.d.ts +0 -22
- package/dist/Verbs/ShareLinkRevoke.d.ts.map +0 -1
- package/dist/Verbs/ShareLinkRevoke.js +0 -137
- package/dist/Verbs/ShareLinkRevoke.js.map +0 -1
- package/dist/Verbs/ShareList.d.ts +0 -10
- package/dist/Verbs/ShareList.d.ts.map +0 -1
- package/dist/Verbs/ShareList.js +0 -254
- package/dist/Verbs/ShareList.js.map +0 -1
- package/dist/Verbs/ShareMaafApp.d.ts +0 -12
- package/dist/Verbs/ShareMaafApp.d.ts.map +0 -1
- package/dist/Verbs/ShareMaafApp.js +0 -14
- package/dist/Verbs/ShareMaafApp.js.map +0 -1
- package/dist/Verbs/ShowMaafApp.d.ts +0 -100
- package/dist/Verbs/ShowMaafApp.d.ts.map +0 -1
- package/dist/Verbs/ShowMaafApp.js +0 -224
- package/dist/Verbs/ShowMaafApp.js.map +0 -1
- package/dist/Verbs/TelemetrySettings.d.ts +0 -8
- package/dist/Verbs/TelemetrySettings.d.ts.map +0 -1
- package/dist/Verbs/TelemetrySettings.js +0 -104
- package/dist/Verbs/TelemetrySettings.js.map +0 -1
- package/dist/Verbs/UnshareMaafApp.d.ts +0 -12
- package/dist/Verbs/UnshareMaafApp.d.ts.map +0 -1
- package/dist/Verbs/UnshareMaafApp.js +0 -14
- package/dist/Verbs/UnshareMaafApp.js.map +0 -1
- package/dist/Verbs/VerbConstants.d.ts +0 -628
- package/dist/Verbs/VerbConstants.d.ts.map +0 -1
- package/dist/Verbs/VerbConstants.js +0 -557
- package/dist/Verbs/VerbConstants.js.map +0 -1
- package/dist/Verbs/index.d.ts +0 -47
- package/dist/Verbs/index.d.ts.map +0 -1
- package/dist/Verbs/index.js +0 -47
- package/dist/Verbs/index.js.map +0 -1
|
@@ -1,651 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import { GrsRepositoryContributorRoleName, infoAsync, MaafAppContributorRoleName, MaafAppReaderRoleName, modifyGrsRoleAssignmentsAsync, modifyMaafRoleAssignmentsAsync, resolvePrincipalByEmailAsync, unshareGrsRepoByPrincipalsAsync, unshareMaafAppByPrincipalsAsync, } from '@microsoft/managed-apps-actions';
|
|
5
|
-
import { AppConfigFileName } from '@microsoft/managed-apps-common/config';
|
|
6
|
-
import { HttpClientError } from '@microsoft/managed-apps-common/services';
|
|
7
|
-
import { getCliLogger, getSettings } from '../CliSettings.js';
|
|
8
|
-
import { isGuid, resolveAppNameAsync, resolveEnvironmentId } from '../CliUtils.js';
|
|
9
|
-
import { CLI_BINARY_NAME } from '../Constants/CliConstants.js';
|
|
10
|
-
import { HelpStrings } from '../Constants/HelpStrings.js';
|
|
11
|
-
import { UsageError } from '../Errors/CliError.js';
|
|
12
|
-
import { printInfo, printJsonSuccess, printSuccess, printWarning } from '../Utils/ConsoleOutput.js';
|
|
13
|
-
import { toRepoDetails } from '../Utils/RepoDetails.js';
|
|
14
|
-
import { externalRepositoryWarning, noRepositoryLinkedMessage, parseAccessLevel, resolveAppForEditAsync, resolveRepoType, } from '../Utils/ShareAccessRouting.js';
|
|
15
|
-
import { ShareMaafAppArguments, UnshareMaafAppArguments } from './VerbConstants.js';
|
|
16
|
-
/**
|
|
17
|
-
* Implements `ms app share` and `ms app unshare` — adds or removes role
|
|
18
|
-
* assignments for AAD principals (users or groups) at either the MAAF app
|
|
19
|
-
* scope (play access) or the GRS repository scope (edit access), driven by
|
|
20
|
-
* the `--access` flag.
|
|
21
|
-
*
|
|
22
|
-
* Pipeline:
|
|
23
|
-
* 1. Register option schema for the chosen mode and run the verb (so `--help`
|
|
24
|
-
* works outside an init'd project).
|
|
25
|
-
* 2. Require a loaded `ms.config.json`.
|
|
26
|
-
* 3. Resolve `environmentId` (`--environment-id` flag wins; otherwise from config),
|
|
27
|
-
* tenantId, and the requested access level (`--access play|edit`, default `play`).
|
|
28
|
-
* 4. Read the comma- or whitespace-separated principals positionals and resolve each entry:
|
|
29
|
-
* - GUID-shaped inputs pass through unchanged.
|
|
30
|
-
* - For app-scope share (`play`, or `edit` on a non-native repo), email-shaped
|
|
31
|
-
* inputs are passed straight through on `principal.email`.
|
|
32
|
-
* - For the GRS share path and every unshare path, email-shaped inputs are
|
|
33
|
-
* resolved to AAD object ids via Graph.
|
|
34
|
-
* 5. Dispatch to the matching share/unshare path:
|
|
35
|
-
* - `play` → MAAF `modifyRoleAssignments` (`MicrosoftAppReader` at app scope).
|
|
36
|
-
* - `edit` + `repoType === 'native'` → fetch the app's `repositoryId` then
|
|
37
|
-
* GRS `modifyRoleAssignments` (`RepositoryContributor` at repo scope).
|
|
38
|
-
* - `edit` + `repoType === 'none' | 'github'` → MAAF `modifyRoleAssignments`
|
|
39
|
-
* (`MicrosoftAppContributor` at app scope); GRS is skipped because the
|
|
40
|
-
* platform does not manage the repository.
|
|
41
|
-
* For unshare, paginate the matching list endpoint and pass through the
|
|
42
|
-
* full `RoleAssignment[]` records on `delete` (the strict wire contract
|
|
43
|
-
* requires `roleAssignmentId`, which only the list endpoint provides).
|
|
44
|
-
* 6. Emit JSON or a human summary.
|
|
45
|
-
*/
|
|
46
|
-
export async function executeMaafAppPermissionsAsync(argumentProvider, mode) {
|
|
47
|
-
configureOptionSchema(argumentProvider, mode);
|
|
48
|
-
await argumentProvider.runVerb();
|
|
49
|
-
const cliSettings = getSettings();
|
|
50
|
-
if (!cliSettings.appConfig) {
|
|
51
|
-
throw new UsageError(`No ${AppConfigFileName} found in the current directory. Run "${CLI_BINARY_NAME} app init" first.`);
|
|
52
|
-
}
|
|
53
|
-
// `resolveEnvironmentId` enforces flag-wins precedence and pushes the resolved
|
|
54
|
-
// id into player services so the URL builder targets the override.
|
|
55
|
-
const environmentId = await resolveEnvironmentId(argumentProvider);
|
|
56
|
-
const tenantId = await argumentProvider.getTenantIdAsync();
|
|
57
|
-
if (!tenantId) {
|
|
58
|
-
throw new UsageError('Unable to determine tenant ID. Ensure you are logged in.');
|
|
59
|
-
}
|
|
60
|
-
const appName = await resolveAppNameAsync(argumentProvider);
|
|
61
|
-
const access = parseAccessLevel(await argumentProvider.getOption('access'));
|
|
62
|
-
// `repoType` only affects edit routing. For play we should never fail on the
|
|
63
|
-
// strict migration check for legacy config shape.
|
|
64
|
-
const repoType = access === 'edit'
|
|
65
|
-
? resolveRepoType(cliSettings.appConfig)
|
|
66
|
-
: (cliSettings.appConfig.repoType ?? 'none');
|
|
67
|
-
const inputs = parseInputs(argumentProvider.getPositionalArgs(0));
|
|
68
|
-
if (inputs.length === 0) {
|
|
69
|
-
throw new UsageError('Provide at least one user or group (AAD object ID or email address). Separate multiple entries with commas, spaces, or both.');
|
|
70
|
-
}
|
|
71
|
-
const emailPassthrough = mode === 'share' && (access === 'play' || repoType !== 'native');
|
|
72
|
-
// Top-level scenario that ties together every server call the verb makes:
|
|
73
|
-
// Graph principal resolution (`ResolvePrincipalByEmail` per email, skipped on
|
|
74
|
-
// the email-passthrough share path), optional app-info fetch (`GetMaafApp`)
|
|
75
|
-
// when the edit path needs the `repositoryId`, and the final modify call (one
|
|
76
|
-
// of `ModifyMaafRoleAssignments`, `ModifyGrsRepositoryRoleAssignments`,
|
|
77
|
-
// `UnshareMaafAppByPrincipals`, or `UnshareGrsRepoByPrincipals`). Each of those
|
|
78
|
-
// actions already emits its own wire-scoped scenario; this scenario captures
|
|
79
|
-
// the verb-level outcome plus the routing decision (scope/role) so we can
|
|
80
|
-
// correlate. All properties are PII-safe — counts and routing flags only, no
|
|
81
|
-
// emails / GUIDs / app names.
|
|
82
|
-
const logger = getCliLogger();
|
|
83
|
-
const scenario = logger.trackScenario('MaafApp.SharePermissions', {
|
|
84
|
-
mode,
|
|
85
|
-
access,
|
|
86
|
-
repoType,
|
|
87
|
-
inputCount: inputs.length,
|
|
88
|
-
});
|
|
89
|
-
try {
|
|
90
|
-
// Failures (bad shape, no Graph match, transport error) are collected here so
|
|
91
|
-
// we can warn the user but still proceed with the entries that resolved.
|
|
92
|
-
const failures = [];
|
|
93
|
-
const refs = await resolveAllAsync(inputs, failures, emailPassthrough);
|
|
94
|
-
// Verb-level summary of the principal resolution fan-out. On the Graph paths
|
|
95
|
-
// each underlying lookup also emits a `ResolvePrincipalByEmail` scenario; on
|
|
96
|
-
// the email-passthrough share path no Graph call is made and entries resolve
|
|
97
|
-
// locally. This event makes the aggregate result queryable per invocation.
|
|
98
|
-
logger.trackActivityEvent('MaafApp.SharePermissions.PrincipalResolution', {
|
|
99
|
-
mode,
|
|
100
|
-
inputCount: inputs.length,
|
|
101
|
-
resolvedCount: refs.length,
|
|
102
|
-
failedCount: failures.length,
|
|
103
|
-
emailPassthrough,
|
|
104
|
-
});
|
|
105
|
-
// If nothing resolved, the operation has no inputs to apply — abort with a
|
|
106
|
-
// single error listing every failure rather than calling the RP with an empty
|
|
107
|
-
// array.
|
|
108
|
-
if (refs.length === 0) {
|
|
109
|
-
throw new UsageError(formatFailures(failures));
|
|
110
|
-
}
|
|
111
|
-
// Otherwise warn about the unresolved entries up front (so they're visible
|
|
112
|
-
// before the success line), then proceed with the resolved subset.
|
|
113
|
-
if (failures.length > 0) {
|
|
114
|
-
printWarning(formatFailures(failures));
|
|
115
|
-
}
|
|
116
|
-
const dispatch = mode === 'share' ? shareDispatchAsync : unshareDispatchAsync;
|
|
117
|
-
const outcome = await dispatch({
|
|
118
|
-
tenantId,
|
|
119
|
-
environmentId,
|
|
120
|
-
appName,
|
|
121
|
-
access,
|
|
122
|
-
refs,
|
|
123
|
-
repoType,
|
|
124
|
-
jsonMode: argumentProvider.isJsonMode(),
|
|
125
|
-
});
|
|
126
|
-
scenario.complete({
|
|
127
|
-
resolvedCount: refs.length,
|
|
128
|
-
failedResolutionCount: failures.length,
|
|
129
|
-
scope: outcome.scope,
|
|
130
|
-
role: outcome.role,
|
|
131
|
-
// App-scope contributor fallback for `edit` is the noteworthy routing
|
|
132
|
-
// case introduced for non-native `repoType`. Tagged here so it's a
|
|
133
|
-
// simple boolean filter on the success event.
|
|
134
|
-
appScopeContributorFallback: access === 'edit' && outcome.scope === 'app',
|
|
135
|
-
...(mode === 'unshare' && {
|
|
136
|
-
revokedCount: outcome.revokedCount ?? 0,
|
|
137
|
-
revokedPrincipalCount: outcome.revokedPrincipalCount ?? 0,
|
|
138
|
-
notFoundCount: outcome.notFound?.length ?? 0,
|
|
139
|
-
skippedCount: outcome.skipped?.length ?? 0,
|
|
140
|
-
}),
|
|
141
|
-
});
|
|
142
|
-
// After a successful edit (write) share, surface the backing repository's
|
|
143
|
-
// classification and clone URL so the newly-granted contributor knows where
|
|
144
|
-
// the source lives and how to clone it. Best-effort: the share already
|
|
145
|
-
// succeeded, so a failure to read the app info must not fail the command.
|
|
146
|
-
const repoDetails = mode === 'share' && access === 'edit'
|
|
147
|
-
? await resolveRepoDetailsAsync({
|
|
148
|
-
appInfo: outcome.appInfo,
|
|
149
|
-
tenantId,
|
|
150
|
-
environmentId,
|
|
151
|
-
appName,
|
|
152
|
-
jsonMode: argumentProvider.isJsonMode(),
|
|
153
|
-
})
|
|
154
|
-
: undefined;
|
|
155
|
-
if (argumentProvider.isJsonMode()) {
|
|
156
|
-
// Envelope semantics for this verb: `success: true` means the modify call
|
|
157
|
-
// reached the RP and returned. When some inputs failed to resolve before
|
|
158
|
-
// the modify, `partialFailure` is `true` and `warnings` lists the
|
|
159
|
-
// unresolved entries. Consumers requiring full success must check both
|
|
160
|
-
// `success === true && partialFailure === false`. `warnings` is always
|
|
161
|
-
// present (empty array on full success) so consumers can treat its
|
|
162
|
-
// length uniformly. The server response is spread flat into the envelope
|
|
163
|
-
// (matching every other verb that emits JSON) instead of nested under a
|
|
164
|
-
// `result` key. For unshare we also include the action-layer bookkeeping
|
|
165
|
-
// (`revokedCount`, `revokedPrincipalCount`, `notFound`, `skipped`) that
|
|
166
|
-
// would otherwise only appear in the human summary — so automation gets
|
|
167
|
-
// the same fidelity as text mode.
|
|
168
|
-
printJsonSuccess({
|
|
169
|
-
access,
|
|
170
|
-
partialFailure: failures.length > 0,
|
|
171
|
-
...outcome.result,
|
|
172
|
-
...(mode === 'unshare' && {
|
|
173
|
-
revokedCount: outcome.revokedCount ?? 0,
|
|
174
|
-
revokedPrincipalCount: outcome.revokedPrincipalCount ?? 0,
|
|
175
|
-
notFound: (outcome.notFound ?? []).map(toJsonRef),
|
|
176
|
-
skipped: (outcome.skipped ?? []).map(toJsonRef),
|
|
177
|
-
}),
|
|
178
|
-
...(repoDetails && {
|
|
179
|
-
repoType: repoDetails.repoType,
|
|
180
|
-
cloneUrl: repoDetails.cloneUrl,
|
|
181
|
-
}),
|
|
182
|
-
warnings: failures,
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
printSummary({ appName, mode, access, inputCount: refs.length, outcome });
|
|
187
|
-
printRepoDetails(repoDetails);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
scenario.failure(error);
|
|
192
|
-
throw error;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
async function shareDispatchAsync(inputs) {
|
|
196
|
-
const { tenantId, environmentId, appName, access, refs, repoType, jsonMode } = inputs;
|
|
197
|
-
if (access === 'play') {
|
|
198
|
-
const entries = refs.map((r) => toMaafPermissionEntry(r, MaafAppReaderRoleName));
|
|
199
|
-
const result = await modifyMaafRoleAssignmentsAsync({
|
|
200
|
-
tenantId,
|
|
201
|
-
environmentId,
|
|
202
|
-
logger: getCliLogger(),
|
|
203
|
-
actionsParams: { appName, put: entries, delete: [] },
|
|
204
|
-
});
|
|
205
|
-
return { result, scope: 'app', role: MaafAppReaderRoleName };
|
|
206
|
-
}
|
|
207
|
-
// access === 'edit': route by repoType.
|
|
208
|
-
if (repoType === 'none') {
|
|
209
|
-
throw new UsageError(noRepositoryLinkedMessage);
|
|
210
|
-
}
|
|
211
|
-
if (repoType !== 'native') {
|
|
212
|
-
// The app has no platform-managed repository, so grant contributor access
|
|
213
|
-
// at the app scope instead of going through GRS.
|
|
214
|
-
if (!jsonMode) {
|
|
215
|
-
printWarning(externalRepositoryWarning);
|
|
216
|
-
}
|
|
217
|
-
const entries = refs.map((r) => toMaafPermissionEntry(r, MaafAppContributorRoleName));
|
|
218
|
-
const result = await modifyMaafRoleAssignmentsAsync({
|
|
219
|
-
tenantId,
|
|
220
|
-
environmentId,
|
|
221
|
-
logger: getCliLogger(),
|
|
222
|
-
actionsParams: { appName, put: entries, delete: [] },
|
|
223
|
-
});
|
|
224
|
-
return { result, scope: 'app', role: MaafAppContributorRoleName };
|
|
225
|
-
}
|
|
226
|
-
const app = await resolveAppForEditAsync({ tenantId, environmentId, appName });
|
|
227
|
-
const entries = refs.map(toGrsPermissionEntry);
|
|
228
|
-
const result = await modifyGrsRoleAssignmentsAsync({
|
|
229
|
-
tenantId,
|
|
230
|
-
environmentId,
|
|
231
|
-
logger: getCliLogger(),
|
|
232
|
-
actionsParams: { repoId: app.repositoryId, put: entries, delete: [] },
|
|
233
|
-
});
|
|
234
|
-
return { result, scope: 'repo', role: GrsRepositoryContributorRoleName, appInfo: app };
|
|
235
|
-
}
|
|
236
|
-
async function unshareDispatchAsync(inputs) {
|
|
237
|
-
const { tenantId, environmentId, appName, access, refs, repoType, jsonMode } = inputs;
|
|
238
|
-
// Unshare never uses email passthrough, so every ref carries a resolved id.
|
|
239
|
-
const principalIds = refs.map(requirePrincipalIdForUnshare);
|
|
240
|
-
const refsByPrincipalId = new Map(refs.map((r) => [requirePrincipalIdForUnshare(r), r]));
|
|
241
|
-
if (access === 'edit' && repoType === 'none') {
|
|
242
|
-
throw new UsageError(noRepositoryLinkedMessage);
|
|
243
|
-
}
|
|
244
|
-
const useAppScope = access === 'play' || repoType !== 'native';
|
|
245
|
-
const role = useAppScope
|
|
246
|
-
? access === 'play'
|
|
247
|
-
? MaafAppReaderRoleName
|
|
248
|
-
: MaafAppContributorRoleName
|
|
249
|
-
: GrsRepositoryContributorRoleName;
|
|
250
|
-
let actionResult;
|
|
251
|
-
if (useAppScope) {
|
|
252
|
-
if (access === 'edit' && repoType !== 'native') {
|
|
253
|
-
if (!jsonMode) {
|
|
254
|
-
printWarning(externalRepositoryWarning);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
actionResult = await unshareMaafAppByPrincipalsAsync({
|
|
258
|
-
tenantId,
|
|
259
|
-
environmentId,
|
|
260
|
-
logger: getCliLogger(),
|
|
261
|
-
actionsParams: {
|
|
262
|
-
appName,
|
|
263
|
-
principalIds,
|
|
264
|
-
roleDefinitionName: role,
|
|
265
|
-
},
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
const app = await resolveAppForEditAsync({ tenantId, environmentId, appName });
|
|
270
|
-
actionResult = await unshareGrsRepoByPrincipalsAsync({
|
|
271
|
-
tenantId,
|
|
272
|
-
environmentId,
|
|
273
|
-
logger: getCliLogger(),
|
|
274
|
-
actionsParams: { repoId: app.repositoryId, principalIds },
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
return {
|
|
278
|
-
result: actionResult.result,
|
|
279
|
-
scope: useAppScope ? 'app' : 'repo',
|
|
280
|
-
role,
|
|
281
|
-
revokedCount: actionResult.revokedCount,
|
|
282
|
-
revokedPrincipalCount: actionResult.revokedPrincipalCount,
|
|
283
|
-
notFound: actionResult.notFoundPrincipalIds.map((id) => refsByPrincipalId.get(id) ?? { id, input: id }),
|
|
284
|
-
skipped: actionResult.skippedNullRoleAssignments.map((s) => refsByPrincipalId.get(s.principalObjectId) ??
|
|
285
|
-
{ id: s.principalObjectId, input: s.principalObjectId }),
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
function requirePrincipalIdForUnshare(ref) {
|
|
289
|
-
if (!ref.id) {
|
|
290
|
-
throw new UsageError(`Could not resolve '${ref.input}' to an AAD object ID. Unshare requires object IDs.`);
|
|
291
|
-
}
|
|
292
|
-
return ref.id;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Best-effort resolution of the app's repository details
|
|
296
|
-
*/
|
|
297
|
-
async function resolveRepoDetailsAsync(args) {
|
|
298
|
-
let app = args.appInfo;
|
|
299
|
-
if (!app) {
|
|
300
|
-
try {
|
|
301
|
-
app = await infoAsync({
|
|
302
|
-
tenantId: args.tenantId,
|
|
303
|
-
environmentId: args.environmentId,
|
|
304
|
-
logger: getCliLogger(),
|
|
305
|
-
actionsParams: { appName: args.appName },
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
catch (error) {
|
|
309
|
-
if (!args.jsonMode) {
|
|
310
|
-
printWarning(`Share succeeded, but repository details for '${args.appName}' could not be read.`);
|
|
311
|
-
}
|
|
312
|
-
return undefined;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return toRepoDetails(app);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Prints the repository details after a successful edit
|
|
319
|
-
* share (text mode only). No-op when there are no details to surface.
|
|
320
|
-
*/
|
|
321
|
-
function printRepoDetails(details) {
|
|
322
|
-
if (!details) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
if (details.repoType) {
|
|
326
|
-
printInfo(`Repo type: ${details.repoType}`);
|
|
327
|
-
}
|
|
328
|
-
if (details.cloneUrl) {
|
|
329
|
-
printInfo(`Clone URL: ${details.cloneUrl}`);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Splits variadic positional values on commas into a deduplicated, trimmed list
|
|
334
|
-
* of inputs. The shell handles whitespace separation, while this function handles
|
|
335
|
-
* compact comma-separated values and commas followed by spaces. Empty segments
|
|
336
|
-
* (trailing commas, whitespace-only entries) are dropped.
|
|
337
|
-
*/
|
|
338
|
-
function parseInputs(rawValues) {
|
|
339
|
-
const seen = new Set();
|
|
340
|
-
for (const rawValue of rawValues) {
|
|
341
|
-
for (const segment of rawValue.split(',')) {
|
|
342
|
-
const trimmed = segment.trim();
|
|
343
|
-
if (trimmed)
|
|
344
|
-
seen.add(trimmed);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
return [...seen];
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Resolves a list of principal inputs to {@link ResolvedRef}s. GUIDs pass
|
|
351
|
-
* through unchanged. Email-shaped inputs are handled one of two ways:
|
|
352
|
-
*
|
|
353
|
-
* - `emailPassthrough === true` (app-scope share): the email is carried
|
|
354
|
-
* verbatim on the ref (`{ input, email }`, no `id`).
|
|
355
|
-
* - `emailPassthrough === false` (GRS share, any unshare): the email is
|
|
356
|
-
* resolved to an AAD object id via Microsoft Graph.
|
|
357
|
-
*
|
|
358
|
-
* Per-entry failures (malformed input, no Graph match, transport error like a
|
|
359
|
-
* 403 on the group lookup) are pushed to the shared `failures` array rather than
|
|
360
|
-
* throwing, so one bad entry doesn't kill an otherwise-valid batch.
|
|
361
|
-
*
|
|
362
|
-
* Graph resolution runs in parallel (`Promise.all`), with an in-flight map
|
|
363
|
-
* coalescing concurrent requests for the same email. The cache deduplicates
|
|
364
|
-
* within a single invocation (e.g. the same email listed twice round-trips Graph
|
|
365
|
-
* once).
|
|
366
|
-
*/
|
|
367
|
-
async function resolveAllAsync(inputs, failures, emailPassthrough) {
|
|
368
|
-
const cache = new Map();
|
|
369
|
-
const inFlight = new Map();
|
|
370
|
-
const settled = await Promise.all(inputs.map(async (input) => {
|
|
371
|
-
const cacheKey = input.toLowerCase();
|
|
372
|
-
const hit = cache.get(cacheKey);
|
|
373
|
-
if (hit)
|
|
374
|
-
return hit;
|
|
375
|
-
if (isGuid(input)) {
|
|
376
|
-
const ref = { id: input, input };
|
|
377
|
-
cache.set(cacheKey, ref);
|
|
378
|
-
return ref;
|
|
379
|
-
}
|
|
380
|
-
if (!looksLikeEmail(input)) {
|
|
381
|
-
failures.push({
|
|
382
|
-
input,
|
|
383
|
-
reason: 'not an AAD object ID (GUID) or a valid email address',
|
|
384
|
-
});
|
|
385
|
-
return null;
|
|
386
|
-
}
|
|
387
|
-
if (emailPassthrough) {
|
|
388
|
-
const ref = { input, email: input };
|
|
389
|
-
cache.set(cacheKey, ref);
|
|
390
|
-
return ref;
|
|
391
|
-
}
|
|
392
|
-
try {
|
|
393
|
-
let resolution = inFlight.get(cacheKey);
|
|
394
|
-
if (!resolution) {
|
|
395
|
-
resolution = resolvePrincipalByEmailAsync(input, getCliLogger());
|
|
396
|
-
inFlight.set(cacheKey, resolution);
|
|
397
|
-
}
|
|
398
|
-
const resolved = await resolution;
|
|
399
|
-
if (!resolved) {
|
|
400
|
-
failures.push({
|
|
401
|
-
input,
|
|
402
|
-
reason: 'no user or group found in this tenant (invite as a guest in Entra ID first if external)',
|
|
403
|
-
});
|
|
404
|
-
return null;
|
|
405
|
-
}
|
|
406
|
-
const ref = {
|
|
407
|
-
id: resolved.id,
|
|
408
|
-
input,
|
|
409
|
-
type: resolved.type,
|
|
410
|
-
email: input,
|
|
411
|
-
displayName: resolved.displayName,
|
|
412
|
-
};
|
|
413
|
-
cache.set(cacheKey, ref);
|
|
414
|
-
return ref;
|
|
415
|
-
}
|
|
416
|
-
catch (error) {
|
|
417
|
-
failures.push({
|
|
418
|
-
input,
|
|
419
|
-
reason: extractGraphErrorMessage(error),
|
|
420
|
-
});
|
|
421
|
-
return null;
|
|
422
|
-
}
|
|
423
|
-
}));
|
|
424
|
-
const resolved = settled.filter((r) => r !== null);
|
|
425
|
-
// Collapse duplicate refs that survived the concurrent fan-out.
|
|
426
|
-
const deduped = [];
|
|
427
|
-
const seenKeys = new Set();
|
|
428
|
-
for (const ref of resolved) {
|
|
429
|
-
const key = (ref.id ?? ref.email ?? ref.input).toLowerCase();
|
|
430
|
-
if (seenKeys.has(key))
|
|
431
|
-
continue;
|
|
432
|
-
seenKeys.add(key);
|
|
433
|
-
deduped.push(ref);
|
|
434
|
-
}
|
|
435
|
-
return deduped;
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Renders the failure list as a single multi-line message. The intro line
|
|
439
|
-
* leads with the count so users skimming a long warning see the impact first.
|
|
440
|
-
*/
|
|
441
|
-
function formatFailures(failures) {
|
|
442
|
-
const noun = failures.length === 1 ? 'entry' : 'entries';
|
|
443
|
-
const lines = failures.map((f) => ` - ${f.input}: ${f.reason}`);
|
|
444
|
-
return [`Could not resolve ${failures.length} ${noun}:`, ...lines].join('\n');
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Extracts the meaningful piece of a Graph HTTP error and formats it as
|
|
448
|
-
* `Graph <status>: <message>`.
|
|
449
|
-
*
|
|
450
|
-
* Prefers the structured fields on {@link HttpClientError} (`status` + JSON-parsed `body`),
|
|
451
|
-
* which removes the dependency on `err.message`'s exact format and decouples this code from
|
|
452
|
-
* which `IHttpClient` implementation produced the error. For anything else (plain `Error`,
|
|
453
|
-
* non-Graph response shape, body parse failure), falls back to the raw message so we never
|
|
454
|
-
* lose information.
|
|
455
|
-
*/
|
|
456
|
-
function extractGraphErrorMessage(error) {
|
|
457
|
-
if (error instanceof HttpClientError) {
|
|
458
|
-
// A 403 from Graph is a consent/permission problem with the caller's
|
|
459
|
-
// sign-in, not a bad principal. Echoing Graph's opaque "Insufficient
|
|
460
|
-
// privileges to complete the operation" under the "Could not resolve
|
|
461
|
-
// <email>" heading misleads users into thinking the email is wrong, so we
|
|
462
|
-
// replace it with an actionable message naming the real cause and the
|
|
463
|
-
// ways forward. See {@link formatGraphPermissionError}.
|
|
464
|
-
if (error.status === 403) {
|
|
465
|
-
return formatGraphPermissionError(error.status);
|
|
466
|
-
}
|
|
467
|
-
const message = extractGraphMessageFromBody(error.body);
|
|
468
|
-
if (message !== undefined) {
|
|
469
|
-
return `Graph ${error.status}: ${message}`;
|
|
470
|
-
}
|
|
471
|
-
return error.message;
|
|
472
|
-
}
|
|
473
|
-
return error instanceof Error ? error.message : String(error);
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Builds the actionable reason for a Graph 403 hit during principal resolution.
|
|
477
|
-
* The email→object-id lookup needs the `User.ReadBasic.All` and
|
|
478
|
-
* `Group.Read.All` delegated Graph permissions; a 403 means the active
|
|
479
|
-
* account's token doesn't carry them in this tenant (consent was never
|
|
480
|
-
* granted). Rather than surface Graph's opaque "Insufficient privileges", we
|
|
481
|
-
* name the cause and the two ways forward: get those permissions consented, or
|
|
482
|
-
* skip the lookup entirely by passing the AAD object ID (GUID) instead of an
|
|
483
|
-
* email.
|
|
484
|
-
*/
|
|
485
|
-
function formatGraphPermissionError(status) {
|
|
486
|
-
return (`Graph ${status}: your sign-in lacks permission to look up accounts by email. ` +
|
|
487
|
-
`Pass the AAD object ID (GUID) instead, or have an admin grant the ` +
|
|
488
|
-
`User.ReadBasic.All and Group.Read.All Graph permissions.`);
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Parses a Graph error body string and returns the inner `error.message`. Returns
|
|
492
|
-
* `undefined` if the body is missing, not valid JSON, or doesn't carry the
|
|
493
|
-
* `{ error: { message } }` shape. Pulled out as a top-level function so the
|
|
494
|
-
* unit tests can exercise it without constructing an `HttpClientError`.
|
|
495
|
-
*/
|
|
496
|
-
function extractGraphMessageFromBody(body) {
|
|
497
|
-
if (!body)
|
|
498
|
-
return undefined;
|
|
499
|
-
try {
|
|
500
|
-
const parsed = JSON.parse(body);
|
|
501
|
-
const message = parsed?.error?.message;
|
|
502
|
-
return typeof message === 'string' ? message : undefined;
|
|
503
|
-
}
|
|
504
|
-
catch {
|
|
505
|
-
return undefined;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
/**
|
|
509
|
-
* Cheap pre-flight check that an input looks like an email address. We do not
|
|
510
|
-
* try to be RFC-5321 compliant — the goal is to surface obvious typos
|
|
511
|
-
* (`foo@`, `@bar`, `a@b@c`, `a@b`) as a `UsageError` naming the bad input,
|
|
512
|
-
* rather than letting Graph reject them with an opaque 400.
|
|
513
|
-
*/
|
|
514
|
-
function looksLikeEmail(input) {
|
|
515
|
-
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(input);
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Builds a `MaafAppPermission` from a resolved reference. The `name` field is a
|
|
519
|
-
* display label echoed back unchanged on the response — we prefer the friendly
|
|
520
|
-
* displayName from Graph, fall back to the original input (which for the
|
|
521
|
-
* email-passthrough path is the email itself).
|
|
522
|
-
|
|
523
|
-
*/
|
|
524
|
-
function toMaafPermissionEntry(ref, role) {
|
|
525
|
-
return {
|
|
526
|
-
name: ref.displayName ?? ref.input,
|
|
527
|
-
properties: {
|
|
528
|
-
roleName: role,
|
|
529
|
-
principal: buildMaafPrincipal(ref),
|
|
530
|
-
},
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
/**
|
|
534
|
-
* Maps a {@link ResolvedRef} to a {@link MaafPrincipal}. Prefers the AAD object
|
|
535
|
-
* id when present; otherwise emits an email-only principal for the server to
|
|
536
|
-
* resolve. `resolveAllAsync` guarantees at least one of `id`/`email` is set, so
|
|
537
|
-
* the final `email` is always defined when `id` is absent.
|
|
538
|
-
*/
|
|
539
|
-
function buildMaafPrincipal(ref) {
|
|
540
|
-
if (ref.id) {
|
|
541
|
-
return ref.email ? { id: ref.id, email: ref.email } : { id: ref.id };
|
|
542
|
-
}
|
|
543
|
-
return { email: ref.email ?? ref.input };
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Builds a `GrsRepoPermission` from a resolved reference for the `edit` access
|
|
547
|
-
* path. Mirrors {@link toMaafPermissionEntry} — same `name` semantics, same
|
|
548
|
-
* principal id passthrough — but targets the `RepositoryContributor` role
|
|
549
|
-
* at the GRS repository scope. The GRS `GrsPrincipal` shape has no `email`
|
|
550
|
-
* field (PPAuthZ only consumes the object id), so the email is dropped here
|
|
551
|
-
* even when the user originally provided one.
|
|
552
|
-
*/
|
|
553
|
-
function toGrsPermissionEntry(ref) {
|
|
554
|
-
// The GRS share path only runs for native-repo edit, which never uses email
|
|
555
|
-
// passthrough, so `ref.id` is always resolved here.
|
|
556
|
-
const id = ref.id ?? ref.input;
|
|
557
|
-
return {
|
|
558
|
-
name: ref.displayName ?? ref.input,
|
|
559
|
-
properties: {
|
|
560
|
-
roleName: GrsRepositoryContributorRoleName,
|
|
561
|
-
principal: ref.type ? { id, type: ref.type } : { id },
|
|
562
|
-
},
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* Shapes a `ResolvedRef` for the JSON envelope's `notFound` / `skipped` arrays.
|
|
567
|
-
* Strips the internal `input` field (which echoes the user's literal entry —
|
|
568
|
-
* useful for stderr warnings, but redundant in structured JSON where consumers
|
|
569
|
-
* already have the original list) and exposes only `id` plus a friendly
|
|
570
|
-
* `label` (Graph displayName when available, else the input).
|
|
571
|
-
*
|
|
572
|
-
* Only the unshare path populates these arrays, and unshare always resolves
|
|
573
|
-
* ids, so `ref.id` is present here.
|
|
574
|
-
*/
|
|
575
|
-
function toJsonRef(ref) {
|
|
576
|
-
return { id: ref.id ?? ref.input, label: ref.displayName ?? ref.input };
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* For share, the granted count comes from the server echo (the spec lets the
|
|
580
|
-
* server dedupe or treat 409 "already exists" as success and echo the entry).
|
|
581
|
-
* For unshare, the count comes from the request because neither endpoint
|
|
582
|
-
* populates `delete` on the response.
|
|
583
|
-
*
|
|
584
|
-
* The wording varies by access mode:
|
|
585
|
-
* - `play` → "play the app" / "play permissions"
|
|
586
|
-
* - `edit` → "edit the app" / "edit permissions"
|
|
587
|
-
*
|
|
588
|
-
* When unshare matched no existing assignments for some principals, an info
|
|
589
|
-
* line follows the success summary naming them — these are silent no-ops
|
|
590
|
-
* (the principal had no assignment to revoke), not failures.
|
|
591
|
-
*/
|
|
592
|
-
function printSummary(args) {
|
|
593
|
-
const { appName, mode, access, inputCount, outcome } = args;
|
|
594
|
-
const accessVerb = access === 'play' ? 'play' : 'edit';
|
|
595
|
-
if (mode === 'share') {
|
|
596
|
-
const result = outcome.result;
|
|
597
|
-
const grantedCount = result.put?.length ?? 0;
|
|
598
|
-
if (grantedCount === 0) {
|
|
599
|
-
printInfo('No changes were applied.');
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
printSuccess(`Shared app '${appName}' with ${grantedCount} ${pluralize('principal', grantedCount)}. They can now ${accessVerb} the app.`);
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
const revokedCount = outcome.revokedCount ?? 0;
|
|
606
|
-
const revokedPrincipalCount = outcome.revokedPrincipalCount ?? revokedCount;
|
|
607
|
-
if (revokedPrincipalCount === 0) {
|
|
608
|
-
// Every requested principal was already without an assignment — emit info
|
|
609
|
-
// rather than "Revoked ... for 0 principals" which reads like an error.
|
|
610
|
-
printInfo(`No ${accessVerb} assignments to revoke on '${appName}' — none of the ${inputCount} ${pluralize('principal', inputCount)} had existing access.`);
|
|
611
|
-
return;
|
|
612
|
-
}
|
|
613
|
-
printSuccess(`Revoked ${accessVerb} permissions for ${revokedPrincipalCount} ${pluralize('principal', revokedPrincipalCount)} on '${appName}'.`);
|
|
614
|
-
if (outcome.notFound && outcome.notFound.length > 0) {
|
|
615
|
-
const labels = outcome.notFound.map((r) => r.displayName ?? r.input).join(', ');
|
|
616
|
-
printInfo(`${outcome.notFound.length} ${pluralize('principal', outcome.notFound.length)} had no existing ${accessVerb} access (no-op): ${labels}`);
|
|
617
|
-
}
|
|
618
|
-
if (outcome.skipped && outcome.skipped.length > 0) {
|
|
619
|
-
// Matched-by-principal but the role assignment carried a null
|
|
620
|
-
// `roleDefinitionName`, so the action couldn't safely classify it.
|
|
621
|
-
// Surface it instead of letting the unshare silently no-op.
|
|
622
|
-
const labels = outcome.skipped.map((r) => r.displayName ?? r.input).join(', ');
|
|
623
|
-
printInfo(`${outcome.skipped.length} ${pluralize('principal', outcome.skipped.length)} had a role assignment with an unknown role definition; ${accessVerb} access was not modified for: ${labels}. Investigate via the role-assignments API.`);
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
function pluralize(noun, count) {
|
|
627
|
-
return count === 1 ? noun : `${noun}s`;
|
|
628
|
-
}
|
|
629
|
-
function configureOptionSchema(argumentProvider, mode) {
|
|
630
|
-
const help = mode === 'share' ? HelpStrings.app.share : HelpStrings.app.unshare;
|
|
631
|
-
const args = mode === 'share' ? ShareMaafAppArguments : UnshareMaafAppArguments;
|
|
632
|
-
argumentProvider.setDescription(help.description);
|
|
633
|
-
argumentProvider.addExamples(help.examples);
|
|
634
|
-
argumentProvider.consumePositionalArgs('userOrGroup');
|
|
635
|
-
argumentProvider.addOptions([
|
|
636
|
-
{
|
|
637
|
-
flags: { key: args.AppName.name },
|
|
638
|
-
env: args.AppName.envVar,
|
|
639
|
-
description: help.options.app,
|
|
640
|
-
optionalInNonInteractive: true,
|
|
641
|
-
},
|
|
642
|
-
{
|
|
643
|
-
flags: { key: args.Access.name },
|
|
644
|
-
env: args.Access.envVar,
|
|
645
|
-
default: args.Access.defaultValue,
|
|
646
|
-
description: help.options.access,
|
|
647
|
-
optionalInNonInteractive: true,
|
|
648
|
-
},
|
|
649
|
-
]);
|
|
650
|
-
}
|
|
651
|
-
//# sourceMappingURL=MaafAppPermissions.js.map
|