@pnp/cli-microsoft365 11.9.0-beta.8c1ee05 → 11.9.0-beta.9bd71dd

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 (153) hide show
  1. package/.devcontainer/Dockerfile +2 -2
  2. package/.devproxy/api-specs/sharepoint.yaml +166 -0
  3. package/allCommands.json +1 -1
  4. package/allCommandsFull.json +1 -1
  5. package/dist/m365/cli/commands/app/app-reconsent.js +8 -0
  6. package/dist/m365/cli/commands/cli-consent.js +8 -31
  7. package/dist/m365/cli/commands/cli-doctor.js +6 -1
  8. package/dist/m365/cli/commands/cli-issue.js +8 -36
  9. package/dist/m365/cli/commands/completion/completion-clink-update.js +8 -0
  10. package/dist/m365/cli/commands/completion/completion-pwsh-setup.js +8 -16
  11. package/dist/m365/cli/commands/completion/completion-pwsh-update.js +8 -0
  12. package/dist/m365/cli/commands/completion/completion-sh-setup.js +8 -0
  13. package/dist/m365/cli/commands/completion/completion-sh-update.js +8 -0
  14. package/dist/m365/cli/commands/config/config-get.js +9 -32
  15. package/dist/m365/cli/commands/config/config-list.js +8 -0
  16. package/dist/m365/cli/commands/config/config-reset.js +9 -34
  17. package/dist/m365/cli/commands/config/config-set.js +86 -70
  18. package/dist/m365/commands/request.js +26 -60
  19. package/dist/m365/commands/search.js +59 -77
  20. package/dist/m365/commands/setup.js +16 -31
  21. package/dist/m365/commands/version.js +6 -0
  22. package/dist/m365/connection/commands/connection-remove.js +9 -29
  23. package/dist/m365/connection/commands/connection-use.js +8 -26
  24. package/dist/m365/context/commands/context-init.js +6 -0
  25. package/dist/m365/context/commands/option/option-set.js +9 -18
  26. package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-add.js +32 -63
  27. package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-get.js +21 -45
  28. package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-list.js +32 -53
  29. package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-remove.js +34 -74
  30. package/dist/m365/entra/commands/administrativeunit/administrativeunit-roleassignment-add.js +37 -57
  31. package/dist/m365/entra/commands/approleassignment/approleassignment-add.js +23 -48
  32. package/dist/m365/entra/commands/approleassignment/approleassignment-list.js +20 -43
  33. package/dist/m365/entra/commands/approleassignment/approleassignment-remove.js +24 -51
  34. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +20 -43
  35. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +20 -43
  36. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +9 -25
  37. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-remove.js +21 -50
  38. package/dist/m365/entra/commands/groupsetting/groupsetting-add.js +9 -25
  39. package/dist/m365/entra/commands/groupsetting/groupsetting-get.js +8 -24
  40. package/dist/m365/entra/commands/groupsetting/groupsetting-list.js +6 -0
  41. package/dist/m365/entra/commands/groupsetting/groupsetting-remove.js +9 -33
  42. package/dist/m365/entra/commands/groupsetting/groupsetting-set.js +8 -24
  43. package/dist/m365/entra/commands/groupsettingtemplate/groupsettingtemplate-get.js +19 -38
  44. package/dist/m365/entra/commands/groupsettingtemplate/groupsettingtemplate-list.js +6 -0
  45. package/dist/m365/entra/commands/multitenant/multitenant-get.js +8 -1
  46. package/dist/m365/entra/commands/multitenant/multitenant-remove.js +8 -22
  47. package/dist/m365/entra/commands/multitenant/multitenant-set.js +15 -36
  48. package/dist/m365/entra/commands/oauth2grant/oauth2grant-add.js +10 -31
  49. package/dist/m365/entra/commands/oauth2grant/oauth2grant-list.js +8 -24
  50. package/dist/m365/entra/commands/oauth2grant/oauth2grant-remove.js +9 -17
  51. package/dist/m365/entra/commands/oauth2grant/oauth2grant-set.js +9 -17
  52. package/dist/m365/entra/commands/pim/pim-role-assignment-add.js +68 -114
  53. package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +28 -55
  54. package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +30 -57
  55. package/dist/m365/entra/commands/pim/pim-role-assignment-remove.js +50 -90
  56. package/dist/m365/entra/commands/pim/pim-role-request-list.js +36 -69
  57. package/dist/m365/entra/commands/policy/policy-list.js +13 -56
  58. package/dist/m365/entra/commands/user/user-add.js +39 -118
  59. package/dist/m365/entra/commands/user/user-get.js +24 -49
  60. package/dist/m365/entra/commands/user/user-groupmembership-list.js +25 -48
  61. package/dist/m365/entra/commands/user/user-guest-add.js +14 -39
  62. package/dist/m365/entra/commands/user/user-hibp.js +12 -34
  63. package/dist/m365/entra/commands/user/user-license-add.js +23 -42
  64. package/dist/m365/entra/commands/user/user-license-list.js +21 -42
  65. package/dist/m365/entra/commands/user/user-license-remove.js +25 -47
  66. package/dist/m365/entra/commands/user/user-list.js +12 -39
  67. package/dist/m365/entra/commands/user/user-password-validate.js +8 -15
  68. package/dist/m365/entra/commands/user/user-recyclebinitem-clear.js +8 -22
  69. package/dist/m365/entra/commands/user/user-recyclebinitem-remove.js +9 -33
  70. package/dist/m365/entra/commands/user/user-recyclebinitem-restore.js +8 -24
  71. package/dist/m365/entra/commands/user/user-registrationdetails-list.js +43 -113
  72. package/dist/m365/entra/commands/user/user-remove.js +22 -42
  73. package/dist/m365/entra/commands/user/user-set.js +69 -149
  74. package/dist/m365/entra/commands/user/user-signin-list.js +22 -51
  75. package/dist/m365/external/commands/connection/connection-add.js +40 -65
  76. package/dist/m365/external/commands/connection/connection-doctor.js +14 -30
  77. package/dist/m365/external/commands/connection/connection-get.js +19 -28
  78. package/dist/m365/external/commands/connection/connection-remove.js +20 -25
  79. package/dist/m365/external/commands/connection/connection-schema-add.js +53 -42
  80. package/dist/m365/external/commands/connection/connection-urltoitemresolver-add.js +12 -23
  81. package/dist/m365/external/commands/item/item-add.js +37 -60
  82. package/dist/m365/file/commands/convert/convert-pdf.js +18 -33
  83. package/dist/m365/file/commands/file-add.js +28 -34
  84. package/dist/m365/file/commands/file-copy.js +18 -34
  85. package/dist/m365/file/commands/file-list.js +18 -24
  86. package/dist/m365/file/commands/file-move.js +22 -35
  87. package/dist/m365/flow/commands/flow-disable.js +10 -26
  88. package/dist/m365/flow/commands/flow-enable.js +10 -26
  89. package/dist/m365/flow/commands/flow-export.js +45 -71
  90. package/dist/m365/flow/commands/flow-get.js +10 -26
  91. package/dist/m365/flow/commands/flow-list.js +17 -48
  92. package/dist/m365/flow/commands/flow-remove.js +11 -38
  93. package/dist/m365/flow/commands/owner/owner-ensure.js +30 -65
  94. package/dist/m365/flow/commands/owner/owner-list.js +10 -35
  95. package/dist/m365/flow/commands/owner/owner-remove.js +30 -61
  96. package/dist/m365/flow/commands/run/run-cancel.js +11 -37
  97. package/dist/m365/flow/commands/run/run-get.js +12 -43
  98. package/dist/m365/flow/commands/run/run-list.js +29 -61
  99. package/dist/m365/flow/commands/run/run-resubmit.js +11 -37
  100. package/dist/m365/graph/commands/changelog/changelog-list.js +68 -67
  101. package/dist/m365/graph/commands/schemaextension/schemaextension-add.js +25 -31
  102. package/dist/m365/graph/commands/schemaextension/schemaextension-get.js +8 -15
  103. package/dist/m365/graph/commands/schemaextension/schemaextension-list.js +26 -50
  104. package/dist/m365/graph/commands/schemaextension/schemaextension-remove.js +9 -24
  105. package/dist/m365/graph/commands/schemaextension/schemaextension-set.js +32 -53
  106. package/dist/m365/graph/commands/subscription/subscription-add.js +63 -89
  107. package/dist/m365/outlook/commands/calendar/calendar-get.js +1 -1
  108. package/dist/m365/outlook/commands/calendar/calendar-list.js +64 -0
  109. package/dist/m365/outlook/commands/mail/mail-send.js +55 -84
  110. package/dist/m365/outlook/commands/message/message-get.js +27 -27
  111. package/dist/m365/outlook/commands/message/message-list.js +53 -80
  112. package/dist/m365/outlook/commands/message/message-move.js +43 -40
  113. package/dist/m365/outlook/commands/message/message-remove.js +17 -45
  114. package/dist/m365/outlook/commands.js +1 -0
  115. package/dist/m365/spe/commands/container/container-get.js +54 -26
  116. package/dist/m365/spe/commands/container/container-permission-list.js +43 -4
  117. package/dist/m365/spe/commands/container/container-set.js +77 -0
  118. package/dist/m365/spe/commands.js +1 -0
  119. package/dist/m365/spo/commands/file/file-unarchive.js +83 -0
  120. package/dist/m365/spo/commands/folder/folder-archive.js +89 -0
  121. package/dist/m365/spo/commands/list/list-sensitivitylabel-remove.js +83 -0
  122. package/dist/m365/spo/commands.js +3 -0
  123. package/dist/m365/viva/commands/engage/engage-role-member-add.js +79 -0
  124. package/dist/m365/viva/commands.js +1 -0
  125. package/docs/docs/cmd/outlook/calendar/calendar-get.mdx +7 -7
  126. package/docs/docs/cmd/outlook/calendar/calendar-list.mdx +155 -0
  127. package/docs/docs/cmd/spe/container/container-get.mdx +24 -3
  128. package/docs/docs/cmd/spe/container/container-permission-list.mdx +24 -3
  129. package/docs/docs/cmd/spe/container/container-set.mdx +160 -0
  130. package/docs/docs/cmd/spo/app/app-add.mdx +19 -0
  131. package/docs/docs/cmd/spo/app/app-deploy.mdx +21 -0
  132. package/docs/docs/cmd/spo/app/app-get.mdx +19 -0
  133. package/docs/docs/cmd/spo/app/app-install.mdx +21 -0
  134. package/docs/docs/cmd/spo/app/app-instance-list.mdx +19 -0
  135. package/docs/docs/cmd/spo/app/app-list.mdx +19 -0
  136. package/docs/docs/cmd/spo/app/app-remove.mdx +21 -0
  137. package/docs/docs/cmd/spo/app/app-retract.mdx +21 -0
  138. package/docs/docs/cmd/spo/app/app-teamspackage-download.mdx +21 -0
  139. package/docs/docs/cmd/spo/app/app-uninstall.mdx +21 -0
  140. package/docs/docs/cmd/spo/app/app-upgrade.mdx +21 -0
  141. package/docs/docs/cmd/spo/apppage/apppage-add.mdx +19 -1
  142. package/docs/docs/cmd/spo/apppage/apppage-set.mdx +21 -0
  143. package/docs/docs/cmd/spo/commandset/commandset-add.mdx +19 -0
  144. package/docs/docs/cmd/spo/commandset/commandset-get.mdx +19 -0
  145. package/docs/docs/cmd/spo/commandset/commandset-list.mdx +19 -0
  146. package/docs/docs/cmd/spo/commandset/commandset-remove.mdx +21 -0
  147. package/docs/docs/cmd/spo/commandset/commandset-set.mdx +21 -0
  148. package/docs/docs/cmd/spo/file/file-unarchive.mdx +68 -0
  149. package/docs/docs/cmd/spo/folder/folder-archive.mdx +73 -0
  150. package/docs/docs/cmd/spo/list/list-sensitivitylabel-remove.mdx +77 -0
  151. package/docs/docs/cmd/viva/engage/engage-role-member-add.mdx +76 -0
  152. package/npm-shrinkwrap.json +280 -128
  153. package/package.json +18 -18
