@pnp/cli-microsoft365 6.3.0-beta.64eb7da → 6.3.0-beta.80fcd21

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 (192) hide show
  1. package/.eslintrc.js +4 -0
  2. package/dist/Command.js +4 -4
  3. package/dist/appInsights.js +2 -1
  4. package/dist/cli/Cli.js +58 -1
  5. package/dist/m365/aad/commands/license/license-list.js +41 -0
  6. package/dist/m365/aad/commands/user/user-add.js +223 -0
  7. package/dist/m365/aad/commands/user/user-license-add.js +88 -0
  8. package/dist/m365/aad/commands/user/user-license-list.js +99 -0
  9. package/dist/m365/aad/commands/user/user-license-remove.js +114 -0
  10. package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +103 -0
  11. package/dist/m365/aad/commands/user/user-recyclebinitem-list.js +41 -0
  12. package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +92 -0
  13. package/dist/m365/aad/commands/user/user-recyclebinitem-restore.js +77 -0
  14. package/dist/m365/aad/commands/user/user-remove.js +107 -0
  15. package/dist/m365/aad/commands.js +10 -0
  16. package/dist/m365/context/commands/option/option-list.js +54 -0
  17. package/dist/m365/context/commands.js +1 -0
  18. package/dist/m365/flow/commands/environment/FlowEnvironmentDetails.js +3 -0
  19. package/dist/m365/flow/commands/environment/environment-get.js +26 -11
  20. package/dist/m365/pa/commands/environment/environment-get.js +13 -5
  21. package/dist/m365/planner/commands/plan/plan-get.js +17 -10
  22. package/dist/m365/planner/commands/plan/plan-set.js +21 -10
  23. package/dist/m365/planner/commands/roster/roster-get.js +61 -0
  24. package/dist/m365/planner/commands/roster/roster-member-add.js +113 -0
  25. package/dist/m365/planner/commands/roster/roster-member-list.js +54 -0
  26. package/dist/m365/planner/commands/roster/roster-member-remove.js +140 -0
  27. package/dist/m365/planner/commands/task/task-add.js +3 -0
  28. package/dist/m365/planner/commands.js +4 -0
  29. package/dist/m365/pp/commands/environment/environment-get.js +18 -9
  30. package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +75 -0
  31. package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +46 -0
  32. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +97 -0
  33. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +77 -0
  34. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +13 -8
  35. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +43 -0
  36. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +97 -0
  37. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +90 -0
  38. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +5 -0
  39. package/dist/m365/purview/commands/retentionlabel/retentionlabel-get.js +5 -0
  40. package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +5 -0
  41. package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +5 -0
  42. package/dist/m365/purview/commands/retentionlabel/retentionlabel-set.js +11 -1
  43. package/dist/m365/purview/commands.js +8 -1
  44. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-add.js +95 -0
  45. package/dist/m365/spo/commands/customaction/customaction-get.js +17 -66
  46. package/dist/m365/spo/commands/customaction/customaction-list.js +2 -36
  47. package/dist/m365/spo/commands/customaction/customaction-remove.js +11 -18
  48. package/dist/m365/spo/commands/file/GraphFileDetails.js +0 -1
  49. package/dist/m365/spo/commands/file/file-move.js +0 -2
  50. package/dist/m365/spo/commands/file/file-sharinglink-add.js +2 -22
  51. package/dist/m365/spo/commands/file/file-sharinglink-clear.js +137 -0
  52. package/dist/m365/spo/commands/file/file-sharinglink-get.js +2 -25
  53. package/dist/m365/spo/commands/file/file-sharinglink-list.js +7 -28
  54. package/dist/m365/spo/commands/file/file-sharinglink-remove.js +2 -25
  55. package/dist/m365/spo/commands/file/file-sharinglink-set.js +104 -0
  56. package/dist/m365/spo/commands/folder/folder-copy.js +0 -2
  57. package/dist/m365/spo/commands/folder/folder-move.js +0 -2
  58. package/dist/m365/spo/commands/listitem/listitem-add.js +2 -1
  59. package/dist/m365/spo/commands/navigation/navigation-node-get.js +73 -0
  60. package/dist/m365/spo/commands/site/site-add.js +0 -3
  61. package/dist/m365/spo/commands/site/site-remove.js +0 -3
  62. package/dist/m365/spo/commands/site/site-set.js +0 -2
  63. package/dist/m365/spo/commands/sitedesign/sitedesign-add.js +6 -0
  64. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +179 -0
  65. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +0 -1
  66. package/dist/m365/spo/commands.js +5 -0
  67. package/dist/m365/teams/commands/team/team-add.js +3 -8
  68. package/dist/utils/aadUser.js +38 -0
  69. package/dist/utils/planner.js +1 -4
  70. package/dist/utils/session.js +18 -0
  71. package/dist/utils/spo.js +92 -12
  72. package/docs/docs/cmd/aad/license/license-list.md +87 -0
  73. package/docs/docs/cmd/aad/user/user-add.md +168 -0
  74. package/docs/docs/cmd/aad/user/user-license-add.md +108 -0
  75. package/docs/docs/cmd/aad/user/user-license-list.md +98 -0
  76. package/docs/docs/cmd/aad/user/user-license-remove.md +43 -0
  77. package/docs/docs/cmd/aad/user/user-recyclebinitem-clear.md +42 -0
  78. package/docs/docs/cmd/aad/user/user-recyclebinitem-list.md +82 -0
  79. package/docs/docs/cmd/aad/user/user-recyclebinitem-remove.md +45 -0
  80. package/docs/docs/cmd/aad/user/user-recyclebinitem-restore.md +99 -0
  81. package/docs/docs/cmd/aad/user/user-remove.md +51 -0
  82. package/docs/docs/cmd/aad/user/user-set.md +1 -1
  83. package/docs/docs/cmd/context/option/option-list.md +63 -0
  84. package/docs/docs/cmd/flow/environment/environment-get.md +31 -3
  85. package/docs/docs/cmd/login.md +26 -0
  86. package/docs/docs/cmd/logout.md +4 -0
  87. package/docs/docs/cmd/pa/app/app-get.md +24 -0
  88. package/docs/docs/cmd/pa/app/app-list.md +21 -0
  89. package/docs/docs/cmd/pa/connector/connector-list.md +17 -0
  90. package/docs/docs/cmd/pa/environment/environment-get.md +26 -2
  91. package/docs/docs/cmd/pa/environment/environment-list.md +19 -0
  92. package/docs/docs/cmd/planner/plan/plan-get.md +12 -12
  93. package/docs/docs/cmd/planner/plan/plan-set.md +10 -4
  94. package/docs/docs/cmd/planner/roster/roster-get.md +73 -0
  95. package/docs/docs/cmd/planner/roster/roster-member-add.md +87 -0
  96. package/docs/docs/cmd/planner/roster/roster-member-list.md +76 -0
  97. package/docs/docs/cmd/planner/roster/roster-member-remove.md +51 -0
  98. package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-get.md +43 -0
  99. package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-list.md +43 -0
  100. package/docs/docs/cmd/pp/card/card-clone.md +12 -0
  101. package/docs/docs/cmd/pp/card/card-get.md +49 -0
  102. package/docs/docs/cmd/pp/card/card-list.md +49 -0
  103. package/docs/docs/cmd/pp/chatbot/chatbot-get.md +55 -0
  104. package/docs/docs/cmd/pp/chatbot/chatbot-list.md +36 -0
  105. package/docs/docs/cmd/pp/dataverse/dataverse-table-get.md +30 -0
  106. package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +30 -0
  107. package/docs/docs/cmd/pp/dataverse/dataverse-table-row-list.md +30 -0
  108. package/docs/docs/cmd/pp/environment/environment-get.md +19 -0
  109. package/docs/docs/cmd/pp/environment/environment-list.md +19 -0
  110. package/docs/docs/cmd/pp/gateway/gateway-get.md +19 -0
  111. package/docs/docs/cmd/pp/gateway/gateway-list.md +19 -0
  112. package/docs/docs/cmd/pp/managementapp/managementapp-add.md +12 -0
  113. package/docs/docs/cmd/pp/managementapp/managementapp-list.md +12 -0
  114. package/docs/docs/cmd/pp/solution/solution-get.md +14 -0
  115. package/docs/docs/cmd/pp/solution/solution-list.md +14 -0
  116. package/docs/docs/cmd/pp/solution/solution-publisher-get.md +20 -1
  117. package/docs/docs/cmd/pp/solution/solution-publisher-list.md +18 -0
  118. package/docs/docs/cmd/pp/tenant/tenant-settings-list.md +21 -0
  119. package/docs/docs/cmd/purview/retentionevent/retentionevent-get.md +132 -0
  120. package/docs/docs/cmd/purview/retentionevent/retentionevent-list.md +107 -0
  121. package/docs/docs/cmd/purview/retentionevent/retentionevent-remove.md +45 -0
  122. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +106 -0
  123. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.md +3 -0
  124. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.md +97 -0
  125. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.md +43 -0
  126. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.md +43 -0
  127. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +3 -0
  128. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-get.md +3 -0
  129. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.md +3 -0
  130. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-remove.md +3 -0
  131. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-set.md +3 -0
  132. package/docs/docs/cmd/request.md +74 -0
  133. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.md +56 -0
  134. package/docs/docs/cmd/spo/file/file-sharinglink-clear.md +46 -0
  135. package/docs/docs/cmd/spo/file/file-sharinglink-list.md +1 -1
  136. package/docs/docs/cmd/spo/file/file-sharinglink-set.md +104 -0
  137. package/docs/docs/cmd/spo/homesite/homesite-get.md +20 -1
  138. package/docs/docs/cmd/spo/homesite/homesite-remove.md +8 -2
  139. package/docs/docs/cmd/spo/homesite/homesite-set.md +8 -2
  140. package/docs/docs/cmd/spo/hubsite/hubsite-connect.md +9 -9
  141. package/docs/docs/cmd/spo/hubsite/hubsite-data-get.md +34 -5
  142. package/docs/docs/cmd/spo/hubsite/hubsite-disconnect.md +6 -6
  143. package/docs/docs/cmd/spo/hubsite/hubsite-get.md +36 -19
  144. package/docs/docs/cmd/spo/hubsite/hubsite-list.md +59 -1
  145. package/docs/docs/cmd/spo/hubsite/hubsite-register.md +30 -1
  146. package/docs/docs/cmd/spo/hubsite/hubsite-rights-grant.md +6 -6
  147. package/docs/docs/cmd/spo/hubsite/hubsite-rights-revoke.md +4 -4
  148. package/docs/docs/cmd/spo/hubsite/hubsite-set.md +40 -15
  149. package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +4 -4
  150. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-get.md +7 -1
  151. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-remove.md +9 -3
  152. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-set.md +8 -2
  153. package/docs/docs/cmd/spo/list/list-add.md +123 -57
  154. package/docs/docs/cmd/spo/list/list-contenttype-add.md +50 -5
  155. package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +4 -4
  156. package/docs/docs/cmd/spo/list/list-contenttype-list.md +49 -4
  157. package/docs/docs/cmd/spo/list/list-contenttype-remove.md +6 -6
  158. package/docs/docs/cmd/spo/list/list-get.md +70 -4
  159. package/docs/docs/cmd/spo/list/list-list.md +70 -2
  160. package/docs/docs/cmd/spo/list/list-remove.md +6 -6
  161. package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.md +2 -2
  162. package/docs/docs/cmd/spo/list/list-retentionlabel-get.md +36 -3
  163. package/docs/docs/cmd/spo/list/list-retentionlabel-remove.md +3 -3
  164. package/docs/docs/cmd/spo/list/list-roleassignment-add.md +6 -6
  165. package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +3 -3
  166. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +9 -9
  167. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +7 -7
  168. package/docs/docs/cmd/spo/list/list-set.md +61 -61
  169. package/docs/docs/cmd/spo/list/list-sitescript-get.md +35 -3
  170. package/docs/docs/cmd/spo/list/list-view-add.md +66 -5
  171. package/docs/docs/cmd/spo/list/list-view-field-add.md +10 -10
  172. package/docs/docs/cmd/spo/list/list-view-get.md +61 -0
  173. package/docs/docs/cmd/spo/list/list-view-list.md +61 -0
  174. package/docs/docs/cmd/spo/list/list-view-set.md +1 -1
  175. package/docs/docs/cmd/spo/list/list-webhook-add.md +19 -0
  176. package/docs/docs/cmd/spo/list/list-webhook-get.md +19 -0
  177. package/docs/docs/cmd/spo/list/list-webhook-list.md +19 -0
  178. package/docs/docs/cmd/spo/listitem/listitem-add.md +29 -0
  179. package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +17 -2
  180. package/docs/docs/cmd/spo/listitem/listitem-get.md +57 -0
  181. package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +6 -0
  182. package/docs/docs/cmd/spo/listitem/listitem-list.md +28 -0
  183. package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +15 -0
  184. package/docs/docs/cmd/spo/listitem/listitem-set.md +30 -0
  185. package/docs/docs/cmd/spo/navigation/navigation-node-add.md +22 -0
  186. package/docs/docs/cmd/spo/navigation/navigation-node-get.md +91 -0
  187. package/docs/docs/cmd/spo/sitedesign/sitedesign-add.md +3 -0
  188. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +59 -0
  189. package/docs/docs/cmd/status.md +46 -0
  190. package/docs/docs/cmd/version.md +26 -0
  191. package/npm-shrinkwrap.json +912 -876
  192. package/package.json +13 -12
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _SpoTenantApplicationCustomizerAddCommand_instances, _SpoTenantApplicationCustomizerAddCommand_initTelemetry, _SpoTenantApplicationCustomizerAddCommand_initOptions, _SpoTenantApplicationCustomizerAddCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const validation_1 = require("../../../../utils/validation");
19
+ const SpoCommand_1 = require("../../../base/SpoCommand");
20
+ const commands_1 = require("../../commands");
21
+ const Cli_1 = require("../../../../cli/Cli");
22
+ const spoTenantAppCatalogUrlGetCommand = require("../tenant/tenant-appcatalogurl-get");
23
+ const spoListItemAddCommand = require("../listitem/listitem-add");
24
+ const spoListItemListCommand = require("../listitem/listitem-list");
25
+ const urlUtil_1 = require("../../../../utils/urlUtil");
26
+ class SpoTenantApplicationCustomizerAddCommand extends SpoCommand_1.default {
27
+ get name() {
28
+ return commands_1.default.TENANT_APPLICATIONCUSTOMIZER_ADD;
29
+ }
30
+ get description() {
31
+ return 'Add an application customizer as a tenant wide extension.';
32
+ }
33
+ constructor() {
34
+ super();
35
+ _SpoTenantApplicationCustomizerAddCommand_instances.add(this);
36
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerAddCommand_instances, "m", _SpoTenantApplicationCustomizerAddCommand_initTelemetry).call(this);
37
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerAddCommand_instances, "m", _SpoTenantApplicationCustomizerAddCommand_initOptions).call(this);
38
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerAddCommand_instances, "m", _SpoTenantApplicationCustomizerAddCommand_initValidators).call(this);
39
+ }
40
+ commandAction(logger, args) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ try {
43
+ const appCatalogUrl = yield this.getAppCatalogUrl(logger);
44
+ const componentManifest = yield this.getComponentManifest(appCatalogUrl, args.options.clientSideComponentId, logger);
45
+ const clientComponentManifest = JSON.parse(componentManifest.ClientComponentManifest);
46
+ if (clientComponentManifest.extensionType !== "ApplicationCustomizer") {
47
+ throw `The extension type of this component is not of type 'ApplicationCustomizer' but of type '${clientComponentManifest.extensionType}'`;
48
+ }
49
+ const solution = yield this.getSolutionFromAppCatalog(appCatalogUrl, componentManifest.SolutionId, logger);
50
+ if (!solution.ContainsTenantWideExtension) {
51
+ throw `The solution does not contain an extension that can be deployed to all sites. Make sure that you've entered the correct component Id.`;
52
+ }
53
+ else if (!solution.SkipFeatureDeployment) {
54
+ throw 'The solution has not been deployed to all sites. Make sure to deploy this solution to all sites.';
55
+ }
56
+ yield this.addTenantWideExtension(appCatalogUrl, args.options, logger);
57
+ }
58
+ catch (err) {
59
+ this.handleRejectedODataJsonPromise(err);
60
+ }
61
+ });
62
+ }
63
+ getAppCatalogUrl(logger) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ const spoTenantAppCatalogUrlGetCommandOutput = yield Cli_1.Cli.executeCommandWithOutput(spoTenantAppCatalogUrlGetCommand, { options: { output: 'text', _: [] } });
66
+ if (this.verbose) {
67
+ logger.logToStderr(spoTenantAppCatalogUrlGetCommandOutput.stderr);
68
+ }
69
+ const appCatalogUrl = spoTenantAppCatalogUrlGetCommandOutput.stdout;
70
+ if (!appCatalogUrl) {
71
+ throw 'Cannot add tenant-wide application customizer as app catalog cannot be found';
72
+ }
73
+ if (this.verbose) {
74
+ logger.logToStderr(`Got tenant app catalog url: ${appCatalogUrl}`);
75
+ }
76
+ return appCatalogUrl;
77
+ });
78
+ }
79
+ getComponentManifest(appCatalogUrl, clientSideComponentId, logger) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ if (this.verbose) {
82
+ logger.logToStderr('Retrieving component manifest item from the ComponentManifests list on the app catalog site so that we get the solution id');
83
+ }
84
+ const camlQuery = `<View><ViewFields><FieldRef Name='ClientComponentId'></FieldRef><FieldRef Name='SolutionId'></FieldRef><FieldRef Name='ClientComponentManifest'></FieldRef></ViewFields><Query><Where><Eq><FieldRef Name='ClientComponentId' /><Value Type='Guid'>${clientSideComponentId}</Value></Eq></Where></Query></View>`;
85
+ const commandOptions = {
86
+ webUrl: appCatalogUrl,
87
+ listUrl: `${urlUtil_1.urlUtil.getServerRelativeSiteUrl(appCatalogUrl)}/Lists/ComponentManifests`,
88
+ camlQuery: camlQuery,
89
+ verbose: this.verbose,
90
+ debug: this.debug,
91
+ output: 'json'
92
+ };
93
+ const output = yield Cli_1.Cli.executeCommandWithOutput(spoListItemListCommand, { options: Object.assign(Object.assign({}, commandOptions), { _: [] }) });
94
+ if (this.verbose) {
95
+ logger.logToStderr(output.stderr);
96
+ }
97
+ const outputParsed = JSON.parse(output.stdout);
98
+ if (outputParsed.length === 0) {
99
+ throw 'No component found with the specified clientSideComponentId found in the component manifest list. Make sure that the application is added to the application catalog';
100
+ }
101
+ return outputParsed[0];
102
+ });
103
+ }
104
+ getSolutionFromAppCatalog(appCatalogUrl, solutionId, logger) {
105
+ return __awaiter(this, void 0, void 0, function* () {
106
+ if (this.verbose) {
107
+ logger.logToStderr(`Retrieving solution with id ${solutionId} from the application catalog`);
108
+ }
109
+ const camlQuery = `<View><ViewFields><FieldRef Name='SkipFeatureDeployment'></FieldRef><FieldRef Name='ContainsTenantWideExtension'></FieldRef></ViewFields><Query><Where><Eq><FieldRef Name='AppProductID' /><Value Type='Guid'>${solutionId}</Value></Eq></Where></Query></View>`;
110
+ const commandOptions = {
111
+ webUrl: appCatalogUrl,
112
+ listUrl: `${urlUtil_1.urlUtil.getServerRelativeSiteUrl(appCatalogUrl)}/AppCatalog`,
113
+ camlQuery: camlQuery,
114
+ verbose: this.verbose,
115
+ debug: this.debug,
116
+ output: 'json'
117
+ };
118
+ const output = yield Cli_1.Cli.executeCommandWithOutput(spoListItemListCommand, { options: Object.assign(Object.assign({}, commandOptions), { _: [] }) });
119
+ if (this.verbose) {
120
+ logger.logToStderr(output.stderr);
121
+ }
122
+ const outputParsed = JSON.parse(output.stdout);
123
+ if (outputParsed.length === 0) {
124
+ throw `No component found with the solution id ${solutionId}. Make sure that the solution is available in the app catalog`;
125
+ }
126
+ return outputParsed[0];
127
+ });
128
+ }
129
+ addTenantWideExtension(appCatalogUrl, options, logger) {
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ if (this.verbose) {
132
+ logger.logToStderr('Pre-checks finished. Adding tenant wide extension to the TenantWideExtensions list');
133
+ }
134
+ const commandOptions = {
135
+ webUrl: appCatalogUrl,
136
+ listUrl: `${urlUtil_1.urlUtil.getServerRelativeSiteUrl(appCatalogUrl)}/Lists/TenantWideExtensions`,
137
+ Title: options.title,
138
+ TenantWideExtensionComponentId: options.clientSideComponentId,
139
+ TenantWideExtensionLocation: 'ClientSideExtension.ApplicationCustomizer',
140
+ TenantWideExtensionSequence: 0,
141
+ TenantWideExtensionListTemplate: 0,
142
+ TenantWideExtensionComponentProperties: options.clientSideComponentProperties || '',
143
+ TenantWideExtensionWebTemplate: options.webTemplate || '',
144
+ TenantWideExtensionDisabled: false,
145
+ verbose: this.verbose,
146
+ debug: this.debug,
147
+ output: options.output
148
+ };
149
+ yield Cli_1.Cli.executeCommand(spoListItemAddCommand, { options: Object.assign(Object.assign({}, commandOptions), { _: [] }) });
150
+ });
151
+ }
152
+ }
153
+ _SpoTenantApplicationCustomizerAddCommand_instances = new WeakSet(), _SpoTenantApplicationCustomizerAddCommand_initTelemetry = function _SpoTenantApplicationCustomizerAddCommand_initTelemetry() {
154
+ this.telemetry.push((args) => {
155
+ Object.assign(this.telemetryProperties, {
156
+ clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
157
+ webTemplate: typeof args.options.webTemplate !== 'undefined'
158
+ });
159
+ });
160
+ }, _SpoTenantApplicationCustomizerAddCommand_initOptions = function _SpoTenantApplicationCustomizerAddCommand_initOptions() {
161
+ this.options.unshift({
162
+ option: '-t, --title <title>'
163
+ }, {
164
+ option: '-i, --clientSideComponentId <clientSideComponentId>'
165
+ }, {
166
+ option: '-p, --clientSideComponentProperties [clientSideComponentProperties]'
167
+ }, {
168
+ option: '-w, --webTemplate [webTemplate]'
169
+ });
170
+ }, _SpoTenantApplicationCustomizerAddCommand_initValidators = function _SpoTenantApplicationCustomizerAddCommand_initValidators() {
171
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
172
+ if (!validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
173
+ return `${args.options.clientSideComponentId} is not a valid GUID`;
174
+ }
175
+ return true;
176
+ }));
177
+ };
178
+ module.exports = new SpoTenantApplicationCustomizerAddCommand();
179
+ //# sourceMappingURL=tenant-applicationcustomizer-add.js.map
@@ -74,7 +74,6 @@ class SpoTenantRecycleBinItemRemoveCommand extends SpoCommand_1.default {
74
74
  reject,
75
75
  logger,
76
76
  currentContext: this.context,
77
- dots: this.dots,
78
77
  debug: this.debug,
79
78
  verbose: this.verbose
80
79
  });
