@pnp/cli-microsoft365 7.0.0-beta.093ef31 → 7.0.0-beta.18ce559

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 (188) hide show
  1. package/README.md +4 -4
  2. package/dist/Auth.js +10 -1
  3. package/dist/Command.js +2 -2
  4. package/dist/cli/Cli.js +4 -4
  5. package/dist/m365/aad/commands/app/app-get.js +4 -1
  6. package/dist/m365/aad/commands/app/app-remove.js +3 -1
  7. package/dist/m365/aad/commands/app/app-role-add.js +4 -1
  8. package/dist/m365/aad/commands/app/app-role-list.js +4 -1
  9. package/dist/m365/aad/commands/app/app-role-remove.js +5 -2
  10. package/dist/m365/aad/commands/app/app-set.js +8 -5
  11. package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +11 -6
  12. package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +4 -4
  13. package/dist/m365/aad/commands/group/group-get.js +4 -4
  14. package/dist/m365/aad/commands/group/group-list.js +1 -23
  15. package/dist/m365/aad/commands/group/group-remove.js +98 -0
  16. package/dist/m365/aad/commands/m365group/m365group-add.js +21 -12
  17. package/dist/m365/aad/commands/m365group/m365group-conversation-list.js +5 -0
  18. package/dist/m365/aad/commands/m365group/m365group-conversation-post-list.js +4 -0
  19. package/dist/m365/aad/commands/m365group/m365group-get.js +4 -3
  20. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +3 -1
  21. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-restore.js +4 -1
  22. package/dist/m365/aad/commands/m365group/m365group-remove.js +5 -0
  23. package/dist/m365/aad/commands/m365group/m365group-renew.js +5 -0
  24. package/dist/m365/aad/commands/m365group/m365group-set.js +5 -0
  25. package/dist/m365/aad/commands/m365group/m365group-teamify.js +14 -6
  26. package/dist/m365/aad/commands/m365group/m365group-user-add.js +5 -0
  27. package/dist/m365/aad/commands/m365group/m365group-user-list.js +5 -0
  28. package/dist/m365/aad/commands/m365group/m365group-user-remove.js +5 -0
  29. package/dist/m365/aad/commands/m365group/m365group-user-set.js +5 -0
  30. package/dist/m365/aad/commands/sp/sp-add.js +4 -1
  31. package/dist/m365/aad/commands/sp/sp-get.js +4 -1
  32. package/dist/m365/aad/commands/user/user-get.js +7 -2
  33. package/dist/m365/aad/commands.js +1 -0
  34. package/dist/m365/booking/commands/business/business-get.js +4 -1
  35. package/dist/m365/commands/login.js +2 -2
  36. package/dist/m365/flow/commands/flow-export.js +13 -13
  37. package/dist/m365/graph/commands/subscription/subscription-add.js +5 -5
  38. package/dist/m365/outlook/commands/message/message-list.js +4 -2
  39. package/dist/m365/outlook/commands/message/message-move.js +4 -2
  40. package/dist/m365/pa/commands/app/app-export.js +7 -7
  41. package/dist/m365/pa/commands/connector/connector-export.js +5 -5
  42. package/dist/m365/planner/commands/bucket/bucket-add.js +4 -1
  43. package/dist/m365/planner/commands/bucket/bucket-get.js +9 -2
  44. package/dist/m365/planner/commands/bucket/bucket-list.js +4 -1
  45. package/dist/m365/planner/commands/bucket/bucket-remove.js +7 -2
  46. package/dist/m365/planner/commands/bucket/bucket-set.js +8 -2
  47. package/dist/m365/planner/commands/plan/plan-add.js +4 -1
  48. package/dist/m365/planner/commands/plan/plan-get.js +4 -1
  49. package/dist/m365/planner/commands/plan/plan-list.js +4 -1
  50. package/dist/m365/planner/commands/plan/plan-remove.js +4 -1
  51. package/dist/m365/planner/commands/plan/plan-set.js +4 -1
  52. package/dist/m365/planner/commands/roster/roster-get.js +4 -1
  53. package/dist/m365/planner/commands/roster/roster-member-add.js +4 -1
  54. package/dist/m365/planner/commands/roster/roster-member-get.js +4 -1
  55. package/dist/m365/planner/commands/roster/roster-member-list.js +4 -1
  56. package/dist/m365/planner/commands/roster/roster-member-remove.js +4 -1
  57. package/dist/m365/planner/commands/roster/roster-plan-list.js +4 -1
  58. package/dist/m365/planner/commands/roster/roster-remove.js +4 -1
  59. package/dist/m365/planner/commands/task/task-add.js +4 -1
  60. package/dist/m365/planner/commands/task/task-checklistitem-add.js +4 -1
  61. package/dist/m365/planner/commands/task/task-checklistitem-list.js +4 -1
  62. package/dist/m365/planner/commands/task/task-checklistitem-remove.js +4 -1
  63. package/dist/m365/planner/commands/task/task-get.js +11 -3
  64. package/dist/m365/planner/commands/task/task-list.js +10 -2
  65. package/dist/m365/planner/commands/task/task-reference-add.js +4 -1
  66. package/dist/m365/planner/commands/task/task-reference-list.js +4 -1
  67. package/dist/m365/planner/commands/task/task-reference-remove.js +4 -1
  68. package/dist/m365/planner/commands/task/task-remove.js +10 -4
  69. package/dist/m365/planner/commands/task/task-set.js +4 -1
  70. package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-get.js +4 -1
  71. package/dist/m365/pp/commands/card/card-get.js +3 -5
  72. package/dist/m365/pp/commands/chatbot/chatbot-get.js +3 -1
  73. package/dist/m365/pp/commands/chatbot/chatbot-list.js +2 -2
  74. package/dist/m365/pp/commands/managementapp/managementapp-add.js +4 -1
  75. package/dist/m365/search/commands/externalconnection/externalconnection-remove.js +3 -1
  76. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.5.js → doctor-1.18.0.js} +2 -2
  77. package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
  78. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001022_DEP_office_ui_fabric_react.js +1 -1
  79. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002028_DEVDEP_microsoft_rush_stack_compiler_4_7.js +13 -0
  80. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.5.js → upgrade-1.18.0.js} +35 -27
  81. package/dist/m365/spfx/commands/project/project-upgrade.js +13 -15
  82. package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
  83. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +5 -3
  84. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -2
  85. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +3 -2
  86. package/dist/m365/spo/commands/commandset/commandset-get.js +4 -2
  87. package/dist/m365/spo/commands/commandset/commandset-remove.js +2 -1
  88. package/dist/m365/spo/commands/commandset/commandset-set.js +3 -1
  89. package/dist/m365/spo/commands/customaction/customaction-get.js +5 -2
  90. package/dist/m365/spo/commands/customaction/customaction-remove.js +3 -1
  91. package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +3 -1
  92. package/dist/m365/spo/commands/file/file-get.js +11 -8
  93. package/dist/m365/spo/commands/file/file-remove.js +2 -2
  94. package/dist/m365/spo/commands/file/file-version-clear.js +2 -2
  95. package/dist/m365/spo/commands/file/file-version-get.js +2 -2
  96. package/dist/m365/spo/commands/file/file-version-list.js +2 -2
  97. package/dist/m365/spo/commands/file/file-version-remove.js +2 -2
  98. package/dist/m365/spo/commands/file/file-version-restore.js +2 -2
  99. package/dist/m365/spo/commands/group/group-member-add.js +24 -24
  100. package/dist/m365/spo/commands/hubsite/hubsite-connect.js +7 -4
  101. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +4 -1
  102. package/dist/m365/spo/commands/hubsite/hubsite-get.js +3 -1
  103. package/dist/m365/spo/commands/listitem/listitem-add.js +1 -0
  104. package/dist/m365/spo/commands/listitem/listitem-attachment-add.js +127 -0
  105. package/dist/m365/spo/commands/listitem/listitem-attachment-get.js +97 -0
  106. package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +121 -0
  107. package/dist/m365/spo/commands/listitem/listitem-attachment-set.js +115 -0
  108. package/dist/m365/spo/commands/listitem/listitem-set.js +3 -2
  109. package/dist/m365/spo/commands/page/clientsidepages.js +18 -0
  110. package/dist/m365/spo/commands/page/page-get.js +1 -0
  111. package/dist/m365/spo/commands/page/page-list.js +4 -3
  112. package/dist/m365/spo/commands/page/page-section-add.js +56 -21
  113. package/dist/m365/spo/commands/page/page-set.js +13 -2
  114. package/dist/m365/spo/commands/site/site-commsite-enable.js +34 -5
  115. package/dist/m365/spo/commands/site/site-list.js +5 -7
  116. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  117. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +8 -3
  118. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +3 -2
  119. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -1
  120. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +3 -2
  121. package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +8 -3
  122. package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +3 -2
  123. package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +3 -1
  124. package/dist/m365/spo/commands/term/term-get.js +6 -6
  125. package/dist/m365/spo/commands/user/user-get.js +10 -10
  126. package/dist/m365/spo/commands.js +4 -0
  127. package/dist/m365/teams/commands/app/app-remove.js +49 -15
  128. package/dist/m365/teams/commands/channel/channel-add.js +5 -1
  129. package/dist/m365/teams/commands/channel/channel-member-add.js +12 -10
  130. package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -1
  131. package/dist/m365/teams/commands/channel/channel-member-set.js +4 -1
  132. package/dist/m365/teams/commands/chat/chat-get.js +7 -10
  133. package/dist/m365/teams/commands/chat/chat-message-send.js +8 -10
  134. package/dist/m365/teams/commands/team/team-clone.js +5 -10
  135. package/dist/m365/teams/commands/team/team-list.js +94 -30
  136. package/dist/m365/tenant/commands/info/info-get.js +83 -0
  137. package/dist/m365/tenant/commands.js +1 -0
  138. package/dist/utils/aadGroup.js +21 -3
  139. package/dist/utils/formatting.js +7 -0
  140. package/dist/utils/powerPlatform.js +1 -1
  141. package/docs/docs/_clisettings.mdx +1 -1
  142. package/docs/docs/cmd/aad/app/app-set.mdx +15 -15
  143. package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +9 -9
  144. package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +10 -10
  145. package/docs/docs/cmd/aad/group/group-get.mdx +5 -5
  146. package/docs/docs/cmd/aad/group/group-list.mdx +0 -11
  147. package/docs/docs/cmd/aad/group/group-remove.mdx +44 -0
  148. package/docs/docs/cmd/aad/m365group/m365group-add.mdx +13 -3
  149. package/docs/docs/cmd/aad/policy/policy-list.mdx +5 -5
  150. package/docs/docs/cmd/cli/config/config-list.mdx +1 -1
  151. package/docs/docs/cmd/flow/flow-export.mdx +11 -11
  152. package/docs/docs/cmd/graph/subscription/subscription-add.mdx +10 -10
  153. package/docs/docs/cmd/pa/app/app-export.mdx +5 -5
  154. package/docs/docs/cmd/pa/connector/connector-export.mdx +3 -3
  155. package/docs/docs/cmd/pp/chatbot/chatbot-list.mdx +4 -4
  156. package/docs/docs/cmd/pp/solution/solution-publisher-get.mdx +2 -2
  157. package/docs/docs/cmd/pp/solution/solution-publisher-remove.mdx +2 -2
  158. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  159. package/docs/docs/cmd/spo/file/file-get.mdx +2 -2
  160. package/docs/docs/cmd/spo/file/file-remove.mdx +2 -2
  161. package/docs/docs/cmd/spo/file/file-version-clear.mdx +2 -2
  162. package/docs/docs/cmd/spo/file/file-version-get.mdx +2 -2
  163. package/docs/docs/cmd/spo/file/file-version-list.mdx +2 -2
  164. package/docs/docs/cmd/spo/file/file-version-remove.mdx +2 -2
  165. package/docs/docs/cmd/spo/file/file-version-restore.mdx +2 -2
  166. package/docs/docs/cmd/spo/group/group-member-add.mdx +27 -27
  167. package/docs/docs/cmd/spo/list/list-contenttype-remove.mdx +1 -1
  168. package/docs/docs/cmd/spo/listitem/listitem-add.mdx +2 -5
  169. package/docs/docs/cmd/spo/listitem/listitem-attachment-add.mdx +110 -0
  170. package/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx +104 -0
  171. package/docs/docs/cmd/spo/listitem/listitem-attachment-remove.mdx +58 -0
  172. package/docs/docs/cmd/spo/listitem/listitem-attachment-set.mdx +58 -0
  173. package/docs/docs/cmd/spo/listitem/listitem-set.mdx +2 -5
  174. package/docs/docs/cmd/spo/page/page-get.mdx +0 -1
  175. package/docs/docs/cmd/spo/page/page-list.mdx +0 -1
  176. package/docs/docs/cmd/spo/page/page-section-add.mdx +25 -1
  177. package/docs/docs/cmd/spo/page/page-set.mdx +23 -0
  178. package/docs/docs/cmd/spo/site/site-commsite-enable.mdx +11 -2
  179. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +2 -4
  180. package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +2 -4
  181. package/docs/docs/cmd/spo/user/user-get.mdx +8 -8
  182. package/docs/docs/cmd/teams/app/app-remove.mdx +9 -6
  183. package/docs/docs/cmd/teams/channel/channel-member-add.mdx +4 -4
  184. package/docs/docs/cmd/teams/team/team-clone.mdx +3 -3
  185. package/docs/docs/cmd/teams/team/team-list.mdx +47 -22
  186. package/docs/docs/cmd/tenant/info/info-get.mdx +101 -0
  187. package/npm-shrinkwrap.json +24 -24
  188. package/package.json +8 -12
