@salesforce/packaging 0.0.13 → 0.0.16
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 +25 -0
- package/lib/constants.d.ts +2 -0
- package/lib/constants.js +2 -0
- package/lib/interfaces/packagingInterfacesAndType.d.ts +24 -4
- package/lib/interfaces/packagingSObjects.d.ts +47 -14
- package/lib/package/index.d.ts +2 -0
- package/lib/package/index.js +4 -1
- package/lib/package/package.d.ts +26 -4
- package/lib/package/package.js +45 -4
- package/lib/package/packageInstall.d.ts +18 -0
- package/lib/package/packageInstall.js +222 -0
- package/lib/package/packageUninstall.d.ts +6 -0
- package/lib/package/packageUninstall.js +63 -0
- package/lib/utils/packageUtils.d.ts +3 -2
- package/lib/utils/packageUtils.js +5 -1
- package/lib/utils/srcDevUtils.d.ts +1 -2
- package/lib/utils/srcDevUtils.js +1 -2
- package/messages/messages.md +8 -0
- package/messages/package-install.md +28 -0
- package/messages/package.md +7 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
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.16](https://github.com/forcedotcom/packaging/compare/v0.0.15...v0.0.16) (2022-08-08)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- add method to uninstall package ([243f4e8](https://github.com/forcedotcom/packaging/commit/243f4e867d5b71a4a24afc70a8551f071dcbbc34))
|
|
10
|
+
|
|
11
|
+
### [0.0.15](https://github.com/forcedotcom/packaging/compare/v0.0.14...v0.0.15) (2022-08-08)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- better callCount expectation ([b009e67](https://github.com/forcedotcom/packaging/commit/b009e67445a6e00990fd19fbd048d87008ee49ab))
|
|
16
|
+
- better timeout number for test ([3240911](https://github.com/forcedotcom/packaging/commit/3240911ef5b58ea6179290de066471f9e87ebda5))
|
|
17
|
+
- higher polling timeout for windows ([e6ce60c](https://github.com/forcedotcom/packaging/commit/e6ce60c0583e0b5b92be5b9b86b78de7603dfa77))
|
|
18
|
+
- unit tests and type updates ([23d8648](https://github.com/forcedotcom/packaging/commit/23d8648f570f326873b6e1ff1149067aba07e015))
|
|
19
|
+
|
|
20
|
+
### [0.0.14](https://github.com/forcedotcom/packaging/compare/v0.0.13...v0.0.14) (2022-08-05)
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
- adds package install ([97a821a](https://github.com/forcedotcom/packaging/commit/97a821af4e427b413e59c55143d5f17df0513dcc))
|
|
25
|
+
- adds some package install code ([f2fff8e](https://github.com/forcedotcom/packaging/commit/f2fff8e52a498c70230575b1ace3a6f303168ad4))
|
|
26
|
+
- enable install NUTs ([105250b](https://github.com/forcedotcom/packaging/commit/105250bbabe0185c04dab9cff2c9d17be4dd488f))
|
|
27
|
+
- export getStatus and add validateId function ([8a97c4a](https://github.com/forcedotcom/packaging/commit/8a97c4ac2a58ad7992f0d37f74fcf4662f754793))
|
|
28
|
+
- use install key ([457d777](https://github.com/forcedotcom/packaging/commit/457d7779f3e646f71b5faf1adc913094c524b74a))
|
|
29
|
+
|
|
5
30
|
### [0.0.13](https://github.com/forcedotcom/packaging/compare/v0.0.12...v0.0.13) (2022-08-05)
|
|
6
31
|
|
|
7
32
|
### Bug Fixes
|
package/lib/constants.d.ts
CHANGED
package/lib/constants.js
CHANGED
|
@@ -36,5 +36,7 @@ exports.consts = {
|
|
|
36
36
|
// tokens to be replaced on source:push
|
|
37
37
|
INSTANCE_URL_TOKEN: '__SFDX_INSTANCE_URL__',
|
|
38
38
|
PACKAGE2_DESCRIPTOR_FILE: 'package2-descriptor.json',
|
|
39
|
+
PACKAGE_INSTALL_POLL_FREQUENCY: 5000,
|
|
40
|
+
PACKAGE_INSTALL_POLL_TIMEOUT: 5, // 5 minutes
|
|
39
41
|
};
|
|
40
42
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { Duration } from '@salesforce/kit';
|
|
2
2
|
import { Connection, SfProject } from '@salesforce/core';
|
|
3
|
-
import { SaveResult } from 'jsforce';
|
|
3
|
+
import { QueryResult, SaveResult } from 'jsforce';
|
|
4
4
|
import { PackageProfileApi } from '../package/packageProfileApi';
|
|
5
5
|
import { PackagingSObjects } from './packagingSObjects';
|
|
6
6
|
import Package2VersionStatus = PackagingSObjects.Package2VersionStatus;
|
|
7
|
+
import PackageInstallRequest = PackagingSObjects.PackageInstallRequest;
|
|
7
8
|
export interface IPackage {
|
|
8
9
|
create(): Promise<void>;
|
|
9
10
|
convert(): Promise<void>;
|
|
10
11
|
delete(): Promise<void>;
|
|
11
|
-
install(): Promise<
|
|
12
|
-
|
|
12
|
+
install(pkgInstallCreateRequest: PackageInstallCreateRequest, options?: PackageInstallOptions): Promise<PackageInstallRequest>;
|
|
13
|
+
getInstallStatus(installRequestId: string): Promise<PackageInstallRequest>;
|
|
14
|
+
list(): Promise<QueryResult<PackagingSObjects.Package2>>;
|
|
13
15
|
uninstall(): Promise<void>;
|
|
14
16
|
update(): Promise<void>;
|
|
17
|
+
waitForPublish(subscriberPackageVersionKey: string, timeout: number | Duration, installationKey?: string): any;
|
|
18
|
+
getExternalSites(subscriberPackageVersionKey: string, installationKey?: string): any;
|
|
15
19
|
}
|
|
16
20
|
export interface IPackageVersion1GP {
|
|
17
21
|
create(): Promise<void>;
|
|
@@ -31,7 +35,10 @@ export interface IPackageVersion2GP {
|
|
|
31
35
|
uninstall(): Promise<void>;
|
|
32
36
|
update(): Promise<void>;
|
|
33
37
|
}
|
|
34
|
-
export declare type PackageOptions =
|
|
38
|
+
export declare type PackageOptions = {
|
|
39
|
+
connection: Connection;
|
|
40
|
+
};
|
|
41
|
+
export declare type PackageIdType = 'PackageId' | 'SubscriberPackageVersionId' | 'PackageInstallRequestId' | 'PackageUninstallRequestId';
|
|
35
42
|
export declare type PackageVersionOptions1GP = Record<string, unknown>;
|
|
36
43
|
export declare type PackageVersionCreateRequestResult = {
|
|
37
44
|
Id: string;
|
|
@@ -92,6 +99,7 @@ export declare type PackageVersionListResult = {
|
|
|
92
99
|
BuildDurationInSeconds?: number;
|
|
93
100
|
HasMetadataRemoved?: boolean;
|
|
94
101
|
};
|
|
102
|
+
export declare type PackageInstallCreateRequest = Partial<Pick<PackageInstallRequest, 'ApexCompileType' | 'EnableRss' | 'NameConflictResolution' | 'PackageInstallSource' | 'Password' | 'SecurityType' | 'UpgradeType'>> & Pick<PackagingSObjects.PackageInstallRequest, 'SubscriberPackageVersionKey'>;
|
|
95
103
|
export declare type Package1Display = {
|
|
96
104
|
MetadataPackageVersionId: string;
|
|
97
105
|
MetadataPackageId: string;
|
|
@@ -130,6 +138,18 @@ export declare type PackageVersionCreateRequestOptions = {
|
|
|
130
138
|
branch?: string;
|
|
131
139
|
skipancestorcheck?: boolean;
|
|
132
140
|
};
|
|
141
|
+
export declare type PackageInstallOptions = {
|
|
142
|
+
/**
|
|
143
|
+
* The frequency to poll the org for package installation status. If providing a number
|
|
144
|
+
* it is interpreted in milliseconds.
|
|
145
|
+
*/
|
|
146
|
+
pollingFrequency?: number | Duration;
|
|
147
|
+
/**
|
|
148
|
+
* The amount of time to wait for package installation to complete. If providing a number
|
|
149
|
+
* it is interpreted in minutes.
|
|
150
|
+
*/
|
|
151
|
+
pollingTimeout?: number | Duration;
|
|
152
|
+
};
|
|
133
153
|
export declare type MDFolderForArtifactOptions = {
|
|
134
154
|
packageName?: string;
|
|
135
155
|
sourceDir?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Nullable } from '@salesforce/ts-types';
|
|
1
2
|
import { PackageType } from './packagingInterfacesAndType';
|
|
2
3
|
export declare namespace PackagingSObjects {
|
|
3
4
|
type Package2 = {
|
|
@@ -118,6 +119,20 @@ export declare namespace PackagingSObjects {
|
|
|
118
119
|
type SubscriberPackageDependencies = {
|
|
119
120
|
ids: string[];
|
|
120
121
|
};
|
|
122
|
+
type SubscriberPackageRemoteSiteSetting = {
|
|
123
|
+
secure: boolean;
|
|
124
|
+
url: string;
|
|
125
|
+
};
|
|
126
|
+
type SubscriberPackageRemoteSiteSettings = {
|
|
127
|
+
settings: SubscriberPackageRemoteSiteSetting[];
|
|
128
|
+
};
|
|
129
|
+
type SubscriberPackageCspTrustedSite = {
|
|
130
|
+
endpointUrl: string;
|
|
131
|
+
};
|
|
132
|
+
type SubscriberPackageCspTrustedSites = {
|
|
133
|
+
settings: SubscriberPackageCspTrustedSite[];
|
|
134
|
+
};
|
|
135
|
+
type InstallValidationStatus = 'NO_ERRORS_DETECTED' | 'BETA_INSTALL_INTO_PRODUCTION_ORG' | 'CANNOT_INSTALL_EARLIER_VERSION' | 'CANNOT_UPGRADE_BETA' | 'CANNOT_UPGRADE_UNMANAGED' | 'DEPRECATED_INSTALL_PACKAGE' | 'EXTENSIONS_ON_LOCAL_PACKAGES' | 'PACKAGE_NOT_INSTALLED' | 'PACKAGE_HAS_IN_DEV_EXTENSIONS' | 'INSTALL_INTO_DEV_ORG' | 'NO_ACCESS' | 'PACKAGING_DISABLED' | 'PACKAGING_NO_ACCESS' | 'PACKAGE_UNAVAILABLE' | 'UNINSTALL_IN_PROGRESS' | 'UNKNOWN_ERROR' | 'NAMESPACE_COLLISION';
|
|
121
136
|
type SubscriberPackageVersion = {
|
|
122
137
|
Id: string;
|
|
123
138
|
SubscriberPackageId: string;
|
|
@@ -142,11 +157,11 @@ export declare namespace PackagingSObjects {
|
|
|
142
157
|
AppExchangeLogoUrl: string;
|
|
143
158
|
ReleaseNotesUrl: string;
|
|
144
159
|
PostInstallUrl: string;
|
|
145
|
-
RemoteSiteSettings:
|
|
146
|
-
CspTrustedSites:
|
|
160
|
+
RemoteSiteSettings: SubscriberPackageRemoteSiteSettings;
|
|
161
|
+
CspTrustedSites: SubscriberPackageCspTrustedSites;
|
|
147
162
|
Profiles: SubscriberPackageProfiles;
|
|
148
163
|
Dependencies: SubscriberPackageDependencies;
|
|
149
|
-
InstallValidationStatus:
|
|
164
|
+
InstallValidationStatus: InstallValidationStatus;
|
|
150
165
|
};
|
|
151
166
|
type SubscriberPackageVersionUninstallRequest = {
|
|
152
167
|
Id: string;
|
|
@@ -170,25 +185,43 @@ export declare namespace PackagingSObjects {
|
|
|
170
185
|
SubscriberPackageVersionId: string;
|
|
171
186
|
Status: string;
|
|
172
187
|
};
|
|
188
|
+
type SubscriberPackageInstallError = {
|
|
189
|
+
message: string;
|
|
190
|
+
};
|
|
191
|
+
type SubscriberPackageInstallErrors = {
|
|
192
|
+
errors: SubscriberPackageInstallError[];
|
|
193
|
+
};
|
|
194
|
+
type SubscriberPackageProfileMapping = {
|
|
195
|
+
source: string;
|
|
196
|
+
target: string;
|
|
197
|
+
};
|
|
198
|
+
type SubscriberPackageProfileMappings = {
|
|
199
|
+
profileMappings: SubscriberPackageProfileMapping[];
|
|
200
|
+
};
|
|
201
|
+
type Attributes = {
|
|
202
|
+
type: string;
|
|
203
|
+
url: string;
|
|
204
|
+
};
|
|
173
205
|
type PackageInstallRequest = {
|
|
206
|
+
attributes: Attributes;
|
|
174
207
|
Id: string;
|
|
175
208
|
IsDeleted: boolean;
|
|
176
|
-
CreatedDate:
|
|
209
|
+
CreatedDate: string;
|
|
177
210
|
CreatedById: string;
|
|
178
|
-
LastModifiedDate:
|
|
211
|
+
LastModifiedDate: string;
|
|
179
212
|
LastModifiedById: string;
|
|
180
|
-
SystemModstamp:
|
|
213
|
+
SystemModstamp: string;
|
|
181
214
|
SubscriberPackageVersionKey: string;
|
|
182
|
-
NameConflictResolution:
|
|
183
|
-
SecurityType:
|
|
215
|
+
NameConflictResolution: 'Block' | 'RenameMetadata';
|
|
216
|
+
SecurityType: 'Custom' | 'Full' | 'None';
|
|
184
217
|
PackageInstallSource: string;
|
|
185
|
-
ProfileMappings:
|
|
186
|
-
Password: string
|
|
218
|
+
ProfileMappings: Nullable<SubscriberPackageProfileMappings>;
|
|
219
|
+
Password: Nullable<string>;
|
|
187
220
|
EnableRss: boolean;
|
|
188
|
-
UpgradeType:
|
|
189
|
-
ApexCompileType:
|
|
190
|
-
Status:
|
|
191
|
-
Errors:
|
|
221
|
+
UpgradeType: Nullable<'delete-only' | 'deprecate-only' | 'mixed-mode'>;
|
|
222
|
+
ApexCompileType: Nullable<'all' | 'package'>;
|
|
223
|
+
Status: 'ERROR' | 'IN_PROGRESS' | 'SUCCESS' | 'UNKNOWN';
|
|
224
|
+
Errors: Nullable<SubscriberPackageInstallErrors>;
|
|
192
225
|
};
|
|
193
226
|
type PackageUploadRequest = {
|
|
194
227
|
Id: string;
|
package/lib/package/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './package';
|
|
2
|
+
export * from './packageInstall';
|
|
2
3
|
export * from './packageVersion';
|
|
3
4
|
export * from './packageList';
|
|
4
5
|
export * from './packageVersionCreateRequest';
|
|
5
6
|
export { listPackageVersions } from './packageVersionList';
|
|
6
7
|
export { createPackage } from './packageCreate';
|
|
7
8
|
export { deletePackage } from './packageDelete';
|
|
9
|
+
export { uninstallPackage } from './packageUninstall';
|
package/lib/package/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.deletePackage = exports.createPackage = exports.listPackageVersions = void 0;
|
|
17
|
+
exports.uninstallPackage = exports.deletePackage = exports.createPackage = exports.listPackageVersions = void 0;
|
|
18
18
|
/*
|
|
19
19
|
* Copyright (c) 2022, salesforce.com, inc.
|
|
20
20
|
* All rights reserved.
|
|
@@ -22,6 +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("./packageInstall"), exports);
|
|
25
26
|
__exportStar(require("./packageVersion"), exports);
|
|
26
27
|
__exportStar(require("./packageList"), exports);
|
|
27
28
|
__exportStar(require("./packageVersionCreateRequest"), exports);
|
|
@@ -31,4 +32,6 @@ var packageCreate_1 = require("./packageCreate");
|
|
|
31
32
|
Object.defineProperty(exports, "createPackage", { enumerable: true, get: function () { return packageCreate_1.createPackage; } });
|
|
32
33
|
var packageDelete_1 = require("./packageDelete");
|
|
33
34
|
Object.defineProperty(exports, "deletePackage", { enumerable: true, get: function () { return packageDelete_1.deletePackage; } });
|
|
35
|
+
var packageUninstall_1 = require("./packageUninstall");
|
|
36
|
+
Object.defineProperty(exports, "uninstallPackage", { enumerable: true, get: function () { return packageUninstall_1.uninstallPackage; } });
|
|
34
37
|
//# sourceMappingURL=index.js.map
|
package/lib/package/package.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { AsyncCreatable } from '@salesforce/kit';
|
|
2
|
-
import {
|
|
1
|
+
import { AsyncCreatable, Duration } from '@salesforce/kit';
|
|
2
|
+
import { QueryResult } from 'jsforce';
|
|
3
|
+
import { Optional } from '@salesforce/ts-types';
|
|
4
|
+
import { IPackage, PackageOptions, PackagingSObjects } from '../interfaces';
|
|
5
|
+
import { PackageInstallOptions, PackageInstallCreateRequest, PackageIdType } from '../interfaces/packagingInterfacesAndType';
|
|
6
|
+
declare type PackageInstallRequest = PackagingSObjects.PackageInstallRequest;
|
|
3
7
|
/**
|
|
4
8
|
* Package class.
|
|
5
9
|
*
|
|
@@ -8,12 +12,30 @@ import { IPackage, PackageOptions } from '../interfaces';
|
|
|
8
12
|
export declare class Package extends AsyncCreatable<PackageOptions> implements IPackage {
|
|
9
13
|
private options;
|
|
10
14
|
constructor(options: PackageOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Given a Salesforce ID for a package resource and the type of resource,
|
|
17
|
+
* ensures the ID is valid.
|
|
18
|
+
*
|
|
19
|
+
* Valid ID types and prefixes for packaging resources:
|
|
20
|
+
* 1. package ID (0Ho)
|
|
21
|
+
* 2. subscriber package version ID (04t)
|
|
22
|
+
* 3. package install request ID (0Hf)
|
|
23
|
+
* 4. package uninstall request ID (06y)
|
|
24
|
+
*
|
|
25
|
+
* @param id Salesforce ID for a specific package resource
|
|
26
|
+
* @param type The type of package ID
|
|
27
|
+
*/
|
|
28
|
+
static validateId(id: string, type: PackageIdType): void;
|
|
11
29
|
convert(): Promise<void>;
|
|
12
30
|
create(): Promise<void>;
|
|
13
31
|
delete(): Promise<void>;
|
|
14
|
-
install(): Promise<
|
|
15
|
-
|
|
32
|
+
install(pkgInstallCreateRequest: PackageInstallCreateRequest, options?: PackageInstallOptions): Promise<PackageInstallRequest>;
|
|
33
|
+
getInstallStatus(installRequestId: string): Promise<PackageInstallRequest>;
|
|
34
|
+
list(): Promise<QueryResult<PackagingSObjects.Package2>>;
|
|
16
35
|
uninstall(): Promise<void>;
|
|
17
36
|
update(): Promise<void>;
|
|
37
|
+
getExternalSites(subscriberPackageVersionId: string, installationKey?: string): Promise<Optional<string[]>>;
|
|
38
|
+
waitForPublish(subscriberPackageVersionId: string, timeout: number | Duration, installationKey?: string): Promise<void>;
|
|
18
39
|
protected init(): Promise<void>;
|
|
19
40
|
}
|
|
41
|
+
export {};
|
package/lib/package/package.js
CHANGED
|
@@ -7,18 +7,50 @@ exports.Package = void 0;
|
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
9
|
*/
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
10
11
|
const kit_1 = require("@salesforce/kit");
|
|
12
|
+
const packageList_1 = require("./packageList");
|
|
13
|
+
const packageInstall_1 = require("./packageInstall");
|
|
14
|
+
const packagePrefixes = {
|
|
15
|
+
PackageId: '0Ho',
|
|
16
|
+
SubscriberPackageVersionId: '04t',
|
|
17
|
+
PackageInstallRequestId: '0Hf',
|
|
18
|
+
PackageUninstallRequestId: '06y',
|
|
19
|
+
};
|
|
20
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
21
|
+
const messages = core_1.Messages.loadMessages('@salesforce/packaging', 'package');
|
|
11
22
|
/**
|
|
12
23
|
* Package class.
|
|
13
24
|
*
|
|
14
25
|
* This class provides the base implementation for a package.
|
|
15
26
|
*/
|
|
16
27
|
class Package extends kit_1.AsyncCreatable {
|
|
17
|
-
// @ts-ignore
|
|
18
28
|
constructor(options) {
|
|
19
29
|
super(options);
|
|
20
30
|
this.options = options;
|
|
21
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Given a Salesforce ID for a package resource and the type of resource,
|
|
34
|
+
* ensures the ID is valid.
|
|
35
|
+
*
|
|
36
|
+
* Valid ID types and prefixes for packaging resources:
|
|
37
|
+
* 1. package ID (0Ho)
|
|
38
|
+
* 2. subscriber package version ID (04t)
|
|
39
|
+
* 3. package install request ID (0Hf)
|
|
40
|
+
* 4. package uninstall request ID (06y)
|
|
41
|
+
*
|
|
42
|
+
* @param id Salesforce ID for a specific package resource
|
|
43
|
+
* @param type The type of package ID
|
|
44
|
+
*/
|
|
45
|
+
static validateId(id, type) {
|
|
46
|
+
const prefix = packagePrefixes[type];
|
|
47
|
+
if (!id.startsWith(prefix)) {
|
|
48
|
+
throw messages.createError('invalidPackageId', [type, id, prefix]);
|
|
49
|
+
}
|
|
50
|
+
if (!core_1.sfdc.validateSalesforceId(id)) {
|
|
51
|
+
throw messages.createError('invalidIdLength', [type, id]);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
22
54
|
convert() {
|
|
23
55
|
return Promise.resolve(undefined);
|
|
24
56
|
}
|
|
@@ -28,11 +60,14 @@ class Package extends kit_1.AsyncCreatable {
|
|
|
28
60
|
delete() {
|
|
29
61
|
return Promise.resolve(undefined);
|
|
30
62
|
}
|
|
31
|
-
install() {
|
|
32
|
-
return
|
|
63
|
+
async install(pkgInstallCreateRequest, options) {
|
|
64
|
+
return (0, packageInstall_1.installPackage)(this.options.connection, pkgInstallCreateRequest, options);
|
|
65
|
+
}
|
|
66
|
+
async getInstallStatus(installRequestId) {
|
|
67
|
+
return (0, packageInstall_1.getStatus)(this.options.connection, installRequestId);
|
|
33
68
|
}
|
|
34
69
|
list() {
|
|
35
|
-
return
|
|
70
|
+
return (0, packageList_1.listPackages)(this.options.connection);
|
|
36
71
|
}
|
|
37
72
|
uninstall() {
|
|
38
73
|
return Promise.resolve(undefined);
|
|
@@ -40,6 +75,12 @@ class Package extends kit_1.AsyncCreatable {
|
|
|
40
75
|
update() {
|
|
41
76
|
return Promise.resolve(undefined);
|
|
42
77
|
}
|
|
78
|
+
async getExternalSites(subscriberPackageVersionId, installationKey) {
|
|
79
|
+
return (0, packageInstall_1.getExternalSites)(this.options.connection, subscriberPackageVersionId, installationKey);
|
|
80
|
+
}
|
|
81
|
+
async waitForPublish(subscriberPackageVersionId, timeout, installationKey) {
|
|
82
|
+
return (0, packageInstall_1.waitForPublish)(this.options.connection, subscriberPackageVersionId, timeout, installationKey);
|
|
83
|
+
}
|
|
43
84
|
init() {
|
|
44
85
|
return Promise.resolve(undefined);
|
|
45
86
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
import { Optional } from '@salesforce/ts-types';
|
|
3
|
+
import { Duration } from '@salesforce/kit';
|
|
4
|
+
import { PackagingSObjects } from '../interfaces';
|
|
5
|
+
import { PackageInstallOptions, PackageInstallCreateRequest } from '../interfaces/packagingInterfacesAndType';
|
|
6
|
+
import PackageInstallRequest = PackagingSObjects.PackageInstallRequest;
|
|
7
|
+
export declare function installPackage(connection: Connection, pkgInstallCreateRequest: PackageInstallCreateRequest, options?: PackageInstallOptions): Promise<PackageInstallRequest>;
|
|
8
|
+
/**
|
|
9
|
+
* Returns an array of RSS and CSP external sites for the package.
|
|
10
|
+
*
|
|
11
|
+
* @param connection The `Connection` object to the org.
|
|
12
|
+
* @param subscriberPackageVersionId The ID of the subscriber package version (begins with "04t")
|
|
13
|
+
* @param installationKey The installation key (if any) for the subscriber package version.
|
|
14
|
+
* @returns an array of RSS and CSP site URLs, or undefined if the package doesn't have any.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getExternalSites(connection: Connection, subscriberPackageVersionId: string, installationKey?: string): Promise<Optional<string[]>>;
|
|
17
|
+
export declare function getStatus(connection: Connection, installRequestId: string): Promise<PackageInstallRequest>;
|
|
18
|
+
export declare function waitForPublish(connection: Connection, subscriberPackageVersionId: string, timeout: number | Duration, installationKey?: string): Promise<void>;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, 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.waitForPublish = exports.getStatus = exports.getExternalSites = exports.installPackage = void 0;
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
|
+
const kit_1 = require("@salesforce/kit");
|
|
13
|
+
const packageUtils_1 = require("../utils/packageUtils");
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
16
|
+
const installMsgs = core_1.Messages.loadMessages('@salesforce/packaging', 'package-install');
|
|
17
|
+
let logger;
|
|
18
|
+
const getLogger = () => {
|
|
19
|
+
if (!logger) {
|
|
20
|
+
logger = core_1.Logger.childFromRoot('installPackage');
|
|
21
|
+
}
|
|
22
|
+
return logger;
|
|
23
|
+
};
|
|
24
|
+
async function installPackage(connection, pkgInstallCreateRequest, options) {
|
|
25
|
+
const defaults = {
|
|
26
|
+
ApexCompileType: 'all',
|
|
27
|
+
EnableRss: false,
|
|
28
|
+
NameConflictResolution: 'Block',
|
|
29
|
+
PackageInstallSource: 'U',
|
|
30
|
+
SecurityType: 'None',
|
|
31
|
+
UpgradeType: 'mixed-mode',
|
|
32
|
+
};
|
|
33
|
+
const request = Object.assign({}, defaults, pkgInstallCreateRequest);
|
|
34
|
+
if (request.Password) {
|
|
35
|
+
request.Password = (0, packageUtils_1.escapeInstallationKey)(request.Password);
|
|
36
|
+
}
|
|
37
|
+
const pkgType = await (0, packageUtils_1.getPackageTypeBy04t)(request.SubscriberPackageVersionKey, connection, request.Password);
|
|
38
|
+
// Only unlocked packages can change the UpgradeType and ApexCompile options from the defaults.
|
|
39
|
+
if (pkgType !== 'Unlocked') {
|
|
40
|
+
if (request.UpgradeType !== defaults.UpgradeType) {
|
|
41
|
+
const msg = installMsgs.getMessage('upgradeTypeOnlyForUnlockedWarning');
|
|
42
|
+
await core_1.Lifecycle.getInstance().emit('PackageInstallRequest:warning', msg);
|
|
43
|
+
delete request.UpgradeType;
|
|
44
|
+
}
|
|
45
|
+
if (request.ApexCompileType !== defaults.ApexCompileType) {
|
|
46
|
+
const msg = installMsgs.getMessage('apexCompileOnlyForUnlockedWarning');
|
|
47
|
+
await core_1.Lifecycle.getInstance().emit('PackageInstallRequest:warning', msg);
|
|
48
|
+
delete request.ApexCompileType;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
await core_1.Lifecycle.getInstance().emit('PackageInstallRequest:presend', request);
|
|
52
|
+
const result = await connection.tooling.create('PackageInstallRequest', request);
|
|
53
|
+
await core_1.Lifecycle.getInstance().emit('PackageInstallRequest:postsend', result);
|
|
54
|
+
const packageInstallRequestId = result.id;
|
|
55
|
+
if (!packageInstallRequestId) {
|
|
56
|
+
throw installMsgs.createError('packageInstallRequestError', [
|
|
57
|
+
request.SubscriberPackageVersionKey,
|
|
58
|
+
result.errors.toString(),
|
|
59
|
+
]);
|
|
60
|
+
}
|
|
61
|
+
if (options?.pollingTimeout == null) {
|
|
62
|
+
return getStatus(connection, packageInstallRequestId);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return pollStatus(connection, packageInstallRequestId, options);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.installPackage = installPackage;
|
|
69
|
+
/**
|
|
70
|
+
* Returns an array of RSS and CSP external sites for the package.
|
|
71
|
+
*
|
|
72
|
+
* @param connection The `Connection` object to the org.
|
|
73
|
+
* @param subscriberPackageVersionId The ID of the subscriber package version (begins with "04t")
|
|
74
|
+
* @param installationKey The installation key (if any) for the subscriber package version.
|
|
75
|
+
* @returns an array of RSS and CSP site URLs, or undefined if the package doesn't have any.
|
|
76
|
+
*/
|
|
77
|
+
async function getExternalSites(connection, subscriberPackageVersionId, installationKey) {
|
|
78
|
+
const queryNoKey = `SELECT RemoteSiteSettings, CspTrustedSites FROM SubscriberPackageVersion WHERE Id ='${subscriberPackageVersionId}'`;
|
|
79
|
+
let queryResult;
|
|
80
|
+
try {
|
|
81
|
+
const escapedInstallationKey = installationKey ? (0, packageUtils_1.escapeInstallationKey)(installationKey) : null;
|
|
82
|
+
const queryWithKey = `${queryNoKey} AND InstallationKey ='${escapedInstallationKey}'`;
|
|
83
|
+
getLogger().debug(`Checking package: [${subscriberPackageVersionId}] for external sites`);
|
|
84
|
+
queryResult = await connection.tooling.query(queryWithKey);
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
// First check for Implementation Restriction error that is enforced in 214, before it was possible to query
|
|
88
|
+
// against InstallationKey, otherwise surface the error.
|
|
89
|
+
if (e instanceof Error && (0, packageUtils_1.isErrorFromSPVQueryRestriction)(e)) {
|
|
90
|
+
queryResult = await connection.tooling.query(queryNoKey);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
throw e;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (queryResult?.records?.length > 0) {
|
|
97
|
+
const record = queryResult.records[0];
|
|
98
|
+
const rssUrls = record.RemoteSiteSettings.settings.map((rss) => rss.url);
|
|
99
|
+
const cspUrls = record.CspTrustedSites.settings.map((csp) => csp.endpointUrl);
|
|
100
|
+
const sites = [...rssUrls, ...cspUrls];
|
|
101
|
+
if (sites.length) {
|
|
102
|
+
return sites;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.getExternalSites = getExternalSites;
|
|
107
|
+
async function getStatus(connection, installRequestId) {
|
|
108
|
+
const result = await connection.tooling.retrieve('PackageInstallRequest', installRequestId);
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
exports.getStatus = getStatus;
|
|
112
|
+
// internal
|
|
113
|
+
async function pollStatus(connection, installRequestId, options) {
|
|
114
|
+
let packageInstallRequest;
|
|
115
|
+
const { pollingFrequency, pollingTimeout } = options;
|
|
116
|
+
let frequency;
|
|
117
|
+
if (pollingFrequency != null) {
|
|
118
|
+
frequency = (0, ts_types_1.isNumber)(pollingFrequency) ? kit_1.Duration.milliseconds(pollingFrequency) : pollingFrequency;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
frequency = kit_1.Duration.milliseconds(constants_1.consts.PACKAGE_INSTALL_POLL_FREQUENCY);
|
|
122
|
+
}
|
|
123
|
+
let timeout;
|
|
124
|
+
if (pollingTimeout != null) {
|
|
125
|
+
timeout = (0, ts_types_1.isNumber)(pollingTimeout) ? kit_1.Duration.minutes(pollingTimeout) : pollingTimeout;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
timeout = kit_1.Duration.minutes(constants_1.consts.PACKAGE_INSTALL_POLL_TIMEOUT);
|
|
129
|
+
}
|
|
130
|
+
const pollingOptions = {
|
|
131
|
+
frequency,
|
|
132
|
+
timeout,
|
|
133
|
+
poll: async () => {
|
|
134
|
+
packageInstallRequest = await getStatus(connection, installRequestId);
|
|
135
|
+
getLogger().debug(installMsgs.getMessage('packageInstallPolling', [packageInstallRequest?.Status]));
|
|
136
|
+
await core_1.Lifecycle.getInstance().emit('PackageInstallRequest:status', packageInstallRequest);
|
|
137
|
+
if (['SUCCESS', 'ERROR'].includes(packageInstallRequest?.Status)) {
|
|
138
|
+
return { completed: true, payload: packageInstallRequest };
|
|
139
|
+
}
|
|
140
|
+
return { completed: false };
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
const pollingClient = await core_1.PollingClient.create(pollingOptions);
|
|
144
|
+
try {
|
|
145
|
+
getLogger().debug(`Polling for PackageInstallRequest status. Package ID = ${installRequestId}`);
|
|
146
|
+
getLogger().debug(`Polling frequency (ms): ${pollingOptions.frequency.milliseconds}`);
|
|
147
|
+
getLogger().debug(`Polling timeout (min): ${pollingOptions.timeout.minutes}`);
|
|
148
|
+
await pollingClient.subscribe();
|
|
149
|
+
return packageInstallRequest;
|
|
150
|
+
}
|
|
151
|
+
catch (e) {
|
|
152
|
+
const errMsg = e instanceof Error ? e.message : (0, ts_types_1.isString)(e) ? e : 'polling timed out';
|
|
153
|
+
const error = new core_1.SfError(errMsg, 'PackageInstallTimeout');
|
|
154
|
+
error.setData(packageInstallRequest);
|
|
155
|
+
if (error.stack && e.stack) {
|
|
156
|
+
// add the original stack to this new error
|
|
157
|
+
error.stack += `\nDUE TO:\n${e.stack}`;
|
|
158
|
+
}
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async function waitForPublish(connection, subscriberPackageVersionId, timeout, installationKey) {
|
|
163
|
+
let queryResult;
|
|
164
|
+
const pollingOptions = {
|
|
165
|
+
frequency: kit_1.Duration.milliseconds(constants_1.consts.PACKAGE_INSTALL_POLL_FREQUENCY),
|
|
166
|
+
timeout: (0, ts_types_1.isNumber)(timeout) ? kit_1.Duration.minutes(timeout) : timeout,
|
|
167
|
+
poll: async () => {
|
|
168
|
+
const QUERY_NO_KEY = `SELECT Id, SubscriberPackageId, InstallValidationStatus FROM SubscriberPackageVersion WHERE Id ='${subscriberPackageVersionId}'`;
|
|
169
|
+
try {
|
|
170
|
+
const escapedInstallationKey = installationKey ? (0, packageUtils_1.escapeInstallationKey)(installationKey) : null;
|
|
171
|
+
const queryWithKey = `${QUERY_NO_KEY} AND InstallationKey ='${escapedInstallationKey}'`;
|
|
172
|
+
queryResult = await connection.tooling.query(queryWithKey);
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
// Check first for Implementation Restriction error that is enforced in 214, before it was possible to query
|
|
176
|
+
// against InstallationKey, otherwise surface the error.
|
|
177
|
+
if (e instanceof Error && (0, packageUtils_1.isErrorFromSPVQueryRestriction)(e)) {
|
|
178
|
+
queryResult = await connection.tooling.query(QUERY_NO_KEY);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
if (e instanceof Error && !(0, packageUtils_1.isErrorPackageNotAvailable)(e)) {
|
|
182
|
+
throw e;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Continue retrying if there is no record
|
|
187
|
+
// or for an InstallValidationStatus of PACKAGE_UNAVAILABLE (replication to the subscriber's instance has not completed)
|
|
188
|
+
// or for an InstallValidationStatus of UNINSTALL_IN_PROGRESS
|
|
189
|
+
let installValidationStatus;
|
|
190
|
+
if (queryResult?.records?.length) {
|
|
191
|
+
installValidationStatus = queryResult.records[0].InstallValidationStatus;
|
|
192
|
+
await core_1.Lifecycle.getInstance().emit('SubscriberPackageVersion:status', installValidationStatus);
|
|
193
|
+
if (!['PACKAGE_UNAVAILABLE', 'UNINSTALL_IN_PROGRESS'].includes(installValidationStatus)) {
|
|
194
|
+
return { completed: true, payload: queryResult };
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const tokens = installValidationStatus ? [` Status = ${installValidationStatus}`] : [];
|
|
198
|
+
getLogger().debug(installMsgs.getMessage('publishWaitProgress', tokens));
|
|
199
|
+
await core_1.Lifecycle.getInstance().emit('SubscriberPackageVersion:status', installValidationStatus);
|
|
200
|
+
return { completed: false, payload: queryResult };
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
const pollingClient = await core_1.PollingClient.create(pollingOptions);
|
|
204
|
+
try {
|
|
205
|
+
getLogger().debug(`Polling for package availability in org. Package ID = ${subscriberPackageVersionId}`);
|
|
206
|
+
getLogger().debug(`Polling frequency (ms): ${pollingOptions.frequency.milliseconds}`);
|
|
207
|
+
getLogger().debug(`Polling timeout (min): ${pollingOptions.timeout.minutes}`);
|
|
208
|
+
await pollingClient.subscribe();
|
|
209
|
+
}
|
|
210
|
+
catch (e) {
|
|
211
|
+
// if polling timed out
|
|
212
|
+
const error = installMsgs.createError('subscriberPackageVersionNotPublished');
|
|
213
|
+
error.setData(queryResult);
|
|
214
|
+
if (error.stack && e.stack) {
|
|
215
|
+
// append the original stack to this new error
|
|
216
|
+
error.stack += `\nDUE TO:\n${e.stack}`;
|
|
217
|
+
}
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.waitForPublish = waitForPublish;
|
|
222
|
+
//# sourceMappingURL=packageInstall.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Connection } from '@salesforce/core';
|
|
2
|
+
import { Duration } from '@salesforce/kit';
|
|
3
|
+
import { PackagingSObjects } from '../interfaces';
|
|
4
|
+
declare type UninstallResult = PackagingSObjects.SubscriberPackageVersionUninstallRequest;
|
|
5
|
+
export declare function uninstallPackage(id: string, conn: Connection, wait?: Duration): Promise<UninstallResult>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uninstallPackage = 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
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
14
|
+
const messages = core_1.Messages.loadMessages('@salesforce/packaging', 'messages');
|
|
15
|
+
async function poll(id, conn) {
|
|
16
|
+
const uninstallRequest = await conn.tooling.sobject('SubscriberPackageVersionUninstallRequest').retrieve(id);
|
|
17
|
+
switch (uninstallRequest.Status) {
|
|
18
|
+
case 'Success': {
|
|
19
|
+
return { completed: true, payload: uninstallRequest };
|
|
20
|
+
}
|
|
21
|
+
case 'InProgress':
|
|
22
|
+
case 'Queued': {
|
|
23
|
+
core_1.Lifecycle.getInstance().emit('packageUninstall', {
|
|
24
|
+
...uninstallRequest,
|
|
25
|
+
});
|
|
26
|
+
return { completed: false, payload: uninstallRequest };
|
|
27
|
+
}
|
|
28
|
+
default: {
|
|
29
|
+
const err = messages.getMessage('defaultErrorMessage', [id, uninstallRequest.Id]);
|
|
30
|
+
const errorQueryResult = await conn.tooling.query(`"SELECT Message FROM PackageVersionUninstallRequestError WHERE ParentRequest.Id = '${id}' ORDER BY Message"`);
|
|
31
|
+
const errors = [];
|
|
32
|
+
if (errorQueryResult.records.length) {
|
|
33
|
+
errors.push('\n=== Errors\n');
|
|
34
|
+
errorQueryResult.records.forEach((record) => {
|
|
35
|
+
errors.push(`(${errors.length}) ${record.Message}${os.EOL}`);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
throw new core_1.SfError(`${err}${errors.join(os.EOL)}`, 'UNINSTALL_ERROR', [
|
|
39
|
+
messages.getMessage('uninstallErrorAction'),
|
|
40
|
+
]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function uninstallPackage(id, conn, wait = kit_1.Duration.seconds(0)) {
|
|
45
|
+
const uninstallRequest = await conn.tooling.sobject('SubscriberPackageVersionUninstallRequest').create({
|
|
46
|
+
SubscriberPackageVersionId: id,
|
|
47
|
+
});
|
|
48
|
+
if (wait.seconds === 0) {
|
|
49
|
+
return (await conn.tooling
|
|
50
|
+
.sobject('SubscriberPackageVersionUninstallRequest')
|
|
51
|
+
.retrieve(uninstallRequest.id));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const pollingClient = await core_1.PollingClient.create({
|
|
55
|
+
poll: () => poll(uninstallRequest.id, conn),
|
|
56
|
+
frequency: kit_1.Duration.seconds(5),
|
|
57
|
+
timeout: wait,
|
|
58
|
+
});
|
|
59
|
+
return pollingClient.subscribe();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.uninstallPackage = uninstallPackage;
|
|
63
|
+
//# sourceMappingURL=packageUninstall.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection, NamedPackageDir, PackageDir, SfdcUrl, SfError, SfProject } from '@salesforce/core';
|
|
2
2
|
import { Duration } from '@salesforce/kit';
|
|
3
|
-
import { Many } from '@salesforce/ts-types';
|
|
3
|
+
import { Many, Nullable } from '@salesforce/ts-types';
|
|
4
4
|
import { SaveError } from 'jsforce';
|
|
5
5
|
import { PackagingSObjects, PackageVersionCreateRequestResult, PackageVersionCreateOptions } from '../interfaces';
|
|
6
6
|
export declare const VERSION_NUMBER_SEP = ".";
|
|
@@ -39,6 +39,7 @@ export declare function applyErrorAction(err: Error): Error;
|
|
|
39
39
|
* @param connection For tooling query
|
|
40
40
|
*/
|
|
41
41
|
export declare function getPackageVersionId(versionId: string, connection: Connection): Promise<string>;
|
|
42
|
+
export declare function escapeInstallationKey(key?: string): Nullable<string>;
|
|
42
43
|
/**
|
|
43
44
|
* Given 0Ho the package type type (Managed, Unlocked, Locked(deprecated?))
|
|
44
45
|
*
|
|
@@ -55,7 +56,7 @@ export declare function getPackageType(packageId: string, connection: Connection
|
|
|
55
56
|
* @param installKey For tooling query, if an installation key is applicable to the package version it must be passed in the queries
|
|
56
57
|
* @throws Error with message when package2 cannot be found
|
|
57
58
|
*/
|
|
58
|
-
export declare function getPackageTypeBy04t(packageVersionId: string, connection: Connection, installKey
|
|
59
|
+
export declare function getPackageTypeBy04t(packageVersionId: string, connection: Connection, installKey?: string): Promise<string>;
|
|
59
60
|
/**
|
|
60
61
|
* Given a package version ID (05i) or subscriber package version ID (04t), return the subscriber package version ID (04t)
|
|
61
62
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveCanonicalPackageProperty = exports.combineSaveErrors = exports.formatDate = exports.getSoqlWhereClauseMaxLength = exports.pollForStatusWithInterval = exports.findOrCreatePackage = exports.getPackageAliasesFromId = exports.convertCamelCaseStringToSentence = exports.getPackageIdFromAlias = exports.getConfigPackageDirectory = exports.getConfigPackageDirectories = exports.getPackageVersionNumber = exports.concatVersion = exports.getAncestorIdHighestRelease = exports.validateAncestorId = exports.getAncestorId = exports.getInClauseItemsCount = exports.queryWithInConditionChunking = exports.getPackageVersionStrings = exports.getHasMetadataRemoved = exports.getContainerOptions = exports.getSubscriberPackageVersionId = exports.getPackageTypeBy04t = exports.getPackageType = exports.getPackageVersionId = exports.applyErrorAction = exports.massageErrorMessage = exports.isErrorPackageNotAvailable = exports.isErrorFromSPVQueryRestriction = exports.validUrl = exports.validatePatchVersion = exports.validateVersionNumber = exports.validateIdNoThrow = exports.validateId = exports.BY_LABEL = exports.BY_PREFIX = exports.DEFAULT_PACKAGE_DIR = exports.POLL_INTERVAL_SECONDS = exports.SOQL_WHERE_CLAUSE_MAX_LENGTH = exports.INSTALL_URL_BASE = exports.VERSION_NUMBER_SEP = void 0;
|
|
3
|
+
exports.resolveCanonicalPackageProperty = exports.combineSaveErrors = exports.formatDate = exports.getSoqlWhereClauseMaxLength = exports.pollForStatusWithInterval = exports.findOrCreatePackage = exports.getPackageAliasesFromId = exports.convertCamelCaseStringToSentence = exports.getPackageIdFromAlias = exports.getConfigPackageDirectory = exports.getConfigPackageDirectories = exports.getPackageVersionNumber = exports.concatVersion = exports.getAncestorIdHighestRelease = exports.validateAncestorId = exports.getAncestorId = exports.getInClauseItemsCount = exports.queryWithInConditionChunking = exports.getPackageVersionStrings = exports.getHasMetadataRemoved = exports.getContainerOptions = exports.getSubscriberPackageVersionId = exports.getPackageTypeBy04t = exports.getPackageType = exports.escapeInstallationKey = exports.getPackageVersionId = exports.applyErrorAction = exports.massageErrorMessage = exports.isErrorPackageNotAvailable = exports.isErrorFromSPVQueryRestriction = exports.validUrl = exports.validatePatchVersion = exports.validateVersionNumber = exports.validateIdNoThrow = exports.validateId = exports.BY_LABEL = exports.BY_PREFIX = exports.DEFAULT_PACKAGE_DIR = exports.POLL_INTERVAL_SECONDS = exports.SOQL_WHERE_CLAUSE_MAX_LENGTH = exports.INSTALL_URL_BASE = exports.VERSION_NUMBER_SEP = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (c) 2022, salesforce.com, inc.
|
|
6
6
|
* All rights reserved.
|
|
@@ -211,6 +211,10 @@ async function getPackageVersionId(versionId, connection) {
|
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
exports.getPackageVersionId = getPackageVersionId;
|
|
214
|
+
function escapeInstallationKey(key) {
|
|
215
|
+
return key ? key.replace(/\\/g, '\\\\').replace(/'/g, "\\'") : null;
|
|
216
|
+
}
|
|
217
|
+
exports.escapeInstallationKey = escapeInstallationKey;
|
|
214
218
|
/**
|
|
215
219
|
* Given 0Ho the package type type (Managed, Unlocked, Locked(deprecated?))
|
|
216
220
|
*
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @param dir to zip
|
|
7
7
|
* @param zipfile
|
|
8
|
-
* @param options
|
|
9
8
|
*/
|
|
10
|
-
export declare function zipDir(dir: string, zipfile: string
|
|
9
|
+
export declare function zipDir(dir: string, zipfile: string): Promise<void>;
|
|
11
10
|
export declare function getElapsedTime(timer: [number, number]): string;
|
|
12
11
|
export declare function copyDir(src: string, dest: string): void;
|
package/lib/utils/srcDevUtils.js
CHANGED
|
@@ -22,9 +22,8 @@ const pipeline = (0, util_1.promisify)(stream_1.pipeline);
|
|
|
22
22
|
*
|
|
23
23
|
* @param dir to zip
|
|
24
24
|
* @param zipfile
|
|
25
|
-
* @param options
|
|
26
25
|
*/
|
|
27
|
-
async function zipDir(dir, zipfile
|
|
26
|
+
async function zipDir(dir, zipfile) {
|
|
28
27
|
const logger = core_1.Logger.childFromRoot('srcDevUtils#zipDir');
|
|
29
28
|
const timer = process.hrtime();
|
|
30
29
|
const globbyResult = await globby('**/*', { expandDirectories: true, cwd: dir });
|
package/messages/messages.md
CHANGED
|
@@ -247,3 +247,11 @@ Package version creation failed with unknown error
|
|
|
247
247
|
|
|
248
248
|
Package upload failed.
|
|
249
249
|
%s
|
|
250
|
+
|
|
251
|
+
# defaultErrorMessage
|
|
252
|
+
|
|
253
|
+
Can't uninstall the package %s during uninstall request %s.
|
|
254
|
+
|
|
255
|
+
# uninstallErrorAction
|
|
256
|
+
|
|
257
|
+
Verify installed package ID and resolve errors, then try again.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# upgradeTypeOnlyForUnlockedWarning
|
|
2
|
+
|
|
3
|
+
WARNING: We ignored the upgradetype parameter when installing this package version. The upgradetype parameter is available only for unlocked package installations. Managed package upgrades always default to using the Mixed upgrade type.
|
|
4
|
+
|
|
5
|
+
# apexCompileOnlyForUnlockedWarning
|
|
6
|
+
|
|
7
|
+
WARNING: We ignored the apexcompile parameter when installing this package version. The apexcompile parameter is available only for installations of unlocked packages.
|
|
8
|
+
|
|
9
|
+
# packageInstallPolling
|
|
10
|
+
|
|
11
|
+
Waiting for the package install request to complete. Status = %s
|
|
12
|
+
|
|
13
|
+
# packageInstallRequestError
|
|
14
|
+
|
|
15
|
+
Failed to create PackageInstallRequest for: %s
|
|
16
|
+
Due to: %s
|
|
17
|
+
|
|
18
|
+
# publishWaitProgress
|
|
19
|
+
|
|
20
|
+
Waiting for the Subscriber Package Version ID to be published to the target org.%s
|
|
21
|
+
|
|
22
|
+
# subscriberPackageVersionNotPublished
|
|
23
|
+
|
|
24
|
+
The subscriber package version is not fully available.
|
|
25
|
+
|
|
26
|
+
# subscriberPackageVersionNotPublished.actions
|
|
27
|
+
|
|
28
|
+
If this is a recently created package version, try again in a few minutes or contact the package publisher.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/packaging",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
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
|
-
"@salesforce/core": "^3.
|
|
39
|
-
"@salesforce/kit": "^1.5.
|
|
38
|
+
"@salesforce/core": "^3.24.0",
|
|
39
|
+
"@salesforce/kit": "^1.5.44",
|
|
40
40
|
"@salesforce/schemas": "^1.2.0",
|
|
41
41
|
"@salesforce/source-deploy-retrieve": "^6.2.0",
|
|
42
42
|
"@salesforce/ts-types": "^1.5.20",
|