@salesforce/packaging 0.0.28 → 0.0.29

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.29](https://github.com/forcedotcom/packaging/compare/v0.0.28...v0.0.29) (2022-08-26)
6
+
7
+ ### Bug Fixes
8
+
9
+ - add PackageVersion.update, NUTs ([af8a816](https://github.com/forcedotcom/packaging/commit/af8a8167d5fbcf7056f7b72db49e4e9f6ed0363f))
10
+
5
11
  ### [0.0.28](https://github.com/forcedotcom/packaging/compare/v0.0.27...v0.0.28) (2022-08-26)
6
12
 
7
13
  ### Bug Fixes
@@ -156,6 +156,13 @@ export declare type PackageVersionListOptions = {
156
156
  concise: boolean;
157
157
  isReleased: boolean;
158
158
  };
159
+ export declare type PackageVersionUpdateOptions = {
160
+ InstallKey?: string;
161
+ VersionName?: string;
162
+ VersionDescription?: string;
163
+ Branch?: string;
164
+ Tag?: string;
165
+ };
159
166
  export declare type ListPackageVersionOptions = PackageVersionListOptions & {
160
167
  connection: Connection;
161
168
  };
@@ -1,5 +1,5 @@
1
1
  import { Duration } from '@salesforce/kit';
2
- import { PackageSaveResult, PackageVersionCreateOptions, PackageVersionCreateRequestResult, PackageVersionListOptions, PackageVersionListResult, PackageVersionOptions, PackageVersionReportResult } from '../interfaces';
2
+ import { PackageSaveResult, PackageVersionCreateOptions, PackageVersionCreateRequestResult, PackageVersionListOptions, PackageVersionListResult, PackageVersionOptions, PackageVersionReportResult, PackageVersionUpdateOptions } from '../interfaces';
3
3
  export declare class PackageVersion {
4
4
  private options;
5
5
  private readonly project;
@@ -59,7 +59,7 @@ export declare class PackageVersion {
59
59
  list(options: PackageVersionListOptions): Promise<PackageVersionListResult[]>;
60
60
  uninstall(): Promise<void>;
61
61
  promote(id: string): Promise<PackageSaveResult>;
62
- update(): Promise<void>;
62
+ update(id: string, options: PackageVersionUpdateOptions): Promise<PackageSaveResult>;
63
63
  private updateDeprecation;
64
64
  private updateProjectWithPackageVersion;
65
65
  }
@@ -167,8 +167,28 @@ class PackageVersion {
167
167
  }
168
168
  return await this.options.connection.tooling.update('Package2Version', { IsReleased: true, Id: id });
169
169
  }
170
- update() {
171
- return Promise.resolve(undefined);
170
+ async update(id, options) {
171
+ // ID can be an 04t or 05i
172
+ (0, utils_1.validateId)([utils_1.BY_LABEL.SUBSCRIBER_PACKAGE_VERSION_ID, utils_1.BY_LABEL.PACKAGE_VERSION_ID], id);
173
+ // lookup the 05i ID, if needed
174
+ id = await (0, utils_1.getPackageVersionId)(id, this.connection);
175
+ const request = {
176
+ Id: id,
177
+ InstallKey: options.InstallKey,
178
+ Name: options.VersionName,
179
+ Description: options.VersionDescription,
180
+ Branch: options.Branch,
181
+ Tag: options.Tag,
182
+ };
183
+ // filter out any undefined values and their keys
184
+ Object.keys(request).forEach((key) => request[key] === undefined && delete request[key]);
185
+ const result = await this.connection.tooling.update('Package2Version', request);
186
+ if (!result.success) {
187
+ throw new Error(result.errors.join(', '));
188
+ }
189
+ // Use the 04t ID for the success message
190
+ result.id = await (0, utils_1.getSubscriberPackageVersionId)(id, this.connection);
191
+ return result;
172
192
  }
173
193
  async updateDeprecation(idOrAlias, IsDeprecated) {
174
194
  const packageVersionId = (0, utils_1.getPackageIdFromAlias)(idOrAlias, this.project);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/packaging",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "packing libraries to Salesforce packaging platform",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",