@pnp/cli-microsoft365 12.1.0-beta.dbc076e → 12.1.0-beta.f55735f

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 (121) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/m365/spfx/commands/package/package-generate.js +30 -51
  4. package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +27 -62
  5. package/dist/m365/spfx/commands/project/project-doctor.js +20 -51
  6. package/dist/m365/spfx/commands/project/project-externalize.js +16 -26
  7. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +28 -65
  8. package/dist/m365/spfx/commands/project/project-permissions-grant.js +4 -2
  9. package/dist/m365/spfx/commands/project/project-rename.js +17 -29
  10. package/dist/m365/spfx/commands/project/project-upgrade.js +0 -3
  11. package/dist/m365/spfx/commands/spfx-doctor.js +23 -47
  12. package/dist/m365/spo/commands/file/file-add.js +51 -77
  13. package/dist/m365/spo/commands/file/file-archive.js +1 -1
  14. package/dist/m365/spo/commands/file/file-checkin.js +35 -64
  15. package/dist/m365/spo/commands/file/file-checkout-undo.js +25 -49
  16. package/dist/m365/spo/commands/file/file-checkout.js +24 -47
  17. package/dist/m365/spo/commands/file/file-copy.js +37 -68
  18. package/dist/m365/spo/commands/file/file-get.js +44 -79
  19. package/dist/m365/spo/commands/file/file-list.js +16 -39
  20. package/dist/m365/spo/commands/file/file-move.js +30 -68
  21. package/dist/m365/spo/commands/file/file-remove.js +27 -56
  22. package/dist/m365/spo/commands/file/file-rename.js +15 -36
  23. package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +26 -51
  24. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +25 -50
  25. package/dist/m365/spo/commands/file/file-roleassignment-add.js +47 -75
  26. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +39 -70
  27. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +26 -52
  28. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +25 -49
  29. package/dist/m365/spo/commands/file/file-sharinginfo-get.js +24 -47
  30. package/dist/m365/spo/commands/file/file-sharinglink-add.js +46 -70
  31. package/dist/m365/spo/commands/file/file-sharinglink-clear.js +33 -57
  32. package/dist/m365/spo/commands/file/file-sharinglink-get.js +25 -47
  33. package/dist/m365/spo/commands/file/file-sharinglink-list.js +32 -53
  34. package/dist/m365/spo/commands/file/file-sharinglink-remove.js +26 -51
  35. package/dist/m365/spo/commands/file/file-sharinglink-set.js +29 -55
  36. package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
  37. package/dist/m365/spo/commands/file/file-version-clear.js +25 -45
  38. package/dist/m365/spo/commands/file/file-version-get.js +25 -43
  39. package/dist/m365/spo/commands/file/file-version-keep.js +1 -1
  40. package/dist/m365/spo/commands/file/file-version-list.js +24 -41
  41. package/dist/m365/spo/commands/file/file-version-remove.js +26 -47
  42. package/dist/m365/spo/commands/file/file-version-restore.js +26 -47
  43. package/dist/m365/spo/commands/folder/folder-add.js +19 -48
  44. package/dist/m365/spo/commands/folder/folder-copy.js +36 -62
  45. package/dist/m365/spo/commands/folder/folder-get.js +30 -51
  46. package/dist/m365/spo/commands/folder/folder-list.js +16 -39
  47. package/dist/m365/spo/commands/folder/folder-move.js +36 -62
  48. package/dist/m365/spo/commands/folder/folder-remove.js +15 -36
  49. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +30 -48
  50. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +30 -50
  51. package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +49 -79
  52. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +37 -67
  53. package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +15 -36
  54. package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +14 -33
  55. package/dist/m365/spo/commands/folder/folder-set.js +28 -48
  56. package/dist/m365/spo/commands/folder/folder-sharinglink-add.js +58 -86
  57. package/dist/m365/spo/commands/folder/folder-sharinglink-clear.js +33 -50
  58. package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +33 -42
  59. package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +32 -47
  60. package/dist/m365/spo/commands/folder/folder-sharinglink-remove.js +34 -41
  61. package/dist/m365/spo/commands/folder/folder-sharinglink-set.js +38 -43
  62. package/dist/m365/spo/commands/page/page-add.js +31 -68
  63. package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +74 -101
  64. package/dist/m365/spo/commands/page/page-column-get.js +15 -32
  65. package/dist/m365/spo/commands/page/page-column-list.js +14 -27
  66. package/dist/m365/spo/commands/page/page-control-get.js +18 -27
  67. package/dist/m365/spo/commands/page/page-control-list.js +13 -20
  68. package/dist/m365/spo/commands/page/page-control-remove.js +1 -1
  69. package/dist/m365/spo/commands/page/page-control-set.js +51 -61
  70. package/dist/m365/spo/commands/page/page-copy.js +15 -31
  71. package/dist/m365/spo/commands/page/page-header-set.js +25 -89
  72. package/dist/m365/spo/commands/page/page-list.js +12 -18
  73. package/dist/m365/spo/commands/page/page-remove.js +16 -39
  74. package/dist/m365/spo/commands/page/page-section-add.js +108 -173
  75. package/dist/m365/spo/commands/page/page-section-get.js +17 -27
  76. package/dist/m365/spo/commands/page/page-section-list.js +13 -20
  77. package/dist/m365/spo/commands/page/page-section-remove.js +4 -1
  78. package/dist/m365/spo/commands/page/page-set.js +50 -100
  79. package/dist/m365/spo/commands/page/page-template-list.js +12 -18
  80. package/dist/m365/spo/commands/page/page-text-add.js +23 -45
  81. package/dist/m365/viva/commands/connections/connections-app-create.js +36 -42
  82. package/dist/m365/viva/commands/engage/engage-community-add.js +75 -71
  83. package/dist/m365/viva/commands/engage/engage-community-get.js +8 -16
  84. package/dist/m365/viva/commands/engage/engage-community-list.js +5 -0
  85. package/dist/m365/viva/commands/engage/engage-community-remove.js +28 -48
  86. package/dist/m365/viva/commands/engage/engage-community-set.js +43 -66
  87. package/dist/m365/viva/commands/engage/engage-community-user-add.js +7 -12
  88. package/dist/m365/viva/commands/engage/engage-community-user-list.js +1 -1
  89. package/dist/m365/viva/commands/engage/engage-community-user-remove.js +4 -2
  90. package/dist/m365/viva/commands/engage/engage-message-add.js +22 -52
  91. package/dist/m365/viva/commands/engage/engage-message-get.js +8 -23
  92. package/dist/m365/viva/commands/engage/engage-message-like-set.js +10 -39
  93. package/dist/m365/viva/commands/engage/engage-message-list.js +22 -66
  94. package/dist/m365/viva/commands/engage/engage-message-remove.js +9 -32
  95. package/dist/m365/viva/commands/engage/engage-network-list.js +8 -22
  96. package/dist/m365/viva/commands/engage/engage-report-activitycounts.js +2 -1
  97. package/dist/m365/viva/commands/engage/engage-report-activityusercounts.js +2 -1
  98. package/dist/m365/viva/commands/engage/engage-report-activityuserdetail.js +2 -1
  99. package/dist/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.js +2 -1
  100. package/dist/m365/viva/commands/engage/engage-report-deviceusageusercounts.js +2 -1
  101. package/dist/m365/viva/commands/engage/engage-report-deviceusageuserdetail.js +2 -1
  102. package/dist/m365/viva/commands/engage/engage-report-groupsactivitycounts.js +2 -1
  103. package/dist/m365/viva/commands/engage/engage-report-groupsactivitydetail.js +2 -1
  104. package/dist/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.js +2 -1
  105. package/dist/m365/viva/commands/engage/engage-role-list.js +5 -0
  106. package/dist/m365/viva/commands/engage/engage-role-member-add.js +3 -5
  107. package/dist/m365/viva/commands/engage/engage-role-member-list.js +1 -1
  108. package/dist/m365/viva/commands/engage/engage-role-member-remove.js +4 -2
  109. package/dist/m365/viva/commands/engage/engage-search.js +16 -65
  110. package/dist/m365/viva/commands/engage/engage-user-get.js +15 -33
  111. package/dist/m365/viva/commands/engage/engage-user-list.js +22 -57
  112. package/docs/docs/cmd/spo/listitem/listitem-record-declare.mdx +19 -0
  113. package/docs/docs/cmd/spo/listitem/listitem-record-lock.mdx +21 -0
  114. package/docs/docs/cmd/spo/listitem/listitem-record-undeclare.mdx +21 -0
  115. package/docs/docs/cmd/spo/listitem/listitem-record-unlock.mdx +21 -0
  116. package/docs/docs/cmd/spo/page/page-text-add.mdx +1 -1
  117. package/docs/docs/cmd/viva/engage/engage-community-add.mdx +19 -0
  118. package/docs/docs/cmd/viva/engage/engage-community-get.mdx +19 -0
  119. package/docs/docs/cmd/viva/engage/engage-community-remove.mdx +21 -0
  120. package/docs/docs/cmd/viva/engage/engage-community-set.mdx +19 -0
  121. package/package.json +1 -1
