@pnp/cli-microsoft365 5.3.0-beta.c04ad6e → 5.3.0-beta.de62fbe

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 (104) hide show
  1. package/.eslintrc.js +1 -0
  2. package/dist/Auth.js +5 -0
  3. package/dist/m365/aad/commands/app/app-add.js +91 -35
  4. package/dist/m365/aad/commands/app/app-role-list.js +1 -1
  5. package/dist/m365/aad/commands/app/app-set.js +91 -0
  6. package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +55 -22
  7. package/dist/m365/aad/commands/group/group-list.js +1 -1
  8. package/dist/m365/aad/commands/groupsetting/groupsetting-list.js +1 -1
  9. package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-get.js +1 -1
  10. package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-list.js +1 -1
  11. package/dist/m365/aad/commands/o365group/o365group-conversation-list.js +1 -1
  12. package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +1 -1
  13. package/dist/m365/aad/commands/o365group/o365group-list.js +1 -1
  14. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +3 -3
  15. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-list.js +1 -1
  16. package/dist/m365/aad/commands/o365group/o365group-user-list.js +2 -2
  17. package/dist/m365/aad/commands/o365group/o365group-user-set.js +2 -2
  18. package/dist/m365/aad/commands/user/user-list.js +1 -1
  19. package/dist/m365/aad/commands/user/user-signin-list.js +1 -1
  20. package/dist/m365/aad/commands.js +1 -1
  21. package/dist/m365/app/commands/app-open.js +64 -0
  22. package/dist/m365/app/commands.js +1 -0
  23. package/dist/m365/base/PowerBICommand.js +10 -0
  24. package/dist/m365/file/commands/file-list.js +1 -1
  25. package/dist/m365/outlook/commands/message/message-list.js +1 -1
  26. package/dist/m365/outlook/commands/room/room-list.js +1 -1
  27. package/dist/m365/outlook/commands/roomlist/roomlist-list.js +1 -1
  28. package/dist/m365/planner/commands/bucket/bucket-add.js +8 -16
  29. package/dist/m365/planner/commands/bucket/bucket-get.js +186 -0
  30. package/dist/m365/planner/commands/bucket/bucket-list.js +10 -19
  31. package/dist/m365/planner/commands/bucket/bucket-remove.js +8 -20
  32. package/dist/m365/planner/commands/bucket/bucket-set.js +9 -21
  33. package/dist/m365/planner/commands/plan/plan-add.js +6 -1
  34. package/dist/m365/planner/commands/plan/plan-details-get.js +12 -15
  35. package/dist/m365/planner/commands/plan/plan-get.js +13 -18
  36. package/dist/m365/planner/commands/plan/plan-list.js +10 -13
  37. package/dist/m365/planner/commands/task/task-add.js +8 -16
  38. package/dist/m365/planner/commands/task/task-details-get.js +6 -0
  39. package/dist/m365/planner/commands/task/task-get.js +11 -23
  40. package/dist/m365/planner/commands/task/task-list.js +15 -24
  41. package/dist/m365/planner/commands/task/task-reference-add.js +75 -0
  42. package/dist/m365/planner/commands/task/task-reference-list.js +45 -0
  43. package/dist/m365/planner/commands/task/task-set.js +9 -18
  44. package/dist/m365/planner/commands.js +4 -1
  45. package/dist/m365/pp/commands/gateway/gateway-list.js +36 -0
  46. package/dist/m365/pp/commands/managementapp/managementapp-list.js +1 -1
  47. package/dist/m365/pp/commands.js +1 -0
  48. package/dist/m365/search/commands/externalconnection/externalconnection-list.js +26 -0
  49. package/dist/m365/search/commands.js +2 -1
  50. package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +119 -0
  51. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +84 -0
  52. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +76 -0
  53. package/dist/m365/spo/commands/list/list-view-add.js +113 -0
  54. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +83 -0
  55. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +79 -0
  56. package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +49 -0
  57. package/dist/m365/spo/commands.js +7 -0
  58. package/dist/m365/teams/commands/app/app-list.js +1 -1
  59. package/dist/m365/teams/commands/channel/channel-list.js +1 -1
  60. package/dist/m365/teams/commands/channel/channel-member-add.js +4 -1
  61. package/dist/m365/teams/commands/channel/channel-member-list.js +1 -1
  62. package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -0
  63. package/dist/m365/teams/commands/channel/channel-member-set.js +3 -0
  64. package/dist/m365/teams/commands/chat/chat-get.js +8 -8
  65. package/dist/m365/teams/commands/chat/chat-list.js +1 -1
  66. package/dist/m365/teams/commands/chat/chat-member-list.js +1 -1
  67. package/dist/m365/teams/commands/chat/chat-message-list.js +1 -1
  68. package/dist/m365/teams/commands/chat/chat-message-send.js +6 -6
  69. package/dist/m365/teams/commands/chat/chatUtil.js +4 -4
  70. package/dist/m365/teams/commands/message/message-list.js +1 -1
  71. package/dist/m365/teams/commands/message/message-reply-list.js +1 -1
  72. package/dist/m365/teams/commands/tab/tab-list.js +1 -1
  73. package/dist/m365/teams/commands/team/team-list.js +1 -1
  74. package/dist/m365/teams/commands/user/user-app-list.js +1 -1
  75. package/dist/m365/teams/commands/user/user-list.js +2 -2
  76. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +1 -1
  77. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +1 -1
  78. package/dist/m365/todo/commands/list/list-list.js +1 -1
  79. package/dist/m365/todo/commands/task/task-list.js +1 -1
  80. package/dist/utils/accessToken.js +18 -0
  81. package/dist/utils/formatting.js +11 -2
  82. package/dist/utils/odata.js +2 -2
  83. package/dist/utils/planner.js +65 -0
  84. package/docs/docs/cmd/aad/app/app-add.md +15 -0
  85. package/docs/docs/cmd/aad/app/app-set.md +17 -0
  86. package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.md +1 -1
  87. package/docs/docs/cmd/app/app-open.md +45 -0
  88. package/docs/docs/cmd/planner/bucket/bucket-get.md +57 -0
  89. package/docs/docs/cmd/planner/task/task-reference-add.md +45 -0
  90. package/docs/docs/cmd/planner/task/task-reference-list.md +24 -0
  91. package/docs/docs/cmd/pp/gateway/gateway-list.md +21 -0
  92. package/docs/docs/cmd/search/externalconnection/externalconnection-list.md +21 -0
  93. package/docs/docs/cmd/spo/eventreceiver/eventreceiver-get.md +70 -0
  94. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +55 -0
  95. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +36 -0
  96. package/docs/docs/cmd/spo/list/list-view-add.md +67 -0
  97. package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +58 -0
  98. package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +39 -0
  99. package/docs/docs/cmd/spo/roledefinition/roledefinition-list.md +24 -0
  100. package/docs/docs/cmd/spo/userprofile/userprofile-get.md +1 -1
  101. package/docs/docs/cmd/teams/channel/channel-member-list.md +4 -4
  102. package/docs/docs/cmd/teams/channel/channel-member-remove.md +2 -2
  103. package/docs/docs/cmd/teams/channel/channel-member-set.md +2 -2
  104. package/package.json +2 -1
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const Auth_1 = require("../../../../Auth");
5
+ const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
7
9
  class PlannerPlanListCommand extends GraphCommand_1.default {
@@ -21,21 +23,16 @@ class PlannerPlanListCommand extends GraphCommand_1.default {
21
23
  return ['id', 'title', 'createdDateTime', 'owner'];
22
24
  }
23
25
  commandAction(logger, args, cb) {
26
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
27
+ this.handleError('This command does not support application permissions.', logger, cb);
28
+ return;
29
+ }
24
30
  this
25
31
  .getGroupId(args)
26
- .then((groupId) => {
27
- const requestOptions = {
28
- url: `${this.resource}/v1.0/groups/${groupId}/planner/plans`,
29
- headers: {
30
- 'accept': 'application/json;odata.metadata=none'
31
- },
32
- responseType: 'json'
33
- };
34
- return request_1.default.get(requestOptions);
35
- })
32
+ .then((groupId) => planner_1.planner.getPlansByGroupId(groupId))
36
33
  .then((res) => {
37
- if (res.value && res.value.length > 0) {
38
- logger.log(res.value);
34
+ if (res && res.length > 0) {
35
+ logger.log(res);
39
36
  }
40
37
  cb();
41
38
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Auth_1 = require("../../../../Auth");
3
4
  const request_1 = require("../../../../request");
5
+ const planner_1 = require("../../../../utils/planner");
4
6
  const utils_1 = require("../../../../utils");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
@@ -29,6 +31,10 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
29
31
  return telemetryProps;
30
32
  }
31
33
  commandAction(logger, args, cb) {
34
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
35
+ this.handleError('This command does not support application permissions.', logger, cb);
36
+ return;
37
+ }
32
38
  this
33
39
  .getPlanId(args)
34
40
  .then(planId => {
@@ -151,22 +157,8 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
151
157
  }
152
158
  return this
153
159
  .getGroupId(args)
154
- .then((groupId) => {
155
- const requestOptions = {
156
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
157
- headers: {
158
- accept: 'application/json;odata.metadata=none'
159
- },
160
- responseType: 'json'
161
- };
162
- return request_1.default.get(requestOptions);
163
- }).then((response) => {
164
- const plan = response.value.find(val => val.title === args.options.planName);
165
- if (!plan) {
166
- return Promise.reject(`The specified plan does not exist`);
167
- }
168
- return Promise.resolve(plan.id);
169
- });
160
+ .then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
161
+ .then(plan => plan.id);
170
162
  }
171
163
  getGroupId(args) {
172
164
  if (args.options.ownerGroupId) {
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../../../utils");
4
+ const Auth_1 = require("../../../../Auth");
3
5
  const request_1 = require("../../../../request");
4
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
5
7
  const commands_1 = require("../../commands");
@@ -11,6 +13,10 @@ class PlannerTaskDetailsGetCommand extends GraphCommand_1.default {
11
13
  return 'Retrieve the details of the specified planner task';
12
14
  }
13
15
  commandAction(logger, args, cb) {
16
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
17
+ this.handleError('This command does not support application permissions.', logger, cb);
18
+ return;
19
+ }
14
20
  const requestOptions = {
15
21
  url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details`,
16
22
  headers: {
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const request_1 = require("../../../../request");
5
+ const utils_2 = require("../../../../utils");
6
+ const planner_1 = require("../../../../utils/planner");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
9
+ const Auth_1 = require("../../../../Auth");
7
10
  class PlannerTaskGetCommand extends GraphCommand_1.default {
8
11
  get name() {
9
12
  return commands_1.default.TASK_GET;
@@ -12,6 +15,10 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
12
15
  return 'Retrieve the the specified planner task';
13
16
  }
14
17
  commandAction(logger, args, cb) {
18
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
19
+ this.handleError('This command does not support application permissions.', logger, cb);
20
+ return;
21
+ }
15
22
  this
16
23
  .getTaskId(args.options)
17
24
  .then(taskId => {
@@ -91,27 +98,8 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
91
98
  }
92
99
  return this
93
100
  .getGroupId(options)
94
- .then((groupId) => {
95
- const requestOptions = {
96
- url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'&$select=id,title`,
97
- headers: {
98
- accept: 'application/json;odata.metadata=none'
99
- },
100
- responseType: 'json'
101
- };
102
- return request_1.default.get(requestOptions);
103
- })
104
- .then((response) => {
105
- const planName = options.planName;
106
- const plans = response.value.filter(val => { var _a; return ((_a = val.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === planName.toLocaleLowerCase(); });
107
- if (!plans.length) {
108
- return Promise.reject(`The specified plan ${options.planName} does not exist`);
109
- }
110
- if (plans.length > 1) {
111
- return Promise.reject(`Multiple plans with name ${options.planName} found: ${plans.map(x => x.id)}`);
112
- }
113
- return Promise.resolve(plans[0].id);
114
- });
101
+ .then(groupId => planner_1.planner.getPlanByName(options.planName, groupId))
102
+ .then(plan => plan.id);
115
103
  }
116
104
  getGroupId(options) {
117
105
  if (options.ownerGroupId) {
@@ -170,7 +158,7 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
170
158
  if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
171
159
  return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
172
160
  }
173
- if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
161
+ if (args.options.ownerGroupId && !utils_2.validation.isValidGuid(args.options.ownerGroupId)) {
174
162
  return `${args.options.ownerGroupId} is not a valid GUID`;
175
163
  }
176
164
  return true;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const Auth_1 = require("../../../../Auth");
5
+ const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
7
9
  class PlannerTaskListCommand extends GraphCommand_1.default {
@@ -25,6 +27,10 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
25
27
  return ['id', 'title', 'startDateTime', 'dueDateTime', 'completedDateTime'];
26
28
  }
27
29
  commandAction(logger, args, cb) {
30
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
31
+ this.handleError('This command does not support application permissions.', logger, cb);
32
+ return;
33
+ }
28
34
  const bucketName = args.options.bucketName;
29
35
  let bucketId = args.options.bucketId;
30
36
  const planName = args.options.planName;
@@ -35,11 +41,11 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
35
41
  .getBucketId(args)
36
42
  .then((retrievedBucketId) => {
37
43
  bucketId = retrievedBucketId;
38
- return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks`, logger);
44
+ return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks`);
39
45
  })
40
46
  .then((tasks) => {
41
47
  taskItems = tasks;
42
- return utils_1.odata.getAllItems(`${this.resource}/beta/planner/buckets/${bucketId}/tasks`, logger);
48
+ return utils_1.odata.getAllItems(`${this.resource}/beta/planner/buckets/${bucketId}/tasks`);
43
49
  })
44
50
  .then((betaTasks) => {
45
51
  logger.log(this.mergeTaskPriority(taskItems, betaTasks));
@@ -51,11 +57,11 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
51
57
  .getPlanId(args)
52
58
  .then((retrievedPlanId) => {
53
59
  planId = retrievedPlanId;
54
- return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/tasks`, logger);
60
+ return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/tasks`);
55
61
  })
56
62
  .then((tasks) => {
57
63
  taskItems = tasks;
58
- return utils_1.odata.getAllItems(`${this.resource}/beta/planner/plans/${planId}/tasks`, logger);
64
+ return utils_1.odata.getAllItems(`${this.resource}/beta/planner/plans/${planId}/tasks`);
59
65
  })
60
66
  .then((betaTasks) => {
61
67
  logger.log(this.mergeTaskPriority(taskItems, betaTasks));
@@ -64,10 +70,10 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
64
70
  }
65
71
  else {
66
72
  utils_1.odata
67
- .getAllItems(`${this.resource}/v1.0/me/planner/tasks`, logger)
73
+ .getAllItems(`${this.resource}/v1.0/me/planner/tasks`)
68
74
  .then((tasks) => {
69
75
  taskItems = tasks;
70
- return utils_1.odata.getAllItems(`${this.resource}/beta/me/planner/tasks`, logger);
76
+ return utils_1.odata.getAllItems(`${this.resource}/beta/me/planner/tasks`);
71
77
  })
72
78
  .then((betaTasks) => {
73
79
  logger.log(this.mergeTaskPriority(taskItems, betaTasks));
@@ -105,23 +111,8 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
105
111
  }
106
112
  return this
107
113
  .getGroupId(args)
108
- .then((groupId) => {
109
- const requestOptions = {
110
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
111
- headers: {
112
- accept: 'application/json;odata.metadata=none'
113
- },
114
- responseType: 'json'
115
- };
116
- return request_1.default.get(requestOptions);
117
- })
118
- .then(response => {
119
- const plan = response.value.find(val => val.title === args.options.planName);
120
- if (!plan) {
121
- return Promise.reject(`The specified plan does not exist`);
122
- }
123
- return Promise.resolve(plan.id);
124
- });
114
+ .then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
115
+ .then(plan => plan.id);
125
116
  }
126
117
  getGroupId(args) {
127
118
  if (args.options.ownerGroupId) {
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const GraphCommand_1 = require("../../../base/GraphCommand");
6
+ const commands_1 = require("../../commands");
7
+ class PlannerTaskReferenceAddCommand extends GraphCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.TASK_REFERENCE_ADD;
10
+ }
11
+ get description() {
12
+ return 'Adds a new reference to a Planner task';
13
+ }
14
+ commandAction(logger, args, cb) {
15
+ this
16
+ .getTaskDetailsEtag(args.options.taskId)
17
+ .then(etag => {
18
+ const requestOptionsTaskDetails = {
19
+ url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details`,
20
+ headers: {
21
+ 'accept': 'application/json;odata.metadata=none',
22
+ 'If-Match': etag,
23
+ 'Prefer': 'return=representation'
24
+ },
25
+ responseType: 'json',
26
+ data: {
27
+ references: {
28
+ [utils_1.formatting.openTypesEncoder(args.options.url)]: Object.assign(Object.assign({ '@odata.type': 'microsoft.graph.plannerExternalReference', previewPriority: ' !' }, (args.options.alias && { alias: args.options.alias })), (args.options.type && { type: args.options.type }))
29
+ }
30
+ }
31
+ };
32
+ return request_1.default.patch(requestOptionsTaskDetails);
33
+ })
34
+ .then((res) => {
35
+ logger.log(res.references);
36
+ cb();
37
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
38
+ }
39
+ getTaskDetailsEtag(taskId) {
40
+ const requestOptions = {
41
+ url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(taskId)}/details`,
42
+ headers: {
43
+ accept: 'application/json'
44
+ },
45
+ responseType: 'json'
46
+ };
47
+ return request_1.default
48
+ .get(requestOptions)
49
+ .then((response) => {
50
+ const etag = response ? response['@odata.etag'] : undefined;
51
+ if (!etag) {
52
+ return Promise.reject(`Error fetching task details`);
53
+ }
54
+ return Promise.resolve(etag);
55
+ });
56
+ }
57
+ options() {
58
+ const options = [
59
+ { option: '-i, --taskId <taskId>' },
60
+ { option: '-u, --url <url>' },
61
+ { option: '--alias [alias]' },
62
+ { option: '--type [type]' }
63
+ ];
64
+ const parentOptions = super.options();
65
+ return options.concat(parentOptions);
66
+ }
67
+ validate(args) {
68
+ if (args.options.type && ['powerpoint', 'word', 'excel', 'other'].indexOf(args.options.type.toLocaleLowerCase()) === -1) {
69
+ return `${args.options.type} is not a valid type value. Allowed values PowerPoint|Word|Excel|Other`;
70
+ }
71
+ return true;
72
+ }
73
+ }
74
+ module.exports = new PlannerTaskReferenceAddCommand();
75
+ //# sourceMappingURL=task-reference-add.js.map
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const GraphCommand_1 = require("../../../base/GraphCommand");
5
+ const commands_1 = require("../../commands");
6
+ const utils_1 = require("../../../../utils");
7
+ const Auth_1 = require("../../../../Auth");
8
+ class PlannerTaskReferenceListCommand extends GraphCommand_1.default {
9
+ get name() {
10
+ return commands_1.default.TASK_REFERENCE_LIST;
11
+ }
12
+ get description() {
13
+ return 'Retrieve the references of the specified planner task';
14
+ }
15
+ commandAction(logger, args, cb) {
16
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
17
+ this.handleError('This command does not support application permissions.', logger, cb);
18
+ return;
19
+ }
20
+ const requestOptions = {
21
+ url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details?$select=references`,
22
+ headers: {
23
+ accept: 'application/json;odata.metadata=none'
24
+ },
25
+ responseType: 'json'
26
+ };
27
+ request_1.default
28
+ .get(requestOptions)
29
+ .then((res) => {
30
+ logger.log(res.references);
31
+ cb();
32
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
33
+ }
34
+ options() {
35
+ const options = [
36
+ {
37
+ option: '-i, --taskId <taskId>'
38
+ }
39
+ ];
40
+ const parentOptions = super.options();
41
+ return options.concat(parentOptions);
42
+ }
43
+ }
44
+ module.exports = new PlannerTaskReferenceListCommand();
45
+ //# sourceMappingURL=task-reference-list.js.map
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const request_1 = require("../../../../request");
4
3
  const utils_1 = require("../../../../utils");
4
+ const Auth_1 = require("../../../../Auth");
5
+ const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
5
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
8
  const commands_1 = require("../../commands");
7
9
  class PlannerTaskSetCommand extends GraphCommand_1.default {
@@ -36,6 +38,10 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
36
38
  return telemetryProps;
37
39
  }
38
40
  commandAction(logger, args, cb) {
41
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
42
+ this.handleError('This command does not support application permissions.', logger, cb);
43
+ return;
44
+ }
39
45
  this
40
46
  .getBucketId(args.options)
41
47
  .then(bucketId => {
@@ -217,23 +223,8 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
217
223
  }
218
224
  return this
219
225
  .getGroupId(options)
220
- .then((groupId) => {
221
- const requestOptions = {
222
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')&$select=id,title`,
223
- headers: {
224
- accept: 'application/json;odata.metadata=none'
225
- },
226
- responseType: 'json'
227
- };
228
- return request_1.default.get(requestOptions);
229
- })
230
- .then((response) => {
231
- const plan = response.value.find(val => val.title === options.planName);
232
- if (!plan) {
233
- return Promise.reject(`The specified plan does not exist`);
234
- }
235
- return Promise.resolve(plan.id);
236
- });
226
+ .then((groupId) => planner_1.planner.getPlanByName(options.planName, groupId))
227
+ .then(plan => plan.id);
237
228
  }
238
229
  getGroupId(options) {
239
230
  if (options.ownerGroupId) {
@@ -6,14 +6,17 @@ exports.default = {
6
6
  BUCKET_LIST: `${prefix} bucket list`,
7
7
  BUCKET_SET: `${prefix} bucket set`,
8
8
  BUCKET_REMOVE: `${prefix} bucket remove`,
9
+ BUCKET_GET: `${prefix} bucket get`,
9
10
  PLAN_ADD: `${prefix} plan add`,
10
- PLAN_GET: `${prefix} plan get`,
11
11
  PLAN_DETAILS_GET: `${prefix} plan details get`,
12
+ PLAN_GET: `${prefix} plan get`,
12
13
  PLAN_LIST: `${prefix} plan list`,
13
14
  TASK_ADD: `${prefix} task add`,
14
15
  TASK_DETAILS_GET: `${prefix} task details get`,
15
16
  TASK_GET: `${prefix} task get`,
16
17
  TASK_LIST: `${prefix} task list`,
18
+ TASK_REFERENCE_ADD: `${prefix} task reference add`,
19
+ TASK_REFERENCE_LIST: `${prefix} task reference list`,
17
20
  TASK_SET: `${prefix} task set`
18
21
  };
19
22
  //# sourceMappingURL=commands.js.map
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const PowerBICommand_1 = require("../../../base/PowerBICommand");
5
+ const commands_1 = require("../../commands");
6
+ class PpGatewayListCommand extends PowerBICommand_1.default {
7
+ get name() {
8
+ return commands_1.default.GATEWAY_LIST;
9
+ }
10
+ get description() {
11
+ return 'Returns a list of gateways for which the user is an admin';
12
+ }
13
+ defaultProperties() {
14
+ return ['id', 'name'];
15
+ }
16
+ commandAction(logger, args, cb) {
17
+ if (this.verbose) {
18
+ logger.logToStderr(`Retrieving list of gateways for which the user is an admin...`);
19
+ }
20
+ const requestOptions = {
21
+ url: `${this.resource}/v1.0/myorg/gateways`,
22
+ headers: {
23
+ accept: 'application/json;odata.metadata=none'
24
+ },
25
+ responseType: 'json'
26
+ };
27
+ request_1.default
28
+ .get(requestOptions)
29
+ .then((res) => {
30
+ logger.log(res.value);
31
+ cb();
32
+ }, (rawRes) => this.handleRejectedODataJsonPromise(rawRes, logger, cb));
33
+ }
34
+ }
35
+ module.exports = new PpGatewayListCommand();
36
+ //# sourceMappingURL=gateway-list.js.map
@@ -13,7 +13,7 @@ class PpManagementAppListCommand extends PowerPlatformCommand_1.default {
13
13
  commandAction(logger, args, cb) {
14
14
  const endpoint = `${this.resource}/providers/Microsoft.BusinessAppPlatform/adminApplications?api-version=2020-06-01`;
15
15
  utils_1.odata
16
- .getAllItems(endpoint, logger)
16
+ .getAllItems(endpoint)
17
17
  .then((managementApps) => {
18
18
  logger.log(managementApps);
19
19
  cb();
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'pp';
4
4
  exports.default = {
5
5
  ENVIRONMENT_LIST: `${prefix} environment list`,
6
+ GATEWAY_LIST: `${prefix} gateway list`,
6
7
  MANAGEMENTAPP_ADD: `${prefix} managementapp add`,
7
8
  MANAGEMENTAPP_LIST: `${prefix} managementapp list`
8
9
  };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const GraphCommand_1 = require("../../../base/GraphCommand");
4
+ const utils_1 = require("../../../../utils");
5
+ const commands_1 = require("../../commands");
6
+ class SearchExternalConnectionListCommand extends GraphCommand_1.default {
7
+ get name() {
8
+ return commands_1.default.EXTERNALCONNECTION_LIST;
9
+ }
10
+ get description() {
11
+ return 'Lists external connections defined in the Microsoft Search';
12
+ }
13
+ defaultProperties() {
14
+ return ['id', 'name', 'state'];
15
+ }
16
+ commandAction(logger, args, cb) {
17
+ utils_1.odata
18
+ .getAllItems(`${this.resource}/v1.0/external/connections`)
19
+ .then((connections) => {
20
+ logger.log(connections);
21
+ cb();
22
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
23
+ }
24
+ }
25
+ module.exports = new SearchExternalConnectionListCommand();
26
+ //# sourceMappingURL=externalconnection-list.js.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'search';
4
4
  exports.default = {
5
- EXTERNALCONNECTION_ADD: `${prefix} externalconnection add`
5
+ EXTERNALCONNECTION_ADD: `${prefix} externalconnection add`,
6
+ EXTERNALCONNECTION_LIST: `${prefix} externalconnection list`
6
7
  };
7
8
  //# sourceMappingURL=commands.js.map
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoEventreceiverGetCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.EVENTRECEIVER_GET;
10
+ }
11
+ get description() {
12
+ return 'Gets a specific event receiver attached to the web, site or list (if any of the list options are filled in) by receiver name of id';
13
+ }
14
+ getTelemetryProperties(args) {
15
+ const telemetryProps = super.getTelemetryProperties(args);
16
+ telemetryProps.listId = typeof args.options.listId !== 'undefined';
17
+ telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
18
+ telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
19
+ telemetryProps.scope = typeof args.options.scope !== 'undefined';
20
+ telemetryProps.id = typeof args.options.id !== 'undefined';
21
+ telemetryProps.name = typeof args.options.name !== 'undefined';
22
+ return telemetryProps;
23
+ }
24
+ commandAction(logger, args, cb) {
25
+ let requestUrl = `${args.options.webUrl}/_api/`;
26
+ let listUrl = '';
27
+ let filter = '?$filter=';
28
+ if (args.options.listId) {
29
+ listUrl = `lists(guid'${encodeURIComponent(args.options.listId)}')/`;
30
+ }
31
+ else if (args.options.listTitle) {
32
+ listUrl = `lists/getByTitle('${encodeURIComponent(args.options.listTitle)}')/`;
33
+ }
34
+ else if (args.options.listUrl) {
35
+ const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
36
+ listUrl = `GetList('${encodeURIComponent(listServerRelativeUrl)}')/`;
37
+ }
38
+ if (!args.options.scope || args.options.scope === 'web') {
39
+ requestUrl += `web/${listUrl}eventreceivers`;
40
+ }
41
+ else {
42
+ requestUrl += 'site/eventreceivers';
43
+ }
44
+ if (args.options.id) {
45
+ filter += `receiverid eq (guid'${args.options.id}')`;
46
+ }
47
+ else {
48
+ filter += `receivername eq '${args.options.name}'`;
49
+ }
50
+ const requestOptions = {
51
+ url: requestUrl + filter,
52
+ headers: {
53
+ 'accept': 'application/json;odata=nometadata'
54
+ },
55
+ responseType: 'json'
56
+ };
57
+ request_1.default
58
+ .get(requestOptions)
59
+ .then((res) => {
60
+ logger.log(res.value);
61
+ cb();
62
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
63
+ }
64
+ options() {
65
+ const options = [
66
+ {
67
+ option: '-u, --webUrl <webUrl>'
68
+ },
69
+ {
70
+ option: '--listTitle [listTitle]'
71
+ },
72
+ {
73
+ option: '--listId [listId]'
74
+ },
75
+ {
76
+ option: '--listUrl [listUrl]'
77
+ },
78
+ {
79
+ option: '-n, --name [name]'
80
+ },
81
+ {
82
+ option: '-i, --id [id]'
83
+ },
84
+ {
85
+ option: '-s, --scope [scope]',
86
+ autocomplete: ['web', 'site']
87
+ }
88
+ ];
89
+ const parentOptions = super.options();
90
+ return options.concat(parentOptions);
91
+ }
92
+ optionSets() {
93
+ return [
94
+ ['name', 'id']
95
+ ];
96
+ }
97
+ validate(args) {
98
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
99
+ if (isValidSharePointUrl !== true) {
100
+ return isValidSharePointUrl;
101
+ }
102
+ const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
103
+ if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
104
+ return `Specify either list id or title or list url`;
105
+ }
106
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
107
+ return `${args.options.listId} is not a valid GUID`;
108
+ }
109
+ if (args.options.scope && ['web', 'site'].indexOf(args.options.scope) === -1) {
110
+ return `${args.options.scope} is not a valid type value. Allowed values web|site.`;
111
+ }
112
+ if (args.options.scope && args.options.scope === 'site' && (args.options.listId || args.options.listUrl || args.options.listTitle)) {
113
+ return 'Scope cannot be set to site when retrieving list event receivers.';
114
+ }
115
+ return true;
116
+ }
117
+ }
118
+ module.exports = new SpoEventreceiverGetCommand();
119
+ //# sourceMappingURL=eventreceiver-get.js.map