@pnp/cli-microsoft365 6.3.0-beta.64eb7da → 6.3.0-beta.861847a

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 (69) hide show
  1. package/.eslintrc.js +4 -0
  2. package/dist/Command.js +4 -4
  3. package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
  4. package/dist/m365/planner/commands/roster/roster-member-add.js +113 -0
  5. package/dist/m365/planner/commands/roster/roster-member-list.js +54 -0
  6. package/dist/m365/planner/commands/task/task-add.js +3 -0
  7. package/dist/m365/planner/commands.js +2 -0
  8. package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +76 -0
  9. package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +47 -0
  10. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +77 -0
  11. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +8 -8
  12. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +44 -0
  13. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +97 -0
  14. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +90 -0
  15. package/dist/m365/purview/commands.js +7 -1
  16. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-add.js +95 -0
  17. package/dist/m365/spo/commands/file/GraphFileDetails.js +0 -1
  18. package/dist/m365/spo/commands/file/file-sharinglink-add.js +2 -22
  19. package/dist/m365/spo/commands/file/file-sharinglink-clear.js +137 -0
  20. package/dist/m365/spo/commands/file/file-sharinglink-get.js +2 -25
  21. package/dist/m365/spo/commands/file/file-sharinglink-list.js +7 -28
  22. package/dist/m365/spo/commands/file/file-sharinglink-remove.js +2 -25
  23. package/dist/m365/spo/commands/file/file-sharinglink-set.js +104 -0
  24. package/dist/m365/spo/commands/listitem/listitem-add.js +2 -1
  25. package/dist/m365/spo/commands/sitedesign/sitedesign-add.js +6 -0
  26. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +179 -0
  27. package/dist/m365/spo/commands.js +4 -0
  28. package/dist/utils/spo.js +28 -0
  29. package/docs/docs/cmd/pa/app/app-get.md +24 -0
  30. package/docs/docs/cmd/pa/app/app-list.md +21 -0
  31. package/docs/docs/cmd/pa/connector/connector-list.md +17 -0
  32. package/docs/docs/cmd/pa/environment/environment-get.md +18 -0
  33. package/docs/docs/cmd/pa/environment/environment-list.md +19 -0
  34. package/docs/docs/cmd/planner/roster/roster-member-add.md +87 -0
  35. package/docs/docs/cmd/planner/roster/roster-member-list.md +76 -0
  36. package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-get.md +43 -0
  37. package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-list.md +43 -0
  38. package/docs/docs/cmd/pp/card/card-clone.md +12 -0
  39. package/docs/docs/cmd/pp/card/card-get.md +49 -0
  40. package/docs/docs/cmd/pp/card/card-list.md +49 -0
  41. package/docs/docs/cmd/pp/chatbot/chatbot-get.md +55 -0
  42. package/docs/docs/cmd/pp/chatbot/chatbot-list.md +36 -0
  43. package/docs/docs/cmd/pp/dataverse/dataverse-table-get.md +30 -0
  44. package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +30 -0
  45. package/docs/docs/cmd/pp/dataverse/dataverse-table-row-list.md +30 -0
  46. package/docs/docs/cmd/pp/environment/environment-get.md +19 -0
  47. package/docs/docs/cmd/pp/environment/environment-list.md +19 -0
  48. package/docs/docs/cmd/pp/gateway/gateway-get.md +19 -0
  49. package/docs/docs/cmd/pp/gateway/gateway-list.md +19 -0
  50. package/docs/docs/cmd/pp/managementapp/managementapp-add.md +12 -0
  51. package/docs/docs/cmd/pp/managementapp/managementapp-list.md +12 -0
  52. package/docs/docs/cmd/pp/solution/solution-get.md +14 -0
  53. package/docs/docs/cmd/pp/solution/solution-list.md +14 -0
  54. package/docs/docs/cmd/pp/solution/solution-publisher-get.md +20 -1
  55. package/docs/docs/cmd/pp/solution/solution-publisher-list.md +18 -0
  56. package/docs/docs/cmd/pp/tenant/tenant-settings-list.md +21 -0
  57. package/docs/docs/cmd/purview/retentionevent/retentionevent-get.md +132 -0
  58. package/docs/docs/cmd/purview/retentionevent/retentionevent-list.md +107 -0
  59. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +106 -0
  60. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.md +97 -0
  61. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.md +43 -0
  62. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.md +43 -0
  63. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.md +56 -0
  64. package/docs/docs/cmd/spo/file/file-sharinglink-clear.md +46 -0
  65. package/docs/docs/cmd/spo/file/file-sharinglink-list.md +1 -1
  66. package/docs/docs/cmd/spo/file/file-sharinglink-set.md +104 -0
  67. package/docs/docs/cmd/spo/sitedesign/sitedesign-add.md +3 -0
  68. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +59 -0
  69. package/package.json +1 -1