@@ -10,7 +10,7 @@ import SpoCommand from '../../../base/SpoCommand.js';
10
10
  import commands from '../../commands.js';
11
11
  import { spo } from '../../../../utils/spo.js';
12
12
  import { formatting } from '../../../../utils/formatting.js';
13
- import os from 'os';
13
+ import { Cli } from '../../../../cli/Cli.js';
14
14
  class SpoApplicationCustomizerSetCommand extends SpoCommand {
15
15
  get name() {
16
16
  return commands.APPLICATIONCUSTOMIZER_SET;
@@ -82,7 +82,8 @@ class SpoApplicationCustomizerSetCommand extends SpoCommand {
82
82
  throw `No application customizer with ${title && `title '${title}'` || clientSideComponentId && `ClientSideComponentId '${clientSideComponentId}'` || id && `id '${id}'`} found`;
83
83
  }
84
84
  if (appCustomizers.length > 1) {
85
- throw `Multiple application customizer with ${title ? `title '${title}'` : `ClientSideComponentId '${clientSideComponentId}'`} found. Please disambiguate using IDs: ${os.EOL}${appCustomizers.map(a => `- ${a.Id}`).join(os.EOL)}`;
85
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', appCustomizers);
86
+ return await Cli.handleMultipleResultsFound(`Multiple application customizer with ${title ? `title '${title}'` : `ClientSideComponentId '${clientSideComponentId}'`} found.`, resultAsKeyValuePair);
86
87
  }
87
88
  return appCustomizers[0];
88
89
  }
@@ -4,12 +4,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _SpoCommandSetGetCommand_instances, _a, _SpoCommandSetGetCommand_initTelemetry, _SpoCommandSetGetCommand_initOptions, _SpoCommandSetGetCommand_initValidators, _SpoCommandSetGetCommand_initOptionSets;
7
- import os from 'os';
8
7
  import { formatting } from '../../../../utils/formatting.js';
9
8
  import { spo } from '../../../../utils/spo.js';
10
9
  import { validation } from '../../../../utils/validation.js';
11
10
  import SpoCommand from '../../../base/SpoCommand.js';
12
11
  import commands from '../../commands.js';
12
+ import { Cli } from '../../../../cli/Cli.js';
13
13
  class SpoCommandSetGetCommand extends SpoCommand {
14
14
  get name() {
15
15
  return commands.COMMANDSET_GET;
@@ -58,7 +58,9 @@ class SpoCommandSetGetCommand extends SpoCommand {
58
58
  throw `No command set with title '${args.options.title}' found.`;
59
59
  }
60
60
  else {
61
- throw `Multiple command sets with title '${args.options.title}' found. Please disambiguate using IDs: ${os.EOL}${commandSets.map(commandSet => `- ${commandSet.Id}`).join(os.EOL)}.`;
61
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', commandSets);
62
+ const commandSet = await Cli.handleMultipleResultsFound(`Multiple command sets with title '${args.options.title}' found.`, resultAsKeyValuePair);
63
+ logger.log(commandSet);
62
64
  }
63
65
  }
64
66
  }
@@ -63,7 +63,8 @@ class SpoCommandSetRemoveCommand extends SpoCommand {
63
63
  throw `No user commandsets with ${options.title && `title '${options.title}'` || options.clientSideComponentId && `ClientSideComponentId '${options.clientSideComponentId}'` || options.id && `id '${options.id}'`} found`;
64
64
  }
65
65
  if (commandSets.length > 1) {
66
- throw `Multiple user commandsets with ${options.title ? `title '${options.title}'` : `ClientSideComponentId '${options.clientSideComponentId}'`} found. Please disambiguate using IDs: ${commandSets.map((commandSet) => commandSet.Id).join(', ')}`;
66
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', commandSets);
67
+ return await Cli.handleMultipleResultsFound(`Multiple user commandsets with ${options.title ? `title '${options.title}'` : `ClientSideComponentId '${options.clientSideComponentId}'`} found.`, resultAsKeyValuePair);
67
68
  }
68
69
  return commandSets[0];
69
70
  }