@@ -13,6 +13,7 @@ exports.default = {
13
13
  APP_TEAMSPACKAGE_DOWNLOAD: `${prefix} app teamspackage download`,
14
14
  APP_UNINSTALL: `${prefix} app uninstall`,
15
15
  APP_UPGRADE: `${prefix} app upgrade`,
16
+ APPLICATIONCUSTOMIZER_ADD: `${prefix} applicationcustomizer add`,
16
17
  APPPAGE_ADD: `${prefix} apppage add`,
17
18
  APPPAGE_SET: `${prefix} apppage set`,
18
19
  CDN_GET: `${prefix} cdn get`,
@@ -65,9 +66,11 @@ exports.default = {
65
66
  FILE_ROLEINHERITANCE_RESET: `${prefix} file roleinheritance reset`,
66
67
  FILE_SHARINGINFO_GET: `${prefix} file sharinginfo get`,
67
68
  FILE_SHARINGLINK_ADD: `${prefix} file sharinglink add`,
69
+ FILE_SHARINGLINK_CLEAR: `${prefix} file sharinglink clear`,
68
70
  FILE_SHARINGLINK_GET: `${prefix} file sharinglink get`,
69
71
  FILE_SHARINGLINK_LIST: `${prefix} file sharinglink list`,
70
72
  FILE_SHARINGLINK_REMOVE: `${prefix} file sharinglink remove`,
73
+ FILE_SHARINGLINK_SET: `${prefix} file sharinglink set`,
71
74
  FILE_VERSION_CLEAR: `${prefix} file version clear`,
72
75
  FILE_VERSION_GET: `${prefix} file version get`,
73
76
  FILE_VERSION_LIST: `${prefix} file version list`,
@@ -165,6 +168,7 @@ exports.default = {
165
168
  LISTITEM_SET: `${prefix} listitem set`,
166
169
  MAIL_SEND: `${prefix} mail send`,
167
170
  NAVIGATION_NODE_ADD: `${prefix} navigation node add`,
171
+ NAVIGATION_NODE_GET: `${prefix} navigation node get`,
168
172
  NAVIGATION_NODE_LIST: `${prefix} navigation node list`,
169
173
  NAVIGATION_NODE_REMOVE: `${prefix} navigation node remove`,
170
174
  NAVIGATION_NODE_SET: `${prefix} navigation node set`,
@@ -274,6 +278,7 @@ exports.default = {
274
278
  STORAGEENTITY_REMOVE: `${prefix} storageentity remove`,
275
279
  TENANT_APPCATALOG_ADD: `${prefix} tenant appcatalog add`,
276
280
  TENANT_APPCATALOGURL_GET: `${prefix} tenant appcatalogurl get`,
281
+ TENANT_APPLICATIONCUSTOMIZER_ADD: `${prefix} tenant applicationcustomizer add`,
277
282
  TENANT_RECYCLEBINITEM_LIST: `${prefix} tenant recyclebinitem list`,
278
283
  TENANT_RECYCLEBINITEM_REMOVE: `${prefix} tenant recyclebinitem remove`,
279
284
  TENANT_RECYCLEBINITEM_RESTORE: `${prefix} tenant recyclebinitem restore`,
@@ -44,7 +44,6 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
44
44
  }
45
45
  commandAction(logger, args) {
46
46
  return __awaiter(this, void 0, void 0, function* () {
47
- this.dots = '';
48
47
  let requestBody;
49
48
  if (args.options.template) {
50
49
  if (this.verbose) {
@@ -95,7 +94,7 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
95
94
  }
96
95
  else {
97
96
  setTimeout(() => {
98
- this.waitUntilFinished(requestOptions, resolve, reject, logger, this.dots);
97
+ this.waitUntilFinished(requestOptions, resolve, reject, logger);
99
98
  }, this.pollingInterval);
100
99
  }
101
100
  }));
@@ -113,11 +112,7 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
113
112
  }
114
113
  });
115
114
  }
