@pnp/cli-microsoft365 6.0.0-beta.a0a813f → 6.0.0-beta.a9609a1

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 (114) hide show
  1. package/dist/Command.js +16 -2
  2. package/dist/m365/commands/status.js +6 -1
  3. package/dist/m365/outlook/commands/mail/mail-send.js +54 -30
  4. package/dist/m365/planner/commands/plan/plan-get.js +5 -20
  5. package/dist/m365/pp/commands/card/card-get.js +110 -0
  6. package/dist/m365/pp/commands/gateway/gateway-get.js +70 -0
  7. package/dist/m365/pp/commands/solution/solution-get.js +117 -0
  8. package/dist/m365/pp/commands.js +3 -0
  9. package/dist/m365/spfx/commands/project/project-doctor.js +4 -1
  10. package/dist/m365/spfx/commands/project/project-externalize.js +4 -1
  11. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010001_YORC_version.js +2 -1
  12. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010002_YORC_isCreatingSolution.js +2 -1
  13. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010003_YORC_packageManager.js +2 -1
  14. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010004_YORC_componentType.js +2 -1
  15. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010005_YORC_environment.js +2 -1
  16. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010006_YORC_framework.js +3 -2
  17. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010007_YORC_isDomainIsolated.js +2 -1
  18. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010008_YORC_nodeVersion.js +2 -1
  19. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010009_YORC_sdkVersions_microsoft_graph_client.js +56 -0
  20. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010010_YORC_sdkVersions_teams_js.js +56 -0
  21. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.16.0-beta.1.js → upgrade-1.16.0-beta.2.js} +44 -28
  22. package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
  23. package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
  24. package/dist/m365/spo/commands/contenttype/contenttype-add.js +82 -43
  25. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +53 -21
  26. package/dist/m365/spo/commands/contenttype/contenttype-get.js +35 -14
  27. package/dist/m365/spo/commands/field/field-add.js +26 -1
  28. package/dist/m365/spo/commands/field/field-set.js +23 -13
  29. package/dist/m365/spo/commands/list/list-roleassignment-add.js +1 -1
  30. package/dist/m365/spo/commands/list/list-webhook-get.js +2 -3
  31. package/dist/m365/spo/commands/list/list-webhook-list.js +4 -28
  32. package/dist/m365/spo/commands/listitem/listitem-add.js +24 -14
  33. package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +18 -8
  34. package/dist/m365/spo/commands/listitem/listitem-get.js +18 -8
  35. package/dist/m365/spo/commands/listitem/listitem-isrecord.js +20 -10
  36. package/dist/m365/spo/commands/listitem/listitem-list.js +21 -11
  37. package/dist/m365/spo/commands/listitem/listitem-record-declare.js +19 -12
  38. package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +24 -21
  39. package/dist/m365/spo/commands/listitem/listitem-remove.js +19 -11
  40. package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +239 -0
  41. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +13 -5
  42. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +13 -5
  43. package/dist/m365/spo/commands/listitem/listitem-set.js +52 -44
  44. package/dist/m365/spo/commands/site/site-add.js +4 -11
  45. package/dist/m365/spo/commands/{hubsite/hubsite-connect.js → site/site-hubsite-connect.js} +10 -10
  46. package/dist/m365/spo/commands/{hubsite/hubsite-disconnect.js → site/site-hubsite-disconnect.js} +13 -13
  47. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +100 -0
  48. package/dist/m365/spo/commands.js +4 -2
  49. package/dist/m365/teams/commands/team/team-set.js +0 -7
  50. package/dist/m365/todo/commands/list/list-get.js +89 -0
  51. package/dist/m365/todo/commands/task/task-add.js +55 -3
  52. package/dist/m365/todo/commands/task/task-get.js +108 -0
  53. package/dist/m365/todo/commands.js +2 -0
  54. package/docs/docs/_clisettings.md +18 -0
  55. package/docs/docs/cmd/outlook/mail/mail-send.md +13 -0
  56. package/docs/docs/cmd/planner/bucket/bucket-add.md +29 -0
  57. package/docs/docs/cmd/planner/bucket/bucket-get.md +29 -0
  58. package/docs/docs/cmd/planner/bucket/bucket-list.md +30 -0
  59. package/docs/docs/cmd/planner/bucket/bucket-remove.md +4 -0
  60. package/docs/docs/cmd/planner/bucket/bucket-set.md +4 -0
  61. package/docs/docs/cmd/planner/plan/plan-add.md +123 -0
  62. package/docs/docs/cmd/planner/plan/plan-get.md +75 -6
  63. package/docs/docs/cmd/planner/plan/plan-list.md +45 -0
  64. package/docs/docs/cmd/planner/plan/plan-remove.md +4 -0
  65. package/docs/docs/cmd/planner/task/task-get.md +0 -3
  66. package/docs/docs/cmd/pp/card/card-get.md +51 -0
  67. package/docs/docs/cmd/pp/gateway/gateway-get.md +24 -0
  68. package/docs/docs/cmd/pp/solution/solution-get.md +51 -0
  69. package/docs/docs/cmd/spfx/project/project-rename.md +1 -14
  70. package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
  71. package/docs/docs/cmd/spo/contenttype/contenttype-add.md +20 -2
  72. package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.md +22 -4
  73. package/docs/docs/cmd/spo/contenttype/contenttype-get.md +21 -3
  74. package/docs/docs/cmd/spo/field/field-add.md +20 -2
  75. package/docs/docs/cmd/spo/field/field-set.md +11 -2
  76. package/docs/docs/cmd/spo/list/list-webhook-get.md +1 -1
  77. package/docs/docs/cmd/spo/list/list-webhook-list.md +3 -9
  78. package/docs/docs/cmd/spo/list/list-webhook-set.md +2 -2
  79. package/docs/docs/cmd/spo/listitem/listitem-add.md +11 -2
  80. package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +11 -2
  81. package/docs/docs/cmd/spo/listitem/listitem-get.md +11 -2
  82. package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +12 -2
  83. package/docs/docs/cmd/spo/listitem/listitem-list.md +10 -1
  84. package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +7 -4
  85. package/docs/docs/cmd/spo/listitem/listitem-record-undeclare.md +11 -2
  86. package/docs/docs/cmd/spo/listitem/listitem-remove.md +11 -2
  87. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.md +81 -0
  88. package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +7 -4
  89. package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +8 -5
  90. package/docs/docs/cmd/spo/listitem/listitem-set.md +7 -4
  91. package/docs/docs/cmd/spo/site/site-add.md +0 -3
  92. package/docs/docs/cmd/spo/{hubsite/hubsite-connect.md → site/site-hubsite-connect.md} +4 -4
  93. package/docs/docs/cmd/spo/{hubsite/hubsite-disconnect.md → site/site-hubsite-disconnect.md} +7 -7
  94. package/docs/docs/cmd/spo/web/web-roleinheritance-break.md +44 -0
  95. package/docs/docs/cmd/teams/team/team-clone.md +0 -3
  96. package/docs/docs/cmd/teams/team/team-set.md +0 -3
  97. package/docs/docs/cmd/tenant/id/id-get.md +20 -0
  98. package/docs/docs/cmd/tenant/report/report-activeusercounts.md +35 -0
  99. package/docs/docs/cmd/tenant/report/report-activeuserdetail.md +49 -0
  100. package/docs/docs/cmd/tenant/report/report-office365activationcounts.md +32 -0
  101. package/docs/docs/cmd/tenant/report/report-office365activationsusercounts.md +30 -0
  102. package/docs/docs/cmd/tenant/report/report-office365activationsuserdetail.md +36 -0
  103. package/docs/docs/cmd/tenant/report/report-servicesusercounts.md +41 -0
  104. package/docs/docs/cmd/tenant/security/security-alerts-list.md +105 -0
  105. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +87 -0
  106. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +91 -0
  107. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +62 -0
  108. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +51 -0
  109. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.md +64 -0
  110. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +52 -0
  111. package/docs/docs/cmd/todo/list/list-get.md +61 -0
  112. package/docs/docs/cmd/todo/task/task-add.md +32 -5
  113. package/docs/docs/cmd/todo/task/task-get.md +75 -0
  114. package/package.json +11 -6
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
@@ -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
  });
