@pnp/cli-microsoft365 10.4.0-beta.47f1e4d → 10.4.0-beta.791a39c

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/dist/cli/cli.js CHANGED
@@ -159,17 +159,9 @@ async function execute(rawArgs) {
159
159
  shouldPrompt) {
160
160
  await cli.error('🌶️ Provide values for the following parameters:');
161
161
  for (const error of result.error.errors) {
162
- const optionName = error.path.join('.');
163
- const optionInfo = cli.commandToExecute.options.find(o => o.name === optionName);
162
+ const optionInfo = cli.commandToExecute.options.find(o => o.name === error.path.join('.'));
164
163
  const answer = await cli.promptForValue(optionInfo);
165
- // coerce the answer to the correct type
166
- try {
167
- const parsed = getCommandOptionsFromArgs([`--${optionName}`, answer], cli.commandToExecute);
168
- cli.optionsFromArgs.options[optionName] = parsed[optionName];
169
- }
170
- catch (e) {
171
- return cli.closeWithError(e.message, cli.optionsFromArgs, true);
172
- }
164
+ cli.optionsFromArgs.options[error.path.join('.')] = answer;
173
165
  }
174
166
  }
175
167
  else {
@@ -119,7 +119,6 @@ export default {
119
119
  USER_REGISTRATIONDETAILS_LIST: `${prefix} user registrationdetails list`,
120
120
  USER_REMOVE: `${prefix} user remove`,
121
121
  USER_RECYCLEBINITEM_RESTORE: `${prefix} user recyclebinitem restore`,
122
- USER_SESSION_REVOKE: `${prefix} user session revoke`,
123
122
  USER_SET: `${prefix} user set`,
124
123
  USER_SIGNIN_LIST: `${prefix} user signin list`
125
124
  };
@@ -46,9 +46,6 @@ class OutlookMailboxSettingsSetCommand extends GraphCommand {
46
46
  }
47
47
  getRefinedSchema(schema) {
48
48
  return schema
49
- .refine(options => !(options.userId && options.userName), {
50
- message: 'Specify either userId or userName, but not both'
51
- })
52
49
  .refine(options => [options.workingDays, options.workingHoursStartTime, options.workingHoursEndTime, options.workingHoursTimeZone,
53
50
  options.autoReplyStatus, options.autoReplyExternalAudience, options.autoReplyExternalMessage, options.autoReplyInternalMessage,
54
51
  options.autoReplyStartDateTime, options.autoReplyStartTimeZone, options.autoReplyEndDateTime, options.autoReplyEndTimeZone,
@@ -60,8 +57,8 @@ class OutlookMailboxSettingsSetCommand extends GraphCommand {
60
57
  const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
61
58
  let requestUrl = `${this.resource}/v1.0/me/mailboxSettings`;
62
59
  if (isAppOnlyAccessToken) {
63
- if (!args.options.userId && !args.options.userName) {
64
- throw 'When running with application permissions either userId or userName is required';
60
+ if (args.options.userId && args.options.userName) {
61
+ throw 'When running with application permissions either userId or userName is required, but not both';
65
62
  }
66
63
  const userIdentifier = args.options.userId ?? args.options.userName;
67
64
  if (this.verbose) {
@@ -1,7 +1,6 @@
1
1
  const prefix = 'outlook';
2
2
  export default {
3
3
  MAIL_SEND: `${prefix} mail send`,
4
- MAILBOX_SETTINGS_GET: `${prefix} mailbox settings get`,
5
4
  MAILBOX_SETTINGS_SET: `${prefix} mailbox settings set`,
6
5
  MESSAGE_GET: `${prefix} message get`,
7
6
  MESSAGE_LIST: `${prefix} message list`,
@@ -8,7 +8,6 @@ import request from '../../../../request.js';
8
8
  import { validation } from '../../../../utils/validation.js';
9
9
  import SpoCommand from '../../../base/SpoCommand.js';
10
10
  import commands from '../../commands.js';
11
- import outlookCommands from '../../../outlook/commands.js';
12
11
  class SpoMailSendCommand extends SpoCommand {
13
12
  get name() {
14
13
  return commands.MAIL_SEND;
@@ -24,7 +23,6 @@ class SpoMailSendCommand extends SpoCommand {
24
23
  __classPrivateFieldGet(this, _SpoMailSendCommand_instances, "m", _SpoMailSendCommand_initValidators).call(this);
25
24
  }
26
25
  async commandAction(logger, args) {
27
- await this.showDeprecationWarning(logger, commands.MAIL_SEND, outlookCommands.MAIL_SEND);
28
26
  const params = {
29
27
  properties: {
30
28
  __metadata: { "type": "SP.Utilities.EmailProperties" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "10.4.0-beta.47f1e4d",
3
+ "version": "10.4.0-beta.791a39c",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",
@@ -1,70 +0,0 @@
1
- import { z } from 'zod';
2
- import { globalOptionsZod } from '../../../../Command.js';
3
- import { zod } from '../../../../utils/zod.js';
4
- import GraphCommand from '../../../base/GraphCommand.js';
5
- import commands from '../../commands.js';
6
- import { validation } from '../../../../utils/validation.js';
7
- import request from '../../../../request.js';
8
- import { cli } from '../../../../cli/cli.js';
9
- import { formatting } from '../../../../utils/formatting.js';
10
- const options = globalOptionsZod
11
- .extend({
12
- userId: zod.alias('i', z.string().refine(id => validation.isValidGuid(id), id => ({
13
- message: `'${id}' is not a valid GUID.`
14
- })).optional()),
15
- userName: zod.alias('n', z.string().refine(name => validation.isValidUserPrincipalName(name), name => ({
16
- message: `'${name}' is not a valid UPN.`
17
- })).optional()),
18
- force: zod.alias('f', z.boolean().optional())
19
- })
20
- .strict();
21
- class EntraUserSessionRevokeCommand extends GraphCommand {
22
- get name() {
23
- return commands.USER_SESSION_REVOKE;
24
- }
25
- get description() {
26
- return 'Revokes all sign-in sessions for a given user';
27
- }
28
- get schema() {
29
- return options;
30
- }
31
- getRefinedSchema(schema) {
32
- return schema
33
- .refine(options => [options.userId, options.userName].filter(o => o !== undefined).length === 1, {
34
- message: `Specify either 'userId' or 'userName'.`
35
- });
36
- }
37
- async commandAction(logger, args) {
38
- const revokeUserSessions = async () => {
39
- try {
40
- const userIdentifier = args.options.userId ?? args.options.userName;
41
- if (this.verbose) {
42
- await logger.logToStderr(`Invalidating all the refresh tokens for user ${userIdentifier}...`);
43
- }
44
- const requestOptions = {
45
- url: `${this.resource}/v1.0/users('${formatting.encodeQueryParameter(userIdentifier)}')/revokeSignInSessions`,
46
- headers: {
47
- accept: 'application/json;odata.metadata=none'
48
- },
49
- responseType: 'json',
50
- data: {}
51
- };
52
- await request.post(requestOptions);
53
- }
54
- catch (err) {
55
- this.handleRejectedODataJsonPromise(err);
56
- }
57
- };
58
- if (args.options.force) {
59
- await revokeUserSessions();
60
- }
61
- else {
62
- const result = await cli.promptForConfirmation({ message: `This will revoke all sessions for the user '${args.options.userId || args.options.userName}', requiring the user to re-sign in from all devices. Are you sure?` });
63
- if (result) {
64
- await revokeUserSessions();
65
- }
66
- }
67
- }
68
- }
69
- export default new EntraUserSessionRevokeCommand();
70
- //# sourceMappingURL=user-session-revoke.js.map
@@ -1,71 +0,0 @@
1
- import { z } from 'zod';
2
- import { globalOptionsZod } from '../../../../Command.js';
3
- import { zod } from '../../../../utils/zod.js';
4
- import GraphCommand from '../../../base/GraphCommand.js';
5
- import commands from '../../commands.js';
6
- import { validation } from '../../../../utils/validation.js';
7
- import request from '../../../../request.js';
8
- import { accessToken } from '../../../../utils/accessToken.js';
9
- import auth from '../../../../Auth.js';
10
- const options = globalOptionsZod
11
- .extend({
12
- userId: zod.alias('i', z.string().refine(id => validation.isValidGuid(id), id => ({
13
- message: `'${id}' is not a valid GUID.`
14
- })).optional()),
15
- userName: zod.alias('n', z.string().refine(name => validation.isValidUserPrincipalName(name), name => ({
16
- message: `'${name}' is not a valid UPN.`
17
- })).optional())
18
- })
19
- .strict();
20
- class OutlookMailboxSettingsGetCommand extends GraphCommand {
21
- get name() {
22
- return commands.MAILBOX_SETTINGS_GET;
23
- }
24
- get description() {
25
- return `Get the user's mailbox settings`;
26
- }
27
- get schema() {
28
- return options;
29
- }
30
- getRefinedSchema(schema) {
31
- return schema
32
- .refine(options => !(options.userId && options.userName), {
33
- message: 'Specify either userId or userName, but not both'
34
- });
35
- }
36
- async commandAction(logger, args) {
37
- const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
38
- let requestUrl = `${this.resource}/v1.0/me/mailboxSettings`;
39
- if (isAppOnlyAccessToken) {
40
- if (!args.options.userId && !args.options.userName) {
41
- throw 'When running with application permissions either userId or userName is required';
42
- }
43
- const userIdentifier = args.options.userId ?? args.options.userName;
44
- if (this.verbose) {
45
- await logger.logToStderr(`Retrieving mailbox settings for user ${userIdentifier}...`);
46
- }
47
- requestUrl = `${this.resource}/v1.0/users('${userIdentifier}')/mailboxSettings`;
48
- }
49
- else {
50
- if (args.options.userId || args.options.userName) {
51
- throw 'You can retrieve mailbox settings of other users only if CLI is authenticated in app-only mode';
52
- }
53
- }
54
- const requestOptions = {
55
- url: requestUrl,
56
- headers: {
57
- accept: 'application/json;odata.metadata=none'
58
- },
59
- responseType: 'json'
60
- };
61
- try {
62
- const result = await request.get(requestOptions);
63
- await logger.log(result);
64
- }
65
- catch (err) {
66
- this.handleRejectedODataJsonPromise(err);
67
- }
68
- }
69
- }
70
- export default new OutlookMailboxSettingsGetCommand();
71
- //# sourceMappingURL=mailbox-settings-get.js.map
@@ -1,65 +0,0 @@
1
- import Global from '/docs/cmd/_global.mdx';
2
-
3
- # entra user session revoke
4
-
5
- Revokes all sign-in sessions for a given user
6
-
7
- ## Usage
8
-
9
- ```sh
10
- m365 entra user session revoke [options]
11
- ```
12
-
13
- ## Options
14
- ```md definition-list
15
- `-i, --userId [userId]`
16
- : The id of the user. Specify either `userId` or `userName`, but not both.
17
-
18
- `-n, --userName [userName]`
19
- : The user principal name of the user. Specify either `userId` or `userName`, but not both.
20
-
21
- `-f, --force`
22
- : Don't prompt for confirmation.
23
- ```
24
-
25
- <Global />
26
-
27
- ## Remarks
28
-
29
- :::info
30
-
31
- To use this command you must be either **User Administrator** or **Global Administrator**.
32
-
33
- :::
34
-
35
- :::note
36
-
37
- There might be a small delay of a few minutes before tokens are revoked.
38
-
39
- This API doesn't revoke sign-in sessions for external users, because external users sign in through their home tenant.
40
-
41
- :::
42
-
43
- ## Examples
44
-
45
- Revoke sign-in sessions of a user specified by id
46
-
47
- ```sh
48
- m365 entra user session revoke --userId 4fb72b9b-d0b0-4a35-8bc1-83f9a6488c48
49
- ```
50
-
51
- Revoke sign-in sessions of a user specified by its UPN
52
-
53
- ```sh
54
- m365 entra user session revoke --userName john.doe@contoso.onmicrosoft.com
55
- ```
56
-
57
- Revoke sign-in sessions of a user specified by its UPN without prompting for confirmation
58
-
59
- ```sh
60
- m365 entra user session revoke --userName john.doe@contoso.onmicrosoft.com --force
61
- ```
62
-
63
- ## Response
64
-
65
- The command won't return a response on success.
@@ -1,131 +0,0 @@
1
- import Global from '/docs/cmd/_global.mdx';
2
- import Tabs from '@theme/Tabs';
3
- import TabItem from '@theme/TabItem';
4
-
5
- # outlook mailbox settings get
6
-
7
- Get the user's mailbox settings
8
-
9
- ## Usage
10
-
11
- ```sh
12
- m365 outlook mailbox settings get [options]
13
- ```
14
-
15
- ## Options
16
-
17
- ```md definition-list
18
- `-i, --userId [userId]`
19
- : The ID of the Microsoft Entra user for which you want to get mailbox settings. Specify either `userId` or `userName`, but not both. This option is required when using application permissions.
20
-
21
- `-n, --userName [userName]`
22
- : The UPN of the Microsoft Entra user for which you want to get mailbox settings. Specify either `userId` or `userName`, but not both. This option is required when using application permissions.
23
- ```
24
-
25
- <Global />
26
-
27
- ## Examples
28
-
29
- Get mailbox settings of the signed-in user
30
-
31
- ```sh
32
- m365 outlook mailbox settings get
33
- ```
34
-
35
- Get mailbox settings of a user specified by id
36
-
37
- ```sh
38
- m365 outlook mailbox settings get --userId 1caf7dcd-7e83-4c3a-94f7-932a1299c844
39
- ```
40
-
41
- ## Response
42
-
43
- <Tabs>
44
- <TabItem value="JSON">
45
-
46
- ```json
47
- {
48
- "archiveFolder": "AQMkAGRlM2Y5YTkzLWI2NzAtNDczOS05YWMyLTJhZGY2MGExMGU0MgAuAAADSG3wPE27kUeySjmT5eRT8QEAfJKVL07sbkmIfHqjbDnRgQAAAgEMAAAA",
49
- "timeZone": "Central Europe Standard Time",
50
- "delegateMeetingMessageDeliveryOptions": "sendToDelegateOnly",
51
- "dateFormat": "dd.MM.yyyy",
52
- "timeFormat": "H:mm",
53
- "userPurpose": "user",
54
- "automaticRepliesSetting": {
55
- "status": "disabled",
56
- "externalAudience": "all",
57
- "internalReplyMessage": "On vacation. Will be back.",
58
- "externalReplyMessage": "Vacation",
59
- "scheduledStartDateTime": {
60
- "dateTime": "2025-01-20T08:00:00.0000000",
61
- "timeZone": "UTC"
62
- },
63
- "scheduledEndDateTime": {
64
- "dateTime": "2025-01-25T18:00:00.0000000",
65
- "timeZone": "UTC"
66
- }
67
- },
68
- "language": {
69
- "locale": "en-US",
70
- "displayName": "English (United States)"
71
- },
72
- "workingHours": {
73
- "daysOfWeek": [
74
- "monday",
75
- "tuesday",
76
- "wednesday",
77
- "thursday",
78
- "friday"
79
- ],
80
- "startTime": "08:00:00.0000000",
81
- "endTime": "16:30:00.0000000",
82
- "timeZone": {
83
- "name": "Central Europe Standard Time"
84
- }
85
- }
86
- }
87
- ```
88
-
89
- </TabItem>
90
- <TabItem value="Text">
91
-
92
- ```text
93
- archiveFolder : AQMkAGRlM2Y5YTkzLWI2NzAtNDczOS05YWMyLTJhZGY2MGExMGU0MgAuAAADSG3wPE27kUeySjmT5eRT8QEAfJKVL07sbkmIfHqjbDnRgQAAAgEMAAAA
94
- automaticRepliesSetting : {"status":"disabled","externalAudience":"all","internalReplyMessage":"","externalReplyMessage":"","scheduledStartDateTime":{"dateTime":"2025-01-20T08:00:00.0000000","timeZone":"UTC"},"scheduledEndDateTime":{"dateTime":"2025-01-25T18:00:00.0000000","timeZone":"UTC"}}
95
- dateFormat : dd.MM.yyyy
96
- delegateMeetingMessageDeliveryOptions: sendToDelegateOnly
97
- language : {"locale":"en-US","displayName":"English (United States)"}
98
- timeFormat : H:mm
99
- timeZone : Central Europe Standard Time
100
- userPurpose : user
101
- workingHours : {"daysOfWeek":["monday","tuesday","wednesday","thursday","friday"],"startTime":"08:00:00.0000000","endTime":"16:30:00.0000000","timeZone":{"name":"Central Europe Standard Time"}}
102
- ```
103
-
104
- </TabItem>
105
- <TabItem value="CSV">
106
-
107
- ```csv
108
- archiveFolder,timeZone,delegateMeetingMessageDeliveryOptions,dateFormat,timeFormat,userPurpose
109
- AQMkAGRlM2Y5YTkzLWI2NzAtNDczOS05YWMyLTJhZGY2MGExMGU0MgAuAAADSG3wPE27kUeySjmT5eRT8QEAfJKVL07sbkmIfHqjbDnRgQAAAgEMAAAA,Central Europe Standard Time,sendToDelegateOnly,dd.MM.yyyy,H:mm,user
110
- ```
111
-
112
- </TabItem>
113
- <TabItem value="Markdown">
114
-
115
- ```md
116
- # outlook mailbox settings get
117
-
118
- Date: 1/17/2025
119
-
120
- Property | Value
121
- ---------|-------
122
- archiveFolder | AQMkAGRlM2Y5YTkzLWI2NzAtNDczOS05YWMyLTJhZGY2MGExMGU0MgAuAAADSG3wPE27kUeySjmT5eRT8QEAfJKVL07sbkmIfHqjbDnRgQAAAgEMAAAA
123
- timeZone | Central Europe Standard Time
124
- delegateMeetingMessageDeliveryOptions | sendToDelegateOnly
125
- dateFormat | dd.MM.yyyy
126
- timeFormat | H:mm
127
- userPurpose | user
128
- ```
129
-
130
- </TabItem>
131
- </Tabs>