@pnp/cli-microsoft365 6.0.0-beta.8352f49 → 6.0.0-beta.c32757e
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/Command.js +22 -0
- package/dist/m365/planner/commands/task/task-add.js +1 -7
- package/dist/m365/planner/commands/task/task-reference-add.js +1 -7
- package/dist/m365/planner/commands/task/task-reference-remove.js +11 -14
- package/dist/m365/planner/commands/task/task-set.js +2 -14
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015008_FILE_eslintrc_js.js +7 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.0.js +6 -4
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +1 -9
- package/dist/utils/accessToken.js +18 -0
- package/dist/utils/validation.js +5 -1
- package/docs/docs/cmd/aad/user/user-get.md +12 -0
- package/docs/docs/cmd/planner/plan/plan-remove.md +1 -1
- package/package.json +1 -1
package/dist/Command.js
CHANGED
|
@@ -14,6 +14,7 @@ const appInsights_1 = require("./appInsights");
|
|
|
14
14
|
const Auth_1 = require("./Auth");
|
|
15
15
|
const cli_1 = require("./cli");
|
|
16
16
|
const request_1 = require("./request");
|
|
17
|
+
const utils_1 = require("./utils");
|
|
17
18
|
class CommandError {
|
|
18
19
|
constructor(message, code) {
|
|
19
20
|
this.message = message;
|
|
@@ -81,6 +82,7 @@ class Command {
|
|
|
81
82
|
cb(new CommandError('Log in to Microsoft 365 first'));
|
|
82
83
|
return;
|
|
83
84
|
}
|
|
85
|
+
this.loadValuesFromAccessToken(args);
|
|
84
86
|
this.commandAction(logger, args, cb);
|
|
85
87
|
}, (error) => {
|
|
86
88
|
cb(new CommandError(error));
|
|
@@ -292,6 +294,26 @@ class Command {
|
|
|
292
294
|
payload[o] = unknownOptions[o];
|
|
293
295
|
});
|
|
294
296
|
}
|
|
297
|
+
loadValuesFromAccessToken(args) {
|
|
298
|
+
if (!Auth_1.default.service.accessTokens[Auth_1.default.defaultResource]) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const token = Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken;
|
|
302
|
+
const optionNames = Object.getOwnPropertyNames(args.options);
|
|
303
|
+
optionNames.forEach(option => {
|
|
304
|
+
const value = args.options[option];
|
|
305
|
+
if (!value || typeof value !== 'string') {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const lowerCaseValue = value.toLowerCase();
|
|
309
|
+
if (lowerCaseValue === '@meid') {
|
|
310
|
+
args.options[option] = utils_1.accessToken.getUserIdFromAccessToken(token);
|
|
311
|
+
}
|
|
312
|
+
if (lowerCaseValue === '@meusername') {
|
|
313
|
+
args.options[option] = utils_1.accessToken.getUserNameFromAccessToken(token);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
295
317
|
}
|
|
296
318
|
exports.default = Command;
|
|
297
319
|
//# sourceMappingURL=Command.js.map
|
|
@@ -96,13 +96,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
96
96
|
};
|
|
97
97
|
return request_1.default
|
|
98
98
|
.get(requestOptions)
|
|
99
|
-
.then((response) =>
|
|
100
|
-
const etag = response ? response['@odata.etag'] : undefined;
|
|
101
|
-
if (!etag) {
|
|
102
|
-
return Promise.reject(`Error fetching task details`);
|
|
103
|
-
}
|
|
104
|
-
return Promise.resolve(etag);
|
|
105
|
-
});
|
|
99
|
+
.then((response) => response['@odata.etag']);
|
|
106
100
|
}
|
|
107
101
|
generateAppliedCategories(options) {
|
|
108
102
|
if (!options.appliedCategories) {
|
|
@@ -46,13 +46,7 @@ class PlannerTaskReferenceAddCommand extends GraphCommand_1.default {
|
|
|
46
46
|
};
|
|
47
47
|
return request_1.default
|
|
48
48
|
.get(requestOptions)
|
|
49
|
-
.then((response) =>
|
|
50
|
-
const etag = response ? response['@odata.etag'] : undefined;
|
|
51
|
-
if (!etag) {
|
|
52
|
-
return Promise.reject(`Error fetching task details`);
|
|
53
|
-
}
|
|
54
|
-
return Promise.resolve(etag);
|
|
55
|
-
});
|
|
49
|
+
.then((response) => response['@odata.etag']);
|
|
56
50
|
}
|
|
57
51
|
options() {
|
|
58
52
|
const options = [
|
|
@@ -74,21 +74,18 @@ class PlannerTaskReferenceRemoveCommand extends GraphCommand_1.default {
|
|
|
74
74
|
let url = options.url;
|
|
75
75
|
return request_1.default
|
|
76
76
|
.get(requestOptions)
|
|
77
|
-
.then((
|
|
78
|
-
const etag = response ? response['@odata.etag'] : undefined;
|
|
79
|
-
if (!etag) {
|
|
80
|
-
return Promise.reject(`Error fetching task details`);
|
|
81
|
-
}
|
|
77
|
+
.then((taskDetails) => {
|
|
82
78
|
if (options.alias) {
|
|
83
|
-
const alias = options.alias;
|
|
84
79
|
const urls = [];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
if (taskDetails.references) {
|
|
81
|
+
Object.entries(taskDetails.references).forEach((ref) => {
|
|
82
|
+
var _a;
|
|
83
|
+
if (((_a = ref[1].alias) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === options.alias.toLocaleLowerCase()) {
|
|
84
|
+
urls.push(decodeURIComponent(ref[0]));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (urls.length === 0) {
|
|
92
89
|
return Promise.reject(`The specified reference with alias ${options.alias} does not exist`);
|
|
93
90
|
}
|
|
94
91
|
if (urls.length > 1) {
|
|
@@ -96,7 +93,7 @@ class PlannerTaskReferenceRemoveCommand extends GraphCommand_1.default {
|
|
|
96
93
|
}
|
|
97
94
|
url = urls[0];
|
|
98
95
|
}
|
|
99
|
-
return Promise.resolve({ etag, url });
|
|
96
|
+
return Promise.resolve({ etag: taskDetails['@odata.etag'], url });
|
|
100
97
|
});
|
|
101
98
|
}
|
|
102
99
|
options() {
|
|
@@ -112,13 +112,7 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
112
112
|
};
|
|
113
113
|
return request_1.default
|
|
114
114
|
.get(requestOptions)
|
|
115
|
-
.then((response) =>
|
|
116
|
-
const etag = response ? response['@odata.etag'] : undefined;
|
|
117
|
-
if (!etag) {
|
|
118
|
-
return Promise.reject(`Error fetching task details`);
|
|
119
|
-
}
|
|
120
|
-
return Promise.resolve(etag);
|
|
121
|
-
});
|
|
115
|
+
.then((response) => response['@odata.etag']);
|
|
122
116
|
}
|
|
123
117
|
getTaskEtag(taskId) {
|
|
124
118
|
const requestOptions = {
|
|
@@ -130,13 +124,7 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
130
124
|
};
|
|
131
125
|
return request_1.default
|
|
132
126
|
.get(requestOptions)
|
|
133
|
-
.then((response) =>
|
|
134
|
-
const etag = response ? response['@odata.etag'] : undefined;
|
|
135
|
-
if (!etag) {
|
|
136
|
-
return Promise.reject(`Error fetching task`);
|
|
137
|
-
}
|
|
138
|
-
return Promise.resolve(etag);
|
|
139
|
-
});
|
|
127
|
+
.then((response) => response['@odata.etag']);
|
|
140
128
|
}
|
|
141
129
|
generateAppliedCategories(options) {
|
|
142
130
|
if (!options.appliedCategories) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FN015008_FILE_eslintrc_js = void 0;
|
|
4
|
+
const utils_1 = require("../../../../../../utils");
|
|
4
5
|
const FileAddRemoveRule_1 = require("./FileAddRemoveRule");
|
|
5
6
|
class FN015008_FILE_eslintrc_js extends FileAddRemoveRule_1.FileAddRemoveRule {
|
|
6
7
|
constructor(add, contents) {
|
|
@@ -9,6 +10,12 @@ class FN015008_FILE_eslintrc_js extends FileAddRemoveRule_1.FileAddRemoveRule {
|
|
|
9
10
|
get id() {
|
|
10
11
|
return 'FN015008';
|
|
11
12
|
}
|
|
13
|
+
visit(project, notifications) {
|
|
14
|
+
if (utils_1.spfx.isReactProject(project)) {
|
|
15
|
+
this.contents = this.contents.replace('@microsoft/eslint-config-spfx/lib/profiles/default', '@microsoft/eslint-config-spfx/lib/profiles/react');
|
|
16
|
+
}
|
|
17
|
+
super.visit(project, notifications);
|
|
18
|
+
}
|
|
12
19
|
}
|
|
13
20
|
exports.FN015008_FILE_eslintrc_js = FN015008_FILE_eslintrc_js;
|
|
14
21
|
//# sourceMappingURL=FN015008_FILE_eslintrc_js.js.map
|
|
@@ -27,6 +27,7 @@ const FN002007_DEVDEP_ajv_1 = require("./rules/FN002007_DEVDEP_ajv");
|
|
|
27
27
|
const FN002009_DEVDEP_microsoft_sp_tslint_rules_1 = require("./rules/FN002009_DEVDEP_microsoft_sp_tslint_rules");
|
|
28
28
|
const FN002013_DEVDEP_types_webpack_env_1 = require("./rules/FN002013_DEVDEP_types_webpack_env");
|
|
29
29
|
const FN002018_DEVDEP_microsoft_rush_stack_compiler_3_9_1 = require("./rules/FN002018_DEVDEP_microsoft_rush_stack_compiler_3_9");
|
|
30
|
+
const FN002019_DEVDEP_spfx_fast_serve_helpers_1 = require("./rules/FN002019_DEVDEP_spfx_fast_serve_helpers");
|
|
30
31
|
const FN002020_DEVDEP_microsoft_rush_stack_compiler_4_5_1 = require("./rules/FN002020_DEVDEP_microsoft_rush_stack_compiler_4_5");
|
|
31
32
|
const FN002021_DEVDEP_rushstack_eslint_config_1 = require("./rules/FN002021_DEVDEP_rushstack_eslint_config");
|
|
32
33
|
const FN002022_DEVDEP_microsoft_eslint_plugin_spfx_1 = require("./rules/FN002022_DEVDEP_microsoft_eslint_plugin_spfx");
|
|
@@ -67,6 +68,7 @@ module.exports = [
|
|
|
67
68
|
new FN002009_DEVDEP_microsoft_sp_tslint_rules_1.FN002009_DEVDEP_microsoft_sp_tslint_rules('', false),
|
|
68
69
|
new FN002013_DEVDEP_types_webpack_env_1.FN002013_DEVDEP_types_webpack_env('1.15.2'),
|
|
69
70
|
new FN002018_DEVDEP_microsoft_rush_stack_compiler_3_9_1.FN002018_DEVDEP_microsoft_rush_stack_compiler_3_9('', false),
|
|
71
|
+
new FN002019_DEVDEP_spfx_fast_serve_helpers_1.FN002019_DEVDEP_spfx_fast_serve_helpers('1.15.2'),
|
|
70
72
|
new FN002020_DEVDEP_microsoft_rush_stack_compiler_4_5_1.FN002020_DEVDEP_microsoft_rush_stack_compiler_4_5('0.2.2'),
|
|
71
73
|
new FN002021_DEVDEP_rushstack_eslint_config_1.FN002021_DEVDEP_rushstack_eslint_config('2.5.1'),
|
|
72
74
|
new FN002022_DEVDEP_microsoft_eslint_plugin_spfx_1.FN002022_DEVDEP_microsoft_eslint_plugin_spfx('1.15.0'),
|
|
@@ -78,10 +80,10 @@ module.exports = [
|
|
|
78
80
|
new FN012017_TSC_extends_1.FN012017_TSC_extends('./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json'),
|
|
79
81
|
new FN015003_FILE_tslint_json_1.FN015003_FILE_tslint_json(false, ''),
|
|
80
82
|
new FN015008_FILE_eslintrc_js_1.FN015008_FILE_eslintrc_js(true, `require('@rushstack/eslint-config/patch/modern-module-resolution');
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
module.exports = {
|
|
84
|
+
extends: ['@microsoft/eslint-config-spfx/lib/profiles/default'],
|
|
85
|
+
parserOptions: { tsconfigRootDir: __dirname }
|
|
86
|
+
};`),
|
|
85
87
|
new FN023002_GITIGNORE_heft_1.FN023002_GITIGNORE_heft()
|
|
86
88
|
];
|
|
87
89
|
//# sourceMappingURL=upgrade-1.15.0.js.map
|
|
@@ -34,15 +34,7 @@ class TenantServiceAnnouncementHealthGetCommand extends GraphCommand_1.default {
|
|
|
34
34
|
},
|
|
35
35
|
responseType: 'json'
|
|
36
36
|
};
|
|
37
|
-
return request_1.default
|
|
38
|
-
.get(requestOptions)
|
|
39
|
-
.then(response => {
|
|
40
|
-
const serviceHealth = response;
|
|
41
|
-
if (!serviceHealth) {
|
|
42
|
-
return Promise.reject(`Error fetching service health`);
|
|
43
|
-
}
|
|
44
|
-
return Promise.resolve(serviceHealth);
|
|
45
|
-
});
|
|
37
|
+
return request_1.default.get(requestOptions);
|
|
46
38
|
}
|
|
47
39
|
options() {
|
|
48
40
|
const options = [
|
|
@@ -57,6 +57,24 @@ exports.accessToken = {
|
|
|
57
57
|
catch (_a) {
|
|
58
58
|
}
|
|
59
59
|
return userName;
|
|
60
|
+
},
|
|
61
|
+
getUserIdFromAccessToken(accessToken) {
|
|
62
|
+
let userId = '';
|
|
63
|
+
if (!accessToken || accessToken.length === 0) {
|
|
64
|
+
return userId;
|
|
65
|
+
}
|
|
66
|
+
const chunks = accessToken.split('.');
|
|
67
|
+
if (chunks.length !== 3) {
|
|
68
|
+
return userId;
|
|
69
|
+
}
|
|
70
|
+
const tokenString = Buffer.from(chunks[1], 'base64').toString();
|
|
71
|
+
try {
|
|
72
|
+
const token = JSON.parse(tokenString);
|
|
73
|
+
userId = token.oid;
|
|
74
|
+
}
|
|
75
|
+
catch (_a) {
|
|
76
|
+
}
|
|
77
|
+
return userId;
|
|
60
78
|
}
|
|
61
79
|
};
|
|
62
80
|
//# sourceMappingURL=accessToken.js.map
|
package/dist/utils/validation.js
CHANGED
|
@@ -6,8 +6,12 @@ exports.validation = {
|
|
|
6
6
|
return guids.every(guid => this.isValidGuid(guid));
|
|
7
7
|
},
|
|
8
8
|
isValidGuid(guid) {
|
|
9
|
+
if (!guid) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
9
12
|
const guidRegEx = new RegExp(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
|
|
10
|
-
|
|
13
|
+
// verify if the guid is a valid guid. @meid will be replaced in a later stage with the actual user id of the logged in user
|
|
14
|
+
return guidRegEx.test(guid) || guid.toLocaleLowerCase().trim() === "@meid";
|
|
11
15
|
},
|
|
12
16
|
isValidTeamsChannelId(guid) {
|
|
13
17
|
const guidRegEx = new RegExp(/^19:[0-9a-zA-Z-_]+@thread\.(skype|tacv2)$/i);
|
|
@@ -56,6 +56,18 @@ For the user with id _1caf7dcd-7e83-4c3a-94f7-932a1299c844_ retrieve the user na
|
|
|
56
56
|
m365 aad user get --id 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --properties "userPrincipalName,mail,displayName"
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
Get information about the currently logged user using the Id token
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
m365 aad user get --id "@meId"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Get information about the currently logged in user using the UserName token
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
m365 aad user get --userName "@meUserName"
|
|
69
|
+
```
|
|
70
|
+
|
|
59
71
|
## More information
|
|
60
72
|
|
|
61
73
|
- Microsoft Graph User properties: [https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties](https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/user#properties)
|
package/package.json
CHANGED