package/.eslintrc.js CHANGED
@@ -7,6 +7,7 @@ const dictionary = [
7
7
  'adaptive',
8
8
  'ai',
9
9
  'app',
10
+ 'application',
10
11
  'apply',
11
12
  'approve',
12
13
  'assets',
@@ -20,8 +21,11 @@ const dictionary = [
20
21
  'content',
21
22
  'conversation',
22
23
  'custom',
24
+ 'customizer',
23
25
  'dataverse',
24
26
  'default',
27
+ 'event',
28
+ 'eventreceiver',
25
29
  'external',
26
30
  'externalize',
27
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;
@@ -79,7 +79,7 @@ class PlannerPlanRemoveCommand extends GraphCommand_1.default {
79
79
  return planner_1.planner.getPlanById(id, 'minimal');
80
80
  }
81
81
  const groupId = yield this.getGroupId(args);
82
- return yield planner_1.planner.getPlanByTitle(title, groupId, 'minimal');
82
+ return yield planner_1.planner.getPlanByTitle(title, groupId, undefined, 'minimal');
83
83
  });
84
84
  }
85
85
  getGroupId(args) {
@@ -0,0 +1,113 @@
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 _PlannerRosterMemberAddCommand_instances, _PlannerRosterMemberAddCommand_initTelemetry, _PlannerRosterMemberAddCommand_initOptions, _PlannerRosterMemberAddCommand_initOptionSets, _PlannerRosterMemberAddCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const validation_1 = require("../../../../utils/validation");
20
+ const GraphCommand_1 = require("../../../base/GraphCommand");
21
+ const commands_1 = require("../../commands");
22
+ const AadUserGetCommand = require("../../../aad/commands/user/user-get");
23
+ const Cli_1 = require("../../../../cli/Cli");
24
+ class PlannerRosterMemberAddCommand extends GraphCommand_1.default {
25
+ get name() {
26
+ return commands_1.default.ROSTER_MEMBER_ADD;
27
+ }
28
+ get description() {
29
+ return 'Adds a user to a Microsoft Planner Roster';
30
+ }
31
+ constructor() {
32
+ super();
33
+ _PlannerRosterMemberAddCommand_instances.add(this);
34
+ __classPrivateFieldGet(this, _PlannerRosterMemberAddCommand_instances, "m", _PlannerRosterMemberAddCommand_initTelemetry).call(this);
35
+ __classPrivateFieldGet(this, _PlannerRosterMemberAddCommand_instances, "m", _PlannerRosterMemberAddCommand_initOptions).call(this);
36
+ __classPrivateFieldGet(this, _PlannerRosterMemberAddCommand_instances, "m", _PlannerRosterMemberAddCommand_initValidators).call(this);
37
+ __classPrivateFieldGet(this, _PlannerRosterMemberAddCommand_instances, "m", _PlannerRosterMemberAddCommand_initOptionSets).call(this);
38
+ }
39
+ commandAction(logger, args) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ if (this.verbose) {
42
+ logger.logToStderr('Adding a user to a Microsoft Planner Roster');
43
+ }
44
+ try {
45
+ const userId = yield this.getUserId(logger, args);
46
+ const requestOptions = {
47
+ url: `${this.resource}/beta/planner/rosters/${args.options.rosterId}/members`,
48
+ headers: {
49
+ accept: 'application/json;odata.metadata=none'
50
+ },
51
+ data: {
52
+ userId: userId
53
+ },
54
+ responseType: 'json'
55
+ };
56
+ const response = yield request_1.default.post(requestOptions);
57
+ logger.log(response);
58
+ }
59
+ catch (err) {
60
+ this.handleRejectedODataJsonPromise(err);
61
+ }
62
+ });
63
+ }
64
+ getUserId(logger, args) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ if (this.verbose) {
67
+ logger.logToStderr("Getting the user ID");
68
+ }
69
+ if (args.options.userId) {
70
+ return args.options.userId;
71
+ }
72
+ const aadUserGetCommandoptions = {
73
+ userName: args.options.userName,
74
+ output: 'json',
75
+ debug: args.options.debug,
76
+ verbose: args.options.verbose
77
+ };
78
+ const aadUserGetOutput = yield Cli_1.Cli.executeCommandWithOutput(AadUserGetCommand, { options: Object.assign(Object.assign({}, aadUserGetCommandoptions), { _: [] }) });
79
+ if (this.verbose) {
80
+ logger.logToStderr(aadUserGetOutput.stderr);
81
+ }
82
+ const aadUserGetJsonOutput = JSON.parse(aadUserGetOutput.stdout);
83
+ return aadUserGetJsonOutput.id;
84
+ });
85
+ }
86
+ }
87
+ _PlannerRosterMemberAddCommand_instances = new WeakSet(), _PlannerRosterMemberAddCommand_initTelemetry = function _PlannerRosterMemberAddCommand_initTelemetry() {
88
+ this.telemetry.push((args) => {
89
+ Object.assign(this.telemetryProperties, {
90
+ userId: typeof args.options.userId !== 'undefined',
91
+ userName: typeof args.options.userName !== 'undefined'
92
+ });
93
+ });
94
+ }, _PlannerRosterMemberAddCommand_initOptions = function _PlannerRosterMemberAddCommand_initOptions() {
95
+ this.options.unshift({
96
+ option: '--rosterId <rosterId>'
97
+ }, {
98
+ option: '--userId [userId]'
99
+ }, {
100
+ option: '--userName [userName]'
101
+ });
102
+ }, _PlannerRosterMemberAddCommand_initOptionSets = function _PlannerRosterMemberAddCommand_initOptionSets() {
103
+ this.optionSets.push({ options: ['userId', 'userName'] });
104
+ }, _PlannerRosterMemberAddCommand_initValidators = function _PlannerRosterMemberAddCommand_initValidators() {
105
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
106
+ if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
107
+ return `${args.options.userId} is not a valid GUID`;
108
+ }
109
+ return true;
110
+ }));
111
+ };
112
+ module.exports = new PlannerRosterMemberAddCommand();
113
+ //# sourceMappingURL=roster-member-add.js.map
@@ -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
+ 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 _PlannerRosterMemberListCommand_instances, _PlannerRosterMemberListCommand_initOptions;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const odata_1 = require("../../../../utils/odata");
19
+ const GraphCommand_1 = require("../../../base/GraphCommand");
20
+ const commands_1 = require("../../commands");
21
+ class PlannerRosterMemberListCommand extends GraphCommand_1.default {
22
+ get name() {
23
+ return commands_1.default.ROSTER_MEMBER_LIST;
24
+ }
25
+ get description() {
26
+ return 'Lists members of the specified Microsoft Planner Roster';
27
+ }
28
+ constructor() {
29
+ super();
30
+ _PlannerRosterMemberListCommand_instances.add(this);
31
+ __classPrivateFieldGet(this, _PlannerRosterMemberListCommand_instances, "m", _PlannerRosterMemberListCommand_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 members of the specified Microsoft Planner Roster');
37
+ }
38
+ try {
39
+ const response = yield odata_1.odata.getAllItems(`${this.resource}/beta/planner/rosters/${args.options.rosterId}/members`);
40
+ logger.log(response);
41
+ }
42
+ catch (err) {
43
+ this.handleRejectedODataJsonPromise(err);
44
+ }
45
+ });
46
+ }
47
+ }
48
+ _PlannerRosterMemberListCommand_instances = new WeakSet(), _PlannerRosterMemberListCommand_initOptions = function _PlannerRosterMemberListCommand_initOptions() {
49
+ this.options.unshift({
50
+ option: '--rosterId <rosterId>'
51
+ });
52
+ };
53
+ module.exports = new PlannerRosterMemberListCommand();
54
+ //# sourceMappingURL=roster-member-list.js.map
@@ -69,6 +69,9 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
69
69
  };
