@microsoft/managed-apps-cli 0.7.0 → 0.8.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 +31 -1
- package/dist/ArgumentProvider.d.ts +11 -0
- package/dist/ArgumentProvider.d.ts.map +1 -1
- package/dist/ArgumentProvider.js +36 -1
- package/dist/ArgumentProvider.js.map +1 -1
- package/dist/Cli.d.ts.map +1 -1
- package/dist/Cli.js +1 -0
- package/dist/Cli.js.map +1 -1
- package/dist/CliSettings.d.ts.map +1 -1
- package/dist/CliSettings.js +1 -2
- package/dist/CliSettings.js.map +1 -1
- package/dist/CliUtils.d.ts +9 -2
- package/dist/CliUtils.d.ts.map +1 -1
- package/dist/CliUtils.js +4 -0
- package/dist/CliUtils.js.map +1 -1
- package/dist/Constants/CommandRegistry.d.ts.map +1 -1
- package/dist/Constants/CommandRegistry.js +28 -1
- package/dist/Constants/CommandRegistry.js.map +1 -1
- package/dist/Constants/HelpStrings.d.ts +54 -4
- package/dist/Constants/HelpStrings.d.ts.map +1 -1
- package/dist/Constants/HelpStrings.js +104 -33
- package/dist/Constants/HelpStrings.js.map +1 -1
- package/dist/Errors/GitHubErrorMap.d.ts.map +1 -1
- package/dist/Errors/GitHubErrorMap.js +1 -1
- package/dist/Errors/GitHubErrorMap.js.map +1 -1
- package/dist/FS/CliFs.d.ts.map +1 -1
- package/dist/FS/CliFs.js.map +1 -1
- package/dist/HttpClient/CliHttpClient.d.ts +17 -0
- package/dist/HttpClient/CliHttpClient.d.ts.map +1 -1
- package/dist/HttpClient/CliHttpClient.js +112 -1
- package/dist/HttpClient/CliHttpClient.js.map +1 -1
- package/dist/Logger/CliLogger.d.ts.map +1 -1
- package/dist/Logger/CliLogger.js +1 -1
- package/dist/Logger/CliLogger.js.map +1 -1
- package/dist/Types/Command.types.d.ts +14 -3
- package/dist/Types/Command.types.d.ts.map +1 -1
- package/dist/Types/Command.types.js +4 -0
- package/dist/Types/Command.types.js.map +1 -1
- package/dist/Utils/BuildPolling.d.ts +18 -0
- package/dist/Utils/BuildPolling.d.ts.map +1 -0
- package/dist/Utils/BuildPolling.js +63 -0
- package/dist/Utils/BuildPolling.js.map +1 -0
- package/dist/Utils/BuildVerbDescriptionTable.d.ts +11 -1
- package/dist/Utils/BuildVerbDescriptionTable.d.ts.map +1 -1
- package/dist/Utils/BuildVerbDescriptionTable.js +73 -17
- package/dist/Utils/BuildVerbDescriptionTable.js.map +1 -1
- package/dist/Utils/DcfRecovery.d.ts +84 -0
- package/dist/Utils/DcfRecovery.d.ts.map +1 -0
- package/dist/Utils/DcfRecovery.js +258 -0
- package/dist/Utils/DcfRecovery.js.map +1 -0
- package/dist/Utils/EnhanceNetworkError.d.ts.map +1 -1
- package/dist/Utils/EnhanceNetworkError.js +2 -0
- package/dist/Utils/EnhanceNetworkError.js.map +1 -1
- 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/ResolveCommand.d.ts +7 -1
- package/dist/Utils/ResolveCommand.d.ts.map +1 -1
- package/dist/Utils/ResolveCommand.js +38 -20
- package/dist/Utils/ResolveCommand.js.map +1 -1
- package/dist/Verbs/AddConnector.d.ts.map +1 -1
- package/dist/Verbs/AddConnector.js.map +1 -1
- package/dist/Verbs/AddConnectorFlows.d.ts.map +1 -1
- package/dist/Verbs/AddConnectorFlows.js +2 -2
- package/dist/Verbs/AddConnectorFlows.js.map +1 -1
- package/dist/Verbs/BuildMaafApp.d.ts.map +1 -1
- package/dist/Verbs/BuildMaafApp.js +98 -22
- package/dist/Verbs/BuildMaafApp.js.map +1 -1
- package/dist/Verbs/ConnectorHelpers.d.ts.map +1 -1
- package/dist/Verbs/ConnectorHelpers.js.map +1 -1
- package/dist/Verbs/CreateMaafApp.d.ts +49 -0
- package/dist/Verbs/CreateMaafApp.d.ts.map +1 -1
- package/dist/Verbs/CreateMaafApp.js +197 -215
- package/dist/Verbs/CreateMaafApp.js.map +1 -1
- package/dist/Verbs/DeployMaafApp.d.ts.map +1 -1
- package/dist/Verbs/DeployMaafApp.js +48 -20
- package/dist/Verbs/DeployMaafApp.js.map +1 -1
- package/dist/Verbs/GetMaafBuildStatus.d.ts.map +1 -1
- package/dist/Verbs/GetMaafBuildStatus.js +66 -17
- package/dist/Verbs/GetMaafBuildStatus.js.map +1 -1
- package/dist/Verbs/Init.d.ts.map +1 -1
- package/dist/Verbs/Init.js +44 -2
- package/dist/Verbs/Init.js.map +1 -1
- package/dist/Verbs/ListFlows.d.ts.map +1 -1
- package/dist/Verbs/ListFlows.js +1 -2
- package/dist/Verbs/ListFlows.js.map +1 -1
- package/dist/Verbs/PlayMaafApp.d.ts +22 -0
- package/dist/Verbs/PlayMaafApp.d.ts.map +1 -0
- package/dist/Verbs/PlayMaafApp.js +147 -0
- package/dist/Verbs/PlayMaafApp.js.map +1 -0
- package/dist/Verbs/RefreshDataSource.d.ts.map +1 -1
- package/dist/Verbs/RefreshDataSource.js.map +1 -1
- package/dist/Verbs/RefreshGitAuth.d.ts.map +1 -1
- package/dist/Verbs/RefreshGitAuth.js +1 -1
- package/dist/Verbs/RefreshGitAuth.js.map +1 -1
- package/dist/Verbs/ShareLinkCreate.d.ts +23 -0
- package/dist/Verbs/ShareLinkCreate.d.ts.map +1 -0
- package/dist/Verbs/ShareLinkCreate.js +73 -0
- package/dist/Verbs/ShareLinkCreate.js.map +1 -0
- package/dist/Verbs/ShareLinkList.d.ts +16 -0
- package/dist/Verbs/ShareLinkList.d.ts.map +1 -0
- package/dist/Verbs/ShareLinkList.js +84 -0
- package/dist/Verbs/ShareLinkList.js.map +1 -0
- package/dist/Verbs/ShareLinkRevoke.d.ts +22 -0
- package/dist/Verbs/ShareLinkRevoke.d.ts.map +1 -0
- package/dist/Verbs/ShareLinkRevoke.js +137 -0
- package/dist/Verbs/ShareLinkRevoke.js.map +1 -0
- package/dist/Verbs/VerbConstants.d.ts +104 -8
- package/dist/Verbs/VerbConstants.d.ts.map +1 -1
- package/dist/Verbs/VerbConstants.js +96 -13
- package/dist/Verbs/VerbConstants.js.map +1 -1
- package/dist/Verbs/index.d.ts +4 -0
- package/dist/Verbs/index.d.ts.map +1 -1
- package/dist/Verbs/index.js +4 -0
- package/dist/Verbs/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import type { RepoType } from '@microsoft/managed-apps-common/config';
|
|
5
|
+
/** Verbs that currently invoke the DCF catch-and-retry recovery flow. */
|
|
6
|
+
export type DcfRecoveryVerb = 'app create' | 'app init' | 'app build' | 'app deploy';
|
|
7
|
+
export interface DcfRecoveryOptions {
|
|
8
|
+
remoteUrl: string;
|
|
9
|
+
tenantId: string;
|
|
10
|
+
jsonMode: boolean;
|
|
11
|
+
openBrowser: boolean;
|
|
12
|
+
/** The CLI verb invoking the recovery — drives the telemetry event prefix and error context. */
|
|
13
|
+
verb: DcfRecoveryVerb;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Inline DCF recovery branch for the github catch-and-retry. SIGINT handling
|
|
17
|
+
* is scoped to this helper so Ctrl+C during the device-code polling loop
|
|
18
|
+
* doesn't leak a listener back to the verb's outer body. Server errors thrown
|
|
19
|
+
* by `authenticateForRepoAsync` are mapped through
|
|
20
|
+
* {@link mapGitHubServerErrorToCliError} before being rethrown so the verb's
|
|
21
|
+
* outer catch (and the single-retry contract) sees CLI-typed errors.
|
|
22
|
+
*
|
|
23
|
+
* Telemetry event prefix is derived from the verb (e.g. `'app create'` →
|
|
24
|
+
* `'Maaf.Create.GitHubDcfRecovery'`) — keeps the call site a one-liner that
|
|
25
|
+
* can't drift out of sync with the verb field.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runDcfRecoveryAsync(options: DcfRecoveryOptions): Promise<void>;
|
|
28
|
+
export interface WithGitHubDcfRecoveryOptions {
|
|
29
|
+
/**
|
|
30
|
+
* The repo binding mode from `ms.config.json`. Non-`'github'` short-circuits:
|
|
31
|
+
* the attempt error is rethrown untouched and no DCF recovery is attempted.
|
|
32
|
+
* Accepts `undefined` so the legacy/native-only verb paths (where no
|
|
33
|
+
* `ms.config.json` is loaded yet) can flow through with the same call shape.
|
|
34
|
+
*/
|
|
35
|
+
repoType: RepoType | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The external repository URL the attempt was authenticating against.
|
|
38
|
+
* Required for `github` recovery — `undefined` triggers a verb-agnostic
|
|
39
|
+
* legacy guard that throws an actionable {@link AuthenticationError} before
|
|
40
|
+
* we'd otherwise crash inside DCF (which needs a URL to parse host/owner/repo).
|
|
41
|
+
*/
|
|
42
|
+
externalRepoUrl: string | undefined;
|
|
43
|
+
tenantId: string;
|
|
44
|
+
jsonMode: boolean;
|
|
45
|
+
openBrowser: boolean;
|
|
46
|
+
verb: DcfRecoveryVerb;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Higher-order wrapper that bolts the GitHub catch-and-retry DCF recovery
|
|
50
|
+
* branch onto a single async attempt. Encapsulates the
|
|
51
|
+
*
|
|
52
|
+
* try { attempt } catch { match → DCF → retry attempt → map-on-failure }
|
|
53
|
+
*
|
|
54
|
+
* pattern that `ms app create`, `ms app init`, `ms app build`, and `ms app deploy`
|
|
55
|
+
* all need, so the verbs stay focused on their own happy-path flow.
|
|
56
|
+
*
|
|
57
|
+
* Contract:
|
|
58
|
+
* - The attempt runs at most twice; DCF runs at most once. No looping.
|
|
59
|
+
* - The attempt callback receives `{ isRetry: false }` on the first call
|
|
60
|
+
* and `{ isRetry: true }` on the post-DCF retry so callers can
|
|
61
|
+
* conditionally alter their request (e.g. drop `forceReauth` on retry
|
|
62
|
+
* so the just-refreshed mapping isn't bypassed again).
|
|
63
|
+
* - `repoType !== 'github'` is a no-op around the attempt — the original
|
|
64
|
+
* error escapes untouched so native/none verbs behave identically to the
|
|
65
|
+
* un-wrapped call.
|
|
66
|
+
* - First-attempt errors that {@link matchGitHubAuthError} doesn't recognize
|
|
67
|
+
* are mapped via {@link mapGitHubServerErrorToCliError} (for
|
|
68
|
+
* {@link GrsServerError}) before being rethrown; everything else escapes
|
|
69
|
+
* as-is.
|
|
70
|
+
* - A matching first-attempt error with no `externalRepoUrl` throws a
|
|
71
|
+
* verb-agnostic {@link AuthenticationError} before DCF is invoked — DCF
|
|
72
|
+
* itself requires a URL to derive host/owner/repo.
|
|
73
|
+
* - Second-attempt (post-DCF) errors follow the same map-and-rethrow
|
|
74
|
+
* contract; a still-matching error after DCF surfaces through the
|
|
75
|
+
* friendly mapper rather than looping the device flow.
|
|
76
|
+
*
|
|
77
|
+
* `runDcfRecovery` is an optional dependency seam — defaults to the real
|
|
78
|
+
* {@link runDcfRecoveryAsync}; tests inject a stub so they don't have to
|
|
79
|
+
* spin up the device-code polling loop.
|
|
80
|
+
*/
|
|
81
|
+
export declare function withGitHubDcfRecoveryAsync<T>(attempt: (context: {
|
|
82
|
+
isRetry: boolean;
|
|
83
|
+
}) => Promise<T>, options: WithGitHubDcfRecoveryOptions, runDcfRecovery?: typeof runDcfRecoveryAsync): Promise<T>;
|
|
84
|
+
//# sourceMappingURL=DcfRecovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DcfRecovery.d.ts","sourceRoot":"","sources":["../../src/Utils/DcfRecovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAStE,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC;AAErF,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,gGAAgG;IAChG,IAAI,EAAE,eAAe,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+EpF;AAqDD,MAAM,WAAW,4BAA4B;IAC3C;;;;;OAKG;IACH,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC/B;;;;;OAKG;IACH,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAsB,0BAA0B,CAAC,CAAC,EAChD,OAAO,EAAE,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EACtD,OAAO,EAAE,4BAA4B,EACrC,cAAc,GAAE,OAAO,mBAAyC,GAC/D,OAAO,CAAC,CAAC,CAAC,CA2EZ"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Shared inline Device Code Flow (DCF) recovery for the github catch-and-retry
|
|
6
|
+
* branch of `ms app create`, `ms app init`, `ms app build`, and `ms app deploy`.
|
|
7
|
+
* On a missing/expired/stale
|
|
8
|
+
* Entra↔GitHub identity mapping, the verb's outer catch calls this helper to
|
|
9
|
+
* prompt the user through the same device-code flow `ms git auth refresh` runs
|
|
10
|
+
* and then retries the failed action exactly once. SIGINT plumbing, telemetry,
|
|
11
|
+
* display selection, and error mapping all live here so the caller can stay
|
|
12
|
+
* focused on its own happy-path flow.
|
|
13
|
+
*/
|
|
14
|
+
import { authenticateForRepoAsync, GrsServerError, } from '@microsoft/managed-apps-actions';
|
|
15
|
+
import { getCliLogger } from '../CliSettings.js';
|
|
16
|
+
import { AuthenticationError } from '../Errors/CliError.js';
|
|
17
|
+
import { mapGitHubServerErrorToCliError, matchGitHubAuthError } from '../Errors/GitHubErrorMap.js';
|
|
18
|
+
import { printInfo } from './ConsoleOutput.js';
|
|
19
|
+
import { ConsoleGitHubDcfDisplay, JsonGitHubDcfDisplay } from './GitHubDcfFlow.js';
|
|
20
|
+
import { computeRepoHash, parseGitHubRepoUrl } from './RepoUrl.js';
|
|
21
|
+
/**
|
|
22
|
+
* Inline DCF recovery branch for the github catch-and-retry. SIGINT handling
|
|
23
|
+
* is scoped to this helper so Ctrl+C during the device-code polling loop
|
|
24
|
+
* doesn't leak a listener back to the verb's outer body. Server errors thrown
|
|
25
|
+
* by `authenticateForRepoAsync` are mapped through
|
|
26
|
+
* {@link mapGitHubServerErrorToCliError} before being rethrown so the verb's
|
|
27
|
+
* outer catch (and the single-retry contract) sees CLI-typed errors.
|
|
28
|
+
*
|
|
29
|
+
* Telemetry event prefix is derived from the verb (e.g. `'app create'` →
|
|
30
|
+
* `'Maaf.Create.GitHubDcfRecovery'`) — keeps the call site a one-liner that
|
|
31
|
+
* can't drift out of sync with the verb field.
|
|
32
|
+
*/
|
|
33
|
+
export async function runDcfRecoveryAsync(options) {
|
|
34
|
+
const { remoteUrl, tenantId, jsonMode, openBrowser, verb } = options;
|
|
35
|
+
const { host, owner, repo } = parseGitHubRepoUrl(remoteUrl);
|
|
36
|
+
const repoHash = computeRepoHash(owner, repo);
|
|
37
|
+
const logger = getCliLogger();
|
|
38
|
+
const eventPrefix = telemetryEventPrefixForVerb(verb);
|
|
39
|
+
// Telemetry: PII-safe — host is the parsed string, repoHash is a truncated
|
|
40
|
+
// SHA256. Emit Start at the top so a recovery that never reaches the retry
|
|
41
|
+
// (e.g. user denied auth) is still observable.
|
|
42
|
+
logger.trackActivityEvent(eventPrefix, {
|
|
43
|
+
repoHost: host,
|
|
44
|
+
repoHash,
|
|
45
|
+
});
|
|
46
|
+
if (!jsonMode) {
|
|
47
|
+
printInfo('GitHub authentication is required to bind this repository.');
|
|
48
|
+
}
|
|
49
|
+
const display = composeRecoveryDisplay({ isJson: jsonMode, openBrowser });
|
|
50
|
+
// SIGINT plumbing: a Ctrl+C during the (potentially 15-minute) polling
|
|
51
|
+
// loop drops us out cleanly rather than leaving a dangling promise.
|
|
52
|
+
const controller = new AbortController();
|
|
53
|
+
const onSigint = () => {
|
|
54
|
+
controller.abort();
|
|
55
|
+
};
|
|
56
|
+
process.once('SIGINT', onSigint);
|
|
57
|
+
try {
|
|
58
|
+
await authenticateForRepoAsync({
|
|
59
|
+
remoteUrl: `https://${host}/${owner}/${repo}`,
|
|
60
|
+
tenantId,
|
|
61
|
+
logger,
|
|
62
|
+
display,
|
|
63
|
+
// Browser launch is gated by the `display` object above: `composeRecoveryDisplay`
|
|
64
|
+
// returns a display whose `openVerificationUri` is undefined by default (no
|
|
65
|
+
// --open-browser flag). `skipBrowser` is the legacy lower-level kill-switch;
|
|
66
|
+
// hardcode to false so the display contract is the single source of truth.
|
|
67
|
+
skipBrowser: false,
|
|
68
|
+
signal: controller.signal,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
// Pair the Start event with a Failed event on every error path so a
|
|
73
|
+
// recovery that throws (DCF declined, server error, abort) still shows
|
|
74
|
+
// up as a closed pair in the activity stream rather than an orphaned Start.
|
|
75
|
+
logger.trackActivityEvent(`${eventPrefix}.Failed`, {
|
|
76
|
+
repoHost: host,
|
|
77
|
+
repoHash,
|
|
78
|
+
});
|
|
79
|
+
if (error instanceof GrsServerError) {
|
|
80
|
+
const mapped = mapGitHubServerErrorToCliError({
|
|
81
|
+
code: error.code,
|
|
82
|
+
message: error.message,
|
|
83
|
+
status: error.status,
|
|
84
|
+
details: error.details,
|
|
85
|
+
}, { repoUrl: remoteUrl, verb });
|
|
86
|
+
if (mapped)
|
|
87
|
+
throw mapped;
|
|
88
|
+
}
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
process.removeListener('SIGINT', onSigint);
|
|
93
|
+
}
|
|
94
|
+
logger.trackActivityEvent(`${eventPrefix}.Complete`, {
|
|
95
|
+
repoHost: host,
|
|
96
|
+
repoHash,
|
|
97
|
+
});
|
|
98
|
+
if (!jsonMode) {
|
|
99
|
+
// Printed here (before the helper returns) rather than at the retry
|
|
100
|
+
// call site so it's adjacent to the DCF-completed telemetry event. If
|
|
101
|
+
// the subsequent verb retry hard-fails, the user sees this followed by the failure message.
|
|
102
|
+
// Still accurate: we DID resume; the resumed call is what failed.
|
|
103
|
+
printInfo(resumeMessageForVerb(verb));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Verb-specific "resuming X..." message shown after a successful DCF recovery. */
|
|
107
|
+
function resumeMessageForVerb(verb) {
|
|
108
|
+
switch (verb) {
|
|
109
|
+
case 'app create':
|
|
110
|
+
return 'Resuming create...';
|
|
111
|
+
case 'app init':
|
|
112
|
+
return 'Resuming init...';
|
|
113
|
+
case 'app build':
|
|
114
|
+
return 'Resuming build...';
|
|
115
|
+
case 'app deploy':
|
|
116
|
+
return 'Resuming deploy...';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Build the right {@link GitHubDcfDisplay} for the recovery path:
|
|
121
|
+
* - JSON mode → NDJSON events, never opens a browser.
|
|
122
|
+
* - Default (no `--open-browser`) → console output, browser launch suppressed.
|
|
123
|
+
* - `--open-browser` → console output + best-effort browser launch (TTY-gated).
|
|
124
|
+
*/
|
|
125
|
+
function composeRecoveryDisplay(opts) {
|
|
126
|
+
if (opts.isJson) {
|
|
127
|
+
return new JsonGitHubDcfDisplay();
|
|
128
|
+
}
|
|
129
|
+
if (opts.openBrowser) {
|
|
130
|
+
return ConsoleGitHubDcfDisplay;
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
...ConsoleGitHubDcfDisplay,
|
|
134
|
+
openVerificationUri: undefined,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Map a verb name to its telemetry event prefix. Keeps the create and build
|
|
139
|
+
* events under their respective `Maaf.Create.*` / `Maaf.Build.*` namespaces
|
|
140
|
+
* so dashboards that filter by namespace continue to work.
|
|
141
|
+
*/
|
|
142
|
+
function telemetryEventPrefixForVerb(verb) {
|
|
143
|
+
switch (verb) {
|
|
144
|
+
case 'app create':
|
|
145
|
+
return 'Maaf.Create.GitHubDcfRecovery';
|
|
146
|
+
case 'app init':
|
|
147
|
+
return 'Maaf.Init.GitHubDcfRecovery';
|
|
148
|
+
case 'app build':
|
|
149
|
+
return 'Maaf.Build.GitHubDcfRecovery';
|
|
150
|
+
case 'app deploy':
|
|
151
|
+
return 'Maaf.Deploy.GitHubDcfRecovery';
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Higher-order wrapper that bolts the GitHub catch-and-retry DCF recovery
|
|
156
|
+
* branch onto a single async attempt. Encapsulates the
|
|
157
|
+
*
|
|
158
|
+
* try { attempt } catch { match → DCF → retry attempt → map-on-failure }
|
|
159
|
+
*
|
|
160
|
+
* pattern that `ms app create`, `ms app init`, `ms app build`, and `ms app deploy`
|
|
161
|
+
* all need, so the verbs stay focused on their own happy-path flow.
|
|
162
|
+
*
|
|
163
|
+
* Contract:
|
|
164
|
+
* - The attempt runs at most twice; DCF runs at most once. No looping.
|
|
165
|
+
* - The attempt callback receives `{ isRetry: false }` on the first call
|
|
166
|
+
* and `{ isRetry: true }` on the post-DCF retry so callers can
|
|
167
|
+
* conditionally alter their request (e.g. drop `forceReauth` on retry
|
|
168
|
+
* so the just-refreshed mapping isn't bypassed again).
|
|
169
|
+
* - `repoType !== 'github'` is a no-op around the attempt — the original
|
|
170
|
+
* error escapes untouched so native/none verbs behave identically to the
|
|
171
|
+
* un-wrapped call.
|
|
172
|
+
* - First-attempt errors that {@link matchGitHubAuthError} doesn't recognize
|
|
173
|
+
* are mapped via {@link mapGitHubServerErrorToCliError} (for
|
|
174
|
+
* {@link GrsServerError}) before being rethrown; everything else escapes
|
|
175
|
+
* as-is.
|
|
176
|
+
* - A matching first-attempt error with no `externalRepoUrl` throws a
|
|
177
|
+
* verb-agnostic {@link AuthenticationError} before DCF is invoked — DCF
|
|
178
|
+
* itself requires a URL to derive host/owner/repo.
|
|
179
|
+
* - Second-attempt (post-DCF) errors follow the same map-and-rethrow
|
|
180
|
+
* contract; a still-matching error after DCF surfaces through the
|
|
181
|
+
* friendly mapper rather than looping the device flow.
|
|
182
|
+
*
|
|
183
|
+
* `runDcfRecovery` is an optional dependency seam — defaults to the real
|
|
184
|
+
* {@link runDcfRecoveryAsync}; tests inject a stub so they don't have to
|
|
185
|
+
* spin up the device-code polling loop.
|
|
186
|
+
*/
|
|
187
|
+
export async function withGitHubDcfRecoveryAsync(attempt, options, runDcfRecovery = runDcfRecoveryAsync) {
|
|
188
|
+
const { repoType, externalRepoUrl, tenantId, jsonMode, openBrowser, verb } = options;
|
|
189
|
+
// Local helper: if `e` is a recognized GrsServerError, return the friendly
|
|
190
|
+
// CLI-typed error; otherwise null. Closes over `externalRepoUrl`/`verb` so
|
|
191
|
+
// the two non-matching call sites below stay one line each and can't drift.
|
|
192
|
+
const mapGrsError = (e) => {
|
|
193
|
+
if (!(e instanceof GrsServerError))
|
|
194
|
+
return null;
|
|
195
|
+
return mapGitHubServerErrorToCliError({ code: e.code, message: e.message, status: e.status, details: e.details }, { repoUrl: externalRepoUrl, verb });
|
|
196
|
+
};
|
|
197
|
+
try {
|
|
198
|
+
// Happy path: attempt succeeds on the first try, no DCF, no retry.
|
|
199
|
+
return await attempt({ isRetry: false });
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
if (repoType !== 'github')
|
|
203
|
+
throw err;
|
|
204
|
+
const matched = matchGitHubAuthError(err);
|
|
205
|
+
if (!matched) {
|
|
206
|
+
// Non-matching first-attempt error: map known server errors to friendly
|
|
207
|
+
// CLI errors, otherwise rethrow untouched.
|
|
208
|
+
const mapped = mapGrsError(err);
|
|
209
|
+
if (mapped)
|
|
210
|
+
throw mapped;
|
|
211
|
+
throw err;
|
|
212
|
+
}
|
|
213
|
+
// Legacy guard: apps created before `externalRepoUrl` was persisted to
|
|
214
|
+
// ms.config.json hit this branch with no URL to authenticate against.
|
|
215
|
+
// Fail fast with an actionable message rather than crashing inside DCF
|
|
216
|
+
// recovery (which would also bypass the Start telemetry).
|
|
217
|
+
if (!externalRepoUrl) {
|
|
218
|
+
throw new AuthenticationError('GitHub authentication is required, but the app config does not record the external ' +
|
|
219
|
+
'repository URL needed to recover the identity mapping. This app may have been created ' +
|
|
220
|
+
'before the URL was persisted to `ms.config.json`. Either add ' +
|
|
221
|
+
'`externalRepoUrl: "<your repo url>"` to `ms.config.json`, or recreate the app with ' +
|
|
222
|
+
`\`ms app create --repo <your repo url>\`, then run \`ms ${verb}\` again.`);
|
|
223
|
+
}
|
|
224
|
+
await runDcfRecovery({
|
|
225
|
+
remoteUrl: externalRepoUrl,
|
|
226
|
+
tenantId,
|
|
227
|
+
jsonMode,
|
|
228
|
+
openBrowser,
|
|
229
|
+
verb,
|
|
230
|
+
});
|
|
231
|
+
try {
|
|
232
|
+
return await attempt({ isRetry: true });
|
|
233
|
+
}
|
|
234
|
+
catch (retryErr) {
|
|
235
|
+
const remapped = matchGitHubAuthError(retryErr);
|
|
236
|
+
if (remapped) {
|
|
237
|
+
// Single-retry contract: a still-matching error after DCF surfaces
|
|
238
|
+
// through the friendly verb-agnostic mapper so the user sees the
|
|
239
|
+
// same wording as on a first-attempt mapping failure. We deliberately
|
|
240
|
+
// do NOT loop DCF — repeated failures suggest the user can't complete
|
|
241
|
+
// the device-code flow and another loop would just hang. Fall through
|
|
242
|
+
// to `retryErr` if the mapper somehow returns null (defensive — the
|
|
243
|
+
// mapper recognizes every code matchGitHubAuthError matches on).
|
|
244
|
+
const mapped = mapGitHubServerErrorToCliError(remapped.payload, {
|
|
245
|
+
repoUrl: externalRepoUrl,
|
|
246
|
+
verb,
|
|
247
|
+
});
|
|
248
|
+
throw mapped ?? retryErr;
|
|
249
|
+
}
|
|
250
|
+
// Non-matching retry error: same map-or-rethrow shape as the first attempt.
|
|
251
|
+
const mapped = mapGrsError(retryErr);
|
|
252
|
+
if (mapped)
|
|
253
|
+
throw mapped;
|
|
254
|
+
throw retryErr;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=DcfRecovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DcfRecovery.js","sourceRoot":"","sources":["../../src/Utils/DcfRecovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EACL,wBAAwB,EAExB,cAAc,GACf,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,8BAA8B,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAchE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAA2B;IACnE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACrE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,E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AAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhanceNetworkError.d.ts","sourceRoot":"","sources":["../../src/Utils/EnhanceNetworkError.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"EnhanceNetworkError.d.ts","sourceRoot":"","sources":["../../src/Utils/EnhanceNetworkError.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAgDtF"}
|
|
@@ -21,6 +21,7 @@ export function enhanceNetworkError(error, method, url) {
|
|
|
21
21
|
const cause = error.cause;
|
|
22
22
|
if (cause) {
|
|
23
23
|
const errorCode = cause.code || cause.errno;
|
|
24
|
+
cause.code = errorCode; // Ensure code is on the cause for easier access
|
|
24
25
|
if (errorCode === 'ENOTFOUND') {
|
|
25
26
|
detailedMessage += ` DNS lookup failed - unable to resolve hostname.`;
|
|
26
27
|
}
|
|
@@ -52,6 +53,7 @@ export function enhanceNetworkError(error, method, url) {
|
|
|
52
53
|
`VPN/proxy configuration, firewall/certificate issues, or server not reachable.`;
|
|
53
54
|
}
|
|
54
55
|
const enhancedError = new Error(detailedMessage);
|
|
56
|
+
enhancedError.name = cause?.code;
|
|
55
57
|
enhancedError.cause = error;
|
|
56
58
|
return enhancedError;
|
|
57
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhanceNetworkError.js","sourceRoot":"","sources":["../../src/Utils/EnhanceNetworkError.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,uDAAuD;AACvD;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,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HANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
export type CliEnvVarName = 'USE_SP_AUTH' | 'SP_CLIENT_ID' | 'SP_CLIENT_SECRET' | 'SP_TENANT_ID' | 'USE_HTTP_FORWARD' | 'HTTP_FORWARD_URL' | 'HTTP_FORWARD_AUTH_TOKEN' | 'HTTP_FORWARD_TENANT_ID' | 'ENABLE_CONNECTOR_USER_CONSENT' | 'REMOTE_TELEMETRY' | 'CONSOLE_TELEMETRY' | 'CONFIG_DIR' | 'WORKING_DIRECTORY' | 'MAAF_DEBUG_ENVIRONMENT_ID' | 'MAAF_GRS_ENDPOINT_OVERRIDE' | 'ENVIRONMENT_ID' | 'APP_DISPLAY_NAME' | 'APP_DESCRIPTION' | 'APP_ID' | 'APP_TEMPLATE' | 'APP_REPOSITORY_ID' | 'APP_REPO' | 'LOCAL_APP_URL' | 'BUILD_PATH' | 'BUILD_COMMAND' | 'BUILD_ENTRY_POINT' | 'LOGO_PATH' | 'CONFIG_ONLY' | 'PORT' | 'CLOUD_INSTANCE' | 'API_ID' | 'CONNECTION_ID' | 'CONNECTION_REF' | 'CONNECTOR_ID' | 'CONNECTOR_SEARCH' | 'CONNECTOR_ACTION_SEARCH' | 'DATASET' | 'TABLE' | 'TABLE_NAME' | 'DATA_SOURCE_NAME' | 'SEARCH_TERM' | 'DATAVERSE_API_SEARCH_TERM' | 'SQL_STORED_PROCEDURE' | 'ENV_URL' | 'SOLUTION_ID' | 'ADD_CONNECTOR_AS' | 'FLOW_ID' | 'FLOW_SEARCH' | 'FLOW_DATA_SOURCE_NAME' | 'REMOVE_FLOW_ID' | 'MAAF_APP_NAME' | 'MAAF_APP_ACCESS' | 'MAAF_COMMIT_SHA' | '
|
|
4
|
+
export type CliEnvVarName = 'USE_SP_AUTH' | 'SP_CLIENT_ID' | 'SP_CLIENT_SECRET' | 'SP_TENANT_ID' | 'USE_HTTP_FORWARD' | 'HTTP_FORWARD_URL' | 'HTTP_FORWARD_AUTH_TOKEN' | 'HTTP_FORWARD_TENANT_ID' | 'ENABLE_CONNECTOR_USER_CONSENT' | 'REMOTE_TELEMETRY' | 'CONSOLE_TELEMETRY' | 'CONFIG_DIR' | 'WORKING_DIRECTORY' | 'MAAF_DEBUG_ENVIRONMENT_ID' | 'MAAF_GRS_ENDPOINT_OVERRIDE' | 'ENVIRONMENT_ID' | 'APP_DISPLAY_NAME' | 'APP_DESCRIPTION' | 'APP_ID' | 'APP_TEMPLATE' | 'APP_REPOSITORY_ID' | 'APP_REPO' | 'LOCAL_APP_URL' | 'BUILD_PATH' | 'BUILD_COMMAND' | 'BUILD_ENTRY_POINT' | 'LOGO_PATH' | 'CONFIG_ONLY' | 'PORT' | 'CLOUD_INSTANCE' | 'API_ID' | 'CONNECTION_ID' | 'CONNECTION_REF' | 'CONNECTOR_ID' | 'CONNECTOR_SEARCH' | 'CONNECTOR_ACTION_SEARCH' | 'DATASET' | 'TABLE' | 'TABLE_NAME' | 'DATA_SOURCE_NAME' | 'SEARCH_TERM' | 'DATAVERSE_API_SEARCH_TERM' | 'SQL_STORED_PROCEDURE' | 'ENV_URL' | 'SOLUTION_ID' | 'ADD_CONNECTOR_AS' | 'FLOW_ID' | 'FLOW_SEARCH' | 'FLOW_DATA_SOURCE_NAME' | 'REMOVE_FLOW_ID' | 'MAAF_APP_NAME' | 'MAAF_APP_ACCESS' | 'MAAF_COMMIT_SHA' | 'MAAF_PLAY_MODE' | 'MAAF_ENVIRONMENT_ID' | 'MAAF_SHARE_LINK_ID' | 'MAAF_DEPLOY_ARTIFACT' | 'MAAF_GITHUB_REPO' | 'LIST_ENVIRONMENT_ID' | 'LIST_PERMISSION' | 'SKIP_CODEGEN' | 'USE_V1_CODEGEN' | 'APP_SHOW_HEADER';
|
|
5
5
|
export declare function cliEnvVarFullName(name: CliEnvVarName): string;
|
|
6
6
|
export declare function getCliEnvVar(name: CliEnvVarName): string | undefined;
|
|
7
7
|
export declare function getCliEnvVarBool(name: CliEnvVarName): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvVars.d.ts","sourceRoot":"","sources":["../../src/Utils/EnvVars.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,MAAM,aAAa,GAErB,aAAa,GACb,cAAc,GACd,kBAAkB,GAClB,cAAc,GAEd,kBAAkB,GAClB,kBAAkB,GAClB,yBAAyB,GACzB,wBAAwB,GAExB,+BAA+B,GAE/B,kBAAkB,GAClB,mBAAmB,GAEnB,YAAY,GACZ,mBAAmB,GACnB,2BAA2B,GAC3B,4BAA4B,GAE5B,gBAAgB,GAChB,kBAAkB,GAClB,iBAAiB,GACjB,QAAQ,GACR,cAAc,GACd,mBAAmB,GACnB,UAAU,GACV,eAAe,GACf,YAAY,GACZ,eAAe,GACf,mBAAmB,GACnB,WAAW,GACX,aAAa,GACb,MAAM,GACN,gBAAgB,GAEhB,QAAQ,GACR,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,kBAAkB,GAClB,yBAAyB,GACzB,SAAS,GACT,OAAO,GACP,YAAY,GACZ,kBAAkB,GAClB,aAAa,GACb,2BAA2B,GAC3B,sBAAsB,GACtB,SAAS,GACT,aAAa,GACb,kBAAkB,GAElB,SAAS,GACT,aAAa,GACb,uBAAuB,GACvB,gBAAgB,GAEhB,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,
|
|
1
|
+
{"version":3,"file":"EnvVars.d.ts","sourceRoot":"","sources":["../../src/Utils/EnvVars.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,MAAM,aAAa,GAErB,aAAa,GACb,cAAc,GACd,kBAAkB,GAClB,cAAc,GAEd,kBAAkB,GAClB,kBAAkB,GAClB,yBAAyB,GACzB,wBAAwB,GAExB,+BAA+B,GAE/B,kBAAkB,GAClB,mBAAmB,GAEnB,YAAY,GACZ,mBAAmB,GACnB,2BAA2B,GAC3B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,GAAG,IAAI,CAErD;AAED,wBAAgB,WAAW,IAAI,OAAO,OAAO,CAAC,GAAG,CAEhD;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,OAAO,CAAC,GAAG,GAAG,IAAI,CAE7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvVars.js","sourceRoot":"","sources":["../../src/Utils/EnvVars.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"EnvVars.js","sourceRoot":"","sources":["../../src/Utils/EnvVars.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,MAAM,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC;AAkFvD,MAAM,UAAU,iBAAiB,CAAC,IAAmB;IACnD,OAAO,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAmB;IAC9C,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAmB;IAClD,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC;AACvC,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAmB,EAAE,KAAa;IAC7D,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAmB;IACjD,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,KAAa;IACzD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAA4B;IACrD,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -6,7 +6,13 @@ import type { CommandTree, NounKey, ResolvedCommand } from '../Types/Command.typ
|
|
|
6
6
|
* Resolves command-line tokens against the command tree.
|
|
7
7
|
*
|
|
8
8
|
* Every command lives under a noun, so the minimum match is 2 tokens (noun + verb).
|
|
9
|
-
* Typed
|
|
9
|
+
* Typed verbs may nest arbitrarily, so a command path can be any depth (e.g.
|
|
10
|
+
* `app add table` is 3 tokens, `app share link create` is 4). The walker
|
|
11
|
+
* descends as deep as it can; when a typed verb has its own handler ("hybrid"
|
|
12
|
+
* verb, like `app share`) and the next token does not name a known subcommand,
|
|
13
|
+
* it falls back to the parent handler so the remaining tokens become
|
|
14
|
+
* positional arguments — letting `ms app share alice@contoso.com` route to
|
|
15
|
+
* the `share` handler.
|
|
10
16
|
*
|
|
11
17
|
* @param argv - The full process.argv array (argv[0] = node, argv[1] = script)
|
|
12
18
|
* @param tree - The command tree to resolve against
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResolveCommand.d.ts","sourceRoot":"","sources":["../../src/Utils/ResolveCommand.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ResolveCommand.d.ts","sourceRoot":"","sources":["../../src/Utils/ResolveCommand.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAEV,WAAW,EAEX,OAAO,EACP,eAAe,EAEhB,MAAM,wBAAwB,CAAC;AAGhC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,GAAG,eAAe,GAAG,IAAI,CAWjG;AAyCD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,KAAK,IAAI,OAAO,CAE9E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAK1F"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import { isTypedVerbDef } from '../Types/Command.types.js';
|
|
4
|
+
import { hasParentHandler, isTypedVerbDef } from '../Types/Command.types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Resolves command-line tokens against the command tree.
|
|
7
7
|
*
|
|
8
8
|
* Every command lives under a noun, so the minimum match is 2 tokens (noun + verb).
|
|
9
|
-
* Typed
|
|
9
|
+
* Typed verbs may nest arbitrarily, so a command path can be any depth (e.g.
|
|
10
|
+
* `app add table` is 3 tokens, `app share link create` is 4). The walker
|
|
11
|
+
* descends as deep as it can; when a typed verb has its own handler ("hybrid"
|
|
12
|
+
* verb, like `app share`) and the next token does not name a known subcommand,
|
|
13
|
+
* it falls back to the parent handler so the remaining tokens become
|
|
14
|
+
* positional arguments — letting `ms app share alice@contoso.com` route to
|
|
15
|
+
* the `share` handler.
|
|
10
16
|
*
|
|
11
17
|
* @param argv - The full process.argv array (argv[0] = node, argv[1] = script)
|
|
12
18
|
* @param tree - The command tree to resolve against
|
|
@@ -14,30 +20,42 @@ import { isTypedVerbDef } from '../Types/Command.types.js';
|
|
|
14
20
|
*/
|
|
15
21
|
export function resolveCommand(argv, tree) {
|
|
16
22
|
const tokens = argv.slice(2);
|
|
17
|
-
// Skip if no tokens or first token looks like a flag
|
|
18
23
|
if (tokens.length === 0 || tokens[0].startsWith('-')) {
|
|
19
24
|
return null;
|
|
20
25
|
}
|
|
21
|
-
const [t0
|
|
26
|
+
const [t0] = tokens;
|
|
22
27
|
if (!isKnownNoun(t0, tree))
|
|
23
28
|
return null;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
return walkCommands(tree[t0].commands, tokens, 1, [t0]);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Recursively walks the command tree, consuming one token per level. Returns
|
|
33
|
+
* the deepest match. If a typed verb's next token doesn't match any sub but
|
|
34
|
+
* the typed verb itself has a handler, returns that handler (hybrid fallback).
|
|
35
|
+
*/
|
|
36
|
+
function walkCommands(commands, tokens, index, path) {
|
|
37
|
+
if (index >= tokens.length)
|
|
38
|
+
return null;
|
|
39
|
+
const token = tokens[index];
|
|
40
|
+
if (token.startsWith('-'))
|
|
41
|
+
return null;
|
|
42
|
+
const entry = commands[token];
|
|
43
|
+
if (!entry)
|
|
44
|
+
return null;
|
|
45
|
+
const nextPath = [...path, token];
|
|
46
|
+
if (!isTypedVerbDef(entry)) {
|
|
47
|
+
return { path: nextPath, handler: entry.handler, tokensConsumed: index + 1 };
|
|
48
|
+
}
|
|
49
|
+
// Typed verb — try to descend first.
|
|
50
|
+
const next = tokens[index + 1];
|
|
51
|
+
if (next && !next.startsWith('-')) {
|
|
52
|
+
const deeper = walkCommands(entry.commands, tokens, index + 1, nextPath);
|
|
53
|
+
if (deeper)
|
|
54
|
+
return deeper;
|
|
34
55
|
}
|
|
35
|
-
//
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
if (verbEntry && !isTypedVerbDef(verbEntry)) {
|
|
39
|
-
return { path: [t0, t1], handler: verbEntry.handler, tokensConsumed: 2 };
|
|
40
|
-
}
|
|
56
|
+
// No deeper match — fall back to the parent handler if this is a hybrid verb.
|
|
57
|
+
if (hasParentHandler(entry)) {
|
|
58
|
+
return { path: nextPath, handler: entry.handler, tokensConsumed: index + 1 };
|
|
41
59
|
}
|
|
42
60
|
return null;
|
|
43
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResolveCommand.js","sourceRoot":"","sources":["../../src/Utils/ResolveCommand.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"ResolveCommand.js","sourceRoot":"","sources":["../../src/Utils/ResolveCommand.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE1E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAC,IAAuB,EAAE,IAAiB;IACvE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE7B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;IACpB,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAExC,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AA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AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,IAAiB;IAC1D,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,IAAY,EAAE,IAAiB;IAC/E,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,SAAS,KAAK,SAAS,IAAI,cAAc,CAAC,SAAS,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddConnector.d.ts","sourceRoot":"","sources":["../../src/Verbs/AddConnector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAe5D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,iBAAiB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"AddConnector.d.ts","sourceRoot":"","sources":["../../src/Verbs/AddConnector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAe5D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,iBAAiB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgEzF"}
|
|
@@ -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;AAC7C,OAAO,EAAE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E,IAAI;SAC/B;QACD;YACE,KAAK,EAAE,EAAE,GAAG,EAAE,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE;YAC7C,GAAG,EAAE,qBAAqB,CAAC,EAAE,CAAC,MAAM;YACpC,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;YACrD,wBAAwB,EAAE,IAAI;SAC/B;KACF,CAAC,CAAC;IACH,gBAAgB,CAAC,SAAS,CAAC;QACzB,KAAK,EAAE,EAAE,GAAG,EAAE,qBAAqB,CAAC,WAAW,CAAC,IAAI,EAAE;QACtD,GAAG,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAAG;QAC1C,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW;KAC/D,CAAC,CAAC;IACH,gBAAgB,CAAC,SAAS,CAAC;QACzB,KAAK,EAAE,EAAE,GAAG,EAAE,qBAAqB,CAAC,YAAY,CAAC,IAAI,EAAE;QACvD,GAAG,EAAE,qBAAqB,CAAC,YAAY,CAAC,GAAG;QAC3C,WAAW,EAAE,gDAAgD;QAC7D,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddConnectorFlows.d.ts","sourceRoot":"","sources":["../../src/Verbs/AddConnectorFlows.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAGV,GAAG,EACH,4BAA4B,EAG7B,MAAM,iCAAiC,CAAC;AAWzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"AddConnectorFlows.d.ts","sourceRoot":"","sources":["../../src/Verbs/AddConnectorFlows.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAGV,GAAG,EACH,4BAA4B,EAG7B,MAAM,iCAAiC,CAAC;AAWzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAW5D;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;;;;OAIG;IACH,MAAM,CAAC,EAAE,4BAA4B,CAAC;CACvC;AAED,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2HhF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFlF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAE1D"}
|
|
@@ -7,7 +7,7 @@ import { promptSelectOrInput } from '../CliUtils.js';
|
|
|
7
7
|
import { CLI_BINARY_NAME } from '../Constants/CliConstants.js';
|
|
8
8
|
import { UsageError } from '../Errors/CliError.js';
|
|
9
9
|
import { printInfo, printSuccess, printTable } from '../Utils/ConsoleOutput.js';
|
|
10
|
-
import { requestCliUserConsentAsync, resolveConnectionInteractivelyAsync } from './ConnectorHelpers.js';
|
|
10
|
+
import { requestCliUserConsentAsync, resolveConnectionInteractivelyAsync, } from './ConnectorHelpers.js';
|
|
11
11
|
/**
|
|
12
12
|
* Runs the connection → dataset → table → addConnectorTableAsync flow.
|
|
13
13
|
* Caller must have already verified the connector exists, passed DLP, and
|
|
@@ -127,7 +127,7 @@ export async function runAddTableFlowAsync(args) {
|
|
|
127
127
|
* which we translate to a `UsageError`.
|
|
128
128
|
*/
|
|
129
129
|
export async function runAddActionFlowAsync(args) {
|
|
130
|
-
const { argumentProvider, connector, apiId, connectionIdFlag, skipCodegen, useV1Codegen, policy } = args;
|
|
130
|
+
const { argumentProvider, connector, apiId, connectionIdFlag, skipCodegen, useV1Codegen, policy, } = args;
|
|
131
131
|
const settings = getSettings();
|
|
132
132
|
const { fileConfig, cliFs } = settings;
|
|
133
133
|
const playerServiceConfig = getPlayerServiceConfig();
|