@pnp/cli-microsoft365 9.0.0-beta.0d94b15 → 9.0.0-beta.1516729
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +11 -12
- package/dist/Command.js +1 -3
- package/dist/cli/cli.js +57 -8
- package/dist/config.js +60 -5
- package/dist/m365/app/commands/permission/permission-add.js +9 -9
- package/dist/m365/base/SpoCommand.js +1 -1
- package/dist/m365/cli/commands/cli-consent.js +9 -5
- package/dist/m365/cli/commands/cli-doctor.js +2 -2
- package/dist/m365/cli/commands/cli-reconsent.js +2 -3
- package/dist/m365/cli/commands/config/config-set.js +12 -3
- package/dist/m365/commands/login.js +38 -14
- package/dist/m365/commands/setup.js +256 -33
- package/dist/m365/commands/status.js +2 -2
- package/dist/m365/connection/commands/connection-list.js +4 -4
- package/dist/m365/entra/commands/app/app-add.js +52 -288
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +13 -13
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +18 -18
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +1 -1
- package/dist/m365/entra/commands/group/group-user-list.js +4 -4
- package/dist/m365/entra/commands/m365group/m365group-conversation-post-list.js +4 -4
- package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-list.js +3 -3
- package/dist/m365/entra/commands/m365group/m365group-user-list.js +9 -6
- package/dist/m365/onenote/commands/notebook/notebook-add.js +132 -0
- package/dist/m365/onenote/commands.js +1 -0
- package/dist/m365/outlook/commands/message/message-get.js +11 -11
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +1 -1
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +10 -1
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +1 -0
- package/dist/m365/spo/commands/file/file-copy.js +34 -55
- package/dist/m365/spo/commands/folder/folder-set.js +4 -0
- package/dist/m365/spo/commands/list/list-list.js +4 -1
- package/dist/m365/spo/commands/site/site-appcatalog-remove.js +24 -48
- package/dist/m365/spo/commands/site/site-get.js +12 -16
- package/dist/m365/spo/commands/site/site-remove.js +7 -1
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +22 -2
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/viva/commands/engage/engage-group-list.js +5 -0
- package/dist/m365/viva/commands/engage/engage-group-user-add.js +5 -0
- package/dist/m365/viva/commands/engage/engage-group-user-remove.js +5 -0
- package/dist/m365/viva/commands/engage/engage-message-add.js +5 -0
- package/dist/m365/viva/commands/engage/engage-message-get.js +5 -0
- package/dist/m365/viva/commands/engage/engage-message-like-set.js +5 -0
- package/dist/m365/viva/commands/engage/engage-message-list.js +5 -0
- package/dist/m365/viva/commands/engage/engage-message-remove.js +5 -0
- package/dist/m365/viva/commands/engage/engage-network-list.js +5 -0
- package/dist/m365/viva/commands/engage/engage-report-activitycounts.js +8 -0
- package/dist/m365/viva/commands/engage/engage-report-activityusercounts.js +8 -0
- package/dist/m365/viva/commands/engage/engage-report-activityuserdetail.js +8 -0
- package/dist/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.js +8 -0
- package/dist/m365/viva/commands/engage/engage-report-deviceusageusercounts.js +8 -0
- package/dist/m365/viva/commands/engage/engage-report-deviceusageuserdetail.js +8 -0
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitycounts.js +8 -0
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitydetail.js +8 -0
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.js +8 -0
- package/dist/m365/viva/commands/engage/engage-search.js +5 -0
- package/dist/m365/viva/commands/engage/engage-user-get.js +5 -0
- package/dist/m365/viva/commands/engage/engage-user-list.js +5 -0
- package/dist/m365/viva/commands/engage/yammerCommands.js +25 -0
- package/dist/settingsNames.js +7 -1
- package/dist/utils/entraApp.js +283 -0
- package/dist/utils/spo.js +0 -74
- package/docs/docs/_clisettings.mdx +6 -0
- package/docs/docs/cmd/app/permission/permission-add.mdx +5 -5
- package/docs/docs/cmd/cli/cli-consent.mdx +1 -1
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-add.mdx +12 -12
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-get.mdx +14 -14
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-list.mdx +5 -5
- package/docs/docs/cmd/entra/group/group-user-list.mdx +7 -7
- package/docs/docs/cmd/entra/m365group/m365group-conversation-post-list.mdx +5 -5
- package/docs/docs/cmd/entra/m365group/m365group-recyclebinitem-list.mdx +3 -3
- package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +1 -1
- package/docs/docs/cmd/onenote/notebook/notebook-add.mdx +169 -0
- package/docs/docs/cmd/outlook/message/message-get.mdx +5 -5
- package/docs/docs/cmd/setup.mdx +16 -3
- package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +12 -11
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +5 -6
- package/docs/docs/cmd/spo/file/file-copy.mdx +12 -119
- package/docs/docs/cmd/spo/folder/folder-set.mdx +6 -0
- package/docs/docs/cmd/spo/list/list-list.mdx +7 -5
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +2 -11
- package/docs/docs/cmd/spo/site/site-remove.mdx +3 -0
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.mdx +49 -2
- package/package.json +1 -1
|
@@ -31,6 +31,9 @@ class EntraM365GroupUserListCommand extends GraphCommand {
|
|
|
31
31
|
async commandAction(logger, args) {
|
|
32
32
|
await this.showDeprecationWarning(logger, aadCommands.M365GROUP_USER_LIST, commands.M365GROUP_USER_LIST);
|
|
33
33
|
try {
|
|
34
|
+
if (args.options.role === 'Guest') {
|
|
35
|
+
await this.warn(logger, `Value 'Guest' for the option role is deprecated. Use --filter "userType eq 'Guest'" instead.`);
|
|
36
|
+
}
|
|
34
37
|
const groupId = await this.getGroupId(args.options, logger);
|
|
35
38
|
const isUnifiedGroup = await entraGroup.isUnifiedGroup(groupId);
|
|
36
39
|
if (!isUnifiedGroup) {
|
|
@@ -39,9 +42,9 @@ class EntraM365GroupUserListCommand extends GraphCommand {
|
|
|
39
42
|
let users = [];
|
|
40
43
|
if (!args.options.role || args.options.role === 'Owner') {
|
|
41
44
|
const owners = await this.getUsers(args.options, 'Owners', groupId, logger);
|
|
42
|
-
owners.forEach(owner => users.push({ ...owner, roles: ['Owner'] }));
|
|
45
|
+
owners.forEach(owner => users.push({ ...owner, roles: ['Owner'], userType: 'Owner' }));
|
|
43
46
|
}
|
|
44
|
-
if (!args.options.role || args.options.role === 'Member') {
|
|
47
|
+
if (!args.options.role || args.options.role === 'Member' || args.options.role === 'Guest') {
|
|
45
48
|
const members = await this.getUsers(args.options, 'Members', groupId, logger);
|
|
46
49
|
members.forEach((member) => {
|
|
47
50
|
const user = users.find((u) => u.id === member.id);
|
|
@@ -54,7 +57,7 @@ class EntraM365GroupUserListCommand extends GraphCommand {
|
|
|
54
57
|
});
|
|
55
58
|
}
|
|
56
59
|
if (args.options.role) {
|
|
57
|
-
users = users.filter(i => i.
|
|
60
|
+
users = users.filter(i => i.userType === args.options.role);
|
|
58
61
|
}
|
|
59
62
|
await logger.log(users);
|
|
60
63
|
}
|
|
@@ -125,7 +128,7 @@ _EntraM365GroupUserListCommand_instances = new WeakSet(), _EntraM365GroupUserLis
|
|
|
125
128
|
option: "-n, --groupDisplayName [groupDisplayName]"
|
|
126
129
|
}, {
|
|
127
130
|
option: "-r, --role [type]",
|
|
128
|
-
autocomplete: ["Owner", "Member"]
|
|
131
|
+
autocomplete: ["Owner", "Member", "Guest"]
|
|
129
132
|
}, {
|
|
130
133
|
option: "-p, --properties [properties]"
|
|
131
134
|
}, {
|
|
@@ -141,8 +144,8 @@ _EntraM365GroupUserListCommand_instances = new WeakSet(), _EntraM365GroupUserLis
|
|
|
141
144
|
return `${args.options.groupId} is not a valid GUID`;
|
|
142
145
|
}
|
|
143
146
|
if (args.options.role) {
|
|
144
|
-
if (['Owner', 'Member'].indexOf(args.options.role) === -1) {
|
|
145
|
-
return `${args.options.role} is not a valid role value. Allowed values Owner|Member`;
|
|
147
|
+
if (['Owner', 'Member', 'Guest'].indexOf(args.options.role) === -1) {
|
|
148
|
+
return `${args.options.role} is not a valid role value. Allowed values Owner|Member|Guest`;
|
|
146
149
|
}
|
|
147
150
|
}
|
|
148
151
|
return true;
|
|
@@ -0,0 +1,132 @@
|
|
|
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 _OneNoteNotebookAddCommand_instances, _OneNoteNotebookAddCommand_initTelemetry, _OneNoteNotebookAddCommand_initOptions, _OneNoteNotebookAddCommand_initValidators, _OneNoteNotebookAddCommand_initOptionSets;
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
9
|
+
import { validation } from '../../../../utils/validation.js';
|
|
10
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
|
+
import commands from '../../commands.js';
|
|
12
|
+
import { spo } from '../../../../utils/spo.js';
|
|
13
|
+
class OneNoteNotebookAddCommand extends GraphCommand {
|
|
14
|
+
get name() {
|
|
15
|
+
return commands.NOTEBOOK_ADD;
|
|
16
|
+
}
|
|
17
|
+
get description() {
|
|
18
|
+
return 'Create a new OneNote notebook';
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_OneNoteNotebookAddCommand_instances.add(this);
|
|
23
|
+
__classPrivateFieldGet(this, _OneNoteNotebookAddCommand_instances, "m", _OneNoteNotebookAddCommand_initTelemetry).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _OneNoteNotebookAddCommand_instances, "m", _OneNoteNotebookAddCommand_initOptions).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _OneNoteNotebookAddCommand_instances, "m", _OneNoteNotebookAddCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _OneNoteNotebookAddCommand_instances, "m", _OneNoteNotebookAddCommand_initOptionSets).call(this);
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
29
|
+
try {
|
|
30
|
+
if (this.verbose) {
|
|
31
|
+
await logger.logToStderr(`Creating OneNote notebook ${args.options.name}`);
|
|
32
|
+
}
|
|
33
|
+
const requestUrl = await this.getRequestUrl(args);
|
|
34
|
+
const requestOptions = {
|
|
35
|
+
url: requestUrl,
|
|
36
|
+
headers: {
|
|
37
|
+
accept: 'application/json;odata.metadata=none',
|
|
38
|
+
'content-type': "application/json"
|
|
39
|
+
},
|
|
40
|
+
responseType: 'json',
|
|
41
|
+
data: {
|
|
42
|
+
displayName: args.options.name
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const response = await request.post(requestOptions);
|
|
46
|
+
await logger.log(response);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
this.handleRejectedODataJsonPromise(err);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async getRequestUrl(args) {
|
|
53
|
+
let endpoint = `${this.resource}/v1.0/`;
|
|
54
|
+
if (args.options.userId) {
|
|
55
|
+
endpoint += `users/${args.options.userId}`;
|
|
56
|
+
}
|
|
57
|
+
else if (args.options.userName) {
|
|
58
|
+
endpoint += `users/${args.options.userName}`;
|
|
59
|
+
}
|
|
60
|
+
else if (args.options.groupId) {
|
|
61
|
+
endpoint += `groups/${args.options.groupId}`;
|
|
62
|
+
}
|
|
63
|
+
else if (args.options.groupName) {
|
|
64
|
+
const groupId = await entraGroup.getGroupIdByDisplayName(args.options.groupName);
|
|
65
|
+
endpoint += `groups/${groupId}`;
|
|
66
|
+
}
|
|
67
|
+
else if (args.options.webUrl) {
|
|
68
|
+
const siteId = await spo.getSpoGraphSiteId(args.options.webUrl);
|
|
69
|
+
endpoint += `sites/${siteId}`;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
endpoint += 'me';
|
|
73
|
+
}
|
|
74
|
+
endpoint += '/onenote/notebooks';
|
|
75
|
+
return endpoint;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
_OneNoteNotebookAddCommand_instances = new WeakSet(), _OneNoteNotebookAddCommand_initTelemetry = function _OneNoteNotebookAddCommand_initTelemetry() {
|
|
79
|
+
this.telemetry.push((args) => {
|
|
80
|
+
Object.assign(this.telemetryProperties, {
|
|
81
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
82
|
+
userName: typeof args.options.userName !== 'undefined',
|
|
83
|
+
groupId: typeof args.options.groupId !== 'undefined',
|
|
84
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
85
|
+
webUrl: typeof args.options.webUrl !== 'undefined'
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}, _OneNoteNotebookAddCommand_initOptions = function _OneNoteNotebookAddCommand_initOptions() {
|
|
89
|
+
this.options.unshift({
|
|
90
|
+
option: '-n, --name <name>'
|
|
91
|
+
}, {
|
|
92
|
+
option: '--userId [userId]'
|
|
93
|
+
}, {
|
|
94
|
+
option: '--userName [userName]'
|
|
95
|
+
}, {
|
|
96
|
+
option: '--groupId [groupId]'
|
|
97
|
+
}, {
|
|
98
|
+
option: '--groupName [groupName]'
|
|
99
|
+
}, {
|
|
100
|
+
option: '-u, --webUrl [webUrl]'
|
|
101
|
+
});
|
|
102
|
+
}, _OneNoteNotebookAddCommand_initValidators = function _OneNoteNotebookAddCommand_initValidators() {
|
|
103
|
+
this.validators.push(async (args) => {
|
|
104
|
+
// check name for invalid characters
|
|
105
|
+
if (args.options.name.length > 128) {
|
|
106
|
+
return 'The specified name is too long. It should be less than 128 characters';
|
|
107
|
+
}
|
|
108
|
+
if (/[?*/:<>|'"]/.test(args.options.name)) {
|
|
109
|
+
return `The specified name contains invalid characters. It cannot contain ?*/:<>|'". Please remove them and try again.`;
|
|
110
|
+
}
|
|
111
|
+
if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
|
|
112
|
+
return `${args.options.userId} is not a valid GUID`;
|
|
113
|
+
}
|
|
114
|
+
if (args.options.groupId && !validation.isValidGuid(args.options.groupId)) {
|
|
115
|
+
return `${args.options.groupId} is not a valid GUID`;
|
|
116
|
+
}
|
|
117
|
+
if (args.options.webUrl) {
|
|
118
|
+
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
});
|
|
122
|
+
}, _OneNoteNotebookAddCommand_initOptionSets = function _OneNoteNotebookAddCommand_initOptionSets() {
|
|
123
|
+
this.optionSets.push({
|
|
124
|
+
options: ['userId', 'userName', 'groupId', 'groupName', 'webUrl'],
|
|
125
|
+
runsWhen: (args) => {
|
|
126
|
+
const options = [args.options.userId, args.options.userName, args.options.groupId, args.options.groupName, args.options.webUrl];
|
|
127
|
+
return options.some(item => item !== undefined);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
export default new OneNoteNotebookAddCommand();
|
|
132
|
+
//# sourceMappingURL=notebook-add.js.map
|
|
@@ -30,20 +30,20 @@ class OutlookMessageGetCommand extends GraphCommand {
|
|
|
30
30
|
}
|
|
31
31
|
let requestUrl = '';
|
|
32
32
|
if (isAppOnlyAccessToken) {
|
|
33
|
-
if (!args.options.userId && !args.options.
|
|
34
|
-
throw `The option 'userId' or '
|
|
33
|
+
if (!args.options.userId && !args.options.userPrincipalName) {
|
|
34
|
+
throw `The option 'userId' or 'userPrincipalName' is required when retrieving an email using app only credentials`;
|
|
35
35
|
}
|
|
36
|
-
if (args.options.userId && args.options.
|
|
37
|
-
throw `Both options 'userId' and '
|
|
36
|
+
if (args.options.userId && args.options.userPrincipalName) {
|
|
37
|
+
throw `Both options 'userId' and 'userPrincipalName' cannot be set when retrieving an email using app only credentials`;
|
|
38
38
|
}
|
|
39
|
-
requestUrl += `users/${args.options.userId ? args.options.userId : args.options.
|
|
39
|
+
requestUrl += `users/${args.options.userId ? args.options.userId : args.options.userPrincipalName}`;
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
if (args.options.userId && args.options.
|
|
43
|
-
throw `Both options 'userId' and '
|
|
42
|
+
if (args.options.userId && args.options.userPrincipalName) {
|
|
43
|
+
throw `Both options 'userId' and 'userPrincipalName' cannot be set when retrieving an email using delegated credentials`;
|
|
44
44
|
}
|
|
45
|
-
if (args.options.userId || args.options.
|
|
46
|
-
requestUrl += `users/${args.options.userId ? args.options.userId : args.options.
|
|
45
|
+
if (args.options.userId || args.options.userPrincipalName) {
|
|
46
|
+
requestUrl += `users/${args.options.userId ? args.options.userId : args.options.userPrincipalName}`;
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
49
|
requestUrl += 'me';
|
|
@@ -69,7 +69,7 @@ _OutlookMessageGetCommand_instances = new WeakSet(), _OutlookMessageGetCommand_i
|
|
|
69
69
|
this.telemetry.push((args) => {
|
|
70
70
|
Object.assign(this.telemetryProperties, {
|
|
71
71
|
userId: typeof args.options.userId !== 'undefined',
|
|
72
|
-
|
|
72
|
+
userPrincipalName: typeof args.options.userPrincipalName !== 'undefined'
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
}, _OutlookMessageGetCommand_initOptions = function _OutlookMessageGetCommand_initOptions() {
|
|
@@ -78,7 +78,7 @@ _OutlookMessageGetCommand_instances = new WeakSet(), _OutlookMessageGetCommand_i
|
|
|
78
78
|
}, {
|
|
79
79
|
option: '--userId [userId]'
|
|
80
80
|
}, {
|
|
81
|
-
option: '--
|
|
81
|
+
option: '--userPrincipalName [userPrincipalName]'
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
84
|
export default new OutlookMessageGetCommand();
|
|
@@ -33,6 +33,9 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
|
33
33
|
if (this.projectRootPath === null) {
|
|
34
34
|
throw new CommandError(`Couldn't find project root folder`, _a.ERROR_NO_PROJECT_ROOT_FOLDER);
|
|
35
35
|
}
|
|
36
|
+
if (!args.options.overwrite) {
|
|
37
|
+
await this.warn(logger, `We recommend always using the --overwrite option and it will become the default behavior in next major release. Overwriting your sppkg file on every deployment is required to make continuous delivery of the latest version of your app which is the aim of the continuous delivery pipeline.`);
|
|
38
|
+
}
|
|
36
39
|
const solutionPackageJsonFile = path.join(this.projectRootPath, 'package.json');
|
|
37
40
|
const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
|
|
38
41
|
const solutionName = JSON.parse(packageJson).name;
|
|
@@ -78,6 +81,9 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
|
78
81
|
if (options.skipFeatureDeployment) {
|
|
79
82
|
this.getDeployAction(workflow).with.SKIP_FEATURE_DEPLOYMENT = true;
|
|
80
83
|
}
|
|
84
|
+
if (options.overwrite) {
|
|
85
|
+
this.getDeployAction(workflow).with.OVERWRITE = true;
|
|
86
|
+
}
|
|
81
87
|
if (options.loginMethod === 'user') {
|
|
82
88
|
const loginAction = this.getLoginAction(workflow);
|
|
83
89
|
loginAction.with = {
|
|
@@ -119,7 +125,8 @@ _a = SpfxProjectGithubWorkflowAddCommand, _SpfxProjectGithubWorkflowAddCommand_i
|
|
|
119
125
|
manuallyTrigger: !!args.options.manuallyTrigger,
|
|
120
126
|
loginMethod: typeof args.options.loginMethod !== 'undefined',
|
|
121
127
|
scope: typeof args.options.scope !== 'undefined',
|
|
122
|
-
skipFeatureDeployment: !!args.options.skipFeatureDeployment
|
|
128
|
+
skipFeatureDeployment: !!args.options.skipFeatureDeployment,
|
|
129
|
+
overwrite: !!args.options.overwrite
|
|
123
130
|
});
|
|
124
131
|
});
|
|
125
132
|
}, _SpfxProjectGithubWorkflowAddCommand_initOptions = function _SpfxProjectGithubWorkflowAddCommand_initOptions() {
|
|
@@ -139,6 +146,8 @@ _a = SpfxProjectGithubWorkflowAddCommand, _SpfxProjectGithubWorkflowAddCommand_i
|
|
|
139
146
|
option: '-u, --siteUrl [siteUrl]'
|
|
140
147
|
}, {
|
|
141
148
|
option: '--skipFeatureDeployment'
|
|
149
|
+
}, {
|
|
150
|
+
option: '--overwrite'
|
|
142
151
|
});
|
|
143
152
|
}, _SpfxProjectGithubWorkflowAddCommand_initValidators = function _SpfxProjectGithubWorkflowAddCommand_initValidators() {
|
|
144
153
|
this.validators.push(async (args) => {
|
|
@@ -33,6 +33,7 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
|
|
|
33
33
|
if (!args.options.clientSideComponentProperties) {
|
|
34
34
|
await logger.log({
|
|
35
35
|
...customAction,
|
|
36
|
+
Rights: JSON.stringify(customAction.Rights),
|
|
36
37
|
Scope: this.humanizeScope(customAction.Scope)
|
|
37
38
|
});
|
|
38
39
|
}
|
|
@@ -5,7 +5,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _SpoFileCopyCommand_instances, _SpoFileCopyCommand_initTelemetry, _SpoFileCopyCommand_initOptions, _SpoFileCopyCommand_initValidators, _SpoFileCopyCommand_initOptionSets, _SpoFileCopyCommand_initTypes;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
|
-
import { CreateCopyJobsNameConflictBehavior, spo } from '../../../../utils/spo.js';
|
|
9
8
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
9
|
import { validation } from '../../../../utils/validation.js';
|
|
11
10
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
@@ -31,43 +30,39 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
31
30
|
try {
|
|
32
31
|
const sourceServerRelativePath = await this.getSourcePath(logger, args.options);
|
|
33
32
|
const sourcePath = this.getAbsoluteUrl(args.options.webUrl, sourceServerRelativePath);
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
let newName = args.options.newName;
|
|
39
|
-
// Add original file extension if not provided
|
|
40
|
-
if (newName && !newName.includes('.')) {
|
|
41
|
-
newName += sourceServerRelativePath.substring(sourceServerRelativePath.lastIndexOf('.'));
|
|
33
|
+
let destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl) + '/';
|
|
34
|
+
if (args.options.newName) {
|
|
35
|
+
destinationPath += args.options.newName;
|
|
42
36
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
ignoreVersionHistory: !!args.options.ignoreVersionHistory,
|
|
47
|
-
newName: newName
|
|
48
|
-
});
|
|
49
|
-
if (args.options.skipWait) {
|
|
50
|
-
return;
|
|
37
|
+
else {
|
|
38
|
+
// Keep the original file name
|
|
39
|
+
destinationPath += sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
|
|
51
40
|
}
|
|
52
41
|
if (this.verbose) {
|
|
53
|
-
await logger.logToStderr(
|
|
42
|
+
await logger.logToStderr(`Copying file '${sourcePath}' to '${destinationPath}'...`);
|
|
54
43
|
}
|
|
55
|
-
const copyJobResult = await spo.getCopyJobResult(args.options.webUrl, copyJobResponse);
|
|
56
|
-
if (this.verbose) {
|
|
57
|
-
await logger.logToStderr('Getting information about the destination file...');
|
|
58
|
-
}
|
|
59
|
-
// Get destination file data
|
|
60
|
-
const siteRelativeDestinationFolder = '/' + copyJobResult.TargetObjectSiteRelativeUrl.substring(0, copyJobResult.TargetObjectSiteRelativeUrl.lastIndexOf('/'));
|
|
61
|
-
const absoluteWebUrl = destinationPath.substring(0, destinationPath.toLowerCase().lastIndexOf(siteRelativeDestinationFolder.toLowerCase()));
|
|
62
44
|
const requestOptions = {
|
|
63
|
-
url: `${
|
|
45
|
+
url: `${args.options.webUrl}/_api/SP.MoveCopyUtil.CopyFileByPath`,
|
|
64
46
|
headers: {
|
|
65
47
|
accept: 'application/json;odata=nometadata'
|
|
66
48
|
},
|
|
67
|
-
responseType: 'json'
|
|
49
|
+
responseType: 'json',
|
|
50
|
+
data: {
|
|
51
|
+
srcPath: {
|
|
52
|
+
DecodedUrl: sourcePath
|
|
53
|
+
},
|
|
54
|
+
destPath: {
|
|
55
|
+
DecodedUrl: destinationPath
|
|
56
|
+
},
|
|
57
|
+
overwrite: args.options.nameConflictBehavior === 'replace',
|
|
58
|
+
options: {
|
|
59
|
+
KeepBoth: args.options.nameConflictBehavior === 'rename',
|
|
60
|
+
ResetAuthorAndCreatedOnCopy: !!args.options.resetAuthorAndCreated,
|
|
61
|
+
ShouldBypassSharedLocks: !!args.options.bypassSharedLock
|
|
62
|
+
}
|
|
63
|
+
}
|
|
68
64
|
};
|
|
69
|
-
|
|
70
|
-
await logger.log(destinationFile);
|
|
65
|
+
await request.post(requestOptions);
|
|
71
66
|
}
|
|
72
67
|
catch (err) {
|
|
73
68
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -81,30 +76,17 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
81
76
|
await logger.logToStderr(`Retrieving server-relative path for file with ID '${options.sourceId}'...`);
|
|
82
77
|
}
|
|
83
78
|
const requestOptions = {
|
|
84
|
-
url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')
|
|
79
|
+
url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')?$select=ServerRelativePath`,
|
|
85
80
|
headers: {
|
|
86
81
|
accept: 'application/json;odata=nometadata'
|
|
87
82
|
},
|
|
88
83
|
responseType: 'json'
|
|
89
84
|
};
|
|
90
85
|
const file = await request.get(requestOptions);
|
|
91
|
-
return file.DecodedUrl;
|
|
92
|
-
}
|
|
93
|
-
getNameConflictBehaviorValue(nameConflictBehavior) {
|
|
94
|
-
switch (nameConflictBehavior?.toLowerCase()) {
|
|
95
|
-
case 'fail':
|
|
96
|
-
return CreateCopyJobsNameConflictBehavior.Fail;
|
|
97
|
-
case 'replace':
|
|
98
|
-
return CreateCopyJobsNameConflictBehavior.Replace;
|
|
99
|
-
case 'rename':
|
|
100
|
-
return CreateCopyJobsNameConflictBehavior.Rename;
|
|
101
|
-
default:
|
|
102
|
-
return CreateCopyJobsNameConflictBehavior.Fail;
|
|
103
|
-
}
|
|
86
|
+
return file.ServerRelativePath.DecodedUrl;
|
|
104
87
|
}
|
|
105
88
|
getAbsoluteUrl(webUrl, url) {
|
|
106
|
-
|
|
107
|
-
return urlUtil.removeTrailingSlashes(result);
|
|
89
|
+
return url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
|
|
108
90
|
}
|
|
109
91
|
}
|
|
110
92
|
_SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry = function _SpoFileCopyCommand_initTelemetry() {
|
|
@@ -113,10 +95,9 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
113
95
|
sourceUrl: typeof args.options.sourceUrl !== 'undefined',
|
|
114
96
|
sourceId: typeof args.options.sourceId !== 'undefined',
|
|
115
97
|
newName: typeof args.options.newName !== 'undefined',
|
|
116
|
-
nameConflictBehavior:
|
|
117
|
-
|
|
118
|
-
bypassSharedLock: !!args.options.bypassSharedLock
|
|
119
|
-
skipWait: !!args.options.skipWait
|
|
98
|
+
nameConflictBehavior: args.options.nameConflictBehavior || false,
|
|
99
|
+
resetAuthorAndCreated: !!args.options.resetAuthorAndCreated,
|
|
100
|
+
bypassSharedLock: !!args.options.bypassSharedLock
|
|
120
101
|
});
|
|
121
102
|
});
|
|
122
103
|
}, _SpoFileCopyCommand_initOptions = function _SpoFileCopyCommand_initOptions() {
|
|
@@ -134,11 +115,9 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
134
115
|
option: '--nameConflictBehavior [nameConflictBehavior]',
|
|
135
116
|
autocomplete: this.nameConflictBehaviorOptions
|
|
136
117
|
}, {
|
|
137
|
-
option: '--
|
|
138
|
-
}, {
|
|
139
|
-
option: '--ignoreVersionHistory'
|
|
118
|
+
option: '--resetAuthorAndCreated'
|
|
140
119
|
}, {
|
|
141
|
-
option: '--
|
|
120
|
+
option: '--bypassSharedLock'
|
|
142
121
|
});
|
|
143
122
|
}, _SpoFileCopyCommand_initValidators = function _SpoFileCopyCommand_initValidators() {
|
|
144
123
|
this.validators.push(async (args) => {
|
|
@@ -149,7 +128,7 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
149
128
|
if (args.options.sourceId && !validation.isValidGuid(args.options.sourceId)) {
|
|
150
129
|
return `${args.options.sourceId} is not a valid GUID for sourceId.`;
|
|
151
130
|
}
|
|
152
|
-
if (args.options.nameConflictBehavior &&
|
|
131
|
+
if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.indexOf(args.options.nameConflictBehavior) === -1) {
|
|
153
132
|
return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}.`;
|
|
154
133
|
}
|
|
155
134
|
return true;
|
|
@@ -158,7 +137,7 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
158
137
|
this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
|
|
159
138
|
}, _SpoFileCopyCommand_initTypes = function _SpoFileCopyCommand_initTypes() {
|
|
160
139
|
this.types.string.push('webUrl', 'sourceUrl', 'sourceId', 'targetUrl', 'newName', 'nameConflictBehavior');
|
|
161
|
-
this.types.boolean.push('
|
|
140
|
+
this.types.boolean.push('resetAuthorAndCreated', 'bypassSharedLock');
|
|
162
141
|
};
|
|
163
142
|
export default new SpoFileCopyCommand();
|
|
164
143
|
//# sourceMappingURL=file-copy.js.map
|
|
@@ -18,6 +18,9 @@ class SpoFolderSetCommand extends SpoCommand {
|
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Updates a folder';
|
|
20
20
|
}
|
|
21
|
+
alias() {
|
|
22
|
+
return [commands.FOLDER_RENAME];
|
|
23
|
+
}
|
|
21
24
|
constructor() {
|
|
22
25
|
super();
|
|
23
26
|
_SpoFolderSetCommand_instances.add(this);
|
|
@@ -31,6 +34,7 @@ class SpoFolderSetCommand extends SpoCommand {
|
|
|
31
34
|
}
|
|
32
35
|
async commandAction(logger, args) {
|
|
33
36
|
try {
|
|
37
|
+
await this.showDeprecationWarning(logger, this.alias()[0], this.name);
|
|
34
38
|
if (this.verbose) {
|
|
35
39
|
await logger.logToStderr(`Updating folder '${args.options.name}'...`);
|
|
36
40
|
}
|
|
@@ -16,7 +16,7 @@ class SpoListListCommand extends SpoCommand {
|
|
|
16
16
|
return 'Lists all available list in the specified site';
|
|
17
17
|
}
|
|
18
18
|
defaultProperties() {
|
|
19
|
-
return ['Title', 'Id'];
|
|
19
|
+
return ['Title', 'Url', 'Id'];
|
|
20
20
|
}
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
@@ -36,6 +36,9 @@ class SpoListListCommand extends SpoCommand {
|
|
|
36
36
|
queryParams.push(`$filter=${args.options.filter}`);
|
|
37
37
|
}
|
|
38
38
|
const listInstances = await odata.getAllItems(`${args.options.webUrl}/_api/web/lists?${queryParams.join('&')}`);
|
|
39
|
+
listInstances.forEach(l => {
|
|
40
|
+
l.Url = l.RootFolder.ServerRelativeUrl;
|
|
41
|
+
});
|
|
39
42
|
await logger.log(listInstances);
|
|
40
43
|
}
|
|
41
44
|
catch (err) {
|
|
@@ -3,8 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _SpoSiteAppCatalogRemoveCommand_instances,
|
|
7
|
-
import { cli } from '../../../../cli/cli.js';
|
|
6
|
+
var _SpoSiteAppCatalogRemoveCommand_instances, _SpoSiteAppCatalogRemoveCommand_initOptions, _SpoSiteAppCatalogRemoveCommand_initValidators;
|
|
8
7
|
import config from '../../../../config.js';
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -22,70 +21,47 @@ class SpoSiteAppCatalogRemoveCommand extends SpoCommand {
|
|
|
22
21
|
constructor() {
|
|
23
22
|
super();
|
|
24
23
|
_SpoSiteAppCatalogRemoveCommand_instances.add(this);
|
|
25
|
-
__classPrivateFieldGet(this, _SpoSiteAppCatalogRemoveCommand_instances, "m", _SpoSiteAppCatalogRemoveCommand_initTelemetry).call(this);
|
|
26
24
|
__classPrivateFieldGet(this, _SpoSiteAppCatalogRemoveCommand_instances, "m", _SpoSiteAppCatalogRemoveCommand_initOptions).call(this);
|
|
27
25
|
__classPrivateFieldGet(this, _SpoSiteAppCatalogRemoveCommand_instances, "m", _SpoSiteAppCatalogRemoveCommand_initValidators).call(this);
|
|
28
|
-
__classPrivateFieldGet(this, _SpoSiteAppCatalogRemoveCommand_instances, "m", _SpoSiteAppCatalogRemoveCommand_initTypes).call(this);
|
|
29
26
|
}
|
|
30
27
|
async commandAction(logger, args) {
|
|
31
|
-
const
|
|
32
|
-
|
|
28
|
+
const url = args.options.siteUrl;
|
|
29
|
+
try {
|
|
30
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
31
|
+
const requestDigest = await spo.getRequestDigest(spoAdminUrl);
|
|
33
32
|
if (this.verbose) {
|
|
34
33
|
await logger.logToStderr(`Disabling site collection app catalog...`);
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const response = json[0];
|
|
49
|
-
if (response.ErrorInfo) {
|
|
50
|
-
throw response.ErrorInfo.ErrorMessage;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
if (this.verbose) {
|
|
54
|
-
await logger.logToStderr('Site collection app catalog disabled');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
35
|
+
const requestOptions = {
|
|
36
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
37
|
+
headers: {
|
|
38
|
+
'X-RequestDigest': requestDigest.FormDigestValue
|
|
39
|
+
},
|
|
40
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="50" ObjectPathId="49" /><ObjectPath Id="52" ObjectPathId="51" /><ObjectPath Id="54" ObjectPathId="53" /><ObjectPath Id="56" ObjectPathId="55" /><ObjectPath Id="58" ObjectPathId="57" /><Method Name="Remove" Id="59" ObjectPathId="57"><Parameters><Parameter Type="String">${formatting.escapeXml(url)}</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="49" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="51" ParentId="49" Name="GetSiteByUrl"><Parameters><Parameter Type="String">${formatting.escapeXml(url)}</Parameter></Parameters></Method><Property Id="53" ParentId="51" Name="RootWeb" /><Property Id="55" ParentId="53" Name="TenantAppCatalog" /><Property Id="57" ParentId="55" Name="SiteCollectionAppCatalogsSites" /></ObjectPaths></Request>`
|
|
41
|
+
};
|
|
42
|
+
const res = await request.post(requestOptions);
|
|
43
|
+
const json = JSON.parse(res);
|
|
44
|
+
const response = json[0];
|
|
45
|
+
if (response.ErrorInfo) {
|
|
46
|
+
throw response.ErrorInfo.ErrorMessage;
|
|
57
47
|
}
|
|
58
|
-
|
|
59
|
-
this.
|
|
48
|
+
else {
|
|
49
|
+
if (this.verbose) {
|
|
50
|
+
await logger.logToStderr('Site collection app catalog disabled');
|
|
51
|
+
}
|
|
60
52
|
}
|
|
61
|
-
};
|
|
62
|
-
if (args.options.force) {
|
|
63
|
-
await removeSiteAppcatalog();
|
|
64
53
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (result) {
|
|
68
|
-
await removeSiteAppcatalog();
|
|
69
|
-
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
this.handleRejectedPromise(err);
|
|
70
56
|
}
|
|
71
57
|
}
|
|
72
58
|
}
|
|
73
|
-
_SpoSiteAppCatalogRemoveCommand_instances = new WeakSet(),
|
|
74
|
-
this.telemetry.push((args) => {
|
|
75
|
-
Object.assign(this.telemetryProperties, {
|
|
76
|
-
force: !!args.options.force
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
}, _SpoSiteAppCatalogRemoveCommand_initOptions = function _SpoSiteAppCatalogRemoveCommand_initOptions() {
|
|
59
|
+
_SpoSiteAppCatalogRemoveCommand_instances = new WeakSet(), _SpoSiteAppCatalogRemoveCommand_initOptions = function _SpoSiteAppCatalogRemoveCommand_initOptions() {
|
|
80
60
|
this.options.unshift({
|
|
81
61
|
option: '-u, --siteUrl <siteUrl>'
|
|
82
|
-
}, {
|
|
83
|
-
option: '-f, --force'
|
|
84
62
|
});
|
|
85
63
|
}, _SpoSiteAppCatalogRemoveCommand_initValidators = function _SpoSiteAppCatalogRemoveCommand_initValidators() {
|
|
86
64
|
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.siteUrl));
|
|
87
|
-
}, _SpoSiteAppCatalogRemoveCommand_initTypes = function _SpoSiteAppCatalogRemoveCommand_initTypes() {
|
|
88
|
-
this.types.string.push('siteUrl');
|
|
89
65
|
};
|
|
90
66
|
export default new SpoSiteAppCatalogRemoveCommand();
|
|
91
67
|
//# sourceMappingURL=site-appcatalog-remove.js.map
|