70
70
  const newTask = yield request_1.default.post(requestOptions);
71
71
  const result = yield this.updateTaskDetails(args.options, newTask);
72
+ if (result.description) {
73
+ result.hasDescription = true;
74
+ }
72
75
  logger.log(result);
73
76
  }
74
77
  catch (err) {
@@ -13,6 +13,8 @@ exports.default = {
13
13
  PLAN_REMOVE: `${prefix} plan remove`,
14
14
  PLAN_SET: `${prefix} plan set`,
15
15
  ROSTER_ADD: `${prefix} roster add`,
16
+ ROSTER_MEMBER_ADD: `${prefix} roster member add`,
17
+ ROSTER_MEMBER_LIST: `${prefix} roster member list`,
16
18
  ROSTER_REMOVE: `${prefix} roster remove`,
17
19
  TASK_ADD: `${prefix} task add`,
18
20
  TASK_CHECKLISTITEM_ADD: `${prefix} task checklistitem add`,
@@ -0,0 +1,76 @@
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 _PurviewRetentionEventGetCommand_instances, _PurviewRetentionEventGetCommand_initOptions, _PurviewRetentionEventGetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const GraphCommand_1 = require("../../../base/GraphCommand");
19
+ const commands_1 = require("../../commands");
20
+ const accessToken_1 = require("../../../../utils/accessToken");
21
+ const Auth_1 = require("../../../../Auth");
22
+ const request_1 = require("../../../../request");
23
+ const validation_1 = require("../../../../utils/validation");
24
+ class PurviewRetentionEventGetCommand extends GraphCommand_1.default {
25
+ get name() {
26
+ return commands_1.default.RETENTIONEVENT_GET;
27
+ }
28
+ get description() {
29
+ return 'Retrieve the specified retention event';
30
+ }
31
+ constructor() {
32
+ super();
33
+ _PurviewRetentionEventGetCommand_instances.add(this);
34
+ __classPrivateFieldGet(this, _PurviewRetentionEventGetCommand_instances, "m", _PurviewRetentionEventGetCommand_initOptions).call(this);
35
+ __classPrivateFieldGet(this, _PurviewRetentionEventGetCommand_instances, "m", _PurviewRetentionEventGetCommand_initValidators).call(this);
36
+ }
37
+ commandAction(logger, args) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ if (this.verbose) {
40
+ logger.logToStderr(`Retrieving retention event with id ${args.options.id}`);
41
+ }
42
+ try {
43
+ const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
44
+ if (isAppOnlyAccessToken) {
45
+ throw 'This command currently does not support app only permissions.';
46
+ }
47
+ const requestOptions = {
48
+ url: `${this.resource}/beta/security/triggers/retentionEvents/${args.options.id}`,
49
+ headers: {
50
+ accept: 'application/json;odata.metadata=none'
51
+ },
52
+ responseType: 'json'
53
+ };
54
+ const res = yield request_1.default.get(requestOptions);
55
+ logger.log(res);
56
+ }
57
+ catch (err) {
58
+ this.handleRejectedODataJsonPromise(err);
59
+ }
60
+ });
61
+ }
62
+ }
63
+ _PurviewRetentionEventGetCommand_instances = new WeakSet(), _PurviewRetentionEventGetCommand_initOptions = function _PurviewRetentionEventGetCommand_initOptions() {
64
+ this.options.unshift({
65
+ option: '-i, --id <id>'
66
+ });
67
+ }, _PurviewRetentionEventGetCommand_initValidators = function _PurviewRetentionEventGetCommand_initValidators() {
68
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
69
+ if (!validation_1.validation.isValidGuid(args.options.id)) {
70
+ return `'${args.options.id}' is not a valid GUID.`;
71
+ }
72
+ return true;
73
+ }));
74
+ };
75
+ module.exports = new PurviewRetentionEventGetCommand();
76
+ //# sourceMappingURL=retentionevent-get.js.map
@@ -0,0 +1,47 @@
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 accessToken_1 = require("../../../../utils/accessToken");
13
+ const odata_1 = require("../../../../utils/odata");
14
+ const GraphCommand_1 = require("../../../base/GraphCommand");
15
+ const commands_1 = require("../../commands");
16
+ const Auth_1 = require("../../../../Auth");
17
+ class PurviewRetentionEventListCommand extends GraphCommand_1.default {
18
+ get name() {
19
+ return commands_1.default.RETENTIONEVENT_LIST;
20
+ }
21
+ get description() {
22
+ return 'Get a list of retention events';
23
+ }
24
+ defaultProperties() {
25
+ return ['id', 'displayName', 'eventTriggerDateTime'];
26
+ }
27
+ commandAction(logger) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ try {
30
+ const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
31
+ if (isAppOnlyAccessToken) {
32
+ throw 'This command currently does not support app only permissions.';
33
+ }
34
+ if (this.verbose) {
35
+ logger.logToStderr('Retrieving Purview retention events');
36
+ }
37
+ const items = yield odata_1.odata.getAllItems(`${this.resource}/beta/security/triggers/retentionEvents`);
38
+ logger.log(items);
39
+ }
40
+ catch (err) {
41
+ this.handleRejectedODataJsonPromise(err);
42
+ }
43
+ });
44
+ }
45
+ }
46
+ module.exports = new PurviewRetentionEventListCommand();
47
+ //# sourceMappingURL=retentionevent-list.js.map
@@ -0,0 +1,77 @@
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 _PurviewRetentionEventTypeAddCommand_instances, _PurviewRetentionEventTypeAddCommand_initTelemetry, _PurviewRetentionEventTypeAddCommand_initOptions;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Auth_1 = require("../../../../Auth");
19
+ const request_1 = require("../../../../request");
20
+ const accessToken_1 = require("../../../../utils/accessToken");
21
+ const GraphCommand_1 = require("../../../base/GraphCommand");
22
+ const commands_1 = require("../../commands");
23
+ class PurviewRetentionEventTypeAddCommand extends GraphCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.RETENTIONEVENTTYPE_ADD;
26
+ }
27
+ get description() {
28
+ return 'Create a retention event type';
29
+ }
30
+ constructor() {
31
+ super();
32
+ _PurviewRetentionEventTypeAddCommand_instances.add(this);
33
+ __classPrivateFieldGet(this, _PurviewRetentionEventTypeAddCommand_instances, "m", _PurviewRetentionEventTypeAddCommand_initTelemetry).call(this);
34
+ __classPrivateFieldGet(this, _PurviewRetentionEventTypeAddCommand_instances, "m", _PurviewRetentionEventTypeAddCommand_initOptions).call(this);
35
+ }
36
+ commandAction(logger, args) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
39
+ this.handleError('This command does not support application permissions.');
40
+ }
41
+ const requestBody = {
42
+ displayName: args.options.displayName,
43
+ description: args.options.description
44
+ };
45
+ const requestOptions = {
46
+ url: `${this.resource}/beta/security/triggerTypes/retentionEventTypes`,
47
+ headers: {
48
+ accept: 'application/json;odata.metadata=none'
49
+ },
50
+ data: requestBody,
51
+ responseType: 'json'
52
+ };
53
+ try {
54
+ const response = yield request_1.default.post(requestOptions);
55
+ logger.log(response);
56
+ }
57
+ catch (err) {
58
+ this.handleRejectedODataPromise(err);
59
+ }
60
+ });
61
+ }
62
+ }
63
+ _PurviewRetentionEventTypeAddCommand_instances = new WeakSet(), _PurviewRetentionEventTypeAddCommand_initTelemetry = function _PurviewRetentionEventTypeAddCommand_initTelemetry() {
64
+ this.telemetry.push((args) => {
65
+ Object.assign(this.telemetryProperties, {
66
+ description: typeof args.options.description !== 'undefined'
67
+ });
68
+ });
69
+ }, _PurviewRetentionEventTypeAddCommand_initOptions = function _PurviewRetentionEventTypeAddCommand_initOptions() {
70
+ this.options.unshift({
71
+ option: '-n, --displayName <displayName>'
72
+ }, {
73
+ option: '-d, --description [description]'
74
+ });
75
+ };
76
+ module.exports = new PurviewRetentionEventTypeAddCommand();
77
+ //# sourceMappingURL=retentioneventtype-add.js.map
@@ -13,13 +13,13 @@ 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 _PurviewRetentionEventtypeGetCommand_instances, _PurviewRetentionEventtypeGetCommand_initOptions, _PurviewRetentionEventtypeGetCommand_initValidators;
16
+ var _PurviewRetentionEventTypeGetCommand_instances, _PurviewRetentionEventTypeGetCommand_initOptions, _PurviewRetentionEventTypeGetCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const GraphCommand_1 = require("../../../base/GraphCommand");
19
19
  const commands_1 = require("../../commands");
