@salesforce/core 2.36.1 → 2.36.2
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 +2 -0
- package/lib/org.d.ts +34 -0
- package/lib/org.js +62 -0
- package/messages/org.json +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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
|
+
### [2.36.2](https://github.com/forcedotcom/sfdx-core/compare/v2.36.1...v2.36.2) (2022-04-20)
|
|
6
|
+
|
|
5
7
|
### [2.36.1](https://github.com/forcedotcom/sfdx-core/compare/v2.36.0...v2.36.1) (2022-04-14)
|
|
6
8
|
|
|
7
9
|
### Bug Fixes
|
package/lib/org.d.ts
CHANGED
|
@@ -113,6 +113,17 @@ export declare class Org extends AsyncCreatable<Org.Options> {
|
|
|
113
113
|
* @returns {ScratchOrgCreateResult}
|
|
114
114
|
*/
|
|
115
115
|
scratchOrgCreate(options: ScratchOrgRequest): Promise<ScratchOrgCreateResult>;
|
|
116
|
+
/**
|
|
117
|
+
* Reports sandbox org creation status. If the org is ready, authenticates to the org.
|
|
118
|
+
*
|
|
119
|
+
* @param {sandboxname} string the sandbox name
|
|
120
|
+
* @param options Wait: The amount of time to wait before timing out, Interval: The time interval between polling
|
|
121
|
+
* @returns {SandboxProcessObject} the sandbox process object
|
|
122
|
+
*/
|
|
123
|
+
sandboxStatus(sandboxname: string, options: {
|
|
124
|
+
wait?: Duration;
|
|
125
|
+
interval?: Duration;
|
|
126
|
+
}): Promise<SandboxProcessObject>;
|
|
116
127
|
/**
|
|
117
128
|
* Clean all data files in the org's data path. Usually <workspace>/.sfdx/orgs/<username>.
|
|
118
129
|
*
|
|
@@ -264,6 +275,29 @@ export declare class Org extends AsyncCreatable<Org.Options> {
|
|
|
264
275
|
* **Throws** *{@link SfdxError} Throws and unsupported error.
|
|
265
276
|
*/
|
|
266
277
|
protected getDefaultOptions(): Org.Options;
|
|
278
|
+
/**
|
|
279
|
+
* Query the sandbox for the SandboxProcessObject by sandbox name
|
|
280
|
+
*
|
|
281
|
+
* @param sandboxName The name of the sandbox to query
|
|
282
|
+
* @returns {SandboxProcessObject} The SandboxProcessObject for the sandbox
|
|
283
|
+
*/
|
|
284
|
+
private queryLatestSandboxProcessBySandboxName;
|
|
285
|
+
/**
|
|
286
|
+
* Gets the sandboxProcessObject and then polls for it to complete.
|
|
287
|
+
*
|
|
288
|
+
* @param sandboxProcessName sanbox process name
|
|
289
|
+
* @param options { wait?: Duration; interval?: Duration }
|
|
290
|
+
* @returns {SandboxProcessObject} The SandboxProcessObject for the sandbox
|
|
291
|
+
*/
|
|
292
|
+
private authWithRetriesByName;
|
|
293
|
+
/**
|
|
294
|
+
* Polls the sandbox org for the sandboxProcessObject.
|
|
295
|
+
*
|
|
296
|
+
* @param sandboxProcessObj: The in-progress sandbox signup request
|
|
297
|
+
* @param options { wait?: Duration; interval?: Duration }
|
|
298
|
+
* @returns {SandboxProcessObject}
|
|
299
|
+
*/
|
|
300
|
+
private authWithRetries;
|
|
267
301
|
private queryProduction;
|
|
268
302
|
/**
|
|
269
303
|
* this method will delete the sandbox org from the production org and clean up any local files
|
package/lib/org.js
CHANGED
|
@@ -110,6 +110,16 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
110
110
|
async scratchOrgCreate(options) {
|
|
111
111
|
return scratchOrgCreate_1.scratchOrgCreate({ ...options, hubOrg: this });
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Reports sandbox org creation status. If the org is ready, authenticates to the org.
|
|
115
|
+
*
|
|
116
|
+
* @param {sandboxname} string the sandbox name
|
|
117
|
+
* @param options Wait: The amount of time to wait before timing out, Interval: The time interval between polling
|
|
118
|
+
* @returns {SandboxProcessObject} the sandbox process object
|
|
119
|
+
*/
|
|
120
|
+
async sandboxStatus(sandboxname, options) {
|
|
121
|
+
return this.authWithRetriesByName(sandboxname, options);
|
|
122
|
+
}
|
|
113
123
|
/**
|
|
114
124
|
* Clean all data files in the org's data path. Usually <workspace>/.sfdx/orgs/<username>.
|
|
115
125
|
*
|
|
@@ -500,6 +510,58 @@ class Org extends kit_1.AsyncCreatable {
|
|
|
500
510
|
getDefaultOptions() {
|
|
501
511
|
throw new sfdxError_1.SfdxError('Not Supported');
|
|
502
512
|
}
|
|
513
|
+
/**
|
|
514
|
+
* Query the sandbox for the SandboxProcessObject by sandbox name
|
|
515
|
+
*
|
|
516
|
+
* @param sandboxName The name of the sandbox to query
|
|
517
|
+
* @returns {SandboxProcessObject} The SandboxProcessObject for the sandbox
|
|
518
|
+
*/
|
|
519
|
+
async queryLatestSandboxProcessBySandboxName(sandboxNameIn) {
|
|
520
|
+
var _a;
|
|
521
|
+
const { tooling } = this.getConnection();
|
|
522
|
+
this.logger.debug('QueryLatestSandboxProcessBySandboxName called with SandboxName: %s ', sandboxNameIn);
|
|
523
|
+
const queryStr = `SELECT Id, Status, SandboxName, SandboxInfoId, LicenseType, CreatedDate, CopyProgress, SandboxOrganization, SourceId, Description, EndDate FROM SandboxProcess WHERE SandboxName='${sandboxNameIn}' AND Status != 'D' ORDER BY CreatedDate DESC LIMIT 1`;
|
|
524
|
+
const queryResult = await tooling.query(queryStr);
|
|
525
|
+
this.logger.debug('Return from calling queryToolingApi: %s ', queryResult);
|
|
526
|
+
if (((_a = queryResult === null || queryResult === void 0 ? void 0 : queryResult.records) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
527
|
+
return queryResult.records[0];
|
|
528
|
+
}
|
|
529
|
+
else if (queryResult.records && queryResult.records.length > 1) {
|
|
530
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'MultiSandboxProcessNotFoundBySandboxName', [sandboxNameIn]);
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
throw sfdxError_1.SfdxError.create('@salesforce/core', 'org', 'SandboxProcessNotFoundBySandboxName', [sandboxNameIn]);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Gets the sandboxProcessObject and then polls for it to complete.
|
|
538
|
+
*
|
|
539
|
+
* @param sandboxProcessName sanbox process name
|
|
540
|
+
* @param options { wait?: Duration; interval?: Duration }
|
|
541
|
+
* @returns {SandboxProcessObject} The SandboxProcessObject for the sandbox
|
|
542
|
+
*/
|
|
543
|
+
async authWithRetriesByName(sandboxProcessName, options) {
|
|
544
|
+
return this.authWithRetries(await this.queryLatestSandboxProcessBySandboxName(sandboxProcessName), options);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Polls the sandbox org for the sandboxProcessObject.
|
|
548
|
+
*
|
|
549
|
+
* @param sandboxProcessObj: The in-progress sandbox signup request
|
|
550
|
+
* @param options { wait?: Duration; interval?: Duration }
|
|
551
|
+
* @returns {SandboxProcessObject}
|
|
552
|
+
*/
|
|
553
|
+
async authWithRetries(sandboxProcessObj, options) {
|
|
554
|
+
var _a;
|
|
555
|
+
const retries = options.wait ? options.wait.seconds / kit_1.Duration.seconds(30).seconds : 0;
|
|
556
|
+
const pollInterval = (_a = options.interval) !== null && _a !== void 0 ? _a : kit_1.Duration.seconds(30);
|
|
557
|
+
this.logger.debug('AuthWithRetries sandboxProcessObj %s, retries %i', sandboxProcessObj, retries);
|
|
558
|
+
return this.pollStatusAndAuth({
|
|
559
|
+
sandboxProcessObj,
|
|
560
|
+
retries,
|
|
561
|
+
shouldPoll: retries > 0,
|
|
562
|
+
pollInterval,
|
|
563
|
+
});
|
|
564
|
+
}
|
|
503
565
|
async queryProduction(org, field, value) {
|
|
504
566
|
return org.connection.singleRecordQuery(`SELECT SandboxInfoId FROM SandboxProcess WHERE ${field} ='${value}' AND Status NOT IN ('D', 'E')`, { tooling: true });
|
|
505
567
|
}
|
package/messages/org.json
CHANGED
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
"SandboxNotFound": "We can't find a SandboxProcess for the sandbox org %s.",
|
|
10
10
|
"SandboxInfoCreateFailed": "The sandbox org creation failed with a result of %s.",
|
|
11
11
|
"MissingAuthUsername": "The sandbox %s does not have an authorized username.",
|
|
12
|
-
"OrgPollingTimeout": "Sandbox status is %s; timed out waiting for completion."
|
|
12
|
+
"OrgPollingTimeout": "Sandbox status is %s; timed out waiting for completion.",
|
|
13
|
+
"SandboxProcessNotFoundBySandboxName": "We can't find a SandboxProcess with the SandboxName %s.",
|
|
14
|
+
"MultiSandboxProcessNotFoundBySandboxName": "We found more than one SandboxProcess with the SandboxName %s."
|
|
13
15
|
}
|