@microsoft/managed-apps-cli 0.9.1 → 0.10.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.
Files changed (144) hide show
  1. package/README.md +23 -43
  2. package/dist/ArgumentProvider.d.ts.map +1 -1
  3. package/dist/ArgumentProvider.js +3 -0
  4. package/dist/ArgumentProvider.js.map +1 -1
  5. package/dist/Authentication/NodeMsalAuthenticationProvider.js +20 -1
  6. package/dist/Authentication/NodeMsalAuthenticationProvider.js.map +1 -1
  7. package/dist/Cli.d.ts.map +1 -1
  8. package/dist/Cli.js +14 -2
  9. package/dist/Cli.js.map +1 -1
  10. package/dist/Constants/CommandRegistry.d.ts.map +1 -1
  11. package/dist/Constants/CommandRegistry.js +5 -24
  12. package/dist/Constants/CommandRegistry.js.map +1 -1
  13. package/dist/Constants/HelpStrings.d.ts +8 -7
  14. package/dist/Constants/HelpStrings.d.ts.map +1 -1
  15. package/dist/Constants/HelpStrings.js +78 -73
  16. package/dist/Constants/HelpStrings.js.map +1 -1
  17. package/dist/Constants.d.ts +1 -1
  18. package/dist/Constants.d.ts.map +1 -1
  19. package/dist/Constants.js +4 -9
  20. package/dist/Constants.js.map +1 -1
  21. package/dist/Errors/GitHubErrorMap.d.ts +43 -14
  22. package/dist/Errors/GitHubErrorMap.d.ts.map +1 -1
  23. package/dist/Errors/GitHubErrorMap.js +188 -147
  24. package/dist/Errors/GitHubErrorMap.js.map +1 -1
  25. package/dist/Logger/CliLogger.d.ts +1 -0
  26. package/dist/Logger/CliLogger.d.ts.map +1 -1
  27. package/dist/Logger/CliLogger.js +5 -3
  28. package/dist/Logger/CliLogger.js.map +1 -1
  29. package/dist/Logger/LoggerSettings.d.ts +2 -3
  30. package/dist/Logger/LoggerSettings.d.ts.map +1 -1
  31. package/dist/Logger/LoggerSettings.js +3 -39
  32. package/dist/Logger/LoggerSettings.js.map +1 -1
  33. package/dist/Logger/OneDSWriter.d.ts.map +1 -1
  34. package/dist/Logger/OneDSWriter.js +3 -3
  35. package/dist/Logger/OneDSWriter.js.map +1 -1
  36. package/dist/Types/Argument.types.d.ts +1 -0
  37. package/dist/Types/Argument.types.d.ts.map +1 -1
  38. package/dist/Utils/BuildPolling.d.ts +27 -2
  39. package/dist/Utils/BuildPolling.d.ts.map +1 -1
  40. package/dist/Utils/BuildPolling.js +98 -22
  41. package/dist/Utils/BuildPolling.js.map +1 -1
  42. package/dist/Utils/DcfRecovery.d.ts +7 -7
  43. package/dist/Utils/DcfRecovery.d.ts.map +1 -1
  44. package/dist/Utils/DcfRecovery.js +17 -37
  45. package/dist/Utils/DcfRecovery.js.map +1 -1
  46. package/dist/Utils/DownloadTemplate.d.ts +45 -0
  47. package/dist/Utils/DownloadTemplate.d.ts.map +1 -0
  48. package/dist/Utils/DownloadTemplate.js +159 -0
  49. package/dist/Utils/DownloadTemplate.js.map +1 -0
  50. package/dist/Utils/EnvVars.d.ts +1 -1
  51. package/dist/Utils/EnvVars.d.ts.map +1 -1
  52. package/dist/Utils/GitVersionChecker.d.ts +38 -0
  53. package/dist/Utils/GitVersionChecker.d.ts.map +1 -0
  54. package/dist/Utils/GitVersionChecker.js +61 -0
  55. package/dist/Utils/GitVersionChecker.js.map +1 -0
  56. package/dist/Utils/MaafAppConfig.d.ts +22 -0
  57. package/dist/Utils/MaafAppConfig.d.ts.map +1 -0
  58. package/dist/Utils/MaafAppConfig.js +32 -0
  59. package/dist/Utils/MaafAppConfig.js.map +1 -0
  60. package/dist/Utils/NodeVersionChecker.d.ts +10 -0
  61. package/dist/Utils/NodeVersionChecker.d.ts.map +1 -0
  62. package/dist/Utils/NodeVersionChecker.js +21 -0
  63. package/dist/Utils/NodeVersionChecker.js.map +1 -0
  64. package/dist/Utils/Paging.d.ts +5 -0
  65. package/dist/Utils/Paging.d.ts.map +1 -1
  66. package/dist/Utils/Paging.js +29 -0
  67. package/dist/Utils/Paging.js.map +1 -1
  68. package/dist/Utils/PinCli.d.ts +28 -0
  69. package/dist/Utils/PinCli.d.ts.map +1 -0
  70. package/dist/Utils/PinCli.js +58 -0
  71. package/dist/Utils/PinCli.js.map +1 -0
  72. package/dist/Utils/RepoOption.d.ts +35 -0
  73. package/dist/Utils/RepoOption.d.ts.map +1 -0
  74. package/dist/Utils/RepoOption.js +36 -0
  75. package/dist/Utils/RepoOption.js.map +1 -0
  76. package/dist/Utils/Spinner.d.ts.map +1 -1
  77. package/dist/Utils/Spinner.js +3 -0
  78. package/dist/Utils/Spinner.js.map +1 -1
  79. package/dist/Verbs/AddAction.js +6 -6
  80. package/dist/Verbs/AddAction.js.map +1 -1
  81. package/dist/Verbs/AddConnector.d.ts +5 -3
  82. package/dist/Verbs/AddConnector.d.ts.map +1 -1
  83. package/dist/Verbs/AddConnector.js +45 -11
  84. package/dist/Verbs/AddConnector.js.map +1 -1
  85. package/dist/Verbs/AddConnectorFlows.d.ts +27 -14
  86. package/dist/Verbs/AddConnectorFlows.d.ts.map +1 -1
  87. package/dist/Verbs/AddConnectorFlows.js +70 -20
  88. package/dist/Verbs/AddConnectorFlows.js.map +1 -1
  89. package/dist/Verbs/AddDataSource.d.ts +3 -4
  90. package/dist/Verbs/AddDataSource.d.ts.map +1 -1
  91. package/dist/Verbs/AddDataSource.js +9 -20
  92. package/dist/Verbs/AddDataSource.js.map +1 -1
  93. package/dist/Verbs/AddTable.js +6 -6
  94. package/dist/Verbs/AddTable.js.map +1 -1
  95. package/dist/Verbs/AuthStatus.d.ts.map +1 -1
  96. package/dist/Verbs/AuthStatus.js +7 -4
  97. package/dist/Verbs/AuthStatus.js.map +1 -1
  98. package/dist/Verbs/BuildMaafApp.js +1 -1
  99. package/dist/Verbs/BuildMaafApp.js.map +1 -1
  100. package/dist/Verbs/ConnectorHelpers.d.ts +3 -4
  101. package/dist/Verbs/ConnectorHelpers.d.ts.map +1 -1
  102. package/dist/Verbs/ConnectorHelpers.js +8 -9
  103. package/dist/Verbs/ConnectorHelpers.js.map +1 -1
  104. package/dist/Verbs/CreateMaafApp.d.ts +0 -29
  105. package/dist/Verbs/CreateMaafApp.d.ts.map +1 -1
  106. package/dist/Verbs/CreateMaafApp.js +100 -171
  107. package/dist/Verbs/CreateMaafApp.js.map +1 -1
  108. package/dist/Verbs/DeleteDataSource.js +6 -6
  109. package/dist/Verbs/DeleteDataSource.js.map +1 -1
  110. package/dist/Verbs/DeployMaafApp.d.ts.map +1 -1
  111. package/dist/Verbs/DeployMaafApp.js +18 -81
  112. package/dist/Verbs/DeployMaafApp.js.map +1 -1
  113. package/dist/Verbs/Dev.js +1 -1
  114. package/dist/Verbs/Dev.js.map +1 -1
  115. package/dist/Verbs/GetMaafBuildStatus.d.ts.map +1 -1
  116. package/dist/Verbs/GetMaafBuildStatus.js +56 -40
  117. package/dist/Verbs/GetMaafBuildStatus.js.map +1 -1
  118. package/dist/Verbs/GetSettings.js +1 -1
  119. package/dist/Verbs/GetSettings.js.map +1 -1
  120. package/dist/Verbs/Init.d.ts.map +1 -1
  121. package/dist/Verbs/Init.js +166 -58
  122. package/dist/Verbs/Init.js.map +1 -1
  123. package/dist/Verbs/ListConnectorActions.js +12 -9
  124. package/dist/Verbs/ListConnectorActions.js.map +1 -1
  125. package/dist/Verbs/ListConnectors.js +2 -2
  126. package/dist/Verbs/ListConnectors.js.map +1 -1
  127. package/dist/Verbs/ListMaafApps.js +3 -3
  128. package/dist/Verbs/ListMaafApps.js.map +1 -1
  129. package/dist/Verbs/MaafAppPermissions.js +2 -2
  130. package/dist/Verbs/MaafAppPermissions.js.map +1 -1
  131. package/dist/Verbs/RefreshDataSource.js +1 -1
  132. package/dist/Verbs/RefreshDataSource.js.map +1 -1
  133. package/dist/Verbs/RefreshGitAuth.d.ts.map +1 -1
  134. package/dist/Verbs/RefreshGitAuth.js +3 -15
  135. package/dist/Verbs/RefreshGitAuth.js.map +1 -1
  136. package/dist/Verbs/SetSetting.js +2 -2
  137. package/dist/Verbs/SetSetting.js.map +1 -1
  138. package/dist/Verbs/ShowMaafApp.js +2 -2
  139. package/dist/Verbs/ShowMaafApp.js.map +1 -1
  140. package/dist/Verbs/VerbConstants.d.ts +19 -22
  141. package/dist/Verbs/VerbConstants.d.ts.map +1 -1
  142. package/dist/Verbs/VerbConstants.js +19 -22
  143. package/dist/Verbs/VerbConstants.js.map +1 -1
  144. package/package.json +11 -9
