@pnp/cli-microsoft365 6.3.0-beta.ac7b232 → 6.3.0-beta.e0fa4e0

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 (115) hide show
  1. package/.eslintrc.js +2 -0
  2. package/dist/Command.js +4 -4
  3. package/dist/cli/Cli.js +38 -0
  4. package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +103 -0
  5. package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +92 -0
  6. package/dist/m365/aad/commands.js +2 -0
  7. package/dist/m365/context/commands/option/option-list.js +54 -0
  8. package/dist/m365/context/commands.js +1 -0
  9. package/dist/m365/pa/commands/environment/environment-get.js +13 -5
  10. package/dist/m365/planner/commands/plan/plan-get.js +17 -10
  11. package/dist/m365/planner/commands/plan/plan-set.js +21 -10
  12. package/dist/m365/planner/commands/roster/roster-get.js +61 -0
  13. package/dist/m365/planner/commands/roster/roster-member-add.js +113 -0
  14. package/dist/m365/planner/commands/roster/roster-member-list.js +54 -0
  15. package/dist/m365/planner/commands/roster/roster-member-remove.js +140 -0
  16. package/dist/m365/planner/commands/task/task-add.js +3 -0
  17. package/dist/m365/planner/commands.js +4 -0
  18. package/dist/m365/pp/commands/environment/environment-get.js +18 -9
  19. package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +75 -0
  20. package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +46 -0
  21. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +97 -0
  22. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +77 -0
  23. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +13 -8
  24. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +43 -0
  25. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +97 -0
  26. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +90 -0
  27. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +5 -0
  28. package/dist/m365/purview/commands/retentionlabel/retentionlabel-get.js +5 -0
  29. package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +5 -0
  30. package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +5 -0
  31. package/dist/m365/purview/commands/retentionlabel/retentionlabel-set.js +11 -1
  32. package/dist/m365/purview/commands.js +8 -1
  33. package/dist/m365/spo/commands/customaction/customaction-get.js +17 -66
  34. package/dist/m365/spo/commands/customaction/customaction-list.js +2 -36
  35. package/dist/m365/spo/commands/customaction/customaction-remove.js +11 -18
  36. package/dist/m365/spo/commands/file/GraphFileDetails.js +0 -1
  37. package/dist/m365/spo/commands/file/file-sharinglink-add.js +2 -22
  38. package/dist/m365/spo/commands/file/file-sharinglink-clear.js +137 -0
  39. package/dist/m365/spo/commands/file/file-sharinglink-get.js +2 -25
  40. package/dist/m365/spo/commands/file/file-sharinglink-list.js +7 -28
  41. package/dist/m365/spo/commands/file/file-sharinglink-remove.js +2 -25
  42. package/dist/m365/spo/commands/file/file-sharinglink-set.js +104 -0
  43. package/dist/m365/spo/commands/listitem/listitem-add.js +2 -1
  44. package/dist/m365/spo/commands/navigation/navigation-node-get.js +73 -0
  45. package/dist/m365/spo/commands/sitedesign/sitedesign-add.js +6 -0
  46. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +179 -0
  47. package/dist/m365/spo/commands.js +4 -0
  48. package/dist/utils/aadUser.js +38 -0
  49. package/dist/utils/planner.js +1 -4
  50. package/dist/utils/spo.js +89 -0
  51. package/docs/docs/cmd/aad/user/user-recyclebinitem-clear.md +42 -0
  52. package/docs/docs/cmd/aad/user/user-recyclebinitem-remove.md +45 -0
  53. package/docs/docs/cmd/context/option/option-list.md +63 -0
  54. package/docs/docs/cmd/login.md +26 -0
  55. package/docs/docs/cmd/logout.md +4 -0
  56. package/docs/docs/cmd/pa/app/app-get.md +24 -0
  57. package/docs/docs/cmd/pa/app/app-list.md +21 -0
  58. package/docs/docs/cmd/pa/connector/connector-list.md +17 -0
  59. package/docs/docs/cmd/pa/environment/environment-get.md +26 -2
  60. package/docs/docs/cmd/pa/environment/environment-list.md +19 -0
  61. package/docs/docs/cmd/planner/plan/plan-get.md +12 -12
  62. package/docs/docs/cmd/planner/plan/plan-set.md +10 -4
  63. package/docs/docs/cmd/planner/roster/roster-get.md +73 -0
  64. package/docs/docs/cmd/planner/roster/roster-member-add.md +87 -0
  65. package/docs/docs/cmd/planner/roster/roster-member-list.md +76 -0
  66. package/docs/docs/cmd/planner/roster/roster-member-remove.md +51 -0
  67. package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-get.md +43 -0
  68. package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-list.md +43 -0
  69. package/docs/docs/cmd/pp/card/card-clone.md +12 -0
  70. package/docs/docs/cmd/pp/card/card-get.md +49 -0
  71. package/docs/docs/cmd/pp/card/card-list.md +49 -0
  72. package/docs/docs/cmd/pp/chatbot/chatbot-get.md +55 -0
  73. package/docs/docs/cmd/pp/chatbot/chatbot-list.md +36 -0
  74. package/docs/docs/cmd/pp/dataverse/dataverse-table-get.md +30 -0
  75. package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +30 -0
  76. package/docs/docs/cmd/pp/dataverse/dataverse-table-row-list.md +30 -0
  77. package/docs/docs/cmd/pp/environment/environment-get.md +19 -0
  78. package/docs/docs/cmd/pp/environment/environment-list.md +19 -0
  79. package/docs/docs/cmd/pp/gateway/gateway-get.md +19 -0
  80. package/docs/docs/cmd/pp/gateway/gateway-list.md +19 -0
  81. package/docs/docs/cmd/pp/managementapp/managementapp-add.md +12 -0
  82. package/docs/docs/cmd/pp/managementapp/managementapp-list.md +12 -0
  83. package/docs/docs/cmd/pp/solution/solution-get.md +14 -0
  84. package/docs/docs/cmd/pp/solution/solution-list.md +14 -0
  85. package/docs/docs/cmd/pp/solution/solution-publisher-get.md +20 -1
  86. package/docs/docs/cmd/pp/solution/solution-publisher-list.md +18 -0
  87. package/docs/docs/cmd/pp/tenant/tenant-settings-list.md +21 -0
  88. package/docs/docs/cmd/purview/retentionevent/retentionevent-get.md +132 -0
  89. package/docs/docs/cmd/purview/retentionevent/retentionevent-list.md +107 -0
  90. package/docs/docs/cmd/purview/retentionevent/retentionevent-remove.md +45 -0
  91. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +106 -0
  92. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.md +3 -0
  93. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.md +97 -0
  94. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.md +43 -0
  95. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.md +43 -0
  96. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +3 -0
  97. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-get.md +3 -0
  98. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.md +3 -0
  99. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-remove.md +3 -0
  100. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-set.md +3 -0
  101. package/docs/docs/cmd/request.md +74 -0
  102. package/docs/docs/cmd/spo/file/file-sharinglink-clear.md +46 -0
  103. package/docs/docs/cmd/spo/file/file-sharinglink-list.md +1 -1
  104. package/docs/docs/cmd/spo/file/file-sharinglink-set.md +104 -0
  105. package/docs/docs/cmd/spo/list/list-contenttype-add.md +1 -1
  106. package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +1 -1
  107. package/docs/docs/cmd/spo/list/list-contenttype-list.md +1 -1
  108. package/docs/docs/cmd/spo/list/list-contenttype-remove.md +1 -1
  109. package/docs/docs/cmd/spo/navigation/navigation-node-get.md +91 -0
  110. package/docs/docs/cmd/spo/sitedesign/sitedesign-add.md +3 -0
  111. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +59 -0
  112. package/docs/docs/cmd/status.md +46 -0
  113. package/docs/docs/cmd/version.md +26 -0
  114. package/npm-shrinkwrap.json +911 -876
  115. package/package.json +12 -12
