@pnp/cli-microsoft365 6.0.0-beta.c377306 → 6.0.0-beta.c561c1f
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/m365/commands/commands.js +1 -0
- package/dist/m365/commands/request.js +153 -0
- package/dist/m365/graph/Changelog.js +3 -0
- package/dist/m365/graph/commands/changelog/changelog-list.js +160 -0
- package/dist/m365/graph/commands.js +1 -0
- package/dist/m365/onenote/commands/notebook/notebook-list.js +139 -0
- package/dist/m365/onenote/commands.js +7 -0
- package/dist/m365/planner/commands/task/task-get.js +7 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.16.0-beta.1.js +23 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +90 -79
- package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +1 -1
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +9 -0
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +57 -28
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +206 -0
- package/dist/m365/spo/commands/web/web-roleassignment-add.js +187 -0
- package/dist/m365/spo/commands/web/web-roleassignment-remove.js +170 -0
- package/dist/m365/spo/commands.js +3 -0
- package/dist/request.js +6 -2
- package/docs/docs/cmd/adaptivecard/adaptivecard-send.md +0 -20
- package/docs/docs/cmd/graph/changelog/changelog-list.md +53 -0
- package/docs/docs/cmd/onenote/notebook/notebook-list.md +70 -0
- package/docs/docs/cmd/request.md +76 -0
- package/docs/docs/cmd/spfx/spfx-doctor.md +3 -3
- package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +2 -2
- package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +3 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.md +67 -0
- package/docs/docs/cmd/spo/web/web-roleassignment-add.md +57 -0
- package/docs/docs/cmd/spo/web/web-roleassignment-remove.md +54 -0
- package/package.json +2 -1
|
@@ -0,0 +1,153 @@
|
|
|
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 _RequestCommand_instances, _RequestCommand_initTelemetry, _RequestCommand_initOptions, _RequestCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const fs = require("fs");
|
|
19
|
+
const Command_1 = require("../../Command");
|
|
20
|
+
const request_1 = require("../../request");
|
|
21
|
+
const commands_1 = require("./commands");
|
|
22
|
+
const path = require("path");
|
|
23
|
+
class RequestCommand extends Command_1.default {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_RequestCommand_instances.add(this);
|
|
27
|
+
this.allowedMethods = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'];
|
|
28
|
+
__classPrivateFieldGet(this, _RequestCommand_instances, "m", _RequestCommand_initTelemetry).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _RequestCommand_instances, "m", _RequestCommand_initOptions).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _RequestCommand_instances, "m", _RequestCommand_initValidators).call(this);
|
|
31
|
+
}
|
|
32
|
+
get name() {
|
|
33
|
+
return commands_1.default.REQUEST;
|
|
34
|
+
}
|
|
35
|
+
get description() {
|
|
36
|
+
return 'Executes the specified web request using CLI for Microsoft 365';
|
|
37
|
+
}
|
|
38
|
+
allowUnknownOptions() {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
commandAction(logger, args, cb) {
|
|
42
|
+
if (this.debug) {
|
|
43
|
+
logger.logToStderr(`Preparing request...`);
|
|
44
|
+
}
|
|
45
|
+
const method = (args.options.method || 'get').toUpperCase();
|
|
46
|
+
const headers = {};
|
|
47
|
+
const unknownOptions = this.getUnknownOptions(args.options);
|
|
48
|
+
const unknownOptionsNames = Object.getOwnPropertyNames(unknownOptions);
|
|
49
|
+
unknownOptionsNames.forEach(o => {
|
|
50
|
+
headers[o] = unknownOptions[o];
|
|
51
|
+
});
|
|
52
|
+
if (!headers.accept) {
|
|
53
|
+
headers.accept = 'application/json';
|
|
54
|
+
}
|
|
55
|
+
if (args.options.resource) {
|
|
56
|
+
headers['x-resource'] = args.options.resource;
|
|
57
|
+
}
|
|
58
|
+
const config = {
|
|
59
|
+
url: args.options.url,
|
|
60
|
+
headers,
|
|
61
|
+
method,
|
|
62
|
+
data: args.options.body
|
|
63
|
+
};
|
|
64
|
+
if (headers.accept.toString().startsWith('application/json')) {
|
|
65
|
+
config.responseType = 'json';
|
|
66
|
+
}
|
|
67
|
+
if (args.options.filePath) {
|
|
68
|
+
config.responseType = 'stream';
|
|
69
|
+
}
|
|
70
|
+
if (this.verbose) {
|
|
71
|
+
logger.logToStderr(`Executing request...`);
|
|
72
|
+
}
|
|
73
|
+
if (args.options.filePath) {
|
|
74
|
+
request_1.default
|
|
75
|
+
.execute(config)
|
|
76
|
+
.then((file) => {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
const writer = fs.createWriteStream(args.options.filePath);
|
|
79
|
+
file.data.pipe(writer);
|
|
80
|
+
writer.on('error', err => {
|
|
81
|
+
reject(err);
|
|
82
|
+
});
|
|
83
|
+
writer.on('close', () => {
|
|
84
|
+
resolve(args.options.filePath);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
})
|
|
88
|
+
.then((file) => {
|
|
89
|
+
if (this.verbose) {
|
|
90
|
+
logger.logToStderr(`File saved to path ${file}`);
|
|
91
|
+
}
|
|
92
|
+
cb();
|
|
93
|
+
}, (err) => this.handleError(err, logger, cb));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
request_1.default
|
|
97
|
+
.execute(config)
|
|
98
|
+
.then(response => {
|
|
99
|
+
logger.log(response);
|
|
100
|
+
cb();
|
|
101
|
+
}, (rawRes) => this.handleError(rawRes, logger, cb));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
_RequestCommand_instances = new WeakSet(), _RequestCommand_initTelemetry = function _RequestCommand_initTelemetry() {
|
|
106
|
+
this.telemetry.push((args) => {
|
|
107
|
+
const properties = {
|
|
108
|
+
method: args.options.method || 'get',
|
|
109
|
+
resource: typeof args.options.resource !== 'undefined',
|
|
110
|
+
accept: args.options.accept || 'application/json',
|
|
111
|
+
body: typeof args.options.body !== 'undefined',
|
|
112
|
+
filePath: typeof args.options.filePath !== 'undefined'
|
|
113
|
+
};
|
|
114
|
+
const unknownOptions = this.getUnknownOptions(args.options);
|
|
115
|
+
const unknownOptionsNames = Object.getOwnPropertyNames(unknownOptions);
|
|
116
|
+
unknownOptionsNames.forEach(o => {
|
|
117
|
+
properties[o] = typeof unknownOptions[o] !== 'undefined';
|
|
118
|
+
});
|
|
119
|
+
Object.assign(this.telemetryProperties, properties);
|
|
120
|
+
});
|
|
121
|
+
}, _RequestCommand_initOptions = function _RequestCommand_initOptions() {
|
|
122
|
+
this.options.unshift({
|
|
123
|
+
option: '-u, --url <url>'
|
|
124
|
+
}, {
|
|
125
|
+
option: '-m, --method [method]',
|
|
126
|
+
autocomplete: this.allowedMethods
|
|
127
|
+
}, {
|
|
128
|
+
option: '-r, --resource [resource]'
|
|
129
|
+
}, {
|
|
130
|
+
option: '-b, --body [body]'
|
|
131
|
+
}, {
|
|
132
|
+
option: '-p, --filePath [filePath]'
|
|
133
|
+
});
|
|
134
|
+
}, _RequestCommand_initValidators = function _RequestCommand_initValidators() {
|
|
135
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
const currentMethod = args.options.method || 'get';
|
|
137
|
+
if (this.allowedMethods.indexOf(currentMethod) === -1) {
|
|
138
|
+
return `${currentMethod} is not a valid value for method. Allowed values: ${this.allowedMethods.join(', ')}`;
|
|
139
|
+
}
|
|
140
|
+
if (args.options.body && (!args.options.method || args.options.method === 'get')) {
|
|
141
|
+
return 'Specify a different method when using body';
|
|
142
|
+
}
|
|
143
|
+
if (args.options.body && !args.options['content-type']) {
|
|
144
|
+
return 'Specify the content-type when using body';
|
|
145
|
+
}
|
|
146
|
+
if (args.options.filePath && !fs.existsSync(path.dirname(args.options.filePath))) {
|
|
147
|
+
return 'The location specified in the filePath does not exist';
|
|
148
|
+
}
|
|
149
|
+
return true;
|
|
150
|
+
}));
|
|
151
|
+
};
|
|
152
|
+
module.exports = new RequestCommand();
|
|
153
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1,160 @@
|
|
|
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 _GraphChangelogListCommand_instances, _GraphChangelogListCommand_initTelemetry, _GraphChangelogListCommand_initOptions, _GraphChangelogListCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const utils_1 = require("../../../../utils");
|
|
19
|
+
const AnonymousCommand_1 = require("../../../base/AnonymousCommand");
|
|
20
|
+
const commands_1 = require("../../commands");
|
|
21
|
+
const request_1 = require("../../../../request");
|
|
22
|
+
const xmldom_1 = require("@xmldom/xmldom");
|
|
23
|
+
class GraphChangelogListCommand extends AnonymousCommand_1.default {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_GraphChangelogListCommand_instances.add(this);
|
|
27
|
+
this.allowedVersions = ['beta', 'v1.0'];
|
|
28
|
+
this.allowedChangeTypes = ['Addition', 'Change', 'Deletion', 'Deprecation'];
|
|
29
|
+
this.allowedServices = [
|
|
30
|
+
'Applications', 'Calendar', 'Change notifications', 'Cloud communications',
|
|
31
|
+
'Compliance', 'Cross-device experiences', 'Customer booking', 'Device and app management',
|
|
32
|
+
'Education', 'Files', 'Financials', 'Groups',
|
|
33
|
+
'Identity and access', 'Mail', 'Notes', 'Notifications',
|
|
34
|
+
'People and workplace intelligence', 'Personal contacts', 'Reports', 'Search',
|
|
35
|
+
'Security', 'Sites and lists', 'Tasks and plans', 'Teamwork',
|
|
36
|
+
'To-do tasks', 'Users', 'Workbooks and charts'
|
|
37
|
+
];
|
|
38
|
+
__classPrivateFieldGet(this, _GraphChangelogListCommand_instances, "m", _GraphChangelogListCommand_initTelemetry).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _GraphChangelogListCommand_instances, "m", _GraphChangelogListCommand_initOptions).call(this);
|
|
40
|
+
__classPrivateFieldGet(this, _GraphChangelogListCommand_instances, "m", _GraphChangelogListCommand_initValidators).call(this);
|
|
41
|
+
}
|
|
42
|
+
get name() {
|
|
43
|
+
return commands_1.default.CHANGELOG_LIST;
|
|
44
|
+
}
|
|
45
|
+
get description() {
|
|
46
|
+
return 'Gets an overview of specific API-level changes in Microsoft Graph v1.0 and beta';
|
|
47
|
+
}
|
|
48
|
+
defaultProperties() {
|
|
49
|
+
return ['category', 'title', 'description'];
|
|
50
|
+
}
|
|
51
|
+
commandAction(logger, args, cb) {
|
|
52
|
+
const allowedChangeType = args.options.changeType && this.allowedChangeTypes.find(x => x.toLocaleLowerCase() === args.options.changeType.toLocaleLowerCase());
|
|
53
|
+
const searchParam = args.options.changeType ? `/?filterBy=${allowedChangeType}` : '';
|
|
54
|
+
const requestOptions = {
|
|
55
|
+
url: `https://developer.microsoft.com/en-us/graph/changelog/rss${searchParam}`,
|
|
56
|
+
headers: {
|
|
57
|
+
'accept': 'text/xml',
|
|
58
|
+
'x-anonymous': 'true'
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
request_1.default
|
|
62
|
+
.get(requestOptions)
|
|
63
|
+
.then((output) => {
|
|
64
|
+
const parser = new xmldom_1.DOMParser();
|
|
65
|
+
const xmlDoc = parser.parseFromString(output.toString(), "text/xml");
|
|
66
|
+
const changelog = this.filterThroughOptions(args.options, this.mapChangelog(xmlDoc, args));
|
|
67
|
+
logger.log(changelog.items);
|
|
68
|
+
cb();
|
|
69
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
70
|
+
}
|
|
71
|
+
filterThroughOptions(options, changelog) {
|
|
72
|
+
let items = changelog.items;
|
|
73
|
+
if (options.services) {
|
|
74
|
+
const allowedServices = this.allowedServices
|
|
75
|
+
.filter(allowedService => options.services.toLocaleLowerCase().split(',').includes(allowedService.toLocaleLowerCase()));
|
|
76
|
+
items = changelog.items.filter(item => allowedServices.includes(item.title));
|
|
77
|
+
}
|
|
78
|
+
if (options.versions) {
|
|
79
|
+
const allowedVersions = this.allowedVersions
|
|
80
|
+
.filter(allowedVersion => options.versions.toLocaleLowerCase().split(',').includes(allowedVersion.toLocaleLowerCase()));
|
|
81
|
+
items = items.filter(item => allowedVersions.includes(item.category));
|
|
82
|
+
}
|
|
83
|
+
if (options.startDate) {
|
|
84
|
+
const startDate = new Date(options.startDate);
|
|
85
|
+
items = items.filter(item => item.pubDate >= startDate);
|
|
86
|
+
}
|
|
87
|
+
if (options.endDate) {
|
|
88
|
+
const endDate = new Date(options.endDate);
|
|
89
|
+
items = items.filter(item => item.pubDate <= endDate);
|
|
90
|
+
}
|
|
91
|
+
// Make sure everything is unique based on the item guid
|
|
92
|
+
items = [...new Map(items.map((item) => [item.guid, item])).values()];
|
|
93
|
+
changelog.items = items.sort((itemA, itemB) => Number(itemB.pubDate) - Number(itemA.pubDate));
|
|
94
|
+
return changelog;
|
|
95
|
+
}
|
|
96
|
+
mapChangelog(xmlDoc, args) {
|
|
97
|
+
const channel = xmlDoc.getElementsByTagName('channel').item(0);
|
|
98
|
+
const changelog = {
|
|
99
|
+
title: channel.getElementsByTagName('title').item(0).textContent,
|
|
100
|
+
description: channel.getElementsByTagName('description').item(0).textContent,
|
|
101
|
+
url: channel.getElementsByTagName('link').item(0).textContent,
|
|
102
|
+
items: []
|
|
103
|
+
};
|
|
104
|
+
Array.from(xmlDoc.getElementsByTagName('item')).forEach((item) => {
|
|
105
|
+
const description = args.options.output === 'text' ?
|
|
106
|
+
utils_1.md.md2plain(item.getElementsByTagName('description').item(0).textContent, '') :
|
|
107
|
+
item.getElementsByTagName('description').item(0).textContent;
|
|
108
|
+
changelog.items.push({
|
|
109
|
+
guid: item.getElementsByTagName('guid').item(0).textContent,
|
|
110
|
+
category: item.getElementsByTagName('category').item(1).textContent,
|
|
111
|
+
title: item.getElementsByTagName('title').item(0).textContent,
|
|
112
|
+
description: args.options.output === 'text' ?
|
|
113
|
+
description.length > 50 ? `${description.substring(0, 47)}...` : description :
|
|
114
|
+
description,
|
|
115
|
+
pubDate: new Date(item.getElementsByTagName('pubDate').item(0).textContent)
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
return changelog;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
_GraphChangelogListCommand_instances = new WeakSet(), _GraphChangelogListCommand_initTelemetry = function _GraphChangelogListCommand_initTelemetry() {
|
|
122
|
+
this.telemetry.push((args) => {
|
|
123
|
+
Object.assign(this.telemetryProperties, {
|
|
124
|
+
versions: typeof args.options.versions !== 'undefined',
|
|
125
|
+
changeType: typeof args.options.changeType !== 'undefined',
|
|
126
|
+
services: typeof args.options.services !== 'undefined',
|
|
127
|
+
startDate: typeof args.options.startDate !== 'undefined',
|
|
128
|
+
endDate: typeof args.options.endDate !== 'undefined'
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}, _GraphChangelogListCommand_initOptions = function _GraphChangelogListCommand_initOptions() {
|
|
132
|
+
this.options.unshift({ option: '-v, --versions [versions]', autocomplete: this.allowedVersions }, { option: "-c, --changeType [changeType]", autocomplete: this.allowedChangeTypes }, { option: "-s, --services [services]", autocomplete: this.allowedServices }, { option: "--startDate [startDate]" }, { option: "--endDate [endDate]" });
|
|
133
|
+
}, _GraphChangelogListCommand_initValidators = function _GraphChangelogListCommand_initValidators() {
|
|
134
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
if (args.options.versions &&
|
|
136
|
+
args.options.versions.toLocaleLowerCase().split(',').some(x => !this.allowedVersions.map(y => y.toLocaleLowerCase()).includes(x))) {
|
|
137
|
+
return `The verions contains an invalid value. Specify either ${this.allowedVersions.join(', ')} as properties`;
|
|
138
|
+
}
|
|
139
|
+
if (args.options.changeType &&
|
|
140
|
+
!this.allowedChangeTypes.map(x => x.toLocaleLowerCase()).includes(args.options.changeType.toLocaleLowerCase())) {
|
|
141
|
+
return `The change type contain an invalid value. Specify either ${this.allowedChangeTypes.join(', ')} as properties`;
|
|
142
|
+
}
|
|
143
|
+
if (args.options.services &&
|
|
144
|
+
args.options.services.toLocaleLowerCase().split(',').some(x => !this.allowedServices.map(y => y.toLocaleLowerCase()).includes(x))) {
|
|
145
|
+
return `The services contains invalid value. Specify either ${this.allowedServices.join(', ')} as properties`;
|
|
146
|
+
}
|
|
147
|
+
if (args.options.startDate && !utils_1.validation.isValidISODate(args.options.startDate)) {
|
|
148
|
+
return 'The startDate is not a valid ISO date string';
|
|
149
|
+
}
|
|
150
|
+
if (args.options.endDate && !utils_1.validation.isValidISODate(args.options.endDate)) {
|
|
151
|
+
return 'The endDate is not a valid ISO date string';
|
|
152
|
+
}
|
|
153
|
+
if (args.options.endDate && args.options.startDate && new Date(args.options.endDate) < new Date(args.options.startDate)) {
|
|
154
|
+
return 'The endDate should be later than startDate';
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}));
|
|
158
|
+
};
|
|
159
|
+
module.exports = new GraphChangelogListCommand();
|
|
160
|
+
//# sourceMappingURL=changelog-list.js.map
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const prefix = 'graph';
|
|
4
4
|
exports.default = {
|
|
5
|
+
CHANGELOG_LIST: `${prefix} changelog list`,
|
|
5
6
|
SCHEMAEXTENSION_ADD: `${prefix} schemaextension add`,
|
|
6
7
|
SCHEMAEXTENSION_GET: `${prefix} schemaextension get`,
|
|
7
8
|
SCHEMAEXTENSION_LIST: `${prefix} schemaextension list`,
|
|
@@ -0,0 +1,139 @@
|
|
|
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 _OneNoteNotebookListCommand_instances, _OneNoteNotebookListCommand_initTelemetry, _OneNoteNotebookListCommand_initOptions, _OneNoteNotebookListCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const utils_1 = require("../../../../utils");
|
|
20
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
21
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
class OneNoteNotebookListCommand extends GraphCommand_1.default {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_OneNoteNotebookListCommand_instances.add(this);
|
|
27
|
+
__classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initValidators).call(this);
|
|
30
|
+
}
|
|
31
|
+
get name() {
|
|
32
|
+
return commands_1.default.NOTEBOOK_LIST;
|
|
33
|
+
}
|
|
34
|
+
get description() {
|
|
35
|
+
return 'Retrieve a list of notebooks';
|
|
36
|
+
}
|
|
37
|
+
getEndpointUrl(args) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
let endpoint = `${this.resource}/v1.0/me/onenote/notebooks`;
|
|
40
|
+
if (args.options.userId) {
|
|
41
|
+
endpoint = `${this.resource}/v1.0/users/${args.options.userId}/onenote/notebooks`;
|
|
42
|
+
return resolve(endpoint);
|
|
43
|
+
}
|
|
44
|
+
else if (args.options.userName) {
|
|
45
|
+
endpoint = `${this.resource}/v1.0/users/${args.options.userName}/onenote/notebooks`;
|
|
46
|
+
return resolve(endpoint);
|
|
47
|
+
}
|
|
48
|
+
else if (args.options.groupId) {
|
|
49
|
+
endpoint = `${this.resource}/v1.0/groups/${args.options.groupId}/onenote/notebooks`;
|
|
50
|
+
return resolve(endpoint);
|
|
51
|
+
}
|
|
52
|
+
else if (args.options.groupName) {
|
|
53
|
+
this
|
|
54
|
+
.getGroupId(args)
|
|
55
|
+
.then((retrievedgroupId) => {
|
|
56
|
+
endpoint = `${this.resource}/v1.0/groups/${retrievedgroupId}/onenote/notebooks`;
|
|
57
|
+
return resolve(endpoint);
|
|
58
|
+
})
|
|
59
|
+
.catch((err) => {
|
|
60
|
+
reject(err);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else if (args.options.webUrl) {
|
|
64
|
+
this
|
|
65
|
+
.getSpoSiteId(args)
|
|
66
|
+
.then((siteId) => {
|
|
67
|
+
endpoint = `${this.resource}/v1.0/sites/${siteId}/onenote/notebooks`;
|
|
68
|
+
return resolve(endpoint);
|
|
69
|
+
})
|
|
70
|
+
.catch((err) => {
|
|
71
|
+
reject(err);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return resolve(endpoint);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
defaultProperties() {
|
|
80
|
+
return ['createdDateTime', 'displayName', 'id'];
|
|
81
|
+
}
|
|
82
|
+
getGroupId(args) {
|
|
83
|
+
return aadGroup_1.aadGroup
|
|
84
|
+
.getGroupByDisplayName(args.options.groupName)
|
|
85
|
+
.then(group => group.id);
|
|
86
|
+
}
|
|
87
|
+
getSpoSiteId(args) {
|
|
88
|
+
const url = new URL(args.options.webUrl);
|
|
89
|
+
const requestOptions = {
|
|
90
|
+
url: `${this.resource}/v1.0/sites/${url.hostname}:${url.pathname}`,
|
|
91
|
+
headers: {
|
|
92
|
+
accept: 'application/json;odata.metadata=none'
|
|
93
|
+
},
|
|
94
|
+
responseType: 'json'
|
|
95
|
+
};
|
|
96
|
+
return request_1.default
|
|
97
|
+
.get(requestOptions)
|
|
98
|
+
.then((site) => site.id);
|
|
99
|
+
}
|
|
100
|
+
commandAction(logger, args, cb) {
|
|
101
|
+
this
|
|
102
|
+
.getEndpointUrl(args)
|
|
103
|
+
.then(endpoint => utils_1.odata.getAllItems(endpoint))
|
|
104
|
+
.then((items) => {
|
|
105
|
+
return Promise.resolve(items);
|
|
106
|
+
})
|
|
107
|
+
.then((items) => {
|
|
108
|
+
logger.log(items);
|
|
109
|
+
cb();
|
|
110
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
_OneNoteNotebookListCommand_instances = new WeakSet(), _OneNoteNotebookListCommand_initTelemetry = function _OneNoteNotebookListCommand_initTelemetry() {
|
|
114
|
+
this.telemetry.push((args) => {
|
|
115
|
+
Object.assign(this.telemetryProperties, {
|
|
116
|
+
joined: args.options.joined
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}, _OneNoteNotebookListCommand_initOptions = function _OneNoteNotebookListCommand_initOptions() {
|
|
120
|
+
this.options.unshift({ option: '--userId [userId]' }, { option: '--userName [userName]' }, { option: '--groupId [groupId]' }, { option: '--groupName [groupName]' }, { option: '-u, --webUrl [webUrl]' });
|
|
121
|
+
}, _OneNoteNotebookListCommand_initValidators = function _OneNoteNotebookListCommand_initValidators() {
|
|
122
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
if (args.options.userId && !utils_1.validation.isValidGuid(args.options.userId)) {
|
|
124
|
+
return `${args.options.userId} is not a valid GUID`;
|
|
125
|
+
}
|
|
126
|
+
if (args.options.groupId && !utils_1.validation.isValidGuid(args.options.groupId)) {
|
|
127
|
+
return `${args.options.groupId} is not a valid GUID`;
|
|
128
|
+
}
|
|
129
|
+
if (args.options.userId && args.options.userName) {
|
|
130
|
+
return 'Specify either userId or userName, but not both';
|
|
131
|
+
}
|
|
132
|
+
if (args.options.groupId && args.options.groupName) {
|
|
133
|
+
return 'Specify either groupId or groupName, but not both';
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}));
|
|
137
|
+
};
|
|
138
|
+
module.exports = new OneNoteNotebookListCommand();
|
|
139
|
+
//# sourceMappingURL=notebook-list.js.map
|
|
@@ -166,6 +166,13 @@ _PlannerTaskGetCommand_instances = new WeakSet(), _PlannerTaskGetCommand_initTel
|
|
|
166
166
|
this.options.unshift({ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '--bucketId [bucketId]' }, { option: '--bucketName [bucketName]' }, { option: '--planId [planId]' }, { option: '--planTitle [planTitle]' }, { option: '--ownerGroupId [ownerGroupId]' }, { option: '--ownerGroupName [ownerGroupName]' });
|
|
167
167
|
}, _PlannerTaskGetCommand_initValidators = function _PlannerTaskGetCommand_initValidators() {
|
|
168
168
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
if (args.options.id) {
|
|
170
|
+
if (args.options.bucketId || args.options.bucketName ||
|
|
171
|
+
args.options.planId || args.options.planName || args.options.planTitle ||
|
|
172
|
+
args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
173
|
+
return 'Don\'t specify bucketId, bucketName, planId, planTitle, ownerGroupId or ownerGroupName when using id';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
169
176
|
if (args.options.title && !args.options.bucketId && !args.options.bucketName) {
|
|
170
177
|
return 'Specify either bucketId or bucketName when using title';
|
|
171
178
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const FN001008_DEP_react_1 = require("./rules/FN001008_DEP_react");
|
|
4
|
+
const FN001009_DEP_react_dom_1 = require("./rules/FN001009_DEP_react_dom");
|
|
5
|
+
const FN001022_DEP_office_ui_fabric_react_1 = require("./rules/FN001022_DEP_office_ui_fabric_react");
|
|
6
|
+
const FN002004_DEVDEP_gulp_1 = require("./rules/FN002004_DEVDEP_gulp");
|
|
7
|
+
const FN002007_DEVDEP_ajv_1 = require("./rules/FN002007_DEVDEP_ajv");
|
|
8
|
+
const FN002013_DEVDEP_types_webpack_env_1 = require("./rules/FN002013_DEVDEP_types_webpack_env");
|
|
9
|
+
const FN002015_DEVDEP_types_react_1 = require("./rules/FN002015_DEVDEP_types_react");
|
|
10
|
+
const FN002016_DEVDEP_types_react_dom_1 = require("./rules/FN002016_DEVDEP_types_react_dom");
|
|
11
|
+
const FN002019_DEVDEP_microsoft_rush_stack_compiler_1 = require("./rules/FN002019_DEVDEP_microsoft_rush_stack_compiler");
|
|
12
|
+
module.exports = [
|
|
13
|
+
new FN001008_DEP_react_1.FN001008_DEP_react('16'),
|
|
14
|
+
new FN001009_DEP_react_dom_1.FN001009_DEP_react_dom('16'),
|
|
15
|
+
new FN001022_DEP_office_ui_fabric_react_1.FN001022_DEP_office_ui_fabric_react('7.192.0'),
|
|
16
|
+
new FN002004_DEVDEP_gulp_1.FN002004_DEVDEP_gulp('4.0.2'),
|
|
17
|
+
new FN002007_DEVDEP_ajv_1.FN002007_DEVDEP_ajv('^6.12.5'),
|
|
18
|
+
new FN002013_DEVDEP_types_webpack_env_1.FN002013_DEVDEP_types_webpack_env('~1.15.2'),
|
|
19
|
+
new FN002015_DEVDEP_types_react_1.FN002015_DEVDEP_types_react('16'),
|
|
20
|
+
new FN002016_DEVDEP_types_react_dom_1.FN002016_DEVDEP_types_react_dom('16'),
|
|
21
|
+
new FN002019_DEVDEP_microsoft_rush_stack_compiler_1.FN002019_DEVDEP_microsoft_rush_stack_compiler(['4.5'])
|
|
22
|
+
];
|
|
23
|
+
//# sourceMappingURL=doctor-1.16.0-beta.1.js.map
|
|
@@ -61,7 +61,8 @@ class SpfxProjectDoctorCommand extends base_project_command_1.BaseProjectCommand
|
|
|
61
61
|
'1.13.1',
|
|
62
62
|
'1.14.0',
|
|
63
63
|
'1.15.0',
|
|
64
|
-
'1.15.2'
|
|
64
|
+
'1.15.2',
|
|
65
|
+
'1.16.0-beta.1'
|
|
65
66
|
];
|
|
66
67
|
__classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initTelemetry).call(this);
|
|
67
68
|
__classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initOptions).call(this);
|