@pnp/cli-microsoft365 7.0.0-beta.093ef31 → 7.0.0-beta.14c7857
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.
- package/README.md +4 -4
- package/dist/Auth.js +10 -1
- package/dist/cli/Cli.js +3 -3
- package/dist/m365/aad/commands/app/app-get.js +4 -1
- package/dist/m365/aad/commands/app/app-remove.js +3 -1
- package/dist/m365/aad/commands/app/app-role-add.js +4 -1
- package/dist/m365/aad/commands/app/app-role-list.js +4 -1
- package/dist/m365/aad/commands/app/app-role-remove.js +5 -2
- package/dist/m365/aad/commands/app/app-set.js +8 -5
- package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +11 -6
- package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +4 -4
- package/dist/m365/aad/commands/group/group-get.js +4 -4
- package/dist/m365/aad/commands/group/group-list.js +1 -23
- package/dist/m365/aad/commands/group/group-remove.js +98 -0
- package/dist/m365/aad/commands/m365group/m365group-add.js +21 -12
- package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +3 -1
- package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-restore.js +4 -1
- package/dist/m365/aad/commands/m365group/m365group-teamify.js +4 -1
- package/dist/m365/aad/commands/sp/sp-add.js +4 -1
- package/dist/m365/aad/commands/sp/sp-get.js +4 -1
- package/dist/m365/aad/commands/user/user-get.js +7 -2
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/booking/commands/business/business-get.js +4 -1
- package/dist/m365/commands/login.js +2 -2
- package/dist/m365/graph/commands/subscription/subscription-add.js +5 -5
- package/dist/m365/outlook/commands/message/message-list.js +4 -2
- package/dist/m365/outlook/commands/message/message-move.js +4 -2
- package/dist/m365/pa/commands/app/app-export.js +7 -7
- package/dist/m365/planner/commands/bucket/bucket-add.js +4 -1
- package/dist/m365/planner/commands/bucket/bucket-get.js +9 -2
- package/dist/m365/planner/commands/bucket/bucket-list.js +4 -1
- package/dist/m365/planner/commands/bucket/bucket-remove.js +7 -2
- package/dist/m365/planner/commands/bucket/bucket-set.js +8 -2
- package/dist/m365/planner/commands/plan/plan-add.js +4 -1
- package/dist/m365/planner/commands/plan/plan-get.js +4 -1
- package/dist/m365/planner/commands/plan/plan-list.js +4 -1
- package/dist/m365/planner/commands/plan/plan-remove.js +4 -1
- package/dist/m365/planner/commands/plan/plan-set.js +4 -1
- package/dist/m365/planner/commands/roster/roster-get.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-add.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-get.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-list.js +4 -1
- package/dist/m365/planner/commands/roster/roster-member-remove.js +4 -1
- package/dist/m365/planner/commands/roster/roster-plan-list.js +4 -1
- package/dist/m365/planner/commands/roster/roster-remove.js +4 -1
- package/dist/m365/planner/commands/task/task-add.js +4 -1
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +4 -1
- package/dist/m365/planner/commands/task/task-checklistitem-list.js +4 -1
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +4 -1
- package/dist/m365/planner/commands/task/task-get.js +11 -3
- package/dist/m365/planner/commands/task/task-list.js +10 -2
- package/dist/m365/planner/commands/task/task-reference-add.js +4 -1
- package/dist/m365/planner/commands/task/task-reference-list.js +4 -1
- package/dist/m365/planner/commands/task/task-reference-remove.js +4 -1
- package/dist/m365/planner/commands/task/task-remove.js +10 -4
- package/dist/m365/planner/commands/task/task-set.js +4 -1
- package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-get.js +4 -1
- package/dist/m365/pp/commands/card/card-get.js +3 -5
- package/dist/m365/pp/commands/chatbot/chatbot-get.js +3 -1
- package/dist/m365/pp/commands/managementapp/managementapp-add.js +4 -1
- package/dist/m365/search/commands/externalconnection/externalconnection-remove.js +3 -1
- package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.5.js → doctor-1.18.0.js} +2 -2
- package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001022_DEP_office_ui_fabric_react.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002028_DEVDEP_microsoft_rush_stack_compiler_4_7.js +13 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.5.js → upgrade-1.18.0.js} +35 -27
- package/dist/m365/spfx/commands/project/project-upgrade.js +13 -15
- package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +5 -3
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -2
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +3 -2
- package/dist/m365/spo/commands/commandset/commandset-get.js +4 -2
- package/dist/m365/spo/commands/commandset/commandset-remove.js +2 -1
- package/dist/m365/spo/commands/commandset/commandset-set.js +3 -1
- package/dist/m365/spo/commands/customaction/customaction-get.js +5 -2
- package/dist/m365/spo/commands/customaction/customaction-remove.js +3 -1
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +3 -1
- package/dist/m365/spo/commands/file/file-get.js +11 -8
- package/dist/m365/spo/commands/file/file-remove.js +2 -2
- package/dist/m365/spo/commands/file/file-version-clear.js +2 -2
- package/dist/m365/spo/commands/file/file-version-get.js +2 -2
- package/dist/m365/spo/commands/file/file-version-list.js +2 -2
- package/dist/m365/spo/commands/file/file-version-remove.js +2 -2
- package/dist/m365/spo/commands/file/file-version-restore.js +2 -2
- package/dist/m365/spo/commands/group/group-member-add.js +24 -24
- package/dist/m365/spo/commands/hubsite/hubsite-connect.js +7 -4
- package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +4 -1
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +3 -1
- package/dist/m365/spo/commands/listitem/listitem-add.js +1 -0
- package/dist/m365/spo/commands/listitem/listitem-set.js +3 -2
- package/dist/m365/spo/commands/page/clientsidepages.js +18 -0
- package/dist/m365/spo/commands/page/page-get.js +1 -0
- package/dist/m365/spo/commands/page/page-list.js +4 -3
- package/dist/m365/spo/commands/page/page-section-add.js +56 -21
- package/dist/m365/spo/commands/page/page-set.js +13 -2
- package/dist/m365/spo/commands/site/site-commsite-enable.js +34 -5
- package/dist/m365/spo/commands/site/site-list.js +5 -7
- package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +8 -3
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -1
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +8 -3
- package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +3 -1
- package/dist/m365/spo/commands/term/term-get.js +6 -6
- package/dist/m365/teams/commands/app/app-remove.js +49 -15
- package/dist/m365/teams/commands/channel/channel-add.js +5 -1
- package/dist/m365/teams/commands/channel/channel-member-add.js +12 -10
- package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -1
- package/dist/m365/teams/commands/channel/channel-member-set.js +4 -1
- package/dist/m365/teams/commands/chat/chat-get.js +7 -10
- package/dist/m365/teams/commands/chat/chat-message-send.js +8 -10
- package/dist/m365/teams/commands/team/team-clone.js +5 -10
- package/dist/m365/teams/commands/team/team-list.js +94 -30
- package/dist/m365/tenant/commands/info/info-get.js +83 -0
- package/dist/m365/tenant/commands.js +1 -0
- package/dist/utils/aadGroup.js +5 -3
- package/dist/utils/formatting.js +7 -0
- package/dist/utils/powerPlatform.js +1 -1
- package/docs/docs/cmd/aad/app/app-set.mdx +15 -15
- package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +9 -9
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +10 -10
- package/docs/docs/cmd/aad/group/group-get.mdx +5 -5
- package/docs/docs/cmd/aad/group/group-list.mdx +0 -11
- package/docs/docs/cmd/aad/group/group-remove.mdx +44 -0
- package/docs/docs/cmd/aad/m365group/m365group-add.mdx +13 -3
- package/docs/docs/cmd/aad/policy/policy-list.mdx +5 -5
- package/docs/docs/cmd/cli/config/config-list.mdx +1 -1
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +10 -10
- package/docs/docs/cmd/pa/app/app-export.mdx +5 -5
- package/docs/docs/cmd/pp/solution/solution-publisher-get.mdx +2 -2
- package/docs/docs/cmd/pp/solution/solution-publisher-remove.mdx +2 -2
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-get.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-remove.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-clear.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-get.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-list.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-remove.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-version-restore.mdx +2 -2
- package/docs/docs/cmd/spo/group/group-member-add.mdx +27 -27
- package/docs/docs/cmd/spo/list/list-contenttype-remove.mdx +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-add.mdx +2 -5
- package/docs/docs/cmd/spo/listitem/listitem-set.mdx +2 -5
- package/docs/docs/cmd/spo/page/page-get.mdx +0 -1
- package/docs/docs/cmd/spo/page/page-list.mdx +0 -1
- package/docs/docs/cmd/spo/page/page-section-add.mdx +25 -1
- package/docs/docs/cmd/spo/page/page-set.mdx +23 -0
- package/docs/docs/cmd/spo/site/site-commsite-enable.mdx +11 -2
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +2 -4
- package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +2 -4
- package/docs/docs/cmd/teams/app/app-remove.mdx +9 -6
- package/docs/docs/cmd/teams/channel/channel-member-add.mdx +4 -4
- package/docs/docs/cmd/teams/team/team-clone.mdx +3 -3
- package/docs/docs/cmd/teams/team/team-list.mdx +47 -22
- package/docs/docs/cmd/tenant/info/info-get.mdx +101 -0
- package/npm-shrinkwrap.json +24 -24
- package/package.json +8 -12
|
@@ -3,9 +3,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _TeamsAppRemoveCommand_instances, _TeamsAppRemoveCommand_initTelemetry, _TeamsAppRemoveCommand_initOptions, _TeamsAppRemoveCommand_initValidators;
|
|
6
|
+
var _TeamsAppRemoveCommand_instances, _TeamsAppRemoveCommand_initTelemetry, _TeamsAppRemoveCommand_initOptions, _TeamsAppRemoveCommand_initValidators, _TeamsAppRemoveCommand_initOptionSets;
|
|
7
7
|
import { Cli } from '../../../../cli/Cli.js';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
9
10
|
import { validation } from '../../../../utils/validation.js';
|
|
10
11
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
12
|
import commands from '../../commands.js';
|
|
@@ -22,20 +23,21 @@ class TeamsAppRemoveCommand extends GraphCommand {
|
|
|
22
23
|
__classPrivateFieldGet(this, _TeamsAppRemoveCommand_instances, "m", _TeamsAppRemoveCommand_initTelemetry).call(this);
|
|
23
24
|
__classPrivateFieldGet(this, _TeamsAppRemoveCommand_instances, "m", _TeamsAppRemoveCommand_initOptions).call(this);
|
|
24
25
|
__classPrivateFieldGet(this, _TeamsAppRemoveCommand_instances, "m", _TeamsAppRemoveCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _TeamsAppRemoveCommand_instances, "m", _TeamsAppRemoveCommand_initOptionSets).call(this);
|
|
25
27
|
}
|
|
26
28
|
async commandAction(logger, args) {
|
|
27
|
-
const { id: appId } = args.options;
|
|
28
29
|
const removeApp = async () => {
|
|
29
|
-
if (this.verbose) {
|
|
30
|
-
await logger.logToStderr(`Removing app with ID ${args.options.id}`);
|
|
31
|
-
}
|
|
32
|
-
const requestOptions = {
|
|
33
|
-
url: `${this.resource}/v1.0/appCatalogs/teamsApps/${appId}`,
|
|
34
|
-
headers: {
|
|
35
|
-
accept: 'application/json;odata.metadata=none'
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
30
|
try {
|
|
31
|
+
const appId = await this.getAppId(args.options, logger);
|
|
32
|
+
if (this.verbose) {
|
|
33
|
+
await logger.logToStderr(`Removing app with ID ${appId}`);
|
|
34
|
+
}
|
|
35
|
+
const requestOptions = {
|
|
36
|
+
url: `${this.resource}/v1.0/appCatalogs/teamsApps/${appId}`,
|
|
37
|
+
headers: {
|
|
38
|
+
accept: 'application/json;odata.metadata=none'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
39
41
|
await request.delete(requestOptions);
|
|
40
42
|
}
|
|
41
43
|
catch (err) {
|
|
@@ -50,33 +52,65 @@ class TeamsAppRemoveCommand extends GraphCommand {
|
|
|
50
52
|
type: 'confirm',
|
|
51
53
|
name: 'continue',
|
|
52
54
|
default: false,
|
|
53
|
-
message: `Are you sure you want to remove the Teams app ${
|
|
55
|
+
message: `Are you sure you want to remove the Teams app ${args.options.id || args.options.name} from the app catalog?`
|
|
54
56
|
});
|
|
55
57
|
if (result.continue) {
|
|
56
58
|
await removeApp();
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
}
|
|
62
|
+
async getAppId(options, logger) {
|
|
63
|
+
if (options.id) {
|
|
64
|
+
return options.id;
|
|
65
|
+
}
|
|
66
|
+
if (this.verbose) {
|
|
67
|
+
await logger.logToStderr(`Retrieving app Id...`);
|
|
68
|
+
}
|
|
69
|
+
const requestOptions = {
|
|
70
|
+
url: `${this.resource}/v1.0/appCatalogs/teamsApps?$filter=displayName eq '${formatting.encodeQueryParameter(options.name)}'&$select=id`,
|
|
71
|
+
headers: {
|
|
72
|
+
accept: 'application/json;odata.metadata=none'
|
|
73
|
+
},
|
|
74
|
+
responseType: 'json'
|
|
75
|
+
};
|
|
76
|
+
const response = await request.get(requestOptions);
|
|
77
|
+
const app = response.value[0];
|
|
78
|
+
if (!app) {
|
|
79
|
+
throw `The specified Teams app does not exist`;
|
|
80
|
+
}
|
|
81
|
+
if (response.value.length > 1) {
|
|
82
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
|
|
83
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple Teams apps with name '${options.name}' found.`, resultAsKeyValuePair);
|
|
84
|
+
return result.id;
|
|
85
|
+
}
|
|
86
|
+
return app.id;
|
|
87
|
+
}
|
|
60
88
|
}
|
|
61
89
|
_TeamsAppRemoveCommand_instances = new WeakSet(), _TeamsAppRemoveCommand_initTelemetry = function _TeamsAppRemoveCommand_initTelemetry() {
|
|
62
90
|
this.telemetry.push((args) => {
|
|
63
91
|
Object.assign(this.telemetryProperties, {
|
|
64
|
-
force: (!(!args.options.force)).toString()
|
|
92
|
+
force: (!(!args.options.force)).toString(),
|
|
93
|
+
id: typeof args.options.id !== 'undefined',
|
|
94
|
+
name: typeof args.options.name !== 'undefined'
|
|
65
95
|
});
|
|
66
96
|
});
|
|
67
97
|
}, _TeamsAppRemoveCommand_initOptions = function _TeamsAppRemoveCommand_initOptions() {
|
|
68
98
|
this.options.unshift({
|
|
69
|
-
option: '-i, --id
|
|
99
|
+
option: '-i, --id [id]'
|
|
100
|
+
}, {
|
|
101
|
+
option: '-n, --name [name]'
|
|
70
102
|
}, {
|
|
71
103
|
option: '-f, --force'
|
|
72
104
|
});
|
|
73
105
|
}, _TeamsAppRemoveCommand_initValidators = function _TeamsAppRemoveCommand_initValidators() {
|
|
74
106
|
this.validators.push(async (args) => {
|
|
75
|
-
if (!validation.isValidGuid(args.options.id)) {
|
|
107
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
76
108
|
return `${args.options.id} is not a valid GUID`;
|
|
77
109
|
}
|
|
78
110
|
return true;
|
|
79
111
|
});
|
|
112
|
+
}, _TeamsAppRemoveCommand_initOptionSets = function _TeamsAppRemoveCommand_initOptionSets() {
|
|
113
|
+
this.optionSets.push({ options: ['id', 'name'] });
|
|
80
114
|
};
|
|
81
115
|
export default new TeamsAppRemoveCommand();
|
|
82
116
|
//# sourceMappingURL=app-remove.js.map
|
|
@@ -8,6 +8,8 @@ import request from '../../../../request.js';
|
|
|
8
8
|
import { validation } from '../../../../utils/validation.js';
|
|
9
9
|
import GraphCommand from "../../../base/GraphCommand.js";
|
|
10
10
|
import commands from '../../commands.js';
|
|
11
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
12
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
11
13
|
class TeamsChannelAddCommand extends GraphCommand {
|
|
12
14
|
get name() {
|
|
13
15
|
return commands.CHANNEL_ADD;
|
|
@@ -42,7 +44,9 @@ class TeamsChannelAddCommand extends GraphCommand {
|
|
|
42
44
|
throw `The specified team does not exist in the Microsoft Teams`;
|
|
43
45
|
}
|
|
44
46
|
if (matchingTeams.length > 1) {
|
|
45
|
-
|
|
47
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
|
|
48
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple Microsoft Teams teams with name ${args.options.teamName} found.`, resultAsKeyValuePair);
|
|
49
|
+
return result.id;
|
|
46
50
|
}
|
|
47
51
|
return matchingTeams[0];
|
|
48
52
|
}
|
|
@@ -4,13 +4,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _TeamsChannelMemberAddCommand_instances, _TeamsChannelMemberAddCommand_initTelemetry, _TeamsChannelMemberAddCommand_initOptions, _TeamsChannelMemberAddCommand_initValidators, _TeamsChannelMemberAddCommand_initOptionSets;
|
|
7
|
-
import os from 'os';
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { aadGroup } from '../../../../utils/aadGroup.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
11
10
|
import { validation } from '../../../../utils/validation.js';
|
|
12
11
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
13
12
|
import commands from '../../commands.js';
|
|
13
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
14
14
|
class TeamsChannelMemberAddCommand extends GraphCommand {
|
|
15
15
|
get name() {
|
|
16
16
|
return commands.CHANNEL_MEMBER_ADD;
|
|
@@ -91,11 +91,11 @@ class TeamsChannelMemberAddCommand extends GraphCommand {
|
|
|
91
91
|
return channelItem.id;
|
|
92
92
|
}
|
|
93
93
|
async getUserId(args) {
|
|
94
|
-
if (args.options.
|
|
95
|
-
return args.options.
|
|
94
|
+
if (args.options.userIds) {
|
|
95
|
+
return args.options.userIds.split(',').map(u => u.trim());
|
|
96
96
|
}
|
|
97
97
|
const tasks = [];
|
|
98
|
-
const userDisplayNames = args.options.
|
|
98
|
+
const userDisplayNames = args.options.userDisplayNames && args.options.userDisplayNames.split(',').map(u => u.trim());
|
|
99
99
|
for (const userName of userDisplayNames) {
|
|
100
100
|
tasks.push(this.getSingleUser(userName));
|
|
101
101
|
}
|
|
@@ -115,7 +115,9 @@ class TeamsChannelMemberAddCommand extends GraphCommand {
|
|
|
115
115
|
throw `The specified user '${userDisplayName}' does not exist`;
|
|
116
116
|
}
|
|
117
117
|
if (response.value.length > 1) {
|
|
118
|
-
|
|
118
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
|
|
119
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple users with display name '${userDisplayName}' found.`, resultAsKeyValuePair);
|
|
120
|
+
return result.id;
|
|
119
121
|
}
|
|
120
122
|
return userItem.id;
|
|
121
123
|
}
|
|
@@ -127,8 +129,8 @@ _TeamsChannelMemberAddCommand_instances = new WeakSet(), _TeamsChannelMemberAddC
|
|
|
127
129
|
teamName: typeof args.options.teamName !== 'undefined',
|
|
128
130
|
channelId: typeof args.options.channelId !== 'undefined',
|
|
129
131
|
channelName: typeof args.options.channelName !== 'undefined',
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
userIds: typeof args.options.userIds !== 'undefined',
|
|
133
|
+
userDisplayNames: typeof args.options.userDisplayNames !== 'undefined',
|
|
132
134
|
owner: args.options.owner
|
|
133
135
|
});
|
|
134
136
|
});
|
|
@@ -142,9 +144,9 @@ _TeamsChannelMemberAddCommand_instances = new WeakSet(), _TeamsChannelMemberAddC
|
|
|
142
144
|
}, {
|
|
143
145
|
option: '--channelName [channelName]'
|
|
144
146
|
}, {
|
|
145
|
-
option: '--
|
|
147
|
+
option: '--userIds [userIds]'
|
|
146
148
|
}, {
|
|
147
|
-
option: '--
|
|
149
|
+
option: '--userDisplayNames [userDisplayNames]'
|
|
148
150
|
}, {
|
|
149
151
|
option: '--owner'
|
|
150
152
|
});
|
|
@@ -159,7 +161,7 @@ _TeamsChannelMemberAddCommand_instances = new WeakSet(), _TeamsChannelMemberAddC
|
|
|
159
161
|
return true;
|
|
160
162
|
});
|
|
161
163
|
}, _TeamsChannelMemberAddCommand_initOptionSets = function _TeamsChannelMemberAddCommand_initOptionSets() {
|
|
162
|
-
this.optionSets.push({ options: ['teamId', 'teamName'] }, { options: ['channelId', 'channelName'] }, { options: ['
|
|
164
|
+
this.optionSets.push({ options: ['teamId', 'teamName'] }, { options: ['channelId', 'channelName'] }, { options: ['userIds', 'userDisplayNames'] });
|
|
163
165
|
};
|
|
164
166
|
export default new TeamsChannelMemberAddCommand();
|
|
165
167
|
//# sourceMappingURL=channel-member-add.js.map
|
|
@@ -123,7 +123,9 @@ class TeamsChannelMemberRemoveCommand extends GraphCommand {
|
|
|
123
123
|
throw 'The specified member does not exist in the Microsoft Teams channel';
|
|
124
124
|
}
|
|
125
125
|
if (conversationMembers.length > 1) {
|
|
126
|
-
|
|
126
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', conversationMembers);
|
|
127
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple Microsoft Teams channel members with name ${args.options.userName} found.`, resultAsKeyValuePair);
|
|
128
|
+
return result.id;
|
|
127
129
|
}
|
|
128
130
|
return conversationMember.id;
|
|
129
131
|
}
|
|
@@ -10,6 +10,7 @@ import { formatting } from '../../../../utils/formatting.js';
|
|
|
10
10
|
import { validation } from '../../../../utils/validation.js';
|
|
11
11
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
12
12
|
import commands from '../../commands.js';
|
|
13
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
13
14
|
class TeamsChannelMemberSetCommand extends GraphCommand {
|
|
14
15
|
get name() {
|
|
15
16
|
return commands.CHANNEL_MEMBER_SET;
|
|
@@ -101,7 +102,9 @@ class TeamsChannelMemberSetCommand extends GraphCommand {
|
|
|
101
102
|
throw 'The specified member does not exist in the Microsoft Teams channel';
|
|
102
103
|
}
|
|
103
104
|
if (conversationMembers.length > 1) {
|
|
104
|
-
|
|
105
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', conversationMembers);
|
|
106
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple Microsoft Teams channel members with name ${args.options.userName} found.`, resultAsKeyValuePair);
|
|
107
|
+
return result.id;
|
|
105
108
|
}
|
|
106
109
|
return conversationMember.id;
|
|
107
110
|
}
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _TeamsChatGetCommand_instances, _TeamsChatGetCommand_initTelemetry, _TeamsChatGetCommand_initOptions, _TeamsChatGetCommand_initValidators, _TeamsChatGetCommand_initOptionSets;
|
|
7
|
-
import os from 'os';
|
|
8
7
|
import auth from '../../../../Auth.js';
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
9
|
import { accessToken } from '../../../../utils/accessToken.js';
|
|
@@ -13,6 +12,7 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
13
12
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
14
13
|
import commands from '../../commands.js';
|
|
15
14
|
import { chatUtil } from './chatUtil.js';
|
|
15
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
16
16
|
class TeamsChatGetCommand extends GraphCommand {
|
|
17
17
|
get name() {
|
|
18
18
|
return commands.CHAT_GET;
|
|
@@ -66,10 +66,9 @@ class TeamsChatGetCommand extends GraphCommand {
|
|
|
66
66
|
if (existingChats.length === 1) {
|
|
67
67
|
return existingChats[0].id;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
throw `Multiple chat conversations with these participants found. Please disambiguate:${os.EOL}${disambiguationText}`;
|
|
69
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', existingChats);
|
|
70
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple chat conversations with these participants found.`, resultAsKeyValuePair);
|
|
71
|
+
return result.id;
|
|
73
72
|
}
|
|
74
73
|
async getChatIdByName(name) {
|
|
75
74
|
const existingChats = await chatUtil.findExistingGroupChatsByName(name);
|
|
@@ -79,11 +78,9 @@ class TeamsChatGetCommand extends GraphCommand {
|
|
|
79
78
|
if (existingChats.length === 1) {
|
|
80
79
|
return existingChats[0].id;
|
|
81
80
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}).join(os.EOL);
|
|
86
|
-
throw `Multiple chat conversations with this name found. Please disambiguate:${os.EOL}${disambiguationText}`;
|
|
81
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', existingChats);
|
|
82
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple chat conversations with this name found.`, resultAsKeyValuePair);
|
|
83
|
+
return result.id;
|
|
87
84
|
}
|
|
88
85
|
}
|
|
89
86
|
_TeamsChatGetCommand_instances = new WeakSet(), _TeamsChatGetCommand_initTelemetry = function _TeamsChatGetCommand_initTelemetry() {
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _TeamsChatMessageSendCommand_instances, _TeamsChatMessageSendCommand_initTelemetry, _TeamsChatMessageSendCommand_initOptions, _TeamsChatMessageSendCommand_initValidators, _TeamsChatMessageSendCommand_initOptionSets;
|
|
7
|
-
import os from 'os';
|
|
8
7
|
import auth from '../../../../Auth.js';
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
9
|
import { accessToken } from '../../../../utils/accessToken.js';
|
|
@@ -12,6 +11,8 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
12
11
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
13
12
|
import commands from '../../commands.js';
|
|
14
13
|
import { chatUtil } from './chatUtil.js';
|
|
14
|
+
import { Cli } from '../../../../cli/Cli.js';
|
|
15
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
15
16
|
class TeamsChatMessageSendCommand extends GraphCommand {
|
|
16
17
|
get name() {
|
|
17
18
|
return commands.CHAT_MESSAGE_SEND;
|
|
@@ -55,10 +56,9 @@ class TeamsChatMessageSendCommand extends GraphCommand {
|
|
|
55
56
|
if (existingChats.length === 1) {
|
|
56
57
|
return existingChats[0].id;
|
|
57
58
|
}
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
throw `Multiple chat conversations with this name found. Please disambiguate:${os.EOL}${disambiguationText}`;
|
|
59
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', existingChats);
|
|
60
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple chat conversations with this name found.`, resultAsKeyValuePair);
|
|
61
|
+
return result.id;
|
|
62
62
|
}
|
|
63
63
|
async getChatIdByName(chatName) {
|
|
64
64
|
const existingChats = await chatUtil.findExistingGroupChatsByName(chatName);
|
|
@@ -68,11 +68,9 @@ class TeamsChatMessageSendCommand extends GraphCommand {
|
|
|
68
68
|
if (existingChats.length === 1) {
|
|
69
69
|
return existingChats[0].id;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}).join(os.EOL);
|
|
75
|
-
throw `Multiple chat conversations with this name found. Please disambiguate:${os.EOL}${disambiguationText}`;
|
|
71
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', existingChats);
|
|
72
|
+
const result = await Cli.handleMultipleResultsFound(`Multiple chat conversations with this name found.`, resultAsKeyValuePair);
|
|
73
|
+
return result.id;
|
|
76
74
|
}
|
|
77
75
|
// This Microsoft Graph API request throws an intermittent 404 exception, saying that it cannot find the principal.
|
|
78
76
|
// The same behavior occurs when creating the conversation through the Graph Explorer.
|
|
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _TeamsTeamCloneCommand_instances, _TeamsTeamCloneCommand_initTelemetry, _TeamsTeamCloneCommand_initOptions, _TeamsTeamCloneCommand_initValidators
|
|
6
|
+
var _TeamsTeamCloneCommand_instances, _TeamsTeamCloneCommand_initTelemetry, _TeamsTeamCloneCommand_initOptions, _TeamsTeamCloneCommand_initValidators;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -22,7 +22,6 @@ class TeamsTeamCloneCommand extends GraphCommand {
|
|
|
22
22
|
__classPrivateFieldGet(this, _TeamsTeamCloneCommand_instances, "m", _TeamsTeamCloneCommand_initTelemetry).call(this);
|
|
23
23
|
__classPrivateFieldGet(this, _TeamsTeamCloneCommand_instances, "m", _TeamsTeamCloneCommand_initOptions).call(this);
|
|
24
24
|
__classPrivateFieldGet(this, _TeamsTeamCloneCommand_instances, "m", _TeamsTeamCloneCommand_initValidators).call(this);
|
|
25
|
-
__classPrivateFieldGet(this, _TeamsTeamCloneCommand_instances, "m", _TeamsTeamCloneCommand_initOptionSets).call(this);
|
|
26
25
|
}
|
|
27
26
|
async commandAction(logger, args) {
|
|
28
27
|
const data = {
|
|
@@ -42,7 +41,7 @@ class TeamsTeamCloneCommand extends GraphCommand {
|
|
|
42
41
|
const requestOptions = {
|
|
43
42
|
url: `${this.resource}/v1.0/teams/${formatting.encodeQueryParameter(args.options.id)}/clone`,
|
|
44
43
|
headers: {
|
|
45
|
-
|
|
44
|
+
'content-type': 'application/json',
|
|
46
45
|
accept: 'application/json;odata.metadata=none'
|
|
47
46
|
},
|
|
48
47
|
responseType: 'json',
|
|
@@ -75,16 +74,14 @@ _TeamsTeamCloneCommand_instances = new WeakSet(), _TeamsTeamCloneCommand_initTel
|
|
|
75
74
|
Object.assign(this.telemetryProperties, {
|
|
76
75
|
description: typeof args.options.description !== 'undefined',
|
|
77
76
|
classification: typeof args.options.classification !== 'undefined',
|
|
78
|
-
visibility: typeof args.options.visibility !== 'undefined'
|
|
79
|
-
id: typeof args.options.id !== 'undefined',
|
|
80
|
-
name: typeof args.options.name !== 'undefined'
|
|
77
|
+
visibility: typeof args.options.visibility !== 'undefined'
|
|
81
78
|
});
|
|
82
79
|
});
|
|
83
80
|
}, _TeamsTeamCloneCommand_initOptions = function _TeamsTeamCloneCommand_initOptions() {
|
|
84
81
|
this.options.unshift({
|
|
85
|
-
option: '-i, --id
|
|
82
|
+
option: '-i, --id <id>'
|
|
86
83
|
}, {
|
|
87
|
-
option: '-n, --name
|
|
84
|
+
option: '-n, --name <name>'
|
|
88
85
|
}, {
|
|
89
86
|
option: '-p, --partsToClone <partsToClone>',
|
|
90
87
|
autocomplete: ['apps', 'channels', 'members', 'settings', 'tabs']
|
|
@@ -121,8 +118,6 @@ _TeamsTeamCloneCommand_instances = new WeakSet(), _TeamsTeamCloneCommand_initTel
|
|
|
121
118
|
}
|
|
122
119
|
return true;
|
|
123
120
|
});
|
|
124
|
-
}, _TeamsTeamCloneCommand_initOptionSets = function _TeamsTeamCloneCommand_initOptionSets() {
|
|
125
|
-
this.optionSets.push({ options: ['id', 'name'] });
|
|
126
121
|
};
|
|
127
122
|
export default new TeamsTeamCloneCommand();
|
|
128
123
|
//# sourceMappingURL=team-clone.js.map
|
|
@@ -3,11 +3,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _TeamsTeamListCommand_instances, _TeamsTeamListCommand_initTelemetry, _TeamsTeamListCommand_initOptions;
|
|
6
|
+
var _TeamsTeamListCommand_instances, _TeamsTeamListCommand_initTelemetry, _TeamsTeamListCommand_initOptions, _TeamsTeamListCommand_initValidators, _TeamsTeamListCommand_initOptionSets, _TeamsTeamListCommand_initTypes;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { odata } from '../../../../utils/odata.js';
|
|
9
9
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
10
|
import commands from '../../commands.js';
|
|
11
|
+
import { validation } from '../../../../utils/validation.js';
|
|
12
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
11
13
|
class TeamsTeamListCommand extends GraphCommand {
|
|
12
14
|
get name() {
|
|
13
15
|
return commands.TEAM_LIST;
|
|
@@ -23,64 +25,126 @@ class TeamsTeamListCommand extends GraphCommand {
|
|
|
23
25
|
_TeamsTeamListCommand_instances.add(this);
|
|
24
26
|
__classPrivateFieldGet(this, _TeamsTeamListCommand_instances, "m", _TeamsTeamListCommand_initTelemetry).call(this);
|
|
25
27
|
__classPrivateFieldGet(this, _TeamsTeamListCommand_instances, "m", _TeamsTeamListCommand_initOptions).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _TeamsTeamListCommand_instances, "m", _TeamsTeamListCommand_initValidators).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _TeamsTeamListCommand_instances, "m", _TeamsTeamListCommand_initOptionSets).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _TeamsTeamListCommand_instances, "m", _TeamsTeamListCommand_initTypes).call(this);
|
|
26
31
|
}
|
|
27
32
|
async commandAction(logger, args) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
if (this.verbose) {
|
|
34
|
+
if (!args.options.joined && !args.options.associated) {
|
|
35
|
+
await logger.logToStderr(`Retrieving Microsoft Teams in the tenant...`);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const user = args.options.userId || args.options.userName || 'me';
|
|
39
|
+
await logger.logToStderr(`Retrieving Microsoft Teams ${args.options.joined ? 'joined by' : 'associated with'} ${user}...`);
|
|
40
|
+
}
|
|
31
41
|
}
|
|
32
42
|
try {
|
|
33
|
-
|
|
34
|
-
if (args.options.joined) {
|
|
35
|
-
|
|
43
|
+
let endpoint = `${this.resource}/v1.0`;
|
|
44
|
+
if (args.options.joined || args.options.associated) {
|
|
45
|
+
endpoint += args.options.userId || args.options.userName ? `/users/${args.options.userId || formatting.encodeQueryParameter(args.options.userName)}` : '/me';
|
|
46
|
+
endpoint += args.options.joined ? '/joinedTeams' : '/teamwork/associatedTeams';
|
|
47
|
+
endpoint += '?$select=id';
|
|
36
48
|
}
|
|
37
49
|
else {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}).map(g => this.getTeamFromGroup(g)));
|
|
41
|
-
await logger.log(teamItems);
|
|
50
|
+
// Get all team groups within the tenant
|
|
51
|
+
endpoint += `/groups?$select=id&$filter=resourceProvisioningOptions/Any(x:x eq 'Team')`;
|
|
42
52
|
}
|
|
53
|
+
const groupResponse = await odata.getAllItems(endpoint);
|
|
54
|
+
const groupIds = groupResponse.map(g => g.id);
|
|
55
|
+
if (this.verbose) {
|
|
56
|
+
await logger.logToStderr(`Retrieved ${groupIds.length} Microsoft Teams, getting additional information...`);
|
|
57
|
+
}
|
|
58
|
+
let teams = await this.getAllTeams(groupIds);
|
|
59
|
+
// Sort teams by display name
|
|
60
|
+
teams = teams.sort((x, y) => x.displayName.localeCompare(y.displayName));
|
|
61
|
+
await logger.log(teams);
|
|
43
62
|
}
|
|
44
63
|
catch (err) {
|
|
45
64
|
this.handleRejectedODataJsonPromise(err);
|
|
46
65
|
}
|
|
47
66
|
}
|
|
48
|
-
async
|
|
67
|
+
async getAllTeams(groupIds) {
|
|
68
|
+
const groupBatches = [];
|
|
69
|
+
for (let i = 0; groupIds.length > i; i += 20) {
|
|
70
|
+
groupBatches.push(groupIds.slice(i, i + 20));
|
|
71
|
+
}
|
|
72
|
+
const promises = groupBatches.map(g => this.getTeamsBatch(g));
|
|
73
|
+
const teams = await Promise.all(promises);
|
|
74
|
+
const result = teams.reduce((prev, val) => prev.concat(val), []);
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
async getTeamsBatch(groupIds) {
|
|
49
78
|
const requestOptions = {
|
|
50
|
-
url: `${this.resource}/v1.0
|
|
79
|
+
url: `${this.resource}/v1.0/$batch`,
|
|
51
80
|
headers: {
|
|
52
|
-
accept: 'application/json;odata.metadata=none'
|
|
81
|
+
accept: 'application/json;odata.metadata=none',
|
|
82
|
+
'content-type': 'application/json'
|
|
53
83
|
},
|
|
54
|
-
responseType: 'json'
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
description: group.description,
|
|
65
|
-
isArchived: undefined
|
|
66
|
-
};
|
|
84
|
+
responseType: 'json',
|
|
85
|
+
data: {
|
|
86
|
+
requests: groupIds.map((id, index) => ({
|
|
87
|
+
id: index.toString(),
|
|
88
|
+
method: 'GET',
|
|
89
|
+
headers: {
|
|
90
|
+
accept: 'application/json;odata.metadata=none'
|
|
91
|
+
},
|
|
92
|
+
url: `/teams/${id}`
|
|
93
|
+
}))
|
|
67
94
|
}
|
|
68
|
-
|
|
69
|
-
|
|
95
|
+
};
|
|
96
|
+
const response = await request.post(requestOptions);
|
|
97
|
+
// Throw error if any of the requests failed
|
|
98
|
+
for (const item of response.responses) {
|
|
99
|
+
if (item.status !== 200) {
|
|
100
|
+
throw item.body;
|
|
70
101
|
}
|
|
71
102
|
}
|
|
103
|
+
return response.responses.map(r => r.body);
|
|
72
104
|
}
|
|
73
105
|
}
|
|
74
106
|
_TeamsTeamListCommand_instances = new WeakSet(), _TeamsTeamListCommand_initTelemetry = function _TeamsTeamListCommand_initTelemetry() {
|
|
75
107
|
this.telemetry.push((args) => {
|
|
76
108
|
Object.assign(this.telemetryProperties, {
|
|
77
|
-
joined: args.options.joined
|
|
109
|
+
joined: !!args.options.joined,
|
|
110
|
+
associated: !!args.options.associated,
|
|
111
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
112
|
+
userName: typeof args.options.userName !== 'undefined'
|
|
78
113
|
});
|
|
79
114
|
});
|
|
80
115
|
}, _TeamsTeamListCommand_initOptions = function _TeamsTeamListCommand_initOptions() {
|
|
81
116
|
this.options.unshift({
|
|
82
117
|
option: '-j, --joined'
|
|
118
|
+
}, {
|
|
119
|
+
option: '-a, --associated'
|
|
120
|
+
}, {
|
|
121
|
+
option: '--userId [userId]'
|
|
122
|
+
}, {
|
|
123
|
+
option: '--userName [userName]'
|
|
124
|
+
});
|
|
125
|
+
}, _TeamsTeamListCommand_initValidators = function _TeamsTeamListCommand_initValidators() {
|
|
126
|
+
this.validators.push(async (args) => {
|
|
127
|
+
if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
|
|
128
|
+
return `${args.options.userId} is not a valid GUID for userId.`;
|
|
129
|
+
}
|
|
130
|
+
if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
|
|
131
|
+
return `${args.options.userId} is not a valid UPN for userName.`;
|
|
132
|
+
}
|
|
133
|
+
if ((args.options.userId || args.options.userName) && !args.options.joined && !args.options.associated) {
|
|
134
|
+
return 'You must specify either joined or associated when specifying userId or userName.';
|
|
135
|
+
}
|
|
136
|
+
return true;
|
|
137
|
+
});
|
|
138
|
+
}, _TeamsTeamListCommand_initOptionSets = function _TeamsTeamListCommand_initOptionSets() {
|
|
139
|
+
this.optionSets.push({
|
|
140
|
+
options: ['joined', 'associated'],
|
|
141
|
+
runsWhen: (args) => !!args.options.joined || !!args.options.associated
|
|
142
|
+
}, {
|
|
143
|
+
options: ['userId', 'userName'],
|
|
144
|
+
runsWhen: (args) => typeof args.options.userId !== 'undefined' || typeof args.options.userName !== 'undefined'
|
|
83
145
|
});
|
|
146
|
+
}, _TeamsTeamListCommand_initTypes = function _TeamsTeamListCommand_initTypes() {
|
|
147
|
+
this.types.string.push('userId', 'userName');
|
|
84
148
|
};
|
|
85
149
|
export default new TeamsTeamListCommand();
|
|
86
150
|
//# sourceMappingURL=team-list.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _TenantInfoGetCommand_instances, _TenantInfoGetCommand_initTelemetry, _TenantInfoGetCommand_initOptions, _TenantInfoGetCommand_initValidators;
|
|
7
|
+
import auth from '../../../../Auth.js';
|
|
8
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
9
|
+
import request from '../../../../request.js';
|
|
10
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
11
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
12
|
+
import { validation } from '../../../../utils/validation.js';
|
|
13
|
+
import commands from '../../commands.js';
|
|
14
|
+
class TenantInfoGetCommand extends GraphCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.INFO_GET;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Gets information about any tenant';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_TenantInfoGetCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _TenantInfoGetCommand_instances, "m", _TenantInfoGetCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _TenantInfoGetCommand_instances, "m", _TenantInfoGetCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _TenantInfoGetCommand_instances, "m", _TenantInfoGetCommand_initValidators).call(this);
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
29
|
+
let domainName = args.options.domainName;
|
|
30
|
+
const tenantId = args.options.tenantId;
|
|
31
|
+
if (!domainName && !tenantId) {
|
|
32
|
+
const userName = accessToken.getUserNameFromAccessToken(auth.service.accessTokens[auth.defaultResource].accessToken);
|
|
33
|
+
domainName = userName.split('@')[1];
|
|
34
|
+
}
|
|
35
|
+
let requestUrl = `${this.resource}/v1.0/tenantRelationships/`;
|
|
36
|
+
if (tenantId) {
|
|
37
|
+
requestUrl += `findTenantInformationByTenantId(tenantId='${formatting.encodeQueryParameter(tenantId)}')`;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
requestUrl += `findTenantInformationByDomainName(domainName='${formatting.encodeQueryParameter(domainName)}')`;
|
|
41
|
+
}
|
|
42
|
+
const requestOptions = {
|
|
43
|
+
url: requestUrl,
|
|
44
|
+
headers: {
|
|
45
|
+
accept: 'application/json;odata.metadata=none'
|
|
46
|
+
},
|
|
47
|
+
responseType: 'json'
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
const res = await request.get(requestOptions);
|
|
51
|
+
await logger.log(res);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
this.handleRejectedODataJsonPromise(err);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
_TenantInfoGetCommand_instances = new WeakSet(), _TenantInfoGetCommand_initTelemetry = function _TenantInfoGetCommand_initTelemetry() {
|
|
59
|
+
this.telemetry.push((args) => {
|
|
60
|
+
Object.assign(this.telemetryProperties, {
|
|
61
|
+
domainName: typeof args.options.domainName !== 'undefined',
|
|
62
|
+
tenantId: typeof args.options.tenantId !== 'undefined'
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}, _TenantInfoGetCommand_initOptions = function _TenantInfoGetCommand_initOptions() {
|
|
66
|
+
this.options.unshift({
|
|
67
|
+
option: '-d, --domainName [domainName]'
|
|
68
|
+
}, {
|
|
69
|
+
option: '-i, --tenantId [tenantId]'
|
|
70
|
+
});
|
|
71
|
+
}, _TenantInfoGetCommand_initValidators = function _TenantInfoGetCommand_initValidators() {
|
|
72
|
+
this.validators.push(async (args) => {
|
|
73
|
+
if (args.options.tenantId && !validation.isValidGuid(args.options.tenantId)) {
|
|
74
|
+
return `${args.options.tenantId} is not a valid GUID`;
|
|
75
|
+
}
|
|
76
|
+
if (args.options.tenantId && args.options.domainName) {
|
|
77
|
+
return `Specify either domainName or tenantId but not both`;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
export default new TenantInfoGetCommand();
|
|
83
|
+
//# sourceMappingURL=info-get.js.map
|