@@ -131,14 +141,28 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
131
141
  args.options.bodyContentType !== 'HTML') {
132
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
  };
@@ -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,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,70 @@
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 _PpGatewayGetCommand_instances, _PpGatewayGetCommand_initOptions, _PpGatewayGetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const validation_1 = require("../../../../utils/validation");
20
+ const PowerBICommand_1 = require("../../../base/PowerBICommand");
21
+ const commands_1 = require("../../commands");
22
+ class PpGatewayGetCommand extends PowerBICommand_1.default {
23
+ constructor() {
24
+ super();
25
+ _PpGatewayGetCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _PpGatewayGetCommand_instances, "m", _PpGatewayGetCommand_initOptions).call(this);
27
+ __classPrivateFieldGet(this, _PpGatewayGetCommand_instances, "m", _PpGatewayGetCommand_initValidators).call(this);
28
+ }
29
+ get name() {
30
+ return commands_1.default.GATEWAY_GET;
31
+ }
32
+ get description() {
33
+ return "Get information about the specified gateway.";
34
+ }
35
+ commandAction(logger, args) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ try {
38
+ const gateway = yield this.getGateway(args.options.id);
39
+ logger.log(gateway);
40
+ }
41
+ catch (error) {
42
+ this.handleRejectedODataJsonPromise(error);
43
+ }
44
+ });
45
+ }
46
+ getGateway(gatewayId) {
47
+ const requestOptions = {
48
+ url: `${this.resource}/v1.0/myorg/gateways/${encodeURIComponent(gatewayId)}`,
49
+ headers: {
50
+ accept: "application/json;odata.metadata=none"
51
+ },
52
+ responseType: "json"
53
+ };
54
+ return request_1.default.get(requestOptions);
55
+ }
56
+ }
57
+ _PpGatewayGetCommand_instances = new WeakSet(), _PpGatewayGetCommand_initOptions = function _PpGatewayGetCommand_initOptions() {
58
+ this.options.unshift({
59
+ option: "-i, --id <id>"
60
+ });
61
+ }, _PpGatewayGetCommand_initValidators = function _PpGatewayGetCommand_initValidators() {
62
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
63
+ if (!validation_1.validation.isValidGuid(args.options.id)) {
64
+ return `${args.options.id} is not a valid GUID`;
65
+ }
66
+ return true;
67
+ }));
68
+ };
69
+ module.exports = new PpGatewayGetCommand();
70
+ //# sourceMappingURL=gateway-get.js.map
@@ -0,0 +1,117 @@
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 _PpSolutionGetCommand_instances, _PpSolutionGetCommand_initTelemetry, _PpSolutionGetCommand_initOptions, _PpSolutionGetCommand_initOptionSets, _PpSolutionGetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
22
+ const commands_1 = require("../../commands");
23
+ class PpSolutionGetCommand extends PowerPlatformCommand_1.default {
24
+ constructor() {
25
+ super();
26
+ _PpSolutionGetCommand_instances.add(this);
27
+ __classPrivateFieldGet(this, _PpSolutionGetCommand_instances, "m", _PpSolutionGetCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _PpSolutionGetCommand_instances, "m", _PpSolutionGetCommand_initOptions).call(this);
29
+ __classPrivateFieldGet(this, _PpSolutionGetCommand_instances, "m", _PpSolutionGetCommand_initValidators).call(this);
30
+ __classPrivateFieldGet(this, _PpSolutionGetCommand_instances, "m", _PpSolutionGetCommand_initOptionSets).call(this);
31
+ }
32
+ get name() {
33
+ return commands_1.default.SOLUTION_GET;
34
+ }
35
+ get description() {
36
+ return 'Gets a specific solution in a given environment.';
37
+ }
38
+ defaultProperties() {
39
+ return ['uniquename', 'version', 'publisher'];
40
+ }
41
+ commandAction(logger, args) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ if (this.verbose) {
44
+ logger.logToStderr(`Retrieving a specific solution '${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.getSolution(dynamicsApiUrl, args.options);
49
+ if (!args.options.output || args.options.output === 'json') {
50
+ logger.log(res);
51
+ }
52
+ else {
53
+ // Converted to text friendly output
54
+ logger.log({
55
+ uniquename: res.uniquename,
56
+ version: res.version,
57
+ publisher: res.publisherid.friendlyname
58
+ });
59
+ }
60
+ }
61
+ catch (err) {
62
+ this.handleRejectedODataJsonPromise(err);
63
+ }
64
+ });
65
+ }
66
+ getSolution(dynamicsApiUrl, options) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const requestOptions = {
69
+ headers: {
70
+ accept: 'application/json;odata.metadata=none'
71
+ },
72
+ responseType: 'json'
73
+ };
74
+ if (options.id) {
75
+ requestOptions.url = `${dynamicsApiUrl}/api/data/v9.0/solutions(${options.id})?$expand=publisherid($select=friendlyname)&$select=solutionid,uniquename,version,publisherid,installedon,solutionpackageversion,friendlyname,versionnumber&api-version=9.1`;
76
+ const result = yield request_1.default.get(requestOptions);
77
+ return result;
78
+ }
79
+ requestOptions.url = `${dynamicsApiUrl}/api/data/v9.0/solutions?$filter=isvisible eq true and uniquename eq \'${options.name}\'&$expand=publisherid($select=friendlyname)&$select=solutionid,uniquename,version,publisherid,installedon,solutionpackageversion,friendlyname,versionnumber&api-version=9.1`;
80
+ const result = yield request_1.default.get(requestOptions);
81
+ if (result.value.length === 0) {
82
+ throw `The specified solution '${options.name}' does not exist.`;
83
+ }
84
+ return result.value[0];
85
+ });
86
+ }
87
+ }
88
+ _PpSolutionGetCommand_instances = new WeakSet(), _PpSolutionGetCommand_initTelemetry = function _PpSolutionGetCommand_initTelemetry() {
89
+ this.telemetry.push((args) => {
90
+ Object.assign(this.telemetryProperties, {
91
+ id: typeof args.options.id !== 'undefined',
92
+ name: typeof args.options.name !== 'undefined',
93
+ asAdmin: !!args.options.asAdmin
94
+ });
95
+ });
96
+ }, _PpSolutionGetCommand_initOptions = function _PpSolutionGetCommand_initOptions() {
97
+ this.options.unshift({
98
+ option: '-e, --environment <environment>'
99
+ }, {
100
+ option: '-i, --id [id]'
101
+ }, {
102
+ option: '-n, --name [name]'
103
+ }, {
104
+ option: '-a, --asAdmin'
105
+ });
106
+ }, _PpSolutionGetCommand_initOptionSets = function _PpSolutionGetCommand_initOptionSets() {
107
+ this.optionSets.push(['id', 'name']);
108
+ }, _PpSolutionGetCommand_initValidators = function _PpSolutionGetCommand_initValidators() {
109
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
110
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
111
+ return `${args.options.id} is not a valid GUID`;
112
+ }
113
+ return true;
114
+ }));
115
+ };
116
+ module.exports = new PpSolutionGetCommand();
117
+ //# sourceMappingURL=solution-get.js.map
@@ -2,13 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'pp';
4
4
  exports.default = {
5
+ CARD_GET: `${prefix} card get`,
5
6
  CARD_LIST: `${prefix} card list`,
6
7
  DATAVERSE_TABLE_LIST: `${prefix} dataverse table list`,
7
8
  ENVIRONMENT_GET: `${prefix} environment get`,
8
9
  ENVIRONMENT_LIST: `${prefix} environment list`,
10
+ GATEWAY_GET: `${prefix} gateway get`,
9
11
  GATEWAY_LIST: `${prefix} gateway list`,
10
12
  MANAGEMENTAPP_ADD: `${prefix} managementapp add`,
11
13
  MANAGEMENTAPP_LIST: `${prefix} managementapp list`,
14
+ SOLUTION_GET: `${prefix} solution get`,
12
15
  SOLUTION_LIST: `${prefix} solution list`,
13
16
  TENANT_SETTINGS_LIST: `${prefix} tenant settings list`
14
17
  };
