@salesforce/core 5.3.3 → 5.3.5
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/org/authInfo.js +1 -1
- package/lib/org/org.d.ts +5 -4
- package/lib/org/org.js +35 -12
- package/package.json +2 -2
package/lib/org/authInfo.js
CHANGED
|
@@ -206,7 +206,7 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
206
206
|
* @param sfdxAuthUrl
|
|
207
207
|
*/
|
|
208
208
|
static parseSfdxAuthUrl(sfdxAuthUrl) {
|
|
209
|
-
const match = sfdxAuthUrl.match(/^force:\/\/([a-zA-Z0-9._-]
|
|
209
|
+
const match = sfdxAuthUrl.match(/^force:\/\/([a-zA-Z0-9._-]+={0,2}):([a-zA-Z0-9._-]*={0,2}):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/);
|
|
210
210
|
if (!match) {
|
|
211
211
|
throw new sfError_1.SfError('Invalid SFDX auth URL. Must be in the format "force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>". Note that the SFDX auth URL uses the "force" protocol, and not "http" or "https". Also note that the "instanceUrl" inside the SFDX auth URL doesn\'t include the protocol ("https://").', 'INVALID_SFDX_AUTH_URL');
|
|
212
212
|
}
|
package/lib/org/org.d.ts
CHANGED
|
@@ -36,7 +36,8 @@ export declare enum SandboxEvents {
|
|
|
36
36
|
EVENT_ASYNC_RESULT = "asyncResult",
|
|
37
37
|
EVENT_RESULT = "result",
|
|
38
38
|
EVENT_AUTH = "auth",
|
|
39
|
-
EVENT_RESUME = "resume"
|
|
39
|
+
EVENT_RESUME = "resume",
|
|
40
|
+
EVENT_MULTIPLE_SBX_PROCESSES = "multipleMatchingSbxProcesses"
|
|
40
41
|
}
|
|
41
42
|
export interface SandboxUserAuthResponse {
|
|
42
43
|
authUserName: string;
|
|
@@ -141,11 +142,11 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
|
|
|
141
142
|
interval?: Duration;
|
|
142
143
|
}): Promise<SandboxProcessObject>;
|
|
143
144
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
145
|
+
* Resume a sandbox creation from a production org.
|
|
146
|
+
* `this` needs to be a production org with sandbox licenses available.
|
|
146
147
|
*
|
|
147
148
|
* @param resumeSandboxRequest SandboxRequest options to create the sandbox with
|
|
148
|
-
* @param options Wait: The amount of time to wait (default:
|
|
149
|
+
* @param options Wait: The amount of time to wait (default: 0 minutes) before timing out,
|
|
149
150
|
* Interval: The time interval (default: 30 seconds) between polling
|
|
150
151
|
*/
|
|
151
152
|
resumeSandbox(resumeSandboxRequest: ResumeSandboxRequest, options?: {
|
package/lib/org/org.js
CHANGED
|
@@ -41,6 +41,7 @@ var SandboxEvents;
|
|
|
41
41
|
SandboxEvents["EVENT_RESULT"] = "result";
|
|
42
42
|
SandboxEvents["EVENT_AUTH"] = "auth";
|
|
43
43
|
SandboxEvents["EVENT_RESUME"] = "resume";
|
|
44
|
+
SandboxEvents["EVENT_MULTIPLE_SBX_PROCESSES"] = "multipleMatchingSbxProcesses";
|
|
44
45
|
})(SandboxEvents = exports.SandboxEvents || (exports.SandboxEvents = {}));
|
|
45
46
|
const resumableSandboxStatus = ['Activating', 'Pending', 'Pending Activation', 'Processing', 'Sampling', 'Completed'];
|
|
46
47
|
function sandboxIsResumable(value) {
|
|
@@ -129,11 +130,11 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
129
130
|
return this.createSandbox(sandboxReq, options);
|
|
130
131
|
}
|
|
131
132
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
133
|
+
* Resume a sandbox creation from a production org.
|
|
134
|
+
* `this` needs to be a production org with sandbox licenses available.
|
|
134
135
|
*
|
|
135
136
|
* @param resumeSandboxRequest SandboxRequest options to create the sandbox with
|
|
136
|
-
* @param options Wait: The amount of time to wait (default:
|
|
137
|
+
* @param options Wait: The amount of time to wait (default: 0 minutes) before timing out,
|
|
137
138
|
* Interval: The time interval (default: 30 seconds) between polling
|
|
138
139
|
*/
|
|
139
140
|
async resumeSandbox(resumeSandboxRequest, options = {
|
|
@@ -144,12 +145,27 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
144
145
|
this.logger.debug(resumeSandboxRequest, 'ResumeSandbox called with ResumeSandboxRequest');
|
|
145
146
|
let sandboxCreationProgress;
|
|
146
147
|
// seed the sandboxCreationProgress via the resumeSandboxRequest options
|
|
147
|
-
if (resumeSandboxRequest.
|
|
148
|
-
sandboxCreationProgress = await this.querySandboxProcessBySandboxName(resumeSandboxRequest.SandboxName);
|
|
149
|
-
}
|
|
150
|
-
else if (resumeSandboxRequest.SandboxProcessObjId) {
|
|
148
|
+
if (resumeSandboxRequest.SandboxProcessObjId) {
|
|
151
149
|
sandboxCreationProgress = await this.querySandboxProcessById(resumeSandboxRequest.SandboxProcessObjId);
|
|
152
150
|
}
|
|
151
|
+
else if (resumeSandboxRequest.SandboxName) {
|
|
152
|
+
try {
|
|
153
|
+
// There can be multiple sandbox processes returned when querying by name. Use the most recent
|
|
154
|
+
// process and fire a warning event with all processes.
|
|
155
|
+
sandboxCreationProgress = await this.querySandboxProcessBySandboxName(resumeSandboxRequest.SandboxName);
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
if (err instanceof sfError_1.SfError && err.name === 'SingleRecordQuery_MultipleRecords' && err.data) {
|
|
159
|
+
const sbxProcesses = err.data;
|
|
160
|
+
// 0 index will always be the most recently created process since the query sorts on created date desc.
|
|
161
|
+
sandboxCreationProgress = sbxProcesses[0];
|
|
162
|
+
await lifecycleEvents_1.Lifecycle.getInstance().emit(SandboxEvents.EVENT_MULTIPLE_SBX_PROCESSES, sbxProcesses);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
throw err;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
153
169
|
else {
|
|
154
170
|
throw messages.createError('sandboxNotFound', [
|
|
155
171
|
resumeSandboxRequest.SandboxName ?? resumeSandboxRequest.SandboxProcessObjId,
|
|
@@ -1085,7 +1101,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
1085
1101
|
let waitingOnAuth = false;
|
|
1086
1102
|
const pollingClient = await pollingClient_1.PollingClient.create({
|
|
1087
1103
|
poll: async () => {
|
|
1088
|
-
const sandboxProcessObj = await this.
|
|
1104
|
+
const sandboxProcessObj = await this.querySandboxProcessById(options.sandboxProcessObj.Id);
|
|
1089
1105
|
// check to see if sandbox can authenticate via sandboxAuth endpoint
|
|
1090
1106
|
const sandboxInfo = await this.sandboxSignupComplete(sandboxProcessObj);
|
|
1091
1107
|
if (sandboxInfo) {
|
|
@@ -1127,10 +1143,17 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
1127
1143
|
* @private
|
|
1128
1144
|
*/
|
|
1129
1145
|
async querySandboxProcess(where) {
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1146
|
+
const soql = `SELECT Id, Status, SandboxName, SandboxInfoId, LicenseType, CreatedDate, CopyProgress, SandboxOrganization, SourceId, Description, EndDate FROM SandboxProcess WHERE ${where} ORDER BY CreatedDate DESC`;
|
|
1147
|
+
const result = (await this.connection.tooling.query(soql)).records.filter((item) => !item.Status.startsWith('Del'));
|
|
1148
|
+
if (result.length === 0) {
|
|
1149
|
+
throw new sfError_1.SfError(`No record found for ${soql}`, connection_1.SingleRecordQueryErrors.NoRecords);
|
|
1150
|
+
}
|
|
1151
|
+
if (result.length > 1) {
|
|
1152
|
+
const err = new sfError_1.SfError('The query returned more than 1 record', connection_1.SingleRecordQueryErrors.MultipleRecords);
|
|
1153
|
+
err.data = result;
|
|
1154
|
+
throw err;
|
|
1155
|
+
}
|
|
1156
|
+
return result[0];
|
|
1134
1157
|
}
|
|
1135
1158
|
/**
|
|
1136
1159
|
* determines if the sandbox has successfully been created
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.5",
|
|
4
4
|
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"types": "lib/exported.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@salesforce/dev-config": "^4.0.1",
|
|
63
63
|
"@salesforce/dev-scripts": "^5.4.2",
|
|
64
64
|
"@salesforce/prettier-config": "^0.0.3",
|
|
65
|
-
"@salesforce/ts-sinon": "^1.4.
|
|
65
|
+
"@salesforce/ts-sinon": "^1.4.16",
|
|
66
66
|
"@types/benchmark": "^2.1.3",
|
|
67
67
|
"@types/chai-string": "^1.4.3",
|
|
68
68
|
"@types/jsonwebtoken": "9.0.3",
|