@pnp/cli-microsoft365 11.7.0-beta.b67a258 → 11.7.0-beta.bd906c5

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.
Files changed (65) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/config.js +1 -0
  4. package/dist/m365/entra/commands/user/user-license-add.js +2 -1
  5. package/dist/m365/entra/commands/user/user-license-list.js +4 -9
  6. package/dist/m365/entra/commands/user/user-license-remove.js +2 -1
  7. package/dist/m365/outlook/commands/calendar/calendar-add.js +85 -0
  8. package/dist/m365/outlook/commands/calendar/calendar-get.js +71 -0
  9. package/dist/m365/outlook/commands/calendar/calendar-remove.js +100 -0
  10. package/dist/m365/outlook/commands/calendargroup/calendargroup-set.js +115 -0
  11. package/dist/m365/outlook/commands/event/event-cancel.js +103 -0
  12. package/dist/m365/outlook/commands/event/event-list.js +115 -0
  13. package/dist/m365/outlook/commands/event/event-remove.js +104 -0
  14. package/dist/m365/outlook/commands.js +7 -0
  15. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +643 -0
  16. package/dist/m365/spfx/commands/project/DeployWorkflow.js +2 -2
  17. package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +13 -1
  18. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.23.0-rc.0.js +19 -0
  19. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  20. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +16 -1
  21. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002021_DEVDEP_rushstack_eslint_config.js +2 -2
  22. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002032_DEVDEP_typescript_eslint_parser.js +2 -2
  23. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015008_FILE_eslintrc_js.js +1 -1
  24. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015016_FILE_eslint_config_js.js +10 -0
  25. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.23.0-rc.0.js +84 -0
  26. package/dist/m365/spfx/commands/project/project-upgrade.js +12 -11
  27. package/dist/m365/spfx/commands/spfx-doctor.js +5 -631
  28. package/dist/m365/teams/commands/chat/chat-message-list.js +43 -4
  29. package/dist/utils/calendar.js +37 -0
  30. package/dist/utils/calendarGroup.js +22 -0
  31. package/dist/utils/entraApp.js +9 -2
  32. package/dist/utils/spfx.js +59 -0
  33. package/docs/docs/cmd/entra/license/license-list.mdx +19 -0
  34. package/docs/docs/cmd/entra/m365group/m365group-conversation-list.mdx +19 -0
  35. package/docs/docs/cmd/entra/m365group/m365group-conversation-post-list.mdx +19 -0
  36. package/docs/docs/cmd/entra/user/user-groupmembership-list.mdx +19 -0
  37. package/docs/docs/cmd/entra/user/user-guest-add.mdx +19 -0
  38. package/docs/docs/cmd/entra/user/user-license-add.mdx +19 -0
  39. package/docs/docs/cmd/entra/user/user-license-list.mdx +18 -1
  40. package/docs/docs/cmd/entra/user/user-license-remove.mdx +21 -0
  41. package/docs/docs/cmd/entra/user/user-password-validate.mdx +12 -0
  42. package/docs/docs/cmd/entra/user/user-recyclebinitem-clear.mdx +21 -0
  43. package/docs/docs/cmd/entra/user/user-recyclebinitem-list.mdx +19 -0
  44. package/docs/docs/cmd/entra/user/user-recyclebinitem-remove.mdx +21 -0
  45. package/docs/docs/cmd/entra/user/user-recyclebinitem-restore.mdx +19 -0
  46. package/docs/docs/cmd/entra/user/user-registrationdetails-list.mdx +19 -0
  47. package/docs/docs/cmd/entra/user/user-session-revoke.mdx +21 -0
  48. package/docs/docs/cmd/entra/user/user-signin-list.mdx +19 -0
  49. package/docs/docs/cmd/exo/approleassignment/approleassignment-add.mdx +19 -0
  50. package/docs/docs/cmd/file/convert/convert-pdf.mdx +21 -0
  51. package/docs/docs/cmd/file/file-add.mdx +21 -0
  52. package/docs/docs/cmd/file/file-copy.mdx +21 -0
  53. package/docs/docs/cmd/file/file-list.mdx +19 -0
  54. package/docs/docs/cmd/file/file-move.mdx +21 -0
  55. package/docs/docs/cmd/outlook/calendar/calendar-add.mdx +165 -0
  56. package/docs/docs/cmd/outlook/calendar/calendar-get.mdx +165 -0
  57. package/docs/docs/cmd/outlook/calendar/calendar-remove.mdx +86 -0
  58. package/docs/docs/cmd/outlook/calendargroup/calendargroup-set.mdx +83 -0
  59. package/docs/docs/cmd/outlook/event/event-cancel.mdx +85 -0
  60. package/docs/docs/cmd/outlook/event/event-list.mdx +245 -0
  61. package/docs/docs/cmd/outlook/event/event-remove.mdx +85 -0
  62. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  63. package/docs/docs/cmd/teams/chat/chat-message-list.mdx +23 -2
  64. package/npm-shrinkwrap.json +0 -7
  65. package/package.json +2 -1
