@salesforce/core 8.23.5 → 8.23.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.
@@ -148,7 +148,7 @@ export declare class Connection<S extends Schema = Schema> extends JSForceConnec
148
148
  */
149
149
  singleRecordQuery<T extends Record>(soql: string, options?: SingleRecordQueryOptions): Promise<T>;
150
150
  /**
151
- * Executes a HEAD request on the baseUrl to force an auth refresh.
151
+ * Executes a GET request on the baseUrl to force an auth refresh.
152
152
  * This is useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes.
153
153
  *
154
154
  * This method issues a request using the current access token to check if it is still valid.
@@ -336,7 +336,7 @@ class Connection extends jsforce_node_1.Connection {
336
336
  return result.records[0];
337
337
  }
338
338
  /**
339
- * Executes a HEAD request on the baseUrl to force an auth refresh.
339
+ * Executes a GET request on the baseUrl to force an auth refresh.
340
340
  * This is useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes.
341
341
  *
342
342
  * This method issues a request using the current access token to check if it is still valid.
@@ -347,7 +347,13 @@ class Connection extends jsforce_node_1.Connection {
347
347
  this.logger.debug('Refreshing auth for org.');
348
348
  const requestInfo = {
349
349
  url: this.baseUrl(),
350
- method: 'HEAD',
350
+ /**
351
+ * IMPORTANT:
352
+ * We do a GET request instead of a HEAD to get the response body.
353
+ *
354
+ * jsforce relies on the res status code AND body to be able to stop retrying on known invalid scenarios (e.g. API access restricted to a specific CA/ECA)
355
+ */
356
+ method: 'GET',
351
357
  };
352
358
  await this.request(requestInfo);
353
359
  }
package/lib/org/org.d.ts CHANGED
@@ -366,14 +366,14 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
366
366
  */
367
367
  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>;
368
368
  /**
369
- * Executes a HEAD request on the baseUrl to force an auth refresh.
369
+ * Executes a GET request on the baseUrl to force an auth refresh.
370
370
  * This is useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes.
371
371
  *
372
372
  * This method issues a request using the current access token to check if it is still valid.
373
373
  * If the request returns 200, no refresh happens, and we keep the token.
374
374
  * If it returns 401, jsforce will request a new token and set it in the connection instance.
375
375
  */
376
- refreshAuth(): Promise<void>;
376
+ refreshAuth(): Promise<ReturnType<Connection['refreshAuth']>>;
377
377
  /**
378
378
  * Reads and returns the content of all user auth files for this org as an array.
379
379
  */
package/lib/org/org.js CHANGED
@@ -767,7 +767,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
767
767
  }
768
768
  }
769
769
  /**
770
- * Executes a HEAD request on the baseUrl to force an auth refresh.
770
+ * Executes a GET request on the baseUrl to force an auth refresh.
771
771
  * This is useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes.
772
772
  *
773
773
  * This method issues a request using the current access token to check if it is still valid.
@@ -775,12 +775,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
775
775
  * If it returns 401, jsforce will request a new token and set it in the connection instance.
776
776
  */
777
777
  async refreshAuth() {
778
- this.logger.debug('Refreshing auth for org.');
779
- const requestInfo = {
780
- url: this.getConnection().baseUrl(),
781
- method: 'HEAD',
782
- };
783
- await this.getConnection().request(requestInfo);
778
+ await this.getConnection().refreshAuth();
784
779
  }
785
780
  /**
786
781
  * Reads and returns the content of all user auth files for this org as an array.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "8.23.5",
3
+ "version": "8.23.7",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",
@@ -65,7 +65,7 @@
65
65
  "faye": "^1.4.1",
66
66
  "form-data": "^4.0.4",
67
67
  "js2xmlparser": "^4.0.1",
68
- "jsonwebtoken": "9.0.2",
68
+ "jsonwebtoken": "9.0.3",
69
69
  "jszip": "3.10.1",
70
70
  "memfs": "^4.30.1",
71
71
  "pino": "^9.7.0",
@@ -85,6 +85,7 @@
85
85
  "@types/semver": "^7.5.8",
86
86
  "benchmark": "^2.1.4",
87
87
  "esbuild": "^0.25.11",
88
+ "mocha": "^11.7.5",
88
89
  "ts-node": "^10.9.2",
89
90
  "ts-patch": "^3.3.0",
90
91
  "typescript": "^5.5.4"