@microsoft/managed-apps-cli 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ArgumentProvider.d.ts.map +1 -1
- package/dist/ArgumentProvider.js +5 -3
- package/dist/ArgumentProvider.js.map +1 -1
- package/dist/Cli.d.ts.map +1 -1
- package/dist/Cli.js +2 -0
- package/dist/Cli.js.map +1 -1
- package/dist/Constants/HelpStrings.d.ts +2 -1
- package/dist/Constants/HelpStrings.d.ts.map +1 -1
- package/dist/Constants/HelpStrings.js +4 -1
- package/dist/Constants/HelpStrings.js.map +1 -1
- package/dist/Logger/LoggerSettings.d.ts +2 -3
- package/dist/Logger/LoggerSettings.d.ts.map +1 -1
- package/dist/Logger/LoggerSettings.js +3 -39
- package/dist/Logger/LoggerSettings.js.map +1 -1
- package/dist/Logger/OneDSWriter.d.ts.map +1 -1
- package/dist/Logger/OneDSWriter.js +3 -3
- package/dist/Logger/OneDSWriter.js.map +1 -1
- package/dist/Utils/BuildPolling.d.ts +27 -2
- package/dist/Utils/BuildPolling.d.ts.map +1 -1
- package/dist/Utils/BuildPolling.js +98 -22
- package/dist/Utils/BuildPolling.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/EnvironmentRoutingUtils.d.ts +55 -0
- package/dist/Utils/EnvironmentRoutingUtils.d.ts.map +1 -1
- package/dist/Utils/EnvironmentRoutingUtils.js +85 -1
- package/dist/Utils/EnvironmentRoutingUtils.js.map +1 -1
- package/dist/Utils/HelpBanner.d.ts +11 -0
- package/dist/Utils/HelpBanner.d.ts.map +1 -0
- package/dist/Utils/HelpBanner.js +15 -0
- package/dist/Utils/HelpBanner.js.map +1 -0
- package/dist/Utils/NodeVersionChecker.d.ts +13 -0
- package/dist/Utils/NodeVersionChecker.d.ts.map +1 -0
- package/dist/Utils/NodeVersionChecker.js +38 -0
- package/dist/Utils/NodeVersionChecker.js.map +1 -0
- package/dist/Verbs/CreateMaafApp.d.ts.map +1 -1
- package/dist/Verbs/CreateMaafApp.js +4 -15
- package/dist/Verbs/CreateMaafApp.js.map +1 -1
- package/dist/Verbs/DeployMaafApp.d.ts.map +1 -1
- package/dist/Verbs/DeployMaafApp.js +17 -80
- package/dist/Verbs/DeployMaafApp.js.map +1 -1
- package/dist/Verbs/GetMaafBuildStatus.d.ts.map +1 -1
- package/dist/Verbs/GetMaafBuildStatus.js +4 -37
- package/dist/Verbs/GetMaafBuildStatus.js.map +1 -1
- package/dist/Verbs/Init.d.ts.map +1 -1
- package/dist/Verbs/Init.js +6 -29
- package/dist/Verbs/Init.js.map +1 -1
- package/dist/Verbs/ListConnectorActions.d.ts.map +1 -1
- package/dist/Verbs/ListConnectorActions.js +16 -5
- package/dist/Verbs/ListConnectorActions.js.map +1 -1
- package/dist/Verbs/ListConnectors.d.ts.map +1 -1
- package/dist/Verbs/ListConnectors.js +16 -5
- package/dist/Verbs/ListConnectors.js.map +1 -1
- package/dist/Verbs/ListMaafApps.js +1 -1
- package/dist/Verbs/ListMaafApps.js.map +1 -1
- package/dist/Verbs/Pack.d.ts.map +1 -1
- package/dist/Verbs/Pack.js +11 -0
- package/dist/Verbs/Pack.js.map +1 -1
- package/dist/Verbs/VerbConstants.d.ts +10 -7
- package/dist/Verbs/VerbConstants.d.ts.map +1 -1
- package/dist/Verbs/VerbConstants.js +10 -7
- package/dist/Verbs/VerbConstants.js.map +1 -1
- package/package.json +6 -6
|
@@ -4,20 +4,88 @@
|
|
|
4
4
|
import { buildStatusAsync } from '@microsoft/managed-apps-actions';
|
|
5
5
|
import { getCliLogger } from '../CliSettings.js';
|
|
6
6
|
import { AppError } from '../Errors/CliError.js';
|
|
7
|
+
import { printInfo } from './ConsoleOutput.js';
|
|
7
8
|
import { CliSpinner } from './Spinner.js';
|
|
8
9
|
const MIN_POLL_INTERVAL_MS = 1000;
|
|
10
|
+
/**
|
|
11
|
+
* Extracts human-readable error detail from a `MaafBuildPollResult.result` value.
|
|
12
|
+
* Handles the documented `{ code, message }` structured shape, legacy plain-string
|
|
13
|
+
* results, and extended server fields (`error.message`, `error.buildOutput`,
|
|
14
|
+
* `buildOutput`) that may be present in actual responses beyond the typed contract.
|
|
15
|
+
*
|
|
16
|
+
* Shared between `build-status`, `build`, and `deploy` so all three commands
|
|
17
|
+
* surface identical error details when a server build fails.
|
|
18
|
+
*/
|
|
19
|
+
export function extractBuildErrorDetail(result) {
|
|
20
|
+
if (typeof result === 'string') {
|
|
21
|
+
const value = result.trim();
|
|
22
|
+
return value ? { errorMessage: value } : {};
|
|
23
|
+
}
|
|
24
|
+
if (!result || typeof result !== 'object') {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
const maybeResult = result;
|
|
28
|
+
const topLevelCode = typeof maybeResult.code === 'string' && maybeResult.code.trim()
|
|
29
|
+
? maybeResult.code.trim()
|
|
30
|
+
: undefined;
|
|
31
|
+
if (typeof maybeResult.error === 'string') {
|
|
32
|
+
const value = maybeResult.error.trim();
|
|
33
|
+
const errorMessage = composeErrorMessage(topLevelCode, value || undefined);
|
|
34
|
+
return errorMessage ? { errorMessage } : {};
|
|
35
|
+
}
|
|
36
|
+
let errorCode;
|
|
37
|
+
let errorMessage;
|
|
38
|
+
let buildOutput;
|
|
39
|
+
if (maybeResult.error && typeof maybeResult.error === 'object') {
|
|
40
|
+
const code = maybeResult.error.code;
|
|
41
|
+
const message = maybeResult.error.message;
|
|
42
|
+
const nestedBuildOutput = maybeResult.error.buildOutput;
|
|
43
|
+
errorCode = typeof code === 'string' && code.trim() ? code.trim() : undefined;
|
|
44
|
+
errorMessage = typeof message === 'string' && message.trim() ? message.trim() : undefined;
|
|
45
|
+
buildOutput =
|
|
46
|
+
typeof nestedBuildOutput === 'string' && nestedBuildOutput.trim()
|
|
47
|
+
? nestedBuildOutput.trim()
|
|
48
|
+
: undefined;
|
|
49
|
+
}
|
|
50
|
+
if (!errorMessage && typeof maybeResult.message === 'string' && maybeResult.message.trim()) {
|
|
51
|
+
errorMessage = maybeResult.message.trim();
|
|
52
|
+
}
|
|
53
|
+
if (!buildOutput &&
|
|
54
|
+
typeof maybeResult.buildOutput === 'string' &&
|
|
55
|
+
maybeResult.buildOutput.trim()) {
|
|
56
|
+
buildOutput = maybeResult.buildOutput.trim();
|
|
57
|
+
}
|
|
58
|
+
const formattedErrorMessage = composeErrorMessage(errorCode ?? topLevelCode, errorMessage);
|
|
59
|
+
return formattedErrorMessage || buildOutput
|
|
60
|
+
? { errorMessage: formattedErrorMessage, buildOutput }
|
|
61
|
+
: {};
|
|
62
|
+
}
|
|
9
63
|
/**
|
|
10
64
|
* Polls `buildStatusAsync` for the given app + commit until the build reaches a
|
|
11
|
-
* terminal state. Shared between `ms app build
|
|
12
|
-
* so
|
|
65
|
+
* terminal state. Shared between `ms app build`, `ms app deploy`, and
|
|
66
|
+
* `ms app play --mode preview` so all verbs surface identical waiting/error UX.
|
|
67
|
+
*
|
|
68
|
+
* note: This function outputs to the console directly (e.g. spinner, error details).
|
|
69
|
+
*
|
|
70
|
+
* When `deadlineMs` is set, throws an `AppError` if the build hasn't completed
|
|
71
|
+
* within that many milliseconds (measured from when polling starts).
|
|
72
|
+
* When `maxIntervalMs` is set, clamps the server-provided `Retry-After` header
|
|
73
|
+
* to prevent a slow/hostile server from making the CLI hang for hours.
|
|
13
74
|
*/
|
|
14
75
|
export async function waitForBuildStatusAsync(args) {
|
|
15
76
|
const logger = getCliLogger();
|
|
16
|
-
|
|
77
|
+
const MIN_INTERVAL = MIN_POLL_INTERVAL_MS;
|
|
78
|
+
const MAX_INTERVAL = args.maxIntervalMs ?? Infinity;
|
|
79
|
+
let waitMs = Math.min(MAX_INTERVAL, Math.max(MIN_INTERVAL, args.initialWaitMs));
|
|
80
|
+
const deadline = args.deadlineMs != null ? Date.now() + args.deadlineMs : null;
|
|
17
81
|
const spinner = args.isJsonMode ? null : new CliSpinner();
|
|
18
82
|
spinner?.start(args.spinnerLabel ?? 'Waiting for build status...');
|
|
19
83
|
try {
|
|
20
84
|
for (;;) {
|
|
85
|
+
if (deadline !== null && Date.now() >= deadline) {
|
|
86
|
+
throw new AppError(`Build did not complete within ${Math.round(args.deadlineMs / 60_000)} minutes. ` +
|
|
87
|
+
`Commit SHA: ${args.commitSha}.`);
|
|
88
|
+
}
|
|
21
89
|
await sleep(waitMs);
|
|
22
90
|
const status = await buildStatusAsync({
|
|
23
91
|
logger,
|
|
@@ -27,14 +95,29 @@ export async function waitForBuildStatusAsync(args) {
|
|
|
27
95
|
case 'Succeeded':
|
|
28
96
|
return status;
|
|
29
97
|
case 'Failed':
|
|
30
|
-
case 'Canceled':
|
|
31
|
-
|
|
98
|
+
case 'Canceled': {
|
|
99
|
+
// Spinner.stop() is idempotent (no-op once stopped), so calling it
|
|
100
|
+
// here to clear the line before printing buildOutput is safe even
|
|
101
|
+
// though the finally block calls it again as the throw propagates.
|
|
102
|
+
spinner?.stop();
|
|
103
|
+
const errorDetail = extractBuildErrorDetail(status.result);
|
|
104
|
+
if (!args.isJsonMode && errorDetail.buildOutput) {
|
|
105
|
+
printInfo(errorDetail.buildOutput);
|
|
106
|
+
}
|
|
107
|
+
const statusDetail = errorDetail.errorMessage ?? '';
|
|
108
|
+
const statusMessage = statusDetail
|
|
109
|
+
? `Build ${status.status.toLowerCase()}: ${statusDetail}.`
|
|
110
|
+
: `Build ${status.status.toLowerCase()}.`;
|
|
111
|
+
throw new AppError(statusMessage + (args.commitSha ? ` Commit SHA: ${args.commitSha}.` : ''));
|
|
112
|
+
}
|
|
32
113
|
case 'NotStarted':
|
|
33
|
-
case 'Running':
|
|
34
|
-
|
|
114
|
+
case 'Running': {
|
|
115
|
+
const next = status.retryAfterMs ?? waitMs;
|
|
116
|
+
waitMs = Math.min(MAX_INTERVAL, Math.max(MIN_INTERVAL, next));
|
|
35
117
|
break;
|
|
118
|
+
}
|
|
36
119
|
default:
|
|
37
|
-
return status;
|
|
120
|
+
return assertUnreachableStatus(status.status);
|
|
38
121
|
}
|
|
39
122
|
}
|
|
40
123
|
}
|
|
@@ -42,20 +125,13 @@ export async function waitForBuildStatusAsync(args) {
|
|
|
42
125
|
spinner?.stop();
|
|
43
126
|
}
|
|
44
127
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
parts.push(result.code);
|
|
53
|
-
if (typeof result.message === 'string' && result.message)
|
|
54
|
-
parts.push(result.message);
|
|
55
|
-
if (parts.length > 0)
|
|
56
|
-
return `: ${parts.join(' - ')}`;
|
|
57
|
-
}
|
|
58
|
-
return '';
|
|
128
|
+
function assertUnreachableStatus(status) {
|
|
129
|
+
throw new AppError(`Unexpected build status from server: ${String(status)}.`);
|
|
130
|
+
}
|
|
131
|
+
function composeErrorMessage(code, message) {
|
|
132
|
+
if (code && message)
|
|
133
|
+
return `${code}: ${message}`;
|
|
134
|
+
return code ?? message;
|
|
59
135
|
}
|
|
60
136
|
function sleep(ms) {
|
|
61
137
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildPolling.js","sourceRoot":"","sources":["../../src/Utils/BuildPolling.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,oBAAoB,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"BuildPolling.js","sourceRoot":"","sources":["../../src/Utils/BuildPolling.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM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AuB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,OAAO,EAAE,IAAI,EAAE,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAa;IAC5C,MAAM,IAAI,QAAQ,CAAC,wCAAwC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAa,EAAE,OAAgB;IAC1D,IAAI,IAAI,IAAI,OAAO;QAAE,OAAO,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC;IAClD,OAAO,IAAI,IAAI,OAAO,CAAC;AACzB,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
package/dist/Utils/EnvVars.d.ts
CHANGED
|
@@ -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' | 'ORIGIN' | 'USE_MMA_APP_ID' | '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' | '
|
|
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' | 'ORIGIN' | 'USE_MMA_APP_ID' | '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' | '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,GACnB,QAAQ,GAER,gBAAgB,GAChB,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,
|
|
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,GACnB,QAAQ,GAER,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,2BAA2B,GAC3B,4BAA4B,GAE5B,gBAAgB,GAChB,kBAAkB,GAClB,iBAAiB,GACjB,QAAQ,GACR,cAAc,GACd,mBAAmB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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;AAmFvD,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"}
|
|
@@ -4,5 +4,60 @@
|
|
|
4
4
|
import type { IHttpClient } from '@microsoft/managed-apps-actions';
|
|
5
5
|
import type { GetUserRoutingEnvironmentResult } from '@microsoft/managed-apps-common/services';
|
|
6
6
|
import type { ILogger } from '@microsoft/managed-apps-common/telemetry';
|
|
7
|
+
import type { ArgumentProvider } from '../ArgumentProvider.js';
|
|
7
8
|
export declare function resolveRoutingEnvironmentIdAsync(resultPromise: Promise<GetUserRoutingEnvironmentResult>, httpClient: IHttpClient, logger: ILogger): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Kicks off PDE routing as a background promise so the network round-trip
|
|
11
|
+
* can overlap with interactive prompts in `app init` / `app create`. When
|
|
12
|
+
* `trackBackgroundFailure` is true (the default), a `.catch()` is attached
|
|
13
|
+
* so that a later thrown prompt does not surface the rejection as an
|
|
14
|
+
* unhandled promise rejection — the eventual `await` still re-throws
|
|
15
|
+
* normally for the caller to handle, and a `*.RoutingEnvironmentBackgroundFailure`
|
|
16
|
+
* telemetry event records the original error.
|
|
17
|
+
*
|
|
18
|
+
* Callers that `await` the returned promise immediately (no intervening
|
|
19
|
+
* prompts) should pass `trackBackgroundFailure: false` so the failure path
|
|
20
|
+
* is reported once, by the caller's own error handler, instead of being
|
|
21
|
+
* double-counted as a "background" failure.
|
|
22
|
+
*
|
|
23
|
+
* Always calls the routing service with `provisionDataverse: false` — the
|
|
24
|
+
* lightweight DV-free PDE is sufficient for `app init`, `app create`, and
|
|
25
|
+
* the read-only browse verbs.
|
|
26
|
+
*
|
|
27
|
+
* @param telemetryNamespace - Prefix for the background-failure error event
|
|
28
|
+
* (e.g. `'Init'` → `'Init.RoutingEnvironmentBackgroundFailure'`). Unused
|
|
29
|
+
* when `trackBackgroundFailure` is false.
|
|
30
|
+
*/
|
|
31
|
+
export declare function startPdeRoutingAsync(argumentProvider: ArgumentProvider, tenantId: string, logger: ILogger, telemetryNamespace: string, options?: {
|
|
32
|
+
trackBackgroundFailure?: boolean;
|
|
33
|
+
}): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves an environment ID for read-only browse verbs (`ms connector list`,
|
|
36
|
+
* `ms connector list-actions`, etc.) without ever prompting the user.
|
|
37
|
+
*
|
|
38
|
+
* Resolution order:
|
|
39
|
+
* 1. `--environment-id` flag (when the verb registers it).
|
|
40
|
+
* 2. `ms.config.json` (when the verb runs inside an existing app project).
|
|
41
|
+
* 3. The user's Personal Developer Environment (PDE) via the routing service.
|
|
42
|
+
* If no PDE exists yet, the routing service provisions one (with
|
|
43
|
+
* `provisionDataverse: false`) and we poll until it's ready.
|
|
44
|
+
*
|
|
45
|
+
* Steps 1 and 2 are both handled by `resolveEnvironmentId({ failIfMissing: false })`,
|
|
46
|
+
* which prefers the flag over the config.
|
|
47
|
+
*
|
|
48
|
+
* In non-JSON mode, prints a "resolving …" info line *before* the await so
|
|
49
|
+
* the user gets immediate feedback during the (potentially multi-second)
|
|
50
|
+
* provision/poll, then a final "Using developer environment …" line once
|
|
51
|
+
* the id is known.
|
|
52
|
+
*
|
|
53
|
+
* Always calls `updateEnvironmentName` so downstream player-service URLs
|
|
54
|
+
* target the right tenant cluster.
|
|
55
|
+
*
|
|
56
|
+
* Throws `UsageError` when the tenant ID can't be resolved (auth issue) or
|
|
57
|
+
* when the routing service returns an actionable failure.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveEnvironmentIdOrPdeAsync(argumentProvider: ArgumentProvider, logger: ILogger, options?: {
|
|
60
|
+
jsonMode?: boolean;
|
|
61
|
+
telemetryNamespace?: string;
|
|
62
|
+
}): Promise<string>;
|
|
8
63
|
//# sourceMappingURL=EnvironmentRoutingUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentRoutingUtils.d.ts","sourceRoot":"","sources":["../../src/Utils/EnvironmentRoutingUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"EnvironmentRoutingUtils.d.ts","sourceRoot":"","sources":["../../src/Utils/EnvironmentRoutingUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAGnE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAO/F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5D,wBAAsB,gCAAgC,CACpD,aAAa,EAAE,OAAO,CAAC,+BAA+B,CAAC,EACvD,UAAU,EAAE,WAAW,EACvB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,CAAC,CAiCjB;AAiBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,EACf,kBAAkB,EAAE,MAAM,EAC1B,OAAO,CAAC,EAAE;IAAE,sBAAsB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7C,OAAO,CAAC,MAAM,CAAC,CAwBjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,8BAA8B,CAClD,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5D,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
+
import { getPlayerServiceConfig, updateEnvironmentName } from '@microsoft/managed-apps-actions';
|
|
4
5
|
import { NotFoundError, UsageError } from '@microsoft/managed-apps-common/errors';
|
|
5
|
-
import { ManagedGovernanceError, ManagedGovernanceTimeoutError, pollRoutingEnvironmentAsync, } from '@microsoft/managed-apps-common/services';
|
|
6
|
+
import { getUserRoutingEnvironmentAsync, ManagedGovernanceError, ManagedGovernanceTimeoutError, pollRoutingEnvironmentAsync, } from '@microsoft/managed-apps-common/services';
|
|
7
|
+
import { resolveEnvironmentId } from '../CliUtils.js';
|
|
8
|
+
import { CLI_CLIENT_ID } from '../Constants.js';
|
|
9
|
+
import { printInfo } from './ConsoleOutput.js';
|
|
6
10
|
export async function resolveRoutingEnvironmentIdAsync(resultPromise, httpClient, logger) {
|
|
7
11
|
// Translate routing-service errors into a UsageError so the user sees an actionable message
|
|
8
12
|
// rather than the raw "ManagedGovernance request failed with status 403" implementation detail.
|
|
@@ -42,4 +46,84 @@ function toRoutingUsageError(err) {
|
|
|
42
46
|
}
|
|
43
47
|
return err instanceof Error ? err : new Error(String(err));
|
|
44
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Kicks off PDE routing as a background promise so the network round-trip
|
|
51
|
+
* can overlap with interactive prompts in `app init` / `app create`. When
|
|
52
|
+
* `trackBackgroundFailure` is true (the default), a `.catch()` is attached
|
|
53
|
+
* so that a later thrown prompt does not surface the rejection as an
|
|
54
|
+
* unhandled promise rejection — the eventual `await` still re-throws
|
|
55
|
+
* normally for the caller to handle, and a `*.RoutingEnvironmentBackgroundFailure`
|
|
56
|
+
* telemetry event records the original error.
|
|
57
|
+
*
|
|
58
|
+
* Callers that `await` the returned promise immediately (no intervening
|
|
59
|
+
* prompts) should pass `trackBackgroundFailure: false` so the failure path
|
|
60
|
+
* is reported once, by the caller's own error handler, instead of being
|
|
61
|
+
* double-counted as a "background" failure.
|
|
62
|
+
*
|
|
63
|
+
* Always calls the routing service with `provisionDataverse: false` — the
|
|
64
|
+
* lightweight DV-free PDE is sufficient for `app init`, `app create`, and
|
|
65
|
+
* the read-only browse verbs.
|
|
66
|
+
*
|
|
67
|
+
* @param telemetryNamespace - Prefix for the background-failure error event
|
|
68
|
+
* (e.g. `'Init'` → `'Init.RoutingEnvironmentBackgroundFailure'`). Unused
|
|
69
|
+
* when `trackBackgroundFailure` is false.
|
|
70
|
+
*/
|
|
71
|
+
export function startPdeRoutingAsync(argumentProvider, tenantId, logger, telemetryNamespace, options) {
|
|
72
|
+
const { trackBackgroundFailure = true } = options ?? {};
|
|
73
|
+
const httpClient = argumentProvider.getHttpClient();
|
|
74
|
+
const { region } = getPlayerServiceConfig();
|
|
75
|
+
const promise = resolveRoutingEnvironmentIdAsync(getUserRoutingEnvironmentAsync(httpClient, tenantId, CLI_CLIENT_ID, { provisionDataverse: false }, region, logger), httpClient, logger);
|
|
76
|
+
if (trackBackgroundFailure) {
|
|
77
|
+
promise.catch((error) => {
|
|
78
|
+
logger.trackErrorEvent(`${telemetryNamespace}.RoutingEnvironmentBackgroundFailure`, {
|
|
79
|
+
error: error instanceof Error ? error.message : String(error),
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return promise;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Resolves an environment ID for read-only browse verbs (`ms connector list`,
|
|
87
|
+
* `ms connector list-actions`, etc.) without ever prompting the user.
|
|
88
|
+
*
|
|
89
|
+
* Resolution order:
|
|
90
|
+
* 1. `--environment-id` flag (when the verb registers it).
|
|
91
|
+
* 2. `ms.config.json` (when the verb runs inside an existing app project).
|
|
92
|
+
* 3. The user's Personal Developer Environment (PDE) via the routing service.
|
|
93
|
+
* If no PDE exists yet, the routing service provisions one (with
|
|
94
|
+
* `provisionDataverse: false`) and we poll until it's ready.
|
|
95
|
+
*
|
|
96
|
+
* Steps 1 and 2 are both handled by `resolveEnvironmentId({ failIfMissing: false })`,
|
|
97
|
+
* which prefers the flag over the config.
|
|
98
|
+
*
|
|
99
|
+
* In non-JSON mode, prints a "resolving …" info line *before* the await so
|
|
100
|
+
* the user gets immediate feedback during the (potentially multi-second)
|
|
101
|
+
* provision/poll, then a final "Using developer environment …" line once
|
|
102
|
+
* the id is known.
|
|
103
|
+
*
|
|
104
|
+
* Always calls `updateEnvironmentName` so downstream player-service URLs
|
|
105
|
+
* target the right tenant cluster.
|
|
106
|
+
*
|
|
107
|
+
* Throws `UsageError` when the tenant ID can't be resolved (auth issue) or
|
|
108
|
+
* when the routing service returns an actionable failure.
|
|
109
|
+
*/
|
|
110
|
+
export async function resolveEnvironmentIdOrPdeAsync(argumentProvider, logger, options) {
|
|
111
|
+
const fromConfig = await resolveEnvironmentId(argumentProvider, { failIfMissing: false });
|
|
112
|
+
if (fromConfig) {
|
|
113
|
+
return fromConfig;
|
|
114
|
+
}
|
|
115
|
+
const tenantId = await argumentProvider.getTenantIdAsync();
|
|
116
|
+
if (!tenantId) {
|
|
117
|
+
throw new UsageError('Unable to determine tenant ID. Ensure you are logged in.');
|
|
118
|
+
}
|
|
119
|
+
if (!options?.jsonMode) {
|
|
120
|
+
printInfo('No environment specified — resolving your developer environment…');
|
|
121
|
+
}
|
|
122
|
+
const environmentId = await startPdeRoutingAsync(argumentProvider, tenantId, logger, options?.telemetryNamespace ?? 'BrowseVerb', { trackBackgroundFailure: false });
|
|
123
|
+
updateEnvironmentName(environmentId);
|
|
124
|
+
if (!options?.jsonMode) {
|
|
125
|
+
printInfo(`Using developer environment ${environmentId}.`);
|
|
126
|
+
}
|
|
127
|
+
return environmentId;
|
|
128
|
+
}
|
|
45
129
|
//# sourceMappingURL=EnvironmentRoutingUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentRoutingUtils.js","sourceRoot":"","sources":["../../src/Utils/EnvironmentRoutingUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAElF,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"EnvironmentRoutingUtils.js","sourceRoot":"","sources":["../../src/Utils/EnvironmentRoutingUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAElF,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,EACtB,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,yCAAyC,CAAC;AAIjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,aAAuD,EACvD,UAAuB,EACvB,MAAe;IAEf,4FAA4F;IAC5F,gGAAgG;IAChG,4FAA4F;IAC5F,0CAA0C;IAC1C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;QAEnC,IAAI,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAA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C,OAAO,EAAE,QAAQ,EAAE,CAAC;QACvB,SAAS,CAAC,kEAAkE,CAAC,CAAC;IAChF,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAC9C,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,OAAO,EAAE,kBAAkB,IAAI,YAAY,EAC3C,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAClC,CAAC;IAEF,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAErC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;QACvB,SAAS,CAAC,+BAA+B,aAAa,GAAG,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The first line shown at the top of every `--help` output across the CLI
|
|
6
|
+
* (Commander-rendered help, noun-level help, and nested typed-verb help).
|
|
7
|
+
* Surfaces the CLI version and the (preview) tag so users always know which
|
|
8
|
+
* version they are running and that the surface is still pre-release.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getHelpBanner(): string;
|
|
11
|
+
//# sourceMappingURL=HelpBanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelpBanner.d.ts","sourceRoot":"","sources":["../../src/Utils/HelpBanner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import packageJson from '../../package.json' with { type: 'json' };
|
|
5
|
+
import { CLI_BINARY_NAME } from '../Constants/CliConstants.js';
|
|
6
|
+
/**
|
|
7
|
+
* The first line shown at the top of every `--help` output across the CLI
|
|
8
|
+
* (Commander-rendered help, noun-level help, and nested typed-verb help).
|
|
9
|
+
* Surfaces the CLI version and the (preview) tag so users always know which
|
|
10
|
+
* version they are running and that the surface is still pre-release.
|
|
11
|
+
*/
|
|
12
|
+
export function getHelpBanner() {
|
|
13
|
+
return `${CLI_BINARY_NAME} v${packageJson.version} (preview)`;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=HelpBanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelpBanner.js","sourceRoot":"","sources":["../../src/Utils/HelpBanner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,GAAG,eAAe,KAAK,WAAW,CAAC,OAAO,YAAY,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Best-effort guard: warn (never throw) when the running Node.js is older than the
|
|
6
|
+
* minimum declared in this package's `engines.node`. Mirrors `scripts/check-bun-version.ts`.
|
|
7
|
+
* Emits via `printWarning` — stderr, so it can't corrupt a `--json` stdout envelope, with
|
|
8
|
+
* NO_COLOR/TTY handled by `styleText`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function warnIfNodeVersionUnsupported(): void;
|
|
11
|
+
/** Parse the leading `major.minor.patch` out of a version or range string (`>=24.5.0` → `[24, 5, 0]`). */
|
|
12
|
+
export declare function parseVersion(value: string): number[];
|
|
13
|
+
//# sourceMappingURL=NodeVersionChecker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeVersionChecker.d.ts","sourceRoot":"","sources":["../../src/Utils/NodeVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAWnD;AAED,0GAA0G;AAC1G,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAGpD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import packageJson from '../../package.json' with { type: 'json' };
|
|
5
|
+
import { printWarning } from './ConsoleOutput.js';
|
|
6
|
+
/**
|
|
7
|
+
* Best-effort guard: warn (never throw) when the running Node.js is older than the
|
|
8
|
+
* minimum declared in this package's `engines.node`. Mirrors `scripts/check-bun-version.ts`.
|
|
9
|
+
* Emits via `printWarning` — stderr, so it can't corrupt a `--json` stdout envelope, with
|
|
10
|
+
* NO_COLOR/TTY handled by `styleText`.
|
|
11
|
+
*/
|
|
12
|
+
export function warnIfNodeVersionUnsupported() {
|
|
13
|
+
const required = packageJson.engines?.node;
|
|
14
|
+
if (!required)
|
|
15
|
+
return;
|
|
16
|
+
const requiredParts = parseVersion(required);
|
|
17
|
+
if (requiredParts.length === 0)
|
|
18
|
+
return;
|
|
19
|
+
if (!isVersionLower(parseVersion(process.versions.node), requiredParts))
|
|
20
|
+
return;
|
|
21
|
+
printWarning(`Warning: Your Node.js version ${process.versions.node} doesn't match required version ${required}; please upgrade Node.js.`);
|
|
22
|
+
}
|
|
23
|
+
/** Parse the leading `major.minor.patch` out of a version or range string (`>=24.5.0` → `[24, 5, 0]`). */
|
|
24
|
+
export function parseVersion(value) {
|
|
25
|
+
const match = value.match(/(\d+)(?:\.(\d+))?(?:\.(\d+))?/);
|
|
26
|
+
return match ? [Number(match[1]), Number(match[2] ?? 0), Number(match[3] ?? 0)] : [];
|
|
27
|
+
}
|
|
28
|
+
/** True when `actual` is strictly older than `required`, compared by major, then minor, then patch. */
|
|
29
|
+
function isVersionLower(actual, required) {
|
|
30
|
+
for (let i = 0; i < 3; i++) {
|
|
31
|
+
const a = actual[i] ?? 0;
|
|
32
|
+
const r = required[i] ?? 0;
|
|
33
|
+
if (a !== r)
|
|
34
|
+
return a < r;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=NodeVersionChecker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeVersionChecker.js","sourceRoot":"","sources":["../../src/Utils/NodeVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B;IAC1C,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC;IAC3C,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEtB,MAAM,aAAa,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IACvC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO;IAEhF,YAAY,CACV,iCAAiC,OAAO,CAAC,QAAQ,CAAC,IAAI,mCAAmC,QAAQ,2BAA2B,CAC7H,CAAC;AACJ,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC3D,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACvF,CAAC;AAED,uGAAuG;AACvG,SAAS,cAAc,CAAC,MAAgB,EAAE,QAAkB;IAC1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateMaafApp.d.ts","sourceRoot":"","sources":["../../src/Verbs/CreateMaafApp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateMaafApp.d.ts","sourceRoot":"","sources":["../../src/Verbs/CreateMaafApp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAQzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA6B5D;;;;;;;;;;GAUG;AACH,UAAU,aAAa;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;GAKG;AACH,UAAU,WAAW;IACnB,OAAO,EAAE,OAAO,CAAC;IAKjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,C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;GAkBG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAmD/D;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CA8BlE"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { createAsync, getPlayerServiceConfig, updateEnvironmentName, writeRepoConfig, } from '@microsoft/managed-apps-actions';
|
|
5
5
|
import { AppConfigFileName } from '@microsoft/managed-apps-common/config';
|
|
6
|
-
import {
|
|
6
|
+
import { regionToCloudSafe } from '@microsoft/managed-apps-common/services';
|
|
7
7
|
import { execFileSync } from 'child_process';
|
|
8
8
|
import * as fs from 'fs';
|
|
9
9
|
import { downloadTemplate } from 'giget';
|
|
@@ -11,13 +11,12 @@ import * as os from 'os';
|
|
|
11
11
|
import * as path from 'path';
|
|
12
12
|
import { getCliLogger, getSettings } from '../CliSettings.js';
|
|
13
13
|
import { createDefaultStringOption, resolveEnvironmentId } from '../CliUtils.js';
|
|
14
|
-
import { CLI_CLIENT_ID } from '../Constants.js';
|
|
15
14
|
import { CLI_BINARY_NAME } from '../Constants/CliConstants.js';
|
|
16
15
|
import { HelpStrings } from '../Constants/HelpStrings.js';
|
|
17
16
|
import { AppError, ConfigurationError, UsageError } from '../Errors/CliError.js';
|
|
18
17
|
import { printInfo, printJsonLine, printJsonSuccess, printSuccess, printWarning, } from '../Utils/ConsoleOutput.js';
|
|
19
18
|
import { withGitHubDcfRecoveryAsync } from '../Utils/DcfRecovery.js';
|
|
20
|
-
import {
|
|
19
|
+
import { startPdeRoutingAsync } from '../Utils/EnvironmentRoutingUtils.js';
|
|
21
20
|
import { buildGcmConfig } from '../Utils/GitCredentialConfig.js';
|
|
22
21
|
import { CreateMaafAppArguments } from './VerbConstants.js';
|
|
23
22
|
const DEFAULT_TEMPLATE = 'github:microsoft/Managed-Apps/templates/vite8';
|
|
@@ -68,7 +67,6 @@ export async function createMaafAppAsync(argumentProvider) {
|
|
|
68
67
|
throw new UsageError('Unable to determine tenant ID. Ensure you are logged in.');
|
|
69
68
|
}
|
|
70
69
|
const logger = getCliLogger();
|
|
71
|
-
const httpClient = argumentProvider.getHttpClient();
|
|
72
70
|
const { region } = getPlayerServiceConfig();
|
|
73
71
|
const displayName = await argumentProvider.getOption('displayName');
|
|
74
72
|
if (!displayName) {
|
|
@@ -178,14 +176,7 @@ export async function createMaafAppAsync(argumentProvider) {
|
|
|
178
176
|
// Skipped entirely when the env id is pre-resolved (--environment-id flag or debug override).
|
|
179
177
|
const routingEnvPromise = preResolvedEnvironmentId
|
|
180
178
|
? undefined
|
|
181
|
-
:
|
|
182
|
-
// If a later prompt throws before we await the promise, the rejection would otherwise be
|
|
183
|
-
// unhandled. Log and swallow here; `await routingEnvPromise` below still surfaces the error.
|
|
184
|
-
routingEnvPromise?.catch((error) => {
|
|
185
|
-
logger.trackErrorEvent('CreateMaafApp.RoutingEnvironmentBackgroundFailure', {
|
|
186
|
-
error: error instanceof Error ? error.message : String(error),
|
|
187
|
-
});
|
|
188
|
-
});
|
|
179
|
+
: startPdeRoutingAsync(argumentProvider, tenantId, logger, 'CreateMaafApp');
|
|
189
180
|
const description = await argumentProvider.getOption('description',
|
|
190
181
|
/* ignorePrompt */ true);
|
|
191
182
|
const buildPath = await argumentProvider.getOption('buildPath', /* ignorePrompt */ true);
|
|
@@ -195,9 +186,7 @@ export async function createMaafAppAsync(argumentProvider) {
|
|
|
195
186
|
/* ignorePrompt */ true);
|
|
196
187
|
// Explicit branch keeps the non-null read of routingEnvPromise reachable only when
|
|
197
188
|
// preResolvedEnvironmentId is undefined — i.e. exactly when routingEnvPromise is defined.
|
|
198
|
-
const environmentId = preResolvedEnvironmentId
|
|
199
|
-
? preResolvedEnvironmentId
|
|
200
|
-
: await resolveRoutingEnvironmentIdAsync(routingEnvPromise, httpClient, logger);
|
|
189
|
+
const environmentId = preResolvedEnvironmentId ?? (await routingEnvPromise);
|
|
201
190
|
updateEnvironmentName(environmentId);
|
|
202
191
|
// Re-check the directory invariant right before the server call. The same
|
|
203
192
|
// check ran in preflight, but the routing-env resolution between then and
|