@@ -68,6 +68,9 @@ class SpfxProjectDoctorCommand extends base_project_command_1.BaseProjectCommand
68
68
  __classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initOptions).call(this);
69
69
  __classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initValidators).call(this);
70
70
  }
71
+ get allowedOutputs() {
72
+ return ['json', 'text', 'md', 'tour'];
73
+ }
71
74
  get name() {
72
75
  return commands_1.default.PROJECT_DOCTOR;
73
76
  }
@@ -333,7 +336,7 @@ _SpfxProjectDoctorCommand_instances = new WeakSet(), _SpfxProjectDoctorCommand_i
333
336
  }, _SpfxProjectDoctorCommand_initOptions = function _SpfxProjectDoctorCommand_initOptions() {
334
337
  this.options.forEach(o => {
335
338
  if (o.option.indexOf('--output') > -1) {
336
- o.autocomplete = ['json', 'text', 'md', 'tour'];
339
+ o.autocomplete = this.allowedOutputs;
337
340
  }
338
341
  });
339
342
  this.options.unshift({
@@ -53,6 +53,9 @@ class SpfxProjectExternalizeCommand extends base_project_command_1.BaseProjectCo
53
53
  this.allEditSuggestions = [];
54
54
  __classPrivateFieldGet(this, _SpfxProjectExternalizeCommand_instances, "m", _SpfxProjectExternalizeCommand_initOptions).call(this);
55
55
  }
56
+ get allowedOutputs() {
57
+ return ['json', 'text', 'md'];
58
+ }
56
59
  get name() {
57
60
  return commands_1.default.PROJECT_EXTERNALIZE;
58
61
  }
@@ -185,7 +188,7 @@ class SpfxProjectExternalizeCommand extends base_project_command_1.BaseProjectCo
185
188
  _SpfxProjectExternalizeCommand_instances = new WeakSet(), _SpfxProjectExternalizeCommand_initOptions = function _SpfxProjectExternalizeCommand_initOptions() {
186
189
  this.options.forEach(o => {
187
190
  if (o.option.indexOf('--output') > -1) {
188
- o.autocomplete = ['json', 'text', 'md'];
191
+ o.autocomplete = this.allowedOutputs;
189
192
  }
190
193
  });
191
194
  };
@@ -33,10 +33,11 @@ class FN010001_YORC_version extends JsonRule_1.JsonRule {
33
33
  return './.yo-rc.json';
34
34
  }
35
35
  visit(project, findings) {
36
+ var _a;
36
37
  if (!project.yoRcJson) {
37
38
  return;
38
39
  }
39
- if (project.yoRcJson["@microsoft/generator-sharepoint"].version !== this.version) {
40
+ if (((_a = project.yoRcJson["@microsoft/generator-sharepoint"]) === null || _a === void 0 ? void 0 : _a.version) !== this.version) {
40
41
  const node = this.getAstNodeFromFile(project.yoRcJson, '@microsoft/generator-sharepoint.version');
41
42
  this.addFindingWithPosition(findings, node);
42
43
  }
@@ -33,10 +33,11 @@ class FN010002_YORC_isCreatingSolution extends JsonRule_1.JsonRule {
33
33
  return './.yo-rc.json';
34
34
  }
35
35
  visit(project, findings) {
36
+ var _a;
36
37
  if (!project.yoRcJson) {
37
38
  return;
38
39
  }
39
- if (project.yoRcJson["@microsoft/generator-sharepoint"].isCreatingSolution !== this.value) {
40
+ if (((_a = project.yoRcJson["@microsoft/generator-sharepoint"]) === null || _a === void 0 ? void 0 : _a.isCreatingSolution) !== this.value) {
40
41
  const node = this.getAstNodeFromFile(project.yoRcJson, '@microsoft/generator-sharepoint.isCreatingSolution');
41
42
  this.addFindingWithPosition(findings, node);
42
43
  }