@pnp/cli-microsoft365 5.0.0-beta.a1bb50f → 5.0.0-beta.a6d30c1

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 (50) hide show
  1. package/.eslintrc.js +1 -0
  2. package/dist/Utils.js +4 -0
  3. package/dist/cli/Cli.js +7 -9
  4. package/dist/m365/aad/commands/user/user-hibp.js +67 -0
  5. package/dist/m365/aad/commands/user/user-list.js +7 -4
  6. package/dist/m365/aad/commands.js +1 -0
  7. package/dist/m365/cli/commands/config/config-set.js +4 -1
  8. package/dist/m365/flow/commands/flow-get.js +2 -2
  9. package/dist/m365/planner/AppliedCategories.js +3 -0
  10. package/dist/m365/planner/commands/task/task-details-get.js +39 -0
  11. package/dist/m365/planner/commands/task/task-get.js +37 -0
  12. package/dist/m365/planner/commands/task/task-set.js +357 -0
  13. package/dist/m365/planner/commands.js +4 -1
  14. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014008_CODE_launch_hostedWorkbench_type.js +62 -0
  15. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.14.0-beta.4.js → upgrade-1.14.0-beta.5.js} +27 -25
  16. package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
  17. package/dist/m365/spo/commands/group/group-user-add.js +64 -13
  18. package/dist/m365/spo/commands/site/site-recyclebinitem-list.js +76 -0
  19. package/dist/m365/spo/commands.js +1 -0
  20. package/dist/m365/teams/commands/app/app-list.js +9 -6
  21. package/dist/m365/teams/commands/chat/chat-list.js +43 -0
  22. package/dist/m365/teams/commands/chat/chat-member-list.js +42 -0
  23. package/dist/m365/teams/commands/chat/chat-message-list.js +60 -0
  24. package/dist/m365/teams/commands/tab/tab-get.js +9 -6
  25. package/dist/m365/teams/commands.js +3 -0
  26. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +57 -0
  27. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +56 -0
  28. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-get.js +39 -0
  29. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +38 -0
  30. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-get.js +51 -0
  31. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +38 -0
  32. package/dist/m365/tenant/commands.js +6 -0
  33. package/dist/settingsNames.js +6 -1
  34. package/docs/docs/cmd/aad/user/user-hibp.md +46 -0
  35. package/docs/docs/cmd/aad/user/user-list.md +9 -0
  36. package/docs/docs/cmd/planner/task/task-details-get.md +24 -0
  37. package/docs/docs/cmd/planner/task/task-get.md +24 -0
  38. package/docs/docs/cmd/planner/task/task-set.md +99 -0
  39. package/docs/docs/cmd/spo/group/group-user-add.md +24 -6
  40. package/docs/docs/cmd/spo/site/site-recyclebinitem-list.md +40 -0
  41. package/docs/docs/cmd/teams/chat/chat-list.md +30 -0
  42. package/docs/docs/cmd/teams/chat/chat-member-list.md +24 -0
  43. package/docs/docs/cmd/teams/chat/chat-message-list.md +24 -0
  44. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +33 -0
  45. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +30 -0
  46. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +24 -0
  47. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +34 -0
  48. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.md +28 -0
  49. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +34 -0
  50. package/package.json +2 -1
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FN014008_CODE_launch_hostedWorkbench_type = void 0;
4
+ const path = require("path");
5
+ const JsonRule_1 = require("./JsonRule");
6
+ class FN014008_CODE_launch_hostedWorkbench_type extends JsonRule_1.JsonRule {
7
+ constructor(type) {
8
+ super();
9
+ this.type = type;
10
+ }
11
+ get id() {
12
+ return 'FN014008';
13
+ }
14
+ get title() {
15
+ return 'Hosted workbench type in .vscode/launch.json';
16
+ }
17
+ get description() {
18
+ return `In the .vscode/launch.json file, update the type property for the hosted workbench launch configuration`;
19
+ }
20
+ get resolution() {
21
+ return `{
22
+ "configurations": [
23
+ {
24
+ "type": "${this.type}"
25
+ }
26
+ ]
27
+ }`;
28
+ }
29
+ get resolutionType() {
30
+ return 'json';
31
+ }
32
+ get severity() {
33
+ return 'Recommended';
34
+ }
35
+ get file() {
36
+ return '.vscode/launch.json';
37
+ }
38
+ visit(project, findings) {
39
+ if (!project.vsCode ||
40
+ !project.vsCode.launchJson ||
41
+ !project.vsCode.launchJson.configurations) {
42
+ return;
43
+ }
44
+ const occurrences = [];
45
+ project.vsCode.launchJson.configurations.forEach((configuration, i) => {
46
+ if (configuration.name === 'Hosted workbench' &&
47
+ configuration.type !== this.type) {
48
+ const node = this.getAstNodeFromFile(project.vsCode.launchJson, `configurations[${i}].url`);
49
+ occurrences.push({
50
+ file: path.relative(project.path, this.file),
51
+ resolution: this.resolution,
52
+ position: this.getPositionFromNode(node)
53
+ });
54
+ }
55
+ });
56
+ if (occurrences.length > 0) {
57
+ this.addFindingWithOccurrences(occurrences, findings);
58
+ }
59
+ }
60
+ }
61
+ exports.FN014008_CODE_launch_hostedWorkbench_type = FN014008_CODE_launch_hostedWorkbench_type;
62
+ //# sourceMappingURL=FN014008_CODE_launch_hostedWorkbench_type.js.map
@@ -26,32 +26,34 @@ const FN006004_CFG_PS_developer_1 = require("./rules/FN006004_CFG_PS_developer")
26
26
  const FN006005_CFG_PS_metadata_1 = require("./rules/FN006005_CFG_PS_metadata");
