@pnp/cli-microsoft365 5.9.0-beta.60e454b → 5.9.0-beta.77d7f6b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Command.js +16 -2
- package/dist/m365/aad/commands/app/app-add.js +37 -13
- package/dist/m365/commands/status.js +6 -1
- package/dist/m365/outlook/commands/mail/mail-send.js +54 -30
- package/dist/m365/pp/commands/card/card-get.js +110 -0
- package/dist/m365/pp/commands/gateway/gateway-get.js +70 -0
- package/dist/m365/pp/commands/solution/solution-get.js +117 -0
- package/dist/m365/pp/commands.js +3 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +4 -1
- package/dist/m365/spfx/commands/project/project-externalize.js +4 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
- package/dist/m365/spo/commands/contenttype/contenttype-add.js +82 -43
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +53 -21
- package/dist/m365/spo/commands/contenttype/contenttype-get.js +35 -14
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +1 -1
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +14 -6
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +15 -7
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +239 -0
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/todo/commands/task/task-add.js +55 -3
- package/docs/docs/_clisettings.md +19 -0
- package/docs/docs/cmd/outlook/mail/mail-send.md +13 -0
- package/docs/docs/cmd/planner/bucket/bucket-add.md +29 -0
- package/docs/docs/cmd/planner/bucket/bucket-get.md +29 -0
- package/docs/docs/cmd/planner/bucket/bucket-list.md +30 -0
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +4 -0
- package/docs/docs/cmd/planner/bucket/bucket-set.md +4 -0
- package/docs/docs/cmd/planner/plan/plan-add.md +123 -0
- package/docs/docs/cmd/planner/plan/plan-get.md +75 -0
- package/docs/docs/cmd/planner/plan/plan-list.md +45 -0
- package/docs/docs/cmd/planner/plan/plan-remove.md +4 -0
- package/docs/docs/cmd/pp/card/card-get.md +51 -0
- package/docs/docs/cmd/pp/gateway/gateway-get.md +24 -0
- package/docs/docs/cmd/pp/solution/solution-get.md +51 -0
- package/docs/docs/cmd/spfx/project/project-rename.md +1 -14
- package/docs/docs/cmd/spo/contenttype/contenttype-add.md +20 -2
- package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.md +22 -4
- package/docs/docs/cmd/spo/contenttype/contenttype-get.md +21 -3
- package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +11 -8
- package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +14 -5
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.md +81 -0
- package/docs/docs/cmd/todo/task/task-add.md +32 -5
- package/package.json +3 -1
package/dist/Command.js
CHANGED
|
@@ -61,6 +61,9 @@ class Command {
|
|
|
61
61
|
__classPrivateFieldGet(this, _Command_instances, "m", _Command_initOptions).call(this);
|
|
62
62
|
__classPrivateFieldGet(this, _Command_instances, "m", _Command_initValidators).call(this);
|
|
63
63
|
}
|
|
64
|
+
get allowedOutputs() {
|
|
65
|
+
return ['csv', 'json', 'text'];
|
|
66
|
+
}
|
|
64
67
|
validateUnknownOptions(args, command) {
|
|
65
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
69
|
if (this.allowUnknownOptions()) {
|
|
@@ -135,6 +138,17 @@ class Command {
|
|
|
135
138
|
return true;
|
|
136
139
|
});
|
|
137
140
|
}
|
|
141
|
+
validateOutput(args) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
if (args.options.output &&
|
|
144
|
+
this.allowedOutputs.indexOf(args.options.output) < 0) {
|
|
145
|
+
return `'${args.options.output}' is not a valid output type. Allowed output types are ${this.allowedOutputs.join(', ')}`;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
138
152
|
alias() {
|
|
139
153
|
return;
|
|
140
154
|
}
|
|
@@ -417,9 +431,9 @@ _Command_instances = new WeakSet(), _Command_initTelemetry = function _Command_i
|
|
|
417
431
|
}, _Command_initOptions = function _Command_initOptions() {
|
|
418
432
|
this.options.unshift({ option: '--query [query]' }, {
|
|
419
433
|
option: '-o, --output [output]',
|
|
420
|
-
autocomplete:
|
|
434
|
+
autocomplete: this.allowedOutputs
|
|
421
435
|
}, { option: '--verbose' }, { option: '--debug' });
|
|
422
436
|
}, _Command_initValidators = function _Command_initValidators() {
|
|
423
|
-
this.validators.push((args, command) => this.validateUnknownOptions(args, command), (args, command) => this.validateRequiredOptions(args, command), (args, command) => this.validateOptionSets(args, command));
|
|
437
|
+
this.validators.push((args, command) => this.validateUnknownOptions(args, command), (args, command) => this.validateRequiredOptions(args, command), args => this.validateOutput(args), (args, command) => this.validateOptionSets(args, command));
|
|
424
438
|
};
|
|
425
439
|
//# sourceMappingURL=Command.js.map
|
|
@@ -209,8 +209,6 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
209
209
|
delete v2Manifest.appId;
|
|
210
210
|
delete v2Manifest.publisherDomain;
|
|
211
211
|
// extract secrets from the manifest. Store them in a separate variable
|
|
212
|
-
// and remove them from the manifest because we need to create them
|
|
213
|
-
// separately
|
|
214
212
|
const secrets = this.getSecretsFromManifest(v2Manifest);
|
|
215
213
|
// Azure Portal returns v2 manifest whereas the Graph API expects a v1.6
|
|
216
214
|
if (args.options.apisApplication || args.options.apisDelegated) {
|
|
@@ -218,6 +216,33 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
218
216
|
// otherwise, they will be skipped in the app update
|
|
219
217
|
v2Manifest.requiredResourceAccess = appInfo.requiredResourceAccess;
|
|
220
218
|
}
|
|
219
|
+
if (args.options.redirectUris) {
|
|
220
|
+
// take submitted redirectUris/platform as options
|
|
221
|
+
// otherwise, they will be removed from the app
|
|
222
|
+
v2Manifest.replyUrlsWithType = args.options.redirectUris.split(',').map(u => {
|
|
223
|
+
return {
|
|
224
|
+
url: u.trim(),
|
|
225
|
+
type: this.translatePlatformToType(args.options.platform)
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
if (args.options.multitenant) {
|
|
230
|
+
// override manifest setting when using multitenant flag
|
|
231
|
+
v2Manifest.signInAudience = 'AzureADMultipleOrgs';
|
|
232
|
+
}
|
|
233
|
+
if (args.options.implicitFlow) {
|
|
234
|
+
// remove manifest settings when using implicitFlow flag
|
|
235
|
+
delete v2Manifest.oauth2AllowIdTokenImplicitFlow;
|
|
236
|
+
delete v2Manifest.oauth2AllowImplicitFlow;
|
|
237
|
+
}
|
|
238
|
+
if (args.options.scopeName) {
|
|
239
|
+
// override manifest setting when using options.
|
|
240
|
+
delete v2Manifest.oauth2Permissions;
|
|
241
|
+
}
|
|
242
|
+
if (args.options.certificateFile || args.options.certificateBase64Encoded) {
|
|
243
|
+
// override manifest setting when using options.
|
|
244
|
+
delete v2Manifest.keyCredentials;
|
|
245
|
+
}
|
|
221
246
|
const graphManifest = this.transformManifest(v2Manifest);
|
|
222
247
|
const updateAppRequestOptions = {
|
|
223
248
|
url: `${this.resource}/v1.0/myorganization/applications/${appInfo.id}`,
|
|
@@ -428,7 +453,6 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
428
453
|
return odata_1.odata
|
|
429
454
|
.getAllItems(`${this.resource}/v1.0/myorganization/servicePrincipals?$select=appId,appRoles,id,oauth2PermissionScopes,servicePrincipalNames`)
|
|
430
455
|
.then(servicePrincipals => {
|
|
431
|
-
var _a;
|
|
432
456
|
let resolvedApis = [];
|
|
433
457
|
try {
|
|
434
458
|
if (args.options.apisDelegated || args.options.apisApplication) {
|
|
@@ -451,17 +475,10 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
451
475
|
}
|
|
452
476
|
});
|
|
453
477
|
}
|
|
454
|
-
|
|
478
|
+
else {
|
|
455
479
|
const manifestApis = this.manifest.requiredResourceAccess;
|
|
456
480
|
manifestApis.forEach(manifestApi => {
|
|
457
|
-
|
|
458
|
-
if (requiredResource) {
|
|
459
|
-
// exclude if any duplicate required resources in both manifest and submitted options
|
|
460
|
-
requiredResource.resourceAccess.push(...manifestApi.resourceAccess.filter(manRes => !requiredResource.resourceAccess.some(res => res.id === manRes.id)));
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
463
|
-
resolvedApis.push(manifestApi);
|
|
464
|
-
}
|
|
481
|
+
resolvedApis.push(manifestApi);
|
|
465
482
|
const app = servicePrincipals.find(servicePrincipals => servicePrincipals.appId === manifestApi.resourceAppId);
|
|
466
483
|
if (app) {
|
|
467
484
|
manifestApi.resourceAccess.forEach((res => {
|
|
@@ -550,7 +567,7 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
550
567
|
}
|
|
551
568
|
}
|
|
552
569
|
configureSecret(args, appInfo, logger) {
|
|
553
|
-
if (!args.options.withSecret) {
|
|
570
|
+
if (!args.options.withSecret || (appInfo.secrets && appInfo.secrets.length > 0)) {
|
|
554
571
|
return Promise.resolve(appInfo);
|
|
555
572
|
}
|
|
556
573
|
if (this.verbose) {
|
|
@@ -560,6 +577,7 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
560
577
|
.createSecret({ appObjectId: appInfo.id })
|
|
561
578
|
.then(secret => {
|
|
562
579
|
appInfo.secret = secret.value;
|
|
580
|
+
appInfo.secrets = [{ displayName: secret.displayName, value: secret.value }];
|
|
563
581
|
return Promise.resolve(appInfo);
|
|
564
582
|
});
|
|
565
583
|
}
|
|
@@ -643,6 +661,12 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
643
661
|
}
|
|
644
662
|
return Promise.resolve(appInfo);
|
|
645
663
|
}
|
|
664
|
+
translatePlatformToType(platform) {
|
|
665
|
+
if (platform === 'publicClient') {
|
|
666
|
+
return 'InstalledClient';
|
|
667
|
+
}
|
|
668
|
+
return platform.charAt(0).toUpperCase() + platform.substring(1);
|
|
669
|
+
}
|
|
646
670
|
}
|
|
647
671
|
_AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = function _AadAppAddCommand_initTelemetry() {
|
|
648
672
|
this.telemetry.push((args) => {
|
|
@@ -37,12 +37,17 @@ class StatusCommand extends Command_1.default {
|
|
|
37
37
|
logger.logToStderr({
|
|
38
38
|
connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken),
|
|
39
39
|
authType: Auth_1.AuthType[Auth_1.default.service.authType],
|
|
40
|
+
appId: Auth_1.default.service.appId,
|
|
41
|
+
appTenant: Auth_1.default.service.tenant,
|
|
40
42
|
accessTokens: JSON.stringify(Auth_1.default.service.accessTokens, null, 2)
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
else {
|
|
44
46
|
logger.log({
|
|
45
|
-
connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken)
|
|
47
|
+
connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken),
|
|
48
|
+
authType: Auth_1.AuthType[Auth_1.default.service.authType],
|
|
49
|
+
appId: Auth_1.default.service.appId,
|
|
50
|
+
appTenant: Auth_1.default.service.tenant
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
53
|
}
|
|
@@ -15,10 +15,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _OutlookMailSendCommand_instances, _OutlookMailSendCommand_initTelemetry, _OutlookMailSendCommand_initOptions, _OutlookMailSendCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const fs = require("fs");
|
|
19
|
+
const path = require("path");
|
|
18
20
|
const Auth_1 = require("../../../../Auth");
|
|
19
21
|
const request_1 = require("../../../../request");
|
|
20
22
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
21
23
|
const commands_1 = require("../../commands");
|
|
24
|
+
const validation_1 = require("../../../../utils/validation");
|
|
22
25
|
class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
23
26
|
constructor() {
|
|
24
27
|
super();
|
|
@@ -37,7 +40,6 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
|
37
40
|
return [commands_1.default.SENDMAIL];
|
|
38
41
|
}
|
|
39
42
|
commandAction(logger, args) {
|
|
40
|
-
var _a, _b;
|
|
41
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
44
|
try {
|
|
43
45
|
const isAppOnlyAuth = Auth_1.Auth.isAppOnlyAuth(Auth_1.default.service.accessTokens[this.resource].accessToken);
|
|
@@ -51,28 +53,8 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
|
51
53
|
'content-type': 'application/json'
|
|
52
54
|
},
|
|
53
55
|
responseType: 'json',
|
|
54
|
-
data:
|
|
55
|
-
message: {
|
|
56
|
-
subject: args.options.subject,
|
|
57
|
-
body: {
|
|
58
|
-
contentType: args.options.bodyContentType || 'Text',
|
|
59
|
-
content: args.options.bodyContents
|
|
60
|
-
},
|
|
61
|
-
toRecipients: this.mapEmailAddressesToRecipients(args.options.to.split(',')),
|
|
62
|
-
ccRecipients: this.mapEmailAddressesToRecipients((_a = args.options.cc) === null || _a === void 0 ? void 0 : _a.split(',')),
|
|
63
|
-
bccRecipients: this.mapEmailAddressesToRecipients((_b = args.options.bcc) === null || _b === void 0 ? void 0 : _b.split(',')),
|
|
64
|
-
importance: args.options.importance
|
|
65
|
-
},
|
|
66
|
-
saveToSentItems: args.options.saveToSentItems
|
|
67
|
-
}
|
|
56
|
+
data: this.getRequestBody(args.options)
|
|
68
57
|
};
|
|
69
|
-
if (args.options.mailbox) {
|
|
70
|
-
requestOptions.data.message.from = {
|
|
71
|
-
emailAddress: {
|
|
72
|
-
address: args.options.mailbox
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
58
|
yield request_1.default.post(requestOptions);
|
|
77
59
|
}
|
|
78
60
|
catch (err) {
|
|
@@ -80,15 +62,40 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
|
80
62
|
}
|
|
81
63
|
});
|
|
82
64
|
}
|
|
83
|
-
|
|
84
|
-
if (!
|
|
85
|
-
return
|
|
65
|
+
mapEmailAddressToRecipient(email) {
|
|
66
|
+
if (!email) {
|
|
67
|
+
return undefined;
|
|
86
68
|
}
|
|
87
|
-
return
|
|
69
|
+
return {
|
|
88
70
|
emailAddress: {
|
|
89
71
|
address: email.trim()
|
|
90
72
|
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
getRequestBody(options) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
const attachments = typeof options.attachment === 'string' ? [options.attachment] : options.attachment;
|
|
78
|
+
const attachmentContents = attachments === null || attachments === void 0 ? void 0 : attachments.map(a => ({
|
|
79
|
+
'@odata.type': '#microsoft.graph.fileAttachment',
|
|
80
|
+
name: path.basename(a),
|
|
81
|
+
contentBytes: fs.readFileSync(a, { encoding: 'base64' })
|
|
91
82
|
}));
|
|
83
|
+
return ({
|
|
84
|
+
message: {
|
|
85
|
+
subject: options.subject,
|
|
86
|
+
body: {
|
|
87
|
+
contentType: options.bodyContentType || 'Text',
|
|
88
|
+
content: options.bodyContents
|
|
89
|
+
},
|
|
90
|
+
from: this.mapEmailAddressToRecipient(options.mailbox),
|
|
91
|
+
toRecipients: options.to.split(',').map(mail => this.mapEmailAddressToRecipient(mail)),
|
|
92
|
+
ccRecipients: (_a = options.cc) === null || _a === void 0 ? void 0 : _a.split(',').map(mail => this.mapEmailAddressToRecipient(mail)),
|
|
93
|
+
bccRecipients: (_b = options.bcc) === null || _b === void 0 ? void 0 : _b.split(',').map(mail => this.mapEmailAddressToRecipient(mail)),
|
|
94
|
+
importance: options.importance,
|
|
95
|
+
attachments: attachmentContents
|
|
96
|
+
},
|
|
97
|
+
saveToSentItems: options.saveToSentItems
|
|
98
|
+
});
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
101
|
_OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initTelemetry = function _OutlookMailSendCommand_initTelemetry() {
|
|
@@ -100,7 +107,8 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
|
|
|
100
107
|
saveToSentItems: args.options.saveToSentItems,
|
|
101
108
|
importance: args.options.importance,
|
|
102
109
|
mailbox: typeof args.options.mailbox !== 'undefined',
|
|
103
|
-
sender: typeof args.options.sender !== 'undefined'
|
|
110
|
+
sender: typeof args.options.sender !== 'undefined',
|
|
111
|
+
attachment: typeof args.options.attachment !== 'undefined'
|
|
104
112
|
});
|
|
105
113
|
});
|
|
106
114
|
}, _OutlookMailSendCommand_initOptions = function _OutlookMailSendCommand_initOptions() {
|
|
@@ -124,6 +132,8 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
|
|
|
124
132
|
}, {
|
|
125
133
|
option: '--importance [importance]',
|
|
126
134
|
autocomplete: ['low', 'normal', 'high']
|
|
135
|
+
}, {
|
|
136
|
+
option: '--attachment [attachment]'
|
|
127
137
|
}, {
|
|
128
138
|
option: '--saveToSentItems [saveToSentItems]'
|
|
129
139
|
});
|
|
@@ -134,14 +144,28 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
|
|
|
134
144
|
args.options.bodyContentType !== 'HTML') {
|
|
135
145
|
return `${args.options.bodyContentType} is not a valid value for the bodyContentType option. Allowed values are Text|HTML`;
|
|
136
146
|
}
|
|
137
|
-
if (args.options.saveToSentItems &&
|
|
138
|
-
args.options.saveToSentItems !== 'true' &&
|
|
139
|
-
args.options.saveToSentItems !== 'false') {
|
|
147
|
+
if (args.options.saveToSentItems && !validation_1.validation.isValidBoolean(args.options.saveToSentItems)) {
|
|
140
148
|
return `${args.options.saveToSentItems} is not a valid value for the saveToSentItems option. Allowed values are true|false`;
|
|
141
149
|
}
|
|
142
150
|
if (args.options.importance && ['low', 'normal', 'high'].indexOf(args.options.importance) === -1) {
|
|
143
151
|
return `'${args.options.importance}' is not a valid value for the importance option. Allowed values are low|normal|high`;
|
|
144
152
|
}
|
|
153
|
+
if (args.options.attachment) {
|
|
154
|
+
const attachments = typeof args.options.attachment === 'string' ? [args.options.attachment] : args.options.attachment;
|
|
155
|
+
for (const attachment of attachments) {
|
|
156
|
+
if (!fs.existsSync(attachment)) {
|
|
157
|
+
return `File with path '${attachment}' was not found.`;
|
|
158
|
+
}
|
|
159
|
+
if (!fs.lstatSync(attachment).isFile()) {
|
|
160
|
+
return `'${attachment}' is not a file.`;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const requestBody = this.getRequestBody(args.options);
|
|
164
|
+
// The max body size of the request is 4 194 304 chars before getting a 413 response
|
|
165
|
+
if (JSON.stringify(requestBody).length > 4194304) {
|
|
166
|
+
return 'Exceeded the max total size of attachments which is 3MB.';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
145
169
|
return true;
|
|
146
170
|
}));
|
|
147
171
|
};
|
|
@@ -0,0 +1,110 @@
|
|
|
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 _PpCardGetCommand_instances, _PpCardGetCommand_initTelemetry, _PpCardGetCommand_initOptions, _PpCardGetCommand_initOptionSets, _PpCardGetCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const powerPlatform_1 = require("../../../../utils/powerPlatform");
|
|
19
|
+
const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
|
|
20
|
+
const commands_1 = require("../../commands");
|
|
21
|
+
const request_1 = require("../../../../request");
|
|
22
|
+
const validation_1 = require("../../../../utils/validation");
|
|
23
|
+
class PpCardGetCommand extends PowerPlatformCommand_1.default {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_PpCardGetCommand_instances.add(this);
|
|
27
|
+
__classPrivateFieldGet(this, _PpCardGetCommand_instances, "m", _PpCardGetCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _PpCardGetCommand_instances, "m", _PpCardGetCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _PpCardGetCommand_instances, "m", _PpCardGetCommand_initValidators).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _PpCardGetCommand_instances, "m", _PpCardGetCommand_initOptionSets).call(this);
|
|
31
|
+
}
|
|
32
|
+
get name() {
|
|
33
|
+
return commands_1.default.CARD_GET;
|
|
34
|
+
}
|
|
35
|
+
get description() {
|
|
36
|
+
return 'Get specific Microsoft Power Platform card in the specified Power Platform environment.';
|
|
37
|
+
}
|
|
38
|
+
defaultProperties() {
|
|
39
|
+
return ['name', 'cardid', 'publishdate', 'createdon', 'modifiedon'];
|
|
40
|
+
}
|
|
41
|
+
commandAction(logger, args) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (this.verbose) {
|
|
44
|
+
logger.logToStderr(`Retrieving a card '${args.options.id || args.options.name}'...`);
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
|
|
48
|
+
const res = yield this.getCard(dynamicsApiUrl, args.options);
|
|
49
|
+
logger.log(res);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
this.handleRejectedODataJsonPromise(err);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
getCard(dynamicsApiUrl, options) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const requestOptions = {
|
|
59
|
+
headers: {
|
|
60
|
+
accept: 'application/json;odata.metadata=none'
|
|
61
|
+
},
|
|
62
|
+
responseType: 'json'
|
|
63
|
+
};
|
|
64
|
+
if (options.id) {
|
|
65
|
+
requestOptions.url = `${dynamicsApiUrl}/api/data/v9.1/cards(${options.id})`;
|
|
66
|
+
const result = yield request_1.default.get(requestOptions);
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
requestOptions.url = `${dynamicsApiUrl}/api/data/v9.1/cards?$filter=name eq '${options.name}'`;
|
|
70
|
+
const result = yield request_1.default.get(requestOptions);
|
|
71
|
+
if (result.value.length === 0) {
|
|
72
|
+
throw `The specified card '${options.name}' does not exist.`;
|
|
73
|
+
}
|
|
74
|
+
if (result.value.length > 1) {
|
|
75
|
+
throw `Multiple cards with name '${options.name}' found: ${result.value.map(x => x.cardid).join(',')}`;
|
|
76
|
+
}
|
|
77
|
+
return result.value[0];
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
_PpCardGetCommand_instances = new WeakSet(), _PpCardGetCommand_initTelemetry = function _PpCardGetCommand_initTelemetry() {
|
|
82
|
+
this.telemetry.push((args) => {
|
|
83
|
+
Object.assign(this.telemetryProperties, {
|
|
84
|
+
id: typeof args.options.id !== 'undefined',
|
|
85
|
+
name: typeof args.options.name !== 'undefined',
|
|
86
|
+
asAdmin: !!args.options.asAdmin
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}, _PpCardGetCommand_initOptions = function _PpCardGetCommand_initOptions() {
|
|
90
|
+
this.options.unshift({
|
|
91
|
+
option: '-e, --environment <environment>'
|
|
92
|
+
}, {
|
|
93
|
+
option: '-i, --id [id]'
|
|
94
|
+
}, {
|
|
95
|
+
option: '-n, --name [name]'
|
|
96
|
+
}, {
|
|
97
|
+
option: '-a, --asAdmin'
|
|
98
|
+
});
|
|
99
|
+
}, _PpCardGetCommand_initOptionSets = function _PpCardGetCommand_initOptionSets() {
|
|
100
|
+
this.optionSets.push(['id', 'name']);
|
|
101
|
+
}, _PpCardGetCommand_initValidators = function _PpCardGetCommand_initValidators() {
|
|
102
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
|
|
104
|
+
return `${args.options.id} is not a valid GUID`;
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
}));
|
|
108
|
+
};
|
|
109
|
+
module.exports = new PpCardGetCommand();
|
|
110
|
+
//# sourceMappingURL=card-get.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
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 _PpGatewayGetCommand_instances, _PpGatewayGetCommand_initOptions, _PpGatewayGetCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const validation_1 = require("../../../../utils/validation");
|
|
20
|
+
const PowerBICommand_1 = require("../../../base/PowerBICommand");
|
|
21
|
+
const commands_1 = require("../../commands");
|
|
22
|
+
class PpGatewayGetCommand extends PowerBICommand_1.default {
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
_PpGatewayGetCommand_instances.add(this);
|
|
26
|
+
__classPrivateFieldGet(this, _PpGatewayGetCommand_instances, "m", _PpGatewayGetCommand_initOptions).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _PpGatewayGetCommand_instances, "m", _PpGatewayGetCommand_initValidators).call(this);
|
|
28
|
+
}
|
|
29
|
+
get name() {
|
|
30
|
+
return commands_1.default.GATEWAY_GET;
|
|
31
|
+
}
|
|
32
|
+
get description() {
|
|
33
|
+
return "Get information about the specified gateway.";
|
|
34
|
+
}
|
|
35
|
+
commandAction(logger, args) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
try {
|
|
38
|
+
const gateway = yield this.getGateway(args.options.id);
|
|
39
|
+
logger.log(gateway);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
this.handleRejectedODataJsonPromise(error);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
getGateway(gatewayId) {
|
|
47
|
+
const requestOptions = {
|
|
48
|
+
url: `${this.resource}/v1.0/myorg/gateways/${encodeURIComponent(gatewayId)}`,
|
|
49
|
+
headers: {
|
|
50
|
+
accept: "application/json;odata.metadata=none"
|
|
51
|
+
},
|
|
52
|
+
responseType: "json"
|
|
53
|
+
};
|
|
54
|
+
return request_1.default.get(requestOptions);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_PpGatewayGetCommand_instances = new WeakSet(), _PpGatewayGetCommand_initOptions = function _PpGatewayGetCommand_initOptions() {
|
|
58
|
+
this.options.unshift({
|
|
59
|
+
option: "-i, --id <id>"
|
|
60
|
+
});
|
|
61
|
+
}, _PpGatewayGetCommand_initValidators = function _PpGatewayGetCommand_initValidators() {
|
|
62
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
if (!validation_1.validation.isValidGuid(args.options.id)) {
|
|
64
|
+
return `${args.options.id} is not a valid GUID`;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
module.exports = new PpGatewayGetCommand();
|
|
70
|
+
//# sourceMappingURL=gateway-get.js.map
|
|
@@ -0,0 +1,117 @@
|
|
|
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 _PpSolutionGetCommand_instances, _PpSolutionGetCommand_initTelemetry, _PpSolutionGetCommand_initOptions, _PpSolutionGetCommand_initOptionSets, _PpSolutionGetCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const powerPlatform_1 = require("../../../../utils/powerPlatform");
|
|
20
|
+
const validation_1 = require("../../../../utils/validation");
|
|
21
|
+
const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
class PpSolutionGetCommand extends PowerPlatformCommand_1.default {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_PpSolutionGetCommand_instances.add(this);
|
|
27
|
+
__classPrivateFieldGet(this, _PpSolutionGetCommand_instances, "m", _PpSolutionGetCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _PpSolutionGetCommand_instances, "m", _PpSolutionGetCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _PpSolutionGetCommand_instances, "m", _PpSolutionGetCommand_initValidators).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _PpSolutionGetCommand_instances, "m", _PpSolutionGetCommand_initOptionSets).call(this);
|
|
31
|
+
}
|
|
32
|
+
get name() {
|
|
33
|
+
return commands_1.default.SOLUTION_GET;
|
|
34
|
+
}
|
|
35
|
+
get description() {
|
|
36
|
+
return 'Gets a specific solution in a given environment.';
|
|
37
|
+
}
|
|
38
|
+
defaultProperties() {
|
|
39
|
+
return ['uniquename', 'version', 'publisher'];
|
|
40
|
+
}
|
|
41
|
+
commandAction(logger, args) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (this.verbose) {
|
|
44
|
+
logger.logToStderr(`Retrieving a specific solution '${args.options.id || args.options.name}'...`);
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
|
|
48
|
+
const res = yield this.getSolution(dynamicsApiUrl, args.options);
|
|
49
|
+
if (!args.options.output || args.options.output === 'json') {
|
|
50
|
+
logger.log(res);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Converted to text friendly output
|
|
54
|
+
logger.log({
|
|
55
|
+
uniquename: res.uniquename,
|
|
56
|
+
version: res.version,
|
|
57
|
+
publisher: res.publisherid.friendlyname
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
this.handleRejectedODataJsonPromise(err);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
getSolution(dynamicsApiUrl, options) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const requestOptions = {
|
|
69
|
+
headers: {
|
|
70
|
+
accept: 'application/json;odata.metadata=none'
|
|
71
|
+
},
|
|
72
|
+
responseType: 'json'
|
|
73
|
+
};
|
|
74
|
+
if (options.id) {
|
|
75
|
+
requestOptions.url = `${dynamicsApiUrl}/api/data/v9.0/solutions(${options.id})?$expand=publisherid($select=friendlyname)&$select=solutionid,uniquename,version,publisherid,installedon,solutionpackageversion,friendlyname,versionnumber&api-version=9.1`;
|
|
76
|
+
const result = yield request_1.default.get(requestOptions);
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
requestOptions.url = `${dynamicsApiUrl}/api/data/v9.0/solutions?$filter=isvisible eq true and uniquename eq \'${options.name}\'&$expand=publisherid($select=friendlyname)&$select=solutionid,uniquename,version,publisherid,installedon,solutionpackageversion,friendlyname,versionnumber&api-version=9.1`;
|
|
80
|
+
const result = yield request_1.default.get(requestOptions);
|
|
81
|
+
if (result.value.length === 0) {
|
|
82
|
+
throw `The specified solution '${options.name}' does not exist.`;
|
|
83
|
+
}
|
|
84
|
+
return result.value[0];
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
_PpSolutionGetCommand_instances = new WeakSet(), _PpSolutionGetCommand_initTelemetry = function _PpSolutionGetCommand_initTelemetry() {
|
|
89
|
+
this.telemetry.push((args) => {
|
|
90
|
+
Object.assign(this.telemetryProperties, {
|
|
91
|
+
id: typeof args.options.id !== 'undefined',
|
|
92
|
+
name: typeof args.options.name !== 'undefined',
|
|
93
|
+
asAdmin: !!args.options.asAdmin
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}, _PpSolutionGetCommand_initOptions = function _PpSolutionGetCommand_initOptions() {
|
|
97
|
+
this.options.unshift({
|
|
98
|
+
option: '-e, --environment <environment>'
|
|
99
|
+
}, {
|
|
100
|
+
option: '-i, --id [id]'
|
|
101
|
+
}, {
|
|
102
|
+
option: '-n, --name [name]'
|
|
103
|
+
}, {
|
|
104
|
+
option: '-a, --asAdmin'
|
|
105
|
+
});
|
|
106
|
+
}, _PpSolutionGetCommand_initOptionSets = function _PpSolutionGetCommand_initOptionSets() {
|
|
107
|
+
this.optionSets.push(['id', 'name']);
|
|
108
|
+
}, _PpSolutionGetCommand_initValidators = function _PpSolutionGetCommand_initValidators() {
|
|
109
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
|
|
111
|
+
return `${args.options.id} is not a valid GUID`;
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
|
+
module.exports = new PpSolutionGetCommand();
|
|
117
|
+
//# sourceMappingURL=solution-get.js.map
|
package/dist/m365/pp/commands.js
CHANGED
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const prefix = 'pp';
|
|
4
4
|
exports.default = {
|
|
5
|
+
CARD_GET: `${prefix} card get`,
|
|
5
6
|
CARD_LIST: `${prefix} card list`,
|
|
6
7
|
DATAVERSE_TABLE_LIST: `${prefix} dataverse table list`,
|
|
7
8
|
ENVIRONMENT_GET: `${prefix} environment get`,
|
|
8
9
|
ENVIRONMENT_LIST: `${prefix} environment list`,
|
|
10
|
+
GATEWAY_GET: `${prefix} gateway get`,
|
|
9
11
|
GATEWAY_LIST: `${prefix} gateway list`,
|
|
10
12
|
MANAGEMENTAPP_ADD: `${prefix} managementapp add`,
|
|
11
13
|
MANAGEMENTAPP_LIST: `${prefix} managementapp list`,
|
|
14
|
+
SOLUTION_GET: `${prefix} solution get`,
|
|
12
15
|
SOLUTION_LIST: `${prefix} solution list`,
|
|
13
16
|
TENANT_SETTINGS_LIST: `${prefix} tenant settings list`
|
|
14
17
|
};
|
|
@@ -68,6 +68,9 @@ class SpfxProjectDoctorCommand extends base_project_command_1.BaseProjectCommand
|
|
|
68
68
|
__classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initOptions).call(this);
|
|
69
69
|
__classPrivateFieldGet(this, _SpfxProjectDoctorCommand_instances, "m", _SpfxProjectDoctorCommand_initValidators).call(this);
|
|
70
70
|
}
|
|
71
|
+
get allowedOutputs() {
|
|
72
|
+
return ['json', 'text', 'md', 'tour'];
|
|
73
|
+
}
|
|
71
74
|
get name() {
|
|
72
75
|
return commands_1.default.PROJECT_DOCTOR;
|
|
73
76
|
}
|
|
@@ -333,7 +336,7 @@ _SpfxProjectDoctorCommand_instances = new WeakSet(), _SpfxProjectDoctorCommand_i
|
|
|
333
336
|
}, _SpfxProjectDoctorCommand_initOptions = function _SpfxProjectDoctorCommand_initOptions() {
|
|
334
337
|
this.options.forEach(o => {
|
|
335
338
|
if (o.option.indexOf('--output') > -1) {
|
|
336
|
-
o.autocomplete =
|
|
339
|
+
o.autocomplete = this.allowedOutputs;
|
|
337
340
|
}
|
|
338
341
|
});
|
|
339
342
|
this.options.unshift({
|
|
@@ -53,6 +53,9 @@ class SpfxProjectExternalizeCommand extends base_project_command_1.BaseProjectCo
|
|
|
53
53
|
this.allEditSuggestions = [];
|
|
54
54
|
__classPrivateFieldGet(this, _SpfxProjectExternalizeCommand_instances, "m", _SpfxProjectExternalizeCommand_initOptions).call(this);
|
|
55
55
|
}
|
|
56
|
+
get allowedOutputs() {
|
|
57
|
+
return ['json', 'text', 'md'];
|
|
58
|
+
}
|
|
56
59
|
get name() {
|
|
57
60
|
return commands_1.default.PROJECT_EXTERNALIZE;
|
|
58
61
|
}
|
|
@@ -185,7 +188,7 @@ class SpfxProjectExternalizeCommand extends base_project_command_1.BaseProjectCo
|
|
|
185
188
|
_SpfxProjectExternalizeCommand_instances = new WeakSet(), _SpfxProjectExternalizeCommand_initOptions = function _SpfxProjectExternalizeCommand_initOptions() {
|
|
186
189
|
this.options.forEach(o => {
|
|
187
190
|
if (o.option.indexOf('--output') > -1) {
|
|
188
|
-
o.autocomplete =
|
|
191
|
+
o.autocomplete = this.allowedOutputs;
|
|
189
192
|
}
|
|
190
193
|
});
|
|
191
194
|
};
|