@@ -10,6 +10,7 @@ import SpoCommand from '../../../base/SpoCommand.js';
10
10
  import request from '../../../../request.js';
11
11
  import { formatting } from '../../../../utils/formatting.js';
12
12
  import { spo } from '../../../../utils/spo.js';
13
+ import { Cli } from '../../../../cli/Cli.js';
13
14
  class SpoCommandSetSetCommand extends SpoCommand {
14
15
  get name() {
15
16
  return commands.COMMANDSET_SET;
@@ -84,7 +85,8 @@ class SpoCommandSetSetCommand extends SpoCommand {
84
85
  throw `No user commandsets with ${options.title && `title '${options.title}'` || options.clientSideComponentId && `ClientSideComponentId '${options.clientSideComponentId}'` || options.id && `id '${options.id}'`} found`;
85
86
  }
86
87
  if (commandSets.length > 1) {
87
- throw `Multiple user commandsets with ${options.title ? `title '${options.title}'` : `ClientSideComponentId '${options.clientSideComponentId}'`} found. Please disambiguate using IDs: ${commandSets.map((commandSet) => commandSet.Id).join(', ')}`;
88
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', commandSets);
89
+ return await Cli.handleMultipleResultsFound(`Multiple user commandsets with ${options.title ? `title '${options.title}'` : `ClientSideComponentId '${options.clientSideComponentId}'`} found.`, resultAsKeyValuePair);
88
90
  }
89
91
  return commandSets[0];
90
92
  }
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _SpoCustomActionGetCommand_instances, _SpoCustomActionGetCommand_initTelemetry, _SpoCustomActionGetCommand_initOptions, _SpoCustomActionGetCommand_initValidators, _SpoCustomActionGetCommand_initOptionSets;
7
+ import { Cli } from '../../../../cli/Cli.js';
7
8
  import { formatting } from '../../../../utils/formatting.js';
8
9
  import { spo } from '../../../../utils/spo.js';
9
10
  import { validation } from '../../../../utils/validation.js';
@@ -71,7 +72,8 @@ class SpoCustomActionGetCommand extends SpoCommand {
71
72
  if (customActions.length === 0) {
72
73
  throw `No user custom action with title '${options.title}' found`;
73
74
  }
74
- throw `Multiple user custom actions with title '${options.title}' found. Please disambiguate using IDs: ${customActions.map(a => a.Id).join(', ')}`;
75
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', customActions);
76
+ return await Cli.handleMultipleResultsFound(`Multiple user custom actions with title '${options.title}' found.`, resultAsKeyValuePair);
75
77
  }
76
78
  else {
77
79
  const customActions = await spo.getCustomActions(options.webUrl, options.scope, `ClientSideComponentId eq guid'${options.clientSideComponentId}'`);
@@ -79,7 +81,8 @@ class SpoCustomActionGetCommand extends SpoCommand {
79
81
  throw `No user custom action with ClientSideComponentId '${options.clientSideComponentId}' found`;
80
82
  }
81
83
  if (customActions.length > 1) {
82
- throw `Multiple user custom actions with ClientSideComponentId '${options.clientSideComponentId}' found. Please disambiguate using IDs: ${customActions.map((customAction) => customAction.Id).join(', ')}`;
84
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', customActions);
85
+ return await Cli.handleMultipleResultsFound(`Multiple user custom actions with ClientSideComponentId '${options.clientSideComponentId}' found.`, resultAsKeyValuePair);
83
86
  }
84
87
  return customActions[0];
85
88
  }
@@ -72,7 +72,9 @@ class SpoCustomActionRemoveCommand extends SpoCommand {
72
72
  if (customActions.length === 0) {
73
73
  throw `No user custom action with title '${options.title}' found`;
74
74
  }
75
- throw `Multiple user custom actions with title '${options.title}' found. Please disambiguate using IDs: ${customActions.map(a => a.Id).join(', ')}`;
75
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', customActions);
76
+ const result = await Cli.handleMultipleResultsFound(`Multiple user custom actions with title '${options.title}' found.`, resultAsKeyValuePair);
77
+ return result.Id;
76
78
  }
77
79
  async removeScopedCustomAction(options) {
78
80
  const customActionId = await this.getCustomActionId(options);
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _SpoEventreceiverGetCommand_instances, _SpoEventreceiverGetCommand_initTelemetry, _SpoEventreceiverGetCommand_initOptions, _SpoEventreceiverGetCommand_initValidators, _SpoEventreceiverGetCommand_initOptionSets;
7
+ import { Cli } from '../../../../cli/Cli.js';
7
8
  import request from '../../../../request.js';
8
9
  import { formatting } from '../../../../utils/formatting.js';
9
10
  import { urlUtil } from '../../../../utils/urlUtil.js';
@@ -75,7 +76,8 @@ class SpoEventreceiverGetCommand extends SpoCommand {
75
76
  throw `The specified event receiver '${args.options.name}' does not exist.`;
76
77
  }
77
78
  if (res.value && res.value.length > 1) {
78
- throw `Multiple event receivers with name '${args.options.name}' found: ${res.value.map(x => x.ReceiverId)}`;
79
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('ReceiverId', res.value);
80
+ return await Cli.handleMultipleResultsFound(`Multiple event receivers with name '${args.options.name}' found.`, resultAsKeyValuePair);
79
81
  }
80
82
  return res.value[0];
81
83
  }
@@ -103,6 +103,9 @@ class SpoFileGetCommand extends SpoCommand {
103
103
  fileProperties.ListItemAllFields.RoleAssignments = response.value;
104
104
  }
105
105
  }
