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

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.
package/.eslintrc.js CHANGED
@@ -7,9 +7,11 @@ const dictionary = [
7
7
  'adaptive',
8
8
  'ai',
9
9
  'app',
10
+ 'application',
10
11
  'apply',
11
12
  'approve',
12
13
  'assets',
14
+ 'audit',
13
15
  'bin',
14
16
  'builder',
15
17
  'catalog',
@@ -19,6 +21,7 @@ const dictionary = [
19
21
  'content',
20
22
  'conversation',
21
23
  'custom',
24
+ 'customizer',
22
25
  'dataverse',
23
26
  'default',
24
27
  'external',
@@ -43,6 +46,9 @@ const dictionary = [
43
46
  'label',
44
47
  'list',
45
48
  'link',
49
+ 'log',
50
+ 'login',
51
+ 'logout',
46
52
  'management',
47
53
  'member',
48
54
  'messaging',
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Command_1 = require("../../Command");
4
+ class O365MgmtCommand extends Command_1.default {
5
+ get resource() {
6
+ return 'https://manage.office.com';
7
+ }
8
+ }
9
+ exports.default = O365MgmtCommand;
10
+ //# sourceMappingURL=O365MgmtCommand.js.map
@@ -48,8 +48,11 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
48
48
  logger.log(result);
49
49
  }
50
50
  else {
51
- const groupId = yield this.getGroupId(args);
52
- const plan = yield planner_1.planner.getPlanByTitle(args.options.title, groupId);
51
+ let groupId = undefined;
52
+ if (args.options.ownerGroupId || args.options.ownerGroupName) {
53
+ groupId = yield this.getGroupId(args);
54
+ }
55
+ const plan = yield planner_1.planner.getPlanByTitle(args.options.title, groupId, args.options.rosterId);
53
56
  const result = yield this.getPlanDetails(plan);
54
57
  if (result) {
55
58
  logger.log(result);
@@ -62,27 +65,27 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
62
65
  });
63
66
  }
64
67
  getPlanDetails(plan) {
65
- const requestOptionsTaskDetails = {
66
- url: `${this.resource}/v1.0/planner/plans/${plan.id}/details`,
67
- headers: {
68
- 'accept': 'application/json;odata.metadata=none',
69
- 'Prefer': 'return=representation'
70
- },
71
- responseType: 'json'
72
- };
73
- return request_1.default
74
- .get(requestOptionsTaskDetails)
75
- .then(planDetails => {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const requestOptionsTaskDetails = {
70
+ url: `${this.resource}/v1.0/planner/plans/${plan.id}/details`,
71
+ headers: {
72
+ 'accept': 'application/json;odata.metadata=none',
73
+ 'Prefer': 'return=representation'
74
+ },
75
+ responseType: 'json'
76
+ };
77
+ const planDetails = yield request_1.default.get(requestOptionsTaskDetails);
76
78
  return Object.assign(Object.assign({}, plan), planDetails);
77
79
  });
78
80
  }
79
81
  getGroupId(args) {
80
- if (args.options.ownerGroupId) {
81
- return Promise.resolve(args.options.ownerGroupId);
82
- }
83
- return aadGroup_1.aadGroup
84
- .getGroupByDisplayName(args.options.ownerGroupName)
85
- .then(group => group.id);
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ if (args.options.ownerGroupId) {
84
+ return args.options.ownerGroupId;
85
+ }
86
+ const group = yield aadGroup_1.aadGroup.getGroupByDisplayName(args.options.ownerGroupName);
87
+ return group.id;
88
+ });
86
89
  }
87
90
  }
88
91
  _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTelemetry = function _PlannerPlanGetCommand_initTelemetry() {
@@ -91,7 +94,8 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
91
94
  id: typeof args.options.id !== 'undefined',
92
95
  title: typeof args.options.title !== 'undefined',
93
96
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
94
- ownerGroupName: typeof args.options.ownerGroupName !== 'undefined'
97
+ ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
98
+ rosterId: typeof args.options.rosterId !== 'undefined'
95
99
  });
96
100
  });
97
101
  }, _PlannerPlanGetCommand_initOptions = function _PlannerPlanGetCommand_initOptions() {
@@ -103,22 +107,25 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
103
107
  option: '--ownerGroupId [ownerGroupId]'
104
108
  }, {
105
109
  option: '--ownerGroupName [ownerGroupName]'
110
+ }, {
111
+ option: '--rosterId [rosterId]'
106
112
  });
107
113
  }, _PlannerPlanGetCommand_initValidators = function _PlannerPlanGetCommand_initValidators() {
108
114
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
109
- if (args.options.title && !args.options.ownerGroupId && !args.options.ownerGroupName) {
110
- return 'Specify either ownerGroupId or ownerGroupName';
111
- }
112
- if (args.options.title && args.options.ownerGroupId && args.options.ownerGroupName) {
113
- return 'Specify either ownerGroupId or ownerGroupName but not both';
114
- }
115
115
  if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
116
116
  return `${args.options.ownerGroupId} is not a valid GUID`;
117
117
  }
