@pnp/cli-microsoft365 10.11.0 → 11.0.0-beta.4be9237
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/m365/pp/commands.js +0 -4
- package/dist/m365/spo/commands/customaction/customaction-list.js +3 -10
- package/dist/m365/spo/commands/homesite/homesite-set.js +88 -44
- package/dist/m365/spo/commands.js +0 -1
- package/dist/m365/teams/commands/report/report-directroutingcalls.js +5 -12
- package/dist/m365/teams/commands/report/report-pstncalls.js +5 -12
- package/dist/m365/viva/commands.js +0 -3
- package/docs/docs/cmd/spo/homesite/homesite-set.mdx +85 -45
- package/docs/docs/cmd/teams/report/report-directroutingcalls.mdx +25 -44
- package/docs/docs/cmd/teams/report/report-pstncalls.mdx +25 -48
- package/docs/docs/cmd/viva/engage/engage-community-list.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-community-user-add.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-community-user-remove.mdx +19 -0
- package/npm-shrinkwrap.json +53 -53
- package/package.json +13 -13
- package/dist/m365/pp/commands/card/card-clone.js +0 -101
- package/dist/m365/pp/commands/card/card-get.js +0 -89
- package/dist/m365/pp/commands/card/card-list.js +0 -55
- package/dist/m365/pp/commands/card/card-remove.js +0 -105
- package/dist/m365/skype/commands/report/report-activitycounts.js +0 -15
- package/dist/m365/skype/commands/report/report-activityusercounts.js +0 -15
- package/dist/m365/skype/commands/report/report-activityuserdetail.js +0 -15
- package/dist/m365/skype/commands.js +0 -7
- package/dist/m365/spo/commands/mail/mail-send.js +0 -108
- package/dist/m365/viva/commands/engage/engage-group-list.js +0 -93
- package/dist/m365/viva/commands/engage/engage-group-user-add.js +0 -73
- package/dist/m365/viva/commands/engage/engage-group-user-remove.js +0 -88
- package/docs/docs/cmd/pp/card/card-clone.mdx +0 -103
- package/docs/docs/cmd/pp/card/card-get.mdx +0 -212
- package/docs/docs/cmd/pp/card/card-list.mdx +0 -163
- package/docs/docs/cmd/pp/card/card-remove.mdx +0 -86
- package/docs/docs/cmd/skype/report/report-activitycounts.mdx +0 -96
- package/docs/docs/cmd/skype/report/report-activityusercounts.mdx +0 -96
- package/docs/docs/cmd/skype/report/report-activityuserdetail.mdx +0 -134
- package/docs/docs/cmd/spo/mail/mail-send.mdx +0 -69
- package/docs/docs/cmd/viva/engage/engage-group-list.mdx +0 -174
- package/docs/docs/cmd/viva/engage/engage-group-user-add.mdx +0 -60
- package/docs/docs/cmd/viva/engage/engage-group-user-remove.mdx +0 -58
|
@@ -1,55 +0,0 @@
|
|
|
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 _PpCardListCommand_instances, _PpCardListCommand_initTelemetry, _PpCardListCommand_initOptions;
|
|
7
|
-
import { odata } from '../../../../utils/odata.js';
|
|
8
|
-
import { powerPlatform } from '../../../../utils/powerPlatform.js';
|
|
9
|
-
import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
|
|
10
|
-
import commands from '../../commands.js';
|
|
11
|
-
class PpCardListCommand extends PowerPlatformCommand {
|
|
12
|
-
get name() {
|
|
13
|
-
return commands.CARD_LIST;
|
|
14
|
-
}
|
|
15
|
-
get description() {
|
|
16
|
-
return 'Lists Microsoft Power Platform cards in the specified Power Platform environment.';
|
|
17
|
-
}
|
|
18
|
-
defaultProperties() {
|
|
19
|
-
return ['name', 'cardid', 'publishdate', 'createdon', 'modifiedon'];
|
|
20
|
-
}
|
|
21
|
-
constructor() {
|
|
22
|
-
super();
|
|
23
|
-
_PpCardListCommand_instances.add(this);
|
|
24
|
-
__classPrivateFieldGet(this, _PpCardListCommand_instances, "m", _PpCardListCommand_initTelemetry).call(this);
|
|
25
|
-
__classPrivateFieldGet(this, _PpCardListCommand_instances, "m", _PpCardListCommand_initOptions).call(this);
|
|
26
|
-
}
|
|
27
|
-
async commandAction(logger, args) {
|
|
28
|
-
if (this.verbose) {
|
|
29
|
-
await logger.logToStderr(`Retrieving list of cards`);
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
const dynamicsApiUrl = await powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
33
|
-
const items = await odata.getAllItems(`${dynamicsApiUrl}/api/data/v9.1/cards?$expand=owninguser($select=azureactivedirectoryobjectid,fullname)`);
|
|
34
|
-
await logger.log(items);
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
this.handleRejectedODataJsonPromise(err);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
_PpCardListCommand_instances = new WeakSet(), _PpCardListCommand_initTelemetry = function _PpCardListCommand_initTelemetry() {
|
|
42
|
-
this.telemetry.push((args) => {
|
|
43
|
-
Object.assign(this.telemetryProperties, {
|
|
44
|
-
asAdmin: !!args.options.asAdmin
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}, _PpCardListCommand_initOptions = function _PpCardListCommand_initOptions() {
|
|
48
|
-
this.options.unshift({
|
|
49
|
-
option: '-e, --environmentName <environmentName>'
|
|
50
|
-
}, {
|
|
51
|
-
option: '--asAdmin'
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
export default new PpCardListCommand();
|
|
55
|
-
//# sourceMappingURL=card-list.js.map
|
|
@@ -1,105 +0,0 @@
|
|
|
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 _PpCardRemoveCommand_instances, _PpCardRemoveCommand_initTelemetry, _PpCardRemoveCommand_initOptions, _PpCardRemoveCommand_initOptionSets, _PpCardRemoveCommand_initValidators;
|
|
7
|
-
import { cli } from '../../../../cli/cli.js';
|
|
8
|
-
import request from '../../../../request.js';
|
|
9
|
-
import { powerPlatform } from '../../../../utils/powerPlatform.js';
|
|
10
|
-
import { validation } from '../../../../utils/validation.js';
|
|
11
|
-
import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
|
|
12
|
-
import commands from '../../commands.js';
|
|
13
|
-
class PpCardRemoveCommand extends PowerPlatformCommand {
|
|
14
|
-
get name() {
|
|
15
|
-
return commands.CARD_REMOVE;
|
|
16
|
-
}
|
|
17
|
-
get description() {
|
|
18
|
-
return 'Removes a specific Microsoft Power Platform card in the specified Power Platform environment.';
|
|
19
|
-
}
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
_PpCardRemoveCommand_instances.add(this);
|
|
23
|
-
__classPrivateFieldGet(this, _PpCardRemoveCommand_instances, "m", _PpCardRemoveCommand_initTelemetry).call(this);
|
|
24
|
-
__classPrivateFieldGet(this, _PpCardRemoveCommand_instances, "m", _PpCardRemoveCommand_initOptions).call(this);
|
|
25
|
-
__classPrivateFieldGet(this, _PpCardRemoveCommand_instances, "m", _PpCardRemoveCommand_initValidators).call(this);
|
|
26
|
-
__classPrivateFieldGet(this, _PpCardRemoveCommand_instances, "m", _PpCardRemoveCommand_initOptionSets).call(this);
|
|
27
|
-
}
|
|
28
|
-
async commandAction(logger, args) {
|
|
29
|
-
if (this.verbose) {
|
|
30
|
-
await logger.logToStderr(`Removing card '${args.options.id || args.options.name}'...`);
|
|
31
|
-
}
|
|
32
|
-
if (args.options.force) {
|
|
33
|
-
await this.deleteCard(args, logger);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove card '${args.options.id || args.options.name}'?` });
|
|
37
|
-
if (result) {
|
|
38
|
-
await this.deleteCard(args, logger);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async getCardId(args, dynamicsApiUrl, logger) {
|
|
43
|
-
if (args.options.id) {
|
|
44
|
-
return args.options.id;
|
|
45
|
-
}
|
|
46
|
-
if (this.verbose) {
|
|
47
|
-
await logger.logToStderr(`Retrieving the card with name '${args.options.name}'`);
|
|
48
|
-
}
|
|
49
|
-
const card = await powerPlatform.getCardByName(dynamicsApiUrl, args.options.name);
|
|
50
|
-
return card.cardid;
|
|
51
|
-
}
|
|
52
|
-
async deleteCard(args, logger) {
|
|
53
|
-
try {
|
|
54
|
-
const dynamicsApiUrl = await powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
55
|
-
const cardId = await this.getCardId(args, dynamicsApiUrl, logger);
|
|
56
|
-
if (this.verbose) {
|
|
57
|
-
await logger.logToStderr(`Deleting card with Id '${cardId}'`);
|
|
58
|
-
}
|
|
59
|
-
const requestOptions = {
|
|
60
|
-
url: `${dynamicsApiUrl}/api/data/v9.1/cards(${cardId})`,
|
|
61
|
-
headers: {
|
|
62
|
-
accept: 'application/json;odata.metadata=none'
|
|
63
|
-
},
|
|
64
|
-
responseType: 'json'
|
|
65
|
-
};
|
|
66
|
-
await request.delete(requestOptions);
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
69
|
-
this.handleRejectedODataJsonPromise(err);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
_PpCardRemoveCommand_instances = new WeakSet(), _PpCardRemoveCommand_initTelemetry = function _PpCardRemoveCommand_initTelemetry() {
|
|
74
|
-
this.telemetry.push((args) => {
|
|
75
|
-
Object.assign(this.telemetryProperties, {
|
|
76
|
-
id: typeof args.options.id !== 'undefined',
|
|
77
|
-
name: typeof args.options.name !== 'undefined',
|
|
78
|
-
asAdmin: !!args.options.asAdmin,
|
|
79
|
-
force: !!args.options.force
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
}, _PpCardRemoveCommand_initOptions = function _PpCardRemoveCommand_initOptions() {
|
|
83
|
-
this.options.unshift({
|
|
84
|
-
option: '-e, --environmentName <environmentName>'
|
|
85
|
-
}, {
|
|
86
|
-
option: '-i, --id [id]'
|
|
87
|
-
}, {
|
|
88
|
-
option: '-n, --name [name]'
|
|
89
|
-
}, {
|
|
90
|
-
option: '--asAdmin'
|
|
91
|
-
}, {
|
|
92
|
-
option: '-f, --force'
|
|
93
|
-
});
|
|
94
|
-
}, _PpCardRemoveCommand_initOptionSets = function _PpCardRemoveCommand_initOptionSets() {
|
|
95
|
-
this.optionSets.push({ options: ['id', 'name'] });
|
|
96
|
-
}, _PpCardRemoveCommand_initValidators = function _PpCardRemoveCommand_initValidators() {
|
|
97
|
-
this.validators.push(async (args) => {
|
|
98
|
-
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
99
|
-
return `${args.options.id} is not a valid GUID`;
|
|
100
|
-
}
|
|
101
|
-
return true;
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
export default new PpCardRemoveCommand();
|
|
105
|
-
//# sourceMappingURL=card-remove.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import PeriodBasedReport from '../../../base/PeriodBasedReport.js';
|
|
2
|
-
import commands from '../../commands.js';
|
|
3
|
-
class SkypeReportActivityCountsCommand extends PeriodBasedReport {
|
|
4
|
-
get name() {
|
|
5
|
-
return commands.REPORT_ACTIVITYCOUNTS;
|
|
6
|
-
}
|
|
7
|
-
get usageEndpoint() {
|
|
8
|
-
return 'getSkypeForBusinessActivityCounts';
|
|
9
|
-
}
|
|
10
|
-
get description() {
|
|
11
|
-
return 'Gets the trends on how many users organized and participated in conference sessions held in your organization through Skype for Business. The report also includes the number of peer-to-peer sessions';
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export default new SkypeReportActivityCountsCommand();
|
|
15
|
-
//# sourceMappingURL=report-activitycounts.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import PeriodBasedReport from '../../../base/PeriodBasedReport.js';
|
|
2
|
-
import commands from '../../commands.js';
|
|
3
|
-
class SkypeReportActivityUserCountsCommand extends PeriodBasedReport {
|
|
4
|
-
get name() {
|
|
5
|
-
return commands.REPORT_ACTIVITYUSERCOUNTS;
|
|
6
|
-
}
|
|
7
|
-
get usageEndpoint() {
|
|
8
|
-
return 'getSkypeForBusinessActivityUserCounts';
|
|
9
|
-
}
|
|
10
|
-
get description() {
|
|
11
|
-
return 'Gets the trends on how many unique users organized and participated in conference sessions held in your organization through Skype for Business. The report also includes the number of peer-to-peer sessions';
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export default new SkypeReportActivityUserCountsCommand();
|
|
15
|
-
//# sourceMappingURL=report-activityusercounts.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import DateAndPeriodBasedReport from '../../../base/DateAndPeriodBasedReport.js';
|
|
2
|
-
import commands from '../../commands.js';
|
|
3
|
-
class SkypeReportActivityUserDetailCommand extends DateAndPeriodBasedReport {
|
|
4
|
-
get name() {
|
|
5
|
-
return commands.REPORT_ACTIVITYUSERDETAIL;
|
|
6
|
-
}
|
|
7
|
-
get usageEndpoint() {
|
|
8
|
-
return 'getSkypeForBusinessActivityUserDetail';
|
|
9
|
-
}
|
|
10
|
-
get description() {
|
|
11
|
-
return 'Gets details about Skype for Business activity by user';
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export default new SkypeReportActivityUserDetailCommand();
|
|
15
|
-
//# sourceMappingURL=report-activityuserdetail.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const prefix = 'skype';
|
|
2
|
-
export default {
|
|
3
|
-
REPORT_ACTIVITYCOUNTS: `${prefix} report activitycounts`,
|
|
4
|
-
REPORT_ACTIVITYUSERCOUNTS: `${prefix} report activityusercounts`,
|
|
5
|
-
REPORT_ACTIVITYUSERDETAIL: `${prefix} report activityuserdetail`
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=commands.js.map
|
|
@@ -1,108 +0,0 @@
|
|
|
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 _SpoMailSendCommand_instances, _SpoMailSendCommand_initTelemetry, _SpoMailSendCommand_initOptions, _SpoMailSendCommand_initValidators;
|
|
7
|
-
import request from '../../../../request.js';
|
|
8
|
-
import { validation } from '../../../../utils/validation.js';
|
|
9
|
-
import SpoCommand from '../../../base/SpoCommand.js';
|
|
10
|
-
import commands from '../../commands.js';
|
|
11
|
-
import outlookCommands from '../../../outlook/commands.js';
|
|
12
|
-
class SpoMailSendCommand extends SpoCommand {
|
|
13
|
-
get name() {
|
|
14
|
-
return commands.MAIL_SEND;
|
|
15
|
-
}
|
|
16
|
-
get description() {
|
|
17
|
-
return 'Sends an e-mail from SharePoint';
|
|
18
|
-
}
|
|
19
|
-
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
_SpoMailSendCommand_instances.add(this);
|
|
22
|
-
__classPrivateFieldGet(this, _SpoMailSendCommand_instances, "m", _SpoMailSendCommand_initTelemetry).call(this);
|
|
23
|
-
__classPrivateFieldGet(this, _SpoMailSendCommand_instances, "m", _SpoMailSendCommand_initOptions).call(this);
|
|
24
|
-
__classPrivateFieldGet(this, _SpoMailSendCommand_instances, "m", _SpoMailSendCommand_initValidators).call(this);
|
|
25
|
-
}
|
|
26
|
-
async commandAction(logger, args) {
|
|
27
|
-
await this.showDeprecationWarning(logger, commands.MAIL_SEND, outlookCommands.MAIL_SEND);
|
|
28
|
-
const params = {
|
|
29
|
-
properties: {
|
|
30
|
-
__metadata: { "type": "SP.Utilities.EmailProperties" },
|
|
31
|
-
Body: args.options.body,
|
|
32
|
-
Subject: args.options.subject,
|
|
33
|
-
To: { results: args.options.to.replace(/\s+/g, '').split(',') }
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
if (args.options.from && args.options.from.length > 0) {
|
|
37
|
-
params.properties.From = args.options.from;
|
|
38
|
-
}
|
|
39
|
-
if (args.options.cc && args.options.cc.length > 0) {
|
|
40
|
-
params.properties.CC = { results: args.options.cc.replace(/\s+/g, '').split(',') };
|
|
41
|
-
}
|
|
42
|
-
if (args.options.bcc && args.options.bcc.length > 0) {
|
|
43
|
-
params.properties.BCC = { results: args.options.bcc.replace(/\s+/g, '').split(',') };
|
|
44
|
-
}
|
|
45
|
-
if (args.options.additionalHeaders) {
|
|
46
|
-
const h = JSON.parse(args.options.additionalHeaders);
|
|
47
|
-
params.properties.AdditionalHeaders = {
|
|
48
|
-
__metadata: { "type": "Collection(SP.KeyValue)" },
|
|
49
|
-
results: Object.keys(h).map(key => {
|
|
50
|
-
return {
|
|
51
|
-
__metadata: {
|
|
52
|
-
type: 'SP.KeyValue'
|
|
53
|
-
},
|
|
54
|
-
Key: key,
|
|
55
|
-
Value: h[key],
|
|
56
|
-
ValueType: 'Edm.String'
|
|
57
|
-
};
|
|
58
|
-
})
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
const requestOptions = {
|
|
62
|
-
url: `${args.options.webUrl}/_api/SP.Utilities.Utility.SendEmail`,
|
|
63
|
-
headers: {
|
|
64
|
-
'content-type': 'application/json;odata=verbose'
|
|
65
|
-
},
|
|
66
|
-
responseType: 'json',
|
|
67
|
-
data: params
|
|
68
|
-
};
|
|
69
|
-
try {
|
|
70
|
-
await request.post(requestOptions);
|
|
71
|
-
}
|
|
72
|
-
catch (err) {
|
|
73
|
-
this.handleRejectedODataJsonPromise(err);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
_SpoMailSendCommand_instances = new WeakSet(), _SpoMailSendCommand_initTelemetry = function _SpoMailSendCommand_initTelemetry() {
|
|
78
|
-
this.telemetry.push((args) => {
|
|
79
|
-
Object.assign(this.telemetryProperties, {
|
|
80
|
-
from: typeof args.options.from !== 'undefined',
|
|
81
|
-
cc: typeof args.options.cc !== 'undefined',
|
|
82
|
-
bcc: typeof args.options.bcc !== 'undefined',
|
|
83
|
-
additionalHeaders: typeof args.options.additionalHeaders !== 'undefined'
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}, _SpoMailSendCommand_initOptions = function _SpoMailSendCommand_initOptions() {
|
|
87
|
-
this.options.unshift({
|
|
88
|
-
option: '-u, --webUrl <webUrl>'
|
|
89
|
-
}, {
|
|
90
|
-
option: '--to <to>'
|
|
91
|
-
}, {
|
|
92
|
-
option: '--subject <subject>'
|
|
93
|
-
}, {
|
|
94
|
-
option: '--body <body>'
|
|
95
|
-
}, {
|
|
96
|
-
option: '--from [from]'
|
|
97
|
-
}, {
|
|
98
|
-
option: '--cc [cc]'
|
|
99
|
-
}, {
|
|
100
|
-
option: '--bcc [bcc]'
|
|
101
|
-
}, {
|
|
102
|
-
option: '--additionalHeaders [additionalHeaders]'
|
|
103
|
-
});
|
|
104
|
-
}, _SpoMailSendCommand_initValidators = function _SpoMailSendCommand_initValidators() {
|
|
105
|
-
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
|
|
106
|
-
};
|
|
107
|
-
export default new SpoMailSendCommand();
|
|
108
|
-
//# sourceMappingURL=mail-send.js.map
|
|
@@ -1,93 +0,0 @@
|
|
|
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 _VivaEngageGroupListCommand_instances, _VivaEngageGroupListCommand_initTelemetry, _VivaEngageGroupListCommand_initOptions, _VivaEngageGroupListCommand_initValidators;
|
|
7
|
-
import request from '../../../../request.js';
|
|
8
|
-
import VivaEngageCommand from '../../../base/VivaEngageCommand.js';
|
|
9
|
-
import commands from '../../commands.js';
|
|
10
|
-
class VivaEngageGroupListCommand extends VivaEngageCommand {
|
|
11
|
-
get name() {
|
|
12
|
-
return commands.ENGAGE_GROUP_LIST;
|
|
13
|
-
}
|
|
14
|
-
get description() {
|
|
15
|
-
return 'Returns the list of groups in a Viva Engage network or the groups for a specific user';
|
|
16
|
-
}
|
|
17
|
-
constructor() {
|
|
18
|
-
super();
|
|
19
|
-
_VivaEngageGroupListCommand_instances.add(this);
|
|
20
|
-
this.items = [];
|
|
21
|
-
__classPrivateFieldGet(this, _VivaEngageGroupListCommand_instances, "m", _VivaEngageGroupListCommand_initTelemetry).call(this);
|
|
22
|
-
__classPrivateFieldGet(this, _VivaEngageGroupListCommand_instances, "m", _VivaEngageGroupListCommand_initOptions).call(this);
|
|
23
|
-
__classPrivateFieldGet(this, _VivaEngageGroupListCommand_instances, "m", _VivaEngageGroupListCommand_initValidators).call(this);
|
|
24
|
-
}
|
|
25
|
-
defaultProperties() {
|
|
26
|
-
return ['id', 'name', 'email', 'privacy', 'external', 'moderated'];
|
|
27
|
-
}
|
|
28
|
-
async getAllItems(logger, args, page) {
|
|
29
|
-
let endpoint = `${this.resource}/v1`;
|
|
30
|
-
if (args.options.userId) {
|
|
31
|
-
endpoint += `/groups/for_user/${args.options.userId}.json`;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
endpoint += `/groups.json`;
|
|
35
|
-
}
|
|
36
|
-
endpoint += `?page=${page}`;
|
|
37
|
-
const requestOptions = {
|
|
38
|
-
url: endpoint,
|
|
39
|
-
headers: {
|
|
40
|
-
accept: 'application/json;odata.metadata=none',
|
|
41
|
-
'content-type': 'application/json;odata=nometadata'
|
|
42
|
-
},
|
|
43
|
-
responseType: 'json'
|
|
44
|
-
};
|
|
45
|
-
const output = await request.get(requestOptions);
|
|
46
|
-
if (!output.length) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this.items = this.items.concat(output);
|
|
50
|
-
if (args.options.limit && this.items.length > args.options.limit) {
|
|
51
|
-
this.items = this.items.slice(0, args.options.limit);
|
|
52
|
-
}
|
|
53
|
-
else if (this.items.length % 50 === 0) {
|
|
54
|
-
await this.getAllItems(logger, args, ++page);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async commandAction(logger, args) {
|
|
58
|
-
this.items = []; // this will reset the items array in interactive mode
|
|
59
|
-
try {
|
|
60
|
-
await this.getAllItems(logger, args, 1);
|
|
61
|
-
await logger.log(this.items);
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
this.handleRejectedODataJsonPromise(err);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
_VivaEngageGroupListCommand_instances = new WeakSet(), _VivaEngageGroupListCommand_initTelemetry = function _VivaEngageGroupListCommand_initTelemetry() {
|
|
69
|
-
this.telemetry.push((args) => {
|
|
70
|
-
Object.assign(this.telemetryProperties, {
|
|
71
|
-
userId: args.options.userId !== undefined,
|
|
72
|
-
limit: args.options.limit !== undefined
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}, _VivaEngageGroupListCommand_initOptions = function _VivaEngageGroupListCommand_initOptions() {
|
|
76
|
-
this.options.unshift({
|
|
77
|
-
option: '--userId [userId]'
|
|
78
|
-
}, {
|
|
79
|
-
option: '--limit [limit]'
|
|
80
|
-
});
|
|
81
|
-
}, _VivaEngageGroupListCommand_initValidators = function _VivaEngageGroupListCommand_initValidators() {
|
|
82
|
-
this.validators.push(async (args) => {
|
|
83
|
-
if (args.options.userId && typeof args.options.userId !== 'number') {
|
|
84
|
-
return `${args.options.userId} is not a number`;
|
|
85
|
-
}
|
|
86
|
-
if (args.options.limit && typeof args.options.limit !== 'number') {
|
|
87
|
-
return `${args.options.limit} is not a number`;
|
|
88
|
-
}
|
|
89
|
-
return true;
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
export default new VivaEngageGroupListCommand();
|
|
93
|
-
//# sourceMappingURL=engage-group-list.js.map
|
|
@@ -1,73 +0,0 @@
|
|
|
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 _VivaEngageGroupUserAddCommand_instances, _VivaEngageGroupUserAddCommand_initTelemetry, _VivaEngageGroupUserAddCommand_initOptions, _VivaEngageGroupUserAddCommand_initValidators;
|
|
7
|
-
import request from '../../../../request.js';
|
|
8
|
-
import VivaEngageCommand from '../../../base/VivaEngageCommand.js';
|
|
9
|
-
import commands from '../../commands.js';
|
|
10
|
-
class VivaEngageGroupUserAddCommand extends VivaEngageCommand {
|
|
11
|
-
get name() {
|
|
12
|
-
return commands.ENGAGE_GROUP_USER_ADD;
|
|
13
|
-
}
|
|
14
|
-
get description() {
|
|
15
|
-
return 'Adds a user to a Viva Engage Group';
|
|
16
|
-
}
|
|
17
|
-
constructor() {
|
|
18
|
-
super();
|
|
19
|
-
_VivaEngageGroupUserAddCommand_instances.add(this);
|
|
20
|
-
__classPrivateFieldGet(this, _VivaEngageGroupUserAddCommand_instances, "m", _VivaEngageGroupUserAddCommand_initTelemetry).call(this);
|
|
21
|
-
__classPrivateFieldGet(this, _VivaEngageGroupUserAddCommand_instances, "m", _VivaEngageGroupUserAddCommand_initOptions).call(this);
|
|
22
|
-
__classPrivateFieldGet(this, _VivaEngageGroupUserAddCommand_instances, "m", _VivaEngageGroupUserAddCommand_initValidators).call(this);
|
|
23
|
-
}
|
|
24
|
-
async commandAction(logger, args) {
|
|
25
|
-
const requestOptions = {
|
|
26
|
-
url: `${this.resource}/v1/group_memberships.json`,
|
|
27
|
-
headers: {
|
|
28
|
-
accept: 'application/json;odata.metadata=none',
|
|
29
|
-
'content-type': 'application/json;odata=nometadata'
|
|
30
|
-
},
|
|
31
|
-
responseType: 'json',
|
|
32
|
-
data: {
|
|
33
|
-
group_id: args.options.groupId,
|
|
34
|
-
user_id: args.options.id,
|
|
35
|
-
email: args.options.email
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
try {
|
|
39
|
-
await request.post(requestOptions);
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
this.handleRejectedODataJsonPromise(err);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
_VivaEngageGroupUserAddCommand_instances = new WeakSet(), _VivaEngageGroupUserAddCommand_initTelemetry = function _VivaEngageGroupUserAddCommand_initTelemetry() {
|
|
47
|
-
this.telemetry.push((args) => {
|
|
48
|
-
Object.assign(this.telemetryProperties, {
|
|
49
|
-
id: typeof args.options.id !== 'undefined',
|
|
50
|
-
email: typeof args.options.email !== 'undefined'
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}, _VivaEngageGroupUserAddCommand_initOptions = function _VivaEngageGroupUserAddCommand_initOptions() {
|
|
54
|
-
this.options.unshift({
|
|
55
|
-
option: '--groupId <groupId>'
|
|
56
|
-
}, {
|
|
57
|
-
option: '--id [id]'
|
|
58
|
-
}, {
|
|
59
|
-
option: '--email [email]'
|
|
60
|
-
});
|
|
61
|
-
}, _VivaEngageGroupUserAddCommand_initValidators = function _VivaEngageGroupUserAddCommand_initValidators() {
|
|
62
|
-
this.validators.push(async (args) => {
|
|
63
|
-
if (typeof args.options.groupId !== 'number') {
|
|
64
|
-
return `${args.options.groupId} is not a number`;
|
|
65
|
-
}
|
|
66
|
-
if (args.options.id && typeof args.options.id !== 'number') {
|
|
67
|
-
return `${args.options.id} is not a number`;
|
|
68
|
-
}
|
|
69
|
-
return true;
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
export default new VivaEngageGroupUserAddCommand();
|
|
73
|
-
//# sourceMappingURL=engage-group-user-add.js.map
|
|
@@ -1,88 +0,0 @@
|
|
|
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 _VivaEngageGroupUserRemoveCommand_instances, _VivaEngageGroupUserRemoveCommand_initTelemetry, _VivaEngageGroupUserRemoveCommand_initOptions, _VivaEngageGroupUserRemoveCommand_initValidators;
|
|
7
|
-
import { cli } from '../../../../cli/cli.js';
|
|
8
|
-
import request from '../../../../request.js';
|
|
9
|
-
import VivaEngageCommand from "../../../base/VivaEngageCommand.js";
|
|
10
|
-
import commands from '../../commands.js';
|
|
11
|
-
class VivaEngageGroupUserRemoveCommand extends VivaEngageCommand {
|
|
12
|
-
get name() {
|
|
13
|
-
return commands.ENGAGE_GROUP_USER_REMOVE;
|
|
14
|
-
}
|
|
15
|
-
get description() {
|
|
16
|
-
return 'Removes a user from a Viva Engage group';
|
|
17
|
-
}
|
|
18
|
-
constructor() {
|
|
19
|
-
super();
|
|
20
|
-
_VivaEngageGroupUserRemoveCommand_instances.add(this);
|
|
21
|
-
__classPrivateFieldGet(this, _VivaEngageGroupUserRemoveCommand_instances, "m", _VivaEngageGroupUserRemoveCommand_initTelemetry).call(this);
|
|
22
|
-
__classPrivateFieldGet(this, _VivaEngageGroupUserRemoveCommand_instances, "m", _VivaEngageGroupUserRemoveCommand_initOptions).call(this);
|
|
23
|
-
__classPrivateFieldGet(this, _VivaEngageGroupUserRemoveCommand_instances, "m", _VivaEngageGroupUserRemoveCommand_initValidators).call(this);
|
|
24
|
-
}
|
|
25
|
-
async commandAction(logger, args) {
|
|
26
|
-
if (args.options.force) {
|
|
27
|
-
await this.executeRemoveAction(args.options);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
let messagePrompt = `Are you sure you want to leave group ${args.options.groupId}?`;
|
|
31
|
-
if (args.options.id) {
|
|
32
|
-
messagePrompt = `Are you sure you want to remove the user ${args.options.id} from the group ${args.options.groupId}?`;
|
|
33
|
-
}
|
|
34
|
-
const result = await cli.promptForConfirmation({ message: messagePrompt });
|
|
35
|
-
if (result) {
|
|
36
|
-
await this.executeRemoveAction(args.options);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async executeRemoveAction(options) {
|
|
41
|
-
const requestOptions = {
|
|
42
|
-
url: `${this.resource}/v1/group_memberships.json`,
|
|
43
|
-
headers: {
|
|
44
|
-
accept: 'application/json;odata.metadata=none',
|
|
45
|
-
'content-type': 'application/json;odata=nometadata'
|
|
46
|
-
},
|
|
47
|
-
responseType: 'json',
|
|
48
|
-
data: {
|
|
49
|
-
group_id: options.groupId,
|
|
50
|
-
user_id: options.id
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
try {
|
|
54
|
-
await request.delete(requestOptions);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
this.handleRejectedODataJsonPromise(err);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
_VivaEngageGroupUserRemoveCommand_instances = new WeakSet(), _VivaEngageGroupUserRemoveCommand_initTelemetry = function _VivaEngageGroupUserRemoveCommand_initTelemetry() {
|
|
62
|
-
this.telemetry.push((args) => {
|
|
63
|
-
Object.assign(this.telemetryProperties, {
|
|
64
|
-
userId: args.options.id !== undefined,
|
|
65
|
-
force: (!(!args.options.force)).toString()
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}, _VivaEngageGroupUserRemoveCommand_initOptions = function _VivaEngageGroupUserRemoveCommand_initOptions() {
|
|
69
|
-
this.options.unshift({
|
|
70
|
-
option: '--groupId <groupId>'
|
|
71
|
-
}, {
|
|
72
|
-
option: '--id [id]'
|
|
73
|
-
}, {
|
|
74
|
-
option: '-f, --force'
|
|
75
|
-
});
|
|
76
|
-
}, _VivaEngageGroupUserRemoveCommand_initValidators = function _VivaEngageGroupUserRemoveCommand_initValidators() {
|
|
77
|
-
this.validators.push(async (args) => {
|
|
78
|
-
if (args.options.groupId && typeof args.options.groupId !== 'number') {
|
|
79
|
-
return `${args.options.groupId} is not a number`;
|
|
80
|
-
}
|
|
81
|
-
if (args.options.id && typeof args.options.id !== 'number') {
|
|
82
|
-
return `${args.options.id} is not a number`;
|
|
83
|
-
}
|
|
84
|
-
return true;
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
export default new VivaEngageGroupUserRemoveCommand();
|
|
88
|
-
//# sourceMappingURL=engage-group-user-remove.js.map
|