106
+ if (args.options.asListItem) {
107
+ delete fileProperties.ListItemAllFields.ID;
108
+ }
106
109
  await logger.log(args.options.asListItem ? fileProperties.ListItemAllFields : fileProperties);
107
110
  }
108
111
  }
@@ -115,20 +118,20 @@ class SpoFileGetCommand extends SpoCommand {
115
118
  _SpoFileGetCommand_instances = new WeakSet(), _SpoFileGetCommand_initTelemetry = function _SpoFileGetCommand_initTelemetry() {
116
119
  this.telemetry.push((args) => {
117
120
  Object.assign(this.telemetryProperties, {
118
- id: (!(!args.options.id)).toString(),
119
- url: (!(!args.options.url)).toString(),
120
- asString: args.options.asString || false,
121
- asListItem: args.options.asListItem || false,
122
- asFile: args.options.asFile || false,
123
- path: (!(!args.options.path)).toString(),
121
+ id: typeof args.options.id !== 'undefined',
122
+ url: typeof args.options.url !== 'undefined',
123
+ asString: !!args.options.asString,
124
+ asListItem: !!args.options.asListItem,
125
+ asFile: !!args.options.asFile,
126
+ path: typeof args.options.path !== 'undefined',
124
127
  withPermissions: !!args.options.withPermissions
125
128
  });
126
129
  });
127
130
  }, _SpoFileGetCommand_initOptions = function _SpoFileGetCommand_initOptions() {
128
131
  this.options.unshift({
129
- option: '-w, --webUrl <webUrl>'
132
+ option: '-u, --webUrl <webUrl>'
130
133
  }, {
131
- option: '-u, --url [url]'
134
+ option: '--url [url]'
132
135
  }, {
133
136
  option: '-i, --id [id]'
134
137
  }, {
@@ -92,11 +92,11 @@ _SpoFileRemoveCommand_instances = new WeakSet(), _SpoFileRemoveCommand_initTelem
92
92
  });
93
93
  }, _SpoFileRemoveCommand_initOptions = function _SpoFileRemoveCommand_initOptions() {
94
94
  this.options.unshift({
95
- option: '-w, --webUrl <webUrl>'
95
+ option: '-u, --webUrl <webUrl>'
96
96
  }, {
97
97
  option: '-i, --id [id]'
98
98
  }, {
99
- option: '-u, --url [url]'
99
+ option: '--url [url]'
100
100
  }, {
101
101
  option: '--recycle'
102
102
  }, {
@@ -79,9 +79,9 @@ _SpoFileVersionClearCommand_instances = new WeakSet(), _SpoFileVersionClearComma
79
79
  });
80
80
  }, _SpoFileVersionClearCommand_initOptions = function _SpoFileVersionClearCommand_initOptions() {
81
81
  this.options.unshift({
82
- option: '-w, --webUrl <webUrl>'
82
+ option: '-u, --webUrl <webUrl>'
83
83
  }, {
84
- option: '-u, --fileUrl [fileUrl]'
84
+ option: '--fileUrl [fileUrl]'
85
85
  }, {
86
86
  option: '-i, --fileId [fileId]'
87
87
  }, {
@@ -67,11 +67,11 @@ _SpoFileVersionGetCommand_instances = new WeakSet(), _SpoFileVersionGetCommand_i
67
67
  });
68
68
  }, _SpoFileVersionGetCommand_initOptions = function _SpoFileVersionGetCommand_initOptions() {
69
69
  this.options.unshift({
70
- option: '-w, --webUrl <webUrl>'
70
+ option: '-u, --webUrl <webUrl>'
71
71
  }, {
72
72
  option: '--label <label>'
73
73
  }, {
74
- option: '-u, --fileUrl [fileUrl]'
74
+ option: '--fileUrl [fileUrl]'
75
75
  }, {
76
76
  option: '-i, --fileId [fileId]'
77
77
  });
@@ -59,9 +59,9 @@ _SpoFileVersionListCommand_instances = new WeakSet(), _SpoFileVersionListCommand
59
59
  });