@@ -0,0 +1,115 @@
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 { validation } from '../../../../utils/validation.js';
6
+ import { odata } from '../../../../utils/odata.js';
7
+ import { calendar } from '../../../../utils/calendar.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ userId: z.string().refine(id => validation.isValidGuid(id), {
11
+ error: e => `'${e.input}' is not a valid GUID.`
12
+ }).optional(),
13
+ userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
14
+ error: e => `'${e.input}' is not a valid UPN.`
15
+ }).optional(),
16
+ calendarId: z.string().optional(),
17
+ calendarName: z.string().optional(),
18
+ startDateTime: z.string().refine(date => validation.isValidISODateTime(date), {
19
+ error: e => `'${e.input}' is not a valid ISO date-time.`
20
+ }).optional(),
21
+ endDateTime: z.string().refine(date => validation.isValidISODateTime(date), {
22
+ error: e => `'${e.input}' is not a valid ISO date-time.`
23
+ }).optional(),
24
+ timeZone: z.string().optional(),
25
+ properties: z.string().optional(),
26
+ filter: z.string().optional()
27
+ });
28
+ class OutlookEventListCommand extends GraphCommand {
29
+ get name() {
30
+ return commands.EVENT_LIST;
31
+ }
32
+ get description() {
33
+ return 'Retrieves a list of events from a specific calendar of a user.';
34
+ }
35
+ get schema() {
36
+ return options;
37
+ }
38
+ getRefinedSchema(schema) {
39
+ return schema
40
+ .refine(options => [options.userId, options.userName].filter(x => x !== undefined).length === 1, {
41
+ error: 'Specify either userId or userName, but not both'
42
+ })
43
+ .refine(options => !(options.calendarId && options.calendarName), {
44
+ error: 'Specify either calendarId or calendarName, but not both.'
45
+ });
46
+ }
47
+ defaultProperties() {
48
+ return ['id', 'subject'];
49
+ }
50
+ async commandAction(logger, args) {
51
+ try {
52
+ if (this.verbose) {
53
+ await logger.logToStderr('Getting a list of the events...');
54
+ }
55
+ let events;
56
+ const endpoint = await this.getRequestUrl(args.options);
57
+ if (args.options.timeZone) {
58
+ const requestOptions = {
59
+ url: endpoint,
60
+ headers: {
61
+ accept: 'application/json;odata.metadata=none',
62
+ Prefer: `outlook.timezone="${args.options.timeZone}"`
63
+ },
64
+ responseType: 'json'
65
+ };
66
+ events = await odata.getAllItems(requestOptions);
67
+ }
68
+ else {
69
+ events = await odata.getAllItems(endpoint);
70
+ }
71
+ await logger.log(events);
72
+ }
73
+ catch (err) {
74
+ this.handleRejectedODataJsonPromise(err);
75
+ }
76
+ }
77
+ async getRequestUrl(options) {
78
+ const queryParameters = [];
79
+ if (options.properties) {
80
+ const allProperties = options.properties.split(',');
81
+ const selectProperties = allProperties.filter(prop => !prop.includes('/'));
82
+ const expandProperties = allProperties.filter(prop => prop.includes('/'));
83
+ if (selectProperties.length > 0) {
84
+ queryParameters.push(`$select=${selectProperties}`);
85
+ }
86
+ if (expandProperties.length > 0) {
87
+ const fieldExpands = expandProperties.map(p => `${p.split('/')[0]}($select=${p.split('/')[1]})`);
88
+ queryParameters.push(`$expand=${fieldExpands.join(',')}`);
89
+ }
90
+ }
91
+ if (options.filter || options.startDateTime || options.endDateTime) {
92
+ let filter = options.filter || '';
93
+ if (options.startDateTime) {
94
+ filter += `${filter ? ' and ' : ''}start/dateTime ge '${options.startDateTime}'`;
95
+ }
96
+ if (options.endDateTime) {
97
+ filter += `${filter ? ' and ' : ''}start/dateTime lt '${options.endDateTime}'`;
98
+ }
99
+ queryParameters.push(`$filter=${filter}`);
100
+ }
101
+ const queryString = queryParameters.length > 0
102
+ ? `?${queryParameters.join('&')}`
103
+ : '';
104
+ const userIdentifier = options.userId ?? options.userName;
105
+ let calendarId = options.calendarId;
106
+ if (options.calendarName) {
107
+ calendarId = (await calendar.getUserCalendarByName(userIdentifier, options.calendarName)).id;
108
+ }
109
+ return calendarId
110
+ ? `${this.resource}/v1.0/users('${userIdentifier}')/calendars/${calendarId}/events${queryString}`
111
+ : `${this.resource}/v1.0/users('${userIdentifier}')/events${queryString}`;
112
+ }
113
+ }
114
+ export default new OutlookEventListCommand();
115
+ //# sourceMappingURL=event-list.js.map
@@ -0,0 +1,104 @@
1
+ import auth from '../../../../Auth.js';
2
+ import request from '../../../../request.js';
3
+ import { accessToken } from '../../../../utils/accessToken.js';
4
+ import { validation } from '../../../../utils/validation.js';
5
+ import GraphCommand from '../../../base/GraphCommand.js';
6
+ import commands from '../../commands.js';
7
+ import { cli } from '../../../../cli/cli.js';
8
+ import { globalOptionsZod } from '../../../../Command.js';
9
+ import { z } from 'zod';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ id: z.string().alias('i'),
13
+ userId: z.string().refine(id => validation.isValidGuid(id), {
14
+ error: e => `'${e.input}' is not a valid GUID.`
15
+ }).optional(),
16
+ userName: z.string()
17
+ .refine(upn => validation.isValidUserPrincipalName(upn) === true, {
18
+ error: e => `'${e.input}' is not a valid user principal name for option 'userName'.`
19
+ })
20
+ .optional(),
21
+ permanent: z.boolean().optional(),
22
+ force: z.boolean().optional().alias('f')
23
+ });
24
+ class OutlookEventRemoveCommand extends GraphCommand {
25
+ get name() {
26
+ return commands.EVENT_REMOVE;
27
+ }
28
+ get description() {
29
+ return 'Removes an event from a calendar';
30
+ }
31
+ get schema() {
32
+ return options;
33
+ }
34
+ getRefinedSchema(schema) {
35
+ return schema.refine(options => !options.userId || !options.userName, {
36
+ error: 'Specify either userId or userName, but not both.'
37
+ });
38
+ }
39
+ async commandAction(logger, args) {
40
+ const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken);
41
+ const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
42
+ if (isAppOnlyAccessToken) {
43
+ if (!args.options.userId && !args.options.userName) {
44
+ throw `The option 'userId' or 'userName' is required when removing an event using application permissions.`;
45
+ }
46
+ }
47
+ else {
48
+ if (args.options.userId) {
49
+ const currentUserId = accessToken.getUserIdFromAccessToken(token);
50
+ if (args.options.userId !== currentUserId) {
51
+ throw `You can only remove your own events when using delegated permissions. The specified userId '${args.options.userId}' does not match the current user '${currentUserId}'.`;
52
+ }
53
+ }
54
+ if (args.options.userName) {
55
+ const currentUserName = accessToken.getUserNameFromAccessToken(token);
56
+ if (args.options.userName.toLowerCase() !== currentUserName.toLowerCase()) {
57
+ throw `You can only remove your own events when using delegated permissions. The specified userName '${args.options.userName}' does not match the current user '${currentUserName}'.`;
58
+ }
59
+ }
60
+ }
61
+ let principalUrl = '';
62
+ const userIdentifier = args.options.userId ?? args.options.userName;
63
+ if (userIdentifier) {
64
+ principalUrl += `users('${userIdentifier}')`;
65
+ }
66
+ else {
67
+ principalUrl += 'me';
68
+ }
69
+ const removeEvent = async () => {
70
+ try {
71
+ if (this.verbose) {
72
+ await logger.logToStderr(`Removing event with id '${args.options.id}'...`);
73
+ }
74
+ const requestOptions = {
75
+ url: `${this.resource}/v1.0/${principalUrl}/events/${args.options.id}`,
76
+ headers: {
77
+ accept: 'application/json;odata.metadata=none'
78
+ }
79
+ };
80
+ if (args.options.permanent) {
81
+ requestOptions.url += '/permanentDelete';
82
+ await request.post(requestOptions);
83
+ }
84
+ else {
85
+ await request.delete(requestOptions);
86
+ }
87
+ }
88
+ catch (err) {
89
+ this.handleRejectedODataJsonPromise(err);
90
+ }
91
+ };
92
+ if (args.options.force) {
93
+ await removeEvent();
94
+ }
95
+ else {
96
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove event with id '${args.options.id}'?` });
97
+ if (result) {
98
+ await removeEvent();
99
+ }
100
+ }
101
+ }
102
+ }
103
+ export default new OutlookEventRemoveCommand();
104
+ //# sourceMappingURL=event-remove.js.map
@@ -1,6 +1,13 @@
1
1
  const prefix = 'outlook';
2
2
  export default {
3
+ CALENDAR_ADD: `${prefix} calendar add`,
4
+ CALENDAR_GET: `${prefix} calendar get`,
5
+ CALENDAR_REMOVE: `${prefix} calendar remove`,
3
6
  CALENDARGROUP_LIST: `${prefix} calendargroup list`,
7
+ CALENDARGROUP_SET: `${prefix} calendargroup set`,
8
+ EVENT_CANCEL: `${prefix} event cancel`,
9
+ EVENT_LIST: `${prefix} event list`,
10
+ EVENT_REMOVE: `${prefix} event remove`,
4
11
  MAIL_SEARCHFOLDER_ADD: `${prefix} mail searchfolder add`,
5
12
  MAIL_SEND: `${prefix} mail send`,
6
13
  MAILBOX_SETTINGS_GET: `${prefix} mailbox settings get`,