@pnp/cli-microsoft365 11.0.0-beta.3d99ea3 → 11.0.0-beta.4abfd23
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/.devproxy/api-specs/sharepoint.yaml +54 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Command.js +4 -0
- package/dist/m365/adaptivecard/commands/adaptivecard-send.js +1 -1
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-add.js +13 -27
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +18 -43
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +10 -21
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +25 -49
- package/dist/m365/entra/commands/group/group-member-add.js +6 -27
- package/dist/m365/entra/commands/group/group-member-set.js +5 -26
- package/dist/m365/entra/commands/m365group/m365group-get.js +1 -7
- package/dist/m365/entra/commands/m365group/m365group-list.js +1 -7
- package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +1 -7
- package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +1 -7
- package/dist/m365/entra/commands/pim/pim-role-request-list.js +1 -7
- package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +146 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/flow/commands/environment/environment-get.js +19 -29
- package/dist/m365/flow/commands/flow-list.js +7 -14
- package/dist/m365/flow/commands/run/run-get.js +1 -7
- package/dist/m365/graph/commands/openextension/openextension-add.js +2 -2
- package/dist/m365/graph/commands/openextension/openextension-set.js +2 -6
- package/dist/m365/graph/commands/subscription/subscription-add.js +3 -10
- package/dist/m365/pa/commands/environment/environment-get.js +18 -23
- package/dist/m365/pp/commands/copilot/copilot-get.js +0 -4
- package/dist/m365/pp/commands/copilot/copilot-list.js +0 -4
- package/dist/m365/pp/commands/copilot/copilot-remove.js +0 -4
- package/dist/m365/pp/commands/environment/environment-get.js +19 -26
- package/dist/m365/pp/commands/solution/solution-publisher-list.js +1 -8
- package/dist/m365/pp/commands.js +0 -3
- package/dist/m365/purview/commands/threatassessment/threatassessment-get.js +1 -7
- package/dist/m365/spfx/commands/project/project-upgrade.js +23 -66
- package/dist/m365/spo/commands/file/file-move.js +2 -8
- package/dist/m365/spo/commands/file/file-version-keep.js +78 -0
- package/dist/m365/spo/commands/homesite/homesite-get.js +28 -14
- package/dist/m365/spo/commands/homesite/homesite-list.js +1 -12
- package/dist/m365/spo/commands/homesite/homesite-remove.js +6 -34
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +4 -13
- package/dist/m365/spo/commands/hubsite/hubsite-list.js +1 -8
- package/dist/m365/spo/commands/list/list-view-add.js +1 -1
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-list.js +17 -25
- package/dist/m365/spo/commands/{tenant/tenant-site-archive.js → site/site-archive.js} +14 -14
- package/dist/m365/spo/commands/{tenant/tenant-site-list.js → site/site-list.js} +16 -27
- package/dist/m365/spo/commands/{tenant/tenant-site-membership-list.js → site/site-membership-list.js} +15 -15
- package/dist/m365/spo/commands/{tenant/tenant-site-rename.js → site/site-rename.js} +14 -14
- package/dist/m365/spo/commands/{tenant/tenant-site-unarchive.js → site/site-unarchive.js} +14 -14
- package/dist/m365/spo/commands/term/term-list.js +1 -7
- package/dist/m365/spo/commands.js +5 -6
- package/dist/m365/teams/commands/chat/chat-member-add.js +3 -9
- package/dist/m365/viva/commands/engage/engage-network-list.js +1 -7
- package/dist/utils/entraAdministrativeUnit.js +1 -1
- package/docs/docs/cmd/entra/group/group-member-add.mdx +7 -26
- package/docs/docs/cmd/entra/group/group-member-set.mdx +5 -23
- package/docs/docs/cmd/entra/m365group/m365group-get.mdx +0 -3
- package/docs/docs/cmd/entra/m365group/m365group-list.mdx +0 -3
- package/docs/docs/cmd/entra/pim/pim-role-assignment-eligibility-list.mdx +0 -3
- package/docs/docs/cmd/entra/pim/pim-role-assignment-list.mdx +0 -3
- package/docs/docs/cmd/entra/pim/pim-role-request-list.mdx +0 -3
- package/docs/docs/cmd/entra/roleassignment/roleassignment-add.mdx +163 -0
- package/docs/docs/cmd/flow/environment/environment-get.mdx +6 -5
- package/docs/docs/cmd/flow/flow-list.mdx +0 -3
- package/docs/docs/cmd/flow/run/run-get.mdx +0 -3
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +0 -3
- package/docs/docs/cmd/pa/environment/environment-get.mdx +5 -2
- package/docs/docs/cmd/pp/copilot/copilot-get.mdx +0 -6
- package/docs/docs/cmd/pp/copilot/copilot-list.mdx +0 -6
- package/docs/docs/cmd/pp/copilot/copilot-remove.mdx +0 -6
- package/docs/docs/cmd/pp/environment/environment-get.mdx +5 -2
- package/docs/docs/cmd/pp/solution/solution-publisher-list.mdx +0 -3
- package/docs/docs/cmd/purview/threatassessment/threatassessment-get.mdx +0 -3
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +18 -5
- package/docs/docs/cmd/spo/file/file-move.mdx +0 -3
- package/docs/docs/cmd/spo/file/file-version-keep.mdx +68 -0
- package/docs/docs/cmd/spo/homesite/homesite-get.mdx +44 -23
- package/docs/docs/cmd/spo/homesite/homesite-list.mdx +0 -6
- package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +10 -35
- package/docs/docs/cmd/spo/homesite/homesite-set.mdx +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-get.mdx +0 -3
- package/docs/docs/cmd/spo/hubsite/hubsite-list.mdx +0 -3
- package/docs/docs/cmd/spo/list/list-view-add.mdx +11 -11
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-list.mdx +18 -18
- package/docs/docs/cmd/spo/{tenant/tenant-site-archive.mdx → site/site-archive.mdx} +4 -4
- package/docs/docs/cmd/spo/{tenant/tenant-site-list.mdx → site/site-list.mdx} +7 -16
- package/docs/docs/cmd/spo/{tenant/tenant-site-membership-list.mdx → site/site-membership-list.mdx} +5 -5
- package/docs/docs/cmd/spo/{tenant/tenant-site-rename.mdx → site/site-rename.mdx} +7 -7
- package/docs/docs/cmd/spo/{tenant/tenant-site-unarchive.mdx → site/site-unarchive.mdx} +4 -4
- package/docs/docs/cmd/spo/term/term-list.mdx +0 -3
- package/docs/docs/cmd/teams/chat/chat-member-add.mdx +2 -5
- package/docs/docs/cmd/viva/engage/engage-network-list.mdx +0 -3
- package/package.json +1 -1
- package/dist/m365/spo/commands/tenant/SPOTenantSitePropertiesEnumerable.js +0 -2
- package/dist/m365/spo/commands/tenant/TenantSiteProperties.js +0 -2
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
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");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _PpEnvironmentGetCommand_instances, _PpEnvironmentGetCommand_initTelemetry, _PpEnvironmentGetCommand_initOptions;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
4
|
import { formatting } from '../../../../utils/formatting.js';
|
|
5
|
+
import { zod } from '../../../../utils/zod.js';
|
|
9
6
|
import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
|
|
10
7
|
import commands from '../../commands.js';
|
|
8
|
+
const options = globalOptionsZod
|
|
9
|
+
.extend({
|
|
10
|
+
name: zod.alias('n', z.string().optional()),
|
|
11
|
+
default: z.boolean().optional(),
|
|
12
|
+
asAdmin: z.boolean().optional()
|
|
13
|
+
})
|
|
14
|
+
.strict();
|
|
11
15
|
class PpEnvironmentGetCommand extends PowerPlatformCommand {
|
|
12
16
|
get name() {
|
|
13
17
|
return commands.ENVIRONMENT_GET;
|
|
@@ -15,11 +19,14 @@ class PpEnvironmentGetCommand extends PowerPlatformCommand {
|
|
|
15
19
|
get description() {
|
|
16
20
|
return 'Gets information about the specified Power Platform environment';
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
get schema() {
|
|
23
|
+
return options;
|
|
24
|
+
}
|
|
25
|
+
getRefinedSchema(schema) {
|
|
26
|
+
return schema
|
|
27
|
+
.refine(options => !!options.name !== !!options.default, {
|
|
28
|
+
message: `Specify either name or default, but not both.`
|
|
29
|
+
});
|
|
23
30
|
}
|
|
24
31
|
async commandAction(logger, args) {
|
|
25
32
|
if (this.verbose) {
|
|
@@ -29,7 +36,7 @@ class PpEnvironmentGetCommand extends PowerPlatformCommand {
|
|
|
29
36
|
if (args.options.asAdmin) {
|
|
30
37
|
url += '/scopes/admin';
|
|
31
38
|
}
|
|
32
|
-
const envName = args.options.
|
|
39
|
+
const envName = args.options.default ? '~Default' : formatting.encodeQueryParameter(args.options.name);
|
|
33
40
|
url += `/environments/${envName}?api-version=2020-10-01`;
|
|
34
41
|
const requestOptions = {
|
|
35
42
|
url: url,
|
|
@@ -42,19 +49,5 @@ class PpEnvironmentGetCommand extends PowerPlatformCommand {
|
|
|
42
49
|
await logger.log(response);
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
|
-
_PpEnvironmentGetCommand_instances = new WeakSet(), _PpEnvironmentGetCommand_initTelemetry = function _PpEnvironmentGetCommand_initTelemetry() {
|
|
46
|
-
this.telemetry.push((args) => {
|
|
47
|
-
Object.assign(this.telemetryProperties, {
|
|
48
|
-
name: typeof args.options.name !== 'undefined',
|
|
49
|
-
asAdmin: !!args.options.asAdmin
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}, _PpEnvironmentGetCommand_initOptions = function _PpEnvironmentGetCommand_initOptions() {
|
|
53
|
-
this.options.unshift({
|
|
54
|
-
option: '-n, --name [name]'
|
|
55
|
-
}, {
|
|
56
|
-
option: '--asAdmin'
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
52
|
export default new PpEnvironmentGetCommand();
|
|
60
53
|
//# sourceMappingURL=environment-get.js.map
|
|
@@ -25,17 +25,13 @@ class PpSolutionPublisherListCommand extends PowerPlatformCommand {
|
|
|
25
25
|
__classPrivateFieldGet(this, _PpSolutionPublisherListCommand_instances, "m", _PpSolutionPublisherListCommand_initOptions).call(this);
|
|
26
26
|
}
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
|
-
if (args.options.includeMicrosoftPublishers) {
|
|
29
|
-
await this.warn(logger, `Parameter 'includeMicrosoftPublishers' is deprecated. Please use 'withMicrosoftPublishers' instead`);
|
|
30
|
-
}
|
|
31
28
|
if (this.verbose) {
|
|
32
29
|
await logger.logToStderr(`Retrieving list of publishers...`);
|
|
33
30
|
}
|
|
34
31
|
try {
|
|
35
32
|
const dynamicsApiUrl = await powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
36
|
-
const shouldIncludeMicrosoftPublishers = args.options.withMicrosoftPublishers || args.options.includeMicrosoftPublishers;
|
|
37
33
|
const requestOptions = {
|
|
38
|
-
url: `${dynamicsApiUrl}/api/data/v9.0/publishers?$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix${!
|
|
34
|
+
url: `${dynamicsApiUrl}/api/data/v9.0/publishers?$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix${!args.options.withMicrosoftPublishers ? `&$filter=publisherid ne 'd21aab70-79e7-11dd-8874-00188b01e34f'` : ''}&api-version=9.1`,
|
|
39
35
|
headers: {
|
|
40
36
|
accept: 'application/json;odata.metadata=none'
|
|
41
37
|
},
|
|
@@ -52,7 +48,6 @@ class PpSolutionPublisherListCommand extends PowerPlatformCommand {
|
|
|
52
48
|
_PpSolutionPublisherListCommand_instances = new WeakSet(), _PpSolutionPublisherListCommand_initTelemetry = function _PpSolutionPublisherListCommand_initTelemetry() {
|
|
53
49
|
this.telemetry.push((args) => {
|
|
54
50
|
Object.assign(this.telemetryProperties, {
|
|
55
|
-
includeMicrosoftPublishers: typeof args.options.includeMicrosoftPublishers !== 'undefined',
|
|
56
51
|
withMicrosoftPublishers: typeof args.options.withMicrosoftPublishers !== 'undefined',
|
|
57
52
|
asAdmin: !!args.options.asAdmin
|
|
58
53
|
});
|
|
@@ -60,8 +55,6 @@ _PpSolutionPublisherListCommand_instances = new WeakSet(), _PpSolutionPublisherL
|
|
|
60
55
|
}, _PpSolutionPublisherListCommand_initOptions = function _PpSolutionPublisherListCommand_initOptions() {
|
|
61
56
|
this.options.unshift({
|
|
62
57
|
option: '-e, --environmentName <environmentName>'
|
|
63
|
-
}, {
|
|
64
|
-
option: '--includeMicrosoftPublishers'
|
|
65
58
|
}, {
|
|
66
59
|
option: '--withMicrosoftPublishers'
|
|
67
60
|
}, {
|
package/dist/m365/pp/commands.js
CHANGED
|
@@ -3,9 +3,6 @@ export default {
|
|
|
3
3
|
AIBUILDERMODEL_GET: `${prefix} aibuildermodel get`,
|
|
4
4
|
AIBUILDERMODEL_LIST: `${prefix} aibuildermodel list`,
|
|
5
5
|
AIBUILDERMODEL_REMOVE: `${prefix} aibuildermodel remove`,
|
|
6
|
-
CHATBOT_GET: `${prefix} chatbot get`,
|
|
7
|
-
CHATBOT_LIST: `${prefix} chatbot list`,
|
|
8
|
-
CHATBOT_REMOVE: `${prefix} chatbot remove`,
|
|
9
6
|
COPILOT_GET: `${prefix} copilot get`,
|
|
10
7
|
COPILOT_LIST: `${prefix} copilot list`,
|
|
11
8
|
COPILOT_REMOVE: `${prefix} copilot remove`,
|
|
@@ -24,15 +24,11 @@ class PurviewThreatAssessmentGetCommand extends GraphCommand {
|
|
|
24
24
|
}
|
|
25
25
|
async commandAction(logger, args) {
|
|
26
26
|
try {
|
|
27
|
-
if (args.options.includeResults) {
|
|
28
|
-
await this.warn(logger, `Parameter 'includeResults' is deprecated. Please use 'withResults' instead`);
|
|
29
|
-
}
|
|
30
27
|
if (this.verbose) {
|
|
31
28
|
await logger.logToStderr(`Retrieving threat assessment with id ${args.options.id}`);
|
|
32
29
|
}
|
|
33
|
-
const shouldIncludeResults = args.options.includeResults || args.options.withResults;
|
|
34
30
|
const requestOptions = {
|
|
35
|
-
url: `${this.resource}/v1.0/informationProtection/threatAssessmentRequests/${args.options.id}${
|
|
31
|
+
url: `${this.resource}/v1.0/informationProtection/threatAssessmentRequests/${args.options.id}${args.options.withResults ? '?$expand=results' : ''}`,
|
|
36
32
|
headers: {
|
|
37
33
|
accept: 'application/json;odata.metadata=none'
|
|
38
34
|
},
|
|
@@ -56,8 +52,6 @@ _PurviewThreatAssessmentGetCommand_instances = new WeakSet(), _PurviewThreatAsse
|
|
|
56
52
|
}, _PurviewThreatAssessmentGetCommand_initOptions = function _PurviewThreatAssessmentGetCommand_initOptions() {
|
|
57
53
|
this.options.unshift({
|
|
58
54
|
option: '-i, --id <id>'
|
|
59
|
-
}, {
|
|
60
|
-
option: '--includeResults'
|
|
61
55
|
}, {
|
|
62
56
|
option: '--withResults'
|
|
63
57
|
});
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
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");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _SpfxProjectUpgradeCommand_instances, _a, _SpfxProjectUpgradeCommand_initTelemetry, _SpfxProjectUpgradeCommand_initOptions, _SpfxProjectUpgradeCommand_initValidators;
|
|
7
1
|
import fs from 'fs';
|
|
8
2
|
import os from 'os';
|
|
9
3
|
import path from 'path';
|
|
10
4
|
// uncomment to support upgrading to preview releases
|
|
11
5
|
import { prerelease } from 'semver';
|
|
12
|
-
import {
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { CommandError, globalOptionsZod } from '../../../../Command.js';
|
|
13
8
|
import { fsUtil } from '../../../../utils/fsUtil.js';
|
|
14
9
|
import { packageManager } from '../../../../utils/packageManager.js';
|
|
10
|
+
import { zod } from '../../../../utils/zod.js';
|
|
15
11
|
import commands from '../../commands.js';
|
|
16
12
|
import { BaseProjectCommand } from './base-project-command.js';
|
|
17
13
|
import { FN017001_MISC_npm_dedupe } from './project-upgrade/rules/FN017001_MISC_npm_dedupe.js';
|
|
14
|
+
const options = globalOptionsZod
|
|
15
|
+
.extend({
|
|
16
|
+
packageManager: z.enum(['npm', 'pnpm', 'yarn']).default('npm'),
|
|
17
|
+
preview: z.boolean().optional(),
|
|
18
|
+
toVersion: zod.alias('v', z.string().optional()),
|
|
19
|
+
shell: z.enum(['bash', 'powershell', 'cmd']).default('powershell'),
|
|
20
|
+
output: z.enum(['json', 'text', 'md', 'tour', 'csv', 'none']).optional()
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
18
23
|
class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
19
24
|
get name() {
|
|
20
25
|
return commands.PROJECT_UPGRADE;
|
|
@@ -25,12 +30,14 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
25
30
|
get allowedOutputs() {
|
|
26
31
|
return ['json', 'text', 'md', 'tour'];
|
|
27
32
|
}
|
|
33
|
+
get schema() {
|
|
34
|
+
return options;
|
|
35
|
+
}
|
|
28
36
|
constructor() {
|
|
29
37
|
super();
|
|
30
|
-
_SpfxProjectUpgradeCommand_instances.add(this);
|
|
31
38
|
this.toVersion = '';
|
|
32
|
-
this.packageManager = '
|
|
33
|
-
this.shell = '
|
|
39
|
+
this.packageManager = '';
|
|
40
|
+
this.shell = '';
|
|
34
41
|
this.allFindings = [];
|
|
35
42
|
this.supportedVersions = [
|
|
36
43
|
'1.0.0',
|
|
@@ -80,14 +87,11 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
80
87
|
'1.21.1',
|
|
81
88
|
'1.22.0-beta.1'
|
|
82
89
|
];
|
|
83
|
-
__classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initTelemetry).call(this);
|
|
84
|
-
__classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initOptions).call(this);
|
|
85
|
-
__classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initValidators).call(this);
|
|
86
90
|
}
|
|
87
91
|
async commandAction(logger, args) {
|
|
88
92
|
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
89
93
|
if (this.projectRootPath === null) {
|
|
90
|
-
throw new CommandError(`Couldn't find project root folder`,
|
|
94
|
+
throw new CommandError(`Couldn't find project root folder`, SpfxProjectUpgradeCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
|
|
91
95
|
}
|
|
92
96
|
this.toVersion = args.options.toVersion ? args.options.toVersion : this.supportedVersions[this.supportedVersions.length - 1];
|
|
93
97
|
// uncomment to support upgrading to preview releases
|
|
@@ -101,21 +105,21 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
101
105
|
this.toVersion = this.supportedVersions[this.supportedVersions.length - 2];
|
|
102
106
|
}
|
|
103
107
|
this.packageManager = args.options.packageManager || 'npm';
|
|
104
|
-
this.shell = args.options.shell || '
|
|
108
|
+
this.shell = args.options.shell || 'powershell';
|
|
105
109
|
if (this.supportedVersions.indexOf(this.toVersion) < 0) {
|
|
106
|
-
throw new CommandError(`CLI for Microsoft 365 doesn't support upgrading SharePoint Framework projects to version ${this.toVersion}. Supported versions are ${this.supportedVersions.join(', ')}`,
|
|
110
|
+
throw new CommandError(`CLI for Microsoft 365 doesn't support upgrading SharePoint Framework projects to version ${this.toVersion}. Supported versions are ${this.supportedVersions.join(', ')}`, SpfxProjectUpgradeCommand.ERROR_UNSUPPORTED_TO_VERSION);
|
|
107
111
|
}
|
|
108
112
|
this.projectVersion = this.getProjectVersion();
|
|
109
113
|
if (!this.projectVersion) {
|
|
110
|
-
throw new CommandError(`Unable to determine the version of the current SharePoint Framework project`,
|
|
114
|
+
throw new CommandError(`Unable to determine the version of the current SharePoint Framework project`, SpfxProjectUpgradeCommand.ERROR_NO_VERSION);
|
|
111
115
|
}
|
|
112
116
|
const pos = this.supportedVersions.indexOf(this.projectVersion);
|
|
113
117
|
if (pos < 0) {
|
|
114
|
-
throw new CommandError(`CLI for Microsoft 365 doesn't support upgrading projects built using SharePoint Framework v${this.projectVersion}`,
|
|
118
|
+
throw new CommandError(`CLI for Microsoft 365 doesn't support upgrading projects built using SharePoint Framework v${this.projectVersion}`, SpfxProjectUpgradeCommand.ERROR_UNSUPPORTED_FROM_VERSION);
|
|
115
119
|
}
|
|
116
120
|
const posTo = this.supportedVersions.indexOf(this.toVersion);
|
|
117
121
|
if (pos > posTo) {
|
|
118
|
-
throw new CommandError('You cannot downgrade a project',
|
|
122
|
+
throw new CommandError('You cannot downgrade a project', SpfxProjectUpgradeCommand.ERROR_NO_DOWNGRADE);
|
|
119
123
|
}
|
|
120
124
|
if (pos === posTo) {
|
|
121
125
|
await logger.log(`Project doesn't need to be upgraded`);
|
|
@@ -479,53 +483,6 @@ ${f.resolution}
|
|
|
479
483
|
};
|
|
480
484
|
}
|
|
481
485
|
}
|
|
482
|
-
_a = SpfxProjectUpgradeCommand, _SpfxProjectUpgradeCommand_instances = new WeakSet(), _SpfxProjectUpgradeCommand_initTelemetry = function _SpfxProjectUpgradeCommand_initTelemetry() {
|
|
483
|
-
this.telemetry.push((args) => {
|
|
484
|
-
Object.assign(this.telemetryProperties, {
|
|
485
|
-
toVersion: args.options.toVersion || this.supportedVersions[this.supportedVersions.length - 1],
|
|
486
|
-
packageManager: args.options.packageManager || 'npm',
|
|
487
|
-
shell: args.options.shell || 'bash',
|
|
488
|
-
preview: args.options.preview
|
|
489
|
-
});
|
|
490
|
-
// uncomment to support upgrading to preview releases
|
|
491
|
-
if (prerelease(this.telemetryProperties.toVersion) && !args.options.preview) {
|
|
492
|
-
this.telemetryProperties.toVersion = this.supportedVersions[this.supportedVersions.length - 2];
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
}, _SpfxProjectUpgradeCommand_initOptions = function _SpfxProjectUpgradeCommand_initOptions() {
|
|
496
|
-
this.options.unshift({
|
|
497
|
-
option: '-v, --toVersion [toVersion]'
|
|
498
|
-
}, {
|
|
499
|
-
option: '--packageManager [packageManager]',
|
|
500
|
-
autocomplete: _a.packageManagers
|
|
501
|
-
}, {
|
|
502
|
-
option: '--shell [shell]',
|
|
503
|
-
autocomplete: _a.shells
|
|
504
|
-
}, {
|
|
505
|
-
option: '--preview'
|
|
506
|
-
});
|
|
507
|
-
this.options.forEach(o => {
|
|
508
|
-
if (o.option.indexOf('--output') > -1) {
|
|
509
|
-
o.autocomplete = this.allowedOutputs;
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
}, _SpfxProjectUpgradeCommand_initValidators = function _SpfxProjectUpgradeCommand_initValidators() {
|
|
513
|
-
this.validators.push(async (args) => {
|
|
514
|
-
if (args.options.packageManager) {
|
|
515
|
-
if (_a.packageManagers.indexOf(args.options.packageManager) < 0) {
|
|
516
|
-
return `${args.options.packageManager} is not a supported package manager. Supported package managers are ${_a.packageManagers.join(', ')}`;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
if (args.options.shell) {
|
|
520
|
-
if (_a.shells.indexOf(args.options.shell) < 0) {
|
|
521
|
-
return `${args.options.shell} is not a supported shell. Supported shells are ${_a.shells.join(', ')}`;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
return true;
|
|
525
|
-
});
|
|
526
|
-
};
|
|
527
|
-
SpfxProjectUpgradeCommand.packageManagers = ['npm', 'pnpm', 'yarn'];
|
|
528
|
-
SpfxProjectUpgradeCommand.shells = ['bash', 'powershell', 'cmd'];
|
|
529
486
|
SpfxProjectUpgradeCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
|
|
530
487
|
SpfxProjectUpgradeCommand.ERROR_UNSUPPORTED_TO_VERSION = 2;
|
|
531
488
|
SpfxProjectUpgradeCommand.ERROR_NO_VERSION = 3;
|
|
@@ -35,9 +35,6 @@ class SpoFileMoveCommand extends SpoCommand {
|
|
|
35
35
|
const sourceServerRelativePath = await this.getSourcePath(logger, args.options);
|
|
36
36
|
const sourcePath = this.getAbsoluteUrl(args.options.webUrl, sourceServerRelativePath);
|
|
37
37
|
const destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl);
|
|
38
|
-
if (args.options.includeItemPermissions) {
|
|
39
|
-
await this.warn(logger, `Parameter 'includeItemPermissions' is deprecated. Please use 'withItemPermissions' instead`);
|
|
40
|
-
}
|
|
41
38
|
if (this.verbose) {
|
|
42
39
|
await logger.logToStderr(`Moving file '${sourceServerRelativePath}' to '${args.options.targetUrl}'...`);
|
|
43
40
|
}
|
|
@@ -49,7 +46,7 @@ class SpoFileMoveCommand extends SpoCommand {
|
|
|
49
46
|
const copyJobResponse = await spo.createFileCopyJob(args.options.webUrl, sourcePath, destinationPath, {
|
|
50
47
|
nameConflictBehavior: this.getNameConflictBehaviorValue(args.options.nameConflictBehavior),
|
|
51
48
|
bypassSharedLock: !!args.options.bypassSharedLock,
|
|
52
|
-
includeItemPermissions: !!args.options.
|
|
49
|
+
includeItemPermissions: !!args.options.withItemPermissions,
|
|
53
50
|
newName: newName,
|
|
54
51
|
operation: 'move'
|
|
55
52
|
});
|
|
@@ -121,7 +118,6 @@ _SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry
|
|
|
121
118
|
sourceId: typeof args.options.sourceId !== 'undefined',
|
|
122
119
|
newName: typeof args.options.newName !== 'undefined',
|
|
123
120
|
nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined',
|
|
124
|
-
includeItemPermissions: !!args.options.includeItemPermissions,
|
|
125
121
|
withItemPermissions: !!args.options.withItemPermissions,
|
|
126
122
|
bypassSharedLock: !!args.options.bypassSharedLock,
|
|
127
123
|
skipWait: !!args.options.skipWait
|
|
@@ -141,8 +137,6 @@ _SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry
|
|
|
141
137
|
}, {
|
|
142
138
|
option: '--nameConflictBehavior [nameConflictBehavior]',
|
|
143
139
|
autocomplete: this.nameConflictBehaviorOptions
|
|
144
|
-
}, {
|
|
145
|
-
option: '--includeItemPermissions'
|
|
146
140
|
}, {
|
|
147
141
|
option: '--withItemPermissions'
|
|
148
142
|
}, {
|
|
@@ -168,7 +162,7 @@ _SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry
|
|
|
168
162
|
this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
|
|
169
163
|
}, _SpoFileMoveCommand_initTypes = function _SpoFileMoveCommand_initTypes() {
|
|
170
164
|
this.types.string.push('webUrl', 'sourceUrl', 'sourceId', 'targetUrl', 'newName', 'nameConflictBehavior');
|
|
171
|
-
this.types.boolean.push('
|
|
165
|
+
this.types.boolean.push('withItemPermissions', 'bypassSharedLock', 'skipWait');
|
|
172
166
|
};
|
|
173
167
|
export default new SpoFileMoveCommand();
|
|
174
168
|
//# sourceMappingURL=file-move.js.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import commands from '../../commands.js';
|
|
2
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { zod } from '../../../../utils/zod.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
7
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
import { odata } from '../../../../utils/odata.js';
|
|
11
|
+
export const options = globalOptionsZod
|
|
12
|
+
.extend({
|
|
13
|
+
webUrl: zod.alias('u', z.string()
|
|
14
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, url => ({
|
|
15
|
+
message: `'${url}' is not a valid SharePoint Online site URL.`
|
|
16
|
+
}))),
|
|
17
|
+
fileUrl: z.string().optional(),
|
|
18
|
+
fileId: zod.alias('i', z.string()
|
|
19
|
+
.refine(id => validation.isValidGuid(id), id => ({
|
|
20
|
+
message: `'${id}' is not a valid GUID.`
|
|
21
|
+
})).optional()),
|
|
22
|
+
label: z.string()
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
class SpoFileVersionKeepCommand extends SpoCommand {
|
|
26
|
+
get name() {
|
|
27
|
+
return commands.FILE_VERSION_KEEP;
|
|
28
|
+
}
|
|
29
|
+
get description() {
|
|
30
|
+
return 'Ensure that a specific file version will never expire';
|
|
31
|
+
}
|
|
32
|
+
get schema() {
|
|
33
|
+
return options;
|
|
34
|
+
}
|
|
35
|
+
getRefinedSchema(schema) {
|
|
36
|
+
return schema
|
|
37
|
+
.refine(options => [options.fileUrl, options.fileId].filter(o => o !== undefined).length === 1, {
|
|
38
|
+
message: `Specify 'fileUrl' or 'fileId', but not both.`
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async commandAction(logger, args) {
|
|
42
|
+
if (this.verbose) {
|
|
43
|
+
await logger.logToStderr(`Ensuring version '${args.options.label}' of file '${args.options.fileUrl || args.options.fileId}' at site '${args.options.webUrl}' will never expire...`);
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const baseApiUrl = this.getBaseApiUrl(args.options.webUrl, args.options.fileUrl, args.options.fileId);
|
|
47
|
+
const response = await odata.getAllItems(`${baseApiUrl}/versions?$filter=VersionLabel eq '${formatting.encodeQueryParameter(args.options.label)}'&$select=ID`);
|
|
48
|
+
if (response.length === 0) {
|
|
49
|
+
throw `Version with label '${args.options.label}' not found.`;
|
|
50
|
+
}
|
|
51
|
+
const requestExpirationOptions = {
|
|
52
|
+
url: `${baseApiUrl}/versions(${response[0].ID})/SetExpirationDate()`,
|
|
53
|
+
headers: {
|
|
54
|
+
accept: 'application/json;odata=nometadata',
|
|
55
|
+
'content-type': 'application/json'
|
|
56
|
+
},
|
|
57
|
+
responseType: 'json'
|
|
58
|
+
};
|
|
59
|
+
await request.post(requestExpirationOptions);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
this.handleRejectedODataJsonPromise(err);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
getBaseApiUrl(webUrl, fileUrl, fileId) {
|
|
66
|
+
let requestUrl;
|
|
67
|
+
if (fileUrl) {
|
|
68
|
+
const serverRelUrl = urlUtil.getServerRelativePath(webUrl, fileUrl);
|
|
69
|
+
requestUrl = `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelUrl)}')`;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
requestUrl = `${webUrl}/_api/web/GetFileById('${fileId}')`;
|
|
73
|
+
}
|
|
74
|
+
return requestUrl;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export default new SpoFileVersionKeepCommand();
|
|
78
|
+
//# sourceMappingURL=file-version-keep.js.map
|
|
@@ -1,28 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zod } from '../../../../utils/zod.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { validation } from '../../../../utils/validation.js';
|
|
2
5
|
import { spo } from '../../../../utils/spo.js';
|
|
3
6
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
4
7
|
import commands from '../../commands.js';
|
|
8
|
+
import { odata } from '../../../../utils/odata.js';
|
|
9
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
+
const options = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
url: zod.alias('u', z.string()
|
|
13
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, url => ({
|
|
14
|
+
message: `'${url}' is not a valid SharePoint Online site URL.`
|
|
15
|
+
})))
|
|
16
|
+
})
|
|
17
|
+
.strict();
|
|
5
18
|
class SpoHomeSiteGetCommand extends SpoCommand {
|
|
6
19
|
get name() {
|
|
7
20
|
return commands.HOMESITE_GET;
|
|
8
21
|
}
|
|
9
22
|
get description() {
|
|
10
|
-
return 'Gets information about
|
|
23
|
+
return 'Gets information about a home site';
|
|
11
24
|
}
|
|
12
|
-
|
|
25
|
+
get schema() {
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
13
29
|
try {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const res = await request.get(requestOptions);
|
|
23
|
-
if (!res["odata.null"]) {
|
|
24
|
-
await logger.log(res);
|
|
30
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
await logger.log(`Retrieving home sites...`);
|
|
33
|
+
}
|
|
34
|
+
const homeSites = await odata.getAllItems(`${spoAdminUrl}/_api/SPO.Tenant/GetTargetedSitesDetails`);
|
|
35
|
+
const homeSite = homeSites.find(hs => urlUtil.removeTrailingSlashes(hs.Url).toLowerCase() === urlUtil.removeTrailingSlashes(args.options.url).toLowerCase());
|
|
36
|
+
if (homeSite === undefined) {
|
|
37
|
+
throw `Home site with URL '${args.options.url}' not found.`;
|
|
25
38
|
}
|
|
39
|
+
await logger.log(homeSite);
|
|
26
40
|
}
|
|
27
41
|
catch (err) {
|
|
28
42
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -9,27 +9,16 @@ class SpoHomeSiteListCommand extends SpoCommand {
|
|
|
9
9
|
get description() {
|
|
10
10
|
return 'Lists all home sites';
|
|
11
11
|
}
|
|
12
|
-
alias() {
|
|
13
|
-
return [commands.TENANT_HOMESITE_LIST];
|
|
14
|
-
}
|
|
15
12
|
defaultProperties() {
|
|
16
13
|
return ['Url', 'Title'];
|
|
17
14
|
}
|
|
18
15
|
async commandAction(logger) {
|
|
19
|
-
await this.showDeprecationWarning(logger, commands.TENANT_HOMESITE_LIST, commands.HOMESITE_LIST);
|
|
20
16
|
try {
|
|
21
17
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
22
|
-
const requestOptions = {
|
|
23
|
-
url: `${spoAdminUrl}/_api/SPO.Tenant/GetTargetedSitesDetails`,
|
|
24
|
-
headers: {
|
|
25
|
-
accept: 'application/json;odata=nometadata'
|
|
26
|
-
},
|
|
27
|
-
responseType: 'json'
|
|
28
|
-
};
|
|
29
18
|
if (this.verbose) {
|
|
30
19
|
await logger.logToStderr(`Retrieving all home sites...`);
|
|
31
20
|
}
|
|
32
|
-
const res = await odata.getAllItems(
|
|
21
|
+
const res = await odata.getAllItems(`${spoAdminUrl}/_api/SPO.Tenant/GetTargetedSitesDetails`);
|
|
33
22
|
await logger.log(res);
|
|
34
23
|
}
|
|
35
24
|
catch (err) {
|
|
@@ -3,7 +3,6 @@ import { zod } from '../../../../utils/zod.js';
|
|
|
3
3
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
4
|
import { validation } from '../../../../utils/validation.js';
|
|
5
5
|
import { cli } from '../../../../cli/cli.js';
|
|
6
|
-
import config from '../../../../config.js';
|
|
7
6
|
import request from '../../../../request.js';
|
|
8
7
|
import { spo } from '../../../../utils/spo.js';
|
|
9
8
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
@@ -13,7 +12,7 @@ const options = globalOptionsZod
|
|
|
13
12
|
url: zod.alias('u', z.string()
|
|
14
13
|
.refine(url => validation.isValidSharePointUrl(url) === true, url => ({
|
|
15
14
|
message: `'${url}' is not a valid SharePoint Online site URL.`
|
|
16
|
-
}))
|
|
15
|
+
}))),
|
|
17
16
|
force: zod.alias('f', z.boolean().optional())
|
|
18
17
|
})
|
|
19
18
|
.strict();
|
|
@@ -30,34 +29,8 @@ class SpoHomeSiteRemoveCommand extends SpoCommand {
|
|
|
30
29
|
async commandAction(logger, args) {
|
|
31
30
|
const removeHomeSite = async () => {
|
|
32
31
|
try {
|
|
33
|
-
if (this.verbose) {
|
|
34
|
-
await logger.logToStderr(`Removing ${args.options.url ? `'${args.options.url}' as home site` : 'the current home site'}...`);
|
|
35
|
-
}
|
|
36
32
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
37
|
-
|
|
38
|
-
if (args.options.url) {
|
|
39
|
-
await this.removeHomeSiteByUrl(args.options.url, spoAdminUrl, logger);
|
|
40
|
-
await logger.log(`${args.options.url} has been removed as a Home Site. It may take some time for the change to apply. Check aka.ms/homesites for details.`);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
await this.warn(logger, `The current way this command works is deprecated and will change in the next major release. The '--url' option will become required.`);
|
|
44
|
-
const requestOptions = {
|
|
45
|
-
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
46
|
-
headers: {
|
|
47
|
-
'X-RequestDigest': reqDigest.FormDigestValue
|
|
48
|
-
},
|
|
49
|
-
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="28" ObjectPathId="27" /><Method Name="RemoveSPHSite" Id="29" ObjectPathId="27" /></Actions><ObjectPaths><Constructor Id="27" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
50
|
-
};
|
|
51
|
-
const res = await request.post(requestOptions);
|
|
52
|
-
const json = JSON.parse(res);
|
|
53
|
-
const response = json[0];
|
|
54
|
-
if (response.ErrorInfo) {
|
|
55
|
-
throw response.ErrorInfo.ErrorMessage;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
await logger.log(json[json.length - 1]);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
33
|
+
await this.removeHomeSiteByUrl(args.options.url, spoAdminUrl, logger);
|
|
61
34
|
}
|
|
62
35
|
catch (err) {
|
|
63
36
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -67,11 +40,7 @@ class SpoHomeSiteRemoveCommand extends SpoCommand {
|
|
|
67
40
|
await removeHomeSite();
|
|
68
41
|
}
|
|
69
42
|
else {
|
|
70
|
-
const result = await cli.promptForConfirmation({
|
|
71
|
-
message: args.options.url
|
|
72
|
-
? `Are you sure you want to remove '${args.options.url}' as home site?`
|
|
73
|
-
: `Are you sure you want to remove the current home site?`
|
|
74
|
-
});
|
|
43
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove '${args.options.url}' as home site?` });
|
|
75
44
|
if (result) {
|
|
76
45
|
await removeHomeSite();
|
|
77
46
|
}
|
|
@@ -79,6 +48,9 @@ class SpoHomeSiteRemoveCommand extends SpoCommand {
|
|
|
79
48
|
}
|
|
80
49
|
async removeHomeSiteByUrl(siteUrl, spoAdminUrl, logger) {
|
|
81
50
|
const siteAdminProperties = await spo.getSiteAdminPropertiesByUrl(siteUrl, false, logger, this.verbose);
|
|
51
|
+
if (this.verbose) {
|
|
52
|
+
await logger.logToStderr(`Removing '${siteUrl}' as home site...`);
|
|
53
|
+
}
|
|
82
54
|
const requestOptions = {
|
|
83
55
|
url: `${spoAdminUrl}/_api/SPO.Tenant/RemoveTargetedSite`,
|
|
84
56
|
headers: {
|
|
@@ -29,20 +29,12 @@ class SpoHubSiteGetCommand extends SpoCommand {
|
|
|
29
29
|
}
|
|
30
30
|
async commandAction(logger, args) {
|
|
31
31
|
try {
|
|
32
|
-
if (args.options.includeAssociatedSites) {
|
|
33
|
-
await this.warn(logger, `Parameter 'includeAssociatedSites' is deprecated. Please use 'withAssociatedSites' instead`);
|
|
34
|
-
}
|
|
35
32
|
const spoUrl = await spo.getSpoUrl(logger, this.debug);
|
|
36
33
|
const hubSite = args.options.id ? await this.getHubSiteById(spoUrl, args.options) : await this.getHubSite(spoUrl, args.options);
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
throw 'includeAssociatedSites option is only allowed with json output mode';
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
throw 'withAssociatedSites option is only allowed with json output mode';
|
|
43
|
-
}
|
|
34
|
+
if (args.options.withAssociatedSites && (args.options.output && args.options.output !== 'json')) {
|
|
35
|
+
throw 'withAssociatedSites option is only allowed with json output mode';
|
|
44
36
|
}
|
|
45
|
-
if (
|
|
37
|
+
if (args.options.withAssociatedSites === true && args.options.output && !cli.shouldTrimOutput(args.options.output)) {
|
|
46
38
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
47
39
|
const associatedSitesCommandOutput = await this.getAssociatedSites(spoAdminUrl, hubSite.SiteId, logger, args);
|
|
48
40
|
const associatedSites = JSON.parse(associatedSitesCommandOutput.stdout);
|
|
@@ -108,12 +100,11 @@ _SpoHubSiteGetCommand_instances = new WeakSet(), _SpoHubSiteGetCommand_initTelem
|
|
|
108
100
|
id: typeof args.options.id !== 'undefined',
|
|
109
101
|
title: typeof args.options.title !== 'undefined',
|
|
110
102
|
url: typeof args.options.url !== 'undefined',
|
|
111
|
-
includeAssociatedSites: args.options.includeAssociatedSites === true,
|
|
112
103
|
withAssociatedSites: args.options.withAssociatedSites === true
|
|
113
104
|
});
|
|
114
105
|
});
|
|
115
106
|
}, _SpoHubSiteGetCommand_initOptions = function _SpoHubSiteGetCommand_initOptions() {
|
|
116
|
-
this.options.unshift({ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '-u, --url [url]' }, { option: '--
|
|
107
|
+
this.options.unshift({ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '-u, --url [url]' }, { option: '--withAssociatedSites' });
|
|
117
108
|
}, _SpoHubSiteGetCommand_initValidators = function _SpoHubSiteGetCommand_initValidators() {
|
|
118
109
|
this.validators.push(async (args) => {
|
|
119
110
|
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|