60
60
  }, _SpoFileVersionListCommand_initOptions = function _SpoFileVersionListCommand_initOptions() {
61
61
  this.options.unshift({
62
- option: '-w, --webUrl <webUrl>'
62
+ option: '-u, --webUrl <webUrl>'
63
63
  }, {
64
- option: '-u, --fileUrl [fileUrl]'
64
+ option: '--fileUrl [fileUrl]'
65
65
  }, {
66
66
  option: '-i, --fileId [fileId]'
67
67
  });
@@ -80,11 +80,11 @@ _SpoFileVersionRemoveCommand_instances = new WeakSet(), _SpoFileVersionRemoveCom
80
80
  });
81
81
  }, _SpoFileVersionRemoveCommand_initOptions = function _SpoFileVersionRemoveCommand_initOptions() {
82
82
  this.options.unshift({
83
- option: '-w, --webUrl <webUrl>'
83
+ option: '-u, --webUrl <webUrl>'
84
84
  }, {
85
85
  option: '--label <label>'
86
86
  }, {
87
- option: '-u, --fileUrl [fileUrl]'
87
+ option: '--fileUrl [fileUrl]'
88
88
  }, {
89
89
  option: '-i, --fileId [fileId]'
90
90
  }, {
@@ -80,11 +80,11 @@ _SpoFileVersionRestoreCommand_instances = new WeakSet(), _SpoFileVersionRestoreC
80
80
  });
81
81
  }, _SpoFileVersionRestoreCommand_initOptions = function _SpoFileVersionRestoreCommand_initOptions() {
82
82
  this.options.unshift({
83
- option: '-w, --webUrl <webUrl>'
83
+ option: '-u, --webUrl <webUrl>'
84
84
  }, {
85
85
  option: '--label <label>'
86
86
  }, {
87
- option: '-u, --fileUrl [fileUrl]'
87
+ option: '--fileUrl [fileUrl]'
88
88
  }, {
89
89
  option: '-i, --fileId [fileId]'
90
90
  }, {
@@ -82,24 +82,24 @@ class SpoGroupMemberAddCommand extends SpoCommand {
82
82
  await logger.logToStderr('Checking if the specified users and groups exist');
83
83
  }
84
84
  const validUserNames = [];
85
- const identifiers = args.options.userName ?? args.options.email ?? args.options.aadGroupId ?? args.options.aadGroupName ?? args.options.userId.toString();
85
+ const identifiers = args.options.userNames ?? args.options.emails ?? args.options.aadGroupIds ?? args.options.aadGroupNames ?? args.options.userIds.toString();
86
86
  await Promise.all(identifiers.split(',').map(async (identifier) => {
87
87
  const trimmedIdentifier = identifier.trim();
88
88
  try {
89
- if (args.options.userId) {
89
+ if (args.options.userIds) {
90
90
  if (this.verbose) {
91
91
  await logger.logToStderr(`Getting AAD ID of user with ID ${trimmedIdentifier}`);
92
92
  }
93
93
  const spoUserAzureId = await spo.getUserAzureIdBySpoId(args.options.webUrl, trimmedIdentifier);
94
94
  validUserNames.push(spoUserAzureId);
95
95
  }
96
- else if (args.options.userName) {
96
+ else if (args.options.userNames) {
97
97
  validUserNames.push(trimmedIdentifier);
98
98
  }
99
- else if (args.options.aadGroupId) {
99
+ else if (args.options.aadGroupIds) {
100
100
  validUserNames.push(trimmedIdentifier);
101
101
  }
102
- else if (args.options.aadGroupName) {
102
+ else if (args.options.aadGroupNames) {
103
103
  if (this.verbose) {
104
104
  await logger.logToStderr(`Getting ID of Azure AD group ${trimmedIdentifier}`);
105
105
  }
@@ -132,11 +132,11 @@ _SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_i
132
132
  Object.assign(this.telemetryProperties, {
133
133
  groupId: typeof args.options.groupId !== 'undefined',
134
134
  groupName: typeof args.options.groupName !== 'undefined',
135
- userName: typeof args.options.userName !== 'undefined',
136
- email: typeof args.options.email !== 'undefined',
137
- userId: typeof args.options.userId !== 'undefined',
138
- aadGroupId: typeof args.options.aadGroupId !== 'undefined',
139
- aadGroupName: typeof args.options.aadGroupName !== 'undefined'
135
+ userNames: typeof args.options.userNames !== 'undefined',
136
+ emails: typeof args.options.emails !== 'undefined',
137
+ userIds: typeof args.options.userIds !== 'undefined',
138
+ aadGroupIds: typeof args.options.aadGroupIds !== 'undefined',
139
+ aadGroupNames: typeof args.options.aadGroupNames !== 'undefined'
140
140
  });
141
141
  });
142
142
  }, _SpoGroupMemberAddCommand_initOptions = function _SpoGroupMemberAddCommand_initOptions() {
@@ -147,15 +147,15 @@ _SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_i
147
147
  }, {
148
148
  option: '--groupName [groupName]'
149
149
  }, {
150
- option: '--userName [userName]'
150
+ option: '--userNames [userNames]'
151
151
  }, {
152
- option: '--email [email]'
152
+ option: '--emails [emails]'
153
153
  }, {
154
- option: '--userId [userId]'
154
+ option: '--userIds [userIds]'
155
155
  }, {
156
- option: '--aadGroupId [aadGroupId]'
156
+ option: '--aadGroupIds [aadGroupIds]'
157
157
  }, {
158
- option: '--aadGroupName [aadGroupName]'
158
+ option: '--aadGroupNames [aadGroupNames]'
159
159
  });
160
160
  }, _SpoGroupMemberAddCommand_initValidators = function _SpoGroupMemberAddCommand_initValidators() {
161
161
  this.validators.push(async (args) => {
@@ -167,22 +167,22 @@ _SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_i
167
167
  return `Specified groupId ${args.options.groupId} is not a number`;
168
168
  }
169
169
  const userIdReg = new RegExp(/^[0-9,]*$/);
170
- if (args.options.userId && !userIdReg.test(args.options.userId)) {
171
- return `${args.options.userId} is not a number or a comma seperated value`;
170
+ if (args.options.userIds && !userIdReg.test(args.options.userIds)) {
171
+ return `${args.options.userIds} is not a number or a comma separated value`;
172
172
  }
173
- if (args.options.userName && args.options.userName.split(',').some(e => !validation.isValidUserPrincipalName(e))) {
174
- return `${args.options.userName} contains one or more invalid usernames`;
173
+ if (args.options.userNames && args.options.userNames.split(',').some(e => !validation.isValidUserPrincipalName(e))) {
174
+ return `${args.options.userNames} contains one or more invalid usernames`;
175
175
  }
176
- if (args.options.email && args.options.email.split(',').some(e => !validation.isValidUserPrincipalName(e))) {
177
- return `${args.options.email} contains one or more invalid email addresses`;
176
+ if (args.options.emails && args.options.emails.split(',').some(e => !validation.isValidUserPrincipalName(e))) {
177
+ return `${args.options.emails} contains one or more invalid email addresses`;
178
178
  }
179
- if (args.options.aadGroupId && args.options.aadGroupId.split(',').some(e => !validation.isValidGuid(e))) {
180
- return `${args.options.aadGroupId} contains one or more invalid GUIDs`;
179
+ if (args.options.aadGroupIds && args.options.aadGroupIds.split(',').some(e => !validation.isValidGuid(e))) {
180
+ return `${args.options.aadGroupIds} contains one or more invalid GUIDs`;
181
181
  }
182
182
  return true;
183
183
  });
184
184
  }, _SpoGroupMemberAddCommand_initOptionSets = function _SpoGroupMemberAddCommand_initOptionSets() {
185
- this.optionSets.push({ options: ['groupId', 'groupName'] }, { options: ['userName', 'email', 'userId', 'aadGroupId', 'aadGroupName'] });
185
+ this.optionSets.push({ options: ['groupId', 'groupName'] }, { options: ['userNames', 'emails', 'userIds', 'aadGroupIds', 'aadGroupNames'] });
186
186
  };
187
187
  export default new SpoGroupMemberAddCommand();
188
188
  //# sourceMappingURL=group-member-add.js.map
@@ -9,6 +9,8 @@ import { spo } from '../../../../utils/spo.js';
9
9
  import { validation } from '../../../../utils/validation.js';
10
10
  import SpoCommand from '../../../base/SpoCommand.js';
11
11
  import commands from '../../commands.js';
12
+ import { Cli } from '../../../../cli/Cli.js';
13
+ import { formatting } from '../../../../utils/formatting.js';
12
14
  class SpoHubSiteConnectCommand extends SpoCommand {
13
15
  get name() {
14
16
  return commands.HUBSITE_CONNECT;
@@ -31,8 +33,8 @@ class SpoHubSiteConnectCommand extends SpoCommand {
31
33
  try {
32
34
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
33
35
  const hubSites = await this.getHubSites(spoAdminUrl);
34
- const hubSite = this.getSpecificHubSite(hubSites, args.options.id, args.options.title, args.options.url);
35
- const parentHubSite = this.getSpecificHubSite(hubSites, args.options.parentId, args.options.parentTitle, args.options.parentUrl);
36
+ const hubSite = await this.getSpecificHubSite(hubSites, args.options.id, args.options.title, args.options.url);
37
+ const parentHubSite = await this.getSpecificHubSite(hubSites, args.options.parentId, args.options.parentTitle, args.options.parentUrl);
36
38
  const requestOptions = {
37
39
  url: `${spoAdminUrl}/_api/HubSites/GetById('${hubSite.ID}')`,
38
40
  headers: {
@@ -61,7 +63,7 @@ class SpoHubSiteConnectCommand extends SpoCommand {
61
63
  const hubSites = await request.get(requestOptions);
62
64
  return hubSites.value;
63
65
  }
64
- getSpecificHubSite(hubSites, id, title, url) {
66
+ async getSpecificHubSite(hubSites, id, title, url) {
65
67
  let filteredHubSites = [];
66
68
  if (id) {
67
69
  filteredHubSites = hubSites.filter(site => site.ID.toLowerCase() === id.toLowerCase());
@@ -76,7 +78,8 @@ class SpoHubSiteConnectCommand extends SpoCommand {
76
78
  throw `The specified hub site '${id || title || url}' does not exist.`;
77
79
  }
78
80
  if (filteredHubSites.length > 1) {
79
- throw `Multiple hub sites with name '${title}' found: ${filteredHubSites.map(s => s.ID).join(',')}.`;
81
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('ID', filteredHubSites);
82
+ return await Cli.handleMultipleResultsFound(`Multiple hub sites with name '${title}' found.`, resultAsKeyValuePair);
80
83
  }
81
84
  return filteredHubSites[0];
82
85
  }
@@ -6,6 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _SpoHubSiteDisconnectCommand_instances, _SpoHubSiteDisconnectCommand_initTelemetry, _SpoHubSiteDisconnectCommand_initOptions, _SpoHubSiteDisconnectCommand_initOptionSets, _SpoHubSiteDisconnectCommand_initValidators;
7
7
  import { Cli } from '../../../../cli/Cli.js';
8
8
  import request from '../../../../request.js';
9
+ import { formatting } from '../../../../utils/formatting.js';
9
10
  import { spo } from '../../../../utils/spo.js';
10
11
  import { validation } from '../../../../utils/validation.js';
11
12
  import SpoCommand from '../../../base/SpoCommand.js';
@@ -91,7 +92,9 @@ class SpoHubSiteDisconnectCommand extends SpoCommand {
91
92
  throw `The specified hub site '${options.title || options.url}' does not exist.`;
92
93
  }
93
94
  if (filteredHubSites.length > 1) {
94
- throw `Multiple hub sites with name '${options.title}' found: ${filteredHubSites.map(s => s.ID).join(',')}.`;
95
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('ID', filteredHubSites);
96
+ const result = await Cli.handleMultipleResultsFound(`Multiple hub sites with name '${options.title}' found.`, resultAsKeyValuePair);
97
+ return result;
95
98
  }
96
99
  return filteredHubSites[0];
97
100
  }
@@ -6,6 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _SpoHubSiteGetCommand_instances, _SpoHubSiteGetCommand_initTelemetry, _SpoHubSiteGetCommand_initOptions, _SpoHubSiteGetCommand_initValidators, _SpoHubSiteGetCommand_initOptionSets;
7
7
  import { Cli } from '../../../../cli/Cli.js';
8
8
  import request from '../../../../request.js';
9
+ import { formatting } from '../../../../utils/formatting.js';
9
10
  import { spo } from '../../../../utils/spo.js';
10
11
  import { validation } from '../../../../utils/validation.js';
11
12
  import SpoCommand from '../../../base/SpoCommand.js';
@@ -87,7 +88,8 @@ class SpoHubSiteGetCommand extends SpoCommand {
87
88
  throw `The specified hub site ${options.title || options.url} does not exist`;
88
89
  }
89
90
  if (hubSites.length > 1) {
90
- throw `Multiple hub sites with ${options.title || options.url} found. Please disambiguate: ${hubSites.map(site => site.SiteUrl).join(', ')}`;
91
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('ID', hubSites);
92
+ return await Cli.handleMultipleResultsFound(`Multiple hub sites with ${options.title || options.url} found.`, resultAsKeyValuePair);
91
93
  }
92
94
  return hubSites[0];
93
95
  }
@@ -148,6 +148,7 @@ class SpoListItemAddCommand extends SpoCommand {
148
148
  responseType: 'json'
149
149
  };
150
150
  const item = await request.get(requestOptions);
151
+ delete item.ID;
151
152
  await logger.log(item);
152
153
  }
153
154
  catch (err) {
@@ -0,0 +1,127 @@
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 _SpoListItemAttachmentAddCommand_instances, _SpoListItemAttachmentAddCommand_initTelemetry, _SpoListItemAttachmentAddCommand_initOptions, _SpoListItemAttachmentAddCommand_initValidators, _SpoListItemAttachmentAddCommand_initOptionSets;
7
+ import request from '../../../../request.js';
8
+ import { formatting } from '../../../../utils/formatting.js';
9
+ import { urlUtil } from '../../../../utils/urlUtil.js';
10
+ import { validation } from '../../../../utils/validation.js';
11
+ import SpoCommand from '../../../base/SpoCommand.js';
12
+ import commands from '../../commands.js';
13
+ import fs from 'fs';
14
+ class SpoListItemAttachmentAddCommand extends SpoCommand {
15
+ get name() {
16
+ return commands.LISTITEM_ATTACHMENT_ADD;
17
+ }
18
+ get description() {
19
+ return 'Adds an attachment to a list item';
20
+ }
21
+ constructor() {
22
+ super();
23
+ _SpoListItemAttachmentAddCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _SpoListItemAttachmentAddCommand_instances, "m", _SpoListItemAttachmentAddCommand_initTelemetry).call(this);
25
+ __classPrivateFieldGet(this, _SpoListItemAttachmentAddCommand_instances, "m", _SpoListItemAttachmentAddCommand_initOptions).call(this);
26
+ __classPrivateFieldGet(this, _SpoListItemAttachmentAddCommand_instances, "m", _SpoListItemAttachmentAddCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _SpoListItemAttachmentAddCommand_instances, "m", _SpoListItemAttachmentAddCommand_initOptionSets).call(this);
28
+ }
29
+ async commandAction(logger, args) {
30
+ if (this.verbose) {
31
+ await logger.logToStderr(`Adding an attachment to list item with id ${args.options.listItemId} on list ${args.options.listId || args.options.listTitle || args.options.listUrl} on web ${args.options.webUrl}.`);
32
+ }
33
+ try {
34
+ const fileName = this.getFileName(args.options.filePath, args.options.fileName);
35
+ const fileBody = fs.readFileSync(args.options.filePath);
36
+ const requestOptions = {
37
+ url: `${args.options.webUrl}/_api/web/${this.getListUrl(args.options.webUrl, args.options.listId, args.options.listTitle, args.options.listUrl)}/items(${args.options.listItemId})/AttachmentFiles/add(FileName='${fileName}')`,
38
+ headers: {
39
+ 'accept': 'application/json;odata=nometadata'
40
+ },
41
+ data: fileBody,
42
+ responseType: 'json'
43
+ };
44
+ const response = await request.post(requestOptions);
45
+ await logger.log(response);
46
+ }
47
+ catch (err) {
48
+ if (err.error &&
49
+ err.error['odata.error'] &&
50
+ err.error['odata.error'].message && err.error['odata.error'].message.value.indexOf('The document or folder name was not changed.') > -1) {
51
+ this.handleError(err.error['odata.error'].message.value.split('\n')[0]);
52
+ }
53
+ else {
54
+ this.handleRejectedODataJsonPromise(err);
55
+ }
56
+ }
57
+ }
58
+ getFileName(filePath, fileName) {
59
+ if (!fileName) {
60
+ return filePath.replace(/^.*[\\\/]/, '');
61
+ }
62
+ const extension = filePath.split('.').pop();
63
+ if (!fileName.endsWith(`.${extension}`)) {
64
+ fileName += `.${extension}`;
65
+ }
66
+ return fileName;
67
+ }
68
+ getListUrl(webUrl, listId, listTitle, listUrl) {
69
+ if (listId) {
70
+ return `lists(guid'${formatting.encodeQueryParameter(listId)}')`;
71
+ }
72
+ else if (listTitle) {
73
+ return `lists/getByTitle('${formatting.encodeQueryParameter(listTitle)}')`;
74
+ }
75
+ else {
76
+ const listServerRelativeUrl = urlUtil.getServerRelativePath(webUrl, listUrl);
77
+ return `GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
78
+ }
79
+ }
80
+ }
81
+ _SpoListItemAttachmentAddCommand_instances = new WeakSet(), _SpoListItemAttachmentAddCommand_initTelemetry = function _SpoListItemAttachmentAddCommand_initTelemetry() {
82
+ this.telemetry.push((args) => {
83
+ Object.assign(this.telemetryProperties, {
84
+ listId: typeof args.options.listId !== 'undefined',
85
+ listTitle: typeof args.options.listTitle !== 'undefined',
86
+ listUrl: typeof args.options.listUrl !== 'undefined',
87
+ fileName: typeof args.options.fileName !== 'undefined'
88
+ });
89
+ });
90
+ }, _SpoListItemAttachmentAddCommand_initOptions = function _SpoListItemAttachmentAddCommand_initOptions() {
91
+ this.options.unshift({
92
+ option: '-u, --webUrl <webUrl>'
93
+ }, {
94
+ option: '--listId [listId]'
95
+ }, {
96
+ option: '--listTitle [listTitle]'
97
+ }, {
98
+ option: '--listUrl [listUrl]'
99
+ }, {
100
+ option: '--listItemId <listItemId>'
101
+ }, {
102
+ option: '-p, --filePath <filePath>'
103
+ }, {
104
+ option: '-n, --fileName [fileName]'
105
+ });
106
+ }, _SpoListItemAttachmentAddCommand_initValidators = function _SpoListItemAttachmentAddCommand_initValidators() {
107
+ this.validators.push(async (args) => {
108
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
109
+ if (isValidSharePointUrl !== true) {
110
+ return isValidSharePointUrl;
111
+ }
112
+ if (isNaN(args.options.listItemId)) {
113
+ return `${args.options.listItemId} in option listItemId is not a valid number.`;
114
+ }
115
+ if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
116
+ return `${args.options.listId} in option listId is not a valid GUID.`;
117
+ }
118
+ if (!fs.existsSync(args.options.filePath)) {
119
+ return `File with path '${args.options.filePath}' was not found.`;
120
+ }
121
+ return true;
122
+ });
123
+ }, _SpoListItemAttachmentAddCommand_initOptionSets = function _SpoListItemAttachmentAddCommand_initOptionSets() {
124
+ this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
125
+ };
126
+ export default new SpoListItemAttachmentAddCommand();
127
+ //# sourceMappingURL=listitem-attachment-add.js.map