@pnp/cli-microsoft365 5.3.0-beta.d2ec1f4 → 5.3.0-beta.ebb13d0

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 (101) 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 +138 -7
  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/spo/commands/list/list-roleinheritance-break.js +84 -0
  49. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +76 -0
  50. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +83 -0
  51. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +79 -0
  52. package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +49 -0
  53. package/dist/m365/spo/commands.js +5 -0
  54. package/dist/m365/teams/commands/app/app-list.js +1 -1
  55. package/dist/m365/teams/commands/channel/channel-list.js +1 -1
  56. package/dist/m365/teams/commands/channel/channel-member-add.js +4 -1
  57. package/dist/m365/teams/commands/channel/channel-member-list.js +1 -1
  58. package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -0
  59. package/dist/m365/teams/commands/channel/channel-member-set.js +3 -0
  60. package/dist/m365/teams/commands/chat/chat-get.js +8 -8
  61. package/dist/m365/teams/commands/chat/chat-list.js +1 -1
  62. package/dist/m365/teams/commands/chat/chat-member-list.js +1 -1
  63. package/dist/m365/teams/commands/chat/chat-message-list.js +1 -1
  64. package/dist/m365/teams/commands/chat/chat-message-send.js +6 -6
  65. package/dist/m365/teams/commands/chat/chatUtil.js +4 -4
  66. package/dist/m365/teams/commands/message/message-list.js +1 -1
  67. package/dist/m365/teams/commands/message/message-reply-list.js +1 -1
  68. package/dist/m365/teams/commands/tab/tab-list.js +1 -1
  69. package/dist/m365/teams/commands/team/team-list.js +1 -1
  70. package/dist/m365/teams/commands/user/user-app-list.js +1 -1
  71. package/dist/m365/teams/commands/user/user-list.js +2 -2
  72. package/dist/m365/tenant/commands/security/security-alerts-list.js +71 -0
  73. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +1 -1
  74. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +1 -1
  75. package/dist/m365/tenant/commands.js +1 -0
  76. package/dist/m365/todo/commands/list/list-list.js +1 -1
  77. package/dist/m365/todo/commands/task/task-list.js +1 -1
  78. package/dist/utils/accessToken.js +18 -0
  79. package/dist/utils/formatting.js +11 -2
  80. package/dist/utils/odata.js +2 -2
  81. package/dist/utils/planner.js +65 -0
  82. package/docs/docs/cmd/aad/app/app-add.md +15 -0
  83. package/docs/docs/cmd/aad/app/app-set.md +17 -0
  84. package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.md +1 -1
  85. package/docs/docs/cmd/app/app-open.md +45 -0
  86. package/docs/docs/cmd/planner/bucket/bucket-get.md +57 -0
  87. package/docs/docs/cmd/planner/task/task-get.md +30 -3
  88. package/docs/docs/cmd/planner/task/task-reference-add.md +45 -0
  89. package/docs/docs/cmd/planner/task/task-reference-list.md +24 -0
  90. package/docs/docs/cmd/pp/gateway/gateway-list.md +21 -0
  91. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +55 -0
  92. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +36 -0
  93. package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +58 -0
  94. package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +39 -0
  95. package/docs/docs/cmd/spo/roledefinition/roledefinition-list.md +24 -0
  96. package/docs/docs/cmd/spo/userprofile/userprofile-get.md +1 -1
  97. package/docs/docs/cmd/teams/channel/channel-member-list.md +4 -4
  98. package/docs/docs/cmd/teams/channel/channel-member-remove.md +2 -2
  99. package/docs/docs/cmd/teams/channel/channel-member-set.md +2 -2
  100. package/docs/docs/cmd/tenant/security/security-alerts-list.md +30 -0
  101. package/package.json +1 -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,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../../../utils");
3
4
  const request_1 = require("../../../../request");
5
+ const utils_2 = require("../../../../utils");
6
+ const planner_1 = require("../../../../utils/planner");
4
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
5
8
  const commands_1 = require("../../commands");
