@salesforce/core 3.23.0 → 3.23.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
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.23.1](https://github.com/forcedotcom/sfdx-core/compare/v3.23.0...v3.23.1) (2022-06-30)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- isScratch should be boolean ([ebda782](https://github.com/forcedotcom/sfdx-core/commit/ebda782bfd4f3927bc12ce4e6402673361ac47d6))
|
|
10
|
+
- update AuthFields type ([766efec](https://github.com/forcedotcom/sfdx-core/commit/766efec26f404cc1f0e4d380d82f4f05aa455e95))
|
|
11
|
+
|
|
5
12
|
## [3.23.0](https://github.com/forcedotcom/sfdx-core/compare/v3.22.1...v3.23.0) (2022-06-30)
|
|
6
13
|
|
|
7
14
|
### Features
|
package/lib/org/authInfo.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
|
2
2
|
import { Nullable } from '@salesforce/ts-types';
|
|
3
3
|
import { OAuth2, OAuth2Config as JsforceOAuth2Config } from 'jsforce';
|
|
4
4
|
import { Connection } from './connection';
|
|
5
|
+
import { Org } from './org';
|
|
5
6
|
export declare type OAuth2Config = JsforceOAuth2Config & {
|
|
6
7
|
privateKey?: string;
|
|
7
8
|
privateKeyFile?: string;
|
|
@@ -39,6 +40,12 @@ export declare type AuthFields = {
|
|
|
39
40
|
userProfileName?: string;
|
|
40
41
|
expirationDate?: string;
|
|
41
42
|
tracksSource?: boolean;
|
|
43
|
+
[Org.Fields.NAME]?: string;
|
|
44
|
+
[Org.Fields.INSTANCE_NAME]?: string;
|
|
45
|
+
[Org.Fields.NAMESPACE_PREFIX]?: Nullable<string>;
|
|
46
|
+
[Org.Fields.IS_SANDBOX]?: boolean;
|
|
47
|
+
[Org.Fields.IS_SCRATCH]?: boolean;
|
|
48
|
+
[Org.Fields.TRIAL_EXPIRATION_DATE]?: Nullable<string>;
|
|
42
49
|
};
|
|
43
50
|
export declare type OrgAuthorization = {
|
|
44
51
|
orgId: string;
|
package/lib/org/org.js
CHANGED
|
@@ -90,7 +90,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
90
90
|
constructor(options) {
|
|
91
91
|
super(options);
|
|
92
92
|
this.status = Org.Status.UNKNOWN;
|
|
93
|
-
this.options = options
|
|
93
|
+
this.options = options !== null && options !== void 0 ? options : {};
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* create a sandbox from a production org
|
|
@@ -499,7 +499,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
499
499
|
const username = this.getUsername();
|
|
500
500
|
if (username) {
|
|
501
501
|
const organization = await this.retrieveOrganizationInformation();
|
|
502
|
-
const isScratch = organization.IsSandbox && organization.TrialExpirationDate;
|
|
502
|
+
const isScratch = organization.IsSandbox && Boolean(organization.TrialExpirationDate);
|
|
503
503
|
const isSandbox = organization.IsSandbox && !organization.TrialExpirationDate;
|
|
504
504
|
const stateAggregator = await stateAggregator_1.StateAggregator.getInstance();
|
|
505
505
|
stateAggregator.orgs.update(username, {
|
|
@@ -529,10 +529,11 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
529
529
|
* Reads and returns the content of all user auth files for this org as an array.
|
|
530
530
|
*/
|
|
531
531
|
async readUserAuthFiles() {
|
|
532
|
+
var _a;
|
|
532
533
|
const config = await this.retrieveOrgUsersConfig();
|
|
533
534
|
const contents = await config.read();
|
|
534
535
|
const thisUsername = (0, ts_types_1.ensure)(this.getUsername());
|
|
535
|
-
const usernames = (0, ts_types_1.ensureJsonArray)(contents.usernames
|
|
536
|
+
const usernames = (0, ts_types_1.ensureJsonArray)((_a = contents.usernames) !== null && _a !== void 0 ? _a : [thisUsername]);
|
|
536
537
|
return Promise.all(usernames.map((username) => {
|
|
537
538
|
if (username === thisUsername) {
|
|
538
539
|
return authInfo_1.AuthInfo.create({
|
|
@@ -562,6 +563,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
562
563
|
* @param {AuthInfo | string} auth The AuthInfo for the username to add.
|
|
563
564
|
*/
|
|
564
565
|
async addUsername(auth) {
|
|
566
|
+
var _a;
|
|
565
567
|
if (!auth) {
|
|
566
568
|
throw new sfError_1.SfError('Missing auth info', 'MissingAuthInfo');
|
|
567
569
|
}
|
|
@@ -571,7 +573,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
571
573
|
const contents = await orgConfig.read();
|
|
572
574
|
// TODO: This is kind of screwy because contents values can be `AnyJson | object`...
|
|
573
575
|
// needs config refactoring to improve
|
|
574
|
-
const usernames = contents.usernames
|
|
576
|
+
const usernames = (_a = contents.usernames) !== null && _a !== void 0 ? _a : [];
|
|
575
577
|
if (!(0, ts_types_1.isArray)(usernames)) {
|
|
576
578
|
throw new sfError_1.SfError('Usernames is not an array', 'UnexpectedDataFormat');
|
|
577
579
|
}
|
|
@@ -600,6 +602,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
600
602
|
* @param {AuthInfo | string} auth The AuthInfo containing the username to remove.
|
|
601
603
|
*/
|
|
602
604
|
async removeUsername(auth) {
|
|
605
|
+
var _a;
|
|
603
606
|
if (!auth) {
|
|
604
607
|
throw new sfError_1.SfError('Missing auth info', 'MissingAuthInfoError');
|
|
605
608
|
}
|
|
@@ -608,7 +611,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
608
611
|
const orgConfig = await this.retrieveOrgUsersConfig();
|
|
609
612
|
const contents = await orgConfig.read();
|
|
610
613
|
const targetUser = authInfo.getFields().username;
|
|
611
|
-
const usernames = (contents.usernames
|
|
614
|
+
const usernames = ((_a = contents.usernames) !== null && _a !== void 0 ? _a : []);
|
|
612
615
|
contents.usernames = usernames.filter((username) => username !== targetUser);
|
|
613
616
|
await orgConfig.write();
|
|
614
617
|
return this;
|
|
@@ -649,7 +652,8 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
649
652
|
* Returns the orgId for this org.
|
|
650
653
|
*/
|
|
651
654
|
getOrgId() {
|
|
652
|
-
|
|
655
|
+
var _a;
|
|
656
|
+
return (_a = this.orgId) !== null && _a !== void 0 ? _a : this.getField(Org.Fields.ORG_ID);
|
|
653
657
|
}
|
|
654
658
|
/**
|
|
655
659
|
* Returns for the config aggregator.
|
|
@@ -835,6 +839,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
835
839
|
* @private
|
|
836
840
|
*/
|
|
837
841
|
async deleteSandbox(prodOrg) {
|
|
842
|
+
var _a, _b;
|
|
838
843
|
const sandbox = await this.getSandboxConfig(this.getOrgId());
|
|
839
844
|
prodOrg !== null && prodOrg !== void 0 ? prodOrg : (prodOrg = await Org.create({
|
|
840
845
|
aggregator: this.configAggregator,
|
|
@@ -845,7 +850,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
845
850
|
let result;
|
|
846
851
|
try {
|
|
847
852
|
// grab sandboxName from config or try to calculate from the sandbox username
|
|
848
|
-
const sandboxName = (sandbox === null || sandbox === void 0 ? void 0 : sandbox.sandboxName)
|
|
853
|
+
const sandboxName = (_a = sandbox === null || sandbox === void 0 ? void 0 : sandbox.sandboxName) !== null && _a !== void 0 ? _a : ((_b = this.getUsername()) !== null && _b !== void 0 ? _b : '').split(`${prodOrg.getUsername()}.`)[1];
|
|
849
854
|
if (!sandboxName) {
|
|
850
855
|
this.logger.debug('Sandbox name is not available');
|
|
851
856
|
// jump to query by orgId
|
|
@@ -975,7 +980,8 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
975
980
|
await Promise.all(authInfos
|
|
976
981
|
.map((auth) => auth.getFields().username)
|
|
977
982
|
.map(async (username) => {
|
|
978
|
-
|
|
983
|
+
var _a;
|
|
984
|
+
const aliasKeys = (_a = (username && stateAggregator.aliases.getAll(username))) !== null && _a !== void 0 ? _a : [];
|
|
979
985
|
stateAggregator.aliases.unsetAll(username);
|
|
980
986
|
const orgForUser = username === this.getUsername()
|
|
981
987
|
? this
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as fs from 'fs';
|
|
3
|
-
import {
|
|
3
|
+
import { Nullable, Optional } from '@salesforce/ts-types';
|
|
4
4
|
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
5
5
|
import { AuthInfoConfig } from '../../config/authInfoConfig';
|
|
6
6
|
import { GlobalInfo } from '../globalInfoConfig';
|
|
@@ -94,7 +94,7 @@ export declare abstract class BaseOrgAccessor<T extends ConfigFile, P extends Co
|
|
|
94
94
|
* @param username
|
|
95
95
|
* @param org
|
|
96
96
|
*/
|
|
97
|
-
update(username: string, org: Partial<P>
|
|
97
|
+
update(username: string, org: Partial<P>): void;
|
|
98
98
|
/**
|
|
99
99
|
* Delete the auth file for a given username.
|
|
100
100
|
*
|