@salesforce/core 6.2.3-qa.0 → 6.2.3-qa.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/lib/org/org.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AsyncOptionalCreatable, Duration } from '@salesforce/kit';
2
- import { AnyJson, JsonMap, Nullable, Optional } from '@salesforce/ts-types';
2
+ import { AnyJson, JsonMap, Nullable } from '@salesforce/ts-types';
3
3
  import { ConfigAggregator } from '../config/configAggregator';
4
4
  import { OrgUsersConfig } from '../config/orgUsersConfig';
5
5
  import { Connection } from './connection';
@@ -208,7 +208,7 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
208
208
  /**
209
209
  * Returns the Org object or null if this org is not affiliated with a Dev Hub (according to the local config).
210
210
  */
211
- getDevHubOrg(): Promise<Optional<Org>>;
211
+ getDevHubOrg(): Promise<Org | undefined>;
212
212
  /**
213
213
  * Returns `true` if the org is a Dev Hub.
214
214
  *
@@ -284,14 +284,7 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
284
284
  * Some organization information is locally cached, such as if the org name or if it is a scratch org.
285
285
  * This method populates/updates the filesystem from information retrieved from the org.
286
286
  */
287
- updateLocalInformation(): Promise<{
288
- name: string;
289
- instanceName: string;
290
- namespacePrefix: string | null;
291
- isSandbox: boolean;
292
- isScratch: boolean;
293
- trailExpirationDate: string | null;
294
- } | undefined>;
287
+ updateLocalInformation(): Promise<Pick<AuthFields, Org.Fields.NAME | Org.Fields.INSTANCE_NAME | Org.Fields.NAMESPACE_PREFIX | Org.Fields.IS_SANDBOX | Org.Fields.IS_SCRATCH | Org.Fields.TRIAL_EXPIRATION_DATE> | undefined>;
295
288
  /**
296
289
  * Refreshes the auth for this org's instance by calling HTTP GET on the baseUrl of the connection object.
297
290
  */
@@ -348,7 +341,7 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
348
341
  /**
349
342
  * Returns the admin username used to create the org.
350
343
  */
351
- getUsername(): Optional<string>;
344
+ getUsername(): string | undefined;
352
345
  /**
353
346
  * Returns the orgId for this org.
354
347
  */
package/lib/org/org.js CHANGED
@@ -522,16 +522,18 @@ class Org extends kit_1.AsyncOptionalCreatable {
522
522
  async updateLocalInformation() {
523
523
  const username = this.getUsername();
524
524
  if (username) {
525
- const organization = await this.retrieveOrganizationInformation();
525
+ const [stateAggregator, organization] = await Promise.all([
526
+ stateAggregator_1.StateAggregator.getInstance(),
527
+ this.retrieveOrganizationInformation(),
528
+ ]);
526
529
  const updateFields = {
527
530
  [Org.Fields.NAME]: organization.Name,
528
531
  [Org.Fields.INSTANCE_NAME]: organization.InstanceName,
529
532
  [Org.Fields.NAMESPACE_PREFIX]: organization.NamespacePrefix,
530
- [Org.Fields.IS_SANDBOX]: organization.IsSandbox && Boolean(organization.TrialExpirationDate),
531
- [Org.Fields.IS_SCRATCH]: organization.IsSandbox && !organization.TrialExpirationDate,
533
+ [Org.Fields.IS_SANDBOX]: organization.IsSandbox && !organization.TrialExpirationDate,
534
+ [Org.Fields.IS_SCRATCH]: organization.IsSandbox && Boolean(organization.TrialExpirationDate),
532
535
  [Org.Fields.TRIAL_EXPIRATION_DATE]: organization.TrialExpirationDate,
533
536
  };
534
- const stateAggregator = await stateAggregator_1.StateAggregator.getInstance();
535
537
  stateAggregator.orgs.update(username, updateFields);
536
538
  await stateAggregator.orgs.write(username);
537
539
  return updateFields;
@@ -546,8 +548,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
546
548
  url: this.getConnection().baseUrl(),
547
549
  method: 'GET',
548
550
  };
549
- const conn = this.getConnection();
550
- await conn.request(requestInfo);
551
+ await this.getConnection().request(requestInfo);
551
552
  }
552
553
  /**
553
554
  * Reads and returns the content of all user auth files for this org as an array.
@@ -557,16 +558,9 @@ class Org extends kit_1.AsyncOptionalCreatable {
557
558
  const contents = await config.read();
558
559
  const thisUsername = (0, ts_types_1.ensure)(this.getUsername());
559
560
  const usernames = (0, ts_types_1.ensureJsonArray)(contents.usernames ?? [thisUsername]);
560
- return Promise.all(usernames.map((username) => {
561
- if (username === thisUsername) {
562
- return authInfo_1.AuthInfo.create({
563
- username: this.getConnection().getUsername(),
564
- });
565
- }
566
- else {
567
- return authInfo_1.AuthInfo.create({ username: (0, ts_types_1.ensureString)(username) });
568
- }
569
- }));
561
+ return Promise.all(usernames.map((username) => authInfo_1.AuthInfo.create({
562
+ username: username === thisUsername ? this.getConnection().getUsername() : (0, ts_types_1.ensureString)(username),
563
+ })));
570
564
  }
571
565
  /**
572
566
  * Adds a username to the user config for this org. For convenience `this` object is returned.
@@ -596,7 +590,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
596
590
  // TODO: This is kind of screwy because contents values can be `AnyJson | object`...
597
591
  // needs config refactoring to improve
598
592
  const usernames = contents.usernames ?? [];
599
- if (!(0, ts_types_1.isArray)(usernames)) {
593
+ if (!Array.isArray(usernames)) {
600
594
  throw new sfError_1.SfError('Usernames is not an array', 'UnexpectedDataFormat');
601
595
  }
602
596
  let shouldUpdate = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "6.2.3-qa.0",
3
+ "version": "6.2.3-qa.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",