@pnp/cli-microsoft365 10.5.0-beta.b872a3f → 10.5.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/README.md +1 -1
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +61 -3
- package/dist/appInsights.js +10 -4
- package/dist/m365/booking/commands/business/business-get.js +0 -3
- package/dist/m365/commands/login.js +3 -0
- package/dist/m365/entra/commands/user/user-guest-add.js +0 -3
- package/dist/m365/flow/commands/environment/environment-get.js +0 -3
- package/dist/m365/flow/commands/flow-get.js +0 -3
- package/dist/m365/flow/commands/run/run-get.js +0 -3
- package/dist/m365/pa/commands/app/app-get.js +0 -3
- package/dist/m365/pa/commands/environment/environment-get.js +0 -3
- package/dist/m365/planner/commands/bucket/bucket-add.js +0 -3
- package/dist/m365/planner/commands/plan/plan-add.js +0 -3
- package/dist/m365/planner/commands/plan/plan-get.js +0 -3
- package/dist/m365/planner/commands/plan/plan-set.js +0 -3
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +0 -3
- package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-get.js +0 -3
- package/dist/m365/pp/commands/card/card-get.js +0 -3
- package/dist/m365/pp/commands/copilot/copilot-get.js +0 -3
- package/dist/m365/pp/commands/dataverse/dataverse-table-get.js +0 -3
- package/dist/m365/pp/commands/environment/environment-get.js +0 -3
- package/dist/m365/pp/commands/solution/solution-get.js +0 -3
- package/dist/m365/pp/commands/solution/solution-publisher-get.js +0 -3
- package/dist/m365/pp/commands/website/website-get.js +0 -3
- package/dist/m365/spo/commands/group/group-member-add.js +0 -3
- package/dist/m365/spo/commands/homesite/homesite-add.js +66 -0
- package/dist/m365/spo/commands/page/page-copy.js +0 -3
- package/dist/m365/spo/commands/page/page-get.js +0 -3
- package/dist/m365/spo/commands/page/page-header-set.js +47 -10
- package/dist/m365/spo/commands/sitedesign/sitedesign-run-status-get.js +0 -3
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +0 -3
- package/dist/m365/todo/commands/list/list-get.js +0 -3
- package/dist/m365/todo/commands/task/task-get.js +0 -3
- package/dist/m365/viva/commands/engage/engage-community-user-add.js +113 -0
- package/dist/m365/viva/commands/engage/engage-community-user-remove.js +107 -0
- package/dist/m365/viva/commands/engage/engage-message-add.js +0 -3
- package/dist/m365/viva/commands/engage/engage-message-get.js +0 -3
- package/dist/m365/viva/commands/engage/engage-user-get.js +0 -3
- package/dist/m365/viva/commands.js +2 -0
- package/docs/docs/cmd/booking/business/business-get.mdx +13 -0
- package/docs/docs/cmd/entra/user/user-guest-add.mdx +11 -0
- package/docs/docs/cmd/flow/environment/environment-get.mdx +2 -0
- package/docs/docs/cmd/flow/flow-get.mdx +2 -0
- package/docs/docs/cmd/flow/run/run-get.mdx +17 -13
- package/docs/docs/cmd/login.mdx +9 -1
- package/docs/docs/cmd/pa/app/app-get.mdx +8 -2
- package/docs/docs/cmd/pa/environment/environment-get.mdx +5 -3
- package/docs/docs/cmd/planner/plan/plan-add.mdx +2 -0
- package/docs/docs/cmd/planner/plan/plan-get.mdx +8 -4
- package/docs/docs/cmd/planner/plan/plan-set.mdx +2 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-add.mdx +6 -3
- package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-get.mdx +12 -3
- package/docs/docs/cmd/pp/card/card-get.mdx +36 -5
- package/docs/docs/cmd/pp/copilot/copilot-get.mdx +41 -5
- package/docs/docs/cmd/pp/dataverse/dataverse-table-get.mdx +19 -4
- package/docs/docs/cmd/pp/environment/environment-get.mdx +5 -2
- package/docs/docs/cmd/pp/solution/solution-get.mdx +12 -7
- package/docs/docs/cmd/pp/solution/solution-publisher-get.mdx +12 -7
- package/docs/docs/cmd/pp/website/website-get.mdx +22 -4
- package/docs/docs/cmd/spo/group/group-member-add.mdx +12 -3
- package/docs/docs/cmd/spo/homesite/homesite-add.mdx +124 -0
- package/docs/docs/cmd/spo/page/page-copy.mdx +30 -4
- package/docs/docs/cmd/spo/page/page-get.mdx +44 -5
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-status-get.mdx +7 -0
- package/docs/docs/cmd/todo/list/list-get.mdx +7 -4
- package/docs/docs/cmd/todo/task/task-get.mdx +7 -2
- package/docs/docs/cmd/viva/engage/engage-community-user-add.mdx +67 -0
- package/docs/docs/cmd/viva/engage/engage-community-user-remove.mdx +55 -0
- package/docs/docs/cmd/viva/engage/engage-message-add.mdx +37 -12
- package/docs/docs/cmd/viva/engage/engage-message-get.mdx +27 -13
- package/docs/docs/cmd/viva/engage/engage-user-get.mdx +50 -8
- package/npm-shrinkwrap.json +97 -84
- package/package.json +15 -15
package/dist/Auth.js
CHANGED
|
@@ -53,6 +53,7 @@ export var AuthType;
|
|
|
53
53
|
AuthType["Password"] = "password";
|
|
54
54
|
AuthType["Certificate"] = "certificate";
|
|
55
55
|
AuthType["Identity"] = "identity";
|
|
56
|
+
AuthType["FederatedIdentity"] = "federatedIdentity";
|
|
56
57
|
AuthType["Browser"] = "browser";
|
|
57
58
|
AuthType["Secret"] = "secret";
|
|
58
59
|
})(AuthType || (AuthType = {}));
|
|
@@ -153,7 +154,8 @@ export class Auth {
|
|
|
153
154
|
// wasn't specified
|
|
154
155
|
if (this.connection.authType !== AuthType.Certificate &&
|
|
155
156
|
this.connection.authType !== AuthType.Secret &&
|
|
156
|
-
this.connection.authType !== AuthType.Identity
|
|
157
|
+
this.connection.authType !== AuthType.Identity &&
|
|
158
|
+
this.connection.authType !== AuthType.FederatedIdentity) {
|
|
157
159
|
this.clientApplication = await this.getPublicClient(logger, debug);
|
|
158
160
|
if (this.clientApplication) {
|
|
159
161
|
const accounts = await this.clientApplication.getTokenCache().getAllAccounts();
|
|
@@ -177,6 +179,9 @@ export class Auth {
|
|
|
177
179
|
case AuthType.Identity:
|
|
178
180
|
getTokenPromise = this.ensureAccessTokenWithIdentity.bind(this);
|
|
179
181
|
break;
|
|
182
|
+
case AuthType.FederatedIdentity:
|
|
183
|
+
getTokenPromise = this.ensureAccessTokenWithFederatedIdentity.bind(this);
|
|
184
|
+
break;
|
|
180
185
|
case AuthType.Browser:
|
|
181
186
|
getTokenPromise = this.ensureAccessTokenWithBrowser.bind(this);
|
|
182
187
|
break;
|
|
@@ -552,6 +557,56 @@ export class Auth {
|
|
|
552
557
|
}
|
|
553
558
|
}
|
|
554
559
|
}
|
|
560
|
+
async ensureAccessTokenWithFederatedIdentity(resource, logger, debug) {
|
|
561
|
+
if (debug) {
|
|
562
|
+
await logger.logToStderr('Trying to retrieve access token using federated identity...');
|
|
563
|
+
}
|
|
564
|
+
if (!process.env.ACTIONS_ID_TOKEN_REQUEST_URL || !process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN) {
|
|
565
|
+
throw new CommandError('Federated identity is currently only supported in GitHub Actions.');
|
|
566
|
+
}
|
|
567
|
+
if (debug) {
|
|
568
|
+
await logger.logToStderr('ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN env variables found. The context is GitHub Actions...');
|
|
569
|
+
}
|
|
570
|
+
const federationToken = await this.getFederationTokenFromGithub(logger, debug);
|
|
571
|
+
const queryParams = [
|
|
572
|
+
'grant_type=client_credentials',
|
|
573
|
+
`scope=${encodeURIComponent(`${resource}/.default`)}`,
|
|
574
|
+
`client_id=${this.connection.appId}`,
|
|
575
|
+
`client_assertion_type=${encodeURIComponent('urn:ietf:params:oauth:client-assertion-type:jwt-bearer')}`,
|
|
576
|
+
`client_assertion=${federationToken}`
|
|
577
|
+
];
|
|
578
|
+
const requestOptions = {
|
|
579
|
+
url: `https://login.microsoftonline.com/${this.connection.tenant}/oauth2/v2.0/token`,
|
|
580
|
+
headers: {
|
|
581
|
+
accept: 'application/json',
|
|
582
|
+
'x-anonymous': true,
|
|
583
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
584
|
+
},
|
|
585
|
+
data: queryParams.join('&'),
|
|
586
|
+
responseType: 'json'
|
|
587
|
+
};
|
|
588
|
+
const accessTokenResponse = await request.post(requestOptions);
|
|
589
|
+
return {
|
|
590
|
+
accessToken: accessTokenResponse.access_token,
|
|
591
|
+
expiresOn: new Date(parseInt(accessTokenResponse.expires_on) * 1000)
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
async getFederationTokenFromGithub(logger, debug) {
|
|
595
|
+
if (debug) {
|
|
596
|
+
await logger.logToStderr('Retrieving GitHub federation token...');
|
|
597
|
+
}
|
|
598
|
+
const requestOptions = {
|
|
599
|
+
url: `${process.env.ACTIONS_ID_TOKEN_REQUEST_URL}&audience=${encodeURIComponent('api://AzureADTokenExchange')}`,
|
|
600
|
+
headers: {
|
|
601
|
+
Authorization: `Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`,
|
|
602
|
+
accept: 'application/json',
|
|
603
|
+
'x-anonymous': true
|
|
604
|
+
},
|
|
605
|
+
responseType: 'json'
|
|
606
|
+
};
|
|
607
|
+
const accessTokenResponse = await request.get(requestOptions);
|
|
608
|
+
return accessTokenResponse.value;
|
|
609
|
+
}
|
|
555
610
|
async ensureAccessTokenWithSecret(resource, logger, debug, fetchNew) {
|
|
556
611
|
this.clientApplication = await this.getConfidentialClient(logger, debug, undefined, undefined, this.connection.secret);
|
|
557
612
|
return this.clientApplication.acquireTokenByClientCredential({
|
|
@@ -597,7 +652,9 @@ export class Auth {
|
|
|
597
652
|
await connectionStorage.set(JSON.stringify(this.connection));
|
|
598
653
|
let allConnections = await this.getAllConnections();
|
|
599
654
|
if (this.connection.active) {
|
|
600
|
-
allConnections = allConnections.filter(c => c.identityId !== this.connection.identityId
|
|
655
|
+
allConnections = allConnections.filter(c => c.identityId !== this.connection.identityId ||
|
|
656
|
+
c.appId !== this.connection.appId ||
|
|
657
|
+
c.tenant !== this.connection.tenant);
|
|
601
658
|
allConnections.forEach(c => c.active = false);
|
|
602
659
|
allConnections = [{ ...this.connection }, ...allConnections];
|
|
603
660
|
}
|
|
@@ -624,7 +681,8 @@ export class Auth {
|
|
|
624
681
|
// When using an application identity, there is no account in the MSAL TokenCache
|
|
625
682
|
if (this.connection.authType !== AuthType.Certificate &&
|
|
626
683
|
this.connection.authType !== AuthType.Secret &&
|
|
627
|
-
this.connection.authType !== AuthType.Identity
|
|
684
|
+
this.connection.authType !== AuthType.Identity &&
|
|
685
|
+
this.connection.authType !== AuthType.FederatedIdentity) {
|
|
628
686
|
this.clientApplication = await this.getPublicClient(logger, debug);
|
|
629
687
|
if (this.clientApplication) {
|
|
630
688
|
const tokenCache = this.clientApplication.getTokenCache();
|
package/dist/appInsights.js
CHANGED
|
@@ -5,7 +5,7 @@ process.env.APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 'none';
|
|
|
5
5
|
process.env.APPLICATION_INSIGHTS_NO_STATSBEAT = 'true';
|
|
6
6
|
// suppress all logging
|
|
7
7
|
process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL = 'NONE';
|
|
8
|
-
import
|
|
8
|
+
import appInsights from 'applicationinsights';
|
|
9
9
|
import crypto from 'crypto';
|
|
10
10
|
import fs from 'fs';
|
|
11
11
|
import os from 'os';
|
|
@@ -15,21 +15,27 @@ import { app } from './utils/app.js';
|
|
|
15
15
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
16
16
|
appInsights
|
|
17
17
|
.setup('InstrumentationKey=6b908c80-d09f-4cf6-8274-e54349a0149a;IngestionEndpoint=https://westeurope-3.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=d42020c6-da32-44f7-bbb7-666f0b3a664d')
|
|
18
|
+
.setAutoCollectRequests(false)
|
|
19
|
+
.setAutoCollectPerformance(false, false)
|
|
20
|
+
.setAutoCollectExceptions(false)
|
|
21
|
+
.setAutoCollectDependencies(false)
|
|
22
|
+
.setAutoCollectConsole(false, false)
|
|
23
|
+
.setAutoCollectPreAggregatedMetrics(false)
|
|
24
|
+
.setSendLiveMetrics(false)
|
|
25
|
+
.enableWebInstrumentation(false)
|
|
18
26
|
.setInternalLogging(false, false);
|
|
19
27
|
// append -dev to the version number when ran locally
|
|
20
28
|
// to distinguish production and dev version of the CLI
|
|
21
29
|
// in the telemetry
|
|
22
30
|
const version = `${app.packageJson().version}${fs.existsSync(path.join(__dirname, `..${path.sep}src`)) ? '-dev' : ''}`;
|
|
23
31
|
const env = process.env.CLIMICROSOFT365_ENV !== undefined ? process.env.CLIMICROSOFT365_ENV : '';
|
|
24
|
-
const appInsightsClient = appInsights.
|
|
32
|
+
const appInsightsClient = appInsights.defaultClient;
|
|
25
33
|
appInsightsClient.commonProperties = {
|
|
26
34
|
version: version,
|
|
27
35
|
node: process.version,
|
|
28
36
|
env: env,
|
|
29
37
|
ci: Boolean(process.env.CI).toString()
|
|
30
38
|
};
|
|
31
|
-
appInsightsClient.config.proxyHttpUrl = process.env.HTTP_PROXY ?? '';
|
|
32
|
-
appInsightsClient.config.proxyHttpsUrl = process.env.HTTPS_PROXY ?? '';
|
|
33
39
|
appInsightsClient.context.tags[appInsightsClient.context.keys.cloudRoleInstance] = crypto.createHash('sha256').update(os.hostname()).digest('hex');
|
|
34
40
|
delete appInsightsClient.context.tags[appInsightsClient.context.keys.cloudRole];
|
|
35
41
|
delete appInsightsClient.context.tags['ai.cloud.roleName'];
|
|
@@ -16,9 +16,6 @@ class BookingBusinessGetCommand extends GraphCommand {
|
|
|
16
16
|
get description() {
|
|
17
17
|
return 'Retrieve the specified Microsoft Bookings business.';
|
|
18
18
|
}
|
|
19
|
-
defaultProperties() {
|
|
20
|
-
return ['id', 'displayName', 'businessType', 'phone', 'email', 'defaultCurrencyIso'];
|
|
21
|
-
}
|
|
22
19
|
constructor() {
|
|
23
20
|
super();
|
|
24
21
|
_BookingBusinessGetCommand_instances.add(this);
|
|
@@ -184,6 +184,9 @@ class LoginCommand extends Command {
|
|
|
184
184
|
auth.connection.authType = AuthType.Identity;
|
|
185
185
|
auth.connection.userName = args.options.userName;
|
|
186
186
|
break;
|
|
187
|
+
case 'federatedIdentity':
|
|
188
|
+
auth.connection.authType = AuthType.FederatedIdentity;
|
|
189
|
+
break;
|
|
187
190
|
case 'browser':
|
|
188
191
|
auth.connection.authType = AuthType.Browser;
|
|
189
192
|
break;
|
|
@@ -20,9 +20,6 @@ class EntraUserGuestAddCommand extends GraphCommand {
|
|
|
20
20
|
__classPrivateFieldGet(this, _EntraUserGuestAddCommand_instances, "m", _EntraUserGuestAddCommand_initTelemetry).call(this);
|
|
21
21
|
__classPrivateFieldGet(this, _EntraUserGuestAddCommand_instances, "m", _EntraUserGuestAddCommand_initOptions).call(this);
|
|
22
22
|
}
|
|
23
|
-
defaultProperties() {
|
|
24
|
-
return ['id', 'inviteRedeemUrl', 'invitedUserDisplayName', 'invitedUserEmailAddress', 'invitedUserType', 'resetRedemption', 'sendInvitationMessage', 'status'];
|
|
25
|
-
}
|
|
26
23
|
async commandAction(logger, args) {
|
|
27
24
|
try {
|
|
28
25
|
const requestOptions = {
|
|
@@ -15,9 +15,6 @@ class FlowEnvironmentGetCommand extends PowerAutomateCommand {
|
|
|
15
15
|
get description() {
|
|
16
16
|
return 'Gets information about the specified Microsoft Flow environment';
|
|
17
17
|
}
|
|
18
|
-
defaultProperties() {
|
|
19
|
-
return ['name', 'id', 'location', 'displayName', 'provisioningState', 'environmentSku', 'azureRegionHint', 'isDefault'];
|
|
20
|
-
}
|
|
21
18
|
constructor() {
|
|
22
19
|
super();
|
|
23
20
|
_FlowEnvironmentGetCommand_instances.add(this);
|
|
@@ -15,9 +15,6 @@ class FlowGetCommand extends PowerAutomateCommand {
|
|
|
15
15
|
get description() {
|
|
16
16
|
return 'Gets information about the specified Microsoft Flow';
|
|
17
17
|
}
|
|
18
|
-
defaultProperties() {
|
|
19
|
-
return ['name', 'displayName', 'description', 'triggers', 'actions'];
|
|
20
|
-
}
|
|
21
18
|
constructor() {
|
|
22
19
|
super();
|
|
23
20
|
_FlowGetCommand_instances.add(this);
|
|
@@ -16,9 +16,6 @@ class FlowRunGetCommand extends PowerAutomateCommand {
|
|
|
16
16
|
get description() {
|
|
17
17
|
return 'Gets information about a specific run of the specified Microsoft Flow';
|
|
18
18
|
}
|
|
19
|
-
defaultProperties() {
|
|
20
|
-
return ['name', 'startTime', 'endTime', 'status', 'triggerName'];
|
|
21
|
-
}
|
|
22
19
|
constructor() {
|
|
23
20
|
super();
|
|
24
21
|
_FlowRunGetCommand_instances.add(this);
|
|
@@ -18,9 +18,6 @@ class PaAppGetCommand extends PowerAppsCommand {
|
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Gets information about the specified Microsoft Power App';
|
|
20
20
|
}
|
|
21
|
-
defaultProperties() {
|
|
22
|
-
return ['name', 'displayName', 'description', 'appVersion', 'owner'];
|
|
23
|
-
}
|
|
24
21
|
constructor() {
|
|
25
22
|
super();
|
|
26
23
|
_PaAppGetCommand_instances.add(this);
|
|
@@ -15,9 +15,6 @@ class PaEnvironmentGetCommand extends PowerAppsCommand {
|
|
|
15
15
|
get description() {
|
|
16
16
|
return 'Gets information about the specified Microsoft Power Apps environment';
|
|
17
17
|
}
|
|
18
|
-
defaultProperties() {
|
|
19
|
-
return ['name', 'id', 'location', 'displayName', 'provisioningState', 'environmentSku', 'azureRegionHint', 'isDefault'];
|
|
20
|
-
}
|
|
21
18
|
constructor() {
|
|
22
19
|
super();
|
|
23
20
|
_PaEnvironmentGetCommand_instances.add(this);
|
|
@@ -17,9 +17,6 @@ class PlannerBucketAddCommand extends GraphCommand {
|
|
|
17
17
|
get description() {
|
|
18
18
|
return 'Adds a new Microsoft Planner bucket';
|
|
19
19
|
}
|
|
20
|
-
defaultProperties() {
|
|
21
|
-
return ['id', 'name', 'planId', 'orderHint'];
|
|
22
|
-
}
|
|
23
20
|
constructor() {
|
|
24
21
|
super();
|
|
25
22
|
_PlannerBucketAddCommand_instances.add(this);
|
|
@@ -18,9 +18,6 @@ class PlannerPlanAddCommand extends GraphCommand {
|
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Adds a new Microsoft Planner plan';
|
|
20
20
|
}
|
|
21
|
-
defaultProperties() {
|
|
22
|
-
return ['id', 'title', 'createdDateTime', 'owner'];
|
|
23
|
-
}
|
|
24
21
|
constructor() {
|
|
25
22
|
super();
|
|
26
23
|
_PlannerPlanAddCommand_instances.add(this);
|
|
@@ -17,9 +17,6 @@ class PlannerPlanGetCommand extends GraphCommand {
|
|
|
17
17
|
get description() {
|
|
18
18
|
return 'Get a Microsoft Planner plan';
|
|
19
19
|
}
|
|
20
|
-
defaultProperties() {
|
|
21
|
-
return ['id', 'title', 'createdDateTime', 'owner', '@odata.etag'];
|
|
22
|
-
}
|
|
23
20
|
constructor() {
|
|
24
21
|
super();
|
|
25
22
|
_PlannerPlanGetCommand_instances.add(this);
|
|
@@ -18,9 +18,6 @@ class PlannerPlanSetCommand extends GraphCommand {
|
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Updates a Microsoft Planner plan';
|
|
20
20
|
}
|
|
21
|
-
defaultProperties() {
|
|
22
|
-
return ['id', 'title', 'createdDateTime', 'owner'];
|
|
23
|
-
}
|
|
24
21
|
constructor() {
|
|
25
22
|
super();
|
|
26
23
|
_PlannerPlanSetCommand_instances.add(this);
|
|
@@ -17,9 +17,6 @@ class PlannerTaskChecklistItemAddCommand extends GraphCommand {
|
|
|
17
17
|
get description() {
|
|
18
18
|
return 'Adds a new checklist item to a Planner task.';
|
|
19
19
|
}
|
|
20
|
-
defaultProperties() {
|
|
21
|
-
return ['id', 'title', 'isChecked'];
|
|
22
|
-
}
|
|
23
20
|
constructor() {
|
|
24
21
|
super();
|
|
25
22
|
_PlannerTaskChecklistItemAddCommand_instances.add(this);
|
|
@@ -18,9 +18,6 @@ class PpAiBuilderModelGetCommand extends PowerPlatformCommand {
|
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Get an AI builder model in the specified Power Platform environment.';
|
|
20
20
|
}
|
|
21
|
-
defaultProperties() {
|
|
22
|
-
return ['msdyn_name', 'msdyn_aimodelid', 'createdon', 'modifiedon'];
|
|
23
|
-
}
|
|
24
21
|
constructor() {
|
|
25
22
|
super();
|
|
26
23
|
_PpAiBuilderModelGetCommand_instances.add(this);
|
|
@@ -18,9 +18,6 @@ class PpCardGetCommand extends PowerPlatformCommand {
|
|
|
18
18
|
get description() {
|
|
19
19
|
return 'Get specific Microsoft Power Platform card in the specified Power Platform environment.';
|
|
20
20
|
}
|
|
21
|
-
defaultProperties() {
|
|
22
|
-
return ['name', 'cardid', 'publishdate', 'createdon', 'modifiedon'];
|
|
23
|
-
}
|
|
24
21
|
constructor() {
|
|
25
22
|
super();
|
|
26
23
|
_PpCardGetCommand_instances.add(this);
|
|
@@ -21,9 +21,6 @@ class PpCopilotGetCommand extends PowerPlatformCommand {
|
|
|
21
21
|
alias() {
|
|
22
22
|
return [commands.CHATBOT_GET];
|
|
23
23
|
}
|
|
24
|
-
defaultProperties() {
|
|
25
|
-
return ['name', 'botid', 'publishedon', 'createdon', 'modifiedon'];
|
|
26
|
-
}
|
|
27
24
|
constructor() {
|
|
28
25
|
super();
|
|
29
26
|
_PpCopilotGetCommand_instances.add(this);
|
|
@@ -15,9 +15,6 @@ class PpDataverseTableGetCommand extends PowerPlatformCommand {
|
|
|
15
15
|
get description() {
|
|
16
16
|
return 'Gets a dataverse table in a given environment';
|
|
17
17
|
}
|
|
18
|
-
defaultProperties() {
|
|
19
|
-
return ['SchemaName', 'EntitySetName', 'LogicalName', 'IsManaged'];
|
|
20
|
-
}
|
|
21
18
|
constructor() {
|
|
22
19
|
super();
|
|
23
20
|
_PpDataverseTableGetCommand_instances.add(this);
|
|
@@ -15,9 +15,6 @@ class PpEnvironmentGetCommand extends PowerPlatformCommand {
|
|
|
15
15
|
get description() {
|
|
16
16
|
return 'Gets information about the specified Power Platform environment';
|
|
17
17
|
}
|
|
18
|
-
defaultProperties() {
|
|
19
|
-
return ['name', 'id'];
|
|
20
|
-
}
|
|
21
18
|
constructor() {
|
|
22
19
|
super();
|
|
23
20
|
_PpEnvironmentGetCommand_instances.add(this);
|
|
@@ -17,9 +17,6 @@ class PpSolutionGetCommand extends PowerPlatformCommand {
|
|
|
17
17
|
get description() {
|
|
18
18
|
return 'Gets a specific solution in a given environment.';
|
|
19
19
|
}
|
|
20
|
-
defaultProperties() {
|
|
21
|
-
return ['uniquename', 'version', 'publisher'];
|
|
22
|
-
}
|
|
23
20
|
constructor() {
|
|
24
21
|
super();
|
|
25
22
|
_PpSolutionGetCommand_instances.add(this);
|
|
@@ -16,9 +16,6 @@ class PpSolutionPublisherGetCommand extends PowerPlatformCommand {
|
|
|
16
16
|
get description() {
|
|
17
17
|
return 'Get information about the specified publisher in a given environment.';
|
|
18
18
|
}
|
|
19
|
-
defaultProperties() {
|
|
20
|
-
return ['publisherid', 'uniquename', 'friendlyname'];
|
|
21
|
-
}
|
|
22
19
|
constructor() {
|
|
23
20
|
super();
|
|
24
21
|
_PpSolutionPublisherGetCommand_instances.add(this);
|
|
@@ -22,9 +22,6 @@ class PpWebSiteGetCommand extends PowerPlatformCommand {
|
|
|
22
22
|
get description() {
|
|
23
23
|
return 'Gets information about the specified Power Pages website.';
|
|
24
24
|
}
|
|
25
|
-
defaultProperties() {
|
|
26
|
-
return ['id', 'name', 'websiteUrl', 'tenantId', 'subdomain', 'type', 'status', 'siteVisibility'];
|
|
27
|
-
}
|
|
28
25
|
get schema() {
|
|
29
26
|
return options;
|
|
30
27
|
}
|
|
@@ -17,9 +17,6 @@ class SpoGroupMemberAddCommand extends SpoCommand {
|
|
|
17
17
|
get description() {
|
|
18
18
|
return 'Add members to a SharePoint Group';
|
|
19
19
|
}
|
|
20
|
-
defaultProperties() {
|
|
21
|
-
return ['Title', 'UserPrincipalName'];
|
|
22
|
-
}
|
|
23
20
|
constructor() {
|
|
24
21
|
super();
|
|
25
22
|
_SpoGroupMemberAddCommand_instances.add(this);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zod } from '../../../../utils/zod.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { spo } from '../../../../utils/spo.js';
|
|
5
|
+
import { validation } from '../../../../utils/validation.js';
|
|
6
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
7
|
+
import commands from '../../commands.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
const options = globalOptionsZod
|
|
10
|
+
.extend({
|
|
11
|
+
url: zod.alias('u', z.string()
|
|
12
|
+
.refine((url) => validation.isValidSharePointUrl(url) === true, url => ({
|
|
13
|
+
message: `'${url}' is not a valid SharePoint Online site URL.`
|
|
14
|
+
}))),
|
|
15
|
+
audiences: z.string()
|
|
16
|
+
.refine(audiences => validation.isValidGuidArray(audiences) === true, audiences => ({
|
|
17
|
+
message: `The following GUIDs are invalid: ${validation.isValidGuidArray(audiences)}.`
|
|
18
|
+
})).optional(),
|
|
19
|
+
vivaConnectionsDefaultStart: z.boolean().optional(),
|
|
20
|
+
isInDraftMode: z.boolean().optional(),
|
|
21
|
+
order: z.number()
|
|
22
|
+
.refine(order => validation.isValidPositiveInteger(order) === true, order => ({
|
|
23
|
+
message: `'${order}' is not a positive integer.`
|
|
24
|
+
})).optional()
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
class SpoHomeSiteAddCommand extends SpoCommand {
|
|
28
|
+
get name() {
|
|
29
|
+
return commands.HOMESITE_ADD;
|
|
30
|
+
}
|
|
31
|
+
get description() {
|
|
32
|
+
return 'Adds a home site';
|
|
33
|
+
}
|
|
34
|
+
get schema() {
|
|
35
|
+
return options;
|
|
36
|
+
}
|
|
37
|
+
async commandAction(logger, args) {
|
|
38
|
+
try {
|
|
39
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
40
|
+
const requestOptions = {
|
|
41
|
+
url: `${spoAdminUrl}/_api/SPHSite/AddHomeSite`,
|
|
42
|
+
headers: {
|
|
43
|
+
accept: 'application/json;odata=nometadata'
|
|
44
|
+
},
|
|
45
|
+
responseType: 'json',
|
|
46
|
+
data: {
|
|
47
|
+
siteUrl: args.options.url,
|
|
48
|
+
audiences: args.options.audiences?.split(','),
|
|
49
|
+
vivaConnectionsDefaultStart: args.options.vivaConnectionsDefaultStart ?? true,
|
|
50
|
+
isInDraftMode: args.options.isInDraftMode ?? false,
|
|
51
|
+
order: args.options.order
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
if (this.verbose) {
|
|
55
|
+
await logger.logToStderr(`Adding home site with URL: ${args.options.url}...`);
|
|
56
|
+
}
|
|
57
|
+
const res = await request.post(requestOptions);
|
|
58
|
+
await logger.log(res);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
this.handleRejectedODataJsonPromise(err);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export default new SpoHomeSiteAddCommand();
|
|
66
|
+
//# sourceMappingURL=homesite-add.js.map
|
|
@@ -16,9 +16,6 @@ class SpoPageCopyCommand extends SpoCommand {
|
|
|
16
16
|
get description() {
|
|
17
17
|
return 'Creates a copy of a modern page or template';
|
|
18
18
|
}
|
|
19
|
-
defaultProperties() {
|
|
20
|
-
return ['Id', 'PageLayoutType', 'Title', 'Url'];
|
|
21
|
-
}
|
|
22
19
|
constructor() {
|
|
23
20
|
super();
|
|
24
21
|
_SpoPageCopyCommand_instances.add(this);
|
|
@@ -25,9 +25,6 @@ class SpoPageGetCommand extends SpoCommand {
|
|
|
25
25
|
get description() {
|
|
26
26
|
return 'Gets information about the specific modern page';
|
|
27
27
|
}
|
|
28
|
-
defaultProperties() {
|
|
29
|
-
return ['commentsDisabled', 'numSections', 'numControls', 'title', 'layoutType'];
|
|
30
|
-
}
|
|
31
28
|
get schema() {
|
|
32
29
|
return options;
|
|
33
30
|
}
|
|
@@ -9,6 +9,7 @@ import { formatting } from '../../../../utils/formatting.js';
|
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
10
10
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
11
11
|
import commands from '../../commands.js';
|
|
12
|
+
const BannerWebPartId = 'cbe7b0a9-3504-44dd-a3a3-0e5cacd07788';
|
|
12
13
|
class SpoPageHeaderSetCommand extends SpoCommand {
|
|
13
14
|
get name() {
|
|
14
15
|
return commands.PAGE_HEADER_SET;
|
|
@@ -28,8 +29,8 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
28
29
|
}
|
|
29
30
|
async commandAction(logger, args) {
|
|
30
31
|
const noPageHeader = {
|
|
31
|
-
"id":
|
|
32
|
-
"instanceId":
|
|
32
|
+
"id": BannerWebPartId,
|
|
33
|
+
"instanceId": BannerWebPartId,
|
|
33
34
|
"title": "Title Region",
|
|
34
35
|
"description": "Title Region Description",
|
|
35
36
|
"serverProcessedContent": {
|
|
@@ -50,8 +51,8 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
const defaultPageHeader = {
|
|
53
|
-
"id":
|
|
54
|
-
"instanceId":
|
|
54
|
+
"id": BannerWebPartId,
|
|
55
|
+
"instanceId": BannerWebPartId,
|
|
55
56
|
"title": "Title Region",
|
|
56
57
|
"description": "Title Region Description",
|
|
57
58
|
"serverProcessedContent": {
|
|
@@ -72,8 +73,8 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
75
|
const customPageHeader = {
|
|
75
|
-
"id":
|
|
76
|
-
"instanceId":
|
|
76
|
+
"id": BannerWebPartId,
|
|
77
|
+
"instanceId": BannerWebPartId,
|
|
77
78
|
"title": "Title Region",
|
|
78
79
|
"description": "Title Region Description",
|
|
79
80
|
"serverProcessedContent": {
|
|
@@ -177,6 +178,14 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
177
178
|
title = pageData.Title;
|
|
178
179
|
topicHeader = topicHeader || pageData.TopicHeader || "";
|
|
179
180
|
}
|
|
181
|
+
const pageControls = JSON.parse(pageData.CanvasContent1);
|
|
182
|
+
//In the new design page header is is a configurable Banner webpart in the first full-width section
|
|
183
|
+
const headerControl = pageControls.find(control => control?.position?.zoneIndex === 1 && control?.position?.sectionFactor === 0 && control?.webPartId === BannerWebPartId);
|
|
184
|
+
const isStandardPageHeader = pageData.LayoutWebpartsContent !== '[]';
|
|
185
|
+
//LayoutWebpartsContent represents standard page header
|
|
186
|
+
if (!isStandardPageHeader) {
|
|
187
|
+
header = headerControl?.webPartData || header;
|
|
188
|
+
}
|
|
180
189
|
header.properties.title = title;
|
|
181
190
|
header.properties.textAlignment = args.options.textAlignment || 'Left';
|
|
182
191
|
header.properties.showTopicHeader = args.options.showTopicHeader || false;
|
|
@@ -232,8 +241,39 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
232
241
|
}
|
|
233
242
|
}
|
|
234
243
|
const requestBody = {
|
|
235
|
-
LayoutWebpartsContent: JSON.stringify([header])
|
|
244
|
+
LayoutWebpartsContent: JSON.stringify([header]),
|
|
245
|
+
CanvasContent1: canvasContent
|
|
236
246
|
};
|
|
247
|
+
if (!isStandardPageHeader) {
|
|
248
|
+
requestBody.LayoutWebpartsContent = '[]';
|
|
249
|
+
header.properties.title = topicHeader;
|
|
250
|
+
if (headerControl) {
|
|
251
|
+
headerControl.webPartData = header;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
for (const pageControl of pageControls) {
|
|
255
|
+
if (pageControl?.position?.sectionIndex) {
|
|
256
|
+
pageControl.position.sectionIndex += pageControl.position.sectionIndex;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
pageControls.push({
|
|
260
|
+
id: BannerWebPartId,
|
|
261
|
+
controlType: 3,
|
|
262
|
+
displayMode: 2,
|
|
263
|
+
emphasis: {},
|
|
264
|
+
position: {
|
|
265
|
+
zoneIndex: 1,
|
|
266
|
+
sectionFactor: 0,
|
|
267
|
+
layoutIndex: 1,
|
|
268
|
+
controlIndex: 1,
|
|
269
|
+
sectionIndex: 1
|
|
270
|
+
},
|
|
271
|
+
webPartId: BannerWebPartId,
|
|
272
|
+
webPartData: header
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
requestBody.CanvasContent1 = JSON.stringify(pageControls);
|
|
276
|
+
}
|
|
237
277
|
if (title) {
|
|
238
278
|
requestBody.Title = title;
|
|
239
279
|
}
|
|
@@ -249,9 +289,6 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
249
289
|
if (bannerImageUrl) {
|
|
250
290
|
requestBody.BannerImageUrl = bannerImageUrl;
|
|
251
291
|
}
|
|
252
|
-
if (canvasContent) {
|
|
253
|
-
requestBody.CanvasContent1 = canvasContent;
|
|
254
|
-
}
|
|
255
292
|
requestOptions = {
|
|
256
293
|
url: `${args.options.webUrl}/_api/sitepages/pages/GetByUrl('sitepages/${formatting.encodeQueryParameter(pageFullName)}')/SavePageAsDraft`,
|
|
257
294
|
headers: {
|
|
@@ -15,9 +15,6 @@ class SpoSiteDesignRunStatusGetCommand extends SpoCommand {
|
|
|
15
15
|
get description() {
|
|
16
16
|
return 'Gets information about the site scripts executed for the specified site design';
|
|
17
17
|
}
|
|
18
|
-
defaultProperties() {
|
|
19
|
-
return ['ActionTitle', 'SiteScriptTitle', 'OutcomeText'];
|
|
20
|
-
}
|
|
21
18
|
constructor() {
|
|
22
19
|
super();
|
|
23
20
|
_SpoSiteDesignRunStatusGetCommand_instances.add(this);
|
|
@@ -116,6 +116,7 @@ export default {
|
|
|
116
116
|
GROUP_MEMBER_REMOVE: `${prefix} group member remove`,
|
|
117
117
|
HIDEDEFAULTTHEMES_GET: `${prefix} hidedefaultthemes get`,
|
|
118
118
|
HIDEDEFAULTTHEMES_SET: `${prefix} hidedefaultthemes set`,
|
|
119
|
+
HOMESITE_ADD: `${prefix} homesite add`,
|
|
119
120
|
HOMESITE_GET: `${prefix} homesite get`,
|
|
120
121
|
HOMESITE_LIST: `${prefix} homesite list`,
|
|
121
122
|
HOMESITE_REMOVE: `${prefix} homesite remove`,
|
|
@@ -14,9 +14,6 @@ class TenantServiceAnnouncementHealthGetCommand extends GraphCommand {
|
|
|
14
14
|
get description() {
|
|
15
15
|
return 'This operation provides the health information of a specified service for a tenant';
|
|
16
16
|
}
|
|
17
|
-
defaultProperties() {
|
|
18
|
-
return ['id', 'status', 'service'];
|
|
19
|
-
}
|
|
20
17
|
constructor() {
|
|
21
18
|
super();
|
|
22
19
|
_TenantServiceAnnouncementHealthGetCommand_instances.add(this);
|
|
@@ -15,9 +15,6 @@ class TodoListGetCommand extends DelegatedGraphCommand {
|
|
|
15
15
|
get description() {
|
|
16
16
|
return 'Gets a specific list of Microsoft To Do task lists';
|
|
17
17
|
}
|
|
18
|
-
defaultProperties() {
|
|
19
|
-
return ['displayName', 'id'];
|
|
20
|
-
}
|
|
21
18
|
constructor() {
|
|
22
19
|
super();
|
|
23
20
|
_TodoListGetCommand_instances.add(this);
|
|
@@ -16,9 +16,6 @@ class TodoTaskGetCommand extends DelegatedGraphCommand {
|
|
|
16
16
|
get description() {
|
|
17
17
|
return 'Get a specific task from a Microsoft To Do task list';
|
|
18
18
|
}
|
|
19
|
-
defaultProperties() {
|
|
20
|
-
return ['id', 'title', 'status', 'createdDateTime', 'lastModifiedDateTime'];
|
|
21
|
-
}
|
|
22
19
|
constructor() {
|
|
23
20
|
super();
|
|
24
21
|
_TodoTaskGetCommand_instances.add(this);
|