@@ -1,13 +1,16 @@
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 _GraphSchemaExtensionListCommand_instances, _GraphSchemaExtensionListCommand_initTelemetry, _GraphSchemaExtensionListCommand_initOptions, _GraphSchemaExtensionListCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { validation } from '../../../../utils/validation.js';
9
5
  import GraphCommand from '../../../base/GraphCommand.js';
10
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ status: z.enum(['Available', 'InDevelopment', 'Deprecated']).optional().alias('s'),
10
+ owner: z.string().optional(),
11
+ pageSize: z.string().optional().alias('p'),
12
+ pageNumber: z.string().optional().alias('n')
13
+ });
11
14
  class GraphSchemaExtensionListCommand extends GraphCommand {
12
15
  get name() {
13
16
  return commands.SCHEMAEXTENSION_LIST;
@@ -15,12 +18,23 @@ class GraphSchemaExtensionListCommand extends GraphCommand {
15
18
  get description() {
16
19
  return 'Get a list of schemaExtension objects created in the current tenant, that can be InDevelopment, Available, or Deprecated.';
17
20
  }
18
- constructor() {
19
- super();
20
- _GraphSchemaExtensionListCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _GraphSchemaExtensionListCommand_instances, "m", _GraphSchemaExtensionListCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _GraphSchemaExtensionListCommand_instances, "m", _GraphSchemaExtensionListCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _GraphSchemaExtensionListCommand_instances, "m", _GraphSchemaExtensionListCommand_initValidators).call(this);
21
+ get schema() {
22
+ return options;
23
+ }
24
+ getRefinedSchema(schema) {
25
+ return schema
26
+ .refine(options => !options.owner || validation.isValidGuid(options.owner), {
27
+ error: e => `${e.input.owner} is not a valid GUID`,
28
+ path: ['owner']
29
+ })
30
+ .refine(options => !options.pageNumber || parseInt(options.pageNumber) >= 1, {
31
+ error: 'pageNumber must be a positive number',
32
+ path: ['pageNumber']
33
+ })
34
+ .refine(options => !options.pageSize || parseInt(options.pageSize) >= 1, {
35
+ error: 'pageSize must be a positive number',
36
+ path: ['pageSize']
37
+ });
24
38
  }
25
39
  async commandAction(logger, args) {
26
40
  const filter = this.getFilter(args.options);
@@ -79,43 +93,5 @@ class GraphSchemaExtensionListCommand extends GraphCommand {
79
93
  return filter;
80
94
  }
81
95
  }
82
- _GraphSchemaExtensionListCommand_instances = new WeakSet(), _GraphSchemaExtensionListCommand_initTelemetry = function _GraphSchemaExtensionListCommand_initTelemetry() {
83
- this.telemetry.push((args) => {
84
- Object.assign(this.telemetryProperties, {
85
- status: typeof args.options.status !== 'undefined',
86
- owner: typeof args.options.owner !== 'undefined',
87
- pageNumber: typeof args.options.pageNumber !== 'undefined',
88
- pageSize: typeof args.options.pageSize !== 'undefined'
89
- });
90
- });
91
- }, _GraphSchemaExtensionListCommand_initOptions = function _GraphSchemaExtensionListCommand_initOptions() {
92
- this.options.unshift({
93
- option: '-s, --status [status]',
94
- autocomplete: ['Available', 'InDevelopment', 'Deprecated']
95
- }, {
96
- option: '--owner [owner]'
97
- }, {
98
- option: '-p, --pageSize [pageSize]'
99
- }, {
100
- option: '-n, --pageNumber [pageNumber]'
101
- });
102
- }, _GraphSchemaExtensionListCommand_initValidators = function _GraphSchemaExtensionListCommand_initValidators() {
103
- this.validators.push(async (args) => {
104
- if (args.options.owner && !validation.isValidGuid(args.options.owner)) {
105
- return `${args.options.owner} is not a valid GUID`;
106
- }
107
- if (args.options.pageNumber && parseInt(args.options.pageNumber) < 1) {
108
- return 'pageNumber must be a positive number';
109
- }
110
- if (args.options.pageSize && parseInt(args.options.pageSize) < 1) {
111
- return 'pageSize must be a positive number';
112
- }
113
- if (args.options.status &&
114
- ['Available', 'InDevelopment', 'Deprecated'].indexOf(args.options.status) === -1) {
115
- return `${args.options.status} is not a valid status value. Allowed values are Available|InDevelopment|Deprecated`;
116
- }
117
- return true;
118
- });
119
- };
120
96
  export default new GraphSchemaExtensionListCommand();
121
97
  //# sourceMappingURL=schemaextension-list.js.map
@@ -1,13 +1,14 @@
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 _GraphSchemaExtensionRemoveCommand_instances, _GraphSchemaExtensionRemoveCommand_initTelemetry, _GraphSchemaExtensionRemoveCommand_initOptions;
1
+ import { z } from 'zod';
7
2
  import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
5
  import GraphCommand from '../../../base/GraphCommand.js';
10
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ id: z.string().alias('i'),
10
+ force: z.boolean().optional().alias('f')
11
+ });
11
12
  class GraphSchemaExtensionRemoveCommand extends GraphCommand {
12
13
  get name() {
13
14
  return commands.SCHEMAEXTENSION_REMOVE;
@@ -15,11 +16,8 @@ class GraphSchemaExtensionRemoveCommand extends GraphCommand {
15
16
  get description() {
16
17
  return 'Removes specified Microsoft Graph schema extension';
17
18
  }
18
- constructor() {
19
- super();
20
- _GraphSchemaExtensionRemoveCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _GraphSchemaExtensionRemoveCommand_instances, "m", _GraphSchemaExtensionRemoveCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _GraphSchemaExtensionRemoveCommand_instances, "m", _GraphSchemaExtensionRemoveCommand_initOptions).call(this);
19
+ get schema() {
20
+ return options;
23
21
  }
24
22
  async commandAction(logger, args) {
25
23
  const removeSchemaExtension = async () => {
@@ -52,18 +50,5 @@ class GraphSchemaExtensionRemoveCommand extends GraphCommand {
52
50
  }
53
51
  }
54
52
  }
55
- _GraphSchemaExtensionRemoveCommand_instances = new WeakSet(), _GraphSchemaExtensionRemoveCommand_initTelemetry = function _GraphSchemaExtensionRemoveCommand_initTelemetry() {
56
- this.telemetry.push((args) => {
57
- Object.assign(this.telemetryProperties, {
58
- force: typeof args.options.force !== 'undefined'
59
- });
60
- });
61
- }, _GraphSchemaExtensionRemoveCommand_initOptions = function _GraphSchemaExtensionRemoveCommand_initOptions() {
62
- this.options.unshift({
63
- option: '-i, --id <id>'
64
- }, {
65
- option: '-f, --force'
66
- });
67
- };
68
53
  export default new GraphSchemaExtensionRemoveCommand();
69
54
  //# sourceMappingURL=schemaextension-remove.js.map
@@ -1,13 +1,18 @@
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 _GraphSchemaExtensionSetCommand_instances, _GraphSchemaExtensionSetCommand_initTelemetry, _GraphSchemaExtensionSetCommand_initOptions, _GraphSchemaExtensionSetCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { validation } from '../../../../utils/validation.js';
9
5
  import GraphCommand from '../../../base/GraphCommand.js';
10
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ id: z.string().alias('i'),
10
+ owner: z.string(),
11
+ description: z.string().optional().alias('d'),
12
+ status: z.enum(['Available', 'Deprecated']).optional().alias('s'),
13
+ targetTypes: z.string().optional().alias('t'),
14
+ properties: z.string().optional().alias('p')
15
+ });
11
16
  class GraphSchemaExtensionSetCommand extends GraphCommand {
12
17
  get name() {
13
18
  return commands.SCHEMAEXTENSION_SET;
@@ -15,12 +20,27 @@ class GraphSchemaExtensionSetCommand extends GraphCommand {
15
20
  get description() {
16
21
  return 'Updates a Microsoft Graph schema extension';
17
22
  }
18
- constructor() {
19
- super();
20
- _GraphSchemaExtensionSetCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _GraphSchemaExtensionSetCommand_instances, "m", _GraphSchemaExtensionSetCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _GraphSchemaExtensionSetCommand_instances, "m", _GraphSchemaExtensionSetCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _GraphSchemaExtensionSetCommand_instances, "m", _GraphSchemaExtensionSetCommand_initValidators).call(this);
23
+ get schema() {
24
+ return options;
25
+ }
26
+ getRefinedSchema(schema) {
27
+ return schema
28
+ .refine(options => validation.isValidGuid(options.owner), {
29
+ error: e => `The specified owner '${e.input.owner}' is not a valid App Id`,
30
+ path: ['owner']
31
+ })
32
+ .refine(options => options.status || options.properties || options.targetTypes || options.description, {
33
+ error: 'No updates were specified. Please specify at least one argument among --status, --targetTypes, --description or --properties'
34
+ })
35
+ .refine(options => {
36
+ if (!options.properties) {
37
+ return true;
38
+ }
39
+ return this.validateProperties(options.properties) === true;
40
+ }, {
41
+ error: e => `${this.validateProperties(e.input.properties)}`,
42
+ path: ['properties']
43
+ });
24
44
  }
25
45
  async commandAction(logger, args) {
26
46
  if (this.verbose) {
@@ -113,46 +133,5 @@ class GraphSchemaExtensionSetCommand extends GraphCommand {
113
133
  return ['Binary', 'Boolean', 'DateTime', 'Integer', 'String'].indexOf(propertyType) > -1;
114
134
  }
115
135
  }
116
- _GraphSchemaExtensionSetCommand_instances = new WeakSet(), _GraphSchemaExtensionSetCommand_initTelemetry = function _GraphSchemaExtensionSetCommand_initTelemetry() {
117
- this.telemetry.push((args) => {
118
- Object.assign(this.telemetryProperties, {
119
- description: typeof args.options.description !== 'undefined',
120
- properties: typeof args.options.properties !== 'undefined',
121
- targetTypes: typeof args.options.targetTypes !== 'undefined',
122
- status: args.options.status
123
- });
124
- });
125
- }, _GraphSchemaExtensionSetCommand_initOptions = function _GraphSchemaExtensionSetCommand_initOptions() {
126
- this.options.unshift({
127
- option: '-i, --id <id>'
128
- }, {
129
- option: '--owner <owner>'
130
- }, {
131
- option: '-d, --description [description]'
132
- }, {
133
- option: '-s, --status [status]'
134
- }, {
135
- option: '-t, --targetTypes [targetTypes]'
136
- }, {
137
- option: '-p, --properties [properties]'
138
- });
139
- }, _GraphSchemaExtensionSetCommand_initValidators = function _GraphSchemaExtensionSetCommand_initValidators() {
140
- this.validators.push(async (args) => {
141
- if (!validation.isValidGuid(args.options.owner)) {
142
- return `The specified owner '${args.options.owner}' is not a valid App Id`;
143
- }
144
- if (!args.options.status && !args.options.properties && !args.options.targetTypes && !args.options.description) {
145
- return `No updates were specified. Please specify at least one argument among --status, --targetTypes, --description or --properties`;
146
- }
147
- const validStatusValues = ['Available', 'Deprecated'];
148
- if (args.options.status && validStatusValues.indexOf(args.options.status) < 0) {
149
- return `Status option is invalid. Valid statuses are: Available or Deprecated`;
150
- }
151
- if (args.options.properties) {
152
- return this.validateProperties(args.options.properties);
153
- }
154
- return true;
155
- });
156
- };
157
136
  export default new GraphSchemaExtensionSetCommand();
158
137
  //# sourceMappingURL=schemaextension-set.js.map
@@ -1,13 +1,24 @@
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 _GraphSubscriptionAddCommand_instances, _GraphSubscriptionAddCommand_initTelemetry, _GraphSubscriptionAddCommand_initOptions, _GraphSubscriptionAddCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { validation } from '../../../../utils/validation.js';
9
5
  import GraphCommand from '../../../base/GraphCommand.js';
10
6
  import commands from '../../commands.js';
7
+ const allowedTlsVersions = ['v1_0', 'v1_1', 'v1_2', 'v1_3'];
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ resource: z.string().alias('r'),
11
+ notificationUrl: z.string().alias('u'),
12
+ changeTypes: z.string().alias('c'),
13
+ expirationDateTime: z.string().optional().alias('e'),
14
+ clientState: z.string().optional().alias('s'),
15
+ lifecycleNotificationUrl: z.string().optional(),
16
+ notificationUrlAppId: z.string().optional(),
17
+ latestTLSVersion: z.enum(allowedTlsVersions).optional(),
18
+ withResourceData: z.boolean().optional(),
19
+ encryptionCertificate: z.string().optional(),
20
+ encryptionCertificateId: z.string().optional()
21
+ });
11
22
  const DEFAULT_EXPIRATION_DELAY_IN_MINUTES_PER_RESOURCE_TYPE = {
12
23
  // User, group, other directory resources 4230 minutes (under 3 days)
13
24
  "users": 4230,
@@ -34,13 +45,52 @@ class GraphSubscriptionAddCommand extends GraphCommand {
34
45
  get description() {
35
46
  return 'Creates a Microsoft Graph subscription';
36
47
  }
37
- constructor() {
38
- super();
39
- _GraphSubscriptionAddCommand_instances.add(this);
40
- this.allowedTlsVersions = ['v1_0', 'v1_1', 'v1_2', 'v1_3'];
41
- __classPrivateFieldGet(this, _GraphSubscriptionAddCommand_instances, "m", _GraphSubscriptionAddCommand_initTelemetry).call(this);
42
- __classPrivateFieldGet(this, _GraphSubscriptionAddCommand_instances, "m", _GraphSubscriptionAddCommand_initOptions).call(this);
43
- __classPrivateFieldGet(this, _GraphSubscriptionAddCommand_instances, "m", _GraphSubscriptionAddCommand_initValidators).call(this);
48
+ get schema() {
49
+ return options;
50
+ }
51
+ getRefinedSchema(schema) {
52
+ return schema
53
+ .refine(options => {
54
+ const url = options.notificationUrl.toLowerCase();
55
+ return url.startsWith('https://') || url.startsWith('eventhub:https://') || url.startsWith('eventgrid:?azuresubscriptionid=');
56
+ }, {
57
+ error: e => `The specified notification URL '${e.input.notificationUrl}' does not start with either 'https://' or 'EventHub:https://' or 'EventGrid:?azuresubscriptionid='`,
58
+ path: ['notificationUrl']
59
+ })
60
+ .refine(options => this.isValidChangeTypes(options.changeTypes), {
61
+ error: `The specified changeTypes are invalid. Valid options are 'created', 'updated' and 'deleted'`,
62
+ path: ['changeTypes']
63
+ })
64
+ .refine(options => !options.expirationDateTime || validation.isValidISODateTime(options.expirationDateTime), {
65
+ error: 'The expirationDateTime is not a valid ISO date string',
66
+ path: ['expirationDateTime']
67
+ })
68
+ .refine(options => !options.clientState || options.clientState.length <= 128, {
69
+ error: 'The clientState value exceeds the maximum length of 128 characters',
70
+ path: ['clientState']
71
+ })
72
+ .refine(options => {
73
+ if (!options.lifecycleNotificationUrl) {
74
+ return true;
75
+ }
76
+ const url = options.lifecycleNotificationUrl.toLowerCase();
77
+ return url.startsWith('https://') || url.startsWith('eventhub:https://') || url.startsWith('eventgrid:?azuresubscriptionid=');
78
+ }, {
79
+ error: e => `The lifecycle notification URL '${e.input.lifecycleNotificationUrl}' does not start with either 'https://' or 'EventHub:https://' or 'EventGrid:?azuresubscriptionid='`,
80
+ path: ['lifecycleNotificationUrl']
81
+ })
82
+ .refine(options => !options.withResourceData || options.encryptionCertificate, {
83
+ error: `The 'encryptionCertificate' options is required to include the changed resource data`,
84
+ path: ['encryptionCertificate']
85
+ })
86
+ .refine(options => !options.withResourceData || options.encryptionCertificateId, {
87
+ error: `The 'encryptionCertificateId' options is required to include the changed resource data`,
88
+ path: ['encryptionCertificateId']
89
+ })
90
+ .refine(options => !options.notificationUrlAppId || validation.isValidGuid(options.notificationUrlAppId), {
91
+ error: e => `${e.input.notificationUrlAppId} is not a valid GUID for the 'notificationUrlAppId'`,
92
+ path: ['notificationUrlAppId']
93
+ });
44
94
  }
45
95
  async commandAction(logger, args) {
46
96
  const data = {
@@ -123,81 +173,5 @@ class GraphSubscriptionAddCommand extends GraphCommand {
123
173
  return invalidChangesTypes.length === 0;
124
174
  }
125
175
  }
126
- _GraphSubscriptionAddCommand_instances = new WeakSet(), _GraphSubscriptionAddCommand_initTelemetry = function _GraphSubscriptionAddCommand_initTelemetry() {
127
- this.telemetry.push((args) => {
128
- Object.assign(this.telemetryProperties, {
129
- changeTypes: args.options.changeTypes,
130
- expirationDateTime: typeof args.options.expirationDateTime !== 'undefined',
131
- clientState: typeof args.options.clientState !== 'undefined',
132
- lifecycleNotificationUrl: typeof args.options.lifecycleNotificationUrl !== 'undefined',
133
- notificationUrlAppId: typeof args.options.notificationUrlAppId !== 'undefined',
134
- latestTLSVersion: typeof args.options.latestTLSVersion !== 'undefined',
135
- withResourceData: !!args.options.withResourceData,
136
- encryptionCertificate: typeof args.options.encryptionCertificate !== 'undefined',
137
- encryptionCertificateId: typeof args.options.encryptionCertificateId !== 'undefined'
138
- });
139
- });
140
- }, _GraphSubscriptionAddCommand_initOptions = function _GraphSubscriptionAddCommand_initOptions() {
141
- this.options.unshift({
142
- option: '-r, --resource <resource>'
143
- }, {
144
- option: '-u, --notificationUrl <notificationUrl>'
145
- }, {
146
- option: '-c, --changeTypes <changeTypes>',
147
- autocomplete: ['created', 'updated', 'deleted']
148
- }, {
149
- option: '-e, --expirationDateTime [expirationDateTime]'
150
- }, {
151
- option: '-s, --clientState [clientState]'
152
- }, {
153
- option: '--lifecycleNotificationUrl [lifecycleNotificationUrl]'
154
- }, {
155
- option: '--notificationUrlAppId [notificationUrlAppId]'
156
- }, {
157
- option: '--latestTLSVersion [latestTLSVersion]',
158
- autocomplete: this.allowedTlsVersions
159
- }, {
160
- option: '--withResourceData [withResourceData]'
161
- }, {
162
- option: '--encryptionCertificate [encryptionCertificate]'
163
- }, {
164
- option: '--encryptionCertificateId [encryptionCertificateId]'
165
- });
166
- }, _GraphSubscriptionAddCommand_initValidators = function _GraphSubscriptionAddCommand_initValidators() {
167
- this.validators.push(async (args) => {
168
- if (!args.options.notificationUrl.toLowerCase().startsWith('https://')
169
- && !args.options.notificationUrl.toLowerCase().startsWith('eventhub:https://')
170
- && !args.options.notificationUrl.toLowerCase().startsWith('eventgrid:?azuresubscriptionid=')) {
171
- return `The specified notification URL '${args.options.notificationUrl}' does not start with either 'https://' or 'EventHub:https://' or 'EventGrid:?azuresubscriptionid='`;
172
- }
173
- if (!this.isValidChangeTypes(args.options.changeTypes)) {
174
- return `The specified changeTypes are invalid. Valid options are 'created', 'updated' and 'deleted'`;
175
- }
176
- if (args.options.expirationDateTime && !validation.isValidISODateTime(args.options.expirationDateTime)) {
177
- return 'The expirationDateTime is not a valid ISO date string';
178
- }
179
- if (args.options.clientState && args.options.clientState.length > 128) {
180
- return 'The clientState value exceeds the maximum length of 128 characters';
181
- }
182
- if (args.options.lifecycleNotificationUrl && !args.options.lifecycleNotificationUrl.toLowerCase().startsWith('https://')
183
- && !args.options.lifecycleNotificationUrl.toLowerCase().startsWith('eventhub:https://')
184
- && !args.options.lifecycleNotificationUrl.toLowerCase().startsWith('eventgrid:?azuresubscriptionid=')) {
185
- return `The lifecycle notification URL '${args.options.lifecycleNotificationUrl}' does not start with either 'https://' or 'EventHub:https://' or 'EventGrid:?azuresubscriptionid='`;
186
- }
187
- if (args.options.latestTLSVersion && this.allowedTlsVersions.map(x => x.toLowerCase()).indexOf(args.options.latestTLSVersion.toLowerCase()) === -1) {
188
- return `${args.options.latestTLSVersion} is not a valid TLS version. Allowed values are ${this.allowedTlsVersions.join(', ')}`;
189
- }
190
- if (args.options.withResourceData && !args.options.encryptionCertificate) {
191
- return `The 'encryptionCertificate' options is required to include the changed resource data`;
192
- }
193
- if (args.options.withResourceData && !args.options.encryptionCertificateId) {
194
- return `The 'encryptionCertificateId' options is required to include the changed resource data`;
195
- }
196
- if (args.options.notificationUrlAppId && !validation.isValidGuid(args.options.notificationUrlAppId)) {
197
- return `${args.options.notificationUrlAppId} is not a valid GUID for the 'notificationUrlAppId'`;
198
- }
199
- return true;
200
- });
201
- };
202
176
  export default new GraphSubscriptionAddCommand();
203
177
  //# sourceMappingURL=subscription-add.js.map
@@ -35,7 +35,7 @@ class OutlookCalendarGetCommand extends GraphCommand {
35
35
  .refine(options => [options.id, options.name].filter(x => x !== undefined).length === 1, {
36
36
  error: 'Specify either id or name, but not both'
37
37
  })
38
- .refine(options => !(options.userId && options.userName), {
38
+ .refine(options => [options.userId, options.userName].filter(x => x !== undefined).length === 1, {
39
39
  error: 'Specify either userId or userName, but not both'
40
40
  })
41
41
  .refine(options => !(options.calendarGroupId && options.calendarGroupName), {
@@ -0,0 +1,64 @@
1
+ import GraphCommand from '../../../base/GraphCommand.js';
2
+ import commands from '../../commands.js';
3
+ import { z } from 'zod';
4
+ import { globalOptionsZod } from '../../../../Command.js';
5
+ import { validation } from '../../../../utils/validation.js';
6
+ import { calendarGroup } from '../../../../utils/calendarGroup.js';
7
+ import { odata } from '../../../../utils/odata.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ userId: z.string()
11
+ .refine(userId => validation.isValidGuid(userId), {
12
+ error: e => `'${e.input}' is not a valid GUID.`
13
+ }).optional(),
14
+ userName: z.string()
15
+ .refine(userName => validation.isValidUserPrincipalName(userName), {
16
+ error: e => `'${e.input}' is not a valid UPN.`
17
+ }).optional(),
18
+ calendarGroupId: z.string().optional(),
19
+ calendarGroupName: z.string().optional()
20
+ });
21
+ class OutlookCalendarListCommand extends GraphCommand {
22
+ get name() {
23
+ return commands.CALENDAR_LIST;
24
+ }
25
+ get description() {
26
+ return 'Retrieves a list of all calendars of a user or a group';
27
+ }
28
+ get schema() {
29
+ return options;
30
+ }
31
+ getRefinedSchema(schema) {
32
+ return schema
33
+ .refine(options => [options.userId, options.userName].filter(x => x !== undefined).length === 1, {
34
+ error: 'Specify either userId or userName, but not both'
35
+ })
36
+ .refine(options => !(options.calendarGroupId && options.calendarGroupName), {
37
+ error: 'Specify either calendarGroupId or calendarGroupName, but not both'
38
+ });
39
+ }
40
+ defaultProperties() {
41
+ return ['id', 'name'];
42
+ }
43
+ async commandAction(logger, args) {
44
+ if (this.verbose) {
45
+ await logger.logToStderr(`Retrieving calendars for ${args.options.userId ?? args.options.userName}...`);
46
+ }
47
+ try {
48
+ const userIdentifier = args.options.userId ?? args.options.userName;
49
+ let calendarGroupId = args.options.calendarGroupId;
50
+ if (args.options.calendarGroupName) {
51
+ const group = await calendarGroup.getUserCalendarGroupByName(userIdentifier, args.options.calendarGroupName, 'id');
52
+ calendarGroupId = group.id;
53
+ }
54
+ const url = `${this.resource}/v1.0/users('${userIdentifier}')/${calendarGroupId ? `calendarGroups/${calendarGroupId}/` : ''}calendars`;
55
+ const calendars = await odata.getAllItems(url);
56
+ await logger.log(calendars);
57
+ }
58
+ catch (err) {
59
+ this.handleRejectedODataJsonPromise(err);
60
+ }
61
+ }
62
+ }
63
+ export default new OutlookCalendarListCommand();
64
+ //# sourceMappingURL=calendar-list.js.map