@@ -1,11 +1,5 @@
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 _VivaEngageCommunityAddCommand_instances, _VivaEngageCommunityAddCommand_initTelemetry, _VivaEngageCommunityAddCommand_initOptions, _VivaEngageCommunityAddCommand_initValidators, _VivaEngageCommunityAddCommand_initTypes, _VivaEngageCommunityAddCommand_initOptionSets;
7
- import GraphCommand from '../../../base/GraphCommand.js';
8
- import commands from '../../commands.js';
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
9
3
  import request from '../../../../request.js';
10
4
  import { validation } from '../../../../utils/validation.js';
11
5
  import { accessToken } from '../../../../utils/accessToken.js';
@@ -13,23 +7,86 @@ import auth from '../../../../Auth.js';
13
7
  import { formatting } from '../../../../utils/formatting.js';
14
8
  import { entraUser } from '../../../../utils/entraUser.js';
15
9
  import { setTimeout } from 'timers/promises';
10
+ import GraphCommand from '../../../base/GraphCommand.js';
11
+ import commands from '../../commands.js';
12
+ export const options = z.strictObject({
13
+ ...globalOptionsZod.shape,
14
+ displayName: z.string(),
15
+ description: z.string(),
16
+ privacy: z.enum(['public', 'private']),
17
+ adminEntraIds: z.string().optional(),
18
+ adminEntraUserNames: z.string().optional(),
19
+ wait: z.boolean().optional()
20
+ });
16
21
  class VivaEngageCommunityAddCommand extends GraphCommand {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.pollingInterval = 5000;
25
+ }
17
26
  get name() {
18
27
  return commands.ENGAGE_COMMUNITY_ADD;
19
28
  }
