@pnp/cli-microsoft365 6.11.0-beta.7edcad2 → 6.11.0-beta.b75e15f
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 +2 -1
- package/dist/Command.js +1 -1
- package/dist/m365/cli/commands/config/config-list.js +29 -0
- package/dist/m365/cli/commands.js +1 -0
- package/dist/m365/pa/commands/app/app-permission-ensure.js +177 -0
- package/dist/m365/pa/commands/app/app-permission-remove.js +170 -0
- package/dist/m365/pa/commands.js +2 -0
- package/dist/m365/planner/commands/bucket/bucket-add.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-get.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-list.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-remove.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-set.js +2 -2
- package/dist/m365/planner/commands/plan/plan-get.js +1 -2
- package/dist/m365/planner/commands/plan/plan-list.js +4 -5
- package/dist/m365/planner/commands/plan/plan-set.js +2 -2
- package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.1.js → doctor-1.18.0-beta.5.js} +1 -1
- package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
- package/dist/m365/spfx/commands/project/project-externalize/rules/PnPJsRule.js +34 -23
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.1.js → upgrade-1.18.0-beta.5.js} +26 -26
- package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +35 -51
- package/dist/m365/spo/commands/app/SpoAppBaseCommand.js +26 -14
- package/dist/m365/spo/commands/app/app-add.js +9 -9
- package/dist/m365/spo/commands/file/file-add.js +13 -13
- package/dist/m365/spo/commands/file/file-checkin.js +1 -1
- package/dist/m365/spo/commands/file/file-checkout.js +1 -1
- package/dist/m365/spo/commands/file/file-copy.js +38 -4
- package/dist/m365/spo/commands/file/file-list.js +4 -4
- package/dist/m365/spo/commands/file/file-move.js +2 -2
- package/dist/m365/spo/commands/file/file-remove.js +6 -6
- package/dist/m365/spo/commands/file/file-rename.js +2 -2
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/file/file-version-clear.js +1 -1
- package/dist/m365/spo/commands/file/file-version-get.js +1 -1
- package/dist/m365/spo/commands/file/file-version-list.js +1 -1
- package/dist/m365/spo/commands/file/file-version-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-version-restore.js +1 -1
- package/dist/m365/spo/commands/folder/folder-add.js +2 -4
- package/dist/m365/spo/commands/folder/folder-get.js +1 -1
- package/dist/m365/spo/commands/folder/folder-list.js +2 -2
- package/dist/m365/spo/commands/folder/folder-remove.js +7 -4
- package/dist/m365/spo/commands/folder/folder-rename.js +13 -17
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/group/group-list.js +0 -1
- package/dist/m365/spo/commands/navigation/navigation-node-set.js +2 -2
- package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +32 -3
- package/dist/m365/spo/commands/page/Page.js +24 -32
- package/dist/m365/spo/commands/propertybag/propertybag-base.js +75 -54
- package/dist/m365/spo/commands/propertybag/propertybag-remove.js +41 -40
- package/dist/m365/spo/commands/site/FlowsPolicy.js +10 -0
- package/dist/m365/spo/commands/site/site-ensure.js +19 -70
- package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +24 -22
- package/dist/m365/spo/commands/site/site-list.js +28 -36
- package/dist/m365/spo/commands/site/site-set.js +52 -39
- package/dist/m365/spo/commands/theme/theme-remove.js +26 -24
- package/dist/m365/spo/commands/theme/theme-set.js +0 -1
- package/dist/m365/spo/commands/user/user-remove.js +29 -27
- package/dist/m365/spo/commands/web/web-reindex.js +17 -20
- package/dist/m365/spo/commands/web/web-remove.js +23 -21
- package/dist/m365/spo/commands/web/web-roleassignment-add.js +45 -52
- package/dist/m365/spo/commands/web/web-roleassignment-remove.js +58 -61
- package/dist/m365/spo/commands/web/web-roleinheritance-break.js +20 -18
- package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +21 -19
- package/dist/m365/yammer/commands/message/message-like-set.js +29 -28
- package/dist/m365/yammer/commands/message/message-list.js +9 -26
- package/dist/m365/yammer/commands/message/message-remove.js +20 -18
- package/dist/m365/yammer/commands/yammer-search.js +42 -56
- package/dist/utils/aadGroup.js +20 -0
- package/dist/utils/planner.js +6 -3
- package/dist/utils/spo.js +601 -1
- package/docs/docs/cmd/aad/user/user-set.mdx +1 -1
- package/docs/docs/cmd/cli/config/config-list.mdx +78 -0
- package/docs/docs/cmd/flow/flow-enable.mdx +2 -2
- package/docs/docs/cmd/login.mdx +6 -0
- package/docs/docs/cmd/pa/app/app-permission-ensure.mdx +85 -0
- package/docs/docs/cmd/pa/app/app-permission-remove.mdx +74 -0
- package/docs/docs/cmd/pp/dataverse/dataverse-table-get.mdx +2 -2
- package/docs/docs/cmd/pp/dataverse/dataverse-table-list.mdx +2 -2
- package/docs/docs/cmd/pp/dataverse/dataverse-table-remove.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-checkin.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -9
- package/docs/docs/cmd/spo/file/file-checkout.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-copy.mdx +20 -16
- package/docs/docs/cmd/spo/file/file-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-list.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-move.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-remove.mdx +8 -8
- package/docs/docs/cmd/spo/file/file-rename.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-add.mdx +76 -1
- package/docs/docs/cmd/spo/folder/folder-get.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-list.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-rename.mdx +5 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +2 -2
- package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-attachment-list.mdx +1 -1
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.mdx +14 -1
- package/docs/docs/cmd/spo/site/site-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-remove.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-commandset-add.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-commandset-remove.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-commandset-set.mdx +1 -1
- package/docs/docs/cmd/yammer/network/network-list.mdx +1 -1
- package/npm-shrinkwrap.json +683 -344
- package/package.json +13 -13
package/dist/Auth.js
CHANGED
|
@@ -588,7 +588,8 @@ class Auth {
|
|
|
588
588
|
resource = resource.substr(0, pos);
|
|
589
589
|
}
|
|
590
590
|
if (resource === 'https://api.bap.microsoft.com' ||
|
|
591
|
-
resource === 'https://api.powerapps.com'
|
|
591
|
+
resource === 'https://api.powerapps.com' ||
|
|
592
|
+
resource.endsWith('.api.bap.microsoft.com')) {
|
|
592
593
|
resource = 'https://service.powerapps.com/';
|
|
593
594
|
}
|
|
594
595
|
if (resource === 'https://api.powerbi.com') {
|
package/dist/Command.js
CHANGED
|
@@ -168,7 +168,7 @@ class Command {
|
|
|
168
168
|
const resultOptionValue = yield inquirer
|
|
169
169
|
.prompt({
|
|
170
170
|
name: 'missingRequiredOptionValue',
|
|
171
|
-
message:
|
|
171
|
+
message: `${missingRequiredOptionName}:`
|
|
172
172
|
});
|
|
173
173
|
args.options[missingRequiredOptionName] = resultOptionValue.missingRequiredOptionValue;
|
|
174
174
|
Cli_1.Cli.log();
|
|
@@ -0,0 +1,29 @@
|
|
|
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 Cli_1 = require("../../../../cli/Cli");
|
|
13
|
+
const AnonymousCommand_1 = require("../../../base/AnonymousCommand");
|
|
14
|
+
const commands_1 = require("../../commands");
|
|
15
|
+
class CliConfigListCommand extends AnonymousCommand_1.default {
|
|
16
|
+
get name() {
|
|
17
|
+
return commands_1.default.CONFIG_LIST;
|
|
18
|
+
}
|
|
19
|
+
get description() {
|
|
20
|
+
return 'List all self set CLI for Microsoft 365 configurations';
|
|
21
|
+
}
|
|
22
|
+
commandAction(logger) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
logger.log(Cli_1.Cli.getInstance().config.all);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
module.exports = new CliConfigListCommand();
|
|
29
|
+
//# sourceMappingURL=config-list.js.map
|
|
@@ -8,6 +8,7 @@ exports.default = {
|
|
|
8
8
|
COMPLETION_SH_SETUP: `${prefix} completion sh setup`,
|
|
9
9
|
COMPLETION_SH_UPDATE: `${prefix} completion sh update`,
|
|
10
10
|
CONFIG_GET: `${prefix} config get`,
|
|
11
|
+
CONFIG_LIST: `${prefix} config list`,
|
|
11
12
|
CONFIG_RESET: `${prefix} config reset`,
|
|
12
13
|
CONFIG_SET: `${prefix} config set`,
|
|
13
14
|
CONSENT: `${prefix} consent`,
|
|
@@ -0,0 +1,177 @@
|
|
|
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 _PaAppPermissionEnsureCommand_instances, _PaAppPermissionEnsureCommand_initTelemetry, _PaAppPermissionEnsureCommand_initOptions, _PaAppPermissionEnsureCommand_initValidators, _PaAppPermissionEnsureCommand_initOptionSets, _PaAppPermissionEnsureCommand_initTypes;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
20
|
+
const validation_1 = require("../../../../utils/validation");
|
|
21
|
+
const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
const aadUser_1 = require("../../../../utils/aadUser");
|
|
24
|
+
const accessToken_1 = require("../../../../utils/accessToken");
|
|
25
|
+
const Auth_1 = require("../../../../Auth");
|
|
26
|
+
class PaAppPermissionEnsureCommand extends PowerAppsCommand_1.default {
|
|
27
|
+
get name() {
|
|
28
|
+
return commands_1.default.APP_PERMISSION_ENSURE;
|
|
29
|
+
}
|
|
30
|
+
get description() {
|
|
31
|
+
return 'Assigns/updates permissions to a Power Apps app';
|
|
32
|
+
}
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
_PaAppPermissionEnsureCommand_instances.add(this);
|
|
36
|
+
__classPrivateFieldGet(this, _PaAppPermissionEnsureCommand_instances, "m", _PaAppPermissionEnsureCommand_initTelemetry).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _PaAppPermissionEnsureCommand_instances, "m", _PaAppPermissionEnsureCommand_initOptions).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _PaAppPermissionEnsureCommand_instances, "m", _PaAppPermissionEnsureCommand_initValidators).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _PaAppPermissionEnsureCommand_instances, "m", _PaAppPermissionEnsureCommand_initOptionSets).call(this);
|
|
40
|
+
__classPrivateFieldGet(this, _PaAppPermissionEnsureCommand_instances, "m", _PaAppPermissionEnsureCommand_initTypes).call(this);
|
|
41
|
+
}
|
|
42
|
+
commandAction(logger, args) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
if (this.verbose) {
|
|
45
|
+
logger.logToStderr(`Assigning/updating permissions for '${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName || (args.options.tenant && 'everyone')}' to the Power Apps app '${args.options.appName}'...`);
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const principalId = yield this.getPrincipalId(args.options);
|
|
49
|
+
const requestOptions = {
|
|
50
|
+
url: `${this.resource}/providers/Microsoft.PowerApps/${args.options.asAdmin ? `scopes/admin/environments/${args.options.environmentName}/` : ''}apps/${args.options.appName}/modifyPermissions?api-version=2022-11-01`,
|
|
51
|
+
headers: {
|
|
52
|
+
accept: 'application/json'
|
|
53
|
+
},
|
|
54
|
+
data: {
|
|
55
|
+
put: [
|
|
56
|
+
{
|
|
57
|
+
properties: {
|
|
58
|
+
principal: {
|
|
59
|
+
id: principalId,
|
|
60
|
+
type: this.getPrincipalType(args.options)
|
|
61
|
+
},
|
|
62
|
+
NotifyShareTargetOption: args.options.sendInvitationMail ? 'Notify' : 'DoNotNotify',
|
|
63
|
+
roleName: args.options.roleName
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
responseType: 'json'
|
|
69
|
+
};
|
|
70
|
+
yield request_1.default.post(requestOptions);
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
this.handleRejectedODataJsonPromise(err);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
getPrincipalType(options) {
|
|
78
|
+
if (options.userId || options.userName) {
|
|
79
|
+
return 'User';
|
|
80
|
+
}
|
|
81
|
+
if (options.groupId || options.groupName) {
|
|
82
|
+
return 'Group';
|
|
83
|
+
}
|
|
84
|
+
return 'Tenant';
|
|
85
|
+
}
|
|
86
|
+
getPrincipalId(options) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
if (options.groupId) {
|
|
89
|
+
return options.groupId;
|
|
90
|
+
}
|
|
91
|
+
if (options.userId) {
|
|
92
|
+
return options.userId;
|
|
93
|
+
}
|
|
94
|
+
if (options.groupName) {
|
|
95
|
+
const group = yield aadGroup_1.aadGroup.getGroupByDisplayName(options.groupName);
|
|
96
|
+
return group.id;
|
|
97
|
+
}
|
|
98
|
+
if (options.userName) {
|
|
99
|
+
const userId = yield aadUser_1.aadUser.getUserIdByUpn(options.userName);
|
|
100
|
+
return userId;
|
|
101
|
+
}
|
|
102
|
+
return accessToken_1.accessToken.getTenantIdFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
_PaAppPermissionEnsureCommand_instances = new WeakSet(), _PaAppPermissionEnsureCommand_initTelemetry = function _PaAppPermissionEnsureCommand_initTelemetry() {
|
|
107
|
+
this.telemetry.push((args) => {
|
|
108
|
+
Object.assign(this.telemetryProperties, {
|
|
109
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
110
|
+
userName: typeof args.options.userName !== 'undefined',
|
|
111
|
+
groupId: typeof args.options.groupId !== 'undefined',
|
|
112
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
113
|
+
tenant: !!args.options.tenant,
|
|
114
|
+
sendInvitationMail: !!args.options.sendInvitationMail,
|
|
115
|
+
environmentName: typeof args.options.environmentName !== 'undefined',
|
|
116
|
+
asAdmin: !!args.options.asAdmin
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}, _PaAppPermissionEnsureCommand_initOptions = function _PaAppPermissionEnsureCommand_initOptions() {
|
|
120
|
+
this.options.unshift({
|
|
121
|
+
option: '--appName <appName>'
|
|
122
|
+
}, {
|
|
123
|
+
option: '--roleName <roleName>',
|
|
124
|
+
autocomplete: PaAppPermissionEnsureCommand.roleNames
|
|
125
|
+
}, {
|
|
126
|
+
option: '--userId [userId]'
|
|
127
|
+
}, {
|
|
128
|
+
option: '--userName [userName]'
|
|
129
|
+
}, {
|
|
130
|
+
option: '--groupId [groupId]'
|
|
131
|
+
}, {
|
|
132
|
+
option: '--groupName [groupName]'
|
|
133
|
+
}, {
|
|
134
|
+
option: '--tenant'
|
|
135
|
+
}, {
|
|
136
|
+
option: '-e, --environmentName [environmentName]'
|
|
137
|
+
}, {
|
|
138
|
+
option: '--sendInvitationMail'
|
|
139
|
+
}, {
|
|
140
|
+
option: '--asAdmin'
|
|
141
|
+
});
|
|
142
|
+
}, _PaAppPermissionEnsureCommand_initValidators = function _PaAppPermissionEnsureCommand_initValidators() {
|
|
143
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
if (!validation_1.validation.isValidGuid(args.options.appName)) {
|
|
145
|
+
return `${args.options.appName} is not a valid GUID for appName.`;
|
|
146
|
+
}
|
|
147
|
+
if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
|
|
148
|
+
return `${args.options.userId} is not a valid GUID for userId.`;
|
|
149
|
+
}
|
|
150
|
+
if (args.options.groupId && !validation_1.validation.isValidGuid(args.options.groupId)) {
|
|
151
|
+
return `${args.options.groupId} is not a valid GUID for groupId.`;
|
|
152
|
+
}
|
|
153
|
+
if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
|
|
154
|
+
return `${args.options.userName} is not a valid user principal name (UPN) for userName.`;
|
|
155
|
+
}
|
|
156
|
+
if (PaAppPermissionEnsureCommand.roleNames.indexOf(args.options.roleName) < 0) {
|
|
157
|
+
return `${args.options.roleName} is not a valid roleName. Allowed values are: ${PaAppPermissionEnsureCommand.roleNames.join(', ')}.`;
|
|
158
|
+
}
|
|
159
|
+
if (args.options.environmentName && !args.options.asAdmin) {
|
|
160
|
+
return 'Specifying environmentName is only allowed when using asAdmin.';
|
|
161
|
+
}
|
|
162
|
+
if (args.options.asAdmin && !args.options.environmentName) {
|
|
163
|
+
return 'Specifying asAdmin is only allowed when using environmentName.';
|
|
164
|
+
}
|
|
165
|
+
if (args.options.tenant && args.options.roleName !== 'CanView') {
|
|
166
|
+
return 'Sharing with the entire tenant is only supported with CanView role.';
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
169
|
+
}));
|
|
170
|
+
}, _PaAppPermissionEnsureCommand_initOptionSets = function _PaAppPermissionEnsureCommand_initOptionSets() {
|
|
171
|
+
this.optionSets.push({ options: ['userId', 'userName', 'groupId', 'groupName', 'tenant'] });
|
|
172
|
+
}, _PaAppPermissionEnsureCommand_initTypes = function _PaAppPermissionEnsureCommand_initTypes() {
|
|
173
|
+
this.types.string.push('appName', 'roleName', 'userId', 'userName', 'groupId', 'groupName', 'environmentName');
|
|
174
|
+
};
|
|
175
|
+
PaAppPermissionEnsureCommand.roleNames = ['CanEdit', 'CanView'];
|
|
176
|
+
module.exports = new PaAppPermissionEnsureCommand();
|
|
177
|
+
//# sourceMappingURL=app-permission-ensure.js.map
|
|
@@ -0,0 +1,170 @@
|
|
|
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 _PaAppPermissionRemoveCommand_instances, _PaAppPermissionRemoveCommand_initTelemetry, _PaAppPermissionRemoveCommand_initOptions, _PaAppPermissionRemoveCommand_initValidators, _PaAppPermissionRemoveCommand_initOptionSets, _PaAppPermissionRemoveCommand_initTypes;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
20
|
+
const validation_1 = require("../../../../utils/validation");
|
|
21
|
+
const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
const aadUser_1 = require("../../../../utils/aadUser");
|
|
24
|
+
const accessToken_1 = require("../../../../utils/accessToken");
|
|
25
|
+
const Auth_1 = require("../../../../Auth");
|
|
26
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
27
|
+
class PaAppPermissionRemoveCommand extends PowerAppsCommand_1.default {
|
|
28
|
+
get name() {
|
|
29
|
+
return commands_1.default.APP_PERMISSION_REMOVE;
|
|
30
|
+
}
|
|
31
|
+
get description() {
|
|
32
|
+
return 'Removes permissions to a Power Apps app';
|
|
33
|
+
}
|
|
34
|
+
constructor() {
|
|
35
|
+
super();
|
|
36
|
+
_PaAppPermissionRemoveCommand_instances.add(this);
|
|
37
|
+
__classPrivateFieldGet(this, _PaAppPermissionRemoveCommand_instances, "m", _PaAppPermissionRemoveCommand_initTelemetry).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _PaAppPermissionRemoveCommand_instances, "m", _PaAppPermissionRemoveCommand_initOptions).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _PaAppPermissionRemoveCommand_instances, "m", _PaAppPermissionRemoveCommand_initValidators).call(this);
|
|
40
|
+
__classPrivateFieldGet(this, _PaAppPermissionRemoveCommand_instances, "m", _PaAppPermissionRemoveCommand_initOptionSets).call(this);
|
|
41
|
+
__classPrivateFieldGet(this, _PaAppPermissionRemoveCommand_instances, "m", _PaAppPermissionRemoveCommand_initTypes).call(this);
|
|
42
|
+
}
|
|
43
|
+
commandAction(logger, args) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
try {
|
|
46
|
+
if (args.options.confirm) {
|
|
47
|
+
yield this.removeAppPermission(logger, args.options);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const result = yield Cli_1.Cli.prompt({
|
|
51
|
+
type: 'confirm',
|
|
52
|
+
name: 'continue',
|
|
53
|
+
default: false,
|
|
54
|
+
message: `Are you sure you want to remove the permissions of '${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName || (args.options.tenant && 'everyone')}' from the Power App '${args.options.appName}'?`
|
|
55
|
+
});
|
|
56
|
+
if (result.continue) {
|
|
57
|
+
yield this.removeAppPermission(logger, args.options);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
this.handleRejectedODataJsonPromise(err);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
removeAppPermission(logger, options) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
if (this.verbose) {
|
|
69
|
+
logger.logToStderr(`Removing permissions for '${options.userId || options.userName || options.groupId || options.groupName || (options.tenant && 'everyone')}' for the Power Apps app ${options.appName}...`);
|
|
70
|
+
}
|
|
71
|
+
const principalId = yield this.getPrincipalId(options);
|
|
72
|
+
const requestOptions = {
|
|
73
|
+
url: `${this.resource}/providers/Microsoft.PowerApps/${options.asAdmin ? `scopes/admin/environments/${options.environmentName}/` : ''}apps/${options.appName}/modifyPermissions?api-version=2022-11-01`,
|
|
74
|
+
headers: {
|
|
75
|
+
accept: 'application/json'
|
|
76
|
+
},
|
|
77
|
+
data: {
|
|
78
|
+
delete: [
|
|
79
|
+
{
|
|
80
|
+
id: principalId
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
responseType: 'json'
|
|
85
|
+
};
|
|
86
|
+
yield request_1.default.post(requestOptions);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
getPrincipalId(options) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
if (options.groupId) {
|
|
92
|
+
return options.groupId;
|
|
93
|
+
}
|
|
94
|
+
if (options.userId) {
|
|
95
|
+
return options.userId;
|
|
96
|
+
}
|
|
97
|
+
if (options.groupName) {
|
|
98
|
+
const group = yield aadGroup_1.aadGroup.getGroupByDisplayName(options.groupName);
|
|
99
|
+
return group.id;
|
|
100
|
+
}
|
|
101
|
+
if (options.userName) {
|
|
102
|
+
const userId = yield aadUser_1.aadUser.getUserIdByUpn(options.userName);
|
|
103
|
+
return userId;
|
|
104
|
+
}
|
|
105
|
+
return `tenant-${accessToken_1.accessToken.getTenantIdFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken)}`;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
_PaAppPermissionRemoveCommand_instances = new WeakSet(), _PaAppPermissionRemoveCommand_initTelemetry = function _PaAppPermissionRemoveCommand_initTelemetry() {
|
|
110
|
+
this.telemetry.push((args) => {
|
|
111
|
+
Object.assign(this.telemetryProperties, {
|
|
112
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
113
|
+
userName: typeof args.options.userName !== 'undefined',
|
|
114
|
+
groupId: typeof args.options.groupId !== 'undefined',
|
|
115
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
116
|
+
tenant: !!args.options.tenant,
|
|
117
|
+
asAdmin: !!args.options.asAdmin,
|
|
118
|
+
environmentName: typeof args.options.environmentName !== 'undefined',
|
|
119
|
+
confirm: !!args.options.confirm
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
}, _PaAppPermissionRemoveCommand_initOptions = function _PaAppPermissionRemoveCommand_initOptions() {
|
|
123
|
+
this.options.unshift({
|
|
124
|
+
option: '--appName <appName>'
|
|
125
|
+
}, {
|
|
126
|
+
option: '--userId [userId]'
|
|
127
|
+
}, {
|
|
128
|
+
option: '--userName [userName]'
|
|
129
|
+
}, {
|
|
130
|
+
option: '--groupId [groupId]'
|
|
131
|
+
}, {
|
|
132
|
+
option: '--groupName [groupName]'
|
|
133
|
+
}, {
|
|
134
|
+
option: '--tenant'
|
|
135
|
+
}, {
|
|
136
|
+
option: '--asAdmin'
|
|
137
|
+
}, {
|
|
138
|
+
option: '-e, --environmentName [environmentName]'
|
|
139
|
+
}, {
|
|
140
|
+
option: '--confirm'
|
|
141
|
+
});
|
|
142
|
+
}, _PaAppPermissionRemoveCommand_initValidators = function _PaAppPermissionRemoveCommand_initValidators() {
|
|
143
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
if (!validation_1.validation.isValidGuid(args.options.appName)) {
|
|
145
|
+
return `${args.options.appName} is not a valid GUID for appName.`;
|
|
146
|
+
}
|
|
147
|
+
if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
|
|
148
|
+
return `${args.options.userId} is not a valid GUID for userId.`;
|
|
149
|
+
}
|
|
150
|
+
if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
|
|
151
|
+
return `${args.options.userName} is not a valid user principal name (UPN) for userName.`;
|
|
152
|
+
}
|
|
153
|
+
if (args.options.groupId && !validation_1.validation.isValidGuid(args.options.groupId)) {
|
|
154
|
+
return `${args.options.groupId} is not a valid GUID for groupId.`;
|
|
155
|
+
}
|
|
156
|
+
if (args.options.environmentName && !args.options.asAdmin) {
|
|
157
|
+
return 'Specifying environmentName is only allowed when using asAdmin';
|
|
158
|
+
}
|
|
159
|
+
if (args.options.asAdmin && !args.options.environmentName) {
|
|
160
|
+
return 'Specifying asAdmin is only allowed when using environmentName';
|
|
161
|
+
}
|
|
162
|
+
return true;
|
|
163
|
+
}));
|
|
164
|
+
}, _PaAppPermissionRemoveCommand_initOptionSets = function _PaAppPermissionRemoveCommand_initOptionSets() {
|
|
165
|
+
this.optionSets.push({ options: ['userId', 'userName', 'groupId', 'groupName', 'tenant'] });
|
|
166
|
+
}, _PaAppPermissionRemoveCommand_initTypes = function _PaAppPermissionRemoveCommand_initTypes() {
|
|
167
|
+
this.types.string.push('appName', 'userId', 'userName', 'groupId', 'groupName', 'environmentName');
|
|
168
|
+
};
|
|
169
|
+
module.exports = new PaAppPermissionRemoveCommand();
|
|
170
|
+
//# sourceMappingURL=app-permission-remove.js.map
|
package/dist/m365/pa/commands.js
CHANGED
|
@@ -8,7 +8,9 @@ exports.default = {
|
|
|
8
8
|
APP_REMOVE: `${prefix} app remove`,
|
|
9
9
|
APP_CONSENT_SET: `${prefix} app consent set`,
|
|
10
10
|
APP_OWNER_SET: `${prefix} app owner set`,
|
|
11
|
+
APP_PERMISSION_ENSURE: `${prefix} app permission ensure`,
|
|
11
12
|
APP_PERMISSION_LIST: `${prefix} app permission list`,
|
|
13
|
+
APP_PERMISSION_REMOVE: `${prefix} app permission remove`,
|
|
12
14
|
CONNECTOR_EXPORT: `${prefix} connector export`,
|
|
13
15
|
CONNECTOR_LIST: `${prefix} connector list`,
|
|
14
16
|
ENVIRONMENT_GET: `${prefix} environment get`,
|
|
@@ -73,8 +73,8 @@ class PlannerBucketAddCommand extends GraphCommand_1.default {
|
|
|
73
73
|
const plan = yield planner_1.planner.getPlanByTitle(args.options.planTitle, groupId);
|
|
74
74
|
return plan.id;
|
|
75
75
|
}
|
|
76
|
-
const
|
|
77
|
-
return
|
|
76
|
+
const plan = yield planner_1.planner.getPlanByRosterId(args.options.rosterId);
|
|
77
|
+
return plan.id;
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
getGroupId(args) {
|
|
@@ -84,8 +84,8 @@ class PlannerBucketGetCommand extends GraphCommand_1.default {
|
|
|
84
84
|
const plan = yield planner_1.planner.getPlanByTitle(planTitle, groupId);
|
|
85
85
|
return plan.id;
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
return
|
|
87
|
+
const plan = yield planner_1.planner.getPlanByRosterId(rosterId);
|
|
88
|
+
return plan.id;
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
getBucketById(id) {
|
|
@@ -61,8 +61,8 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
|
|
|
61
61
|
const plan = yield planner_1.planner.getPlanByTitle(args.options.planTitle, groupId);
|
|
62
62
|
return plan.id;
|
|
63
63
|
}
|
|
64
|
-
const
|
|
65
|
-
return
|
|
64
|
+
const plan = yield planner_1.planner.getPlanByRosterId(args.options.rosterId);
|
|
65
|
+
return plan.id;
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
getGroupId(args) {
|
|
@@ -114,8 +114,8 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
|
114
114
|
const plan = yield planner_1.planner.getPlanByTitle(planTitle, groupId);
|
|
115
115
|
return plan.id;
|
|
116
116
|
}
|
|
117
|
-
const
|
|
118
|
-
return
|
|
117
|
+
const plan = yield planner_1.planner.getPlanByRosterId(rosterId);
|
|
118
|
+
return plan.id;
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
getGroupId(args) {
|
|
@@ -105,8 +105,8 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
105
105
|
const plan = yield planner_1.planner.getPlanByTitle(planTitle, groupId);
|
|
106
106
|
return plan.id;
|
|
107
107
|
}
|
|
108
|
-
const
|
|
109
|
-
return
|
|
108
|
+
const plan = yield planner_1.planner.getPlanByRosterId(rosterId);
|
|
109
|
+
return plan.id;
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
getGroupId(args) {
|
|
@@ -50,8 +50,7 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
50
50
|
else {
|
|
51
51
|
let plan = {};
|
|
52
52
|
if (args.options.rosterId) {
|
|
53
|
-
|
|
54
|
-
plan = plans[0];
|
|
53
|
+
plan = yield planner_1.planner.getPlanByRosterId(args.options.rosterId);
|
|
55
54
|
}
|
|
56
55
|
else {
|
|
57
56
|
let groupId = undefined;
|
|
@@ -41,17 +41,16 @@ class PlannerPlanListCommand extends GraphCommand_1.default {
|
|
|
41
41
|
commandAction(logger, args) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
try {
|
|
44
|
-
let plannerPlans =
|
|
44
|
+
let plannerPlans = [];
|
|
45
45
|
if (args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
46
46
|
const groupId = yield this.getGroupId(args);
|
|
47
47
|
plannerPlans = yield planner_1.planner.getPlansByGroupId(groupId);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (plannerPlans && plannerPlans.length > 0) {
|
|
53
|
-
logger.log(plannerPlans);
|
|
50
|
+
const plan = yield planner_1.planner.getPlanByRosterId(args.options.rosterId);
|
|
51
|
+
plannerPlans.push(plan);
|
|
54
52
|
}
|
|
53
|
+
logger.log(plannerPlans);
|
|
55
54
|
}
|
|
56
55
|
catch (err) {
|
|
57
56
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -61,8 +61,8 @@ class PlannerPlanSetCommand extends GraphCommand_1.default {
|
|
|
61
61
|
}
|
|
62
62
|
let groupId = '';
|
|
63
63
|
if (args.options.rosterId) {
|
|
64
|
-
const
|
|
65
|
-
return
|
|
64
|
+
const plan = yield planner_1.planner.getPlanByRosterId(args.options.rosterId);
|
|
65
|
+
return plan.id;
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
68
|
groupId = yield this.getGroupId(args);
|
|
@@ -20,4 +20,4 @@ module.exports = [
|
|
|
20
20
|
new FN002016_DEVDEP_types_react_dom_1.FN002016_DEVDEP_types_react_dom('17'),
|
|
21
21
|
new FN002019_DEVDEP_microsoft_rush_stack_compiler_1.FN002019_DEVDEP_microsoft_rush_stack_compiler(['4.5'])
|
|
22
22
|
];
|
|
23
|
-
//# sourceMappingURL=doctor-1.18.0-beta.
|
|
23
|
+
//# sourceMappingURL=doctor-1.18.0-beta.5.js.map
|
|
@@ -78,7 +78,7 @@ class SpfxProjectDoctorCommand extends base_project_command_1.BaseProjectCommand
|
|
|
78
78
|
'1.17.2',
|
|
79
79
|
'1.17.3',
|
|
80
80
|
'1.17.4',
|
|
81
|
-
'1.18.0-beta.
|
|
81
|
+
'1.18.0-beta.5'
|
|
82
82
|
];
|
|
83
83
|
__classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initTelemetry).call(this);
|
|
84
84
|
__classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initOptions).call(this);
|
|
@@ -1,4 +1,13 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.PnPJsRule = void 0;
|
|
4
13
|
const BasicDependencyRule_1 = require("./BasicDependencyRule");
|
|
@@ -46,31 +55,33 @@ class PnPJsRule extends BasicDependencyRule_1.BasicDependencyRule {
|
|
|
46
55
|
];
|
|
47
56
|
}
|
|
48
57
|
visit(project) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.filter(x => x.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
path: y,
|
|
58
|
-
targetValue: x.shadowRequire
|
|
59
|
-
})));
|
|
60
|
-
const fileEdits = rawFileEdits.length > 0 ? rawFileEdits.reduce((x, y) => [...x, ...y]) : [];
|
|
61
|
-
if (findings.filter(x => x.key && x.key !== '@pnp/pnpjs').length > 0) { // we're adding tslib only if we found other packages that are not the bundle which already contains tslib
|
|
62
|
-
findings.push({
|
|
63
|
-
key: 'tslib',
|
|
64
|
-
globalName: 'tslib',
|
|
65
|
-
path: `https://unpkg.com/tslib@^1.10.0/tslib.js`
|
|
66
|
-
});
|
|
67
|
-
fileEdits.push(...files.map(x => ({
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const findings = this.pnpModules
|
|
60
|
+
.map(x => this.getModuleAndParents(project, x.key))
|
|
61
|
+
.reduce((x, y) => [...x, ...y]);
|
|
62
|
+
const files = this.getEntryFilesList(project);
|
|
63
|
+
const rawFileEdits = this.pnpModules.filter(x => findings.find(y => y.key === x.key) !== undefined)
|
|
64
|
+
.filter(x => x.shadowRequire !== undefined)
|
|
65
|
+
.map(x => files.map(y => ({
|
|
68
66
|
action: "add",
|
|
69
|
-
path:
|
|
70
|
-
targetValue:
|
|
67
|
+
path: y,
|
|
68
|
+
targetValue: x.shadowRequire
|
|
71
69
|
})));
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const fileEdits = rawFileEdits.length > 0 ? rawFileEdits.reduce((x, y) => [...x, ...y]) : [];
|
|
71
|
+
if (findings.filter(x => x.key && x.key !== '@pnp/pnpjs').length > 0) { // we're adding tslib only if we found other packages that are not the bundle which already contains tslib
|
|
72
|
+
findings.push({
|
|
73
|
+
key: 'tslib',
|
|
74
|
+
globalName: 'tslib',
|
|
75
|
+
path: `https://unpkg.com/tslib@^1.10.0/tslib.js`
|
|
76
|
+
});
|
|
77
|
+
fileEdits.push(...files.map(x => ({
|
|
78
|
+
action: "add",
|
|
79
|
+
path: x,
|
|
80
|
+
targetValue: 'require(\"tslib\");'
|
|
81
|
+
})));
|
|
82
|
+
}
|
|
83
|
+
return { entries: findings, suggestions: fileEdits };
|
|
84
|
+
});
|
|
74
85
|
}
|
|
75
86
|
getEntryFilesList(project) {
|
|
76
87
|
return project && project.manifests ? project.manifests.map(x => x.path.replace('.manifest.json', '.ts')) : [];
|
|
@@ -105,7 +105,7 @@ module.exports = [
|
|
|
105
105
|
'fixWith': 'symbol'
|
|
106
106
|
},
|
|
107
107
|
'Function': {
|
|
108
|
-
'message': 'The \\'Function\\' type accepts any function-like value
|
|
108
|
+
'message': 'The \\'Function\\' type accepts any function-like value.\\nIt provides no type safety when calling the function, which can be a common source of bugs.\\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \\'new\\'.\\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|