@pnp/cli-microsoft365 5.0.0-beta.014983c → 5.0.0-beta.1d35279

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 (57) hide show
  1. package/.eslintrc.js +1 -0
  2. package/dist/Command.js +1 -1
  3. package/dist/api.d.ts +11 -0
  4. package/dist/api.js +17 -0
  5. package/dist/cli/Cli.js +19 -4
  6. package/dist/m365/aad/commands/app/app-add.js +43 -7
  7. package/dist/m365/aad/commands/app/app-delete.js +123 -0
  8. package/dist/m365/aad/commands/group/group-list.js +14 -1
  9. package/dist/m365/aad/commands/user/user-list.js +7 -4
  10. package/dist/m365/aad/commands.js +1 -0
  11. package/dist/m365/flow/commands/flow-get.js +2 -2
  12. package/dist/m365/planner/AppliedCategories.js +3 -0
  13. package/dist/m365/planner/commands/task/task-details-get.js +39 -0
  14. package/dist/m365/planner/commands/task/task-get.js +37 -0
  15. package/dist/m365/planner/commands/task/task-list.js +37 -7
  16. package/dist/m365/planner/commands/task/task-set.js +357 -0
  17. package/dist/m365/planner/commands.js +4 -1
  18. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014008_CODE_launch_hostedWorkbench_type.js +62 -0
  19. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.14.0-beta.4.js → upgrade-1.14.0-rc.2.js} +27 -25
  20. package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
  21. package/dist/m365/spo/commands/group/group-user-add.js +64 -13
  22. package/dist/m365/spo/commands/group/group-user-remove.js +100 -0
  23. package/dist/m365/spo/commands/site/site-recyclebinitem-list.js +76 -0
  24. package/dist/m365/spo/commands.js +2 -0
  25. package/dist/m365/teams/commands/app/app-list.js +9 -6
  26. package/dist/m365/teams/commands/chat/chat-message-list.js +60 -0
  27. package/dist/m365/teams/commands/tab/tab-get.js +9 -6
  28. package/dist/m365/teams/commands.js +1 -0
  29. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +57 -0
  30. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +56 -0
  31. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-get.js +39 -0
  32. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +38 -0
  33. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-get.js +51 -0
  34. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +38 -0
  35. package/dist/m365/tenant/commands.js +6 -0
  36. package/docs/docs/cmd/aad/app/app-delete.md +51 -0
  37. package/docs/docs/cmd/aad/group/group-list.md +9 -0
  38. package/docs/docs/cmd/aad/user/user-list.md +9 -0
  39. package/docs/docs/cmd/planner/task/task-details-get.md +24 -0
  40. package/docs/docs/cmd/planner/task/task-get.md +29 -0
  41. package/docs/docs/cmd/planner/task/task-list.md +5 -0
  42. package/docs/docs/cmd/planner/task/task-set.md +99 -0
  43. package/docs/docs/cmd/search/externalconnection/externalconnection-add.md +3 -3
  44. package/docs/docs/cmd/spo/group/group-user-add.md +24 -6
  45. package/docs/docs/cmd/spo/group/group-user-remove.md +39 -0
  46. package/docs/docs/cmd/spo/site/site-recyclebinitem-list.md +40 -0
  47. package/docs/docs/cmd/teams/channel/channel-get.md +1 -1
  48. package/docs/docs/cmd/teams/chat/chat-message-list.md +24 -0
  49. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +33 -0
  50. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +30 -0
  51. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +24 -0
  52. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +34 -0
  53. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.md +28 -0
  54. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +34 -0
  55. package/npm-shrinkwrap.json +808 -770
  56. package/package.json +19 -18
  57. package/dist/m365/base/AadCommand.js +0 -10