27
27
  const FN006006_CFG_PS_features_1 = require("./rules/FN006006_CFG_PS_features");
28
28
  const FN010001_YORC_version_1 = require("./rules/FN010001_YORC_version");
29
+ const FN014008_CODE_launch_hostedWorkbench_type_1 = require("./rules/FN014008_CODE_launch_hostedWorkbench_type");
29
30
  module.exports = [
30
- new FN001001_DEP_microsoft_sp_core_library_1.FN001001_DEP_microsoft_sp_core_library('1.14.0-beta.4'),
31
- new FN001002_DEP_microsoft_sp_lodash_subset_1.FN001002_DEP_microsoft_sp_lodash_subset('1.14.0-beta.4'),
32
- new FN001003_DEP_microsoft_sp_office_ui_fabric_core_1.FN001003_DEP_microsoft_sp_office_ui_fabric_core('1.14.0-beta.4'),
33
- new FN001004_DEP_microsoft_sp_webpart_base_1.FN001004_DEP_microsoft_sp_webpart_base('1.14.0-beta.4'),
34
- new FN001011_DEP_microsoft_sp_dialog_1.FN001011_DEP_microsoft_sp_dialog('1.14.0-beta.4'),
35
- new FN001012_DEP_microsoft_sp_application_base_1.FN001012_DEP_microsoft_sp_application_base('1.14.0-beta.4'),
36
- new FN001013_DEP_microsoft_decorators_1.FN001013_DEP_microsoft_decorators('1.14.0-beta.4'),
37
- new FN001014_DEP_microsoft_sp_listview_extensibility_1.FN001014_DEP_microsoft_sp_listview_extensibility('1.14.0-beta.4'),
38
- new FN001021_DEP_microsoft_sp_property_pane_1.FN001021_DEP_microsoft_sp_property_pane('1.14.0-beta.4'),
39
- new FN001023_DEP_microsoft_sp_component_base_1.FN001023_DEP_microsoft_sp_component_base('1.14.0-beta.4'),
40
- new FN001024_DEP_microsoft_sp_diagnostics_1.FN001024_DEP_microsoft_sp_diagnostics('1.14.0-beta.4'),
41
- new FN001025_DEP_microsoft_sp_dynamic_data_1.FN001025_DEP_microsoft_sp_dynamic_data('1.14.0-beta.4'),
42
- new FN001026_DEP_microsoft_sp_extension_base_1.FN001026_DEP_microsoft_sp_extension_base('1.14.0-beta.4'),
43
- new FN001027_DEP_microsoft_sp_http_1.FN001027_DEP_microsoft_sp_http('1.14.0-beta.4'),
44
- new FN001028_DEP_microsoft_sp_list_subscription_1.FN001028_DEP_microsoft_sp_list_subscription('1.14.0-beta.4'),
45
- new FN001029_DEP_microsoft_sp_loader_1.FN001029_DEP_microsoft_sp_loader('1.14.0-beta.4'),
46
- new FN001030_DEP_microsoft_sp_module_interfaces_1.FN001030_DEP_microsoft_sp_module_interfaces('1.14.0-beta.4'),
47
- new FN001031_DEP_microsoft_sp_odata_types_1.FN001031_DEP_microsoft_sp_odata_types('1.14.0-beta.4'),
48
- new FN001032_DEP_microsoft_sp_page_context_1.FN001032_DEP_microsoft_sp_page_context('1.14.0-beta.4'),
49
- new FN002001_DEVDEP_microsoft_sp_build_web_1.FN002001_DEVDEP_microsoft_sp_build_web('1.14.0-beta.4'),
50
- new FN002002_DEVDEP_microsoft_sp_module_interfaces_1.FN002002_DEVDEP_microsoft_sp_module_interfaces('1.14.0-beta.4'),
51
- new FN002009_DEVDEP_microsoft_sp_tslint_rules_1.FN002009_DEVDEP_microsoft_sp_tslint_rules('1.14.0-beta.4'),
52
- new FN006004_CFG_PS_developer_1.FN006004_CFG_PS_developer('1.14.0-beta.4'),
31
+ new FN001001_DEP_microsoft_sp_core_library_1.FN001001_DEP_microsoft_sp_core_library('1.14.0-beta.5'),
32
+ new FN001002_DEP_microsoft_sp_lodash_subset_1.FN001002_DEP_microsoft_sp_lodash_subset('1.14.0-beta.5'),
33
+ new FN001003_DEP_microsoft_sp_office_ui_fabric_core_1.FN001003_DEP_microsoft_sp_office_ui_fabric_core('1.14.0-beta.5'),
34
+ new FN001004_DEP_microsoft_sp_webpart_base_1.FN001004_DEP_microsoft_sp_webpart_base('1.14.0-beta.5'),
35
+ new FN001011_DEP_microsoft_sp_dialog_1.FN001011_DEP_microsoft_sp_dialog('1.14.0-beta.5'),
36
+ new FN001012_DEP_microsoft_sp_application_base_1.FN001012_DEP_microsoft_sp_application_base('1.14.0-beta.5'),
37
+ new FN001013_DEP_microsoft_decorators_1.FN001013_DEP_microsoft_decorators('1.14.0-beta.5'),
38
+ new FN001014_DEP_microsoft_sp_listview_extensibility_1.FN001014_DEP_microsoft_sp_listview_extensibility('1.14.0-beta.5'),
39
+ new FN001021_DEP_microsoft_sp_property_pane_1.FN001021_DEP_microsoft_sp_property_pane('1.14.0-beta.5'),
40
+ new FN001023_DEP_microsoft_sp_component_base_1.FN001023_DEP_microsoft_sp_component_base('1.14.0-beta.5'),
41
+ new FN001024_DEP_microsoft_sp_diagnostics_1.FN001024_DEP_microsoft_sp_diagnostics('1.14.0-beta.5'),
42
+ new FN001025_DEP_microsoft_sp_dynamic_data_1.FN001025_DEP_microsoft_sp_dynamic_data('1.14.0-beta.5'),
43
+ new FN001026_DEP_microsoft_sp_extension_base_1.FN001026_DEP_microsoft_sp_extension_base('1.14.0-beta.5'),
44
+ new FN001027_DEP_microsoft_sp_http_1.FN001027_DEP_microsoft_sp_http('1.14.0-beta.5'),
45
+ new FN001028_DEP_microsoft_sp_list_subscription_1.FN001028_DEP_microsoft_sp_list_subscription('1.14.0-beta.5'),
46
+ new FN001029_DEP_microsoft_sp_loader_1.FN001029_DEP_microsoft_sp_loader('1.14.0-beta.5'),
47
+ new FN001030_DEP_microsoft_sp_module_interfaces_1.FN001030_DEP_microsoft_sp_module_interfaces('1.14.0-beta.5'),
48
+ new FN001031_DEP_microsoft_sp_odata_types_1.FN001031_DEP_microsoft_sp_odata_types('1.14.0-beta.5'),
49
+ new FN001032_DEP_microsoft_sp_page_context_1.FN001032_DEP_microsoft_sp_page_context('1.14.0-beta.5'),
50
+ new FN002001_DEVDEP_microsoft_sp_build_web_1.FN002001_DEVDEP_microsoft_sp_build_web('1.14.0-beta.5'),
51
+ new FN002002_DEVDEP_microsoft_sp_module_interfaces_1.FN002002_DEVDEP_microsoft_sp_module_interfaces('1.14.0-beta.5'),
52
+ new FN002009_DEVDEP_microsoft_sp_tslint_rules_1.FN002009_DEVDEP_microsoft_sp_tslint_rules('1.14.0-beta.5'),
53
+ new FN006004_CFG_PS_developer_1.FN006004_CFG_PS_developer('1.14.0-beta.5'),
53
54
  new FN006005_CFG_PS_metadata_1.FN006005_CFG_PS_metadata(),
54
55
  new FN006006_CFG_PS_features_1.FN006006_CFG_PS_features(),
55
- new FN010001_YORC_version_1.FN010001_YORC_version('1.14.0-beta.4')
56
+ new FN010001_YORC_version_1.FN010001_YORC_version('1.14.0-beta.5'),
57
+ new FN014008_CODE_launch_hostedWorkbench_type_1.FN014008_CODE_launch_hostedWorkbench_type('pwa-chrome')
56
58
  ];
