@pnp/cli-microsoft365 7.2.0-beta.54705a9 → 7.2.0-beta.6775e3a

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 (192) hide show
  1. package/.devcontainer/Dockerfile +0 -1
  2. package/.eslintrc.cjs +4 -0
  3. package/Dockerfile +0 -1
  4. package/dist/Command.js +7 -24
  5. package/dist/chili/chili.js +40 -51
  6. package/dist/cli/Cli.js +27 -14
  7. package/dist/m365/aad/commands/administrativeunit/administrativeunit-add.js +61 -0
  8. package/dist/m365/aad/commands/administrativeunit/administrativeunit-get.js +80 -0
  9. package/dist/m365/aad/commands/administrativeunit/administrativeunit-list.js +25 -0
  10. package/dist/m365/aad/commands/administrativeunit/administrativeunit-remove.js +91 -0
  11. package/dist/m365/aad/commands/app/app-remove.js +2 -7
  12. package/dist/m365/aad/commands/app/app-role-remove.js +2 -7
  13. package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +2 -7
  14. package/dist/m365/aad/commands/group/group-remove.js +2 -7
  15. package/dist/m365/aad/commands/groupsetting/groupsetting-remove.js +2 -7
  16. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-clear.js +2 -7
  17. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +2 -7
  18. package/dist/m365/aad/commands/m365group/m365group-remove.js +2 -7
  19. package/dist/m365/aad/commands/m365group/m365group-user-remove.js +2 -7
  20. package/dist/m365/aad/commands/oauth2grant/oauth2grant-remove.js +2 -7
  21. package/dist/m365/aad/commands/siteclassification/siteclassification-disable.js +2 -7
  22. package/dist/m365/aad/commands/user/user-license-remove.js +2 -7
  23. package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +2 -7
  24. package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +2 -7
  25. package/dist/m365/aad/commands/user/user-remove.js +2 -7
  26. package/dist/m365/aad/commands.js +4 -0
  27. package/dist/m365/base/AppCommand.js +3 -12
  28. package/dist/m365/commands/setup.js +31 -37
  29. package/dist/m365/context/commands/context-remove.js +2 -7
  30. package/dist/m365/context/commands/option/option-remove.js +2 -7
  31. package/dist/m365/{search/commands/externalconnection/externalconnection-add.js → external/commands/connection/connection-add.js} +16 -13
  32. package/dist/m365/{search/commands/externalconnection/externalconnection-get.js → external/commands/connection/connection-get.js} +16 -13
  33. package/dist/m365/{search/commands/externalconnection/externalconnection-list.js → external/commands/connection/connection-list.js} +7 -4
  34. package/dist/m365/{search/commands/externalconnection/externalconnection-remove.js → external/commands/connection/connection-remove.js} +19 -21
  35. package/dist/m365/{search/commands/externalconnection/externalconnection-schema-add.js → external/commands/connection/connection-schema-add.js} +14 -11
  36. package/dist/m365/external/commands.js +15 -0
  37. package/dist/m365/flow/commands/flow-remove.js +2 -7
  38. package/dist/m365/flow/commands/owner/owner-remove.js +2 -7
  39. package/dist/m365/flow/commands/run/run-cancel.js +2 -7
  40. package/dist/m365/flow/commands/run/run-resubmit.js +2 -7
  41. package/dist/m365/graph/commands/schemaextension/schemaextension-remove.js +2 -7
  42. package/dist/m365/pa/commands/app/app-consent-set.js +2 -7
  43. package/dist/m365/pa/commands/app/app-permission-remove.js +2 -7
  44. package/dist/m365/pa/commands/app/app-remove.js +2 -7
  45. package/dist/m365/planner/commands/bucket/bucket-remove.js +2 -7
  46. package/dist/m365/planner/commands/plan/plan-remove.js +2 -7
  47. package/dist/m365/planner/commands/roster/roster-member-remove.js +4 -14
  48. package/dist/m365/planner/commands/roster/roster-remove.js +2 -7
  49. package/dist/m365/planner/commands/task/task-checklistitem-remove.js +2 -7
  50. package/dist/m365/planner/commands/task/task-reference-remove.js +2 -7
  51. package/dist/m365/planner/commands/task/task-remove.js +2 -7
  52. package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-remove.js +2 -7
  53. package/dist/m365/pp/commands/card/card-remove.js +2 -7
  54. package/dist/m365/pp/commands/chatbot/chatbot-remove.js +2 -7
  55. package/dist/m365/pp/commands/dataverse/dataverse-table-remove.js +2 -7
  56. package/dist/m365/pp/commands/dataverse/dataverse-table-row-remove.js +2 -7
  57. package/dist/m365/pp/commands/solution/solution-publisher-remove.js +2 -7
  58. package/dist/m365/pp/commands/solution/solution-remove.js +2 -7
  59. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +2 -7
  60. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +2 -7
  61. package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +2 -7
  62. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.1-rc.0.js +21 -0
  63. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  64. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014010_CODE_settings_filesexclude_jest.js +44 -0
  65. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.18.1-rc.0.js +57 -0
  66. package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
  67. package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
  68. package/dist/m365/spo/commands/app/app-remove.js +2 -7
  69. package/dist/m365/spo/commands/app/app-retract.js +2 -7
  70. package/dist/m365/spo/commands/app/app-uninstall.js +2 -7
  71. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -7
  72. package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +2 -7
  73. package/dist/m365/spo/commands/commandset/commandset-remove.js +2 -7
  74. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +2 -7
  75. package/dist/m365/spo/commands/contenttype/contenttype-remove.js +2 -2
  76. package/dist/m365/spo/commands/customaction/customaction-clear.js +2 -7
  77. package/dist/m365/spo/commands/customaction/customaction-remove.js +2 -7
  78. package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +2 -7
  79. package/dist/m365/spo/commands/field/field-remove.js +2 -7
  80. package/dist/m365/spo/commands/file/file-checkout-undo.js +2 -7
  81. package/dist/m365/spo/commands/file/file-remove.js +2 -7
  82. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +2 -7
  83. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +2 -7
  84. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +2 -7
  85. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +2 -7
  86. package/dist/m365/spo/commands/file/file-sharinglink-clear.js +2 -7
  87. package/dist/m365/spo/commands/file/file-sharinglink-remove.js +2 -7
  88. package/dist/m365/spo/commands/file/file-version-clear.js +2 -7
  89. package/dist/m365/spo/commands/file/file-version-remove.js +2 -7
  90. package/dist/m365/spo/commands/file/file-version-restore.js +2 -7
  91. package/dist/m365/spo/commands/folder/folder-remove.js +2 -7
  92. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +2 -7
  93. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +2 -7
  94. package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +2 -7
  95. package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +2 -7
  96. package/dist/m365/spo/commands/group/group-member-remove.js +2 -7
  97. package/dist/m365/spo/commands/group/group-remove.js +2 -7
  98. package/dist/m365/spo/commands/homesite/homesite-remove.js +2 -7
  99. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +2 -7
  100. package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +2 -7
  101. package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +2 -7
  102. package/dist/m365/spo/commands/knowledgehub/knowledgehub-remove.js +2 -7
  103. package/dist/m365/spo/commands/list/list-contenttype-remove.js +2 -7
  104. package/dist/m365/spo/commands/list/list-remove.js +2 -7
  105. package/dist/m365/spo/commands/list/list-retentionlabel-remove.js +2 -7
  106. package/dist/m365/spo/commands/list/list-roleassignment-remove.js +2 -7
  107. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +2 -7
  108. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +2 -7
  109. package/dist/m365/spo/commands/list/list-view-field-remove.js +2 -7
  110. package/dist/m365/spo/commands/list/list-view-remove.js +2 -7
  111. package/dist/m365/spo/commands/list/list-webhook-remove.js +2 -7
  112. package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +2 -7
  113. package/dist/m365/spo/commands/listitem/listitem-remove.js +2 -7
  114. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +2 -7
  115. package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +2 -7
  116. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +2 -7
  117. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +2 -7
  118. package/dist/m365/spo/commands/navigation/navigation-node-remove.js +2 -7
  119. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +2 -7
  120. package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +2 -7
  121. package/dist/m365/spo/commands/page/page-remove.js +2 -7
  122. package/dist/m365/spo/commands/propertybag/propertybag-remove.js +2 -7
  123. package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +2 -7
  124. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +2 -7
  125. package/dist/m365/spo/commands/site/site-apppermission-remove.js +2 -7
  126. package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +2 -7
  127. package/dist/m365/spo/commands/site/site-recyclebinitem-clear.js +2 -7
  128. package/dist/m365/spo/commands/site/site-recyclebinitem-move.js +2 -7
  129. package/dist/m365/spo/commands/site/site-recyclebinitem-remove.js +2 -7
  130. package/dist/m365/spo/commands/site/site-remove.js +2 -7
  131. package/dist/m365/spo/commands/site/site-set.js +33 -1
  132. package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +2 -7
  133. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-revoke.js +2 -7
  134. package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +2 -7
  135. package/dist/m365/spo/commands/sitescript/sitescript-remove.js +2 -7
  136. package/dist/m365/spo/commands/storageentity/storageentity-remove.js +2 -7
  137. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -7
  138. package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +2 -7
  139. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +2 -7
  140. package/dist/m365/spo/commands/theme/theme-remove.js +2 -7
  141. package/dist/m365/spo/commands/user/user-remove.js +2 -7
  142. package/dist/m365/spo/commands/web/web-remove.js +2 -7
  143. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +2 -7
  144. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +2 -7
  145. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +2 -7
  146. package/dist/m365/teams/commands/app/app-remove.js +2 -7
  147. package/dist/m365/teams/commands/app/app-uninstall.js +2 -7
  148. package/dist/m365/teams/commands/app/app-update.js +9 -6
  149. package/dist/m365/teams/commands/cache/cache-remove.js +2 -7
  150. package/dist/m365/teams/commands/channel/channel-member-remove.js +2 -7
  151. package/dist/m365/teams/commands/channel/channel-remove.js +2 -7
  152. package/dist/m365/teams/commands/chat/chat-member-remove.js +2 -7
  153. package/dist/m365/teams/commands/tab/tab-remove.js +2 -7
  154. package/dist/m365/teams/commands/team/team-remove.js +2 -7
  155. package/dist/m365/teams/commands/user/user-app-remove.js +2 -7
  156. package/dist/m365/tenant/commands/people/people-profilecardproperty-add.js +131 -0
  157. package/dist/m365/tenant/commands/people/people-profilecardproperty-get.js +75 -0
  158. package/dist/m365/tenant/commands/people/people-profilecardproperty-list.js +53 -0
  159. package/dist/m365/tenant/commands/people/people-profilecardproperty-remove.js +79 -0
  160. package/dist/m365/tenant/commands/people/people-profilecardproperty-set.js +118 -0
  161. package/dist/m365/tenant/commands/people/profileCardProperties.js +24 -0
  162. package/dist/m365/tenant/commands.js +5 -0
  163. package/dist/m365/todo/commands/list/list-remove.js +2 -7
  164. package/dist/m365/todo/commands/task/task-remove.js +2 -7
  165. package/dist/m365/yammer/commands/group/group-user-remove.js +2 -7
  166. package/dist/m365/yammer/commands/message/message-like-set.js +3 -8
  167. package/dist/m365/yammer/commands/message/message-remove.js +2 -7
  168. package/dist/utils/aadAdministrativeUnit.js +25 -0
  169. package/dist/utils/aadGroup.js +3 -1
  170. package/dist/utils/prompt.js +26 -7
  171. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-add.mdx +119 -0
  172. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-get.mdx +102 -0
  173. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-list.mdx +87 -0
  174. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-remove.mdx +56 -0
  175. package/docs/docs/cmd/{search/externalconnection/externalconnection-add.mdx → external/connection/connection-add.mdx} +16 -10
  176. package/docs/docs/cmd/{search/externalconnection/externalconnection-get.mdx → external/connection/connection-get.mdx} +16 -11
  177. package/docs/docs/cmd/{search/externalconnection/externalconnection-list.mdx → external/connection/connection-list.mdx} +12 -7
  178. package/docs/docs/cmd/external/connection/connection-remove.mdx +54 -0
  179. package/docs/docs/cmd/external/connection/connection-schema-add.mdx +41 -0
  180. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  181. package/docs/docs/cmd/spo/file/file-rename.mdx +2 -0
  182. package/docs/docs/cmd/spo/site/site-set.mdx +15 -0
  183. package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +126 -0
  184. package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +101 -0
  185. package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +98 -0
  186. package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +61 -0
  187. package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +120 -0
  188. package/npm-shrinkwrap.json +262 -186
  189. package/package.json +7 -8
  190. package/dist/m365/search/commands.js +0 -9
  191. package/docs/docs/cmd/search/externalconnection/externalconnection-remove.mdx +0 -48
  192. package/docs/docs/cmd/search/externalconnection/externalconnection-schema-add.mdx +0 -35
