@pnp/cli-microsoft365 6.0.0-beta.42305df → 6.0.0-beta.49b3c0a

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 (124) hide show
  1. package/.eslintrc.js +15 -2
  2. package/README.md +5 -0
  3. package/dist/Command.js +16 -2
  4. package/dist/m365/aad/commands/app/app-add.js +36 -13
  5. package/dist/m365/commands/status.js +6 -1
  6. package/dist/m365/outlook/commands/mail/mail-send.js +55 -31
  7. package/dist/m365/planner/commands/bucket/bucket-get.js +1 -1
  8. package/dist/m365/planner/commands/plan/plan-get.js +5 -20
  9. package/dist/m365/pp/commands/Environment.js +3 -0
  10. package/dist/m365/pp/commands/card/card-get.js +110 -0
  11. package/dist/m365/pp/commands/card/card-list.js +68 -0
  12. package/dist/m365/pp/commands/dataverse/dataverse-table-list.js +6 -12
  13. package/dist/m365/pp/commands/environment/environment-get.js +75 -0
  14. package/dist/m365/pp/commands/gateway/gateway-get.js +70 -0
  15. package/dist/m365/pp/commands/solution/Solution.js +3 -0
  16. package/dist/m365/pp/commands/solution/solution-get.js +117 -0
  17. package/dist/m365/pp/commands/solution/solution-list.js +87 -0
  18. package/dist/m365/pp/commands.js +6 -0
  19. package/dist/m365/spfx/commands/project/project-doctor.js +4 -1
  20. package/dist/m365/spfx/commands/project/project-externalize.js +4 -1
  21. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010001_YORC_version.js +2 -1
  22. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010002_YORC_isCreatingSolution.js +2 -1
  23. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010003_YORC_packageManager.js +2 -1
  24. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010004_YORC_componentType.js +2 -1
  25. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010005_YORC_environment.js +2 -1
  26. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010006_YORC_framework.js +3 -2
  27. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010007_YORC_isDomainIsolated.js +2 -1
  28. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010008_YORC_nodeVersion.js +2 -1
  29. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010009_YORC_sdkVersions_microsoft_graph_client.js +56 -0
  30. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010010_YORC_sdkVersions_teams_js.js +56 -0
  31. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0.js +0 -2
  32. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.16.0-beta.1.js → upgrade-1.16.0-beta.2.js} +44 -28
  33. package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
  34. package/dist/m365/spfx/commands/spfx-doctor.js +39 -9
  35. package/dist/m365/spo/commands/contenttype/contenttype-add.js +82 -43
  36. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +53 -21
  37. package/dist/m365/spo/commands/contenttype/contenttype-get.js +35 -14
  38. package/dist/m365/spo/commands/eventreceiver/EventReceiver.js +3 -0
  39. package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +182 -0
  40. package/dist/m365/spo/commands/file/file-copy.js +25 -39
  41. package/dist/m365/spo/commands/file/file-move.js +24 -37
  42. package/dist/m365/spo/commands/file/file-rename.js +19 -16
  43. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +129 -0
  44. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +168 -0
  45. package/dist/m365/spo/commands/group/AssociatedGroupPropertiesCollection.js +3 -0
  46. package/dist/m365/spo/commands/group/group-list.js +49 -10
  47. package/dist/m365/spo/commands/list/list-contenttype-add.js +21 -18
  48. package/dist/m365/spo/commands/list/list-contenttype-default-set.js +59 -47
  49. package/dist/m365/spo/commands/list/list-contenttype-list.js +16 -8
  50. package/dist/m365/spo/commands/list/list-contenttype-remove.js +16 -8
  51. package/dist/m365/spo/commands/list/list-roleassignment-add.js +10 -10
  52. package/dist/m365/spo/commands/list/list-roleassignment-remove.js +8 -8
  53. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +14 -6
  54. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +14 -6
  55. package/dist/m365/spo/commands/list/list-webhook-add.js +19 -11
  56. package/dist/m365/spo/commands/list/list-webhook-get.js +17 -10
  57. package/dist/m365/spo/commands/list/list-webhook-list.js +17 -42
  58. package/dist/m365/spo/commands/list/list-webhook-remove.js +19 -11
  59. package/dist/m365/spo/commands/list/list-webhook-set.js +18 -10
  60. package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +239 -0
  61. package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +8 -8
  62. package/dist/m365/spo/commands/site/site-add.js +4 -11
  63. package/dist/m365/spo/commands/{hubsite/hubsite-connect.js → site/site-hubsite-connect.js} +10 -10
  64. package/dist/m365/spo/commands/{hubsite/hubsite-disconnect.js → site/site-hubsite-disconnect.js} +13 -13
  65. package/dist/m365/spo/commands/web/web-roleassignment-add.js +10 -10
  66. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +8 -8
  67. package/dist/m365/spo/commands.js +6 -2
  68. package/dist/m365/teams/commands/channel/channel-add.js +9 -9
  69. package/dist/m365/teams/commands/team/team-set.js +0 -7
  70. package/dist/m365/todo/commands/task/task-add.js +55 -3
  71. package/dist/m365/todo/commands/task/task-set.js +53 -1
  72. package/docs/docs/_clisettings.md +18 -0
  73. package/docs/docs/cmd/outlook/mail/mail-send.md +13 -0
  74. package/docs/docs/cmd/planner/bucket/bucket-add.md +29 -0
  75. package/docs/docs/cmd/planner/bucket/bucket-get.md +29 -0
  76. package/docs/docs/cmd/planner/bucket/bucket-list.md +30 -0
  77. package/docs/docs/cmd/planner/bucket/bucket-remove.md +4 -0
  78. package/docs/docs/cmd/planner/bucket/bucket-set.md +4 -0
  79. package/docs/docs/cmd/planner/plan/plan-add.md +123 -0
  80. package/docs/docs/cmd/planner/plan/plan-get.md +75 -6
  81. package/docs/docs/cmd/planner/plan/plan-list.md +45 -0
  82. package/docs/docs/cmd/planner/plan/plan-remove.md +4 -0
  83. package/docs/docs/cmd/planner/task/task-get.md +0 -3
  84. package/docs/docs/cmd/pp/card/card-get.md +51 -0
  85. package/docs/docs/cmd/pp/card/card-list.md +33 -0
  86. package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +2 -2
  87. package/docs/docs/cmd/pp/environment/environment-get.md +38 -0
  88. package/docs/docs/cmd/pp/environment/environment-list.md +1 -1
  89. package/docs/docs/cmd/pp/gateway/gateway-get.md +24 -0
  90. package/docs/docs/cmd/pp/solution/solution-get.md +51 -0
  91. package/docs/docs/cmd/pp/solution/solution-list.md +33 -0
  92. package/docs/docs/cmd/spfx/project/project-rename.md +1 -14
  93. package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
  94. package/docs/docs/cmd/spfx/spfx-doctor.md +10 -1
  95. package/docs/docs/cmd/spo/contenttype/contenttype-add.md +20 -2
  96. package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.md +22 -4
  97. package/docs/docs/cmd/spo/contenttype/contenttype-get.md +21 -3
  98. package/docs/docs/cmd/spo/eventreceiver/eventreceiver-get.md +2 -2
  99. package/docs/docs/cmd/spo/eventreceiver/eventreceiver-remove.md +69 -0
  100. package/docs/docs/cmd/spo/file/file-roleinheritance-break.md +54 -0
  101. package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.md +57 -0
  102. package/docs/docs/cmd/spo/group/group-list.md +10 -1
  103. package/docs/docs/cmd/spo/list/list-contenttype-add.md +15 -6
  104. package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +16 -7
  105. package/docs/docs/cmd/spo/list/list-contenttype-list.md +15 -6
  106. package/docs/docs/cmd/spo/list/list-contenttype-remove.md +16 -7
  107. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +11 -8
  108. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +16 -7
  109. package/docs/docs/cmd/spo/list/list-webhook-add.md +15 -16
  110. package/docs/docs/cmd/spo/list/list-webhook-get.md +17 -8
  111. package/docs/docs/cmd/spo/list/list-webhook-list.md +13 -10
  112. package/docs/docs/cmd/spo/list/list-webhook-remove.md +12 -10
  113. package/docs/docs/cmd/spo/list/list-webhook-set.md +15 -13
  114. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.md +81 -0
  115. package/docs/docs/cmd/spo/site/site-add.md +0 -3
  116. package/docs/docs/cmd/spo/{hubsite/hubsite-connect.md → site/site-hubsite-connect.md} +4 -4
  117. package/docs/docs/cmd/spo/{hubsite/hubsite-disconnect.md → site/site-hubsite-disconnect.md} +7 -7
  118. package/docs/docs/cmd/teams/channel/channel-add.md +4 -4
  119. package/docs/docs/cmd/teams/team/team-clone.md +0 -3
  120. package/docs/docs/cmd/teams/team/team-set.md +0 -3
  121. package/docs/docs/cmd/todo/task/task-add.md +32 -5
  122. package/docs/docs/cmd/todo/task/task-set.md +29 -2
  123. package/package.json +12 -3
  124. 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" />
