@pnp/cli-microsoft365 10.11.0 → 11.0.0-beta.3655c37
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 +54 -0
- package/.eslintrc.cjs +2 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Command.js +4 -0
- package/dist/m365/adaptivecard/commands/adaptivecard-send.js +1 -1
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-add.js +13 -27
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +18 -43
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +10 -21
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +25 -49
- package/dist/m365/entra/commands/app/app-add.js +14 -2
- package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +146 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/flow/commands/environment/environment-get.js +19 -29
- package/dist/m365/graph/commands/openextension/openextension-add.js +2 -2
- package/dist/m365/graph/commands/openextension/openextension-set.js +2 -6
- package/dist/m365/outlook/commands/mail/mail-searchfolder-add.js +85 -0
- package/dist/m365/outlook/commands.js +1 -0
- package/dist/m365/pa/commands/environment/environment-get.js +18 -23
- package/dist/m365/pp/commands/copilot/copilot-get.js +0 -4
- package/dist/m365/pp/commands/copilot/copilot-list.js +0 -4
- package/dist/m365/pp/commands/copilot/copilot-remove.js +0 -4
- package/dist/m365/pp/commands/environment/environment-get.js +19 -26
- package/dist/m365/pp/commands.js +0 -7
- package/dist/m365/spfx/commands/project/project-upgrade.js +23 -66
- package/dist/m365/spo/commands/customaction/customaction-list.js +3 -10
- package/dist/m365/spo/commands/file/file-version-keep.js +78 -0
- package/dist/m365/spo/commands/homesite/homesite-get.js +28 -14
- package/dist/m365/spo/commands/homesite/homesite-list.js +1 -12
- package/dist/m365/spo/commands/homesite/homesite-remove.js +6 -34
- package/dist/m365/spo/commands/homesite/homesite-set.js +88 -44
- package/dist/m365/spo/commands/list/list-view-add.js +1 -1
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-list.js +17 -25
- package/dist/m365/spo/commands.js +1 -2
- 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/dist/utils/entraAdministrativeUnit.js +1 -1
- package/dist/utils/entraApp.js +15 -0
- package/docs/docs/cmd/entra/app/app-add.mdx +7 -1
- package/docs/docs/cmd/entra/roleassignment/roleassignment-add.mdx +163 -0
- package/docs/docs/cmd/flow/environment/environment-get.mdx +6 -5
- package/docs/docs/cmd/outlook/mail/mail-searchfolder-add.mdx +147 -0
- package/docs/docs/cmd/pa/environment/environment-get.mdx +5 -2
- package/docs/docs/cmd/pp/copilot/copilot-get.mdx +0 -6
- package/docs/docs/cmd/pp/copilot/copilot-list.mdx +0 -6
- package/docs/docs/cmd/pp/copilot/copilot-remove.mdx +0 -6
- package/docs/docs/cmd/pp/environment/environment-get.mdx +5 -2
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +18 -5
- package/docs/docs/cmd/spo/file/file-version-keep.mdx +68 -0
- package/docs/docs/cmd/spo/homesite/homesite-get.mdx +44 -23
- package/docs/docs/cmd/spo/homesite/homesite-list.mdx +0 -6
- package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +10 -35
- package/docs/docs/cmd/spo/homesite/homesite-set.mdx +85 -45
- package/docs/docs/cmd/spo/list/list-view-add.mdx +11 -11
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-list.mdx +18 -18
- 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
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import request from '../../../../request.js';
|
|
2
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
|
+
import commands from '../../commands.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
6
|
+
import { zod } from '../../../../utils/zod.js';
|
|
7
|
+
import { validation } from '../../../../utils/validation.js';
|
|
8
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
9
|
+
import auth from '../../../../Auth.js';
|
|
10
|
+
const options = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
userId: zod.alias('i', z.string()
|
|
13
|
+
.refine(userId => validation.isValidGuid(userId), userId => ({
|
|
14
|
+
message: `'${userId}' is not a valid GUID.`
|
|
15
|
+
})).optional()),
|
|
16
|
+
userName: zod.alias('n', z.string()
|
|
17
|
+
.refine(userName => validation.isValidUserPrincipalName(userName), userName => ({
|
|
18
|
+
message: `'${userName}' is not a valid UPN.`
|
|
19
|
+
})).optional()),
|
|
20
|
+
folderName: z.string(),
|
|
21
|
+
messageFilter: z.string(),
|
|
22
|
+
sourceFoldersIds: z.string().transform((value) => value.split(',')).pipe(z.string().array()),
|
|
23
|
+
includeNestedFolders: z.boolean().optional()
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
class OutlookMailSearchFolderAddCommand extends GraphCommand {
|
|
27
|
+
get name() {
|
|
28
|
+
return commands.MAIL_SEARCHFOLDER_ADD;
|
|
29
|
+
}
|
|
30
|
+
get description() {
|
|
31
|
+
return `Creates a new mail search folder in the user's mailbox`;
|
|
32
|
+
}
|
|
33
|
+
get schema() {
|
|
34
|
+
return options;
|
|
35
|
+
}
|
|
36
|
+
getRefinedSchema(schema) {
|
|
37
|
+
return schema
|
|
38
|
+
.refine(options => !(options.userId && options.userName), {
|
|
39
|
+
message: 'Specify either userId or userName, but not both'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async commandAction(logger, args) {
|
|
43
|
+
try {
|
|
44
|
+
const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
|
|
45
|
+
let requestUrl = `${this.resource}/v1.0/me/mailFolders/searchFolders/childFolders`;
|
|
46
|
+
if (isAppOnlyAccessToken) {
|
|
47
|
+
if (!args.options.userId && !args.options.userName) {
|
|
48
|
+
throw 'When running with application permissions either userId or userName is required';
|
|
49
|
+
}
|
|
50
|
+
const userIdentifier = args.options.userId ?? args.options.userName;
|
|
51
|
+
requestUrl = `${this.resource}/v1.0/users('${userIdentifier}')/mailFolders/searchFolders/childFolders`;
|
|
52
|
+
if (args.options.verbose) {
|
|
53
|
+
await logger.logToStderr(`Creating a mail search folder in the mailbox of the user ${userIdentifier}...`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
if (args.options.userId || args.options.userName) {
|
|
58
|
+
throw 'You can create mail search folder for other users only if CLI is authenticated in app-only mode';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const requestOptions = {
|
|
62
|
+
url: requestUrl,
|
|
63
|
+
headers: {
|
|
64
|
+
accept: 'application/json;odata.metadata=none',
|
|
65
|
+
'content-type': 'application/json'
|
|
66
|
+
},
|
|
67
|
+
responseType: 'json',
|
|
68
|
+
data: {
|
|
69
|
+
'@odata.type': '#microsoft.graph.mailSearchFolder',
|
|
70
|
+
displayName: args.options.folderName,
|
|
71
|
+
includeNestedFolders: args.options.includeNestedFolders,
|
|
72
|
+
filterQuery: args.options.messageFilter,
|
|
73
|
+
sourceFolderIds: args.options.sourceFoldersIds
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const result = await request.post(requestOptions);
|
|
77
|
+
await logger.log(result);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
this.handleRejectedODataJsonPromise(err);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export default new OutlookMailSearchFolderAddCommand();
|
|
85
|
+
//# sourceMappingURL=mail-searchfolder-add.js.map
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 _PaEnvironmentGetCommand_instances, _PaEnvironmentGetCommand_initTelemetry, _PaEnvironmentGetCommand_initOptions;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
4
|
import { formatting } from '../../../../utils/formatting.js';
|
|
5
|
+
import { zod } from '../../../../utils/zod.js';
|
|
9
6
|
import PowerAppsCommand from '../../../base/PowerAppsCommand.js';
|
|
10
7
|
import commands from '../../commands.js';
|
|
8
|
+
const options = globalOptionsZod
|
|
9
|
+
.extend({
|
|
10
|
+
name: zod.alias('n', z.string().optional()),
|
|
11
|
+
default: z.boolean().optional()
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
11
14
|
class PaEnvironmentGetCommand extends PowerAppsCommand {
|
|
12
15
|
get name() {
|
|
13
16
|
return commands.ENVIRONMENT_GET;
|
|
@@ -15,17 +18,20 @@ class PaEnvironmentGetCommand extends PowerAppsCommand {
|
|
|
15
18
|
get description() {
|
|
16
19
|
return 'Gets information about the specified Microsoft Power Apps environment';
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
get schema() {
|
|
22
|
+
return options;
|
|
23
|
+
}
|
|
24
|
+
getRefinedSchema(schema) {
|
|
25
|
+
return schema
|
|
26
|
+
.refine(options => !!options.name !== !!options.default, {
|
|
27
|
+
message: `Specify either name or default, but not both.`
|
|
28
|
+
});
|
|
23
29
|
}
|
|
24
30
|
async commandAction(logger, args) {
|
|
25
31
|
if (this.verbose) {
|
|
26
32
|
await logger.logToStderr(`Retrieving information about Microsoft Power Apps environment ${args.options.name || 'default'}...`);
|
|
27
33
|
}
|
|
28
|
-
const environmentName = args.options.
|
|
34
|
+
const environmentName = args.options.default ? '~default' : formatting.encodeQueryParameter(args.options.name);
|
|
29
35
|
const requestOptions = {
|
|
30
36
|
url: `${this.resource}/providers/Microsoft.PowerApps/environments/${environmentName}?api-version=2016-11-01`,
|
|
31
37
|
headers: {
|
|
@@ -47,16 +53,5 @@ class PaEnvironmentGetCommand extends PowerAppsCommand {
|
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
|
-
_PaEnvironmentGetCommand_instances = new WeakSet(), _PaEnvironmentGetCommand_initTelemetry = function _PaEnvironmentGetCommand_initTelemetry() {
|
|
51
|
-
this.telemetry.push((args) => {
|
|
52
|
-
Object.assign(this.telemetryProperties, {
|
|
53
|
-
name: typeof args.options.name !== 'undefined'
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}, _PaEnvironmentGetCommand_initOptions = function _PaEnvironmentGetCommand_initOptions() {
|
|
57
|
-
this.options.unshift({
|
|
58
|
-
option: '-n, --name [name]'
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
56
|
export default new PaEnvironmentGetCommand();
|
|
62
57
|
//# sourceMappingURL=environment-get.js.map
|
|
@@ -18,9 +18,6 @@ class PpCopilotGetCommand extends PowerPlatformCommand {
|
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Get information about the specified copilot';
|
|
20
20
|
}
|
|
21
|
-
alias() {
|
|
22
|
-
return [commands.CHATBOT_GET];
|
|
23
|
-
}
|
|
24
21
|
constructor() {
|
|
25
22
|
super();
|
|
26
23
|
_PpCopilotGetCommand_instances.add(this);
|
|
@@ -30,7 +27,6 @@ class PpCopilotGetCommand extends PowerPlatformCommand {
|
|
|
30
27
|
__classPrivateFieldGet(this, _PpCopilotGetCommand_instances, "m", _PpCopilotGetCommand_initOptionSets).call(this);
|
|
31
28
|
}
|
|
32
29
|
async commandAction(logger, args) {
|
|
33
|
-
await this.showDeprecationWarning(logger, commands.CHATBOT_GET, commands.COPILOT_GET);
|
|
34
30
|
if (this.verbose) {
|
|
35
31
|
await logger.logToStderr(`Retrieving copilot '${args.options.id || args.options.name}'...`);
|
|
36
32
|
}
|
|
@@ -15,9 +15,6 @@ class PpCopilotListCommand extends PowerPlatformCommand {
|
|
|
15
15
|
get description() {
|
|
16
16
|
return 'Lists Microsoft Power Platform copilots in the specified Power Platform environment';
|
|
17
17
|
}
|
|
18
|
-
alias() {
|
|
19
|
-
return [commands.CHATBOT_LIST];
|
|
20
|
-
}
|
|
21
18
|
defaultProperties() {
|
|
22
19
|
return ['name', 'botid', 'publishedOn', 'createdOn', 'botModifiedOn'];
|
|
23
20
|
}
|
|
@@ -28,7 +25,6 @@ class PpCopilotListCommand extends PowerPlatformCommand {
|
|
|
28
25
|
__classPrivateFieldGet(this, _PpCopilotListCommand_instances, "m", _PpCopilotListCommand_initOptions).call(this);
|
|
29
26
|
}
|
|
30
27
|
async commandAction(logger, args) {
|
|
31
|
-
await this.showDeprecationWarning(logger, commands.CHATBOT_LIST, commands.COPILOT_LIST);
|
|
32
28
|
if (this.verbose) {
|
|
33
29
|
await logger.logToStderr(`Retrieving list of copilots for environment '${args.options.environmentName}'.`);
|
|
34
30
|
}
|
|
@@ -18,9 +18,6 @@ class PpCopilotRemoveCommand extends PowerPlatformCommand {
|
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Removes the specified copilot';
|
|
20
20
|
}
|
|
21
|
-
alias() {
|
|
22
|
-
return [commands.CHATBOT_REMOVE];
|
|
23
|
-
}
|
|
24
21
|
constructor() {
|
|
25
22
|
super();
|
|
26
23
|
_PpCopilotRemoveCommand_instances.add(this);
|
|
@@ -30,7 +27,6 @@ class PpCopilotRemoveCommand extends PowerPlatformCommand {
|
|
|
30
27
|
__classPrivateFieldGet(this, _PpCopilotRemoveCommand_instances, "m", _PpCopilotRemoveCommand_initOptionSets).call(this);
|
|
31
28
|
}
|
|
32
29
|
async commandAction(logger, args) {
|
|
33
|
-
await this.showDeprecationWarning(logger, commands.CHATBOT_REMOVE, commands.COPILOT_REMOVE);
|
|
34
30
|
if (this.verbose) {
|
|
35
31
|
await logger.logToStderr(`Removing copilot '${args.options.id || args.options.name}'...`);
|
|
36
32
|
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 _PpEnvironmentGetCommand_instances, _PpEnvironmentGetCommand_initTelemetry, _PpEnvironmentGetCommand_initOptions;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
4
|
import { formatting } from '../../../../utils/formatting.js';
|
|
5
|
+
import { zod } from '../../../../utils/zod.js';
|
|
9
6
|
import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
|
|
10
7
|
import commands from '../../commands.js';
|
|
8
|
+
const options = globalOptionsZod
|
|
9
|
+
.extend({
|
|
10
|
+
name: zod.alias('n', z.string().optional()),
|
|
11
|
+
default: z.boolean().optional(),
|
|
12
|
+
asAdmin: z.boolean().optional()
|
|
13
|
+
})
|
|
14
|
+
.strict();
|
|
11
15
|
class PpEnvironmentGetCommand extends PowerPlatformCommand {
|
|
12
16
|
get name() {
|
|
13
17
|
return commands.ENVIRONMENT_GET;
|
|
@@ -15,11 +19,14 @@ class PpEnvironmentGetCommand extends PowerPlatformCommand {
|
|
|
15
19
|
get description() {
|
|
16
20
|
return 'Gets information about the specified Power Platform environment';
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
get schema() {
|
|
23
|
+
return options;
|
|
24
|
+
}
|
|
25
|
+
getRefinedSchema(schema) {
|
|
26
|
+
return schema
|
|
27
|
+
.refine(options => !!options.name !== !!options.default, {
|
|
28
|
+
message: `Specify either name or default, but not both.`
|
|
29
|
+
});
|
|
23
30
|
}
|
|
24
31
|
async commandAction(logger, args) {
|
|
25
32
|
if (this.verbose) {
|
|
@@ -29,7 +36,7 @@ class PpEnvironmentGetCommand extends PowerPlatformCommand {
|
|
|
29
36
|
if (args.options.asAdmin) {
|
|
30
37
|
url += '/scopes/admin';
|
|
31
38
|
}
|
|
32
|
-
const envName = args.options.
|
|
39
|
+
const envName = args.options.default ? '~Default' : formatting.encodeQueryParameter(args.options.name);
|
|
33
40
|
url += `/environments/${envName}?api-version=2020-10-01`;
|
|
34
41
|
const requestOptions = {
|
|
35
42
|
url: url,
|
|
@@ -42,19 +49,5 @@ class PpEnvironmentGetCommand extends PowerPlatformCommand {
|
|
|
42
49
|
await logger.log(response);
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
|
-
_PpEnvironmentGetCommand_instances = new WeakSet(), _PpEnvironmentGetCommand_initTelemetry = function _PpEnvironmentGetCommand_initTelemetry() {
|
|
46
|
-
this.telemetry.push((args) => {
|
|
47
|
-
Object.assign(this.telemetryProperties, {
|
|
48
|
-
name: typeof args.options.name !== 'undefined',
|
|
49
|
-
asAdmin: !!args.options.asAdmin
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}, _PpEnvironmentGetCommand_initOptions = function _PpEnvironmentGetCommand_initOptions() {
|
|
53
|
-
this.options.unshift({
|
|
54
|
-
option: '-n, --name [name]'
|
|
55
|
-
}, {
|
|
56
|
-
option: '--asAdmin'
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
52
|
export default new PpEnvironmentGetCommand();
|
|
60
53
|
//# sourceMappingURL=environment-get.js.map
|
package/dist/m365/pp/commands.js
CHANGED
|
@@ -3,13 +3,6 @@ export default {
|
|
|
3
3
|
AIBUILDERMODEL_GET: `${prefix} aibuildermodel get`,
|
|
4
4
|
AIBUILDERMODEL_LIST: `${prefix} aibuildermodel list`,
|
|
5
5
|
AIBUILDERMODEL_REMOVE: `${prefix} aibuildermodel remove`,
|
|
6
|
-
CARD_CLONE: `${prefix} card clone`,
|
|
7
|
-
CARD_GET: `${prefix} card get`,
|
|
8
|
-
CARD_LIST: `${prefix} card list`,
|
|
9
|
-
CARD_REMOVE: `${prefix} card remove`,
|
|
10
|
-
CHATBOT_GET: `${prefix} chatbot get`,
|
|
11
|
-
CHATBOT_LIST: `${prefix} chatbot list`,
|
|
12
|
-
CHATBOT_REMOVE: `${prefix} chatbot remove`,
|
|
13
6
|
COPILOT_GET: `${prefix} copilot get`,
|
|
14
7
|
COPILOT_LIST: `${prefix} copilot list`,
|
|
15
8
|
COPILOT_REMOVE: `${prefix} copilot remove`,
|
|
@@ -1,20 +1,25 @@
|
|
|
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 _SpfxProjectUpgradeCommand_instances, _a, _SpfxProjectUpgradeCommand_initTelemetry, _SpfxProjectUpgradeCommand_initOptions, _SpfxProjectUpgradeCommand_initValidators;
|
|
7
1
|
import fs from 'fs';
|
|
8
2
|
import os from 'os';
|
|
9
3
|
import path from 'path';
|
|
10
4
|
// uncomment to support upgrading to preview releases
|
|
11
5
|
import { prerelease } from 'semver';
|
|
12
|
-
import {
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { CommandError, globalOptionsZod } from '../../../../Command.js';
|
|
13
8
|
import { fsUtil } from '../../../../utils/fsUtil.js';
|
|
14
9
|
import { packageManager } from '../../../../utils/packageManager.js';
|
|
10
|
+
import { zod } from '../../../../utils/zod.js';
|
|
15
11
|
import commands from '../../commands.js';
|
|
16
12
|
import { BaseProjectCommand } from './base-project-command.js';
|
|
17
13
|
import { FN017001_MISC_npm_dedupe } from './project-upgrade/rules/FN017001_MISC_npm_dedupe.js';
|
|
14
|
+
const options = globalOptionsZod
|
|
15
|
+
.extend({
|
|
16
|
+
packageManager: z.enum(['npm', 'pnpm', 'yarn']).default('npm'),
|
|
17
|
+
preview: z.boolean().optional(),
|
|
18
|
+
toVersion: zod.alias('v', z.string().optional()),
|
|
19
|
+
shell: z.enum(['bash', 'powershell', 'cmd']).default('powershell'),
|
|
20
|
+
output: z.enum(['json', 'text', 'md', 'tour', 'csv', 'none']).optional()
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
18
23
|
class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
19
24
|
get name() {
|
|
20
25
|
return commands.PROJECT_UPGRADE;
|
|
@@ -25,12 +30,14 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
25
30
|
get allowedOutputs() {
|
|
26
31
|
return ['json', 'text', 'md', 'tour'];
|
|
27
32
|
}
|
|
33
|
+
get schema() {
|
|
34
|
+
return options;
|
|
35
|
+
}
|
|
28
36
|
constructor() {
|
|
29
37
|
super();
|
|
30
|
-
_SpfxProjectUpgradeCommand_instances.add(this);
|
|
31
38
|
this.toVersion = '';
|
|
32
|
-
this.packageManager = '
|
|
33
|
-
this.shell = '
|
|
39
|
+
this.packageManager = '';
|
|
40
|
+
this.shell = '';
|
|
34
41
|
this.allFindings = [];
|
|
35
42
|
this.supportedVersions = [
|
|
36
43
|
'1.0.0',
|
|
@@ -80,14 +87,11 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
80
87
|
'1.21.1',
|
|
81
88
|
'1.22.0-beta.1'
|
|
82
89
|
];
|
|
83
|
-
__classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initTelemetry).call(this);
|
|
84
|
-
__classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initOptions).call(this);
|
|
85
|
-
__classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initValidators).call(this);
|
|
86
90
|
}
|
|
87
91
|
async commandAction(logger, args) {
|
|
88
92
|
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
89
93
|
if (this.projectRootPath === null) {
|
|
90
|
-
throw new CommandError(`Couldn't find project root folder`,
|
|
94
|
+
throw new CommandError(`Couldn't find project root folder`, SpfxProjectUpgradeCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
|
|
91
95
|
}
|
|
92
96
|
this.toVersion = args.options.toVersion ? args.options.toVersion : this.supportedVersions[this.supportedVersions.length - 1];
|
|
93
97
|
// uncomment to support upgrading to preview releases
|
|
@@ -101,21 +105,21 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
101
105
|
this.toVersion = this.supportedVersions[this.supportedVersions.length - 2];
|
|
102
106
|
}
|
|
103
107
|
this.packageManager = args.options.packageManager || 'npm';
|
|
104
|
-
this.shell = args.options.shell || '
|
|
108
|
+
this.shell = args.options.shell || 'powershell';
|
|
105
109
|
if (this.supportedVersions.indexOf(this.toVersion) < 0) {
|
|
106
|
-
throw new CommandError(`CLI for Microsoft 365 doesn't support upgrading SharePoint Framework projects to version ${this.toVersion}. Supported versions are ${this.supportedVersions.join(', ')}`,
|
|
110
|
+
throw new CommandError(`CLI for Microsoft 365 doesn't support upgrading SharePoint Framework projects to version ${this.toVersion}. Supported versions are ${this.supportedVersions.join(', ')}`, SpfxProjectUpgradeCommand.ERROR_UNSUPPORTED_TO_VERSION);
|
|
107
111
|
}
|
|
108
112
|
this.projectVersion = this.getProjectVersion();
|
|
109
113
|
if (!this.projectVersion) {
|
|
110
|
-
throw new CommandError(`Unable to determine the version of the current SharePoint Framework project`,
|
|
114
|
+
throw new CommandError(`Unable to determine the version of the current SharePoint Framework project`, SpfxProjectUpgradeCommand.ERROR_NO_VERSION);
|
|
111
115
|
}
|
|
112
116
|
const pos = this.supportedVersions.indexOf(this.projectVersion);
|
|
113
117
|
if (pos < 0) {
|
|
114
|
-
throw new CommandError(`CLI for Microsoft 365 doesn't support upgrading projects built using SharePoint Framework v${this.projectVersion}`,
|
|
118
|
+
throw new CommandError(`CLI for Microsoft 365 doesn't support upgrading projects built using SharePoint Framework v${this.projectVersion}`, SpfxProjectUpgradeCommand.ERROR_UNSUPPORTED_FROM_VERSION);
|
|
115
119
|
}
|
|
116
120
|
const posTo = this.supportedVersions.indexOf(this.toVersion);
|
|
117
121
|
if (pos > posTo) {
|
|
118
|
-
throw new CommandError('You cannot downgrade a project',
|
|
122
|
+
throw new CommandError('You cannot downgrade a project', SpfxProjectUpgradeCommand.ERROR_NO_DOWNGRADE);
|
|
119
123
|
}
|
|
120
124
|
if (pos === posTo) {
|
|
121
125
|
await logger.log(`Project doesn't need to be upgraded`);
|
|
@@ -479,53 +483,6 @@ ${f.resolution}
|
|
|
479
483
|
};
|
|
480
484
|
}
|
|
481
485
|
}
|
|
482
|
-
_a = SpfxProjectUpgradeCommand, _SpfxProjectUpgradeCommand_instances = new WeakSet(), _SpfxProjectUpgradeCommand_initTelemetry = function _SpfxProjectUpgradeCommand_initTelemetry() {
|
|
483
|
-
this.telemetry.push((args) => {
|
|
484
|
-
Object.assign(this.telemetryProperties, {
|
|
485
|
-
toVersion: args.options.toVersion || this.supportedVersions[this.supportedVersions.length - 1],
|
|
486
|
-
packageManager: args.options.packageManager || 'npm',
|
|
487
|
-
shell: args.options.shell || 'bash',
|
|
488
|
-
preview: args.options.preview
|
|
489
|
-
});
|
|
490
|
-
// uncomment to support upgrading to preview releases
|
|
491
|
-
if (prerelease(this.telemetryProperties.toVersion) && !args.options.preview) {
|
|
492
|
-
this.telemetryProperties.toVersion = this.supportedVersions[this.supportedVersions.length - 2];
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
}, _SpfxProjectUpgradeCommand_initOptions = function _SpfxProjectUpgradeCommand_initOptions() {
|
|
496
|
-
this.options.unshift({
|
|
497
|
-
option: '-v, --toVersion [toVersion]'
|
|
498
|
-
}, {
|
|
499
|
-
option: '--packageManager [packageManager]',
|
|
500
|
-
autocomplete: _a.packageManagers
|
|
501
|
-
}, {
|
|
502
|
-
option: '--shell [shell]',
|
|
503
|
-
autocomplete: _a.shells
|
|
504
|
-
}, {
|
|
505
|
-
option: '--preview'
|
|
506
|
-
});
|
|
507
|
-
this.options.forEach(o => {
|
|
508
|
-
if (o.option.indexOf('--output') > -1) {
|
|
509
|
-
o.autocomplete = this.allowedOutputs;
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
}, _SpfxProjectUpgradeCommand_initValidators = function _SpfxProjectUpgradeCommand_initValidators() {
|
|
513
|
-
this.validators.push(async (args) => {
|
|
514
|
-
if (args.options.packageManager) {
|
|
515
|
-
if (_a.packageManagers.indexOf(args.options.packageManager) < 0) {
|
|
516
|
-
return `${args.options.packageManager} is not a supported package manager. Supported package managers are ${_a.packageManagers.join(', ')}`;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
if (args.options.shell) {
|
|
520
|
-
if (_a.shells.indexOf(args.options.shell) < 0) {
|
|
521
|
-
return `${args.options.shell} is not a supported shell. Supported shells are ${_a.shells.join(', ')}`;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
return true;
|
|
525
|
-
});
|
|
526
|
-
};
|
|
527
|
-
SpfxProjectUpgradeCommand.packageManagers = ['npm', 'pnpm', 'yarn'];
|
|
528
|
-
SpfxProjectUpgradeCommand.shells = ['bash', 'powershell', 'cmd'];
|
|
529
486
|
SpfxProjectUpgradeCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
|
|
530
487
|
SpfxProjectUpgradeCommand.ERROR_UNSUPPORTED_TO_VERSION = 2;
|
|
531
488
|
SpfxProjectUpgradeCommand.ERROR_NO_VERSION = 3;
|
|
@@ -33,17 +33,10 @@ class SpoCustomActionListCommand extends SpoCommand {
|
|
|
33
33
|
await logger.logToStderr('');
|
|
34
34
|
}
|
|
35
35
|
const customActions = await spo.getCustomActions(args.options.webUrl, args.options.scope);
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
await logger.logToStderr(`Custom actions not found`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
if (args.options.output !== 'json') {
|
|
43
|
-
customActions.forEach(a => a.Scope = this.humanizeScope(a.Scope));
|
|
44
|
-
}
|
|
45
|
-
await logger.log(customActions);
|
|
36
|
+
if (args.options.output !== 'json') {
|
|
37
|
+
customActions.forEach(a => a.Scope = this.humanizeScope(a.Scope));
|
|
46
38
|
}
|
|
39
|
+
await logger.log(customActions);
|
|
47
40
|
}
|
|
48
41
|
catch (err) {
|
|
49
42
|
this.handleRejectedPromise(err);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import commands from '../../commands.js';
|
|
2
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { zod } from '../../../../utils/zod.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
7
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
import { odata } from '../../../../utils/odata.js';
|
|
11
|
+
export const options = globalOptionsZod
|
|
12
|
+
.extend({
|
|
13
|
+
webUrl: zod.alias('u', z.string()
|
|
14
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, url => ({
|
|
15
|
+
message: `'${url}' is not a valid SharePoint Online site URL.`
|
|
16
|
+
}))),
|
|
17
|
+
fileUrl: z.string().optional(),
|
|
18
|
+
fileId: zod.alias('i', z.string()
|
|
19
|
+
.refine(id => validation.isValidGuid(id), id => ({
|
|
20
|
+
message: `'${id}' is not a valid GUID.`
|
|
21
|
+
})).optional()),
|
|
22
|
+
label: z.string()
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
class SpoFileVersionKeepCommand extends SpoCommand {
|
|
26
|
+
get name() {
|
|
27
|
+
return commands.FILE_VERSION_KEEP;
|
|
28
|
+
}
|
|
29
|
+
get description() {
|
|
30
|
+
return 'Ensure that a specific file version will never expire';
|
|
31
|
+
}
|
|
32
|
+
get schema() {
|
|
33
|
+
return options;
|
|
34
|
+
}
|
|
35
|
+
getRefinedSchema(schema) {
|
|
36
|
+
return schema
|
|
37
|
+
.refine(options => [options.fileUrl, options.fileId].filter(o => o !== undefined).length === 1, {
|
|
38
|
+
message: `Specify 'fileUrl' or 'fileId', but not both.`
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async commandAction(logger, args) {
|
|
42
|
+
if (this.verbose) {
|
|
43
|
+
await logger.logToStderr(`Ensuring version '${args.options.label}' of file '${args.options.fileUrl || args.options.fileId}' at site '${args.options.webUrl}' will never expire...`);
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const baseApiUrl = this.getBaseApiUrl(args.options.webUrl, args.options.fileUrl, args.options.fileId);
|
|
47
|
+
const response = await odata.getAllItems(`${baseApiUrl}/versions?$filter=VersionLabel eq '${formatting.encodeQueryParameter(args.options.label)}'&$select=ID`);
|
|
48
|
+
if (response.length === 0) {
|
|
49
|
+
throw `Version with label '${args.options.label}' not found.`;
|
|
50
|
+
}
|
|
51
|
+
const requestExpirationOptions = {
|
|
52
|
+
url: `${baseApiUrl}/versions(${response[0].ID})/SetExpirationDate()`,
|
|
53
|
+
headers: {
|
|
54
|
+
accept: 'application/json;odata=nometadata',
|
|
55
|
+
'content-type': 'application/json'
|
|
56
|
+
},
|
|
57
|
+
responseType: 'json'
|
|
58
|
+
};
|
|
59
|
+
await request.post(requestExpirationOptions);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
this.handleRejectedODataJsonPromise(err);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
getBaseApiUrl(webUrl, fileUrl, fileId) {
|
|
66
|
+
let requestUrl;
|
|
67
|
+
if (fileUrl) {
|
|
68
|
+
const serverRelUrl = urlUtil.getServerRelativePath(webUrl, fileUrl);
|
|
69
|
+
requestUrl = `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelUrl)}')`;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
requestUrl = `${webUrl}/_api/web/GetFileById('${fileId}')`;
|
|
73
|
+
}
|
|
74
|
+
return requestUrl;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export default new SpoFileVersionKeepCommand();
|
|
78
|
+
//# sourceMappingURL=file-version-keep.js.map
|
|
@@ -1,28 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zod } from '../../../../utils/zod.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { validation } from '../../../../utils/validation.js';
|
|
2
5
|
import { spo } from '../../../../utils/spo.js';
|
|
3
6
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
4
7
|
import commands from '../../commands.js';
|
|
8
|
+
import { odata } from '../../../../utils/odata.js';
|
|
9
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
+
const options = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
url: zod.alias('u', z.string()
|
|
13
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, url => ({
|
|
14
|
+
message: `'${url}' is not a valid SharePoint Online site URL.`
|
|
15
|
+
})))
|
|
16
|
+
})
|
|
17
|
+
.strict();
|
|
5
18
|
class SpoHomeSiteGetCommand extends SpoCommand {
|
|
6
19
|
get name() {
|
|
7
20
|
return commands.HOMESITE_GET;
|
|
8
21
|
}
|
|
9
22
|
get description() {
|
|
10
|
-
return 'Gets information about
|
|
23
|
+
return 'Gets information about a home site';
|
|
11
24
|
}
|
|
12
|
-
|
|
25
|
+
get schema() {
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
13
29
|
try {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const res = await request.get(requestOptions);
|
|
23
|
-
if (!res["odata.null"]) {
|
|
24
|
-
await logger.log(res);
|
|
30
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
await logger.log(`Retrieving home sites...`);
|
|
33
|
+
}
|
|
34
|
+
const homeSites = await odata.getAllItems(`${spoAdminUrl}/_api/SPO.Tenant/GetTargetedSitesDetails`);
|
|
35
|
+
const homeSite = homeSites.find(hs => urlUtil.removeTrailingSlashes(hs.Url).toLowerCase() === urlUtil.removeTrailingSlashes(args.options.url).toLowerCase());
|
|
36
|
+
if (homeSite === undefined) {
|
|
37
|
+
throw `Home site with URL '${args.options.url}' not found.`;
|
|
25
38
|
}
|
|
39
|
+
await logger.log(homeSite);
|
|
26
40
|
}
|
|
27
41
|
catch (err) {
|
|
28
42
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -9,27 +9,16 @@ class SpoHomeSiteListCommand extends SpoCommand {
|
|
|
9
9
|
get description() {
|
|
10
10
|
return 'Lists all home sites';
|
|
11
11
|
}
|
|
12
|
-
alias() {
|
|
13
|
-
return [commands.TENANT_HOMESITE_LIST];
|
|
14
|
-
}
|
|
15
12
|
defaultProperties() {
|
|
16
13
|
return ['Url', 'Title'];
|
|
17
14
|
}
|
|
18
15
|
async commandAction(logger) {
|
|
19
|
-
await this.showDeprecationWarning(logger, commands.TENANT_HOMESITE_LIST, commands.HOMESITE_LIST);
|
|
20
16
|
try {
|
|
21
17
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
22
|
-
const requestOptions = {
|
|
23
|
-
url: `${spoAdminUrl}/_api/SPO.Tenant/GetTargetedSitesDetails`,
|
|
24
|
-
headers: {
|
|
25
|
-
accept: 'application/json;odata=nometadata'
|
|
26
|
-
},
|
|
27
|
-
responseType: 'json'
|
|
28
|
-
};
|
|
29
18
|
if (this.verbose) {
|
|
30
19
|
await logger.logToStderr(`Retrieving all home sites...`);
|
|
31
20
|
}
|
|
32
|
-
const res = await odata.getAllItems(
|
|
21
|
+
const res = await odata.getAllItems(`${spoAdminUrl}/_api/SPO.Tenant/GetTargetedSitesDetails`);
|
|
33
22
|
await logger.log(res);
|
|
34
23
|
}
|
|
35
24
|
catch (err) {
|