@pnp/cli-microsoft365 11.4.0-beta.13d597c → 11.4.0-beta.37c2235
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/.devproxy/api-specs/sharepoint.yaml +43 -0
- package/README.md +1 -1
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +1 -1
- package/dist/AuthServer.js +2 -4
- package/dist/Command.js +2 -2
- package/dist/cli/cli.js +9 -9
- package/dist/m365/adaptivecard/commands/adaptivecard-send.js +10 -11
- package/dist/m365/app/commands/app-open.js +3 -4
- package/dist/m365/app/commands/permission/permission-add.js +4 -5
- package/dist/m365/base/AppCommand.js +3 -3
- package/dist/m365/booking/commands/business/business-get.js +6 -8
- package/dist/m365/booking/commands/business/business-list.js +2 -1
- package/dist/m365/cli/commands/app/app-add.js +5 -7
- package/dist/m365/commands/docs.js +1 -1
- package/dist/m365/commands/login.js +22 -19
- package/dist/m365/commands/logout.js +1 -1
- package/dist/m365/commands/status.js +2 -1
- package/dist/m365/connection/commands/connection-list.js +2 -1
- package/dist/m365/connection/commands/connection-set.js +15 -29
- package/dist/m365/context/commands/context-remove.js +4 -6
- package/dist/m365/context/commands/option/option-remove.js +5 -7
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-add.js +5 -7
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +7 -9
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +4 -5
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +8 -10
- package/dist/m365/entra/commands/license/license-list.js +1 -1
- package/dist/m365/entra/commands/m365group/m365group-remove.js +1 -1
- package/dist/m365/entra/commands/multitenant/multitenant-add.js +3 -4
- package/dist/m365/entra/commands/organization/organization-list.js +4 -6
- package/dist/m365/entra/commands/organization/organization-set.js +24 -26
- package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +21 -34
- package/dist/m365/entra/commands/roledefinition/roledefinition-add.js +8 -10
- package/dist/m365/entra/commands/roledefinition/roledefinition-get.js +11 -13
- package/dist/m365/entra/commands/roledefinition/roledefinition-list.js +5 -7
- package/dist/m365/entra/commands/roledefinition/roledefinition-remove.js +11 -13
- package/dist/m365/entra/commands/roledefinition/roledefinition-set.js +15 -17
- package/dist/m365/entra/commands/rolepermission/rolepermission-list.js +5 -7
- package/dist/m365/entra/commands/user/user-session-revoke.js +9 -13
- package/dist/m365/exo/commands/approleassignment/approleassignment-add.js +29 -31
- package/dist/m365/flow/commands/environment/environment-get.js +5 -7
- package/dist/m365/flow/commands/environment/environment-list.js +2 -1
- package/dist/m365/flow/commands/recyclebinitem/recyclebinitem-list.js +4 -6
- package/dist/m365/flow/commands/recyclebinitem/recyclebinitem-restore.js +5 -11
- package/dist/m365/graph/commands/directoryextension/directoryextension-add.js +11 -13
- package/dist/m365/graph/commands/directoryextension/directoryextension-get.js +10 -19
- package/dist/m365/graph/commands/directoryextension/directoryextension-list.js +6 -12
- package/dist/m365/graph/commands/directoryextension/directoryextension-remove.js +11 -20
- package/dist/m365/graph/commands/openextension/openextension-add.js +12 -13
- package/dist/m365/graph/commands/openextension/openextension-get.js +12 -14
- package/dist/m365/graph/commands/openextension/openextension-list.js +11 -13
- package/dist/m365/graph/commands/openextension/openextension-remove.js +13 -15
- package/dist/m365/graph/commands/openextension/openextension-set.js +16 -17
- package/dist/m365/onedrive/commands/onedrive-list.js +2 -1
- package/dist/m365/outlook/commands/mail/mail-searchfolder-add.js +9 -14
- package/dist/m365/outlook/commands/mailbox/mailbox-settings-get.js +8 -12
- package/dist/m365/outlook/commands/mailbox/mailbox-settings-set.js +15 -15
- package/dist/m365/outlook/commands/roomlist/roomlist-list.js +2 -1
- package/dist/m365/pa/commands/environment/environment-get.js +5 -7
- package/dist/m365/pa/commands/environment/environment-list.js +2 -1
- package/dist/m365/planner/commands/tenant/tenant-settings-list.js +1 -1
- package/dist/m365/pp/commands/environment/environment-get.js +5 -7
- package/dist/m365/pp/commands/environment/environment-list.js +3 -4
- package/dist/m365/pp/commands/gateway/gateway-list.js +1 -1
- package/dist/m365/pp/commands/tenant/tenant-settings-list.js +1 -1
- package/dist/m365/pp/commands/website/website-get.js +12 -12
- package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +2 -1
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +1 -1
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +1 -1
- package/dist/m365/spe/commands/container/container-add.js +10 -15
- package/dist/m365/spe/commands/container/container-permission-list.js +4 -6
- package/dist/m365/spe/commands/container/container-recyclebinitem-list.js +5 -10
- package/dist/m365/spe/commands/container/container-recyclebinitem-remove.js +96 -0
- package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +7 -12
- package/dist/m365/spe/commands/container/container-remove.js +10 -16
- package/dist/m365/spe/commands/containertype/containertype-add.js +15 -20
- package/dist/m365/spe/commands/containertype/containertype-get.js +6 -13
- package/dist/m365/spe/commands/containertype/containertype-remove.js +7 -14
- package/dist/m365/spe/commands.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +4 -6
- package/dist/m365/spo/commands/file/file-add.js +49 -11
- package/dist/m365/spo/commands/file/file-version-keep.js +10 -14
- package/dist/m365/spo/commands/homesite/homesite-add.js +13 -15
- package/dist/m365/spo/commands/homesite/homesite-get.js +8 -9
- package/dist/m365/spo/commands/homesite/homesite-remove.js +9 -10
- package/dist/m365/spo/commands/homesite/homesite-set.js +13 -14
- package/dist/m365/spo/commands/list/DefaultColumnValue.js +2 -0
- package/dist/m365/spo/commands/list/list-defaultvalue-clear.js +13 -17
- package/dist/m365/spo/commands/list/list-defaultvalue-get.js +124 -0
- package/dist/m365/spo/commands/list/list-defaultvalue-list.js +13 -37
- package/dist/m365/spo/commands/list/list-defaultvalue-remove.js +12 -16
- package/dist/m365/spo/commands/list/list-defaultvalue-set.js +11 -15
- package/dist/m365/spo/commands/list/list-view-add.js +16 -20
- package/dist/m365/spo/commands/listitem/listitem-set.js +1 -1
- package/dist/m365/spo/commands/page/page-control-remove.js +11 -15
- package/dist/m365/spo/commands/page/page-get.js +10 -11
- package/dist/m365/spo/commands/page/page-header-set.js +97 -89
- package/dist/m365/spo/commands/page/page-publish.js +9 -10
- package/dist/m365/spo/commands/page/page-section-remove.js +11 -12
- package/dist/m365/spo/commands/page/page-set.js +26 -26
- package/dist/m365/spo/commands/site/site-appcatalog-list.js +4 -6
- package/dist/m365/spo/commands/site/site-get.js +6 -8
- package/dist/m365/spo/commands/site/site-sharingpermission-set.js +7 -9
- package/dist/m365/spo/commands/site/site-versionpolicy-get.js +11 -13
- package/dist/m365/spo/commands/web/web-alert-list.js +20 -27
- package/dist/m365/spo/commands/web/web-alert-remove.js +15 -20
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/spp/commands/model/model-apply.js +18 -24
- package/dist/m365/teams/commands/callrecord/callrecord-list.js +5 -9
- package/dist/m365/teams/commands/chat/chat-message-list.js +26 -27
- package/dist/m365/teams/commands/chat/chat-message-send.js +12 -3
- package/dist/m365/teams/commands/chat/chatUtil.js +1 -1
- package/dist/m365/tenant/commands/people/people-pronouns-set.js +4 -6
- package/dist/m365/tenant/commands/report/report-settings-set.js +4 -6
- package/dist/m365/viva/commands/engage/engage-community-user-add.js +17 -22
- package/dist/m365/viva/commands/engage/engage-community-user-list.js +8 -14
- package/dist/m365/viva/commands/engage/engage-community-user-remove.js +14 -22
- package/dist/m365/viva/commands/engage/engage-role-member-list.js +6 -11
- package/dist/utils/spo.js +30 -2
- package/dist/utils/zod.js +41 -76
- package/docs/docs/cmd/entra/app/app-permission-add.mdx +19 -0
- package/docs/docs/cmd/entra/app/app-permission-list.mdx +19 -0
- package/docs/docs/cmd/entra/app/app-permission-remove.mdx +21 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-remove.mdx +79 -0
- package/docs/docs/cmd/spo/file/file-add.mdx +140 -1
- package/docs/docs/cmd/spo/list/list-defaultvalue-get.mdx +118 -0
- package/docs/docs/cmd/spo/page/page-header-set.mdx +28 -8
- package/docs/docs/cmd/spo/page/page-set.mdx +35 -5
- package/docs/docs/cmd/teams/chat/chat-message-list.mdx +34 -7
- package/docs/docs/cmd/teams/chat/chat-message-send.mdx +23 -1
- package/npm-shrinkwrap.json +274 -248
- package/package.json +12 -11
|
@@ -1,34 +1,27 @@
|
|
|
1
|
-
import commands from '../../commands.js';
|
|
2
|
-
import SpoCommand from '../../../base/SpoCommand.js';
|
|
3
|
-
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
1
|
import { z } from 'zod';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { spo } from '../../../../utils/spo.js';
|
|
2
|
+
import { cli } from '../../../../cli/cli.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
8
4
|
import { entraUser } from '../../../../utils/entraUser.js';
|
|
9
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
6
|
import { odata } from '../../../../utils/odata.js';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
import { spo } from '../../../../utils/spo.js';
|
|
8
|
+
import { validation } from '../../../../utils/validation.js';
|
|
9
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
10
|
+
import commands from '../../commands.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
webUrl: z.string().alias('u')
|
|
14
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
15
|
+
error: e => `'${e.input}' is not a valid SharePoint site URL.`
|
|
16
|
+
}),
|
|
17
|
+
listId: z.uuid().optional(),
|
|
22
18
|
listUrl: z.string().optional(),
|
|
23
19
|
listTitle: z.string().optional(),
|
|
24
|
-
userName: z.string().refine(upn => validation.isValidUserPrincipalName(upn),
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
userId: z.
|
|
28
|
-
|
|
29
|
-
})).optional()
|
|
30
|
-
})
|
|
31
|
-
.strict();
|
|
20
|
+
userName: z.string().optional().refine(upn => typeof upn === 'undefined' || validation.isValidUserPrincipalName(upn), {
|
|
21
|
+
error: e => `'${e.input}' is not a valid UPN.`
|
|
22
|
+
}),
|
|
23
|
+
userId: z.uuid().optional()
|
|
24
|
+
});
|
|
32
25
|
class SpoWebAlertListCommand extends SpoCommand {
|
|
33
26
|
get name() {
|
|
34
27
|
return commands.WEB_ALERT_LIST;
|
|
@@ -45,10 +38,10 @@ class SpoWebAlertListCommand extends SpoCommand {
|
|
|
45
38
|
getRefinedSchema(schema) {
|
|
46
39
|
return schema
|
|
47
40
|
.refine(options => [options.listId, options.listUrl, options.listTitle].filter(x => x !== undefined).length <= 1, {
|
|
48
|
-
|
|
41
|
+
error: `Specify either listId, listUrl, or listTitle, but not more than one.`
|
|
49
42
|
})
|
|
50
43
|
.refine(options => [options.userName, options.userId].filter(x => x !== undefined).length <= 1, {
|
|
51
|
-
|
|
44
|
+
error: `Specify either userName or userId, but not both.`
|
|
52
45
|
});
|
|
53
46
|
}
|
|
54
47
|
async commandAction(logger, args) {
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import commands from '../../commands.js';
|
|
2
|
-
import SpoCommand from '../../../base/SpoCommand.js';
|
|
3
|
-
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
1
|
import { z } from 'zod';
|
|
5
|
-
import { zod } from '../../../../utils/zod.js';
|
|
6
|
-
import { validation } from '../../../../utils/validation.js';
|
|
7
|
-
import { formatting } from '../../../../utils/formatting.js';
|
|
8
|
-
import request from '../../../../request.js';
|
|
9
2
|
import { cli } from '../../../../cli/cli.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})
|
|
22
|
-
.
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import request from '../../../../request.js';
|
|
5
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
7
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
8
|
+
import commands from '../../commands.js';
|
|
9
|
+
const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
webUrl: z.string().alias('u')
|
|
12
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
13
|
+
error: e => `'${e.input}' is not a valid SharePoint URL.`
|
|
14
|
+
}),
|
|
15
|
+
id: z.uuid(),
|
|
16
|
+
force: z.boolean().optional().alias('f')
|
|
17
|
+
});
|
|
23
18
|
class SpoWebAlertRemoveCommand extends SpoCommand {
|
|
24
19
|
get name() {
|
|
25
20
|
return commands.WEB_ALERT_REMOVE;
|
|
@@ -141,6 +141,7 @@ export default {
|
|
|
141
141
|
LIST_CONTENTTYPE_REMOVE: `${prefix} list contenttype remove`,
|
|
142
142
|
LIST_CONTENTTYPE_DEFAULT_SET: `${prefix} list contenttype default set`,
|
|
143
143
|
LIST_DEFAULTVALUE_CLEAR: `${prefix} list defaultvalue clear`,
|
|
144
|
+
LIST_DEFAULTVALUE_GET: `${prefix} list defaultvalue get`,
|
|
144
145
|
LIST_DEFAULTVALUE_LIST: `${prefix} list defaultvalue list`,
|
|
145
146
|
LIST_DEFAULTVALUE_REMOVE: `${prefix} list defaultvalue remove`,
|
|
146
147
|
LIST_DEFAULTVALUE_SET: `${prefix} list defaultvalue set`,
|
|
@@ -7,31 +7,25 @@ import SpoCommand from '../../../base/SpoCommand.js';
|
|
|
7
7
|
import commands from '../../commands.js';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
webUrl:
|
|
18
|
-
.refine(url => validation.isValidSharePointUrl(url) === true,
|
|
19
|
-
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})).optional()),
|
|
25
|
-
title: zod.alias('t', z.string()).optional(),
|
|
10
|
+
export const options = z.strictObject({
|
|
11
|
+
...globalOptionsZod.shape,
|
|
12
|
+
contentCenterUrl: z.string()
|
|
13
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
14
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
15
|
+
})
|
|
16
|
+
.alias('c'),
|
|
17
|
+
webUrl: z.string()
|
|
18
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
19
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
20
|
+
})
|
|
21
|
+
.alias('u'),
|
|
22
|
+
id: z.uuid().optional().alias('i'),
|
|
23
|
+
title: z.string().optional().alias('t'),
|
|
26
24
|
listTitle: z.string().optional(),
|
|
27
|
-
listId: z.
|
|
28
|
-
.refine(listId => validation.isValidGuid(listId) === true, listId => ({
|
|
29
|
-
message: `${listId} is not a valid GUID.`
|
|
30
|
-
})).optional(),
|
|
25
|
+
listId: z.uuid().optional(),
|
|
31
26
|
listUrl: z.string().optional(),
|
|
32
27
|
viewOption: z.enum(['NewViewAsDefault', 'DoNotChangeDefault', 'TileViewAsDefault']).optional()
|
|
33
|
-
})
|
|
34
|
-
.strict();
|
|
28
|
+
});
|
|
35
29
|
class SppModelApplyCommand extends SpoCommand {
|
|
36
30
|
get name() {
|
|
37
31
|
return commands.MODEL_APPLY;
|
|
@@ -45,10 +39,10 @@ class SppModelApplyCommand extends SpoCommand {
|
|
|
45
39
|
getRefinedSchema(schema) {
|
|
46
40
|
return schema
|
|
47
41
|
.refine(options => [options.id, options.title].filter(x => x !== undefined).length === 1, {
|
|
48
|
-
|
|
42
|
+
error: `Specify exactly one of the following options: 'id' or 'title'.`
|
|
49
43
|
})
|
|
50
44
|
.refine(options => [options.listTitle, options.listId, options.listUrl].filter(x => x !== undefined).length === 1, {
|
|
51
|
-
|
|
45
|
+
error: `Specify exactly one of the following options: 'listTitle', 'listId' or 'listUrl'.`
|
|
52
46
|
});
|
|
53
47
|
}
|
|
54
48
|
async commandAction(logger, args) {
|
|
@@ -5,12 +5,9 @@ import GraphApplicationCommand from '../../../base/GraphApplicationCommand.js';
|
|
|
5
5
|
import { validation } from '../../../../utils/validation.js';
|
|
6
6
|
import { entraUser } from '../../../../utils/entraUser.js';
|
|
7
7
|
import { odata } from '../../../../utils/odata.js';
|
|
8
|
-
const options =
|
|
9
|
-
.
|
|
10
|
-
userId: z.
|
|
11
|
-
.refine((val) => validation.isValidGuid(val), {
|
|
12
|
-
message: 'Invalid GUID.'
|
|
13
|
-
}).optional(),
|
|
8
|
+
export const options = z.strictObject({
|
|
9
|
+
...globalOptionsZod.shape,
|
|
10
|
+
userId: z.uuid().optional(),
|
|
14
11
|
userName: z.string()
|
|
15
12
|
.refine((val) => validation.isValidUserPrincipalName(val), {
|
|
16
13
|
message: 'Invalid user principal name.'
|
|
@@ -41,8 +38,7 @@ const options = globalOptionsZod
|
|
|
41
38
|
}, {
|
|
42
39
|
message: 'Date must be a valid ISO date within the last 30 days and not in the future.'
|
|
43
40
|
}).optional()
|
|
44
|
-
})
|
|
45
|
-
.strict();
|
|
41
|
+
});
|
|
46
42
|
class TeamsCallRecordListCommand extends GraphApplicationCommand {
|
|
47
43
|
get name() {
|
|
48
44
|
return commands.CALLRECORD_LIST;
|
|
@@ -59,7 +55,7 @@ class TeamsCallRecordListCommand extends GraphApplicationCommand {
|
|
|
59
55
|
getRefinedSchema(schema) {
|
|
60
56
|
return schema
|
|
61
57
|
.refine((options) => [options.userId, options.userName].filter(o => o !== undefined).length <= 1, {
|
|
62
|
-
|
|
58
|
+
error: 'Use one of the following options: userId or userName but not both.'
|
|
63
59
|
})
|
|
64
60
|
.refine((options) => [options.startDateTime, options.endDateTime].filter(o => o !== undefined).length <= 1 || new Date(options.startDateTime) < new Date(options.endDateTime), {
|
|
65
61
|
message: 'Value of startDateTime, must be before endDateTime.'
|
|
@@ -1,13 +1,22 @@
|
|
|
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 _TeamsChatMessageListCommand_instances, _TeamsChatMessageListCommand_initOptions, _TeamsChatMessageListCommand_initValidators;
|
|
7
1
|
import { odata } from '../../../../utils/odata.js';
|
|
8
2
|
import { validation } from '../../../../utils/validation.js';
|
|
9
3
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
4
|
import commands from '../../commands.js';
|
|
5
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export const options = z.strictObject({
|
|
8
|
+
...globalOptionsZod.shape,
|
|
9
|
+
chatId: z.string()
|
|
10
|
+
.refine(id => validation.isValidTeamsChatId(id), {
|
|
11
|
+
error: e => `'${e.input}' is not a valid value for option chatId.`
|
|
12
|
+
})
|
|
13
|
+
.alias('i'),
|
|
14
|
+
endDateTime: z.string()
|
|
15
|
+
.refine(time => validation.isValidISODateTime(time), {
|
|
16
|
+
error: e => `'${e.input}' is not a valid ISO date-time string for option endDateTime.`
|
|
17
|
+
})
|
|
18
|
+
.optional()
|
|
19
|
+
});
|
|
11
20
|
class TeamsChatMessageListCommand extends GraphCommand {
|
|
12
21
|
get name() {
|
|
13
22
|
return commands.CHAT_MESSAGE_LIST;
|
|
@@ -16,19 +25,21 @@ class TeamsChatMessageListCommand extends GraphCommand {
|
|
|
16
25
|
return 'Lists all messages from a chat';
|
|
17
26
|
}
|
|
18
27
|
defaultProperties() {
|
|
19
|
-
return ['id', 'shortBody'];
|
|
28
|
+
return ['id', 'createdDateTime', 'shortBody'];
|
|
20
29
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_TeamsChatMessageListCommand_instances.add(this);
|
|
24
|
-
__classPrivateFieldGet(this, _TeamsChatMessageListCommand_instances, "m", _TeamsChatMessageListCommand_initOptions).call(this);
|
|
25
|
-
__classPrivateFieldGet(this, _TeamsChatMessageListCommand_instances, "m", _TeamsChatMessageListCommand_initValidators).call(this);
|
|
30
|
+
get schema() {
|
|
31
|
+
return options;
|
|
26
32
|
}
|
|
27
33
|
async commandAction(logger, args) {
|
|
28
|
-
const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/messages`;
|
|
29
34
|
try {
|
|
30
|
-
|
|
31
|
-
if (args.options.
|
|
35
|
+
let apiUrl = `${this.resource}/v1.0/chats/${args.options.chatId}/messages`;
|
|
36
|
+
if (args.options.endDateTime) {
|
|
37
|
+
// You can only filter results if the request URL contains the $orderby and $filter query parameters configured for the same property;
|
|
38
|
+
// otherwise, the $filter query option is ignored.
|
|
39
|
+
apiUrl += `?$filter=createdDateTime lt ${args.options.endDateTime}&$orderby=createdDateTime desc`;
|
|
40
|
+
}
|
|
41
|
+
const items = await odata.getAllItems(apiUrl);
|
|
42
|
+
if (args.options.output && args.options.output !== 'json') {
|
|
32
43
|
items.forEach(i => {
|
|
33
44
|
// hoist the content to body for readability
|
|
34
45
|
i.body = i.body.content;
|
|
@@ -53,17 +64,5 @@ class TeamsChatMessageListCommand extends GraphCommand {
|
|
|
53
64
|
}
|
|
54
65
|
}
|
|
55
66
|
}
|
|
56
|
-
_TeamsChatMessageListCommand_instances = new WeakSet(), _TeamsChatMessageListCommand_initOptions = function _TeamsChatMessageListCommand_initOptions() {
|
|
57
|
-
this.options.unshift({
|
|
58
|
-
option: '-i, --chatId <chatId>'
|
|
59
|
-
});
|
|
60
|
-
}, _TeamsChatMessageListCommand_initValidators = function _TeamsChatMessageListCommand_initValidators() {
|
|
61
|
-
this.validators.push(async (args) => {
|
|
62
|
-
if (!validation.isValidTeamsChatId(args.options.chatId)) {
|
|
63
|
-
return `${args.options.chatId} is not a valid Teams chat ID`;
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
67
|
export default new TeamsChatMessageListCommand();
|
|
69
68
|
//# sourceMappingURL=chat-message-list.js.map
|
|
@@ -23,6 +23,7 @@ class TeamsChatMessageSendCommand extends GraphDelegatedCommand {
|
|
|
23
23
|
constructor() {
|
|
24
24
|
super();
|
|
25
25
|
_TeamsChatMessageSendCommand_instances.add(this);
|
|
26
|
+
this.contentTypes = ['text', 'html'];
|
|
26
27
|
__classPrivateFieldGet(this, _TeamsChatMessageSendCommand_instances, "m", _TeamsChatMessageSendCommand_initTelemetry).call(this);
|
|
27
28
|
__classPrivateFieldGet(this, _TeamsChatMessageSendCommand_instances, "m", _TeamsChatMessageSendCommand_initOptions).call(this);
|
|
28
29
|
__classPrivateFieldGet(this, _TeamsChatMessageSendCommand_instances, "m", _TeamsChatMessageSendCommand_initValidators).call(this);
|
|
@@ -47,7 +48,7 @@ class TeamsChatMessageSendCommand extends GraphDelegatedCommand {
|
|
|
47
48
|
}
|
|
48
49
|
async ensureChatIdByUserEmails(userEmailsOption) {
|
|
49
50
|
const userEmails = userEmailsOption.trim().toLowerCase().split(',').filter(e => e && e !== '');
|
|
50
|
-
const currentUserEmail = accessToken.getUserNameFromAccessToken(auth.connection.accessTokens[
|
|
51
|
+
const currentUserEmail = accessToken.getUserNameFromAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken).toLowerCase();
|
|
51
52
|
const existingChats = await chatUtil.findExistingChatsByParticipants([currentUserEmail, ...userEmails]);
|
|
52
53
|
if (!existingChats || existingChats.length === 0) {
|
|
53
54
|
const chat = await this.createConversation([currentUserEmail, ...userEmails]);
|
|
@@ -112,11 +113,12 @@ class TeamsChatMessageSendCommand extends GraphDelegatedCommand {
|
|
|
112
113
|
url: `${this.resource}/v1.0/chats/${chatId}/messages`,
|
|
113
114
|
headers: {
|
|
114
115
|
accept: 'application/json;odata.metadata=none',
|
|
115
|
-
'content-type': 'application/json
|
|
116
|
+
'content-type': 'application/json'
|
|
116
117
|
},
|
|
117
118
|
responseType: 'json',
|
|
118
119
|
data: {
|
|
119
120
|
body: {
|
|
121
|
+
contentType: args.options.contentType || 'text',
|
|
120
122
|
content: args.options.message
|
|
121
123
|
}
|
|
122
124
|
}
|
|
@@ -129,7 +131,8 @@ _TeamsChatMessageSendCommand_instances = new WeakSet(), _TeamsChatMessageSendCom
|
|
|
129
131
|
Object.assign(this.telemetryProperties, {
|
|
130
132
|
chatId: typeof args.options.chatId !== 'undefined',
|
|
131
133
|
userEmails: typeof args.options.userEmails !== 'undefined',
|
|
132
|
-
chatName: typeof args.options.chatName !== 'undefined'
|
|
134
|
+
chatName: typeof args.options.chatName !== 'undefined',
|
|
135
|
+
contentType: args.options.contentType ?? 'text'
|
|
133
136
|
});
|
|
134
137
|
});
|
|
135
138
|
}, _TeamsChatMessageSendCommand_initOptions = function _TeamsChatMessageSendCommand_initOptions() {
|
|
@@ -141,6 +144,9 @@ _TeamsChatMessageSendCommand_instances = new WeakSet(), _TeamsChatMessageSendCom
|
|
|
141
144
|
option: '--chatName [chatName]'
|
|
142
145
|
}, {
|
|
143
146
|
option: '-m, --message <message>'
|
|
147
|
+
}, {
|
|
148
|
+
option: '--contentType [contentType]',
|
|
149
|
+
autocomplete: this.contentTypes
|
|
144
150
|
});
|
|
145
151
|
}, _TeamsChatMessageSendCommand_initValidators = function _TeamsChatMessageSendCommand_initValidators() {
|
|
146
152
|
this.validators.push(async (args) => {
|
|
@@ -153,6 +159,9 @@ _TeamsChatMessageSendCommand_instances = new WeakSet(), _TeamsChatMessageSendCom
|
|
|
153
159
|
return `${args.options.userEmails} contains one or more invalid email addresses.`;
|
|
154
160
|
}
|
|
155
161
|
}
|
|
162
|
+
if (args.options.contentType && !this.contentTypes.includes(args.options.contentType)) {
|
|
163
|
+
return `'${args.options.contentType}' is not a valid value for option contentType. Allowed values are ${this.contentTypes.join(', ')}.`;
|
|
164
|
+
}
|
|
156
165
|
return true;
|
|
157
166
|
});
|
|
158
167
|
}, _TeamsChatMessageSendCommand_initOptionSets = function _TeamsChatMessageSendCommand_initOptionSets() {
|
|
@@ -3,7 +3,7 @@ import { odata } from '../../../../utils/odata.js';
|
|
|
3
3
|
export const chatUtil = {
|
|
4
4
|
/**
|
|
5
5
|
* Finds existing Microsoft Teams chats by participants, using the Microsoft Graph
|
|
6
|
-
* @param expectedMemberEmails a string array of participant
|
|
6
|
+
* @param expectedMemberEmails a string array of participant email addresses
|
|
7
7
|
* @param logger a logger to pipe into the graph request odata helper.
|
|
8
8
|
*/
|
|
9
9
|
async findExistingChatsByParticipants(expectedMemberEmails) {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
3
|
import request from '../../../../request.js';
|
|
4
|
-
import { zod } from '../../../../utils/zod.js';
|
|
5
4
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
6
5
|
import commands from '../../commands.js';
|
|
7
|
-
const options =
|
|
8
|
-
.
|
|
9
|
-
enabled:
|
|
10
|
-
})
|
|
11
|
-
.strict();
|
|
6
|
+
export const options = z.strictObject({
|
|
7
|
+
...globalOptionsZod.shape,
|
|
8
|
+
enabled: z.boolean().alias('e')
|
|
9
|
+
});
|
|
12
10
|
class TenantPeoplePronounsSetCommand extends GraphCommand {
|
|
13
11
|
get name() {
|
|
14
12
|
return commands.PEOPLE_PRONOUNS_SET;
|
|
@@ -3,12 +3,10 @@ import GraphCommand from '../../../base/GraphCommand.js';
|
|
|
3
3
|
import commands from '../../commands.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
})
|
|
11
|
-
.strict();
|
|
6
|
+
export const options = z.strictObject({
|
|
7
|
+
...globalOptionsZod.shape,
|
|
8
|
+
displayConcealedNames: z.boolean().alias('d')
|
|
9
|
+
});
|
|
12
10
|
class TenantReportSettingsSetCommand extends GraphCommand {
|
|
13
11
|
get name() {
|
|
14
12
|
return commands.REPORT_SETTINGS_SET;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
-
import { zod } from '../../../../utils/zod.js';
|
|
4
3
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
4
|
import commands from '../../commands.js';
|
|
6
5
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -8,25 +7,21 @@ import { vivaEngage } from '../../../../utils/vivaEngage.js';
|
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { entraUser } from '../../../../utils/entraUser.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
11
|
-
const options =
|
|
12
|
-
.
|
|
10
|
+
export const options = z.strictObject({
|
|
11
|
+
...globalOptionsZod.shape,
|
|
13
12
|
communityId: z.string().optional(),
|
|
14
|
-
communityDisplayName:
|
|
15
|
-
entraGroupId: z.
|
|
16
|
-
.refine(id => validation.isValidGuid(id), id => ({
|
|
17
|
-
message: `'${id}' is not a valid GUID.`
|
|
18
|
-
})).optional(),
|
|
13
|
+
communityDisplayName: z.string().optional().alias('n'),
|
|
14
|
+
entraGroupId: z.uuid().optional(),
|
|
19
15
|
ids: z.string()
|
|
20
|
-
.refine(ids => validation.isValidGuidArray(ids) === true,
|
|
21
|
-
|
|
22
|
-
})
|
|
16
|
+
.refine(ids => validation.isValidGuidArray(ids) === true, {
|
|
17
|
+
error: e => `The following GUIDs are invalid: ${e.input}.`
|
|
18
|
+
}).optional(),
|
|
23
19
|
userNames: z.string()
|
|
24
|
-
.refine(userNames => validation.isValidUserPrincipalNameArray(userNames) === true,
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
role:
|
|
28
|
-
})
|
|
29
|
-
.strict();
|
|
20
|
+
.refine(userNames => validation.isValidUserPrincipalNameArray(userNames) === true, {
|
|
21
|
+
error: e => `The following user principal names are invalid: ${e.input}.`
|
|
22
|
+
}).optional(),
|
|
23
|
+
role: z.enum(['Admin', 'Member']).alias('r')
|
|
24
|
+
});
|
|
30
25
|
class VivaEngageCommunityUserAddCommand extends GraphCommand {
|
|
31
26
|
get name() {
|
|
32
27
|
return commands.ENGAGE_COMMUNITY_USER_ADD;
|
|
@@ -40,16 +35,16 @@ class VivaEngageCommunityUserAddCommand extends GraphCommand {
|
|
|
40
35
|
getRefinedSchema(schema) {
|
|
41
36
|
return schema
|
|
42
37
|
.refine(options => [options.communityId, options.communityDisplayName, options.entraGroupId].filter(x => x !== undefined).length === 1, {
|
|
43
|
-
|
|
38
|
+
error: 'Specify either communityId, communityDisplayName, or entraGroupId, but not multiple.'
|
|
44
39
|
})
|
|
45
40
|
.refine(options => options.communityId || options.communityDisplayName || options.entraGroupId, {
|
|
46
|
-
|
|
41
|
+
error: 'Specify at least one of communityId, communityDisplayName, or entraGroupId.'
|
|
47
42
|
})
|
|
48
43
|
.refine(options => options.ids || options.userNames, {
|
|
49
|
-
|
|
44
|
+
error: 'Specify either of ids or userNames.'
|
|
50
45
|
})
|
|
51
|
-
.refine(options => options.userNames !== undefined || options.ids !== undefined, {
|
|
52
|
-
|
|
46
|
+
.refine(options => typeof options.userNames !== 'undefined' || typeof options.ids !== 'undefined', {
|
|
47
|
+
error: 'Specify either ids or userNames, but not both.'
|
|
53
48
|
});
|
|
54
49
|
}
|
|
55
50
|
async commandAction(logger, args) {
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
-
import { zod } from '../../../../utils/zod.js';
|
|
4
3
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
4
|
import commands from '../../commands.js';
|
|
6
|
-
import { validation } from '../../../../utils/validation.js';
|
|
7
5
|
import { vivaEngage } from '../../../../utils/vivaEngage.js';
|
|
8
6
|
import { odata } from '../../../../utils/odata.js';
|
|
9
|
-
const options =
|
|
10
|
-
.
|
|
7
|
+
export const options = z.strictObject({
|
|
8
|
+
...globalOptionsZod.shape,
|
|
11
9
|
communityId: z.string().optional(),
|
|
12
|
-
communityDisplayName:
|
|
13
|
-
entraGroupId: z.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})).optional(),
|
|
17
|
-
role: zod.alias('r', z.enum(['Admin', 'Member']).optional())
|
|
18
|
-
})
|
|
19
|
-
.strict();
|
|
10
|
+
communityDisplayName: z.string().optional().alias('n'),
|
|
11
|
+
entraGroupId: z.uuid().optional(),
|
|
12
|
+
role: z.enum(['Admin', 'Member']).optional().alias('r')
|
|
13
|
+
});
|
|
20
14
|
class VivaEngageCommunityUserListCommand extends GraphCommand {
|
|
21
15
|
get name() {
|
|
22
16
|
return commands.ENGAGE_COMMUNITY_USER_LIST;
|
|
@@ -30,10 +24,10 @@ class VivaEngageCommunityUserListCommand extends GraphCommand {
|
|
|
30
24
|
getRefinedSchema(schema) {
|
|
31
25
|
return schema
|
|
32
26
|
.refine(options => [options.communityId, options.communityDisplayName, options.entraGroupId].filter(x => x !== undefined).length === 1, {
|
|
33
|
-
|
|
27
|
+
error: 'Specify either communityId, communityDisplayName, or entraGroupId, but not multiple.'
|
|
34
28
|
})
|
|
35
29
|
.refine(options => options.communityId || options.communityDisplayName || options.entraGroupId, {
|
|
36
|
-
|
|
30
|
+
error: 'Specify at least one of communityId, communityDisplayName, or entraGroupId.'
|
|
37
31
|
});
|
|
38
32
|
}
|
|
39
33
|
defaultProperties() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
-
import { zod } from '../../../../utils/zod.js';
|
|
4
3
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
4
|
import commands from '../../commands.js';
|
|
6
5
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -8,25 +7,18 @@ import { vivaEngage } from '../../../../utils/vivaEngage.js';
|
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { entraUser } from '../../../../utils/entraUser.js';
|
|
10
9
|
import { cli } from '../../../../cli/cli.js';
|
|
11
|
-
const options =
|
|
12
|
-
.
|
|
10
|
+
export const options = z.strictObject({
|
|
11
|
+
...globalOptionsZod.shape,
|
|
13
12
|
communityId: z.string().optional(),
|
|
14
|
-
communityDisplayName:
|
|
15
|
-
entraGroupId: z.
|
|
16
|
-
|
|
17
|
-
message: `'${id}' is not a valid GUID.`
|
|
18
|
-
})).optional(),
|
|
19
|
-
id: z.string()
|
|
20
|
-
.refine(id => validation.isValidGuid(id), id => ({
|
|
21
|
-
message: `'${id}' is not a valid GUID.`
|
|
22
|
-
})).optional(),
|
|
13
|
+
communityDisplayName: z.string().optional().alias('n'),
|
|
14
|
+
entraGroupId: z.uuid().optional(),
|
|
15
|
+
id: z.uuid().optional(),
|
|
23
16
|
userName: z.string()
|
|
24
|
-
.refine(userName => validation.isValidUserPrincipalName(userName),
|
|
25
|
-
|
|
26
|
-
})
|
|
17
|
+
.refine(userName => validation.isValidUserPrincipalName(userName), {
|
|
18
|
+
error: e => `'${e.input}' is not a valid user principal name.`
|
|
19
|
+
}).optional(),
|
|
27
20
|
force: z.boolean().optional()
|
|
28
|
-
})
|
|
29
|
-
.strict();
|
|
21
|
+
});
|
|
30
22
|
class VivaEngageCommunityUserRemoveCommand extends GraphCommand {
|
|
31
23
|
get name() {
|
|
32
24
|
return commands.ENGAGE_COMMUNITY_USER_REMOVE;
|
|
@@ -40,16 +32,16 @@ class VivaEngageCommunityUserRemoveCommand extends GraphCommand {
|
|
|
40
32
|
getRefinedSchema(schema) {
|
|
41
33
|
return schema
|
|
42
34
|
.refine(options => [options.communityId, options.communityDisplayName, options.entraGroupId].filter(x => x !== undefined).length === 1, {
|
|
43
|
-
|
|
35
|
+
error: 'Specify either communityId, communityDisplayName, or entraGroupId, but not multiple.'
|
|
44
36
|
})
|
|
45
37
|
.refine(options => options.communityId || options.communityDisplayName || options.entraGroupId, {
|
|
46
|
-
|
|
38
|
+
error: 'Specify at least one of communityId, communityDisplayName, or entraGroupId.'
|
|
47
39
|
})
|
|
48
40
|
.refine(options => options.id || options.userName, {
|
|
49
|
-
|
|
41
|
+
error: 'Specify either of id or userName.'
|
|
50
42
|
})
|
|
51
|
-
.refine(options => options.userName !== undefined || options.id !== undefined, {
|
|
52
|
-
|
|
43
|
+
.refine(options => typeof options.userName !== 'undefined' || typeof options.id !== 'undefined', {
|
|
44
|
+
error: 'Specify either id or userName, but not both.'
|
|
53
45
|
});
|
|
54
46
|
}
|
|
55
47
|
async commandAction(logger, args) {
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
-
import { zod } from '../../../../utils/zod.js';
|
|
4
3
|
import { odata } from '../../../../utils/odata.js';
|
|
5
4
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
6
5
|
import commands from '../../commands.js';
|
|
7
|
-
import { validation } from '../../../../utils/validation.js';
|
|
8
6
|
import { vivaEngage } from '../../../../utils/vivaEngage.js';
|
|
9
|
-
const options =
|
|
10
|
-
.
|
|
11
|
-
roleId:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
roleName: zod.alias('n', z.string().optional())
|
|
15
|
-
})
|
|
16
|
-
.strict();
|
|
7
|
+
export const options = z.strictObject({
|
|
8
|
+
...globalOptionsZod.shape,
|
|
9
|
+
roleId: z.uuid().optional().alias('i'),
|
|
10
|
+
roleName: z.string().optional().alias('n')
|
|
11
|
+
});
|
|
17
12
|
class VivaEngageRoleMemberListCommand extends GraphCommand {
|
|
18
13
|
get name() {
|
|
19
14
|
return commands.ENGAGE_ROLE_MEMBER_LIST;
|
|
@@ -27,7 +22,7 @@ class VivaEngageRoleMemberListCommand extends GraphCommand {
|
|
|
27
22
|
getRefinedSchema(schema) {
|
|
28
23
|
return schema
|
|
29
24
|
.refine(options => [options.roleId, options.roleName].filter(x => x !== undefined).length === 1, {
|
|
30
|
-
|
|
25
|
+
error: 'Specify either roleId, or roleName, but not both.'
|
|
31
26
|
});
|
|
32
27
|
}
|
|
33
28
|
defaultProperties() {
|