20
29
  get description() {
21
30
  return 'Creates a new community in Viva Engage';
22
31
  }
23
- constructor() {
24
- super();
25
- _VivaEngageCommunityAddCommand_instances.add(this);
26
- this.pollingInterval = 5000;
27
- this.privacyOptions = ['public', 'private'];
28
- __classPrivateFieldGet(this, _VivaEngageCommunityAddCommand_instances, "m", _VivaEngageCommunityAddCommand_initTelemetry).call(this);
29
- __classPrivateFieldGet(this, _VivaEngageCommunityAddCommand_instances, "m", _VivaEngageCommunityAddCommand_initOptions).call(this);
30
- __classPrivateFieldGet(this, _VivaEngageCommunityAddCommand_instances, "m", _VivaEngageCommunityAddCommand_initValidators).call(this);
31
- __classPrivateFieldGet(this, _VivaEngageCommunityAddCommand_instances, "m", _VivaEngageCommunityAddCommand_initTypes).call(this);
32
- __classPrivateFieldGet(this, _VivaEngageCommunityAddCommand_instances, "m", _VivaEngageCommunityAddCommand_initOptionSets).call(this);
32
+ get schema() {
33
+ return options;
34
+ }
35
+ getRefinedSchema(schema) {
36
+ return schema
37
+ .refine(opts => opts.displayName.length <= 255, {
38
+ message: `The maximum amount of characters for 'displayName' is 255.`
39
+ })
40
+ .refine(opts => opts.description.length <= 1024, {
41
+ message: `The maximum amount of characters for 'description' is 1024.`
42
+ })
43
+ .superRefine((opts, ctx) => {
44
+ if (opts.adminEntraIds) {
45
+ const items = opts.adminEntraIds.split(',').map(s => s.trim());
46
+ const invalid = items.filter(item => !validation.isValidGuid(item));
47
+ if (invalid.length > 0) {
48
+ ctx.addIssue({
49
+ code: z.ZodIssueCode.custom,
50
+ message: `The following GUIDs are invalid for the option 'adminEntraIds': ${invalid.join(', ')}`
51
+ });
52
+ }
53
+ }
54
+ })
55
+ .refine(opts => {
56
+ if (!opts.adminEntraIds) {
57
+ return true;
58
+ }
59
+ return formatting.splitAndTrim(opts.adminEntraIds).length <= 20;
60
+ }, {
61
+ message: 'Maximum of 20 admins allowed. Please reduce the number of users and try again.'
62
+ })
63
+ .superRefine((opts, ctx) => {
64
+ if (opts.adminEntraUserNames) {
65
+ const items = opts.adminEntraUserNames.split(',').map(s => s.trim());
66
+ const invalid = items.filter(item => !validation.isValidUserPrincipalName(item));
67
+ if (invalid.length > 0) {
68
+ ctx.addIssue({
69
+ code: z.ZodIssueCode.custom,
70
+ message: `The following user principal names are invalid for the option 'adminEntraUserNames': ${invalid.join(', ')}`
71
+ });
72
+ }
73
+ }
74
+ })
75
+ .refine(opts => {
76
+ if (!opts.adminEntraUserNames) {
77
+ return true;
78
+ }
79
+ return formatting.splitAndTrim(opts.adminEntraUserNames).length <= 20;
80
+ }, {
81
+ message: 'Maximum of 20 admins allowed. Please reduce the number of users and try again.'
82
+ })
83
+ .refine(opts => !opts.adminEntraIds || !opts.adminEntraUserNames, {
84
+ message: 'Specify either adminEntraIds or adminEntraUserNames, but not both.',
85
+ params: {
86
+ customCode: 'optionSet',
87
+ options: ['adminEntraIds', 'adminEntraUserNames']
88
+ }
89
+ });
33
90
  }
34
91
  async commandAction(logger, args) {
35
92
  const { displayName, description, privacy, adminEntraIds, adminEntraUserNames, wait } = args.options;
@@ -109,58 +166,5 @@ class VivaEngageCommunityAddCommand extends GraphCommand {
109
166
  return graphUserUrls;
110
167
  }
111
168
  }
112
- _VivaEngageCommunityAddCommand_instances = new WeakSet(), _VivaEngageCommunityAddCommand_initTelemetry = function _VivaEngageCommunityAddCommand_initTelemetry() {
113
- this.telemetry.push((args) => {
114
- Object.assign(this.telemetryProperties, {
115
- adminEntraIds: typeof args.options.adminEntraIds !== 'undefined',
116
- adminEntraUserNames: typeof args.options.adminEntraUserNames !== 'undefined',
117
- wait: !!args.options.wait
118
- });
119
- });
120
- }, _VivaEngageCommunityAddCommand_initOptions = function _VivaEngageCommunityAddCommand_initOptions() {
121
- this.options.unshift({ option: '--displayName <displayName>' }, { option: '--description <description>' }, {
122
- option: '--privacy <privacy>',
123
- autocomplete: this.privacyOptions
124
- }, { option: '--adminEntraIds [adminEntraIds]' }, { option: '--adminEntraUserNames [adminEntraUserNames]' }, { option: '--wait' });
125
- }, _VivaEngageCommunityAddCommand_initValidators = function _VivaEngageCommunityAddCommand_initValidators() {
126
- this.validators.push(async (args) => {
127
- if (args.options.displayName.length > 255) {
128
- return `The maximum amount of characters for 'displayName' is 255.`;
129
- }
130
- if (args.options.description.length > 1024) {
131
- return `The maximum amount of characters for 'description' is 1024.`;
132
- }
133
- if (this.privacyOptions.indexOf(args.options.privacy) === -1) {
134
- return `'${args.options.privacy}' is not a valid value for privacy. Allowed values are: ${this.privacyOptions.join(', ')}.`;
135
- }
136
- if (args.options.adminEntraIds) {
137
- const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.adminEntraIds);
138
- if (isValidGUIDArrayResult !== true) {
139
- return `The following GUIDs are invalid for the option 'adminEntraIds': ${isValidGUIDArrayResult}.`;
140
- }
141
- if (formatting.splitAndTrim(args.options.adminEntraIds).length > 20) {
142
- return `Maximum of 20 admins allowed. Please reduce the number of users and try again.`;
143
- }
144
- }
145
- if (args.options.adminEntraUserNames) {
146
- const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.adminEntraUserNames);
147
- if (isValidUPNArrayResult !== true) {
148
- return `The following user principal names are invalid for the option 'adminEntraUserNames': ${isValidUPNArrayResult}.`;
149
- }
150
- if (formatting.splitAndTrim(args.options.adminEntraUserNames).length > 20) {
151
- return `Maximum of 20 admins allowed. Please reduce the number of users and try again.`;
152
- }
153
- }
154
- return true;
155
- });
156
- }, _VivaEngageCommunityAddCommand_initTypes = function _VivaEngageCommunityAddCommand_initTypes() {
157
- this.types.string.push('displayName', 'description', 'privacy', 'adminEntraIds', 'adminEntraUserNames');
158
- this.types.boolean.push('wait');
159
- }, _VivaEngageCommunityAddCommand_initOptionSets = function _VivaEngageCommunityAddCommand_initOptionSets() {
160
- this.optionSets.push({
161
- options: ['adminEntraIds', 'adminEntraUserNames'],
162
- runsWhen: (args) => args.options.adminEntraIds || args.options.adminEntraUserNames
163
- });
164
- };
165
169
  export default new VivaEngageCommunityAddCommand();
