@pnp/cli-microsoft365 5.3.0-beta.24cd8e4 → 5.3.0-beta.2a76d05

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 (81) hide show
  1. package/dist/Auth.js +5 -0
  2. package/dist/m365/aad/commands/app/app-add.js +91 -35
  3. package/dist/m365/aad/commands/app/app-role-list.js +1 -1
  4. package/dist/m365/aad/commands/app/app-set.js +91 -0
  5. package/dist/m365/aad/commands/group/group-list.js +1 -1
  6. package/dist/m365/aad/commands/groupsetting/groupsetting-list.js +1 -1
  7. package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-get.js +1 -1
  8. package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-list.js +1 -1
  9. package/dist/m365/aad/commands/o365group/o365group-conversation-list.js +1 -1
  10. package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +1 -1
  11. package/dist/m365/aad/commands/o365group/o365group-list.js +1 -1
  12. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +3 -3
  13. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-list.js +1 -1
  14. package/dist/m365/aad/commands/o365group/o365group-user-list.js +2 -2
  15. package/dist/m365/aad/commands/o365group/o365group-user-set.js +2 -2
  16. package/dist/m365/aad/commands/user/user-list.js +1 -1
  17. package/dist/m365/aad/commands/user/user-signin-list.js +1 -1
  18. package/dist/m365/base/PowerBICommand.js +10 -0
  19. package/dist/m365/file/commands/file-list.js +1 -1
  20. package/dist/m365/outlook/commands/message/message-list.js +1 -1
  21. package/dist/m365/outlook/commands/room/room-list.js +1 -1
  22. package/dist/m365/outlook/commands/roomlist/roomlist-list.js +1 -1
  23. package/dist/m365/planner/commands/bucket/bucket-add.js +3 -16
  24. package/dist/m365/planner/commands/bucket/bucket-get.js +3 -20
  25. package/dist/m365/planner/commands/bucket/bucket-list.js +4 -18
  26. package/dist/m365/planner/commands/bucket/bucket-remove.js +3 -20
  27. package/dist/m365/planner/commands/bucket/bucket-set.js +3 -20
  28. package/dist/m365/planner/commands/plan/plan-details-get.js +6 -14
  29. package/dist/m365/planner/commands/plan/plan-get.js +8 -18
  30. package/dist/m365/planner/commands/plan/plan-list.js +4 -12
  31. package/dist/m365/planner/commands/task/task-add.js +3 -16
  32. package/dist/m365/planner/commands/task/task-get.js +3 -21
  33. package/dist/m365/planner/commands/task/task-list.js +9 -23
  34. package/dist/m365/planner/commands/task/task-reference-add.js +75 -0
  35. package/dist/m365/planner/commands/task/task-reference-list.js +45 -0
  36. package/dist/m365/planner/commands/task/task-set.js +3 -17
  37. package/dist/m365/planner/commands.js +3 -1
  38. package/dist/m365/pp/commands/gateway/gateway-list.js +36 -0
  39. package/dist/m365/pp/commands/managementapp/managementapp-list.js +1 -1
  40. package/dist/m365/pp/commands.js +1 -0
  41. package/dist/m365/search/commands/externalconnection/externalconnection-list.js +26 -0
  42. package/dist/m365/search/commands.js +2 -1
  43. package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +119 -0
  44. package/dist/m365/spo/commands/list/list-view-add.js +113 -0
  45. package/dist/m365/spo/commands.js +2 -0
  46. package/dist/m365/teams/commands/app/app-list.js +1 -1
  47. package/dist/m365/teams/commands/channel/channel-list.js +1 -1
  48. package/dist/m365/teams/commands/channel/channel-member-add.js +4 -1
  49. package/dist/m365/teams/commands/channel/channel-member-list.js +1 -1
  50. package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -0
  51. package/dist/m365/teams/commands/channel/channel-member-set.js +3 -0
  52. package/dist/m365/teams/commands/chat/chat-get.js +8 -8
  53. package/dist/m365/teams/commands/chat/chat-list.js +1 -1
  54. package/dist/m365/teams/commands/chat/chat-member-list.js +1 -1
  55. package/dist/m365/teams/commands/chat/chat-message-list.js +1 -1
  56. package/dist/m365/teams/commands/chat/chat-message-send.js +6 -6
  57. package/dist/m365/teams/commands/chat/chatUtil.js +4 -4
  58. package/dist/m365/teams/commands/message/message-list.js +1 -1
  59. package/dist/m365/teams/commands/message/message-reply-list.js +1 -1
  60. package/dist/m365/teams/commands/tab/tab-list.js +1 -1
  61. package/dist/m365/teams/commands/team/team-list.js +1 -1
  62. package/dist/m365/teams/commands/user/user-app-list.js +1 -1
  63. package/dist/m365/teams/commands/user/user-list.js +2 -2
  64. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +1 -1
  65. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +1 -1
  66. package/dist/m365/todo/commands/list/list-list.js +1 -1
  67. package/dist/m365/todo/commands/task/task-list.js +1 -1
  68. package/dist/utils/formatting.js +11 -2
  69. package/dist/utils/odata.js +2 -2
  70. package/dist/utils/planner.js +65 -0
  71. package/docs/docs/cmd/aad/app/app-add.md +15 -0
  72. package/docs/docs/cmd/aad/app/app-set.md +17 -0
  73. package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.md +1 -1
  74. package/docs/docs/cmd/planner/task/task-reference-add.md +45 -0
  75. package/docs/docs/cmd/planner/task/task-reference-list.md +24 -0
  76. package/docs/docs/cmd/pp/gateway/gateway-list.md +21 -0
  77. package/docs/docs/cmd/search/externalconnection/externalconnection-list.md +21 -0
  78. package/docs/docs/cmd/spo/eventreceiver/eventreceiver-get.md +70 -0
  79. package/docs/docs/cmd/spo/list/list-view-add.md +67 -0
  80. package/docs/docs/cmd/spo/userprofile/userprofile-get.md +1 -1
  81. package/package.json +2 -1
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("../../../../utils");
4
4
  const request_1 = require("../../../../request");
