@salesforce/core-bundle 8.17.0 → 8.18.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/index.d.ts CHANGED
@@ -369,7 +369,7 @@ declare module '@salesforce/core-bundle/config/configAggregator' {
369
369
  */
370
370
  export class ConfigAggregator extends AsyncOptionalCreatable<ConfigAggregator.Options> {
371
371
  protected static encrypted: boolean;
372
- protected static instance: AsyncOptionalCreatable | undefined;
372
+ protected static instances: Map<string, ConfigAggregator>;
373
373
  private static readonly mutex;
374
374
  private allowedProperties;
375
375
  private readonly localConfig?;
@@ -382,20 +382,22 @@ declare module '@salesforce/core-bundle/config/configAggregator' {
382
382
  */
383
383
  constructor(options?: ConfigAggregator.Options);
384
384
  private get config();
385
+ static create<T extends ConfigAggregator>(this: new (options?: ConfigAggregator.Options) => T, options?: ConfigAggregator.Options): Promise<T>;
385
386
  static create<P extends ConfigAggregator.Options, T extends AsyncOptionalCreatable<P>>(this: new (options?: P) => T, options?: P): Promise<T>;
386
387
  /**
387
388
  * Clear the cache to force reading from disk.
389
+ * If no projectPath is provided, all instances will be cleared.
388
390
  *
389
391
  * *NOTE: Only call this method if you must and you know what you are doing.*
390
392
  */
391
- static clearInstance(): Promise<void>;
393
+ static clearInstance(projectPath?: string): Promise<void>;
392
394
  /**
393
395
  * Get the info for a given key. If the ConfigAggregator was not asynchronously created OR
394
396
  * the {@link ConfigAggregator.reload} was not called, the config value may be encrypted.
395
397
  *
396
398
  * @param key The config key.
397
399
  */
398
- static getValue(key: string): ConfigInfo;
400
+ static getValue(key: string, projectPath?: string): ConfigInfo;
399
401
  /**
400
402
  * Get the static ConfigAggregator instance. If one doesn't exist, one will be created with
401
403
  * the **encrypted** config values. Encrypted config values need to be resolved
@@ -535,6 +537,8 @@ declare module '@salesforce/core-bundle/config/configAggregator' {
535
537
  }
536
538
  type Options = {
537
539
  customConfigMeta?: ConfigPropertyMeta[];
540
+ /** an absolute path to the project root */
541
+ projectPath?: string;
538
542
  };
539
543
  }
540
544
 
@@ -2667,6 +2671,8 @@ declare module '@salesforce/core-bundle/org/authInfo' {
2667
2671
  getFields(decrypt?: boolean): Readonly<AuthFields>;
2668
2672
  /**
2669
2673
  * Get the org front door (used for web based oauth flows)
2674
+ *
2675
+ * @deprecated Will be removed in the next major version. Use the `Org.getFrontDoorUrl()` method instead.
2670
2676
  */
2671
2677
  getOrgFrontDoorUrl(): string;
2672
2678
  /**
@@ -3225,6 +3231,39 @@ declare module '@salesforce/core-bundle/org/org' {
3225
3231
  * @ignore
3226
3232
  */
3227
3233
  constructor(options?: Org.Options);
3234
+ /**
3235
+ * Generate a URL to a metadata UI builder/setup section in an org.
3236
+ *
3237
+ * Bot: open in Agentforce Builder
3238
+ * ApexPage: opens page
3239
+ * Flow: open in Flow Builder
3240
+ * FlexiPage: open in Lightning App Builder
3241
+ * CustomObject: open in Object Manager
3242
+ * ApexClass: open in Setup -> Apex Classes UI
3243
+ *
3244
+ * if you pass any other metadata type you'll get a path to Lightning App Builder
3245
+ *
3246
+ * @example
3247
+ * // use SDR resolver:
3248
+ * import { MetadataResolver } from '@salesforce/source-deploy-retrieve';
3249
+ *
3250
+ * const metadataResolver = new MetadataResolver();
3251
+ * const components = metadataResolver.getComponentsFromPath(filePath);
3252
+ * const typeName = components[0]?.type?.name;
3253
+ *
3254
+ * const metadataBuilderUrl = await org.getMetadataUIURL(typeName, filePath);
3255
+ *
3256
+ * @typeName Bot | ApexPage | Flow | FlexiPage | CustomObject | ApexClass
3257
+ * @file Absolute file path to the metadata file
3258
+ */
3259
+ getMetadataUIURL(typeName: string, file: string): Promise<string>;
3260
+ /**
3261
+ * Get a Frontdoor URL
3262
+ *
3263
+ * This uses the UI Bridge API to generate a single-use Frontdoor URL:
3264
+ * https://help.salesforce.com/s/articleView?id=xcloud.frontdoor_singleaccess.htm&type=5
3265
+ */
3266
+ getFrontDoorUrl(redirectUri?: string): Promise<string>;
3228
3267
  /**
3229
3268
  * create a sandbox from a production org
3230
3269
  * 'this' needs to be a production org with sandbox licenses available
package/lib/index.js CHANGED
@@ -8364,19 +8364,19 @@ var require_internal3 = __commonJS({
8364
8364
  var fs = __importStar2(require("node:fs"));
8365
8365
  var node_path_1 = require("node:path");
8366
8366
  var messages_12 = require_messages();
8367
- var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
8367
+ var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "%s does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
8368
8368
  exports2.SFDX_PROJECT_JSON = "sfdx-project.json";
8369
8369
  async function resolveProjectPath(dir = process.cwd()) {
8370
8370
  const projectPath = await exports2.traverse.forFile(dir, exports2.SFDX_PROJECT_JSON);
8371
8371
  if (!projectPath) {
8372
- throw messages.createError("invalidProjectWorkspace");
8372
+ throw messages.createError("invalidProjectWorkspace", [dir]);
8373
8373
  }
8374
8374
  return projectPath;
8375
8375
  }
8376
8376
  function resolveProjectPathSync(dir = process.cwd()) {
8377
8377
  const projectPath = exports2.traverse.forFileSync(dir, exports2.SFDX_PROJECT_JSON);
8378
8378
  if (!projectPath) {
8379
- throw messages.createError("invalidProjectWorkspace");
8379
+ throw messages.createError("invalidProjectWorkspace", [dir]);
8380
8380
  }
8381
8381
  return projectPath;
8382
8382
  }
@@ -12336,7 +12336,7 @@ var require_package2 = __commonJS({
12336
12336
  "package.json"(exports2, module2) {
12337
12337
  module2.exports = {
12338
12338
  name: "@salesforce/core-bundle",
12339
- version: "8.17.0",
12339
+ version: "8.18.1",
12340
12340
  description: "Core libraries to interact with SFDX projects, orgs, and APIs.",
12341
12341
  main: "lib/index",
12342
12342
  types: "lib/index.d.ts",
@@ -12373,7 +12373,7 @@ var require_package2 = __commonJS({
12373
12373
  "messageTransformer/messageTransformer.ts"
12374
12374
  ],
12375
12375
  dependencies: {
12376
- "@jsforce/jsforce-node": "^3.8.2",
12376
+ "@jsforce/jsforce-node": "^3.9.1",
12377
12377
  "@salesforce/kit": "^3.2.2",
12378
12378
  "@salesforce/schemas": "^1.9.0",
12379
12379
  "@salesforce/ts-types": "^2.0.10",
@@ -33136,7 +33136,7 @@ var require_VERSION = __commonJS({
33136
33136
  "node_modules/@jsforce/jsforce-node/lib/VERSION.js"(exports2) {
33137
33137
  "use strict";
33138
33138
  Object.defineProperty(exports2, "__esModule", { value: true });
33139
- exports2.default = "3.8.2";
33139
+ exports2.default = "3.9.1";
33140
33140
  }
33141
33141
  });
33142
33142
 
@@ -46311,6 +46311,49 @@ var require_connection = __commonJS({
46311
46311
  * @param options
46312
46312
  */
46313
46313
  async upsert(type2, records, extIdField, options = {}) {
46314
+ return Array.isArray(records) ? (
46315
+ // check the version whether SObject collection API is supported (46.0)
46316
+ this._ensureVersion(46) ? this._upsertMany(type2, records, extIdField, options) : this._upsertParallel(type2, records, extIdField, options)
46317
+ ) : this._upsertParallel(type2, records, extIdField, options);
46318
+ }
46319
+ /** @private */
46320
+ async _upsertMany(type2, records, extIdField, options = {}) {
46321
+ if (records.length === 0) {
46322
+ return [];
46323
+ }
46324
+ if (records.length > MAX_DML_COUNT && options.allowRecursive) {
46325
+ return [
46326
+ ...await this._upsertMany(type2, records.slice(0, MAX_DML_COUNT), extIdField, options),
46327
+ ...await this._upsertMany(type2, records.slice(MAX_DML_COUNT), extIdField, options)
46328
+ ];
46329
+ }
46330
+ const _records = records.map((recordItem) => {
46331
+ const { [extIdField]: extId, type: recordType, attributes, ...rec } = recordItem;
46332
+ const sobjectType = recordType || attributes?.type || type2;
46333
+ if (!extId) {
46334
+ throw new Error("External ID is not found in record.");
46335
+ }
46336
+ if (!sobjectType) {
46337
+ throw new Error("No SObject Type defined in record");
46338
+ }
46339
+ return { [extIdField]: extId, attributes: { type: sobjectType }, ...rec };
46340
+ });
46341
+ const url = [this._baseUrl(), "composite", "sobjects", type2, extIdField].join("/");
46342
+ return this.request({
46343
+ method: "PATCH",
46344
+ url,
46345
+ body: JSON.stringify({
46346
+ allOrNone: options.allOrNone || false,
46347
+ records: _records
46348
+ }),
46349
+ headers: {
46350
+ ...options.headers || {},
46351
+ "content-type": "application/json"
46352
+ }
46353
+ });
46354
+ }
46355
+ /** @private */
46356
+ async _upsertParallel(type2, records, extIdField, options = {}) {
46314
46357
  const isArray = Array.isArray(records);
46315
46358
  const _records = Array.isArray(records) ? records : [records];
46316
46359
  if (_records.length > this._maxRequest) {
@@ -84211,7 +84254,7 @@ var require_orgConfigProperties = __commonJS({
84211
84254
  var messages_12 = require_messages();
84212
84255
  var sfdcUrl_12 = require_sfdcUrl();
84213
84256
  var sfdc_1 = require_sfdc();
84214
- var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
84257
+ var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "%s does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
84215
84258
  var OrgConfigProperties;
84216
84259
  (function(OrgConfigProperties2) {
84217
84260
  OrgConfigProperties2["TARGET_ORG"] = "target-org";
@@ -84343,7 +84386,7 @@ var require_config = __commonJS({
84343
84386
  var lifecycleEvents_12 = require_lifecycleEvents();
84344
84387
  var configFile_12 = require_configFile();
84345
84388
  var lwwMap_1 = require_lwwMap();
84346
- var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
84389
+ var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "%s does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
84347
84390
  var SFDX_CONFIG_FILE_NAME = "sfdx-config.json";
84348
84391
  var CONFIG_FILE_NAME = "config.json";
84349
84392
  var SfConfigProperties;
@@ -84757,6 +84800,7 @@ var require_configAggregator = __commonJS({
84757
84800
  "use strict";
84758
84801
  Object.defineProperty(exports2, "__esModule", { value: true });
84759
84802
  exports2.ConfigAggregator = void 0;
84803
+ var node_path_1 = require("node:path");
84760
84804
  var kit_1 = require_lib2();
84761
84805
  var ts_types_1 = require_lib();
84762
84806
  var messages_12 = require_messages();
@@ -84764,10 +84808,10 @@ var require_configAggregator = __commonJS({
84764
84808
  var mutex_1 = require_mutex();
84765
84809
  var envVars_12 = require_envVars();
84766
84810
  var config_12 = require_config();
84767
- var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
84811
+ var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "%s does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
84768
84812
  var ConfigAggregator = class _ConfigAggregator extends kit_1.AsyncOptionalCreatable {
84769
84813
  static encrypted = true;
84770
- static instance;
84814
+ static instances = /* @__PURE__ */ new Map();
84771
84815
  static mutex = new mutex_1.Mutex();
84772
84816
  // Initialized in loadProperties
84773
84817
  allowedProperties;
@@ -84782,7 +84826,10 @@ var require_configAggregator = __commonJS({
84782
84826
  constructor(options) {
84783
84827
  super(options ?? {});
84784
84828
  try {
84785
- this.localConfig = new config_12.Config(config_12.Config.getDefaultOptions(false));
84829
+ this.localConfig = new config_12.Config({
84830
+ ...config_12.Config.getDefaultOptions(false),
84831
+ ...options?.projectPath ? { rootFolder: options.projectPath } : {}
84832
+ });
84786
84833
  } catch (err) {
84787
84834
  if (err.name !== "InvalidProjectWorkspaceError") {
84788
84835
  throw err;
@@ -84794,32 +84841,38 @@ var require_configAggregator = __commonJS({
84794
84841
  get config() {
84795
84842
  return this.resolveProperties(this.globalConfig.getContents(), this.localConfig?.getContents());
84796
84843
  }
84797
- // Use typing from AsyncOptionalCreatable to support extending ConfigAggregator.
84798
- // We really don't want ConfigAggregator extended but typescript doesn't support a final.
84799
84844
  static async create(options) {
84800
84845
  return _ConfigAggregator.mutex.lock(async () => {
84801
- let config = _ConfigAggregator.instance;
84802
- if (!config) {
84803
- config = _ConfigAggregator.instance = new this(options);
84804
- await config.init();
84846
+ const projectPath = options?.projectPath ? (0, node_path_1.resolve)(options.projectPath) : process.cwd();
84847
+ if (!_ConfigAggregator.instances.has(projectPath)) {
84848
+ const agg = new this(options);
84849
+ _ConfigAggregator.instances.set(projectPath, agg);
84850
+ await agg.init();
84805
84851
  }
84852
+ const config = _ConfigAggregator.instances.get(projectPath);
84806
84853
  if (_ConfigAggregator.encrypted) {
84807
84854
  await config.loadProperties();
84808
84855
  }
84809
84856
  if (options?.customConfigMeta) {
84810
84857
  config_12.Config.addAllowedProperties(options.customConfigMeta);
84811
84858
  }
84812
- return _ConfigAggregator.instance;
84859
+ return config;
84813
84860
  });
84814
84861
  }
84815
84862
  /**
84816
84863
  * Clear the cache to force reading from disk.
84864
+ * If no projectPath is provided, all instances will be cleared.
84817
84865
  *
84818
84866
  * *NOTE: Only call this method if you must and you know what you are doing.*
84819
84867
  */
84820
- static async clearInstance() {
84868
+ static async clearInstance(projectPath) {
84821
84869
  return _ConfigAggregator.mutex.lock(() => {
84822
- _ConfigAggregator.instance = void 0;
84870
+ if (projectPath) {
84871
+ const normalizedPath = (0, node_path_1.resolve)(projectPath);
84872
+ _ConfigAggregator.instances.delete(normalizedPath);
84873
+ } else {
84874
+ _ConfigAggregator.instances.clear();
84875
+ }
84823
84876
  _ConfigAggregator.encrypted = true;
84824
84877
  });
84825
84878
  }
@@ -84829,22 +84882,22 @@ var require_configAggregator = __commonJS({
84829
84882
  *
84830
84883
  * @param key The config key.
84831
84884
  */
84832
- static getValue(key) {
84833
- return this.getInstance().getInfo(key);
84885
+ static getValue(key, projectPath) {
84886
+ return this.getInstance(projectPath ?? process.cwd()).getInfo(key);
84834
84887
  }
84835
84888
  /**
84836
84889
  * Get the static ConfigAggregator instance. If one doesn't exist, one will be created with
84837
84890
  * the **encrypted** config values. Encrypted config values need to be resolved
84838
84891
  * asynchronously by calling {@link ConfigAggregator.reload}
84839
84892
  */
84840
- // Use typing from AsyncOptionalCreatable to support extending ConfigAggregator.
84841
- // We really don't want ConfigAggregator extended but typescript doesn't support a final.
84842
- static getInstance() {
84843
- if (!_ConfigAggregator.instance) {
84844
- _ConfigAggregator.instance = new this();
84845
- _ConfigAggregator.instance.loadPropertiesSync();
84893
+ static getInstance(projectPath = process.cwd()) {
84894
+ const normalizedPath = (0, node_path_1.resolve)(projectPath);
84895
+ if (!_ConfigAggregator.instances.has(normalizedPath)) {
84896
+ const instance = new _ConfigAggregator({ projectPath: normalizedPath });
84897
+ _ConfigAggregator.instances.set(normalizedPath, instance);
84898
+ instance.loadPropertiesSync();
84846
84899
  }
84847
- return _ConfigAggregator.instance;
84900
+ return _ConfigAggregator.instances.get(normalizedPath);
84848
84901
  }
84849
84902
  /**
84850
84903
  * Initialize this instances async dependencies.
@@ -85072,13 +85125,12 @@ var require_configAggregator = __commonJS({
85072
85125
  if (value)
85073
85126
  this.envVars[key] = value;
85074
85127
  }
85075
- const configs = [globalConfig];
85076
- if (localConfig) {
85077
- configs.push(localConfig);
85078
- }
85079
- configs.push(this.envVars);
85080
- const json = {};
85081
- return configs.filter(ts_types_1.isJsonMap).reduce((acc, el) => (0, kit_1.merge)(acc, el), json);
85128
+ return [
85129
+ globalConfig,
85130
+ ...localConfig ? [localConfig] : [],
85131
+ // We might not be in a project workspace
85132
+ this.envVars
85133
+ ].filter(ts_types_1.isJsonMap).reduce((acc, el) => (0, kit_1.merge)(acc, el), {});
85082
85134
  }
85083
85135
  };
85084
85136
  exports2.ConfigAggregator = ConfigAggregator;
@@ -93352,7 +93404,7 @@ var require_sfProject = __commonJS({
93352
93404
  var sfError_12 = require_sfError();
93353
93405
  var messages_12 = require_messages();
93354
93406
  var findUppercaseKeys_1 = require_findUppercaseKeys();
93355
- var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "This directory does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
93407
+ var messages = new messages_12.Messages("@salesforce/core-bundle", "config", /* @__PURE__ */ new Map([["unknownConfigKey", "Unknown config name: %s."], ["deprecatedConfigKey", "Deprecated config name: %s. Please use %s instead."], ["invalidWrite", "The writeSync method is not allowed on SfdxConfig. Use the async write method instead."], ["invalidConfigValue", "Invalid config value: %s."], ["invalidInstanceUrl", "Specify a valid Salesforce instance URL."], ["invalidApiVersion", "Specify a valid Salesforce API version, for example, 42.0."], ["invalidCustomOrgMetadataTemplates", "Specify a valid repository URL or directory for the custom org metadata templates."], ["invalidIsvDebuggerSid", "Specify a valid Debugger SID."], ["invalidIsvDebuggerUrl", "Specify a valid Debugger URL."], ["invalidNumberConfigValue", "Specify a valid positive integer, for example, 150000."], ["invalidBooleanConfigValue", "The config value can only be set to true or false."], ["invalidProjectWorkspace", "%s does not contain a valid Salesforce DX project."], ["schemaValidationError", 'The config file "%s" is not schema valid.\nDue to: %s'], ["schemaValidationError.actions", ["Fix the invalid entries at %s."]], ["missingDefaultPath", 'In sfdx-project.json, be sure to specify which package directory (path) is the default. Example: `[{ "path": "packageDirectory1", "default": true }, { "path": "packageDirectory2" }]`'], ["missingPackageDirectory", 'The path "%s", specified in sfdx-project.json, does not exist. Be sure this directory is included in your project root.'], ["invalidPackageDirectory", 'The path "%s", specified in sfdx-project.json, must be indicated as a relative path to the project root.'], ["multipleDefaultPaths", "In sfdx-project.json, indicate only one package directory (path) as the default."], ["singleNonDefaultPackage", 'The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.'], ["target-org", "Username or alias of the org that all commands run against by default. (sf only)"], ["target-dev-hub", "Username or alias of your default Dev Hub org. (sf only)"], ["defaultUsername", "Username or alias of the org that all commands run against by default. (sfdx only)"], ["defaultDevHubUsername", "Username or alias of your default Dev Hub org. (sfdx only)"], ["isvDebuggerSid", "ISV debugger SID (sfdx only)"], ["isvDebuggerUrl", "ISV debugger URL (sfdx only)"], ["org-isv-debugger-sid", "ISV debugger SID."], ["org-isv-debugger-url", "ISV debugger URL."], ["apiVersion", "API version of your project. Default: API version of your Dev Hub org. (sfdx only)"], ["org-api-version", "API version of your project. Default: API version of your Dev Hub org."], ["disableTelemetry", "Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)"], ["disable-telemetry", "Disables the collection of usage and user environment information, etc. Default: false."], ["maxQueryLimit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)"], ["org-max-query-limit", "Maximum number of Salesforce records returned by a CLI command. Default: 10,000."], ["restDeploy", "Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)"], ["instanceUrl", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)"], ["org-instance-url", "URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com."], ["customOrgMetadataTemplates", "A valid repository URL or directory for the custom org metadata templates."], ["org-custom-metadata-templates", "A valid repository URL or directory for the custom org metadata templates."], ["org-capitalize-record-types", "Whether record types are capitalized on scratch org creation."], ["invalidId", "The given id %s is not a valid 15 or 18 character Salesforce ID."]]));
93356
93408
  var SfProjectJson = class _SfProjectJson extends configFile_12.ConfigFile {
93357
93409
  /** json properties that are uppercase, or allow uppercase keys inside them */
93358
93410
  static BLOCKLIST = ["packageAliases", "plugins"];
@@ -107816,10 +107868,13 @@ var require_org = __commonJS({
107816
107868
  __setModuleDefault2(result, mod);
107817
107869
  return result;
107818
107870
  };
107871
+ var __importDefault3 = exports2 && exports2.__importDefault || function(mod) {
107872
+ return mod && mod.__esModule ? mod : { "default": mod };
107873
+ };
107819
107874
  Object.defineProperty(exports2, "__esModule", { value: true });
107820
107875
  exports2.Org = exports2.SandboxEvents = exports2.OrgTypes = void 0;
107821
107876
  exports2.sandboxIsResumable = sandboxIsResumable;
107822
- var node_path_1 = require("node:path");
107877
+ var node_path_1 = __importDefault3(require("node:path"));
107823
107878
  var fs = __importStar2(require("node:fs"));
107824
107879
  var kit_1 = require_lib2();
107825
107880
  var ts_types_1 = require_lib();
@@ -107839,7 +107894,7 @@ var require_org = __commonJS({
107839
107894
  var authInfo_12 = require_authInfo();
107840
107895
  var scratchOrgCreate_12 = require_scratchOrgCreate();
107841
107896
  var orgConfigProperties_12 = require_orgConfigProperties();
107842
- var messages = new messages_12.Messages("@salesforce/core-bundle", "org", /* @__PURE__ */ new Map([["notADevHub", "The provided dev hub username %s is not a valid dev hub."], ["noUsernameFound", "No username found."], ["noDevHubFound", "Unable to associate this scratch org with a DevHub."], ["deleteOrgHubError", "The Dev Hub org cannot be deleted."], ["insufficientAccessToDelete", "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin."], ["scratchOrgNotFound", "Attempting to delete an expired or deleted org"], ["sandboxDeleteFailed", "The sandbox org deletion failed with a result of %s."], ["sandboxNotFound", "We can't find a SandboxProcess for the sandbox %s."], ["sandboxInfoCreateFailed", "The sandbox org creation failed with a result of %s."], ["sandboxInfoRefreshFailed", "The sandbox org refresh failed with a result of %s."], ["missingAuthUsername", "The sandbox %s does not have an authorized username."], ["orgPollingTimeout", "Sandbox status is %s; timed out waiting for completion."], ["NotFoundOnDevHub", "The scratch org does not belong to the dev hub username %s."], ["AuthInfoOrgIdUndefined", "AuthInfo orgId is undefined."], ["sandboxCreateNotComplete", "The sandbox creation has not completed."], ["SandboxProcessNotFoundBySandboxName", "We can't find a SandboxProcess with the SandboxName %s."], ["MultiSandboxProcessNotFoundBySandboxName", "We found more than one SandboxProcess with the SandboxName %s."], ["sandboxNotResumable", "The sandbox %s cannot resume with status of %s."]]));
107897
+ var messages = new messages_12.Messages("@salesforce/core-bundle", "org", /* @__PURE__ */ new Map([["notADevHub", "The provided dev hub username %s is not a valid dev hub."], ["noUsernameFound", "No username found."], ["noDevHubFound", "Unable to associate this scratch org with a DevHub."], ["deleteOrgHubError", "The Dev Hub org cannot be deleted."], ["insufficientAccessToDelete", "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin."], ["scratchOrgNotFound", "Attempting to delete an expired or deleted org"], ["sandboxDeleteFailed", "The sandbox org deletion failed with a result of %s."], ["sandboxNotFound", "We can't find a SandboxProcess for the sandbox %s."], ["sandboxInfoCreateFailed", "The sandbox org creation failed with a result of %s."], ["sandboxInfoRefreshFailed", "The sandbox org refresh failed with a result of %s."], ["missingAuthUsername", "The sandbox %s does not have an authorized username."], ["orgPollingTimeout", "Sandbox status is %s; timed out waiting for completion."], ["NotFoundOnDevHub", "The scratch org does not belong to the dev hub username %s."], ["AuthInfoOrgIdUndefined", "AuthInfo orgId is undefined."], ["sandboxCreateNotComplete", "The sandbox creation has not completed."], ["SandboxProcessNotFoundBySandboxName", "We can't find a SandboxProcess with the SandboxName %s."], ["MultiSandboxProcessNotFoundBySandboxName", "We found more than one SandboxProcess with the SandboxName %s."], ["sandboxNotResumable", "The sandbox %s cannot resume with status of %s."], ["FrontdoorURLError", "Failed to generate a frontdoor URL."], ["FlowIdNotFound", "ID not found for Flow %s."], ["CustomObjectIdNotFound", "ID not found for custom object %s."], ["ApexClassIdNotFound", "ID not found for Apex class %s."]]));
107843
107898
  var OrgTypes;
107844
107899
  (function(OrgTypes2) {
107845
107900
  OrgTypes2["Scratch"] = "scratch";
@@ -107906,6 +107961,105 @@ var require_org = __commonJS({
107906
107961
  super(options);
107907
107962
  this.options = options ?? {};
107908
107963
  }
107964
+ /**
107965
+ * Generate a URL to a metadata UI builder/setup section in an org.
107966
+ *
107967
+ * Bot: open in Agentforce Builder
107968
+ * ApexPage: opens page
107969
+ * Flow: open in Flow Builder
107970
+ * FlexiPage: open in Lightning App Builder
107971
+ * CustomObject: open in Object Manager
107972
+ * ApexClass: open in Setup -> Apex Classes UI
107973
+ *
107974
+ * if you pass any other metadata type you'll get a path to Lightning App Builder
107975
+ *
107976
+ * @example
107977
+ * // use SDR resolver:
107978
+ * import { MetadataResolver } from '@salesforce/source-deploy-retrieve';
107979
+ *
107980
+ * const metadataResolver = new MetadataResolver();
107981
+ * const components = metadataResolver.getComponentsFromPath(filePath);
107982
+ * const typeName = components[0]?.type?.name;
107983
+ *
107984
+ * const metadataBuilderUrl = await org.getMetadataUIURL(typeName, filePath);
107985
+ *
107986
+ * @typeName Bot | ApexPage | Flow | FlexiPage | CustomObject | ApexClass
107987
+ * @file Absolute file path to the metadata file
107988
+ */
107989
+ async getMetadataUIURL(typeName, file) {
107990
+ const botFileNameToId = async (conn, filePath) => (await conn.singleRecordQuery(`SELECT id FROM BotDefinition WHERE DeveloperName='${node_path_1.default.basename(filePath, ".bot-meta.xml")}'`)).Id;
107991
+ const flexiPageFilenameToId = async (conn, filePath) => (await conn.singleRecordQuery(`SELECT id FROM flexipage WHERE DeveloperName='${node_path_1.default.basename(filePath, ".flexipage-meta.xml")}'`, { tooling: true })).Id;
107992
+ const flowFileNameToId = async (conn, filePath) => {
107993
+ try {
107994
+ const flow = await conn.singleRecordQuery(`SELECT DurableId FROM FlowVersionView WHERE FlowDefinitionView.ApiName = '${node_path_1.default.basename(filePath, ".flow-meta.xml")}' ORDER BY VersionNumber DESC LIMIT 1`);
107995
+ return flow.DurableId;
107996
+ } catch (error) {
107997
+ throw messages.createError("FlowIdNotFound", [filePath]);
107998
+ }
107999
+ };
108000
+ const customObjectFileNameToId = async (conn, filePath) => {
108001
+ try {
108002
+ const customObject = await conn.singleRecordQuery(`SELECT Id FROM CustomObject WHERE DeveloperName = '${node_path_1.default.basename(filePath.replace(/__c/g, ""), ".object-meta.xml")}'`, {
108003
+ tooling: true
108004
+ });
108005
+ return customObject.Id;
108006
+ } catch (error) {
108007
+ throw messages.createError("CustomObjectIdNotFound", [filePath]);
108008
+ }
108009
+ };
108010
+ const apexClassFileNameToId = async (conn, filePath) => {
108011
+ try {
108012
+ const apexClass = await conn.singleRecordQuery(`SELECT Id FROM ApexClass WHERE Name = '${node_path_1.default.basename(filePath, ".cls")}'`, {
108013
+ tooling: true
108014
+ });
108015
+ return apexClass.Id;
108016
+ } catch (error) {
108017
+ throw messages.createError("ApexClassIdNotFound", [filePath]);
108018
+ }
108019
+ };
108020
+ let redirectUri = "";
108021
+ switch (typeName) {
108022
+ case "ApexClass":
108023
+ redirectUri = `lightning/setup/ApexClasses/page?address=%2F${await apexClassFileNameToId(this.connection, file)}`;
108024
+ break;
108025
+ case "CustomObject":
108026
+ redirectUri = `lightning/setup/ObjectManager/${await customObjectFileNameToId(this.connection, file)}/Details/view`;
108027
+ break;
108028
+ case "Bot":
108029
+ redirectUri = `/AiCopilot/copilotStudio.app#/copilot/builder?copilotId=${await botFileNameToId(this.connection, file)}`;
108030
+ break;
108031
+ case "ApexPage":
108032
+ redirectUri = `/apex/${node_path_1.default.basename(file).replace(".page-meta.xml", "").replace(".page", "")}`;
108033
+ break;
108034
+ case "Flow":
108035
+ redirectUri = `/builder_platform_interaction/flowBuilder.app?flowId=${await flowFileNameToId(this.connection, file)}`;
108036
+ break;
108037
+ case "FlexiPage":
108038
+ redirectUri = `/visualEditor/appBuilder.app?pageId=${await flexiPageFilenameToId(this.connection, file)}`;
108039
+ break;
108040
+ default:
108041
+ redirectUri = "/lightning/setup/FlexiPageList/home";
108042
+ break;
108043
+ }
108044
+ return this.getFrontDoorUrl(redirectUri);
108045
+ }
108046
+ /**
108047
+ * Get a Frontdoor URL
108048
+ *
108049
+ * This uses the UI Bridge API to generate a single-use Frontdoor URL:
108050
+ * https://help.salesforce.com/s/articleView?id=xcloud.frontdoor_singleaccess.htm&type=5
108051
+ */
108052
+ async getFrontDoorUrl(redirectUri) {
108053
+ await this.refreshAuth();
108054
+ const singleAccessUrl = new URL("/services/oauth2/singleaccess", this.connection.instanceUrl);
108055
+ if (redirectUri) {
108056
+ singleAccessUrl.searchParams.append("redirect_uri", redirectUri);
108057
+ }
108058
+ const response = await this.connection.requestGet(singleAccessUrl.toString());
108059
+ if (response.frontdoor_uri)
108060
+ return response.frontdoor_uri;
108061
+ throw new sfError_12.SfError(messages.getMessage("FrontdoorURLError")).setData(response);
108062
+ }
107909
108063
  /**
107910
108064
  * create a sandbox from a production org
107911
108065
  * 'this' needs to be a production org with sandbox licenses available
@@ -108629,7 +108783,7 @@ var require_org = __commonJS({
108629
108783
  }
108630
108784
  async getLocalDataDir(orgDataPath) {
108631
108785
  const rootFolder = await config_12.Config.resolveRootFolder(false);
108632
- return (0, node_path_1.join)(rootFolder, global_12.Global.SFDX_STATE_FOLDER, orgDataPath ? orgDataPath : "orgs");
108786
+ return node_path_1.default.join(rootFolder, global_12.Global.SFDX_STATE_FOLDER, orgDataPath ? orgDataPath : "orgs");
108633
108787
  }
108634
108788
  /**
108635
108789
  * Gets the sandboxProcessObject and then polls for it to complete.
@@ -109007,7 +109161,7 @@ var require_org = __commonJS({
109007
109161
  async removeSourceTrackingFiles() {
109008
109162
  try {
109009
109163
  const rootFolder = await config_12.Config.resolveRootFolder(false);
109010
- await fs.promises.rm((0, node_path_1.join)(rootFolder, global_12.Global.SF_STATE_FOLDER, "orgs", this.getOrgId()), {
109164
+ await fs.promises.rm(node_path_1.default.join(rootFolder, global_12.Global.SF_STATE_FOLDER, "orgs", this.getOrgId()), {
109011
109165
  recursive: true,
109012
109166
  force: true
109013
109167
  });
@@ -109520,6 +109674,8 @@ var require_authInfo = __commonJS({
109520
109674
  }
109521
109675
  /**
109522
109676
  * Get the org front door (used for web based oauth flows)
109677
+ *
109678
+ * @deprecated Will be removed in the next major version. Use the `Org.getFrontDoorUrl()` method instead.
109523
109679
  */
109524
109680
  getOrgFrontDoorUrl() {
109525
109681
  const authFields = this.getFields(true);
@@ -122881,7 +123037,7 @@ var require_testSetup = __commonJS({
122881
123037
  testContext.configStubs = {};
122882
123038
  stateAggregator_12.StateAggregator.clearInstance();
122883
123039
  sfProject_12.SfProject.clearInstances();
122884
- delete configAggregator_12.ConfigAggregator.instance;
123040
+ configAggregator_12.ConfigAggregator.instances.clear();
122885
123041
  };
122886
123042
  exports2.restoreContext = restoreContext;
122887
123043
  exports2.unexpectedResult = new sfError_12.SfError("This code was expected to fail", "UnexpectedResult");
@@ -44,7 +44,7 @@ The config value can only be set to true or false.
44
44
 
45
45
  # invalidProjectWorkspace
46
46
 
47
- This directory does not contain a valid Salesforce DX project.
47
+ %s does not contain a valid Salesforce DX project.
48
48
 
49
49
  # schemaValidationError
50
50
 
package/messages/org.md CHANGED
@@ -69,3 +69,19 @@ We found more than one SandboxProcess with the SandboxName %s.
69
69
  # sandboxNotResumable
70
70
 
71
71
  The sandbox %s cannot resume with status of %s.
72
+
73
+ # FrontdoorURLError
74
+
75
+ Failed to generate a frontdoor URL.
76
+
77
+ # FlowIdNotFound
78
+
79
+ ID not found for Flow %s.
80
+
81
+ # CustomObjectIdNotFound
82
+
83
+ ID not found for custom object %s.
84
+
85
+ # ApexClassIdNotFound
86
+
87
+ ID not found for Apex class %s.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core-bundle",
3
- "version": "8.17.0",
3
+ "version": "8.18.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",
@@ -37,7 +37,7 @@
37
37
  "messageTransformer/messageTransformer.ts"
38
38
  ],
39
39
  "dependencies": {
40
- "@jsforce/jsforce-node": "^3.8.2",
40
+ "@jsforce/jsforce-node": "^3.9.1",
41
41
  "@salesforce/kit": "^3.2.2",
42
42
  "@salesforce/schemas": "^1.9.0",
43
43
  "@salesforce/ts-types": "^2.0.10",