166
170
  //# sourceMappingURL=engage-community-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 _VivaEngageCommunityGetCommand_instances, _VivaEngageCommunityGetCommand_initOptions, _VivaEngageCommunityGetCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import GraphCommand from '../../../base/GraphCommand.js';
8
4
  import commands from '../../commands.js';
9
5
  import request from '../../../../request.js';
6
+ export const options = z.strictObject({
7
+ ...globalOptionsZod.shape,
8
+ id: z.string().alias('i')
9
+ });
10
10
  class VivaEngageCommunityGetCommand extends GraphCommand {
11
11
  get name() {
12
12
  return commands.ENGAGE_COMMUNITY_GET;
@@ -14,11 +14,8 @@ class VivaEngageCommunityGetCommand extends GraphCommand {
14
14
  get description() {
15
15
  return 'Gets information of a Viva Engage community';
16
16
  }
17
- constructor() {
18
- super();
19
- _VivaEngageCommunityGetCommand_instances.add(this);
20
- __classPrivateFieldGet(this, _VivaEngageCommunityGetCommand_instances, "m", _VivaEngageCommunityGetCommand_initOptions).call(this);
21
- __classPrivateFieldGet(this, _VivaEngageCommunityGetCommand_instances, "m", _VivaEngageCommunityGetCommand_initTypes).call(this);
17
+ get schema() {
18
+ return options;
22
19
  }
23
20
  async commandAction(logger, args) {
24
21
  if (this.verbose) {
@@ -40,10 +37,5 @@ class VivaEngageCommunityGetCommand extends GraphCommand {
40
37
  }
41
38
  }
42
39
  }
43
- _VivaEngageCommunityGetCommand_instances = new WeakSet(), _VivaEngageCommunityGetCommand_initOptions = function _VivaEngageCommunityGetCommand_initOptions() {
44
- this.options.unshift({ option: '-i, --id <id>' });
45
- }, _VivaEngageCommunityGetCommand_initTypes = function _VivaEngageCommunityGetCommand_initTypes() {
46
- this.types.string.push('id');
47
- };
48
40
  export default new VivaEngageCommunityGetCommand();
49
41
  //# sourceMappingURL=engage-community-get.js.map
@@ -1,6 +1,8 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import { odata } from '../../../../utils/odata.js';
2
3
  import GraphCommand from '../../../base/GraphCommand.js';
3
4
  import commands from '../../commands.js';
5
+ export const options = globalOptionsZod.strict();
4
6
  class VivaEngageCommunityListCommand extends GraphCommand {
5
7
  get name() {
6
8
  return commands.ENGAGE_COMMUNITY_LIST;
@@ -11,6 +13,9 @@ class VivaEngageCommunityListCommand extends GraphCommand {
11
13
  defaultProperties() {
12
14
  return ['id', 'displayName', 'privacy'];
13
15
  }
16
+ get schema() {
17
+ return options;
18
+ }
14
19
  async commandAction(logger) {
15
20
  if (this.verbose) {
16
21
  await logger.logToStderr('Getting all Viva Engage communities...');
@@ -1,15 +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 _VivaEngageCommunityRemoveCommand_instances, _VivaEngageCommunityRemoveCommand_initTelemetry, _VivaEngageCommunityRemoveCommand_initOptions, _VivaEngageCommunityRemoveCommand_initValidators, _VivaEngageCommunityRemoveCommand_initOptionSets, _VivaEngageCommunityRemoveCommand_initTypes;
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
- import { validation } from '../../../../utils/validation.js';
10
5
  import { vivaEngage } from '../../../../utils/vivaEngage.js';
11
6
  import GraphCommand from '../../../base/GraphCommand.js';
12
7
  import commands from '../../commands.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ id: z.string().optional().alias('i'),
11
+ displayName: z.string().optional().alias('n'),
12
+ entraGroupId: z.guid().optional(),
13
+ force: z.boolean().optional().alias('f')
14
+ });
13
15
  class VivaEngageCommunityRemoveCommand extends GraphCommand {
14
16
  get name() {
15
17
  return commands.ENGAGE_COMMUNITY_REMOVE;
@@ -17,14 +19,25 @@ class VivaEngageCommunityRemoveCommand extends GraphCommand {
17
19
  get description() {
18
20
  return 'Removes a Viva Engage community';
19
21
  }
20
- constructor() {
21
- super();
22
- _VivaEngageCommunityRemoveCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _VivaEngageCommunityRemoveCommand_instances, "m", _VivaEngageCommunityRemoveCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _VivaEngageCommunityRemoveCommand_instances, "m", _VivaEngageCommunityRemoveCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _VivaEngageCommunityRemoveCommand_instances, "m", _VivaEngageCommunityRemoveCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _VivaEngageCommunityRemoveCommand_instances, "m", _VivaEngageCommunityRemoveCommand_initOptionSets).call(this);
27
- __classPrivateFieldGet(this, _VivaEngageCommunityRemoveCommand_instances, "m", _VivaEngageCommunityRemoveCommand_initTypes).call(this);
22
+ get schema() {
23
+ return options;
24
+ }
25
+ getRefinedSchema(schema) {
26
+ return schema
27
+ .refine(opts => [opts.id, opts.displayName, opts.entraGroupId].some(x => x !== undefined), {
28
+ message: 'Specify either id, displayName, or entraGroupId.',
29
+ params: {
30
+ customCode: 'optionSet',
31
+ options: ['id', 'displayName', 'entraGroupId']
32
+ }
33
+ })
34
+ .refine(opts => [opts.id, opts.displayName, opts.entraGroupId].filter(x => x !== undefined).length <= 1, {
35
+ message: 'Specify either id, displayName, or entraGroupId, but not multiple.',
36
+ params: {
37
+ customCode: 'optionSet',
38
+ options: ['id', 'displayName', 'entraGroupId']
39
+ }
40
+ });
28
41
  }
29
42
  async commandAction(logger, args) {
30
43
  const removeCommunity = async () => {
@@ -62,38 +75,5 @@ class VivaEngageCommunityRemoveCommand extends GraphCommand {
62
75
  }
63
76
  }
64
77
  }
65
- _VivaEngageCommunityRemoveCommand_instances = new WeakSet(), _VivaEngageCommunityRemoveCommand_initTelemetry = function _VivaEngageCommunityRemoveCommand_initTelemetry() {
66
- this.telemetry.push((args) => {
67
- Object.assign(this.telemetryProperties, {
68
- id: args.options.id !== 'undefined',
69
- displayName: args.options.displayName !== 'undefined',
70
- entraGroupId: args.options.entraGroupId !== 'undefined',
71
- force: !!args.options.force
72
- });
73
- });
74
- }, _VivaEngageCommunityRemoveCommand_initOptions = function _VivaEngageCommunityRemoveCommand_initOptions() {
75
- this.options.unshift({
76
- option: '-i, --id [id]'
77
- }, {
78
- option: '-n, --displayName [displayName]'
79
- }, {
80
- option: '--entraGroupId [entraGroupId]'
81
- }, {
82
- option: '-f, --force'
83
- });
84
- }, _VivaEngageCommunityRemoveCommand_initValidators = function _VivaEngageCommunityRemoveCommand_initValidators() {
85
- this.validators.push(async (args) => {
86
- if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
87
- return `${args.options.entraGroupId} is not a valid GUID for the option 'entraGroupId'.`;
88
- }
89
- return true;
90
- });
91
- }, _VivaEngageCommunityRemoveCommand_initOptionSets = function _VivaEngageCommunityRemoveCommand_initOptionSets() {
92
- this.optionSets.push({
93
- options: ['id', 'displayName', 'entraGroupId']
94
- });
95
- }, _VivaEngageCommunityRemoveCommand_initTypes = function _VivaEngageCommunityRemoveCommand_initTypes() {
96
- this.types.string.push('id', 'displayName', 'entraGroupId');
97
- };
98
78
  export default new VivaEngageCommunityRemoveCommand();
99
79
  //# sourceMappingURL=engage-community-remove.js.map
@@ -1,14 +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 _VivaEngageCommunitySetCommand_instances, _VivaEngageCommunitySetCommand_initTelemetry, _VivaEngageCommunitySetCommand_initOptions, _VivaEngageCommunitySetCommand_initValidators, _VivaEngageCommunitySetCommand_initTypes, _VivaEngageCommunitySetCommand_initOptionSets;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
- import { validation } from '../../../../utils/validation.js';
9
4
  import { vivaEngage } from '../../../../utils/vivaEngage.js';
10
5
  import GraphCommand from '../../../base/GraphCommand.js';
11
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ id: z.string().optional().alias('i'),
10
+ displayName: z.string().optional().alias('d'),
11
+ entraGroupId: z.guid().optional(),
12
+ newDisplayName: z.string().optional(),
13
+ description: z.string().optional(),
14
+ privacy: z.string().pipe(z.enum(['public', 'private'])).optional()
15
+ });
12
16
  class VivaEngageCommunitySetCommand extends GraphCommand {
13
17
  get name() {
14
18
  return commands.ENGAGE_COMMUNITY_SET;
@@ -16,15 +20,38 @@ class VivaEngageCommunitySetCommand extends GraphCommand {
16
20
  get description() {
17
21
  return 'Updates an existing Viva Engage community';
18
22
  }
19
- constructor() {
20
- super();
21
- _VivaEngageCommunitySetCommand_instances.add(this);
22
- this.privacyOptions = ['public', 'private'];
23
- __classPrivateFieldGet(this, _VivaEngageCommunitySetCommand_instances, "m", _VivaEngageCommunitySetCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _VivaEngageCommunitySetCommand_instances, "m", _VivaEngageCommunitySetCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _VivaEngageCommunitySetCommand_instances, "m", _VivaEngageCommunitySetCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _VivaEngageCommunitySetCommand_instances, "m", _VivaEngageCommunitySetCommand_initTypes).call(this);
27
- __classPrivateFieldGet(this, _VivaEngageCommunitySetCommand_instances, "m", _VivaEngageCommunitySetCommand_initOptionSets).call(this);
23
+ get schema() {
24
+ return options;
25
+ }
26
+ getRefinedSchema(schema) {
27
+ return schema
28
+ .refine(opts => [opts.id, opts.displayName, opts.entraGroupId].some(x => x !== undefined), {
29
+ message: 'Specify either id, displayName, or entraGroupId.',
30
+ params: {
31
+ customCode: 'optionSet',
32
+ options: ['id', 'displayName', 'entraGroupId']
33
+ }
34
+ })
35
+ .refine(opts => [opts.id, opts.displayName, opts.entraGroupId].filter(x => x !== undefined).length <= 1, {
36
+ message: 'Specify either id, displayName, or entraGroupId, but not multiple.',
37
+ params: {
38
+ customCode: 'optionSet',
39
+ options: ['id', 'displayName', 'entraGroupId']
40
+ }
41
+ })
42
+ .refine(opts => !opts.newDisplayName || opts.newDisplayName.length <= 255, {
43
+ message: `The maximum amount of characters for 'newDisplayName' is 255.`
44
+ })
45
+ .refine(opts => !opts.description || opts.description.length <= 1024, {
46
+ message: `The maximum amount of characters for 'description' is 1024.`
47
+ })
48
+ .refine(opts => opts.newDisplayName || opts.description || opts.privacy, {
49
+ message: 'Specify at least newDisplayName, description, or privacy.',
50
+ params: {
51
+ customCode: 'optionSet',
52
+ options: ['newDisplayName', 'description', 'privacy']
53
+ }
54
+ });
28
55
  }
29
56
  async commandAction(logger, args) {
30
57
  let communityId = args.options.id;
@@ -57,55 +84,5 @@ class VivaEngageCommunitySetCommand extends GraphCommand {
57
84
  }
58
85
  }
59
86
  }
60
- _VivaEngageCommunitySetCommand_instances = new WeakSet(), _VivaEngageCommunitySetCommand_initTelemetry = function _VivaEngageCommunitySetCommand_initTelemetry() {
61
- this.telemetry.push((args) => {
62
- Object.assign(this.telemetryProperties, {
63
- id: typeof args.options.id !== 'undefined',
64
- displayName: typeof args.options.displayName !== 'undefined',
65
- entraGroupId: typeof args.options.entraGroupId !== 'undefined',
66
- newDisplayName: typeof args.options.newDisplayName !== 'undefined',
67
- description: typeof args.options.description !== 'undefined',
68
- privacy: typeof args.options.privacy !== 'undefined'
69
- });
70
- });
71
- }, _VivaEngageCommunitySetCommand_initOptions = function _VivaEngageCommunitySetCommand_initOptions() {
72
- this.options.unshift({
73
- option: '-i, --id [id]'
74
- }, {
75
- option: '-d, --displayName [displayName]'
76
- }, {
77
- option: '--entraGroupId [entraGroupId]'
78
- }, {
79
- option: '--newDisplayName [newDisplayName]'
80
- }, {
81
- option: '--description [description]'
82
- }, {
83
- option: '--privacy [privacy]',
84
- autocomplete: this.privacyOptions
85
- });
86
- }, _VivaEngageCommunitySetCommand_initValidators = function _VivaEngageCommunitySetCommand_initValidators() {
87
- this.validators.push(async (args) => {
88
- if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
89
- return `${args.options.entraGroupId} is not a valid GUID for the option 'entraGroupId'.`;
90
- }
91
- if (args.options.newDisplayName && args.options.newDisplayName.length > 255) {
92
- return `The maximum amount of characters for 'newDisplayName' is 255.`;
93
- }
94
- if (args.options.description && args.options.description.length > 1024) {
95
- return `The maximum amount of characters for 'description' is 1024.`;
96
- }
97
- if (args.options.privacy && this.privacyOptions.map(x => x.toLowerCase()).indexOf(args.options.privacy.toLowerCase()) === -1) {
98
- return `${args.options.privacy} is not a valid privacy. Allowed values are ${this.privacyOptions.join(', ')}`;
99
- }
100
- if (!args.options.newDisplayName && !args.options.description && !args.options.privacy) {
101
- return 'Specify at least newDisplayName, description, or privacy.';
102
- }
103
- return true;
104
- });
105
- }, _VivaEngageCommunitySetCommand_initTypes = function _VivaEngageCommunitySetCommand_initTypes() {
106
- this.types.string.push('id', 'displayName', 'entraGroupId', 'newDisplayName', 'description', 'privacy');
107
- }, _VivaEngageCommunitySetCommand_initOptionSets = function _VivaEngageCommunitySetCommand_initOptionSets() {
108
- this.optionSets.push({ options: ['id', 'displayName', 'entraGroupId'] });
109
- };
110
87
  export default new VivaEngageCommunitySetCommand();
111
88
  //# sourceMappingURL=engage-community-set.js.map
@@ -14,12 +14,14 @@ export const options = z.strictObject({
14
14
  entraGroupId: z.uuid().optional(),
15
15
  ids: z.string()
16
16
  .refine(ids => validation.isValidGuidArray(ids) === true, {
17
- error: e => `The following GUIDs are invalid: ${e.input}.`
18
- }).optional(),
17
+ error: issue => `The following GUIDs are invalid: ${validation.isValidGuidArray(String(issue.input))}.`
18
+ })
19
+ .optional(),
19
20
  userNames: z.string()
20
21
  .refine(userNames => validation.isValidUserPrincipalNameArray(userNames) === true, {
21
- error: e => `The following user principal names are invalid: ${e.input}.`
22
- }).optional(),
22
+ error: issue => `The following user principal names are invalid: ${validation.isValidUserPrincipalNameArray(String(issue.input))}.`
23
+ })
24
+ .optional(),
23
25
  role: z.enum(['Admin', 'Member']).alias('r')
24
26
  });
25
27
  class VivaEngageCommunityUserAddCommand extends GraphCommand {
@@ -48,14 +50,7 @@ class VivaEngageCommunityUserAddCommand extends GraphCommand {
48
50
  options: ['communityId', 'communityDisplayName', 'entraGroupId']
49
51
  }
50
52
  })
51
- .refine(options => options.ids || options.userNames, {
52
- error: 'Specify either of ids or userNames.',
53
- params: {
54
- customCode: 'optionSet',
55
- options: ['ids', 'userNames']
56
- }
57
- })
58
- .refine(options => typeof options.userNames !== 'undefined' || typeof options.ids !== 'undefined', {
53
+ .refine(options => [options.ids, options.userNames].filter(x => x !== undefined).length === 1, {
59
54
  error: 'Specify either ids or userNames, but not both.',
60
55
  params: {
61
56
  customCode: 'optionSet',
@@ -8,7 +8,7 @@ export const options = z.strictObject({
8
8
  ...globalOptionsZod.shape,
9
9
  communityId: z.string().optional(),
10
10
  communityDisplayName: z.string().optional().alias('n'),
11
- entraGroupId: z.uuid().optional(),
11
+ entraGroupId: z.guid().optional(),
12
12
  role: z.enum(['Admin', 'Member']).optional().alias('r')
13
13
  });
14
14
  class VivaEngageCommunityUserListCommand extends GraphCommand {
@@ -11,8 +11,10 @@ export const options = z.strictObject({
11
11
  ...globalOptionsZod.shape,
12
12
  communityId: z.string().optional(),
13
13
  communityDisplayName: z.string().optional().alias('n'),
14
- entraGroupId: z.uuid().optional(),
15
- id: z.uuid().optional(),
14
+ entraGroupId: z.guid().optional(),
15
+ id: z.string().refine(id => validation.isValidGuid(id), {
16
+ error: e => `'${e.input}' is not a valid GUID.`
17
+ }).optional(),
16
18
  userName: z.string()
17
19
  .refine(userName => validation.isValidUserPrincipalName(userName), {
18
20
  error: e => `'${e.input}' is not a valid user principal name.`
@@ -1,12 +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 _VivaEngageMessageAddCommand_instances, _VivaEngageMessageAddCommand_initTelemetry, _VivaEngageMessageAddCommand_initOptions, _VivaEngageMessageAddCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import VivaEngageCommand from '../../../base/VivaEngageCommand.js';
9
5
  import commands from '../../commands.js';
6
+ export const options = z.strictObject({
7
+ ...globalOptionsZod.shape,
8
+ body: z.string().alias('b'),
9
+ repliedToId: z.coerce.number().optional().alias('r'),
10
+ directToUserIds: z.string().optional().alias('d'),
11
+ groupId: z.coerce.number().optional(),
12
+ networkId: z.coerce.number().optional()
13
+ });
10
14
  class VivaEngageMessageAddCommand extends VivaEngageCommand {
11
15
  get name() {
12
16
  return commands.ENGAGE_MESSAGE_ADD;
@@ -14,12 +18,18 @@ class VivaEngageMessageAddCommand extends VivaEngageCommand {
14
18
  get description() {
15
19
  return 'Posts a Viva Engage network message on behalf of the current user';
16
20
  }
17
- constructor() {
18
- super();
19
- _VivaEngageMessageAddCommand_instances.add(this);
20
- __classPrivateFieldGet(this, _VivaEngageMessageAddCommand_instances, "m", _VivaEngageMessageAddCommand_initTelemetry).call(this);
21
- __classPrivateFieldGet(this, _VivaEngageMessageAddCommand_instances, "m", _VivaEngageMessageAddCommand_initOptions).call(this);
22
- __classPrivateFieldGet(this, _VivaEngageMessageAddCommand_instances, "m", _VivaEngageMessageAddCommand_initValidators).call(this);
21
+ get schema() {
22
+ return options;
23
+ }
24
+ getRefinedSchema(schema) {
25
+ return schema
26
+ .refine(opts => opts.groupId !== undefined || opts.directToUserIds !== undefined || opts.repliedToId !== undefined, {
27
+ message: 'You must either specify groupId, repliedToId or directToUserIds',
28
+ params: {
29
+ customCode: 'optionSet',
30
+ options: ['groupId', 'repliedToId', 'directToUserIds']
31
+ }
32
+ });
23
33
  }
24
34
  async commandAction(logger, args) {
25
35
  const requestOptions = {
@@ -50,45 +60,5 @@ class VivaEngageMessageAddCommand extends VivaEngageCommand {
50
60
  }
51
61
  }
52
62
  }
53
- _VivaEngageMessageAddCommand_instances = new WeakSet(), _VivaEngageMessageAddCommand_initTelemetry = function _VivaEngageMessageAddCommand_initTelemetry() {
54
- this.telemetry.push((args) => {
55
- Object.assign(this.telemetryProperties, {
56
- repliedToId: args.options.repliedToId !== undefined,
57
- directToUserIds: args.options.directToUserIds !== undefined,
58
- groupId: args.options.groupId !== undefined,
59
- networkId: args.options.networkId !== undefined
60
- });
61
- });
62
- }, _VivaEngageMessageAddCommand_initOptions = function _VivaEngageMessageAddCommand_initOptions() {
63
- this.options.unshift({
64
- option: '-b, --body <body>'
65
- }, {
66
- option: '-r, --repliedToId [repliedToId]'
67
- }, {
68
- option: '-d, --directToUserIds [directToUserIds]'
69
- }, {
70
- option: '--groupId [groupId]'
71
- }, {
72
- option: '--networkId [networkId]'
73
- });
74
- }, _VivaEngageMessageAddCommand_initValidators = function _VivaEngageMessageAddCommand_initValidators() {
75
- this.validators.push(async (args) => {
76
- if (args.options.groupId && typeof args.options.groupId !== 'number') {
77
- return `${args.options.groupId} is not a number`;
78
- }
79
- if (args.options.networkId && typeof args.options.networkId !== 'number') {
80
- return `${args.options.networkId} is not a number`;
81
- }
82
- if (args.options.repliedToId && typeof args.options.repliedToId !== 'number') {
83
- return `${args.options.repliedToId} is not a number`;
84
- }
85
- if (args.options.groupId === undefined &&
86
- args.options.directToUserIds === undefined &&
87
- args.options.repliedToId === undefined) {
88
- return "You must either specify groupId, repliedToId or directToUserIds";
89
- }
90
- return true;
91
- });
92
- };
93
63
  export default new VivaEngageMessageAddCommand();
94
64
  //# sourceMappingURL=engage-message-add.js.map