@microsoft/managed-apps-cli 0.13.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ArgumentProvider.d.ts +1 -2
- package/dist/ArgumentProvider.d.ts.map +1 -1
- package/dist/ArgumentProvider.js.map +1 -1
- package/dist/Authentication/NoOpAuthenticationProvider.d.ts +25 -0
- package/dist/Authentication/NoOpAuthenticationProvider.d.ts.map +1 -0
- package/dist/Authentication/NoOpAuthenticationProvider.js +31 -0
- package/dist/Authentication/NoOpAuthenticationProvider.js.map +1 -0
- package/dist/Cli.d.ts.map +1 -1
- package/dist/Cli.js +14 -0
- package/dist/Cli.js.map +1 -1
- package/dist/CliSettings.d.ts.map +1 -1
- package/dist/CliSettings.js +2 -1
- package/dist/CliSettings.js.map +1 -1
- package/dist/Constants/CommandRegistry.d.ts.map +1 -1
- package/dist/Constants/CommandRegistry.js +22 -4
- package/dist/Constants/CommandRegistry.js.map +1 -1
- package/dist/Constants/HelpStrings.d.ts +21 -3
- package/dist/Constants/HelpStrings.d.ts.map +1 -1
- package/dist/Constants/HelpStrings.js +53 -18
- package/dist/Constants/HelpStrings.js.map +1 -1
- package/dist/Constants.d.ts +2 -0
- package/dist/Constants.d.ts.map +1 -1
- package/dist/Constants.js +8 -0
- package/dist/Constants.js.map +1 -1
- package/dist/HttpClient/CliHttpClient.d.ts +1 -1
- package/dist/HttpClient/CliHttpClient.d.ts.map +1 -1
- package/dist/HttpClient/CliHttpClient.js +49 -2
- package/dist/HttpClient/CliHttpClient.js.map +1 -1
- package/dist/Logger/CliLogger.d.ts +1 -1
- package/dist/Logger/CliLogger.d.ts.map +1 -1
- package/dist/Logger/CliLogger.js +23 -4
- package/dist/Logger/CliLogger.js.map +1 -1
- package/dist/Logger/ConsoleWriter.d.ts +1 -0
- package/dist/Logger/ConsoleWriter.d.ts.map +1 -1
- package/dist/Logger/ConsoleWriter.js +3 -0
- package/dist/Logger/ConsoleWriter.js.map +1 -1
- package/dist/Logger/OneDSWriter.d.ts +1 -1
- package/dist/Logger/OneDSWriter.d.ts.map +1 -1
- package/dist/Logger/OneDSWriter.js +8 -3
- package/dist/Logger/OneDSWriter.js.map +1 -1
- package/dist/Testing/MockFetch.d.ts +23 -0
- package/dist/Testing/MockFetch.d.ts.map +1 -0
- package/dist/Testing/MockFetch.js +177 -0
- package/dist/Testing/MockFetch.js.map +1 -0
- package/dist/Testing/MockRoutes.d.ts +34 -0
- package/dist/Testing/MockRoutes.d.ts.map +1 -0
- package/dist/Testing/MockRoutes.js +226 -0
- package/dist/Testing/MockRoutes.js.map +1 -0
- package/dist/Testing/fixtures/connectors/commondataserviceforapps.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/commondataserviceforapps.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/commondataserviceforapps.js +25 -0
- package/dist/Testing/fixtures/connectors/commondataserviceforapps.js.map +1 -0
- package/dist/Testing/fixtures/connectors/dataverseContactEntity.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/dataverseContactEntity.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/dataverseContactEntity.js +55 -0
- package/dist/Testing/fixtures/connectors/dataverseContactEntity.js.map +1 -0
- package/dist/Testing/fixtures/connectors/excelonlinebusiness.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/excelonlinebusiness.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/excelonlinebusiness.js +1970 -0
- package/dist/Testing/fixtures/connectors/excelonlinebusiness.js.map +1 -0
- package/dist/Testing/fixtures/connectors/kusto.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/kusto.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/kusto.js +1333 -0
- package/dist/Testing/fixtures/connectors/kusto.js.map +1 -0
- package/dist/Testing/fixtures/connectors/msnweather.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/msnweather.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/msnweather.js +917 -0
- package/dist/Testing/fixtures/connectors/msnweather.js.map +1 -0
- package/dist/Testing/fixtures/connectors/office365groups.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/office365groups.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/office365groups.js +2144 -0
- package/dist/Testing/fixtures/connectors/office365groups.js.map +1 -0
- package/dist/Testing/fixtures/connectors/office365users.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/office365users.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/office365users.js +1969 -0
- package/dist/Testing/fixtures/connectors/office365users.js.map +1 -0
- package/dist/Testing/fixtures/connectors/onedriveforbusiness.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/onedriveforbusiness.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/onedriveforbusiness.js +4873 -0
- package/dist/Testing/fixtures/connectors/onedriveforbusiness.js.map +1 -0
- package/dist/Testing/fixtures/connectors/powerappsforappmakers.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/powerappsforappmakers.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/powerappsforappmakers.js +4682 -0
- package/dist/Testing/fixtures/connectors/powerappsforappmakers.js.map +1 -0
- package/dist/Testing/fixtures/connectors/sharepointTestListMetadata.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/sharepointTestListMetadata.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/sharepointTestListMetadata.js +1078 -0
- package/dist/Testing/fixtures/connectors/sharepointTestListMetadata.js.map +1 -0
- package/dist/Testing/fixtures/connectors/sharepointonline.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/sharepointonline.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/sharepointonline.js +28 -0
- package/dist/Testing/fixtures/connectors/sharepointonline.js.map +1 -0
- package/dist/Testing/fixtures/connectors/teams.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/teams.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/teams.js +9987 -0
- package/dist/Testing/fixtures/connectors/teams.js.map +1 -0
- package/dist/Testing/fixtures/connectors/translatorv2.d.ts +6 -0
- package/dist/Testing/fixtures/connectors/translatorv2.d.ts.map +1 -0
- package/dist/Testing/fixtures/connectors/translatorv2.js +307 -0
- package/dist/Testing/fixtures/connectors/translatorv2.js.map +1 -0
- package/dist/Testing/fixtures/index.d.ts +23 -0
- package/dist/Testing/fixtures/index.d.ts.map +1 -0
- package/dist/Testing/fixtures/index.js +96 -0
- package/dist/Testing/fixtures/index.js.map +1 -0
- package/dist/Types/LoggerTypes.types.d.ts +1 -0
- package/dist/Types/LoggerTypes.types.d.ts.map +1 -1
- package/dist/Utils/CoerceCliVersion.d.ts +27 -0
- package/dist/Utils/CoerceCliVersion.d.ts.map +1 -0
- package/dist/Utils/CoerceCliVersion.js +67 -0
- package/dist/Utils/CoerceCliVersion.js.map +1 -0
- package/dist/Utils/EnvVars.d.ts +1 -1
- package/dist/Utils/EnvVars.d.ts.map +1 -1
- package/dist/Utils/EnvVars.js.map +1 -1
- package/dist/Utils/EnvironmentRoutingUtils.d.ts +1 -2
- package/dist/Utils/EnvironmentRoutingUtils.d.ts.map +1 -1
- package/dist/Utils/EnvironmentRoutingUtils.js.map +1 -1
- package/dist/Utils/MaafAppConfig.d.ts +2 -0
- package/dist/Utils/MaafAppConfig.d.ts.map +1 -1
- package/dist/Utils/MaafAppConfig.js +6 -0
- package/dist/Utils/MaafAppConfig.js.map +1 -1
- package/dist/Utils/PinCli.d.ts +18 -13
- package/dist/Utils/PinCli.d.ts.map +1 -1
- package/dist/Utils/PinCli.js +37 -18
- package/dist/Utils/PinCli.js.map +1 -1
- package/dist/Utils/RepoOption.d.ts +1 -0
- package/dist/Utils/RepoOption.d.ts.map +1 -1
- package/dist/Utils/RepoOption.js +14 -0
- package/dist/Utils/RepoOption.js.map +1 -1
- package/dist/Utils/ShareAccessRouting.d.ts +78 -0
- package/dist/Utils/ShareAccessRouting.d.ts.map +1 -0
- package/dist/Utils/ShareAccessRouting.js +93 -0
- package/dist/Utils/ShareAccessRouting.js.map +1 -0
- package/dist/Verbs/AddConnector.d.ts +6 -6
- package/dist/Verbs/AddConnector.d.ts.map +1 -1
- package/dist/Verbs/AddConnector.js +62 -36
- package/dist/Verbs/AddConnector.js.map +1 -1
- package/dist/Verbs/AddConnectorFlows.d.ts +14 -2
- package/dist/Verbs/AddConnectorFlows.d.ts.map +1 -1
- package/dist/Verbs/AddConnectorFlows.js +67 -18
- package/dist/Verbs/AddConnectorFlows.js.map +1 -1
- package/dist/Verbs/ConnectorHelpers.d.ts +79 -6
- package/dist/Verbs/ConnectorHelpers.d.ts.map +1 -1
- package/dist/Verbs/ConnectorHelpers.js +280 -32
- package/dist/Verbs/ConnectorHelpers.js.map +1 -1
- package/dist/Verbs/CreateMaafApp.d.ts +8 -16
- package/dist/Verbs/CreateMaafApp.d.ts.map +1 -1
- package/dist/Verbs/CreateMaafApp.js +224 -96
- package/dist/Verbs/CreateMaafApp.js.map +1 -1
- package/dist/Verbs/DeleteMaafApp.d.ts +13 -9
- package/dist/Verbs/DeleteMaafApp.d.ts.map +1 -1
- package/dist/Verbs/DeleteMaafApp.js +41 -21
- package/dist/Verbs/DeleteMaafApp.js.map +1 -1
- package/dist/Verbs/Dev.d.ts.map +1 -1
- package/dist/Verbs/Dev.js +34 -3
- package/dist/Verbs/Dev.js.map +1 -1
- package/dist/Verbs/GetMaafApp.d.ts.map +1 -1
- package/dist/Verbs/GetMaafApp.js +18 -6
- package/dist/Verbs/GetMaafApp.js.map +1 -1
- package/dist/Verbs/Init.d.ts.map +1 -1
- package/dist/Verbs/Init.js +58 -5
- package/dist/Verbs/Init.js.map +1 -1
- package/dist/Verbs/ListConnectors.d.ts.map +1 -1
- package/dist/Verbs/ListConnectors.js +12 -1
- package/dist/Verbs/ListConnectors.js.map +1 -1
- package/dist/Verbs/ListMaafApps.d.ts +9 -8
- package/dist/Verbs/ListMaafApps.d.ts.map +1 -1
- package/dist/Verbs/ListMaafApps.js +30 -23
- package/dist/Verbs/ListMaafApps.js.map +1 -1
- package/dist/Verbs/MaafAppPermissions.d.ts +8 -17
- package/dist/Verbs/MaafAppPermissions.d.ts.map +1 -1
- package/dist/Verbs/MaafAppPermissions.js +84 -91
- package/dist/Verbs/MaafAppPermissions.js.map +1 -1
- package/dist/Verbs/Pack.d.ts +30 -1
- package/dist/Verbs/Pack.d.ts.map +1 -1
- package/dist/Verbs/Pack.js +179 -2
- package/dist/Verbs/Pack.js.map +1 -1
- package/dist/Verbs/RefreshDataSource.d.ts +15 -0
- package/dist/Verbs/RefreshDataSource.d.ts.map +1 -1
- package/dist/Verbs/RefreshDataSource.js +41 -27
- package/dist/Verbs/RefreshDataSource.js.map +1 -1
- package/dist/Verbs/RemoveDataSource.d.ts.map +1 -1
- package/dist/Verbs/RemoveDataSource.js +17 -3
- package/dist/Verbs/RemoveDataSource.js.map +1 -1
- package/dist/Verbs/ShareList.d.ts +10 -0
- package/dist/Verbs/ShareList.d.ts.map +1 -0
- package/dist/Verbs/ShareList.js +254 -0
- package/dist/Verbs/ShareList.js.map +1 -0
- package/dist/Verbs/VerbConstants.d.ts +56 -3
- package/dist/Verbs/VerbConstants.d.ts.map +1 -1
- package/dist/Verbs/VerbConstants.js +40 -3
- package/dist/Verbs/VerbConstants.js.map +1 -1
- package/dist/Verbs/index.d.ts +1 -0
- package/dist/Verbs/index.d.ts.map +1 -1
- package/dist/Verbs/index.js +1 -0
- package/dist/Verbs/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import { getSettings } from '../CliSettings.js';
|
|
4
|
+
import { getCliLogger, getSettings } from '../CliSettings.js';
|
|
5
5
|
import { createDefaultStringOption, promptConfirm } from '../CliUtils.js';
|
|
6
6
|
import { HelpStrings } from '../Constants/HelpStrings.js';
|
|
7
7
|
import { UsageError } from '../Errors/CliError.js';
|
|
8
8
|
import { isCdsConnectorId } from '../Utils/ConnectorIds.js';
|
|
9
9
|
import { isTabularConnector, runAddActionFlowAsync, runAddTableFlowAsync, } from './AddConnectorFlows.js';
|
|
10
|
-
import { runConnectorDlpPreflightAsync } from './ConnectorHelpers.js';
|
|
10
|
+
import { resolveConnectorIdAsync, runConnectorDlpPreflightAsync } from './ConnectorHelpers.js';
|
|
11
11
|
import { AddConnectorArguments, SharedArguments } from './VerbConstants.js';
|
|
12
|
-
const DATAVERSE_PAIR_ERROR = '--dataverse-environment-id and --table must be specified together for the Common Data Service for Apps connector. Provide both or neither.';
|
|
13
12
|
/**
|
|
14
13
|
* `ms app add data-source` — a single entry point that adds a connector to
|
|
15
14
|
* the app and picks the right shape (table or action) based on the
|
|
@@ -17,17 +16,17 @@ const DATAVERSE_PAIR_ERROR = '--dataverse-environment-id and --table must be spe
|
|
|
17
16
|
*
|
|
18
17
|
* Decision matrix:
|
|
19
18
|
* 1. Run connector-policy preflight (single source of truth for policy enforcement).
|
|
20
|
-
* 2.
|
|
21
|
-
*
|
|
19
|
+
* 2. Common Data Service for Apps (Dataverse) connector → always the action flow
|
|
20
|
+
* with an optional Dataverse table binding. `--table` carries the entity logical
|
|
21
|
+
* name; `--dataverse-environment-id` is optional (defaults to the app environment);
|
|
22
|
+
* `--as table` requests a table binding; `--dataset` is rejected.
|
|
23
|
+
* 3. Otherwise determine `isTabular` from connector capabilities and resolve mode:
|
|
22
24
|
* - Non-tabular + `--as table` → UsageError
|
|
23
25
|
* - Non-tabular → mode = action
|
|
24
26
|
* - Tabular + `--as` given → mode = flag value
|
|
25
27
|
* - Tabular + interactive (no `--as`) → promptConfirm yes/no
|
|
26
28
|
* - Tabular + non-interactive + no `--as` → UsageError
|
|
27
|
-
* 4. Reject `--dataset` / `--table` if mode resolved to action
|
|
28
|
-
* for the Common Data Service for Apps connector where `--table` is
|
|
29
|
-
* re-interpreted as the Dataverse logical name (paired with
|
|
30
|
-
* `--dataverse-environment-id`).
|
|
29
|
+
* 4. Reject `--dataset` / `--table` if mode resolved to action (non-CDS).
|
|
31
30
|
* 5. Delegate to the appropriate shared flow helper.
|
|
32
31
|
*/
|
|
33
32
|
export async function addConnectorAsync(argumentProvider) {
|
|
@@ -41,6 +40,7 @@ export async function addConnectorAsync(argumentProvider) {
|
|
|
41
40
|
const dataverseEnvironmentIdFlag = await argumentProvider.getOption('dataverseEnvironmentId', true);
|
|
42
41
|
const skipCodegen = !!(await argumentProvider.getOption('skipCodegen', true));
|
|
43
42
|
const useV1Codegen = !!(await argumentProvider.getOption('useV1Codegen', true));
|
|
43
|
+
const useSso = !!(await argumentProvider.getOption('useSso', true));
|
|
44
44
|
// ── Validate `--as` value (if provided) ────────────────────────────────────
|
|
45
45
|
let asFlag;
|
|
46
46
|
if (asFlagRaw !== undefined && asFlagRaw !== '') {
|
|
@@ -50,38 +50,59 @@ export async function addConnectorAsync(argumentProvider) {
|
|
|
50
50
|
}
|
|
51
51
|
asFlag = normalized;
|
|
52
52
|
}
|
|
53
|
+
// ── Resolve display name to connector API ID (if needed) ──────────────────
|
|
54
|
+
const resolvedApiId = await resolveConnectorIdAsync(apiId, getCliLogger());
|
|
53
55
|
// ── Preflight: connector + connector policy (throws on not-found or blocked) ──
|
|
54
|
-
const { connector, policy } = await runConnectorDlpPreflightAsync(argumentProvider,
|
|
55
|
-
const connectorLabel = connector.properties.displayName ??
|
|
56
|
+
const { connector, policy } = await runConnectorDlpPreflightAsync(argumentProvider, resolvedApiId);
|
|
57
|
+
const connectorLabel = connector.properties.displayName ?? resolvedApiId;
|
|
56
58
|
const isTabular = isTabularConnector(connector);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
// the Dataverse entity logical name and pairs with `--dataverse-environment-id`. The
|
|
67
|
-
// connector is non-tabular, so we land here only in action mode.
|
|
68
|
-
let dataverseEnvironmentId;
|
|
69
|
-
let dataverseTable;
|
|
70
|
-
if (isCommonDataServiceForApps && mode === 'action') {
|
|
59
|
+
const isCommonDataServiceForApps = isCdsConnectorId(resolvedApiId);
|
|
60
|
+
// ── Common Data Service for Apps (Dataverse) connector ────────────────────
|
|
61
|
+
// Dataverse is added through the action flow (it exposes Dataverse operations),
|
|
62
|
+
// with an OPTIONAL table binding — it does not use the generic tabular
|
|
63
|
+
// dataset/table flow (Dataverse has no dataset concept). The standard `--table`
|
|
64
|
+
// flag carries the Dataverse entity logical name; `--dataverse-environment-id`
|
|
65
|
+
// is optional and defaults to the app's environment. `--as table` is accepted
|
|
66
|
+
// and signals that the user wants a table binding.
|
|
67
|
+
if (isCommonDataServiceForApps) {
|
|
71
68
|
if (datasetFlag) {
|
|
72
69
|
throw new UsageError('--dataset is not used with the Common Data Service for Apps connector. Use --table to specify a Dataverse logical name.');
|
|
73
70
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
const wantsTableBinding = asFlag === 'table';
|
|
72
|
+
const nonInteractive = !getSettings().interactive;
|
|
73
|
+
// A table logical name is required to bind a table. In non-interactive mode,
|
|
74
|
+
// reject `--as table` or a bare `--dataverse-environment-id` without `--table`
|
|
75
|
+
// instead of silently ignoring them.
|
|
76
|
+
if (nonInteractive && (wantsTableBinding || dataverseEnvironmentIdFlag) && !tableFlag) {
|
|
77
|
+
throw new UsageError('Adding a Dataverse table requires --table <logical-name> for the Common Data Service for Apps connector. --dataverse-environment-id is optional and defaults to the app environment.');
|
|
78
78
|
}
|
|
79
|
+
await runAddActionFlowAsync({
|
|
80
|
+
argumentProvider,
|
|
81
|
+
connector,
|
|
82
|
+
apiId: resolvedApiId,
|
|
83
|
+
connectionIdFlag,
|
|
84
|
+
skipCodegen,
|
|
85
|
+
useV1Codegen,
|
|
86
|
+
useSso,
|
|
87
|
+
policy,
|
|
88
|
+
dataverseEnvironmentId: dataverseEnvironmentIdFlag,
|
|
89
|
+
dataverseTable: tableFlag,
|
|
90
|
+
forceTableBinding: wantsTableBinding,
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
79
93
|
}
|
|
80
|
-
|
|
94
|
+
// ── Non-CDS connectors ────────────────────────────────────────────────────
|
|
95
|
+
if (dataverseEnvironmentIdFlag) {
|
|
81
96
|
throw new UsageError('--dataverse-environment-id can only be used with the Common Data Service for Apps connector (--connector shared_commondataserviceforapps or --connector commondataserviceforapps).');
|
|
82
97
|
}
|
|
83
|
-
// ──
|
|
84
|
-
|
|
98
|
+
// ── Decide mode ───────────────────────────────────────────────────────────
|
|
99
|
+
const mode = await resolveModeAsync({
|
|
100
|
+
isTabular,
|
|
101
|
+
asFlag,
|
|
102
|
+
connectorLabel,
|
|
103
|
+
});
|
|
104
|
+
// ── Reject contradictory flags when adding actions ────────────────────────
|
|
105
|
+
if (mode === 'action' && (datasetFlag || tableFlag)) {
|
|
85
106
|
throw new UsageError(`--dataset and --table cannot be used with --as action. Re-run with --as table, or omit those flags.`);
|
|
86
107
|
}
|
|
87
108
|
// ── Dispatch ──────────────────────────────────────────────────────────────
|
|
@@ -89,25 +110,25 @@ export async function addConnectorAsync(argumentProvider) {
|
|
|
89
110
|
await runAddTableFlowAsync({
|
|
90
111
|
argumentProvider,
|
|
91
112
|
connector,
|
|
92
|
-
apiId,
|
|
113
|
+
apiId: resolvedApiId,
|
|
93
114
|
connectionIdFlag,
|
|
94
115
|
datasetFlag,
|
|
95
116
|
tableFlag,
|
|
96
117
|
skipCodegen,
|
|
97
118
|
useV1Codegen,
|
|
119
|
+
useSso,
|
|
98
120
|
});
|
|
99
121
|
}
|
|
100
122
|
else {
|
|
101
123
|
await runAddActionFlowAsync({
|
|
102
124
|
argumentProvider,
|
|
103
125
|
connector,
|
|
104
|
-
apiId,
|
|
126
|
+
apiId: resolvedApiId,
|
|
105
127
|
connectionIdFlag,
|
|
106
128
|
skipCodegen,
|
|
107
129
|
useV1Codegen,
|
|
130
|
+
useSso,
|
|
108
131
|
policy,
|
|
109
|
-
dataverseEnvironmentId,
|
|
110
|
-
dataverseTable,
|
|
111
132
|
});
|
|
112
133
|
}
|
|
113
134
|
}
|
|
@@ -186,6 +207,11 @@ function createOptionSchema(argumentProvider) {
|
|
|
186
207
|
env: AddConnectorArguments.SkipCodegen.env,
|
|
187
208
|
description: HelpStrings.app.add.connector.options.skipCodegen,
|
|
188
209
|
});
|
|
210
|
+
argumentProvider.addSwitch({
|
|
211
|
+
flags: { key: AddConnectorArguments.UseSso.name },
|
|
212
|
+
env: AddConnectorArguments.UseSso.env,
|
|
213
|
+
description: HelpStrings.app.add.connector.options.useSso,
|
|
214
|
+
});
|
|
189
215
|
argumentProvider.addSwitch({
|
|
190
216
|
flags: { key: AddConnectorArguments.UseV1Codegen.name },
|
|
191
217
|
env: AddConnectorArguments.UseV1Codegen.env,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddConnector.js","sourceRoot":"","sources":["../../src/Verbs/AddConnector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"AddConnector.js","sourceRoot":"","sources":["../../src/Verbs/AddConnector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAA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29
29
|
connectionIdFlag?: string;
|
|
30
30
|
skipCodegen: boolean;
|
|
31
31
|
useV1Codegen: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* When true (`--use-sso`), force silent creation of an SSO (Entra ID) connection
|
|
34
|
+
* for any SSO-capable connector when none exists — not just SSO-only connectors.
|
|
35
|
+
*/
|
|
36
|
+
useSso?: boolean;
|
|
32
37
|
}
|
|
33
38
|
export interface AddActionFlowArgs extends AddFlowBaseArgs {
|
|
34
39
|
/**
|
|
@@ -39,15 +44,22 @@ export interface AddActionFlowArgs extends AddFlowBaseArgs {
|
|
|
39
44
|
policy?: EffectiveConnectorDataPolicy;
|
|
40
45
|
/**
|
|
41
46
|
* For the Common Data Service for Apps connector only: the target Dataverse
|
|
42
|
-
* environment GUID.
|
|
47
|
+
* environment GUID (`--dataverse-environment-id`). Optional — when omitted the
|
|
48
|
+
* app's environment is used.
|
|
43
49
|
*/
|
|
44
50
|
dataverseEnvironmentId?: string;
|
|
45
51
|
/**
|
|
46
52
|
* For the Common Data Service for Apps connector only: the Dataverse entity
|
|
47
53
|
* logical name (carried by the standard `--table` flag at the CLI surface).
|
|
48
|
-
* Pairs with `dataverseEnvironmentId`.
|
|
49
54
|
*/
|
|
50
55
|
dataverseTable?: string;
|
|
56
|
+
/**
|
|
57
|
+
* For the Common Data Service for Apps connector only: when true (`--as table`),
|
|
58
|
+
* the caller explicitly requested a Dataverse table binding. In interactive mode
|
|
59
|
+
* this skips the "Connect a table?" confirmation and prompts for the table name
|
|
60
|
+
* directly.
|
|
61
|
+
*/
|
|
62
|
+
forceTableBinding?: boolean;
|
|
51
63
|
}
|
|
52
64
|
export interface AddTableFlowArgs extends AddFlowBaseArgs {
|
|
53
65
|
datasetFlag?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddConnectorFlows.d.ts","sourceRoot":"","sources":["../../src/Verbs/AddConnectorFlows.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAGV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AAI,CAAC,CA+HlF;AAwDD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAE1D"}
|
|
@@ -7,15 +7,29 @@ import { promptConfirm, promptSelectOrInput, promptText } from '../CliUtils.js';
|
|
|
7
7
|
import { CLI_BINARY_NAME } from '../Constants/CliConstants.js';
|
|
8
8
|
import { UsageError } from '../Errors/CliError.js';
|
|
9
9
|
import { isCdsConnectorId } from '../Utils/ConnectorIds.js';
|
|
10
|
-
import { printInfo, printSuccess, printTable } from '../Utils/ConsoleOutput.js';
|
|
11
|
-
import { requestCliUserConsentAsync,
|
|
10
|
+
import { printInfo, printSuccess, printTable, printWarning } from '../Utils/ConsoleOutput.js';
|
|
11
|
+
import { requestCliUserConsentAsync, resolveConnectionAsync, withAutoSelectedConnectionHintAsync, } from './ConnectorHelpers.js';
|
|
12
|
+
/**
|
|
13
|
+
* Emits a DLP/ACP warning listing every Dataverse service method that was not generated
|
|
14
|
+
* because its underlying `*WithOrganization` CDS connector operation is blocked by policy.
|
|
15
|
+
* No-ops when `skipped` is empty.
|
|
16
|
+
*/
|
|
17
|
+
function printSkippedMethodsWarning(skipped) {
|
|
18
|
+
if (skipped.length === 0)
|
|
19
|
+
return;
|
|
20
|
+
printWarning(`The following connector operations are blocked by your organization's policy and were not generated.\n` +
|
|
21
|
+
`Ask your admin to allow them on 'Microsoft Dataverse' to restore the missing service methods:\n` +
|
|
22
|
+
skipped
|
|
23
|
+
.map(({ operationId, methodName }) => ` • ${operationId} (generates ${methodName}())`)
|
|
24
|
+
.join('\n'));
|
|
25
|
+
}
|
|
12
26
|
/**
|
|
13
27
|
* Runs the connection → dataset → table → addConnectorTableAsync flow.
|
|
14
28
|
* Caller must have already verified the connector exists, passed the
|
|
15
29
|
* connector-policy preflight, and supports tabular.
|
|
16
30
|
*/
|
|
17
31
|
export async function runAddTableFlowAsync(args) {
|
|
18
|
-
const { argumentProvider, connector, apiId, connectionIdFlag, datasetFlag, tableFlag, skipCodegen, useV1Codegen, } = args;
|
|
32
|
+
const { argumentProvider, connector, apiId, connectionIdFlag, datasetFlag, tableFlag, skipCodegen, useV1Codegen, useSso, } = args;
|
|
19
33
|
const settings = getSettings();
|
|
20
34
|
const { fileConfig, cliFs } = settings;
|
|
21
35
|
const playerServiceConfig = getPlayerServiceConfig();
|
|
@@ -36,14 +50,24 @@ export async function runAddTableFlowAsync(args) {
|
|
|
36
50
|
logger,
|
|
37
51
|
};
|
|
38
52
|
// ── Step 1: Connection resolution ─────────────────────────────────────────
|
|
53
|
+
const connectorLabel = connector.properties.displayName ?? apiId;
|
|
39
54
|
let connectionId = connectionIdFlag;
|
|
55
|
+
let connectionAutoSelected = false;
|
|
40
56
|
if (!connectionId) {
|
|
41
|
-
|
|
57
|
+
const resolved = await resolveConnectionAsync({
|
|
42
58
|
argumentProvider,
|
|
43
59
|
apiId,
|
|
44
60
|
connector,
|
|
61
|
+
useSso,
|
|
45
62
|
});
|
|
63
|
+
connectionId = resolved.connectionId;
|
|
64
|
+
connectionAutoSelected = resolved.autoSelected;
|
|
46
65
|
}
|
|
66
|
+
// For tabular connectors the connection is bound to a specific target
|
|
67
|
+
// (server/database/site). When the connection was auto-selected (not chosen by
|
|
68
|
+
// the user), enrich any downstream failure with remediation guidance so the
|
|
69
|
+
// "broken/expired" vs "wrong resource" ambiguity is spelled out.
|
|
70
|
+
const hintContext = { autoSelected: connectionAutoSelected, connectionId, connectorLabel };
|
|
47
71
|
// ── Step 1b: Request user consent on the resolved connection ─────────────
|
|
48
72
|
await requestCliUserConsentAsync({ apiId, connectionId });
|
|
49
73
|
// ── Step 2: Dataset resolution ────────────────────────────────────────────
|
|
@@ -53,10 +77,10 @@ export async function runAddTableFlowAsync(args) {
|
|
|
53
77
|
...baseContext,
|
|
54
78
|
actionsParams: { apiId, connectionId },
|
|
55
79
|
};
|
|
56
|
-
const { value: datasets } = await listDatasetsAsync(datasetsCtx);
|
|
80
|
+
const { value: datasets } = await withAutoSelectedConnectionHintAsync(() => listDatasetsAsync(datasetsCtx), hintContext);
|
|
57
81
|
if (!settings.interactive) {
|
|
58
82
|
printTable({
|
|
59
|
-
title: `Available datasets for ${
|
|
83
|
+
title: `Available datasets for ${connectorLabel}`,
|
|
60
84
|
columns: [{ header: 'Display Name', maxWidth: 40 }, { header: 'Dataset Name' }],
|
|
61
85
|
rows: datasets.map((d) => [d.DisplayName || d.Name, d.Name]),
|
|
62
86
|
emptyMessage: 'No datasets found for this connection.',
|
|
@@ -81,7 +105,7 @@ export async function runAddTableFlowAsync(args) {
|
|
|
81
105
|
...baseContext,
|
|
82
106
|
actionsParams: { apiId, connectionId, dataset },
|
|
83
107
|
};
|
|
84
|
-
const { value: tables } = await listTablesAsync(tablesCtx);
|
|
108
|
+
const { value: tables } = await withAutoSelectedConnectionHintAsync(() => listTablesAsync(tablesCtx), hintContext);
|
|
85
109
|
if (!settings.interactive) {
|
|
86
110
|
printTable({
|
|
87
111
|
title: `Available tables in dataset '${dataset}'`,
|
|
@@ -107,8 +131,8 @@ export async function runAddTableFlowAsync(args) {
|
|
|
107
131
|
...baseContext,
|
|
108
132
|
actionsParams: { apiId, connectionId, dataset, tableName, skipCodegen, useV1Codegen },
|
|
109
133
|
};
|
|
110
|
-
const dataSourceName = await addConnectorTableAsync(context);
|
|
111
|
-
printSuccess(`Data source '${dataSourceName}' added successfully (table '${tableName}' from connector '${
|
|
134
|
+
const dataSourceName = await withAutoSelectedConnectionHintAsync(() => addConnectorTableAsync(context), hintContext);
|
|
135
|
+
printSuccess(`Data source '${dataSourceName}' added successfully (table '${tableName}' from connector '${connectorLabel}').`);
|
|
112
136
|
printInfo(`Hint: Run '${CLI_BINARY_NAME} app dev' to test locally, or '${CLI_BINARY_NAME} app deploy' to deploy.`);
|
|
113
137
|
}
|
|
114
138
|
/**
|
|
@@ -129,7 +153,7 @@ export async function runAddTableFlowAsync(args) {
|
|
|
129
153
|
* translate to a `UsageError`.
|
|
130
154
|
*/
|
|
131
155
|
export async function runAddActionFlowAsync(args) {
|
|
132
|
-
const { argumentProvider, connector, apiId, connectionIdFlag, skipCodegen, useV1Codegen, policy, dataverseEnvironmentId, dataverseTable, } = args;
|
|
156
|
+
const { argumentProvider, connector, apiId, connectionIdFlag, skipCodegen, useV1Codegen, useSso, policy, dataverseEnvironmentId, dataverseTable, forceTableBinding, } = args;
|
|
133
157
|
const settings = getSettings();
|
|
134
158
|
const { fileConfig, cliFs } = settings;
|
|
135
159
|
const playerServiceConfig = getPlayerServiceConfig();
|
|
@@ -141,11 +165,13 @@ export async function runAddActionFlowAsync(args) {
|
|
|
141
165
|
// ── Step 2: Connection resolution ─────────────────────────────────────────
|
|
142
166
|
let connectionId = connectionIdFlag;
|
|
143
167
|
if (needsConnection && !connectionId) {
|
|
144
|
-
|
|
168
|
+
const resolved = await resolveConnectionAsync({
|
|
145
169
|
argumentProvider,
|
|
146
170
|
apiId,
|
|
147
171
|
connector,
|
|
172
|
+
useSso,
|
|
148
173
|
});
|
|
174
|
+
connectionId = resolved.connectionId;
|
|
149
175
|
}
|
|
150
176
|
// ── Step 2b: Request user consent on the resolved connection ──────────────
|
|
151
177
|
if (needsConnection && connectionId) {
|
|
@@ -158,6 +184,7 @@ export async function runAddActionFlowAsync(args) {
|
|
|
158
184
|
const isCommonDataServiceForApps = isCdsConnectorId(apiId);
|
|
159
185
|
const initialDataverseParams = await resolveInitialDataverseParamsAsync({
|
|
160
186
|
isCommonDataServiceForApps,
|
|
187
|
+
forceTableBinding: !!forceTableBinding,
|
|
161
188
|
dataverseEnvironmentId,
|
|
162
189
|
dataverseTable,
|
|
163
190
|
});
|
|
@@ -200,15 +227,25 @@ export async function runAddActionFlowAsync(args) {
|
|
|
200
227
|
if (actionResult.filteredCount > 0) {
|
|
201
228
|
printInfo(`Skipped ${actionResult.filteredCount} of ${actionResult.totalCount} actions due to your organization's connector policy.`);
|
|
202
229
|
}
|
|
230
|
+
// Warn the maker about any Dataverse service methods that were not generated
|
|
231
|
+
// because their underlying CDS *WithOrganization operation was blocked by ACP/DLP.
|
|
232
|
+
printSkippedMethodsWarning(actionResult.skippedDataverseMethods);
|
|
203
233
|
printSuccess(`Data source '${actionResult.dataSourceName}' added successfully (connector '${connector.properties.displayName ?? apiId}').`);
|
|
234
|
+
// When a Dataverse table was requested up front (via --table / --as table), the binding is
|
|
235
|
+
// added as part of the connector-add call above. Confirm it explicitly so the flag-driven
|
|
236
|
+
// path matches the interactive path's feedback.
|
|
237
|
+
if (initialDataverseParams?.dataverseTable) {
|
|
238
|
+
printSuccess(`Dataverse table '${initialDataverseParams.dataverseTable}' bound successfully.`);
|
|
239
|
+
}
|
|
204
240
|
if (isCommonDataServiceForApps && settings.interactive && !initialDataverseParams) {
|
|
205
241
|
const connectTable = await promptConfirm({
|
|
206
242
|
message: 'Connect this to a specific Dataverse table?',
|
|
207
243
|
initialValue: true,
|
|
208
244
|
});
|
|
209
245
|
if (connectTable) {
|
|
210
|
-
await addConnectorActionAsync(createContext(await promptDataverseParamsAsync({})));
|
|
246
|
+
const tableBindingResult = await addConnectorActionAsync(createContext(await promptDataverseParamsAsync({})));
|
|
211
247
|
printSuccess('Dataverse table binding added successfully.');
|
|
248
|
+
printSkippedMethodsWarning(tableBindingResult.skippedDataverseMethods);
|
|
212
249
|
}
|
|
213
250
|
}
|
|
214
251
|
printInfo(`Hint: Run '${CLI_BINARY_NAME} app dev' to test locally, or '${CLI_BINARY_NAME} app deploy' to deploy.`);
|
|
@@ -218,12 +255,23 @@ async function resolveInitialDataverseParamsAsync(input) {
|
|
|
218
255
|
return undefined;
|
|
219
256
|
}
|
|
220
257
|
const settings = getSettings();
|
|
221
|
-
const hasEnvironmentId = !!input.dataverseEnvironmentId;
|
|
222
258
|
const hasTable = !!input.dataverseTable;
|
|
223
|
-
if (!settings.interactive
|
|
224
|
-
|
|
259
|
+
if (!settings.interactive) {
|
|
260
|
+
// Non-interactive: bind a table only when a logical name is provided. The
|
|
261
|
+
// environment id is optional (defaults to the app's environment downstream).
|
|
262
|
+
// The CLI verb has already rejected env-without-table, so we don't re-validate here.
|
|
263
|
+
if (!hasTable) {
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
dataverseEnvironmentId: input.dataverseEnvironmentId,
|
|
268
|
+
dataverseTable: input.dataverseTable,
|
|
269
|
+
};
|
|
225
270
|
}
|
|
226
|
-
|
|
271
|
+
// Interactive: prompt for the table when the caller supplied one, or when
|
|
272
|
+
// `--as table` explicitly asked for a binding. Otherwise defer to the
|
|
273
|
+
// post-add "Connect a table?" confirmation.
|
|
274
|
+
if (!hasTable && !input.forceTableBinding) {
|
|
227
275
|
return undefined;
|
|
228
276
|
}
|
|
229
277
|
return promptDataverseParamsAsync({
|
|
@@ -232,9 +280,10 @@ async function resolveInitialDataverseParamsAsync(input) {
|
|
|
232
280
|
});
|
|
233
281
|
}
|
|
234
282
|
async function promptDataverseParamsAsync(input) {
|
|
235
|
-
|
|
283
|
+
// The environment id is not prompted — it is optional and defaults to the
|
|
284
|
+
// app's environment. Only the table logical name is required.
|
|
236
285
|
const dataverseTable = input.dataverseTable ?? (await promptText({ message: 'Dataverse table logical name:' }));
|
|
237
|
-
return { dataverseEnvironmentId, dataverseTable };
|
|
286
|
+
return { dataverseEnvironmentId: input.dataverseEnvironmentId, dataverseTable };
|
|
238
287
|
}
|
|
239
288
|
/**
|
|
240
289
|
* Shared helper to compute whether a connector supports tabular data sources.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddConnectorFlows.js","sourceRoot":"","sources":["../../src/Verbs/AddConnectorFlows.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,aA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;IAC1E,8DAA8D;IAC9D,MAAM,cAAc,GAClB,KAAK,CAAC,cAAc,IAAI,CAAC,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC,CAAC,CAAC;IAC3F,OAAO,EAAE,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EAAE,cAAc,EAAE,CAAC;AAClF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAc;IAC/C,OAAO,SAAS,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,SAAS,CAAC,IAAI,KAAK,CAAC;AAChG,CAAC"}
|
|
@@ -4,6 +4,25 @@
|
|
|
4
4
|
import type { Api, EffectiveConnectorDataPolicy } from '@microsoft/managed-apps-actions';
|
|
5
5
|
import type { Region } from '@microsoft/managed-apps-common/services';
|
|
6
6
|
import type { ArgumentProvider } from '../ArgumentProvider.js';
|
|
7
|
+
import { getCliLogger } from '../CliSettings.js';
|
|
8
|
+
/**
|
|
9
|
+
* Resolves a raw `--connector` argument to a canonical connector API ID.
|
|
10
|
+
*
|
|
11
|
+
* - If `input` starts with `shared_` → returned unchanged (fast path, no network call).
|
|
12
|
+
* - Otherwise the full connector list is fetched. Resolution proceeds in two passes:
|
|
13
|
+
* 1. **Exact match** (case-insensitive `displayName === input`).
|
|
14
|
+
* 2. **Partial match** (case-insensitive `displayName.includes(input)`) —
|
|
15
|
+
* only attempted when the exact pass yields zero results.
|
|
16
|
+
*
|
|
17
|
+
* Outcomes:
|
|
18
|
+
* - One candidate → returns the connector's `name` (its API ID).
|
|
19
|
+
* A notice is printed when the match was partial.
|
|
20
|
+
* - Multiple matches → throws `UsageError` with a disambiguation list.
|
|
21
|
+
* - Zero matches → returns `input` unchanged so that bare aliases
|
|
22
|
+
* such as `commondataserviceforapps` are still
|
|
23
|
+
* accepted by the downstream `getConnectorAsync`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveConnectorIdAsync(input: string, logger: ReturnType<typeof getCliLogger> | undefined): Promise<string>;
|
|
7
26
|
/**
|
|
8
27
|
* Preflight step shared by `app add action` and `app add table`. Fetches the
|
|
9
28
|
* connector and effective connector policy in parallel, then enforces the policy.
|
|
@@ -26,16 +45,70 @@ export declare function runConnectorDlpPreflightAsync(argumentProvider: Argument
|
|
|
26
45
|
policy: EffectiveConnectorDataPolicy;
|
|
27
46
|
}>;
|
|
28
47
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
48
|
+
* Result of {@link resolveConnectionAsync}: the resolved connection id plus
|
|
49
|
+
* whether it was **auto-selected** (chosen by the CLI without the user explicitly
|
|
50
|
+
* picking it from a prompt).
|
|
51
|
+
*
|
|
52
|
+
* `autoSelected` is `true` when the CLI reuses a connection on the user's behalf:
|
|
53
|
+
* the non-interactive reuse-the-only-one path, or the `--use-sso` reuse-the-first-
|
|
54
|
+
* SSO-connection path (both modes). It is used by the tabular add-table flow to
|
|
55
|
+
* enrich a downstream failure with remediation guidance (see
|
|
56
|
+
* {@link autoSelectedConnectionHint}), because for tabular connectors the
|
|
57
|
+
* connection determines the target server/database. Freshly created connections
|
|
58
|
+
* are **not** flagged (nothing to disambiguate).
|
|
33
59
|
*/
|
|
34
|
-
export
|
|
60
|
+
export interface ResolvedConnection {
|
|
61
|
+
connectionId: string;
|
|
62
|
+
autoSelected: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Resolves a connection for a connector, choosing the strategy based on mode.
|
|
66
|
+
*
|
|
67
|
+
* Interactive mode: lists existing connections and prompts the user to pick one
|
|
68
|
+
* (or create a new one).
|
|
69
|
+
*
|
|
70
|
+
* Non-interactive mode (deterministic auto-resolution — see
|
|
71
|
+
* {@link resolveConnectionNonInteractivelyAsync}): reuses the sole existing
|
|
72
|
+
* connection, silently creates one for SSO-only connectors when none exist,
|
|
73
|
+
* prints the connection table and errors when multiple connections are ambiguous,
|
|
74
|
+
* or errors without a table when zero connections exist for a non-auto-creatable
|
|
75
|
+
* connector.
|
|
76
|
+
*
|
|
77
|
+
* `--use-sso` (`useSso`) short-circuits both modes: it reuses the first existing
|
|
78
|
+
* SSO connection when one exists, otherwise silently creates one via the OBO
|
|
79
|
+
* flow (even when non-SSO connections already exist). It errors up front when the
|
|
80
|
+
* connector cannot use SSO at all. In interactive mode it skips the picker.
|
|
81
|
+
*/
|
|
82
|
+
export declare function resolveConnectionAsync(options: {
|
|
35
83
|
argumentProvider: ArgumentProvider;
|
|
36
84
|
apiId: string;
|
|
37
85
|
connector: Api;
|
|
38
|
-
|
|
86
|
+
useSso?: boolean;
|
|
87
|
+
}): Promise<ResolvedConnection>;
|
|
88
|
+
/**
|
|
89
|
+
* Builds a remediation hint to append to a downstream failure when the connection
|
|
90
|
+
* was **auto-selected** (no `--connection-id` was provided) rather than explicitly
|
|
91
|
+
* chosen — either the sole connection for the connector, or the first SSO
|
|
92
|
+
* connection under `--use-sso`. For tabular connectors the connection needs to
|
|
93
|
+
* have access to the target resource, so a failure may not clearly indicate the
|
|
94
|
+
* root cause — this spells out both possibilities so an operator or agent can act.
|
|
95
|
+
*/
|
|
96
|
+
export declare function autoSelectedConnectionHint(connectionId: string, connectorLabel: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* Runs a downstream connector API call and, when the connection was
|
|
99
|
+
* auto-selected, appends {@link autoSelectedConnectionHint} to the error message
|
|
100
|
+
* on failure. The original error instance is preserved (message is mutated in
|
|
101
|
+
* place) so its type and `exitCode` survive to the top-level handler.
|
|
102
|
+
*
|
|
103
|
+
* `UsageError`s are left untouched — they are the CLI's own control-flow errors
|
|
104
|
+
* ("re-run with --dataset"), not backend failures, so the connection hint would
|
|
105
|
+
* be noise.
|
|
106
|
+
*/
|
|
107
|
+
export declare function withAutoSelectedConnectionHintAsync<T>(op: () => Promise<T>, context: {
|
|
108
|
+
autoSelected: boolean;
|
|
109
|
+
connectionId: string;
|
|
110
|
+
connectorLabel: string;
|
|
111
|
+
}): Promise<T>;
|
|
39
112
|
/**
|
|
40
113
|
* Best-effort request that the calling application be added to a connection's
|
|
41
114
|
* API Hubs ACL via the Power Platform user-consent endpoint. The server reads
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectorHelpers.d.ts","sourceRoot":"","sources":["../../src/Verbs/ConnectorHelpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ConnectorHelpers.d.ts","sourceRoot":"","sources":["../../src/Verbs/ConnectorHelpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,GAAG,EAEH,4BAA4B,EAC7B,MAAM,iCAAiC,CAAC;AAazC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAKtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAe,MAAM,gBAAgB,CAAC;AAY3D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,GAAG,SAAS,GAClD,OAAO,CAAC,MAAM,CAAC,CA2CjB;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,6BAA6B,CACjD,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IACT,SAAS,EAAE,GAAG,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,4BAA4B,CAAC;CACtC,CAAC,CA6CD;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,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