20
20
  const request_1 = require("../../../../request");
21
21
  const validation_1 = require("../../../../utils/validation");
22
- class PurviewRetentionEventtypeGetCommand extends GraphCommand_1.default {
22
+ class PurviewRetentionEventTypeGetCommand extends GraphCommand_1.default {
23
23
  get name() {
24
24
  return commands_1.default.RETENTIONEVENTTYPE_GET;
25
25
  }
@@ -28,9 +28,9 @@ class PurviewRetentionEventtypeGetCommand extends GraphCommand_1.default {
28
28
  }
29
29
  constructor() {
30
30
  super();
31
- _PurviewRetentionEventtypeGetCommand_instances.add(this);
32
- __classPrivateFieldGet(this, _PurviewRetentionEventtypeGetCommand_instances, "m", _PurviewRetentionEventtypeGetCommand_initOptions).call(this);
33
- __classPrivateFieldGet(this, _PurviewRetentionEventtypeGetCommand_instances, "m", _PurviewRetentionEventtypeGetCommand_initValidators).call(this);
31
+ _PurviewRetentionEventTypeGetCommand_instances.add(this);
32
+ __classPrivateFieldGet(this, _PurviewRetentionEventTypeGetCommand_instances, "m", _PurviewRetentionEventTypeGetCommand_initOptions).call(this);
33
+ __classPrivateFieldGet(this, _PurviewRetentionEventTypeGetCommand_instances, "m", _PurviewRetentionEventTypeGetCommand_initValidators).call(this);
34
34
  }
35
35
  commandAction(logger, args) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
@@ -54,11 +54,11 @@ class PurviewRetentionEventtypeGetCommand extends GraphCommand_1.default {
54
54
  });
55
55
  }
