@pnp/cli-microsoft365 11.0.0-beta.88d51e6 → 11.0.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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Command.js +4 -0
- package/dist/config.js +1 -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/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/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/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/spe/commands/container/container-add.js +1 -3
- package/dist/m365/spe/commands/container/container-list.js +1 -3
- package/dist/m365/spe/commands/container/container-recyclebinitem-list.js +1 -3
- package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +1 -3
- package/dist/m365/spe/commands/container/container-remove.js +1 -3
- package/dist/m365/spe/commands/containertype/containertype-add.js +67 -90
- package/dist/m365/spe/commands/containertype/containertype-get.js +53 -81
- package/dist/m365/spe/commands/containertype/containertype-list.js +8 -19
- package/dist/m365/spe/commands/containertype/containertype-remove.js +27 -5
- 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/homesite/homesite-add.js +26 -2
- 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/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 +4 -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/dist/utils/spe.js +5 -39
- 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/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/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/solution/solution-publisher-list.mdx +0 -3
- package/docs/docs/cmd/purview/threatassessment/threatassessment-get.mdx +0 -3
- package/docs/docs/cmd/spe/container/container-activate.mdx +21 -0
- package/docs/docs/cmd/spe/container/container-add.mdx +29 -0
- package/docs/docs/cmd/spe/container/container-get.mdx +20 -1
- package/docs/docs/cmd/spe/container/container-list.mdx +29 -0
- package/docs/docs/cmd/spe/container/container-permission-list.mdx +19 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-list.mdx +29 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +31 -0
- package/docs/docs/cmd/spe/container/container-remove.mdx +31 -0
- package/docs/docs/cmd/spe/containertype/containertype-add.mdx +111 -55
- package/docs/docs/cmd/spe/containertype/containertype-get.mdx +69 -38
- package/docs/docs/cmd/spe/containertype/containertype-list.mdx +59 -31
- package/docs/docs/cmd/spe/containertype/containertype-remove.mdx +31 -4
- 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/homesite/homesite-add.mdx +13 -4
- 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/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 +2 -2
- package/dist/m365/spo/commands/tenant/SPOTenantSitePropertiesEnumerable.js +0 -2
- package/dist/m365/spo/commands/tenant/TenantSiteProperties.js +0 -2
|
@@ -1,115 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _SpeContainerTypeAddCommand_instances, _SpeContainerTypeAddCommand_initTelemetry, _SpeContainerTypeAddCommand_initOptions, _SpeContainerTypeAddCommand_initValidators;
|
|
7
|
-
import config from '../../../../config.js';
|
|
1
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { zod } from '../../../../utils/zod.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
|
-
import { spo } from '../../../../utils/spo.js';
|
|
10
5
|
import { validation } from '../../../../utils/validation.js';
|
|
11
|
-
import
|
|
6
|
+
import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
|
|
12
7
|
import commands from '../../commands.js';
|
|
13
|
-
|
|
8
|
+
import Auth from '../../../../Auth.js';
|
|
9
|
+
const consumingTenantOverridablesOptions = ['urlTemplate', 'isDiscoverabilityEnabled', 'isSearchEnabled', 'isItemVersioningEnabled', 'itemMajorVersionLimit', 'maxStoragePerContainerInBytes'];
|
|
10
|
+
const options = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
name: zod.alias('n', z.string()),
|
|
13
|
+
appId: z.string()
|
|
14
|
+
.refine(id => validation.isValidGuid(id), id => ({
|
|
15
|
+
message: `'${id}' is not a valid GUID.`
|
|
16
|
+
})).optional(),
|
|
17
|
+
billingType: z.enum(['standard', 'trial', 'directToCustomer']).default('standard'),
|
|
18
|
+
consumingTenantOverridables: z.string()
|
|
19
|
+
.refine(values => values.split(',').every(v => consumingTenantOverridablesOptions.includes(v.trim())), values => ({
|
|
20
|
+
message: `'${values}' is not a valid value. Valid options are: ${consumingTenantOverridablesOptions.join(', ')}.`
|
|
21
|
+
})).optional(),
|
|
22
|
+
isDiscoverabilityEnabled: z.boolean().optional(),
|
|
23
|
+
isItemVersioningEnabled: z.boolean().optional(),
|
|
24
|
+
isSearchEnabled: z.boolean().optional(),
|
|
25
|
+
isSharingRestricted: z.boolean().optional(),
|
|
26
|
+
itemMajorVersionLimit: z.number()
|
|
27
|
+
.refine(n => validation.isValidPositiveInteger(n), n => ({
|
|
28
|
+
message: `'${n}' is not a valid positive integer.`
|
|
29
|
+
})).optional(),
|
|
30
|
+
maxStoragePerContainerInBytes: z.number()
|
|
31
|
+
.refine(n => validation.isValidPositiveInteger(n), n => ({
|
|
32
|
+
message: `'${n}' is not a valid positive integer.`
|
|
33
|
+
})).optional(),
|
|
34
|
+
sharingCapability: z.enum(['disabled', 'externalUserSharingOnly', 'externalUserAndGuestSharing', 'existingExternalUserSharingOnly']).optional(),
|
|
35
|
+
urlTemplate: z.string().optional()
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
class SpeContainerTypeAddCommand extends GraphDelegatedCommand {
|
|
14
39
|
get name() {
|
|
15
40
|
return commands.CONTAINERTYPE_ADD;
|
|
16
41
|
}
|
|
17
42
|
get description() {
|
|
18
|
-
return 'Creates a new
|
|
43
|
+
return 'Creates a new container type';
|
|
19
44
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
get schema() {
|
|
46
|
+
return options;
|
|
47
|
+
}
|
|
48
|
+
getRefinedSchema(schema) {
|
|
49
|
+
return schema
|
|
50
|
+
.refine(options => !options.itemMajorVersionLimit || options.isItemVersioningEnabled !== false, {
|
|
51
|
+
message: `Cannot set itemMajorVersionLimit when isItemVersioningEnabled is false.`
|
|
52
|
+
});
|
|
26
53
|
}
|
|
27
54
|
async commandAction(logger, args) {
|
|
28
55
|
try {
|
|
29
56
|
if (this.verbose) {
|
|
30
|
-
await logger.logToStderr(`Creating a new Container Type for your app with name ${args.options.name}
|
|
57
|
+
await logger.logToStderr(`Creating a new Container Type for your app with name '${args.options.name}'.`);
|
|
31
58
|
}
|
|
32
|
-
const
|
|
33
|
-
const requestBody = this.getRequestBody(args.options);
|
|
34
|
-
const formDigestInfo = await spo.ensureFormDigest(adminUrl, logger, undefined, this.debug);
|
|
59
|
+
const appId = args.options.appId ?? Auth.connection.appId;
|
|
35
60
|
const requestOptions = {
|
|
36
|
-
url: `${
|
|
61
|
+
url: `${this.resource}/beta/storage/fileStorage/containerTypes`,
|
|
37
62
|
headers: {
|
|
38
|
-
|
|
63
|
+
accept: 'application/json;odata.metadata=none'
|
|
39
64
|
},
|
|
40
|
-
|
|
65
|
+
responseType: 'json',
|
|
66
|
+
data: {
|
|
67
|
+
name: args.options.name,
|
|
68
|
+
owningAppId: appId,
|
|
69
|
+
billingClassification: args.options.billingType,
|
|
70
|
+
settings: {
|
|
71
|
+
consumingTenantOverridables: args.options.consumingTenantOverridables?.split(',').map(s => s.trim()).join(','),
|
|
72
|
+
isDiscoverabilityEnabled: args.options.isDiscoverabilityEnabled,
|
|
73
|
+
isItemVersioningEnabled: args.options.isItemVersioningEnabled,
|
|
74
|
+
isSearchEnabled: args.options.isSearchEnabled,
|
|
75
|
+
isSharingRestricted: args.options.isSharingRestricted,
|
|
76
|
+
itemMajorVersionLimit: args.options.itemMajorVersionLimit,
|
|
77
|
+
maxStoragePerContainerInBytes: args.options.maxStoragePerContainerInBytes,
|
|
78
|
+
sharingCapability: args.options.sharingCapability,
|
|
79
|
+
urlTemplate: args.options.urlTemplate
|
|
80
|
+
}
|
|
81
|
+
}
|
|
41
82
|
};
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const response = json[0];
|
|
45
|
-
if (response.ErrorInfo) {
|
|
46
|
-
throw response.ErrorInfo.ErrorMessage;
|
|
47
|
-
}
|
|
48
|
-
const result = json.pop();
|
|
49
|
-
delete result._ObjectType_;
|
|
50
|
-
result.SPContainerTypeBillingClassification = args.options.trial ? 'Trial' : 'Standard';
|
|
51
|
-
result.AzureSubscriptionId = this.replaceString(result.AzureSubscriptionId);
|
|
52
|
-
result.OwningAppId = this.replaceString(result.OwningAppId);
|
|
53
|
-
result.OwningTenantId = this.replaceString(result.OwningTenantId);
|
|
54
|
-
result.ContainerTypeId = this.replaceString(result.ContainerTypeId);
|
|
55
|
-
await logger.log(result);
|
|
83
|
+
const response = await request.post(requestOptions);
|
|
84
|
+
await logger.log(response);
|
|
56
85
|
}
|
|
57
86
|
catch (err) {
|
|
58
87
|
this.handleRejectedODataJsonPromise(err);
|
|
59
88
|
}
|
|
60
89
|
}
|
|
61
|
-
replaceString(s) {
|
|
62
|
-
return s.replace('/Guid(', '').replace(')/', '');
|
|
63
|
-
}
|
|
64
|
-
getRequestBody(options) {
|
|
65
|
-
if (options.trial) {
|
|
66
|
-
return `<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="4" ObjectPathId="3" /><Method Name="NewSPOContainerType" Id="5" ObjectPathId="3"><Parameters><Parameter TypeId="{5466648e-c306-441b-9df4-c09deef25cb1}"><Property Name="AzureSubscriptionId" Type="Guid">{00000000-0000-0000-0000-000000000000}</Property><Property Name="ContainerTypeId" Type="Guid">{00000000-0000-0000-0000-000000000000}</Property><Property Name="CreationDate" Type="Null" /><Property Name="DisplayName" Type="String">${options.name}</Property><Property Name="ExpiryDate" Type="Null" /><Property Name="IsBillingProfileRequired" Type="Boolean">false</Property><Property Name="OwningAppId" Type="Guid">{${options.applicationId}}</Property><Property Name="OwningTenantId" Type="Guid">{00000000-0000-0000-0000-000000000000}</Property><Property Name="Region" Type="Null" /><Property Name="ResourceGroup" Type="Null" /><Property Name="SPContainerTypeBillingClassification" Type="Enum">1</Property></Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="3" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`;
|
|
67
|
-
}
|
|
68
|
-
return `<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><Method Name="NewSPOContainerType" Id="4" ObjectPathId="1"><Parameters><Parameter TypeId="{5466648e-c306-441b-9df4-c09deef25cb1}"><Property Name="AzureSubscriptionId" Type="Guid">{${options.azureSubscriptionId}}</Property><Property Name="ContainerTypeId" Type="Guid">{00000000-0000-0000-0000-000000000000}</Property><Property Name="CreationDate" Type="Null" /><Property Name="DisplayName" Type="String">${options.name}</Property><Property Name="ExpiryDate" Type="Null" /><Property Name="IsBillingProfileRequired" Type="Boolean">false</Property><Property Name="OwningAppId" Type="Guid">{${options.applicationId}}</Property><Property Name="OwningTenantId" Type="Guid">{00000000-0000-0000-0000-000000000000}</Property><Property Name="Region" Type="String">${options.region}</Property><Property Name="ResourceGroup" Type="String">${options.resourceGroup}</Property><Property Name="SPContainerTypeBillingClassification" Type="Enum">0</Property></Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`;
|
|
69
|
-
}
|
|
70
90
|
}
|
|
71
|
-
_SpeContainerTypeAddCommand_instances = new WeakSet(), _SpeContainerTypeAddCommand_initTelemetry = function _SpeContainerTypeAddCommand_initTelemetry() {
|
|
72
|
-
this.telemetry.push((args) => {
|
|
73
|
-
Object.assign(this.telemetryProperties, {
|
|
74
|
-
trial: !!args.options.trial,
|
|
75
|
-
azureSubscriptionId: typeof args.options.azureSubscriptionId !== 'undefined',
|
|
76
|
-
resourceGroup: typeof args.options.resourceGroup !== 'undefined',
|
|
77
|
-
region: typeof args.options.region !== 'undefined'
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}, _SpeContainerTypeAddCommand_initOptions = function _SpeContainerTypeAddCommand_initOptions() {
|
|
81
|
-
this.options.unshift({
|
|
82
|
-
option: '-n, --name <name>'
|
|
83
|
-
}, {
|
|
84
|
-
option: '--applicationId <applicationId>'
|
|
85
|
-
}, {
|
|
86
|
-
option: '--trial'
|
|
87
|
-
}, {
|
|
88
|
-
option: '--azureSubscriptionId [azureSubscriptionId]'
|
|
89
|
-
}, {
|
|
90
|
-
option: '--resourceGroup [resourceGroup]'
|
|
91
|
-
}, {
|
|
92
|
-
option: '--region [region]'
|
|
93
|
-
});
|
|
94
|
-
}, _SpeContainerTypeAddCommand_initValidators = function _SpeContainerTypeAddCommand_initValidators() {
|
|
95
|
-
this.validators.push(async (args) => {
|
|
96
|
-
if (!validation.isValidGuid(args.options.applicationId)) {
|
|
97
|
-
return `${args.options.applicationId} is not a valid GUID for option applicationId.`;
|
|
98
|
-
}
|
|
99
|
-
if (args.options.trial === undefined && !args.options.azureSubscriptionId) {
|
|
100
|
-
return 'You must specify the azureSubscriptionId when creating a non-trial environment.';
|
|
101
|
-
}
|
|
102
|
-
if (args.options.trial === undefined && !args.options.resourceGroup) {
|
|
103
|
-
return 'You must specify the resourceGroup when creating a non-trial environment.';
|
|
104
|
-
}
|
|
105
|
-
if (args.options.trial === undefined && !args.options.region) {
|
|
106
|
-
return 'You must specify the region when creating a non-trial environment.';
|
|
107
|
-
}
|
|
108
|
-
if (args.options.azureSubscriptionId && !validation.isValidGuid(args.options.azureSubscriptionId)) {
|
|
109
|
-
return `${args.options.azureSubscriptionId} is not a valid GUID for option azureSubscriptionId.`;
|
|
110
|
-
}
|
|
111
|
-
return true;
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
91
|
export default new SpeContainerTypeAddCommand();
|
|
115
92
|
//# sourceMappingURL=containertype-add.js.map
|
|
@@ -1,99 +1,71 @@
|
|
|
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 _SpeContainerTypeGetCommand_instances, _SpeContainerTypeGetCommand_initTelemetry, _SpeContainerTypeGetCommand_initOptions, _SpeContainerTypeGetCommand_initOptionSets, _SpeContainerTypeGetCommand_initValidators, _SpeContainerTypeGetCommand_initTypes;
|
|
7
|
-
import config from '../../../../config.js';
|
|
8
|
-
import request from '../../../../request.js';
|
|
9
|
-
import { spe } from '../../../../utils/spe.js';
|
|
10
|
-
import { spo } from '../../../../utils/spo.js';
|
|
11
1
|
import { validation } from '../../../../utils/validation.js';
|
|
12
|
-
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
2
|
import commands from '../../commands.js';
|
|
14
|
-
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { zod } from '../../../../utils/zod.js';
|
|
6
|
+
import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
|
|
7
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { odata } from '../../../../utils/odata.js';
|
|
10
|
+
import { cli } from '../../../../cli/cli.js';
|
|
11
|
+
const options = globalOptionsZod
|
|
12
|
+
.extend({
|
|
13
|
+
id: zod.alias('i', z.string()
|
|
14
|
+
.refine(id => validation.isValidGuid(id), id => ({
|
|
15
|
+
message: `'${id}' is not a valid GUID.`
|
|
16
|
+
}))
|
|
17
|
+
.optional()),
|
|
18
|
+
name: zod.alias('n', z.string().optional())
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
class SpeContainerTypeGetCommand extends GraphDelegatedCommand {
|
|
15
22
|
get name() {
|
|
16
23
|
return commands.CONTAINERTYPE_GET;
|
|
17
24
|
}
|
|
18
25
|
get description() {
|
|
19
|
-
return '
|
|
26
|
+
return 'Gets a container type';
|
|
27
|
+
}
|
|
28
|
+
get schema() {
|
|
29
|
+
return options;
|
|
20
30
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
__classPrivateFieldGet(this, _SpeContainerTypeGetCommand_instances, "m", _SpeContainerTypeGetCommand_initValidators).call(this);
|
|
27
|
-
__classPrivateFieldGet(this, _SpeContainerTypeGetCommand_instances, "m", _SpeContainerTypeGetCommand_initOptionSets).call(this);
|
|
28
|
-
__classPrivateFieldGet(this, _SpeContainerTypeGetCommand_instances, "m", _SpeContainerTypeGetCommand_initTypes).call(this);
|
|
31
|
+
getRefinedSchema(schema) {
|
|
32
|
+
return schema
|
|
33
|
+
.refine(options => [options.id, options.name].filter(o => o !== undefined).length === 1, {
|
|
34
|
+
message: 'Use one of the following options: id or name.'
|
|
35
|
+
});
|
|
29
36
|
}
|
|
30
37
|
async commandAction(logger, args) {
|
|
31
38
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
let result;
|
|
40
|
+
if (args.options.name) {
|
|
41
|
+
const containerTypes = await odata.getAllItems(`${this.resource}/beta/storage/fileStorage/containerTypes?$filter=name eq '${formatting.encodeQueryParameter(args.options.name)}'`);
|
|
42
|
+
if (containerTypes.length === 0) {
|
|
43
|
+
throw `The specified container type '${args.options.name}' does not exist.`;
|
|
44
|
+
}
|
|
45
|
+
if (containerTypes.length > 1) {
|
|
46
|
+
const containerKeyValuePair = formatting.convertArrayToHashTable('id', containerTypes);
|
|
47
|
+
result = await cli.handleMultipleResultsFound(`Multiple container types with name '${args.options.name}' found.`, containerKeyValuePair);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
result = containerTypes[0];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const requestOptions = {
|
|
55
|
+
url: `${this.resource}/beta/storage/fileStorage/containerTypes/${args.options.id}`,
|
|
56
|
+
headers: {
|
|
57
|
+
accept: 'application/json;odata.metadata=none'
|
|
58
|
+
},
|
|
59
|
+
responseType: 'json'
|
|
60
|
+
};
|
|
61
|
+
result = await request.get(requestOptions);
|
|
62
|
+
}
|
|
63
|
+
await logger.log(result);
|
|
36
64
|
}
|
|
37
65
|
catch (err) {
|
|
38
66
|
this.handleRejectedODataJsonPromise(err);
|
|
39
67
|
}
|
|
40
68
|
}
|
|
41
|
-
async getContainerTypeById(containerTypeId, spoAdminUrl, logger) {
|
|
42
|
-
if (this.verbose) {
|
|
43
|
-
await logger.logToStderr(`Getting the Container type...`);
|
|
44
|
-
}
|
|
45
|
-
const requestOptions = {
|
|
46
|
-
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
47
|
-
headers: {
|
|
48
|
-
accept: 'application/json;odata=nometadata'
|
|
49
|
-
},
|
|
50
|
-
responseType: 'json',
|
|
51
|
-
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="49" ObjectPathId="48" /><Method Name="GetSPOContainerTypeById" Id="50" ObjectPathId="48"><Parameters><Parameter Type="Guid">{${containerTypeId}}</Parameter><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="48" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
52
|
-
};
|
|
53
|
-
const res = await request.post(requestOptions);
|
|
54
|
-
const response = res[0];
|
|
55
|
-
if (response.ErrorInfo) {
|
|
56
|
-
throw response.ErrorInfo.ErrorMessage;
|
|
57
|
-
}
|
|
58
|
-
const containerTypes = res[res.length - 1];
|
|
59
|
-
return containerTypes;
|
|
60
|
-
}
|
|
61
|
-
async getContainerTypeId(options, spoAdminUrl, logger) {
|
|
62
|
-
if (options.id) {
|
|
63
|
-
return options.id;
|
|
64
|
-
}
|
|
65
|
-
if (this.verbose) {
|
|
66
|
-
await logger.logToStderr(`Retrieving container type id for container type '${options.containerTypeName}'...`);
|
|
67
|
-
}
|
|
68
|
-
return spe.getContainerTypeIdByName(spoAdminUrl, options.name);
|
|
69
|
-
}
|
|
70
69
|
}
|
|
71
|
-
_SpeContainerTypeGetCommand_instances = new WeakSet(), _SpeContainerTypeGetCommand_initTelemetry = function _SpeContainerTypeGetCommand_initTelemetry() {
|
|
72
|
-
this.telemetry.push((args) => {
|
|
73
|
-
Object.assign(this.telemetryProperties, {
|
|
74
|
-
id: typeof args.options.id !== 'undefined',
|
|
75
|
-
name: typeof args.options.name !== 'undefined'
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
}, _SpeContainerTypeGetCommand_initOptions = function _SpeContainerTypeGetCommand_initOptions() {
|
|
79
|
-
this.options.unshift({
|
|
80
|
-
option: '-i, --id [id]'
|
|
81
|
-
}, {
|
|
82
|
-
option: '-n, --name [name]'
|
|
83
|
-
});
|
|
84
|
-
}, _SpeContainerTypeGetCommand_initOptionSets = function _SpeContainerTypeGetCommand_initOptionSets() {
|
|
85
|
-
this.optionSets.push({
|
|
86
|
-
options: ['id', 'name']
|
|
87
|
-
});
|
|
88
|
-
}, _SpeContainerTypeGetCommand_initValidators = function _SpeContainerTypeGetCommand_initValidators() {
|
|
89
|
-
this.validators.push(async (args) => {
|
|
90
|
-
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
91
|
-
return `${args.options.id} is not a valid GUID`;
|
|
92
|
-
}
|
|
93
|
-
return true;
|
|
94
|
-
});
|
|
95
|
-
}, _SpeContainerTypeGetCommand_initTypes = function _SpeContainerTypeGetCommand_initTypes() {
|
|
96
|
-
this.types.string.push('id', 'name');
|
|
97
|
-
};
|
|
98
70
|
export default new SpeContainerTypeGetCommand();
|
|
99
71
|
//# sourceMappingURL=containertype-get.js.map
|
|
@@ -1,37 +1,26 @@
|
|
|
1
|
-
import SpoCommand from '../../../base/SpoCommand.js';
|
|
2
1
|
import commands from '../../commands.js';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
class SpeContainerTypeListCommand extends
|
|
2
|
+
import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
|
|
3
|
+
import { odata } from '../../../../utils/odata.js';
|
|
4
|
+
class SpeContainerTypeListCommand extends GraphDelegatedCommand {
|
|
6
5
|
get name() {
|
|
7
6
|
return commands.CONTAINERTYPE_LIST;
|
|
8
7
|
}
|
|
9
8
|
get description() {
|
|
10
|
-
return 'Lists all
|
|
9
|
+
return 'Lists all container types';
|
|
11
10
|
}
|
|
12
11
|
defaultProperties() {
|
|
13
|
-
return ['
|
|
12
|
+
return ['id', 'name', 'owningAppId'];
|
|
14
13
|
}
|
|
15
14
|
async commandAction(logger) {
|
|
16
15
|
try {
|
|
17
|
-
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
18
16
|
if (this.verbose) {
|
|
19
17
|
await logger.logToStderr(`Retrieving list of Container types...`);
|
|
20
18
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const result = allContainerTypes.map(ct => ({
|
|
24
|
-
_ObjectType_: 'Microsoft.Online.SharePoint.TenantAdministration.SPContainerTypeProperties',
|
|
25
|
-
...ct,
|
|
26
|
-
AzureSubscriptionId: `/Guid(${ct.AzureSubscriptionId})/`,
|
|
27
|
-
ContainerTypeId: `/Guid(${ct.ContainerTypeId})/`,
|
|
28
|
-
OwningAppId: `/Guid(${ct.OwningAppId})/`,
|
|
29
|
-
OwningTenantId: `/Guid(${ct.OwningTenantId})/`
|
|
30
|
-
}));
|
|
31
|
-
await logger.log(result);
|
|
19
|
+
const containerTypes = await odata.getAllItems(`${this.resource}/beta/storage/fileStorage/containerTypes`);
|
|
20
|
+
await logger.log(containerTypes);
|
|
32
21
|
}
|
|
33
22
|
catch (err) {
|
|
34
|
-
this.
|
|
23
|
+
this.handleRejectedODataJsonPromise(err);
|
|
35
24
|
}
|
|
36
25
|
}
|
|
37
26
|
}
|
|
@@ -4,11 +4,11 @@ import { zod } from '../../../../utils/zod.js';
|
|
|
4
4
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
5
5
|
import commands from '../../commands.js';
|
|
6
6
|
import { spo } from '../../../../utils/spo.js';
|
|
7
|
-
import { spe } from '../../../../utils/spe.js';
|
|
8
7
|
import { cli } from '../../../../cli/cli.js';
|
|
9
8
|
import { validation } from '../../../../utils/validation.js';
|
|
10
9
|
import request from '../../../../request.js';
|
|
11
10
|
import config from '../../../../config.js';
|
|
11
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
12
12
|
const options = globalOptionsZod
|
|
13
13
|
.extend({
|
|
14
14
|
id: zod.alias('i', z.string()
|
|
@@ -46,14 +46,13 @@ class SpeContainerTypeRemoveCommand extends SpoCommand {
|
|
|
46
46
|
try {
|
|
47
47
|
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.verbose);
|
|
48
48
|
const containerTypeId = await this.getContainerTypeId(args.options, spoAdminUrl, logger);
|
|
49
|
-
const formDigestInfo = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
|
|
50
49
|
if (this.verbose) {
|
|
51
|
-
await logger.logToStderr(`Removing container type ${args.options.id || args.options.name}...`);
|
|
50
|
+
await logger.logToStderr(`Removing container type '${args.options.id || args.options.name}'...`);
|
|
52
51
|
}
|
|
53
52
|
const requestOptions = {
|
|
54
53
|
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
55
54
|
headers: {
|
|
56
|
-
'
|
|
55
|
+
accept: 'application/json;odata=nometadata'
|
|
57
56
|
},
|
|
58
57
|
responseType: 'json',
|
|
59
58
|
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="7" ObjectPathId="6" /><Method Name="RemoveSPOContainerType" Id="8" ObjectPathId="6"><Parameters><Parameter TypeId="{b66ab1ca-fd51-44f9-8cfc-01f5c2a21f99}"><Property Name="ContainerTypeId" Type="Guid">{${containerTypeId}}</Property></Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="6" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
@@ -74,7 +73,30 @@ class SpeContainerTypeRemoveCommand extends SpoCommand {
|
|
|
74
73
|
if (this.verbose) {
|
|
75
74
|
await logger.logToStderr(`Retrieving container type id for container type '${options.name}'...`);
|
|
76
75
|
}
|
|
77
|
-
|
|
76
|
+
const requestOptions = {
|
|
77
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
78
|
+
headers: {
|
|
79
|
+
accept: 'application/json;odata=nometadata'
|
|
80
|
+
},
|
|
81
|
+
responseType: 'json',
|
|
82
|
+
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="46" ObjectPathId="45" /><Method Name="GetSPOContainerTypes" Id="47" ObjectPathId="45"><Parameters><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="45" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
83
|
+
};
|
|
84
|
+
const json = await request.post(requestOptions);
|
|
85
|
+
const response = json[0];
|
|
86
|
+
if (response.ErrorInfo) {
|
|
87
|
+
throw new Error(response.ErrorInfo.ErrorMessage);
|
|
88
|
+
}
|
|
89
|
+
const allContainerTypes = json[json.length - 1];
|
|
90
|
+
const containerTypes = allContainerTypes.filter(ct => ct.DisplayName.toLowerCase() === options.name.toLowerCase());
|
|
91
|
+
if (containerTypes.length === 0) {
|
|
92
|
+
throw new Error(`The specified container type '${options.name}' does not exist.`);
|
|
93
|
+
}
|
|
94
|
+
if (containerTypes.length > 1) {
|
|
95
|
+
const containerTypeKeyValuePair = formatting.convertArrayToHashTable('ContainerTypeId', containerTypes);
|
|
96
|
+
const containerType = await cli.handleMultipleResultsFound(`Multiple container types with name '${options.name}' found.`, containerTypeKeyValuePair);
|
|
97
|
+
return formatting.extractCsomGuid(containerType.ContainerTypeId);
|
|
98
|
+
}
|
|
99
|
+
return formatting.extractCsomGuid(containerTypes[0].ContainerTypeId);
|
|
78
100
|
}
|
|
79
101
|
}
|
|
80
102
|
export default new SpeContainerTypeRemoveCommand();
|
|
@@ -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
|