@pnp/cli-microsoft365 6.3.0-beta.c3dc921 → 6.3.0-beta.e46ffee
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/dist/Auth.js +0 -18
- package/dist/m365/file/commands/convert/convert-pdf.js +7 -6
- package/dist/m365/flow/commands/run/run-list.js +55 -3
- package/dist/m365/onenote/commands/notebook/notebook-list.js +2 -16
- package/dist/m365/onenote/commands/page/page-list.js +2 -16
- package/dist/m365/outlook/commands/mail/mail-send.js +3 -2
- package/dist/m365/outlook/commands/message/message-get.js +4 -3
- package/dist/m365/planner/commands/plan/plan-add.js +20 -6
- package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
- package/dist/m365/planner/commands/roster/roster-add.js +47 -0
- package/dist/m365/planner/commands/roster/roster-remove.js +88 -0
- package/dist/m365/planner/commands.js +2 -0
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +70 -0
- package/dist/m365/purview/commands.js +1 -0
- package/dist/m365/spfx/commands/project/WebApiPermissionRequests.js +3 -0
- package/dist/m365/spfx/commands/project/project-permissions-grant.js +81 -0
- package/dist/m365/spfx/commands.js +3 -2
- package/dist/m365/spo/commands/navigation/navigation-node-add.js +17 -3
- package/dist/m365/spo/commands/navigation/navigation-node-list.js +4 -7
- package/dist/m365/spo/commands/navigation/navigation-node-set.js +118 -0
- package/dist/m365/spo/commands/site/site-apppermission-add.js +2 -14
- package/dist/m365/spo/commands/site/site-apppermission-get.js +2 -14
- package/dist/m365/spo/commands/site/site-apppermission-list.js +2 -14
- package/dist/m365/spo/commands/site/site-apppermission-remove.js +2 -14
- package/dist/m365/spo/commands/site/site-apppermission-set.js +2 -14
- package/dist/m365/spo/commands/web/web-set.js +11 -4
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/teams/commands/chat/chat-list.js +4 -4
- package/dist/m365/teams/commands/meeting/meeting-attendancereport-list.js +5 -5
- package/dist/m365/teams/commands/meeting/meeting-get.js +5 -5
- package/dist/m365/teams/commands/meeting/meeting-list.js +4 -3
- package/dist/utils/accessToken.js +1 -1
- package/dist/utils/planner.js +4 -4
- package/dist/utils/spo.js +27 -0
- package/docs/docs/cmd/aad/app/app-list.md +3 -0
- package/docs/docs/cmd/aad/user/user-set.md +1 -1
- package/docs/docs/cmd/flow/run/run-list.md +21 -0
- package/docs/docs/cmd/planner/plan/plan-add.md +17 -6
- package/docs/docs/cmd/planner/plan/plan-remove.md +4 -0
- package/docs/docs/cmd/planner/roster/roster-add.md +60 -0
- package/docs/docs/cmd/planner/roster/roster-remove.md +48 -0
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.md +100 -0
- package/docs/docs/cmd/spfx/project/project-permissions-grant.md +65 -0
- package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +2 -2
- package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +2 -2
- package/docs/docs/cmd/spo/navigation/navigation-node-add.md +18 -3
- package/docs/docs/cmd/spo/navigation/navigation-node-list.md +30 -0
- package/docs/docs/cmd/spo/navigation/navigation-node-remove.md +1 -1
- package/docs/docs/cmd/spo/navigation/navigation-node-set.md +59 -0
- package/docs/docs/cmd/spo/web/web-set.md +9 -0
- package/package.json +1 -1
package/dist/Auth.js
CHANGED
|
@@ -573,24 +573,6 @@ class Auth {
|
|
|
573
573
|
getMsalCacheStorage() {
|
|
574
574
|
return new FileTokenStorage_1.FileTokenStorage(FileTokenStorage_1.FileTokenStorage.msalCacheFilePath());
|
|
575
575
|
}
|
|
576
|
-
static isAppOnlyAuth(accessToken) {
|
|
577
|
-
let isAppOnlyAuth;
|
|
578
|
-
if (!accessToken || accessToken.length === 0) {
|
|
579
|
-
return isAppOnlyAuth;
|
|
580
|
-
}
|
|
581
|
-
const chunks = accessToken.split('.');
|
|
582
|
-
if (chunks.length !== 3) {
|
|
583
|
-
return isAppOnlyAuth;
|
|
584
|
-
}
|
|
585
|
-
const tokenString = Buffer.from(chunks[1], 'base64').toString();
|
|
586
|
-
try {
|
|
587
|
-
const token = JSON.parse(tokenString);
|
|
588
|
-
isAppOnlyAuth = !token.upn;
|
|
589
|
-
}
|
|
590
|
-
catch (_a) {
|
|
591
|
-
}
|
|
592
|
-
return isAppOnlyAuth;
|
|
593
|
-
}
|
|
594
576
|
}
|
|
595
577
|
exports.Auth = Auth;
|
|
596
578
|
exports.default = new Auth();
|
|
@@ -23,6 +23,7 @@ const uuid_1 = require("uuid");
|
|
|
23
23
|
const Auth_1 = require("../../../../Auth");
|
|
24
24
|
const Command_1 = require("../../../../Command");
|
|
25
25
|
const request_1 = require("../../../../request");
|
|
26
|
+
const accessToken_1 = require("../../../../utils/accessToken");
|
|
26
27
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
27
28
|
const commands_1 = require("../../commands");
|
|
28
29
|
class FileConvertPdfCommand extends GraphCommand_1.default {
|
|
@@ -46,8 +47,8 @@ class FileConvertPdfCommand extends GraphCommand_1.default {
|
|
|
46
47
|
let sourceIsLocalFile = true;
|
|
47
48
|
let targetIsLocalFile = true;
|
|
48
49
|
let error;
|
|
49
|
-
const
|
|
50
|
-
if (typeof
|
|
50
|
+
const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken);
|
|
51
|
+
if (typeof isAppOnlyAccessToken === 'undefined') {
|
|
51
52
|
throw 'Unable to determine authentication type';
|
|
52
53
|
}
|
|
53
54
|
if (args.options.sourceFile.toLowerCase().startsWith('https://')) {
|
|
@@ -62,7 +63,7 @@ class FileConvertPdfCommand extends GraphCommand_1.default {
|
|
|
62
63
|
}
|
|
63
64
|
try {
|
|
64
65
|
try {
|
|
65
|
-
sourceFileUrl = yield this.getSourceFileUrl(logger, args,
|
|
66
|
+
sourceFileUrl = yield this.getSourceFileUrl(logger, args, isAppOnlyAccessToken);
|
|
66
67
|
const graphFileUrl = yield this.getGraphFileUrl(logger, sourceFileUrl, this.sourceFileGraphUrl);
|
|
67
68
|
const fileResponse = yield this.convertFile(logger, graphFileUrl);
|
|
68
69
|
yield this.writeFileToDisk(logger, fileResponse, localTargetFilePath);
|
|
@@ -114,17 +115,17 @@ class FileConvertPdfCommand extends GraphCommand_1.default {
|
|
|
114
115
|
* file to the user's OneDrive for Business
|
|
115
116
|
* @param logger Logger instance
|
|
116
117
|
* @param args Command args
|
|
117
|
-
* @param
|
|
118
|
+
* @param isAppOnlyAccessToken True if CLI is authenticated in app-only mode
|
|
118
119
|
* @returns Web URL of the file to upload
|
|
119
120
|
*/
|
|
120
|
-
getSourceFileUrl(logger, args,
|
|
121
|
+
getSourceFileUrl(logger, args, isAppOnlyAccessToken) {
|
|
121
122
|
if (args.options.sourceFile.toLowerCase().startsWith('https://')) {
|
|
122
123
|
return Promise.resolve(args.options.sourceFile);
|
|
123
124
|
}
|
|
124
125
|
if (this.verbose) {
|
|
125
126
|
logger.logToStderr('Uploading local file temporarily for conversion...');
|
|
126
127
|
}
|
|
127
|
-
const driveUrl = `${this.resource}/v1.0/${
|
|
128
|
+
const driveUrl = `${this.resource}/v1.0/${isAppOnlyAccessToken ? 'drive/root' : 'me/drive/root'}`;
|
|
128
129
|
// we need the original file extension because otherwise Graph won't be able
|
|
129
130
|
// to convert the file to PDF
|
|
130
131
|
this.sourceFileGraphUrl = `${driveUrl}:/${(0, uuid_1.v4)()}${path.extname(args.options.sourceFile)}`;
|
|
@@ -13,9 +13,10 @@ 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 _FlowRunListCommand_instances, _FlowRunListCommand_initOptions;
|
|
16
|
+
var _FlowRunListCommand_instances, _FlowRunListCommand_initTelemetry, _FlowRunListCommand_initOptions, _FlowRunListCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const formatting_1 = require("../../../../utils/formatting");
|
|
19
|
+
const validation_1 = require("../../../../utils/validation");
|
|
19
20
|
const AzmgmtItemsListCommand_1 = require("../../../base/AzmgmtItemsListCommand");
|
|
20
21
|
const commands_1 = require("../../commands");
|
|
21
22
|
class FlowRunListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand {
|
|
@@ -31,14 +32,21 @@ class FlowRunListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand
|
|
|
31
32
|
constructor() {
|
|
32
33
|
super();
|
|
33
34
|
_FlowRunListCommand_instances.add(this);
|
|
35
|
+
this.allowedStatusses = ['Succeeded', 'Running', 'Failed', 'Cancelled'];
|
|
36
|
+
__classPrivateFieldGet(this, _FlowRunListCommand_instances, "m", _FlowRunListCommand_initTelemetry).call(this);
|
|
34
37
|
__classPrivateFieldGet(this, _FlowRunListCommand_instances, "m", _FlowRunListCommand_initOptions).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _FlowRunListCommand_instances, "m", _FlowRunListCommand_initValidators).call(this);
|
|
35
39
|
}
|
|
36
40
|
commandAction(logger, args) {
|
|
37
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
42
|
if (this.verbose) {
|
|
39
43
|
logger.logToStderr(`Retrieving list of runs for Microsoft Flow ${args.options.flowName}...`);
|
|
40
44
|
}
|
|
41
|
-
|
|
45
|
+
let url = `${this.resource}providers/Microsoft.ProcessSimple/environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/runs?api-version=2016-11-01`;
|
|
46
|
+
const filters = this.getFilters(args.options);
|
|
47
|
+
if (filters.length > 0) {
|
|
48
|
+
url += `&$filter=${filters.join(' and ')}`;
|
|
49
|
+
}
|
|
42
50
|
try {
|
|
43
51
|
yield this.getAllItems(url, logger, true);
|
|
44
52
|
if (this.items.length > 0) {
|
|
@@ -59,13 +67,57 @@ class FlowRunListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand
|
|
|
59
67
|
}
|
|
60
68
|
});
|
|
61
69
|
}
|
|
70
|
+
getFilters(options) {
|
|
71
|
+
const filters = [];
|
|
72
|
+
if (options.status) {
|
|
73
|
+
filters.push(`status eq '${options.status}'`);
|
|
74
|
+
}
|
|
75
|
+
if (options.triggerStartTime) {
|
|
76
|
+
filters.push(`startTime ge ${options.triggerStartTime}`);
|
|
77
|
+
}
|
|
78
|
+
if (options.triggerEndTime) {
|
|
79
|
+
filters.push(`startTime lt ${options.triggerEndTime}`);
|
|
80
|
+
}
|
|
81
|
+
return filters;
|
|
82
|
+
}
|
|
62
83
|
}
|
|
63
|
-
_FlowRunListCommand_instances = new WeakSet(),
|
|
84
|
+
_FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry = function _FlowRunListCommand_initTelemetry() {
|
|
85
|
+
this.telemetry.push((args) => {
|
|
86
|
+
Object.assign(this.telemetryProperties, {
|
|
87
|
+
status: typeof args.options.status !== 'undefined',
|
|
88
|
+
triggerStartTime: typeof args.options.triggerStartTime !== 'undefined',
|
|
89
|
+
triggerEndTime: typeof args.options.triggerEndTime !== 'undefined'
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}, _FlowRunListCommand_initOptions = function _FlowRunListCommand_initOptions() {
|
|
64
93
|
this.options.unshift({
|
|
65
94
|
option: '-f, --flowName <flowName>'
|
|
66
95
|
}, {
|
|
67
96
|
option: '-e, --environmentName <environmentName>'
|
|
97
|
+
}, {
|
|
98
|
+
option: '--status [status]',
|
|
99
|
+
autocomplete: this.allowedStatusses
|
|
100
|
+
}, {
|
|
101
|
+
option: '--triggerStartTime [triggerStartTime]'
|
|
102
|
+
}, {
|
|
103
|
+
option: '--triggerEndTime [triggerEndTime]'
|
|
68
104
|
});
|
|
105
|
+
}, _FlowRunListCommand_initValidators = function _FlowRunListCommand_initValidators() {
|
|
106
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
if (!validation_1.validation.isValidGuid(args.options.flowName)) {
|
|
108
|
+
return `${args.options.flowName} is not a valid GUID`;
|
|
109
|
+
}
|
|
110
|
+
if (args.options.status && this.allowedStatusses.indexOf(args.options.status) === -1) {
|
|
111
|
+
return `'${args.options.status}' is not a valid status. Allowed values are: ${this.allowedStatusses.join(',')}`;
|
|
112
|
+
}
|
|
113
|
+
if (args.options.triggerStartTime && !validation_1.validation.isValidISODateTime(args.options.triggerStartTime)) {
|
|
114
|
+
return `'${args.options.triggerStartTime}' is not a valid datetime.`;
|
|
115
|
+
}
|
|
116
|
+
if (args.options.triggerEndTime && !validation_1.validation.isValidISODateTime(args.options.triggerEndTime)) {
|
|
117
|
+
return `'${args.options.triggerEndTime}' is not a valid datetime.`;
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
}));
|
|
69
121
|
};
|
|
70
122
|
module.exports = new FlowRunListCommand();
|
|
71
123
|
//# sourceMappingURL=run-list.js.map
|
|
@@ -15,12 +15,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _OneNoteNotebookListCommand_instances, _OneNoteNotebookListCommand_initTelemetry, _OneNoteNotebookListCommand_initOptions, _OneNoteNotebookListCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const request_1 = require("../../../../request");
|
|
19
18
|
const odata_1 = require("../../../../utils/odata");
|
|
20
19
|
const validation_1 = require("../../../../utils/validation");
|
|
21
20
|
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
22
21
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
23
22
|
const commands_1 = require("../../commands");
|
|
23
|
+
const spo_1 = require("../../../../utils/spo");
|
|
24
24
|
class OneNoteNotebookListCommand extends GraphCommand_1.default {
|
|
25
25
|
get name() {
|
|
26
26
|
return commands_1.default.NOTEBOOK_LIST;
|
|
@@ -62,8 +62,7 @@ class OneNoteNotebookListCommand extends GraphCommand_1.default {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
else if (args.options.webUrl) {
|
|
65
|
-
|
|
66
|
-
.getSpoSiteId(args)
|
|
65
|
+
spo_1.spo.getSpoGraphSiteId(args.options.webUrl)
|
|
67
66
|
.then((siteId) => {
|
|
68
67
|
endpoint = `${this.resource}/v1.0/sites/${siteId}/onenote/notebooks`;
|
|
69
68
|
return resolve(endpoint);
|
|
@@ -85,19 +84,6 @@ class OneNoteNotebookListCommand extends GraphCommand_1.default {
|
|
|
85
84
|
.getGroupByDisplayName(args.options.groupName)
|
|
86
85
|
.then(group => group.id);
|
|
87
86
|
}
|
|
88
|
-
getSpoSiteId(args) {
|
|
89
|
-
const url = new URL(args.options.webUrl);
|
|
90
|
-
const requestOptions = {
|
|
91
|
-
url: `${this.resource}/v1.0/sites/${url.hostname}:${url.pathname}`,
|
|
92
|
-
headers: {
|
|
93
|
-
accept: 'application/json;odata.metadata=none'
|
|
94
|
-
},
|
|
95
|
-
responseType: 'json'
|
|
96
|
-
};
|
|
97
|
-
return request_1.default
|
|
98
|
-
.get(requestOptions)
|
|
99
|
-
.then((site) => site.id);
|
|
100
|
-
}
|
|
101
87
|
commandAction(logger, args) {
|
|
102
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
89
|
try {
|
|
@@ -15,12 +15,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _OneNotePageListCommand_instances, _OneNotePageListCommand_initTelemetry, _OneNotePageListCommand_initOptions, _OneNotePageListCommand_initValidators, _OneNotePageListCommand_initOptionSets;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const request_1 = require("../../../../request");
|
|
19
18
|
const odata_1 = require("../../../../utils/odata");
|
|
20
19
|
const validation_1 = require("../../../../utils/validation");
|
|
21
20
|
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
22
21
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
23
22
|
const commands_1 = require("../../commands");
|
|
23
|
+
const spo_1 = require("../../../../utils/spo");
|
|
24
24
|
class OneNotePageListCommand extends GraphCommand_1.default {
|
|
25
25
|
get name() {
|
|
26
26
|
return commands_1.default.PAGE_LIST;
|
|
@@ -56,7 +56,7 @@ class OneNotePageListCommand extends GraphCommand_1.default {
|
|
|
56
56
|
endpoint += `groups/${groupId}`;
|
|
57
57
|
}
|
|
58
58
|
else if (args.options.webUrl) {
|
|
59
|
-
const siteId = yield
|
|
59
|
+
const siteId = yield spo_1.spo.getSpoGraphSiteId(args.options.webUrl);
|
|
60
60
|
endpoint += `sites/${siteId}`;
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
@@ -72,20 +72,6 @@ class OneNotePageListCommand extends GraphCommand_1.default {
|
|
|
72
72
|
return group.id;
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
getSpoSiteId(webUrl) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const url = new URL(webUrl);
|
|
78
|
-
const requestOptions = {
|
|
79
|
-
url: `${this.resource}/v1.0/sites/${url.hostname}:${url.pathname}`,
|
|
80
|
-
headers: {
|
|
81
|
-
accept: 'application/json;odata.metadata=none'
|
|
82
|
-
},
|
|
83
|
-
responseType: 'json'
|
|
84
|
-
};
|
|
85
|
-
const site = yield request_1.default.get(requestOptions);
|
|
86
|
-
return site.id;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
75
|
commandAction(logger, args) {
|
|
90
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
77
|
try {
|
|
@@ -22,6 +22,7 @@ const request_1 = require("../../../../request");
|
|
|
22
22
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
23
23
|
const commands_1 = require("../../commands");
|
|
24
24
|
const formatting_1 = require("../../../../utils/formatting");
|
|
25
|
+
const accessToken_1 = require("../../../../utils/accessToken");
|
|
25
26
|
class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
26
27
|
get name() {
|
|
27
28
|
return commands_1.default.MAIL_SEND;
|
|
@@ -40,8 +41,8 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
|
40
41
|
commandAction(logger, args) {
|
|
41
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
43
|
try {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
44
|
+
const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
|
|
45
|
+
if (isAppOnlyAccessToken === true && !args.options.sender) {
|
|
45
46
|
throw `Specify a upn or user id in the 'sender' option when using app only authentication.`;
|
|
46
47
|
}
|
|
47
48
|
const requestOptions = {
|
|
@@ -17,6 +17,7 @@ var _OutlookMessageGetCommand_instances, _OutlookMessageGetCommand_initTelemetry
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const Auth_1 = require("../../../../Auth");
|
|
19
19
|
const request_1 = require("../../../../request");
|
|
20
|
+
const accessToken_1 = require("../../../../utils/accessToken");
|
|
20
21
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
21
22
|
const commands_1 = require("../../commands");
|
|
22
23
|
class OutlookMessageGetCommand extends GraphCommand_1.default {
|
|
@@ -35,12 +36,12 @@ class OutlookMessageGetCommand extends GraphCommand_1.default {
|
|
|
35
36
|
commandAction(logger, args) {
|
|
36
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
38
|
try {
|
|
38
|
-
const
|
|
39
|
+
const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
|
|
39
40
|
if (this.verbose) {
|
|
40
|
-
logger.logToStderr(`Retrieving message with id ${args.options.id} using ${
|
|
41
|
+
logger.logToStderr(`Retrieving message with id ${args.options.id} using ${isAppOnlyAccessToken ? 'app only permissions' : 'delegated permissions'}`);
|
|
41
42
|
}
|
|
42
43
|
let requestUrl = '';
|
|
43
|
-
if (
|
|
44
|
+
if (isAppOnlyAccessToken) {
|
|
44
45
|
if (!args.options.userId && !args.options.userPrincipalName) {
|
|
45
46
|
throw `The option 'userId' or 'userPrincipalName' is required when retrieving an email using app only credentials`;
|
|
46
47
|
}
|
|
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _PlannerPlanAddCommand_instances, _PlannerPlanAddCommand_initTelemetry, _PlannerPlanAddCommand_initOptions, _PlannerPlanAddCommand_initValidators, _PlannerPlanAddCommand_initOptionSets;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Command_1 = require("../../../../Command");
|
|
18
19
|
const request_1 = require("../../../../request");
|
|
19
20
|
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
20
21
|
const formatting_1 = require("../../../../utils/formatting");
|
|
@@ -42,23 +43,34 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
42
43
|
commandAction(logger, args) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
try {
|
|
45
|
-
const
|
|
46
|
+
const data = {
|
|
47
|
+
title: args.options.title
|
|
48
|
+
};
|
|
49
|
+
if (args.options.rosterId) {
|
|
50
|
+
data.container = {
|
|
51
|
+
"url": `https://graph.microsoft.com/v1.0/planner/rosters/${args.options.rosterId}`
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const groupId = yield this.getGroupId(args);
|
|
56
|
+
data.owner = groupId;
|
|
57
|
+
}
|
|
46
58
|
const requestOptions = {
|
|
47
59
|
url: `${this.resource}/v1.0/planner/plans`,
|
|
48
60
|
headers: {
|
|
49
61
|
'accept': 'application/json;odata.metadata=none'
|
|
50
62
|
},
|
|
51
63
|
responseType: 'json',
|
|
52
|
-
data:
|
|
53
|
-
owner: groupId,
|
|
54
|
-
title: args.options.title
|
|
55
|
-
}
|
|
64
|
+
data: data
|
|
56
65
|
};
|
|
57
66
|
const newPlan = yield request_1.default.post(requestOptions);
|
|
58
67
|
const result = yield this.updatePlanDetails(args.options, newPlan);
|
|
59
68
|
logger.log(result);
|
|
60
69
|
}
|
|
61
70
|
catch (err) {
|
|
71
|
+
if (err.error && err.error.error.message === "You do not have the required permissions to access this item, or the item may not exist.") {
|
|
72
|
+
throw new Command_1.CommandError("You can only add 1 plan to a Roster");
|
|
73
|
+
}
|
|
62
74
|
this.handleRejectedODataJsonPromise(err);
|
|
63
75
|
}
|
|
64
76
|
});
|
|
@@ -167,6 +179,8 @@ _PlannerPlanAddCommand_instances = new WeakSet(), _PlannerPlanAddCommand_initTel
|
|
|
167
179
|
option: "--ownerGroupId [ownerGroupId]"
|
|
168
180
|
}, {
|
|
169
181
|
option: "--ownerGroupName [ownerGroupName]"
|
|
182
|
+
}, {
|
|
183
|
+
option: "--rosterId [rosterId]"
|
|
170
184
|
}, {
|
|
171
185
|
option: '--shareWithUserIds [shareWithUserIds]'
|
|
172
186
|
}, {
|
|
@@ -186,7 +200,7 @@ _PlannerPlanAddCommand_instances = new WeakSet(), _PlannerPlanAddCommand_initTel
|
|
|
186
200
|
return true;
|
|
187
201
|
}));
|
|
188
202
|
}, _PlannerPlanAddCommand_initOptionSets = function _PlannerPlanAddCommand_initOptionSets() {
|
|
189
|
-
this.optionSets.push({ options: ['ownerGroupId', 'ownerGroupName'] });
|
|
203
|
+
this.optionSets.push({ options: ['ownerGroupId', 'ownerGroupName', 'rosterId'] });
|
|
190
204
|
};
|
|
191
205
|
module.exports = new PlannerPlanAddCommand();
|
|
192
206
|
//# sourceMappingURL=plan-add.js.map
|
|
@@ -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);
|
|
82
|
+
return yield planner_1.planner.getPlanByTitle(title, groupId, 'minimal');
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
getGroupId(args) {
|
|
@@ -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 request_1 = require("../../../../request");
|
|
13
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
14
|
+
const commands_1 = require("../../commands");
|
|
15
|
+
class PlannerRosterAddCommand extends GraphCommand_1.default {
|
|
16
|
+
get name() {
|
|
17
|
+
return commands_1.default.ROSTER_ADD;
|
|
18
|
+
}
|
|
19
|
+
get description() {
|
|
20
|
+
return 'Creates a new Microsoft Planner Roster';
|
|
21
|
+
}
|
|
22
|
+
commandAction(logger) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
if (this.verbose) {
|
|
25
|
+
logger.logToStderr('Creating a new Microsoft Planner Roster');
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const requestBody = {};
|
|
29
|
+
const requestOptions = {
|
|
30
|
+
url: `${this.resource}/beta/planner/rosters`,
|
|
31
|
+
headers: {
|
|
32
|
+
accept: 'application/json;odata.metadata=none'
|
|
33
|
+
},
|
|
34
|
+
data: requestBody,
|
|
35
|
+
responseType: 'json'
|
|
36
|
+
};
|
|
37
|
+
const response = yield request_1.default.post(requestOptions);
|
|
38
|
+
logger.log(response);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
this.handleRejectedODataJsonPromise(err);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
module.exports = new PlannerRosterAddCommand();
|
|
47
|
+
//# sourceMappingURL=roster-add.js.map
|
|
@@ -0,0 +1,88 @@
|
|
|
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 _PlannerRosterRemoveCommand_instances, _PlannerRosterRemoveCommand_initTelemetry, _PlannerRosterRemoveCommand_initOptions;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
21
|
+
const commands_1 = require("../../commands");
|
|
22
|
+
class PlannerRosterRemoveCommand extends GraphCommand_1.default {
|
|
23
|
+
get name() {
|
|
24
|
+
return commands_1.default.ROSTER_REMOVE;
|
|
25
|
+
}
|
|
26
|
+
get description() {
|
|
27
|
+
return 'Removes a Microsoft Planner Roster';
|
|
28
|
+
}
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
_PlannerRosterRemoveCommand_instances.add(this);
|
|
32
|
+
__classPrivateFieldGet(this, _PlannerRosterRemoveCommand_instances, "m", _PlannerRosterRemoveCommand_initTelemetry).call(this);
|
|
33
|
+
__classPrivateFieldGet(this, _PlannerRosterRemoveCommand_instances, "m", _PlannerRosterRemoveCommand_initOptions).call(this);
|
|
34
|
+
}
|
|
35
|
+
commandAction(logger, args) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
if (args.options.confirm) {
|
|
38
|
+
yield this.removeRoster(args, logger);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const result = yield Cli_1.Cli.prompt({
|
|
42
|
+
type: 'confirm',
|
|
43
|
+
name: 'continue',
|
|
44
|
+
default: false,
|
|
45
|
+
message: `Are you sure you want to remove roster ${args.options.id}?`
|
|
46
|
+
});
|
|
47
|
+
if (result.continue) {
|
|
48
|
+
yield this.removeRoster(args, logger);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
removeRoster(args, logger) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
if (this.verbose) {
|
|
56
|
+
logger.logToStderr(`Removing roster ${args.options.id}`);
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const requestOptions = {
|
|
60
|
+
url: `${this.resource}/beta/planner/rosters/${args.options.id}`,
|
|
61
|
+
headers: {
|
|
62
|
+
accept: 'application/json;odata.metadata=none'
|
|
63
|
+
},
|
|
64
|
+
responseType: 'json'
|
|
65
|
+
};
|
|
66
|
+
yield request_1.default.delete(requestOptions);
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
this.handleRejectedODataJsonPromise(err);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
_PlannerRosterRemoveCommand_instances = new WeakSet(), _PlannerRosterRemoveCommand_initTelemetry = function _PlannerRosterRemoveCommand_initTelemetry() {
|
|
75
|
+
this.telemetry.push((args) => {
|
|
76
|
+
Object.assign(this.telemetryProperties, {
|
|
77
|
+
confirm: !!args.options.confirm
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}, _PlannerRosterRemoveCommand_initOptions = function _PlannerRosterRemoveCommand_initOptions() {
|
|
81
|
+
this.options.unshift({
|
|
82
|
+
option: '--id <id>'
|
|
83
|
+
}, {
|
|
84
|
+
option: '--confirm'
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
module.exports = new PlannerRosterRemoveCommand();
|
|
88
|
+
//# sourceMappingURL=roster-remove.js.map
|
|
@@ -12,6 +12,8 @@ exports.default = {
|
|
|
12
12
|
PLAN_LIST: `${prefix} plan list`,
|
|
13
13
|
PLAN_REMOVE: `${prefix} plan remove`,
|
|
14
14
|
PLAN_SET: `${prefix} plan set`,
|
|
15
|
+
ROSTER_ADD: `${prefix} roster add`,
|
|
16
|
+
ROSTER_REMOVE: `${prefix} roster remove`,
|
|
15
17
|
TASK_ADD: `${prefix} task add`,
|
|
16
18
|
TASK_CHECKLISTITEM_ADD: `${prefix} task checklistitem add`,
|
|
17
19
|
TASK_CHECKLISTITEM_LIST: `${prefix} task checklistitem list`,
|
|
@@ -0,0 +1,70 @@
|
|
|
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 _PurviewRetentionEventtypeGetCommand_instances, _PurviewRetentionEventtypeGetCommand_initOptions, _PurviewRetentionEventtypeGetCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
19
|
+
const commands_1 = require("../../commands");
|
|
20
|
+
const request_1 = require("../../../../request");
|
|
21
|
+
const validation_1 = require("../../../../utils/validation");
|
|
22
|
+
class PurviewRetentionEventtypeGetCommand extends GraphCommand_1.default {
|
|
23
|
+
get name() {
|
|
24
|
+
return commands_1.default.RETENTIONEVENTTYPE_GET;
|
|
25
|
+
}
|
|
26
|
+
get description() {
|
|
27
|
+
return 'Retrieve the specified retention event type';
|
|
28
|
+
}
|
|
29
|
+
constructor() {
|
|
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);
|
|
34
|
+
}
|
|
35
|
+
commandAction(logger, args) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
try {
|
|
38
|
+
if (this.verbose) {
|
|
39
|
+
logger.logToStderr(`Retrieving retention event type with id ${args.options.id}`);
|
|
40
|
+
}
|
|
41
|
+
const requestOptions = {
|
|
42
|
+
url: `${this.resource}/beta/security/triggerTypes/retentionEventTypes/${args.options.id}`,
|
|
43
|
+
headers: {
|
|
44
|
+
accept: 'application/json;odata.metadata=none'
|
|
45
|
+
},
|
|
46
|
+
responseType: 'json'
|
|
47
|
+
};
|
|
48
|
+
const res = yield request_1.default.get(requestOptions);
|
|
49
|
+
logger.log(res);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
this.handleRejectedODataJsonPromise(err);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_PurviewRetentionEventtypeGetCommand_instances = new WeakSet(), _PurviewRetentionEventtypeGetCommand_initOptions = function _PurviewRetentionEventtypeGetCommand_initOptions() {
|
|
58
|
+
this.options.unshift({
|
|
59
|
+
option: '-i, --id <id>'
|
|
60
|
+
});
|
|
61
|
+
}, _PurviewRetentionEventtypeGetCommand_initValidators = function _PurviewRetentionEventtypeGetCommand_initValidators() {
|
|
62
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
if (!validation_1.validation.isValidGuid(args.options.id)) {
|
|
64
|
+
return `'${args.options.id}' is not a valid GUID.`;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
module.exports = new PurviewRetentionEventtypeGetCommand();
|
|
70
|
+
//# sourceMappingURL=retentioneventtype-get.js.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const prefix = 'purview';
|
|
4
4
|
exports.default = {
|
|
5
|
+
RETENTIONEVENTTYPE_GET: `${prefix} retentioneventtype get`,
|
|
5
6
|
RETENTIONLABEL_ADD: `${prefix} retentionlabel add`,
|
|
6
7
|
RETENTIONLABEL_GET: `${prefix} retentionlabel get`,
|
|
7
8
|
RETENTIONLABEL_LIST: `${prefix} retentionlabel list`,
|