package/.eslintrc.js CHANGED
@@ -23,6 +23,7 @@ const dictionary = [
23
23
  'group',
24
24
  'groupify',
25
25
  'guest',
26
+ 'health',
26
27
  'hide',
27
28
  'historical',
28
29
  'home',
package/dist/Command.js CHANGED
@@ -113,7 +113,7 @@ class Command {
113
113
  },
114
114
  {
115
115
  option: '-o, --output [output]',
116
- autocomplete: ['json', 'text']
116
+ autocomplete: ['csv', 'json', 'text']
117
117
  },
118
118
  {
119
119
  option: '--verbose'
package/dist/api.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export interface CommandOutput {
2
+ error?: {
3
+ message: string;
4
+ code?: number;
5
+ }
6
+ stdout: string;
7
+ stderr: string;
8
+ }
9
+
10
+ export declare function executeCommand(commandName: string, options: any): Promise<CommandOutput>;
11
+ export declare function on(eventName: string, listener: (...args: any[]) => void): void;
package/dist/api.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeCommand = void 0;
4
+ const cli_1 = require("./cli");
5
+ const path = require("path");
6
+ function executeCommand(commandName, options, listener) {
7
+ const cli = cli_1.Cli.getInstance();
8
+ cli.commandsFolder = path.join(__dirname, 'm365');
9
+ cli.commands = [];
10
+ cli.loadCommandFromArgs(commandName.split(' '));
11
+ if (cli.commands.length !== 1) {
12
+ return Promise.reject(`Command not found: ${commandName}`);
13
+ }
14
+ return cli_1.Cli.executeCommandWithOutput(cli.commands[0].command, { options: options !== null && options !== void 0 ? options : {} }, listener);
15
+ }
16
+ exports.executeCommand = executeCommand;
17
+ //# sourceMappingURL=api.js.map
package/dist/cli/Cli.js CHANGED
@@ -189,23 +189,38 @@ class Cli {
189
189
  });
190
190
  });
191
191
  }