@@ -0,0 +1,159 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { execFileSync } from 'child_process';
5
+ import * as fs from 'fs';
6
+ import * as os from 'os';
7
+ import * as path from 'path';
8
+ import { UsageError } from '../Errors/CliError.js';
9
+ /**
10
+ * Parses a template source. Accepted shapes:
11
+ *
12
+ * github:<owner>/<repo>[/<subdir>...][#<ref>]
13
+ * gh:<owner>/<repo>[/<subdir>...][#<ref>] (shorthand)
14
+ * <owner>/<repo>[/<subdir>...][#<ref>] (prefix optional)
15
+ * https://github.com/<owner>/<repo>[.git][#<ref>]
16
+ * https://github.com/<owner>/<repo>/tree/<ref>[/<subdir>]
17
+ *
18
+ * Throws `UsageError` for any other shape — non-github providers (`gitlab:`,
19
+ * `bitbucket:`, …), arbitrary tarball URLs, and github file URLs (`/blob/...`).
20
+ * The CLI is intentionally github-only here: github is the only provider in
21
+ * real use, and authentication against private github repos already flows
22
+ * through the user's normal git credential setup.
23
+ */
24
+ export function parseGithubTemplate(source) {
25
+ if (!source) {
26
+ throw new UsageError('Template source is empty. Use --template to specify one.');
27
+ }
28
+ // 1. Raw github.com URL — common when the user pastes from a browser
29
+ // address bar. We use the WHATWG URL parser rather than regex so query
30
+ // params (`?tab=readme`), mixed-case hosts, trailing slashes, embedded
31
+ // userinfo, and percent-encoded segments all get normalised away
32
+ // automatically. The path is then matched against the two shapes we
33
+ // support: bare-repo (`/<owner>/<repo>[.git]`) and the web-UI subdir
34
+ // form (`/<owner>/<repo>/tree/<branch>[/<subdir>...]`). `/blob/...`
35
+ // (file URLs) and any other path shape are rejected with a clear error
36
+ // so the failure isn't a confusing mid-flow clone failure.
37
+ if (/^https?:\/\//i.test(source)) {
38
+ let url;
39
+ try {
40
+ url = new URL(source);
41
+ }
42
+ catch {
43
+ throw new UsageError(`Template source '${source}' is not a valid URL.`);
44
+ }
45
+ if (url.hostname.toLowerCase() !== 'github.com') {
46
+ throw new UsageError(`Template source '${source}' uses host '${url.hostname}'; only github.com URLs are supported.`);
47
+ }
48
+ const segments = url.pathname.split('/').filter(Boolean);
49
+ if (segments.length < 2) {
50
+ throw new UsageError(`Template source '${source}' is missing the owner/repo path. ` +
51
+ `Use 'https://github.com/<owner>/<repo>'.`);
52
+ }
53
+ const [owner, rawRepo, ...rest] = segments;
54
+ const repo = rawRepo.endsWith('.git') ? rawRepo.slice(0, -'.git'.length) : rawRepo;
55
+ const hashRef = url.hash ? url.hash.slice(1) : undefined;
56
+ if (rest.length === 0) {
57
+ return { owner, repo, subdir: '', ref: hashRef };
58
+ }
59
+ // Web-UI subdir form: /<owner>/<repo>/tree/<branch>[/<subdir>...]. We can't
60
+ // disambiguate `branch` from `subdir` when the branch name contains a `/`
61
+ // (we'd need to look up refs on the server). The downloadTemplate
62
+ // subdir-not-found error tells the user to switch to the `#<ref>` shorthand.
63
+ if (rest[0].toLowerCase() === 'tree' && rest.length >= 2) {
64
+ return {
65
+ owner,
66
+ repo,
67
+ subdir: rest.slice(2).join('/'),
68
+ ref: hashRef ?? rest[1],
69
+ };
70
+ }
71
+ if (rest[0].toLowerCase() === 'blob') {
72
+ throw new UsageError(`Template source '${source}' points at a file ('/blob/...'). ` +
73
+ `Templates must be a directory — use the '/tree/<branch>/<subdir>' URL form instead.`);
74
+ }
75
+ throw new UsageError(`Template source '${source}' has an unrecognised path. Use ` +
76
+ `'https://github.com/<owner>/<repo>' or ` +
77
+ `'https://github.com/<owner>/<repo>/tree/<branch>/<subdir>'.`);
78
+ }
79
+ // 2. Reject any prefix other than `github:` or `gh:` up front so the failure
80
+ // mode is a clear preflight error rather than a confusing clone failure.
81
+ const prefixMatch = /^([a-z][a-z0-9+.-]*):/i.exec(source);
82
+ if (prefixMatch) {
83
+ const prefix = prefixMatch[1].toLowerCase();
84
+ if (prefix !== 'github' && prefix !== 'gh') {
85
+ throw new UsageError(`Template source '${source}' uses unsupported provider prefix '${prefixMatch[1]}:'. ` +
86
+ `Only 'github:' (or 'gh:' shorthand) templates are supported.`);
87
+ }
88
+ }
89
+ // 3. Shorthand: 'github:owner/repo[/subdir][#ref]', 'gh:owner/repo[...]', or
90
+ // bare 'owner/repo[...]'.
91
+ const stripped = source.replace(/^(?:github|gh):/i, '');
92
+ const [pathPart, ref] = stripped.split('#', 2);
93
+ const parts = pathPart.split('/').filter(Boolean);
94
+ if (parts.length < 2) {
95
+ throw new UsageError(`Template source '${source}' is missing the owner/repo path. ` +
96
+ `Expected 'github:<owner>/<repo>[/<subdir>]'.`);
97
+ }
98
+ const [owner, repo, ...subdirParts] = parts;
99
+ return { owner, repo, subdir: subdirParts.join('/'), ref: ref || undefined };
100
+ }
101
+ /**
102
+ * Downloads a github-hosted template into `dir`. Uses a shallow + partial +
103
+ * sparse clone so only the requested subdirectory is fetched, then copies the
104
+ * working tree into place via `fs.cpSync` and discards the temporary clone.
105
+ *
106
+ * Requires `git` on PATH; callers should run `ensureGitInstalled` in preflight
107
+ * so a missing-git failure surfaces before any server call. Authentication for
108
+ * private repos flows through the user's existing git credential setup
109
+ * (gh, GCM, SSH key, PAT) — the CLI does not inject tokens at this layer.
110
+ */
111
+ export function downloadTemplate(source, options) {
112
+ const parsed = parseGithubTemplate(source);
113
+ const repoUrl = `https://github.com/${parsed.owner}/${parsed.repo}.git`;
114
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'ms-template-'));
115
+ try {
116
+ // `--filter=blob:none` defers blob download until checkout; combined with
117
+ // `--sparse` it means we only ever fetch blobs inside the requested
118
+ // subdir. For no-subdir templates we still want `--depth=1` for a shallow
119
+ // clone but skip `--sparse` so the whole tree checks out.
120
+ const cloneArgs = ['clone', '--depth=1', '--filter=blob:none'];
121
+ if (parsed.subdir)
122
+ cloneArgs.push('--sparse');
123
+ if (parsed.ref)
124
+ cloneArgs.push('--branch', parsed.ref);
125
+ cloneArgs.push(repoUrl, tmp);
126
+ execFileSync('git', cloneArgs, { stdio: ['ignore', 'ignore', 'inherit'] });
127
+ if (parsed.subdir) {
128
+ execFileSync('git', ['-C', tmp, 'sparse-checkout', 'set', parsed.subdir], {
129
+ stdio: ['ignore', 'ignore', 'inherit'],
130
+ });
131
+ }
132
+ const checkoutSource = parsed.subdir ? path.join(tmp, parsed.subdir) : tmp;
133
+ if (!fs.existsSync(checkoutSource)) {
134
+ // Common cause when this fires from the `/tree/<branch>/<subdir>` URL form:
135
+ // the branch name contains a `/` (e.g. `feat/foo`), and the parser took the
136
+ // first segment after `/tree/` as the ref — so `subdir` ended up shifted
137
+ // and the requested path doesn't exist. The shorthand `#<ref>` form is
138
+ // unambiguous and the recommended workaround.
139
+ throw new UsageError(`Template subdirectory '${parsed.subdir}' was not found in ` +
140
+ `https://github.com/${parsed.owner}/${parsed.repo}` +
141
+ `${parsed.ref ? ` at ref '${parsed.ref}'` : ''}. ` +
142
+ `If the branch name contains '/', use the ` +
143
+ `'github:<owner>/<repo>/<subdir>#<branch>' form to disambiguate.`);
144
+ }
145
+ fs.mkdirSync(options.dir, { recursive: true });
146
+ fs.cpSync(checkoutSource, options.dir, {
147
+ recursive: true,
148
+ force: true,
149
+ // Skip `.git` when copying. With `--sparse` + subdir the .git lives at
150
+ // `tmp/.git` (outside the copy source), so this matters mainly for the
151
+ // no-subdir path where the copy source IS the clone root.
152
+ filter: (src) => path.basename(src) !== '.git',
153
+ });
154
+ }
155
+ finally {
156
+ fs.rmSync(tmp, { recursive: true, force: true });
157
+ }
158
+ }
159
+ //# sourceMappingURL=DownloadTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DownloadTemplate.js","sourceRoot":"","sources":["../../src/Utils/DownloadTemplate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EA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,UAAU,CAClB,0BAA0B,MAAM,CAAC,MAAM,qBAAqB;gBAC1D,sBAAsB,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE;gBACnD,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI;gBAClD,2CAA2C;gBAC3C,iEAAiE,CACpE,CAAC;QACJ,CAAC;QAED,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE;YACrC,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,IAAI;YACX,uEAAuE;YACvE,uEAAuE;YACvE,0DAA0D;YAC1D,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,MAAM;SAC/C,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
@@ -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' | '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';
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' | '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' | 'CONNECTOR' | 'CONNECTION_ID' | 'CONNECTION_REF' | 'CONNECTOR_ID' | 'CONNECTOR_SEARCH' | 'CONNECTOR_ACTION_SEARCH' | 'DATASET' | 'TABLE' | 'TABLE_NAME' | 'DATA_SOURCE_NAME' | 'SEARCH_TERM' | 'DATAVERSE_API_SEARCH_TERM' | 'DATAVERSE_ENVIRONMENT_ID' | '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,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,GAElB,qBAAqB,GACrB,iBAAiB,GAEjB,cAAc,GACd,gBAAgB,GAEhB,iBAAiB,CAAC;AAEtB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAE7D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAE7D;AAED,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAErE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAEzD;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEjE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,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"}
@@ -0,0 +1,38 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ /**
5
+ * Preflight guard for `ms app create`: throws `ConfigurationError` when `git` is
6
+ * missing from PATH, or present but older than this package's `engines.git`
7
+ * range. Runs ahead of any server call so a local-tooling misconfiguration fails
8
+ * fast and never leaves an orphaned MAAF app + GRS repo behind.
9
+ *
10
+ * The floor lives in `engines.git` (currently `>=2.27.0`), bound by
11
+ * `git clone --sparse` + `git sparse-checkout set` in cone-mode-by-default — both
12
+ * landed in git 2.27.0 (Jun 2020). Every other git invocation in the verb
13
+ * (init/add/commit/push/clone/fetch/checkout, plus `-C` and `--filter=blob:none`)
14
+ * needs older versions, so 2.27.0 is the cumulative floor.
15
+ *
16
+ * Note that `engines.git` is NOT a recognised key in npm / bun / yarn / pnpm —
17
+ * none of them check it at install time (the only `engines` keys with built-in
18
+ * enforcement are `node` and the package manager's own name, and even those
19
+ * default to warn-not-fail). The runtime check below is the sole enforcement
20
+ * point; the manifest entry is documentation and the source of truth this
21
+ * function reads back.
22
+ *
23
+ * Failure postures, by input source:
24
+ * - `engines.git` lives in our own `package.json`, so a missing / invalid
25
+ * value would be a CLI bug. The runtime silently no-ops in that case —
26
+ * blocking a user over OUR misconfiguration would be the wrong trade.
27
+ * The `GitVersionChecker.test.ts` "engines.git is non-empty and a valid
28
+ * semver range" test fails the build if the manifest is broken, so the
29
+ * misconfig never reaches production.
30
+ * - `git --version` output comes from whatever git is on the user's PATH.
31
+ * Real-world dialects include `git version 2.45.2.windows.1`, `git version
32
+ * 2.39.5 (Apple Git-154)`, RC/dev suffixes, etc. `semver.coerce` extracts
33
+ * the leading `<major>.<minor>.<patch>` from any of them; if it can't, we
34
+ * fail open so a non-standard distribution doesn't get blocked over a
35
+ * format we couldn't predict.
36
+ */
37
+ export declare function ensureGitInstalled(): void;
38
+ //# sourceMappingURL=GitVersionChecker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitVersionChecker.d.ts","sourceRoot":"","sources":["../../src/Utils/GitVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAmBzC"}
@@ -0,0 +1,61 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { execFileSync } from 'child_process';
5
+ import semver from 'semver';
6
+ import packageJson from '../../package.json' with { type: 'json' };
7
+ import { ConfigurationError } from '../Errors/CliError.js';
8
+ /**
9
+ * Preflight guard for `ms app create`: throws `ConfigurationError` when `git` is
10
+ * missing from PATH, or present but older than this package's `engines.git`
11
+ * range. Runs ahead of any server call so a local-tooling misconfiguration fails
12
+ * fast and never leaves an orphaned MAAF app + GRS repo behind.
13
+ *
14
+ * The floor lives in `engines.git` (currently `>=2.27.0`), bound by
15
+ * `git clone --sparse` + `git sparse-checkout set` in cone-mode-by-default — both
16
+ * landed in git 2.27.0 (Jun 2020). Every other git invocation in the verb
17
+ * (init/add/commit/push/clone/fetch/checkout, plus `-C` and `--filter=blob:none`)
18
+ * needs older versions, so 2.27.0 is the cumulative floor.
19
+ *
20
+ * Note that `engines.git` is NOT a recognised key in npm / bun / yarn / pnpm —
21
+ * none of them check it at install time (the only `engines` keys with built-in
22
+ * enforcement are `node` and the package manager's own name, and even those
23
+ * default to warn-not-fail). The runtime check below is the sole enforcement
24
+ * point; the manifest entry is documentation and the source of truth this
25
+ * function reads back.
26
+ *
27
+ * Failure postures, by input source:
28
+ * - `engines.git` lives in our own `package.json`, so a missing / invalid
29
+ * value would be a CLI bug. The runtime silently no-ops in that case —
30
+ * blocking a user over OUR misconfiguration would be the wrong trade.
31
+ * The `GitVersionChecker.test.ts` "engines.git is non-empty and a valid
32
+ * semver range" test fails the build if the manifest is broken, so the
33
+ * misconfig never reaches production.
34
+ * - `git --version` output comes from whatever git is on the user's PATH.
35
+ * Real-world dialects include `git version 2.45.2.windows.1`, `git version
36
+ * 2.39.5 (Apple Git-154)`, RC/dev suffixes, etc. `semver.coerce` extracts
37
+ * the leading `<major>.<minor>.<patch>` from any of them; if it can't, we
38
+ * fail open so a non-standard distribution doesn't get blocked over a
39
+ * format we couldn't predict.
40
+ */
41
+ export function ensureGitInstalled() {
42
+ let versionOutput;
43
+ try {
44
+ versionOutput = execFileSync('git', ['--version'], {
45
+ stdio: ['ignore', 'pipe', 'ignore'],
46
+ }).toString();
47
+ }
48
+ catch {
49
+ throw new ConfigurationError("'git' is required but was not found on PATH.");
50
+ }
51
+ const required = packageJson.engines.git;
52
+ if (!semver.validRange(required))
53
+ return;
54
+ const found = semver.coerce(versionOutput);
55
+ if (!found)
56
+ return;
57
+ if (semver.satisfies(found, required))
58
+ return;
59
+ throw new ConfigurationError(`Git ${required} is required (found ${found.version}). Please upgrade git.`);
60
+ }
61
+ //# sourceMappingURL=GitVersionChecker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitVersionChecker.js","sourceRoot":"","sources":["../../src/Utils/GitVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,aAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,aAAa,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE;YACjD,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,kBAAkB,CAAC,8CAA8C,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC;QAAE,OAAO;IAE9C,MAAM,IAAI,kBAAkB,CAC1B,OAAO,QAAQ,uBAAuB,KAAK,CAAC,OAAO,wBAAwB,CAC5E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { AppConfig, RepoType } from '@microsoft/managed-apps-common/config';
5
+ interface BuildMaafAppConfigOptions {
6
+ appId: string;
7
+ appDisplayName: string;
8
+ description: string | null | undefined;
9
+ environmentId: string;
10
+ repoType: RepoType;
11
+ cloud: AppConfig['cloud'];
12
+ buildPath?: string;
13
+ buildCommand?: string;
14
+ buildEntryPoint?: string;
15
+ repositoryId?: string;
16
+ externalRepoUrl?: string;
17
+ appSettings?: AppConfig['appSettings'];
18
+ connectionReferences?: AppConfig['connectionReferences'];
19
+ }
20
+ export declare function buildMaafAppConfig(options: BuildMaafAppConfigOptions): AppConfig;
21
+ export {};
22
+ //# sourceMappingURL=MaafAppConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaafAppConfig.d.ts","sourceRoot":"","sources":["../../src/Utils/MaafAppConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAGjF,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACvC,oBAAoB,CAAC,EAAE,SAAS,CAAC,sBAAsB,CAAC,CAAC;CAC1D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,SAAS,CA+BhF"}
@@ -0,0 +1,32 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { VERSION } from '@microsoft/managed-apps-common/config';
5
+ export function buildMaafAppConfig(options) {
6
+ const appConfig = {
7
+ version: VERSION,
8
+ appId: options.appId,
9
+ appDisplayName: options.appDisplayName,
10
+ environmentId: options.environmentId,
11
+ description: options.description,
12
+ repoType: options.repoType,
13
+ cloud: options.cloud,
14
+ buildPath: options.buildPath ?? './dist',
15
+ buildCommand: options.buildCommand ?? 'npm run build',
16
+ buildEntryPoint: options.buildEntryPoint ?? 'index.html',
17
+ };
18
+ if (options.repositoryId) {
19
+ appConfig.repositoryId = options.repositoryId;
20
+ }
21
+ if (options.externalRepoUrl) {
22
+ appConfig.externalRepoUrl = options.externalRepoUrl;
23
+ }
24
+ if (options.connectionReferences !== undefined) {
25
+ appConfig.connectionReferences = options.connectionReferences;
26
+ }
27
+ if (options.appSettings !== undefined) {
28
+ appConfig.appSettings = options.appSettings;
29
+ }
30
+ return appConfig;
31
+ }
32
+ //# sourceMappingURL=MaafAppConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaafAppConfig.js","sourceRoot":"","sources":["../../src/Utils/MaafAppConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAkBhE,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,MAAM,SAAS,GAAc;QAC3B,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,QAAQ;QACxC,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,eAAe;QACrD,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,YAAY;KACzD,CAAC;IAEF,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACzB,SAAS,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAChD,CAAC;IAED,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5B,SAAS,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IACtD,CAAC;IAED,IAAI,OAAO,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;QAC/C,SAAS,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAChE,CAAC;IAED,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACtC,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAC9C,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ /**
5
+ * Best-effort guard: warn (never throw) when the running Node.js doesn't satisfy this package's
6
+ * `engines.node` range. Mirrors `scripts/check-bun-version.ts`. Emits via `printWarning` — stderr,
7
+ * so it can't corrupt a `--json` stdout envelope, with NO_COLOR/TTY handled by `styleText`.
8
+ */
9
+ export declare function warnIfNodeVersionUnsupported(): void;
10
+ //# 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;AAOH;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAWnD"}
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import semver from 'semver';
5
+ import packageJson from '../../package.json' with { type: 'json' };
6
+ import { printWarning } from './ConsoleOutput.js';
7
+ /**
8
+ * Best-effort guard: warn (never throw) when the running Node.js doesn't satisfy this package's
9
+ * `engines.node` range. Mirrors `scripts/check-bun-version.ts`. Emits via `printWarning` — stderr,
10
+ * so it can't corrupt a `--json` stdout envelope, with NO_COLOR/TTY handled by `styleText`.
11
+ */
12
+ export function warnIfNodeVersionUnsupported() {
13
+ const required = packageJson.engines.node;
14
+ // `semver` lets the engine be any valid range (e.g. `>=24.11.0`, or `^24 || >=26` to allow 24 and
15
+ // 26 but not 25). An invalid range counts as unsupported; the check never throws.
16
+ if (Boolean(semver.validRange(required)) && semver.satisfies(process.versions.node, required)) {
17
+ return;
18
+ }
19
+ printWarning(`Warning: Your Node.js version ${process.versions.node} doesn't match requirement ${required}; Please install a compatible Node.js version.`);
20
+ }
21
+ //# 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,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,4BAA4B;IAC1C,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1C,kGAAkG;IAClG,kFAAkF;IAClF,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC9F,OAAO;IACT,CAAC;IAED,YAAY,CACV,iCAAiC,OAAO,CAAC,QAAQ,CAAC,IAAI,8BAA8B,QAAQ,gDAAgD,CAC7I,CAAC;AACJ,CAAC"}
@@ -8,6 +8,11 @@ export declare const PAGE_SIZE = 20;
8
8
  * Enter/Space = continue, Esc/q = exit, Ctrl+C = process exit.
