@pnp/cli-microsoft365 5.9.0-beta.1672f8f → 5.9.0-beta.1713b46

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 (74) hide show
  1. package/.eslintrc.js +15 -2
  2. package/README.md +5 -0
  3. package/dist/m365/aad/commands/app/app-add.js +37 -13
  4. package/dist/m365/outlook/commands/mail/mail-send.js +1 -1
  5. package/dist/m365/planner/commands/bucket/bucket-get.js +1 -1
  6. package/dist/m365/pp/commands/Environment.js +3 -0
  7. package/dist/m365/pp/commands/card/card-list.js +68 -0
  8. package/dist/m365/pp/commands/dataverse/dataverse-table-list.js +6 -12
  9. package/dist/m365/pp/commands/environment/environment-get.js +75 -0
  10. package/dist/m365/pp/commands/solution/Solution.js +3 -0
  11. package/dist/m365/pp/commands/solution/solution-list.js +87 -0
  12. package/dist/m365/pp/commands.js +3 -0
  13. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0.js +0 -2
  14. package/dist/m365/spfx/commands/spfx-doctor.js +37 -7
  15. package/dist/m365/spo/commands/eventreceiver/EventReceiver.js +3 -0
  16. package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +182 -0
  17. package/dist/m365/spo/commands/file/file-copy.js +25 -39
  18. package/dist/m365/spo/commands/file/file-move.js +24 -37
  19. package/dist/m365/spo/commands/file/file-rename.js +19 -16
  20. package/dist/m365/spo/commands/file/file-roleassignment-add.js +231 -0
  21. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +129 -0
  22. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
  23. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +168 -0
  24. package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +94 -0
  25. package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +1 -1
  26. package/dist/m365/spo/commands/group/AssociatedGroupPropertiesCollection.js +3 -0
  27. package/dist/m365/spo/commands/group/group-list.js +49 -10
  28. package/dist/m365/spo/commands/list/list-contenttype-add.js +21 -18
  29. package/dist/m365/spo/commands/list/list-contenttype-default-set.js +59 -47
  30. package/dist/m365/spo/commands/list/list-contenttype-list.js +16 -8
  31. package/dist/m365/spo/commands/list/list-contenttype-remove.js +16 -8
  32. package/dist/m365/spo/commands/list/list-roleassignment-add.js +10 -10
  33. package/dist/m365/spo/commands/list/list-roleassignment-remove.js +8 -8
  34. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +14 -6
  35. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +15 -7
  36. package/dist/m365/spo/commands/list/list-webhook-add.js +19 -11
  37. package/dist/m365/spo/commands/list/list-webhook-get.js +17 -9
  38. package/dist/m365/spo/commands/list/list-webhook-list.js +23 -24
  39. package/dist/m365/spo/commands/list/list-webhook-remove.js +19 -11
  40. package/dist/m365/spo/commands/list/list-webhook-set.js +18 -10
  41. package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +8 -8
  42. package/dist/m365/spo/commands/web/web-roleassignment-add.js +10 -10
  43. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +8 -8
  44. package/dist/m365/spo/commands.js +5 -0
  45. package/dist/m365/teams/commands/channel/channel-add.js +9 -9
  46. package/dist/m365/todo/commands/task/task-set.js +53 -1
  47. package/docs/docs/cmd/pp/card/card-list.md +33 -0
  48. package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +2 -2
  49. package/docs/docs/cmd/pp/environment/environment-get.md +38 -0
  50. package/docs/docs/cmd/pp/environment/environment-list.md +1 -1
  51. package/docs/docs/cmd/pp/solution/solution-list.md +33 -0
  52. package/docs/docs/cmd/spfx/spfx-doctor.md +10 -1
  53. package/docs/docs/cmd/spo/eventreceiver/eventreceiver-get.md +2 -2
  54. package/docs/docs/cmd/spo/eventreceiver/eventreceiver-remove.md +69 -0
  55. package/docs/docs/cmd/spo/file/file-roleassignment-add.md +57 -0
  56. package/docs/docs/cmd/spo/file/file-roleinheritance-break.md +54 -0
  57. package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.md +57 -0
  58. package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.md +39 -0
  59. package/docs/docs/cmd/spo/group/group-list.md +10 -1
  60. package/docs/docs/cmd/spo/list/list-contenttype-add.md +16 -7
  61. package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +16 -7
  62. package/docs/docs/cmd/spo/list/list-contenttype-list.md +15 -6
  63. package/docs/docs/cmd/spo/list/list-contenttype-remove.md +17 -8
  64. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +11 -8
  65. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +14 -5
  66. package/docs/docs/cmd/spo/list/list-webhook-add.md +15 -16
  67. package/docs/docs/cmd/spo/list/list-webhook-get.md +15 -6
  68. package/docs/docs/cmd/spo/list/list-webhook-list.md +16 -7
  69. package/docs/docs/cmd/spo/list/list-webhook-remove.md +12 -10
  70. package/docs/docs/cmd/spo/list/list-webhook-set.md +13 -11
  71. package/docs/docs/cmd/teams/channel/channel-add.md +4 -4
  72. package/docs/docs/cmd/todo/task/task-set.md +29 -2
  73. package/package.json +5 -1
  74. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +0 -60
