@pnp/cli-microsoft365 6.4.0-beta.3946b02 → 6.4.0-beta.91f8cd3
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/README.md +12 -1
- package/dist/m365/aad/commands/user/user-get.js +3 -0
- package/dist/m365/aad/commands/user/user-set.js +3 -0
- package/dist/m365/aad/commands/user/user-signin-list.js +3 -0
- package/dist/m365/flow/commands/owner/owner-add.js +147 -0
- package/dist/m365/flow/commands/owner/owner-remove.js +147 -0
- package/dist/m365/flow/commands/run/run-list.js +5 -2
- package/dist/m365/flow/commands.js +2 -0
- package/dist/m365/planner/commands/roster/roster-member-add.js +3 -0
- package/dist/m365/planner/commands/roster/roster-member-get.js +98 -0
- package/dist/m365/planner/commands.js +1 -0
- package/dist/m365/spfx/commands/spfx-doctor.js +43 -29
- package/dist/m365/spo/commands/customaction/customaction-get.js +27 -7
- package/dist/m365/spo/commands/file/file-move.js +1 -1
- package/dist/m365/spo/commands/list/list-add.js +11 -8
- package/dist/m365/spo/commands/list/list-set.js +3 -3
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +118 -0
- package/dist/m365/spo/commands.js +1 -0
- package/dist/utils/aadGroup.js +18 -0
- package/dist/utils/md.js +7 -0
- package/dist/utils/spo.js +14 -0
- package/docs/docs/cmd/flow/owner/owner-add.md +61 -0
- package/docs/docs/cmd/flow/owner/owner-remove.md +67 -0
- package/docs/docs/cmd/flow/run/run-list.md +28 -0
- package/docs/docs/cmd/onenote/page/page-list.md +1 -1
- package/docs/docs/cmd/outlook/mail/mail-send.md +4 -0
- package/docs/docs/cmd/outlook/message/message-get.md +143 -0
- package/docs/docs/cmd/outlook/message/message-list.md +119 -0
- package/docs/docs/cmd/outlook/message/message-move.md +4 -0
- package/docs/docs/cmd/outlook/report/report-mailactivitycounts.md +40 -0
- package/docs/docs/cmd/outlook/report/report-mailactivityusercounts.md +40 -0
- package/docs/docs/cmd/outlook/report/report-mailactivityuserdetail.md +45 -0
- package/docs/docs/cmd/outlook/report/report-mailappusageappsusercounts.md +43 -0
- package/docs/docs/cmd/outlook/report/report-mailappusageusercounts.md +44 -0
- package/docs/docs/cmd/outlook/report/report-mailappusageuserdetail.md +48 -0
- package/docs/docs/cmd/outlook/report/report-mailappusageversionsusercounts.md +41 -0
- package/docs/docs/cmd/outlook/report/report-mailboxusagedetail.md +49 -0
- package/docs/docs/cmd/outlook/report/report-mailboxusagemailboxcount.md +37 -0
- package/docs/docs/cmd/outlook/report/report-mailboxusagequotastatusmailboxcounts.md +40 -0
- package/docs/docs/cmd/outlook/report/report-mailboxusagestorage.md +36 -0
- package/docs/docs/cmd/outlook/room/room-list.md +81 -0
- package/docs/docs/cmd/outlook/roomlist/roomlist-list.md +58 -0
- package/docs/docs/cmd/planner/plan/plan-add.md +3 -3
- package/docs/docs/cmd/planner/plan/plan-set.md +73 -7
- package/docs/docs/cmd/planner/roster/roster-add.md +16 -1
- package/docs/docs/cmd/planner/roster/roster-member-get.md +87 -0
- package/docs/docs/cmd/planner/task/task-add.md +230 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-add.md +55 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-list.md +55 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-remove.md +4 -0
- package/docs/docs/cmd/planner/task/task-get.md +131 -0
- package/docs/docs/cmd/planner/task/task-list.md +92 -0
- package/docs/docs/cmd/planner/task/task-reference-add.md +46 -0
- package/docs/docs/cmd/planner/task/task-reference-list.md +46 -0
- package/docs/docs/cmd/planner/task/task-reference-remove.md +4 -0
- package/docs/docs/cmd/planner/task/task-remove.md +4 -0
- package/docs/docs/cmd/planner/task/task-set.md +230 -0
- package/docs/docs/cmd/planner/tenant/tenant-settings-list.md +55 -0
- package/docs/docs/cmd/planner/tenant/tenant-settings-set.md +55 -0
- package/docs/docs/cmd/pp/card/card-get.md +2 -2
- package/docs/docs/cmd/pp/card/card-list.md +2 -2
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +7 -7
- package/docs/docs/cmd/skype/report/report-activitycounts.md +38 -0
- package/docs/docs/cmd/skype/report/report-activityusercounts.md +38 -0
- package/docs/docs/cmd/skype/report/report-activityuserdetail.md +67 -0
- package/docs/docs/cmd/spo/customaction/customaction-get.md +113 -11
- package/docs/docs/cmd/spo/list/list-add.md +2 -2
- package/docs/docs/cmd/spo/list/list-set.md +2 -2
- package/docs/docs/cmd/spo/listitem/listitem-add.md +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-batch-add.md +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-set.md +1 -1
- package/docs/docs/cmd/spo/site/site-set.md +2 -2
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.md +142 -0
- package/docs/docs/cmd/spo/term/term-list.md +1 -1
- package/docs/docs/cmd/teams/channel/channel-get.md +1 -1
- package/docs/docs/cmd/teams/message/message-get.md +39 -4
- package/docs/docs/cmd/teams/message/message-list.md +41 -6
- package/docs/docs/cmd/teams/message/message-reply-list.md +39 -4
- package/docs/docs/cmd/teams/messagingsettings/messagingsettings-list.md +20 -2
- package/docs/docs/cmd/teams/messagingsettings/messagingsettings-set.md +8 -8
- package/docs/docs/cmd/teams/report/report-deviceusagedistributionusercounts.md +12 -5
- package/docs/docs/cmd/teams/report/report-deviceusageusercounts.md +13 -6
- package/docs/docs/cmd/teams/report/report-deviceusageuserdetail.md +14 -7
- package/docs/docs/cmd/teams/report/report-directroutingcalls.md +13 -6
- package/docs/docs/cmd/teams/report/report-pstncalls.md +13 -6
- package/docs/docs/cmd/teams/report/report-useractivitycounts.md +13 -6
- package/docs/docs/cmd/teams/report/report-useractivityusercounts.md +13 -6
- package/docs/docs/cmd/teams/report/report-useractivityuserdetail.md +13 -6
- package/docs/docs/cmd/teams/tab/tab-add.md +16 -0
- package/docs/docs/cmd/teams/tab/tab-get.md +17 -0
- package/docs/docs/cmd/teams/tab/tab-list.md +19 -0
- package/docs/docs/cmd/teams/team/team-add.md +77 -8
- package/docs/docs/cmd/teams/team/team-app-list.md +18 -2
- package/docs/docs/cmd/teams/team/team-archive.md +2 -2
- package/docs/docs/cmd/teams/team/team-clone.md +8 -8
- package/docs/docs/cmd/teams/team/team-get.md +34 -4
- package/docs/docs/cmd/teams/team/team-list.md +34 -3
- package/docs/docs/cmd/teams/team/team-remove.md +3 -3
- package/docs/docs/cmd/teams/team/team-set.md +8 -8
- package/docs/docs/cmd/teams/team/team-unarchive.md +3 -2
- package/docs/docs/cmd/teams/user/user-app-add.md +3 -3
- package/docs/docs/cmd/teams/user/user-app-list.md +18 -2
- package/docs/docs/cmd/teams/user/user-app-remove.md +4 -4
- package/docs/docs/cmd/teams/user/user-list.md +21 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
alt="GitHub" />
|
|
16
16
|
</a>
|
|
17
17
|
|
|
18
|
-
<a href="https://discord.
|
|
18
|
+
<a href="https://discord.gg/35HTFJ544b">
|
|
19
19
|
<img src="https://img.shields.io/badge/Discord-Join-7289da?style=flat-square"
|
|
20
20
|
alt="Discord" />
|
|
21
21
|
</a>
|
|
@@ -213,6 +213,17 @@ If you want to get involved with helping us grow the CLI, whether that is sugges
|
|
|
213
213
|
|
|
214
214
|
Checkout our [Wiki](https://github.com/pnp/cli-microsoft365/wiki) for guides on how to contribute to this project.
|
|
215
215
|
|
|
216
|
+
## Need Help?
|
|
217
|
+
|
|
218
|
+
<h4 align="center">
|
|
219
|
+
Join our community
|
|
220
|
+
</h4>
|
|
221
|
+
<p align="center">
|
|
222
|
+
<a href="https://discord.gg/35HTFJ544b">
|
|
223
|
+
<img alt="Discord" src="./docs/docs/images/discord-logo.png" width="100"/>
|
|
224
|
+
</a>
|
|
225
|
+
</p>
|
|
226
|
+
|
|
216
227
|
## Microsoft 365 Platform Community
|
|
217
228
|
|
|
218
229
|
CLI for Microsoft 365 is a [Microsoft 365 Platform Community](https://pnp.github.io) (PnP) project. Microsoft 365 Platform Community is a virtual team consisting of Microsoft employees and community members focused on helping the community make the best use of Microsoft products. CLI for Microsoft 365 is an open-source project not affiliated with Microsoft and not covered by Microsoft support. If you experience any issues using the CLI, please submit an issue in the [issues list](https://github.com/pnp/cli-microsoft365/issues).
|
|
@@ -101,6 +101,9 @@ _AadUserGetCommand_instances = new WeakSet(), _AadUserGetCommand_initTelemetry =
|
|
|
101
101
|
!validation_1.validation.isValidGuid(args.options.id)) {
|
|
102
102
|
return `${args.options.id} is not a valid GUID`;
|
|
103
103
|
}
|
|
104
|
+
if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
|
|
105
|
+
return `${args.options.userName} is not a valid userName`;
|
|
106
|
+
}
|
|
104
107
|
return true;
|
|
105
108
|
}));
|
|
106
109
|
}, _AadUserGetCommand_initOptionSets = function _AadUserGetCommand_initOptionSets() {
|
|
@@ -170,6 +170,9 @@ _AadUserSetCommand_instances = new WeakSet(), _AadUserSetCommand_initTelemetry =
|
|
|
170
170
|
!validation_1.validation.isValidGuid(args.options.objectId)) {
|
|
171
171
|
return `${args.options.objectId} is not a valid GUID`;
|
|
172
172
|
}
|
|
173
|
+
if (args.options.userPrincipalName && !validation_1.validation.isValidUserPrincipalName(args.options.userPrincipalName)) {
|
|
174
|
+
return `${args.options.userPrincipalName} is not a valid userPrincipalName`;
|
|
175
|
+
}
|
|
173
176
|
if (!args.options.resetPassword && ((args.options.currentPassword && !args.options.newPassword) || (args.options.newPassword && !args.options.currentPassword))) {
|
|
174
177
|
return `Specify both currentPassword and newPassword when you want to change your password`;
|
|
175
178
|
}
|
|
@@ -90,6 +90,9 @@ _AadUserSigninListCommand_instances = new WeakSet(), _AadUserSigninListCommand_i
|
|
|
90
90
|
if (args.options.appId && args.options.appDisplayName) {
|
|
91
91
|
return 'Specify either appId or appDisplayName, but not both';
|
|
92
92
|
}
|
|
93
|
+
if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
|
|
94
|
+
return `${args.options.userName} is not a valid userName`;
|
|
95
|
+
}
|
|
93
96
|
if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
|
|
94
97
|
return `${args.options.userId} is not a valid GUID`;
|
|
95
98
|
}
|
|
@@ -0,0 +1,147 @@
|
|
|
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 _FlowOwnerAddCommand_instances, _FlowOwnerAddCommand_initTelemetry, _FlowOwnerAddCommand_initOptions, _FlowOwnerAddCommand_initOptionSets, _FlowOwnerAddCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
20
|
+
const aadUser_1 = require("../../../../utils/aadUser");
|
|
21
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
22
|
+
const validation_1 = require("../../../../utils/validation");
|
|
23
|
+
const AzmgmtCommand_1 = require("../../../base/AzmgmtCommand");
|
|
24
|
+
const commands_1 = require("../../commands");
|
|
25
|
+
class FlowOwnerAddCommand extends AzmgmtCommand_1.default {
|
|
26
|
+
get name() {
|
|
27
|
+
return commands_1.default.OWNER_ADD;
|
|
28
|
+
}
|
|
29
|
+
get description() {
|
|
30
|
+
return 'Assigns permissions to a Power Automate flow';
|
|
31
|
+
}
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
_FlowOwnerAddCommand_instances.add(this);
|
|
35
|
+
__classPrivateFieldGet(this, _FlowOwnerAddCommand_instances, "m", _FlowOwnerAddCommand_initTelemetry).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _FlowOwnerAddCommand_instances, "m", _FlowOwnerAddCommand_initOptions).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _FlowOwnerAddCommand_instances, "m", _FlowOwnerAddCommand_initValidators).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _FlowOwnerAddCommand_instances, "m", _FlowOwnerAddCommand_initOptionSets).call(this);
|
|
39
|
+
}
|
|
40
|
+
commandAction(logger, args) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
if (this.verbose) {
|
|
44
|
+
logger.logToStderr(`Assigning permissions for ${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName} with permissions ${args.options.roleName} to Power Automate flow ${args.options.flowName}`);
|
|
45
|
+
}
|
|
46
|
+
let id = '';
|
|
47
|
+
if (args.options.userId) {
|
|
48
|
+
id = args.options.userId;
|
|
49
|
+
}
|
|
50
|
+
else if (args.options.userName) {
|
|
51
|
+
id = yield aadUser_1.aadUser.getUserIdByUpn(args.options.userName);
|
|
52
|
+
}
|
|
53
|
+
else if (args.options.groupId) {
|
|
54
|
+
id = args.options.groupId;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
id = yield aadGroup_1.aadGroup.getGroupIdByDisplayName(args.options.groupName);
|
|
58
|
+
}
|
|
59
|
+
let type;
|
|
60
|
+
if (args.options.userId || args.options.userName) {
|
|
61
|
+
type = 'User';
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
type = 'Group';
|
|
65
|
+
}
|
|
66
|
+
const requestOptions = {
|
|
67
|
+
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/modifyPermissions?api-version=2016-11-01`,
|
|
68
|
+
headers: {
|
|
69
|
+
accept: 'application/json'
|
|
70
|
+
},
|
|
71
|
+
data: {
|
|
72
|
+
put: [
|
|
73
|
+
{
|
|
74
|
+
properties: {
|
|
75
|
+
principal: {
|
|
76
|
+
id: id,
|
|
77
|
+
type: type
|
|
78
|
+
},
|
|
79
|
+
roleName: args.options.roleName
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
responseType: 'json'
|
|
85
|
+
};
|
|
86
|
+
yield request_1.default.post(requestOptions);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
this.handleRejectedODataJsonPromise(err);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
_FlowOwnerAddCommand_instances = new WeakSet(), _FlowOwnerAddCommand_initTelemetry = function _FlowOwnerAddCommand_initTelemetry() {
|
|
95
|
+
this.telemetry.push((args) => {
|
|
96
|
+
Object.assign(this.telemetryProperties, {
|
|
97
|
+
asAdmin: !!args.options.asAdmin,
|
|
98
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
99
|
+
userName: typeof args.options.userName !== 'undefined',
|
|
100
|
+
groupId: typeof args.options.groupId !== 'undefined',
|
|
101
|
+
groupName: typeof args.options.groupName !== 'undefined'
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}, _FlowOwnerAddCommand_initOptions = function _FlowOwnerAddCommand_initOptions() {
|
|
105
|
+
this.options.unshift({
|
|
106
|
+
option: '-e, --environmentName <environmentName>'
|
|
107
|
+
}, {
|
|
108
|
+
option: '-f, --flowName <flowName>'
|
|
109
|
+
}, {
|
|
110
|
+
option: '--userId [userId]'
|
|
111
|
+
}, {
|
|
112
|
+
option: '--userName [userName]'
|
|
113
|
+
}, {
|
|
114
|
+
option: '--groupId [groupId]'
|
|
115
|
+
}, {
|
|
116
|
+
option: '--groupName [groupName]'
|
|
117
|
+
}, {
|
|
118
|
+
option: '--roleName <roleName>',
|
|
119
|
+
autocomplete: FlowOwnerAddCommand.allowedRoleNames
|
|
120
|
+
}, {
|
|
121
|
+
option: '--asAdmin'
|
|
122
|
+
});
|
|
123
|
+
}, _FlowOwnerAddCommand_initOptionSets = function _FlowOwnerAddCommand_initOptionSets() {
|
|
124
|
+
this.optionSets.push({ options: ['userId', 'userName', 'groupId', 'groupName'] });
|
|
125
|
+
}, _FlowOwnerAddCommand_initValidators = function _FlowOwnerAddCommand_initValidators() {
|
|
126
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
if (!validation_1.validation.isValidGuid(args.options.flowName)) {
|
|
128
|
+
return `${args.options.flowName} is not a valid GUID.`;
|
|
129
|
+
}
|
|
130
|
+
if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
|
|
131
|
+
return `${args.options.userId} is not a valid GUID.`;
|
|
132
|
+
}
|
|
133
|
+
if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
|
|
134
|
+
return `${args.options.userName} is not a valid userName.`;
|
|
135
|
+
}
|
|
136
|
+
if (args.options.groupId && !validation_1.validation.isValidGuid(args.options.groupId)) {
|
|
137
|
+
return `${args.options.groupId} is not a valid GUID.`;
|
|
138
|
+
}
|
|
139
|
+
if (FlowOwnerAddCommand.allowedRoleNames.indexOf(args.options.roleName) === -1) {
|
|
140
|
+
return `${args.options.roleName} is not a valid roleName. Valid values are: ${FlowOwnerAddCommand.allowedRoleNames.join(', ')}`;
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
}));
|
|
144
|
+
};
|
|
145
|
+
FlowOwnerAddCommand.allowedRoleNames = ['CanView', 'CanEdit'];
|
|
146
|
+
module.exports = new FlowOwnerAddCommand();
|
|
147
|
+
//# sourceMappingURL=owner-add.js.map
|
|
@@ -0,0 +1,147 @@
|
|
|
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 _FlowOwnerRemoveCommand_instances, _FlowOwnerRemoveCommand_initTelemetry, _FlowOwnerRemoveCommand_initOptions, _FlowOwnerRemoveCommand_initValidators, _FlowOwnerRemoveCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
21
|
+
const aadUser_1 = require("../../../../utils/aadUser");
|
|
22
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
23
|
+
const validation_1 = require("../../../../utils/validation");
|
|
24
|
+
const AzmgmtCommand_1 = require("../../../base/AzmgmtCommand");
|
|
25
|
+
const commands_1 = require("../../commands");
|
|
26
|
+
class FlowOwnerRemoveCommand extends AzmgmtCommand_1.default {
|
|
27
|
+
get name() {
|
|
28
|
+
return commands_1.default.OWNER_REMOVE;
|
|
29
|
+
}
|
|
30
|
+
get description() {
|
|
31
|
+
return 'Removes owner permissions to a Power Automate flow';
|
|
32
|
+
}
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
_FlowOwnerRemoveCommand_instances.add(this);
|
|
36
|
+
__classPrivateFieldGet(this, _FlowOwnerRemoveCommand_instances, "m", _FlowOwnerRemoveCommand_initTelemetry).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _FlowOwnerRemoveCommand_instances, "m", _FlowOwnerRemoveCommand_initOptions).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _FlowOwnerRemoveCommand_instances, "m", _FlowOwnerRemoveCommand_initValidators).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _FlowOwnerRemoveCommand_instances, "m", _FlowOwnerRemoveCommand_initOptionSets).call(this);
|
|
40
|
+
}
|
|
41
|
+
commandAction(logger, args) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
if (this.verbose) {
|
|
45
|
+
logger.logToStderr(`Removing owner ${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName} from flow ${args.options.flowName} in environment ${args.options.environmentName}`);
|
|
46
|
+
}
|
|
47
|
+
const removeFlowOwner = () => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
let idToRemove = '';
|
|
49
|
+
if (args.options.userId) {
|
|
50
|
+
idToRemove = args.options.userId;
|
|
51
|
+
}
|
|
52
|
+
else if (args.options.userName) {
|
|
53
|
+
idToRemove = yield aadUser_1.aadUser.getUserIdByUpn(args.options.userName);
|
|
54
|
+
}
|
|
55
|
+
else if (args.options.groupId) {
|
|
56
|
+
idToRemove = args.options.groupId;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
idToRemove = yield aadGroup_1.aadGroup.getGroupIdByDisplayName(args.options.groupName);
|
|
60
|
+
}
|
|
61
|
+
const requestOptions = {
|
|
62
|
+
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/modifyPermissions?api-version=2016-11-01`,
|
|
63
|
+
headers: {
|
|
64
|
+
accept: 'application/json'
|
|
65
|
+
},
|
|
66
|
+
data: {
|
|
67
|
+
delete: [
|
|
68
|
+
{
|
|
69
|
+
id: idToRemove
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
responseType: 'json'
|
|
74
|
+
};
|
|
75
|
+
yield request_1.default.post(requestOptions);
|
|
76
|
+
});
|
|
77
|
+
if (args.options.confirm) {
|
|
78
|
+
yield removeFlowOwner();
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const result = yield Cli_1.Cli.prompt({
|
|
82
|
+
type: 'confirm',
|
|
83
|
+
name: 'continue',
|
|
84
|
+
default: false,
|
|
85
|
+
message: `Are you sure you want to remove owner '${args.options.groupId || args.options.groupName || args.options.userId || args.options.userName}' from the specified flow?`
|
|
86
|
+
});
|
|
87
|
+
if (result.continue) {
|
|
88
|
+
yield removeFlowOwner();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
this.handleRejectedODataJsonPromise(err);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
_FlowOwnerRemoveCommand_instances = new WeakSet(), _FlowOwnerRemoveCommand_initTelemetry = function _FlowOwnerRemoveCommand_initTelemetry() {
|
|
99
|
+
this.telemetry.push((args) => {
|
|
100
|
+
Object.assign(this.telemetryProperties, {
|
|
101
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
102
|
+
userName: typeof args.options.userName !== 'undefined',
|
|
103
|
+
groupId: typeof args.options.groupId !== 'undefined',
|
|
104
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
105
|
+
asAdmin: !!args.options.asAdmin,
|
|
106
|
+
confirm: !!args.options.confirm
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}, _FlowOwnerRemoveCommand_initOptions = function _FlowOwnerRemoveCommand_initOptions() {
|
|
110
|
+
this.options.unshift({
|
|
111
|
+
option: '-e, --environmentName <environmentName>'
|
|
112
|
+
}, {
|
|
113
|
+
option: '-f, --flowName <flowName>'
|
|
114
|
+
}, {
|
|
115
|
+
option: '--userId [userId]'
|
|
116
|
+
}, {
|
|
117
|
+
option: '--userName [userName]'
|
|
118
|
+
}, {
|
|
119
|
+
option: '--groupId [groupId]'
|
|
120
|
+
}, {
|
|
121
|
+
option: '--groupName [groupName]'
|
|
122
|
+
}, {
|
|
123
|
+
option: '--asAdmin'
|
|
124
|
+
}, {
|
|
125
|
+
option: '--confirm'
|
|
126
|
+
});
|
|
127
|
+
}, _FlowOwnerRemoveCommand_initValidators = function _FlowOwnerRemoveCommand_initValidators() {
|
|
128
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
if (!validation_1.validation.isValidGuid(args.options.flowName)) {
|
|
130
|
+
return `${args.options.flowName} is not a valid GUID.`;
|
|
131
|
+
}
|
|
132
|
+
if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
|
|
133
|
+
return `${args.options.userId} is not a valid GUID.`;
|
|
134
|
+
}
|
|
135
|
+
if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
|
|
136
|
+
return `${args.options.userName} is not a valid userName.`;
|
|
137
|
+
}
|
|
138
|
+
if (args.options.groupId && !validation_1.validation.isValidGuid(args.options.groupId)) {
|
|
139
|
+
return `${args.options.groupId} is not a valid GUID.`;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}));
|
|
143
|
+
}, _FlowOwnerRemoveCommand_initOptionSets = function _FlowOwnerRemoveCommand_initOptionSets() {
|
|
144
|
+
this.optionSets.push({ options: ['userId', 'userName', 'groupId', 'groupName'] });
|
|
145
|
+
};
|
|
146
|
+
module.exports = new FlowOwnerRemoveCommand();
|
|
147
|
+
//# sourceMappingURL=owner-remove.js.map
|
|
@@ -42,7 +42,7 @@ class FlowRunListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand
|
|
|
42
42
|
if (this.verbose) {
|
|
43
43
|
logger.logToStderr(`Retrieving list of runs for Microsoft Flow ${args.options.flowName}...`);
|
|
44
44
|
}
|
|
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`;
|
|
45
|
+
let url = `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/runs?api-version=2016-11-01`;
|
|
46
46
|
const filters = this.getFilters(args.options);
|
|
47
47
|
if (filters.length > 0) {
|
|
48
48
|
url += `&$filter=${filters.join(' and ')}`;
|
|
@@ -86,7 +86,8 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
|
|
|
86
86
|
Object.assign(this.telemetryProperties, {
|
|
87
87
|
status: typeof args.options.status !== 'undefined',
|
|
88
88
|
triggerStartTime: typeof args.options.triggerStartTime !== 'undefined',
|
|
89
|
-
triggerEndTime: typeof args.options.triggerEndTime !== 'undefined'
|
|
89
|
+
triggerEndTime: typeof args.options.triggerEndTime !== 'undefined',
|
|
90
|
+
asAdmin: !!args.options.asAdmin
|
|
90
91
|
});
|
|
91
92
|
});
|
|
92
93
|
}, _FlowRunListCommand_initOptions = function _FlowRunListCommand_initOptions() {
|
|
@@ -101,6 +102,8 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
|
|
|
101
102
|
option: '--triggerStartTime [triggerStartTime]'
|
|
102
103
|
}, {
|
|
103
104
|
option: '--triggerEndTime [triggerEndTime]'
|
|
105
|
+
}, {
|
|
106
|
+
option: '--asAdmin'
|
|
104
107
|
});
|
|
105
108
|
}, _FlowRunListCommand_initValidators = function _FlowRunListCommand_initValidators() {
|
|
106
109
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -11,7 +11,9 @@ exports.default = {
|
|
|
11
11
|
EXPORT: `${prefix} export`,
|
|
12
12
|
GET: `${prefix} get`,
|
|
13
13
|
LIST: `${prefix} list`,
|
|
14
|
+
OWNER_ADD: `${prefix} owner add`,
|
|
14
15
|
OWNER_LIST: `${prefix} owner list`,
|
|
16
|
+
OWNER_REMOVE: `${prefix} owner remove`,
|
|
15
17
|
REMOVE: `${prefix} remove`,
|
|
16
18
|
RUN_CANCEL: `${prefix} run cancel`,
|
|
17
19
|
RUN_GET: `${prefix} run get`,
|
|
@@ -106,6 +106,9 @@ _PlannerRosterMemberAddCommand_instances = new WeakSet(), _PlannerRosterMemberAd
|
|
|
106
106
|
if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
|
|
107
107
|
return `${args.options.userId} is not a valid GUID`;
|
|
108
108
|
}
|
|
109
|
+
if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
|
|
110
|
+
return `${args.options.userName} is not a valid user principal name (UPN)`;
|
|
111
|
+
}
|
|
109
112
|
return true;
|
|
110
113
|
}));
|
|
111
114
|
};
|
|
@@ -0,0 +1,98 @@
|
|
|
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 _PlannerRosterMemberGetCommand_instances, _PlannerRosterMemberGetCommand_initTelemetry, _PlannerRosterMemberGetCommand_initOptions, _PlannerRosterMemberGetCommand_initOptionSets, _PlannerRosterMemberGetCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const validation_1 = require("../../../../utils/validation");
|
|
20
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
21
|
+
const commands_1 = require("../../commands");
|
|
22
|
+
const aadUser_1 = require("../../../../utils/aadUser");
|
|
23
|
+
class PlannerRosterMemberGetCommand extends GraphCommand_1.default {
|
|
24
|
+
get name() {
|
|
25
|
+
return commands_1.default.ROSTER_MEMBER_GET;
|
|
26
|
+
}
|
|
27
|
+
get description() {
|
|
28
|
+
return 'Gets a member of the specified Microsoft Planner Roster';
|
|
29
|
+
}
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
_PlannerRosterMemberGetCommand_instances.add(this);
|
|
33
|
+
__classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initTelemetry).call(this);
|
|
34
|
+
__classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initOptions).call(this);
|
|
35
|
+
__classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initValidators).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initOptionSets).call(this);
|
|
37
|
+
}
|
|
38
|
+
commandAction(logger, args) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (this.verbose) {
|
|
41
|
+
logger.logToStderr(`Retrieving member ${args.options.userName || args.options.userId} from the Microsoft Planner Roster`);
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const userId = yield this.getUserId(args);
|
|
45
|
+
const requestOptions = {
|
|
46
|
+
url: `${this.resource}/beta/planner/rosters/${args.options.rosterId}/members/${userId}`,
|
|
47
|
+
headers: {
|
|
48
|
+
accept: 'application/json;odata.metadata=none'
|
|
49
|
+
},
|
|
50
|
+
responseType: 'json'
|
|
51
|
+
};
|
|
52
|
+
const response = yield request_1.default.get(requestOptions);
|
|
53
|
+
logger.log(response);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
this.handleRejectedODataJsonPromise(err);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
getUserId(args) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
if (args.options.userId) {
|
|
63
|
+
return args.options.userId;
|
|
64
|
+
}
|
|
65
|
+
return aadUser_1.aadUser.getUserIdByUpn(args.options.userName);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
_PlannerRosterMemberGetCommand_instances = new WeakSet(), _PlannerRosterMemberGetCommand_initTelemetry = function _PlannerRosterMemberGetCommand_initTelemetry() {
|
|
70
|
+
this.telemetry.push((args) => {
|
|
71
|
+
Object.assign(this.telemetryProperties, {
|
|
72
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
73
|
+
userName: typeof args.options.userName !== 'undefined'
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}, _PlannerRosterMemberGetCommand_initOptions = function _PlannerRosterMemberGetCommand_initOptions() {
|
|
77
|
+
this.options.unshift({
|
|
78
|
+
option: '--rosterId <rosterId>'
|
|
79
|
+
}, {
|
|
80
|
+
option: '--userId [userId]'
|
|
81
|
+
}, {
|
|
82
|
+
option: '--userName [userName]'
|
|
83
|
+
});
|
|
84
|
+
}, _PlannerRosterMemberGetCommand_initOptionSets = function _PlannerRosterMemberGetCommand_initOptionSets() {
|
|
85
|
+
this.optionSets.push({ options: ['userId', 'userName'] });
|
|
86
|
+
}, _PlannerRosterMemberGetCommand_initValidators = function _PlannerRosterMemberGetCommand_initValidators() {
|
|
87
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
|
|
89
|
+
return `${args.options.userId} is not a valid GUID`;
|
|
90
|
+
}
|
|
91
|
+
if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
|
|
92
|
+
return `${args.options.userName} is not a valid userName`;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
}));
|
|
96
|
+
};
|
|
97
|
+
module.exports = new PlannerRosterMemberGetCommand();
|
|
98
|
+
//# sourceMappingURL=roster-member-get.js.map
|
|
@@ -15,6 +15,7 @@ exports.default = {
|
|
|
15
15
|
ROSTER_ADD: `${prefix} roster add`,
|
|
16
16
|
ROSTER_GET: `${prefix} roster get`,
|
|
17
17
|
ROSTER_MEMBER_ADD: `${prefix} roster member add`,
|
|
18
|
+
ROSTER_MEMBER_GET: `${prefix} roster member get`,
|
|
18
19
|
ROSTER_MEMBER_LIST: `${prefix} roster member list`,
|
|
19
20
|
ROSTER_MEMBER_REMOVE: `${prefix} roster member remove`,
|
|
20
21
|
ROSTER_REMOVE: `${prefix} roster remove`,
|
|
@@ -18,8 +18,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
const chalk = require("chalk");
|
|
19
19
|
const child_process = require("child_process");
|
|
20
20
|
const semver_1 = require("semver");
|
|
21
|
-
const AnonymousCommand_1 = require("../../base/AnonymousCommand");
|
|
22
21
|
const commands_1 = require("../commands");
|
|
22
|
+
const base_project_command_1 = require("./project/base-project-command");
|
|
23
23
|
/**
|
|
24
24
|
* Has the particular check passed or failed
|
|
25
25
|
*/
|
|
@@ -64,7 +64,7 @@ var SharePointVersion;
|
|
|
64
64
|
SharePointVersion[SharePointVersion["SPO"] = 4] = "SPO";
|
|
65
65
|
SharePointVersion[SharePointVersion["All"] = 7] = "All";
|
|
66
66
|
})(SharePointVersion || (SharePointVersion = {}));
|
|
67
|
-
class SpfxDoctorCommand extends
|
|
67
|
+
class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
68
68
|
get allowedOutputs() {
|
|
69
69
|
return ['text'];
|
|
70
70
|
}
|
|
@@ -479,6 +479,7 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
|
|
|
479
479
|
if (!args.options.output) {
|
|
480
480
|
args.options.output = 'text';
|
|
481
481
|
}
|
|
482
|
+
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
482
483
|
logger.log(' ');
|
|
483
484
|
logger.log('CLI for Microsoft 365 SharePoint Framework doctor');
|
|
484
485
|
logger.log('Verifying configuration of your system for working with the SharePoint Framework');
|
|
@@ -557,9 +558,11 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
|
|
|
557
558
|
});
|
|
558
559
|
}
|
|
559
560
|
checkSharePointFrameworkVersion(spfxVersionRequested, fixes, logger) {
|
|
560
|
-
return this
|
|
561
|
-
|
|
562
|
-
|
|
561
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
562
|
+
let spfxVersionDetected = this.getSPFxVersionFromYoRcFile(logger);
|
|
563
|
+
if (!spfxVersionDetected) {
|
|
564
|
+
spfxVersionDetected = yield this.getPackageVersion('@microsoft/generator-sharepoint', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger);
|
|
565
|
+
}
|
|
563
566
|
const versionCheck = {
|
|
564
567
|
range: spfxVersionRequested,
|
|
565
568
|
fix: `npm i -g @microsoft/generator-sharepoint@${spfxVersionRequested}`
|
|
@@ -625,39 +628,50 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
|
|
|
625
628
|
spVersionStringToEnum(sp) {
|
|
626
629
|
return SharePointVersion[sp.toUpperCase()];
|
|
627
630
|
}
|
|
631
|
+
getSPFxVersionFromYoRcFile(logger) {
|
|
632
|
+
if (this.projectRootPath !== null) {
|
|
633
|
+
const spfxVersion = this.getProjectVersion();
|
|
634
|
+
if (spfxVersion) {
|
|
635
|
+
if (this.debug) {
|
|
636
|
+
logger.logToStderr(`SPFx version retrieved from .yo-rc.json file. Retrieved version: ${spfxVersion}`);
|
|
637
|
+
}
|
|
638
|
+
return spfxVersion;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return undefined;
|
|
642
|
+
}
|
|
628
643
|
getSharePointFrameworkVersion(logger) {
|
|
629
|
-
return
|
|
630
|
-
|
|
631
|
-
|
|
644
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
645
|
+
let spfxVersion = this.getSPFxVersionFromYoRcFile(logger);
|
|
646
|
+
if (spfxVersion) {
|
|
647
|
+
return spfxVersion;
|
|
632
648
|
}
|
|
633
|
-
|
|
634
|
-
.getPackageVersion('@microsoft/sp-core-library', PackageSearchMode.LocalOnly, HandlePromise.Fail, logger)
|
|
635
|
-
.then((version) => {
|
|
649
|
+
try {
|
|
650
|
+
spfxVersion = yield this.getPackageVersion('@microsoft/sp-core-library', PackageSearchMode.LocalOnly, HandlePromise.Fail, logger);
|
|
636
651
|
if (this.debug) {
|
|
637
|
-
logger.logToStderr(`Found @microsoft/sp-core-library@${
|
|
652
|
+
logger.logToStderr(`Found @microsoft/sp-core-library@${spfxVersion}`);
|
|
638
653
|
}
|
|
639
|
-
return
|
|
640
|
-
}
|
|
641
|
-
|
|
654
|
+
return spfxVersion;
|
|
655
|
+
}
|
|
656
|
+
catch (_a) {
|
|
642
657
|
if (this.debug) {
|
|
643
658
|
logger.logToStderr(`@microsoft/sp-core-library not found. Search for @microsoft/generator-sharepoint local or global...`);
|
|
644
659
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
.then((version) => {
|
|
648
|
-
resolve(version);
|
|
649
|
-
})
|
|
650
|
-
.catch((error) => {
|
|
651
|
-
if (this.debug) {
|
|
652
|
-
logger.logToStderr('@microsoft/generator-sharepoint not found');
|
|
653
|
-
}
|
|
654
|
-
if (error && error.indexOf('ENOENT') > -1) {
|
|
655
|
-
reject('npm not found');
|
|
660
|
+
try {
|
|
661
|
+
return yield this.getPackageVersion('@microsoft/generator-sharepoint', PackageSearchMode.LocalAndGlobal, HandlePromise.Fail, logger);
|
|
656
662
|
}
|
|
657
|
-
|
|
658
|
-
|
|
663
|
+
catch (error) {
|
|
664
|
+
if (this.debug) {
|
|
665
|
+
logger.logToStderr('@microsoft/generator-sharepoint not found');
|
|
666
|
+
}
|
|
667
|
+
if (error && error.indexOf('ENOENT') > -1) {
|
|
668
|
+
throw 'npm not found';
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
return '';
|
|
672
|
+
}
|
|
659
673
|
}
|
|
660
|
-
}
|
|
674
|
+
}
|
|
661
675
|
});
|
|
662
676
|
}
|
|
663
677
|
getPackageVersion(packageName, searchMode, handlePromise, logger) {
|