@pnp/cli-microsoft365 12.0.0-beta.0be7d8d → 12.0.0-beta.1752794

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 (190) hide show
  1. package/.devproxy/generate-openapi-spec.json +1 -1
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/Auth.js +2 -6
  5. package/dist/auth/FileTokenStorage.js +0 -3
  6. package/dist/auth/msalCachePlugin.js +201 -12
  7. package/dist/googleAnalytics.js +96 -0
  8. package/dist/m365/commands/logout.js +2 -4
  9. package/dist/m365/entra/commands/m365group/m365group-remove.js +4 -3
  10. package/dist/m365/spe/commands/container/container-remove.js +6 -7
  11. package/dist/m365/spo/commands/app/app-add.js +35 -56
  12. package/dist/m365/spo/commands/app/app-deploy.js +41 -59
  13. package/dist/m365/spo/commands/app/app-get.js +40 -56
  14. package/dist/m365/spo/commands/app/app-install.js +20 -41
  15. package/dist/m365/spo/commands/app/app-instance-list.js +12 -24
  16. package/dist/m365/spo/commands/app/app-list.js +26 -44
  17. package/dist/m365/spo/commands/app/app-remove.js +32 -52
  18. package/dist/m365/spo/commands/app/app-retract.js +32 -51
  19. package/dist/m365/spo/commands/app/app-teamspackage-download.js +35 -54
  20. package/dist/m365/spo/commands/app/app-uninstall.js +21 -44
  21. package/dist/m365/spo/commands/app/app-upgrade.js +20 -41
  22. package/dist/m365/spo/commands/feature/feature-disable.js +20 -50
  23. package/dist/m365/spo/commands/feature/feature-enable.js +22 -50
  24. package/dist/m365/spo/commands/feature/feature-list.js +11 -36
  25. package/dist/m365/spo/commands/field/field-add.js +33 -62
  26. package/dist/m365/spo/commands/field/field-get.js +30 -57
  27. package/dist/m365/spo/commands/field/field-list.js +21 -46
  28. package/dist/m365/spo/commands/field/field-remove.js +32 -63
  29. package/dist/m365/spo/commands/field/field-set.js +34 -66
  30. package/dist/m365/spo/commands/file/file-archive.js +1 -1
  31. package/dist/m365/spo/commands/file/file-get.js +4 -3
  32. package/dist/m365/spo/commands/file/file-remove.js +5 -5
  33. package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
  34. package/dist/m365/spo/commands/folder/folder-archive.js +1 -1
  35. package/dist/m365/spo/commands/folder/folder-remove.js +5 -5
  36. package/dist/m365/spo/commands/folder/folder-unarchive.js +90 -0
  37. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-get.js +5 -0
  38. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-set.js +8 -26
  39. package/dist/m365/spo/commands/homesite/homesite-list.js +5 -0
  40. package/dist/m365/spo/commands/hubsite/hubsite-connect.js +38 -63
  41. package/dist/m365/spo/commands/hubsite/hubsite-data-get.js +11 -27
  42. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +25 -47
  43. package/dist/m365/spo/commands/hubsite/hubsite-get.js +25 -37
  44. package/dist/m365/spo/commands/hubsite/hubsite-list.js +12 -24
  45. package/dist/m365/spo/commands/hubsite/hubsite-register.js +10 -18
  46. package/dist/m365/spo/commands/hubsite/hubsite-rights-grant.js +14 -32
  47. package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +12 -29
  48. package/dist/m365/spo/commands/hubsite/hubsite-set.js +19 -46
  49. package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +11 -27
  50. package/dist/m365/spo/commands/list/list-remove.js +4 -4
  51. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +5 -4
  52. package/dist/m365/spo/commands/listitem/listitem-get.js +1 -12
  53. package/dist/m365/spo/commands/listitem/listitem-remove.js +8 -5
  54. package/dist/m365/spo/commands/navigation/navigation-node-list.js +6 -4
  55. package/dist/m365/spo/commands/page/page-remove.js +7 -7
  56. package/dist/m365/spo/commands/site/site-list.js +60 -49
  57. package/dist/m365/spo/commands/site/site-remove.js +7 -7
  58. package/dist/m365/spo/commands/spo-get.js +5 -0
  59. package/dist/m365/spo/commands/spo-set.js +10 -21
  60. package/dist/m365/spo/commands/storageentity/storageentity-get.js +23 -17
  61. package/dist/m365/spo/commands/storageentity/storageentity-list.js +39 -36
  62. package/dist/m365/spo/commands/storageentity/storageentity-remove.js +26 -33
  63. package/dist/m365/spo/commands/storageentity/storageentity-set.js +26 -36
  64. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  65. package/dist/m365/spo/commands/user/user-ensure.js +24 -60
  66. package/dist/m365/spo/commands/user/user-get.js +25 -65
  67. package/dist/m365/spo/commands/user/user-list.js +10 -18
  68. package/dist/m365/spo/commands/user/user-remove.js +26 -68
  69. package/dist/m365/spo/commands/userprofile/userprofile-get.js +10 -23
  70. package/dist/m365/spo/commands/userprofile/userprofile-set.js +10 -19
  71. package/dist/m365/spo/commands/web/web-add.js +20 -55
  72. package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +10 -18
  73. package/dist/m365/spo/commands/web/web-get.js +12 -30
  74. package/dist/m365/spo/commands/web/web-installedlanguage-list.js +10 -18
  75. package/dist/m365/spo/commands/web/web-list.js +10 -18
  76. package/dist/m365/spo/commands/web/web-reindex.js +10 -18
  77. package/dist/m365/spo/commands/web/web-remove.js +11 -27
  78. package/dist/m365/spo/commands/web/web-retentionlabel-list.js +10 -18
  79. package/dist/m365/spo/commands/web/web-roleassignment-add.js +40 -64
  80. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +31 -58
  81. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +12 -36
  82. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +11 -29
  83. package/dist/m365/spo/commands/web/web-rule-get.js +47 -0
  84. package/dist/m365/spo/commands/web/web-rule-list.js +6 -4
  85. package/dist/m365/spo/commands/web/web-rule-remove.js +0 -3
  86. package/dist/m365/spo/commands/web/web-set.js +26 -96
  87. package/dist/m365/spo/commands.js +3 -3
  88. package/dist/m365/teams/commands/channel/channel-add.js +46 -57
  89. package/dist/m365/teams/commands/channel/channel-get.js +41 -48
  90. package/dist/m365/teams/commands/channel/channel-list.js +30 -48
  91. package/dist/m365/teams/commands/channel/channel-member-add.js +55 -60
  92. package/dist/m365/teams/commands/channel/channel-member-list.js +49 -61
  93. package/dist/m365/teams/commands/channel/channel-member-remove.js +64 -68
  94. package/dist/m365/teams/commands/channel/channel-member-set.js +63 -71
  95. package/dist/m365/teams/commands/channel/channel-remove.js +49 -57
  96. package/dist/m365/teams/commands/channel/channel-set.js +49 -62
  97. package/dist/m365/teams/commands/chat/chat-get.js +30 -45
  98. package/dist/m365/teams/commands/chat/chat-list.js +22 -42
  99. package/dist/m365/teams/commands/chat/chat-member-add.js +43 -64
  100. package/dist/m365/teams/commands/chat/chat-member-list.js +10 -23
  101. package/dist/m365/teams/commands/chat/chat-member-remove.js +28 -50
  102. package/dist/m365/teams/commands/chat/chat-message-send.js +32 -55
  103. package/dist/m365/teams/commands/tab/tab-get.js +2 -6
  104. package/dist/m365/teams/commands/team/team-archive.js +2 -6
  105. package/dist/m365/teams/commands/team/team-remove.js +2 -6
  106. package/dist/m365/teams/commands/team/team-unarchive.js +2 -6
  107. package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -28
  108. package/dist/telemetry.js +7 -11
  109. package/dist/utils/spo.js +1 -3
  110. package/dist/utils/urlUtil.js +2 -2
  111. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +4 -4
  112. package/docs/docs/cmd/spe/container/container-remove.mdx +5 -5
  113. package/docs/docs/cmd/spo/file/file-archive.mdx +9 -1
  114. package/docs/docs/cmd/spo/file/file-checkin.mdx +2 -2
  115. package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -1
  116. package/docs/docs/cmd/spo/file/file-checkout.mdx +2 -2
  117. package/docs/docs/cmd/spo/file/file-copy.mdx +2 -2
  118. package/docs/docs/cmd/spo/file/file-get.mdx +6 -6
  119. package/docs/docs/cmd/spo/file/file-remove.mdx +4 -4
  120. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
  121. package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +1 -1
  122. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
  123. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  124. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +3 -3
  125. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +2 -2
  126. package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +2 -2
  127. package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +22 -1
  128. package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +24 -1
  129. package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +22 -1
  130. package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +22 -1
  131. package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +24 -1
  132. package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +22 -1
  133. package/docs/docs/cmd/spo/file/file-unarchive.mdx +9 -1
  134. package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
  135. package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
  136. package/docs/docs/cmd/spo/file/file-version-keep.mdx +1 -1
  137. package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
  138. package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
  139. package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
  140. package/docs/docs/cmd/spo/folder/folder-archive.mdx +7 -1
  141. package/docs/docs/cmd/spo/folder/folder-copy.mdx +1 -1
  142. package/docs/docs/cmd/spo/folder/folder-get.mdx +2 -2
  143. package/docs/docs/cmd/spo/folder/folder-remove.mdx +4 -4
  144. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
  145. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
  146. package/docs/docs/cmd/spo/folder/folder-sharinglink-add.mdx +22 -1
  147. package/docs/docs/cmd/spo/folder/folder-sharinglink-clear.mdx +23 -0
  148. package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +21 -0
  149. package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +22 -1
  150. package/docs/docs/cmd/spo/folder/folder-sharinglink-remove.mdx +24 -1
  151. package/docs/docs/cmd/spo/folder/folder-sharinglink-set.mdx +21 -0
  152. package/docs/docs/cmd/spo/folder/folder-unarchive.mdx +76 -0
  153. package/docs/docs/cmd/spo/list/list-remove.mdx +4 -4
  154. package/docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx +8 -2
  155. package/docs/docs/cmd/spo/listitem/listitem-get.mdx +0 -6
  156. package/docs/docs/cmd/spo/listitem/listitem-remove.mdx +8 -2
  157. package/docs/docs/cmd/spo/navigation/navigation-node-list.mdx +37 -27
  158. package/docs/docs/cmd/spo/page/page-remove.mdx +4 -4
  159. package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +52 -21
  160. package/docs/docs/cmd/spo/site/site-list.mdx +22 -1
  161. package/docs/docs/cmd/spo/site/site-remove.mdx +3 -3
  162. package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +11 -2
  163. package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +9 -3
  164. package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +6 -6
  165. package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +10 -4
  166. package/docs/docs/cmd/spo/web/web-rule-get.mdx +108 -0
  167. package/docs/docs/cmd/spo/web/web-rule-list.mdx +8 -12
  168. package/docs/docs/cmd/spo/web/web-rule-remove.mdx +0 -6
  169. package/docs/docs/cmd/spp/model/model-get.mdx +1 -1
  170. package/docs/docs/cmd/spp/model/model-remove.mdx +1 -1
  171. package/docs/docs/cmd/teams/app/app-install.mdx +21 -0
  172. package/docs/docs/cmd/teams/app/app-list.mdx +19 -0
  173. package/docs/docs/cmd/teams/app/app-publish.mdx +17 -0
  174. package/docs/docs/cmd/teams/app/app-remove.mdx +19 -0
  175. package/docs/docs/cmd/teams/app/app-uninstall.mdx +21 -0
  176. package/docs/docs/cmd/teams/app/app-update.mdx +19 -0
  177. package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +19 -0
  178. package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +19 -0
  179. package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +19 -0
  180. package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +19 -0
  181. package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +19 -0
  182. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.mdx +19 -0
  183. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.mdx +19 -0
  184. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.mdx +19 -0
  185. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +19 -0
  186. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +19 -0
  187. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +19 -0
  188. package/npm-shrinkwrap.json +1120 -3216
  189. package/package.json +23 -33
  190. package/dist/appInsights.js +0 -43
