@pnp/cli-microsoft365 11.9.0-beta.93bd508 → 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 (86) hide show
  1. package/.devcontainer/Dockerfile +2 -2
  2. package/.devproxy/api-specs/sharepoint.yaml +84 -0
  3. package/allCommands.json +1 -1
  4. package/allCommandsFull.json +1 -1
  5. package/dist/m365/entra/commands/approleassignment/approleassignment-add.js +23 -48
  6. package/dist/m365/entra/commands/approleassignment/approleassignment-list.js +20 -43
  7. package/dist/m365/entra/commands/approleassignment/approleassignment-remove.js +24 -51
  8. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +20 -43
  9. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +20 -43
  10. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +9 -25
  11. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-remove.js +21 -50
  12. package/dist/m365/entra/commands/groupsetting/groupsetting-add.js +9 -25
  13. package/dist/m365/entra/commands/groupsetting/groupsetting-get.js +8 -24
  14. package/dist/m365/entra/commands/groupsetting/groupsetting-list.js +6 -0
  15. package/dist/m365/entra/commands/groupsetting/groupsetting-remove.js +9 -33
  16. package/dist/m365/entra/commands/groupsetting/groupsetting-set.js +8 -24
  17. package/dist/m365/entra/commands/groupsettingtemplate/groupsettingtemplate-get.js +19 -38
  18. package/dist/m365/entra/commands/groupsettingtemplate/groupsettingtemplate-list.js +6 -0
  19. package/dist/m365/entra/commands/pim/pim-role-assignment-add.js +68 -114
  20. package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +28 -55
  21. package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +30 -57
  22. package/dist/m365/entra/commands/pim/pim-role-assignment-remove.js +50 -90
  23. package/dist/m365/entra/commands/pim/pim-role-request-list.js +36 -69
  24. package/dist/m365/entra/commands/policy/policy-list.js +13 -56
  25. package/dist/m365/entra/commands/user/user-add.js +39 -118
  26. package/dist/m365/entra/commands/user/user-get.js +24 -49
  27. package/dist/m365/entra/commands/user/user-groupmembership-list.js +25 -48
  28. package/dist/m365/entra/commands/user/user-guest-add.js +14 -39
  29. package/dist/m365/entra/commands/user/user-hibp.js +12 -34
  30. package/dist/m365/entra/commands/user/user-license-add.js +23 -42
  31. package/dist/m365/entra/commands/user/user-license-list.js +21 -42
  32. package/dist/m365/entra/commands/user/user-license-remove.js +25 -47
  33. package/dist/m365/entra/commands/user/user-list.js +12 -39
  34. package/dist/m365/entra/commands/user/user-password-validate.js +8 -15
  35. package/dist/m365/entra/commands/user/user-recyclebinitem-clear.js +8 -22
  36. package/dist/m365/entra/commands/user/user-recyclebinitem-remove.js +9 -33
  37. package/dist/m365/entra/commands/user/user-recyclebinitem-restore.js +8 -24
  38. package/dist/m365/entra/commands/user/user-registrationdetails-list.js +43 -113
  39. package/dist/m365/entra/commands/user/user-remove.js +22 -42
  40. package/dist/m365/entra/commands/user/user-set.js +69 -149
  41. package/dist/m365/entra/commands/user/user-signin-list.js +22 -51
  42. package/dist/m365/external/commands/connection/connection-add.js +40 -65
  43. package/dist/m365/external/commands/connection/connection-doctor.js +14 -30
  44. package/dist/m365/external/commands/connection/connection-get.js +19 -28
  45. package/dist/m365/external/commands/connection/connection-remove.js +20 -25
  46. package/dist/m365/external/commands/connection/connection-schema-add.js +53 -42
  47. package/dist/m365/external/commands/connection/connection-urltoitemresolver-add.js +12 -23
  48. package/dist/m365/external/commands/item/item-add.js +37 -60
  49. package/dist/m365/file/commands/convert/convert-pdf.js +18 -33
  50. package/dist/m365/file/commands/file-add.js +28 -34
  51. package/dist/m365/file/commands/file-copy.js +18 -34
  52. package/dist/m365/file/commands/file-list.js +18 -24
  53. package/dist/m365/file/commands/file-move.js +22 -35
  54. package/dist/m365/flow/commands/flow-disable.js +10 -26
  55. package/dist/m365/flow/commands/flow-enable.js +10 -26
  56. package/dist/m365/flow/commands/flow-export.js +45 -71
  57. package/dist/m365/flow/commands/flow-get.js +10 -26
  58. package/dist/m365/flow/commands/flow-list.js +17 -48
  59. package/dist/m365/flow/commands/flow-remove.js +11 -38
  60. package/dist/m365/flow/commands/owner/owner-ensure.js +30 -65
  61. package/dist/m365/flow/commands/owner/owner-list.js +10 -35
  62. package/dist/m365/flow/commands/owner/owner-remove.js +30 -61
  63. package/dist/m365/flow/commands/run/run-cancel.js +11 -37
  64. package/dist/m365/flow/commands/run/run-get.js +12 -43
  65. package/dist/m365/flow/commands/run/run-list.js +29 -61
  66. package/dist/m365/flow/commands/run/run-resubmit.js +11 -37
  67. package/dist/m365/graph/commands/changelog/changelog-list.js +68 -67
  68. package/dist/m365/graph/commands/schemaextension/schemaextension-add.js +25 -31
  69. package/dist/m365/graph/commands/schemaextension/schemaextension-get.js +8 -15
  70. package/dist/m365/graph/commands/schemaextension/schemaextension-list.js +26 -50
  71. package/dist/m365/graph/commands/schemaextension/schemaextension-remove.js +9 -24
  72. package/dist/m365/graph/commands/schemaextension/schemaextension-set.js +32 -53
  73. package/dist/m365/graph/commands/subscription/subscription-add.js +63 -89
  74. package/dist/m365/outlook/commands/calendar/calendar-list.js +64 -0
  75. package/dist/m365/outlook/commands/mail/mail-send.js +55 -84
  76. package/dist/m365/outlook/commands/message/message-get.js +27 -27
  77. package/dist/m365/outlook/commands/message/message-list.js +53 -80
  78. package/dist/m365/outlook/commands/message/message-move.js +43 -40
  79. package/dist/m365/outlook/commands/message/message-remove.js +17 -45
  80. package/dist/m365/outlook/commands.js +1 -0
  81. package/dist/m365/spo/commands/list/list-sensitivitylabel-remove.js +83 -0
  82. package/dist/m365/spo/commands.js +1 -0
  83. package/docs/docs/cmd/outlook/calendar/calendar-list.mdx +155 -0
  84. package/docs/docs/cmd/spo/list/list-sensitivitylabel-remove.mdx +77 -0
  85. package/npm-shrinkwrap.json +7 -0
  86. package/package.json +1 -1