9
+ const Auth_1 = require("../../../../Auth");
6
10
  class PlannerTaskGetCommand extends GraphCommand_1.default {
7
11
  get name() {
8
12
  return commands_1.default.TASK_GET;
@@ -11,27 +15,154 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
11
15
  return 'Retrieve the the specified planner task';
12
16
  }
13
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
+ }
22
+ this
23
+ .getTaskId(args.options)
24
+ .then(taskId => {
25
+ const requestOptions = {
26
+ url: `${this.resource}/beta/planner/tasks/${encodeURIComponent(taskId)}`,
27
+ headers: {
28
+ accept: 'application/json;odata.metadata=none'
29
+ },
30
+ responseType: 'json'
31
+ };
32
+ return request_1.default.get(requestOptions);
33
+ })
34
+ .then((res) => {
35
+ logger.log(res);
36
+ cb();
37
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
38
+ }
39
+ getTaskId(options) {
40
+ if (options.id) {
41
+ return Promise.resolve(options.id);
42
+ }
43
+ return this
44
+ .getBucketId(options)
45
+ .then(bucketId => {
46
+ const requestOptions = {
47
+ url: `${this.resource}/v1.0/planner/buckets/${bucketId}/tasks?$select=id,title`,
48
+ headers: {
49
+ accept: 'application/json;odata.metadata=none'
50
+ },
51
+ responseType: 'json'
52
+ };
53
+ return request_1.default.get(requestOptions);
54
+ })
55
+ .then((response) => {
56
+ const title = options.title;
57
+ const tasks = response.value.filter(val => { var _a; return ((_a = val.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === title.toLocaleLowerCase(); });
58
+ if (!tasks.length) {
59
+ return Promise.reject(`The specified task ${options.title} does not exist`);
60
+ }
61
+ if (tasks.length > 1) {
62
+ return Promise.reject(`Multiple tasks with title ${options.title} found: ${tasks.map(x => x.id)}`);
63
+ }
64
+ return Promise.resolve(tasks[0].id);
65
+ });
66
+ }
67
+ getBucketId(options) {
68
+ if (options.bucketId) {
69
+ return Promise.resolve(options.bucketId);
70
+ }
71
+ return this
72
+ .getPlanId(options)
73
+ .then(planId => {
74
+ const requestOptions = {
75
+ url: `${this.resource}/v1.0/planner/plans/${planId}/buckets?$select=id,name`,
76
+ headers: {
77
+ accept: 'application/json;odata.metadata=none'
78
+ },
79
+ responseType: 'json'
80
+ };
81
+ return request_1.default.get(requestOptions);
82
+ })
83
+ .then((response) => {
84
+ const bucketName = options.bucketName;
85
+ const buckets = response.value.filter(val => { var _a; return ((_a = val.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === bucketName.toLocaleLowerCase(); });
86
+ if (!buckets.length) {
87
+ return Promise.reject(`The specified bucket ${options.bucketName} does not exist`);
88
+ }
89
+ if (buckets.length > 1) {
90
+ return Promise.reject(`Multiple buckets with name ${options.bucketName} found: ${buckets.map(x => x.id)}`);
91
+ }
92
+ return Promise.resolve(buckets[0].id);
93
+ });
94
+ }
95
+ getPlanId(options) {
96
+ if (options.planId) {
97
+ return Promise.resolve(options.planId);
98
+ }
99
+ return this
100
+ .getGroupId(options)
101
+ .then(groupId => planner_1.planner.getPlanByName(options.planName, groupId))
102
+ .then(plan => plan.id);
103
+ }
104
+ getGroupId(options) {
105
+ if (options.ownerGroupId) {
106
+ return Promise.resolve(options.ownerGroupId);
107
+ }
14
108
  const requestOptions = {
15
- url: `${this.resource}/beta/planner/tasks/${encodeURIComponent(args.options.id)}`,
109
+ url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(options.ownerGroupName)}'&$select=id`,
16
110
  headers: {
17
111
  accept: 'application/json;odata.metadata=none'
18
112
  },
19
113
  responseType: 'json'
20
114
  };
21
- request_1.default
115
+ return request_1.default
22
116
  .get(requestOptions)
23
- .then((res) => {
24
- logger.log(res);
25
- cb();
26
- }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
117
+ .then(response => {
118
+ const groups = response.value;
119
+ if (!groups.length) {
120
+ return Promise.reject(`The specified ownerGroup ${options.ownerGroupName} does not exist`);
121
+ }
122
+ if (groups.length > 1) {
123
+ return Promise.reject(`Multiple ownerGroups with name ${options.ownerGroupName} found: ${groups.map(x => x.id)}`);
124
+ }
125
+ return Promise.resolve(groups[0].id);
126
+ });
27
127
  }
28
128
  options() {
29
129
  const options = [
30
- { option: '-i, --id <id>' }
130
+ { option: '-i, --id [id]' },
131
+ { option: '-t, --title [title]' },
132
+ { option: '--bucketId [bucketId]' },
133
+ { option: '--bucketName [bucketName]' },
134
+ { option: '--planId [planId]' },
135
+ { option: '--planName [planName]' },
136
+ { option: '--ownerGroupId [ownerGroupId]' },
137
+ { option: '--ownerGroupName [ownerGroupName]' }
31
138
  ];
32
139
  const parentOptions = super.options();
33
140
  return options.concat(parentOptions);
34
141
  }
142
+ validate(args) {
143
+ if (args.options.title && !args.options.bucketId && !args.options.bucketName) {
144
+ return 'Specify either bucketId or bucketName when using title';
145
+ }
146
+ if (args.options.title && args.options.bucketId && args.options.bucketName) {
147
+ return 'Specify either bucketId or bucketName when using title but not both';
148
+ }
149
+ if (args.options.bucketName && !args.options.planId && !args.options.planName) {
150
+ return 'Specify either planId or planName when using bucketName';
151
+ }
152
+ if (args.options.bucketName && args.options.planId && args.options.planName) {
153
+ return 'Specify either planId or planName when using bucketName but not both';
154
+ }
155
+ if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
156
+ return 'Specify either ownerGroupId or ownerGroupName when using planName';
157
+ }
158
+ if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
159
+ return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
160
+ }
161
+ if (args.options.ownerGroupId && !utils_2.validation.isValidGuid(args.options.ownerGroupId)) {
162
+ return `${args.options.ownerGroupId} is not a valid GUID`;
163
+ }
164
+ return true;
165
+ }
35
166
  }
36
167
  module.exports = new PlannerTaskGetCommand();
37
168
  //# sourceMappingURL=task-get.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 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
  };