Skip to content

Commit

Permalink
fix: undefined handling in remote tracking (#489)
Browse files Browse the repository at this point in the history
* fix: undefined handling in remote tracking

* style: remove unnecessary default

* chore: bump sdr

* refactor: handle null AND undefined in reset?

* refactor: use wrapper methods
  • Loading branch information
mshanemc authored Oct 18, 2023
1 parent efbd233 commit eacfeac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"dependencies": {
"@salesforce/core": "^5.3.9",
"@salesforce/kit": "^3.0.13",
"@salesforce/source-deploy-retrieve": "^9.7.25",
"@salesforce/ts-types": "^2.0.8",
"@salesforce/source-deploy-retrieve": "^9.7.27",
"@salesforce/ts-types": "^2.0.9",
"fast-xml-parser": "^4.2.5",
"graceful-fs": "^4.2.11",
"isomorphic-git": "1.23.0",
Expand All @@ -74,7 +74,7 @@
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsdoc": "^46.5.1",
"eslint-plugin-sf-plugin": "^1.16.5",
"eslint-plugin-sf-plugin": "^1.16.11",
"husky": "^7.0.4",
"mocha": "^9.2.2",
"nyc": "^15.1.0",
Expand Down
10 changes: 5 additions & 5 deletions src/shared/remoteSourceTrackingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ export class RemoteSourceTrackingService extends ConfigFile<RemoteSourceTracking
// source tracking for this org. Calling querySourceMembersFrom() has the extra benefit
// of caching the query so we don't have to make an identical request in the same process.
await this.querySourceMembersFrom({ fromRevision: 0 });
this.set('sourceMembers', {});
this.set('serverMaxRevisionCounter', 0);
this.initSourceMembers();
this.setServerMaxRevision(0);

await this.write();
} catch (e) {
Expand Down Expand Up @@ -247,7 +247,7 @@ export class RemoteSourceTrackingService extends ConfigFile<RemoteSourceTracking
this.initSourceMembers();

const members =
toRevision != null
toRevision !== undefined && toRevision !== null
? await this.querySourceMembersTo(toRevision)
: await this.querySourceMembersFrom({ fromRevision: 0 });

Expand Down Expand Up @@ -513,7 +513,7 @@ export class RemoteSourceTrackingService extends ConfigFile<RemoteSourceTracking
}

private calculateTimeout(memberCount: number): Duration {
const overriddenTimeout = env.getNumber('SFDX_SOURCE_MEMBER_POLLING_TIMEOUT', 0) ?? 0;
const overriddenTimeout = env.getNumber('SFDX_SOURCE_MEMBER_POLLING_TIMEOUT', 0);
if (overriddenTimeout > 0) {
this.logger.debug(`Overriding SourceMember polling timeout to ${overriddenTimeout}`);
return Duration.seconds(overriddenTimeout);
Expand All @@ -532,7 +532,7 @@ export class RemoteSourceTrackingService extends ConfigFile<RemoteSourceTracking
quiet = false,
useCache = true,
}: { fromRevision?: number; quiet?: boolean; useCache?: boolean } = {}): Promise<SourceMember[]> {
const rev = fromRevision != null ? fromRevision : this.getServerMaxRevision();
const rev = fromRevision ?? this.getServerMaxRevision();

if (useCache) {
// Check cache first and return if found.
Expand Down
32 changes: 16 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@
strip-ansi "6.0.1"
ts-retry-promise "^0.7.1"

"@salesforce/core@^5.2.7", "@salesforce/core@^5.3.1", "@salesforce/core@^5.3.5", "@salesforce/core@^5.3.9":
"@salesforce/core@^5.3.1", "@salesforce/core@^5.3.5", "@salesforce/core@^5.3.9":
version "5.3.9"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-5.3.9.tgz#1c8f793ce1a0798c5c7767a5a370a5926d3298de"
integrity sha512-/HX0PiXq3Sjc5eVJ0EaYetcDGsKU9O9Nj8jFGw5qYlITx8zogfxc0j07liH67tQXS1KbTysYoj/MQ2zbHSNkPA==
Expand Down Expand Up @@ -618,7 +618,7 @@
typescript "^4.9.5"
wireit "^0.9.5"

"@salesforce/kit@^3.0.11", "@salesforce/kit@^3.0.13":
"@salesforce/kit@^3.0.13":
version "3.0.13"
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-3.0.13.tgz#10b47ad6e0e27c3a9f97eb6a5cdcfffa9ba1f163"
integrity sha512-HLQ5L5bBi0tsMeH5ZHJAhHUpvNUNPQoNJt2O82Jf6C60GGsrlzwzQ5ONAHGNBgKSZ7HLr0UGL5xaA+hE9uOcgw==
Expand All @@ -636,13 +636,13 @@
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.6.0.tgz#14505ebad2fb2d4f7b14837545d662766d293561"
integrity sha512-SwhDTLucj/GRbPpxlEoDZeqlX22o+G6fiebTXTu1cZKmd1oE0W2L7SlTTgJnWck8bhTeBIgQi9cpD8c2t5ISKA==

"@salesforce/source-deploy-retrieve@^9.7.25":
version "9.7.25"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-9.7.25.tgz#30f1eda5bf450deab57e6840b3a8a4543de08dba"
integrity sha512-X2J6hYEyMALtAkIA8pTfLUfZ7n9NdCzGitSakuD771RmOk92GRcdht143TMhvpgZ5J5rRNXsbvGRX2c+E8IANg==
"@salesforce/source-deploy-retrieve@^9.7.27":
version "9.7.27"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-9.7.27.tgz#1d88eb237361bab62c3a4c683be178ca3cc77e4c"
integrity sha512-ot0TpibH8OZVOJpMo10TuZ6acqpV7T04qNCpEcjrcpGVolCahMzFtpiJ4TjBxL+MPY/efuWWBj3YELjy9hgFxw==
dependencies:
"@salesforce/core" "^5.3.1"
"@salesforce/kit" "^3.0.11"
"@salesforce/kit" "^3.0.13"
"@salesforce/ts-types" "^2.0.7"
fast-levenshtein "^3.0.0"
fast-xml-parser "^4.3.2"
Expand All @@ -664,10 +664,10 @@
sinon "^5.1.1"
tslib "^2.6.1"

"@salesforce/ts-types@^2.0.6", "@salesforce/ts-types@^2.0.7", "@salesforce/ts-types@^2.0.8":
version "2.0.8"
resolved "https://registry.yarnpkg.com/@salesforce/ts-types/-/ts-types-2.0.8.tgz#e732b5a42cbec6bda79c089a0633fc643daf8bca"
integrity sha512-vuzLcxtThBhpuhmnoh8GFrVU8XjdoNyQm9gPtmcjUyUD/9nQIBTAX8oGoUvCiiq93c4LFEmSua+xm3yu0bbNfg==
"@salesforce/ts-types@^2.0.6", "@salesforce/ts-types@^2.0.7", "@salesforce/ts-types@^2.0.8", "@salesforce/ts-types@^2.0.9":
version "2.0.9"
resolved "https://registry.yarnpkg.com/@salesforce/ts-types/-/ts-types-2.0.9.tgz#66bff7b41720065d6b01631b6f6a3ccca02857c5"
integrity sha512-boUD9jw5vQpTCPCCmK/NFTWjSuuW+lsaxOynkyNXLW+zxOc4GDjhtKc4j0vWZJQvolpafbyS8ZLFHZJvs12gYA==
dependencies:
tslib "^2.6.2"

Expand Down Expand Up @@ -2266,12 +2266,12 @@ eslint-plugin-prefer-arrow@^1.2.1:
resolved "https://registry.yarnpkg.com/eslint-plugin-prefer-arrow/-/eslint-plugin-prefer-arrow-1.2.3.tgz#e7fbb3fa4cd84ff1015b9c51ad86550e55041041"
integrity sha512-J9I5PKCOJretVuiZRGvPQxCbllxGAV/viI20JO3LYblAodofBxyMnZAJ+WGeClHgANnSJberTNoFWWjrWKBuXQ==

eslint-plugin-sf-plugin@^1.16.5:
version "1.16.5"
resolved "https://registry.yarnpkg.com/eslint-plugin-sf-plugin/-/eslint-plugin-sf-plugin-1.16.5.tgz#41a9153e270625776e2a05ef6add3f27090b091f"
integrity sha512-W3E9KtClPHTZajCInxryxWS0tnNwg1ER4/W7ZRJj6heX4XLJ9LHu8x519g576urSuQx03i9APGGOh1mFeAgfgw==
eslint-plugin-sf-plugin@^1.16.11:
version "1.16.11"
resolved "https://registry.yarnpkg.com/eslint-plugin-sf-plugin/-/eslint-plugin-sf-plugin-1.16.11.tgz#cc30f8b3ac42d1ca3b33bec9b9d0d0eba1913e37"
integrity sha512-BjqiSahGVuYTVpbk4snbniIDQZeZIZzbnDpiwkfliTQKK/FOqzoDPPOEMHNGT9cVXQBC1xKkCedWYHNpTPAbaQ==
dependencies:
"@salesforce/core" "^5.2.7"
"@salesforce/core" "^5.3.9"
"@typescript-eslint/utils" "^5.59.11"

eslint-scope@^5.1.1:
Expand Down

0 comments on commit eacfeac

Please sign in to comment.