118
118
  return true;
119
119
  }));
120
120
  }, _PlannerPlanGetCommand_initOptionSets = function _PlannerPlanGetCommand_initOptionSets() {
121
- this.optionSets.push({ options: ['id', 'title'] });
121
+ this.optionSets.push({
122
+ options: ['id', 'title']
123
+ }, {
124
+ options: ['ownerGroupId', 'ownerGroupName', 'rosterId'],
125
+ runsWhen: (args) => {
126
+ return args.options.title !== undefined;
127
+ }
128
+ });
122
129
  };
123
130
  module.exports = new PlannerPlanGetCommand();
124
131
  //# sourceMappingURL=plan-get.js.map
@@ -16,16 +16,16 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
16
16
  var _PlannerPlanListCommand_instances, _PlannerPlanListCommand_initTelemetry, _PlannerPlanListCommand_initOptions, _PlannerPlanListCommand_initValidators, _PlannerPlanListCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const validation_1 = require("../../../../utils/validation");
19
- const aadGroup_1 = require("../../../../utils/aadGroup");
20
19
  const planner_1 = require("../../../../utils/planner");
21
20
  const GraphCommand_1 = require("../../../base/GraphCommand");
22
21
  const commands_1 = require("../../commands");
22
+ const aadGroup_1 = require("../../../../utils/aadGroup");
23
23
  class PlannerPlanListCommand extends GraphCommand_1.default {
24
24
  get name() {
25
25
  return commands_1.default.PLAN_LIST;
26
26
  }
27
27
  get description() {
28
- return 'Returns a list of plans associated with a specified group';
28
+ return 'Returns a list of plans associated with a specified group or roster';
29
29
  }
30
30
  constructor() {
31
31
  super();
@@ -41,10 +41,16 @@ class PlannerPlanListCommand extends GraphCommand_1.default {
41
41
  commandAction(logger, args) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
43
  try {
44
- const groupId = yield this.getGroupId(args);
45
- const result = yield planner_1.planner.getPlansByGroupId(groupId);
46
- if (result && result.length > 0) {
47
- logger.log(result);
44
+ let plannerPlans = null;
45
+ if (args.options.ownerGroupId || args.options.ownerGroupName) {
46
+ const groupId = yield this.getGroupId(args);
47
+ plannerPlans = yield planner_1.planner.getPlansByGroupId(groupId);
48
+ }
49
+ else {
50
+ plannerPlans = yield planner_1.planner.getPlansByRosterId(args.options.rosterId);
51
+ }
52
+ if (plannerPlans && plannerPlans.length > 0) {
53
+ logger.log(plannerPlans);
48
54
  }
49
55
  }
50
56
  catch (err) {
@@ -53,19 +59,21 @@ class PlannerPlanListCommand extends GraphCommand_1.default {
53
59
  });
54
60
  }
55
61
  getGroupId(args) {
56
- if (args.options.ownerGroupId) {
57
- return Promise.resolve(args.options.ownerGroupId);
58
- }
59
- return aadGroup_1.aadGroup
60
- .getGroupByDisplayName(args.options.ownerGroupName)
61
- .then(group => group.id);
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ if (args.options.ownerGroupId) {
64
+ return args.options.ownerGroupId;
65
+ }
66
+ const group = yield aadGroup_1.aadGroup.getGroupByDisplayName(args.options.ownerGroupName);
67
+ return group.id;
68
+ });
62
69
  }
63
70
  }
64
71
  _PlannerPlanListCommand_instances = new WeakSet(), _PlannerPlanListCommand_initTelemetry = function _PlannerPlanListCommand_initTelemetry() {
65
72
  this.telemetry.push((args) => {
66
73
  Object.assign(this.telemetryProperties, {
67
74
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
68
- ownerGroupName: typeof args.options.ownerGroupName !== 'undefined'
75
+ ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
76
+ rosterId: typeof args.options.rosterId !== 'undefined'
69
77
  });
70
78
  });
71
79
  }, _PlannerPlanListCommand_initOptions = function _PlannerPlanListCommand_initOptions() {
@@ -73,6 +81,8 @@ _PlannerPlanListCommand_instances = new WeakSet(), _PlannerPlanListCommand_initT
73
81
  option: "--ownerGroupId [ownerGroupId]"
74
82
  }, {
75
83
  option: "--ownerGroupName [ownerGroupName]"
84
+ }, {
85
+ option: "--rosterId [rosterId]"
76
86
  });
77
87
  }, _PlannerPlanListCommand_initValidators = function _PlannerPlanListCommand_initValidators() {
78
88
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -82,7 +92,7 @@ _PlannerPlanListCommand_instances = new WeakSet(), _PlannerPlanListCommand_initT
82
92
  return true;
83
93
  }));
