@pnp/cli-microsoft365 11.7.0-beta.bd906c5 → 11.8.0-beta.50a1b64
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 +53 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/m365/context/commands/option/option-list.js +6 -1
- package/dist/m365/entra/commands/resourcenamespace/resourcenamespace-list.js +6 -0
- package/dist/m365/external/commands/connection/connection-list.js +6 -0
- package/dist/m365/outlook/commands/calendar/calendar-set.js +132 -0
- package/dist/m365/outlook/commands/calendargroup/calendargroup-get.js +114 -0
- package/dist/m365/outlook/commands/calendargroup/calendargroup-remove.js +98 -0
- package/dist/m365/outlook/commands.js +3 -0
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +9 -5
- package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +10 -9
- package/dist/m365/spfx/commands/project/project-doctor.js +6 -0
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +12 -10
- package/dist/m365/spfx/commands/project/project-upgrade/rules/DependencyRule.js +11 -5
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027001_OVERRIDES_rushstack_heft.js +10 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.22.0.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.23.0-rc.0.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade.js +23 -6
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-add.js +13 -1
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +24 -3
- package/dist/m365/spo/commands/brandcenter/brandcenter-colors-list.js +59 -0
- package/dist/m365/spo/commands/file/file-archive.js +83 -0
- package/dist/m365/spo/commands/propertybag/propertybag-set.js +3 -9
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +20 -0
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +27 -2
- package/dist/m365/spo/commands/tenant/tenant-settings-set.js +5 -1
- package/dist/m365/spo/commands.js +2 -0
- package/dist/request.js +1 -17
- package/dist/utils/packageManager.js +29 -7
- package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +21 -0
- package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +19 -0
- package/docs/docs/cmd/entra/m365group/m365group-user-remove.mdx +21 -0
- package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +21 -0
- package/docs/docs/cmd/entra/roledefinition/roledefinition-add.mdx +19 -0
- package/docs/docs/cmd/entra/roledefinition/roledefinition-get.mdx +19 -0
- package/docs/docs/cmd/entra/roledefinition/roledefinition-list.mdx +19 -0
- package/docs/docs/cmd/entra/roledefinition/roledefinition-remove.mdx +21 -0
- package/docs/docs/cmd/entra/roledefinition/roledefinition-set.mdx +21 -0
- package/docs/docs/cmd/entra/siteclassification/siteclassification-disable.mdx +21 -0
- package/docs/docs/cmd/entra/siteclassification/siteclassification-enable.mdx +21 -0
- package/docs/docs/cmd/entra/siteclassification/siteclassification-get.mdx +19 -0
- package/docs/docs/cmd/entra/siteclassification/siteclassification-set.mdx +20 -0
- package/docs/docs/cmd/external/connection/connection-add.mdx +21 -0
- package/docs/docs/cmd/external/connection/connection-doctor.mdx +19 -0
- package/docs/docs/cmd/external/connection/connection-get.mdx +19 -0
- package/docs/docs/cmd/external/connection/connection-list.mdx +19 -0
- package/docs/docs/cmd/external/connection/connection-remove.mdx +21 -0
- package/docs/docs/cmd/external/connection/connection-schema-add.mdx +21 -0
- package/docs/docs/cmd/external/connection/connection-urltoitemresolver-add.mdx +21 -0
- package/docs/docs/cmd/external/item/item-add.mdx +19 -0
- package/docs/docs/cmd/outlook/calendar/calendar-set.mdx +178 -0
- package/docs/docs/cmd/outlook/calendargroup/calendargroup-get.mdx +125 -0
- package/docs/docs/cmd/outlook/calendargroup/calendargroup-remove.mdx +91 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.mdx +14 -11
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +9 -6
- package/docs/docs/cmd/spo/brandcenter/brandcenter-colors-list.mdx +115 -0
- package/docs/docs/cmd/spo/file/file-archive.mdx +68 -0
- package/docs/docs/cmd/spo/propertybag/propertybag-set.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.mdx +13 -10
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-set.mdx +7 -4
- package/docs/docs/cmd/spo/tenant/tenant-settings-set.mdx +3 -0
- package/npm-shrinkwrap.json +583 -224
- package/package.json +33 -19
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021009_PKG_overrides_rushstack_heft.js +0 -45
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import {
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CommandError, globalOptionsZod } from '../../../../Command.js';
|
|
3
4
|
import ContextCommand from '../../../base/ContextCommand.js';
|
|
4
5
|
import commands from '../../commands.js';
|
|
6
|
+
export const options = z.strictObject({ ...globalOptionsZod.shape });
|
|
5
7
|
class ContextOptionListCommand extends ContextCommand {
|
|
6
8
|
get name() {
|
|
7
9
|
return commands.OPTION_LIST;
|
|
@@ -9,6 +11,9 @@ class ContextOptionListCommand extends ContextCommand {
|
|
|
9
11
|
get description() {
|
|
10
12
|
return 'List all options added to the context';
|
|
11
13
|
}
|
|
14
|
+
get schema() {
|
|
15
|
+
return options;
|
|
16
|
+
}
|
|
12
17
|
async commandAction(logger) {
|
|
13
18
|
if (this.verbose) {
|
|
14
19
|
await logger.logToStderr(`Retrieving context options...`);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { odata } from '../../../../utils/odata.js';
|
|
2
2
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
3
|
import commands from '../../commands.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
6
|
+
export const options = z.strictObject({ ...globalOptionsZod.shape });
|
|
4
7
|
class EntraResourcenamespaceListCommand extends GraphCommand {
|
|
5
8
|
get name() {
|
|
6
9
|
return commands.RESOURCENAMESPACE_LIST;
|
|
@@ -8,6 +11,9 @@ class EntraResourcenamespaceListCommand extends GraphCommand {
|
|
|
8
11
|
get description() {
|
|
9
12
|
return 'Get a list of the RBAC resource namespaces and their properties';
|
|
10
13
|
}
|
|
14
|
+
get schema() {
|
|
15
|
+
return options;
|
|
16
|
+
}
|
|
11
17
|
defaultProperties() {
|
|
12
18
|
return ['id', 'name'];
|
|
13
19
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { odata } from '../../../../utils/odata.js';
|
|
2
2
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
3
|
import commands from '../../commands.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
6
|
+
export const options = z.strictObject({ ...globalOptionsZod.shape });
|
|
4
7
|
class ExternalConnectionListCommand extends GraphCommand {
|
|
5
8
|
get name() {
|
|
6
9
|
return commands.CONNECTION_LIST;
|
|
@@ -11,6 +14,9 @@ class ExternalConnectionListCommand extends GraphCommand {
|
|
|
11
14
|
alias() {
|
|
12
15
|
return [commands.EXTERNALCONNECTION_LIST];
|
|
13
16
|
}
|
|
17
|
+
get schema() {
|
|
18
|
+
return options;
|
|
19
|
+
}
|
|
14
20
|
defaultProperties() {
|
|
15
21
|
return ['id', 'name', 'state'];
|
|
16
22
|
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
4
|
+
import commands from '../../commands.js';
|
|
5
|
+
import { validation } from '../../../../utils/validation.js';
|
|
6
|
+
import request from '../../../../request.js';
|
|
7
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
8
|
+
import auth from '../../../../Auth.js';
|
|
9
|
+
import { calendarGroup } from '../../../../utils/calendarGroup.js';
|
|
10
|
+
const calendarColors = ['auto', 'lightBlue', 'lightGreen', 'lightOrange', 'lightGray', 'lightYellow', 'lightTeal', 'lightPink', 'lightBrown', 'lightRed', 'maxColor'];
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
id: z.string().alias('i'),
|
|
14
|
+
name: z.string().optional().alias('n'),
|
|
15
|
+
userId: z.string().refine(id => validation.isValidGuid(id), {
|
|
16
|
+
error: e => `'${e.input}' is not a valid GUID.`
|
|
17
|
+
}).optional(),
|
|
18
|
+
userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
|
|
19
|
+
error: e => `'${e.input}' is not a valid UPN.`
|
|
20
|
+
}).optional(),
|
|
21
|
+
calendarGroupId: z.string().optional(),
|
|
22
|
+
calendarGroupName: z.string().optional(),
|
|
23
|
+
color: z.enum(calendarColors).optional(),
|
|
24
|
+
isDefault: z.boolean().optional()
|
|
25
|
+
});
|
|
26
|
+
class OutlookCalendarSetCommand extends GraphCommand {
|
|
27
|
+
get name() {
|
|
28
|
+
return commands.CALENDAR_SET;
|
|
29
|
+
}
|
|
30
|
+
get description() {
|
|
31
|
+
return 'Updates a calendar for a user';
|
|
32
|
+
}
|
|
33
|
+
get schema() {
|
|
34
|
+
return options;
|
|
35
|
+
}
|
|
36
|
+
getRefinedSchema(schema) {
|
|
37
|
+
return schema
|
|
38
|
+
.refine(options => !(options.userId && options.userName), {
|
|
39
|
+
error: 'Specify either userId or userName, but not both.'
|
|
40
|
+
})
|
|
41
|
+
.refine(options => !(options.calendarGroupId && options.calendarGroupName), {
|
|
42
|
+
error: 'Specify either calendarGroupId or calendarGroupName, but not both.'
|
|
43
|
+
})
|
|
44
|
+
.refine(options => [options.name, options.color, options.isDefault].filter(o => o !== undefined).length > 0, {
|
|
45
|
+
error: 'Specify at least one of the following options: name, color, or isDefault.'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async commandAction(logger, args) {
|
|
49
|
+
try {
|
|
50
|
+
const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
|
|
51
|
+
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(token);
|
|
52
|
+
let requestUrl;
|
|
53
|
+
if (isAppOnlyAccessToken) {
|
|
54
|
+
if (!args.options.userId && !args.options.userName) {
|
|
55
|
+
throw 'When running with application permissions either userId or userName is required.';
|
|
56
|
+
}
|
|
57
|
+
const userIdentifier = args.options.userId ?? args.options.userName;
|
|
58
|
+
requestUrl = this.buildRequestUrl(userIdentifier);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (args.options.userId || args.options.userName) {
|
|
62
|
+
const currentUserId = accessToken.getUserIdFromAccessToken(token);
|
|
63
|
+
const currentUserName = accessToken.getUserNameFromAccessToken(token);
|
|
64
|
+
const isOtherUser = (args.options.userId && args.options.userId !== currentUserId) ||
|
|
65
|
+
(args.options.userName && args.options.userName.toLowerCase() !== currentUserName?.toLowerCase());
|
|
66
|
+
if (isOtherUser) {
|
|
67
|
+
const scopes = accessToken.getScopesFromAccessToken(token);
|
|
68
|
+
const hasSharedScope = scopes.some(s => s === 'Calendars.ReadWrite.Shared');
|
|
69
|
+
if (!hasSharedScope) {
|
|
70
|
+
throw 'To update calendars of other users, the Entra ID application used for authentication must have the Calendars.ReadWrite.Shared delegated permission assigned.';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const userIdentifier = args.options.userId ?? args.options.userName;
|
|
74
|
+
requestUrl = this.buildRequestUrl(userIdentifier);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
requestUrl = this.buildRequestUrl(undefined);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (this.verbose) {
|
|
81
|
+
await logger.logToStderr(`Updating calendar '${args.options.id}'...`);
|
|
82
|
+
}
|
|
83
|
+
let calendarGroupId = args.options.calendarGroupId;
|
|
84
|
+
if (args.options.calendarGroupName) {
|
|
85
|
+
const userIdForGroup = args.options.userId ?? args.options.userName ?? accessToken.getUserIdFromAccessToken(token);
|
|
86
|
+
const calendarGroupResult = await calendarGroup.getUserCalendarGroupByName(userIdForGroup, args.options.calendarGroupName, 'id');
|
|
87
|
+
calendarGroupId = calendarGroupResult.id;
|
|
88
|
+
}
|
|
89
|
+
const url = this.buildCalendarUrl(requestUrl, args.options.id, calendarGroupId);
|
|
90
|
+
const requestOptions = {
|
|
91
|
+
url,
|
|
92
|
+
headers: {
|
|
93
|
+
accept: 'application/json;odata.metadata=none'
|
|
94
|
+
},
|
|
95
|
+
responseType: 'json',
|
|
96
|
+
data: this.createRequestBody(args)
|
|
97
|
+
};
|
|
98
|
+
const result = await request.patch(requestOptions);
|
|
99
|
+
await logger.log(result);
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
this.handleRejectedODataJsonPromise(err);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
buildRequestUrl(userIdentifier) {
|
|
106
|
+
if (userIdentifier) {
|
|
107
|
+
return `${this.resource}/v1.0/users('${userIdentifier}')`;
|
|
108
|
+
}
|
|
109
|
+
return `${this.resource}/v1.0/me`;
|
|
110
|
+
}
|
|
111
|
+
buildCalendarUrl(baseUrl, calendarId, calendarGroupId) {
|
|
112
|
+
if (calendarGroupId) {
|
|
113
|
+
return `${baseUrl}/calendarGroups/${calendarGroupId}/calendars/${calendarId}`;
|
|
114
|
+
}
|
|
115
|
+
return `${baseUrl}/calendars/${calendarId}`;
|
|
116
|
+
}
|
|
117
|
+
createRequestBody(args) {
|
|
118
|
+
const data = {};
|
|
119
|
+
if (args.options.name !== undefined) {
|
|
120
|
+
data.name = args.options.name;
|
|
121
|
+
}
|
|
122
|
+
if (args.options.color !== undefined) {
|
|
123
|
+
data.color = args.options.color;
|
|
124
|
+
}
|
|
125
|
+
if (args.options.isDefault !== undefined) {
|
|
126
|
+
data.isDefaultCalendar = args.options.isDefault;
|
|
127
|
+
}
|
|
128
|
+
return data;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
export default new OutlookCalendarSetCommand();
|
|
132
|
+
//# sourceMappingURL=calendar-set.js.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
|
+
import commands from '../../commands.js';
|
|
4
|
+
import { validation } from '../../../../utils/validation.js';
|
|
5
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
6
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
7
|
+
import { odata } from '../../../../utils/odata.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
10
|
+
import auth from '../../../../Auth.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
id: z.string().optional(),
|
|
14
|
+
name: z.string().optional(),
|
|
15
|
+
userId: z.string().refine(id => validation.isValidGuid(id), {
|
|
16
|
+
error: e => `'${e.input}' is not a valid GUID.`
|
|
17
|
+
}).optional(),
|
|
18
|
+
userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
|
|
19
|
+
error: e => `'${e.input}' is not a valid UPN.`
|
|
20
|
+
}).optional()
|
|
21
|
+
});
|
|
22
|
+
class OutlookCalendarGroupGetCommand extends GraphCommand {
|
|
23
|
+
get name() {
|
|
24
|
+
return commands.CALENDARGROUP_GET;
|
|
25
|
+
}
|
|
26
|
+
get description() {
|
|
27
|
+
return 'Retrieve information about a calendar group for a user';
|
|
28
|
+
}
|
|
29
|
+
get schema() {
|
|
30
|
+
return options;
|
|
31
|
+
}
|
|
32
|
+
getRefinedSchema(schema) {
|
|
33
|
+
return schema
|
|
34
|
+
.refine(o => !(o.id && o.name), {
|
|
35
|
+
error: 'Specify either id or name, but not both.'
|
|
36
|
+
})
|
|
37
|
+
.refine(o => Boolean(o.id || o.name), {
|
|
38
|
+
error: 'Specify either id or name.'
|
|
39
|
+
})
|
|
40
|
+
.refine(o => !(o.userId && o.userName), {
|
|
41
|
+
error: 'Specify either userId or userName, but not both.'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async commandAction(logger, args) {
|
|
45
|
+
try {
|
|
46
|
+
const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
|
|
47
|
+
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(token);
|
|
48
|
+
let userIdentifier = undefined;
|
|
49
|
+
if (args.options.userId || args.options.userName) {
|
|
50
|
+
userIdentifier = args.options.userId ?? args.options.userName;
|
|
51
|
+
}
|
|
52
|
+
const encodedUserIdentifier = userIdentifier
|
|
53
|
+
? formatting.encodeQueryParameter(userIdentifier)
|
|
54
|
+
: undefined;
|
|
55
|
+
if (isAppOnlyAccessToken) {
|
|
56
|
+
if (!args.options.userId && !args.options.userName) {
|
|
57
|
+
throw 'When running with application permissions either userId or userName is required.';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (args.options.userId || args.options.userName) {
|
|
62
|
+
const currentUserId = accessToken.getUserIdFromAccessToken(token);
|
|
63
|
+
const currentUserName = accessToken.getUserNameFromAccessToken(token);
|
|
64
|
+
const isOtherUser = (args.options.userId && args.options.userId !== currentUserId) ||
|
|
65
|
+
(args.options.userName && args.options.userName.toLowerCase() !== currentUserName?.toLowerCase());
|
|
66
|
+
if (isOtherUser) {
|
|
67
|
+
const scopes = accessToken.getScopesFromAccessToken(token);
|
|
68
|
+
const hasSharedScope = scopes.some(s => s === 'Calendars.Read.Shared' || s === 'Calendars.ReadWrite.Shared');
|
|
69
|
+
if (!hasSharedScope) {
|
|
70
|
+
throw `To retrieve calendar groups of other users, the Entra ID application used for authentication must have either the Calendars.Read.Shared or Calendars.ReadWrite.Shared delegated permission assigned.`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const getCalendarGroupByName = async (calendarGroupName) => {
|
|
76
|
+
const userPath = encodedUserIdentifier ? `users('${encodedUserIdentifier}')` : 'me';
|
|
77
|
+
const calendarGroups = await odata.getAllItems(`${this.resource}/v1.0/${userPath}/calendarGroups?$filter=name eq '${formatting.encodeQueryParameter(calendarGroupName)}'`);
|
|
78
|
+
if (calendarGroups.length === 0) {
|
|
79
|
+
throw `The specified calendar group '${calendarGroupName}' does not exist.`;
|
|
80
|
+
}
|
|
81
|
+
return calendarGroups[0];
|
|
82
|
+
};
|
|
83
|
+
if (args.options.name) {
|
|
84
|
+
if (this.verbose) {
|
|
85
|
+
await logger.logToStderr(`Retrieving calendar group '${args.options.name}'...`);
|
|
86
|
+
}
|
|
87
|
+
const result = await getCalendarGroupByName(args.options.name);
|
|
88
|
+
await logger.log(result);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const calendarGroupId = args.options.id;
|
|
92
|
+
const userPath = encodedUserIdentifier ? `users('${encodedUserIdentifier}')` : 'me';
|
|
93
|
+
const requestUrl = `${this.resource}/v1.0/${userPath}/calendarGroups/${calendarGroupId}`;
|
|
94
|
+
if (this.verbose) {
|
|
95
|
+
await logger.logToStderr(`Retrieving calendar group '${calendarGroupId}'...`);
|
|
96
|
+
}
|
|
97
|
+
const requestOptions = {
|
|
98
|
+
url: requestUrl,
|
|
99
|
+
headers: {
|
|
100
|
+
accept: 'application/json;odata.metadata=none'
|
|
101
|
+
},
|
|
102
|
+
responseType: 'json'
|
|
103
|
+
};
|
|
104
|
+
const result = await request.get(requestOptions);
|
|
105
|
+
await logger.log(result);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
this.handleRejectedODataJsonPromise(err);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export default new OutlookCalendarGroupGetCommand();
|
|
114
|
+
//# sourceMappingURL=calendargroup-get.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
4
|
+
import { cli } from '../../../../cli/cli.js';
|
|
5
|
+
import commands from '../../commands.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
7
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
8
|
+
import auth from '../../../../Auth.js';
|
|
9
|
+
import request from '../../../../request.js';
|
|
10
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
11
|
+
import { calendarGroup } from '../../../../utils/calendarGroup.js';
|
|
12
|
+
export const options = z.strictObject({
|
|
13
|
+
...globalOptionsZod.shape,
|
|
14
|
+
id: z.string().optional(),
|
|
15
|
+
name: z.string().optional(),
|
|
16
|
+
userId: z.string().refine(id => validation.isValidGuid(id), {
|
|
17
|
+
error: e => `'${e.input}' is not a valid GUID.`
|
|
18
|
+
}).optional(),
|
|
19
|
+
userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
|
|
20
|
+
error: e => `'${e.input}' is not a valid UPN.`
|
|
21
|
+
}).optional(),
|
|
22
|
+
force: z.boolean().optional().alias('f')
|
|
23
|
+
});
|
|
24
|
+
class OutlookCalendarGroupRemoveCommand extends GraphCommand {
|
|
25
|
+
get name() {
|
|
26
|
+
return commands.CALENDARGROUP_REMOVE;
|
|
27
|
+
}
|
|
28
|
+
get description() {
|
|
29
|
+
return 'Removes a calendar group';
|
|
30
|
+
}
|
|
31
|
+
get schema() {
|
|
32
|
+
return options;
|
|
33
|
+
}
|
|
34
|
+
getRefinedSchema(schema) {
|
|
35
|
+
return schema
|
|
36
|
+
.refine(options => options.id || options.name, {
|
|
37
|
+
error: 'Specify either id or name.'
|
|
38
|
+
})
|
|
39
|
+
.refine(options => !(options.id && options.name), {
|
|
40
|
+
error: 'Specify either id or name, but not both.'
|
|
41
|
+
})
|
|
42
|
+
.refine(options => !(options.userId && options.userName), {
|
|
43
|
+
error: 'Specify either userId or userName, but not both.'
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async commandAction(logger, args) {
|
|
47
|
+
const removeCalendarGroup = async () => {
|
|
48
|
+
try {
|
|
49
|
+
const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
|
|
50
|
+
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(token);
|
|
51
|
+
if (isAppOnlyAccessToken && !args.options.userId && !args.options.userName) {
|
|
52
|
+
throw 'When running with application permissions either userId or userName is required.';
|
|
53
|
+
}
|
|
54
|
+
let endpoint;
|
|
55
|
+
let graphUserId;
|
|
56
|
+
if (args.options.userId || args.options.userName) {
|
|
57
|
+
graphUserId = (args.options.userId ?? args.options.userName);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
graphUserId = accessToken.getUserIdFromAccessToken(token);
|
|
61
|
+
}
|
|
62
|
+
endpoint = `${this.resource}/v1.0/users('${formatting.encodeQueryParameter(graphUserId)}')`;
|
|
63
|
+
let calendarGroupId = args.options.id;
|
|
64
|
+
if (args.options.name) {
|
|
65
|
+
if (this.verbose) {
|
|
66
|
+
await logger.logToStderr(`Retrieving calendar group by name '${args.options.name}'...`);
|
|
67
|
+
}
|
|
68
|
+
const calendarGroupResult = await calendarGroup.getUserCalendarGroupByName(graphUserId, args.options.name);
|
|
69
|
+
calendarGroupId = calendarGroupResult.id;
|
|
70
|
+
}
|
|
71
|
+
if (this.verbose) {
|
|
72
|
+
await logger.logToStderr(`Removing calendar group '${calendarGroupId}'...`);
|
|
73
|
+
}
|
|
74
|
+
const requestOptions = {
|
|
75
|
+
url: `${endpoint}/calendarGroups/${calendarGroupId}`,
|
|
76
|
+
headers: {
|
|
77
|
+
accept: 'application/json;odata.metadata=none'
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
await request.delete(requestOptions);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
this.handleRejectedODataJsonPromise(err);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
if (args.options.force) {
|
|
87
|
+
await removeCalendarGroup();
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove calendar group '${args.options.id || args.options.name}'?` });
|
|
91
|
+
if (result) {
|
|
92
|
+
await removeCalendarGroup();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export default new OutlookCalendarGroupRemoveCommand();
|
|
98
|
+
//# sourceMappingURL=calendargroup-remove.js.map
|
|
@@ -3,7 +3,10 @@ export default {
|
|
|
3
3
|
CALENDAR_ADD: `${prefix} calendar add`,
|
|
4
4
|
CALENDAR_GET: `${prefix} calendar get`,
|
|
5
5
|
CALENDAR_REMOVE: `${prefix} calendar remove`,
|
|
6
|
+
CALENDAR_SET: `${prefix} calendar set`,
|
|
7
|
+
CALENDARGROUP_GET: `${prefix} calendargroup get`,
|
|
6
8
|
CALENDARGROUP_LIST: `${prefix} calendargroup list`,
|
|
9
|
+
CALENDARGROUP_REMOVE: `${prefix} calendargroup remove`,
|
|
7
10
|
CALENDARGROUP_SET: `${prefix} calendargroup set`,
|
|
8
11
|
EVENT_CANCEL: `${prefix} event cancel`,
|
|
9
12
|
EVENT_LIST: `${prefix} event list`,
|
|
@@ -16,11 +16,11 @@ export const workflow = {
|
|
|
16
16
|
steps: [
|
|
17
17
|
{
|
|
18
18
|
name: "Checkout",
|
|
19
|
-
uses: "actions/checkout@
|
|
19
|
+
uses: "actions/checkout@v6"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
name: "Use Node.js",
|
|
23
|
-
uses: "actions/setup-node@
|
|
23
|
+
uses: "actions/setup-node@v6",
|
|
24
24
|
with: {
|
|
25
25
|
"node-version": "${{ env.NodeVersion }}"
|
|
26
26
|
}
|
|
@@ -35,7 +35,7 @@ export const workflow = {
|
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
name: "CLI for Microsoft 365 Login",
|
|
38
|
-
uses: "pnp/action-cli-login@
|
|
38
|
+
uses: "pnp/action-cli-login@v4",
|
|
39
39
|
with: {
|
|
40
40
|
"CERTIFICATE_ENCODED": "${{ secrets.CERTIFICATE_ENCODED }}",
|
|
41
41
|
"CERTIFICATE_PASSWORD": "${{ secrets.CERTIFICATE_PASSWORD }}",
|
|
@@ -45,9 +45,9 @@ export const workflow = {
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
name: "CLI for Microsoft 365 Deploy App",
|
|
48
|
-
uses: "pnp/action-cli-deploy@
|
|
48
|
+
uses: "pnp/action-cli-deploy@v6",
|
|
49
49
|
with: {
|
|
50
|
-
"APP_FILE_PATH": "sharepoint/
|
|
50
|
+
"APP_FILE_PATH": "sharepoint/{{ sppkgPath }}",
|
|
51
51
|
"SKIP_FEATURE_DEPLOYMENT": false,
|
|
52
52
|
"OVERWRITE": true
|
|
53
53
|
}
|
|
@@ -105,6 +105,10 @@ export const pipeline = {
|
|
|
105
105
|
name: "PackageName",
|
|
106
106
|
value: ""
|
|
107
107
|
},
|
|
108
|
+
{
|
|
109
|
+
name: "SppkgPath",
|
|
110
|
+
value: ""
|
|
111
|
+
},
|
|
108
112
|
{
|
|
109
113
|
name: "SiteAppCatalogUrl",
|
|
110
114
|
value: ""
|
|
@@ -34,14 +34,14 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends BaseProjectCommand {
|
|
|
34
34
|
if (this.projectRootPath === null) {
|
|
35
35
|
throw new CommandError(`Couldn't find project root folder`, _a.ERROR_NO_PROJECT_ROOT_FOLDER);
|
|
36
36
|
}
|
|
37
|
-
const solutionPackageJsonFile = path.join(this.projectRootPath, 'package.json');
|
|
38
|
-
const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
|
|
39
|
-
const solutionName = JSON.parse(packageJson).name;
|
|
40
37
|
if (this.debug) {
|
|
41
38
|
await logger.logToStderr(`Adding Azure DevOps pipeline in the current SPFx project`);
|
|
42
39
|
}
|
|
43
40
|
try {
|
|
44
|
-
this.
|
|
41
|
+
const project = { path: this.projectRootPath };
|
|
42
|
+
this.readAndParseJsonFile(path.join(this.projectRootPath, 'config', 'package-solution.json'), project, 'packageSolutionJson');
|
|
43
|
+
const sppkgPath = project.packageSolutionJson?.paths?.zippedPackage;
|
|
44
|
+
this.updatePipeline(sppkgPath, pipeline, args.options);
|
|
45
45
|
this.savePipeline(pipeline);
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
@@ -56,7 +56,7 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends BaseProjectCommand {
|
|
|
56
56
|
const pipelineFile = path.join(pipelinesPath, 'deploy-spfx-solution.yml');
|
|
57
57
|
fs.writeFileSync(path.resolve(pipelineFile), yaml.stringify(pipeline), 'utf-8');
|
|
58
58
|
}
|
|
59
|
-
updatePipeline(
|
|
59
|
+
updatePipeline(sppkgPath, pipeline, options) {
|
|
60
60
|
if (options.name) {
|
|
61
61
|
pipeline.name = options.name;
|
|
62
62
|
}
|
|
@@ -93,16 +93,17 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends BaseProjectCommand {
|
|
|
93
93
|
}
|
|
94
94
|
if (options.scope === 'sitecollection') {
|
|
95
95
|
script.script = script.script.replace(`{{deploy}}`, `m365 spo app deploy --name '$(PackageName)' --appCatalogScope sitecollection --appCatalogUrl '$(SiteAppCatalogUrl)'`);
|
|
96
|
-
script.script = script.script.replace(`{{addApp}}`, `m365 spo app add --filePath '$(Build.SourcesDirectory)/sharepoint
|
|
96
|
+
script.script = script.script.replace(`{{addApp}}`, `m365 spo app add --filePath '$(Build.SourcesDirectory)/sharepoint/$(SppkgPath)' --appCatalogScope sitecollection --appCatalogUrl '$(SiteAppCatalogUrl)' --overwrite`);
|
|
97
97
|
this.assignPipelineVariables(pipeline, 'SiteAppCatalogUrl', options.siteUrl);
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
100
|
script.script = script.script.replace(`{{deploy}}`, `m365 spo app deploy --name '$(PackageName)' --appCatalogScope 'tenant'`);
|
|
101
|
-
script.script = script.script.replace(`{{addApp}}`, `m365 spo app add --filePath '$(Build.SourcesDirectory)/sharepoint
|
|
101
|
+
script.script = script.script.replace(`{{addApp}}`, `m365 spo app add --filePath '$(Build.SourcesDirectory)/sharepoint/$(SppkgPath)' --overwrite`);
|
|
102
102
|
pipeline.variables = pipeline.variables.filter(v => v.name !== 'SiteAppCatalogUrl');
|
|
103
103
|
}
|
|
104
|
-
if (
|
|
105
|
-
this.assignPipelineVariables(pipeline, '
|
|
104
|
+
if (sppkgPath) {
|
|
105
|
+
this.assignPipelineVariables(pipeline, 'SppkgPath', sppkgPath);
|
|
106
|
+
this.assignPipelineVariables(pipeline, 'PackageName', path.basename(sppkgPath));
|
|
106
107
|
}
|
|
107
108
|
if (options.skipFeatureDeployment) {
|
|
108
109
|
script.script = script.script.replace(`m365 spo app deploy `, `m365 spo app deploy --skipFeatureDeployment `);
|
|
@@ -308,6 +308,8 @@ ${f.resolution}
|
|
|
308
308
|
const packagesDepExact = [];
|
|
309
309
|
const packagesDepUn = [];
|
|
310
310
|
const packagesDevUn = [];
|
|
311
|
+
const packagesOverride = [];
|
|
312
|
+
const packagesOverrideRemove = [];
|
|
311
313
|
findings.forEach(f => {
|
|
312
314
|
packageManager.mapPackageManagerCommand({
|
|
313
315
|
command: f.resolution,
|
|
@@ -315,6 +317,8 @@ ${f.resolution}
|
|
|
315
317
|
packagesDepExact,
|
|
316
318
|
packagesDepUn,
|
|
317
319
|
packagesDevUn,
|
|
320
|
+
packagesOverride,
|
|
321
|
+
packagesOverrideRemove,
|
|
318
322
|
packageMgr: this.packageManager
|
|
319
323
|
});
|
|
320
324
|
});
|
|
@@ -323,6 +327,8 @@ ${f.resolution}
|
|
|
323
327
|
packagesDevExact,
|
|
324
328
|
packagesDepUn,
|
|
325
329
|
packagesDevUn,
|
|
330
|
+
packagesOverride,
|
|
331
|
+
packagesOverrideRemove,
|
|
326
332
|
packageMgr: this.packageManager
|
|
327
333
|
});
|
|
328
334
|
if (this.packageManager === 'npm') {
|
|
@@ -34,14 +34,16 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
|
34
34
|
if (this.projectRootPath === null) {
|
|
35
35
|
throw new CommandError(`Couldn't find project root folder`, _a.ERROR_NO_PROJECT_ROOT_FOLDER);
|
|
36
36
|
}
|
|
37
|
-
const solutionPackageJsonFile = path.join(this.projectRootPath, 'package.json');
|
|
38
|
-
const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
|
|
39
|
-
const solutionName = JSON.parse(packageJson).name;
|
|
40
|
-
if (this.debug) {
|
|
41
|
-
await logger.logToStderr(`Adding GitHub workflow in the current SPFx project`);
|
|
42
|
-
}
|
|
43
37
|
try {
|
|
44
|
-
this.
|
|
38
|
+
const project = { path: this.projectRootPath };
|
|
39
|
+
this.readAndParseJsonFile(path.join(this.projectRootPath, 'package.json'), project, 'packageJson');
|
|
40
|
+
this.readAndParseJsonFile(path.join(this.projectRootPath, 'config', 'package-solution.json'), project, 'packageSolutionJson');
|
|
41
|
+
const solutionName = project.packageJson.name;
|
|
42
|
+
const sppkgPath = project.packageSolutionJson?.paths?.zippedPackage;
|
|
43
|
+
if (this.debug) {
|
|
44
|
+
await logger.logToStderr(`Adding GitHub workflow in the current SPFx project`);
|
|
45
|
+
}
|
|
46
|
+
this.updateWorkflow(solutionName, sppkgPath, workflow, args.options);
|
|
45
47
|
this.saveWorkflow(workflow);
|
|
46
48
|
}
|
|
47
49
|
catch (error) {
|
|
@@ -56,7 +58,7 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
|
56
58
|
const workflowFile = path.join(workflowPath, 'deploy-spfx-solution.yml');
|
|
57
59
|
fs.writeFileSync(path.resolve(workflowFile), yaml.stringify(workflow), 'utf-8');
|
|
58
60
|
}
|
|
59
|
-
updateWorkflow(solutionName, workflow, options) {
|
|
61
|
+
updateWorkflow(solutionName, sppkgPath, workflow, options) {
|
|
60
62
|
workflow.name = options.name ? options.name : workflow.name.replace('{{ name }}', solutionName);
|
|
61
63
|
if (options.branchName) {
|
|
62
64
|
workflow.on.push.branches[0] = options.branchName;
|
|
@@ -90,9 +92,9 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
|
90
92
|
deployAction.with.SCOPE = 'sitecollection';
|
|
91
93
|
deployAction.with.SITE_COLLECTION_URL = options.siteUrl;
|
|
92
94
|
}
|
|
93
|
-
if (
|
|
95
|
+
if (sppkgPath) {
|
|
94
96
|
const deployAction = this.getDeployAction(workflow);
|
|
95
|
-
deployAction.with.APP_FILE_PATH = deployAction.with.APP_FILE_PATH.replace('{{
|
|
97
|
+
deployAction.with.APP_FILE_PATH = deployAction.with.APP_FILE_PATH.replace('{{ sppkgPath }}', sppkgPath);
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
assignNodeVersion(workflow, nodeVersion) {
|
|
@@ -7,7 +7,7 @@ var _DependencyRule_instances, _DependencyRule_needsUpdate, _DependencyRule_getM
|
|
|
7
7
|
import semver from 'semver';
|
|
8
8
|
import { JsonRule } from '../../JsonRule.js';
|
|
9
9
|
export class DependencyRule extends JsonRule {
|
|
10
|
-
constructor(packageName, packageVersion, isDevDep = false, isOptional = false, add = true) {
|
|
10
|
+
constructor(packageName, packageVersion, isDevDep = false, isOptional = false, add = true, isOverride = false) {
|
|
11
11
|
super();
|
|
12
12
|
_DependencyRule_instances.add(this);
|
|
13
13
|
this.packageName = packageName;
|
|
@@ -15,14 +15,20 @@ export class DependencyRule extends JsonRule {
|
|
|
15
15
|
this.isDevDep = isDevDep;
|
|
16
16
|
this.isOptional = isOptional;
|
|
17
17
|
this.add = add;
|
|
18
|
+
this.isOverride = isOverride;
|
|
18
19
|
}
|
|
19
20
|
get title() {
|
|
20
21
|
return this.packageName;
|
|
21
22
|
}
|
|
22
23
|
get description() {
|
|
23
|
-
return `${(this.add ? 'Upgrade' : 'Remove')} SharePoint Framework ${(this.isDevDep ? 'dev ' : '')}dependency package ${this.packageName}`;
|
|
24
|
+
return `${(this.add ? 'Upgrade' : 'Remove')} SharePoint Framework ${(this.isOverride ? 'override ' : this.isDevDep ? 'dev ' : '')}dependency package ${this.packageName}`;
|
|
24
25
|
}
|
|
25
26
|
get resolution() {
|
|
27
|
+
if (this.isOverride) {
|
|
28
|
+
return this.add ?
|
|
29
|
+
`override overrides.${this.packageName}=${this.packageVersion}` :
|
|
30
|
+
`removeOverride overrides.${this.packageName}`;
|
|
31
|
+
}
|
|
26
32
|
return this.add ?
|
|
27
33
|
`${(this.isDevDep ? 'installDev' : 'install')} ${this.packageName}@${this.packageVersion}` :
|
|
28
34
|
`${(this.isDevDep ? 'uninstallDev' : 'uninstall')} ${this.packageName}`;
|
|
@@ -44,10 +50,10 @@ export class DependencyRule extends JsonRule {
|
|
|
44
50
|
if (!project.packageJson) {
|
|
45
51
|
return;
|
|
46
52
|
}
|
|
47
|
-
const projectDependencies = this.isDevDep ? project.packageJson.devDependencies : project.packageJson.dependencies;
|
|
53
|
+
const projectDependencies = this.isOverride ? project.packageJson.overrides : this.isDevDep ? project.packageJson.devDependencies : project.packageJson.dependencies;
|
|
48
54
|
const versionEntry = projectDependencies ? projectDependencies[this.packageName] : '';
|
|
49
55
|
if (this.add) {
|
|
50
|
-
let jsonProperty = this.isDevDep ? 'devDependencies' : 'dependencies';
|
|
56
|
+
let jsonProperty = this.isOverride ? 'overrides' : this.isDevDep ? 'devDependencies' : 'dependencies';
|
|
51
57
|
if (versionEntry) {
|
|
52
58
|
jsonProperty += `.${this.packageName}`;
|
|
53
59
|
if (__classPrivateFieldGet(this, _DependencyRule_instances, "m", _DependencyRule_needsUpdate).call(this, this.packageVersion, versionEntry)) {
|
|
@@ -67,7 +73,7 @@ export class DependencyRule extends JsonRule {
|
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
75
|
else {
|
|
70
|
-
const jsonProperty = `${(this.isDevDep ? 'devDependencies' : 'dependencies')}.${this.packageName}`;
|
|
76
|
+
const jsonProperty = `${(this.isOverride ? 'overrides' : this.isDevDep ? 'devDependencies' : 'dependencies')}.${this.packageName}`;
|
|
71
77
|
if (versionEntry) {
|
|
72
78
|
const node = this.getAstNodeFromFile(project.packageJson, jsonProperty);
|
|
73
79
|
this.addFindingWithPosition(findings, node);
|
package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027001_OVERRIDES_rushstack_heft.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DependencyRule } from "./DependencyRule.js";
|
|
2
|
+
export class FN027001_OVERRIDES_rushstack_heft extends DependencyRule {
|
|
3
|
+
constructor(version) {
|
|
4
|
+
super('@rushstack/heft', version, false, false, true, true);
|
|
5
|
+
}
|
|
6
|
+
get id() {
|
|
7
|
+
return 'FN027001';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=FN027001_OVERRIDES_rushstack_heft.js.map
|