56
56
  }
57
- _PurviewRetentionEventtypeGetCommand_instances = new WeakSet(), _PurviewRetentionEventtypeGetCommand_initOptions = function _PurviewRetentionEventtypeGetCommand_initOptions() {
57
+ _PurviewRetentionEventTypeGetCommand_instances = new WeakSet(), _PurviewRetentionEventTypeGetCommand_initOptions = function _PurviewRetentionEventTypeGetCommand_initOptions() {
58
58
  this.options.unshift({
59
59
  option: '-i, --id <id>'
60
60
  });
61
- }, _PurviewRetentionEventtypeGetCommand_initValidators = function _PurviewRetentionEventtypeGetCommand_initValidators() {
61
+ }, _PurviewRetentionEventTypeGetCommand_initValidators = function _PurviewRetentionEventTypeGetCommand_initValidators() {
62
62
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
63
63
  if (!validation_1.validation.isValidGuid(args.options.id)) {
64
64
  return `'${args.options.id}' is not a valid GUID.`;
@@ -66,5 +66,5 @@ _PurviewRetentionEventtypeGetCommand_instances = new WeakSet(), _PurviewRetentio
66
66
  return true;
67
67
  }));
68
68
  };
69
- module.exports = new PurviewRetentionEventtypeGetCommand();
69
+ module.exports = new PurviewRetentionEventTypeGetCommand();
70
70
  //# sourceMappingURL=retentioneventtype-get.js.map
