@pnp/cli-microsoft365 11.9.0-beta.7b34e40 → 11.9.0-beta.93bd508
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devproxy/api-specs/sharepoint.yaml +82 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/m365/cli/commands/app/app-reconsent.js +8 -0
- package/dist/m365/cli/commands/cli-consent.js +8 -31
- package/dist/m365/cli/commands/cli-doctor.js +6 -1
- package/dist/m365/cli/commands/cli-issue.js +8 -36
- package/dist/m365/cli/commands/completion/completion-clink-update.js +8 -0
- package/dist/m365/cli/commands/completion/completion-pwsh-setup.js +8 -16
- package/dist/m365/cli/commands/completion/completion-pwsh-update.js +8 -0
- package/dist/m365/cli/commands/completion/completion-sh-setup.js +8 -0
- package/dist/m365/cli/commands/completion/completion-sh-update.js +8 -0
- package/dist/m365/cli/commands/config/config-get.js +9 -32
- package/dist/m365/cli/commands/config/config-list.js +8 -0
- package/dist/m365/cli/commands/config/config-reset.js +9 -34
- package/dist/m365/cli/commands/config/config-set.js +86 -70
- package/dist/m365/commands/request.js +26 -60
- package/dist/m365/commands/search.js +59 -77
- package/dist/m365/commands/setup.js +16 -31
- package/dist/m365/commands/version.js +6 -0
- package/dist/m365/connection/commands/connection-remove.js +9 -29
- package/dist/m365/connection/commands/connection-use.js +8 -26
- package/dist/m365/context/commands/context-init.js +6 -0
- package/dist/m365/context/commands/option/option-set.js +9 -18
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-add.js +32 -63
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-get.js +21 -45
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-list.js +32 -53
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-remove.js +34 -74
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-roleassignment-add.js +37 -57
- package/dist/m365/entra/commands/multitenant/multitenant-get.js +8 -1
- package/dist/m365/entra/commands/multitenant/multitenant-remove.js +8 -22
- package/dist/m365/entra/commands/multitenant/multitenant-set.js +15 -36
- package/dist/m365/entra/commands/oauth2grant/oauth2grant-add.js +10 -31
- package/dist/m365/entra/commands/oauth2grant/oauth2grant-list.js +8 -24
- package/dist/m365/entra/commands/oauth2grant/oauth2grant-remove.js +9 -17
- package/dist/m365/entra/commands/oauth2grant/oauth2grant-set.js +9 -17
- package/dist/m365/spe/commands/container/container-permission-list.js +43 -4
- package/dist/m365/spo/commands/file/file-unarchive.js +83 -0
- package/dist/m365/spo/commands/folder/folder-archive.js +89 -0
- package/dist/m365/spo/commands.js +2 -0
- package/dist/m365/viva/commands/engage/engage-role-member-add.js +79 -0
- package/dist/m365/viva/commands.js +1 -0
- package/docs/docs/cmd/spe/container/container-get.mdx +13 -1
- package/docs/docs/cmd/spe/container/container-permission-list.mdx +24 -3
- package/docs/docs/cmd/spo/app/app-add.mdx +19 -0
- package/docs/docs/cmd/spo/app/app-deploy.mdx +21 -0
- package/docs/docs/cmd/spo/app/app-get.mdx +19 -0
- package/docs/docs/cmd/spo/app/app-install.mdx +21 -0
- package/docs/docs/cmd/spo/app/app-instance-list.mdx +19 -0
- package/docs/docs/cmd/spo/app/app-list.mdx +19 -0
- package/docs/docs/cmd/spo/app/app-remove.mdx +21 -0
- package/docs/docs/cmd/spo/app/app-retract.mdx +21 -0
- package/docs/docs/cmd/spo/app/app-teamspackage-download.mdx +21 -0
- package/docs/docs/cmd/spo/app/app-uninstall.mdx +21 -0
- package/docs/docs/cmd/spo/app/app-upgrade.mdx +21 -0
- package/docs/docs/cmd/spo/apppage/apppage-add.mdx +19 -1
- package/docs/docs/cmd/spo/apppage/apppage-set.mdx +21 -0
- package/docs/docs/cmd/spo/commandset/commandset-add.mdx +19 -0
- package/docs/docs/cmd/spo/commandset/commandset-get.mdx +19 -0
- package/docs/docs/cmd/spo/commandset/commandset-list.mdx +19 -0
- package/docs/docs/cmd/spo/commandset/commandset-remove.mdx +21 -0
- package/docs/docs/cmd/spo/commandset/commandset-set.mdx +21 -0
- package/docs/docs/cmd/spo/file/file-unarchive.mdx +68 -0
- package/docs/docs/cmd/spo/folder/folder-archive.mdx +73 -0
- package/docs/docs/cmd/viva/engage/engage-role-member-add.mdx +76 -0
- package/npm-shrinkwrap.json +273 -128
- package/package.json +18 -18
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _EntraMultitenantSetCommand_instances, _EntraMultitenantSetCommand_initTelemetry, _EntraMultitenantSetCommand_initOptions, _EntraMultitenantSetCommand_initValidators, _EntraMultitenantSetCommand_initTypes;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
4
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
9
5
|
import commands from '../../commands.js';
|
|
6
|
+
export const options = globalOptionsZod
|
|
7
|
+
.extend({
|
|
8
|
+
displayName: z.string().optional().alias('n'),
|
|
9
|
+
description: z.string().optional().alias('d')
|
|
10
|
+
}).strict();
|
|
10
11
|
class EntraMultitenantSetCommand extends GraphCommand {
|
|
11
12
|
get name() {
|
|
12
13
|
return commands.MULTITENANT_SET;
|
|
@@ -14,13 +15,14 @@ class EntraMultitenantSetCommand extends GraphCommand {
|
|
|
14
15
|
get description() {
|
|
15
16
|
return 'Updates the properties of a multitenant organization';
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
get schema() {
|
|
19
|
+
return options;
|
|
20
|
+
}
|
|
21
|
+
getRefinedSchema(schema) {
|
|
22
|
+
return schema
|
|
23
|
+
.refine(options => options.displayName || options.description, {
|
|
24
|
+
error: 'Specify either displayName or description or both'
|
|
25
|
+
});
|
|
24
26
|
}
|
|
25
27
|
async commandAction(logger, args) {
|
|
26
28
|
if (this.verbose) {
|
|
@@ -45,28 +47,5 @@ class EntraMultitenantSetCommand extends GraphCommand {
|
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
_EntraMultitenantSetCommand_instances = new WeakSet(), _EntraMultitenantSetCommand_initTelemetry = function _EntraMultitenantSetCommand_initTelemetry() {
|
|
49
|
-
this.telemetry.push((args) => {
|
|
50
|
-
Object.assign(this.telemetryProperties, {
|
|
51
|
-
displayName: typeof args.options.displayName !== 'undefined',
|
|
52
|
-
description: typeof args.options.description !== 'undefined'
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}, _EntraMultitenantSetCommand_initOptions = function _EntraMultitenantSetCommand_initOptions() {
|
|
56
|
-
this.options.unshift({
|
|
57
|
-
option: '-n, --displayName [displayName]'
|
|
58
|
-
}, {
|
|
59
|
-
option: '-d, --description [description]'
|
|
60
|
-
});
|
|
61
|
-
}, _EntraMultitenantSetCommand_initValidators = function _EntraMultitenantSetCommand_initValidators() {
|
|
62
|
-
this.validators.push(async (args) => {
|
|
63
|
-
if (!args.options.displayName && !args.options.description) {
|
|
64
|
-
return 'Specify either displayName or description or both.';
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
});
|
|
68
|
-
}, _EntraMultitenantSetCommand_initTypes = function _EntraMultitenantSetCommand_initTypes() {
|
|
69
|
-
this.types.string.push('displayName', 'description');
|
|
70
|
-
};
|
|
71
50
|
export default new EntraMultitenantSetCommand();
|
|
72
51
|
//# sourceMappingURL=multitenant-set.js.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _EntraOAuth2GrantAddCommand_instances, _EntraOAuth2GrantAddCommand_initOptions, _EntraOAuth2GrantAddCommand_initValidators;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
|
-
import { validation } from '../../../../utils/validation.js';
|
|
9
4
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
5
|
import commands from '../../commands.js';
|
|
6
|
+
export const options = globalOptionsZod
|
|
7
|
+
.extend({
|
|
8
|
+
clientId: z.uuid().alias('i'),
|
|
9
|
+
resourceId: z.uuid().alias('r'),
|
|
10
|
+
scope: z.string().alias('s')
|
|
11
|
+
}).strict();
|
|
11
12
|
class EntraOAuth2GrantAddCommand extends GraphCommand {
|
|
12
13
|
get name() {
|
|
13
14
|
return commands.OAUTH2GRANT_ADD;
|
|
@@ -15,11 +16,8 @@ class EntraOAuth2GrantAddCommand extends GraphCommand {
|
|
|
15
16
|
get description() {
|
|
16
17
|
return 'Grant the specified service principal OAuth2 permissions to the specified resource';
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_EntraOAuth2GrantAddCommand_instances.add(this);
|
|
21
|
-
__classPrivateFieldGet(this, _EntraOAuth2GrantAddCommand_instances, "m", _EntraOAuth2GrantAddCommand_initOptions).call(this);
|
|
22
|
-
__classPrivateFieldGet(this, _EntraOAuth2GrantAddCommand_instances, "m", _EntraOAuth2GrantAddCommand_initValidators).call(this);
|
|
19
|
+
get schema() {
|
|
20
|
+
return options;
|
|
23
21
|
}
|
|
24
22
|
async commandAction(logger, args) {
|
|
25
23
|
if (this.verbose) {
|
|
@@ -47,24 +45,5 @@ class EntraOAuth2GrantAddCommand extends GraphCommand {
|
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
|
-
_EntraOAuth2GrantAddCommand_instances = new WeakSet(), _EntraOAuth2GrantAddCommand_initOptions = function _EntraOAuth2GrantAddCommand_initOptions() {
|
|
51
|
-
this.options.unshift({
|
|
52
|
-
option: '-i, --clientId <clientId>'
|
|
53
|
-
}, {
|
|
54
|
-
option: '-r, --resourceId <resourceId>'
|
|
55
|
-
}, {
|
|
56
|
-
option: '-s, --scope <scope>'
|
|
57
|
-
});
|
|
58
|
-
}, _EntraOAuth2GrantAddCommand_initValidators = function _EntraOAuth2GrantAddCommand_initValidators() {
|
|
59
|
-
this.validators.push(async (args) => {
|
|
60
|
-
if (!validation.isValidGuid(args.options.clientId)) {
|
|
61
|
-
return `${args.options.clientId} is not a valid GUID`;
|
|
62
|
-
}
|
|
63
|
-
if (!validation.isValidGuid(args.options.resourceId)) {
|
|
64
|
-
return `${args.options.resourceId} is not a valid GUID`;
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
48
|
export default new EntraOAuth2GrantAddCommand();
|
|
70
49
|
//# sourceMappingURL=oauth2grant-add.js.map
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _EntraOAuth2GrantListCommand_instances, _EntraOAuth2GrantListCommand_initOptions, _EntraOAuth2GrantListCommand_initValidators;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
4
|
import { odata } from '../../../../utils/odata.js';
|
|
9
|
-
import { validation } from '../../../../utils/validation.js';
|
|
10
5
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
6
|
import commands from '../../commands.js';
|
|
7
|
+
export const options = globalOptionsZod
|
|
8
|
+
.extend({
|
|
9
|
+
spObjectId: z.uuid().alias('i')
|
|
10
|
+
}).strict();
|
|
12
11
|
class EntraOAuth2GrantListCommand extends GraphCommand {
|
|
13
12
|
get name() {
|
|
14
13
|
return commands.OAUTH2GRANT_LIST;
|
|
@@ -19,11 +18,8 @@ class EntraOAuth2GrantListCommand extends GraphCommand {
|
|
|
19
18
|
defaultProperties() {
|
|
20
19
|
return ['objectId', 'resourceId', 'scope'];
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_EntraOAuth2GrantListCommand_instances.add(this);
|
|
25
|
-
__classPrivateFieldGet(this, _EntraOAuth2GrantListCommand_instances, "m", _EntraOAuth2GrantListCommand_initOptions).call(this);
|
|
26
|
-
__classPrivateFieldGet(this, _EntraOAuth2GrantListCommand_instances, "m", _EntraOAuth2GrantListCommand_initValidators).call(this);
|
|
21
|
+
get schema() {
|
|
22
|
+
return options;
|
|
27
23
|
}
|
|
28
24
|
async commandAction(logger, args) {
|
|
29
25
|
if (this.verbose) {
|
|
@@ -38,17 +34,5 @@ class EntraOAuth2GrantListCommand extends GraphCommand {
|
|
|
38
34
|
}
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
|
-
_EntraOAuth2GrantListCommand_instances = new WeakSet(), _EntraOAuth2GrantListCommand_initOptions = function _EntraOAuth2GrantListCommand_initOptions() {
|
|
42
|
-
this.options.unshift({
|
|
43
|
-
option: '-i, --spObjectId <spObjectId>'
|
|
44
|
-
});
|
|
45
|
-
}, _EntraOAuth2GrantListCommand_initValidators = function _EntraOAuth2GrantListCommand_initValidators() {
|
|
46
|
-
this.validators.push(async (args) => {
|
|
47
|
-
if (!validation.isValidGuid(args.options.spObjectId)) {
|
|
48
|
-
return `${args.options.spObjectId} is not a valid GUID`;
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
37
|
export default new EntraOAuth2GrantListCommand();
|
|
54
38
|
//# sourceMappingURL=oauth2grant-list.js.map
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _EntraOAuth2GrantRemoveCommand_instances, _EntraOAuth2GrantRemoveCommand_initOptions;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import { cli } from '../../../../cli/cli.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
6
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
7
|
import commands from '../../commands.js';
|
|
8
|
+
export const options = globalOptionsZod
|
|
9
|
+
.extend({
|
|
10
|
+
grantId: z.string().alias('i'),
|
|
11
|
+
force: z.boolean().optional().alias('f')
|
|
12
|
+
}).strict();
|
|
12
13
|
class EntraOAuth2GrantRemoveCommand extends GraphCommand {
|
|
13
14
|
get name() {
|
|
14
15
|
return commands.OAUTH2GRANT_REMOVE;
|
|
@@ -16,10 +17,8 @@ class EntraOAuth2GrantRemoveCommand extends GraphCommand {
|
|
|
16
17
|
get description() {
|
|
17
18
|
return 'Remove specified service principal OAuth2 permissions';
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_EntraOAuth2GrantRemoveCommand_instances.add(this);
|
|
22
|
-
__classPrivateFieldGet(this, _EntraOAuth2GrantRemoveCommand_instances, "m", _EntraOAuth2GrantRemoveCommand_initOptions).call(this);
|
|
20
|
+
get schema() {
|
|
21
|
+
return options;
|
|
23
22
|
}
|
|
24
23
|
async commandAction(logger, args) {
|
|
25
24
|
const removeOauth2Grant = async () => {
|
|
@@ -51,12 +50,5 @@ class EntraOAuth2GrantRemoveCommand extends GraphCommand {
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
_EntraOAuth2GrantRemoveCommand_instances = new WeakSet(), _EntraOAuth2GrantRemoveCommand_initOptions = function _EntraOAuth2GrantRemoveCommand_initOptions() {
|
|
55
|
-
this.options.unshift({
|
|
56
|
-
option: '-i, --grantId <grantId>'
|
|
57
|
-
}, {
|
|
58
|
-
option: '-f, --force'
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
53
|
export default new EntraOAuth2GrantRemoveCommand();
|
|
62
54
|
//# sourceMappingURL=oauth2grant-remove.js.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _EntraOAuth2GrantSetCommand_instances, _EntraOAuth2GrantSetCommand_initOptions;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
4
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
5
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
6
|
import commands from '../../commands.js';
|
|
7
|
+
export const options = globalOptionsZod
|
|
8
|
+
.extend({
|
|
9
|
+
grantId: z.string().alias('i'),
|
|
10
|
+
scope: z.string().alias('s')
|
|
11
|
+
}).strict();
|
|
11
12
|
class EntraOAuth2GrantSetCommand extends GraphCommand {
|
|
12
13
|
get name() {
|
|
13
14
|
return commands.OAUTH2GRANT_SET;
|
|
@@ -15,10 +16,8 @@ class EntraOAuth2GrantSetCommand extends GraphCommand {
|
|
|
15
16
|
get description() {
|
|
16
17
|
return 'Update OAuth2 permissions for the service principal';
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_EntraOAuth2GrantSetCommand_instances.add(this);
|
|
21
|
-
__classPrivateFieldGet(this, _EntraOAuth2GrantSetCommand_instances, "m", _EntraOAuth2GrantSetCommand_initOptions).call(this);
|
|
19
|
+
get schema() {
|
|
20
|
+
return options;
|
|
22
21
|
}
|
|
23
22
|
async commandAction(logger, args) {
|
|
24
23
|
if (this.verbose) {
|
|
@@ -42,12 +41,5 @@ class EntraOAuth2GrantSetCommand extends GraphCommand {
|
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
_EntraOAuth2GrantSetCommand_instances = new WeakSet(), _EntraOAuth2GrantSetCommand_initOptions = function _EntraOAuth2GrantSetCommand_initOptions() {
|
|
46
|
-
this.options.unshift({
|
|
47
|
-
option: '-i, --grantId <grantId>'
|
|
48
|
-
}, {
|
|
49
|
-
option: '-s, --scope <scope>'
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
44
|
export default new EntraOAuth2GrantSetCommand();
|
|
53
45
|
//# sourceMappingURL=oauth2grant-set.js.map
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { cli } from '../../../../cli/cli.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import { CommandError, globalOptionsZod } from '../../../../Command.js';
|
|
4
4
|
import commands from '../../commands.js';
|
|
5
5
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
6
6
|
import { odata } from '../../../../utils/odata.js';
|
|
7
7
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
|
+
import { spe } from '../../../../utils/spe.js';
|
|
8
9
|
export const options = z.strictObject({
|
|
9
10
|
...globalOptionsZod.shape,
|
|
10
|
-
containerId: z.string().alias('i')
|
|
11
|
+
containerId: z.string().alias('i').optional(),
|
|
12
|
+
containerName: z.string().alias('n').optional(),
|
|
13
|
+
containerTypeId: z.uuid().optional(),
|
|
14
|
+
containerTypeName: z.string().optional()
|
|
11
15
|
});
|
|
12
16
|
class SpeContainerPermissionListCommand extends GraphCommand {
|
|
13
17
|
get name() {
|
|
@@ -22,12 +26,25 @@ class SpeContainerPermissionListCommand extends GraphCommand {
|
|
|
22
26
|
get schema() {
|
|
23
27
|
return options;
|
|
24
28
|
}
|
|
29
|
+
getRefinedSchema(schema) {
|
|
30
|
+
return schema
|
|
31
|
+
.refine((opts) => [opts.containerId, opts.containerName].filter(value => value !== undefined).length === 1, {
|
|
32
|
+
message: 'Specify either id or name, but not both.'
|
|
33
|
+
})
|
|
34
|
+
.refine((options) => !options.containerName || [options.containerTypeId, options.containerTypeName].filter(o => o !== undefined).length === 1, {
|
|
35
|
+
error: 'Use one of the following options when specifying the container name: containerTypeId or containerTypeName.'
|
|
36
|
+
})
|
|
37
|
+
.refine((options) => options.containerName || [options.containerTypeId, options.containerTypeName].filter(o => o !== undefined).length === 0, {
|
|
38
|
+
error: 'Options containerTypeId and containerTypeName are only required when retrieving a container by name.'
|
|
39
|
+
});
|
|
40
|
+
}
|
|
25
41
|
async commandAction(logger, args) {
|
|
26
42
|
try {
|
|
43
|
+
const containerId = await this.resolveContainerId(args.options, logger);
|
|
27
44
|
if (this.verbose) {
|
|
28
|
-
await logger.logToStderr(`Retrieving permissions of a SharePoint Embedded Container with id '${
|
|
45
|
+
await logger.logToStderr(`Retrieving permissions of a SharePoint Embedded Container with id '${containerId}'...`);
|
|
29
46
|
}
|
|
30
|
-
const containerPermission = await odata.getAllItems(`${this.resource}/v1.0/storage/fileStorage/containers/${formatting.encodeQueryParameter(
|
|
47
|
+
const containerPermission = await odata.getAllItems(`${this.resource}/v1.0/storage/fileStorage/containers/${formatting.encodeQueryParameter(containerId)}/permissions`);
|
|
31
48
|
if (!cli.shouldTrimOutput(args.options.output)) {
|
|
32
49
|
await logger.log(containerPermission);
|
|
33
50
|
}
|
|
@@ -42,9 +59,31 @@ class SpeContainerPermissionListCommand extends GraphCommand {
|
|
|
42
59
|
}
|
|
43
60
|
}
|
|
44
61
|
catch (err) {
|
|
62
|
+
if (err instanceof CommandError) {
|
|
63
|
+
throw err;
|
|
64
|
+
}
|
|
45
65
|
this.handleRejectedODataJsonPromise(err);
|
|
46
66
|
}
|
|
47
67
|
}
|
|
68
|
+
async resolveContainerId(options, logger) {
|
|
69
|
+
if (options.containerId) {
|
|
70
|
+
return options.containerId;
|
|
71
|
+
}
|
|
72
|
+
if (this.verbose) {
|
|
73
|
+
await logger.logToStderr(`Resolving container id from name '${options.containerName}'...`);
|
|
74
|
+
}
|
|
75
|
+
const containerTypeId = await this.getContainerTypeId(options, logger);
|
|
76
|
+
return spe.getContainerIdByName(containerTypeId, options.containerName);
|
|
77
|
+
}
|
|
78
|
+
async getContainerTypeId(options, logger) {
|
|
79
|
+
if (options.containerTypeId) {
|
|
80
|
+
return options.containerTypeId;
|
|
81
|
+
}
|
|
82
|
+
if (this.verbose) {
|
|
83
|
+
await logger.logToStderr(`Getting container type with name '${options.containerTypeName}'...`);
|
|
84
|
+
}
|
|
85
|
+
return spe.getContainerTypeIdByName(options.containerTypeName);
|
|
86
|
+
}
|
|
48
87
|
}
|
|
49
88
|
export default new SpeContainerPermissionListCommand();
|
|
50
89
|
//# sourceMappingURL=container-permission-list.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import commands from '../../commands.js';
|
|
2
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { validation } from '../../../../utils/validation.js';
|
|
6
|
+
import { cli } from '../../../../cli/cli.js';
|
|
7
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
export const options = z.strictObject({
|
|
11
|
+
...globalOptionsZod.shape,
|
|
12
|
+
webUrl: z.string()
|
|
13
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
14
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
15
|
+
})
|
|
16
|
+
.alias('u'),
|
|
17
|
+
url: z.string().optional(),
|
|
18
|
+
id: z.uuid().optional().alias('i'),
|
|
19
|
+
force: z.boolean().optional().alias('f')
|
|
20
|
+
});
|
|
21
|
+
class SpoFileUnarchiveCommand extends SpoCommand {
|
|
22
|
+
get name() {
|
|
23
|
+
return commands.FILE_UNARCHIVE;
|
|
24
|
+
}
|
|
25
|
+
get description() {
|
|
26
|
+
return 'Unarchives a file';
|
|
27
|
+
}
|
|
28
|
+
get schema() {
|
|
29
|
+
return options;
|
|
30
|
+
}
|
|
31
|
+
getRefinedSchema(schema) {
|
|
32
|
+
return schema
|
|
33
|
+
.refine(options => [options.url, options.id].filter(o => o !== undefined).length === 1, {
|
|
34
|
+
error: `Specify 'url' or 'id', but not both.`
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getExcludedOptionsWithUrls() {
|
|
38
|
+
return ['url'];
|
|
39
|
+
}
|
|
40
|
+
async commandAction(logger, args) {
|
|
41
|
+
const { webUrl, url, id, force, verbose } = args.options;
|
|
42
|
+
if (!force) {
|
|
43
|
+
const result = await cli.promptForConfirmation({ message: `Reactivation could take up to 24 hours. Files that are reactivated cannot be archived again for 30 days. Are you sure you would like to unarchive this item?` });
|
|
44
|
+
if (!result) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
if (verbose) {
|
|
50
|
+
await logger.logToStderr(`Unarchiving file '${url || id}' at site '${webUrl}'...`);
|
|
51
|
+
}
|
|
52
|
+
let requestUrl = `${webUrl}/_api/web`;
|
|
53
|
+
if (id) {
|
|
54
|
+
requestUrl += `/GetFileById('${formatting.encodeQueryParameter(id)}')`;
|
|
55
|
+
}
|
|
56
|
+
else if (url) {
|
|
57
|
+
const serverRelativePath = urlUtil.getServerRelativePath(webUrl, url);
|
|
58
|
+
requestUrl += `/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativePath)}')`;
|
|
59
|
+
}
|
|
60
|
+
requestUrl += '?$select=ListId,ListItemAllFields/Id&$expand=ListItemAllFields';
|
|
61
|
+
const fileInfo = await request.get({
|
|
62
|
+
url: requestUrl,
|
|
63
|
+
headers: {
|
|
64
|
+
accept: 'application/json;odata=nometadata'
|
|
65
|
+
},
|
|
66
|
+
responseType: 'json'
|
|
67
|
+
});
|
|
68
|
+
const requestOptions = {
|
|
69
|
+
url: `${webUrl}/_api/Lists(guid'${fileInfo.ListId}')/items(${fileInfo.ListItemAllFields.Id})/UnArchive`,
|
|
70
|
+
headers: {
|
|
71
|
+
accept: 'application/json;odata=nometadata'
|
|
72
|
+
},
|
|
73
|
+
responseType: 'json'
|
|
74
|
+
};
|
|
75
|
+
await request.post(requestOptions);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
this.handleRejectedODataJsonPromise(err);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export default new SpoFileUnarchiveCommand();
|
|
83
|
+
//# sourceMappingURL=file-unarchive.js.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import commands from '../../commands.js';
|
|
2
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { validation } from '../../../../utils/validation.js';
|
|
6
|
+
import { cli } from '../../../../cli/cli.js';
|
|
7
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
export const options = z.strictObject({
|
|
11
|
+
...globalOptionsZod.shape,
|
|
12
|
+
webUrl: z.string()
|
|
13
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
14
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
15
|
+
})
|
|
16
|
+
.alias('u'),
|
|
17
|
+
url: z.string().optional(),
|
|
18
|
+
id: z.uuid().optional().alias('i'),
|
|
19
|
+
force: z.boolean().optional().alias('f')
|
|
20
|
+
});
|
|
21
|
+
class SpoFolderArchiveCommand extends SpoCommand {
|
|
22
|
+
get name() {
|
|
23
|
+
return commands.FOLDER_ARCHIVE;
|
|
24
|
+
}
|
|
25
|
+
get description() {
|
|
26
|
+
return 'Archives a folder';
|
|
27
|
+
}
|
|
28
|
+
get schema() {
|
|
29
|
+
return options;
|
|
30
|
+
}
|
|
31
|
+
getRefinedSchema(schema) {
|
|
32
|
+
return schema
|
|
33
|
+
.refine(options => [options.url, options.id].filter(o => o !== undefined).length === 1, {
|
|
34
|
+
error: `Specify 'url' or 'id', but not both.`
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getExcludedOptionsWithUrls() {
|
|
38
|
+
return ['url'];
|
|
39
|
+
}
|
|
40
|
+
async commandAction(logger, args) {
|
|
41
|
+
const { webUrl, url, id, force } = args.options;
|
|
42
|
+
if (!force) {
|
|
43
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you would like to archive this item? You will be able to reactivate it instantly for the first 7 days. After that, it will take up to 24 hours to reactivate.` });
|
|
44
|
+
if (!result) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
if (this.verbose) {
|
|
50
|
+
await logger.logToStderr(`Archiving folder ${url || id} at site ${webUrl}...`);
|
|
51
|
+
}
|
|
52
|
+
let requestUrl = `${webUrl}/_api/web`;
|
|
53
|
+
if (id) {
|
|
54
|
+
requestUrl += `/GetFolderById('${formatting.encodeQueryParameter(id)}')`;
|
|
55
|
+
}
|
|
56
|
+
else if (url) {
|
|
57
|
+
const serverRelativePath = urlUtil.getServerRelativePath(webUrl, url);
|
|
58
|
+
requestUrl += `/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativePath)}')`;
|
|
59
|
+
}
|
|
60
|
+
requestUrl += '?$select=Exists,ListItemAllFields/Id,ListItemAllFields/ParentList/Id&$expand=ListItemAllFields,ListItemAllFields/ParentList';
|
|
61
|
+
const folderInfo = await request.get({
|
|
62
|
+
url: requestUrl,
|
|
63
|
+
headers: {
|
|
64
|
+
accept: 'application/json;odata=nometadata'
|
|
65
|
+
},
|
|
66
|
+
responseType: 'json'
|
|
67
|
+
});
|
|
68
|
+
if (!folderInfo.Exists) {
|
|
69
|
+
throw `The folder '${url || id}' does not exist.`;
|
|
70
|
+
}
|
|
71
|
+
if (!folderInfo.ListItemAllFields?.ParentList) {
|
|
72
|
+
throw `The folder '${url || id}' is the root folder of a document library and cannot be archived. Archive a subfolder instead.`;
|
|
73
|
+
}
|
|
74
|
+
const requestOptions = {
|
|
75
|
+
url: `${webUrl}/_api/Lists(guid'${folderInfo.ListItemAllFields.ParentList.Id}')/items(${folderInfo.ListItemAllFields.Id})/Archive`,
|
|
76
|
+
headers: {
|
|
77
|
+
accept: 'application/json;odata=nometadata'
|
|
78
|
+
},
|
|
79
|
+
responseType: 'json'
|
|
80
|
+
};
|
|
81
|
+
await request.post(requestOptions);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
this.handleRejectedODataJsonPromise(err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export default new SpoFolderArchiveCommand();
|
|
89
|
+
//# sourceMappingURL=folder-archive.js.map
|
|
@@ -85,6 +85,7 @@ export default {
|
|
|
85
85
|
FILE_SHARINGLINK_LIST: `${prefix} file sharinglink list`,
|
|
86
86
|
FILE_SHARINGLINK_REMOVE: `${prefix} file sharinglink remove`,
|
|
87
87
|
FILE_SHARINGLINK_SET: `${prefix} file sharinglink set`,
|
|
88
|
+
FILE_UNARCHIVE: `${prefix} file unarchive`,
|
|
88
89
|
FILE_VERSION_CLEAR: `${prefix} file version clear`,
|
|
89
90
|
FILE_VERSION_GET: `${prefix} file version get`,
|
|
90
91
|
FILE_VERSION_KEEP: `${prefix} file version keep`,
|
|
@@ -92,6 +93,7 @@ export default {
|
|
|
92
93
|
FILE_VERSION_REMOVE: `${prefix} file version remove`,
|
|
93
94
|
FILE_VERSION_RESTORE: `${prefix} file version restore`,
|
|
94
95
|
FOLDER_ADD: `${prefix} folder add`,
|
|
96
|
+
FOLDER_ARCHIVE: `${prefix} folder archive`,
|
|
95
97
|
FOLDER_COPY: `${prefix} folder copy`,
|
|
96
98
|
FOLDER_GET: `${prefix} folder get`,
|
|
97
99
|
FOLDER_LIST: `${prefix} folder list`,
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
4
|
+
import commands from '../../commands.js';
|
|
5
|
+
import { vivaEngage } from '../../../../utils/vivaEngage.js';
|
|
6
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { validation } from '../../../../utils/validation.js';
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
roleId: z.uuid().optional().refine(id => validation.isValidGuid(id), {
|
|
12
|
+
error: e => `'${e.input}' is not a valid GUID.`
|
|
13
|
+
}),
|
|
14
|
+
roleName: z.string().optional(),
|
|
15
|
+
userId: z.uuid().optional().refine(id => validation.isValidGuid(id), {
|
|
16
|
+
error: e => `'${e.input}' is not a valid GUID.`
|
|
17
|
+
}),
|
|
18
|
+
userName: z.string().refine(upn => validation.isValidUserPrincipalName(upn), {
|
|
19
|
+
error: e => `'${e.input}' is not a valid UPN.`
|
|
20
|
+
}).optional()
|
|
21
|
+
});
|
|
22
|
+
class VivaEngageRoleMemberAddCommand extends GraphCommand {
|
|
23
|
+
get name() {
|
|
24
|
+
return commands.ENGAGE_ROLE_MEMBER_ADD;
|
|
25
|
+
}
|
|
26
|
+
get description() {
|
|
27
|
+
return 'Assign a Viva Engage role to a user';
|
|
28
|
+
}
|
|
29
|
+
get schema() {
|
|
30
|
+
return options;
|
|
31
|
+
}
|
|
32
|
+
getRefinedSchema(schema) {
|
|
33
|
+
return schema
|
|
34
|
+
.refine(options => [options.roleId, options.roleName].filter(x => x !== undefined).length === 1, {
|
|
35
|
+
error: 'Specify either roleId, or roleName, but not both.'
|
|
36
|
+
})
|
|
37
|
+
.refine(options => [options.userId, options.userName].filter(x => x !== undefined).length === 1, {
|
|
38
|
+
error: 'Specify either userId, or userName, but not both.'
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async commandAction(logger, args) {
|
|
42
|
+
try {
|
|
43
|
+
let roleId = args.options.roleId;
|
|
44
|
+
let userId = args.options.userId;
|
|
45
|
+
if (args.options.roleName) {
|
|
46
|
+
if (this.verbose) {
|
|
47
|
+
await logger.logToStderr(`Retrieving Viva Engage role ID for role name '${args.options.roleName}'...`);
|
|
48
|
+
}
|
|
49
|
+
roleId = await vivaEngage.getRoleIdByName(args.options.roleName);
|
|
50
|
+
}
|
|
51
|
+
if (args.options.userName) {
|
|
52
|
+
if (this.verbose) {
|
|
53
|
+
await logger.logToStderr(`Retrieving Viva Engage user ID for user name '${args.options.userName}'...`);
|
|
54
|
+
}
|
|
55
|
+
userId = await entraUser.getUserIdByUpn(args.options.userName);
|
|
56
|
+
}
|
|
57
|
+
if (this.verbose) {
|
|
58
|
+
await logger.logToStderr(`Assigning user ${userId} to a Viva Engage role ${roleId}...`);
|
|
59
|
+
}
|
|
60
|
+
const requestOptions = {
|
|
61
|
+
url: `${this.resource}/beta/employeeExperience/roles/${roleId}/members`,
|
|
62
|
+
headers: {
|
|
63
|
+
'content-type': 'application/json;odata=nometadata',
|
|
64
|
+
'accept': 'application/json;odata.metadata=none'
|
|
65
|
+
},
|
|
66
|
+
responseType: 'json',
|
|
67
|
+
data: {
|
|
68
|
+
'user@odata.bind': `${this.resource}/beta/users('${userId}')`
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
await request.post(requestOptions);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
this.handleRejectedODataJsonPromise(err);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export default new VivaEngageRoleMemberAddCommand();
|
|
79
|
+
//# sourceMappingURL=engage-role-member-add.js.map
|
|
@@ -25,6 +25,7 @@ export default {
|
|
|
25
25
|
ENGAGE_REPORT_GROUPSACTIVITYDETAIL: `${prefix} engage report groupsactivitydetail`,
|
|
26
26
|
ENGAGE_REPORT_GROUPSACTIVITYGROUPCOUNTS: `${prefix} engage report groupsactivitygroupcounts`,
|
|
27
27
|
ENGAGE_ROLE_LIST: `${prefix} engage role list`,
|
|
28
|
+
ENGAGE_ROLE_MEMBER_ADD: `${prefix} engage role member add`,
|
|
28
29
|
ENGAGE_ROLE_MEMBER_LIST: `${prefix} engage role member list`,
|
|
29
30
|
ENGAGE_ROLE_MEMBER_REMOVE: `${prefix} engage role member remove`,
|
|
30
31
|
ENGAGE_SEARCH: `${prefix} engage search`,
|