192
- static executeCommandWithOutput(command, args) {
192
+ static executeCommandWithOutput(command, args, listener) {
193
193
  return new Promise((resolve, reject) => {
194
194
  const log = [];
195
195
  const logErr = [];
196
196
  const logger = {
197
197
  log: (message) => {
198
- log.push(Cli.formatOutput(message, args.options));
198
+ const formattedMessage = Cli.formatOutput(message, args.options);
199
+ if (listener && listener.stdout) {
200
+ listener.stdout(formattedMessage);
201
+ }
202
+ log.push(formattedMessage);
199
203
  },
200
204
  logRaw: (message) => {
201
- log.push(Cli.formatOutput(message, args.options));
205
+ const formattedMessage = Cli.formatOutput(message, args.options);
206
+ if (listener && listener.stdout) {
207
+ listener.stdout(formattedMessage);
208
+ }
209
+ log.push(formattedMessage);
202
210
  },
203
211
  logToStderr: (message) => {
212
+ if (listener && listener.stderr) {
213
+ listener.stderr(message);
214
+ }
204
215
  logErr.push(message);
205
216
  }
206
217
  };
207
218
  if (args.options.debug) {
208
- logErr.push(`Executing command ${command.name} with options ${JSON.stringify(args)}`);
219
+ const message = `Executing command ${command.name} with options ${JSON.stringify(args)}`;
220
+ if (listener && listener.stderr) {
221
+ listener.stderr(message);
222
+ }
223
+ logErr.push(message);
209
224
  }
210
225
  // store the current command name, if any and set the name to the name of
211
226
  // the command to execute
@@ -105,21 +105,49 @@ class AadAppAddCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
105
105
  if (!args.options.manifest) {
106
106
  return Promise.resolve(appInfo);
107
107
  }
108
- const manifest = JSON.parse(args.options.manifest);
108
+ const v2Manifest = JSON.parse(args.options.manifest);
109
109
  // remove properties that might be coming from the original app that was
110
110
  // used to create the manifest and which can't be updated
111
- delete manifest.id;
112
- delete manifest.appId;
113
- delete manifest.publisherDomain;
111
+ delete v2Manifest.id;
112
+ delete v2Manifest.appId;
113
+ delete v2Manifest.publisherDomain;
114
114
  // Azure Portal returns v2 manifest whereas the Graph API expects a v1.6
115
- const transformedManifest = this.transformManifest(manifest);
115
+ const graphManifest = this.transformManifest(v2Manifest);
116
116
  const updateAppRequestOptions = {
117
117
  url: `${this.resource}/v1.0/myorganization/applications/${appInfo.id}`,
118
118
  headers: {
119
119
  'content-type': 'application/json'
120
120
  },
121
121
  responseType: 'json',
122
- data: transformedManifest
122
+ data: graphManifest
123
+ };
124
+ return request_1.default
125
+ .patch(updateAppRequestOptions)
126
+ .then(_ => this.updatePreAuthorizedAppsFromManifest(v2Manifest, appInfo))
127
+ .then(_ => Promise.resolve(appInfo));
128
+ }
129
+ updatePreAuthorizedAppsFromManifest(manifest, appInfo) {
130
+ if (!manifest ||
131
+ !manifest.preAuthorizedApplications ||
132
+ manifest.preAuthorizedApplications.length === 0) {
133
+ return Promise.resolve(appInfo);
134
+ }
135
+ const graphManifest = {
136
+ api: {
137
+ preAuthorizedApplications: manifest.preAuthorizedApplications
138
+ }
139
+ };
140
+ graphManifest.api.preAuthorizedApplications.forEach((p) => {
141
+ p.delegatedPermissionIds = p.permissionIds;
142
+ delete p.permissionIds;
143
+ });
144
+ const updateAppRequestOptions = {
145
+ url: `${this.resource}/v1.0/myorganization/applications/${appInfo.id}`,
146
+ headers: {
147
+ 'content-type': 'application/json'
148
+ },
149
+ responseType: 'json',
150
+ data: graphManifest
123
151
  };
124
152
  return request_1.default
125
153
  .patch(updateAppRequestOptions)
@@ -180,8 +208,16 @@ class AadAppAddCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
180
208
  delete graphManifest.oauth2AllowIdTokenImplicitFlow;
181
209
  graphManifest.api.oauth2PermissionScopes = v2Manifest.oauth2Permissions;
182
210
  delete graphManifest.oauth2Permissions;
211
+ if (graphManifest.api.oauth2PermissionScopes) {
212
+ graphManifest.api.oauth2PermissionScopes.forEach((scope) => {
213
+ delete scope.lang;
214
+ delete scope.origin;
215
+ });
216
+ }
183
217
  delete graphManifest.oauth2RequiredPostResponse;
184
- graphManifest.api.preAuthorizedApplications = v2Manifest.preAuthorizedApplications;
218
+ // MS Graph doesn't support creating OAuth2 permissions and pre-authorized
219
+ // apps in one request. This is why we need to remove it here and do it in
220
+ // the next request
185
221
  delete graphManifest.preAuthorizedApplications;
186
222
  if (v2Manifest.replyUrlsWithType) {
187
223
  v2Manifest.replyUrlsWithType.forEach((urlWithType) => {
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_1 = require("../../../../cli");
4
+ const request_1 = require("../../../../request");
5
+ const Utils_1 = require("../../../../Utils");
6
+ const GraphCommand_1 = require("../../../base/GraphCommand");
7
+ const commands_1 = require("../../commands");
8
+ class AadAppDeleteCommand extends GraphCommand_1.default {
9
+ get name() {
10
+ return commands_1.default.APP_DELETE;
11
+ }
12
+ get description() {
13
+ return 'Removes an Azure AD app registration';
14
+ }
15
+ getTelemetryProperties(args) {
16
+ const telemetryProps = super.getTelemetryProperties(args);
17
+ telemetryProps.appId = typeof args.options.appId !== 'undefined';
18
+ telemetryProps.objectId = typeof args.options.objectId !== 'undefined';
19
+ telemetryProps.name = typeof args.options.name !== 'undefined';
20
+ telemetryProps.confirm = (!(!args.options.confirm)).toString();
21
+ return telemetryProps;
22
+ }
23
+ commandAction(logger, args, cb) {
24
+ const deleteApp = () => {
25
+ this
26
+ .getObjectId(args, logger)
27
+ .then((objectId) => {
28
+ if (this.verbose) {
29
+ logger.logToStderr(`Deleting Azure AD app ${objectId}...`);
30
+ }
31
+ const requestOptions = {
32
+ url: `${this.resource}/v1.0/myorganization/applications/${objectId}`,
33
+ headers: {
34
+ accept: 'application/json;odata.metadata=none'
35
+ },
36
+ responseType: 'json'
37
+ };
38
+ return request_1.default.delete(requestOptions);
39
+ })
40
+ .then(_ => cb(), (rawRes) => this.handleRejectedODataJsonPromise(rawRes, logger, cb));
41
+ };
42
+ if (args.options.confirm) {
43
+ deleteApp();
44
+ }
45
+ else {
46
+ cli_1.Cli.prompt({
47
+ type: 'confirm',
48
+ name: 'continue',
49
+ default: false,
50
+ message: `Are you sure you want to delete the App?`
51
+ }, (result) => {
52
+ if (!result.continue) {
53
+ cb();
54
+ }
55
+ else {
56
+ deleteApp();
57
+ }
58
+ });
59
+ }
60
+ }
61
+ getObjectId(args, logger) {
62
+ if (args.options.objectId) {
63
+ return Promise.resolve(args.options.objectId);
64
+ }
65
+ const { appId, name } = args.options;
66
+ if (this.verbose) {
67
+ logger.logToStderr(`Retrieving information about Azure AD app ${appId ? appId : name}...`);
68
+ }
69
+ const filter = appId ?
70
+ `appId eq '${encodeURIComponent(appId)}'` :
71
+ `displayName eq '${encodeURIComponent(name)}'`;
72
+ const requestOptions = {
73
+ url: `${this.resource}/v1.0/myorganization/applications?$filter=${filter}&$select=id`,
74
+ headers: {
75
+ accept: 'application/json;odata.metadata=none'
76
+ },
77
+ responseType: 'json'
78
+ };
79
+ return request_1.default
80
+ .get(requestOptions)
81
+ .then((res) => {
82
+ if (res.value.length === 1) {
83
+ return Promise.resolve(res.value[0].id);
84
+ }
85
+ if (res.value.length === 0) {
86
+ const applicationIdentifier = appId ? `ID ${appId}` : `name ${name}`;
87
+ return Promise.reject(`No Azure AD application registration with ${applicationIdentifier} found`);
88
+ }
89
+ return Promise.reject(`Multiple Azure AD application registration with name ${name} found. Please choose one of the object IDs: ${res.value.map(a => a.id).join(', ')}`);
90
+ });
91
+ }
92
+ options() {
93
+ const options = [
94
+ { option: '--appId [appId]' },
95
+ { option: '--objectId [objectId]' },
96
+ { option: '--name [name]' },
97
+ { option: '--confirm' }
98
+ ];
99
+ const parentOptions = super.options();
100
+ return options.concat(parentOptions);
101
+ }
102
+ validate(args) {
103
+ if (!args.options.appId &&
104
+ !args.options.objectId &&
105
+ !args.options.name) {
106
+ return 'Specify either appId, objectId, or name';
107
+ }
108
+ if ((args.options.appId && args.options.objectId) ||
109
+ (args.options.appId && args.options.name) ||
110
+ (args.options.objectId && args.options.name)) {
111
+ return 'Specify either appId, objectId, or name';
112
+ }
113
+ if (args.options.appId && !Utils_1.default.isValidGuid(args.options.appId)) {
114
+ return `${args.options.appId} is not a valid GUID`;
115
+ }
116
+ if (args.options.objectId && !Utils_1.default.isValidGuid(args.options.objectId)) {
117
+ return `${args.options.objectId} is not a valid GUID`;
118
+ }
119
+ return true;
120
+ }
121
+ }
122
+ module.exports = new AadAppDeleteCommand();
123
+ //# sourceMappingURL=app-delete.js.map
@@ -9,12 +9,18 @@ class AadGroupListCommand extends GraphItemsListCommand_1.GraphItemsListCommand
9
9
  get description() {
10
10
  return 'Lists all groups defined in Azure Active Directory.';
11
11
  }
12
+ getTelemetryProperties(args) {
13
+ const telemetryProps = super.getTelemetryProperties(args);
14
+ telemetryProps.deleted = args.options.deleted;
15
+ return telemetryProps;
16
+ }
12
17
  defaultProperties() {
13
18
  return ['id', 'displayName', 'groupType'];
14
19
  }
15
20
  commandAction(logger, args, cb) {
21
+ const endpoint = args.options.deleted ? 'directory/deletedItems/microsoft.graph.group' : 'groups';
16
22
  this
17
- .getAllItems(`${this.resource}/v1.0/groups`, logger, true)
23
+ .getAllItems(`${this.resource}/v1.0/${endpoint}`, logger, true)
18
24
  .then(() => {
19
25
  if (args.options.output === 'text') {
20
26
  this.items.forEach((group) => {
@@ -36,6 +42,13 @@ class AadGroupListCommand extends GraphItemsListCommand_1.GraphItemsListCommand
36
42
  cb();
37
43
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
38
44
  }
45
+ options() {
46
+ const options = [
47
+ { option: '-d, --deleted' }
48
+ ];
49
+ const parentOptions = super.options();
50
+ return options.concat(parentOptions);
51
+ }
39
52
  }
40
53
  module.exports = new AadGroupListCommand();
41
54
  //# sourceMappingURL=group-list.js.map
@@ -15,6 +15,7 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
15
15
  getTelemetryProperties(args) {
16
16
  const telemetryProps = super.getTelemetryProperties(args);
17
17
  telemetryProps.properties = args.options.properties;
18
+ telemetryProps.deleted = typeof args.options.deleted !== 'undefined';
18
19
  return telemetryProps;
19
20
  }
20
21
  commandAction(logger, args, cb) {
@@ -22,7 +23,8 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
22
23
  args.options.properties.split(',').map(p => p.trim()) :
23
24
  ['userPrincipalName', 'displayName'];
24
25
  const filter = this.getFilter(args.options);
25
- const url = `${this.resource}/v1.0/users?$select=${properties.join(',')}${(filter.length > 0 ? '&' + filter : '')}&$top=100`;
26
+ const endpoint = args.options.deleted ? 'directory/deletedItems/microsoft.graph.user' : 'users';
27
+ const url = `${this.resource}/v1.0/${endpoint}?$select=${properties.join(',')}${(filter.length > 0 ? '&' + filter : '')}&$top=100`;
26
28
  this
27
29
  .getAllItems(url, logger, true)
28
30
  .then(() => {
@@ -35,6 +37,8 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
35
37
  const excludeOptions = [
36
38
  'properties',
37
39
  'p',
40
+ 'deleted',
41
+ 'd',
38
42
  'debug',
39
43
  'verbose',
40
44
  'output',
@@ -55,9 +59,8 @@ class AadUserListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
55
59
  }
56
60
  options() {
57
61
  const options = [
58
- {
59
- option: '-p, --properties [properties]'
60
- }
62
+ { option: '-p, --properties [properties]' },
63
+ { option: '-d, --deleted' }
61
64
  ];
62
65
  const parentOptions = super.options();
63
66
  return options.concat(parentOptions);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'aad';
4
4
  exports.default = {
5
5
  APP_ADD: `${prefix} app add`,
6
+ APP_DELETE: `${prefix} app delete`,
6
7
  APP_GET: `${prefix} app get`,
7
8
  APP_SET: `${prefix} app set`,
8
9
  APP_ROLE_ADD: `${prefix} app role add`,
@@ -29,8 +29,8 @@ class FlowGetCommand extends AzmgmtCommand_1.default {
29
29
  .then((res) => {
30
30
  res.displayName = res.properties.displayName;
31
31
  res.description = res.properties.definitionSummary.description || '';
32
- res.triggers = Object.keys(res.properties.definition.triggers).join(', ');
33
- res.actions = Object.keys(res.properties.definition.actions).join(', ');
32
+ res.triggers = res.properties.definitionSummary.triggers.map((t) => (t.type + (t.kind ? "-" + t.kind : ''))).join(', ');
33
+ res.actions = res.properties.definitionSummary.actions.map((a) => (a.type + (a.swaggerOperationId ? "-" + a.swaggerOperationId : ''))).join(', ');
34
34
  logger.log(res);
35
35
  cb();
36
36
  }, (rawRes) => this.handleRejectedODataJsonPromise(rawRes, logger, cb));
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=AppliedCategories.js.map
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
5
+ const commands_1 = require("../../commands");
6
+ class PlannerTaskDetailsGetCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
7
+ get name() {
8
+ return commands_1.default.TASK_DETAILS_GET;
9
+ }
10
+ get description() {
11
+ return 'Retrieve the details of the specified planner task';
12
+ }
13
+ commandAction(logger, args, cb) {
14
+ const requestOptions = {
15
+ url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details`,
16
+ headers: {
17
+ accept: 'application/json;odata.metadata=none'
18
+ },
19
+ responseType: 'json'
20
+ };
21
+ request_1.default
22
+ .get(requestOptions)
23
+ .then((res) => {
24
+ logger.log(res);
25
+ cb();
26
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
27
+ }
28
+ options() {
29
+ const options = [
30
+ {
31
+ option: '-i, --taskId <taskId>'
32
+ }
33
+ ];
34
+ const parentOptions = super.options();
35
+ return options.concat(parentOptions);
36
+ }
37
+ }
38
+ module.exports = new PlannerTaskDetailsGetCommand();
39
+ //# sourceMappingURL=task-details-get.js.map
@@ -0,0 +1,37 @@
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
+ class PlannerTaskGetCommand extends GraphCommand_1.default {
7
+ get name() {
8
+ return commands_1.default.TASK_GET;
9
+ }
10
+ get description() {
11
+ return 'Retrieve the the specified planner task';
12
+ }
13
+ commandAction(logger, args, cb) {
14
+ const requestOptions = {
15
+ url: `${this.resource}/beta/planner/tasks/${encodeURIComponent(args.options.id)}`,
16
+ headers: {
17
+ accept: 'application/json;odata.metadata=none'
18
+ },
19
+ responseType: 'json'
20
+ };
21
+ request_1.default
22
+ .get(requestOptions)
23
+ .then((res) => {
24
+ logger.log(res);
25
+ cb();
26
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
27
+ }
28
+ options() {
29
+ const options = [
30
+ { option: '-i, --id <id>' }
31
+ ];
32
+ const parentOptions = super.options();
33
+ return options.concat(parentOptions);
34
+ }
35
+ }
36
+ module.exports = new PlannerTaskGetCommand();
37
+ //# sourceMappingURL=task-get.js.map
@@ -25,25 +25,40 @@ class PlannerTaskListCommand extends GraphItemsListCommand_1.GraphItemsListComma
25
25
  return ['id', 'title', 'startDateTime', 'dueDateTime', 'completedDateTime'];
26
26
  }
27
27
  commandAction(logger, args, cb) {
28
- const bucketId = args.options.bucketId;
29
28
  const bucketName = args.options.bucketName;
30
- const planId = args.options.planId;
29
+ let bucketId = args.options.bucketId;
31
30
  const planName = args.options.planName;
31
+ let planId = args.options.planId;
32
+ let taskItems = [];
32
33
  if (bucketId || bucketName) {
33
34
  this
34
35
  .getBucketId(args)
35
- .then((bucketId) => this.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks`, logger, true))
36
+ .then((retrievedBucketId) => {
37
+ bucketId = retrievedBucketId;
38
+ return this.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks`, logger, true);
39
+ })
36
40
  .then(() => {
37
- logger.log(this.items);
41
+ taskItems = this.items;
42
+ return this.getAllItems(`${this.resource}/beta/planner/buckets/${bucketId}/tasks`, logger, true);
43
+ })
44
+ .then(() => {
45
+ logger.log(this.mergeTaskPriority(taskItems, this.items));
38
46
  cb();
39
47
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
40
48
  }
41
49
  else if (planId || planName) {
42
50
  this
43
51
  .getPlanId(args)
44
- .then((planId) => this.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/tasks`, logger, true))
52
+ .then((retrievedPlanId) => {
53
+ planId = retrievedPlanId;
54
+ return this.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/tasks`, logger, true);
55
+ })
56
+ .then(() => {
57
+ taskItems = this.items;
58
+ return this.getAllItems(`${this.resource}/beta/planner/plans/${planId}/tasks`, logger, true);
59
+ })
45
60
  .then(() => {
46
- logger.log(this.items);
61
+ logger.log(this.mergeTaskPriority(taskItems, this.items));
47
62
  cb();
48
63
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
49
64
  }
@@ -51,7 +66,11 @@ class PlannerTaskListCommand extends GraphItemsListCommand_1.GraphItemsListComma
51
66
  this
52
67
  .getAllItems(`${this.resource}/v1.0/me/planner/tasks`, logger, true)
53
68
  .then(() => {
54
- logger.log(this.items);
69
+ taskItems = this.items;
70
+ return this.getAllItems(`${this.resource}/beta/me/planner/tasks`, logger, true);
71
+ })
72
+ .then(() => {
73
+ logger.log(this.mergeTaskPriority(taskItems, this.items));
55
74
  cb();
56
75
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
57
76
  }
@@ -125,6 +144,17 @@ class PlannerTaskListCommand extends GraphItemsListCommand_1.GraphItemsListComma
125
144
  return Promise.resolve(group.id);
126
145
  });
127
146
  }
147
+ mergeTaskPriority(taskItems, betaTaskItems) {
148
+ const findBetaTask = (id) => betaTaskItems.find(task => task.id === id);
149
+ taskItems.forEach(task => {
150
+ const betaTaskItem = findBetaTask(task.id);
151
+ if (betaTaskItem) {
152
+ const { priority } = betaTaskItem;
153
+ Object.assign(task, { priority });
154
+ }
155
+ });
156
+ return taskItems;
157
+ }
128
158
  options() {
129
159
  const options = [
130
160
  {