@pnp/cli-microsoft365 6.1.0-beta.825554 → 6.1.0-beta.f03db2d

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 (48) hide show
  1. package/.eslintrc.js +2 -0
  2. package/dist/cli/Cli.js +48 -5
  3. package/dist/m365/planner/commands/tenant/tenant-settings-set.js +4 -7
  4. package/dist/m365/pp/commands/chatbot/chatbot-get.js +111 -0
  5. package/dist/m365/pp/commands/chatbot/chatbot-remove.js +131 -0
  6. package/dist/m365/pp/commands/dataverse/dataverse-table-row-list.js +95 -0
  7. package/dist/m365/pp/commands/solution/solution-publisher-add.js +101 -0
  8. package/dist/m365/pp/commands.js +4 -0
  9. package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +38 -0
  10. package/dist/m365/purview/commands.js +7 -0
  11. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.16.1.js +23 -0
  12. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  13. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +63 -0
  14. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015009_FILE_config_sass_json.js +14 -0
  15. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0.js +2 -0
  16. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.16.1.js +59 -0
  17. package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
  18. package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
  19. package/dist/m365/spo/commands/listitem/listitem-list.js +2 -2
  20. package/dist/m365/teams/commands/meeting/meeting-attendancereport-list.js +121 -0
  21. package/dist/m365/teams/commands/user/user-app-list.js +1 -1
  22. package/dist/m365/teams/commands.js +1 -0
  23. package/dist/utils/formatting.js +25 -0
  24. package/docs/docs/cmd/cli/cli-consent.md +20 -0
  25. package/docs/docs/cmd/cli/cli-doctor.md +50 -0
  26. package/docs/docs/cmd/cli/cli-issue.md +20 -0
  27. package/docs/docs/cmd/cli/cli-reconsent.md +20 -0
  28. package/docs/docs/cmd/cli/completion/completion-clink-update.md +5 -1
  29. package/docs/docs/cmd/cli/completion/completion-pwsh-setup.md +5 -1
  30. package/docs/docs/cmd/cli/completion/completion-pwsh-update.md +5 -1
  31. package/docs/docs/cmd/cli/completion/completion-sh-setup.md +21 -1
  32. package/docs/docs/cmd/cli/completion/completion-sh-update.md +4 -0
  33. package/docs/docs/cmd/cli/config/config-get.md +22 -0
  34. package/docs/docs/cmd/cli/config/config-reset.md +4 -0
  35. package/docs/docs/cmd/cli/config/config-set.md +4 -0
  36. package/docs/docs/cmd/pp/chatbot/chatbot-get.md +123 -0
  37. package/docs/docs/cmd/pp/chatbot/chatbot-remove.md +52 -0
  38. package/docs/docs/cmd/pp/dataverse/dataverse-table-row-list.md +90 -0
  39. package/docs/docs/cmd/pp/solution/solution-publisher-add.md +49 -0
  40. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.md +81 -0
  41. package/docs/docs/cmd/search/externalconnection/externalconnection-add.md +4 -0
  42. package/docs/docs/cmd/search/externalconnection/externalconnection-get.md +38 -0
  43. package/docs/docs/cmd/search/externalconnection/externalconnection-list.md +38 -0
  44. package/docs/docs/cmd/search/externalconnection/externalconnection-remove.md +4 -0
  45. package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
  46. package/docs/docs/cmd/teams/meeting/meeting-attendancereport-list.md +69 -0
  47. package/docs/docs/cmd/teams/user/user-app-list.md +6 -0
  48. package/package.json +1 -1
