@microsoft/managed-apps-cli 0.5.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 (331) hide show
  1. package/LICENSE +153 -0
  2. package/README.md +280 -0
  3. package/dist/ArgumentProvider.d.ts +102 -0
  4. package/dist/ArgumentProvider.d.ts.map +1 -0
  5. package/dist/ArgumentProvider.js +376 -0
  6. package/dist/ArgumentProvider.js.map +1 -0
  7. package/dist/Authentication/NodeMsalAuthenticationProvider.d.ts +18 -0
  8. package/dist/Authentication/NodeMsalAuthenticationProvider.d.ts.map +1 -0
  9. package/dist/Authentication/NodeMsalAuthenticationProvider.js +99 -0
  10. package/dist/Authentication/NodeMsalAuthenticationProvider.js.map +1 -0
  11. package/dist/Authentication/OrchardAuthenticationProvider.d.ts +13 -0
  12. package/dist/Authentication/OrchardAuthenticationProvider.d.ts.map +1 -0
  13. package/dist/Authentication/OrchardAuthenticationProvider.js +30 -0
  14. package/dist/Authentication/OrchardAuthenticationProvider.js.map +1 -0
  15. package/dist/Authentication/ServicePrincipalAuthenticationProvider.d.ts +23 -0
  16. package/dist/Authentication/ServicePrincipalAuthenticationProvider.d.ts.map +1 -0
  17. package/dist/Authentication/ServicePrincipalAuthenticationProvider.js +60 -0
  18. package/dist/Authentication/ServicePrincipalAuthenticationProvider.js.map +1 -0
  19. package/dist/Bin.d.ts +6 -0
  20. package/dist/Bin.d.ts.map +1 -0
  21. package/dist/Bin.js +7 -0
  22. package/dist/Bin.js.map +1 -0
  23. package/dist/Cli.d.ts +2 -0
  24. package/dist/Cli.d.ts.map +1 -0
  25. package/dist/Cli.js +91 -0
  26. package/dist/Cli.js.map +1 -0
  27. package/dist/CliSettings.d.ts +14 -0
  28. package/dist/CliSettings.d.ts.map +1 -0
  29. package/dist/CliSettings.js +78 -0
  30. package/dist/CliSettings.js.map +1 -0
  31. package/dist/CliUtils.d.ts +92 -0
  32. package/dist/CliUtils.d.ts.map +1 -0
  33. package/dist/CliUtils.js +218 -0
  34. package/dist/CliUtils.js.map +1 -0
  35. package/dist/Constants/CliConstants.d.ts +6 -0
  36. package/dist/Constants/CliConstants.d.ts.map +1 -0
  37. package/dist/Constants/CliConstants.js +6 -0
  38. package/dist/Constants/CliConstants.js.map +1 -0
  39. package/dist/Constants/CommandRegistry.d.ts +23 -0
  40. package/dist/Constants/CommandRegistry.d.ts.map +1 -0
  41. package/dist/Constants/CommandRegistry.js +193 -0
  42. package/dist/Constants/CommandRegistry.js.map +1 -0
  43. package/dist/Constants/HelpStrings.d.ts +321 -0
  44. package/dist/Constants/HelpStrings.d.ts.map +1 -0
  45. package/dist/Constants/HelpStrings.js +438 -0
  46. package/dist/Constants/HelpStrings.js.map +1 -0
  47. package/dist/Constants.d.ts +10 -0
  48. package/dist/Constants.d.ts.map +1 -0
  49. package/dist/Constants.js +18 -0
  50. package/dist/Constants.js.map +1 -0
  51. package/dist/Errors/CliError.d.ts +5 -0
  52. package/dist/Errors/CliError.d.ts.map +1 -0
  53. package/dist/Errors/CliError.js +7 -0
  54. package/dist/Errors/CliError.js.map +1 -0
  55. package/dist/FS/CliFs.d.ts +41 -0
  56. package/dist/FS/CliFs.d.ts.map +1 -0
  57. package/dist/FS/CliFs.js +136 -0
  58. package/dist/FS/CliFs.js.map +1 -0
  59. package/dist/HttpClient/CliHttpClient.d.ts +24 -0
  60. package/dist/HttpClient/CliHttpClient.d.ts.map +1 -0
  61. package/dist/HttpClient/CliHttpClient.js +122 -0
  62. package/dist/HttpClient/CliHttpClient.js.map +1 -0
  63. package/dist/HttpClient/OrchardProxy.d.ts +11 -0
  64. package/dist/HttpClient/OrchardProxy.d.ts.map +1 -0
  65. package/dist/HttpClient/OrchardProxy.js +25 -0
  66. package/dist/HttpClient/OrchardProxy.js.map +1 -0
  67. package/dist/HttpClient/Proxy.d.ts +7 -0
  68. package/dist/HttpClient/Proxy.d.ts.map +1 -0
  69. package/dist/HttpClient/Proxy.js +5 -0
  70. package/dist/HttpClient/Proxy.js.map +1 -0
  71. package/dist/Logger/CliLogger.d.ts +36 -0
  72. package/dist/Logger/CliLogger.d.ts.map +1 -0
  73. package/dist/Logger/CliLogger.js +235 -0
  74. package/dist/Logger/CliLogger.js.map +1 -0
  75. package/dist/Logger/ConsoleWriter.d.ts +15 -0
  76. package/dist/Logger/ConsoleWriter.d.ts.map +1 -0
  77. package/dist/Logger/ConsoleWriter.js +45 -0
  78. package/dist/Logger/ConsoleWriter.js.map +1 -0
  79. package/dist/Logger/Constants.d.ts +6 -0
  80. package/dist/Logger/Constants.d.ts.map +1 -0
  81. package/dist/Logger/Constants.js +15 -0
  82. package/dist/Logger/Constants.js.map +1 -0
  83. package/dist/Logger/LoggerSettings.d.ts +19 -0
  84. package/dist/Logger/LoggerSettings.d.ts.map +1 -0
  85. package/dist/Logger/LoggerSettings.js +114 -0
  86. package/dist/Logger/LoggerSettings.js.map +1 -0
  87. package/dist/Logger/OneDSWriter.d.ts +22 -0
  88. package/dist/Logger/OneDSWriter.d.ts.map +1 -0
  89. package/dist/Logger/OneDSWriter.js +129 -0
  90. package/dist/Logger/OneDSWriter.js.map +1 -0
  91. package/dist/Logger/Scrubber/ScrubCustomDimensions.d.ts +5 -0
  92. package/dist/Logger/Scrubber/ScrubCustomDimensions.d.ts.map +1 -0
  93. package/dist/Logger/Scrubber/ScrubCustomDimensions.js +46 -0
  94. package/dist/Logger/Scrubber/ScrubCustomDimensions.js.map +1 -0
  95. package/dist/Logger/Scrubber/ScrubCustomDimensionsConfig.d.ts +27 -0
  96. package/dist/Logger/Scrubber/ScrubCustomDimensionsConfig.d.ts.map +1 -0
  97. package/dist/Logger/Scrubber/ScrubCustomDimensionsConfig.js +168 -0
  98. package/dist/Logger/Scrubber/ScrubCustomDimensionsConfig.js.map +1 -0
  99. package/dist/Logger/Scrubber/ScrubUtils.d.ts +8 -0
  100. package/dist/Logger/Scrubber/ScrubUtils.d.ts.map +1 -0
  101. package/dist/Logger/Scrubber/ScrubUtils.js +34 -0
  102. package/dist/Logger/Scrubber/ScrubUtils.js.map +1 -0
  103. package/dist/Types/Argument.types.d.ts +27 -0
  104. package/dist/Types/Argument.types.d.ts.map +1 -0
  105. package/dist/Types/Argument.types.js +5 -0
  106. package/dist/Types/Argument.types.js.map +1 -0
  107. package/dist/Types/Cli.types.d.ts +32 -0
  108. package/dist/Types/Cli.types.d.ts.map +1 -0
  109. package/dist/Types/Cli.types.js +5 -0
  110. package/dist/Types/Cli.types.js.map +1 -0
  111. package/dist/Types/Command.types.d.ts +52 -0
  112. package/dist/Types/Command.types.d.ts.map +1 -0
  113. package/dist/Types/Command.types.js +8 -0
  114. package/dist/Types/Command.types.js.map +1 -0
  115. package/dist/Types/Datasource.types.d.ts +43 -0
  116. package/dist/Types/Datasource.types.d.ts.map +1 -0
  117. package/dist/Types/Datasource.types.js +5 -0
  118. package/dist/Types/Datasource.types.js.map +1 -0
  119. package/dist/Types/LoggerTypes.types.d.ts +17 -0
  120. package/dist/Types/LoggerTypes.types.d.ts.map +1 -0
  121. package/dist/Types/LoggerTypes.types.js +5 -0
  122. package/dist/Types/LoggerTypes.types.js.map +1 -0
  123. package/dist/Utils/BuildVerbDescriptionTable.d.ts +19 -0
  124. package/dist/Utils/BuildVerbDescriptionTable.d.ts.map +1 -0
  125. package/dist/Utils/BuildVerbDescriptionTable.js +87 -0
  126. package/dist/Utils/BuildVerbDescriptionTable.js.map +1 -0
  127. package/dist/Utils/ConsoleOutput.d.ts +80 -0
  128. package/dist/Utils/ConsoleOutput.d.ts.map +1 -0
  129. package/dist/Utils/ConsoleOutput.js +151 -0
  130. package/dist/Utils/ConsoleOutput.js.map +1 -0
  131. package/dist/Utils/DetectPackageManager.d.ts +9 -0
  132. package/dist/Utils/DetectPackageManager.d.ts.map +1 -0
  133. package/dist/Utils/DetectPackageManager.js +24 -0
  134. package/dist/Utils/DetectPackageManager.js.map +1 -0
  135. package/dist/Utils/EnhanceNetworkError.d.ts +14 -0
  136. package/dist/Utils/EnhanceNetworkError.d.ts.map +1 -0
  137. package/dist/Utils/EnhanceNetworkError.js +59 -0
  138. package/dist/Utils/EnhanceNetworkError.js.map +1 -0
  139. package/dist/Utils/EnvVars.d.ts +17 -0
  140. package/dist/Utils/EnvVars.d.ts.map +1 -0
  141. package/dist/Utils/EnvVars.js +38 -0
  142. package/dist/Utils/EnvVars.js.map +1 -0
  143. package/dist/Utils/GitCredentialConfig.d.ts +12 -0
  144. package/dist/Utils/GitCredentialConfig.d.ts.map +1 -0
  145. package/dist/Utils/GitCredentialConfig.js +32 -0
  146. package/dist/Utils/GitCredentialConfig.js.map +1 -0
  147. package/dist/Utils/GitUtils.d.ts +22 -0
  148. package/dist/Utils/GitUtils.d.ts.map +1 -0
  149. package/dist/Utils/GitUtils.js +35 -0
  150. package/dist/Utils/GitUtils.js.map +1 -0
  151. package/dist/Utils/Paging.d.ts +23 -0
  152. package/dist/Utils/Paging.d.ts.map +1 -0
  153. package/dist/Utils/Paging.js +67 -0
  154. package/dist/Utils/Paging.js.map +1 -0
  155. package/dist/Utils/ReadPackageJson.d.ts +9 -0
  156. package/dist/Utils/ReadPackageJson.d.ts.map +1 -0
  157. package/dist/Utils/ReadPackageJson.js +13 -0
  158. package/dist/Utils/ReadPackageJson.js.map +1 -0
  159. package/dist/Utils/ResolveCommand.d.ts +26 -0
  160. package/dist/Utils/ResolveCommand.d.ts.map +1 -0
  161. package/dist/Utils/ResolveCommand.js +62 -0
  162. package/dist/Utils/ResolveCommand.js.map +1 -0
  163. package/dist/Utils/RunCommand.d.ts +33 -0
  164. package/dist/Utils/RunCommand.d.ts.map +1 -0
  165. package/dist/Utils/RunCommand.js +83 -0
  166. package/dist/Utils/RunCommand.js.map +1 -0
  167. package/dist/Utils/Spinner.d.ts +15 -0
  168. package/dist/Utils/Spinner.d.ts.map +1 -0
  169. package/dist/Utils/Spinner.js +71 -0
  170. package/dist/Utils/Spinner.js.map +1 -0
  171. package/dist/Utils/zipBuildArtifact.d.ts +35 -0
  172. package/dist/Utils/zipBuildArtifact.d.ts.map +1 -0
  173. package/dist/Utils/zipBuildArtifact.js +100 -0
  174. package/dist/Utils/zipBuildArtifact.js.map +1 -0
  175. package/dist/Verbs/AddAction.d.ts +6 -0
  176. package/dist/Verbs/AddAction.d.ts.map +1 -0
  177. package/dist/Verbs/AddAction.js +87 -0
  178. package/dist/Verbs/AddAction.js.map +1 -0
  179. package/dist/Verbs/AddDataSource.d.ts +19 -0
  180. package/dist/Verbs/AddDataSource.d.ts.map +1 -0
  181. package/dist/Verbs/AddDataSource.js +173 -0
  182. package/dist/Verbs/AddDataSource.js.map +1 -0
  183. package/dist/Verbs/AddFlow.d.ts +12 -0
  184. package/dist/Verbs/AddFlow.d.ts.map +1 -0
  185. package/dist/Verbs/AddFlow.js +67 -0
  186. package/dist/Verbs/AddFlow.js.map +1 -0
  187. package/dist/Verbs/AddTable.d.ts +6 -0
  188. package/dist/Verbs/AddTable.d.ts.map +1 -0
  189. package/dist/Verbs/AddTable.js +163 -0
  190. package/dist/Verbs/AddTable.js.map +1 -0
  191. package/dist/Verbs/AuthStatus.d.ts +6 -0
  192. package/dist/Verbs/AuthStatus.d.ts.map +1 -0
  193. package/dist/Verbs/AuthStatus.js +18 -0
  194. package/dist/Verbs/AuthStatus.js.map +1 -0
  195. package/dist/Verbs/BuildMaafApp.d.ts +6 -0
  196. package/dist/Verbs/BuildMaafApp.d.ts.map +1 -0
  197. package/dist/Verbs/BuildMaafApp.js +96 -0
  198. package/dist/Verbs/BuildMaafApp.js.map +1 -0
  199. package/dist/Verbs/ConnectorHelpers.d.ts +37 -0
  200. package/dist/Verbs/ConnectorHelpers.d.ts.map +1 -0
  201. package/dist/Verbs/ConnectorHelpers.js +116 -0
  202. package/dist/Verbs/ConnectorHelpers.js.map +1 -0
  203. package/dist/Verbs/CreateMaafApp.d.ts +58 -0
  204. package/dist/Verbs/CreateMaafApp.d.ts.map +1 -0
  205. package/dist/Verbs/CreateMaafApp.js +712 -0
  206. package/dist/Verbs/CreateMaafApp.js.map +1 -0
  207. package/dist/Verbs/DeleteDataSource.d.ts +6 -0
  208. package/dist/Verbs/DeleteDataSource.d.ts.map +1 -0
  209. package/dist/Verbs/DeleteDataSource.js +105 -0
  210. package/dist/Verbs/DeleteDataSource.js.map +1 -0
  211. package/dist/Verbs/DeleteMaafApp.d.ts +23 -0
  212. package/dist/Verbs/DeleteMaafApp.d.ts.map +1 -0
  213. package/dist/Verbs/DeleteMaafApp.js +98 -0
  214. package/dist/Verbs/DeleteMaafApp.js.map +1 -0
  215. package/dist/Verbs/DeployMaafApp.d.ts +6 -0
  216. package/dist/Verbs/DeployMaafApp.d.ts.map +1 -0
  217. package/dist/Verbs/DeployMaafApp.js +501 -0
  218. package/dist/Verbs/DeployMaafApp.js.map +1 -0
  219. package/dist/Verbs/Dev.d.ts +6 -0
  220. package/dist/Verbs/Dev.d.ts.map +1 -0
  221. package/dist/Verbs/Dev.js +212 -0
  222. package/dist/Verbs/Dev.js.map +1 -0
  223. package/dist/Verbs/FindDataverseApi.d.ts +12 -0
  224. package/dist/Verbs/FindDataverseApi.d.ts.map +1 -0
  225. package/dist/Verbs/FindDataverseApi.js +101 -0
  226. package/dist/Verbs/FindDataverseApi.js.map +1 -0
  227. package/dist/Verbs/GetMaafApp.d.ts +6 -0
  228. package/dist/Verbs/GetMaafApp.d.ts.map +1 -0
  229. package/dist/Verbs/GetMaafApp.js +59 -0
  230. package/dist/Verbs/GetMaafApp.js.map +1 -0
  231. package/dist/Verbs/GetMaafBuildStatus.d.ts +6 -0
  232. package/dist/Verbs/GetMaafBuildStatus.d.ts.map +1 -0
  233. package/dist/Verbs/GetMaafBuildStatus.js +67 -0
  234. package/dist/Verbs/GetMaafBuildStatus.js.map +1 -0
  235. package/dist/Verbs/GetSettings.d.ts +12 -0
  236. package/dist/Verbs/GetSettings.d.ts.map +1 -0
  237. package/dist/Verbs/GetSettings.js +48 -0
  238. package/dist/Verbs/GetSettings.js.map +1 -0
  239. package/dist/Verbs/Init.d.ts +6 -0
  240. package/dist/Verbs/Init.d.ts.map +1 -0
  241. package/dist/Verbs/Init.js +171 -0
  242. package/dist/Verbs/Init.js.map +1 -0
  243. package/dist/Verbs/ListConnectionReferences.d.ts +6 -0
  244. package/dist/Verbs/ListConnectionReferences.d.ts.map +1 -0
  245. package/dist/Verbs/ListConnectionReferences.js +70 -0
  246. package/dist/Verbs/ListConnectionReferences.js.map +1 -0
  247. package/dist/Verbs/ListConnectorActions.d.ts +6 -0
  248. package/dist/Verbs/ListConnectorActions.d.ts.map +1 -0
  249. package/dist/Verbs/ListConnectorActions.js +73 -0
  250. package/dist/Verbs/ListConnectorActions.js.map +1 -0
  251. package/dist/Verbs/ListConnectors.d.ts +6 -0
  252. package/dist/Verbs/ListConnectors.d.ts.map +1 -0
  253. package/dist/Verbs/ListConnectors.js +66 -0
  254. package/dist/Verbs/ListConnectors.js.map +1 -0
  255. package/dist/Verbs/ListDatasets.d.ts +6 -0
  256. package/dist/Verbs/ListDatasets.d.ts.map +1 -0
  257. package/dist/Verbs/ListDatasets.js +82 -0
  258. package/dist/Verbs/ListDatasets.js.map +1 -0
  259. package/dist/Verbs/ListEnvironmentVariables.d.ts +14 -0
  260. package/dist/Verbs/ListEnvironmentVariables.d.ts.map +1 -0
  261. package/dist/Verbs/ListEnvironmentVariables.js +66 -0
  262. package/dist/Verbs/ListEnvironmentVariables.js.map +1 -0
  263. package/dist/Verbs/ListFlows.d.ts +13 -0
  264. package/dist/Verbs/ListFlows.d.ts.map +1 -0
  265. package/dist/Verbs/ListFlows.js +88 -0
  266. package/dist/Verbs/ListFlows.js.map +1 -0
  267. package/dist/Verbs/ListMaafApps.d.ts +71 -0
  268. package/dist/Verbs/ListMaafApps.d.ts.map +1 -0
  269. package/dist/Verbs/ListMaafApps.js +168 -0
  270. package/dist/Verbs/ListMaafApps.js.map +1 -0
  271. package/dist/Verbs/ListSqlStoredProcedures.d.ts +6 -0
  272. package/dist/Verbs/ListSqlStoredProcedures.d.ts.map +1 -0
  273. package/dist/Verbs/ListSqlStoredProcedures.js +84 -0
  274. package/dist/Verbs/ListSqlStoredProcedures.js.map +1 -0
  275. package/dist/Verbs/ListTables.d.ts +6 -0
  276. package/dist/Verbs/ListTables.d.ts.map +1 -0
  277. package/dist/Verbs/ListTables.js +94 -0
  278. package/dist/Verbs/ListTables.js.map +1 -0
  279. package/dist/Verbs/Login.d.ts +6 -0
  280. package/dist/Verbs/Login.d.ts.map +1 -0
  281. package/dist/Verbs/Login.js +28 -0
  282. package/dist/Verbs/Login.js.map +1 -0
  283. package/dist/Verbs/Logout.d.ts +6 -0
  284. package/dist/Verbs/Logout.d.ts.map +1 -0
  285. package/dist/Verbs/Logout.js +28 -0
  286. package/dist/Verbs/Logout.js.map +1 -0
  287. package/dist/Verbs/MaafAppPermissions.d.ts +23 -0
  288. package/dist/Verbs/MaafAppPermissions.d.ts.map +1 -0
  289. package/dist/Verbs/MaafAppPermissions.js +278 -0
  290. package/dist/Verbs/MaafAppPermissions.js.map +1 -0
  291. package/dist/Verbs/Pack.d.ts +42 -0
  292. package/dist/Verbs/Pack.d.ts.map +1 -0
  293. package/dist/Verbs/Pack.js +114 -0
  294. package/dist/Verbs/Pack.js.map +1 -0
  295. package/dist/Verbs/RefreshDataSource.d.ts +6 -0
  296. package/dist/Verbs/RefreshDataSource.d.ts.map +1 -0
  297. package/dist/Verbs/RefreshDataSource.js +72 -0
  298. package/dist/Verbs/RefreshDataSource.js.map +1 -0
  299. package/dist/Verbs/RemoveFlow.d.ts +12 -0
  300. package/dist/Verbs/RemoveFlow.d.ts.map +1 -0
  301. package/dist/Verbs/RemoveFlow.js +99 -0
  302. package/dist/Verbs/RemoveFlow.js.map +1 -0
  303. package/dist/Verbs/SetSetting.d.ts +12 -0
  304. package/dist/Verbs/SetSetting.d.ts.map +1 -0
  305. package/dist/Verbs/SetSetting.js +141 -0
  306. package/dist/Verbs/SetSetting.js.map +1 -0
  307. package/dist/Verbs/ShareMaafApp.d.ts +12 -0
  308. package/dist/Verbs/ShareMaafApp.d.ts.map +1 -0
  309. package/dist/Verbs/ShareMaafApp.js +14 -0
  310. package/dist/Verbs/ShareMaafApp.js.map +1 -0
  311. package/dist/Verbs/ShowMaafApp.d.ts +94 -0
  312. package/dist/Verbs/ShowMaafApp.d.ts.map +1 -0
  313. package/dist/Verbs/ShowMaafApp.js +216 -0
  314. package/dist/Verbs/ShowMaafApp.js.map +1 -0
  315. package/dist/Verbs/TelemetrySettings.d.ts +8 -0
  316. package/dist/Verbs/TelemetrySettings.d.ts.map +1 -0
  317. package/dist/Verbs/TelemetrySettings.js +104 -0
  318. package/dist/Verbs/TelemetrySettings.js.map +1 -0
  319. package/dist/Verbs/UnshareMaafApp.d.ts +12 -0
  320. package/dist/Verbs/UnshareMaafApp.d.ts.map +1 -0
  321. package/dist/Verbs/UnshareMaafApp.js +14 -0
  322. package/dist/Verbs/UnshareMaafApp.js.map +1 -0
  323. package/dist/Verbs/VerbConstants.d.ts +415 -0
  324. package/dist/Verbs/VerbConstants.d.ts.map +1 -0
  325. package/dist/Verbs/VerbConstants.js +382 -0
  326. package/dist/Verbs/VerbConstants.js.map +1 -0
  327. package/dist/Verbs/index.d.ts +39 -0
  328. package/dist/Verbs/index.d.ts.map +1 -0
  329. package/dist/Verbs/index.js +39 -0
  330. package/dist/Verbs/index.js.map +1 -0
  331. package/package.json +52 -0
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import * as fs from 'fs';
5
+ import { AUTH_CACHE_DIRECTORY } from '../Constants.js';
6
+ import { HelpStrings } from '../Constants/HelpStrings.js';
7
+ import { printError, printInfo, printSuccess, printWarning } from '../Utils/ConsoleOutput.js';
8
+ export async function logoutAsync(argumentProvider) {
9
+ argumentProvider.setDescription(HelpStrings.auth.logout.description);
10
+ argumentProvider.addExamples(HelpStrings.auth.logout.examples);
11
+ await argumentProvider.runVerb();
12
+ const cacheDir = AUTH_CACHE_DIRECTORY;
13
+ try {
14
+ if (fs.existsSync(cacheDir)) {
15
+ fs.rmSync(cacheDir, { recursive: true, force: true });
16
+ printSuccess('Successfully logged out. Cached credentials have been cleared.');
17
+ printInfo('On next command, you will be prompted to sign in via the browser. If your browser has a single account session, it will be used automatically.');
18
+ }
19
+ else {
20
+ printWarning('No user found.');
21
+ }
22
+ }
23
+ catch (error) {
24
+ printError(`Failed to log out the user: ${error.message}`);
25
+ throw error;
26
+ }
27
+ }
28
+ //# sourceMappingURL=Logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logout.js","sourceRoot":"","sources":["../../src/Verbs/Logout.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAGzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3F,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,gBAAkC;IAClE,gBAAgB,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACrE,gBAAgB,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE/D,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;IAEjC,MAAM,QAAQ,GAAG,oBAAoB,CAAC;IAEtC,IAAI,CAAC;QACH,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACtD,YAAY,CAAC,gEAAgE,CAAC,CAAC;YAC/E,SAAS,CACP,gJAAgJ,CACjJ,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,gBAAgB,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,UAAU,CAAC,+BAAgC,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QACtE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { ArgumentProvider } from '../ArgumentProvider.js';
5
+ /** Selects between the share (put) and unshare (delete) execution paths. */
6
+ export type MaafAppPermissionsMode = 'share' | 'unshare';
7
+ /**
8
+ * Implements `ms app share` and `ms app unshare` — adds or removes the
9
+ * `Microsoft App Reader` role for AAD principals (users or groups) at the app
10
+ * scope.
11
+ *
12
+ * Pipeline:
13
+ * 1. Register option schema for the chosen mode and run the verb (so `--help`
14
+ * works outside an init'd project).
15
+ * 2. Require a loaded `ms.config.json`.
16
+ * 3. Resolve `environmentId` (`--environment-id` flag wins; otherwise from config) and tenantId.
17
+ * 4. Read the comma-separated principals positional; resolve email-shaped inputs
18
+ * to AAD object ids via Graph, pass GUID-shaped inputs through unchanged.
19
+ * 5. Call `modifyPermissionsAsync` with `put` or `delete` populated based on
20
+ * `mode`, then emit JSON or a human summary.
21
+ */
22
+ export declare function executeMaafAppPermissionsAsync(argumentProvider: ArgumentProvider, mode: MaafAppPermissionsMode): Promise<void>;
23
+ //# sourceMappingURL=MaafAppPermissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaafAppPermissions.d.ts","sourceRoot":"","sources":["../../src/Verbs/MaafAppPermissions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAS5D,4EAA4E;AAC5E,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,SAAS,CAAC;AAuBzD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,8BAA8B,CAClD,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAyGf"}
@@ -0,0 +1,278 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { MaafAppReaderRoleName, modifyPermissionsAsync, resolvePrincipalByEmailAsync, } from '@microsoft/managed-apps-actions';
5
+ import { AppConfigFileName } from '@microsoft/managed-apps-common/config';
6
+ import { HttpClientError } from '@microsoft/managed-apps-common/services';
7
+ import { getCliLogger, getSettings } from '../CliSettings.js';
8
+ import { isGuid, resolveAppNameAsync, resolveEnvironmentId } from '../CliUtils.js';
9
+ import { CLI_BINARY_NAME } from '../Constants/CliConstants.js';
10
+ import { HelpStrings } from '../Constants/HelpStrings.js';
11
+ import { UsageError } from '../Errors/CliError.js';
12
+ import { printInfo, printJsonSuccess, printSuccess, printWarning } from '../Utils/ConsoleOutput.js';
13
+ import { ShareMaafAppArguments, UnshareMaafAppArguments } from './VerbConstants.js';
14
+ /**
15
+ * Implements `ms app share` and `ms app unshare` — adds or removes the
16
+ * `Microsoft App Reader` role for AAD principals (users or groups) at the app
17
+ * scope.
18
+ *
19
+ * Pipeline:
20
+ * 1. Register option schema for the chosen mode and run the verb (so `--help`
21
+ * works outside an init'd project).
22
+ * 2. Require a loaded `ms.config.json`.
23
+ * 3. Resolve `environmentId` (`--environment-id` flag wins; otherwise from config) and tenantId.
24
+ * 4. Read the comma-separated principals positional; resolve email-shaped inputs
25
+ * to AAD object ids via Graph, pass GUID-shaped inputs through unchanged.
26
+ * 5. Call `modifyPermissionsAsync` with `put` or `delete` populated based on
27
+ * `mode`, then emit JSON or a human summary.
28
+ */
29
+ export async function executeMaafAppPermissionsAsync(argumentProvider, mode) {
30
+ configureOptionSchema(argumentProvider, mode);
31
+ await argumentProvider.runVerb();
32
+ const cliSettings = getSettings();
33
+ if (!cliSettings.appConfig) {
34
+ throw new UsageError(`No ${AppConfigFileName} found in the current directory. Run "npx ${CLI_BINARY_NAME} app init" first.`);
35
+ }
36
+ // `resolveEnvironmentId` enforces flag-wins precedence and pushes the resolved
37
+ // id into player services so the URL builder targets the override.
38
+ const environmentId = await resolveEnvironmentId(argumentProvider);
39
+ const tenantId = await argumentProvider.getTenantIdAsync();
40
+ if (!tenantId) {
41
+ throw new UsageError('Unable to determine tenant ID. Ensure you are logged in.');
42
+ }
43
+ const appName = await resolveAppNameAsync(argumentProvider);
44
+ const inputs = parseInputs(argumentProvider.getPositionalArg(0));
45
+ if (inputs.length === 0) {
46
+ throw new UsageError('Provide at least one principal as a comma-separated list (AAD object IDs or email addresses).');
47
+ }
48
+ // Failures (bad shape, no Graph match, transport error) are collected here so
49
+ // we can warn the user but still proceed with the entries that resolved.
50
+ const failures = [];
51
+ const refs = await resolveAllAsync(inputs, failures);
52
+ // If nothing resolved, the operation has no inputs to apply — abort with a
53
+ // single error listing every failure rather than calling the RP with an empty
54
+ // array.
55
+ if (refs.length === 0) {
56
+ throw new UsageError(formatFailures(failures));
57
+ }
58
+ // Otherwise warn about the unresolved entries up front (so they're visible
59
+ // before the success line), then proceed with the resolved subset.
60
+ if (failures.length > 0) {
61
+ printWarning(formatFailures(failures));
62
+ }
63
+ const entries = refs.map(toPermissionEntry);
64
+ const result = await modifyPermissionsAsync({
65
+ tenantId,
66
+ environmentId,
67
+ logger: getCliLogger(),
68
+ actionsParams: {
69
+ appName,
70
+ put: mode === 'share' ? entries : [],
71
+ delete: mode === 'unshare' ? entries : [],
72
+ },
73
+ });
74
+ if (argumentProvider.isJsonMode()) {
75
+ const _assertNoCollision = true;
76
+ void _assertNoCollision;
77
+ printJsonSuccess({
78
+ ...result,
79
+ partialFailure: failures.length > 0,
80
+ warnings: failures,
81
+ });
82
+ }
83
+ else {
84
+ printSummary(appName, mode, refs.length, result);
85
+ }
86
+ }
87
+ /**
88
+ * Splits a comma-separated string into a deduplicated, trimmed list of inputs.
89
+ * Each entry is either an AAD object id (GUID) or an email address. Empty
90
+ * segments (trailing commas, whitespace-only entries) are dropped.
91
+ */
92
+ function parseInputs(raw) {
93
+ if (!raw)
94
+ return [];
95
+ const seen = new Set();
96
+ for (const segment of raw.split(',')) {
97
+ const trimmed = segment.trim();
98
+ if (trimmed)
99
+ seen.add(trimmed);
100
+ }
101
+ return [...seen];
102
+ }
103
+ /**
104
+ * Resolves a list of principal inputs to AAD object ids. GUIDs pass through
105
+ * unchanged; anything containing `@` is treated as an email and resolved via
106
+ * Microsoft Graph.
107
+ *
108
+ * Per-entry failures (malformed input, no Graph match, transport error like
109
+ * 403 on the group lookup) are pushed to the shared `failures` array rather
110
+ * than throwing, so one bad email doesn't kill an otherwise-valid batch.
111
+ *
112
+ * Resolution runs Graph calls in parallel (`Promise.all`), with an in-flight
113
+ * map coalescing concurrent requests for the same email. The cache deduplicates
114
+ * within a single invocation (e.g. the same email listed twice round-trips Graph
115
+ * once).
116
+ */
117
+ async function resolveAllAsync(inputs, failures) {
118
+ const cache = new Map();
119
+ const inFlight = new Map();
120
+ const settled = await Promise.all(inputs.map(async (input) => {
121
+ const cacheKey = input.toLowerCase();
122
+ const hit = cache.get(cacheKey);
123
+ if (hit)
124
+ return hit;
125
+ if (isGuid(input)) {
126
+ const ref = { id: input, input };
127
+ cache.set(cacheKey, ref);
128
+ return ref;
129
+ }
130
+ if (!looksLikeEmail(input)) {
131
+ failures.push({
132
+ input,
133
+ reason: 'not an AAD object ID (GUID) or a valid email address',
134
+ });
135
+ return null;
136
+ }
137
+ try {
138
+ let resolution = inFlight.get(cacheKey);
139
+ if (!resolution) {
140
+ resolution = resolvePrincipalByEmailAsync(input, getCliLogger());
141
+ inFlight.set(cacheKey, resolution);
142
+ }
143
+ const resolved = await resolution;
144
+ if (!resolved) {
145
+ failures.push({
146
+ input,
147
+ reason: 'no user or group found in this tenant (invite as a guest in Entra ID first if external)',
148
+ });
149
+ return null;
150
+ }
151
+ const ref = {
152
+ id: resolved.id,
153
+ input,
154
+ email: input,
155
+ displayName: resolved.displayName,
156
+ };
157
+ cache.set(cacheKey, ref);
158
+ return ref;
159
+ }
160
+ catch (error) {
161
+ failures.push({
162
+ input,
163
+ reason: extractGraphErrorMessage(error),
164
+ });
165
+ return null;
166
+ }
167
+ }));
168
+ return settled.filter((r) => r !== null);
169
+ }
170
+ /**
171
+ * Renders the failure list as a single multi-line message. The intro line
172
+ * leads with the count so users skimming a long warning see the impact first.
173
+ */
174
+ function formatFailures(failures) {
175
+ const noun = failures.length === 1 ? 'entry' : 'entries';
176
+ const lines = failures.map((f) => ` - ${f.input}: ${f.reason}`);
177
+ return [`Could not resolve ${failures.length} ${noun}:`, ...lines].join('\n');
178
+ }
179
+ /**
180
+ * Extracts the meaningful piece of a Graph HTTP error and formats it as
181
+ * `Graph <status>: <message>`.
182
+ *
183
+ * Prefers the structured fields on {@link HttpClientError} (`status` + JSON-parsed `body`),
184
+ * which removes the dependency on `err.message`'s exact format and decouples this code from
185
+ * which `IHttpClient` implementation produced the error. For anything else (plain `Error`,
186
+ * non-Graph response shape, body parse failure), falls back to the raw message so we never
187
+ * lose information.
188
+ */
189
+ function extractGraphErrorMessage(error) {
190
+ if (error instanceof HttpClientError) {
191
+ const message = extractGraphMessageFromBody(error.body);
192
+ if (message !== undefined) {
193
+ return `Graph ${error.status}: ${message}`;
194
+ }
195
+ return error.message;
196
+ }
197
+ return error instanceof Error ? error.message : String(error);
198
+ }
199
+ /**
200
+ * Parses a Graph error body string and returns the inner `error.message`. Returns
201
+ * `undefined` if the body is missing, not valid JSON, or doesn't carry the
202
+ * `{ error: { message } }` shape. Pulled out as a top-level function so the
203
+ * unit tests can exercise it without constructing an `HttpClientError`.
204
+ */
205
+ function extractGraphMessageFromBody(body) {
206
+ if (!body)
207
+ return undefined;
208
+ try {
209
+ const parsed = JSON.parse(body);
210
+ const message = parsed?.error?.message;
211
+ return typeof message === 'string' ? message : undefined;
212
+ }
213
+ catch {
214
+ return undefined;
215
+ }
216
+ }
217
+ /**
218
+ * Cheap pre-flight check that an input looks like an email address. We do not
219
+ * try to be RFC-5321 compliant — the goal is to surface obvious typos
220
+ * (`foo@`, `@bar`, `a@b@c`, `a@b`) as a `UsageError` naming the bad input,
221
+ * rather than letting Graph reject them with an opaque 400.
222
+ */
223
+ function looksLikeEmail(input) {
224
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(input);
225
+ }
226
+ /**
227
+ * Builds a `MaafAppPermission` from a resolved reference. The `name` field is a
228
+ * display label echoed back unchanged on the response — we prefer the friendly
229
+ * displayName from Graph, fall back to the original input. Setting `principal.email`
230
+ * (when the user supplied one) keeps the wire payload self-describing for server
231
+ * logs even though the response strips it.
232
+ */
233
+ function toPermissionEntry(ref) {
234
+ return {
235
+ name: ref.displayName ?? ref.input,
236
+ properties: {
237
+ roleName: MaafAppReaderRoleName,
238
+ principal: ref.email ? { id: ref.id, email: ref.email } : { id: ref.id },
239
+ },
240
+ };
241
+ }
242
+ /**
243
+ * For share, the granted count comes from the server echo (the spec lets the
244
+ * server dedupe or treat 409 "already exists" as success and echo the entry).
245
+ * For unshare, the count comes from the request because the spec says `delete`
246
+ * is not populated on the response and may be omitted or null.
247
+ */
248
+ function printSummary(appName, mode, inputCount, result) {
249
+ if (mode === 'share') {
250
+ const grantedCount = result.put?.length ?? 0;
251
+ if (grantedCount === 0) {
252
+ printInfo('No changes were applied.');
253
+ return;
254
+ }
255
+ printSuccess(`Shared app '${appName}' with ${grantedCount} ${pluralize('principal', grantedCount)}. They can now play the app.`);
256
+ return;
257
+ }
258
+ printSuccess(`Revoked play permissions for ${inputCount} ${pluralize('principal', inputCount)} on '${appName}'.`);
259
+ }
260
+ function pluralize(noun, count) {
261
+ return count === 1 ? noun : `${noun}s`;
262
+ }
263
+ function configureOptionSchema(argumentProvider, mode) {
264
+ const help = mode === 'share' ? HelpStrings.app.share : HelpStrings.app.unshare;
265
+ const args = mode === 'share' ? ShareMaafAppArguments : UnshareMaafAppArguments;
266
+ argumentProvider.setDescription(help.description);
267
+ argumentProvider.addExamples(help.examples);
268
+ argumentProvider.consumePositionalArg('<principals>');
269
+ argumentProvider.addOptions([
270
+ {
271
+ flags: { key: args.AppName.name },
272
+ env: args.AppName.envVar,
273
+ description: help.options.app,
274
+ optionalInNonInteractive: true,
275
+ },
276
+ ]);
277
+ }
278
+ //# sourceMappingURL=MaafAppPermissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaafAppPermissions.js","sourceRoot":"","sources":["../../src/Verbs/MaafAppPermissions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAG1E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AA0BjF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,gBAAkC,EAClC,IAA4B;IAE5B,qBAAqB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAC9C,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;IAEjC,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC;IAClC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC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+1,42 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { AppConfig } from '@microsoft/managed-apps-common/config';
5
+ import type { ArgumentProvider } from '../ArgumentProvider.js';
6
+ export interface PackResult {
7
+ /** App ID resolved from `ms.config.json`. */
8
+ appId: string;
9
+ /** Root of the packed output: `<projectRoot>/.{CLI_BINARY_NAME}/packed/`. */
10
+ packedFolder: string;
11
+ /** Per-app folder `<packedFolder>/apps/<appId>/` containing ms.config.json, manifest.json, dataSources.json, and client/. */
12
+ packAppOutputDir: string;
13
+ /** Per-app client folder inside `packedFolder` containing the copied build output. */
14
+ packClientOutputDir: string;
15
+ }
16
+ export interface PackOptions {
17
+ /**
18
+ * When true, suppresses all human-oriented stdout produced during pack: the build
19
+ * command banner, the spinner, and the build script's stdout/stderr (which is
20
+ * captured and surfaced only on failure). This keeps the parent stdout clean for
21
+ * JSON-mode callers like `ms app push --json`.
22
+ */
23
+ quiet?: boolean;
24
+ }
25
+ /**
26
+ * Validates the pack-related fields of `ms.config.json` (`buildPath`,
27
+ * `buildCommand`) without performing any I/O. Call this before any user-facing
28
+ * confirmation prompt so config errors surface up-front instead of after the
29
+ * user confirms.
30
+ *
31
+ * Typed as a TypeScript assertion predicate so callers can use `appConfig.buildPath` and
32
+ * `appConfig.buildCommand` as `string` (not `string | undefined`) without casts.
33
+ */
34
+ export declare function assertPackPreconditions(appConfig: AppConfig): asserts appConfig is AppConfig & Required<Pick<AppConfig, 'buildPath' | 'buildCommand'>>;
35
+ /**
36
+ * Runs the configured build command and copies its output into the canonical packed
37
+ * layout `<projectRoot>/.{CLI_BINARY_NAME}/packed/apps/<appId>/client/`. Returns the
38
+ * paths so callers (the `app pack` verb, `app push`) can consume the artifact.
39
+ */
40
+ export declare function packAppArtifactAsync(options?: PackOptions): Promise<PackResult>;
41
+ export declare function packAsync(argumentProvider: ArgumentProvider): Promise<void>;
42
+ //# sourceMappingURL=Pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pack.d.ts","sourceRoot":"","sources":["../../src/Verbs/Pack.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAIvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAS5D,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,6HAA6H;IAC7H,gBAAgB,EAAE,MAAM,CAAC;IACzB,sFAAsF;IACtF,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,SAAS,IAAI,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,cAAc,CAAC,CAAC,CAO1F;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAkDzF;AA4CD,wBAAsB,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAcjF"}
@@ -0,0 +1,114 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import * as fsp from 'node:fs/promises';
5
+ import * as path from 'node:path';
6
+ import { GENERATED_FOLDERNAME } from '@microsoft/managed-apps-codegen';
7
+ import { AppConfigFileName } from '@microsoft/managed-apps-common/config';
8
+ import JSON5 from 'json5';
9
+ import { getSettings } from '../CliSettings.js';
10
+ import { CLI_BINARY_NAME } from '../Constants/CliConstants.js';
11
+ import { HelpStrings } from '../Constants/HelpStrings.js';
12
+ import { AppError, ConfigurationError } from '../Errors/CliError.js';
13
+ import { printInfo, printJsonSuccess, printSuccess } from '../Utils/ConsoleOutput.js';
14
+ import { runCommandAsync } from '../Utils/RunCommand.js';
15
+ import { CliSpinner } from '../Utils/Spinner.js';
16
+ /**
17
+ * Validates the pack-related fields of `ms.config.json` (`buildPath`,
18
+ * `buildCommand`) without performing any I/O. Call this before any user-facing
19
+ * confirmation prompt so config errors surface up-front instead of after the
20
+ * user confirms.
21
+ *
22
+ * Typed as a TypeScript assertion predicate so callers can use `appConfig.buildPath` and
23
+ * `appConfig.buildCommand` as `string` (not `string | undefined`) without casts.
24
+ */
25
+ export function assertPackPreconditions(appConfig) {
26
+ if (!appConfig.buildPath) {
27
+ throw new ConfigurationError(`buildPath is required in ${AppConfigFileName} to pack an app`);
28
+ }
29
+ if (!appConfig.buildCommand) {
30
+ throw new ConfigurationError(`buildCommand is required in ${AppConfigFileName} to pack an app`);
31
+ }
32
+ }
33
+ /**
34
+ * Runs the configured build command and copies its output into the canonical packed
35
+ * layout `<projectRoot>/.{CLI_BINARY_NAME}/packed/apps/<appId>/client/`. Returns the
36
+ * paths so callers (the `app pack` verb, `app push`) can consume the artifact.
37
+ */
38
+ export async function packAppArtifactAsync(options = {}) {
39
+ const { quiet = false } = options;
40
+ const { appConfig, fileConfig } = getSettings();
41
+ if (!appConfig) {
42
+ throw new ConfigurationError(`${AppConfigFileName} is required to pack an app`);
43
+ }
44
+ const appId = appConfig.appId;
45
+ if (!appId) {
46
+ throw new ConfigurationError(`appId is required in ${AppConfigFileName} to pack an app`);
47
+ }
48
+ assertPackPreconditions(appConfig);
49
+ const { buildPath, buildCommand } = appConfig;
50
+ const projectRoot = path.dirname(path.resolve(fileConfig.appConfigPath));
51
+ const packedFolder = path.join(projectRoot, `.${CLI_BINARY_NAME}`, 'packed');
52
+ const packAppOutputDir = path.join(packedFolder, 'apps', appId);
53
+ const packClientOutputDir = path.join(packAppOutputDir, 'client');
54
+ if (!quiet) {
55
+ printInfo(`Running: ${buildCommand}`);
56
+ }
57
+ await runCommandAsync(buildCommand, projectRoot, { quiet });
58
+ const resolvedBuildPath = path.resolve(projectRoot, buildPath);
59
+ const spinner = quiet ? null : new CliSpinner();
60
+ spinner?.start();
61
+ try {
62
+ await fsp.rm(packedFolder, { recursive: true, force: true });
63
+ await fsp.mkdir(packClientOutputDir, { recursive: true });
64
+ await fsp.cp(resolvedBuildPath, packClientOutputDir, { recursive: true });
65
+ await fsp.copyFile(path.resolve(fileConfig.appConfigPath), path.join(packAppOutputDir, AppConfigFileName));
66
+ await extractDataSourcesAsync(projectRoot, packAppOutputDir, { quiet });
67
+ await fsp.writeFile(path.join(packAppOutputDir, 'manifest.json'), JSON.stringify({ hasCustomMiddleTier: false }, null, 2));
68
+ }
69
+ finally {
70
+ spinner?.stop();
71
+ }
72
+ return { appId, packedFolder, packAppOutputDir, packClientOutputDir };
73
+ }
74
+ const DATA_SOURCES_TS_PATH = path.join(GENERATED_FOLDERNAME, 'dataSources.ts');
75
+ const DATA_SOURCES_EXPORT_REGEX = /export\s+default\s+(\{[\s\S]*\});/;
76
+ async function extractDataSourcesAsync(projectRoot, packAppOutputDir, options) {
77
+ const dataSourcesTsPath = path.join(projectRoot, DATA_SOURCES_TS_PATH);
78
+ try {
79
+ await fsp.access(dataSourcesTsPath);
80
+ }
81
+ catch {
82
+ if (!options.quiet) {
83
+ printInfo(`${DATA_SOURCES_TS_PATH} not found — dataSources.json will not be included in the pack.`);
84
+ }
85
+ return;
86
+ }
87
+ const fileContent = await fsp.readFile(dataSourcesTsPath, 'utf-8');
88
+ const match = DATA_SOURCES_EXPORT_REGEX.exec(fileContent);
89
+ if (!match?.[1]) {
90
+ throw new AppError(`Could not extract dataSources from ${DATA_SOURCES_TS_PATH}`);
91
+ }
92
+ let parsed;
93
+ try {
94
+ parsed = JSON5.parse(match[1]);
95
+ }
96
+ catch (err) {
97
+ throw new AppError(`${DATA_SOURCES_TS_PATH} has an unexpected format: ${err.message}`);
98
+ }
99
+ await fsp.writeFile(path.join(packAppOutputDir, 'dataSources.json'), JSON.stringify(parsed, null, 2));
100
+ }
101
+ export async function packAsync(argumentProvider) {
102
+ argumentProvider.setDescription(HelpStrings.app.pack.description);
103
+ argumentProvider.addExamples(HelpStrings.app.pack.examples);
104
+ await argumentProvider.runVerb();
105
+ const jsonMode = argumentProvider.isJsonMode();
106
+ const result = await packAppArtifactAsync({ quiet: jsonMode });
107
+ if (jsonMode) {
108
+ printJsonSuccess(result);
109
+ }
110
+ else {
111
+ printSuccess('App successfully packed.');
112
+ }
113
+ }
114
+ //# sourceMappingURL=Pack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pack.js","sourceRoot":"","sources":["../../src/Verbs/Pack.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAuB9C;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CACrC,SAAoB;IAEpB,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,kBA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AAE,CAAC,CAAC,CAChC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,gBAAkC;IAChE,gBAAgB,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClE,gBAAgB,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAE5D,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;IAEjC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,UAAU,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE/D,IAAI,QAAQ,EAAE,CAAC;QACb,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,0BAA0B,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { ArgumentProvider } from '../ArgumentProvider.js';
5
+ export declare function refreshDataSourceAsync(argumentProvider: ArgumentProvider): Promise<void>;
6
+ //# sourceMappingURL=RefreshDataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefreshDataSource.d.ts","sourceRoot":"","sources":["../../src/Verbs/RefreshDataSource.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAO5D,wBAAsB,sBAAsB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4C9F"}
@@ -0,0 +1,72 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { getPlayerServiceConfig, refreshDataSourceAsync as refreshDataSourceActionsAsync, } from '@microsoft/managed-apps-actions';
5
+ import { getCliLogger, getSettings } from '../CliSettings.js';
6
+ import { promptConfirm, promptText } from '../CliUtils.js';
7
+ import { CLI_BINARY_NAME } from '../Constants/CliConstants.js';
8
+ import { HelpStrings } from '../Constants/HelpStrings.js';
9
+ import { RefreshDataSourceArguments } from './VerbConstants.js';
10
+ export async function refreshDataSourceAsync(argumentProvider) {
11
+ const settings = getSettings();
12
+ const { fileConfig, cliFs } = settings;
13
+ createOptionSchema(argumentProvider);
14
+ await argumentProvider.runVerb();
15
+ const playerServiceConfig = getPlayerServiceConfig();
16
+ const authenticationProvider = argumentProvider.getAuthenticationProvider();
17
+ const rawDataSourceName = await argumentProvider.getOption('dataSourceName');
18
+ const dataSourceName = rawDataSourceName || undefined;
19
+ const config = {
20
+ vfs: cliFs,
21
+ authProvider: authenticationProvider,
22
+ httpClient: argumentProvider.getHttpClient(),
23
+ region: playerServiceConfig.region,
24
+ environmentName: playerServiceConfig.environmentName,
25
+ localFilePaths: {
26
+ appConfigPath: fileConfig.appConfigPath,
27
+ schemaPath: fileConfig.schemaPath,
28
+ codeGenPath: fileConfig.codeGenPath,
29
+ },
30
+ logger: getCliLogger(),
31
+ actionsParams: {
32
+ dataSourceName,
33
+ },
34
+ };
35
+ const result = await refreshDataSourceActionsAsync(config);
36
+ for (const dsName of result.succeeded) {
37
+ console.log(`'${dsName}' refreshed successfully.`);
38
+ }
39
+ for (const failure of result.failed) {
40
+ console.error(`Failed to refresh '${failure.dataSourceName}': ${failure.error}`);
41
+ }
42
+ if (result.succeeded.length > 0 && result.failed.length === 0) {
43
+ console.log(`Hint: Run 'npx ${CLI_BINARY_NAME} run' to test locally, or 'npx ${CLI_BINARY_NAME} push' to deploy.`);
44
+ }
45
+ }
46
+ function createOptionSchema(argumentProvider) {
47
+ argumentProvider.setDescription(HelpStrings.app.refresh.description);
48
+ argumentProvider.addExamples(HelpStrings.app.refresh.examples);
49
+ argumentProvider.addOptions([
50
+ {
51
+ flags: {
52
+ key: RefreshDataSourceArguments.DataSourceName.name,
53
+ alias: RefreshDataSourceArguments.DataSourceName.alias,
54
+ },
55
+ env: RefreshDataSourceArguments.DataSourceName.envVar,
56
+ description: HelpStrings.app.refresh.options.dataSourceName,
57
+ optionalInNonInteractive: true,
58
+ customPrompt: async () => {
59
+ const hasSpecificDs = await promptConfirm({
60
+ message: 'Do you want to refresh a specific data source? (No to refresh all)',
61
+ });
62
+ if (hasSpecificDs) {
63
+ return await promptText({
64
+ message: RefreshDataSourceArguments.DataSourceName.promptMessage,
65
+ });
66
+ }
67
+ return '';
68
+ },
69
+ },
70
+ ]);
71
+ }
72
+ //# sourceMappingURL=RefreshDataSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefreshDataSource.js","sourceRoot":"","sources":["../../src/Verbs/RefreshDataSource.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,sBAAsB,EACtB,sBAAsB,IAAI,6BAA6B,GACxD,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,gBAAkC;IAC7E,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC;IACvC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IACrC,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;IAEjC,MAAM,mBAAmB,GAAG,sBAAsB,EAAE,CAAC;IACrD,MAAM,sBAAsB,GAAG,gBAAgB,CAAC,yBAAyB,EAAE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W,CAAC,CAAC;IACrE,gBAAgB,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/D,gBAAgB,CAAC,UAAU,CAAC;QAC1B;YACE,KAAK,EAAE;gBACL,GAAG,EAAE,0BAA0B,CAAC,cAAc,CAAC,IAAI;gBACnD,KAAK,EAAE,0BAA0B,CAAC,cAAc,CAAC,KAAK;aACvD;YACD,GAAG,EAAE,0BAA0B,CAAC,cAAc,CAAC,MAAM;YACrD,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc;YAC3D,wBAAwB,EAAE,IAAI;YAC9B,YAAY,EAAE,KAAK,IAAI,EAAE;gBACvB,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC;oBACxC,OAAO,EAAE,oEAAoE;iBAC9E,CAAC,CAAC;gBACH,IAAI,aAAa,EAAE,CAAC;oBAClB,OAAO,MAAM,UAAU,CAAC;wBACtB,OAAO,EAAE,0BAA0B,CAAC,cAAc,CAAC,aAAa;qBACjE,CAAC,CAAC;gBACL,CAAC;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { ArgumentProvider } from '../ArgumentProvider.js';
5
+ /**
6
+ * Remove a cloud flow from the current app.
7
+ *
8
+ * @param {ArgumentProvider} argumentProvider
9
+ * @returns {Promise<void>}
10
+ */
11
+ export declare function removeFlowAsync(argumentProvider: ArgumentProvider): Promise<void>;
12
+ //# sourceMappingURL=RemoveFlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RemoveFlow.d.ts","sourceRoot":"","sources":["../../src/Verbs/RemoveFlow.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAO5D;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CvF"}