@@ -0,0 +1,44 @@
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 accessToken_1 = require("../../../../utils/accessToken");
13
+ const odata_1 = require("../../../../utils/odata");
14
+ const GraphCommand_1 = require("../../../base/GraphCommand");
15
+ const commands_1 = require("../../commands");
16
+ const Auth_1 = require("../../../../Auth");
17
+ class PurviewRetentionEventTypeListCommand extends GraphCommand_1.default {
18
+ get name() {
19
+ return commands_1.default.RETENTIONEVENTTYPE_LIST;
20
+ }
21
+ get description() {
22
+ return 'Get a list of retention event types';
23
+ }
24
+ defaultProperties() {
25
+ return ['id', 'displayName', 'createdDateTime'];
26
+ }
27
+ commandAction(logger) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ try {
30
+ const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
31
+ if (isAppOnlyAccessToken) {
32
+ throw 'This command currently does not support app only permissions.';
33
+ }
34
+ const items = yield odata_1.odata.getAllItems(`${this.resource}/beta/security/triggerTypes/retentionEventTypes`);
35
+ logger.log(items);
36
+ }
37
+ catch (err) {
38
+ this.handleRejectedODataJsonPromise(err);
39
+ }
40
+ });
41
+ }
42
+ }
43
+ module.exports = new PurviewRetentionEventTypeListCommand();
44
+ //# sourceMappingURL=retentioneventtype-list.js.map
@@ -0,0 +1,97 @@
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 _PurviewRetentionEventTypeRemoveCommand_instances, _PurviewRetentionEventTypeRemoveCommand_initTelemetry, _PurviewRetentionEventTypeRemoveCommand_initOptions, _PurviewRetentionEventTypeRemoveCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Auth_1 = require("../../../../Auth");
19
+ const Cli_1 = require("../../../../cli/Cli");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const request_1 = require("../../../../request");
22
+ const GraphCommand_1 = require("../../../base/GraphCommand");
23
+ const commands_1 = require("../../commands");
24
+ const accessToken_1 = require("../../../../utils/accessToken");
25
+ class PurviewRetentionEventTypeRemoveCommand extends GraphCommand_1.default {
26
+ get name() {
27
+ return commands_1.default.RETENTIONEVENTTYPE_REMOVE;
28
+ }
29
+ get description() {
30
+ return 'Delete a retention event type';
31
+ }
32
+ constructor() {
33
+ super();
34
+ _PurviewRetentionEventTypeRemoveCommand_instances.add(this);
35
+ __classPrivateFieldGet(this, _PurviewRetentionEventTypeRemoveCommand_instances, "m", _PurviewRetentionEventTypeRemoveCommand_initTelemetry).call(this);
36
+ __classPrivateFieldGet(this, _PurviewRetentionEventTypeRemoveCommand_instances, "m", _PurviewRetentionEventTypeRemoveCommand_initOptions).call(this);
37
+ __classPrivateFieldGet(this, _PurviewRetentionEventTypeRemoveCommand_instances, "m", _PurviewRetentionEventTypeRemoveCommand_initValidators).call(this);
38
+ }
39
+ commandAction(logger, args) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
42
+ this.handleError('This command does not support application permissions.');
43
+ }
44
+ const removeRetentionEventType = () => __awaiter(this, void 0, void 0, function* () {
45
+ try {
46
+ const requestOptions = {
47
+ url: `${this.resource}/beta/security/triggerTypes/retentionEventTypes/${args.options.id}`,
48
+ headers: {
49
+ accept: 'application/json;odata.metadata=none'
50
+ },
51
+ responseType: 'json'
52
+ };
53
+ yield request_1.default.delete(requestOptions);
54
+ }
55
+ catch (err) {
56
+ this.handleRejectedODataJsonPromise(err);
57
+ }
58
+ });
59
+ if (args.options.confirm) {
60
+ yield removeRetentionEventType();
61
+ }
62
+ else {
63
+ const result = yield Cli_1.Cli.prompt({
64
+ type: 'confirm',
65
+ name: 'continue',
66
+ default: false,
67
+ message: `Are you sure you want to remove the retention event type with id ${args.options.id}?`
68
+ });
69
+ if (result.continue) {
70
+ yield removeRetentionEventType();
71
+ }
72
+ }
73
+ });
74
+ }
75
+ }
76
+ _PurviewRetentionEventTypeRemoveCommand_instances = new WeakSet(), _PurviewRetentionEventTypeRemoveCommand_initTelemetry = function _PurviewRetentionEventTypeRemoveCommand_initTelemetry() {
77
+ this.telemetry.push((args) => {
78
+ Object.assign(this.telemetryProperties, {
79
+ confirm: !!args.options.confirm
80
+ });
81
+ });
82
+ }, _PurviewRetentionEventTypeRemoveCommand_initOptions = function _PurviewRetentionEventTypeRemoveCommand_initOptions() {
83
+ this.options.unshift({
84
+ option: '-i, --id <id>'
85
+ }, {
86
+ option: '--confirm'
87
+ });
88
+ }, _PurviewRetentionEventTypeRemoveCommand_initValidators = function _PurviewRetentionEventTypeRemoveCommand_initValidators() {
89
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
90
+ if (!validation_1.validation.isValidGuid(args.options.id)) {
91
+ return `'${args.options.id}' is not a valid GUID.`;
92
+ }
93
+ return true;
94
+ }));
95
+ };
96
+ module.exports = new PurviewRetentionEventTypeRemoveCommand();
97
+ //# sourceMappingURL=retentioneventtype-remove.js.map