@pnp/cli-microsoft365 8.1.0-beta.3dec9fa → 9.0.0-beta.1cfb646
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 +9 -9
- package/dist/Command.js +49 -2
- package/dist/cli/cli.js +60 -38
- package/dist/config.js +1 -1
- package/dist/m365/app/commands/permission/permission-add.js +9 -9
- package/dist/m365/commands/login.js +44 -96
- package/dist/m365/commands/status.js +2 -2
- package/dist/m365/connection/commands/connection-remove.js +6 -2
- package/dist/m365/connection/commands/connection-set.js +4 -1
- package/dist/m365/connection/commands/connection-use.js +25 -4
- 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 +6 -9
- package/dist/m365/entra/commands/multitenant/multitenant-add.js +65 -0
- package/dist/m365/entra/commands/multitenant/multitenant-remove.js +118 -0
- package/dist/m365/entra/commands/multitenant/multitenant-set.js +72 -0
- package/dist/m365/entra/commands.js +3 -0
- package/dist/m365/outlook/commands/message/message-get.js +11 -11
- package/dist/m365/spe/ContainerTypeProperties.js +2 -0
- package/dist/m365/spe/commands/containertype/containertype-list.js +49 -0
- package/dist/m365/spe/commands.js +2 -1
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +1 -1
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +1 -10
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +16 -21
- package/dist/m365/spo/commands/commandset/commandset-get.js +31 -17
- package/dist/m365/spo/commands/file/file-copy.js +55 -34
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/folder/folder-set.js +0 -4
- package/dist/m365/spo/commands/list/list-list.js +1 -4
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +46 -21
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +48 -46
- package/dist/m365/spo/commands/site/site-appcatalog-remove.js +48 -24
- package/dist/m365/spo/commands/site/site-remove.js +1 -7
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +19 -5
- package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +20 -6
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +2 -22
- package/dist/m365/spo/commands.js +0 -1
- package/dist/utils/formatting.js +16 -0
- package/dist/utils/spo.js +111 -6
- package/dist/utils/zod.js +124 -0
- package/docs/docs/cmd/app/permission/permission-add.mdx +5 -5
- package/docs/docs/cmd/connection/connection-use.mdx +8 -2
- 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/entra/multitenant/multitenant-add.mdx +107 -0
- package/docs/docs/cmd/entra/multitenant/multitenant-remove.mdx +58 -0
- package/docs/docs/cmd/entra/multitenant/multitenant-set.mdx +53 -0
- package/docs/docs/cmd/outlook/message/message-get.mdx +5 -5
- package/docs/docs/cmd/planner/plan/plan-remove.mdx +1 -1
- package/docs/docs/cmd/spe/containertype/containertype-list.mdx +102 -0
- package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +11 -12
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +87 -38
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +22 -28
- package/docs/docs/cmd/spo/commandset/commandset-get.mdx +75 -24
- package/docs/docs/cmd/spo/commandset/commandset-list.mdx +26 -32
- package/docs/docs/cmd/spo/file/file-copy.mdx +119 -12
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +2 -2
- package/docs/docs/cmd/spo/folder/folder-set.mdx +0 -6
- package/docs/docs/cmd/spo/list/list-list.mdx +5 -7
- package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +15 -3
- package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +15 -3
- package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-ensure.mdx +4 -4
- package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-remove.mdx +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.mdx +9 -9
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.mdx +7 -7
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +11 -2
- package/docs/docs/cmd/spo/site/site-recyclebinitem-list.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-remove.mdx +0 -3
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx +79 -30
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +20 -19
- package/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx +84 -38
- package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +20 -19
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.mdx +2 -49
- package/docs/docs/cmd/spo/web/web-roleassignment-add.mdx +1 -1
- package/docs/docs/cmd/spo/web/web-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/teams/meeting/meeting-list.mdx +7 -3
- package/npm-shrinkwrap.json +606 -845
- package/package.json +6 -2
|
@@ -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.userName) {
|
|
34
|
+
throw `The option 'userId' or 'userName' 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.userName) {
|
|
37
|
+
throw `Both options 'userId' and 'userName' 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.userName}`;
|
|
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.userName) {
|
|
43
|
+
throw `Both options 'userId' and 'userName' 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.userName) {
|
|
46
|
+
requestUrl += `users/${args.options.userId ? args.options.userId : args.options.userName}`;
|
|
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
|
+
userName: typeof args.options.userName !== '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: '--userName [userName]'
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
84
|
export default new OutlookMessageGetCommand();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import config from '../../../../config.js';
|
|
2
|
+
import request from '../../../../request.js';
|
|
3
|
+
import { spo } from '../../../../utils/spo.js';
|
|
4
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
5
|
+
import commands from '../../commands.js';
|
|
6
|
+
class SpeContainertypeListCommand extends SpoCommand {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands.CONTAINERTYPE_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Lists all Container Types';
|
|
12
|
+
}
|
|
13
|
+
defaultProperties() {
|
|
14
|
+
return ['ContainerTypeId', 'DisplayName', 'OwningAppId'];
|
|
15
|
+
}
|
|
16
|
+
async commandAction(logger) {
|
|
17
|
+
try {
|
|
18
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
19
|
+
if (this.verbose) {
|
|
20
|
+
await logger.logToStderr(`Retrieving list of Container types...`);
|
|
21
|
+
}
|
|
22
|
+
const allContainerTypes = await this.getAllContainerTypes(spoAdminUrl, logger);
|
|
23
|
+
await logger.log(allContainerTypes);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
this.handleRejectedPromise(err);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async getAllContainerTypes(spoAdminUrl, logger) {
|
|
30
|
+
const formDigestInfo = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
|
|
31
|
+
const requestOptions = {
|
|
32
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
33
|
+
headers: {
|
|
34
|
+
'X-RequestDigest': formDigestInfo.FormDigestValue
|
|
35
|
+
},
|
|
36
|
+
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="46" ObjectPathId="45" /><Method Name="GetSPOContainerTypes" Id="47" ObjectPathId="45"><Parameters><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="45" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
37
|
+
};
|
|
38
|
+
const res = await request.post(requestOptions);
|
|
39
|
+
const json = JSON.parse(res);
|
|
40
|
+
const response = json[0];
|
|
41
|
+
if (response.ErrorInfo) {
|
|
42
|
+
throw response.ErrorInfo.ErrorMessage;
|
|
43
|
+
}
|
|
44
|
+
const containerTypes = json[json.length - 1];
|
|
45
|
+
return containerTypes;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export default new SpeContainertypeListCommand();
|
|
49
|
+
//# sourceMappingURL=containertype-list.js.map
|
|
@@ -33,9 +33,6 @@ 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
|
-
}
|
|
39
36
|
const solutionPackageJsonFile = path.join(this.projectRootPath, 'package.json');
|
|
40
37
|
const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
|
|
41
38
|
const solutionName = JSON.parse(packageJson).name;
|
|
@@ -81,9 +78,6 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
|
81
78
|
if (options.skipFeatureDeployment) {
|
|
82
79
|
this.getDeployAction(workflow).with.SKIP_FEATURE_DEPLOYMENT = true;
|
|
83
80
|
}
|
|
84
|
-
if (options.overwrite) {
|
|
85
|
-
this.getDeployAction(workflow).with.OVERWRITE = true;
|
|
86
|
-
}
|
|
87
81
|
if (options.loginMethod === 'user') {
|
|
88
82
|
const loginAction = this.getLoginAction(workflow);
|
|
89
83
|
loginAction.with = {
|
|
@@ -125,8 +119,7 @@ _a = SpfxProjectGithubWorkflowAddCommand, _SpfxProjectGithubWorkflowAddCommand_i
|
|
|
125
119
|
manuallyTrigger: !!args.options.manuallyTrigger,
|
|
126
120
|
loginMethod: typeof args.options.loginMethod !== 'undefined',
|
|
127
121
|
scope: typeof args.options.scope !== 'undefined',
|
|
128
|
-
skipFeatureDeployment: !!args.options.skipFeatureDeployment
|
|
129
|
-
overwrite: !!args.options.overwrite
|
|
122
|
+
skipFeatureDeployment: !!args.options.skipFeatureDeployment
|
|
130
123
|
});
|
|
131
124
|
});
|
|
132
125
|
}, _SpfxProjectGithubWorkflowAddCommand_initOptions = function _SpfxProjectGithubWorkflowAddCommand_initOptions() {
|
|
@@ -146,8 +139,6 @@ _a = SpfxProjectGithubWorkflowAddCommand, _SpfxProjectGithubWorkflowAddCommand_i
|
|
|
146
139
|
option: '-u, --siteUrl [siteUrl]'
|
|
147
140
|
}, {
|
|
148
141
|
option: '--skipFeatureDeployment'
|
|
149
|
-
}, {
|
|
150
|
-
option: '--overwrite'
|
|
151
142
|
});
|
|
152
143
|
}, _SpfxProjectGithubWorkflowAddCommand_initValidators = function _SpfxProjectGithubWorkflowAddCommand_initValidators() {
|
|
153
144
|
this.validators.push(async (args) => {
|
|
@@ -3,7 +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 _SpoApplicationCustomizerGetCommand_instances, _SpoApplicationCustomizerGetCommand_initTelemetry, _SpoApplicationCustomizerGetCommand_initOptions, _SpoApplicationCustomizerGetCommand_initValidators, _SpoApplicationCustomizerGetCommand_initOptionSets;
|
|
6
|
+
var _SpoApplicationCustomizerGetCommand_instances, _SpoApplicationCustomizerGetCommand_initTelemetry, _SpoApplicationCustomizerGetCommand_initOptions, _SpoApplicationCustomizerGetCommand_initValidators, _SpoApplicationCustomizerGetCommand_initOptionSets, _SpoApplicationCustomizerGetCommand_initTypes;
|
|
7
7
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
8
|
import { spo } from '../../../../utils/spo.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -25,33 +25,22 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
|
|
|
25
25
|
__classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initOptions).call(this);
|
|
26
26
|
__classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initValidators).call(this);
|
|
27
27
|
__classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initOptionSets).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initTypes).call(this);
|
|
28
29
|
}
|
|
29
30
|
async commandAction(logger, args) {
|
|
30
31
|
try {
|
|
31
32
|
const customAction = await this.getCustomAction(args.options);
|
|
32
|
-
if (
|
|
33
|
+
if (!args.options.clientSideComponentProperties) {
|
|
33
34
|
await logger.log({
|
|
34
|
-
|
|
35
|
-
ClientSideComponentProperties: customAction.ClientSideComponentProperties,
|
|
36
|
-
CommandUIExtension: customAction.CommandUIExtension,
|
|
37
|
-
Description: customAction.Description,
|
|
38
|
-
Group: customAction.Group,
|
|
39
|
-
Id: customAction.Id,
|
|
40
|
-
ImageUrl: customAction.ImageUrl,
|
|
41
|
-
Location: customAction.Location,
|
|
42
|
-
Name: customAction.Name,
|
|
43
|
-
RegistrationId: customAction.RegistrationId,
|
|
44
|
-
RegistrationType: customAction.RegistrationType,
|
|
35
|
+
...customAction,
|
|
45
36
|
Rights: JSON.stringify(customAction.Rights),
|
|
46
|
-
Scope: this.humanizeScope(customAction.Scope)
|
|
47
|
-
ScriptBlock: customAction.ScriptBlock,
|
|
48
|
-
ScriptSrc: customAction.ScriptSrc,
|
|
49
|
-
Sequence: customAction.Sequence,
|
|
50
|
-
Title: customAction.Title,
|
|
51
|
-
Url: customAction.Url,
|
|
52
|
-
VersionOfUserCustomAction: customAction.VersionOfUserCustomAction
|
|
37
|
+
Scope: this.humanizeScope(customAction.Scope)
|
|
53
38
|
});
|
|
54
39
|
}
|
|
40
|
+
else {
|
|
41
|
+
const properties = formatting.tryParseJson(customAction.ClientSideComponentProperties);
|
|
42
|
+
await logger.log(properties);
|
|
43
|
+
}
|
|
55
44
|
}
|
|
56
45
|
catch (err) {
|
|
57
46
|
this.handleRejectedPromise(err);
|
|
@@ -95,7 +84,8 @@ _SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCu
|
|
|
95
84
|
title: typeof args.options.title !== 'undefined',
|
|
96
85
|
id: typeof args.options.id !== 'undefined',
|
|
97
86
|
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
98
|
-
scope: typeof args.options.scope !== 'undefined'
|
|
87
|
+
scope: typeof args.options.scope !== 'undefined',
|
|
88
|
+
clientSideComponentProperties: !!args.options.clientSideComponentProperties
|
|
99
89
|
});
|
|
100
90
|
});
|
|
101
91
|
}, _SpoApplicationCustomizerGetCommand_initOptions = function _SpoApplicationCustomizerGetCommand_initOptions() {
|
|
@@ -110,6 +100,8 @@ _SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCu
|
|
|
110
100
|
}, {
|
|
111
101
|
option: '-s, --scope [scope]',
|
|
112
102
|
autocomplete: this.allowedScopes
|
|
103
|
+
}, {
|
|
104
|
+
option: '-p, --clientSideComponentProperties'
|
|
113
105
|
});
|
|
114
106
|
}, _SpoApplicationCustomizerGetCommand_initValidators = function _SpoApplicationCustomizerGetCommand_initValidators() {
|
|
115
107
|
this.validators.push(async (args) => {
|
|
@@ -126,6 +118,9 @@ _SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCu
|
|
|
126
118
|
});
|
|
127
119
|
}, _SpoApplicationCustomizerGetCommand_initOptionSets = function _SpoApplicationCustomizerGetCommand_initOptionSets() {
|
|
128
120
|
this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
|
|
121
|
+
}, _SpoApplicationCustomizerGetCommand_initTypes = function _SpoApplicationCustomizerGetCommand_initTypes() {
|
|
122
|
+
this.types.string.push('webUrl', 'title', 'id', 'clientSideComponentId', 'scope');
|
|
123
|
+
this.types.boolean.push('clientSideComponentProperties');
|
|
129
124
|
};
|
|
130
125
|
export default new SpoApplicationCustomizerGetCommand();
|
|
131
126
|
//# sourceMappingURL=applicationcustomizer-get.js.map
|
|
@@ -3,7 +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 _SpoCommandSetGetCommand_instances, _a, _SpoCommandSetGetCommand_initTelemetry, _SpoCommandSetGetCommand_initOptions, _SpoCommandSetGetCommand_initValidators, _SpoCommandSetGetCommand_initOptionSets;
|
|
6
|
+
var _SpoCommandSetGetCommand_instances, _a, _SpoCommandSetGetCommand_initTelemetry, _SpoCommandSetGetCommand_initOptions, _SpoCommandSetGetCommand_initValidators, _SpoCommandSetGetCommand_initOptionSets, _SpoCommandSetGetCommand_initTypes;
|
|
7
7
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
8
|
import { spo } from '../../../../utils/spo.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -24,45 +24,53 @@ class SpoCommandSetGetCommand extends SpoCommand {
|
|
|
24
24
|
__classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initOptions).call(this);
|
|
25
25
|
__classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initValidators).call(this);
|
|
26
26
|
__classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initOptionSets).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initTypes).call(this);
|
|
27
28
|
}
|
|
28
29
|
async commandAction(logger, args) {
|
|
29
30
|
try {
|
|
30
31
|
if (this.verbose) {
|
|
31
|
-
await logger.logToStderr(`Attempt to get a specific
|
|
32
|
+
await logger.logToStderr(`Attempt to get a specific Command Set by property ${args.options.title || args.options.id || args.options.clientSideComponentId}.`);
|
|
32
33
|
}
|
|
34
|
+
let commandSet;
|
|
33
35
|
if (args.options.id) {
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
+
const customAction = await spo.getCustomActionById(args.options.webUrl, args.options.id, args.options.scope);
|
|
37
|
+
if (customAction === undefined) {
|
|
36
38
|
throw `Command set with id ${args.options.id} can't be found.`;
|
|
37
39
|
}
|
|
38
|
-
else if (!_a.allowedCommandSetLocations.some(allowedLocation => allowedLocation ===
|
|
40
|
+
else if (!_a.allowedCommandSetLocations.some(allowedLocation => allowedLocation === customAction.Location)) {
|
|
39
41
|
throw `Custom action with id ${args.options.id} is not a command set.`;
|
|
40
42
|
}
|
|
41
|
-
|
|
43
|
+
commandSet = customAction;
|
|
42
44
|
}
|
|
43
45
|
else if (args.options.clientSideComponentId) {
|
|
44
46
|
const filter = `${this.getBaseFilter()} ClientSideComponentId eq guid'${args.options.clientSideComponentId}'`;
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
+
const customActions = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
|
|
48
|
+
if (customActions.length === 0) {
|
|
47
49
|
throw `No command set with clientSideComponentId '${args.options.clientSideComponentId}' found.`;
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
commandSet = customActions[0];
|
|
50
52
|
}
|
|
51
53
|
else if (args.options.title) {
|
|
52
54
|
const filter = `${this.getBaseFilter()} Title eq '${formatting.encodeQueryParameter(args.options.title)}'`;
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
|
|
55
|
+
const customActions = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
|
|
56
|
+
if (customActions.length === 1) {
|
|
57
|
+
commandSet = customActions[0];
|
|
56
58
|
}
|
|
57
|
-
else if (
|
|
59
|
+
else if (customActions.length === 0) {
|
|
58
60
|
throw `No command set with title '${args.options.title}' found.`;
|
|
59
61
|
}
|
|
60
62
|
else {
|
|
61
|
-
const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id',
|
|
62
|
-
|
|
63
|
-
await logger.log(commandSet);
|
|
63
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', customActions);
|
|
64
|
+
commandSet = await cli.handleMultipleResultsFound(`Multiple command sets with title '${args.options.title}' found.`, resultAsKeyValuePair);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
67
|
+
if (!args.options.clientSideComponentProperties) {
|
|
68
|
+
await logger.log(commandSet);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const properties = formatting.tryParseJson(commandSet.ClientSideComponentProperties);
|
|
72
|
+
await logger.log(properties);
|
|
73
|
+
}
|
|
66
74
|
}
|
|
67
75
|
catch (err) {
|
|
68
76
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -78,7 +86,8 @@ _a = SpoCommandSetGetCommand, _SpoCommandSetGetCommand_instances = new WeakSet()
|
|
|
78
86
|
title: typeof args.options.title !== 'undefined',
|
|
79
87
|
id: typeof args.options.id !== 'undefined',
|
|
80
88
|
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
81
|
-
scope: typeof args.options.scope !== 'undefined'
|
|
89
|
+
scope: typeof args.options.scope !== 'undefined',
|
|
90
|
+
clientSideComponentProperties: !!args.options.clientSideComponentProperties
|
|
82
91
|
});
|
|
83
92
|
});
|
|
84
93
|
}, _SpoCommandSetGetCommand_initOptions = function _SpoCommandSetGetCommand_initOptions() {
|
|
@@ -93,6 +102,8 @@ _a = SpoCommandSetGetCommand, _SpoCommandSetGetCommand_instances = new WeakSet()
|
|
|
93
102
|
}, {
|
|
94
103
|
option: '-s, --scope [scope]',
|
|
95
104
|
autocomplete: _a.scopes
|
|
105
|
+
}, {
|
|
106
|
+
option: '-p, --clientSideComponentProperties'
|
|
96
107
|
});
|
|
97
108
|
}, _SpoCommandSetGetCommand_initValidators = function _SpoCommandSetGetCommand_initValidators() {
|
|
98
109
|
this.validators.push(async (args) => {
|
|
@@ -109,6 +120,9 @@ _a = SpoCommandSetGetCommand, _SpoCommandSetGetCommand_instances = new WeakSet()
|
|
|
109
120
|
});
|
|
110
121
|
}, _SpoCommandSetGetCommand_initOptionSets = function _SpoCommandSetGetCommand_initOptionSets() {
|
|
111
122
|
this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
|
|
123
|
+
}, _SpoCommandSetGetCommand_initTypes = function _SpoCommandSetGetCommand_initTypes() {
|
|
124
|
+
this.types.string.push('webUrl', 'title', 'id', 'clientSideComponentId', 'scope');
|
|
125
|
+
this.types.boolean.push('clientSideComponentProperties');
|
|
112
126
|
};
|
|
113
127
|
SpoCommandSetGetCommand.scopes = ['All', 'Site', 'Web'];
|
|
114
128
|
SpoCommandSetGetCommand.baseLocation = 'ClientSideExtension.ListViewCommandSet';
|
|
@@ -5,6 +5,7 @@ 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';
|
|
8
9
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
9
10
|
import { validation } from '../../../../utils/validation.js';
|
|
10
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
@@ -30,39 +31,43 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
30
31
|
try {
|
|
31
32
|
const sourceServerRelativePath = await this.getSourcePath(logger, args.options);
|
|
32
33
|
const sourcePath = this.getAbsoluteUrl(args.options.webUrl, sourceServerRelativePath);
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
|
|
34
|
+
const destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl);
|
|
35
|
+
if (this.verbose) {
|
|
36
|
+
await logger.logToStderr(`Copying file '${sourceServerRelativePath}' to '${args.options.targetUrl}'...`);
|
|
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('.'));
|
|
36
42
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
const copyJobResponse = await spo.createCopyJob(args.options.webUrl, sourcePath, destinationPath, {
|
|
44
|
+
nameConflictBehavior: this.getNameConflictBehaviorValue(args.options.nameConflictBehavior),
|
|
45
|
+
bypassSharedLock: !!args.options.bypassSharedLock,
|
|
46
|
+
ignoreVersionHistory: !!args.options.ignoreVersionHistory,
|
|
47
|
+
newName: newName
|
|
48
|
+
});
|
|
49
|
+
if (args.options.skipWait) {
|
|
50
|
+
return;
|
|
40
51
|
}
|
|
41
52
|
if (this.verbose) {
|
|
42
|
-
await logger.logToStderr(
|
|
53
|
+
await logger.logToStderr('Waiting for the copy job to complete...');
|
|
43
54
|
}
|
|
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()));
|
|
44
62
|
const requestOptions = {
|
|
45
|
-
url: `${
|
|
63
|
+
url: `${absoluteWebUrl}/_api/Web/GetFileById('${copyJobResult.TargetObjectUniqueId}')`,
|
|
46
64
|
headers: {
|
|
47
65
|
accept: 'application/json;odata=nometadata'
|
|
48
66
|
},
|
|
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
|
-
}
|
|
67
|
+
responseType: 'json'
|
|
64
68
|
};
|
|
65
|
-
await request.
|
|
69
|
+
const destinationFile = await request.get(requestOptions);
|
|
70
|
+
await logger.log(destinationFile);
|
|
66
71
|
}
|
|
67
72
|
catch (err) {
|
|
68
73
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -76,17 +81,30 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
76
81
|
await logger.logToStderr(`Retrieving server-relative path for file with ID '${options.sourceId}'...`);
|
|
77
82
|
}
|
|
78
83
|
const requestOptions = {
|
|
79
|
-
url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')
|
|
84
|
+
url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')/ServerRelativePath`,
|
|
80
85
|
headers: {
|
|
81
86
|
accept: 'application/json;odata=nometadata'
|
|
82
87
|
},
|
|
83
88
|
responseType: 'json'
|
|
84
89
|
};
|
|
85
90
|
const file = await request.get(requestOptions);
|
|
86
|
-
return file.
|
|
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
|
+
}
|
|
87
104
|
}
|
|
88
105
|
getAbsoluteUrl(webUrl, url) {
|
|
89
|
-
|
|
106
|
+
const result = url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
|
|
107
|
+
return urlUtil.removeTrailingSlashes(result);
|
|
90
108
|
}
|
|
91
109
|
}
|
|
92
110
|
_SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry = function _SpoFileCopyCommand_initTelemetry() {
|
|
@@ -95,9 +113,10 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
95
113
|
sourceUrl: typeof args.options.sourceUrl !== 'undefined',
|
|
96
114
|
sourceId: typeof args.options.sourceId !== 'undefined',
|
|
97
115
|
newName: typeof args.options.newName !== 'undefined',
|
|
98
|
-
nameConflictBehavior: args.options.nameConflictBehavior
|
|
99
|
-
|
|
100
|
-
bypassSharedLock: !!args.options.bypassSharedLock
|
|
116
|
+
nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined',
|
|
117
|
+
ignoreVersionHistory: !!args.options.ignoreVersionHistory,
|
|
118
|
+
bypassSharedLock: !!args.options.bypassSharedLock,
|
|
119
|
+
skipWait: !!args.options.skipWait
|
|
101
120
|
});
|
|
102
121
|
});
|
|
103
122
|
}, _SpoFileCopyCommand_initOptions = function _SpoFileCopyCommand_initOptions() {
|
|
@@ -114,10 +133,12 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
114
133
|
}, {
|
|
115
134
|
option: '--nameConflictBehavior [nameConflictBehavior]',
|
|
116
135
|
autocomplete: this.nameConflictBehaviorOptions
|
|
117
|
-
}, {
|
|
118
|
-
option: '--resetAuthorAndCreated'
|
|
119
136
|
}, {
|
|
120
137
|
option: '--bypassSharedLock'
|
|
138
|
+
}, {
|
|
139
|
+
option: '--ignoreVersionHistory'
|
|
140
|
+
}, {
|
|
141
|
+
option: '--skipWait'
|
|
121
142
|
});
|
|
122
143
|
}, _SpoFileCopyCommand_initValidators = function _SpoFileCopyCommand_initValidators() {
|
|
123
144
|
this.validators.push(async (args) => {
|
|
@@ -128,7 +149,7 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
128
149
|
if (args.options.sourceId && !validation.isValidGuid(args.options.sourceId)) {
|
|
129
150
|
return `${args.options.sourceId} is not a valid GUID for sourceId.`;
|
|
130
151
|
}
|
|
131
|
-
if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.
|
|
152
|
+
if (args.options.nameConflictBehavior && !this.nameConflictBehaviorOptions.includes(args.options.nameConflictBehavior.toLowerCase())) {
|
|
132
153
|
return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}.`;
|
|
133
154
|
}
|
|
134
155
|
return true;
|
|
@@ -137,7 +158,7 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
137
158
|
this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
|
|
138
159
|
}, _SpoFileCopyCommand_initTypes = function _SpoFileCopyCommand_initTypes() {
|
|
139
160
|
this.types.string.push('webUrl', 'sourceUrl', 'sourceId', 'targetUrl', 'newName', 'nameConflictBehavior');
|
|
140
|
-
this.types.boolean.push('
|
|
161
|
+
this.types.boolean.push('bypassSharedLock', 'ignoreVersionHistory', 'skipWait');
|
|
141
162
|
};
|
|
142
163
|
export default new SpoFileCopyCommand();
|
|
143
164
|
//# sourceMappingURL=file-copy.js.map
|
|
@@ -140,7 +140,7 @@ _SpoFileRoleAssignmentAddCommand_instances = new WeakSet(), _SpoFileRoleAssignme
|
|
|
140
140
|
}, {
|
|
141
141
|
option: '--fileUrl [fileUrl]'
|
|
142
142
|
}, {
|
|
143
|
-
option: 'i, --fileId [fileId]'
|
|
143
|
+
option: '-i, --fileId [fileId]'
|
|
144
144
|
}, {
|
|
145
145
|
option: '--principalId [principalId]'
|
|
146
146
|
}, {
|
|
@@ -83,7 +83,7 @@ _SpoFolderRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoFolderReten
|
|
|
83
83
|
}, {
|
|
84
84
|
option: '--folderUrl [folderUrl]'
|
|
85
85
|
}, {
|
|
86
|
-
option: 'i, --folderId [folderId]'
|
|
86
|
+
option: '-i, --folderId [folderId]'
|
|
87
87
|
});
|
|
88
88
|
}, _SpoFolderRetentionLabelEnsureCommand_initValidators = function _SpoFolderRetentionLabelEnsureCommand_initValidators() {
|
|
89
89
|
this.validators.push(async (args) => {
|
|
@@ -18,9 +18,6 @@ class SpoFolderSetCommand extends SpoCommand {
|
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Updates a folder';
|
|
20
20
|
}
|
|
21
|
-
alias() {
|
|
22
|
-
return [commands.FOLDER_RENAME];
|
|
23
|
-
}
|
|
24
21
|
constructor() {
|
|
25
22
|
super();
|
|
26
23
|
_SpoFolderSetCommand_instances.add(this);
|
|
@@ -34,7 +31,6 @@ class SpoFolderSetCommand extends SpoCommand {
|
|
|
34
31
|
}
|
|
35
32
|
async commandAction(logger, args) {
|
|
36
33
|
try {
|
|
37
|
-
await this.showDeprecationWarning(logger, this.alias()[0], this.name);
|
|
38
34
|
if (this.verbose) {
|
|
39
35
|
await logger.logToStderr(`Updating folder '${args.options.name}'...`);
|
|
40
36
|
}
|
|
@@ -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', '
|
|
19
|
+
return ['Title', 'Id'];
|
|
20
20
|
}
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
@@ -36,9 +36,6 @@ 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
|
-
});
|
|
42
39
|
await logger.log(listInstances);
|
|
43
40
|
}
|
|
44
41
|
catch (err) {
|