@salesforce/packaging 4.15.1 → 4.16.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.
|
@@ -15,4 +15,12 @@ export declare class PackageBundleVersion {
|
|
|
15
15
|
private static mapPackageBundle;
|
|
16
16
|
private static mapAncestor;
|
|
17
17
|
private static mapAncestorPackageBundle;
|
|
18
|
+
/**
|
|
19
|
+
* Add a bundle version alias to the sfdx-project.json file after successful bundle version creation.
|
|
20
|
+
* Creates an alias in the format: <BundleName>@<MajorVersion>.<MinorVersion>
|
|
21
|
+
*
|
|
22
|
+
* @param project The SfProject instance
|
|
23
|
+
* @param result The bundle version create result containing bundle information
|
|
24
|
+
*/
|
|
25
|
+
private static addBundleVersionAlias;
|
|
18
26
|
}
|
|
@@ -28,7 +28,7 @@ class PackageBundleVersion {
|
|
|
28
28
|
static async create(options) {
|
|
29
29
|
const createResult = await packageBundleVersionCreate_1.PackageBundleVersionCreate.createBundleVersion(options.connection, options.project, options);
|
|
30
30
|
if (options.polling) {
|
|
31
|
-
|
|
31
|
+
const finalResult = await PackageBundleVersion.pollCreateStatus(createResult.Id, options.connection, options.project, options.polling).catch((error) => {
|
|
32
32
|
if (error.name === 'PollingClientTimeout') {
|
|
33
33
|
const modifiedError = new core_1.SfError(error.message);
|
|
34
34
|
modifiedError.setData({ VersionCreateRequestId: createResult.Id });
|
|
@@ -37,6 +37,17 @@ class PackageBundleVersion {
|
|
|
37
37
|
}
|
|
38
38
|
throw (0, packageUtils_1.applyErrorAction)((0, bundleUtils_1.massageErrorMessage)(error));
|
|
39
39
|
});
|
|
40
|
+
// Add bundle version alias to sfdx-project.json after successful creation
|
|
41
|
+
if (finalResult.RequestStatus === interfaces_1.BundleSObjects.PkgBundleVersionCreateReqStatus.success && finalResult.PackageBundleVersionId) {
|
|
42
|
+
await PackageBundleVersion.addBundleVersionAlias(options.project, finalResult);
|
|
43
|
+
}
|
|
44
|
+
return finalResult;
|
|
45
|
+
}
|
|
46
|
+
// Add bundle version alias to sfdx-project.json after successful creation (non-polling case)
|
|
47
|
+
// Note: In the non-polling case, the bundle version may not be created yet (status is 'Queued' or 'InProgress')
|
|
48
|
+
// So we only add the alias if the status is already 'Success'
|
|
49
|
+
if (createResult.RequestStatus === interfaces_1.BundleSObjects.PkgBundleVersionCreateReqStatus.success && createResult.PackageBundleVersionId) {
|
|
50
|
+
await PackageBundleVersion.addBundleVersionAlias(options.project, createResult);
|
|
40
51
|
}
|
|
41
52
|
return createResult;
|
|
42
53
|
}
|
|
@@ -229,6 +240,28 @@ class PackageBundleVersion {
|
|
|
229
240
|
SystemModstamp: packageBundle?.SystemModstamp ?? '',
|
|
230
241
|
};
|
|
231
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Add a bundle version alias to the sfdx-project.json file after successful bundle version creation.
|
|
245
|
+
* Creates an alias in the format: <BundleName>@<MajorVersion>.<MinorVersion>
|
|
246
|
+
*
|
|
247
|
+
* @param project The SfProject instance
|
|
248
|
+
* @param result The bundle version create result containing bundle information
|
|
249
|
+
*/
|
|
250
|
+
static async addBundleVersionAlias(project, result) {
|
|
251
|
+
// Skip if auto-update is disabled
|
|
252
|
+
if (kit_1.env.getBoolean('SF_PROJECT_AUTOUPDATE_DISABLE_FOR_PACKAGE_CREATE')) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
// Ensure we have the necessary information to create the alias
|
|
256
|
+
if (!result.PackageBundleVersionId || !result.VersionName || !result.MajorVersion || !result.MinorVersion) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
// Create alias in format: BundleName@MajorVersion.MinorVersion
|
|
260
|
+
const alias = `${result.VersionName}@${result.MajorVersion}.${result.MinorVersion}`;
|
|
261
|
+
// Add the alias to the sfdx-project.json file
|
|
262
|
+
project.getSfProjectJson().addPackageBundleAlias(alias, result.PackageBundleVersionId);
|
|
263
|
+
await project.getSfProjectJson().write();
|
|
264
|
+
}
|
|
232
265
|
}
|
|
233
266
|
exports.PackageBundleVersion = PackageBundleVersion;
|
|
234
267
|
//# sourceMappingURL=packageBundleVersion.js.map
|