@salesforce/packaging 1.3.0 → 1.3.1
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/package/packageInstall.js +21 -11
- package/package.json +2 -2
|
@@ -76,10 +76,21 @@ function isErrorPackageNotAvailable(err) {
|
|
|
76
76
|
}
|
|
77
77
|
exports.isErrorPackageNotAvailable = isErrorPackageNotAvailable;
|
|
78
78
|
async function getInstallationStatus(subscriberPackageVersionId, installationKey, connection) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
let query = `SELECT Id, SubscriberPackageId, InstallValidationStatus FROM SubscriberPackageVersion WHERE Id ='${subscriberPackageVersionId}'`;
|
|
80
|
+
if (installationKey) {
|
|
81
|
+
query += ` AND InstallationKey ='${(0, packageUtils_1.escapeInstallationKey)(installationKey)}'`;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
return await connection.tooling.query(query);
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
if (e instanceof Error && isErrorPackageNotAvailable(e)) {
|
|
88
|
+
getLogger().debug('getInstallationStatus:', e.name);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
throw e;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
83
94
|
}
|
|
84
95
|
exports.getInstallationStatus = getInstallationStatus;
|
|
85
96
|
async function waitForPublish(connection, subscriberPackageVersionId, frequency, timeout, installationKey) {
|
|
@@ -88,7 +99,7 @@ async function waitForPublish(connection, subscriberPackageVersionId, frequency,
|
|
|
88
99
|
return;
|
|
89
100
|
}
|
|
90
101
|
let queryResult;
|
|
91
|
-
let installValidationStatus;
|
|
102
|
+
let installValidationStatus = 'PACKAGE_UNAVAILABLE';
|
|
92
103
|
const pollingOptions = {
|
|
93
104
|
frequency: (0, packageUtils_1.numberToDuration)(frequency || 0),
|
|
94
105
|
timeout: pollingTimeout,
|
|
@@ -99,14 +110,12 @@ async function waitForPublish(connection, subscriberPackageVersionId, frequency,
|
|
|
99
110
|
// or for an InstallValidationStatus of UNINSTALL_IN_PROGRESS
|
|
100
111
|
if (queryResult?.records?.length) {
|
|
101
112
|
installValidationStatus = queryResult.records[0].InstallValidationStatus;
|
|
102
|
-
await core_1.Lifecycle.getInstance().emit(interfaces_1.PackageEvents.install['subscriber-status'], installValidationStatus);
|
|
103
|
-
if (!['PACKAGE_UNAVAILABLE', 'UNINSTALL_IN_PROGRESS'].includes(installValidationStatus)) {
|
|
104
|
-
return { completed: true, payload: installValidationStatus };
|
|
105
|
-
}
|
|
106
113
|
}
|
|
107
|
-
|
|
108
|
-
getLogger().debug(installMsgs.getMessage('publishWaitProgress', tokens));
|
|
114
|
+
getLogger().debug(installMsgs.getMessage('publishWaitProgress', [` Status = ${installValidationStatus}`]));
|
|
109
115
|
await core_1.Lifecycle.getInstance().emit(interfaces_1.PackageEvents.install['subscriber-status'], installValidationStatus);
|
|
116
|
+
if (!['PACKAGE_UNAVAILABLE', 'UNINSTALL_IN_PROGRESS'].includes(installValidationStatus)) {
|
|
117
|
+
return { completed: true, payload: installValidationStatus };
|
|
118
|
+
}
|
|
110
119
|
return { completed: false, payload: installValidationStatus };
|
|
111
120
|
},
|
|
112
121
|
};
|
|
@@ -122,6 +131,7 @@ async function waitForPublish(connection, subscriberPackageVersionId, frequency,
|
|
|
122
131
|
const error = installMsgs.createError('subscriberPackageVersionNotPublished');
|
|
123
132
|
error.setData(queryResult?.records[0]);
|
|
124
133
|
if (error.stack && e.stack) {
|
|
134
|
+
getLogger().debug(`Error during waitForPublish polling:\n${e.stack}`);
|
|
125
135
|
// append the original stack to this new error
|
|
126
136
|
error.stack += `\nDUE TO:\n${e.stack}`;
|
|
127
137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/packaging",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Packaging library for the Salesforce packaging platform",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"types": "lib/exported.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@salesforce/dev-config": "^3.1.0",
|
|
63
63
|
"@salesforce/dev-scripts": "^3.1.1",
|
|
64
64
|
"@salesforce/prettier-config": "^0.0.2",
|
|
65
|
-
"@salesforce/ts-sinon": "^1.4.
|
|
65
|
+
"@salesforce/ts-sinon": "^1.4.6",
|
|
66
66
|
"@types/debug": "4.1.7",
|
|
67
67
|
"@types/globby": "^9.1.0",
|
|
68
68
|
"@types/jszip": "^3.4.1",
|