@@ -1,32 +1,78 @@
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 _TeamsChannelMemberSetCommand_instances, _TeamsChannelMemberSetCommand_initTelemetry, _TeamsChannelMemberSetCommand_initOptions, _TeamsChannelMemberSetCommand_initValidators, _TeamsChannelMemberSetCommand_initOptionSets;
7
1
  import request from '../../../../request.js';
8
- import { entraGroup } from '../../../../utils/entraGroup.js';
9
2
  import { formatting } from '../../../../utils/formatting.js';
3
+ import { teams } from '../../../../utils/teams.js';
10
4
  import { validation } from '../../../../utils/validation.js';
11
5
  import GraphCommand from '../../../base/GraphCommand.js';
12
6
  import commands from '../../commands.js';
13
7
  import { cli } from '../../../../cli/cli.js';
8
+ import { globalOptionsZod } from '../../../../Command.js';
9
+ import { z } from 'zod';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ teamId: z.string()
13
+ .refine(val => validation.isValidGuid(val), {
14
+ message: 'The value must be a valid GUID.'
15
+ })
16
+ .optional(),
17
+ teamName: z.string()
18
+ .optional(),
19
+ channelId: z.string()
20
+ .refine(val => validation.isValidTeamsChannelId(val), {
21
+ message: 'The value is not a valid Teams channel id.'
22
+ })
23
+ .optional(),
24
+ channelName: z.string()
25
+ .optional(),
26
+ userName: z.string()
27
+ .optional(),
28
+ userId: z.string()
29
+ .refine(val => validation.isValidGuid(val), {
30
+ message: 'The value must be a valid GUID.'
31
+ })
32
+ .optional(),
33
+ id: z.string()
34
+ .optional(),
35
+ role: z.enum(['owner', 'member'])
36
+ .alias('r')
37
+ });
14
38
  class TeamsChannelMemberSetCommand extends GraphCommand {
39
+ constructor() {
40
+ super(...arguments);
41
+ this.teamId = '';
42
+ this.channelId = '';
43
+ }
15
44
  get name() {
16
45
  return commands.CHANNEL_MEMBER_SET;
17
46
  }
18
47
  get description() {
19
48
  return 'Updates the role of the specified member in the specified Microsoft Teams private or shared team channel';
20
49
  }
21
- constructor() {
22
- super();
23
- _TeamsChannelMemberSetCommand_instances.add(this);
24
- this.teamId = '';
25
- this.channelId = '';
26
- __classPrivateFieldGet(this, _TeamsChannelMemberSetCommand_instances, "m", _TeamsChannelMemberSetCommand_initTelemetry).call(this);
27
- __classPrivateFieldGet(this, _TeamsChannelMemberSetCommand_instances, "m", _TeamsChannelMemberSetCommand_initOptions).call(this);
28
- __classPrivateFieldGet(this, _TeamsChannelMemberSetCommand_instances, "m", _TeamsChannelMemberSetCommand_initValidators).call(this);
29
- __classPrivateFieldGet(this, _TeamsChannelMemberSetCommand_instances, "m", _TeamsChannelMemberSetCommand_initOptionSets).call(this);
50
+ get schema() {
51
+ return options;
52
+ }
53
+ getRefinedSchema(schema) {
54
+ return schema
55
+ .refine(opts => [opts.teamId, opts.teamName].filter(x => x !== undefined).length === 1, {
56
+ message: 'Specify either teamId or teamName, but not both.',
57
+ params: {
58
+ customCode: 'optionSet',
59
+ options: ['teamId', 'teamName']
60
+ }
61
+ })
62
+ .refine(opts => [opts.channelId, opts.channelName].filter(x => x !== undefined).length === 1, {
63
+ message: 'Specify either channelId or channelName, but not both.',
64
+ params: {
65
+ customCode: 'optionSet',
66
+ options: ['channelId', 'channelName']
67
+ }
68
+ })
69
+ .refine(opts => [opts.userName, opts.userId, opts.id].filter(x => x !== undefined).length === 1, {
70
+ message: 'Specify either userName, userId, or id, but not both.',
71
+ params: {
72
+ customCode: 'optionSet',
73
+ options: ['userName', 'userId', 'id']
74
+ }
75
+ });
30
76
  }
31
77
  async commandAction(logger, args) {
32
78
  try {
@@ -56,11 +102,7 @@ class TeamsChannelMemberSetCommand extends GraphCommand {
56
102
  if (args.options.teamId) {
57
103
  return args.options.teamId;
58
104
  }
59
- const group = await entraGroup.getGroupByDisplayName(args.options.teamName);
60
- if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
61
- throw `The specified team does not exist in the Microsoft Teams`;
62
- }
63
- return group.id;
105
+ return teams.getTeamIdByDisplayName(args.options.teamName);
64
106
  }
65
107
  async getChannelId(args) {
66
108
  if (args.options.channelId) {
@@ -109,55 +151,5 @@ class TeamsChannelMemberSetCommand extends GraphCommand {
109
151
  return conversationMember.id;
110
152
  }
111
153
  }
112
- _TeamsChannelMemberSetCommand_instances = new WeakSet(), _TeamsChannelMemberSetCommand_initTelemetry = function _TeamsChannelMemberSetCommand_initTelemetry() {
113
- this.telemetry.push((args) => {
114
- Object.assign(this.telemetryProperties, {
115
- teamId: typeof args.options.teamId !== 'undefined',
116
- teamName: typeof args.options.teamName !== 'undefined',
117
- channelId: typeof args.options.channelId !== 'undefined',
118
- channelName: typeof args.options.channelName !== 'undefined',
119
- userName: typeof args.options.userName !== 'undefined',
120
- userId: typeof args.options.userId !== 'undefined',
121
- id: typeof args.options.id !== 'undefined'
122
- });
123
- });
124
- }, _TeamsChannelMemberSetCommand_initOptions = function _TeamsChannelMemberSetCommand_initOptions() {
125
- this.options.unshift({
126
- option: '--teamId [teamId]'
127
- }, {
128
- option: '--teamName [teamName]'
129
- }, {
130
- option: '--channelId [channelId]'
131
- }, {
132
- option: '--channelName [channelName]'
133
- }, {
134
- option: '--userName [userName]'
135
- }, {
136
- option: '--userId [userId]'
137
- }, {
138
- option: '--id [id]'
139
- }, {
140
- option: '-r, --role <role>',
141
- autocomplete: ['owner', 'member']
142
- });
143
- }, _TeamsChannelMemberSetCommand_initValidators = function _TeamsChannelMemberSetCommand_initValidators() {
144
- this.validators.push(async (args) => {
145
- if (args.options.teamId && !validation.isValidGuid(args.options.teamId)) {
146
- return `${args.options.teamId} is not a valid GUID`;
147
- }
148
- if (args.options.channelId && !validation.isValidTeamsChannelId(args.options.channelId)) {
149
- return `${args.options.channelId} is not a valid Teams Channel ID`;
150
- }
151
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
152
- return `${args.options.userId} is not a valid GUID`;
153
- }
154
- if (['owner', 'member'].indexOf(args.options.role) === -1) {
155
- return `${args.options.role} is not a valid role value. Allowed values owner|member`;
156
- }
157
- return true;
158
- });
159
- }, _TeamsChannelMemberSetCommand_initOptionSets = function _TeamsChannelMemberSetCommand_initOptionSets() {
160
- this.optionSets.push({ options: ['teamId', 'teamName'] }, { options: ['channelId', 'channelName'] }, { options: ['userName', 'userId', 'id'] });
161
- };
162
154
  export default new TeamsChannelMemberSetCommand();
163
155
  //# sourceMappingURL=channel-member-set.js.map
@@ -1,31 +1,64 @@
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 _TeamsChannelRemoveCommand_instances, _TeamsChannelRemoveCommand_initTelemetry, _TeamsChannelRemoveCommand_initOptions, _TeamsChannelRemoveCommand_initValidators, _TeamsChannelRemoveCommand_initOptionSets;
7
1
  import { cli } from '../../../../cli/cli.js';
8
2
  import request from '../../../../request.js';
9
- import { entraGroup } from '../../../../utils/entraGroup.js';
10
3
  import { formatting } from '../../../../utils/formatting.js';
4
+ import { teams } from '../../../../utils/teams.js';
11
5
  import { validation } from '../../../../utils/validation.js';
12
6
  import GraphCommand from '../../../base/GraphCommand.js';
13
7
  import commands from '../../commands.js';
8
+ import { globalOptionsZod } from '../../../../Command.js';
9
+ import { z } from 'zod';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ id: z.string()
13
+ .refine(val => validation.isValidTeamsChannelId(val), {
14
+ message: 'The value is not a valid Teams channel id.'
15
+ })
16
+ .optional()
17
+ .alias('i'),
18
+ name: z.string()
19
+ .optional()
20
+ .alias('n'),
21
+ teamId: z.string()
22
+ .refine(val => validation.isValidGuid(val), {
23
+ message: 'The value must be a valid GUID.'
24
+ })
25
+ .optional(),
26
+ teamName: z.string()
27
+ .optional(),
28
+ force: z.boolean()
29
+ .optional()
30
+ .alias('f')
31
+ });
14
32
  class TeamsChannelRemoveCommand extends GraphCommand {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.teamId = "";
36
+ }
15
37
  get name() {
16
38
  return commands.CHANNEL_REMOVE;
17
39
  }
18
40
  get description() {
19
41
  return 'Removes the specified channel in the Microsoft Teams team';
20
42
  }
21
- constructor() {
22
- super();
23
- _TeamsChannelRemoveCommand_instances.add(this);
24
- this.teamId = "";
25
- __classPrivateFieldGet(this, _TeamsChannelRemoveCommand_instances, "m", _TeamsChannelRemoveCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _TeamsChannelRemoveCommand_instances, "m", _TeamsChannelRemoveCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _TeamsChannelRemoveCommand_instances, "m", _TeamsChannelRemoveCommand_initValidators).call(this);
28
- __classPrivateFieldGet(this, _TeamsChannelRemoveCommand_instances, "m", _TeamsChannelRemoveCommand_initOptionSets).call(this);
43
+ get schema() {
44
+ return options;
45
+ }
46
+ getRefinedSchema(schema) {
47
+ return schema
48
+ .refine(opts => [opts.id, opts.name].filter(x => x !== undefined).length === 1, {
49
+ message: 'Specify either id or name, but not both.',
50
+ params: {
51
+ customCode: 'optionSet',
52
+ options: ['id', 'name']
53
+ }
54
+ })
55
+ .refine(opts => [opts.teamId, opts.teamName].filter(x => x !== undefined).length === 1, {
56
+ message: 'Specify either teamId or teamName, but not both.',
57
+ params: {
58
+ customCode: 'optionSet',
59
+ options: ['teamId', 'teamName']
60
+ }
61
+ });
29
62
  }
30
63
  async commandAction(logger, args) {
31
64
  const removeChannel = async () => {
@@ -63,13 +96,7 @@ class TeamsChannelRemoveCommand extends GraphCommand {
63
96
  if (args.options.teamId) {
64
97
  return args.options.teamId;
65
98
  }
66
- const group = await entraGroup.getGroupByDisplayName(args.options.teamName);
67
- if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
68
- throw 'The specified team does not exist';
69
- }
70
- else {
71
- return group.id;
72
- }
99
+ return teams.getTeamIdByDisplayName(args.options.teamName);
73
100
  }
74
101
  async getChannelId(args) {
75
102
  if (args.options.id) {
@@ -90,40 +117,5 @@ class TeamsChannelRemoveCommand extends GraphCommand {
90
117
  return channelItem.id;
91
118
  }
92
119
  }
93
- _TeamsChannelRemoveCommand_instances = new WeakSet(), _TeamsChannelRemoveCommand_initTelemetry = function _TeamsChannelRemoveCommand_initTelemetry() {
94
- this.telemetry.push((args) => {
95
- Object.assign(this.telemetryProperties, {
96
- id: typeof args.options.id !== 'undefined',
97
- name: typeof args.options.name !== 'undefined',
98
- teamId: typeof args.options.teamId !== 'undefined',
99
- teamName: typeof args.options.teamName !== 'undefined',
100
- force: (!(!args.options.force)).toString()
101
- });
102
- });
103
- }, _TeamsChannelRemoveCommand_initOptions = function _TeamsChannelRemoveCommand_initOptions() {
104
- this.options.unshift({
105
- option: '--teamId [teamId]'
106
- }, {
107
- option: '--teamName [teamName]'
108
- }, {
109
- option: '-i, --id [id]'
110
- }, {
111
- option: '-n, --name [name]'
112
- }, {
113
- option: '-f, --force'
114
- });
115
- }, _TeamsChannelRemoveCommand_initValidators = function _TeamsChannelRemoveCommand_initValidators() {
116
- this.validators.push(async (args) => {
117
- if (args.options.id && !validation.isValidTeamsChannelId(args.options.id)) {
118
- return `${args.options.id} is not a valid Teams channel id`;
119
- }
120
- if (args.options.teamId && !validation.isValidGuid(args.options.teamId)) {
121
- return `${args.options.teamId} is not a valid GUID`;
122
- }
123
- return true;
124
- });
125
- }, _TeamsChannelRemoveCommand_initOptionSets = function _TeamsChannelRemoveCommand_initOptionSets() {
126
- this.optionSets.push({ options: ['id', 'name'] }, { options: ['teamId', 'teamName'] });
127
- };
128
120
  export default new TeamsChannelRemoveCommand();
129
121
  //# sourceMappingURL=channel-remove.js.map
@@ -1,15 +1,37 @@
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 _TeamsChannelSetCommand_instances, _TeamsChannelSetCommand_initTelemetry, _TeamsChannelSetCommand_initOptions, _TeamsChannelSetCommand_initValidators, _TeamsChannelSetCommand_initOptionSets;
7
1
  import request from '../../../../request.js';
8
- import { entraGroup } from '../../../../utils/entraGroup.js';
9
2
  import { formatting } from '../../../../utils/formatting.js';
3
+ import { teams } from '../../../../utils/teams.js';
10
4
  import { validation } from '../../../../utils/validation.js';
11
5
  import GraphCommand from '../../../base/GraphCommand.js';
12
6
  import commands from '../../commands.js';
7
+ import { globalOptionsZod } from '../../../../Command.js';
8
+ import { z } from 'zod';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ id: z.string()
12
+ .refine(val => validation.isValidTeamsChannelId(val), {
13
+ message: 'The value is not a valid Teams channel id.'
14
+ })
15
+ .optional()
16
+ .alias('i'),
17
+ name: z.string()
18
+ .refine(val => val.toLowerCase() !== 'general', {
19
+ message: 'General channel cannot be updated.'
20
+ })
21
+ .optional()
22
+ .alias('n'),
23
+ description: z.string()
24
+ .optional(),
25
+ newName: z.string()
26
+ .optional(),
27
+ teamId: z.string()
28
+ .refine(val => validation.isValidGuid(val), {
29
+ message: 'The value must be a valid GUID.'
30
+ })
31
+ .optional(),
32
+ teamName: z.string()
33
+ .optional()
34
+ });
13
35
  class TeamsChannelSetCommand extends GraphCommand {
14
36
  get name() {
15
37
  return commands.CHANNEL_SET;
@@ -17,13 +39,25 @@ class TeamsChannelSetCommand extends GraphCommand {
17
39
  get description() {
18
40
  return 'Updates properties of the specified channel in the given Microsoft Teams team';
19
41
  }
20
- constructor() {
21
- super();
22
- _TeamsChannelSetCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _TeamsChannelSetCommand_instances, "m", _TeamsChannelSetCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _TeamsChannelSetCommand_instances, "m", _TeamsChannelSetCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _TeamsChannelSetCommand_instances, "m", _TeamsChannelSetCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _TeamsChannelSetCommand_instances, "m", _TeamsChannelSetCommand_initOptionSets).call(this);
42
+ get schema() {
43
+ return options;
44
+ }
45
+ getRefinedSchema(schema) {
46
+ return schema
47
+ .refine(opts => [opts.id, opts.name].filter(x => x !== undefined).length === 1, {
48
+ message: 'Specify either id or name, but not both.',
49
+ params: {
50
+ customCode: 'optionSet',
51
+ options: ['id', 'name']
52
+ }
53
+ })
54
+ .refine(opts => [opts.teamId, opts.teamName].filter(x => x !== undefined).length === 1, {
55
+ message: 'Specify either teamId or teamName, but not both.',
56
+ params: {
57
+ customCode: 'optionSet',
58
+ options: ['teamId', 'teamName']
59
+ }
60
+ });
27
61
  }
28
62
  async commandAction(logger, args) {
29
63
  try {
@@ -58,13 +92,7 @@ class TeamsChannelSetCommand extends GraphCommand {
58
92
  if (args.options.teamId) {
59
93
  return args.options.teamId;
60
94
  }
61
- const group = await entraGroup.getGroupByDisplayName(args.options.teamName);
62
- if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
63
- throw 'The specified team does not exist';
64
- }
65
- else {
66
- return group.id;
67
- }
95
+ return teams.getTeamIdByDisplayName(args.options.teamName);
68
96
  }
69
97
  async getChannelId(teamId, args) {
70
98
  if (args.options.id) {
@@ -85,46 +113,5 @@ class TeamsChannelSetCommand extends GraphCommand {
85
113
  return channelItem.id;
86
114
  }
87
115
  }
88
- _TeamsChannelSetCommand_instances = new WeakSet(), _TeamsChannelSetCommand_initTelemetry = function _TeamsChannelSetCommand_initTelemetry() {
89
- this.telemetry.push((args) => {
90
- Object.assign(this.telemetryProperties, {
91
- id: typeof args.options.id !== 'undefined',
92
- name: typeof args.options.name !== 'undefined',
93
- teamId: typeof args.options.teamId !== 'undefined',
94
- teamName: typeof args.options.teamName !== 'undefined',
95
- newName: typeof args.options.newName !== 'undefined',
96
- description: typeof args.options.description !== 'undefined'
97
- });
98
- });
99
- }, _TeamsChannelSetCommand_initOptions = function _TeamsChannelSetCommand_initOptions() {
100
- this.options.unshift({
101
- option: '--teamId [teamId]'
102
- }, {
103
- option: '--teamName [teamName]'
104
- }, {
105
- option: '-i, --id [id]'
106
- }, {
107
- option: '-n, --name [name]'
108
- }, {
109
- option: '--newName [newName]'
110
- }, {
111
- option: '--description [description]'
112
- });
113
- }, _TeamsChannelSetCommand_initValidators = function _TeamsChannelSetCommand_initValidators() {
114
- this.validators.push(async (args) => {
115
- if (args.options.teamId && !validation.isValidGuid(args.options.teamId)) {
116
- return `${args.options.teamId} is not a valid GUID`;
117
- }
118
- if (args.options.id && !validation.isValidTeamsChannelId(args.options.id)) {
119
- return `${args.options.id} is not a valid Teams channel id`;
120
- }
121
- if (args.options.name && args.options.name.toLowerCase() === "general") {
122
- return 'General channel cannot be updated';
123
- }
124
- return true;
125
- });
126
- }, _TeamsChannelSetCommand_initOptionSets = function _TeamsChannelSetCommand_initOptionSets() {
127
- this.optionSets.push({ options: ['id', 'name'] }, { options: ['teamId', 'teamName'] });
128
- };
129
116
  export default new TeamsChannelSetCommand();
130
117
  //# sourceMappingURL=channel-set.js.map
@@ -1,10 +1,6 @@
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 _TeamsChatGetCommand_instances, _TeamsChatGetCommand_initTelemetry, _TeamsChatGetCommand_initOptions, _TeamsChatGetCommand_initValidators, _TeamsChatGetCommand_initOptionSets;
1
+ import { z } from 'zod';
7
2
  import auth from '../../../../Auth.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
5
  import { accessToken } from '../../../../utils/accessToken.js';
10
6
  import { formatting } from '../../../../utils/formatting.js';
@@ -13,6 +9,22 @@ import GraphCommand from '../../../base/GraphCommand.js';
13
9
  import commands from '../../commands.js';
14
10
  import { chatUtil } from './chatUtil.js';
15
11
  import { cli } from '../../../../cli/cli.js';
12
+ export const options = z.strictObject({
13
+ ...globalOptionsZod.shape,
14
+ id: z.string().refine(val => validation.isValidTeamsChatId(val), {
15
+ message: 'The value is not a valid Teams ChatId.'
16
+ }).alias('i').optional(),
17
+ participants: z.string().refine(val => {
18
+ const participants = val.trim().toLowerCase().split(',').filter(e => e && e !== '');
19
+ if (!participants || participants.length === 0) {
20
+ return false;
21
+ }
22
+ return participants.every(e => validation.isValidUserPrincipalName(e));
23
+ }, {
24
+ message: 'The option participants contains one or more invalid email addresses.'
25
+ }).alias('p').optional(),
26
+ name: z.string().alias('n').optional()
27
+ });
16
28
  class TeamsChatGetCommand extends GraphCommand {
17
29
  get name() {
18
30
  return commands.CHAT_GET;
@@ -20,13 +32,18 @@ class TeamsChatGetCommand extends GraphCommand {
20
32
  get description() {
21
33
  return 'Gets a Microsoft Teams chat conversation by id, participants or chat name.';
22
34
  }
23
- constructor() {
24
- super();
25
- _TeamsChatGetCommand_instances.add(this);
26
- __classPrivateFieldGet(this, _TeamsChatGetCommand_instances, "m", _TeamsChatGetCommand_initTelemetry).call(this);
27
- __classPrivateFieldGet(this, _TeamsChatGetCommand_instances, "m", _TeamsChatGetCommand_initOptions).call(this);
28
- __classPrivateFieldGet(this, _TeamsChatGetCommand_instances, "m", _TeamsChatGetCommand_initValidators).call(this);
29
- __classPrivateFieldGet(this, _TeamsChatGetCommand_instances, "m", _TeamsChatGetCommand_initOptionSets).call(this);
35
+ get schema() {
36
+ return options;
37
+ }
38
+ getRefinedSchema(schema) {
39
+ return schema
40
+ .refine(opts => [opts.id, opts.participants, opts.name].filter(x => x !== undefined).length === 1, {
41
+ message: 'Specify one of id, participants or name, but not more than one.',
42
+ params: {
43
+ customCode: 'optionSet',
44
+ options: ['id', 'participants', 'name']
45
+ }
46
+ });
30
47
  }
31
48
  async commandAction(logger, args) {
32
49
  try {
@@ -83,37 +100,5 @@ class TeamsChatGetCommand extends GraphCommand {
83
100
  return result.id;
84
101
  }
85
102
  }
86
- _TeamsChatGetCommand_instances = new WeakSet(), _TeamsChatGetCommand_initTelemetry = function _TeamsChatGetCommand_initTelemetry() {
87
- this.telemetry.push((args) => {
88
- Object.assign(this.telemetryProperties, {
89
- id: typeof args.options.id !== 'undefined',
90
- participants: typeof args.options.participants !== 'undefined',
91
- name: typeof args.options.name !== 'undefined'
92
- });
93
- });
94
- }, _TeamsChatGetCommand_initOptions = function _TeamsChatGetCommand_initOptions() {
95
- this.options.unshift({
96
- option: '-i, --id [id]'
97
- }, {
98
- option: '-p, --participants [participants]'
99
- }, {
100
- option: '-n, --name [name]'
101
- });
102
- }, _TeamsChatGetCommand_initValidators = function _TeamsChatGetCommand_initValidators() {
103
- this.validators.push(async (args) => {
104
- if (args.options.id && !validation.isValidTeamsChatId(args.options.id)) {
105
- return `${args.options.id} is not a valid Teams ChatId.`;
106
- }
107
- if (args.options.participants) {
108
- const participants = args.options.participants.trim().toLowerCase().split(',').filter(e => e && e !== '');
109
- if (!participants || participants.length === 0 || participants.some(e => !validation.isValidUserPrincipalName(e))) {
110
- return `${args.options.participants} contains one or more invalid email addresses.`;
111
- }
112
- }
113
- return true;
114
- });
115
- }, _TeamsChatGetCommand_initOptionSets = function _TeamsChatGetCommand_initOptionSets() {
116
- this.optionSets.push({ options: ['id', 'participants', 'name'] });
117
- };
118
103
  export default new TeamsChatGetCommand();
119
104
  //# sourceMappingURL=chat-get.js.map
@@ -1,15 +1,19 @@
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 _TeamsChatListCommand_instances, _TeamsChatListCommand_initTelemetry, _TeamsChatListCommand_initOptions, _TeamsChatListCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import auth from '../../../../Auth.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import { accessToken } from '../../../../utils/accessToken.js';
9
5
  import { odata } from '../../../../utils/odata.js';
10
6
  import { validation } from '../../../../utils/validation.js';
11
7
  import GraphCommand from '../../../base/GraphCommand.js';
12
8
  import commands from '../../commands.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ type: z.enum(['oneOnOne', 'group', 'meeting']).alias('t').optional(),
12
+ userId: z.string().refine(val => validation.isValidGuid(val), {
13
+ message: 'The value of the option userId must be a valid GUID.'
14
+ }).optional(),
15
+ userName: z.string().optional()
16
+ });
13
17
  class TeamsChatListCommand extends GraphCommand {
14
18
  get name() {
15
19
  return commands.CHAT_LIST;
@@ -20,13 +24,18 @@ class TeamsChatListCommand extends GraphCommand {
20
24
  defaultProperties() {
21
25
  return ['id', 'topic', 'chatType'];
22
26
  }
23
- constructor() {
24
- super();
25
- _TeamsChatListCommand_instances.add(this);
26
- this.supportedTypes = ['oneOnOne', 'group', 'meeting'];
27
- __classPrivateFieldGet(this, _TeamsChatListCommand_instances, "m", _TeamsChatListCommand_initTelemetry).call(this);
28
- __classPrivateFieldGet(this, _TeamsChatListCommand_instances, "m", _TeamsChatListCommand_initOptions).call(this);
29
- __classPrivateFieldGet(this, _TeamsChatListCommand_instances, "m", _TeamsChatListCommand_initValidators).call(this);
27
+ get schema() {
28
+ return options;
29
+ }
30
+ getRefinedSchema(schema) {
31
+ return schema
32
+ .refine(opts => !(opts.userId && opts.userName), {
33
+ message: 'You can only specify either userId or userName.',
34
+ params: {
35
+ customCode: 'optionSet',
36
+ options: ['userId', 'userName']
37
+ }
38
+ });
30
39
  }
31
40
  async commandAction(logger, args) {
32
41
  const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[this.resource].accessToken);
@@ -49,34 +58,5 @@ class TeamsChatListCommand extends GraphCommand {
49
58
  }
50
59
  }
51
60
  }
52
- _TeamsChatListCommand_instances = new WeakSet(), _TeamsChatListCommand_initTelemetry = function _TeamsChatListCommand_initTelemetry() {
53
- this.telemetry.push((args) => {
54
- Object.assign(this.telemetryProperties, {
55
- type: args.options.type
56
- });
57
- });
58
- }, _TeamsChatListCommand_initOptions = function _TeamsChatListCommand_initOptions() {
59
- this.options.unshift({
60
- option: '-t, --type [type]',
61
- autocomplete: this.supportedTypes
62
- }, {
63
- option: '--userId [userId]'
64
- }, {
65
- option: '--userName [userName]'
66
- });
67
- }, _TeamsChatListCommand_initValidators = function _TeamsChatListCommand_initValidators() {
68
- this.validators.push(async (args) => {
69
- if (args.options.type !== undefined && this.supportedTypes.indexOf(args.options.type) === -1) {
70
- return `${args.options.type} is not a valid chatType. Accepted values are ${this.supportedTypes.join(', ')}`;
71
- }
72
- if (args.options.userId && args.options.userName) {
73
- return `You can only specify either 'userId' or 'userName'`;
74
- }
75
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
76
- return `${args.options.userId} is not a valid GUID`;
77
- }
78
- return true;
79
- });
80
- };
81
61
  export default new TeamsChatListCommand();
82
62
  //# sourceMappingURL=chat-list.js.map