@salesforce/core 4.3.5 → 4.3.7
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.d.ts +5 -0
- package/lib/org/authInfo.js +13 -2
- package/package.json +4 -4
package/lib/org/authInfo.d.ts
CHANGED
|
@@ -192,6 +192,11 @@ export declare class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
|
|
|
192
192
|
* Find all dev hubs available in the local environment.
|
|
193
193
|
*/
|
|
194
194
|
static getDevHubAuthInfos(): Promise<OrgAuthorization[]>;
|
|
195
|
+
/**
|
|
196
|
+
* Checks active scratch orgs to match by the ScratchOrg field (the 15-char org id)
|
|
197
|
+
* if you pass an 18-char scratchOrgId, it will be trimmed to 15-char for query purposes
|
|
198
|
+
* Throws is no matching scratch org is found
|
|
199
|
+
*/
|
|
195
200
|
private static queryScratchOrg;
|
|
196
201
|
/**
|
|
197
202
|
* Get the username.
|
package/lib/org/authInfo.js
CHANGED
|
@@ -270,11 +270,22 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
270
270
|
static async getDevHubAuthInfos() {
|
|
271
271
|
return AuthInfo.listAllAuthorizations((possibleHub) => possibleHub?.isDevHub ?? false);
|
|
272
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Checks active scratch orgs to match by the ScratchOrg field (the 15-char org id)
|
|
275
|
+
* if you pass an 18-char scratchOrgId, it will be trimmed to 15-char for query purposes
|
|
276
|
+
* Throws is no matching scratch org is found
|
|
277
|
+
*/
|
|
273
278
|
static async queryScratchOrg(devHubUsername, scratchOrgId) {
|
|
274
279
|
const devHubOrg = await org_1.Org.create({ aliasOrUsername: devHubUsername });
|
|
280
|
+
const trimmedId = (0, sfdc_1.trimTo15)(scratchOrgId);
|
|
275
281
|
const conn = devHubOrg.getConnection();
|
|
276
|
-
const data = await conn.
|
|
277
|
-
return
|
|
282
|
+
const data = await conn.query(`select Id, ExpirationDate, ScratchOrg from ScratchOrgInfo where ScratchOrg = '${trimmedId}' and Status = 'Active'`);
|
|
283
|
+
// where ScratchOrg='00DDE00000485Lg' will return a record for both 00DDE00000485Lg and 00DDE00000485LG.
|
|
284
|
+
// this is our way of enforcing case sensitivity on a 15-char Id (which is unfortunately how ScratchOrgInfo stores it)
|
|
285
|
+
const result = data.records.filter((r) => r.ScratchOrg === trimmedId)[0];
|
|
286
|
+
if (result)
|
|
287
|
+
return result;
|
|
288
|
+
throw new sfError_1.SfError(`DevHub ${devHubUsername} has no active scratch orgs that match ${trimmedId}`, 'NoActiveScratchOrgFound');
|
|
278
289
|
}
|
|
279
290
|
/**
|
|
280
291
|
* Get the username.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.7",
|
|
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",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"@types/lodash": "^4.14.195",
|
|
69
69
|
"@types/proper-lockfile": "^4.1.2",
|
|
70
70
|
"@types/shelljs": "0.8.12",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
72
|
-
"@typescript-eslint/parser": "^5.
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
|
72
|
+
"@typescript-eslint/parser": "^5.60.1",
|
|
73
73
|
"benchmark": "^2.1.4",
|
|
74
74
|
"chai": "^4.3.7",
|
|
75
75
|
"chai-string": "^1.5.0",
|
|
76
|
-
"eslint": "^8.
|
|
76
|
+
"eslint": "^8.44.0",
|
|
77
77
|
"eslint-config-prettier": "^8.8.0",
|
|
78
78
|
"eslint-config-salesforce": "^2.0.1",
|
|
79
79
|
"eslint-config-salesforce-license": "^0.2.0",
|