package/dist/Command.js CHANGED
@@ -61,6 +61,9 @@ class Command {
61
61
  __classPrivateFieldGet(this, _Command_instances, "m", _Command_initOptions).call(this);
62
62
  __classPrivateFieldGet(this, _Command_instances, "m", _Command_initValidators).call(this);
63
63
  }
64
+ get allowedOutputs() {
65
+ return ['csv', 'json', 'text'];
66
+ }
64
67
  validateUnknownOptions(args, command) {
65
68
  return __awaiter(this, void 0, void 0, function* () {
66
69
  if (this.allowUnknownOptions()) {
@@ -135,6 +138,17 @@ class Command {
135
138
  return true;
136
139
  });
137
140
  }
141
+ validateOutput(args) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ if (args.options.output &&
144
+ this.allowedOutputs.indexOf(args.options.output) < 0) {
145
+ return `'${args.options.output}' is not a valid output type. Allowed output types are ${this.allowedOutputs.join(', ')}`;
146
+ }
147
+ else {
148
+ return true;
149
+ }
150
+ });
151
+ }
138
152
  alias() {
139
153
  return;
140
154
  }
@@ -417,9 +431,9 @@ _Command_instances = new WeakSet(), _Command_initTelemetry = function _Command_i
417
431
  }, _Command_initOptions = function _Command_initOptions() {
418
432
  this.options.unshift({ option: '--query [query]' }, {
419
433
  option: '-o, --output [output]',
420
- autocomplete: ['csv', 'json', 'text']
434
+ autocomplete: this.allowedOutputs
421
435
  }, { option: '--verbose' }, { option: '--debug' });
422
436
  }, _Command_initValidators = function _Command_initValidators() {
423
- this.validators.push((args, command) => this.validateUnknownOptions(args, command), (args, command) => this.validateRequiredOptions(args, command), (args, command) => this.validateOptionSets(args, command));
437
+ this.validators.push((args, command) => this.validateUnknownOptions(args, command), (args, command) => this.validateRequiredOptions(args, command), args => this.validateOutput(args), (args, command) => this.validateOptionSets(args, command));
424
438
  };