9
9
  */
10
10
  export declare function waitForPageKey(): Promise<'continue' | 'exit'>;
11
+ /**
12
+ * Prints a paginated text blob in TTY mode (PAGE_SIZE lines per page,
13
+ * Enter/Esc to navigate) or the full text in non-TTY/piped mode.
14
+ */
15
+ export declare function printPagedText(text: string): Promise<void>;
11
16
  /**
12
17
  * Prints a paginated table in TTY mode (20 rows per page, Enter/Esc to navigate)
13
18
  * or a single full table in non-TTY/piped mode.
@@ -1 +1 @@
1
- {"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../src/Utils/Paging.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,CA2BnE;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhB"}
1
+ {"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../src/Utils/Paging.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,CA2BnE;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhE;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhB"}
@@ -35,6 +35,35 @@ export async function waitForPageKey() {
35
35
  process.stdin.on('keypress', handler);
36
36
  });
37
37
  }
38
+ /**
39
+ * Prints a paginated text blob in TTY mode (PAGE_SIZE lines per page,
40
+ * Enter/Esc to navigate) or the full text in non-TTY/piped mode.
41
+ */
42
+ export async function printPagedText(text) {
43
+ const lines = text.split(/\r?\n/);
44
+ if (!process.stdout.isTTY) {
45
+ for (const line of lines) {
46
+ console.log(line);
47
+ }
48
+ return;
49
+ }
50
+ const total = lines.length;
51
+ const totalPages = Math.max(1, Math.ceil(total / PAGE_SIZE));
52
+ for (let page = 0; page < totalPages; page++) {
53
+ const start = page * PAGE_SIZE;
54
+ const pageLines = lines.slice(start, start + PAGE_SIZE);
55
+ const isLastPage = page === totalPages - 1;
56
+ for (const line of pageLines) {
57
+ console.log(line);
58
+ }
59
+ if (isLastPage)
60
+ break;
61
+ console.log(styleText('dim', ' Press Enter for more, Esc or q to exit'));
62
+ const action = await waitForPageKey();
63
+ if (action === 'exit')
64
+ break;
65
+ }
66
+ }
38
67
  /**
39
68
  * Prints a paginated table in TTY mode (20 rows per page, Enter/Esc to navigate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,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,IAAI,KAAK,UAAU,GAAG,CAAC,CAAC;QAE3C,UAAU,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,KAAK,GAAG,QAAQ,CAAC,MAAM,OAAO,KAAK,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC;QAChG,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,0CAA0C,CAAC,CAAC,CAAC;QAC5E,CAAC;QAED,IAAI,UAAU;YAAE,MAAM;QAEtB,MAAM,MAAM,GAAG,MAAM,cAAc,EAAE,CAAC;QACtC,IAAI,MAAM,KAAK,MAAM;YAAE,MAAM;IAC/B,CAAC;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ /**
5
+ * Pins the running CLI into an app's `package.json` as a `devDependency` at the
6
+ * exact version of the CLI executing the command (read from this package's own
7
+ * manifest, so it always matches the running CLI).
8
+ *
9
+ * Used by `ms app create` (right after the template is scaffolded) and `ms app
10
+ * init` (binding an existing project) so the app carries a project-local `ms` at
11
+ * the version it was set up with — which `npx ms` / `pnpm exec` / `bun x` resolve
12
+ * ahead of any globally-installed CLI. The app therefore keeps building and
13
+ * deploying against the CLI it was created with, even if the developer's global
14
+ * CLI later moves to an incompatible version.
15
+ *
16
+ * Best-effort and non-fatal — the server-side app already exists by the time this
17
+ * runs:
18
+ * - No `package.json` in `appDir` (e.g. `ms app create` with a custom
19
+ * `--template` that isn't an npm project) → nothing to pin; return quietly.
20
+ * - Read / parse / write failure → warn (outside `--json` mode) and continue;
21
+ * the user can add the pin by hand.
22
+ *
23
+ * The entry overwrites any existing CLI `devDependencies` entry, and
24
+ * `devDependencies` is re-sorted alphabetically to match the npm convention so a
25
+ * later `install --save` won't reshuffle the file.
26
+ */
27
+ export declare function pinCliIntoAppPackageJson(appDir: string, jsonMode: boolean): void;
28
+ //# sourceMappingURL=PinCli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PinCli.d.ts","sourceRoot":"","sources":["../../src/Utils/PinCli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAiChF"}
@@ -0,0 +1,58 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import * as fs from 'fs';
5
+ import * as path from 'path';
6
+ import packageJson from '../../package.json' with { type: 'json' };
7
+ import { printWarning } from './ConsoleOutput.js';
8
+ /**
9
+ * Pins the running CLI into an app's `package.json` as a `devDependency` at the
10
+ * exact version of the CLI executing the command (read from this package's own
11
+ * manifest, so it always matches the running CLI).
12
+ *
13
+ * Used by `ms app create` (right after the template is scaffolded) and `ms app
14
+ * init` (binding an existing project) so the app carries a project-local `ms` at
15
+ * the version it was set up with — which `npx ms` / `pnpm exec` / `bun x` resolve
16
+ * ahead of any globally-installed CLI. The app therefore keeps building and
17
+ * deploying against the CLI it was created with, even if the developer's global
18
+ * CLI later moves to an incompatible version.
19
+ *
20
+ * Best-effort and non-fatal — the server-side app already exists by the time this
21
+ * runs:
22
+ * - No `package.json` in `appDir` (e.g. `ms app create` with a custom
23
+ * `--template` that isn't an npm project) → nothing to pin; return quietly.
24
+ * - Read / parse / write failure → warn (outside `--json` mode) and continue;
25
+ * the user can add the pin by hand.
26
+ *
27
+ * The entry overwrites any existing CLI `devDependencies` entry, and
28
+ * `devDependencies` is re-sorted alphabetically to match the npm convention so a
29
+ * later `install --save` won't reshuffle the file.
30
+ */
31
+ export function pinCliIntoAppPackageJson(appDir, jsonMode) {
32
+ const packageJsonPath = path.join(appDir, 'package.json');
33
+ // existsSync gate keeps the common "not an npm project" case off the warning
34
+ // path below — only genuine read/parse/write failures should warn.
35
+ if (!fs.existsSync(packageJsonPath)) {
36
+ return;
37
+ }
38
+ try {
39
+ const manifest = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
40
+ manifest.devDependencies = Object.fromEntries(Object.entries({
41
+ ...manifest.devDependencies,
42
+ [packageJson.name]: packageJson.version,
43
+ // Explicit 'en' locale keeps the sort order deterministic across hosts
44
+ // (a bare localeCompare follows the machine's default collation).
45
+ }).sort(([a], [b]) => a.localeCompare(b, 'en')));
46
+ // JSON.stringify drops the trailing newline every scaffolder emits; re-add it.
47
+ fs.writeFileSync(packageJsonPath, `${JSON.stringify(manifest, null, 2)}\n`);
48
+ }
49
+ catch (err) {
50
+ if (!jsonMode) {
51
+ printWarning(`Could not pin '${packageJson.name}' into ${packageJsonPath} ` +
52
+ `(${err instanceof Error ? err.message : String(err)}). Add ` +
53
+ `"${packageJson.name}": "${packageJson.version}" to devDependencies manually ` +
54
+ `to get a project-local CLI.`);
55
+ }
56
+ }
57
+ }
58
+ //# sourceMappingURL=PinCli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PinCli.js","sourceRoot":"","sources":["../../src/Utils/PinCli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,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AC;AACH,CAAC"}
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { RepoType } from '@microsoft/managed-apps-common/config';
5
+ /**
6
+ * Result of parsing the `--repo` flag value.
7
+ *
8
+ * - `native` (default): MAAF auto-provisions a platform-managed git repo, no remote URL.
9
+ * - `none`: source-control-free; no platform-managed repo, no remote URL.
10
+ * - `github`: bound to an external GitHub Enterprise repo at `remoteUrl`.
11
+ *
12
+ * `remoteUrl` is populated only when `repoType === 'github'`. This is a flat
13
+ * interface (not a discriminated union), so `if (repoType === 'github')` does NOT
14
+ * auto-narrow `remoteUrl` to `string`; github-branch use sites assert `remoteUrl!`.
15
+ */
16
+ export interface RepoSelection {
17
+ repoType: RepoType;
18
+ remoteUrl: string | undefined;
19
+ }
20
+ /**
21
+ * Maps the raw `--repo` flag value to a `(repoType, remoteUrl)` pair.
22
+ * - omitted / empty → `native` (default GRS-backed flow)
23
+ * - `none` (case-insensitive) → `none` (no GRS, no local setup)
24
+ * - any other non-empty value → `github` (external GHE binding, the trimmed value
25
+ * flows through as `remoteUrl` to the action and the eventual git clone)
26
+ *
27
+ * Runtime invariant: `remoteUrl` is set iff `repoType === 'github'`. Consumers
28
+ * branch on `repoType` and assert `remoteUrl!` at github use sites — see
29
+ * `RepoSelection` for why narrowing is not automatic.
30
+ *
31
+ * Lives in `Utils/` (not `Verbs/CreateMaafApp.ts`) so the lightweight `app init`
32
+ * verb can call it without pulling in `giget`/`child_process` from CreateMaafApp.
33
+ */
34
+ export declare function parseRepoOption(rawRepoValue: string | undefined): RepoSelection;
35
+ //# sourceMappingURL=RepoOption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RepoOption.d.ts","sourceRoot":"","sources":["../../src/Utils/RepoOption.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAWtE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,CAS/E"}