5
+ const planner_1 = require("../../../../utils/planner");
5
6
  const Auth_1 = require("../../../../Auth");
6
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
8
  const commands_1 = require("../../commands");
@@ -30,7 +31,7 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
30
31
  }
31
32
  this
32
33
  .getPlanId(args)
33
- .then((planId) => utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/buckets`, logger))
34
+ .then((planId) => utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/buckets`))
34
35
  .then((buckets) => {
35
36
  logger.log(buckets);
36
37
  cb();
@@ -42,23 +43,8 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
42
43
  }
43
44
  return this
44
45
  .getGroupId(args)
45
- .then((groupId) => {
46
- const requestOptions = {
47
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
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 plan = response.value.find(val => val.title === args.options.planName);
57
- if (!plan) {
58
- return Promise.reject(`The specified plan does not exist`);
59
- }
60
- return Promise.resolve(plan.id);
61
- });
46
+ .then(groupId => planner_1.planner.getPlanByName(args.options.planName, groupId))
47
+ .then(plan => plan.id);
62
48
  }
63
49
  getGroupId(args) {
64
50
  if (args.options.ownerGroupId) {
@@ -5,6 +5,7 @@ const utils_1 = require("../../../../utils");
5
5
  const request_1 = require("../../../../request");
6
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
7
  const commands_1 = require("../../commands");
8
+ const planner_1 = require("../../../../utils/planner");
8
9
  const Auth_1 = require("../../../../Auth");
9
10
  class PlannerBucketRemoveCommand extends GraphCommand_1.default {
10
11
  get name() {
@@ -105,26 +106,8 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
105
106
  }
106
107
  return this
107
108
  .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(plans => {
119
- const filteredPlans = plans.value.filter(p => p.title.toLowerCase() === planName.toLowerCase());
120
- if (!filteredPlans.length) {
121
- return Promise.reject(`The specified plan ${planName} does not exist`);
122
- }
123
- if (filteredPlans.length > 1) {
124
- return Promise.reject(`Multiple plans with name ${planName} found: ${filteredPlans.map(x => x.id)}`);
125
- }
126
- return Promise.resolve(filteredPlans[0].id);
127
- });
109
+ .then(groupId => planner_1.planner.getPlanByName(planName, groupId))
110
+ .then(plan => plan.id);
128
111
  }
129
112
  getGroupId(args) {
130
113
  const { ownerGroupId, ownerGroupName } = args.options;
@@ -4,6 +4,7 @@ const utils_1 = require("../../../../utils");
4
4
  const GraphCommand_1 = require("../../../base/GraphCommand");
5
5
  const Auth_1 = require("../../../../Auth");
6
6
  const request_1 = require("../../../../request");
7
+ const planner_1 = require("../../../../utils/planner");
7
8
  const commands_1 = require("../../commands");
8
9
  class PlannerBucketSetCommand extends GraphCommand_1.default {
9
10
  get name() {
@@ -93,26 +94,8 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
93
94
  }
94
95
  return this
95
96
  .getGroupId(args)
96
- .then(groupId => {
97
- const requestOptions = {
98
- url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'`,
99
- headers: {
100
- accept: 'application/json;odata.metadata=none'
101
- },
102
- responseType: 'json'
103
- };
104
- return request_1.default.get(requestOptions);
105
- })
106
- .then(plans => {
107
- const filteredPlans = plans.value.filter(p => p.title.toLowerCase() === planName.toLowerCase());
108
- if (filteredPlans.length === 0) {
109
- return Promise.reject(`The specified plan ${planName} does not exist`);
110
- }
111
- if (filteredPlans.length > 1) {
112
- return Promise.reject(`Multiple plans with name ${planName} found: ${filteredPlans.map(x => x.id)}`);
113
- }
114
- return Promise.resolve(filteredPlans[0].id);
115
- });
97
+ .then(groupId => planner_1.planner.getPlanByName(planName, groupId))
98
+ .then(plan => plan.id);
116
99
  }
117
100
  getGroupId(args) {
118
101
  const { ownerGroupId, ownerGroupName } = args.options;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("../../../../utils");
4
4
  const Auth_1 = require("../../../../Auth");
5
5
  const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
6
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
8
  const commands_1 = require("../../commands");
8
9
  class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
@@ -33,7 +34,7 @@ class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
33
34
  .getGroupId(args)
34
35
  .then((groupId) => {
35
36
  this.groupId = groupId;
36
- return this.getPlanId(args, logger);
37
+ return this.getPlanId(args);
37
38
  })
38
39
  .then((planId) => {
39
40
  args.options.planId = planId;
@@ -71,22 +72,13 @@ class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
71
72
  return Promise.resolve(groupItem.id);
72
73
  });
73
74
  }
74
- getPlanId(args, logger) {
75
+ getPlanId(args) {
75
76
  if (args.options.planId) {
76
77
  return Promise.resolve(args.options.planId);
77
78
  }
78
- return utils_1.odata
79
- .getAllItems(`${this.resource}/v1.0/groups/${this.groupId}/planner/plans`, logger)
80
- .then((plans) => {
81
- const plansMatchingName = plans.filter((plan) => plan.title === args.options.planTitle);
82
- if (plansMatchingName && plansMatchingName.length > 0) {
83
- if (plansMatchingName.length > 1) {
84
- return Promise.reject(`Multiple plans with name ${args.options.planTitle} found: ${plansMatchingName.map(x => x.id)}`);
85
- }
86
- return Promise.resolve(plansMatchingName[0].id);
87
- }
88
- return Promise.reject(`The specified plan title does not exist`);
89
- });
79
+ return planner_1.planner
80
+ .getPlanByName(args.options.planTitle, this.groupId)
81
+ .then(plan => plan.id);
90
82
  }
91
83
  getPlanDetails(args) {
92
84
  const requestOptions = {
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const Auth_1 = require("../../../../Auth");
4
3
  const utils_1 = require("../../../../utils");
5
4
  const request_1 = require("../../../../request");
5
+ const planner_1 = require("../../../../utils/planner");
6
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
7
  const commands_1 = require("../../commands");
8
+ const Auth_1 = require("../../../../Auth");
8
9
  class PlannerPlanGetCommand extends GraphCommand_1.default {
9
10
  get name() {
10
11
  return commands_1.default.PLAN_GET;
@@ -29,8 +30,8 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
29
30
  return;
30
31
  }
31
32
  if (args.options.id) {
32
- this
33
- .getPlan(args)
33
+ planner_1.planner
34
+ .getPlanById(args.options.id)
34
35
  .then((res) => {
35
36
  logger.log(res);
36
37
  cb();
@@ -39,11 +40,10 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
39
40
  else {
40
41
  this
41
42
  .getGroupId(args)
42
- .then((groupId) => utils_1.odata.getAllItems(`${this.resource}/v1.0/groups/${groupId}/planner/plans`, logger, 'minimal'))
43
- .then((plans) => {
44
- const filteredPlan = plans.filter((plan) => plan.title === args.options.title);
45
- if (filteredPlan && filteredPlan.length > 0) {
46
- logger.log(filteredPlan);
43
+ .then(groupId => planner_1.planner.getPlanByName(args.options.title, groupId))
44
+ .then((plan) => {
45
+ if (plan) {
46
+ logger.log(plan);
47
47
  }
48
48
  cb();
49
49
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
@@ -70,16 +70,6 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
70
70
  return Promise.resolve(group.id);
71
71
  });
72
72
  }
73
- getPlan(args) {
74
- const requestOptions = {
75
- url: `${this.resource}/v1.0/planner/plans/${args.options.id}`,
76
- headers: {
77
- 'accept': 'application/json'
78
- },
79
- responseType: 'json'
80
- };
81
- return request_1.default.get(requestOptions);
82
- }
83
73
  options() {
84
74
  const options = [
85
75
  {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("../../../../utils");
4
4
  const Auth_1 = require("../../../../Auth");
5
5
  const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
6
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
8
  const commands_1 = require("../../commands");
8
9
  class PlannerPlanListCommand extends GraphCommand_1.default {
@@ -28,19 +29,10 @@ class PlannerPlanListCommand extends GraphCommand_1.default {
28
29
  }
29
30
  this
30
31
  .getGroupId(args)
31
- .then((groupId) => {
32
- const requestOptions = {
33
- url: `${this.resource}/v1.0/groups/${groupId}/planner/plans`,
34
- headers: {
35
- 'accept': 'application/json;odata.metadata=none'
36
- },
37
- responseType: 'json'
38
- };
39
- return request_1.default.get(requestOptions);
40
- })
32
+ .then((groupId) => planner_1.planner.getPlansByGroupId(groupId))
41
33
  .then((res) => {
42
- if (res.value && res.value.length > 0) {
43
- logger.log(res.value);
34
+ if (res && res.length > 0) {
35
+ logger.log(res);
44
36
  }
45
37
  cb();
46
38
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const Auth_1 = require("../../../../Auth");
4
4
  const request_1 = require("../../../../request");
5
+ const planner_1 = require("../../../../utils/planner");
5
6
  const utils_1 = require("../../../../utils");
6
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
8
  const commands_1 = require("../../commands");
@@ -156,22 +157,8 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
156
157
  }
157
158
  return this
158
159
  .getGroupId(args)
159
- .then((groupId) => {
160
- const requestOptions = {
161
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
162
- headers: {
163
- accept: 'application/json;odata.metadata=none'
164
- },
165
- responseType: 'json'
166
- };
167
- return request_1.default.get(requestOptions);
168
- }).then((response) => {
169
- const plan = response.value.find(val => val.title === args.options.planName);
170
- if (!plan) {
171
- return Promise.reject(`The specified plan does not exist`);
172
- }
173
- return Promise.resolve(plan.id);
174
- });
160
+ .then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
161
+ .then(plan => plan.id);
175
162
  }
176
163
  getGroupId(args) {
177
164
  if (args.options.ownerGroupId) {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("../../../../utils");
4
4
  const request_1 = require("../../../../request");
5
5
  const utils_2 = require("../../../../utils");
6
+ const planner_1 = require("../../../../utils/planner");
6
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
8
  const commands_1 = require("../../commands");
8
9
  const Auth_1 = require("../../../../Auth");
@@ -97,27 +98,8 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
97
98
  }
98
99
  return this
99
100
  .getGroupId(options)
100
- .then((groupId) => {
101
- const requestOptions = {
102
- url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'&$select=id,title`,
103
- headers: {
104
- accept: 'application/json;odata.metadata=none'
105
- },
106
- responseType: 'json'
107
- };
108
- return request_1.default.get(requestOptions);
109
- })
110
- .then((response) => {
111
- const planName = options.planName;
112
- const plans = response.value.filter(val => { var _a; return ((_a = val.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === planName.toLocaleLowerCase(); });
113
- if (!plans.length) {
114
- return Promise.reject(`The specified plan ${options.planName} does not exist`);
115
- }
116
- if (plans.length > 1) {
117
- return Promise.reject(`Multiple plans with name ${options.planName} found: ${plans.map(x => x.id)}`);
118
- }
119
- return Promise.resolve(plans[0].id);
120
- });
101
+ .then(groupId => planner_1.planner.getPlanByName(options.planName, groupId))
102
+ .then(plan => plan.id);
121
103
  }
122
104
  getGroupId(options) {
123
105
  if (options.ownerGroupId) {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("../../../../utils");
4
4
  const Auth_1 = require("../../../../Auth");
5
5
  const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
6
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
8
  const commands_1 = require("../../commands");
8
9
  class PlannerTaskListCommand extends GraphCommand_1.default {
@@ -40,11 +41,11 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
40
41
  .getBucketId(args)
41
42
  .then((retrievedBucketId) => {
42
43
  bucketId = retrievedBucketId;
43
- 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`);
44
45
  })
45
46
  .then((tasks) => {
46
47
  taskItems = tasks;
47
- 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`);
48
49
  })
49
50
  .then((betaTasks) => {
50
51
  logger.log(this.mergeTaskPriority(taskItems, betaTasks));
@@ -56,11 +57,11 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
56
57
  .getPlanId(args)
57
58
  .then((retrievedPlanId) => {
58
59
  planId = retrievedPlanId;
59
- 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`);
60
61
  })
61
62
  .then((tasks) => {
62
63
  taskItems = tasks;
63
- 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`);
64
65
  })
65
66
  .then((betaTasks) => {
66
67
  logger.log(this.mergeTaskPriority(taskItems, betaTasks));
@@ -69,10 +70,10 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
69
70
  }
70
71
  else {
71
72
  utils_1.odata
72
- .getAllItems(`${this.resource}/v1.0/me/planner/tasks`, logger)
73
+ .getAllItems(`${this.resource}/v1.0/me/planner/tasks`)
73
74
  .then((tasks) => {
74
75
  taskItems = tasks;
75
- return utils_1.odata.getAllItems(`${this.resource}/beta/me/planner/tasks`, logger);
76
+ return utils_1.odata.getAllItems(`${this.resource}/beta/me/planner/tasks`);
76
77
  })
77
78
  .then((betaTasks) => {
78
79
  logger.log(this.mergeTaskPriority(taskItems, betaTasks));
@@ -110,23 +111,8 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
110
111
  }
111
112
  return this
112
113
  .getGroupId(args)
113
- .then((groupId) => {
114
- const requestOptions = {
115
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
116
- headers: {
117
- accept: 'application/json;odata.metadata=none'
118
- },
119
- responseType: 'json'
120
- };
121
- return request_1.default.get(requestOptions);
122
- })
123
- .then(response => {
124
- const plan = response.value.find(val => val.title === args.options.planName);
125
- if (!plan) {
126
- return Promise.reject(`The specified plan does not exist`);
127
- }
128
- return Promise.resolve(plan.id);
129
- });
114
+ .then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
115
+ .then(plan => plan.id);
130
116
  }
131
117
  getGroupId(args) {
132
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
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("../../../../utils");
4
4
  const Auth_1 = require("../../../../Auth");
5
5
  const request_1 = require("../../../../request");
6
+ const planner_1 = require("../../../../utils/planner");
6
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
8
  const commands_1 = require("../../commands");
8
9
  class PlannerTaskSetCommand extends GraphCommand_1.default {
@@ -222,23 +223,8 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
222
223
  }
223
224
  return this
224
225
  .getGroupId(options)
225
- .then((groupId) => {
226
- const requestOptions = {
227
- url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')&$select=id,title`,
228
- headers: {
229
- accept: 'application/json;odata.metadata=none'
230
- },
231
- responseType: 'json'
232
- };
233
- return request_1.default.get(requestOptions);
234
- })
235
- .then((response) => {
236
- const plan = response.value.find(val => val.title === options.planName);
237
- if (!plan) {
238
- return Promise.reject(`The specified plan does not exist`);
239
- }
240
- return Promise.resolve(plan.id);
241
- });
226
+ .then((groupId) => planner_1.planner.getPlanByName(options.planName, groupId))
227
+ .then(plan => plan.id);
242
228
  }
243
229
  getGroupId(options) {
244
230
  if (options.ownerGroupId) {
@@ -8,13 +8,15 @@ exports.default = {
8
8
  BUCKET_REMOVE: `${prefix} bucket remove`,
9
9
  BUCKET_GET: `${prefix} bucket get`,
10
10
  PLAN_ADD: `${prefix} plan add`,
11
- PLAN_GET: `${prefix} plan get`,
12
11
  PLAN_DETAILS_GET: `${prefix} plan details get`,
12
+ PLAN_GET: `${prefix} plan get`,
13
13
  PLAN_LIST: `${prefix} plan list`,
14
14
  TASK_ADD: `${prefix} task add`,
15
15
  TASK_DETAILS_GET: `${prefix} task details get`,
16
16
  TASK_GET: `${prefix} task get`,
17
17
  TASK_LIST: `${prefix} task list`,
18
+ TASK_REFERENCE_ADD: `${prefix} task reference add`,
19
+ TASK_REFERENCE_LIST: `${prefix} task reference list`,
18
20
  TASK_SET: `${prefix} task set`
19
21
  };
20
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