@salesforce/packaging 0.0.45 → 0.0.47
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/lib/interfaces/packagingInterfacesAndType.d.ts +3 -9
- package/lib/package1/index.d.ts +1 -5
- package/lib/package1/index.js +1 -5
- package/lib/package1/package1Version.d.ts +52 -0
- package/lib/package1/package1Version.js +127 -0
- package/lib/utils/versionNumber.d.ts +9 -0
- package/lib/utils/versionNumber.js +21 -0
- package/messages/package1Version.md +28 -0
- package/messages/version_number.md +4 -0
- package/package.json +8 -8
- package/lib/package1/package1VersionCreate.d.ts +0 -7
- package/lib/package1/package1VersionCreate.js +0 -56
- package/lib/package1/package1VersionCreateGet.d.ts +0 -3
- package/lib/package1/package1VersionCreateGet.js +0 -16
- package/lib/package1/package1VersionList.d.ts +0 -11
- package/lib/package1/package1VersionList.js +0 -31
- package/lib/package1/packageDisplay.d.ts +0 -9
- package/lib/package1/packageDisplay.js +0 -29
- package/lib/package1/packageVersion1GP.d.ts +0 -17
- package/lib/package1/packageVersion1GP.js +0 -46
- package/messages/package1_version_create.md +0 -8
|
@@ -3,7 +3,7 @@ import { Connection, NamedPackageDir, SfProject } from '@salesforce/core';
|
|
|
3
3
|
import { QueryResult, SaveResult } from 'jsforce';
|
|
4
4
|
import { Attributes } from 'graphology-types';
|
|
5
5
|
import { PackageProfileApi } from '../package/packageProfileApi';
|
|
6
|
-
import { PackageAncestryNode } from '../package
|
|
6
|
+
import { PackageAncestryNode } from '../package';
|
|
7
7
|
import { PackagingSObjects } from './packagingSObjects';
|
|
8
8
|
import Package2VersionStatus = PackagingSObjects.Package2VersionStatus;
|
|
9
9
|
import PackageInstallRequest = PackagingSObjects.PackageInstallRequest;
|
|
@@ -21,13 +21,7 @@ export interface IPackage {
|
|
|
21
21
|
getExternalSites(subscriberPackageVersionKey: string, installationKey?: string): any;
|
|
22
22
|
}
|
|
23
23
|
export interface IPackageVersion1GP {
|
|
24
|
-
|
|
25
|
-
convert(): Promise<void>;
|
|
26
|
-
delete(): Promise<void>;
|
|
27
|
-
install(): Promise<void>;
|
|
28
|
-
list(): Promise<void>;
|
|
29
|
-
uninstall(): Promise<void>;
|
|
30
|
-
update(): Promise<void>;
|
|
24
|
+
getPackageVersion(id: string): Promise<MetadataPackageVersion[]>;
|
|
31
25
|
}
|
|
32
26
|
export interface IPackageVersion2GP {
|
|
33
27
|
create(): Promise<void>;
|
|
@@ -267,7 +261,7 @@ export declare type PackageVersionReportResult = Partial<PackagingSObjects.Packa
|
|
|
267
261
|
export declare type PackageVersionCreateReportProgress = PackageVersionCreateRequestResult & {
|
|
268
262
|
remainingWaitTime: Duration;
|
|
269
263
|
};
|
|
270
|
-
export declare type Package1VersionCreateRequest = Pick<PackagingSObjects.PackageUploadRequest, 'VersionName'> & Partial<Pick<PackagingSObjects.PackageUploadRequest, '
|
|
264
|
+
export declare type Package1VersionCreateRequest = Pick<PackagingSObjects.PackageUploadRequest, 'VersionName' | 'MetadataPackageId'> & Partial<Pick<PackagingSObjects.PackageUploadRequest, 'Description' | 'MajorVersion' | 'MinorVersion' | 'IsReleaseVersion' | 'ReleaseNotesUrl' | 'PostInstallUrl' | 'Password'>>;
|
|
271
265
|
export declare type InstalledPackages = {
|
|
272
266
|
Id: string;
|
|
273
267
|
SubscriberPackageId: string;
|
package/lib/package1/index.d.ts
CHANGED
package/lib/package1/index.js
CHANGED
|
@@ -20,9 +20,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
* Licensed under the BSD 3-Clause license.
|
|
21
21
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
22
22
|
*/
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
__exportStar(require("./packageDisplay"), exports);
|
|
25
|
-
__exportStar(require("./package1VersionCreateGet"), exports);
|
|
26
|
-
__exportStar(require("./package1VersionCreate"), exports);
|
|
27
|
-
__exportStar(require("./package1VersionList"), exports);
|
|
23
|
+
__exportStar(require("./package1Version"), exports);
|
|
28
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
import { Duration } from '@salesforce/kit';
|
|
3
|
+
import { IPackageVersion1GP, Package1VersionCreateRequest, PackagingSObjects } from '../interfaces';
|
|
4
|
+
import MetadataPackageVersion = PackagingSObjects.MetadataPackageVersion;
|
|
5
|
+
/**
|
|
6
|
+
* Package1Version class - Class to be used with 1st generation package versions
|
|
7
|
+
*
|
|
8
|
+
* implementation examples can be seen here: https://github.com/salesforcecli/plugin-packaging/tree/main/src/commands/force/package1/
|
|
9
|
+
*/
|
|
10
|
+
export declare class Package1Version implements IPackageVersion1GP {
|
|
11
|
+
private connection;
|
|
12
|
+
private id;
|
|
13
|
+
/**
|
|
14
|
+
* Package1Version Constructor - Class to be used with 1st generation package versions
|
|
15
|
+
*
|
|
16
|
+
* @param connection: Connection to the org
|
|
17
|
+
* @param id: 04t ID of the package version
|
|
18
|
+
*/
|
|
19
|
+
constructor(connection: Connection, id: string);
|
|
20
|
+
/**
|
|
21
|
+
* Will create a PackageUploadRequest object based on the options provided, will poll for completion if pollingOptions are provided
|
|
22
|
+
*
|
|
23
|
+
* @param connection: Connection to the org
|
|
24
|
+
* @param options: Package1VersionCreateRequest options for the new PackageUploadRequest to be created with
|
|
25
|
+
* @param pollingOptions: options to set frequency, and duration of polling. Default to not poll
|
|
26
|
+
*/
|
|
27
|
+
static create(connection: Connection, options: Package1VersionCreateRequest, pollingOptions?: {
|
|
28
|
+
frequency: Duration;
|
|
29
|
+
timeout: Duration;
|
|
30
|
+
}): Promise<PackagingSObjects.PackageUploadRequest>;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the status of a PackageUploadRequest
|
|
33
|
+
*
|
|
34
|
+
* @param connection Connection to the target org
|
|
35
|
+
* @param id 0HD Id of the PackageUploadRequest
|
|
36
|
+
*/
|
|
37
|
+
static getCreateStatus(connection: Connection, id: string): Promise<PackagingSObjects.PackageUploadRequest>;
|
|
38
|
+
/**
|
|
39
|
+
* Lists package versions available in the org. If package ID is supplied, only list versions of that package,
|
|
40
|
+
* otherwise, list all package versions
|
|
41
|
+
*
|
|
42
|
+
* @param connection Connection to the org
|
|
43
|
+
* @param id: optional, if present, ID of package to list versions for (starts with 033)
|
|
44
|
+
* @returns Array of package version results
|
|
45
|
+
*/
|
|
46
|
+
static list(connection: Connection, id?: string): Promise<MetadataPackageVersion[]>;
|
|
47
|
+
private static packageUploadPolling;
|
|
48
|
+
/**
|
|
49
|
+
* Queries the org for the package version with the given ID
|
|
50
|
+
*/
|
|
51
|
+
getPackageVersion(): Promise<MetadataPackageVersion[]>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Package1Version = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
* Licensed under the BSD 3-Clause license.
|
|
8
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
+
*/
|
|
10
|
+
const os = require("os");
|
|
11
|
+
const core_1 = require("@salesforce/core");
|
|
12
|
+
const kit_1 = require("@salesforce/kit");
|
|
13
|
+
const interfaces_1 = require("../interfaces");
|
|
14
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
|
+
const messages = core_1.Messages.loadMessages('@salesforce/packaging', 'package1Version');
|
|
16
|
+
/**
|
|
17
|
+
* Package1Version class - Class to be used with 1st generation package versions
|
|
18
|
+
*
|
|
19
|
+
* implementation examples can be seen here: https://github.com/salesforcecli/plugin-packaging/tree/main/src/commands/force/package1/
|
|
20
|
+
*/
|
|
21
|
+
class Package1Version {
|
|
22
|
+
/**
|
|
23
|
+
* Package1Version Constructor - Class to be used with 1st generation package versions
|
|
24
|
+
*
|
|
25
|
+
* @param connection: Connection to the org
|
|
26
|
+
* @param id: 04t ID of the package version
|
|
27
|
+
*/
|
|
28
|
+
constructor(connection, id) {
|
|
29
|
+
this.connection = connection;
|
|
30
|
+
this.id = id;
|
|
31
|
+
if (!id.startsWith('04t')) {
|
|
32
|
+
throw messages.createError('invalid04tId', [id]);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Will create a PackageUploadRequest object based on the options provided, will poll for completion if pollingOptions are provided
|
|
37
|
+
*
|
|
38
|
+
* @param connection: Connection to the org
|
|
39
|
+
* @param options: Package1VersionCreateRequest options for the new PackageUploadRequest to be created with
|
|
40
|
+
* @param pollingOptions: options to set frequency, and duration of polling. Default to not poll
|
|
41
|
+
*/
|
|
42
|
+
static async create(connection, options, pollingOptions = { frequency: kit_1.Duration.seconds(5), timeout: kit_1.Duration.seconds(0) }) {
|
|
43
|
+
if (!options.MetadataPackageId || !options.MetadataPackageId.startsWith('033')) {
|
|
44
|
+
throw messages.createError('missingMetadataPackageId');
|
|
45
|
+
}
|
|
46
|
+
if (!options.VersionName) {
|
|
47
|
+
throw messages.createError('missingVersionName');
|
|
48
|
+
}
|
|
49
|
+
const createRequest = await connection.tooling.sobject('PackageUploadRequest').create(options);
|
|
50
|
+
if (pollingOptions.timeout.seconds) {
|
|
51
|
+
const timeout = pollingOptions.timeout.seconds;
|
|
52
|
+
const pollingClient = await core_1.PollingClient.create({
|
|
53
|
+
poll: () => Package1Version.packageUploadPolling(connection, createRequest.id, timeout, pollingOptions.frequency.seconds),
|
|
54
|
+
...pollingOptions,
|
|
55
|
+
});
|
|
56
|
+
return pollingClient.subscribe();
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// jsforce templates weren't working when setting the type to PackageUploadRequest, so we have to cast `as unknown as PackagingSObjects.PackageUploadRequest`
|
|
60
|
+
return (await connection.tooling
|
|
61
|
+
.sobject('PackageUploadRequest')
|
|
62
|
+
.retrieve(createRequest.id));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns the status of a PackageUploadRequest
|
|
67
|
+
*
|
|
68
|
+
* @param connection Connection to the target org
|
|
69
|
+
* @param id 0HD Id of the PackageUploadRequest
|
|
70
|
+
*/
|
|
71
|
+
static async getCreateStatus(connection, id) {
|
|
72
|
+
if (!id.startsWith('0HD')) {
|
|
73
|
+
throw messages.createError('invalid0HDId', [id]);
|
|
74
|
+
}
|
|
75
|
+
return (await connection.tooling
|
|
76
|
+
.sobject('PackageUploadRequest')
|
|
77
|
+
.retrieve(id));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Lists package versions available in the org. If package ID is supplied, only list versions of that package,
|
|
81
|
+
* otherwise, list all package versions
|
|
82
|
+
*
|
|
83
|
+
* @param connection Connection to the org
|
|
84
|
+
* @param id: optional, if present, ID of package to list versions for (starts with 033)
|
|
85
|
+
* @returns Array of package version results
|
|
86
|
+
*/
|
|
87
|
+
static async list(connection, id) {
|
|
88
|
+
if (id && !id?.startsWith('033')) {
|
|
89
|
+
// we have to check that it is present, and starts with 033
|
|
90
|
+
// otherwise, undefined doesn't start with 033 and will trigger this error, when it shouldn't
|
|
91
|
+
throw messages.createError('invalid033Id', [id]);
|
|
92
|
+
}
|
|
93
|
+
const query = `SELECT Id,MetadataPackageId,Name,ReleaseState,MajorVersion,MinorVersion,PatchVersion,BuildNumber FROM MetadataPackageVersion ${id ? `WHERE MetadataPackageId = '${id}'` : ''} ORDER BY MetadataPackageId, MajorVersion, MinorVersion, PatchVersion, BuildNumber`;
|
|
94
|
+
return (await connection.tooling.query(query)).records;
|
|
95
|
+
}
|
|
96
|
+
static async packageUploadPolling(connection, id, timeout, frequency) {
|
|
97
|
+
const pollingResult = await connection.tooling.sobject('PackageUploadRequest').retrieve(id);
|
|
98
|
+
switch (pollingResult.Status) {
|
|
99
|
+
case 'SUCCESS':
|
|
100
|
+
return { completed: true, payload: pollingResult };
|
|
101
|
+
case 'IN_PROGRESS':
|
|
102
|
+
case 'QUEUED':
|
|
103
|
+
timeout -= frequency;
|
|
104
|
+
await core_1.Lifecycle.getInstance().emit(interfaces_1.Package1VersionEvents.create.progress, { timeout, pollingResult });
|
|
105
|
+
return { completed: false, payload: pollingResult };
|
|
106
|
+
default: {
|
|
107
|
+
if (pollingResult?.Errors?.errors?.length > 0) {
|
|
108
|
+
throw messages.createError('package1VersionCreateCommandUploadFailure', [
|
|
109
|
+
pollingResult.Errors.errors.map((e) => e.message).join(os.EOL),
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
throw messages.createError('package1VersionCreateCommandUploadFailureDefault');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Queries the org for the package version with the given ID
|
|
120
|
+
*/
|
|
121
|
+
async getPackageVersion() {
|
|
122
|
+
const query = `SELECT Id, MetadataPackageId, Name, ReleaseState, MajorVersion, MinorVersion, PatchVersion, BuildNumber FROM MetadataPackageVersion WHERE id = '${this.id}'`;
|
|
123
|
+
return (await this.connection.tooling.query(query)).records;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.Package1Version = Package1Version;
|
|
127
|
+
//# sourceMappingURL=package1Version.js.map
|
|
@@ -11,6 +11,15 @@ export declare class VersionNumber {
|
|
|
11
11
|
patch: string | number;
|
|
12
12
|
build: string | number;
|
|
13
13
|
constructor(major: string | number, minor: string | number, patch: string | number, build: string | number);
|
|
14
|
+
/**
|
|
15
|
+
* Separates at major.minor string into {major: Number, minor: Number} object
|
|
16
|
+
*
|
|
17
|
+
* @param versionString a string in the format of major.minor like '3.2'
|
|
18
|
+
*/
|
|
19
|
+
static parseMajorMinor(versionString: string): {
|
|
20
|
+
major: number;
|
|
21
|
+
minor: number;
|
|
22
|
+
};
|
|
14
23
|
static from(versionString: string): VersionNumber;
|
|
15
24
|
toString(): string;
|
|
16
25
|
isbuildKeyword(): boolean;
|
|
@@ -25,6 +25,27 @@ class VersionNumber {
|
|
|
25
25
|
this.patch = patch;
|
|
26
26
|
this.build = build;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Separates at major.minor string into {major: Number, minor: Number} object
|
|
30
|
+
*
|
|
31
|
+
* @param versionString a string in the format of major.minor like '3.2'
|
|
32
|
+
*/
|
|
33
|
+
static parseMajorMinor(versionString) {
|
|
34
|
+
const versions = versionString?.split('.');
|
|
35
|
+
if (!versions) {
|
|
36
|
+
// return nulls so when no version option is provided, the server can infer the correct version
|
|
37
|
+
return { major: null, minor: null };
|
|
38
|
+
}
|
|
39
|
+
if (versions.length === 2) {
|
|
40
|
+
return {
|
|
41
|
+
major: Number(versions[0]),
|
|
42
|
+
minor: Number(versions[1]),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw messages.createError('invalidMajorMinorFormat', [versionString]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
28
49
|
static from(versionString) {
|
|
29
50
|
if (!versionString) {
|
|
30
51
|
throw messages.createError('errorMissingVersionNumber');
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# package1VersionCreateCommandUploadFailureDefault
|
|
2
|
+
|
|
3
|
+
Package version creation failed with unknown error
|
|
4
|
+
|
|
5
|
+
# package1VersionCreateCommandUploadFailure
|
|
6
|
+
|
|
7
|
+
Package upload failed.
|
|
8
|
+
%s
|
|
9
|
+
|
|
10
|
+
# invalid04tId
|
|
11
|
+
|
|
12
|
+
Specify a valid package version ID (starts with 04t), received %s
|
|
13
|
+
|
|
14
|
+
# invalid0HDId
|
|
15
|
+
|
|
16
|
+
Specify a valid Package Upload Request ID (starts with 0HD), received %s
|
|
17
|
+
|
|
18
|
+
# invalid033Id
|
|
19
|
+
|
|
20
|
+
Specify a valid package metadata package ID (starts with 033), received %s
|
|
21
|
+
|
|
22
|
+
# missingMetadataPackageId
|
|
23
|
+
|
|
24
|
+
A MetadataPackageId was not provided, but is required, it must start with 033
|
|
25
|
+
|
|
26
|
+
# missingVersionName
|
|
27
|
+
|
|
28
|
+
a VersionName was not provided, but is required
|
|
@@ -13,3 +13,7 @@ VersionNumber parts major, minor or patch must be a number but the value found i
|
|
|
13
13
|
# errorInvalidVersionNumber
|
|
14
14
|
|
|
15
15
|
VersionNumber must be in the format major.minor.patch.build but the value found is [%s].
|
|
16
|
+
|
|
17
|
+
# invalidMajorMinorFormat
|
|
18
|
+
|
|
19
|
+
Version supplied, %s, is not formatted correctly. Enter in major.minor format, for example, 3.2.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/packaging",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
4
|
"description": "packing libraries to Salesforce packaging platform",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"types": "lib/exported.d.ts",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"!lib/**/*.map"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@oclif/core": "^1.16.
|
|
39
|
-
"@salesforce/core": "^3.30.
|
|
38
|
+
"@oclif/core": "^1.16.5",
|
|
39
|
+
"@salesforce/core": "^3.30.8",
|
|
40
40
|
"@salesforce/kit": "^1.6.1",
|
|
41
41
|
"@salesforce/schemas": "^1.2.0",
|
|
42
42
|
"@salesforce/source-deploy-retrieve": "^6.8.2",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"xml2js": "^0.4.23"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@salesforce/cli-plugins-testkit": "^2.
|
|
58
|
+
"@salesforce/cli-plugins-testkit": "^3.2.0",
|
|
59
59
|
"@salesforce/dev-config": "^3.0.1",
|
|
60
60
|
"@salesforce/dev-scripts": "^2.0.4",
|
|
61
61
|
"@salesforce/prettier-config": "^0.0.2",
|
|
62
|
-
"@salesforce/ts-sinon": "^1.
|
|
62
|
+
"@salesforce/ts-sinon": "^1.4.0",
|
|
63
63
|
"@types/debug": "4.1.7",
|
|
64
64
|
"@types/globby": "^9.1.0",
|
|
65
65
|
"@types/jszip": "^3.4.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"eslint-config-salesforce-typescript": "^0.2.8",
|
|
76
76
|
"eslint-plugin-header": "3.1.1",
|
|
77
77
|
"eslint-plugin-import": "^2.26.0",
|
|
78
|
-
"eslint-plugin-jsdoc": "^39.3.
|
|
78
|
+
"eslint-plugin-jsdoc": "^39.3.6",
|
|
79
79
|
"eslint-plugin-prettier": "^4.0.0",
|
|
80
80
|
"husky": "^8.0.1",
|
|
81
81
|
"mocha": "^10.0.0",
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"prettier": "^2.6.2",
|
|
84
84
|
"pretty-quick": "^3.1.3",
|
|
85
85
|
"shelljs": "0.8.5",
|
|
86
|
-
"sinon": "14.0.
|
|
86
|
+
"sinon": "14.0.1",
|
|
87
87
|
"ts-node": "^10.9.1",
|
|
88
|
-
"typescript": "4.8.
|
|
88
|
+
"typescript": "4.8.4"
|
|
89
89
|
},
|
|
90
90
|
"repository": "forcedotcom/packaging",
|
|
91
91
|
"publishConfig": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Connection } from '@salesforce/core';
|
|
2
|
-
import { Duration } from '@salesforce/kit';
|
|
3
|
-
import { Package1VersionCreateRequest, PackagingSObjects } from '../interfaces';
|
|
4
|
-
export declare function package1VersionCreate(connection: Connection, options: Package1VersionCreateRequest, pollingOptions?: {
|
|
5
|
-
frequency: Duration;
|
|
6
|
-
timeout: Duration;
|
|
7
|
-
}): Promise<PackagingSObjects.PackageUploadRequest>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.package1VersionCreate = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
6
|
-
* All rights reserved.
|
|
7
|
-
* Licensed under the BSD 3-Clause license.
|
|
8
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
-
*/
|
|
10
|
-
const os = require("os");
|
|
11
|
-
const core_1 = require("@salesforce/core");
|
|
12
|
-
const kit_1 = require("@salesforce/kit");
|
|
13
|
-
const interfaces_1 = require("../interfaces");
|
|
14
|
-
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
|
-
const messages = core_1.Messages.loadMessages('@salesforce/packaging', 'package1_version_create');
|
|
16
|
-
const packageUploadRequestStatus = async (id, connection, timeout, frequency) => {
|
|
17
|
-
const pollingResult = await connection.tooling.sobject('PackageUploadRequest').retrieve(id);
|
|
18
|
-
switch (pollingResult.Status) {
|
|
19
|
-
case 'SUCCESS':
|
|
20
|
-
return { completed: true, payload: pollingResult };
|
|
21
|
-
case 'IN_PROGRESS':
|
|
22
|
-
case 'QUEUED':
|
|
23
|
-
timeout -= frequency;
|
|
24
|
-
await core_1.Lifecycle.getInstance().emit(interfaces_1.Package1VersionEvents.create.progress, { timeout, pollingResult });
|
|
25
|
-
return { completed: false, payload: pollingResult };
|
|
26
|
-
default: {
|
|
27
|
-
if (pollingResult?.Errors?.errors?.length > 0) {
|
|
28
|
-
throw messages.createError('package1VersionCreateCommandUploadFailure', [
|
|
29
|
-
pollingResult.Errors.errors.map((e) => e.message).join(os.EOL),
|
|
30
|
-
]);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
throw messages.createError('package1VersionCreateCommandUploadFailureDefault');
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
async function package1VersionCreate(connection, options, pollingOptions = { frequency: kit_1.Duration.seconds(5), timeout: kit_1.Duration.seconds(0) }) {
|
|
39
|
-
const createRequest = await connection.tooling.sobject('PackageUploadRequest').create(options);
|
|
40
|
-
if (pollingOptions.timeout.seconds) {
|
|
41
|
-
const timeout = pollingOptions.timeout.seconds;
|
|
42
|
-
const pollingClient = await core_1.PollingClient.create({
|
|
43
|
-
poll: () => packageUploadRequestStatus(createRequest.id, connection, timeout, pollingOptions.frequency.seconds),
|
|
44
|
-
...pollingOptions,
|
|
45
|
-
});
|
|
46
|
-
return pollingClient.subscribe();
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
// jsforce templates weren't working when setting the type to PackageUploadRequest, so we have to cast `as unknown as PackagingSObjects.PackageUploadRequest`
|
|
50
|
-
return (await connection.tooling
|
|
51
|
-
.sobject('PackageUploadRequest')
|
|
52
|
-
.retrieve(createRequest.id));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.package1VersionCreate = package1VersionCreate;
|
|
56
|
-
//# sourceMappingURL=package1VersionCreate.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.package1VersionCreateGet = void 0;
|
|
10
|
-
async function package1VersionCreateGet(connection, id) {
|
|
11
|
-
return (await connection.tooling
|
|
12
|
-
.sobject('PackageUploadRequest')
|
|
13
|
-
.retrieve(id));
|
|
14
|
-
}
|
|
15
|
-
exports.package1VersionCreateGet = package1VersionCreateGet;
|
|
16
|
-
//# sourceMappingURL=package1VersionCreateGet.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Connection } from '@salesforce/core';
|
|
2
|
-
import { Package1Display } from '../interfaces';
|
|
3
|
-
/**
|
|
4
|
-
* Lists package versions available in dev org. If package ID is supplied, only list versions of that package,
|
|
5
|
-
* otherwise, list all package versions
|
|
6
|
-
*
|
|
7
|
-
* @param connection: sfdx-core Connection to the org
|
|
8
|
-
* @param metadataPackageId: optional, if present ID of package to list versions for (starts with 033)
|
|
9
|
-
* @returns Array of package version results
|
|
10
|
-
*/
|
|
11
|
-
export declare function package1VersionList(connection: Connection, metadataPackageId?: string): Promise<Package1Display[]>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.package1VersionList = void 0;
|
|
10
|
-
/**
|
|
11
|
-
* Lists package versions available in dev org. If package ID is supplied, only list versions of that package,
|
|
12
|
-
* otherwise, list all package versions
|
|
13
|
-
*
|
|
14
|
-
* @param connection: sfdx-core Connection to the org
|
|
15
|
-
* @param metadataPackageId: optional, if present ID of package to list versions for (starts with 033)
|
|
16
|
-
* @returns Array of package version results
|
|
17
|
-
*/
|
|
18
|
-
async function package1VersionList(connection, metadataPackageId) {
|
|
19
|
-
const query = `SELECT Id,MetadataPackageId,Name,ReleaseState,MajorVersion,MinorVersion,PatchVersion,BuildNumber FROM MetadataPackageVersion ${metadataPackageId ? `WHERE MetadataPackageId = '${metadataPackageId}'` : ''} ORDER BY MetadataPackageId, MajorVersion, MinorVersion, PatchVersion, BuildNumber`;
|
|
20
|
-
const queryResult = await connection.tooling.query(query);
|
|
21
|
-
return queryResult.records?.map((record) => ({
|
|
22
|
-
MetadataPackageVersionId: record.Id,
|
|
23
|
-
MetadataPackageId: record.MetadataPackageId,
|
|
24
|
-
Name: record.Name,
|
|
25
|
-
ReleaseState: record.ReleaseState,
|
|
26
|
-
Version: `${record.MajorVersion}.${record.MinorVersion}.${record.PatchVersion}`,
|
|
27
|
-
BuildNumber: record.BuildNumber,
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
exports.package1VersionList = package1VersionList;
|
|
31
|
-
//# sourceMappingURL=package1VersionList.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Connection } from '@salesforce/core';
|
|
2
|
-
import { Package1Display } from '../interfaces';
|
|
3
|
-
/**
|
|
4
|
-
* Executes server-side logic for the package1:display command
|
|
5
|
-
*
|
|
6
|
-
* @param connection
|
|
7
|
-
* @param id: id of the MetadataPackageVersion sObject
|
|
8
|
-
*/
|
|
9
|
-
export declare function package1Display(connection: Connection, id: string): Promise<Package1Display[]>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.package1Display = void 0;
|
|
10
|
-
/**
|
|
11
|
-
* Executes server-side logic for the package1:display command
|
|
12
|
-
*
|
|
13
|
-
* @param connection
|
|
14
|
-
* @param id: id of the MetadataPackageVersion sObject
|
|
15
|
-
*/
|
|
16
|
-
async function package1Display(connection, id) {
|
|
17
|
-
const query = `SELECT Id,MetadataPackageId,Name,ReleaseState,MajorVersion,MinorVersion,PatchVersion,BuildNumber FROM MetadataPackageVersion WHERE id = '${id}'`;
|
|
18
|
-
const results = (await connection.tooling.query(query)).records;
|
|
19
|
-
return results.map((result) => ({
|
|
20
|
-
MetadataPackageVersionId: result.Id,
|
|
21
|
-
MetadataPackageId: result.MetadataPackageId,
|
|
22
|
-
Name: result.Name,
|
|
23
|
-
ReleaseState: result.ReleaseState,
|
|
24
|
-
Version: `${result.MajorVersion}.${result.MinorVersion}.${result.PatchVersion}`,
|
|
25
|
-
BuildNumber: result.BuildNumber,
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
exports.package1Display = package1Display;
|
|
29
|
-
//# sourceMappingURL=packageDisplay.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AsyncCreatable } from '@salesforce/kit';
|
|
2
|
-
import { IPackageVersion1GP, PackageVersionOptions1GP } from '../interfaces';
|
|
3
|
-
/**
|
|
4
|
-
* Package1Version class - Class to be used with 1st generation package versions
|
|
5
|
-
*/
|
|
6
|
-
export declare class PackageVersion1GP extends AsyncCreatable<PackageVersionOptions1GP> implements IPackageVersion1GP {
|
|
7
|
-
private options;
|
|
8
|
-
constructor(options: PackageVersionOptions1GP);
|
|
9
|
-
convert(): Promise<void>;
|
|
10
|
-
create(): Promise<void>;
|
|
11
|
-
delete(): Promise<void>;
|
|
12
|
-
install(): Promise<void>;
|
|
13
|
-
list(): Promise<void>;
|
|
14
|
-
uninstall(): Promise<void>;
|
|
15
|
-
update(): Promise<void>;
|
|
16
|
-
protected init(): Promise<void>;
|
|
17
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PackageVersion1GP = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
6
|
-
* All rights reserved.
|
|
7
|
-
* Licensed under the BSD 3-Clause license.
|
|
8
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
-
*/
|
|
10
|
-
const kit_1 = require("@salesforce/kit");
|
|
11
|
-
/**
|
|
12
|
-
* Package1Version class - Class to be used with 1st generation package versions
|
|
13
|
-
*/
|
|
14
|
-
class PackageVersion1GP extends kit_1.AsyncCreatable {
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
constructor(options) {
|
|
17
|
-
super(options);
|
|
18
|
-
this.options = options;
|
|
19
|
-
}
|
|
20
|
-
convert() {
|
|
21
|
-
return Promise.resolve(undefined);
|
|
22
|
-
}
|
|
23
|
-
create() {
|
|
24
|
-
return Promise.resolve(undefined);
|
|
25
|
-
}
|
|
26
|
-
delete() {
|
|
27
|
-
return Promise.resolve(undefined);
|
|
28
|
-
}
|
|
29
|
-
install() {
|
|
30
|
-
return Promise.resolve(undefined);
|
|
31
|
-
}
|
|
32
|
-
list() {
|
|
33
|
-
return Promise.resolve(undefined);
|
|
34
|
-
}
|
|
35
|
-
uninstall() {
|
|
36
|
-
return Promise.resolve(undefined);
|
|
37
|
-
}
|
|
38
|
-
update() {
|
|
39
|
-
return Promise.resolve(undefined);
|
|
40
|
-
}
|
|
41
|
-
init() {
|
|
42
|
-
return Promise.resolve(undefined);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.PackageVersion1GP = PackageVersion1GP;
|
|
46
|
-
//# sourceMappingURL=packageVersion1GP.js.map
|