@@ -6,7 +6,6 @@ LABEL name="CLI for Microsoft 365 Development" \
6
6
  maintainers="Waldek Mastykarz <waldek@mastykarz.nl>, \
7
7
  Garry Trinder <garry.trinder@live.com>, \
8
8
  Albert-Jan Schot <appie@digiwijs.nl>, \
9
- Patrick Lamber <patrick@nubo.eu>, \
10
9
  Arjun Menon <arjun.umenon@gmail.com>, \
11
10
  Adam Wojcik <adam.wojcik.it@gmail.com>, \
12
11
  Martin Lingstuyl <mlingstuyl@live.com>, \
package/.eslintrc.cjs CHANGED
@@ -5,6 +5,7 @@ const dictionary = [
5
5
  'activation',
6
6
  'activations',
7
7
  'adaptive',
8
+ 'administrative',
8
9
  'ai',
9
10
  'app',
10
11
  'application',
@@ -15,6 +16,7 @@ const dictionary = [
15
16
  'audit',
16
17
  'bin',
17
18
  'builder',
19
+ 'card',
18
20
  'catalog',
19
21
  'checklist',
20
22
  'client',
@@ -67,6 +69,7 @@ const dictionary = [
67
69
  'permission',
68
70
  'place',
69
71
  'policy',
72
+ 'profile',
70
73
  'property',
71
74
  'records',
72
75
  'recycle',
@@ -90,6 +93,7 @@ const dictionary = [
90
93
  'threat',
91
94
  'token',
92
95
  'type',
96
+ 'unit',
93
97
  'user',
94
98
  'web',
95
99
  'webhook'
package/Dockerfile CHANGED
@@ -8,7 +8,6 @@ LABEL name="m365pnp/cli-microsoft365:${CLI_VERSION}" \
8
8
  maintainers="Waldek Mastykarz <waldek@mastykarz.nl>, \
9
9
  Garry Trinder <garry.trinder@live.com>, \
10
10
  Albert-Jan Schot <appie@digiwijs.nl>, \
11
- Patrick Lamber <patrick@nubo.eu>, \
12
11
  Arjun Menon <arjun.umenon@gmail.com>, \
13
12
  Adam Wojcik <adam.wojcik.it@gmail.com>, \
14
13
  Martin Lingstuyl <mlingstuyl@live.com>, \
package/dist/Command.js CHANGED
@@ -89,11 +89,8 @@ class Command {
89
89
  prompted = true;
90
90
  Cli.error('🌶️ Provide values for the following parameters:');
91
91
  }
92
- const missingRequireOptionValue = await prompt.forInput({
93
- name: 'missingRequireOptionValue',
94
- message: `${command.options[i].name}: `
95
- }).then(result => result.missingRequireOptionValue);
96
- args.options[command.options[i].name] = missingRequireOptionValue;
92
+ const answer = await prompt.forInput({ message: `${command.options[i].name}: ` });
93
+ args.options[command.options[i].name] = answer;
97
94
  }
98
95
  if (prompted) {
99
96
  Cli.error('');
@@ -130,29 +127,15 @@ class Command {
130
127
  }
131
128
  async promptForOptionSetNameAndValue(args, optionSet) {
132
129
  Cli.error(`🌶️ Please specify one of the following options:`);
133
- const resultOptionName = await prompt.forInput({
134
- type: 'list',
135
- name: 'missingRequiredOptionName',
136
- message: `Option to use:`,
137
- choices: optionSet.options
138
- });
139
- const missingRequiredOptionName = resultOptionName.missingRequiredOptionName;
140
- const resultOptionValue = await prompt.forInput({
141
- name: 'missingRequiredOptionValue',
142
- message: `${missingRequiredOptionName}:`
143
- });
144
- args.options[missingRequiredOptionName] = resultOptionValue.missingRequiredOptionValue;
130
+ const selectedOptionName = await prompt.forSelection({ message: `Option to use:`, choices: optionSet.options.map((choice) => { return { name: choice, value: choice }; }) });
131
+ const optionValue = await prompt.forInput({ message: `${selectedOptionName}:` });
132
+ args.options[selectedOptionName] = optionValue;
145
133
  Cli.error('');
146
134
  }
147
135
  async promptForSpecificOption(args, commonOptions) {
148
136
  Cli.error(`🌶️ Multiple options for an option set specified. Please specify the correct option that you wish to use.`);
149
- const requiredOptionNameResult = await prompt.forInput({
150
- type: 'list',
151
- name: 'missingRequiredOptionName',
152
- message: `Option to use:`,
153
- choices: commonOptions
154
- });
155
- commonOptions.filter(y => y !== requiredOptionNameResult.missingRequiredOptionName).map(optionName => args.options[optionName] = undefined);
137
+ const selectedOptionName = await prompt.forSelection({ message: `Option to use:`, choices: commonOptions.map((choice) => { return { name: choice, value: choice }; }) });
138
+ commonOptions.filter(y => y !== selectedOptionName).map(optionName => args.options[optionName] = undefined);
156
139
  Cli.error('');
157
140
  }
158
141
  async validateOutput(args) {
@@ -1,5 +1,4 @@
1
1
  import fs from 'fs';
2
- import inquirer from 'inquirer';
3
2
  import ora from 'ora';
4
3
  import path from 'path';
5
4
  import url from 'url';
@@ -7,6 +6,7 @@ import { Cli } from '../cli/Cli.js';
7
6
  import request from '../request.js';
8
7
  import { settingsNames } from '../settingsNames.js';
9
8
  import { md } from '../utils/md.js';
9
+ import { prompt } from '../utils/prompt.js';
10
10
  const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
11
11
  const mendableApiKey = 'd3313d54-6f8e-40e0-90d3-4095019d4be7';
12
12
  let showHelp = false;
@@ -79,12 +79,7 @@ async function startConversation(args) {
79
79
  await runConversationTurn(conversationId, initialPrompt);
80
80
  }
81
81
  async function promptForPrompt() {
82
- const answer = await inquirer.prompt([{
83
- type: 'input',
84
- name: 'prompt',
85
- message: '🌶️ How can I help you?'
86
- }]);
87
- return answer.prompt;
82
+ return await prompt.forInput({ message: '🌶️ How can I help you?' });
88
83
  }
89
84
  async function runConversationTurn(conversationId, question) {
90
85
  console.log('');
@@ -120,60 +115,54 @@ async function runConversationTurn(conversationId, question) {
120
115
  }
121
116
  console.log('');
122
117
  }
123
- const result = await inquirer.prompt([{
124
- type: 'list',
125
- name: 'chat',
126
- message: 'What would you like to do next?',
127
- choices: [
128
- {
129
- name: '📝 I want to know more',
130
- value: 'ask'
131
- },
132
- {
133
- name: '👋 I know enough. Thanks!',
134
- value: 'end'
135
- },
136
- {
137
- name: '🔄 I want to ask about something else',
138
- value: 'new'
139
- }
140
- ]
141
- }]);
142
- switch (result.chat) {
118
+ const choices = [
119
+ {
120
+ name: '📝 I want to know more',
121
+ value: 'ask'
122
+ },
123
+ {
124
+ name: '👋 I know enough. Thanks!',
125
+ value: 'end'
126
+ },
127
+ {
128
+ name: '🔄 I want to ask about something else',
129
+ value: 'new'
130
+ }
131
+ ];
132
+ const result = await prompt.forSelection({ message: 'What would you like to do next?', choices });
133
+ switch (result) {
143
134
  case 'ask':
144
135
  const prompt = await promptForPrompt();
145
- return await runConversationTurn(conversationId, prompt);
136
+ await runConversationTurn(conversationId, prompt);
137
+ break;
146
138
  case 'end':
147
139
  await endConversation(conversationId);
148
140
  console.log('');
149
141
  console.log('🌶️ Bye!');
150
- return;
142
+ break;
151
143
  case 'new':
152
144
  initialPrompt = '';
153
- return startConversation([]);
145
+ await startConversation([]);
146
+ break;
154
147
  }
155
148
  }
156
149
  async function rateResponse(messageId) {
157
- const result = await inquirer.prompt([{
158
- type: 'list',
159
- name: 'rating',
160
- message: 'Was this helpful?',
161
- choices: [
162
- {
163
- name: '👍 Yes',
164
- value: 1
165
- },
166
- {
167
- name: '👎 No',
168
- value: -1
169
- },
170
- {
171
- name: '🤔 Not sure/skip',
172
- value: 0
173
- }
174
- ]
175
- }]);
176
- if (result.rating === 0) {
150
+ const choices = [
151
+ {
152
+ name: '👍 Yes',
153
+ value: 1
154
+ },
155
+ {
156
+ name: '👎 No',
157
+ value: -1
158
+ },
159
+ {
160
+ name: '🤔 Not sure/skip',
161
+ value: 0
162
+ }
163
+ ];
164
+ const rating = await prompt.forSelection({ message: 'Was this helpful?', choices });
165
+ if (rating === 0) {
177
166
  return;
178
167
  }
179
168
  console.log('Thanks for letting us know! 😊');
@@ -192,7 +181,7 @@ async function rateResponse(messageId) {
192
181
  // eslint-disable-next-line camelcase
193
182
  message_id: messageId,
194
183
  // eslint-disable-next-line camelcase
195
- rating_value: result.rating
184
+ rating_value: rating
196
185
  }
197
186
  };
198
187
  const spinner = ora('Sending rating...');
package/dist/cli/Cli.js CHANGED
@@ -707,9 +707,10 @@ export class Cli {
707
707
  const maxLength = Math.max(...namesOfCommandsToPrint.map(s => s.length)) + 10;
708
708
  Cli.log(`Commands:`);
709
709
  Cli.log();
710
- for (const commandName in commandsToPrint) {
710
+ const sortedCommandNamesToPrint = Object.getOwnPropertyNames(commandsToPrint).sort();
711
+ sortedCommandNamesToPrint.forEach(commandName => {
711
712
  Cli.log(` ${`${commandName} [options]`.padEnd(maxLength, ' ')} ${commandsToPrint[commandName].command.description}`);
712
- }
713
+ });
713
714
  }
714
715
  const namesOfCommandGroupsToPrint = Object.keys(commandGroupsToPrint);
715
716
  if (namesOfCommandGroupsToPrint.length > 0) {
@@ -803,35 +804,47 @@ export class Cli {
803
804
  cli.spinner.start();
804
805
  }
805
806
  }
806
- static async prompt(options, answers) {
807
+ static async promptForSelection(config) {
807
808
  const cli = Cli.getInstance();
808
809
  const spinnerSpinning = cli.spinner.isSpinning;
809
810
  /* c8 ignore next 3 */
810
811
  if (spinnerSpinning) {
811
812
  cli.spinner.stop();
812
813
  }
813
- const response = await prompt.forInput(options, answers);
814
+ const answer = await prompt.forSelection(config);
815
+ Cli.error('');
814
816
  // Restart the spinner if it was running before the prompt
815
817
  /* c8 ignore next 3 */
816
818
  if (spinnerSpinning) {
817
819
  cli.spinner.start();
818
820
  }
819
- return response;
821
+ return answer;
822
+ }
823
+ static async promptForConfirmation(config) {
824
+ const cli = Cli.getInstance();
825
+ const spinnerSpinning = cli.spinner.isSpinning;
826
+ /* c8 ignore next 3 */
827
+ if (spinnerSpinning) {
828
+ cli.spinner.stop();
829
+ }
830
+ const answer = await prompt.forConfirmation(config);
831
+ Cli.error('');
832
+ // Restart the spinner if it was running before the prompt
833
+ /* c8 ignore next 3 */
834
+ if (spinnerSpinning) {
835
+ cli.spinner.start();
836
+ }
837
+ return answer;
820
838
  }
821
839
  static async handleMultipleResultsFound(message, values) {
822
840
  const prompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, true);
823
841
  if (!prompt) {
824
842
  throw new Error(`${message} Found: ${Object.keys(values).join(', ')}.`);
825
843
  }
826
- const response = await Cli.prompt({
827
- type: 'list',
828
- name: 'select',
829
- default: 0,
830
- prefix: '🌶️ ',
831
- message: `${message} Please choose one:`,
832
- choices: Object.keys(values)
833
- });
834
- return values[response.select];
844
+ Cli.error(`🌶️ ${message}`);
845
+ const choices = Object.keys(values).map((choice) => { return { name: choice, value: choice }; });
846
+ const response = await Cli.promptForSelection({ message: `Please choose one:`, choices });
847
+ return values[response];
835
848
  }
836
849
  static removeShortOptions(args) {
837
850
  const filteredArgs = JSON.parse(JSON.stringify(args));
@@ -0,0 +1,61 @@
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 _AadAdministrativeUnitAddCommand_instances, _AadAdministrativeUnitAddCommand_initTelemetry, _AadAdministrativeUnitAddCommand_initOptions;
7
+ import request from "../../../../request.js";
8
+ import GraphCommand from "../../../base/GraphCommand.js";
9
+ import commands from "../../commands.js";
10
+ class AadAdministrativeUnitAddCommand extends GraphCommand {
11
+ get name() {
12
+ return commands.ADMINISTRATIVEUNIT_ADD;
13
+ }
14
+ get description() {
15
+ return 'Creates an administrative unit';
16
+ }
17
+ constructor() {
18
+ super();
19
+ _AadAdministrativeUnitAddCommand_instances.add(this);
20
+ __classPrivateFieldGet(this, _AadAdministrativeUnitAddCommand_instances, "m", _AadAdministrativeUnitAddCommand_initTelemetry).call(this);
21
+ __classPrivateFieldGet(this, _AadAdministrativeUnitAddCommand_instances, "m", _AadAdministrativeUnitAddCommand_initOptions).call(this);
22
+ }
23
+ async commandAction(logger, args) {
24
+ const requestOptions = {
25
+ url: `${this.resource}/v1.0/directory/administrativeUnits`,
26
+ headers: {
27
+ accept: 'application/json;odata.metadata=none'
28
+ },
29
+ responseType: 'json',
30
+ data: {
31
+ description: args.options.description,
32
+ displayName: args.options.displayName,
33
+ visibility: args.options.hiddenMembership ? 'HiddenMembership' : null
34
+ }
35
+ };
36
+ try {
37
+ const administrativeUnit = await request.post(requestOptions);
38
+ await logger.log(administrativeUnit);
39
+ }
40
+ catch (err) {
41
+ this.handleRejectedODataJsonPromise(err);
42
+ }
43
+ }
44
+ }
45
+ _AadAdministrativeUnitAddCommand_instances = new WeakSet(), _AadAdministrativeUnitAddCommand_initTelemetry = function _AadAdministrativeUnitAddCommand_initTelemetry() {
46
+ this.telemetry.push((args) => {
47
+ Object.assign(this.telemetryProperties, {
48
+ hiddenMembership: !!args.options.hiddenMembership
49
+ });
50
+ });
51
+ }, _AadAdministrativeUnitAddCommand_initOptions = function _AadAdministrativeUnitAddCommand_initOptions() {
52
+ this.options.unshift({
53
+ option: '-n, --displayName <displayName>'
54
+ }, {
55
+ option: '-d, --description [description]'
56
+ }, {
57
+ option: '--hiddenMembership'
58
+ });
59
+ };
60
+ export default new AadAdministrativeUnitAddCommand();
61
+ //# sourceMappingURL=administrativeunit-add.js.map
@@ -0,0 +1,80 @@
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 _AadAdministrativeUnitGetCommand_instances, _AadAdministrativeUnitGetCommand_initTelemetry, _AadAdministrativeUnitGetCommand_initOptions, _AadAdministrativeUnitGetCommand_initValidators, _AadAdministrativeUnitGetCommand_initOptionSets, _AadAdministrativeUnitGetCommand_initTypes;
7
+ import { validation } from "../../../../utils/validation.js";
8
+ import request from "../../../../request.js";
9
+ import GraphCommand from "../../../base/GraphCommand.js";
10
+ import commands from "../../commands.js";
11
+ import { aadAdministrativeUnit } from "../../../../utils/aadAdministrativeUnit.js";
12
+ class AadAdministrativeUnitGetCommand extends GraphCommand {
13
+ get name() {
14
+ return commands.ADMINISTRATIVEUNIT_GET;
15
+ }
16
+ get description() {
17
+ return 'Gets information about a specific administrative unit';
18
+ }
19
+ constructor() {
20
+ super();
21
+ _AadAdministrativeUnitGetCommand_instances.add(this);
22
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initTelemetry).call(this);
23
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initOptions).call(this);
24
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initValidators).call(this);
25
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initOptionSets).call(this);
26
+ __classPrivateFieldGet(this, _AadAdministrativeUnitGetCommand_instances, "m", _AadAdministrativeUnitGetCommand_initTypes).call(this);
27
+ }
28
+ async commandAction(logger, args) {
29
+ let administrativeUnit;
30
+ try {
31
+ if (args.options.id) {
32
+ administrativeUnit = await this.getAdministrativeUnitById(args.options.id);
33
+ }
34
+ else {
35
+ administrativeUnit = await aadAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.displayName);
36
+ }
37
+ await logger.log(administrativeUnit);
38
+ }
39
+ catch (err) {
40
+ this.handleRejectedODataJsonPromise(err);
41
+ }
42
+ }
43
+ async getAdministrativeUnitById(id) {
44
+ const requestOptions = {
45
+ url: `${this.resource}/v1.0/directory/administrativeUnits/${id}`,
46
+ headers: {
47
+ accept: 'application/json;odata.metadata=none'
48
+ },
49
+ responseType: 'json'
50
+ };
51
+ return await request.get(requestOptions);
52
+ }
53
+ }
54
+ _AadAdministrativeUnitGetCommand_instances = new WeakSet(), _AadAdministrativeUnitGetCommand_initTelemetry = function _AadAdministrativeUnitGetCommand_initTelemetry() {
55
+ this.telemetry.push((args) => {
56
+ Object.assign(this.telemetryProperties, {
57
+ id: typeof args.options.id !== 'undefined',
58
+ displayName: typeof args.options.displayName !== 'undefined'
59
+ });
60
+ });
61
+ }, _AadAdministrativeUnitGetCommand_initOptions = function _AadAdministrativeUnitGetCommand_initOptions() {
62
+ this.options.unshift({
63
+ option: '-i, --id [id]'
64
+ }, {
65
+ option: '-n, --displayName [displayName]'
66
+ });
67
+ }, _AadAdministrativeUnitGetCommand_initValidators = function _AadAdministrativeUnitGetCommand_initValidators() {
68
+ this.validators.push(async (args) => {
69
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
70
+ return `${args.options.id} is not a valid GUID`;
71
+ }
72
+ return true;
73
+ });
74
+ }, _AadAdministrativeUnitGetCommand_initOptionSets = function _AadAdministrativeUnitGetCommand_initOptionSets() {
75
+ this.optionSets.push({ options: ['id', 'displayName'] });
76
+ }, _AadAdministrativeUnitGetCommand_initTypes = function _AadAdministrativeUnitGetCommand_initTypes() {
77
+ this.types.string.push('displayName');
78
+ };
79
+ export default new AadAdministrativeUnitGetCommand();
80
+ //# sourceMappingURL=administrativeunit-get.js.map
@@ -0,0 +1,25 @@
1
+ import { odata } from '../../../../utils/odata.js';
2
+ import GraphCommand from '../../../base/GraphCommand.js';
3
+ import commands from '../../commands.js';
4
+ class AadAdministrativeUnitListCommand extends GraphCommand {
5
+ get name() {
6
+ return commands.ADMINISTRATIVEUNIT_LIST;
7
+ }
8
+ get description() {
9
+ return 'Retrieves a list of administrative units';
10
+ }
11
+ defaultProperties() {
12
+ return ['id', 'displayName', 'visibility'];
13
+ }
14
+ async commandAction(logger) {
15
+ try {
16
+ const results = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits`);
17
+ await logger.log(results);
18
+ }
19
+ catch (err) {
20
+ this.handleRejectedODataJsonPromise(err);
21
+ }
22
+ }
23
+ }
24
+ export default new AadAdministrativeUnitListCommand();
25
+ //# sourceMappingURL=administrativeunit-list.js.map
@@ -0,0 +1,91 @@
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 _AadAdministrativeUnitRemoveCommand_instances, _AadAdministrativeUnitRemoveCommand_initTelemetry, _AadAdministrativeUnitRemoveCommand_initOptions, _AadAdministrativeUnitRemoveCommand_initOptionSets, _AadAdministrativeUnitRemoveCommand_initValidators, _AadAdministrativeUnitRemoveCommand_initTypes;
7
+ import { aadAdministrativeUnit } from '../../../../utils/aadAdministrativeUnit.js';
8
+ import { validation } from "../../../../utils/validation.js";
9
+ import request from "../../../../request.js";
10
+ import GraphCommand from "../../../base/GraphCommand.js";
11
+ import commands from "../../commands.js";
12
+ import { Cli } from "../../../../cli/Cli.js";
13
+ class AadAdministrativeUnitRemoveCommand extends GraphCommand {
14
+ get name() {
15
+ return commands.ADMINISTRATIVEUNIT_REMOVE;
16
+ }
17
+ get description() {
18
+ return 'Removes an administrative unit';
19
+ }
20
+ constructor() {
21
+ super();
22
+ _AadAdministrativeUnitRemoveCommand_instances.add(this);
23
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initOptions).call(this);
24
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initValidators).call(this);
25
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initOptionSets).call(this);
26
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _AadAdministrativeUnitRemoveCommand_instances, "m", _AadAdministrativeUnitRemoveCommand_initTypes).call(this);
28
+ }
29
+ async commandAction(logger, args) {
30
+ const removeAdministrativeUnit = async () => {
31
+ try {
32
+ let administrativeUnitId = args.options.id;
33
+ if (args.options.displayName) {
34
+ const administrativeUnit = await aadAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.displayName);
35
+ administrativeUnitId = administrativeUnit.id;
36
+ }
37
+ const requestOptions = {
38
+ url: `${this.resource}/v1.0/directory/administrativeUnits/${administrativeUnitId}`,
39
+ headers: {
40
+ accept: 'application/json;odata.metadata=none'
41
+ }
42
+ };
43
+ await request.delete(requestOptions);
44
+ }
45
+ catch (err) {
46
+ this.handleRejectedODataJsonPromise(err);
47
+ }
48
+ };
49
+ if (args.options.force) {
50
+ await removeAdministrativeUnit();
51
+ }
52
+ else {
53
+ const result = await Cli.promptForConfirmation({ message: `Are you sure you want to remove administrative unit '${args.options.id || args.options.displayName}'?` });
54
+ if (result) {
55
+ await removeAdministrativeUnit();
56
+ }
57
+ }
58
+ }
59
+ }
60
+ _AadAdministrativeUnitRemoveCommand_instances = new WeakSet(), _AadAdministrativeUnitRemoveCommand_initTelemetry = function _AadAdministrativeUnitRemoveCommand_initTelemetry() {
61
+ this.telemetry.push((args) => {
62
+ Object.assign(this.telemetryProperties, {
63
+ id: args.options.id !== 'undefined',
64
+ displayName: args.options.displayName !== 'undefined',
65
+ force: !!args.options.force
66
+ });
67
+ });
68
+ }, _AadAdministrativeUnitRemoveCommand_initOptions = function _AadAdministrativeUnitRemoveCommand_initOptions() {
69
+ this.options.unshift({
70
+ option: '-i, --id [id]'
71
+ }, {
72
+ option: '-n, --displayName [displayName]'
73
+ }, {
74
+ option: '-f, --force'
75
+ });
76
+ }, _AadAdministrativeUnitRemoveCommand_initOptionSets = function _AadAdministrativeUnitRemoveCommand_initOptionSets() {
77
+ this.optionSets.push({
78
+ options: ['id', 'displayName']
79
+ });
80
+ }, _AadAdministrativeUnitRemoveCommand_initValidators = function _AadAdministrativeUnitRemoveCommand_initValidators() {
81
+ this.validators.push(async (args) => {
82
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
83
+ return `${args.options.id} is not a valid GUID for option id.`;
84
+ }
85
+ return true;
86
+ });
87
+ }, _AadAdministrativeUnitRemoveCommand_initTypes = function _AadAdministrativeUnitRemoveCommand_initTypes() {
88
+ this.types.string.push('id', 'displayName');
89
+ };
90
+ export default new AadAdministrativeUnitRemoveCommand();
91
+ //# sourceMappingURL=administrativeunit-remove.js.map
@@ -49,13 +49,8 @@ class AadAppRemoveCommand extends GraphCommand {
49
49
  await deleteApp();
50
50
  }
51
51
  else {
52
- const result = await Cli.prompt({
53
- type: 'confirm',
54
- name: 'continue',
55
- default: false,
56
- message: `Are you sure you want to remove the app?`
57
- });
58
- if (result.continue) {
52
+ const result = await Cli.promptForConfirmation({ message: `Are you sure you want to remove the app?` });
53
+ if (result) {
59
54
  await deleteApp();
60
55
  }
61
56
  }
@@ -38,13 +38,8 @@ class AadAppRoleRemoveCommand extends GraphCommand {
38
38
  await deleteAppRole();
39
39
  }
40
40
  else {
41
- const result = await Cli.prompt({
42
- type: 'confirm',
43
- name: 'continue',
44
- default: false,
45
- message: `Are you sure you want to remove the app role ?`
46
- });
47
- if (result.continue) {
41
+ const result = await Cli.promptForConfirmation({ message: `Are you sure you want to remove the app role?` });
42
+ if (result) {
48
43
  await deleteAppRole();
49
44
  }
50
45
  }
@@ -111,13 +111,8 @@ class AadAppRoleAssignmentRemoveCommand extends GraphCommand {
111
111
  await removeAppRoleAssignment();
112
112
  }
113
113
  else {
114
- const result = await Cli.prompt({
115
- type: 'confirm',
116
- name: 'continue',
117
- default: false,
118
- message: `Are you sure you want to remove the appRoleAssignment with scopes ${args.options.scopes} for resource ${args.options.resource}?`
119
- });
120
- if (result.continue) {
114
+ const result = await Cli.promptForConfirmation({ message: `Are you sure you want to remove the appRoleAssignment with scope ${args.options.scope} for resource ${args.options.resource}?` });
115
+ if (result) {
121
116
  await removeAppRoleAssignment();
122
117
  }
123
118
  }
@@ -52,13 +52,8 @@ class AadGroupRemoveCommand extends GraphCommand {
52
52
  await removeGroup();
53
53
  }
54
54
  else {
55
- const result = await Cli.prompt({
56
- type: 'confirm',
57
- name: 'continue',
58
- default: false,
59
- message: `Are you sure you want to remove group '${args.options.id || args.options.displayName}'?`
60
- });
61
- if (result.continue) {
55
+ const result = await Cli.promptForConfirmation({ message: `Are you sure you want to remove group '${args.options.id || args.options.displayName}'?` });
56
+ if (result) {
62
57
  await removeGroup();
63
58
  }
64
59
  }
@@ -45,13 +45,8 @@ class AadGroupSettingRemoveCommand extends GraphCommand {
45
45
  await removeGroupSetting();
46
46
  }
47
47
  else {
48
- const result = await Cli.prompt({
49
- type: 'confirm',
50
- name: 'continue',
51
- default: false,
52
- message: `Are you sure you want to remove the group setting ${args.options.id}?`
53
- });
54
- if (result.continue) {
48
+ const result = await Cli.promptForConfirmation({ message: `Are you sure you want to remove the group setting ${args.options.id}?` });
49
+ if (result) {
55
50
  await removeGroupSetting();
56
51
  }
57
52
  }