@salesforce/core-bundle 8.7.0 → 8.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/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2024, Salesforce.com, Inc.
1
+ Copyright (c) 2025, Salesforce.com, Inc.
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
package/lib/index.d.ts CHANGED
@@ -2995,8 +2995,12 @@ declare module '@salesforce/core-bundle/org/connection' {
2995
2995
  */
2996
2996
  singleRecordQuery<T extends Record>(soql: string, options?: SingleRecordQueryOptions): Promise<T>;
2997
2997
  /**
2998
- * Executes a get request on the baseUrl to force an auth refresh
2999
- * Useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes
2998
+ * Executes a HEAD request on the baseUrl to force an auth refresh.
2999
+ * This is useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes.
3000
+ *
3001
+ * This method issues a request using the current access token to check if it is still valid.
3002
+ * If the request returns 200, no refresh happens, and we keep the token.
3003
+ * If it returns 401, jsforce will request a new token and set it in the connection instance.
3000
3004
  */
3001
3005
  refreshAuth(): Promise<void>;
3002
3006
  private getCachedApiVersion;
@@ -3353,7 +3357,12 @@ declare module '@salesforce/core-bundle/org/org' {
3353
3357
  */
3354
3358
  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>;
3355
3359
  /**
3356
- * Refreshes the auth for this org's instance by calling HTTP GET on the baseUrl of the connection object.
3360
+ * Executes a HEAD request on the baseUrl to force an auth refresh.
3361
+ * This is useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes.
3362
+ *
3363
+ * This method issues a request using the current access token to check if it is still valid.
3364
+ * If the request returns 200, no refresh happens, and we keep the token.
3365
+ * If it returns 401, jsforce will request a new token and set it in the connection instance.
3357
3366
  */
3358
3367
  refreshAuth(): Promise<void>;
3359
3368
  /**
package/lib/index.js CHANGED
@@ -12328,7 +12328,7 @@ var require_package2 = __commonJS({
12328
12328
  "package.json"(exports2, module2) {
12329
12329
  module2.exports = {
12330
12330
  name: "@salesforce/core-bundle",
12331
- version: "8.7.0",
12331
+ version: "8.8.1",
12332
12332
  description: "Core libraries to interact with SFDX projects, orgs, and APIs.",
12333
12333
  main: "lib/index",
12334
12334
  types: "lib/index.d.ts",
@@ -85462,14 +85462,18 @@ var require_connection3 = __commonJS({
85462
85462
  return result.records[0];
85463
85463
  }
85464
85464
  /**
85465
- * Executes a get request on the baseUrl to force an auth refresh
85466
- * Useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes
85465
+ * Executes a HEAD request on the baseUrl to force an auth refresh.
85466
+ * This is useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes.
85467
+ *
85468
+ * This method issues a request using the current access token to check if it is still valid.
85469
+ * If the request returns 200, no refresh happens, and we keep the token.
85470
+ * If it returns 401, jsforce will request a new token and set it in the connection instance.
85467
85471
  */
85468
85472
  async refreshAuth() {
85469
85473
  this.logger.debug("Refreshing auth for org.");
85470
85474
  const requestInfo = {
85471
85475
  url: this.baseUrl(),
85472
- method: "GET"
85476
+ method: "HEAD"
85473
85477
  };
85474
85478
  await this.request(requestInfo);
85475
85479
  }
@@ -108094,13 +108098,18 @@ var require_org = __commonJS({
108094
108098
  }
108095
108099
  }
108096
108100
  /**
108097
- * Refreshes the auth for this org's instance by calling HTTP GET on the baseUrl of the connection object.
108101
+ * Executes a HEAD request on the baseUrl to force an auth refresh.
108102
+ * This is useful for the raw methods (request, requestRaw) that use the accessToken directly and don't handle refreshes.
108103
+ *
108104
+ * This method issues a request using the current access token to check if it is still valid.
108105
+ * If the request returns 200, no refresh happens, and we keep the token.
108106
+ * If it returns 401, jsforce will request a new token and set it in the connection instance.
108098
108107
  */
108099
108108
  async refreshAuth() {
108100
108109
  this.logger.debug("Refreshing auth for org.");
108101
108110
  const requestInfo = {
108102
108111
  url: this.getConnection().baseUrl(),
108103
- method: "GET"
108112
+ method: "HEAD"
108104
108113
  };
108105
108114
  await this.getConnection().request(requestInfo);
108106
108115
  }
@@ -108952,7 +108961,7 @@ var require_authInfo = __commonJS({
108952
108961
  * @param sfdxAuthUrl
108953
108962
  */
108954
108963
  static parseSfdxAuthUrl(sfdxAuthUrl) {
108955
- const match = sfdxAuthUrl.match(/^force:\/\/([a-zA-Z0-9._-]+={0,2}):([a-zA-Z0-9._-]*={0,2}):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/);
108964
+ const match = sfdxAuthUrl.match(/^force:\/\/([a-zA-Z0-9._-]+={0,2}):([a-zA-Z0-9._-]*={0,2}):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9:._-]+)/);
108956
108965
  if (!match) {
108957
108966
  throw new sfError_12.SfError(messages.getMessage("invalidSfdxAuthUrlError"), "INVALID_SFDX_AUTH_URL");
108958
108967
  }
@@ -109205,14 +109214,11 @@ var require_authInfo = __commonJS({
109205
109214
  * **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)
109206
109215
  */
109207
109216
  getSfdxAuthUrl() {
109208
- const decryptedFields = this.getFields(true);
109209
- const instanceUrl = (0, ts_types_1.ensure)(decryptedFields.instanceUrl, "undefined instanceUrl").replace(/^https?:\/\//, "");
109210
- let sfdxAuthUrl = "force://";
109211
- if (decryptedFields.clientId) {
109212
- sfdxAuthUrl += `${decryptedFields.clientId}:${decryptedFields.clientSecret ?? ""}:`;
109213
- }
109214
- sfdxAuthUrl += `${(0, ts_types_1.ensure)(decryptedFields.refreshToken, "undefined refreshToken")}@${instanceUrl}`;
109215
- return sfdxAuthUrl;
109217
+ const { clientId, clientSecret, refreshToken, instanceUrl } = this.getFields(true);
109218
+ const url = new URL((0, ts_types_1.ensure)(instanceUrl, "undefined instanceUrl")).host;
109219
+ const clientIdAndSecret = clientId ? `${clientId}:${clientSecret ?? ""}` : "";
109220
+ const token = (0, ts_types_1.ensure)(refreshToken, "undefined refreshToken");
109221
+ return `force://${clientIdAndSecret}:${token}@${url}`;
109216
109222
  }
109217
109223
  /**
109218
109224
  * Convenience function to handle typical side effects encountered when dealing with an AuthInfo.
@@ -109386,13 +109392,14 @@ var require_authInfo = __commonJS({
109386
109392
  }
109387
109393
  // A callback function for a connection to refresh an access token. This is used
109388
109394
  // both for a JWT connection and an OAuth connection.
109389
- async refreshFn(conn, callback) {
109395
+ async refreshFn(_conn, callback) {
109390
109396
  this.logger.info("Access token has expired. Updating...");
109391
109397
  try {
109392
109398
  const fields = this.getFields(true);
109393
109399
  await this.initAuthOptions(fields);
109394
109400
  await this.save();
109395
- return await callback(null, fields.accessToken);
109401
+ const { accessToken } = this.getFields(true);
109402
+ return await callback(null, accessToken);
109396
109403
  } catch (err) {
109397
109404
  const error = err;
109398
109405
  if (error?.message?.includes("Data Not Available")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core-bundle",
3
- "version": "8.7.0",
3
+ "version": "8.8.1",
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",