@salesforce/packaging 0.0.6 → 0.0.9
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 +18 -0
- package/lib/interfaces/packagingInterfacesAndType.d.ts +21 -8
- package/lib/interfaces/packagingSObjects.d.ts +11 -0
- package/lib/package/index.d.ts +1 -1
- package/lib/package/index.js +1 -1
- package/lib/package/packageConvert.d.ts +2 -2
- package/lib/package/packageConvert.js +8 -2
- package/lib/package/packageCreate.d.ts +1 -1
- package/lib/package/packageCreate.js +7 -8
- package/lib/package/{profileApi.d.ts → packageProfileApi.d.ts} +9 -5
- package/lib/package/{profileApi.js → packageProfileApi.js} +15 -12
- package/lib/package/packageVersion.d.ts +20 -3
- package/lib/package/packageVersion.js +49 -3
- package/lib/package/packageVersionCreate.d.ts +4 -6
- package/lib/package/packageVersionCreate.js +69 -94
- package/lib/package/packageVersionCreateRequest.d.ts +3 -3
- package/lib/package/packageVersionCreateRequest.js +7 -7
- package/lib/package/packageVersionList.js +1 -1
- package/lib/package1/index.d.ts +2 -0
- package/lib/package1/index.js +2 -0
- package/lib/package1/package1VersionCreateGet.d.ts +3 -0
- package/lib/package1/package1VersionCreateGet.js +16 -0
- package/lib/package1/packageDisplay.d.ts +9 -0
- package/lib/package1/packageDisplay.js +29 -0
- package/lib/utils/packageUtils.d.ts +10 -10
- package/lib/utils/packageUtils.js +39 -42
- package/lib/utils/srcDevUtils.js +23 -19
- package/lib/utils/versionNumber.js +6 -6
- package/messages/messages.md +32 -0
- package/package.json +8 -14
- package/lib/package/packageVersion2GP.d.ts +0 -17
- package/lib/package/packageVersion2GP.js +0 -46
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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.9](https://github.com/forcedotcom/packaging/compare/v0.0.8...v0.0.9) (2022-07-19)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- add package1Display method for use with package1:version:display command ([ef3df30](https://github.com/forcedotcom/packaging/commit/ef3df309147bafb16367c957981a04470c6ad7df))
|
|
10
|
+
|
|
11
|
+
### [0.0.8](https://github.com/forcedotcom/packaging/compare/v0.0.7...v0.0.8) (2022-07-18)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- add package1VersionDisplayGet method ([0de1b9e](https://github.com/forcedotcom/packaging/commit/0de1b9e730dc1dc18c68f4efa7bbc2e2b0b43807))
|
|
16
|
+
|
|
17
|
+
### [0.0.7](https://github.com/forcedotcom/packaging/compare/v0.0.6...v0.0.7) (2022-07-14)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- add package version create/delete to library ([7713d4d](https://github.com/forcedotcom/packaging/commit/7713d4dc7d25f2a381a6972e57f24c9fbdcbae05))
|
|
22
|
+
|
|
5
23
|
### [0.0.6](https://github.com/forcedotcom/packaging/compare/v0.0.5...v0.0.6) (2022-07-08)
|
|
6
24
|
|
|
7
25
|
### Bug Fixes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Duration } from '@salesforce/kit';
|
|
2
2
|
import { Connection, SfProject } from '@salesforce/core';
|
|
3
3
|
import { SaveResult } from 'jsforce';
|
|
4
|
-
import {
|
|
4
|
+
import { PackageProfileApi } from '../package/packageProfileApi';
|
|
5
5
|
import { PackagingSObjects } from './packagingSObjects';
|
|
6
6
|
import Package2VersionStatus = PackagingSObjects.Package2VersionStatus;
|
|
7
7
|
export interface IPackage {
|
|
@@ -34,7 +34,7 @@ export interface IPackageVersion2GP {
|
|
|
34
34
|
export declare type PackageOptions = Record<string, unknown>;
|
|
35
35
|
export declare type PackageVersion2Options = Record<string, unknown>;
|
|
36
36
|
export declare type PackageVersionOptions1GP = Record<string, unknown>;
|
|
37
|
-
export declare type
|
|
37
|
+
export declare type PackageVersionCreateRequestResult = {
|
|
38
38
|
Id: string;
|
|
39
39
|
Status: Package2VersionStatus;
|
|
40
40
|
Package2Id: string;
|
|
@@ -47,13 +47,13 @@ export declare type Package2VersionCreateRequestResult = {
|
|
|
47
47
|
HasMetadataRemoved: boolean | null;
|
|
48
48
|
CreatedBy: string;
|
|
49
49
|
};
|
|
50
|
-
export declare type
|
|
50
|
+
export declare type PackageVersionCreateRequestError = {
|
|
51
51
|
Message: string;
|
|
52
52
|
};
|
|
53
|
-
export declare type
|
|
53
|
+
export declare type PackageVersionCreateEventData = {
|
|
54
54
|
id: string;
|
|
55
55
|
packageUpdated?: boolean;
|
|
56
|
-
|
|
56
|
+
packageVersionCreateRequestResult: PackageVersionCreateRequestResult;
|
|
57
57
|
message?: string;
|
|
58
58
|
timeRemaining?: Duration;
|
|
59
59
|
};
|
|
@@ -92,6 +92,14 @@ export declare type PackageVersionListResult = {
|
|
|
92
92
|
BuildDurationInSeconds?: number;
|
|
93
93
|
HasMetadataRemoved?: boolean;
|
|
94
94
|
};
|
|
95
|
+
export declare type Package1Display = {
|
|
96
|
+
MetadataPackageVersionId: string;
|
|
97
|
+
MetadataPackageId: string;
|
|
98
|
+
Name: string;
|
|
99
|
+
Version: string;
|
|
100
|
+
ReleaseState: string;
|
|
101
|
+
BuildNumber: number;
|
|
102
|
+
};
|
|
95
103
|
export declare type PackageType = 'Managed' | 'Unlocked';
|
|
96
104
|
export declare type PackageCreateOptions = {
|
|
97
105
|
name: string;
|
|
@@ -135,7 +143,7 @@ export declare type PackageVersionOptions = {
|
|
|
135
143
|
connection: Connection;
|
|
136
144
|
project: SfProject;
|
|
137
145
|
};
|
|
138
|
-
export declare type PackageVersionCreateOptions = PackageVersionOptions & {
|
|
146
|
+
export declare type PackageVersionCreateOptions = Partial<PackageVersionOptions & {
|
|
139
147
|
branch: string;
|
|
140
148
|
buildinstance: string;
|
|
141
149
|
codecoverage: boolean;
|
|
@@ -158,10 +166,15 @@ export declare type PackageVersionCreateOptions = PackageVersionOptions & {
|
|
|
158
166
|
versionname: string;
|
|
159
167
|
versionnumber: string;
|
|
160
168
|
wait: Duration;
|
|
161
|
-
profileApi
|
|
162
|
-
}
|
|
169
|
+
profileApi: PackageProfileApi;
|
|
170
|
+
}>;
|
|
163
171
|
export declare type PackageVersionCreateRequestQueryOptions = {
|
|
164
172
|
createdlastdays?: number;
|
|
165
173
|
connection?: Connection;
|
|
166
174
|
status?: string;
|
|
167
175
|
};
|
|
176
|
+
export declare type ProfileApiOptions = {
|
|
177
|
+
project: SfProject;
|
|
178
|
+
includeUserLicenses: boolean;
|
|
179
|
+
generateProfileInformation: boolean;
|
|
180
|
+
};
|
|
@@ -223,4 +223,15 @@ export declare namespace PackagingSObjects {
|
|
|
223
223
|
SubscriberPackageVersionId: string;
|
|
224
224
|
MinPackageVersionId: string;
|
|
225
225
|
};
|
|
226
|
+
type MetadataPackageVersion = {
|
|
227
|
+
Id: string;
|
|
228
|
+
MetadataPackageId: string;
|
|
229
|
+
Name: string;
|
|
230
|
+
ReleaseState: 'Beta' | 'Released';
|
|
231
|
+
MajorVersion: number;
|
|
232
|
+
MinorVersion: number;
|
|
233
|
+
PatchVersion: number;
|
|
234
|
+
BuildNumber: number;
|
|
235
|
+
IsDeprecated: boolean;
|
|
236
|
+
};
|
|
226
237
|
}
|
package/lib/package/index.d.ts
CHANGED
package/lib/package/index.js
CHANGED
|
@@ -22,7 +22,7 @@ exports.deletePackage = exports.createPackage = exports.listPackageVersions = vo
|
|
|
22
22
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
23
23
|
*/
|
|
24
24
|
__exportStar(require("./package"), exports);
|
|
25
|
-
__exportStar(require("./
|
|
25
|
+
__exportStar(require("./packageVersion"), exports);
|
|
26
26
|
__exportStar(require("./packageList"), exports);
|
|
27
27
|
__exportStar(require("./packageVersionCreateRequest"), exports);
|
|
28
28
|
var packageVersionList_1 = require("./packageVersionList");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Connection, Org, SfProject } from '@salesforce/core';
|
|
2
2
|
import { Duration } from '@salesforce/kit';
|
|
3
|
-
import {
|
|
3
|
+
import { PackageVersionCreateRequestResult } from '../interfaces';
|
|
4
4
|
declare type ConvertPackageOptions = {
|
|
5
5
|
installationKey: string;
|
|
6
6
|
installationKeyBypass: boolean;
|
|
7
7
|
wait: Duration;
|
|
8
8
|
buildInstance: string;
|
|
9
9
|
};
|
|
10
|
-
export declare function convertPackage(pkg: string, org: Org, connection: Connection, project: SfProject, options: ConvertPackageOptions): Promise<
|
|
10
|
+
export declare function convertPackage(pkg: string, org: Org, connection: Connection, project: SfProject, options: ConvertPackageOptions): Promise<PackageVersionCreateRequestResult>;
|
|
11
11
|
export {};
|
|
@@ -11,24 +11,30 @@ const path = require("path");
|
|
|
11
11
|
const util = require("util");
|
|
12
12
|
const os = require("os");
|
|
13
13
|
const fs = require("fs");
|
|
14
|
+
const core_1 = require("@salesforce/core");
|
|
14
15
|
const kit_1 = require("@salesforce/kit");
|
|
15
16
|
const testSetup_1 = require("@salesforce/core/lib/testSetup");
|
|
16
17
|
const pkgUtils = require("../utils/packageUtils");
|
|
17
18
|
const constants_1 = require("../constants");
|
|
18
19
|
const srcDevUtil = require("../utils/srcDevUtils");
|
|
19
20
|
const packageVersionCreateRequest_1 = require("./packageVersionCreateRequest");
|
|
21
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
22
|
+
const messages = core_1.Messages.loadMessages('@salesforce/packaging', 'messages');
|
|
20
23
|
async function convertPackage(pkg, org, connection, project, options) {
|
|
21
24
|
let maxRetries = 0;
|
|
22
25
|
const branch = 'main';
|
|
23
26
|
if (options.wait) {
|
|
24
27
|
maxRetries = (60 / pkgUtils.POLL_INTERVAL_SECONDS) * options.wait.seconds;
|
|
25
28
|
}
|
|
26
|
-
const packageId = await pkgUtils.
|
|
29
|
+
const packageId = await pkgUtils.findOrCreatePackage(pkg, connection);
|
|
27
30
|
const request = await createPackageVersionCreateRequest(context, packageId);
|
|
28
31
|
const createResult = await connection.tooling.create('Package2VersionCreateRequest', request);
|
|
29
32
|
if (!createResult.success) {
|
|
30
33
|
const errStr = createResult.errors && createResult.errors.length ? createResult.errors.join(', ') : createResult.errors;
|
|
31
|
-
throw
|
|
34
|
+
throw messages.createError('failedToCreatePVCRequest', [
|
|
35
|
+
createResult.id ? ` [${createResult.id}]` : '',
|
|
36
|
+
errStr.toString(),
|
|
37
|
+
]);
|
|
32
38
|
}
|
|
33
39
|
let results;
|
|
34
40
|
if (options.wait) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection, NamedPackageDir, PackageDir, SfProject } from '@salesforce/core';
|
|
2
2
|
import { PackageCreateOptions, PackagingSObjects } from '../interfaces';
|
|
3
3
|
declare type Package2Request = Pick<PackagingSObjects.Package2, 'Name' | 'Description' | 'NamespacePrefix' | 'ContainerOptions' | 'IsOrgDependent' | 'PackageErrorUsername'>;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function _createPackageRequestFromContext(project: SfProject, options: PackageCreateOptions): Package2Request;
|
|
5
5
|
/**
|
|
6
6
|
* Generate packageDirectory json entry for this package that can be written to sfdx-project.json
|
|
7
7
|
*
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.createPackage = exports._generatePackageAliasEntry = exports._generatePackageDirEntry = exports.
|
|
9
|
+
exports.createPackage = exports._generatePackageAliasEntry = exports._generatePackageDirEntry = exports._createPackageRequestFromContext = void 0;
|
|
10
10
|
const core_1 = require("@salesforce/core");
|
|
11
11
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
12
|
const pkgUtils = require("../utils/packageUtils");
|
|
13
13
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
14
14
|
const messages = core_1.Messages.loadMessages('@salesforce/packaging', 'messages');
|
|
15
|
-
function
|
|
15
|
+
function _createPackageRequestFromContext(project, options) {
|
|
16
16
|
const namespace = options.noNamespace ? '' : project.getSfProjectJson().getContents().namespace || '';
|
|
17
17
|
return {
|
|
18
18
|
Name: options.name,
|
|
@@ -23,7 +23,7 @@ function _createPackage2RequestFromContext(project, options) {
|
|
|
23
23
|
PackageErrorUsername: options.errorNotificationUsername,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
exports.
|
|
26
|
+
exports._createPackageRequestFromContext = _createPackageRequestFromContext;
|
|
27
27
|
/**
|
|
28
28
|
* Generate packageDirectory json entry for this package that can be written to sfdx-project.json
|
|
29
29
|
*
|
|
@@ -32,7 +32,6 @@ exports._createPackage2RequestFromContext = _createPackage2RequestFromContext;
|
|
|
32
32
|
* @private
|
|
33
33
|
*/
|
|
34
34
|
function _generatePackageDirEntry(project, options) {
|
|
35
|
-
var _a, _b;
|
|
36
35
|
let packageDirs = project.getPackageDirectories();
|
|
37
36
|
if (!packageDirs) {
|
|
38
37
|
packageDirs = [];
|
|
@@ -47,8 +46,8 @@ function _generatePackageDirEntry(project, options) {
|
|
|
47
46
|
if (packageDir) {
|
|
48
47
|
// update existing entry
|
|
49
48
|
packageDir.package = options.name;
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
packageDir.versionName ?? (packageDir.versionName = pkgUtils.DEFAULT_PACKAGE_DIR.versionName);
|
|
50
|
+
packageDir.versionNumber ?? (packageDir.versionNumber = pkgUtils.DEFAULT_PACKAGE_DIR.versionNumber);
|
|
52
51
|
// set as default if this is the only entry or no other entry is the default
|
|
53
52
|
if (!Reflect.getOwnPropertyDescriptor(packageDir, 'default')) {
|
|
54
53
|
packageDir.default = !pkgUtils.getConfigPackageDirectory(packageDirs, 'default', true);
|
|
@@ -83,7 +82,7 @@ exports._generatePackageAliasEntry = _generatePackageAliasEntry;
|
|
|
83
82
|
async function createPackage(connection, project, options) {
|
|
84
83
|
// strip trailing slash from path param
|
|
85
84
|
options.path = options.path.replace(/\/$/, '');
|
|
86
|
-
const request =
|
|
85
|
+
const request = _createPackageRequestFromContext(project, options);
|
|
87
86
|
let packageId = null;
|
|
88
87
|
const createResult = await connection.tooling
|
|
89
88
|
.sobject('Package2')
|
|
@@ -97,7 +96,7 @@ async function createPackage(connection, project, options) {
|
|
|
97
96
|
}
|
|
98
97
|
packageId = createResult.id;
|
|
99
98
|
const queryResult = await connection.tooling.query(`SELECT Id FROM Package2 WHERE Id='${packageId}'`);
|
|
100
|
-
if (!
|
|
99
|
+
if (!queryResult?.records[0]) {
|
|
101
100
|
throw messages.createError('unableToFindPackageWithId', [packageId]);
|
|
102
101
|
}
|
|
103
102
|
const record = queryResult.records[0];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ConfigAggregator, SfProject } from '@salesforce/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { AsyncCreatable } from '@salesforce/kit';
|
|
3
|
+
import { ProfileApiOptions } from '../interfaces';
|
|
4
|
+
export declare class PackageProfileApi extends AsyncCreatable<ProfileApiOptions> {
|
|
5
|
+
private options;
|
|
6
6
|
readonly profiles: ProfileInformation[];
|
|
7
7
|
apiVersion: string;
|
|
8
8
|
nodeEntities: {
|
|
@@ -16,7 +16,11 @@ export declare class ProfileApi {
|
|
|
16
16
|
parentElement: string[];
|
|
17
17
|
};
|
|
18
18
|
config: ConfigAggregator;
|
|
19
|
-
|
|
19
|
+
project: SfProject;
|
|
20
|
+
includeUserLicenses: boolean;
|
|
21
|
+
generateProfileInformation: boolean;
|
|
22
|
+
constructor(options: ProfileApiOptions);
|
|
23
|
+
init(): Promise<void>;
|
|
20
24
|
/**
|
|
21
25
|
* For any profile present in the workspace, this function generates a subset of data that only contains references
|
|
22
26
|
* to items in the manifest.
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.PackageProfileApi = void 0;
|
|
10
10
|
const path = require("path");
|
|
11
11
|
const fs = require("fs");
|
|
12
12
|
const glob = require("glob");
|
|
13
13
|
const xmldom_sfdx_encoding_1 = require("xmldom-sfdx-encoding");
|
|
14
14
|
const core_1 = require("@salesforce/core");
|
|
15
|
-
|
|
15
|
+
const kit_1 = require("@salesforce/kit");
|
|
16
16
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
17
17
|
// TODO: need to transfer these messages
|
|
18
18
|
const profileApiMessages = core_1.Messages.loadMessages('@salesforce/packaging', 'messages');
|
|
@@ -21,15 +21,18 @@ const profileApiMessages = core_1.Messages.loadMessages('@salesforce/packaging',
|
|
|
21
21
|
* All profiles found in the workspaces are extracted out and then re-written to only include metadata in the profile
|
|
22
22
|
* that is relevant to the source in the package directory being packaged.
|
|
23
23
|
*/
|
|
24
|
-
class
|
|
25
|
-
constructor(
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
this.generateProfileInformation = generateProfileInformation;
|
|
24
|
+
class PackageProfileApi extends kit_1.AsyncCreatable {
|
|
25
|
+
constructor(options) {
|
|
26
|
+
super(options);
|
|
27
|
+
this.options = options;
|
|
29
28
|
this.profiles = [];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
this.generateProfileInformation = false;
|
|
30
|
+
}
|
|
31
|
+
async init() {
|
|
32
|
+
this.project = this.options.project;
|
|
33
|
+
this.includeUserLicenses = this.options.includeUserLicenses;
|
|
34
|
+
this.generateProfileInformation = this.options.generateProfileInformation;
|
|
35
|
+
this.config = await core_1.ConfigAggregator.create();
|
|
33
36
|
this.apiVersion = this.config.getPropertyValue('apiVersion');
|
|
34
37
|
// nodeEntities is used to determine which elements in the profile are relevant to the source being packaged.
|
|
35
38
|
// name refers to the entity type name in source that the element pertains to. As an example, a profile may
|
|
@@ -238,7 +241,7 @@ class ProfileApi {
|
|
|
238
241
|
});
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
|
-
exports.
|
|
244
|
+
exports.PackageProfileApi = PackageProfileApi;
|
|
242
245
|
class ProfileInformation {
|
|
243
246
|
constructor(ProfileName, ProfilePath, IsPackaged, settingsRemoved) {
|
|
244
247
|
this.ProfileName = ProfileName;
|
|
@@ -272,4 +275,4 @@ class ProfileInformation {
|
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
}
|
|
275
|
-
//# sourceMappingURL=
|
|
278
|
+
//# sourceMappingURL=packageProfileApi.js.map
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PackageVersionCreateRequestResult, PackageSaveResult, PackageVersionCreateOptions, PackageVersionOptions } from '../interfaces';
|
|
2
2
|
export declare class PackageVersion {
|
|
3
3
|
private options;
|
|
4
4
|
private readonly project;
|
|
5
5
|
private readonly connection;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
constructor(options: PackageVersionOptions);
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new package version.
|
|
9
|
+
*
|
|
10
|
+
* @param options
|
|
11
|
+
*/
|
|
12
|
+
create(options: PackageVersionCreateOptions): Promise<Partial<PackageVersionCreateRequestResult>>;
|
|
13
|
+
/**
|
|
14
|
+
* Deletes a package version.
|
|
15
|
+
*
|
|
16
|
+
* @param idOrAlias
|
|
17
|
+
* @param undelete
|
|
18
|
+
*/
|
|
19
|
+
delete(idOrAlias: string, undelete?: boolean): Promise<PackageSaveResult>;
|
|
20
|
+
convert(): Promise<void>;
|
|
21
|
+
install(): Promise<void>;
|
|
22
|
+
list(): Promise<void>;
|
|
23
|
+
uninstall(): Promise<void>;
|
|
24
|
+
update(): Promise<void>;
|
|
8
25
|
}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.PackageVersion = void 0;
|
|
10
10
|
const core_1 = require("@salesforce/core");
|
|
11
|
+
const pkgUtils = require("../utils/packageUtils");
|
|
12
|
+
const utils_1 = require("../utils");
|
|
11
13
|
const packageVersionCreate_1 = require("./packageVersionCreate");
|
|
12
14
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
13
15
|
// const messages = Messages.loadMessages('@salesforce/packaging', 'messages');
|
|
@@ -18,9 +20,53 @@ class PackageVersion {
|
|
|
18
20
|
this.connection = this.options.connection;
|
|
19
21
|
this.project = this.options.project;
|
|
20
22
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new package version.
|
|
25
|
+
*
|
|
26
|
+
* @param options
|
|
27
|
+
*/
|
|
28
|
+
async create(options) {
|
|
29
|
+
const pvc = new packageVersionCreate_1.PackageVersionCreate({ ...options, ...this.options });
|
|
30
|
+
return pvc.createPackageVersion();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Deletes a package version.
|
|
34
|
+
*
|
|
35
|
+
* @param idOrAlias
|
|
36
|
+
* @param undelete
|
|
37
|
+
*/
|
|
38
|
+
async delete(idOrAlias, undelete = false) {
|
|
39
|
+
const packageVersionId = pkgUtils.getPackageIdFromAlias(idOrAlias, this.project);
|
|
40
|
+
// ID can be an 04t or 05i
|
|
41
|
+
pkgUtils.validateId([pkgUtils.BY_LABEL.SUBSCRIBER_PACKAGE_VERSION_ID, pkgUtils.BY_LABEL.PACKAGE_VERSION_ID], packageVersionId);
|
|
42
|
+
// lookup the 05i ID, if needed
|
|
43
|
+
const packageId = await pkgUtils.getPackageVersionId(packageVersionId, this.connection);
|
|
44
|
+
// setup the request
|
|
45
|
+
const request = {
|
|
46
|
+
Id: packageId,
|
|
47
|
+
IsDeprecated: !undelete,
|
|
48
|
+
};
|
|
49
|
+
const updateResult = await this.connection.tooling.update('Package2Version', request);
|
|
50
|
+
if (!updateResult.success) {
|
|
51
|
+
throw (0, utils_1.combineSaveErrors)('Package2', 'update', updateResult.errors);
|
|
52
|
+
}
|
|
53
|
+
updateResult.id = await pkgUtils.getSubscriberPackageVersionId(packageVersionId, this.connection);
|
|
54
|
+
return updateResult;
|
|
55
|
+
}
|
|
56
|
+
convert() {
|
|
57
|
+
return Promise.resolve(undefined);
|
|
58
|
+
}
|
|
59
|
+
install() {
|
|
60
|
+
return Promise.resolve(undefined);
|
|
61
|
+
}
|
|
62
|
+
list() {
|
|
63
|
+
return Promise.resolve(undefined);
|
|
64
|
+
}
|
|
65
|
+
uninstall() {
|
|
66
|
+
return Promise.resolve(undefined);
|
|
67
|
+
}
|
|
68
|
+
update() {
|
|
69
|
+
return Promise.resolve(undefined);
|
|
24
70
|
}
|
|
25
71
|
}
|
|
26
72
|
exports.PackageVersion = PackageVersion;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { Connection } from '@salesforce/core';
|
|
2
|
-
import {
|
|
2
|
+
import { PackageVersionCreateRequestResult, PackageVersionCreateOptions } from '../interfaces';
|
|
3
3
|
export declare class PackageVersionCreate {
|
|
4
4
|
private options;
|
|
5
5
|
private apiVersionFromPackageXml;
|
|
6
|
-
private packageDirs;
|
|
7
6
|
private readonly project;
|
|
8
7
|
private readonly connection;
|
|
9
8
|
constructor(options: PackageVersionCreateOptions);
|
|
10
|
-
createPackageVersion(
|
|
11
|
-
listRequest(createdlastdays?: number, status?: string): Promise<
|
|
12
|
-
listRequestById(id: string, connection: Connection): Promise<
|
|
13
|
-
rejectWithInstallKeyError(): Promise<never>;
|
|
9
|
+
createPackageVersion(): Promise<Partial<PackageVersionCreateRequestResult>>;
|
|
10
|
+
listRequest(createdlastdays?: number, status?: string): Promise<PackageVersionCreateRequestResult[]>;
|
|
11
|
+
listRequestById(id: string, connection: Connection): Promise<PackageVersionCreateRequestResult[]>;
|
|
14
12
|
private generateMDFolderForArtifact;
|
|
15
13
|
private validateDependencyValues;
|
|
16
14
|
/**
|