package/.eslintrc.js CHANGED
@@ -174,7 +174,19 @@ module.exports = {
174
174
  "eqeqeq": [
175
175
  "error",
176
176
  "always"
177
- ]
177
+ ],
178
+ "@typescript-eslint/naming-convention": [
179
+ "error",
180
+ {
181
+ "selector": [
182
+ "method"
183
+ ],
184
+ "format": [
185
+ "camelCase"
186
+ ]
187
+ }
188
+ ],
189
+ "@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }]
178
190
  },
179
191
  "overrides": [
180
192
  {
@@ -185,7 +197,8 @@ module.exports = {
185
197
  "no-console": "error",
186
198
  "@typescript-eslint/no-empty-function": "off",
187
199
  "cli-microsoft365/correct-command-class-name": "off",
188
- "cli-microsoft365/correct-command-name": "off"
200
+ "cli-microsoft365/correct-command-name": "off",
201
+ "@typescript-eslint/explicit-function-return-type": "off"
189
202
  }
190
203
  },
191
204
  {
package/README.md CHANGED
@@ -15,6 +15,11 @@
15
15
  alt="GitHub" />
16
16
  </a>
17
17
 
18
+ <a href="https://discord.com/invite/7rfW4kg6B5">
19
+ <img src="https://img.shields.io/badge/Discord-Join-7289da?style=flat-square"
20
+ alt="Discord" />
21
+ </a>
22
+
18
23
  <a href="https://twitter.com/climicrosoft365">
19
24
  <img src="https://img.shields.io/badge/Twitter-%40climicrosoft365-blue?style=flat-square"
20
25
  alt="Twitter" />
@@ -209,8 +209,6 @@ class AadAppAddCommand extends GraphCommand_1.default {
209
209
  delete v2Manifest.appId;
210
210
  delete v2Manifest.publisherDomain;
211
211
  // extract secrets from the manifest. Store them in a separate variable
212
- // and remove them from the manifest because we need to create them
213
- // separately
214
212
  const secrets = this.getSecretsFromManifest(v2Manifest);
215
213
  // Azure Portal returns v2 manifest whereas the Graph API expects a v1.6
216
214
  if (args.options.apisApplication || args.options.apisDelegated) {
@@ -218,6 +216,33 @@ class AadAppAddCommand extends GraphCommand_1.default {
218
216
  // otherwise, they will be skipped in the app update
219
217
  v2Manifest.requiredResourceAccess = appInfo.requiredResourceAccess;
220
218
  }
219
+ if (args.options.redirectUris) {
220
+ // take submitted redirectUris/platform as options
221
+ // otherwise, they will be removed from the app
222
+ v2Manifest.replyUrlsWithType = args.options.redirectUris.split(',').map(u => {
223
+ return {
224
+ url: u.trim(),
225
+ type: this.translatePlatformToType(args.options.platform)
226
+ };
227
+ });
228
+ }
229
+ if (args.options.multitenant) {
230
+ // override manifest setting when using multitenant flag
231
+ v2Manifest.signInAudience = 'AzureADMultipleOrgs';
232
+ }
233
+ if (args.options.implicitFlow) {
234
+ // remove manifest settings when using implicitFlow flag
235
+ delete v2Manifest.oauth2AllowIdTokenImplicitFlow;
236
+ delete v2Manifest.oauth2AllowImplicitFlow;
237
+ }
238
+ if (args.options.scopeName) {
239
+ // override manifest setting when using options.
240
+ delete v2Manifest.oauth2Permissions;
241
+ }
242
+ if (args.options.certificateFile || args.options.certificateBase64Encoded) {
243
+ // override manifest setting when using options.
244
+ delete v2Manifest.keyCredentials;
245
+ }
221
246
  const graphManifest = this.transformManifest(v2Manifest);
222
247
  const updateAppRequestOptions = {
223
248
  url: `${this.resource}/v1.0/myorganization/applications/${appInfo.id}`,
@@ -428,7 +453,6 @@ class AadAppAddCommand extends GraphCommand_1.default {
428
453
  return odata_1.odata
429
454
  .getAllItems(`${this.resource}/v1.0/myorganization/servicePrincipals?$select=appId,appRoles,id,oauth2PermissionScopes,servicePrincipalNames`)
430
455
  .then(servicePrincipals => {
431
- var _a;
432
456
  let resolvedApis = [];
433
457
  try {
434
458
  if (args.options.apisDelegated || args.options.apisApplication) {
@@ -451,17 +475,10 @@ class AadAppAddCommand extends GraphCommand_1.default {
451
475
  }
452
476
  });
453
477
  }
454
- if (typeof ((_a = this.manifest) === null || _a === void 0 ? void 0 : _a.requiredResourceAccess) !== 'undefined' && this.manifest.requiredResourceAccess.length > 0) {
478
+ else {
455
479
  const manifestApis = this.manifest.requiredResourceAccess;
456
480
  manifestApis.forEach(manifestApi => {
457
- const requiredResource = resolvedApis.find(api => api.resourceAppId === manifestApi.resourceAppId);
458
- if (requiredResource) {
459
- // exclude if any duplicate required resources in both manifest and submitted options
460
- requiredResource.resourceAccess.push(...manifestApi.resourceAccess.filter(manRes => !requiredResource.resourceAccess.some(res => res.id === manRes.id)));
461
- }
462
- else {
463
- resolvedApis.push(manifestApi);
464
- }
481
+ resolvedApis.push(manifestApi);
465
482
  const app = servicePrincipals.find(servicePrincipals => servicePrincipals.appId === manifestApi.resourceAppId);
466
483
  if (app) {
467
484
  manifestApi.resourceAccess.forEach((res => {
@@ -550,7 +567,7 @@ class AadAppAddCommand extends GraphCommand_1.default {
550
567
  }
551
568
  }
552
569
  configureSecret(args, appInfo, logger) {
553
- if (!args.options.withSecret) {
570
+ if (!args.options.withSecret || (appInfo.secrets && appInfo.secrets.length > 0)) {
554
571
  return Promise.resolve(appInfo);
555
572
  }
556
573
  if (this.verbose) {
@@ -560,6 +577,7 @@ class AadAppAddCommand extends GraphCommand_1.default {
560
577
  .createSecret({ appObjectId: appInfo.id })
561
578
  .then(secret => {
562
579
  appInfo.secret = secret.value;
580
+ appInfo.secrets = [{ displayName: secret.displayName, value: secret.value }];
563
581
  return Promise.resolve(appInfo);
564
582
  });
565
583
  }
@@ -643,6 +661,12 @@ class AadAppAddCommand extends GraphCommand_1.default {
643
661
  }
644
662
  return Promise.resolve(appInfo);
645
663
  }
664
+ translatePlatformToType(platform) {
665
+ if (platform === 'publicClient') {
666
+ return 'InstalledClient';
667
+ }
668
+ return platform.charAt(0).toUpperCase() + platform.substring(1);
669
+ }
646
670
  }
647
671
  _AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = function _AadAppAddCommand_initTelemetry() {
648
672
  this.telemetry.push((args) => {
@@ -132,7 +132,7 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
132
132
  if (args.options.bodyContentType &&
133
133
  args.options.bodyContentType !== 'Text' &&
134
134
  args.options.bodyContentType !== 'HTML') {
135
- return `${args.options.bodyContents} is not a valid value for the bodyContents option. Allowed values are Text|HTML`;
135
+ return `${args.options.bodyContentType} is not a valid value for the bodyContentType option. Allowed values are Text|HTML`;
136
136
  }
137
137
  if (args.options.saveToSentItems &&
138
138
  args.options.saveToSentItems !== 'true' &&
@@ -100,7 +100,7 @@ class PlannerBucketGetCommand extends GraphCommand_1.default {
100
100
  const requestOptions = {
101
101
  url: `${this.resource}/v1.0/planner/buckets/${id}`,
102
102
  headers: {
103
- accept: 'application/json'
103
+ accept: 'application/json;odata.metadata=none'
104
104
  },
105
105
  responseType: 'json'
106
106
  };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Environment.js.map
@@ -0,0 +1,68 @@
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 _PpCardListCommand_instances, _PpCardListCommand_initTelemetry, _PpCardListCommand_initOptions;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const odata_1 = require("../../../../utils/odata");
19
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
21
+ const commands_1 = require("../../commands");
22
+ class PpCardListCommand extends PowerPlatformCommand_1.default {
23
+ constructor() {
24
+ super();
25
+ _PpCardListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _PpCardListCommand_instances, "m", _PpCardListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _PpCardListCommand_instances, "m", _PpCardListCommand_initOptions).call(this);
28
+ }
29
+ get name() {
30
+ return commands_1.default.CARD_LIST;
31
+ }
32
+ get description() {
33
+ return 'Lists Microsoft Power Platform cards in the specified Power Platform environment.';
34
+ }
35
+ defaultProperties() {
36
+ return ['name', 'cardid', 'publishdate', 'createdon', 'modifiedon'];
37
+ }
38
+ commandAction(logger, args) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Retrieving list of cards`);
42
+ }
43
+ try {
44
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
45
+ const items = yield odata_1.odata.getAllItems(`${dynamicsApiUrl}/api/data/v9.1/cards?$expand=owninguser($select=azureactivedirectoryobjectid,fullname)`);
46
+ logger.log(items);
47
+ }
48
+ catch (err) {
49
+ this.handleRejectedODataJsonPromise(err);
50
+ }
51
+ });
52
+ }
53
+ }
54
+ _PpCardListCommand_instances = new WeakSet(), _PpCardListCommand_initTelemetry = function _PpCardListCommand_initTelemetry() {
55
+ this.telemetry.push((args) => {
56
+ Object.assign(this.telemetryProperties, {
57
+ asAdmin: !!args.options.asAdmin
58
+ });
59
+ });
60
+ }, _PpCardListCommand_initOptions = function _PpCardListCommand_initOptions() {
61
+ this.options.unshift({
62
+ option: '-e, --environment <environment>'
63
+ }, {
64
+ option: '-a, --asAdmin'
65
+ });
66
+ };
67
+ module.exports = new PpCardListCommand();
68
+ //# sourceMappingURL=card-list.js.map
@@ -15,7 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PpDataverseTableListCommand_instances, _PpDataverseTableListCommand_initTelemetry, _PpDataverseTableListCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- const request_1 = require("../../../../request");
18
+ const odata_1 = require("../../../../utils/odata");
19
19
  const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
20
  const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
21
21
  const commands_1 = require("../../commands");
@@ -33,24 +33,18 @@ class PpDataverseTableListCommand extends PowerPlatformCommand_1.default {
33
33
  return 'Lists dataverse tables in a given environment';
34
34
  }
35
35
  defaultProperties() {
36
- return ['SchemaName', 'EntitySetName', 'IsManaged'];
36
+ return ['SchemaName', 'EntitySetName', 'LogicalName', 'IsManaged'];
37
37
  }
38
38
  commandAction(logger, args) {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
40
  if (this.verbose) {
41
41
  logger.logToStderr(`Retrieving list of tables for which the user is an admin...`);
42
42
  }
43
- const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
44
- const requestOptions = {
45
- url: `${dynamicsApiUrl}/api/data/v9.0/EntityDefinitions?$select=MetadataId,IsCustomEntity,IsManaged,SchemaName,IconVectorName,LogicalName,EntitySetName,IsActivity,DataProviderId,IsRenameable,IsCustomizable,CanCreateForms,CanCreateViews,CanCreateCharts,CanCreateAttributes,CanChangeTrackingBeEnabled,CanModifyAdditionalSettings,CanChangeHierarchicalRelationship,CanEnableSyncToExternalSearchIndex&$filter=(IsIntersect eq false and IsLogicalEntity eq false and%0APrimaryNameAttribute ne null and PrimaryNameAttribute ne %27%27 and ObjectTypeCode gt 0 and%0AObjectTypeCode ne 4712 and ObjectTypeCode ne 4724 and ObjectTypeCode ne 9933 and ObjectTypeCode ne 9934 and%0AObjectTypeCode ne 9935 and ObjectTypeCode ne 9947 and ObjectTypeCode ne 9945 and ObjectTypeCode ne 9944 and%0AObjectTypeCode ne 9942 and ObjectTypeCode ne 9951 and ObjectTypeCode ne 2016 and ObjectTypeCode ne 9949 and%0AObjectTypeCode ne 9866 and ObjectTypeCode ne 9867 and ObjectTypeCode ne 9868) and (IsCustomizable/Value eq true or IsCustomEntity eq true or IsManaged eq false or IsMappable/Value eq true or IsRenameable/Value eq true)&api-version=9.1`,
46
- headers: {
47
- accept: 'application/json;odata.metadata=none'
48
- },
49
- responseType: 'json'
50
- };
51
43
  try {
52
- const res = yield request_1.default.get(requestOptions);
53
- logger.log(res.value);
44
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
45
+ const endpoint = `${dynamicsApiUrl}/api/data/v9.0/EntityDefinitions?$select=MetadataId,IsCustomEntity,IsManaged,SchemaName,IconVectorName,LogicalName,EntitySetName,IsActivity,DataProviderId,IsRenameable,IsCustomizable,CanCreateForms,CanCreateViews,CanCreateCharts,CanCreateAttributes,CanChangeTrackingBeEnabled,CanModifyAdditionalSettings,CanChangeHierarchicalRelationship,CanEnableSyncToExternalSearchIndex&$filter=(IsIntersect eq false and IsLogicalEntity eq false and%0APrimaryNameAttribute ne null and PrimaryNameAttribute ne %27%27 and ObjectTypeCode gt 0 and%0AObjectTypeCode ne 4712 and ObjectTypeCode ne 4724 and ObjectTypeCode ne 9933 and ObjectTypeCode ne 9934 and%0AObjectTypeCode ne 9935 and ObjectTypeCode ne 9947 and ObjectTypeCode ne 9945 and ObjectTypeCode ne 9944 and%0AObjectTypeCode ne 9942 and ObjectTypeCode ne 9951 and ObjectTypeCode ne 2016 and ObjectTypeCode ne 9949 and%0AObjectTypeCode ne 9866 and ObjectTypeCode ne 9867 and ObjectTypeCode ne 9868) and (IsCustomizable/Value eq true or IsCustomEntity eq true or IsManaged eq false or IsMappable/Value eq true or IsRenameable/Value eq true)&api-version=9.1`;
46
+ const res = yield odata_1.odata.getAllItems(endpoint);
47
+ logger.log(res);
54
48
  }
55
49
  catch (err) {
56
50
  this.handleRejectedODataJsonPromise(err);
@@ -0,0 +1,75 @@
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 _PpEnvironmentGetCommand_instances, _PpEnvironmentGetCommand_initTelemetry, _PpEnvironmentGetCommand_initOptions;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
20
+ const commands_1 = require("../../commands");
21
+ class PpEnvironmentGetCommand extends PowerPlatformCommand_1.default {
22
+ constructor() {
23
+ super();
24
+ _PpEnvironmentGetCommand_instances.add(this);
25
+ __classPrivateFieldGet(this, _PpEnvironmentGetCommand_instances, "m", _PpEnvironmentGetCommand_initTelemetry).call(this);
26
+ __classPrivateFieldGet(this, _PpEnvironmentGetCommand_instances, "m", _PpEnvironmentGetCommand_initOptions).call(this);
27
+ }
28
+ get name() {
29
+ return commands_1.default.ENVIRONMENT_GET;
30
+ }
31
+ get description() {
32
+ return 'Gets information about the specified Power Platform environment';
33
+ }
34
+ defaultProperties() {
35
+ return ['name', 'id'];
36
+ }
37
+ commandAction(logger, args) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ let url = `${this.resource}/providers/Microsoft.BusinessAppPlatform/environments`;
40
+ if (args.options.asAdmin) {
41
+ url = `${this.resource}/providers/Microsoft.BusinessAppPlatform/scopes/admin/environments`;
42
+ }
43
+ const requestOptions = {
44
+ url: `${url}?api-version=2020-10-01`,
45
+ headers: {
46
+ accept: 'application/json'
47
+ },
48
+ responseType: 'json'
49
+ };
50
+ const res = yield request_1.default.get(requestOptions);
51
+ const environmentItem = res.value.filter((env) => {
52
+ return env.name === args.options.name;
53
+ })[0];
54
+ if (!environmentItem) {
55
+ throw `The specified Power Platform environment does not exist`;
56
+ }
57
+ logger.log(environmentItem);
58
+ });
59
+ }
60
+ }
61
+ _PpEnvironmentGetCommand_instances = new WeakSet(), _PpEnvironmentGetCommand_initTelemetry = function _PpEnvironmentGetCommand_initTelemetry() {
62
+ this.telemetry.push((args) => {
63
+ Object.assign(this.telemetryProperties, {
64
+ asAdmin: !!args.options.asAdmin
65
+ });
66
+ });
67
+ }, _PpEnvironmentGetCommand_initOptions = function _PpEnvironmentGetCommand_initOptions() {
68
+ this.options.unshift({
69
+ option: '-n, --name <name>'
70
+ }, {
71
+ option: '-a, --asAdmin'
72
+ });
73
+ };
74
+ module.exports = new PpEnvironmentGetCommand();
75
+ //# sourceMappingURL=environment-get.js.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Solution.js.map
@@ -0,0 +1,87 @@
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 _PpSolutionListCommand_instances, _PpSolutionListCommand_initTelemetry, _PpSolutionListCommand_initOptions;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
21
+ const commands_1 = require("../../commands");
22
+ class PpSolutionListCommand extends PowerPlatformCommand_1.default {
23
+ constructor() {
24
+ super();
25
+ _PpSolutionListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _PpSolutionListCommand_instances, "m", _PpSolutionListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _PpSolutionListCommand_instances, "m", _PpSolutionListCommand_initOptions).call(this);
28
+ }
29
+ get name() {
30
+ return commands_1.default.SOLUTION_LIST;
31
+ }
32
+ get description() {
33
+ return 'Lists solutions in a given environment.';
34
+ }
35
+ defaultProperties() {
36
+ return ['uniquename', 'version', 'publisher'];
37
+ }
38
+ commandAction(logger, args) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Retrieving list of solutions for which the user is an admin...`);
42
+ }
43
+ try {
44
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
45
+ const requestOptions = {
46
+ url: `${dynamicsApiUrl}/api/data/v9.0/solutions?$filter=isvisible eq true&$expand=publisherid($select=friendlyname)&$select=solutionid,uniquename,version,publisherid,installedon,solutionpackageversion,friendlyname,versionnumber&api-version=9.1`,
47
+ headers: {
48
+ accept: 'application/json;odata.metadata=none'
49
+ },
50
+ responseType: 'json'
51
+ };
52
+ const res = yield request_1.default.get(requestOptions);
53
+ if (!args.options.output || args.options.output === 'json') {
54
+ logger.log(res.value);
55
+ }
56
+ else {
57
+ //converted to text friendly output
58
+ logger.log(res.value.map(i => {
59
+ return {
60
+ uniquename: i.uniquename,
61
+ version: i.version,
62
+ publisher: i.publisherid.friendlyname
63
+ };
64
+ }));
65
+ }
66
+ }
67
+ catch (err) {
68
+ this.handleRejectedODataJsonPromise(err);
69
+ }
70
+ });
71
+ }
72
+ }
73
+ _PpSolutionListCommand_instances = new WeakSet(), _PpSolutionListCommand_initTelemetry = function _PpSolutionListCommand_initTelemetry() {
74
+ this.telemetry.push((args) => {
75
+ Object.assign(this.telemetryProperties, {
76
+ asAdmin: !!args.options.asAdmin
77
+ });
78
+ });
79
+ }, _PpSolutionListCommand_initOptions = function _PpSolutionListCommand_initOptions() {
80
+ this.options.unshift({
81
+ option: '-e, --environment <environment>'
82
+ }, {
83
+ option: '-a, --asAdmin'
84
+ });
85
+ };
86
+ module.exports = new PpSolutionListCommand();
87
+ //# sourceMappingURL=solution-list.js.map
@@ -2,11 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'pp';
4
4
  exports.default = {
5
+ CARD_LIST: `${prefix} card list`,
5
6
  DATAVERSE_TABLE_LIST: `${prefix} dataverse table list`,
7
+ ENVIRONMENT_GET: `${prefix} environment get`,
6
8
  ENVIRONMENT_LIST: `${prefix} environment list`,
7
9
  GATEWAY_LIST: `${prefix} gateway list`,
8
10
  MANAGEMENTAPP_ADD: `${prefix} managementapp add`,
9
11
  MANAGEMENTAPP_LIST: `${prefix} managementapp list`,
12
+ SOLUTION_LIST: `${prefix} solution list`,
10
13
  TENANT_SETTINGS_LIST: `${prefix} tenant settings list`
11
14
  };
12
15
  //# sourceMappingURL=commands.js.map
@@ -25,7 +25,6 @@ const FN002009_DEVDEP_microsoft_sp_tslint_rules_1 = require("./rules/FN002009_DE
25
25
  const FN002019_DEVDEP_spfx_fast_serve_helpers_1 = require("./rules/FN002019_DEVDEP_spfx_fast_serve_helpers");
26
26
  const FN006004_CFG_PS_developer_1 = require("./rules/FN006004_CFG_PS_developer");
27
27
  const FN006005_CFG_PS_metadata_1 = require("./rules/FN006005_CFG_PS_metadata");
28
- const FN006006_CFG_PS_features_1 = require("./rules/FN006006_CFG_PS_features");
29
28
  const FN010001_YORC_version_1 = require("./rules/FN010001_YORC_version");
30
29
  const FN014008_CODE_launch_hostedWorkbench_type_1 = require("./rules/FN014008_CODE_launch_hostedWorkbench_type");
31
30
  module.exports = [
@@ -54,7 +53,6 @@ module.exports = [
54
53
  new FN002019_DEVDEP_spfx_fast_serve_helpers_1.FN002019_DEVDEP_spfx_fast_serve_helpers('1.14.0'),
55
54
  new FN006004_CFG_PS_developer_1.FN006004_CFG_PS_developer('1.14.0'),
56
55
  new FN006005_CFG_PS_metadata_1.FN006005_CFG_PS_metadata(),
57
- new FN006006_CFG_PS_features_1.FN006006_CFG_PS_features(),
58
56
  new FN010001_YORC_version_1.FN010001_YORC_version('1.14.0'),
59
57
  new FN014008_CODE_launch_hostedWorkbench_type_1.FN014008_CODE_launch_hostedWorkbench_type('pwa-chrome')
60
58
  ];
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
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
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _SpfxDoctorCommand_instances, _SpfxDoctorCommand_initTelemetry, _SpfxDoctorCommand_initOptions, _SpfxDoctorCommand_initValidators, _SpfxDoctorCommand_initTypes;
16
+ var _SpfxDoctorCommand_instances, _SpfxDoctorCommand_initTelemetry, _SpfxDoctorCommand_initOptions, _SpfxDoctorCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const chalk = require("chalk");
19
19
  const child_process = require("child_process");
@@ -448,7 +448,6 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
448
448
  __classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initTelemetry).call(this);
449
449
  __classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initOptions).call(this);
450
450
  __classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initValidators).call(this);
451
- __classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initTypes).call(this);
452
451
  }
453
452
  get name() {
454
453
  return commands_1.default.DOCTOR;
@@ -457,6 +456,7 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
457
456
  return 'Verifies environment configuration for using the specific version of the SharePoint Framework';
458
457
  }
459
458
  commandAction(logger, args) {
459
+ var _a;
460
460
  return __awaiter(this, void 0, void 0, function* () {
461
461
  if (!args.options.output) {
462
462
  args.options.output = 'text';
@@ -469,7 +469,7 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
469
469
  let prerequisites;
470
470
  const fixes = [];
471
471
  try {
472
- spfxVersion = yield this.getSharePointFrameworkVersion(logger);
472
+ spfxVersion = (_a = args.options.spfxVersion) !== null && _a !== void 0 ? _a : yield this.getSharePointFrameworkVersion(logger);
473
473
  if (!spfxVersion) {
474
474
  logger.log(this.getStatus(CheckStatus.Failure, `SharePoint Framework`));
475
475
  throw `SharePoint Framework not found`;
@@ -479,7 +479,13 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
479
479
  logger.log(this.getStatus(CheckStatus.Failure, `SharePoint Framework v${spfxVersion}`));
480
480
  throw `spfx doctor doesn't support SPFx v${spfxVersion} at this moment`;
481
481
  }
482
- logger.log(this.getStatus(CheckStatus.Success, `SharePoint Framework v${spfxVersion}`));
482
+ if (args.options.spfxVersion) {
483
+ yield this.checkSharePointFrameworkVersion(args.options.spfxVersion, fixes, logger);
484
+ }
485
+ else {
486
+ // spfx was detected and if we are here, it means that we support it
487
+ logger.log(this.getStatus(CheckStatus.Success, `SharePoint Framework v${spfxVersion}`));
488
+ }
483
489
  yield this.checkSharePointCompatibility(spfxVersion, prerequisites, args, fixes, logger);
484
490
  yield this.checkNodeVersion(prerequisites, fixes, logger);
485
491
  yield this.checkYo(prerequisites, fixes, logger);
@@ -532,6 +538,23 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
532
538
  this.checkStatus('Node', nodeVersion, prerequisites.node, OptionalOrRequired.Required, fixes, logger);
533
539
  });
534
540
  }
541
+ checkSharePointFrameworkVersion(spfxVersionRequested, fixes, logger) {
542
+ return this
543
+ .getPackageVersion('@microsoft/generator-sharepoint', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger)
544
+ .then((spfxVersionDetected) => {
545
+ const versionCheck = {
546
+ range: spfxVersionRequested,
547
+ fix: `npm i -g @microsoft/generator-sharepoint@${spfxVersionRequested}`
548
+ };
549
+ if (spfxVersionDetected) {
550
+ this.checkStatus(`SharePoint Framework`, spfxVersionDetected, versionCheck, OptionalOrRequired.Required, fixes, logger);
551
+ }
552
+ else {
553
+ logger.log(this.getStatus(CheckStatus.Failure, `SharePoint Framework v${spfxVersionRequested} not found`));
554
+ fixes.push(versionCheck.fix);
555
+ }
556
+ });
557
+ }
535
558
  checkYo(prerequisites, fixes, logger) {
536
559
  return this
537
560
  .getPackageVersion('yo', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger)
@@ -710,13 +733,17 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
710
733
  _SpfxDoctorCommand_instances = new WeakSet(), _SpfxDoctorCommand_initTelemetry = function _SpfxDoctorCommand_initTelemetry() {
711
734
  this.telemetry.push((args) => {
712
735
  Object.assign(this.telemetryProperties, {
713
- env: args.options.env
736
+ env: args.options.env,
737
+ spfxVersion: args.options.spfxVersion
714
738
  });
715
739
  });
716
740
  }, _SpfxDoctorCommand_initOptions = function _SpfxDoctorCommand_initOptions() {
717
741
  this.options.unshift({
718
742
  option: '-e, --env [env]',
719
743
  autocomplete: ['sp2016', 'sp2019', 'spo']
744
+ }, {
745
+ option: '-v, --spfxVersion [spfxVersion]',
746
+ autocomplete: Object.keys(this.versions)
720
747
  });
721
748
  }, _SpfxDoctorCommand_initValidators = function _SpfxDoctorCommand_initValidators() {
722
749
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -726,13 +753,16 @@ _SpfxDoctorCommand_instances = new WeakSet(), _SpfxDoctorCommand_initTelemetry =
726
753
  return `${args.options.env} is not a valid SharePoint version. Valid versions are sp2016, sp2019 or spo`;
727
754
  }
728
755
  }
756
+ if (args.options.spfxVersion) {
757
+ if (!this.versions[args.options.spfxVersion]) {
758
+ return `${args.options.spfxVersion} is not a supported SharePoint Framework version. Supported versions are ${Object.keys(this.versions).join(', ')}`;
759
+ }
760
+ }
729
761
  if (args.options.output && args.options.output !== 'text') {
730
762
  return `The output option only accepts the type 'text'`;
731
763
  }
732
764
  return true;
733
765
  }));
734
- }, _SpfxDoctorCommand_initTypes = function _SpfxDoctorCommand_initTypes() {
735
- this.types.string.push('e', 'env');
736
766
  };
737
767
  module.exports = new SpfxDoctorCommand();
738
768
  //# sourceMappingURL=spfx-doctor.js.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=EventReceiver.js.map