@@ -1,16 +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 _FlowRunResubmitCommand_instances, _FlowRunResubmitCommand_initTelemetry, _FlowRunResubmitCommand_initOptions, _FlowRunResubmitCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import chalk from 'chalk';
8
3
  import { cli } from '../../../../cli/cli.js';
4
+ import { globalOptionsZod } from '../../../../Command.js';
9
5
  import request from '../../../../request.js';
10
6
  import { formatting } from '../../../../utils/formatting.js';
11
- import { validation } from '../../../../utils/validation.js';
12
7
  import commands from '../../commands.js';
13
8
  import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ name: z.string().alias('n'),
12
+ flowName: z.uuid(),
13
+ environmentName: z.string().alias('e'),
14
+ force: z.boolean().optional().alias('f')
15
+ });
14
16
  class FlowRunResubmitCommand extends PowerAutomateCommand {
15
17
  get name() {
16
18
  return commands.RUN_RESUBMIT;
@@ -18,12 +20,8 @@ class FlowRunResubmitCommand extends PowerAutomateCommand {
18
20
  get description() {
19
21
  return 'Resubmits a specific flow run for the specified Microsoft Flow';
20
22
  }
21
- constructor() {
22
- super();
23
- _FlowRunResubmitCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _FlowRunResubmitCommand_instances, "m", _FlowRunResubmitCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _FlowRunResubmitCommand_instances, "m", _FlowRunResubmitCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _FlowRunResubmitCommand_instances, "m", _FlowRunResubmitCommand_initValidators).call(this);
23
+ get schema() {
24
+ return options;
27
25
  }
28
26
  async commandAction(logger, args) {
29
27
  if (this.verbose) {
@@ -70,29 +68,5 @@ class FlowRunResubmitCommand extends PowerAutomateCommand {
70
68
  return res.value[0].name;
71
69
  }
72
70
  }
73
- _FlowRunResubmitCommand_instances = new WeakSet(), _FlowRunResubmitCommand_initTelemetry = function _FlowRunResubmitCommand_initTelemetry() {
74
- this.telemetry.push((args) => {
75
- Object.assign(this.telemetryProperties, {
76
- force: args.options.force
77
- });
78
- });
79
- }, _FlowRunResubmitCommand_initOptions = function _FlowRunResubmitCommand_initOptions() {
80
- this.options.unshift({
81
- option: '-n, --name <name>'
82
- }, {
83
- option: '--flowName <flowName>'
84
- }, {
85
- option: '-e, --environmentName <environmentName>'
86
- }, {
87
- option: '-f, --force'
88
- });
89
- }, _FlowRunResubmitCommand_initValidators = function _FlowRunResubmitCommand_initValidators() {
90
- this.validators.push(async (args) => {
91
- if (!validation.isValidGuid(args.options.flowName)) {
92
- return `${args.options.flowName} is not a valid GUID`;
93
- }
94
- return true;
95
- });
96
- };
97
71
  export default new FlowRunResubmitCommand();
98
72
  //# sourceMappingURL=run-resubmit.js.map
@@ -1,16 +1,38 @@
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 _GraphChangelogListCommand_instances, _GraphChangelogListCommand_initTelemetry, _GraphChangelogListCommand_initOptions, _GraphChangelogListCommand_initValidators;
7
1
  import { DOMParser } from '@xmldom/xmldom';
2
+ import { z } from 'zod';
8
3
  import { cli } from '../../../../cli/cli.js';
4
+ import { globalOptionsZod } from '../../../../Command.js';
9
5
  import request from '../../../../request.js';
10
6
  import { md } from '../../../../utils/md.js';
11
7
  import { validation } from '../../../../utils/validation.js';
8
+ import { zod } from '../../../../utils/zod.js';
12
9
  import AnonymousCommand from '../../../base/AnonymousCommand.js';
13
10
  import commands from '../../commands.js';
11
+ const allowedVersions = ['beta', 'v1.0'];
12
+ var ChangeType;
13
+ (function (ChangeType) {
14
+ ChangeType["Addition"] = "Addition";
15
+ ChangeType["Change"] = "Change";
16
+ ChangeType["Deletion"] = "Deletion";
17
+ ChangeType["Deprecation"] = "Deprecation";
18
+ })(ChangeType || (ChangeType = {}));
19
+ const allowedServices = [
20
+ 'Applications', 'Calendar', 'Change notifications', 'Cloud communications',
21
+ 'Compliance', 'Cross-device experiences', 'Customer booking', 'Device and app management',
22
+ 'Education', 'Files', 'Financials', 'Groups',
23
+ 'Identity and access', 'Mail', 'Notes', 'Notifications',
24
+ 'People and workplace intelligence', 'Personal contacts', 'Reports', 'Search',
25
+ 'Security', 'Sites and lists', 'Tasks and plans', 'Teamwork',
26
+ 'To-do tasks', 'Users', 'Workbooks and charts'
27
+ ];
28
+ export const options = z.strictObject({
29
+ ...globalOptionsZod.shape,
30
+ versions: z.string().optional().alias('v'),
31
+ changeType: zod.coercedEnum(ChangeType).optional().alias('c'),
32
+ services: z.string().optional().alias('s'),
33
+ startDate: z.string().optional(),
34
+ endDate: z.string().optional()
35
+ });
14
36
  class GraphChangelogListCommand extends AnonymousCommand {
15
37
  get name() {
16
38
  return commands.CHANGELOG_LIST;
@@ -21,28 +43,45 @@ class GraphChangelogListCommand extends AnonymousCommand {
21
43
  defaultProperties() {
22
44
  return ['category', 'title', 'description'];
23
45
  }
24
- constructor() {
25
- super();
26
- _GraphChangelogListCommand_instances.add(this);
27
- this.allowedVersions = ['beta', 'v1.0'];
28
- this.allowedChangeTypes = ['Addition', 'Change', 'Deletion', 'Deprecation'];
29
- this.allowedServices = [
30
- 'Applications', 'Calendar', 'Change notifications', 'Cloud communications',
31
- 'Compliance', 'Cross-device experiences', 'Customer booking', 'Device and app management',
32
- 'Education', 'Files', 'Financials', 'Groups',
33
- 'Identity and access', 'Mail', 'Notes', 'Notifications',
34
- 'People and workplace intelligence', 'Personal contacts', 'Reports', 'Search',
35
- 'Security', 'Sites and lists', 'Tasks and plans', 'Teamwork',
36
- 'To-do tasks', 'Users', 'Workbooks and charts'
37
- ];
38
- __classPrivateFieldGet(this, _GraphChangelogListCommand_instances, "m", _GraphChangelogListCommand_initTelemetry).call(this);
39
- __classPrivateFieldGet(this, _GraphChangelogListCommand_instances, "m", _GraphChangelogListCommand_initOptions).call(this);
40
- __classPrivateFieldGet(this, _GraphChangelogListCommand_instances, "m", _GraphChangelogListCommand_initValidators).call(this);
46
+ get schema() {
47
+ return options;
48
+ }
49
+ getRefinedSchema(schema) {
50
+ return schema
51
+ .refine(options => {
52
+ if (!options.versions) {
53
+ return true;
54
+ }
55
+ return !options.versions.toLocaleLowerCase().split(',').some(x => !allowedVersions.map(y => y.toLocaleLowerCase()).includes(x));
56
+ }, {
57
+ error: `The versions contains an invalid value. Specify either ${allowedVersions.join(', ')} as properties`,
58
+ path: ['versions']
59
+ })
60
+ .refine(options => {
61
+ if (!options.services) {
62
+ return true;
63
+ }
64
+ return !options.services.toLocaleLowerCase().split(',').some(x => !allowedServices.map(y => y.toLocaleLowerCase()).includes(x));
65
+ }, {
66
+ error: `The services contains invalid value. Specify either ${allowedServices.join(', ')} as properties`,
67
+ path: ['services']
68
+ })
69
+ .refine(options => !options.startDate || validation.isValidISODate(options.startDate), {
70
+ error: 'The startDate is not a valid ISO date string',
71
+ path: ['startDate']
72
+ })
73
+ .refine(options => !options.endDate || validation.isValidISODate(options.endDate), {
74
+ error: 'The endDate is not a valid ISO date string',
75
+ path: ['endDate']
76
+ })
77
+ .refine(options => !(options.endDate && options.startDate && new Date(options.endDate) < new Date(options.startDate)), {
78
+ error: 'The endDate should be later than startDate',
79
+ path: ['endDate']
80
+ });
41
81
  }
42
82
  async commandAction(logger, args) {
43
83
  try {
44
- const allowedChangeType = args.options.changeType && this.allowedChangeTypes.find(x => x.toLocaleLowerCase() === args.options.changeType.toLocaleLowerCase());
45
- const searchParam = args.options.changeType ? `/?filterBy=${allowedChangeType}` : '';
84
+ const searchParam = args.options.changeType ? `/?filterBy=${args.options.changeType}` : '';
46
85
  const requestOptions = {
47
86
  url: `https://developer.microsoft.com/en-us/graph/changelog/rss${searchParam}`,
48
87
  headers: {
@@ -63,14 +102,14 @@ class GraphChangelogListCommand extends AnonymousCommand {
63
102
  filterThroughOptions(options, changelog) {
64
103
  let items = changelog.items;
65
104
  if (options.services) {
66
- const allowedServices = this.allowedServices
105
+ const matchedServices = allowedServices
67
106
  .filter(allowedService => options.services.toLocaleLowerCase().split(',').includes(allowedService.toLocaleLowerCase()));
68
- items = changelog.items.filter(item => allowedServices.includes(item.title));
107
+ items = changelog.items.filter(item => matchedServices.includes(item.title));
69
108
  }
70
109
  if (options.versions) {
71
- const allowedVersions = this.allowedVersions
110
+ const matchedVersions = allowedVersions
72
111
  .filter(allowedVersion => options.versions.toLocaleLowerCase().split(',').includes(allowedVersion.toLocaleLowerCase()));
73
- items = items.filter(item => allowedVersions.includes(item.category));
112
+ items = items.filter(item => matchedVersions.includes(item.category));
74
113
  }
75
114
  if (options.startDate) {
76
115
  const startDate = new Date(options.startDate);
@@ -110,43 +149,5 @@ class GraphChangelogListCommand extends AnonymousCommand {
110
149
  return changelog;
111
150
  }
112
151
  }
113
- _GraphChangelogListCommand_instances = new WeakSet(), _GraphChangelogListCommand_initTelemetry = function _GraphChangelogListCommand_initTelemetry() {
114
- this.telemetry.push((args) => {
115
- Object.assign(this.telemetryProperties, {
116
- versions: typeof args.options.versions !== 'undefined',
117
- changeType: typeof args.options.changeType !== 'undefined',
118
- services: typeof args.options.services !== 'undefined',
119
- startDate: typeof args.options.startDate !== 'undefined',
120
- endDate: typeof args.options.endDate !== 'undefined'
121
- });
122
- });
123
- }, _GraphChangelogListCommand_initOptions = function _GraphChangelogListCommand_initOptions() {
124
- this.options.unshift({ option: '-v, --versions [versions]', autocomplete: this.allowedVersions }, { option: "-c, --changeType [changeType]", autocomplete: this.allowedChangeTypes }, { option: "-s, --services [services]", autocomplete: this.allowedServices }, { option: "--startDate [startDate]" }, { option: "--endDate [endDate]" });
125
- }, _GraphChangelogListCommand_initValidators = function _GraphChangelogListCommand_initValidators() {
126
- this.validators.push(async (args) => {
127
- if (args.options.versions &&
128
- args.options.versions.toLocaleLowerCase().split(',').some(x => !this.allowedVersions.map(y => y.toLocaleLowerCase()).includes(x))) {
129
- return `The verions contains an invalid value. Specify either ${this.allowedVersions.join(', ')} as properties`;
130
- }
131
- if (args.options.changeType &&
132
- !this.allowedChangeTypes.map(x => x.toLocaleLowerCase()).includes(args.options.changeType.toLocaleLowerCase())) {
133
- return `The change type contain an invalid value. Specify either ${this.allowedChangeTypes.join(', ')} as properties`;
134
- }
135
- if (args.options.services &&
136
- args.options.services.toLocaleLowerCase().split(',').some(x => !this.allowedServices.map(y => y.toLocaleLowerCase()).includes(x))) {
137
- return `The services contains invalid value. Specify either ${this.allowedServices.join(', ')} as properties`;
138
- }
139
- if (args.options.startDate && !validation.isValidISODate(args.options.startDate)) {
140
- return 'The startDate is not a valid ISO date string';
141
- }
142
- if (args.options.endDate && !validation.isValidISODate(args.options.endDate)) {
143
- return 'The endDate is not a valid ISO date string';
144
- }
145
- if (args.options.endDate && args.options.startDate && new Date(args.options.endDate) < new Date(args.options.startDate)) {
146
- return 'The endDate should be later than startDate';
147
- }
148
- return true;
149
- });
150
- };
151
152
  export default new GraphChangelogListCommand();
152
153
  //# sourceMappingURL=changelog-list.js.map
@@ -1,13 +1,17 @@
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 _GraphSchemaExtensionAddCommand_instances, _GraphSchemaExtensionAddCommand_initOptions, _GraphSchemaExtensionAddCommand_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
+ description: z.string().optional().alias('d'),
11
+ owner: z.string(),
12
+ targetTypes: z.string().alias('t'),
13
+ properties: z.string().alias('p')
14
+ });
11
15
  class GraphSchemaExtensionAddCommand extends GraphCommand {
12
16
  get name() {
13
17
  return commands.SCHEMAEXTENSION_ADD;
@@ -15,11 +19,21 @@ class GraphSchemaExtensionAddCommand extends GraphCommand {
15
19
  get description() {
16
20
  return 'Creates a Microsoft Graph schema extension';
17
21
  }
18
- constructor() {
19
- super();
20
- _GraphSchemaExtensionAddCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _GraphSchemaExtensionAddCommand_instances, "m", _GraphSchemaExtensionAddCommand_initOptions).call(this);
22
- __classPrivateFieldGet(this, _GraphSchemaExtensionAddCommand_instances, "m", _GraphSchemaExtensionAddCommand_initValidators).call(this);
22
+ get schema() {
23
+ return options;
24
+ }
25
+ getRefinedSchema(schema) {
26
+ return schema
27
+ .refine(options => validation.isValidGuid(options.owner), {
28
+ error: e => `The specified owner '${e.input.owner}' is not a valid App Id`,
29
+ path: ['owner']
30
+ })
31
+ .refine(options => {
32
+ return this.validateProperties(options.properties) === true;
33
+ }, {
34
+ error: e => `${this.validateProperties(e.input.properties)}`,
35
+ path: ['properties']
36
+ });
23
37
  }
24
38
  async commandAction(logger, args) {
25
39
  if (this.verbose) {
@@ -85,25 +99,5 @@ class GraphSchemaExtensionAddCommand extends GraphCommand {
85
99
  return ['Binary', 'Boolean', 'DateTime', 'Integer', 'String'].indexOf(propertyType) > -1;
86
100
  }
87
101
  }
88
- _GraphSchemaExtensionAddCommand_instances = new WeakSet(), _GraphSchemaExtensionAddCommand_initOptions = function _GraphSchemaExtensionAddCommand_initOptions() {
89
- this.options.unshift({
90
- option: '-i, --id <id>'
91
- }, {
92
- option: '-d, --description [description]'
93
- }, {
94
- option: '--owner <owner>'
95
- }, {
96
- option: '-t, --targetTypes <targetTypes>'
97
- }, {
98
- option: '-p, --properties <properties>'
99
- });
100
- }, _GraphSchemaExtensionAddCommand_initValidators = function _GraphSchemaExtensionAddCommand_initValidators() {
101
- this.validators.push(async (args) => {
102
- if (args.options.owner && !validation.isValidGuid(args.options.owner)) {
103
- return `The specified owner '${args.options.owner}' is not a valid App Id`;
104
- }
105
- return this.validateProperties(args.options.properties);
106
- });
107
- };
108
102
  export default new GraphSchemaExtensionAddCommand();
109
103
  //# sourceMappingURL=schemaextension-add.js.map
@@ -1,12 +1,12 @@
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 _GraphSchemaExtensionGetCommand_instances, _GraphSchemaExtensionGetCommand_initOptions;
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 = z.strictObject({
7
+ ...globalOptionsZod.shape,
8
+ id: z.string().alias('i')
9
+ });
10
10
  class GraphSchemaExtensionGetCommand extends GraphCommand {
11
11
  get name() {
12
12
  return commands.SCHEMAEXTENSION_GET;
@@ -14,10 +14,8 @@ class GraphSchemaExtensionGetCommand extends GraphCommand {
14
14
  get description() {
15
15
  return 'Gets the properties of the specified schema extension definition';
16
16
  }
17
- constructor() {
18
- super();
19
- _GraphSchemaExtensionGetCommand_instances.add(this);
20
- __classPrivateFieldGet(this, _GraphSchemaExtensionGetCommand_instances, "m", _GraphSchemaExtensionGetCommand_initOptions).call(this);
17
+ get schema() {
18
+ return options;
21
19
  }
22
20
  async commandAction(logger, args) {
23
21
  if (this.verbose) {
@@ -40,10 +38,5 @@ class GraphSchemaExtensionGetCommand extends GraphCommand {
40
38
  }
41
39
  }
42
40
  }
43
- _GraphSchemaExtensionGetCommand_instances = new WeakSet(), _GraphSchemaExtensionGetCommand_initOptions = function _GraphSchemaExtensionGetCommand_initOptions() {
44
- this.options.unshift({
45
- option: '-i, --id <id>'
46
- });
47
- };
48
41
  export default new GraphSchemaExtensionGetCommand();
49
42
  //# sourceMappingURL=schemaextension-get.js.map
@@ -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