@salesforce/packaging 4.7.0 → 4.8.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.
|
@@ -56,6 +56,7 @@ export declare namespace PackagingSObjects {
|
|
|
56
56
|
EndToEndBuildDurationInSeconds?: number;
|
|
57
57
|
TotalNumberOfMetadataFiles: number;
|
|
58
58
|
TotalSizeOfMetadataFiles: number;
|
|
59
|
+
DeveloperUsePkgZip?: string;
|
|
59
60
|
};
|
|
60
61
|
enum Package2VersionStatus {
|
|
61
62
|
queued = "Queued",
|
|
@@ -302,7 +303,6 @@ export declare namespace PackagingSObjects {
|
|
|
302
303
|
PatchVersion: number;
|
|
303
304
|
BuildNumber: number;
|
|
304
305
|
IsDeprecated: boolean;
|
|
305
|
-
MetadataZip?: string;
|
|
306
306
|
};
|
|
307
307
|
type MetadataPackage = {
|
|
308
308
|
Id: string;
|
|
@@ -42,19 +42,43 @@ async function retrievePackageVersionMetadata(project, options, connection) {
|
|
|
42
42
|
if (!(0, packageUtils_1.isPackageDirectoryEffectivelyEmpty)(destinationPath)) {
|
|
43
43
|
throw messages.createError('sourcesDownloadDirectoryNotEmpty');
|
|
44
44
|
}
|
|
45
|
-
// Get the
|
|
45
|
+
// Get the DeveloperUsePkgZip URL from the Package2Version record
|
|
46
46
|
const subscriberPackageVersionId = project.getPackageIdFromAlias(options.subscriberPackageVersionId) ?? options.subscriberPackageVersionId;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
// Query Package2Version to get the record by SubscriberPackageVersionId
|
|
48
|
+
const queryOptions = {
|
|
49
|
+
whereClause: `WHERE SubscriberPackageVersionId = '${subscriberPackageVersionId}'`,
|
|
50
|
+
};
|
|
51
|
+
let versionInfo;
|
|
52
|
+
try {
|
|
53
|
+
[versionInfo] = await packageVersion_1.PackageVersion.queryPackage2Version(connection, queryOptions);
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
57
|
+
if (msg.includes("No such column 'DeveloperUsePkgZip' on entity 'Package2Version'")) {
|
|
58
|
+
throw messages.createError('developerUsePkgZipFieldUnavailable');
|
|
59
|
+
}
|
|
60
|
+
if (msg.includes("sObject type 'Package2Version' is not supported.")) {
|
|
61
|
+
throw messages.createError('packagingNotEnabledOnOrg');
|
|
62
|
+
}
|
|
63
|
+
throw e;
|
|
64
|
+
}
|
|
65
|
+
if (!versionInfo?.DeveloperUsePkgZip) {
|
|
66
|
+
throw messages.createError('developerUsePkgZipFieldUnavailable');
|
|
52
67
|
}
|
|
53
|
-
const responseBase64 = await connection.tooling.request(versionInfo.
|
|
68
|
+
const responseBase64 = await connection.tooling.request(versionInfo.DeveloperUsePkgZip, {
|
|
54
69
|
encoding: 'base64',
|
|
55
70
|
});
|
|
56
71
|
const buffer = Buffer.from(responseBase64, 'base64');
|
|
57
|
-
let tree
|
|
72
|
+
let tree;
|
|
73
|
+
try {
|
|
74
|
+
tree = await source_deploy_retrieve_1.ZipTreeContainer.create(buffer);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
if (e instanceof Error && e.message.includes('data length = 0')) {
|
|
78
|
+
throw messages.createError('downloadDeveloperPackageZipHasNoData');
|
|
79
|
+
}
|
|
80
|
+
throw e;
|
|
81
|
+
}
|
|
58
82
|
let dependencies = [];
|
|
59
83
|
// 2GP packages declare their dependencies in dependency-ids.json within the outer zip.
|
|
60
84
|
if (tree.exists('dependency-ids.json')) {
|
|
@@ -79,7 +103,7 @@ async function retrievePackageVersionMetadata(project, options, connection) {
|
|
|
79
103
|
outputDirectory: destinationPath,
|
|
80
104
|
genUniqueDir: false,
|
|
81
105
|
});
|
|
82
|
-
await attemptToUpdateProjectJson(project, connection, versionInfo.
|
|
106
|
+
await attemptToUpdateProjectJson(project, connection, versionInfo.Package2Id, subscriberPackageVersionId, dependencies, destinationFolder);
|
|
83
107
|
return result;
|
|
84
108
|
}
|
|
85
109
|
/**
|
|
@@ -94,13 +118,6 @@ async function attemptToUpdateProjectJson(project, connection, packageId, subscr
|
|
|
94
118
|
return;
|
|
95
119
|
}
|
|
96
120
|
try {
|
|
97
|
-
const packageInfo = (await connection.tooling
|
|
98
|
-
.sobject('MetadataPackage')
|
|
99
|
-
.retrieve(packageId));
|
|
100
|
-
if (packageInfo.PackageCategory !== 'Package2') {
|
|
101
|
-
logger.info(`Skipping sfdx-project.json updates because ${packageId} is not a 2GP package. It has a PackageCategory of '${packageInfo.PackageCategory}'`);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
121
|
const queryOptions = {
|
|
105
122
|
whereClause: `WHERE SubscriberPackageVersionId = '${subscriberPackageVersionId}'`,
|
|
106
123
|
};
|
package/messages/package.md
CHANGED
|
@@ -28,18 +28,20 @@ Enabling App Analytics is only possible with API version 59.0 or higher.
|
|
|
28
28
|
|
|
29
29
|
# sourcesDownloadDirectoryNotEmpty
|
|
30
30
|
|
|
31
|
-
Can
|
|
31
|
+
Can't retrieve package version metadata. The specified directory isn't empty. Empty the directory, or create a new one and try again.
|
|
32
32
|
|
|
33
33
|
# sourcesDownloadDirectoryMustBeRelative
|
|
34
34
|
|
|
35
|
-
Can
|
|
35
|
+
Can't retrieve package version metadata. The specified directory must be relative to your Salesforce DX project directory, and not an absolute path.
|
|
36
36
|
|
|
37
|
-
#
|
|
37
|
+
# developerUsePkgZipFieldUnavailable
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Can't retrieve package metadata. To use this feature, you must first assign yourself the DownloadPackageVersionZips user permission. Then retry retrieving your package metadata.
|
|
40
40
|
|
|
41
|
-
#
|
|
41
|
+
# downloadDeveloperPackageZipHasNoData
|
|
42
42
|
|
|
43
|
-
Can
|
|
43
|
+
Can't retrieve package metadata. We're unable to retrieve metadata for the package version you specified. Retrieving package metadata is available to converted 2GP package versions only. If the package you specified is a converted 2GP package, try creating a new package version, and then retry retrieving the package metadata for the new package version. If your package is a 1GP, start by converting the package to 2GP, and then retry retrieving metadata from the converted 2GP package version.
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
# packagingNotEnabledOnOrg
|
|
46
|
+
|
|
47
|
+
Can't retrieve package metadata. The org you specified doesn't have the required second-generation packaging permission enabled. Enable this permission on your Dev Hub org, and try again.
|