116
- waitUntilFinished(requestOptions, resolve, reject, logger, dots) {
117
- if (!this.debug && this.verbose) {
118
- dots += '.';
119
- process.stdout.write(`\r${dots}`);
120
- }
115
+ waitUntilFinished(requestOptions, resolve, reject, logger) {
121
116
  request_1.default
122
117
  .get(requestOptions)
123
118
  .then((teamsAsyncOperation) => {
@@ -133,7 +128,7 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
133
128
  return;
134
129
  }
135
130
  setTimeout(() => {
136
- this.waitUntilFinished(requestOptions, resolve, reject, logger, dots);
131
+ this.waitUntilFinished(requestOptions, resolve, reject, logger);
137
132
  }, this.pollingInterval);
138
133
  }).catch(err => reject(err));
139
134
  }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.aadUser = void 0;
13
+ const request_1 = require("../request");
14
+ const formatting_1 = require("./formatting");
15
+ const graphResource = 'https://graph.microsoft.com';
16
+ exports.aadUser = {
17
+ /**
18
+ * Retrieve the id of a user by its UPN.
19
+ * @param upn User UPN.
20
+ */
21
+ getUserIdByUpn(upn) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const requestOptions = {
24
+ url: `${graphResource}/v1.0/users?$filter=userPrincipalName eq '${formatting_1.formatting.encodeQueryParameter(upn)}'&$select=Id`,
25
+ headers: {
26
+ accept: 'application/json;odata.metadata=none'
27
+ },
28
+ responseType: 'json'
29
+ };
30
+ const res = yield request_1.default.get(requestOptions);
31
+ if (res.value.length === 0) {
32
+ throw Error(`The specified user with user name ${upn} does not exist.`);
33
+ }
34
+ return res.value[0].id;
35
+ });
36
+ }
37
+ };
38
+ //# sourceMappingURL=aadUser.js.map
@@ -57,15 +57,12 @@ exports.planner = {
57
57
  * @param groupId Owner group ID.
58
58
  * @param rosterId Roster ID.
59
59
  */
60
- getPlanByTitle(title, groupId, rosterId, metadata = 'none') {
60
+ getPlanByTitle(title, groupId, metadata = 'none') {
61
61
  return __awaiter(this, void 0, void 0, function* () {
62
62
  let plans = [];
63
63
  if (groupId) {
64
64
  plans = yield this.getPlansByGroupId(groupId, metadata);
65
65
  }
66
- else if (rosterId) {
67
- plans = yield this.getPlansByRosterId(rosterId, metadata);
68
- }
69
66
  const filteredPlans = plans.filter(p => p.title && p.title.toLowerCase() === title.toLowerCase());
70
67
  if (!filteredPlans.length) {
71
68
  throw Error(`The specified plan '${title}' does not exist.`);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.session = void 0;
4
+ const crypto = require("crypto");
5
+ const cache_1 = require("./cache");
6
+ exports.session = {
7
+ getId(pid) {
8
+ const key = `${pid.toString()}_session`;
9
+ let sessionId = cache_1.cache.getValue(key);
10
+ if (sessionId) {
11
+ return sessionId;
12
+ }
13
+ sessionId = crypto.randomBytes(24).toString('base64');
14
+ cache_1.cache.setValue(key, sessionId);
15
+ return sessionId;
16
+ }
17
+ };
18
+ //# sourceMappingURL=session.js.map
package/dist/utils/spo.js CHANGED
@@ -18,6 +18,7 @@ const config_1 = require("../config");
18
18
  const base_permissions_1 = require("../m365/spo/base-permissions");
19
19
  const request_1 = require("../request");
20
20
  const formatting_1 = require("./formatting");
21
+ const odata_1 = require("./odata");
21
22
  exports.spo = {
22
23
  getRequestDigest(siteUrl) {
23
24
  const requestOptions = {
@@ -55,7 +56,7 @@ exports.spo = {
55
56
  });
56
57
  });
57
58
  },
58
- waitUntilFinished({ operationId, siteUrl, resolve, reject, logger, currentContext, dots, debug, verbose }) {
59
+ waitUntilFinished({ operationId, siteUrl, resolve, reject, logger, currentContext, debug, verbose }) {
59
60
  exports.spo
60
61
  .ensureFormDigest(siteUrl, logger, currentContext, debug)
61
62
  .then((res) => {
@@ -63,10 +64,6 @@ exports.spo = {
63
64
  if (debug) {
64
65
  logger.logToStderr(`Checking if operation ${operationId} completed...`);
65
66
  }
66
- if (!debug && verbose) {
67
- dots += '.';
68
- process.stdout.write(`\r${dots}`);
69
- }
70
67
  const requestOptions = {
71
68
  url: `${siteUrl}/_vti_bin/client.svc/ProcessQuery`,
72
69
  headers: {
@@ -100,7 +97,6 @@ exports.spo = {
100
97
  reject,
101
98
  logger,
102
99
  currentContext,
103
- dots,
104
100
  debug,
105
101
  verbose
106
102
  });
@@ -108,7 +104,7 @@ exports.spo = {
108
104
  }
109
105
  });
110
106
  },
111
- waitUntilCopyJobFinished({ copyJobInfo, siteUrl, pollingInterval, resolve, reject, logger, dots, debug, verbose }) {
107
+ waitUntilCopyJobFinished({ copyJobInfo, siteUrl, pollingInterval, resolve, reject, logger, debug, verbose }) {
112
108
  const requestUrl = `${siteUrl}/_api/site/GetCopyJobProgress`;
113
109
  const requestOptions = {
114
110
  url: requestUrl,
@@ -118,10 +114,6 @@ exports.spo = {
118
114
  data: { "copyJobInfo": copyJobInfo },
119
115
  responseType: 'json'
120
116
  };
121
- if (!debug && verbose) {
122
- dots += '.';
123
- process.stdout.write(`\r${dots}`);
124
- }
125
117
  request_1.default
126
118
  .post(requestOptions)
127
119
  .then((resp) => {
@@ -148,7 +140,7 @@ exports.spo = {
148
140
  }
149
141
  else {
150
142
  setTimeout(() => {
151
- exports.spo.waitUntilCopyJobFinished({ copyJobInfo, siteUrl, pollingInterval, resolve, reject, logger, dots, debug, verbose });
143
+ exports.spo.waitUntilCopyJobFinished({ copyJobInfo, siteUrl, pollingInterval, resolve, reject, logger, debug, verbose });
152
144
  }, pollingInterval);
153
145
  }
154
146
  });
@@ -456,6 +448,94 @@ exports.spo = {
456
448
  reject('Cannot proceed. Folder _ObjectIdentity_ not found'); // this is not suppose to happen
457
449
  }, (err) => { reject(err); });
458
450
  });
451
+ },
452
+ /**
453
+ * Retrieves the SiteId, VroomItemId and VroomDriveId from a specific file.
454
+ * @param webUrl Web url
455
+ * @param fileId GUID ID of the file
456
+ * @param fileUrl Decoded URL of the file
457
+ */
458
+ getVroomFileDetails(webUrl, fileId, fileUrl) {
459
+ return __awaiter(this, void 0, void 0, function* () {
460
+ let requestUrl = `${webUrl}/_api/web/`;
461
+ if (fileUrl) {
462
+ const fileServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(webUrl, fileUrl);
463
+ requestUrl += `GetFileByServerRelativePath(decodedUrl='${formatting_1.formatting.encodeQueryParameter(fileServerRelativeUrl)}')`;
464
+ }
465
+ else {
466
+ requestUrl += `GetFileById('${fileId}')`;
467
+ }
468
+ requestUrl += '?$select=SiteId,VroomItemId,VroomDriveId';
469
+ const requestOptions = {
470
+ url: requestUrl,
471
+ headers: {
472
+ accept: 'application/json;odata=nometadata'
473
+ },
474
+ responseType: 'json'
475
+ };
476
+ const res = yield request_1.default.get(requestOptions);
477
+ return res;
478
+ });
479
+ },
480
+ /**
481
+ * Retrieves a list of Custom Actions from a SharePoint site.
482
+ * @param webUrl Web url
483
+ * @param scope The scope of custom actions to retrieve, allowed values "Site", "Web" or "All".
484
+ * @param filter An OData filter query to limit the results.
485
+ */
486
+ getCustomActions(webUrl, scope, filter) {
487
+ return __awaiter(this, void 0, void 0, function* () {
488
+ if (scope && scope !== "All" && scope !== "Site" && scope !== "Web") {
489
+ throw `Invalid scope '${scope}'. Allowed values are 'Site', 'Web' or 'All'.`;
490
+ }
491
+ const queryString = filter ? `?$filter=${filter}` : "";
492
+ if (scope && scope !== "All") {
493
+ return yield odata_1.odata.getAllItems(`${webUrl}/_api/${scope}/UserCustomActions${queryString}`);
494
+ }
495
+ const customActions = [
496
+ ...yield odata_1.odata.getAllItems(`${webUrl}/_api/Site/UserCustomActions${queryString}`),
497
+ ...yield odata_1.odata.getAllItems(`${webUrl}/_api/Web/UserCustomActions${queryString}`)
498
+ ];
499
+ return customActions;
500
+ });
501
+ },
502
+ /**
503
+ * Retrieves a Custom Actions from a SharePoint site by Id.
504
+ * @param webUrl Web url
505
+ * @param id The Id of the Custom Action
506
+ * @param scope The scope of custom actions to retrieve, allowed values "Site", "Web" or "All".
507
+ */
508
+ getCustomActionById(webUrl, id, scope) {
509
+ return __awaiter(this, void 0, void 0, function* () {
510
+ if (scope && scope !== "All" && scope !== "Site" && scope !== "Web") {
511
+ throw `Invalid scope '${scope}'. Allowed values are 'Site', 'Web' or 'All'.`;
512
+ }
513
+ function getById(webUrl, id, scope) {
514
+ return __awaiter(this, void 0, void 0, function* () {
515
+ const requestOptions = {
516
+ url: `${webUrl}/_api/${scope}/UserCustomActions(guid'${id}')`,
517
+ headers: {
518
+ accept: 'application/json;odata=nometadata'
519
+ },
520
+ responseType: 'json'
521
+ };
522
+ const result = yield request_1.default.get(requestOptions);
523
+ if (result["odata.null"] === true) {
524
+ return undefined;
525
+ }
526
+ return result;
527
+ });
528
+ }
529
+ if (scope && scope !== "All") {
530
+ return yield getById(webUrl, id, scope);
531
+ }
532
+ const customActionOnWeb = yield getById(webUrl, id, "Web");
533
+ if (customActionOnWeb) {
534
+ return customActionOnWeb;
535
+ }
536
+ const customActionOnSite = yield getById(webUrl, id, "Site");
537
+ return customActionOnSite;
538
+ });
459
539
  }
460
540
  };
461
541
  //# sourceMappingURL=spo.js.map
@@ -0,0 +1,87 @@
1
+ # aad license list
2
+
3
+ Lists commercial subscriptions that an organization has acquired
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 aad license list [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ --8<-- "docs/cmd/_global.md"
14
+
15
+ ## Examples
16
+
17
+ List all licenses within the tenant
18
+
19
+ ```sh
20
+ m365 aad license list
21
+ ```
22
+
23
+ ## Response
24
+
25
+ === "JSON"
26
+
27
+ ```json
28
+ [
29
+ {
30
+ "capabilityStatus": "Enabled",
31
+ "consumedUnits": 1,
32
+ "id": "48a80680-7326-48cd-9935-b556b81d3a4e_c7df2760-2c81-4ef7-b578-5b5392b571df",
33
+ "skuId": "c7df2760-2c81-4ef7-b578-5b5392b571df",
34
+ "skuPartNumber": "ENTERPRISEPREMIUM",
35
+ "appliesTo": "User",
36
+ "prepaidUnits": {
37
+ "enabled": 10000,
38
+ "suspended": 0,
39
+ "warning": 0
40
+ },
41
+ "servicePlans": [
42
+ {
43
+ "servicePlanId": "8c098270-9dd4-4350-9b30-ba4703f3b36b",
44
+ "servicePlanName": "ADALLOM_S_O365",
45
+ "provisioningStatus": "Success",
46
+ "appliesTo": "User"
47
+ }
48
+ ]
49
+ }
50
+ ]
51
+ ```
52
+
53
+ === "Text"
54
+
55
+ ```text
56
+ id skuId skuPartNumber
57
+ ------------------------------------------------------------------------- ------------------------------------ ----------------------
58
+ 48a80680-7326-48cd-9935-b556b81d3a4e_c7df2760-2c81-4ef7-b578-5b5392b571df c7df2760-2c81-4ef7-b578-5b5392b571df ENTERPRISEPREMIUM
59
+ ```
60
+
61
+ === "CSV"
62
+
63
+ ```csv
64
+ id,skuId,skuPartNumber
65
+ 48a80680-7326-48cd-9935-b556b81d3a4e_c7df2760-2c81-4ef7-b578-5b5392b571df,c7df2760-2c81-4ef7-b578-5b5392b571df,ENTERPRISEPREMIUM
66
+ ```
67
+
68
+ === "Markdown"
69
+
70
+ ```md
71
+ # aad license list
72
+
73
+ Date: 14/2/2023
74
+
75
+ ## 48a80680-7326-48cd-9935-b556b81d3a4e_c7df2760-2c81-4ef7-b578-5b5392b571df
76
+
77
+ Property | Value
78
+ ---------|-------
79
+ capabilityStatus | Enabled
80
+ consumedUnits | 1
81
+ id | 48a80680-7326-48cd-9935-b556b81d3a4e_c7df2760-2c81-4ef7-b578-5b5392b571df
82
+ skuId | c7df2760-2c81-4ef7-b578-5b5392b571df
83
+ skuPartNumber | ENTERPRISEPREMIUM
84
+ appliesTo | User
85
+ prepaidUnits | {"enabled":10000,"suspended":0,"warning":0}
86
+ servicePlans | [{"servicePlanId":"8c098270-9dd4-4350-9b30-ba4703f3b36b","servicePlanName": "ADALLOM_S_O365","provisioningStatus": "Success","appliesTo": "User"}]
87
+ ```