425
439
  //# sourceMappingURL=Command.js.map
@@ -206,8 +206,6 @@ class AadAppAddCommand extends GraphCommand_1.default {
206
206
  delete v2Manifest.appId;
207
207
  delete v2Manifest.publisherDomain;
208
208
  // extract secrets from the manifest. Store them in a separate variable
209
- // and remove them from the manifest because we need to create them
210
- // separately
211
209
  const secrets = this.getSecretsFromManifest(v2Manifest);
212
210
  // Azure Portal returns v2 manifest whereas the Graph API expects a v1.6
213
211
  if (args.options.apisApplication || args.options.apisDelegated) {
@@ -215,6 +213,33 @@ class AadAppAddCommand extends GraphCommand_1.default {
215
213
  // otherwise, they will be skipped in the app update
216
214
  v2Manifest.requiredResourceAccess = appInfo.requiredResourceAccess;
217
215
  }
216
+ if (args.options.redirectUris) {
217
+ // take submitted redirectUris/platform as options
218
+ // otherwise, they will be removed from the app
219
+ v2Manifest.replyUrlsWithType = args.options.redirectUris.split(',').map(u => {
220
+ return {
221
+ url: u.trim(),
222
+ type: this.translatePlatformToType(args.options.platform)
223
+ };
224
+ });
225
+ }
226
+ if (args.options.multitenant) {
227
+ // override manifest setting when using multitenant flag
228
+ v2Manifest.signInAudience = 'AzureADMultipleOrgs';
229
+ }
230
+ if (args.options.implicitFlow) {
231
+ // remove manifest settings when using implicitFlow flag
232
+ delete v2Manifest.oauth2AllowIdTokenImplicitFlow;
233
+ delete v2Manifest.oauth2AllowImplicitFlow;
234
+ }
235
+ if (args.options.scopeName) {
236
+ // override manifest setting when using options.
237
+ delete v2Manifest.oauth2Permissions;
238
+ }
239
+ if (args.options.certificateFile || args.options.certificateBase64Encoded) {
240
+ // override manifest setting when using options.
241
+ delete v2Manifest.keyCredentials;
242
+ }
218
243
  const graphManifest = this.transformManifest(v2Manifest);
219
244
  const updateAppRequestOptions = {
220
245
  url: `${this.resource}/v1.0/myorganization/applications/${appInfo.id}`,
@@ -425,7 +450,6 @@ class AadAppAddCommand extends GraphCommand_1.default {
425
450
  return odata_1.odata
426
451
  .getAllItems(`${this.resource}/v1.0/myorganization/servicePrincipals?$select=appId,appRoles,id,oauth2PermissionScopes,servicePrincipalNames`)
427
452
  .then(servicePrincipals => {
428
- var _a;
429
453
  let resolvedApis = [];
430
454
  try {
431
455
  if (args.options.apisDelegated || args.options.apisApplication) {
@@ -448,17 +472,10 @@ class AadAppAddCommand extends GraphCommand_1.default {
448
472
  }
449
473
  });
450
474
  }
451
- if (typeof ((_a = this.manifest) === null || _a === void 0 ? void 0 : _a.requiredResourceAccess) !== 'undefined' && this.manifest.requiredResourceAccess.length > 0) {
475
+ else {
452
476
  const manifestApis = this.manifest.requiredResourceAccess;
453
477
  manifestApis.forEach(manifestApi => {
454
- const requiredResource = resolvedApis.find(api => api.resourceAppId === manifestApi.resourceAppId);
455
- if (requiredResource) {
456
- // exclude if any duplicate required resources in both manifest and submitted options
457
- requiredResource.resourceAccess.push(...manifestApi.resourceAccess.filter(manRes => !requiredResource.resourceAccess.some(res => res.id === manRes.id)));
458
- }
459
- else {
460
- resolvedApis.push(manifestApi);
461
- }
478
+ resolvedApis.push(manifestApi);
462
479
  const app = servicePrincipals.find(servicePrincipals => servicePrincipals.appId === manifestApi.resourceAppId);
463
480
  if (app) {
464
481
  manifestApi.resourceAccess.forEach((res => {
@@ -547,7 +564,7 @@ class AadAppAddCommand extends GraphCommand_1.default {
547
564
  }
548
565
  }
549
566
  configureSecret(args, appInfo, logger) {
550
- if (!args.options.withSecret) {
567
+ if (!args.options.withSecret || (appInfo.secrets && appInfo.secrets.length > 0)) {
551
568
  return Promise.resolve(appInfo);
552
569
  }
553
570
  if (this.verbose) {
@@ -643,6 +660,12 @@ class AadAppAddCommand extends GraphCommand_1.default {
643
660
  }
644
661
  return Promise.resolve(appInfo);
645
662
  }
663
+ translatePlatformToType(platform) {
664
+ if (platform === 'publicClient') {
665
+ return 'InstalledClient';
666
+ }
667
+ return platform.charAt(0).toUpperCase() + platform.substring(1);
668
+ }
646
669
  }
647
670
  _AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = function _AadAppAddCommand_initTelemetry() {
648
671
  this.telemetry.push((args) => {
@@ -37,12 +37,17 @@ class StatusCommand extends Command_1.default {
37
37
  logger.logToStderr({
38
38
  connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken),
39
39
  authType: Auth_1.AuthType[Auth_1.default.service.authType],
40
+ appId: Auth_1.default.service.appId,
41
+ appTenant: Auth_1.default.service.tenant,
40
42
  accessTokens: JSON.stringify(Auth_1.default.service.accessTokens, null, 2)
41
43
  });
42
44
  }
43
45
  else {
44
46
  logger.log({
45
- connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken)
47
+ connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken),
48
+ authType: Auth_1.AuthType[Auth_1.default.service.authType],
49
+ appId: Auth_1.default.service.appId,
50
+ appTenant: Auth_1.default.service.tenant
46
51
  });
47
52
  }
48
53
  }
@@ -15,10 +15,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _OutlookMailSendCommand_instances, _OutlookMailSendCommand_initTelemetry, _OutlookMailSendCommand_initOptions, _OutlookMailSendCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const fs = require("fs");
19
+ const path = require("path");
18
20
  const Auth_1 = require("../../../../Auth");
19
21
  const request_1 = require("../../../../request");
20
22
  const GraphCommand_1 = require("../../../base/GraphCommand");
21
23
  const commands_1 = require("../../commands");
24
+ const validation_1 = require("../../../../utils/validation");
22
25
  class OutlookMailSendCommand extends GraphCommand_1.default {
23
26
  constructor() {
24
27
  super();
@@ -34,7 +37,6 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
34
37
  return 'Sends an email';
35
38
  }
36
39
  commandAction(logger, args) {
37
- var _a, _b;
38
40
  return __awaiter(this, void 0, void 0, function* () {
39
41
  try {
40
42
  const isAppOnlyAuth = Auth_1.Auth.isAppOnlyAuth(Auth_1.default.service.accessTokens[this.resource].accessToken);
@@ -48,28 +50,8 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
48
50
  'content-type': 'application/json'
49
51
  },
50
52
  responseType: 'json',
51
- data: {
52
- message: {
53
- subject: args.options.subject,
54
- body: {
55
- contentType: args.options.bodyContentType || 'Text',
56
- content: args.options.bodyContents
57
- },
58
- toRecipients: this.mapEmailAddressesToRecipients(args.options.to.split(',')),
59
- ccRecipients: this.mapEmailAddressesToRecipients((_a = args.options.cc) === null || _a === void 0 ? void 0 : _a.split(',')),
60
- bccRecipients: this.mapEmailAddressesToRecipients((_b = args.options.bcc) === null || _b === void 0 ? void 0 : _b.split(',')),
61
- importance: args.options.importance
62
- },
63
- saveToSentItems: args.options.saveToSentItems
64
- }
53
+ data: this.getRequestBody(args.options)
65
54
  };
66
- if (args.options.mailbox) {
67
- requestOptions.data.message.from = {
68
- emailAddress: {
69
- address: args.options.mailbox
70
- }
71
- };
72
- }
73
55
  yield request_1.default.post(requestOptions);
74
56
  }
75
57
  catch (err) {
@@ -77,15 +59,40 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
77
59
  }
78
60
  });
79
61
  }
80
- mapEmailAddressesToRecipients(emailAddresses) {
81
- if (!emailAddresses) {
82
- return emailAddresses;
62
+ mapEmailAddressToRecipient(email) {
63
+ if (!email) {
64
+ return undefined;
83
65
  }
84
- return emailAddresses.map(email => ({
66
+ return {
85
67
  emailAddress: {
86
68
  address: email.trim()
87
69
  }
70
+ };
71
+ }
72
+ getRequestBody(options) {
73
+ var _a, _b;
74
+ const attachments = typeof options.attachment === 'string' ? [options.attachment] : options.attachment;
75
+ const attachmentContents = attachments === null || attachments === void 0 ? void 0 : attachments.map(a => ({
76
+ '@odata.type': '#microsoft.graph.fileAttachment',
77
+ name: path.basename(a),
78
+ contentBytes: fs.readFileSync(a, { encoding: 'base64' })
88
79
  }));
80
+ return ({
81
+ message: {
82
+ subject: options.subject,
83
+ body: {
84
+ contentType: options.bodyContentType || 'Text',
85
+ content: options.bodyContents
86
+ },
87
+ from: this.mapEmailAddressToRecipient(options.mailbox),
88
+ toRecipients: options.to.split(',').map(mail => this.mapEmailAddressToRecipient(mail)),
89
+ ccRecipients: (_a = options.cc) === null || _a === void 0 ? void 0 : _a.split(',').map(mail => this.mapEmailAddressToRecipient(mail)),
90
+ bccRecipients: (_b = options.bcc) === null || _b === void 0 ? void 0 : _b.split(',').map(mail => this.mapEmailAddressToRecipient(mail)),
91
+ importance: options.importance,
92
+ attachments: attachmentContents
93
+ },
94
+ saveToSentItems: options.saveToSentItems
95
+ });
89
96
  }
90
97
  }
91
98
  _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initTelemetry = function _OutlookMailSendCommand_initTelemetry() {
@@ -97,7 +104,8 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
97
104
  saveToSentItems: args.options.saveToSentItems,
98
105
  importance: args.options.importance,
99
106
  mailbox: typeof args.options.mailbox !== 'undefined',
100
- sender: typeof args.options.sender !== 'undefined'
107
+ sender: typeof args.options.sender !== 'undefined',
108
+ attachment: typeof args.options.attachment !== 'undefined'
101
109
  });
102
110
  });
103
111
  }, _OutlookMailSendCommand_initOptions = function _OutlookMailSendCommand_initOptions() {
@@ -121,6 +129,8 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
121
129
  }, {
122
130
  option: '--importance [importance]',
123
131
  autocomplete: ['low', 'normal', 'high']
132
+ }, {
133
+ option: '--attachment [attachment]'
124
134
  }, {
125
135
  option: '--saveToSentItems [saveToSentItems]'
126
136
  });
@@ -129,16 +139,30 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
129
139
  if (args.options.bodyContentType &&
130
140
  args.options.bodyContentType !== 'Text' &&
131
141
  args.options.bodyContentType !== 'HTML') {
132
- return `${args.options.bodyContents} is not a valid value for the bodyContents option. Allowed values are Text|HTML`;
142
+ return `${args.options.bodyContentType} is not a valid value for the bodyContentType option. Allowed values are Text|HTML`;
133
143
  }
134
- if (args.options.saveToSentItems &&
135
- args.options.saveToSentItems !== 'true' &&
136
- args.options.saveToSentItems !== 'false') {
144
+ if (args.options.saveToSentItems && !validation_1.validation.isValidBoolean(args.options.saveToSentItems)) {
137
145
  return `${args.options.saveToSentItems} is not a valid value for the saveToSentItems option. Allowed values are true|false`;
138
146
  }
139
147
  if (args.options.importance && ['low', 'normal', 'high'].indexOf(args.options.importance) === -1) {
140
148
  return `'${args.options.importance}' is not a valid value for the importance option. Allowed values are low|normal|high`;
141
149
  }
150
+ if (args.options.attachment) {
151
+ const attachments = typeof args.options.attachment === 'string' ? [args.options.attachment] : args.options.attachment;
152
+ for (const attachment of attachments) {
153
+ if (!fs.existsSync(attachment)) {
154
+ return `File with path '${attachment}' was not found.`;
155
+ }
156
+ if (!fs.lstatSync(attachment).isFile()) {
157
+ return `'${attachment}' is not a file.`;
158
+ }
159
+ }
160
+ const requestBody = this.getRequestBody(args.options);
161
+ // The max body size of the request is 4 194 304 chars before getting a 413 response
162
+ if (JSON.stringify(requestBody).length > 4194304) {
163
+ return 'Exceeded the max total size of attachments which is 3MB.';
164
+ }
165
+ }
142
166
  return true;
143
167
  }));
144
168
  };
@@ -96,7 +96,7 @@ class PlannerBucketGetCommand extends GraphCommand_1.default {
96
96
  const requestOptions = {
97
97
  url: `${this.resource}/v1.0/planner/buckets/${id}`,
98
98
  headers: {
99
- accept: 'application/json'
99
+ accept: 'application/json;odata.metadata=none'
100
100
  },
101
101
  responseType: 'json'
102
102
  };
@@ -46,12 +46,6 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
46
46
  this.handleError('This command does not support application permissions.');
47
47
  return;
48
48
  }
49
- if (args.options.planId) {
50
- args.options.id = args.options.planId;
51
- }
52
- if (args.options.planTitle) {
53
- args.options.title = args.options.planTitle;
54
- }
55
49
  try {
56
50
  if (args.options.id) {
57
51
  const plan = yield planner_1.planner.getPlanById(args.options.id);
@@ -99,8 +93,6 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
99
93
  _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTelemetry = function _PlannerPlanGetCommand_initTelemetry() {
100
94
  this.telemetry.push((args) => {
101
95
  Object.assign(this.telemetryProperties, {
102
- planId: typeof args.options.planId !== 'undefined',
103
- planTitle: typeof args.options.planTitle !== 'undefined',
104
96
  id: typeof args.options.id !== 'undefined',
105
97
  title: typeof args.options.title !== 'undefined',
106
98
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
@@ -109,10 +101,6 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
109
101
  });
110
102
  }, _PlannerPlanGetCommand_initOptions = function _PlannerPlanGetCommand_initOptions() {
111
103
  this.options.unshift({
112
- option: '--planId [planId]'
113
- }, {
114
- option: '--planTitle [planTitle]'
115
- }, {
116
104
  option: '-i, --id [id]'
117
105
  }, {
118
106
  option: '-t, --title [title]'
@@ -123,20 +111,17 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
123
111
  });
124
112
  }, _PlannerPlanGetCommand_initValidators = function _PlannerPlanGetCommand_initValidators() {
125
113
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
126
- if (args.options.planId && args.options.planTitle ||
127
- args.options.id && args.options.title ||
128
- args.options.planId && args.options.title ||
129
- args.options.id && args.options.planTitle) {
114
+ if (args.options.id && args.options.title) {
130
115
  return 'Specify either id or title but not both';
131
116
  }
132
- if (!args.options.planId && !args.options.id) {
133
- if (!args.options.planTitle && !args.options.title) {
117
+ if (!args.options.id) {
118
+ if (!args.options.title) {
134
119
  return 'Specify either id or title';
135
120
  }
136
- if ((args.options.title || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
121
+ if (args.options.title && !args.options.ownerGroupId && !args.options.ownerGroupName) {
137
122
  return 'Specify either ownerGroupId or ownerGroupName';
138
123
  }
139
- if ((args.options.title || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
124
+ if (args.options.title && args.options.ownerGroupId && args.options.ownerGroupName) {
140
125
  return 'Specify either ownerGroupId or ownerGroupName but not both';
141
126
  }
142
127
  if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Environment.js.map
@@ -0,0 +1,110 @@
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 _PpCardGetCommand_instances, _PpCardGetCommand_initTelemetry, _PpCardGetCommand_initOptions, _PpCardGetCommand_initOptionSets, _PpCardGetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
19
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
20
+ const commands_1 = require("../../commands");
21
+ const request_1 = require("../../../../request");
22
+ const validation_1 = require("../../../../utils/validation");
23
+ class PpCardGetCommand extends PowerPlatformCommand_1.default {
24
+ constructor() {
25
+ super();
26
+ _PpCardGetCommand_instances.add(this);
27
+ __classPrivateFieldGet(this, _PpCardGetCommand_instances, "m", _PpCardGetCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _PpCardGetCommand_instances, "m", _PpCardGetCommand_initOptions).call(this);
29
+ __classPrivateFieldGet(this, _PpCardGetCommand_instances, "m", _PpCardGetCommand_initValidators).call(this);
30
+ __classPrivateFieldGet(this, _PpCardGetCommand_instances, "m", _PpCardGetCommand_initOptionSets).call(this);
31
+ }
32
+ get name() {
33
+ return commands_1.default.CARD_GET;
34
+ }
35
+ get description() {
36
+ return 'Get specific Microsoft Power Platform card in the specified Power Platform environment.';
37
+ }
38
+ defaultProperties() {
39
+ return ['name', 'cardid', 'publishdate', 'createdon', 'modifiedon'];
40
+ }
41
+ commandAction(logger, args) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ if (this.verbose) {
44
+ logger.logToStderr(`Retrieving a card '${args.options.id || args.options.name}'...`);
45
+ }
46
+ try {
47
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
48
+ const res = yield this.getCard(dynamicsApiUrl, args.options);
49
+ logger.log(res);
50
+ }
51
+ catch (err) {
52
+ this.handleRejectedODataJsonPromise(err);
53
+ }
54
+ });
55
+ }
56
+ getCard(dynamicsApiUrl, options) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ const requestOptions = {
59
+ headers: {
60
+ accept: 'application/json;odata.metadata=none'
61
+ },
62
+ responseType: 'json'
63
+ };
64
+ if (options.id) {
65
+ requestOptions.url = `${dynamicsApiUrl}/api/data/v9.1/cards(${options.id})`;
66
+ const result = yield request_1.default.get(requestOptions);
67
+ return result;
68
+ }
69
+ requestOptions.url = `${dynamicsApiUrl}/api/data/v9.1/cards?$filter=name eq '${options.name}'`;
70
+ const result = yield request_1.default.get(requestOptions);
71
+ if (result.value.length === 0) {
72
+ throw `The specified card '${options.name}' does not exist.`;
73
+ }
74
+ if (result.value.length > 1) {
75
+ throw `Multiple cards with name '${options.name}' found: ${result.value.map(x => x.cardid).join(',')}`;
76
+ }
77
+ return result.value[0];
78
+ });
79
+ }
80
+ }
81
+ _PpCardGetCommand_instances = new WeakSet(), _PpCardGetCommand_initTelemetry = function _PpCardGetCommand_initTelemetry() {
82
+ this.telemetry.push((args) => {
83
+ Object.assign(this.telemetryProperties, {
84
+ id: typeof args.options.id !== 'undefined',
85
+ name: typeof args.options.name !== 'undefined',
86
+ asAdmin: !!args.options.asAdmin
87
+ });
88
+ });
89
+ }, _PpCardGetCommand_initOptions = function _PpCardGetCommand_initOptions() {
90
+ this.options.unshift({
91
+ option: '-e, --environment <environment>'
92
+ }, {
93
+ option: '-i, --id [id]'
94
+ }, {
95
+ option: '-n, --name [name]'
96
+ }, {
97
+ option: '-a, --asAdmin'
98
+ });
99
+ }, _PpCardGetCommand_initOptionSets = function _PpCardGetCommand_initOptionSets() {
100
+ this.optionSets.push(['id', 'name']);
101
+ }, _PpCardGetCommand_initValidators = function _PpCardGetCommand_initValidators() {
102
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
103
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
104
+ return `${args.options.id} is not a valid GUID`;
105
+ }
106
+ return true;
107
+ }));
108
+ };
109
+ module.exports = new PpCardGetCommand();
110
+ //# sourceMappingURL=card-get.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);