84
94
  }, _PlannerPlanListCommand_initOptionSets = function _PlannerPlanListCommand_initOptionSets() {
85
- this.optionSets.push({ options: ['ownerGroupId', 'ownerGroupName'] });
95
+ this.optionSets.push({ options: ['ownerGroupId', 'ownerGroupName', 'rosterId'] });
86
96
  };
87
97
  module.exports = new PlannerPlanListCommand();
88
98
  //# sourceMappingURL=plan-list.js.map
@@ -0,0 +1,205 @@
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 _PurviewAuditLogListCommand_instances, _PurviewAuditLogListCommand_initTelemetry, _PurviewAuditLogListCommand_initOptions, _PurviewAuditLogListCommand_initValidators;
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 validation_1 = require("../../../../utils/validation");
22
+ const O365MgmtCommand_1 = require("../../../base/O365MgmtCommand");
23
+ const commands_1 = require("../../commands");
24
+ class PurviewAuditLogListCommand extends O365MgmtCommand_1.default {
25
+ get name() {
26
+ return commands_1.default.AUDITLOG_LIST;
27
+ }
28
+ get description() {
29
+ return 'List audit logs within your tenant';
30
+ }
31
+ defaultProperties() {
32
+ return ['CreationTime', 'UserId', 'Operation', 'ObjectId'];
33
+ }
34
+ constructor() {
35
+ super();
36
+ _PurviewAuditLogListCommand_instances.add(this);
37
+ this.contentTypeOptions = ['AzureActiveDirectory', 'Exchange', 'SharePoint', 'General', 'DLP'];
38
+ __classPrivateFieldGet(this, _PurviewAuditLogListCommand_instances, "m", _PurviewAuditLogListCommand_initTelemetry).call(this);
39
+ __classPrivateFieldGet(this, _PurviewAuditLogListCommand_instances, "m", _PurviewAuditLogListCommand_initOptions).call(this);
40
+ __classPrivateFieldGet(this, _PurviewAuditLogListCommand_instances, "m", _PurviewAuditLogListCommand_initValidators).call(this);
41
+ }
42
+ commandAction(logger, args) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ // If we don't create a now object, start and end date can be an few extra ms apart due to execution time between code lines
45
+ const now = new Date();
46
+ try {
47
+ let startTime;
48
+ if (args.options.startTime) {
49
+ startTime = new Date(args.options.startTime);
50
+ }
51
+ else {
52
+ startTime = new Date(now);
53
+ startTime.setDate(startTime.getDate() - 1);
54
+ }
55
+ const endTime = args.options.endTime ? new Date(args.options.endTime) : new Date(now);
56
+ if (this.verbose) {
57
+ logger.logToStderr(`Getting audit logs for content type '${args.options.contentType}' within a time frame from '${startTime.toISOString()}' to '${endTime.toISOString()}'.`);
58
+ }
59
+ const tenantId = accessToken_1.accessToken.getTenantIdFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken);
60
+ const contentTypeValue = args.options.contentType === 'DLP' ? 'DLP.All' : 'Audit.' + args.options.contentType;
61
+ yield this.ensureSubscription(tenantId, contentTypeValue);
62
+ if (this.verbose) {
63
+ logger.logToStderr(`'${args.options.contentType}' subscription is active.`);
64
+ }
65
+ const contentUris = [];
66
+ for (const time = startTime; time < endTime; time.setDate(time.getDate() + 1)) {
67
+ const differenceInMs = endTime.getTime() - time.getTime();
68
+ const endTimeBatch = new Date(time.getTime() + Math.min(differenceInMs, 1000 * 60 * 60 * 24)); // ms difference cannot be greater than 1 day
69
+ if (this.verbose) {
70
+ logger.logToStderr(`Get content URIs for date range from '${time.toISOString()}' to '${endTimeBatch.toISOString()}'.`);
71
+ }
72
+ const contentUrisBatch = yield this.getContentUris(tenantId, contentTypeValue, time, endTimeBatch);
73
+ contentUris.push(...contentUrisBatch);
74
+ }
75
+ if (this.verbose) {
76
+ logger.logToStderr(`Get content from ${contentUris.length} content URIs.`);
77
+ }
78
+ const logs = yield this.getContent(logger, contentUris);
79
+ const sortedLogs = logs.sort(this.auditLogsCompare);
80
+ logger.log(sortedLogs);
81
+ }
82
+ catch (err) {
83
+ this.handleRejectedODataJsonPromise(err);
84
+ }
85
+ });
86
+ }
87
+ ensureSubscription(tenantId, contentType) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ const requestOptions = {
90
+ url: `${this.resource}/api/v1.0/${tenantId}/activity/feed/subscriptions/list`,
91
+ headers: {
92
+ accept: 'application/json'
93
+ },
94
+ responseType: 'json'
95
+ };
96
+ const subscriptions = yield request_1.default.get(requestOptions);
97
+ if (subscriptions.some(s => s.contentType === contentType && s.status === 'enabled')) {
98
+ return;
99
+ }
100
+ requestOptions.url = `${this.resource}/api/v1.0/${tenantId}/activity/feed/subscriptions/start?contentType=${contentType}`;
101
+ const subscription = yield request_1.default.post(requestOptions);
102
+ if (subscription.status !== 'enabled') {
103
+ throw `Unable to start subscription '${contentType}'`;
104
+ }
105
+ });
106
+ }
107
+ getContentUris(tenantId, contentType, startTime, endTime) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const contentUris = [];
110
+ const requestOptions = {
111
+ url: `${this.resource}/api/v1.0/${tenantId}/activity/feed/subscriptions/content?contentType=${contentType}&startTime=${startTime.toISOString()}&endTime=${endTime.toISOString()}`,
112
+ headers: {
113
+ accept: 'application/json'
114
+ },
115
+ responseType: 'json',
116
+ fullResponse: true
117
+ };
118
+ do {
119
+ const response = yield request_1.default.get(requestOptions);
120
+ const uris = response.data.map(d => d.contentUri);
121
+ contentUris.push(...uris);
122
+ requestOptions.url = response.headers.nextpageuri;
123
+ } while (requestOptions.url);
124
+ return contentUris;
125
+ });
126
+ }
127
+ getContent(logger, contentUris) {
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ const logs = [];
130
+ const batchSize = 30;
131
+ for (let i = 0; i < contentUris.length; i += batchSize) {
132
+ const contentUrisBatch = contentUris.slice(i, i + batchSize);
133
+ if (this.verbose) {
134
+ logger.logToStderr(`Retrieving content from next ${contentUrisBatch.length} content URIs. Progress: ${Math.round(i / contentUris.length * 100)}%`);
135
+ }
136
+ const batchResult = yield Promise.all(contentUrisBatch.map(uri => request_1.default.get({
137
+ url: uri,
138
+ headers: {
139
+ accept: 'application/json'
140
+ },
141
+ responseType: 'json'
142
+ })));
143
+ batchResult.forEach(res => logs.push(...res));
144
+ }
145
+ return logs;
146
+ });
147
+ }
148
+ auditLogsCompare(a, b) {
149
+ if (a.CreationTime < b.CreationTime) {
150
+ return -1;
151
+ }
152
+ if (a.CreationTime > b.CreationTime) {
153
+ return 1;
154
+ }
155
+ return 0;
156
+ }
157
+ }
158
+ _PurviewAuditLogListCommand_instances = new WeakSet(), _PurviewAuditLogListCommand_initTelemetry = function _PurviewAuditLogListCommand_initTelemetry() {
159
+ this.telemetry.push((args) => {
160
+ Object.assign(this.telemetryProperties, {
161
+ startTime: typeof args.options.startTime !== 'undefined',
162
+ endTime: typeof args.options.endTime !== 'undefined'
163
+ });
164
+ });
165
+ }, _PurviewAuditLogListCommand_initOptions = function _PurviewAuditLogListCommand_initOptions() {
166
+ this.options.unshift({
167
+ option: '--contentType <contentType>',
168
+ autocomplete: this.contentTypeOptions
169
+ }, {
170
+ option: '--startTime [startTime]'
171
+ }, {
172
+ option: '--endTime [endTime]'
173
+ });
174
+ }, _PurviewAuditLogListCommand_initValidators = function _PurviewAuditLogListCommand_initValidators() {
175
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
176
+ if (this.contentTypeOptions.indexOf(args.options.contentType) === -1) {
177
+ return `'${args.options.contentType}' is not a valid contentType value. Allowed values: ${this.contentTypeOptions}.`;
178
+ }
179
+ if (args.options.startTime) {
180
+ if (!validation_1.validation.isValidISODateTime(args.options.startTime)) {
181
+ return `'${args.options.startTime}' is not a valid ISO date time string.`;
182
+ }
183
+ const lowerDateLimit = new Date();
184
+ lowerDateLimit.setDate(lowerDateLimit.getDate() - 7);
185
+ lowerDateLimit.setHours(lowerDateLimit.getHours() - 1); // Min date is 7 days ago, however there seems to be an 1h margin
186
+ if (new Date(args.options.startTime) < lowerDateLimit) {
187
+ return 'startTime value cannot be more than 7 days in the past.';
188
+ }
189
+ }
190
+ if (args.options.endTime) {
191
+ if (!validation_1.validation.isValidISODateTime(args.options.endTime)) {
192
+ return `'${args.options.endTime}' is not a valid ISO date time string.`;
193
+ }
194
+ if (new Date(args.options.endTime) > new Date()) {
195
+ return 'endTime value cannot be in the future.';
196
+ }
197
+ }
198
+ if (args.options.startTime && args.options.endTime && new Date(args.options.startTime) >= new Date(args.options.endTime)) {
199
+ return 'startTime value must be before endTime.';
200
+ }
201
+ return true;
202
+ }));
203
+ };
204
+ module.exports = new PurviewAuditLogListCommand();
205
+ //# sourceMappingURL=auditlog-list.js.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'purview';
4
4
  exports.default = {
5
5
  RETENTIONEVENTTYPE_GET: `${prefix} retentioneventtype get`,
6
+ AUDITLOG_LIST: `${prefix} auditlog list`,
6
7
  RETENTIONLABEL_ADD: `${prefix} retentionlabel add`,
7
8
  RETENTIONLABEL_GET: `${prefix} retentionlabel get`,
8
9
  RETENTIONLABEL_LIST: `${prefix} retentionlabel list`,
@@ -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 _SpoApplicationCustomizerAddCommand_instances, _SpoApplicationCustomizerAddCommand_initOptions, _SpoApplicationCustomizerAddCommand_initTelemetry, _SpoApplicationCustomizerAddCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const validation_1 = require("../../../../utils/validation");
20
+ const SpoCommand_1 = require("../../../base/SpoCommand");
21
+ const commands_1 = require("../../commands");
22
+ const spoCustomActionAddCommand = require("../customaction/customaction-add");
23
+ class SpoApplicationCustomizerAddCommand extends SpoCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.APPLICATIONCUSTOMIZER_ADD;
26
+ }
27
+ get description() {
28
+ return 'Add an application customizer to a site.';
29
+ }
30
+ constructor() {
31
+ super();
32
+ _SpoApplicationCustomizerAddCommand_instances.add(this);
33
+ __classPrivateFieldGet(this, _SpoApplicationCustomizerAddCommand_instances, "m", _SpoApplicationCustomizerAddCommand_initTelemetry).call(this);
34
+ __classPrivateFieldGet(this, _SpoApplicationCustomizerAddCommand_instances, "m", _SpoApplicationCustomizerAddCommand_initOptions).call(this);
35
+ __classPrivateFieldGet(this, _SpoApplicationCustomizerAddCommand_instances, "m", _SpoApplicationCustomizerAddCommand_initValidators).call(this);
36
+ }
37
+ commandAction(logger, args) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ if (this.verbose) {
40
+ logger.logToStderr(`Adding application customizer with title '${args.options.title}' and clientSideComponentId '${args.options.clientSideComponentId}' to the site`);
41
+ }
42
+ const options = {
43
+ webUrl: args.options.webUrl,
44
+ name: args.options.title,
45
+ title: args.options.title,
46
+ clientSideComponentId: args.options.clientSideComponentId,
47
+ clientSideComponentProperties: args.options.clientSideComponentProperties || '',
48
+ location: 'ClientSideExtension.ApplicationCustomizer',
49
+ debug: this.debug,
50
+ verbose: this.verbose
51
+ };
52
+ yield Cli_1.Cli.executeCommand(spoCustomActionAddCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
53
+ });
54
+ }
55
+ }
56
+ _SpoApplicationCustomizerAddCommand_instances = new WeakSet(), _SpoApplicationCustomizerAddCommand_initOptions = function _SpoApplicationCustomizerAddCommand_initOptions() {
57
+ this.options.unshift({
58
+ option: '-t, --title <title>'
59
+ }, {
60
+ option: '-u, --webUrl <webUrl>'
61
+ }, {
62
+ option: '-i, --clientSideComponentId <clientSideComponentId>'
63
+ }, {
64
+ option: '--clientSideComponentProperties [clientSideComponentProperties]'
65
+ });
66
+ }, _SpoApplicationCustomizerAddCommand_initTelemetry = function _SpoApplicationCustomizerAddCommand_initTelemetry() {
67
+ this.telemetry.push((args) => {
68
+ Object.assign(this.telemetryProperties, {
69
+ clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined'
70
+ });
71
+ });
72
+ }, _SpoApplicationCustomizerAddCommand_initValidators = function _SpoApplicationCustomizerAddCommand_initValidators() {
73
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
74
+ if (args.options.webUrl) {
75
+ const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
76
+ if (isValidSharePointUrl !== true) {
77
+ return isValidSharePointUrl;
78
+ }
79
+ }
80
+ if (!validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
81
+ return `${args.options.clientSideComponentId} is not a valid GUID`;
82
+ }
83
+ if (args.options.clientSideComponentProperties) {
84
+ try {
85
+ JSON.parse(args.options.clientSideComponentProperties);
86
+ }
87
+ catch (e) {
88
+ return `An error has occurred while parsing clientSideComponentProperties: ${e}`;
89
+ }
90
+ }
91
+ return true;
92
+ }));
93
+ };
94
+ module.exports = new SpoApplicationCustomizerAddCommand();
95
+ //# sourceMappingURL=applicationcustomizer-add.js.map
@@ -13,6 +13,7 @@ exports.default = {
13
13
  APP_TEAMSPACKAGE_DOWNLOAD: `${prefix} app teamspackage download`,
14
14
  APP_UNINSTALL: `${prefix} app uninstall`,
15
15
  APP_UPGRADE: `${prefix} app upgrade`,
16
+ APPLICATIONCUSTOMIZER_ADD: `${prefix} applicationcustomizer add`,
16
17
  APPPAGE_ADD: `${prefix} apppage add`,
17
18
  APPPAGE_SET: `${prefix} apppage set`,
18
19
  CDN_GET: `${prefix} cdn get`,
@@ -44,14 +44,28 @@ exports.planner = {
44
44
  getPlansByGroupId(groupId, metadata = 'none') {
45
45
  return odata_1.odata.getAllItems(`${graphResource}/v1.0/groups/${groupId}/planner/plans`, metadata);
46
46
  },
47
+ /**
48
+ * Get all Planner plans for a specific roster.
49
+ * @param rosterId Roster ID.
50
+ */
51
+ getPlansByRosterId(rosterId, metadata = 'none') {
52
+ return odata_1.odata.getAllItems(`${graphResource}/beta/planner/rosters/${rosterId}/plans`, metadata);
53
+ },
47
54
  /**
48
55
  * Get Planner plan by title in a specific group.
49
56
  * @param title Title of the Planner plan. Case insensitive.
50
- * @param groupId Owner group ID .
57
+ * @param groupId Owner group ID.
58
+ * @param rosterId Roster ID.
51
59
  */
52
- getPlanByTitle(title, groupId, metadata = 'none') {
60
+ getPlanByTitle(title, groupId, rosterId, metadata = 'none') {
53
61
  return __awaiter(this, void 0, void 0, function* () {
54
- const plans = yield this.getPlansByGroupId(groupId, metadata);
62
+ let plans = [];
63
+ if (groupId) {
64
+ plans = yield this.getPlansByGroupId(groupId, metadata);
65
+ }
66
+ else if (rosterId) {
67
+ plans = yield this.getPlansByRosterId(rosterId, metadata);
68
+ }
55
69
  const filteredPlans = plans.filter(p => p.title && p.title.toLowerCase() === title.toLowerCase());
56
70
  if (!filteredPlans.length) {
57
71
  throw Error(`The specified plan '${title}' does not exist.`);
@@ -17,13 +17,21 @@ m365 planner plan get [options]
17
17
  : Title of the plan. Specify either `id` or `title` but not both.
18
18
 
19
19
  `--ownerGroupId [ownerGroupId]`
20
- : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
20
+ : ID of the Group that owns the plan. Specify either `ownerGroupId`, `ownerGroupName` or `rosterId` when using `title`.
21
21
 
22
22
  `--ownerGroupName [ownerGroupName]`
23
- : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
23
+ : Name of the Group that owns the plan. Specify either `ownerGroupId`, `ownerGroupName` or `rosterId` when using `title`.
24
+
25
+ `--rosterId [rosterId]`
26
+ : ID of the Planner Roster. Specify either `ownerGroupId`, `ownerGroupName` or `rosterId` when using `title`.
24
27
 
25
28
  --8<-- "docs/cmd/_global.md"
26
29
 
30
+ ## Remarks
31
+
32
+ !!! attention
33
+ When using `rosterId`, the command is based on an API that is currently in preview and is subject to change once the API reached general availability.
34
+
27
35
  ## Examples
28
36
 
29
37
  Returns the Microsoft Planner plan with id _gndWOTSK60GfPQfiDDj43JgACDCb_
@@ -44,6 +52,12 @@ Returns the Microsoft Planner plan with title _MyPlan_ for Group _My Planner Gro
44
52
  m365 planner plan get --title "MyPlan" --ownerGroupName "My Planner Group"
45
53
  ```
46
54
 
55
+ Returns the Microsoft Planner plan with title _MyPlan_ for Roster _FeMZFDoK8k2oWmuGE-XFHZcAEwtn_
56
+
57
+ ```sh
58
+ m365 planner plan get --title "MyPlan" --rosterId "FeMZFDoK8k2oWmuGE-XFHZcAEwtn"
59
+ ```
60
+
47
61
  ## Response
48
62
 
49
63
  === "JSON"
@@ -11,13 +11,21 @@ m365 planner plan list [options]
11
11
  ## Options
12
12
 
13
13
  `--ownerGroupId [ownerGroupId]`
14
- : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` but not both.
14
+ : ID of the Group that owns the plan. Specify either `ownerGroupId`, `ownerGroupName` or `rosterId`.
15
15
 
16
16
  `--ownerGroupName [ownerGroupName]`
17
- : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` but not both.
17
+ : Name of the Group that owns the plan. Specify either `ownerGroupId`, `ownerGroupName` or `rosterId`.
18
+
19
+ `--rosterId [rosterId]`
20
+ : ID of the Planner Roster. Specify either `ownerGroupId`, `ownerGroupName` or `rosterId`.
18
21
 
19
22
  --8<-- "docs/cmd/_global.md"
20
23
 
24
+ ## Remarks
25
+
26
+ !!! attention
27
+ When using rosterId, the command is based on an API that is currently in preview and is subject to change once the API reached general availability.
28
+
21
29
  ## Examples
22
30
 
23
31
  Returns a list of Microsoft Planner plans for Group _233e43d0-dc6a-482e-9b4e-0de7a7bce9b4_
@@ -32,6 +40,12 @@ Returns a list of Microsoft Planner plans for Group _My Planner Group_
32
40
  m365 planner plan list --ownerGroupName "My Planner Group"
33
41
  ```
34
42
 
43
+ Returns a list of Microsoft Planner plans for Roster _FeMZFDoK8k2oWmuGE-XFHZcAEwtn_
44
+
45
+ ```sh
46
+ m365 planner plan list --rosterId "FeMZFDoK8k2oWmuGE-XFHZcAEwtn"
47
+ ```
48
+
35
49
  ## Response
36
50
 
37
51
  === "JSON"
@@ -0,0 +1,123 @@
1
+ # purview auditlog list
2
+
3
+ List audit logs within your tenant
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 purview auditlog list [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `--contentType <contentType>`
14
+ : Content type of logs to retrieve. Possible values: `AzureActiveDirectory`, `Exchange`, `SharePoint`, `General`, `DLP`.
15
+
16
+ `--startTime [startTime]`
17
+ : Time indicating the **inclusive** start of a time range of content to return. This should be defined as a valid ISO 8601 string (2021-12-16T18:28:48.6964197Z). Start time cannot be more than 7 days in the past. Default value is 24h ago.
18
+
19
+ `--endTime [endTime]`
20
+ : Time indicating the **exclusive** end of a time range of content to return. This should be defined as a valid ISO 8601 string (2021-12-16T18:28:48.6964197Z). Default value is now.
21
+
22
+ --8<-- "docs/cmd/_global.md"
23
+
24
+ ## Remarks
25
+
26
+ !!! important
27
+ Before you can access audit log data, you must enable unified audit logging for your Microsoft 365 tenant. For instructions, check out the page [Turn auditing on or off](https://learn.microsoft.com/en-us/microsoft-365/compliance/audit-log-enable-disable).
28
+
29
+ !!! important
30
+ When running this command for the first time for a certain content type, a subscription for this content type is created. It can take up to 12 hours for the first content blobs to become available for that subscription.
31
+
32
+ !!! tip
33
+ Retrieving audit logs is an intensive process, especially for large or active tenants. In this case it may take some time to retrieve all audit logs. It can be useful to add the `--verbose` option to your command to view the command progress.
34
+
35
+ When you specify a value for `contentType`, consider the following:
36
+
37
+ - `AzureActiveDirectory` includes all Azure AD audit logs.
38
+ - `Exchange` includes all Exchange audit logs.
39
+ - `SharePoint` includes all SharePoint audit logs.
40
+ - `General` includes all other workloads not included in the previous content types.
41
+ - `DLP` DLP events only for all workloads.
42
+
43
+ ## Examples
44
+
45
+ List all SharePoint audit logs for the past 24 hours
46
+
47
+ ```sh
48
+ m365 purview auditlog list --contentType SharePoint
49
+ ```
50
+
51
+ List all SharePoint audit logs within a specific time frame
52
+
53
+ ```sh
54
+ m365 purview auditlog list --contentType SharePoint --startTime "2023-01-01T00:00:00Z" --endTime "2023-01-03T09:00:00Z"
55
+ ```
56
+
57
+ Get all SharePoint audit logs within a specific time frame and save the logs to a file
58
+
59
+ ```sh
60
+ m365 purview auditlog list --contentType SharePoint --startTime "2023-01-01T00:00:00Z" --endTime "2023-01-01T12:00:00Z" > auditLogs.json
61
+ ```
62
+
63
+ ## Response
64
+
65
+ === "JSON"
66
+
67
+ ```json
68
+ [
69
+ {
70
+ "AppAccessContext": {
71
+ "ClientAppId": "94bfad6e-a0b3-4eb9-8e2b-83eeb335de28",
72
+ "CorrelationId": "040d86a0-f096-5000-d4b4-baac627b75f3",
73
+ "UniqueTokenId": "5CVDGmrynkGYBkY-MPynAA"
74
+ },
75
+ "CreationTime": "2023-01-10T00:00:00",
76
+ "Id": "4d671836-c772-4169-55f9-08dae745c839",
77
+ "Operation": "ListItemViewed",
78
+ "OrganizationId": "6e40c2aa-0565-4013-b38c-d5e6f0c42993",
79
+ "RecordType": 36,
80
+ "UserKey": "i:0i.t|00000003-0000-0ff1-ce00-000000000000|app@sharepoint",
81
+ "UserType": 0,
82
+ "Version": 1,
83
+ "Workload": "SharePoint",
84
+ "ClientIP": "168.63.104.32",
85
+ "ObjectId": "https://contoso.sharepoint.com/sites/Project-x/Lists/cae414a1-ac65-4a90-844e-651d7a1e463d/305_.000",
86
+ "UserId": "john.doe@contoso.com",
87
+ "ApplicationId": "94bfad6e-a0b3-4eb9-8e2b-83eeb335de28",
88
+ "CorrelationId": "040d86a0-f096-5000-d4b4-baac627b75f3",
89
+ "EventSource": "SharePoint",
90
+ "ItemType": "ListItem",
91
+ "ListId": "cae414a1-ac65-4a90-844e-651d7a1e463d",
92
+ "ListItemUniqueId": "2d364471-4d27-4186-b139-072c8225ee4a",
93
+ "Site": "51f5a236-b2e5-4a6d-a81d-13d188610155",
94
+ "UserAgent": "NONISV|Contoso|ContosoApp/1.0",
95
+ "WebId": "38ab94aa-a904-4c2b-8467-4be0e457f97b",
96
+ "CustomizedDoclib": false,
97
+ "FromApp": false,
98
+ "ItemCount": 192,
99
+ "ListBaseTemplateType": "100",
100
+ "ListBaseType": "GenericList",
101
+ "ListColor": "",
102
+ "ListIcon": "",
103
+ "Source": "Unknown",
104
+ "TemplateTypeId": "",
105
+ "ListTitle": "cae414a1-ac65-4a90-844e-651d7a1e463d"
106
+ }
107
+ ]
108
+ ```
109
+
110
+ === "Text"
111
+
112
+ ```txt
113
+ CreationTime UserId Operation ObjectId
114
+ ------------------- -------------------- -------------- --------------------------------------------------------------------------------------------------
115
+ 2023-01-10T00:00:00 john.doe@contoso.com ListItemViewed https://contoso.sharepoint.com/sites/Project-x/Lists/cae414a1-ac65-4a90-844e-651d7a1e463d/305_.000
116
+ ```
117
+
118
+ === "CSV"
119
+
120
+ ```csv
121
+ CreationTime,UserId,Operation,ObjectId
122
+ 2023-01-10T00:00:00,john.doe@contoso.com,ListItemViewed,https://contoso.sharepoint.com/sites/Project-x/Lists/cae414a1-ac65-4a90-844e-651d7a1e463d/305_.000
123
+ ```
@@ -0,0 +1,56 @@
1
+ # spo applicationcustomizer add
2
+
3
+ Add an application customizer to a site.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo applicationcustomizer add [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-t, --title <title>`
14
+ : The title of the application customizer.
15
+
16
+ `-u, --webUrl <webUrl>`
17
+ : URL of the site.
18
+
19
+ `-i, --clientSideComponentId <clientSideComponentId>`
20
+ : Client-side component ID of the application customizer (GUID).
21
+
22
+ `--clientSideComponentProperties [clientSideComponentProperties]`
23
+ : JSON string with application customizer properties
24
+
25
+ --8<-- "docs/cmd/_global.md"
26
+
27
+ ## Remarks
28
+
29
+ Running this command from the Windows Command Shell (cmd.exe) or PowerShell for Windows OS XP, 7, 8, 8.1 without bash installed might require additional formatting for command options that have JSON, XML or JavaScript values because the command shell treat quotes differently. For example, this is how an application customizer can be created from the Windows cmd.exe:
30
+
31
+ ```sh
32
+ m365 spo applicationcustomizer add --webUrl https://contoso.sharepoint.com/sites/test --title "YourAppCustomizer" --clientSideComponentId b41916e7-e69d-467f-b37f-ff8ecf8f99f2 --clientSideComponentProperties '{\"testMessage\":\"Test message\"}'
33
+ ```
34
+
35
+ Note, how the clientSideComponentProperties option has escaped double quotes `'{\"testMessage\":\"Test message\"}'` compared to execution from bash `'{"testMessage":"Test message"}'`.
36
+
37
+ !!! warning "Escaping JSON in PowerShell"
38
+ When using the `--clientSideComponentProperties` option it's possible to enter a JSON string. In PowerShell 5 to 7.2 [specific escaping rules](./../../../user-guide/using-cli.md#escaping-double-quotes-in-powershell) apply due to an issue. Remember that you can also use [file tokens](./../../../user-guide/using-cli.md#passing-complex-content-into-cli-options) instead.
39
+
40
+ ## Examples
41
+
42
+ Adds an application customizer to the sales site.
43
+
44
+ ```sh
45
+ m365 spo applicationcustomizer add --title 'Some customizer' --clientSideComponentId 799883f5-7962-4384-a10a-105adaec6ffc --webUrl https://contoso.sharepoint.com/sites/sales
46
+ ```
47
+
48
+ Adds an application customizer to the sales site with some properties.
49
+
50
+ ```sh
51
+ m365 spo applicationcustomizer add --title 'Some customizer' --clientSideComponentId 799883f5-7962-4384-a10a-105adaec6ffc --clientSideComponentProperties '{ "someProperty": "Some value" }' --webUrl https://contoso.sharepoint.com/sites/sales
52
+ ```
53
+
54
+ ## Response
55
+
56
+ The command won't return a response on success.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "6.3.0-beta.a991329",
3
+ "version": "6.3.0-beta.ac7b232",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",