@pnp/cli-microsoft365 6.11.0-beta.ee225fb → 6.11.0
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/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/task/task-add.js +17 -11
- package/dist/m365/planner/commands/task/task-get.js +35 -25
- package/dist/m365/planner/commands/task/task-list.js +26 -19
- package/dist/m365/planner/commands/task/task-remove.js +40 -35
- package/dist/m365/planner/commands/task/task-set.js +35 -23
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +58 -0
- 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-github-workflow-add.js +171 -0
- package/dist/m365/spfx/commands/project/project-github-workflow-model.js +3 -0
- 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/spfx/commands.js +1 -0
- 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/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/serviceprincipal/serviceprincipal-set.js +32 -32
- package/dist/m365/spo/commands/site/FlowsPolicy.js +10 -0
- package/dist/m365/spo/commands/site/site-add.js +113 -154
- package/dist/m365/spo/commands/site/site-apppermission-add.js +26 -27
- package/dist/m365/spo/commands/site/site-apppermission-remove.js +37 -37
- package/dist/m365/spo/commands/site/site-apppermission-set.js +15 -16
- 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-remove.js +139 -171
- package/dist/m365/spo/commands/site/site-set.js +179 -178
- 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/fsUtil.js +5 -0
- package/dist/utils/spo.js +601 -1
- 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/planner/task/task-add.mdx +22 -7
- package/docs/docs/cmd/planner/task/task-get.mdx +13 -4
- package/docs/docs/cmd/planner/task/task-list.mdx +22 -7
- package/docs/docs/cmd/planner/task/task-remove.mdx +25 -8
- package/docs/docs/cmd/planner/task/task-set.mdx +22 -7
- package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +94 -0
- 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/orgassetslibrary/orgassetslibrary-add.mdx +14 -1
- package/docs/docs/cmd/spo/site/site-ensure.mdx +1 -1
- package/npm-shrinkwrap.json +698 -345
- package/package.json +16 -15
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,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`,
|
|
@@ -163,9 +163,15 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
163
163
|
if (args.options.planId) {
|
|
164
164
|
return args.options.planId;
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
if (args.options.rosterId) {
|
|
167
|
+
const plan = yield planner_1.planner.getPlanByRosterId(args.options.rosterId);
|
|
168
|
+
return plan.id;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
const groupId = yield this.getGroupId(args);
|
|
172
|
+
const plan = yield planner_1.planner.getPlanByTitle(args.options.planTitle, groupId);
|
|
173
|
+
return plan.id;
|
|
174
|
+
}
|
|
169
175
|
});
|
|
170
176
|
}
|
|
171
177
|
getGroupId(args) {
|
|
@@ -214,6 +220,7 @@ _PlannerTaskAddCommand_instances = new WeakSet(), _PlannerTaskAddCommand_initTel
|
|
|
214
220
|
Object.assign(this.telemetryProperties, {
|
|
215
221
|
planId: typeof args.options.planId !== 'undefined',
|
|
216
222
|
planTitle: typeof args.options.planTitle !== 'undefined',
|
|
223
|
+
rosterId: typeof args.options.rosterId !== 'undefined',
|
|
217
224
|
ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
|
|
218
225
|
ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
|
|
219
226
|
bucketId: typeof args.options.bucketId !== 'undefined',
|
|
@@ -232,7 +239,7 @@ _PlannerTaskAddCommand_instances = new WeakSet(), _PlannerTaskAddCommand_initTel
|
|
|
232
239
|
});
|
|
233
240
|
});
|
|
234
241
|
}, _PlannerTaskAddCommand_initOptions = function _PlannerTaskAddCommand_initOptions() {
|
|
235
|
-
this.options.unshift({ option: '-t, --title <title>' }, { option: '--planId [planId]' }, { option: '--planTitle [planTitle]' }, { option: '--ownerGroupId [ownerGroupId]' }, { option: '--ownerGroupName [ownerGroupName]' }, { option: '--bucketId [bucketId]' }, { option: '--bucketName [bucketName]' }, { option: '--startDateTime [startDateTime]' }, { option: '--dueDateTime [dueDateTime]' }, { option: '--percentComplete [percentComplete]' }, { option: '--assignedToUserIds [assignedToUserIds]' }, { option: '--assignedToUserNames [assignedToUserNames]' }, { option: '--assigneePriority [assigneePriority]' }, { option: '--description [description]' }, {
|
|
242
|
+
this.options.unshift({ option: '-t, --title <title>' }, { option: '--planId [planId]' }, { option: '--planTitle [planTitle]' }, { option: '--rosterId [rosterId]' }, { option: '--ownerGroupId [ownerGroupId]' }, { option: '--ownerGroupName [ownerGroupName]' }, { option: '--bucketId [bucketId]' }, { option: '--bucketName [bucketName]' }, { option: '--startDateTime [startDateTime]' }, { option: '--dueDateTime [dueDateTime]' }, { option: '--percentComplete [percentComplete]' }, { option: '--assignedToUserIds [assignedToUserIds]' }, { option: '--assignedToUserNames [assignedToUserNames]' }, { option: '--assigneePriority [assigneePriority]' }, { option: '--description [description]' }, {
|
|
236
243
|
option: '--appliedCategories [appliedCategories]',
|
|
237
244
|
autocomplete: this.allowedAppliedCategories
|
|
238
245
|
}, {
|
|
@@ -241,12 +248,6 @@ _PlannerTaskAddCommand_instances = new WeakSet(), _PlannerTaskAddCommand_initTel
|
|
|
241
248
|
}, { option: '--orderHint [orderHint]' }, { option: '--priority [priority]', autocomplete: taskPriority_1.taskPriority.priorityValues });
|
|
242
249
|
}, _PlannerTaskAddCommand_initValidators = function _PlannerTaskAddCommand_initValidators() {
|
|
243
250
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
244
|
-
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
245
|
-
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
246
|
-
}
|
|
247
|
-
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
248
|
-
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
249
|
-
}
|
|
250
251
|
if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
251
252
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
252
253
|
}
|
|
@@ -287,7 +288,12 @@ _PlannerTaskAddCommand_instances = new WeakSet(), _PlannerTaskAddCommand_initTel
|
|
|
287
288
|
return true;
|
|
288
289
|
}));
|
|
289
290
|
}, _PlannerTaskAddCommand_initOptionSets = function _PlannerTaskAddCommand_initOptionSets() {
|
|
290
|
-
this.optionSets.push({ options: ['planId', 'planTitle'] }, { options: ['bucketId', 'bucketName'] }
|
|
291
|
+
this.optionSets.push({ options: ['planId', 'planTitle', 'rosterId'] }, { options: ['bucketId', 'bucketName'] }, {
|
|
292
|
+
options: ['ownerGroupId', 'ownerGroupName'],
|
|
293
|
+
runsWhen: (args) => {
|
|
294
|
+
return args.options.planTitle !== undefined;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
291
297
|
};
|
|
292
298
|
module.exports = new PlannerTaskAddCommand();
|
|
293
299
|
//# sourceMappingURL=task-add.js.map
|
|
@@ -131,9 +131,15 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
131
131
|
if (options.planId) {
|
|
132
132
|
return options.planId;
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
if (options.rosterId) {
|
|
135
|
+
const plan = yield planner_1.planner.getPlanByRosterId(options.rosterId);
|
|
136
|
+
return plan.id;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const groupId = yield this.getGroupId(options);
|
|
140
|
+
const plan = yield planner_1.planner.getPlanByTitle(options.planTitle, groupId);
|
|
141
|
+
return plan.id;
|
|
142
|
+
}
|
|
137
143
|
});
|
|
138
144
|
}
|
|
139
145
|
getGroupId(options) {
|
|
@@ -154,46 +160,50 @@ _PlannerTaskGetCommand_instances = new WeakSet(), _PlannerTaskGetCommand_initTel
|
|
|
154
160
|
bucketId: typeof args.options.bucketId !== 'undefined',
|
|
155
161
|
bucketName: typeof args.options.bucketName !== 'undefined',
|
|
156
162
|
planId: typeof args.options.planId !== 'undefined',
|
|
163
|
+
planTitle: typeof args.options.planTitle !== 'undefined',
|
|
164
|
+
rosterId: typeof args.options.rosterId !== 'undefined',
|
|
157
165
|
ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
|
|
158
166
|
ownerGroupName: typeof args.options.ownerGroupName !== 'undefined'
|
|
159
167
|
});
|
|
160
168
|
});
|
|
161
169
|
}, _PlannerTaskGetCommand_initOptions = function _PlannerTaskGetCommand_initOptions() {
|
|
162
|
-
this.options.unshift({ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '--bucketId [bucketId]' }, { option: '--bucketName [bucketName]' }, { option: '--planId [planId]' }, { option: '--planTitle [planTitle]' }, { option: '--ownerGroupId [ownerGroupId]' }, { option: '--ownerGroupName [ownerGroupName]' });
|
|
170
|
+
this.options.unshift({ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '--bucketId [bucketId]' }, { option: '--bucketName [bucketName]' }, { option: '--planId [planId]' }, { option: '--planTitle [planTitle]' }, { option: '--rosterId [rosterId]' }, { option: '--ownerGroupId [ownerGroupId]' }, { option: '--ownerGroupName [ownerGroupName]' });
|
|
163
171
|
}, _PlannerTaskGetCommand_initValidators = function _PlannerTaskGetCommand_initValidators() {
|
|
164
172
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
165
173
|
if (args.options.id) {
|
|
166
174
|
if (args.options.bucketId || args.options.bucketName ||
|
|
167
|
-
args.options.planId || args.options.
|
|
175
|
+
args.options.planId || args.options.planTitle || args.options.rosterId ||
|
|
168
176
|
args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
169
|
-
return 'Don\'t specify bucketId, bucketName, planId, planTitle, ownerGroupId or ownerGroupName when using id';
|
|
177
|
+
return 'Don\'t specify bucketId, bucketName, planId, planTitle, rosterId, ownerGroupId or ownerGroupName when using id';
|
|
170
178
|
}
|
|
171
179
|
}
|
|
172
|
-
if (args.options.title && !args.options.bucketId && !args.options.bucketName) {
|
|
173
|
-
return 'Specify either bucketId or bucketName when using title';
|
|
174
|
-
}
|
|
175
|
-
if (args.options.title && args.options.bucketId && args.options.bucketName) {
|
|
176
|
-
return 'Specify either bucketId or bucketName when using title but not both';
|
|
177
|
-
}
|
|
178
|
-
if (args.options.bucketName && !args.options.planId && !args.options.planTitle) {
|
|
179
|
-
return 'Specify either planId or planTitle when using bucketName';
|
|
180
|
-
}
|
|
181
|
-
if (args.options.bucketName && args.options.planId && args.options.planTitle) {
|
|
182
|
-
return 'Specify either planId or planTitle when using bucketName but not both';
|
|
183
|
-
}
|
|
184
|
-
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
185
|
-
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
186
|
-
}
|
|
187
|
-
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
188
|
-
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
189
|
-
}
|
|
190
180
|
if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
191
181
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
192
182
|
}
|
|
193
183
|
return true;
|
|
194
184
|
}));
|
|
195
185
|
}, _PlannerTaskGetCommand_initOptionSets = function _PlannerTaskGetCommand_initOptionSets() {
|
|
196
|
-
this.optionSets.push({ options: ['id', 'title'] }
|
|
186
|
+
this.optionSets.push({ options: ['id', 'title'] }, {
|
|
187
|
+
options: ['planId', 'planTitle', 'rosterId'],
|
|
188
|
+
runsWhen: (args) => {
|
|
189
|
+
return args.options.id === undefined;
|
|
190
|
+
}
|
|
191
|
+
}, {
|
|
192
|
+
options: ['bucketId', 'bucketName'],
|
|
193
|
+
runsWhen: (args) => {
|
|
194
|
+
return args.options.title !== undefined;
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
options: ['planId', 'planTitle'],
|
|
198
|
+
runsWhen: (args) => {
|
|
199
|
+
return args.options.bucketName !== undefined && args.options.rosterId === undefined;
|
|
200
|
+
}
|
|
201
|
+
}, {
|
|
202
|
+
options: ['ownerGroupId', 'ownerGroupName'],
|
|
203
|
+
runsWhen: (args) => {
|
|
204
|
+
return args.options.planTitle !== undefined;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
197
207
|
};
|
|
198
208
|
module.exports = new PlannerTaskGetCommand();
|
|
199
209
|
//# sourceMappingURL=task-get.js.map
|
|
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
14
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
15
|
};
|
|
16
|
-
var _PlannerTaskListCommand_instances, _PlannerTaskListCommand_initTelemetry, _PlannerTaskListCommand_initOptions, _PlannerTaskListCommand_initValidators;
|
|
16
|
+
var _PlannerTaskListCommand_instances, _PlannerTaskListCommand_initTelemetry, _PlannerTaskListCommand_initOptions, _PlannerTaskListCommand_initValidators, _PlannerTaskListCommand_initOptionSets;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const odata_1 = require("../../../../utils/odata");
|
|
@@ -39,6 +39,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
39
39
|
__classPrivateFieldGet(this, _PlannerTaskListCommand_instances, "m", _PlannerTaskListCommand_initTelemetry).call(this);
|
|
40
40
|
__classPrivateFieldGet(this, _PlannerTaskListCommand_instances, "m", _PlannerTaskListCommand_initOptions).call(this);
|
|
41
41
|
__classPrivateFieldGet(this, _PlannerTaskListCommand_instances, "m", _PlannerTaskListCommand_initValidators).call(this);
|
|
42
|
+
__classPrivateFieldGet(this, _PlannerTaskListCommand_instances, "m", _PlannerTaskListCommand_initOptionSets).call(this);
|
|
42
43
|
}
|
|
43
44
|
commandAction(logger, args) {
|
|
44
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -107,9 +108,15 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
107
108
|
if (args.options.planId) {
|
|
108
109
|
return formatting_1.formatting.encodeQueryParameter(args.options.planId);
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
if (args.options.rosterId) {
|
|
112
|
+
const plan = yield planner_1.planner.getPlanByRosterId(args.options.rosterId);
|
|
113
|
+
return plan.id;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
const groupId = yield this.getGroupId(args);
|
|
117
|
+
const plan = yield planner_1.planner.getPlanByTitle(args.options.planTitle, groupId);
|
|
118
|
+
return plan.id;
|
|
119
|
+
}
|
|
113
120
|
});
|
|
114
121
|
}
|
|
115
122
|
getGroupId(args) {
|
|
@@ -140,6 +147,7 @@ _PlannerTaskListCommand_instances = new WeakSet(), _PlannerTaskListCommand_initT
|
|
|
140
147
|
bucketName: typeof args.options.bucketName !== 'undefined',
|
|
141
148
|
planId: typeof args.options.planId !== 'undefined',
|
|
142
149
|
planTitle: typeof args.options.planTitle !== 'undefined',
|
|
150
|
+
rosterId: typeof args.options.rosterId !== 'undefined',
|
|
143
151
|
ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
|
|
144
152
|
ownerGroupName: typeof args.options.ownerGroupName !== 'undefined'
|
|
145
153
|
});
|
|
@@ -153,6 +161,8 @@ _PlannerTaskListCommand_instances = new WeakSet(), _PlannerTaskListCommand_initT
|
|
|
153
161
|
option: '--planId [planId]'
|
|
154
162
|
}, {
|
|
155
163
|
option: '--planTitle [planTitle]'
|
|
164
|
+
}, {
|
|
165
|
+
option: '--rosterId [rosterId]'
|
|
156
166
|
}, {
|
|
157
167
|
option: '--ownerGroupId [ownerGroupId]'
|
|
158
168
|
}, {
|
|
@@ -160,26 +170,23 @@ _PlannerTaskListCommand_instances = new WeakSet(), _PlannerTaskListCommand_initT
|
|
|
160
170
|
});
|
|
161
171
|
}, _PlannerTaskListCommand_initValidators = function _PlannerTaskListCommand_initValidators() {
|
|
162
172
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
if (args.options.bucketId && args.options.bucketName) {
|
|
164
|
-
return 'To retrieve tasks from a bucket, specify bucketId or bucketName, but not both';
|
|
165
|
-
}
|
|
166
|
-
if (args.options.bucketName && !args.options.planId && !args.options.planTitle) {
|
|
167
|
-
return 'Specify either planId or planTitle when using bucketName';
|
|
168
|
-
}
|
|
169
|
-
if (args.options.planId && args.options.planTitle) {
|
|
170
|
-
return 'Specify either planId or planTitle but not both';
|
|
171
|
-
}
|
|
172
|
-
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
173
|
-
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
174
|
-
}
|
|
175
|
-
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
176
|
-
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
177
|
-
}
|
|
178
173
|
if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
179
174
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
180
175
|
}
|
|
181
176
|
return true;
|
|
182
177
|
}));
|
|
178
|
+
}, _PlannerTaskListCommand_initOptionSets = function _PlannerTaskListCommand_initOptionSets() {
|
|
179
|
+
this.optionSets.push({ options: ['bucketId', 'bucketName'] }, {
|
|
180
|
+
options: ['planId', 'planTitle'],
|
|
181
|
+
runsWhen: (args) => {
|
|
182
|
+
return args.options.bucketName !== undefined && args.options.rosterId === undefined;
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
options: ['ownerGroupId', 'ownerGroupName'],
|
|
186
|
+
runsWhen: (args) => {
|
|
187
|
+
return args.options.planTitle !== undefined;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
183
190
|
};
|
|
184
191
|
module.exports = new PlannerTaskListCommand();
|
|
185
192
|
//# sourceMappingURL=task-list.js.map
|