@salesforce/core 3.7.8 → 3.8.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/CHANGELOG.md +19 -0
- package/lib/exported.d.ts +1 -1
- package/lib/org/authInfo.d.ts +13 -0
- package/lib/org/authInfo.js +18 -0
- package/lib/org/org.js +1 -1
- package/lib/testSetup.d.ts +5 -1
- package/lib/testSetup.js +9 -8
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
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
|
+
### [3.8.1](https://github.com/forcedotcom/sfdx-core/compare/v3.8.0...v3.8.1) (2022-03-18)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- adjust mock org test data to conform to v3 ([38faf50](https://github.com/forcedotcom/sfdx-core/commit/38faf5063931955066312c24b4188b12c40098a5))
|
|
10
|
+
- side effects function should not save when no changes ([#541](https://github.com/forcedotcom/sfdx-core/issues/541)) ([6bfb841](https://github.com/forcedotcom/sfdx-core/commit/6bfb84172fdf74882102b9ffc6e6fbfe58e6ffbc))
|
|
11
|
+
|
|
12
|
+
## [3.8.0](https://github.com/forcedotcom/sfdx-core/compare/v3.7.9...v3.8.0) (2022-03-09)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- add handle side effect function to authinfo ([64c78e7](https://github.com/forcedotcom/sfdx-core/commit/64c78e74bc5e1cfb748fd2d64e4b1e8fc1062bf6))
|
|
17
|
+
|
|
18
|
+
### [3.7.9](https://github.com/forcedotcom/sfdx-core/compare/v3.7.8...v3.7.9) (2022-03-04)
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- error literal to match the error thrown ([#533](https://github.com/forcedotcom/sfdx-core/issues/533)) ([b91ce5c](https://github.com/forcedotcom/sfdx-core/commit/b91ce5c329c9b2b88fb4b0ad028aee5f6d5b6e77))
|
|
23
|
+
|
|
5
24
|
### [3.7.8](https://github.com/forcedotcom/sfdx-core/compare/v3.7.7...v3.7.8) (2022-03-03)
|
|
6
25
|
|
|
7
26
|
### Bug Fixes
|
package/lib/exported.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { DeviceOauthService, DeviceCodeResponse, DeviceCodePollingResponse } fro
|
|
|
7
7
|
export { OrgUsersConfig } from './config/orgUsersConfig';
|
|
8
8
|
export { ConfigPropertyMeta, ConfigPropertyMetaInput, Config, SfdxPropertyKeys, SFDX_ALLOWED_PROPERTIES, } from './config/config';
|
|
9
9
|
export { ConfigInfo, ConfigAggregator } from './config/configAggregator';
|
|
10
|
-
export { AuthFields, AuthInfo, OrgAuthorization } from './org/authInfo';
|
|
10
|
+
export { AuthFields, AuthInfo, AuthSideEffects, OrgAuthorization } from './org/authInfo';
|
|
11
11
|
export { AuthRemover } from './org/authRemover';
|
|
12
12
|
export { Connection, SFDX_HTTP_HEADERS } from './org/connection';
|
|
13
13
|
export { Mode, Global } from './global';
|
package/lib/org/authInfo.d.ts
CHANGED
|
@@ -59,6 +59,11 @@ export interface AccessTokenOptions {
|
|
|
59
59
|
loginUrl?: string;
|
|
60
60
|
instanceUrl?: string;
|
|
61
61
|
}
|
|
62
|
+
export declare type AuthSideEffects = {
|
|
63
|
+
alias: string;
|
|
64
|
+
setDefault: boolean;
|
|
65
|
+
setDefaultDevHub: boolean;
|
|
66
|
+
};
|
|
62
67
|
/**
|
|
63
68
|
* A function to update a refresh token when the access token is expired.
|
|
64
69
|
*/
|
|
@@ -225,6 +230,14 @@ export declare class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
|
|
|
225
230
|
* **See** [SFDX Authorization](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_auth.htm#cli_reference_force_auth)
|
|
226
231
|
*/
|
|
227
232
|
getSfdxAuthUrl(): string;
|
|
233
|
+
/**
|
|
234
|
+
* Convenience function to handle typical side effects encountered when dealing with an AuthInfo.
|
|
235
|
+
* Given the values supplied in parameter sideEffects, this function will set auth alias, default auth
|
|
236
|
+
* and default dev hub.
|
|
237
|
+
*
|
|
238
|
+
* @param sideEffects - instance of AuthSideEffects
|
|
239
|
+
*/
|
|
240
|
+
handleAliasAndDefaultSettings(sideEffects: AuthSideEffects): Promise<void>;
|
|
228
241
|
/**
|
|
229
242
|
* Set the target-env (default) or the target-dev-hub to the alias if
|
|
230
243
|
* it exists otherwise to the username. Method will try to set the local
|
package/lib/org/authInfo.js
CHANGED
|
@@ -398,6 +398,24 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
398
398
|
sfdxAuthUrl += `${(0, ts_types_1.ensure)(decryptedFields.refreshToken, 'undefined refreshToken')}@${instanceUrl}`;
|
|
399
399
|
return sfdxAuthUrl;
|
|
400
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* Convenience function to handle typical side effects encountered when dealing with an AuthInfo.
|
|
403
|
+
* Given the values supplied in parameter sideEffects, this function will set auth alias, default auth
|
|
404
|
+
* and default dev hub.
|
|
405
|
+
*
|
|
406
|
+
* @param sideEffects - instance of AuthSideEffects
|
|
407
|
+
*/
|
|
408
|
+
async handleAliasAndDefaultSettings(sideEffects) {
|
|
409
|
+
if (sideEffects.alias || sideEffects.setDefault || sideEffects.setDefaultDevHub) {
|
|
410
|
+
if (sideEffects.alias)
|
|
411
|
+
await this.setAlias(sideEffects.alias);
|
|
412
|
+
if (sideEffects.setDefault)
|
|
413
|
+
await this.setAsDefault({ org: true });
|
|
414
|
+
if (sideEffects.setDefaultDevHub)
|
|
415
|
+
await this.setAsDefault({ devHub: true });
|
|
416
|
+
await this.save();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
401
419
|
/**
|
|
402
420
|
* Set the target-env (default) or the target-dev-hub to the alias if
|
|
403
421
|
* it exists otherwise to the username. Method will try to set the local
|
package/lib/org/org.js
CHANGED
|
@@ -850,7 +850,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
850
850
|
catch (err) {
|
|
851
851
|
const error = err;
|
|
852
852
|
this.logger.debug('Exception while calling writeSandboxAuthFile %s', err);
|
|
853
|
-
if ((error === null || error === void 0 ? void 0 : error.name) === '
|
|
853
|
+
if ((error === null || error === void 0 ? void 0 : error.name) === 'JwtAuthError' && ((_a = error === null || error === void 0 ? void 0 : error.stack) === null || _a === void 0 ? void 0 : _a.includes("user hasn't approved"))) {
|
|
854
854
|
waitingOnAuth = true;
|
|
855
855
|
}
|
|
856
856
|
else {
|
package/lib/testSetup.d.ts
CHANGED
|
@@ -377,7 +377,8 @@ export declare class StreamingMockCometClient extends CometClient {
|
|
|
377
377
|
*/
|
|
378
378
|
export declare class MockTestOrgData {
|
|
379
379
|
testId: string;
|
|
380
|
-
|
|
380
|
+
aliases?: string[];
|
|
381
|
+
configs?: string[];
|
|
381
382
|
username: string;
|
|
382
383
|
devHubUsername?: string;
|
|
383
384
|
orgId: string;
|
|
@@ -390,6 +391,9 @@ export declare class MockTestOrgData {
|
|
|
390
391
|
refreshToken: string;
|
|
391
392
|
userId: string;
|
|
392
393
|
redirectUri: string;
|
|
394
|
+
isDevHub?: boolean;
|
|
395
|
+
isScratchOrg?: boolean;
|
|
396
|
+
isExpired?: boolean | 'unknown';
|
|
393
397
|
constructor(id?: string, options?: {
|
|
394
398
|
username: string;
|
|
395
399
|
});
|
package/lib/testSetup.js
CHANGED
|
@@ -493,12 +493,13 @@ class MockTestOrgData {
|
|
|
493
493
|
this.devHubUsername = username;
|
|
494
494
|
}
|
|
495
495
|
makeDevHub() {
|
|
496
|
-
|
|
496
|
+
this.isDevHub = true;
|
|
497
497
|
}
|
|
498
498
|
createUser(user) {
|
|
499
499
|
const userMock = new MockTestOrgData();
|
|
500
500
|
userMock.username = user;
|
|
501
|
-
userMock.
|
|
501
|
+
userMock.aliases = this.aliases;
|
|
502
|
+
userMock.configs = this.configs;
|
|
502
503
|
userMock.devHubUsername = this.devHubUsername;
|
|
503
504
|
userMock.orgId = this.orgId;
|
|
504
505
|
userMock.loginUrl = this.loginUrl;
|
|
@@ -506,6 +507,9 @@ class MockTestOrgData {
|
|
|
506
507
|
userMock.clientId = this.clientId;
|
|
507
508
|
userMock.clientSecret = this.clientSecret;
|
|
508
509
|
userMock.redirectUri = this.redirectUri;
|
|
510
|
+
userMock.isDevHub = this.isDevHub;
|
|
511
|
+
userMock.isScratchOrg = this.isScratchOrg;
|
|
512
|
+
userMock.isExpired = this.isExpired;
|
|
509
513
|
return userMock;
|
|
510
514
|
}
|
|
511
515
|
getMockUserInfo() {
|
|
@@ -513,7 +517,8 @@ class MockTestOrgData {
|
|
|
513
517
|
Id: this.userId,
|
|
514
518
|
Username: this.username,
|
|
515
519
|
LastName: `user_lastname_${this.testId}`,
|
|
516
|
-
Alias: this.
|
|
520
|
+
Alias: this.aliases ? this.aliases[0] : 'user_alias_blah',
|
|
521
|
+
Configs: this.configs,
|
|
517
522
|
TimeZoneSidKey: `user_timezonesidkey_${this.testId}`,
|
|
518
523
|
LocaleSidKey: `user_localesidkey_${this.testId}`,
|
|
519
524
|
EmailEncodingKey: `user_emailencodingkey_${this.testId}`,
|
|
@@ -540,14 +545,10 @@ class MockTestOrgData {
|
|
|
540
545
|
config.createdOrgInstance = 'CS1';
|
|
541
546
|
config.created = '1519163543003';
|
|
542
547
|
config.userId = this.userId;
|
|
543
|
-
// config.devHubUsername = 'tn@su-blitz.org';
|
|
544
548
|
if (this.devHubUsername) {
|
|
545
549
|
config.devHubUsername = this.devHubUsername;
|
|
546
550
|
}
|
|
547
|
-
|
|
548
|
-
if (isDevHub) {
|
|
549
|
-
config.isDevHub = isDevHub;
|
|
550
|
-
}
|
|
551
|
+
config.isDevHub = this.isDevHub;
|
|
551
552
|
return config;
|
|
552
553
|
}
|
|
553
554
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.1",
|
|
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",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"!lib/**/*.map"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@oclif/core": "^1.
|
|
37
|
+
"@oclif/core": "^1.5.1",
|
|
38
38
|
"@salesforce/bunyan": "^2.0.0",
|
|
39
|
-
"@salesforce/kit": "^1.5.
|
|
39
|
+
"@salesforce/kit": "^1.5.34",
|
|
40
40
|
"@salesforce/schemas": "^1.1.0",
|
|
41
41
|
"@salesforce/ts-types": "^1.5.20",
|
|
42
42
|
"@types/graceful-fs": "^4.1.5",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"ts-retry-promise": "^0.6.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@salesforce/dev-config": "^3.0.
|
|
60
|
-
"@salesforce/dev-scripts": "^2.0.
|
|
59
|
+
"@salesforce/dev-config": "^3.0.1",
|
|
60
|
+
"@salesforce/dev-scripts": "^2.0.1",
|
|
61
61
|
"@salesforce/prettier-config": "^0.0.2",
|
|
62
62
|
"@salesforce/ts-sinon": "^1.3.21",
|
|
63
63
|
"@types/archiver": "^5.3.1",
|