@pnp/cli-microsoft365 8.0.0 → 8.1.0-beta.309a9b8
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 +50 -5
- package/dist/cli/cli.js +101 -39
- package/dist/m365/commands/login.js +49 -96
- 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-remove.js +123 -0
- package/dist/m365/entra/commands/group/group-set.js +256 -0
- package/dist/m365/entra/commands/m365group/m365group-user-add.js +109 -32
- package/dist/m365/entra/commands/m365group/m365group-user-set.js +159 -84
- 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 +6 -0
- package/dist/m365/flow/commands/flow-get.js +1 -1
- package/dist/m365/onenote/commands/notebook/notebook-add.js +132 -0
- package/dist/m365/onenote/commands.js +1 -0
- package/dist/m365/pa/commands/app/app-export.js +13 -7
- 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/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-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-sharinglink-get.js +86 -0
- package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +110 -0
- package/dist/m365/spo/commands/list/ListInstance.js +6 -1
- package/dist/m365/spo/commands/list/list-get.js +9 -3
- 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-get.js +12 -16
- 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.js +2 -0
- package/dist/m365/teams/commands/message/message-restore.js +106 -0
- package/dist/m365/teams/commands.js +1 -0
- package/dist/utils/drive.js +61 -0
- package/dist/utils/formatting.js +16 -0
- package/dist/utils/spo.js +69 -6
- package/dist/utils/zod.js +124 -0
- package/docs/docs/cmd/connection/connection-use.mdx +8 -2
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-remove.mdx +65 -0
- package/docs/docs/cmd/entra/group/group-add.mdx +0 -4
- package/docs/docs/cmd/entra/group/group-set.mdx +89 -0
- package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +28 -10
- package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +35 -11
- 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/flow/flow-get.mdx +149 -283
- package/docs/docs/cmd/onenote/notebook/notebook-add.mdx +169 -0
- package/docs/docs/cmd/pa/app/app-export.mdx +15 -9
- 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/spo/app/app-uninstall.mdx +1 -1
- 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-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-sharinglink-get.mdx +110 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +114 -0
- package/docs/docs/cmd/spo/list/list-get.mdx +6 -0
- 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-recyclebinitem-list.mdx +1 -1
- 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/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/docs/docs/cmd/teams/message/message-remove.mdx +2 -1
- package/docs/docs/cmd/teams/message/message-restore.mdx +62 -0
- package/npm-shrinkwrap.json +1003 -1148
- package/package.json +27 -24
|
@@ -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
|
|
@@ -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 _PaAppExportCommand_instances, _PaAppExportCommand_initTelemetry, _PaAppExportCommand_initOptions, _PaAppExportCommand_initValidators;
|
|
6
|
+
var _PaAppExportCommand_instances, _PaAppExportCommand_initTelemetry, _PaAppExportCommand_initOptions, _PaAppExportCommand_initValidators, _PaAppExportCommand_initTypes;
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import { setTimeout } from 'timers/promises';
|
|
@@ -26,14 +26,18 @@ class PaAppExportCommand extends PowerPlatformCommand {
|
|
|
26
26
|
__classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initTelemetry).call(this);
|
|
27
27
|
__classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initOptions).call(this);
|
|
28
28
|
__classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initValidators).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initTypes).call(this);
|
|
29
30
|
}
|
|
30
31
|
async commandAction(logger, args) {
|
|
31
32
|
try {
|
|
32
33
|
const location = await this.exportPackage(args, logger);
|
|
33
|
-
const packageLink = await this.getPackageLink(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const packageLink = await this.getPackageLink(logger, location);
|
|
35
|
+
let filename = args.options.name;
|
|
36
|
+
if (args.options.packageDisplayName) {
|
|
37
|
+
//Replace all illegal characters from the file name
|
|
38
|
+
const illegalCharsRegEx = /[\\\/:*?"<>|]/g;
|
|
39
|
+
filename = args.options.packageDisplayName.replace(illegalCharsRegEx, '_');
|
|
40
|
+
}
|
|
37
41
|
const requestOptions = {
|
|
38
42
|
url: packageLink,
|
|
39
43
|
// Set responseType to arraybuffer, otherwise binary data will be encoded
|
|
@@ -98,7 +102,7 @@ class PaAppExportCommand extends PowerPlatformCommand {
|
|
|
98
102
|
details: {
|
|
99
103
|
creator: args.options.packageCreatedBy,
|
|
100
104
|
description: args.options.packageDescription,
|
|
101
|
-
displayName: args.options.packageDisplayName,
|
|
105
|
+
displayName: args.options.packageDisplayName || args.options.name,
|
|
102
106
|
sourceEnvironment: args.options.packageSourceEnvironment
|
|
103
107
|
},
|
|
104
108
|
resources: resources
|
|
@@ -108,7 +112,7 @@ class PaAppExportCommand extends PowerPlatformCommand {
|
|
|
108
112
|
const response = await request.post(requestOptions);
|
|
109
113
|
return response.headers.location;
|
|
110
114
|
}
|
|
111
|
-
async getPackageLink(
|
|
115
|
+
async getPackageLink(logger, location) {
|
|
112
116
|
if (this.verbose) {
|
|
113
117
|
await logger.logToStderr('Retrieving the package link and waiting on the exported package.');
|
|
114
118
|
}
|
|
@@ -172,6 +176,8 @@ _PaAppExportCommand_instances = new WeakSet(), _PaAppExportCommand_initTelemetry
|
|
|
172
176
|
}
|
|
173
177
|
return true;
|
|
174
178
|
});
|
|
179
|
+
}, _PaAppExportCommand_initTypes = function _PaAppExportCommand_initTypes() {
|
|
180
|
+
this.types.string.push('name', 'environmentName', 'packageDisplayName', 'packageDescription', 'packageCreatedBy', 'packageSourceEnvironment', 'path');
|
|
175
181
|
};
|
|
176
182
|
export default new PaAppExportCommand();
|
|
177
183
|
//# sourceMappingURL=app-export.js.map
|
|
@@ -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
|
|
@@ -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';
|
|
@@ -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) => {
|
|
@@ -0,0 +1,86 @@
|
|
|
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 _SpoFolderSharingLinkGetCommand_instances, _SpoFolderSharingLinkGetCommand_initTelemetry, _SpoFolderSharingLinkGetCommand_initOptions, _SpoFolderSharingLinkGetCommand_initOptionSets, _SpoFolderSharingLinkGetCommand_initValidators, _SpoFolderSharingLinkGetCommand_initTypes;
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { spo } from '../../../../utils/spo.js';
|
|
9
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
|
+
import commands from '../../commands.js';
|
|
13
|
+
import { drive as driveItem } from '../../../../utils/drive.js';
|
|
14
|
+
class SpoFolderSharingLinkGetCommand extends SpoCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.FOLDER_SHARINGLINK_GET;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Gets details about a specific sharing link on a folder';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_SpoFolderSharingLinkGetCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initOptionSets).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initTypes).call(this);
|
|
29
|
+
}
|
|
30
|
+
async commandAction(logger, args) {
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
await logger.logToStderr(`Retrieving sharing link on folder ${args.options.folderId || args.options.folderUrl}...`);
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const relFolderUrl = await spo.getFolderServerRelativeUrl(args.options.webUrl, args.options.folderUrl, args.options.folderId);
|
|
36
|
+
const absoluteFolderUrl = urlUtil.getAbsoluteUrl(args.options.webUrl, relFolderUrl);
|
|
37
|
+
const folderUrl = new URL(absoluteFolderUrl);
|
|
38
|
+
const siteId = await spo.getSiteId(args.options.webUrl);
|
|
39
|
+
const drive = await driveItem.getDriveByUrl(siteId, folderUrl);
|
|
40
|
+
const itemId = await driveItem.getDriveItemId(drive, folderUrl);
|
|
41
|
+
const requestUrl = `https://graph.microsoft.com/v1.0/drives/${drive.id}/items/${itemId}/permissions/${args.options.id}`;
|
|
42
|
+
const requestOptions = {
|
|
43
|
+
url: requestUrl,
|
|
44
|
+
headers: {
|
|
45
|
+
'accept': 'application/json;odata.metadata=none'
|
|
46
|
+
},
|
|
47
|
+
responseType: 'json'
|
|
48
|
+
};
|
|
49
|
+
const permission = await request.get(requestOptions);
|
|
50
|
+
await logger.log(permission);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
this.handleRejectedODataJsonPromise(err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_SpoFolderSharingLinkGetCommand_instances = new WeakSet(), _SpoFolderSharingLinkGetCommand_initTelemetry = function _SpoFolderSharingLinkGetCommand_initTelemetry() {
|
|
58
|
+
this.telemetry.push((args) => {
|
|
59
|
+
Object.assign(this.telemetryProperties, {
|
|
60
|
+
folderUrl: typeof args.options.folderUrl !== 'undefined',
|
|
61
|
+
folderId: typeof args.options.folderId !== 'undefined'
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}, _SpoFolderSharingLinkGetCommand_initOptions = function _SpoFolderSharingLinkGetCommand_initOptions() {
|
|
65
|
+
this.options.unshift({ option: '-u, --webUrl <webUrl>' }, { option: '--folderUrl [folderUrl]' }, { option: '--folderId [folderId]' }, { option: '-i, --id <id>' });
|
|
66
|
+
}, _SpoFolderSharingLinkGetCommand_initOptionSets = function _SpoFolderSharingLinkGetCommand_initOptionSets() {
|
|
67
|
+
this.optionSets.push({ options: ['folderUrl', 'folderId'] });
|
|
68
|
+
}, _SpoFolderSharingLinkGetCommand_initValidators = function _SpoFolderSharingLinkGetCommand_initValidators() {
|
|
69
|
+
this.validators.push(async (args) => {
|
|
70
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
71
|
+
if (isValidSharePointUrl !== true) {
|
|
72
|
+
return isValidSharePointUrl;
|
|
73
|
+
}
|
|
74
|
+
if (args.options.folderId && !validation.isValidGuid(args.options.folderId)) {
|
|
75
|
+
return `${args.options.folderId} is not a valid GUID for option 'folderId'.`;
|
|
76
|
+
}
|
|
77
|
+
if (!validation.isValidGuid(args.options.id)) {
|
|
78
|
+
return `${args.options.id} is not a valid GUID for option 'id'.`;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
});
|
|
82
|
+
}, _SpoFolderSharingLinkGetCommand_initTypes = function _SpoFolderSharingLinkGetCommand_initTypes() {
|
|
83
|
+
this.types.string.push('webUrl', 'folderUrl', 'folderId', 'id');
|
|
84
|
+
};
|
|
85
|
+
export default new SpoFolderSharingLinkGetCommand();
|
|
86
|
+
//# sourceMappingURL=folder-sharinglink-get.js.map
|