package/.eslintrc.js CHANGED
@@ -37,6 +37,7 @@ const dictionary = [
37
37
  'installed',
38
38
  'is',
39
39
  'issue',
40
+ 'label',
40
41
  'list',
41
42
  'management',
42
43
  'member',
@@ -52,6 +53,7 @@ const dictionary = [
52
53
  'property',
53
54
  'records',
54
55
  'recycle',
56
+ 'retention',
55
57
  'role',
56
58
  'room',
57
59
  'schema',
package/dist/cli/Cli.js CHANGED
@@ -22,6 +22,7 @@ const settingsNames_1 = require("../settingsNames");
22
22
  const formatting_1 = require("../utils/formatting");
23
23
  const fsUtil_1 = require("../utils/fsUtil");
24
24
  const md_1 = require("../utils/md");
25
+ const validation_1 = require("../utils/validation");
25
26
  const packageJSON = require('../../package.json');
26
27
  class Cli {
27
28
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -83,9 +84,15 @@ class Cli {
83
84
  // we have found a command to execute. Parse args again taking into
84
85
  // account short and long options, option types and whether the command
85
86
  // supports known and unknown options or not
86
- this.optionsFromArgs = {
87
- options: this.getCommandOptionsFromArgs(rawArgs, this.commandToExecute)
88
- };
87
+ try {
88
+ this.optionsFromArgs = {
89
+ options: this.getCommandOptionsFromArgs(rawArgs, this.commandToExecute)
90
+ };
91
+ }
92
+ catch (e) {
93
+ const optionsWithoutShorts = Cli.removeShortOptions({ options: parsedArgs });
94
+ return this.closeWithError(e.message, optionsWithoutShorts, false);
95
+ }
89
96
  }
90
97
  else {
91
98
  this.optionsFromArgs = {
@@ -208,6 +215,11 @@ class Cli {
208
215
  });
209
216
  }
210
217
  catch (err) {
218
+ // restoring the command and logger is done here instead of in a 'finally' because there were issues with the code coverage tool
219
+ // restore the original command name
220
+ cli.currentCommandName = parentCommandName;
221
+ // restore the original logger
222
+ request_1.default.logger = currentLogger;
211
223
  throw {
212
224
  error: err,
213
225
  stderr: logErr.join(os.EOL)
@@ -339,11 +351,15 @@ class Cli {
339
351
  const minimistOptions = {
340
352
  alias: {}
341
353
  };
354
+ let argsToParse = args;
342
355
  if (commandInfo) {
343
356
  const commandTypes = commandInfo.command.types;
344
357
  if (commandTypes) {
345
358
  minimistOptions.string = commandTypes.string;
346
- minimistOptions.boolean = commandTypes.boolean;
359
+ // minimist will parse unused boolean options to 'false' (unused options => options that are not included in the args)
360
+ // But in the CLI booleans are nullable. They can can be true, false or undefined.
361
+ // For this reason we only pass boolean types that are actually used as arg.
362
+ minimistOptions.boolean = commandTypes.boolean.filter(optionName => args.some(arg => `--${optionName}` === arg || `-${optionName}` === arg));
347
363
  }
348
364
  minimistOptions.alias = {};
349
365
  commandInfo.options.forEach(option => {
@@ -351,8 +367,35 @@ class Cli {
351
367
  minimistOptions.alias[option.short] = option.long;
352
368
  }
353
369
  });
370
+ argsToParse = this.getRewrittenArgs(args, commandTypes);
354
371
  }
355
- return minimist(args, minimistOptions);
372
+ return minimist(argsToParse, minimistOptions);
373
+ }
374
+ /**
375
+ * Rewrites arguments (if necessary) before passing them into minimist.
376
+ * Currently only boolean values are checked and fixed.
377
+ * Args are only checked and rewritten if the option has been added to the 'types.boolean' array.
378
+ */
379
+ getRewrittenArgs(args, commandTypes) {
380
+ const booleanTypes = commandTypes.boolean;
381
+ if (booleanTypes.length === 0) {
382
+ return args;
383
+ }
384
+ return args.map((arg, index, array) => {
385
+ if (arg.startsWith('-') || index === 0) {
386
+ return arg;
387
+ }
388
+ // This line checks if the current arg is a value that belongs to a boolean option.
389
+ if (booleanTypes.some(t => `--${t}` === array[index - 1] || `-${t}` === array[index - 1])) {
390
+ const rewrittenBoolean = formatting_1.formatting.rewriteBooleanValue(arg);
391
+ if (!validation_1.validation.isValidBoolean(rewrittenBoolean)) {
392
+ const optionName = array[index - 1];
393
+ throw new Error(`The value '${arg}' for option '${optionName}' is not a valid boolean`);
394
+ }
395
+ return rewrittenBoolean;
396
+ }
397
+ return arg;
398
+ });
356
399
  }
357
400
  static formatOutput(logStatement, options) {
358
401
  if (logStatement instanceof Date) {
@@ -13,10 +13,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  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");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _PlannerTenantSettingsSetCommand_instances, _PlannerTenantSettingsSetCommand_initTelemetry, _PlannerTenantSettingsSetCommand_initOptions, _PlannerTenantSettingsSetCommand_initValidators;
16
+ var _PlannerTenantSettingsSetCommand_instances, _PlannerTenantSettingsSetCommand_initTelemetry, _PlannerTenantSettingsSetCommand_initOptions, _PlannerTenantSettingsSetCommand_initTypes, _PlannerTenantSettingsSetCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
- const validation_1 = require("../../../../utils/validation");
20
19
  const PlannerCommand_1 = require("../../../base/PlannerCommand");
21
20
  const commands_1 = require("../../commands");
22
21
  class PlannerTenantSettingsSetCommand extends PlannerCommand_1.default {
@@ -25,6 +24,7 @@ class PlannerTenantSettingsSetCommand extends PlannerCommand_1.default {
25
24
  _PlannerTenantSettingsSetCommand_instances.add(this);
26
25
  __classPrivateFieldGet(this, _PlannerTenantSettingsSetCommand_instances, "m", _PlannerTenantSettingsSetCommand_initTelemetry).call(this);
27
26
  __classPrivateFieldGet(this, _PlannerTenantSettingsSetCommand_instances, "m", _PlannerTenantSettingsSetCommand_initOptions).call(this);
27
+ __classPrivateFieldGet(this, _PlannerTenantSettingsSetCommand_instances, "m", _PlannerTenantSettingsSetCommand_initTypes).call(this);
28
28
  __classPrivateFieldGet(this, _PlannerTenantSettingsSetCommand_instances, "m", _PlannerTenantSettingsSetCommand_initValidators).call(this);
29
29
  }
30
30
  get name() {
@@ -92,6 +92,8 @@ _PlannerTenantSettingsSetCommand_instances = new WeakSet(), _PlannerTenantSettin
92
92
  option: '--allowPlannerMobilePushNotifications [allowPlannerMobilePushNotifications]',
93
93
  autocomplete: ['true', 'false']
94
94
  });
95
+ }, _PlannerTenantSettingsSetCommand_initTypes = function _PlannerTenantSettingsSetCommand_initTypes() {
96
+ this.types.boolean.push('isPlannerAllowed', 'allowCalendarSharing', 'allowTenantMoveWithDataLoss', 'allowTenantMoveWithDataMigration', 'allowRosterCreation', 'allowPlannerMobilePushNotifications');
95
97
  }, _PlannerTenantSettingsSetCommand_initValidators = function _PlannerTenantSettingsSetCommand_initValidators() {
96
98
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
97
99
  const optionsArray = [
@@ -101,11 +103,6 @@ _PlannerTenantSettingsSetCommand_instances = new WeakSet(), _PlannerTenantSettin
101
103
  if (optionsArray.every(o => typeof o === 'undefined')) {
102
104
  return 'You must specify at least one option';
103
105
  }
104
- for (const option of optionsArray) {
105
- if (typeof option !== 'undefined' && !validation_1.validation.isValidBoolean(option)) {
106
- return `Value '${option}' is not a valid boolean`;
107
- }
108
- }
109
106
  return true;
110
107
  }));
111
108
  };
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _PpChatbotGetCommand_instances, _PpChatbotGetCommand_initTelemetry, _PpChatbotGetCommand_initOptions, _PpChatbotGetCommand_initOptionSets, _PpChatbotGetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
19
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
20
+ const commands_1 = require("../../commands");
21
+ const request_1 = require("../../../../request");
22
+ const validation_1 = require("../../../../utils/validation");
23
+ const formatting_1 = require("../../../../utils/formatting");
24
+ class PpChatbotGetCommand extends PowerPlatformCommand_1.default {
25
+ constructor() {
26
+ super();
27
+ _PpChatbotGetCommand_instances.add(this);
28
+ __classPrivateFieldGet(this, _PpChatbotGetCommand_instances, "m", _PpChatbotGetCommand_initTelemetry).call(this);
29
+ __classPrivateFieldGet(this, _PpChatbotGetCommand_instances, "m", _PpChatbotGetCommand_initOptions).call(this);
30
+ __classPrivateFieldGet(this, _PpChatbotGetCommand_instances, "m", _PpChatbotGetCommand_initValidators).call(this);
31
+ __classPrivateFieldGet(this, _PpChatbotGetCommand_instances, "m", _PpChatbotGetCommand_initOptionSets).call(this);
32
+ }
33
+ get name() {
34
+ return commands_1.default.CHATBOT_GET;
35
+ }
36
+ get description() {
37
+ return 'Get information about the specified chatbot';
38
+ }
39
+ defaultProperties() {
40
+ return ['name', 'botid', 'publishedon', 'createdon', 'modifiedon'];
41
+ }
42
+ commandAction(logger, args) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ if (this.verbose) {
45
+ logger.logToStderr(`Retrieving chatbot '${args.options.id || args.options.name}'...`);
46
+ }
47
+ try {
48
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
49
+ const res = yield this.getChatbot(dynamicsApiUrl, args.options);
50
+ logger.log(res);
51
+ }
52
+ catch (err) {
53
+ this.handleRejectedODataJsonPromise(err);
54
+ }
55
+ });
56
+ }
57
+ getChatbot(dynamicsApiUrl, options) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const requestOptions = {
60
+ headers: {
61
+ accept: 'application/json;odata.metadata=none'
62
+ },
63
+ responseType: 'json'
64
+ };
65
+ if (options.id) {
66
+ requestOptions.url = `${dynamicsApiUrl}/api/data/v9.1/bots(${options.id})`;
67
+ const result = yield request_1.default.get(requestOptions);
68
+ return result;
69
+ }
70
+ requestOptions.url = `${dynamicsApiUrl}/api/data/v9.1/bots?$filter=name eq '${formatting_1.formatting.encodeQueryParameter(options.name)}'`;
71
+ const result = yield request_1.default.get(requestOptions);
72
+ if (result.value.length > 1) {
73
+ throw `Multiple chatbots with name '${options.name}' found: ${result.value.map(x => x.botid).join(',')}`;
74
+ }
75
+ if (result.value.length === 0) {
76
+ throw `The specified chatbot '${options.name}' does not exist.`;
77
+ }
78
+ return result.value[0];
79
+ });
80
+ }
81
+ }
82
+ _PpChatbotGetCommand_instances = new WeakSet(), _PpChatbotGetCommand_initTelemetry = function _PpChatbotGetCommand_initTelemetry() {
83
+ this.telemetry.push((args) => {
84
+ Object.assign(this.telemetryProperties, {
85
+ id: typeof args.options.id !== 'undefined',
86
+ name: typeof args.options.name !== 'undefined',
87
+ asAdmin: !!args.options.asAdmin
88
+ });
89
+ });
90
+ }, _PpChatbotGetCommand_initOptions = function _PpChatbotGetCommand_initOptions() {
91
+ this.options.unshift({
92
+ option: '-e, --environment <environment>'
93
+ }, {
94
+ option: '-i, --id [id]'
95
+ }, {
96
+ option: '-n, --name [name]'
97
+ }, {
98
+ option: '--asAdmin'
99
+ });
100
+ }, _PpChatbotGetCommand_initOptionSets = function _PpChatbotGetCommand_initOptionSets() {
101
+ this.optionSets.push({ options: ['id', 'name'] });
102
+ }, _PpChatbotGetCommand_initValidators = function _PpChatbotGetCommand_initValidators() {
103
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
104
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
105
+ return `${args.options.id} is not a valid GUID`;
106
+ }
107
+ return true;
108
+ }));
109
+ };
110
+ module.exports = new PpChatbotGetCommand();
111
+ //# sourceMappingURL=chatbot-get.js.map
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _PpChatbotRemoveCommand_instances, _PpChatbotRemoveCommand_initTelemetry, _PpChatbotRemoveCommand_initOptions, _PpChatbotRemoveCommand_initOptionSets, _PpChatbotRemoveCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
19
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
20
+ const commands_1 = require("../../commands");
21
+ const request_1 = require("../../../../request");
22
+ const validation_1 = require("../../../../utils/validation");
23
+ const Cli_1 = require("../../../../cli/Cli");
24
+ const PpChatbotGetCommand = require("./chatbot-get");
25
+ class PpChatbotRemoveCommand extends PowerPlatformCommand_1.default {
26
+ constructor() {
27
+ super();
28
+ _PpChatbotRemoveCommand_instances.add(this);
29
+ __classPrivateFieldGet(this, _PpChatbotRemoveCommand_instances, "m", _PpChatbotRemoveCommand_initTelemetry).call(this);
30
+ __classPrivateFieldGet(this, _PpChatbotRemoveCommand_instances, "m", _PpChatbotRemoveCommand_initOptions).call(this);
31
+ __classPrivateFieldGet(this, _PpChatbotRemoveCommand_instances, "m", _PpChatbotRemoveCommand_initValidators).call(this);
32
+ __classPrivateFieldGet(this, _PpChatbotRemoveCommand_instances, "m", _PpChatbotRemoveCommand_initOptionSets).call(this);
33
+ }
34
+ get name() {
35
+ return commands_1.default.CHATBOT_REMOVE;
36
+ }
37
+ get description() {
38
+ return 'Removes the specified chatbot';
39
+ }
40
+ commandAction(logger, args) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ if (this.verbose) {
43
+ logger.logToStderr(`Removing chatbot '${args.options.id || args.options.name}'...`);
44
+ }
45
+ if (args.options.confirm) {
46
+ yield this.deleteChatbot(args);
47
+ }
48
+ else {
49
+ const result = yield Cli_1.Cli.prompt({
50
+ type: 'confirm',
51
+ name: 'continue',
52
+ default: false,
53
+ message: `Are you sure you want to remove chatbot '${args.options.id || args.options.name}'?`
54
+ });
55
+ if (result.continue) {
56
+ yield this.deleteChatbot(args);
57
+ }
58
+ }
59
+ });
60
+ }
61
+ getChatbotId(args) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ if (args.options.id) {
64
+ return args.options.id;
65
+ }
66
+ const options = {
67
+ environment: args.options.environment,
68
+ name: args.options.name,
69
+ output: 'json',
70
+ debug: this.debug,
71
+ verbose: this.verbose
72
+ };
73
+ const output = yield Cli_1.Cli.executeCommandWithOutput(PpChatbotGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
74
+ const getBotOutput = JSON.parse(output.stdout);
75
+ return getBotOutput.botid;
76
+ });
77
+ }
78
+ deleteChatbot(args) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ try {
81
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
82
+ const botId = yield this.getChatbotId(args);
83
+ const requestOptions = {
84
+ url: `${dynamicsApiUrl}/api/data/v9.1/bots(${botId})/Microsoft.Dynamics.CRM.PvaDeleteBot?tag=deprovisionbotondelete`,
85
+ headers: {
86
+ accept: 'application/json',
87
+ 'content-type': 'application/json'
88
+ },
89
+ responseType: 'json'
90
+ };
91
+ yield request_1.default.post(requestOptions);
92
+ }
93
+ catch (err) {
94
+ this.handleRejectedODataJsonPromise(err);
95
+ }
96
+ });
97
+ }
98
+ }
99
+ _PpChatbotRemoveCommand_instances = new WeakSet(), _PpChatbotRemoveCommand_initTelemetry = function _PpChatbotRemoveCommand_initTelemetry() {
100
+ this.telemetry.push((args) => {
101
+ Object.assign(this.telemetryProperties, {
102
+ id: typeof args.options.id !== 'undefined',
103
+ name: typeof args.options.name !== 'undefined',
104
+ asAdmin: !!args.options.asAdmin,
105
+ confirm: !!args.options.confirm
106
+ });
107
+ });
108
+ }, _PpChatbotRemoveCommand_initOptions = function _PpChatbotRemoveCommand_initOptions() {
109
+ this.options.unshift({
110
+ option: '-e, --environment <environment>'
111
+ }, {
112
+ option: '-i, --id [id]'
113
+ }, {
114
+ option: '-n, --name [name]'
115
+ }, {
116
+ option: '--asAdmin'
117
+ }, {
118
+ option: '--confirm'
119
+ });
120
+ }, _PpChatbotRemoveCommand_initOptionSets = function _PpChatbotRemoveCommand_initOptionSets() {
121
+ this.optionSets.push({ options: ['id', 'name'] });
122
+ }, _PpChatbotRemoveCommand_initValidators = function _PpChatbotRemoveCommand_initValidators() {
123
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
124
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
125
+ return `${args.options.id} is not a valid GUID`;
126
+ }
127
+ return true;
128
+ }));
129
+ };
130
+ module.exports = new PpChatbotRemoveCommand();
131
+ //# sourceMappingURL=chatbot-remove.js.map
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _PpDataverseTableRowListCommand_instances, _PpDataverseTableRowListCommand_initTelemetry, _PpDataverseTableRowListCommand_initOptions, _PpDataverseTableRowListCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
19
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
20
+ const commands_1 = require("../../commands");
21
+ const request_1 = require("../../../../request");
22
+ const odata_1 = require("../../../../utils/odata");
23
+ class PpDataverseTableRowListCommand extends PowerPlatformCommand_1.default {
24
+ constructor() {
25
+ super();
26
+ _PpDataverseTableRowListCommand_instances.add(this);
27
+ __classPrivateFieldGet(this, _PpDataverseTableRowListCommand_instances, "m", _PpDataverseTableRowListCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _PpDataverseTableRowListCommand_instances, "m", _PpDataverseTableRowListCommand_initOptions).call(this);
29
+ __classPrivateFieldGet(this, _PpDataverseTableRowListCommand_instances, "m", _PpDataverseTableRowListCommand_initOptionSets).call(this);
30
+ }
31
+ get name() {
32
+ return commands_1.default.DATAVERSE_TABLE_ROW_LIST;
33
+ }
34
+ get description() {
35
+ return 'Lists table rows for the given Dataverse table';
36
+ }
37
+ commandAction(logger, args) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ if (this.verbose) {
40
+ logger.logToStderr('Retrieving list of table rows');
41
+ }
42
+ try {
43
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
44
+ const entitySetName = yield this.getEntitySetName(dynamicsApiUrl, args);
45
+ if (this.verbose) {
46
+ logger.logToStderr('Entity set name is: ' + entitySetName);
47
+ }
48
+ const response = yield odata_1.odata.getAllItems(`${dynamicsApiUrl}/api/data/v9.0/${entitySetName}`);
49
+ logger.log(response);
50
+ }
51
+ catch (err) {
52
+ this.handleRejectedODataJsonPromise(err);
53
+ }
54
+ });
55
+ }
56
+ getEntitySetName(dynamicsApiUrl, args) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ if (args.options.entitySetName) {
59
+ return args.options.entitySetName;
60
+ }
61
+ const requestOptions = {
62
+ url: `${dynamicsApiUrl}/api/data/v9.0/EntityDefinitions(LogicalName='${args.options.tableName}')?$select=EntitySetName`,
63
+ headers: {
64
+ accept: 'application/json;odata.metadata=none'
65
+ },
66
+ responseType: 'json'
67
+ };
68
+ const response = yield request_1.default.get(requestOptions);
69
+ return response.EntitySetName;
70
+ });
71
+ }
72
+ }
73
+ _PpDataverseTableRowListCommand_instances = new WeakSet(), _PpDataverseTableRowListCommand_initTelemetry = function _PpDataverseTableRowListCommand_initTelemetry() {
74
+ this.telemetry.push((args) => {
75
+ Object.assign(this.telemetryProperties, {
76
+ entitySetName: typeof args.options.entitySetName !== 'undefined',
77
+ tableName: typeof args.options.tableName !== 'undefined',
78
+ asAdmin: !!args.options.asAdmin
79
+ });
80
+ });
81
+ }, _PpDataverseTableRowListCommand_initOptions = function _PpDataverseTableRowListCommand_initOptions() {
82
+ this.options.unshift({
83
+ option: '-e, --environment <environment>'
84
+ }, {
85
+ option: '--entitySetName [entitySetName]'
86
+ }, {
87
+ option: '--tableName [tableName]'
88
+ }, {
89
+ option: '--asAdmin'
90
+ });
91
+ }, _PpDataverseTableRowListCommand_initOptionSets = function _PpDataverseTableRowListCommand_initOptionSets() {
92
+ this.optionSets.push({ options: ['entitySetName', 'tableName'] });
93
+ };
94
+ module.exports = new PpDataverseTableRowListCommand();
95
+ //# sourceMappingURL=dataverse-table-row-list.js.map
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _PpSolutionPublisherAddCommand_instances, _PpSolutionPublisherAddCommand_initTelemetry, _PpSolutionPublisherAddCommand_initOptions, _PpSolutionPublisherAddCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
21
+ const commands_1 = require("../../commands");
22
+ class PpSolutionPublisherAddCommand extends PowerPlatformCommand_1.default {
23
+ constructor() {
24
+ super();
25
+ _PpSolutionPublisherAddCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _PpSolutionPublisherAddCommand_instances, "m", _PpSolutionPublisherAddCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _PpSolutionPublisherAddCommand_instances, "m", _PpSolutionPublisherAddCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _PpSolutionPublisherAddCommand_instances, "m", _PpSolutionPublisherAddCommand_initValidators).call(this);
29
+ }
30
+ get name() {
31
+ return commands_1.default.SOLUTION_PUBLISHER_ADD;
32
+ }
33
+ get description() {
34
+ return 'Adds a specified publisher in a given environment';
35
+ }
36
+ commandAction(logger, args) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ if (this.verbose) {
39
+ logger.logToStderr(`Adding new publisher '${args.options.name}'...`);
40
+ }
41
+ try {
42
+ const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
43
+ const requestOptions = {
44
+ url: `${dynamicsApiUrl}/api/data/v9.0/publishers`,
45
+ headers: {
46
+ accept: 'application/json;odata.metadata=none'
47
+ },
48
+ responseType: 'json',
49
+ data: {
50
+ uniquename: args.options.name,
51
+ friendlyname: args.options.displayName,
52
+ customizationprefix: args.options.prefix,
53
+ customizationoptionvalueprefix: args.options.choiceValuePrefix
54
+ }
55
+ };
56
+ yield request_1.default.post(requestOptions);
57
+ }
58
+ catch (err) {
59
+ this.handleRejectedODataJsonPromise(err);
60
+ }
61
+ });
62
+ }
63
+ }
64
+ _PpSolutionPublisherAddCommand_instances = new WeakSet(), _PpSolutionPublisherAddCommand_initTelemetry = function _PpSolutionPublisherAddCommand_initTelemetry() {
65
+ this.telemetry.push((args) => {
66
+ Object.assign(this.telemetryProperties, {
67
+ asAdmin: !!args.options.asAdmin
68
+ });
69
+ });
70
+ }, _PpSolutionPublisherAddCommand_initOptions = function _PpSolutionPublisherAddCommand_initOptions() {
71
+ this.options.unshift({
72
+ option: '-e, --environment <environment>'
73
+ }, {
74
+ option: '-n, --name <name>'
75
+ }, {
76
+ option: '--displayName <displayName>'
77
+ }, {
78
+ option: '--prefix <prefix>'
79
+ }, {
80
+ option: '--choiceValuePrefix <choiceValuePrefix>'
81
+ }, {
82
+ option: '--asAdmin'
83
+ });
84
+ }, _PpSolutionPublisherAddCommand_initValidators = function _PpSolutionPublisherAddCommand_initValidators() {
85
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
86
+ if (isNaN(args.options.choiceValuePrefix) || args.options.choiceValuePrefix < 10000 || args.options.choiceValuePrefix > 99999 || !Number.isInteger(args.options.choiceValuePrefix)) {
87
+ return 'Option choiceValuePrefix should be an integer between 10000 and 99999.';
88
+ }
89
+ const nameRegEx = new RegExp(/^[a-zA-Z_][A-Za-z0-9_]+$/);
90
+ if (!nameRegEx.test(args.options.name)) {
91
+ return 'Option name may only consist of alphanumeric characters and underscores. The first character cannot be a number.';
92
+ }
93
+ const prefixRegEx = new RegExp(/^(?!mscrm.*$)[a-zA-Z][A-Za-z0-9]{1,7}$/);
94
+ if (!prefixRegEx.test(args.options.prefix)) {
95
+ return `Option prefix may only consist of alphanumeric characters. The first character cannot be a number and may not start with 'mscrm'. It must be between 2 and 8 characters long.`;
96
+ }
97
+ return true;
98
+ }));
99
+ };
100
+ module.exports = new PpSolutionPublisherAddCommand();
101
+ //# sourceMappingURL=solution-publisher-add.js.map
@@ -6,10 +6,13 @@ exports.default = {
6
6
  CARD_GET: `${prefix} card get`,
7
7
  CARD_LIST: `${prefix} card list`,
8
8
  CARD_REMOVE: `${prefix} card remove`,
9
+ CHATBOT_GET: `${prefix} chatbot get`,
9
10
  CHATBOT_LIST: `${prefix} chatbot list`,
11
+ CHATBOT_REMOVE: `${prefix} chatbot remove`,
10
12
  DATAVERSE_TABLE_LIST: `${prefix} dataverse table list`,
11
13
  DATAVERSE_TABLE_GET: `${prefix} dataverse table get`,
12
14
  DATAVERSE_TABLE_REMOVE: `${prefix} dataverse table remove`,
15
+ DATAVERSE_TABLE_ROW_LIST: `${prefix} dataverse table row list`,
13
16
  ENVIRONMENT_GET: `${prefix} environment get`,
14
17
  ENVIRONMENT_LIST: `${prefix} environment list`,
15
18
  GATEWAY_GET: `${prefix} gateway get`,
@@ -19,6 +22,7 @@ exports.default = {
19
22
  SOLUTION_GET: `${prefix} solution get`,
20
23
  SOLUTION_LIST: `${prefix} solution list`,
21
24
  SOLUTION_REMOVE: `${prefix} solution remove`,
25
+ SOLUTION_PUBLISHER_ADD: `${prefix} solution publisher add`,
22
26
  SOLUTION_PUBLISHER_GET: `${prefix} solution publisher get`,
23
27
  SOLUTION_PUBLISHER_LIST: `${prefix} solution publisher list`,
24
28
  SOLUTION_PUBLISHER_REMOVE: `${prefix} solution publisher remove`,
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const odata_1 = require("../../../../utils/odata");
13
+ const GraphCommand_1 = require("../../../base/GraphCommand");
14
+ const commands_1 = require("../../commands");
15
+ class PurviewRetentionLabelListCommand extends GraphCommand_1.default {
16
+ get name() {
17
+ return commands_1.default.RETENTIONLABEL_LIST;
18
+ }
19
+ get description() {
20
+ return 'Get a list of retention labels';
21
+ }
22
+ defaultProperties() {
23
+ return ['id', 'displayName', 'isInUse'];
24
+ }
25
+ commandAction(logger) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ try {
28
+ const items = yield odata_1.odata.getAllItems(`${this.resource}/beta/security/labels/retentionLabels`);
29
+ logger.log(items);
30
+ }
31
+ catch (err) {
32
+ this.handleRejectedODataJsonPromise(err);
33
+ }
34
+ });
35
+ }
36
+ }
37
+ module.exports = new PurviewRetentionLabelListCommand();
38
+ //# sourceMappingURL=retentionlabel-list.js.map
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const prefix = 'purview';
4
+ exports.default = {
5
+ RETENTIONLABEL_LIST: `${prefix} retentionlabel list`
6
+ };
7
+ //# sourceMappingURL=commands.js.map