57
- //# sourceMappingURL=upgrade-1.14.0-beta.4.js.map
59
+ //# sourceMappingURL=upgrade-1.14.0-beta.5.js.map
@@ -45,7 +45,7 @@ class SpfxProjectUpgradeCommand extends base_project_command_1.BaseProjectComman
45
45
  '1.12.1',
46
46
  '1.13.0',
47
47
  '1.13.1',
48
- '1.14.0-beta.4'
48
+ '1.14.0-beta.5'
49
49
  ];
50
50
  }
51
51
  get name() {
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_1 = require("../../../../cli");
4
4
  const Command_1 = require("../../../../Command");
5
5
  const request_1 = require("../../../../request");
6
- const SpoCommand_1 = require("../../../base/SpoCommand");
7
6
  const AadUserGetCommand = require("../../../aad/commands/user/user-get");
7
+ const SpoCommand_1 = require("../../../base/SpoCommand");
8
8
  const commands_1 = require("../../commands");
9
9
  class SpoGroupUserAddCommand extends SpoCommand_1.default {
10
10
  get name() {
@@ -17,15 +17,21 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
17
17
  return ['DisplayName', 'Email'];
18
18
  }
19
19
  commandAction(logger, args, cb) {
20
- this.getOnlyActiveUsers(args, logger)
20
+ let groupId = 0;
21
+ this
22
+ .getGroupId(args)
23
+ .then((_groupId) => {
24
+ groupId = _groupId;
25
+ return this.getOnlyActiveUsers(args, logger);
26
+ })
21
27
  .then((resolvedUsernameList) => {
22
28
  if (this.verbose) {
23
- logger.logToStderr(`Start adding Active user/s to SharePoint Group ${args.options.groupId}...`);
29
+ logger.logToStderr(`Start adding Active user/s to SharePoint Group ${args.options.groupId ? args.options.groupId : args.options.groupName}`);
24
30
  }
25
31
  const data = {
26
32
  url: args.options.webUrl,
27
33
  peoplePickerInput: this.getFormattedUserList(resolvedUsernameList),
28
- roleValue: `group:${args.options.groupId}`
34
+ roleValue: `group:${groupId}`
29
35
  };
30
36
  const requestOptions = {
31
37
  url: `${args.options.webUrl}/_api/SP.Web.ShareObject`,
@@ -46,24 +52,51 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
46
52
  cb();
47
53
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
48
54
  }
55
+ getGroupId(args) {
56
+ const getGroupMethod = args.options.groupName ?
57
+ `GetByName('${encodeURIComponent(args.options.groupName)}')` :
58
+ `GetById('${args.options.groupId}')`;
59
+ const requestOptions = {
60
+ url: `${args.options.webUrl}/_api/web/sitegroups/${getGroupMethod}`,
61
+ headers: {
62
+ 'accept': 'application/json;odata=nometadata'
63
+ },
64
+ responseType: 'json'
65
+ };
66
+ return request_1.default
67
+ .get(requestOptions)
68
+ .then(response => {
69
+ const groupId = response.Id;
70
+ if (!groupId) {
71
+ return Promise.reject(`The specified group does not exist in the SharePoint site`);
72
+ }
73
+ return groupId;
74
+ });
75
+ }
49
76
  getOnlyActiveUsers(args, logger) {
50
77
  if (this.verbose) {
51
78
  logger.logToStderr(`Removing Users which are not active from the original list`);
52
79
  }
53
- const activeUsernamelist = [];
54
- return Promise.all(args.options.userName.split(",").map(singleUsername => {
80
+ const activeUserNameList = [];
81
+ const userInfo = args.options.userName ? args.options.userName : args.options.email;
82
+ return Promise.all(userInfo.split(',').map(singleUserName => {
55
83
  const options = {
56
- userName: singleUsername.trim(),
57
84
  output: 'json',
58
85
  debug: args.options.debug,
59
86
  verbose: args.options.verbose
60
87
  };
88
+ if (args.options.userName) {
89
+ options.userName = singleUserName.trim();
90
+ }
91
+ else {
92
+ options.email = singleUserName.trim();
93
+ }
61
94
  return cli_1.Cli.executeCommandWithOutput(AadUserGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) })
62
95
  .then((getUserGetOutput) => {
63
96
  if (this.debug) {
64
97
  logger.logToStderr(getUserGetOutput.stderr);
65
98
  }
66
- activeUsernamelist.push(JSON.parse(getUserGetOutput.stdout).userPrincipalName);
99
+ activeUserNameList.push(JSON.parse(getUserGetOutput.stdout).userPrincipalName);
67
100
  }, (err) => {
68
101
  if (this.debug) {
69
102
  logger.logToStderr(err.stderr);
@@ -71,7 +104,7 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
71
104
  });
72
105
  }))
73
106
  .then(() => {
74
- return Promise.resolve(activeUsernamelist);
107
+ return Promise.resolve(activeUserNameList);
75
108
  });
76
109
  }
77
110
  getFormattedUserList(activeUserList) {
@@ -86,10 +119,16 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
86
119
  option: '-u, --webUrl <webUrl>'
87
120
  },
88
121
  {
89
- option: '--groupId <groupId>'
122
+ option: '--groupId [groupId]'
90
123
  },
91
124
  {
92
- option: '--userName <userName>'
125
+ option: '--groupName [groupName]'
126
+ },
127
+ {
128
+ option: '--userName [userName]'
129
+ },
130
+ {
131
+ option: '--email [email]'
93
132
  }
94
133
  ];
95
134
  const parentOptions = super.options();
@@ -100,8 +139,20 @@ class SpoGroupUserAddCommand extends SpoCommand_1.default {
100
139
  if (isValidSharePointUrl !== true) {
101
140
  return isValidSharePointUrl;
102
141
  }
103
- if (typeof args.options.groupId !== 'number') {
104
- return `Group Id : ${args.options.groupId} is not a number`;
142
+ if (!args.options.groupId && !args.options.groupName) {
143
+ return 'Specify either groupId or groupName';
144
+ }
145
+ if (args.options.groupId && args.options.groupName) {
146
+ return 'Specify either groupId or groupName but not both';
147
+ }
148
+ if (!args.options.userName && !args.options.email) {
149
+ return 'Specify either userName or email';
150
+ }
151
+ if (args.options.userName && args.options.email) {
152
+ return 'Specify either userName or email but not both';
153
+ }
154
+ if (args.options.groupId && isNaN(args.options.groupId)) {
155
+ return `Specified groupId ${args.options.groupId} is not a number`;
105
156
  }
106
157
  return true;
107
158
  }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const SpoCommand_1 = require("../../../base/SpoCommand");
5
+ const commands_1 = require("../../commands");
6
+ class SpoSiteRecycleBinItemListCommand extends SpoCommand_1.default {
7
+ get name() {
8
+ return commands_1.default.SITE_RECYCLEBINITEM_LIST;
9
+ }
10
+ get description() {
11
+ return 'Lists items from recycle bin';
12
+ }
13
+ defaultProperties() {
14
+ return ['Id', 'Title', 'DirName'];
15
+ }
16
+ commandAction(logger, args, cb) {
17
+ if (this.verbose) {
18
+ logger.logToStderr(`Retrieving all items from recycle bin at ${args.options.siteUrl}...`);
19
+ }
20
+ const state = args.options.secondary ? '2' : '1';
21
+ let requestUrl = `${args.options.siteUrl}/_api/site/RecycleBin?$filter=(ItemState eq ${state})`;
22
+ if (typeof args.options.type !== 'undefined') {
23
+ const type = SpoSiteRecycleBinItemListCommand.recycleBinItemType.find(item => item.value === args.options.type);
24
+ if (typeof type !== 'undefined') {
25
+ requestUrl += ` and (ItemType eq ${type.id})`;
26
+ }
27
+ }
28
+ const requestOptions = {
29
+ url: requestUrl,
30
+ headers: {
31
+ 'accept': 'application/json;odata=nometadata'
32
+ },
33
+ responseType: 'json'
34
+ };
35
+ request_1.default
36
+ .get(requestOptions)
37
+ .then((response) => {
38
+ logger.log(response.value);
39
+ cb();
40
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
41
+ }
42
+ options() {
43
+ const options = [
44
+ {
45
+ option: '-u, --siteUrl <siteUrl>'
46
+ },
47
+ {
48
+ option: '-t, --type [type]',
49
+ autocomplete: SpoSiteRecycleBinItemListCommand.recycleBinItemType.map(item => item.value)
50
+ },
51
+ {
52
+ option: '-s, --secondary'
53
+ }
54
+ ];
55
+ const parentOptions = super.options();
56
+ return options.concat(parentOptions);
57
+ }
58
+ validate(args) {
59
+ const isValidSharePointUrl = SpoCommand_1.default.isValidSharePointUrl(args.options.siteUrl);
60
+ if (isValidSharePointUrl !== true) {
61
+ return isValidSharePointUrl;
62
+ }
63
+ if (typeof args.options.type !== 'undefined' &&
64
+ !SpoSiteRecycleBinItemListCommand.recycleBinItemType.some(item => item.value === args.options.type)) {
65
+ return `${args.options.type} is not a valid value. Allowed values are ${SpoSiteRecycleBinItemListCommand.recycleBinItemType.map(item => item.value).join(', ')}`;
66
+ }
67
+ return true;
68
+ }
69
+ }
70
+ SpoSiteRecycleBinItemListCommand.recycleBinItemType = [
71
+ { id: 1, value: 'files' },
72
+ { id: 3, value: 'listItems' },
73
+ { id: 5, value: 'folders' }
74
+ ];
75
+ module.exports = new SpoSiteRecycleBinItemListCommand();
76
+ //# sourceMappingURL=site-recyclebinitem-list.js.map
@@ -183,6 +183,7 @@ exports.default = {
183
183
  SITE_GROUPIFY: `${prefix} site groupify`,
184
184
  SITE_LIST: `${prefix} site list`,
185
185
  SITE_INPLACERECORDSMANAGEMENT_SET: `${prefix} site inplacerecordsmanagement set`,
186
+ SITE_RECYCLEBINITEM_LIST: `${prefix} site recyclebinitem list`,
186
187
  SITE_REMOVE: `${prefix} site remove`,
187
188
  SITE_RENAME: `${prefix} site rename`,
188
189
  SITE_SET: `${prefix} site set`,
@@ -25,24 +25,27 @@ class TeamsAppListCommand extends GraphItemsListCommand_1.GraphItemsListCommand
25
25
  if (args.options.teamId) {
26
26
  return Promise.resolve(args.options.teamId);
27
27
  }
28
- const teamRequestOptions = {
29
- url: `${this.resource}/v1.0/me/joinedTeams?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
28
+ const requestOptions = {
29
+ url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
30
30
  headers: {
31
31
  accept: 'application/json;odata.metadata=none'
32
32
  },
33
33
  responseType: 'json'
34
34
  };
35
35
  return request_1.default
36
- .get(teamRequestOptions)
36
+ .get(requestOptions)
37
37
  .then(response => {
38
- const teamItem = response.value[0];
39
- if (!teamItem) {
38
+ const groupItem = response.value[0];
39
+ if (!groupItem) {
40
+ return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
41
+ }
42
+ if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
40
43
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
41
44
  }
42
45
  if (response.value.length > 1) {
43
46
  return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
44
47
  }
45
- return Promise.resolve(teamItem.id);
48
+ return Promise.resolve(groupItem.id);
46
49
  });
47
50
  }
48
51
  getEndpointUrl(args) {
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
4
+ const commands_1 = require("../../commands");
5
+ class TeamsChatListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
6
+ get name() {
7
+ return commands_1.default.CHAT_LIST;
8
+ }
9
+ get description() {
10
+ return 'Lists all chat conversations';
11
+ }
12
+ defaultProperties() {
13
+ return ['id', 'topic', 'chatType'];
14
+ }
15
+ commandAction(logger, args, cb) {
16
+ const filter = args.options.type !== undefined ? `?$filter=chatType eq '${args.options.type}'` : '';
17
+ const endpoint = `${this.resource}/v1.0/chats${filter}`;
18
+ this
19
+ .getAllItems(endpoint, logger, true)
20
+ .then(() => {
21
+ logger.log(this.items);
22
+ cb();
23
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
24
+ }
25
+ options() {
26
+ const options = [
27
+ {
28
+ option: '-t, --type [chatType]'
29
+ }
30
+ ];
31
+ const parentOptions = super.options();
32
+ return options.concat(parentOptions);
33
+ }
34
+ validate(args) {
35
+ const supportedTypes = ['oneOnOne', 'group', 'meeting'];
36
+ if (args.options.type !== undefined && supportedTypes.indexOf(args.options.type) === -1) {
37
+ return `${args.options.type} is not a valid chatType. Accepted values are ${supportedTypes.join(', ')}`;
38
+ }
39
+ return true;
40
+ }
41
+ }
42
+ module.exports = new TeamsChatListCommand();
43
+ //# sourceMappingURL=chat-list.js.map
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Utils_1 = require("../../../../Utils");
4
+ const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
5
+ const commands_1 = require("../../commands");
6
+ class TeamsChatMemberListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
7
+ get name() {
8
+ return commands_1.default.CHAT_MEMBER_LIST;
9
+ }
10
+ get description() {
11
+ return 'Lists all members from a chat';
12
+ }
13
+ defaultProperties() {
14
+ return ['userId', 'displayName', 'email'];
15
+ }
16
+ commandAction(logger, args, cb) {
17
+ const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/members`;
18
+ this
19
+ .getAllItems(endpoint, logger, true)
20
+ .then(() => {
21
+ logger.log(this.items);
22
+ cb();
23
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
24
+ }
25
+ options() {
26
+ const options = [
27
+ {
28
+ option: '-i, --chatId <chatId>'
29
+ }
30
+ ];
31
+ const parentOptions = super.options();
32
+ return options.concat(parentOptions);
33
+ }
34
+ validate(args) {
35
+ if (!Utils_1.default.isValidTeamsChatId(args.options.chatId)) {
36
+ return `${args.options.chatId} is not a valid Teams ChatId`;
37
+ }
38
+ return true;
39
+ }
40
+ }
41
+ module.exports = new TeamsChatMemberListCommand();
42
+ //# sourceMappingURL=chat-member-list.js.map
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Utils_1 = require("../../../../Utils");
4
+ const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
5
+ const commands_1 = require("../../commands");
6
+ class TeamsChatMessageListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
7
+ get name() {
8
+ return commands_1.default.CHAT_MESSAGE_LIST;
9
+ }
10
+ get description() {
11
+ return 'Lists all messages from a chat';
12
+ }
13
+ defaultProperties() {
14
+ return ['id', 'shortBody'];
15
+ }
16
+ commandAction(logger, args, cb) {
17
+ const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/messages`;
18
+ this
19
+ .getAllItems(endpoint, logger, true)
20
+ .then(() => {
21
+ if (args.options.output !== 'json') {
22
+ this.items.forEach(i => {
23
+ // hoist the content to body for readability
24
+ i.body = i.body.content;
25
+ let shortBody;
26
+ const bodyToProcess = i.body;
27
+ if (bodyToProcess) {
28
+ let maxLength = 50;
29
+ let addedDots = '...';
30
+ if (bodyToProcess.length < maxLength) {
31
+ maxLength = bodyToProcess.length;
32
+ addedDots = '';
33
+ }
34
+ shortBody = bodyToProcess.replace(/\n/g, ' ').substring(0, maxLength) + addedDots;
35
+ }
36
+ i.shortBody = shortBody;
37
+ });
38
+ }
39
+ logger.log(this.items);
40
+ cb();
41
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
42
+ }
43
+ options() {
44
+ const options = [
45
+ {
46
+ option: '-i, --chatId <chatId>'
47
+ }
48
+ ];
49
+ const parentOptions = super.options();
50
+ return options.concat(parentOptions);
51
+ }
52
+ validate(args) {
53
+ if (!Utils_1.default.isValidTeamsChatId(args.options.chatId)) {
54
+ return `${args.options.chatId} is not a valid Teams chat ID`;
55
+ }
56
+ return true;
57
+ }
58
+ }
59
+ module.exports = new TeamsChatMessageListCommand();
60
+ //# sourceMappingURL=chat-message-list.js.map
@@ -30,24 +30,27 @@ class TeamsTabGetCommand extends GraphCommand_1.default {
30
30
  if (args.options.teamId) {
31
31
  return Promise.resolve(args.options.teamId);
32
32
  }
33
- const teamRequestOptions = {
34
- url: `${this.resource}/v1.0/me/joinedTeams?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
33
+ const requestOptions = {
34
+ url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(args.options.teamName)}'`,
35
35
  headers: {
36
36
  accept: 'application/json;odata.metadata=none'
37
37
  },
38
38
  responseType: 'json'
39
39
  };
40
40
  return request_1.default
41
- .get(teamRequestOptions)
41
+ .get(requestOptions)
42
42
  .then(response => {
43
- const teamItem = response.value[0];
44
- if (!teamItem) {
43
+ const groupItem = response.value[0];
44
+ if (!groupItem) {
45
+ return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
46
+ }
47
+ if (groupItem.resourceProvisioningOptions.indexOf('Team') === -1) {
45
48
  return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
46
49
  }
47
50
  if (response.value.length > 1) {
48
51
  return Promise.reject(`Multiple Microsoft Teams teams with name ${args.options.teamName} found: ${response.value.map(x => x.id)}`);
49
52
  }
50
- return Promise.resolve(teamItem.id);
53
+ return Promise.resolve(groupItem.id);
51
54
  });
52
55
  }
53
56
  getChannelId(args) {
@@ -13,6 +13,9 @@ exports.default = {
13
13
  CHANNEL_LIST: `${prefix} channel list`,
14
14
  CHANNEL_REMOVE: `${prefix} channel remove`,
15
15
  CHANNEL_SET: `${prefix} channel set`,
16
+ CHAT_LIST: `${prefix} chat list`,
17
+ CHAT_MEMBER_LIST: `${prefix} chat member list`,
18
+ CHAT_MESSAGE_LIST: `${prefix} chat message list`,
16
19
  CONVERSATIONMEMBER_ADD: `${prefix} conversationmember add`,
17
20
  CONVERSATIONMEMBER_LIST: `${prefix} conversationmember list`,
18
21
  FUNSETTINGS_LIST: `${prefix} funsettings list`,
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const GraphCommand_1 = require("../../../base/GraphCommand");
4
+ const request_1 = require("../../../../request");
5
+ const commands_1 = require("../../commands");
6
+ class TenantServiceAnnouncementHealthGetCommand extends GraphCommand_1.default {
7
+ get name() {
8
+ return commands_1.default.SERVICEANNOUNCEMENT_HEALTH_GET;
9
+ }
10
+ get description() {
11
+ return 'This operation provides the health information of a specified service for a tenant';
12
+ }
13
+ getTelemetryProperties(args) {
14
+ const telemetryProps = super.getTelemetryProperties(args);
15
+ telemetryProps.issues = typeof args.options.issues !== 'undefined';
16
+ return telemetryProps;
17
+ }
18
+ defaultProperties() {
19
+ return ['id', 'status', 'service'];
20
+ }
21
+ commandAction(logger, args, cb) {
22
+ this
23
+ .getServiceHealth(args.options)
24
+ .then((res) => {
25
+ logger.log(res);
26
+ cb();
27
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
28
+ }
29
+ getServiceHealth(options) {
30
+ const requestOptions = {
31
+ url: `${this.resource}/v1.0/admin/serviceAnnouncement/healthOverviews/${options.serviceName}${options.issues && (!options.output || options.output.toLocaleLowerCase() === 'json') ? '?$expand=issues' : ''}`,
32
+ headers: {
33
+ accept: 'application/json;odata.metadata=none'
34
+ },
35
+ responseType: 'json'
36
+ };
37
+ return request_1.default
38
+ .get(requestOptions)
39
+ .then(response => {
40
+ const serviceHealth = response;
41
+ if (!serviceHealth) {
42
+ return Promise.reject(`Error fetching service health`);
43
+ }
44
+ return Promise.resolve(serviceHealth);
45
+ });
46
+ }
47
+ options() {
48
+ const options = [
49
+ { option: '-s, --serviceName <serviceName>' },
50
+ { option: '-i, --issues' }
51
+ ];
52
+ const parentOptions = super.options();
53
+ return options.concat(parentOptions);
54
+ }
55
+ }
56
+ module.exports = new TenantServiceAnnouncementHealthGetCommand();
57
+ //# sourceMappingURL=serviceannouncement-health-get.js.map