package/.eslintrc.js CHANGED
@@ -24,6 +24,8 @@ const dictionary = [
24
24
  'customizer',
25
25
  'dataverse',
26
26
  'default',
27
+ 'event',
28
+ 'eventreceiver',
27
29
  'external',
28
30
  'externalize',
29
31
  'fun',
package/dist/Command.js CHANGED
@@ -484,15 +484,15 @@ class Command {
484
484
  const title = this.getLogItemTitle(l);
485
485
  const id = this.getLogItemId(l);
486
486
  if (title && id) {
487
- output.push(`## ${title} (${id})`);
487
+ output.push(`## ${title} (${id})`, os.EOL, os.EOL);
488
488
  }
489
489
  else if (title) {
490
- output.push(`## ${title}`);
490
+ output.push(`## ${title}`, os.EOL, os.EOL);
491
491
  }
492
492
  else if (id) {
493
- output.push(`## ${id}`);
493
+ output.push(`## ${id}`, os.EOL, os.EOL);
494
494
  }
495
- output.push(os.EOL, os.EOL, `Property | Value`, os.EOL, `---------|-------`, os.EOL);
495
+ output.push(`Property | Value`, os.EOL, `---------|-------`, os.EOL);
496
496
  output.push(Object.keys(l).map(k => {
497
497
  const value = l[k];
498
498
  let stringValue = value;
package/dist/cli/Cli.js CHANGED
@@ -118,6 +118,8 @@ class Cli {
118
118
  }
119
119
  try {
120
120
  // process options before passing them on to validation stage
121
+ const contextCommandOptions = this.loadOptionsFromContext(this.commandToExecute.options, optionsWithoutShorts.options.debug);
122
+ optionsWithoutShorts.options = Object.assign(Object.assign({}, contextCommandOptions), optionsWithoutShorts.options);
121
123
  yield this.commandToExecute.command.processOptions(optionsWithoutShorts.options);
122
124
  }
123
125
  catch (e) {
@@ -283,6 +285,42 @@ class Cli {
283
285
  }
284
286
  this.loadCommandFromFile(commandFilePath);
285
287
  }
288
+ loadOptionsFromContext(commandOptions, debug) {
289
+ const filePath = '.m365rc.json';
290
+ let m365rc = {};
291
+ if (!fs.existsSync(filePath)) {
292
+ return;
293
+ }
294
+ if (debug) {
295
+ Cli.error('found .m365rc.json file');
296
+ }
297
+ try {
298
+ const fileContents = fs.readFileSync(filePath, 'utf8');
299
+ if (fileContents) {
300
+ m365rc = JSON.parse(fileContents);
301
+ }
302
+ }
303
+ catch (e) {
304
+ this.closeWithError(`Error parsing ${filePath}`, { options: {} });
305
+ }
306
+ if (!m365rc.context) {
307
+ return;
308
+ }
309
+ if (debug) {
310
+ Cli.error('found context in .m365rc.json file');
311
+ }
312
+ const context = m365rc.context;
313
+ const foundOptions = {};
314
+ commandOptions.forEach(option => {
315
+ if (context[option.name]) {
316
+ foundOptions[option.name] = context[option.name];
317
+ if (debug) {
318
+ Cli.error(`returning ${option.name} option from context`);
319
+ }
320
+ }
321
+ });
322
+ return foundOptions;
323
+ }
286
324
  /**
287
325
  * Loads command from the specified file into CLI. If can't find the file
288
326
  * or the file doesn't contain a command, loads all available commands.
@@ -0,0 +1,103 @@
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 _AadUserRecycleBinItemClearCommand_instances, _AadUserRecycleBinItemClearCommand_initTelemetry, _AadUserRecycleBinItemClearCommand_initOptions;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const request_1 = require("../../../../request");
20
+ const odata_1 = require("../../../../utils/odata");
21
+ const GraphCommand_1 = require("../../../base/GraphCommand");
22
+ const commands_1 = require("../../commands");
23
+ class AadUserRecycleBinItemClearCommand extends GraphCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.USER_RECYCLEBINITEM_CLEAR;
26
+ }
27
+ get description() {
28
+ return 'Removes all users from the tenant recycle bin';
29
+ }
30
+ constructor() {
31
+ super();
32
+ _AadUserRecycleBinItemClearCommand_instances.add(this);
33
+ __classPrivateFieldGet(this, _AadUserRecycleBinItemClearCommand_instances, "m", _AadUserRecycleBinItemClearCommand_initTelemetry).call(this);
34
+ __classPrivateFieldGet(this, _AadUserRecycleBinItemClearCommand_instances, "m", _AadUserRecycleBinItemClearCommand_initOptions).call(this);
35
+ }
36
+ commandAction(logger, args) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ const clearRecycleBinUsers = () => __awaiter(this, void 0, void 0, function* () {
39
+ try {
40
+ const users = yield odata_1.odata.getAllItems(`${this.resource}/v1.0/directory/deletedItems/microsoft.graph.user?$select=id`);
41
+ if (this.verbose) {
42
+ logger.logToStderr(`Amount of users to permanently delete: ${users.length}`);
43
+ }
44
+ const batchRequests = users.map((user, index) => {
45
+ return {
46
+ id: index,
47
+ method: 'DELETE',
48
+ url: `/directory/deletedItems/${user.id}`
49
+ };
50
+ });
51
+ for (let i = 0; i < batchRequests.length; i += 20) {
52
+ const batchRequestChunk = batchRequests.slice(i, i + 20);
53
+ if (this.verbose) {
54
+ logger.logToStderr(`Deleting users: ${i + batchRequestChunk.length}/${users.length}`);
55
+ }
56
+ const requestOptions = {
57
+ url: `${this.resource}/v1.0/$batch`,
58
+ headers: {
59
+ accept: 'application/json',
60
+ 'content-type': 'application/json'
61
+ },
62
+ responseType: 'json',
63
+ data: {
64
+ requests: batchRequestChunk
65
+ }
66
+ };
67
+ yield request_1.default.post(requestOptions);
68
+ }
69
+ }
70
+ catch (err) {
71
+ this.handleRejectedODataJsonPromise(err);
72
+ }
73
+ });
74
+ if (args.options.confirm) {
75
+ yield clearRecycleBinUsers();
76
+ }
77
+ else {
78
+ const result = yield Cli_1.Cli.prompt({
79
+ type: 'confirm',
80
+ name: 'continue',
81
+ default: false,
82
+ message: 'Are you sure you want to permanently delete all deleted users?'
83
+ });
84
+ if (result.continue) {
85
+ yield clearRecycleBinUsers();
86
+ }
87
+ }
88
+ });
89
+ }
90
+ }
91
+ _AadUserRecycleBinItemClearCommand_instances = new WeakSet(), _AadUserRecycleBinItemClearCommand_initTelemetry = function _AadUserRecycleBinItemClearCommand_initTelemetry() {
92
+ this.telemetry.push((args) => {
93
+ Object.assign(this.telemetryProperties, {
94
+ confirm: !!args.options.confirm
95
+ });
96
+ });
97
+ }, _AadUserRecycleBinItemClearCommand_initOptions = function _AadUserRecycleBinItemClearCommand_initOptions() {
98
+ this.options.unshift({
99
+ option: '--confirm'
100
+ });
101
+ };
102
+ module.exports = new AadUserRecycleBinItemClearCommand();
103
+ //# sourceMappingURL=user-recyclebinitem-clear.js.map
@@ -0,0 +1,92 @@
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 _AadUserRecycleBinItemRemoveCommand_instances, _AadUserRecycleBinItemRemoveCommand_initTelemetry, _AadUserRecycleBinItemRemoveCommand_initOptions, _AadUserRecycleBinItemRemoveCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const request_1 = require("../../../../request");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const GraphCommand_1 = require("../../../base/GraphCommand");
22
+ const commands_1 = require("../../commands");
23
+ class AadUserRecycleBinItemRemoveCommand extends GraphCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.USER_RECYCLEBINITEM_REMOVE;
26
+ }
27
+ get description() {
28
+ return 'Removes a user from the recycle bin in the current tenant';
29
+ }
30
+ constructor() {
31
+ super();
32
+ _AadUserRecycleBinItemRemoveCommand_instances.add(this);
33
+ __classPrivateFieldGet(this, _AadUserRecycleBinItemRemoveCommand_instances, "m", _AadUserRecycleBinItemRemoveCommand_initTelemetry).call(this);
34
+ __classPrivateFieldGet(this, _AadUserRecycleBinItemRemoveCommand_instances, "m", _AadUserRecycleBinItemRemoveCommand_initOptions).call(this);
35
+ __classPrivateFieldGet(this, _AadUserRecycleBinItemRemoveCommand_instances, "m", _AadUserRecycleBinItemRemoveCommand_initValidators).call(this);
36
+ }
37
+ commandAction(logger, args) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const clearRecycleBinItem = () => __awaiter(this, void 0, void 0, function* () {
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Permanently deleting user with id ${args.options.id} from Azure Active Directory`);
42
+ }
43
+ try {
44
+ const requestOptions = {
45
+ url: `${this.resource}/v1.0/directory/deletedItems/${args.options.id}`,
46
+ headers: {}
47
+ };
48
+ yield request_1.default.delete(requestOptions);
49
+ }
50
+ catch (err) {
51
+ this.handleRejectedODataJsonPromise(err);
52
+ }
53
+ });
54
+ if (args.options.confirm) {
55
+ yield clearRecycleBinItem();
56
+ }
57
+ else {
58
+ const result = yield Cli_1.Cli.prompt({
59
+ type: 'confirm',
60
+ name: 'continue',
61
+ default: false,
62
+ message: `Are you sure you want to permanently delete the user with id ${args.options.id}?`
63
+ });
64
+ if (result.continue) {
65
+ yield clearRecycleBinItem();
66
+ }
67
+ }
68
+ });
69
+ }
70
+ }
71
+ _AadUserRecycleBinItemRemoveCommand_instances = new WeakSet(), _AadUserRecycleBinItemRemoveCommand_initTelemetry = function _AadUserRecycleBinItemRemoveCommand_initTelemetry() {
72
+ this.telemetry.push((args) => {
73
+ Object.assign(this.telemetryProperties, {
74
+ confirm: !!args.options.confirm
75
+ });
76
+ });
77
+ }, _AadUserRecycleBinItemRemoveCommand_initOptions = function _AadUserRecycleBinItemRemoveCommand_initOptions() {
78
+ this.options.unshift({
79
+ option: '--id <id>'
80
+ }, {
81
+ option: '--confirm'
82
+ });
83
+ }, _AadUserRecycleBinItemRemoveCommand_initValidators = function _AadUserRecycleBinItemRemoveCommand_initValidators() {
84
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
85
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
86
+ return `${args.options.id} is not a valid GUID`;
87
+ }
88
+ return true;
89
+ }));
90
+ };
91
+ module.exports = new AadUserRecycleBinItemRemoveCommand();
92
+ //# sourceMappingURL=user-recyclebinitem-remove.js.map
@@ -60,6 +60,8 @@ exports.default = {
60
60
  USER_HIBP: `${prefix} user hibp`,
61
61
  USER_LIST: `${prefix} user list`,
62
62
  USER_PASSWORD_VALIDATE: `${prefix} user password validate`,
63
+ USER_RECYCLEBINITEM_CLEAR: `${prefix} user recyclebinitem clear`,
64
+ USER_RECYCLEBINITEM_REMOVE: `${prefix} user recyclebinitem remove`,
63
65
  USER_SET: `${prefix} user set`,
64
66
  USER_SIGNIN_LIST: `${prefix} user signin list`
65
67
  };
@@ -0,0 +1,54 @@
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 fs = require("fs");
13
+ const Command_1 = require("../../../../Command");
14
+ const ContextCommand_1 = require("../../../base/ContextCommand");
15
+ const commands_1 = require("../../commands");
16
+ class ContextOptionListCommand extends ContextCommand_1.default {
17
+ get name() {
18
+ return commands_1.default.OPTION_LIST;
19
+ }
20
+ get description() {
21
+ return 'List all options added to the context';
22
+ }
23
+ commandAction(logger) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ if (this.verbose) {
26
+ logger.logToStderr(`Retrieving context options...`);
27
+ }
28
+ const filePath = '.m365rc.json';
29
+ let m365rc = {};
30
+ if (fs.existsSync(filePath)) {
31
+ try {
32
+ if (this.verbose) {
33
+ logger.logToStderr(`Reading context file...`);
34
+ }
35
+ const fileContents = fs.readFileSync(filePath, 'utf8');
36
+ if (fileContents) {
37
+ m365rc = JSON.parse(fileContents);
38
+ }
39
+ }
40
+ catch (e) {
41
+ throw new Command_1.CommandError(`Error reading ${filePath}: ${e}. Please retrieve context options from ${filePath} manually.`);
42
+ }
43
+ }
44
+ if (!m365rc.context) {
45
+ throw new Command_1.CommandError(`No context present`);
46
+ }
47
+ else {
48
+ logger.log(m365rc.context);
49
+ }
50
+ });
51
+ }
52
+ }
53
+ module.exports = new ContextOptionListCommand();
54
+ //# sourceMappingURL=option-list.js.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'context';
4
4
  exports.default = {
5
5
  INIT: `${prefix} init`,
6
+ OPTION_LIST: `${prefix} option list`,
6
7
  OPTION_REMOVE: `${prefix} option remove`,
7
8
  OPTION_SET: `${prefix} option set`,
8
9
  REMOVE: `${prefix} remove`
@@ -13,7 +13,7 @@ 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 _PaEnvironmentGetCommand_instances, _PaEnvironmentGetCommand_initOptions;
16
+ var _PaEnvironmentGetCommand_instances, _PaEnvironmentGetCommand_initTelemetry, _PaEnvironmentGetCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
@@ -32,15 +32,17 @@ class PaEnvironmentGetCommand extends PowerAppsCommand_1.default {
32
32
  constructor() {
33
33
  super();
34
34
  _PaEnvironmentGetCommand_instances.add(this);
35
+ __classPrivateFieldGet(this, _PaEnvironmentGetCommand_instances, "m", _PaEnvironmentGetCommand_initTelemetry).call(this);
35
36
  __classPrivateFieldGet(this, _PaEnvironmentGetCommand_instances, "m", _PaEnvironmentGetCommand_initOptions).call(this);
36
37
  }
37
38
  commandAction(logger, args) {
38
39
  return __awaiter(this, void 0, void 0, function* () {
39
40
  if (this.verbose) {
40
- logger.logToStderr(`Retrieving information about Microsoft Power Apps environment ${args.options.name}...`);
41
+ logger.logToStderr(`Retrieving information about Microsoft Power Apps environment ${args.options.name || 'default'}...`);
41
42
  }
43
+ const environmentName = args.options.name ? formatting_1.formatting.encodeQueryParameter(args.options.name) : '~default';
42
44
  const requestOptions = {
43
- url: `${this.resource}/providers/Microsoft.PowerApps/environments/${formatting_1.formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
45
+ url: `${this.resource}/providers/Microsoft.PowerApps/environments/${environmentName}?api-version=2016-11-01`,
44
46
  headers: {
45
47
  accept: 'application/json'
46
48
  },
@@ -61,9 +63,15 @@ class PaEnvironmentGetCommand extends PowerAppsCommand_1.default {
61
63
  });
62
64
  }
63
65
  }
64
- _PaEnvironmentGetCommand_instances = new WeakSet(), _PaEnvironmentGetCommand_initOptions = function _PaEnvironmentGetCommand_initOptions() {
66
+ _PaEnvironmentGetCommand_instances = new WeakSet(), _PaEnvironmentGetCommand_initTelemetry = function _PaEnvironmentGetCommand_initTelemetry() {
67
+ this.telemetry.push((args) => {
68
+ Object.assign(this.telemetryProperties, {
69
+ name: typeof args.options.name !== 'undefined'
70
+ });
71
+ });
72
+ }, _PaEnvironmentGetCommand_initOptions = function _PaEnvironmentGetCommand_initOptions() {
65
73
  this.options.unshift({
66
- option: '-n, --name <name>'
74
+ option: '-n, --name [name]'
67
75
  });
68
76
  };
69
77
  module.exports = new PaEnvironmentGetCommand();
@@ -48,11 +48,18 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
48
48
  logger.log(result);
49
49
  }
50
50
  else {
51
- let groupId = undefined;
52
- if (args.options.ownerGroupId || args.options.ownerGroupName) {
53
- groupId = yield this.getGroupId(args);
51
+ let plan = {};
52
+ if (args.options.rosterId) {
53
+ const plans = yield planner_1.planner.getPlansByRosterId(args.options.rosterId);
54
+ plan = plans[0];
55
+ }
56
+ else {
57
+ let groupId = undefined;
58
+ if (args.options.ownerGroupId || args.options.ownerGroupName) {
59
+ groupId = yield this.getGroupId(args);
60
+ }
61
+ plan = yield planner_1.planner.getPlanByTitle(args.options.title, groupId);
54
62
  }
55
- const plan = yield planner_1.planner.getPlanByTitle(args.options.title, groupId, args.options.rosterId);
56
63
  const result = yield this.getPlanDetails(plan);
57
64
  if (result) {
58
65
  logger.log(result);
@@ -93,9 +100,9 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
93
100
  Object.assign(this.telemetryProperties, {
94
101
  id: typeof args.options.id !== 'undefined',
95
102
  title: typeof args.options.title !== 'undefined',
103
+ rosterId: typeof args.options.rosterId !== 'undefined',
96
104
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
97
- ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
98
- rosterId: typeof args.options.rosterId !== 'undefined'
105
+ ownerGroupName: typeof args.options.ownerGroupName !== 'undefined'
99
106
  });
100
107
  });
101
108
  }, _PlannerPlanGetCommand_initOptions = function _PlannerPlanGetCommand_initOptions() {
@@ -103,12 +110,12 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
103
110
  option: '-i, --id [id]'
104
111
  }, {
105
112
  option: '-t, --title [title]'
113
+ }, {
114
+ option: '--rosterId [rosterId]'
106
115
  }, {
107
116
  option: '--ownerGroupId [ownerGroupId]'
108
117
  }, {
109
118
  option: '--ownerGroupName [ownerGroupName]'
110
- }, {
111
- option: '--rosterId [rosterId]'
112
119
  });
113
120
  }, _PlannerPlanGetCommand_initValidators = function _PlannerPlanGetCommand_initValidators() {
114
121
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -119,9 +126,9 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
119
126
  }));
120
127
  }, _PlannerPlanGetCommand_initOptionSets = function _PlannerPlanGetCommand_initOptionSets() {
121
128
  this.optionSets.push({
122
- options: ['id', 'title']
129
+ options: ['id', 'title', 'rosterId']
123
130
  }, {
124
- options: ['ownerGroupId', 'ownerGroupName', 'rosterId'],
131
+ options: ['ownerGroupId', 'ownerGroupName'],
125
132
  runsWhen: (args) => {
126
133
  return args.options.title !== undefined;
127
134
  }
@@ -59,9 +59,16 @@ class PlannerPlanSetCommand extends GraphCommand_1.default {
59
59
  if (id) {
60
60
  return id;
61
61
  }
62
- const groupId = yield this.getGroupId(args);
63
- const plan = yield planner_1.planner.getPlanByTitle(title, groupId);
64
- return plan.id;
62
+ let groupId = '';
63
+ if (args.options.rosterId) {
64
+ const plans = yield planner_1.planner.getPlansByRosterId(args.options.rosterId);
65
+ return plans[0].id;
66
+ }
67
+ else {
68
+ groupId = yield this.getGroupId(args);
69
+ const plan = yield planner_1.planner.getPlanByTitle(title, groupId);
70
+ return plan.id;
71
+ }
65
72
  });
66
73
  }
67
74
  getUserIds(options) {
@@ -214,6 +221,7 @@ _PlannerPlanSetCommand_instances = new WeakSet(), _PlannerPlanSetCommand_initTel
214
221
  title: typeof args.options.title !== 'undefined',
215
222
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
216
223
  ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
224
+ rosterId: typeof args.options.rosterId !== 'undefined',
217
225
  newTitle: typeof args.options.newTitle !== 'undefined',
218
226
  shareWithUserIds: typeof args.options.shareWithUserIds !== 'undefined',
219
227
  shareWithUserNames: typeof args.options.shareWithUserNames !== 'undefined'
@@ -228,6 +236,8 @@ _PlannerPlanSetCommand_instances = new WeakSet(), _PlannerPlanSetCommand_initTel
228
236
  option: '--ownerGroupId [ownerGroupId]'
229
237
  }, {
230
238
  option: '--ownerGroupName [ownerGroupName]'
239
+ }, {
240
+ option: '--rosterId [rosterId]'
231
241
  }, {
232
242
  option: '--newTitle [newTitle]'
233
243
  }, {
@@ -241,12 +251,6 @@ _PlannerPlanSetCommand_instances = new WeakSet(), _PlannerPlanSetCommand_initTel
241
251
  if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
242
252
  return `${args.options.ownerGroupId} is not a valid GUID`;
243
253
  }
244
- if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
245
- return 'Specify either ownerGroupId or ownerGroupName when using title';
246
- }
247
- if (args.options.ownerGroupId && args.options.ownerGroupName) {
248
- return 'Specify either ownerGroupId or ownerGroupName when using title but not both';
249
- }
250
254
  }
251
255
  if (args.options.shareWithUserIds && args.options.shareWithUserNames) {
252
256
  return 'Specify either shareWithUserIds or shareWithUserNames but not both';
@@ -293,7 +297,14 @@ _PlannerPlanSetCommand_instances = new WeakSet(), _PlannerPlanSetCommand_initTel
293
297
  return true;
294
298
  }));
295
299
  }, _PlannerPlanSetCommand_initOptionSets = function _PlannerPlanSetCommand_initOptionSets() {
296
- this.optionSets.push({ options: ['id', 'title'] });
300
+ this.optionSets.push({
301
+ options: ['id', 'title', 'rosterId']
302
+ }, {
303
+ options: ['ownerGroupId', 'ownerGroupName'],
304
+ runsWhen: (args) => {
305
+ return args.options.title !== undefined;
306
+ }
307
+ });
297
308
  };
298
309
  module.exports = new PlannerPlanSetCommand();
299
310
  //# sourceMappingURL=plan-set.js.map
@@ -0,0 +1,61 @@
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 _PlannerRosterGetCommand_instances, _PlannerRosterGetCommand_initOptions;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const GraphCommand_1 = require("../../../base/GraphCommand");
20
+ const commands_1 = require("../../commands");
21
+ class PlannerRosterGetCommand extends GraphCommand_1.default {
22
+ get name() {
23
+ return commands_1.default.ROSTER_GET;
24
+ }
25
+ get description() {
26
+ return 'Retrieve information about a specific Microsoft Planner Roster';
27
+ }
28
+ constructor() {
29
+ super();
30
+ _PlannerRosterGetCommand_instances.add(this);
31
+ __classPrivateFieldGet(this, _PlannerRosterGetCommand_instances, "m", _PlannerRosterGetCommand_initOptions).call(this);
32
+ }
33
+ commandAction(logger, args) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ if (this.verbose) {
36
+ logger.logToStderr(`Retrieving information about Microsoft Planner Roster with id ${args.options.id}`);
37
+ }
38
+ const requestOptions = {
39
+ url: `${this.resource}/beta/planner/rosters/${args.options.id}`,
40
+ headers: {
41
+ 'accept': 'application/json;odata.metadata=none'
42
+ },
43
+ responseType: 'json'
44
+ };
45
+ try {
46
+ const response = yield request_1.default.get(requestOptions);
47
+ logger.log(response);
48
+ }
49
+ catch (err) {
50
+ this.handleRejectedODataJsonPromise(err);
51
+ }
52
+ });
53
+ }
54
+ }
55
+ _PlannerRosterGetCommand_instances = new WeakSet(), _PlannerRosterGetCommand_initOptions = function _PlannerRosterGetCommand_initOptions() {
56
+ this.options.unshift({
57
+ option: '--id <id>'
58
+ });
59
+ };
60
+ module.exports = new PlannerRosterGetCommand();
61
+ //# sourceMappingURL=roster-get.js.map