@salesforce/core 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/config/config.js +1 -1
- package/lib/config/configAggregator.d.ts +7 -3
- package/lib/config/configAggregator.js +40 -29
- package/lib/org/authInfo.d.ts +2 -0
- package/lib/org/authInfo.js +2 -0
- package/lib/org/org.d.ts +33 -0
- package/lib/org/org.js +112 -4
- package/lib/org/orgConfigProperties.js +1 -1
- package/lib/sfProject.js +1 -1
- package/lib/testSetup.js +1 -1
- package/lib/util/internal.js +3 -3
- package/messages/config.md +1 -1
- package/messages/org.md +16 -0
- package/package.json +2 -2
package/lib/config/config.js
CHANGED
|
@@ -44,7 +44,7 @@ const lifecycleEvents_1 = require("../lifecycleEvents");
|
|
|
44
44
|
const configFile_1 = require("./configFile");
|
|
45
45
|
const lwwMap_1 = require("./lwwMap");
|
|
46
46
|
;
|
|
47
|
-
const messages = new messages_1.Messages('@salesforce/core', 'config', 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", "
|
|
47
|
+
const messages = new messages_1.Messages('@salesforce/core', 'config', 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."]]));
|
|
48
48
|
const SFDX_CONFIG_FILE_NAME = 'sfdx-config.json';
|
|
49
49
|
const CONFIG_FILE_NAME = 'config.json';
|
|
50
50
|
var SfConfigProperties;
|
|
@@ -55,7 +55,7 @@ export type ConfigInfo = {
|
|
|
55
55
|
*/
|
|
56
56
|
export declare class ConfigAggregator extends AsyncOptionalCreatable<ConfigAggregator.Options> {
|
|
57
57
|
protected static encrypted: boolean;
|
|
58
|
-
protected static
|
|
58
|
+
protected static instances: Map<string, ConfigAggregator>;
|
|
59
59
|
private static readonly mutex;
|
|
60
60
|
private allowedProperties;
|
|
61
61
|
private readonly localConfig?;
|
|
@@ -68,20 +68,22 @@ export declare class ConfigAggregator extends AsyncOptionalCreatable<ConfigAggre
|
|
|
68
68
|
*/
|
|
69
69
|
constructor(options?: ConfigAggregator.Options);
|
|
70
70
|
private get config();
|
|
71
|
+
static create<T extends ConfigAggregator>(this: new (options?: ConfigAggregator.Options) => T, options?: ConfigAggregator.Options): Promise<T>;
|
|
71
72
|
static create<P extends ConfigAggregator.Options, T extends AsyncOptionalCreatable<P>>(this: new (options?: P) => T, options?: P): Promise<T>;
|
|
72
73
|
/**
|
|
73
74
|
* Clear the cache to force reading from disk.
|
|
75
|
+
* If no projectPath is provided, all instances will be cleared.
|
|
74
76
|
*
|
|
75
77
|
* *NOTE: Only call this method if you must and you know what you are doing.*
|
|
76
78
|
*/
|
|
77
|
-
static clearInstance(): Promise<void>;
|
|
79
|
+
static clearInstance(projectPath?: string): Promise<void>;
|
|
78
80
|
/**
|
|
79
81
|
* Get the info for a given key. If the ConfigAggregator was not asynchronously created OR
|
|
80
82
|
* the {@link ConfigAggregator.reload} was not called, the config value may be encrypted.
|
|
81
83
|
*
|
|
82
84
|
* @param key The config key.
|
|
83
85
|
*/
|
|
84
|
-
static getValue(key: string): ConfigInfo;
|
|
86
|
+
static getValue(key: string, projectPath?: string): ConfigInfo;
|
|
85
87
|
/**
|
|
86
88
|
* Get the static ConfigAggregator instance. If one doesn't exist, one will be created with
|
|
87
89
|
* the **encrypted** config values. Encrypted config values need to be resolved
|
|
@@ -221,5 +223,7 @@ export declare namespace ConfigAggregator {
|
|
|
221
223
|
}
|
|
222
224
|
type Options = {
|
|
223
225
|
customConfigMeta?: ConfigPropertyMeta[];
|
|
226
|
+
/** an absolute path to the project root */
|
|
227
|
+
projectPath?: string;
|
|
224
228
|
};
|
|
225
229
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ConfigAggregator = void 0;
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
10
11
|
const kit_1 = require("@salesforce/kit");
|
|
11
12
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
13
|
const messages_1 = require("../messages");
|
|
@@ -15,7 +16,7 @@ const mutex_1 = require("../util/mutex");
|
|
|
15
16
|
const envVars_1 = require("./envVars");
|
|
16
17
|
const config_1 = require("./config");
|
|
17
18
|
;
|
|
18
|
-
const messages = new messages_1.Messages('@salesforce/core', 'config', 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", "
|
|
19
|
+
const messages = new messages_1.Messages('@salesforce/core', 'config', 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."]]));
|
|
19
20
|
/**
|
|
20
21
|
* Aggregate global and local project config files, as well as environment variables for
|
|
21
22
|
* `config.json`. The resolution happens in the following bottom-up order:
|
|
@@ -33,7 +34,7 @@ const messages = new messages_1.Messages('@salesforce/core', 'config', new Map([
|
|
|
33
34
|
*/
|
|
34
35
|
class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
|
|
35
36
|
static encrypted = true;
|
|
36
|
-
static
|
|
37
|
+
static instances = new Map();
|
|
37
38
|
static mutex = new mutex_1.Mutex();
|
|
38
39
|
// Initialized in loadProperties
|
|
39
40
|
allowedProperties;
|
|
@@ -50,7 +51,10 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
|
|
|
50
51
|
// Don't throw an project error with the aggregator, since it should resolve to global if
|
|
51
52
|
// there is no project.
|
|
52
53
|
try {
|
|
53
|
-
this.localConfig = new config_1.Config(
|
|
54
|
+
this.localConfig = new config_1.Config({
|
|
55
|
+
...config_1.Config.getDefaultOptions(false),
|
|
56
|
+
...(options?.projectPath ? { rootFolder: options.projectPath } : {}),
|
|
57
|
+
});
|
|
54
58
|
}
|
|
55
59
|
catch (err) {
|
|
56
60
|
if (err.name !== 'InvalidProjectWorkspaceError') {
|
|
@@ -63,15 +67,16 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
|
|
|
63
67
|
get config() {
|
|
64
68
|
return this.resolveProperties(this.globalConfig.getContents(), this.localConfig?.getContents());
|
|
65
69
|
}
|
|
66
|
-
// Use typing from AsyncOptionalCreatable to support extending ConfigAggregator.
|
|
67
|
-
// We really don't want ConfigAggregator extended but typescript doesn't support a final.
|
|
68
70
|
static async create(options) {
|
|
69
71
|
return ConfigAggregator.mutex.lock(async () => {
|
|
70
|
-
|
|
71
|
-
if (!
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const projectPath = options?.projectPath ? (0, node_path_1.resolve)(options.projectPath) : process.cwd();
|
|
73
|
+
if (!ConfigAggregator.instances.has(projectPath)) {
|
|
74
|
+
const agg = new this(options);
|
|
75
|
+
ConfigAggregator.instances.set(projectPath, agg);
|
|
76
|
+
await agg.init();
|
|
74
77
|
}
|
|
78
|
+
// we just either created the instance or got it from the cache
|
|
79
|
+
const config = ConfigAggregator.instances.get(projectPath);
|
|
75
80
|
if (ConfigAggregator.encrypted) {
|
|
76
81
|
await config.loadProperties();
|
|
77
82
|
}
|
|
@@ -79,17 +84,24 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
|
|
|
79
84
|
config_1.Config.addAllowedProperties(options.customConfigMeta);
|
|
80
85
|
}
|
|
81
86
|
// console.log(ConfigAggregator.instance);
|
|
82
|
-
return
|
|
87
|
+
return config;
|
|
83
88
|
});
|
|
84
89
|
}
|
|
85
90
|
/**
|
|
86
91
|
* Clear the cache to force reading from disk.
|
|
92
|
+
* If no projectPath is provided, all instances will be cleared.
|
|
87
93
|
*
|
|
88
94
|
* *NOTE: Only call this method if you must and you know what you are doing.*
|
|
89
95
|
*/
|
|
90
|
-
static async clearInstance() {
|
|
96
|
+
static async clearInstance(projectPath) {
|
|
91
97
|
return ConfigAggregator.mutex.lock(() => {
|
|
92
|
-
|
|
98
|
+
if (projectPath) {
|
|
99
|
+
const normalizedPath = (0, node_path_1.resolve)(projectPath);
|
|
100
|
+
ConfigAggregator.instances.delete(normalizedPath);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
ConfigAggregator.instances.clear();
|
|
104
|
+
}
|
|
93
105
|
ConfigAggregator.encrypted = true; // Reset encryption flag as well
|
|
94
106
|
});
|
|
95
107
|
}
|
|
@@ -99,22 +111,22 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
|
|
|
99
111
|
*
|
|
100
112
|
* @param key The config key.
|
|
101
113
|
*/
|
|
102
|
-
static getValue(key) {
|
|
103
|
-
return this.getInstance().getInfo(key);
|
|
114
|
+
static getValue(key, projectPath) {
|
|
115
|
+
return this.getInstance(projectPath ?? process.cwd()).getInfo(key);
|
|
104
116
|
}
|
|
105
117
|
/**
|
|
106
118
|
* Get the static ConfigAggregator instance. If one doesn't exist, one will be created with
|
|
107
119
|
* the **encrypted** config values. Encrypted config values need to be resolved
|
|
108
120
|
* asynchronously by calling {@link ConfigAggregator.reload}
|
|
109
121
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
ConfigAggregator.instance
|
|
115
|
-
|
|
122
|
+
static getInstance(projectPath = process.cwd()) {
|
|
123
|
+
const normalizedPath = (0, node_path_1.resolve)(projectPath);
|
|
124
|
+
if (!ConfigAggregator.instances.has(normalizedPath)) {
|
|
125
|
+
const instance = new ConfigAggregator({ projectPath: normalizedPath });
|
|
126
|
+
ConfigAggregator.instances.set(normalizedPath, instance);
|
|
127
|
+
instance.loadPropertiesSync();
|
|
116
128
|
}
|
|
117
|
-
return ConfigAggregator.
|
|
129
|
+
return ConfigAggregator.instances.get(normalizedPath);
|
|
118
130
|
}
|
|
119
131
|
/**
|
|
120
132
|
* Initialize this instances async dependencies.
|
|
@@ -358,14 +370,13 @@ class ConfigAggregator extends kit_1.AsyncOptionalCreatable {
|
|
|
358
370
|
}
|
|
359
371
|
// Global config must be read first so it is on the left hand of the
|
|
360
372
|
// object assign and is overwritten by the local config.
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
return configs.filter(ts_types_1.isJsonMap).reduce((acc, el) => (0, kit_1.merge)(acc, el), json);
|
|
373
|
+
return [
|
|
374
|
+
globalConfig,
|
|
375
|
+
...(localConfig ? [localConfig] : []), // We might not be in a project workspace
|
|
376
|
+
this.envVars,
|
|
377
|
+
]
|
|
378
|
+
.filter(ts_types_1.isJsonMap)
|
|
379
|
+
.reduce((acc, el) => (0, kit_1.merge)(acc, el), {});
|
|
369
380
|
}
|
|
370
381
|
}
|
|
371
382
|
exports.ConfigAggregator = ConfigAggregator;
|
package/lib/org/authInfo.d.ts
CHANGED
|
@@ -259,6 +259,8 @@ export declare class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
|
|
|
259
259
|
getFields(decrypt?: boolean): Readonly<AuthFields>;
|
|
260
260
|
/**
|
|
261
261
|
* Get the org front door (used for web based oauth flows)
|
|
262
|
+
*
|
|
263
|
+
* @deprecated Will be removed in the next major version. Use the `Org.getFrontDoorUrl()` method instead.
|
|
262
264
|
*/
|
|
263
265
|
getOrgFrontDoorUrl(): string;
|
|
264
266
|
/**
|
package/lib/org/authInfo.js
CHANGED
|
@@ -545,6 +545,8 @@ class AuthInfo extends kit_1.AsyncOptionalCreatable {
|
|
|
545
545
|
}
|
|
546
546
|
/**
|
|
547
547
|
* Get the org front door (used for web based oauth flows)
|
|
548
|
+
*
|
|
549
|
+
* @deprecated Will be removed in the next major version. Use the `Org.getFrontDoorUrl()` method instead.
|
|
548
550
|
*/
|
|
549
551
|
getOrgFrontDoorUrl() {
|
|
550
552
|
const authFields = this.getFields(true);
|
package/lib/org/org.d.ts
CHANGED
|
@@ -152,6 +152,39 @@ export declare class Org extends AsyncOptionalCreatable<Org.Options> {
|
|
|
152
152
|
* @ignore
|
|
153
153
|
*/
|
|
154
154
|
constructor(options?: Org.Options);
|
|
155
|
+
/**
|
|
156
|
+
* Generate a URL to a metadata UI builder/setup section in an org.
|
|
157
|
+
*
|
|
158
|
+
* Bot: open in Agentforce Builder
|
|
159
|
+
* ApexPage: opens page
|
|
160
|
+
* Flow: open in Flow Builder
|
|
161
|
+
* FlexiPage: open in Lightning App Builder
|
|
162
|
+
* CustomObject: open in Object Manager
|
|
163
|
+
* ApexClass: open in Setup -> Apex Classes UI
|
|
164
|
+
*
|
|
165
|
+
* if you pass any other metadata type you'll get a path to Lightning App Builder
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* // use SDR resolver:
|
|
169
|
+
* import { MetadataResolver } from '@salesforce/source-deploy-retrieve';
|
|
170
|
+
*
|
|
171
|
+
* const metadataResolver = new MetadataResolver();
|
|
172
|
+
* const components = metadataResolver.getComponentsFromPath(filePath);
|
|
173
|
+
* const typeName = components[0]?.type?.name;
|
|
174
|
+
*
|
|
175
|
+
* const metadataBuilderUrl = await org.getMetadataUIURL(typeName, filePath);
|
|
176
|
+
*
|
|
177
|
+
* @typeName Bot | ApexPage | Flow | FlexiPage | CustomObject | ApexClass
|
|
178
|
+
* @file Absolute file path to the metadata file
|
|
179
|
+
*/
|
|
180
|
+
getMetadataUIURL(typeName: string, file: string): Promise<string>;
|
|
181
|
+
/**
|
|
182
|
+
* Get a Frontdoor URL
|
|
183
|
+
*
|
|
184
|
+
* This uses the UI Bridge API to generate a single-use Frontdoor URL:
|
|
185
|
+
* https://help.salesforce.com/s/articleView?id=xcloud.frontdoor_singleaccess.htm&type=5
|
|
186
|
+
*/
|
|
187
|
+
getFrontDoorUrl(redirectUri?: string): Promise<string>;
|
|
155
188
|
/**
|
|
156
189
|
* create a sandbox from a production org
|
|
157
190
|
* 'this' needs to be a production org with sandbox licenses available
|
package/lib/org/org.js
CHANGED
|
@@ -29,10 +29,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
__setModuleDefault(result, mod);
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
+
};
|
|
32
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
36
|
exports.Org = exports.SandboxEvents = exports.OrgTypes = void 0;
|
|
34
37
|
exports.sandboxIsResumable = sandboxIsResumable;
|
|
35
|
-
const node_path_1 = require("node:path");
|
|
38
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
36
39
|
const fs = __importStar(require("node:fs"));
|
|
37
40
|
const kit_1 = require("@salesforce/kit");
|
|
38
41
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
@@ -53,7 +56,7 @@ const authInfo_1 = require("./authInfo");
|
|
|
53
56
|
const scratchOrgCreate_1 = require("./scratchOrgCreate");
|
|
54
57
|
const orgConfigProperties_1 = require("./orgConfigProperties");
|
|
55
58
|
;
|
|
56
|
-
const messages = new messages_1.Messages('@salesforce/core', 'org', 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."]]));
|
|
59
|
+
const messages = new messages_1.Messages('@salesforce/core', 'org', 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."]]));
|
|
57
60
|
var OrgTypes;
|
|
58
61
|
(function (OrgTypes) {
|
|
59
62
|
OrgTypes["Scratch"] = "scratch";
|
|
@@ -146,6 +149,111 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
146
149
|
super(options);
|
|
147
150
|
this.options = options ?? {};
|
|
148
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Generate a URL to a metadata UI builder/setup section in an org.
|
|
154
|
+
*
|
|
155
|
+
* Bot: open in Agentforce Builder
|
|
156
|
+
* ApexPage: opens page
|
|
157
|
+
* Flow: open in Flow Builder
|
|
158
|
+
* FlexiPage: open in Lightning App Builder
|
|
159
|
+
* CustomObject: open in Object Manager
|
|
160
|
+
* ApexClass: open in Setup -> Apex Classes UI
|
|
161
|
+
*
|
|
162
|
+
* if you pass any other metadata type you'll get a path to Lightning App Builder
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* // use SDR resolver:
|
|
166
|
+
* import { MetadataResolver } from '@salesforce/source-deploy-retrieve';
|
|
167
|
+
*
|
|
168
|
+
* const metadataResolver = new MetadataResolver();
|
|
169
|
+
* const components = metadataResolver.getComponentsFromPath(filePath);
|
|
170
|
+
* const typeName = components[0]?.type?.name;
|
|
171
|
+
*
|
|
172
|
+
* const metadataBuilderUrl = await org.getMetadataUIURL(typeName, filePath);
|
|
173
|
+
*
|
|
174
|
+
* @typeName Bot | ApexPage | Flow | FlexiPage | CustomObject | ApexClass
|
|
175
|
+
* @file Absolute file path to the metadata file
|
|
176
|
+
*/
|
|
177
|
+
async getMetadataUIURL(typeName, file) {
|
|
178
|
+
const botFileNameToId = async (conn, filePath) => (await conn.singleRecordQuery(`SELECT id FROM BotDefinition WHERE DeveloperName='${node_path_1.default.basename(filePath, '.bot-meta.xml')}'`)).Id;
|
|
179
|
+
/** query flexipage via toolingAPI to get its ID (starts with 0M0) */
|
|
180
|
+
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;
|
|
181
|
+
/** query the rest API to turn a flow's filepath into a FlowId (starts with 301) */
|
|
182
|
+
const flowFileNameToId = async (conn, filePath) => {
|
|
183
|
+
try {
|
|
184
|
+
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`);
|
|
185
|
+
return flow.DurableId;
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
throw messages.createError('FlowIdNotFound', [filePath]);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const customObjectFileNameToId = async (conn, filePath) => {
|
|
192
|
+
try {
|
|
193
|
+
const customObject = await conn.singleRecordQuery(`SELECT Id FROM CustomObject WHERE DeveloperName = '${node_path_1.default.basename(filePath.replace(/__c/g, ''), '.object-meta.xml')}'`, {
|
|
194
|
+
tooling: true,
|
|
195
|
+
});
|
|
196
|
+
return customObject.Id;
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
throw messages.createError('CustomObjectIdNotFound', [filePath]);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const apexClassFileNameToId = async (conn, filePath) => {
|
|
203
|
+
try {
|
|
204
|
+
const apexClass = await conn.singleRecordQuery(`SELECT Id FROM ApexClass WHERE Name = '${node_path_1.default.basename(filePath, '.cls')}'`, {
|
|
205
|
+
tooling: true,
|
|
206
|
+
});
|
|
207
|
+
return apexClass.Id;
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
throw messages.createError('ApexClassIdNotFound', [filePath]);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
let redirectUri = '';
|
|
214
|
+
switch (typeName) {
|
|
215
|
+
case 'ApexClass':
|
|
216
|
+
redirectUri = `lightning/setup/ApexClasses/page?address=%2F${await apexClassFileNameToId(this.connection, file)}`;
|
|
217
|
+
break;
|
|
218
|
+
case 'CustomObject':
|
|
219
|
+
redirectUri = `lightning/setup/ObjectManager/${await customObjectFileNameToId(this.connection, file)}/Details/view`;
|
|
220
|
+
break;
|
|
221
|
+
case 'Bot':
|
|
222
|
+
redirectUri = `/AiCopilot/copilotStudio.app#/copilot/builder?copilotId=${await botFileNameToId(this.connection, file)}`;
|
|
223
|
+
break;
|
|
224
|
+
case 'ApexPage':
|
|
225
|
+
redirectUri = `/apex/${node_path_1.default.basename(file).replace('.page-meta.xml', '').replace('.page', '')}`;
|
|
226
|
+
break;
|
|
227
|
+
case 'Flow':
|
|
228
|
+
redirectUri = `/builder_platform_interaction/flowBuilder.app?flowId=${await flowFileNameToId(this.connection, file)}`;
|
|
229
|
+
break;
|
|
230
|
+
case 'FlexiPage':
|
|
231
|
+
redirectUri = `/visualEditor/appBuilder.app?pageId=${await flexiPageFilenameToId(this.connection, file)}`;
|
|
232
|
+
break;
|
|
233
|
+
default:
|
|
234
|
+
redirectUri = '/lightning/setup/FlexiPageList/home';
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
return this.getFrontDoorUrl(redirectUri);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get a Frontdoor URL
|
|
241
|
+
*
|
|
242
|
+
* This uses the UI Bridge API to generate a single-use Frontdoor URL:
|
|
243
|
+
* https://help.salesforce.com/s/articleView?id=xcloud.frontdoor_singleaccess.htm&type=5
|
|
244
|
+
*/
|
|
245
|
+
async getFrontDoorUrl(redirectUri) {
|
|
246
|
+
// the `singleaccess` endpoint returns 403 when using an expired token and jsforce only triggers a token refresh on 401 so we check if it's valid first
|
|
247
|
+
await this.refreshAuth();
|
|
248
|
+
const singleAccessUrl = new URL('/services/oauth2/singleaccess', this.connection.instanceUrl);
|
|
249
|
+
if (redirectUri) {
|
|
250
|
+
singleAccessUrl.searchParams.append('redirect_uri', redirectUri);
|
|
251
|
+
}
|
|
252
|
+
const response = await this.connection.requestGet(singleAccessUrl.toString());
|
|
253
|
+
if (response.frontdoor_uri)
|
|
254
|
+
return response.frontdoor_uri;
|
|
255
|
+
throw new sfError_1.SfError(messages.getMessage('FrontdoorURLError')).setData(response);
|
|
256
|
+
}
|
|
149
257
|
/**
|
|
150
258
|
* create a sandbox from a production org
|
|
151
259
|
* 'this' needs to be a production org with sandbox licenses available
|
|
@@ -925,7 +1033,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
925
1033
|
}
|
|
926
1034
|
async getLocalDataDir(orgDataPath) {
|
|
927
1035
|
const rootFolder = await config_1.Config.resolveRootFolder(false);
|
|
928
|
-
return
|
|
1036
|
+
return node_path_1.default.join(rootFolder, global_1.Global.SFDX_STATE_FOLDER, orgDataPath ? orgDataPath : 'orgs');
|
|
929
1037
|
}
|
|
930
1038
|
/**
|
|
931
1039
|
* Gets the sandboxProcessObject and then polls for it to complete.
|
|
@@ -1351,7 +1459,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
|
|
|
1351
1459
|
async removeSourceTrackingFiles() {
|
|
1352
1460
|
try {
|
|
1353
1461
|
const rootFolder = await config_1.Config.resolveRootFolder(false);
|
|
1354
|
-
await fs.promises.rm(
|
|
1462
|
+
await fs.promises.rm(node_path_1.default.join(rootFolder, global_1.Global.SF_STATE_FOLDER, 'orgs', this.getOrgId()), {
|
|
1355
1463
|
recursive: true,
|
|
1356
1464
|
force: true,
|
|
1357
1465
|
});
|
|
@@ -13,7 +13,7 @@ const messages_1 = require("../messages");
|
|
|
13
13
|
const sfdcUrl_1 = require("../util/sfdcUrl");
|
|
14
14
|
const sfdc_1 = require("../util/sfdc");
|
|
15
15
|
;
|
|
16
|
-
const messages = new messages_1.Messages('@salesforce/core', 'config', 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", "
|
|
16
|
+
const messages = new messages_1.Messages('@salesforce/core', 'config', 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."]]));
|
|
17
17
|
var OrgConfigProperties;
|
|
18
18
|
(function (OrgConfigProperties) {
|
|
19
19
|
/**
|
package/lib/sfProject.js
CHANGED
|
@@ -43,7 +43,7 @@ const sfError_1 = require("./sfError");
|
|
|
43
43
|
const messages_1 = require("./messages");
|
|
44
44
|
const findUppercaseKeys_1 = require("./util/findUppercaseKeys");
|
|
45
45
|
;
|
|
46
|
-
const messages = new messages_1.Messages('@salesforce/core', 'config', 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", "
|
|
46
|
+
const messages = new messages_1.Messages('@salesforce/core', 'config', 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."]]));
|
|
47
47
|
/**
|
|
48
48
|
* The sfdx-project.json config object. This file determines if a folder is a valid sfdx project.
|
|
49
49
|
*
|
package/lib/testSetup.js
CHANGED
|
@@ -537,7 +537,7 @@ const restoreContext = (testContext) => {
|
|
|
537
537
|
sfProject_1.SfProject.clearInstances();
|
|
538
538
|
// Allow each test to have their own config aggregator
|
|
539
539
|
// @ts-ignore clear for testing.
|
|
540
|
-
|
|
540
|
+
configAggregator_1.ConfigAggregator.instances.clear();
|
|
541
541
|
};
|
|
542
542
|
exports.restoreContext = restoreContext;
|
|
543
543
|
/**
|
package/lib/util/internal.js
CHANGED
|
@@ -36,7 +36,7 @@ const fs = __importStar(require("node:fs"));
|
|
|
36
36
|
const node_path_1 = require("node:path");
|
|
37
37
|
const messages_1 = require("../messages");
|
|
38
38
|
;
|
|
39
|
-
const messages = new messages_1.Messages('@salesforce/core', 'config', 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", "
|
|
39
|
+
const messages = new messages_1.Messages('@salesforce/core', 'config', 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."]]));
|
|
40
40
|
/**
|
|
41
41
|
* The name of the project config file.
|
|
42
42
|
*
|
|
@@ -59,7 +59,7 @@ exports.SFDX_PROJECT_JSON = 'sfdx-project.json';
|
|
|
59
59
|
async function resolveProjectPath(dir = process.cwd()) {
|
|
60
60
|
const projectPath = await exports.traverse.forFile(dir, exports.SFDX_PROJECT_JSON);
|
|
61
61
|
if (!projectPath) {
|
|
62
|
-
throw messages.createError('invalidProjectWorkspace');
|
|
62
|
+
throw messages.createError('invalidProjectWorkspace', [dir]);
|
|
63
63
|
}
|
|
64
64
|
return projectPath;
|
|
65
65
|
}
|
|
@@ -78,7 +78,7 @@ async function resolveProjectPath(dir = process.cwd()) {
|
|
|
78
78
|
function resolveProjectPathSync(dir = process.cwd()) {
|
|
79
79
|
const projectPath = exports.traverse.forFileSync(dir, exports.SFDX_PROJECT_JSON);
|
|
80
80
|
if (!projectPath) {
|
|
81
|
-
throw messages.createError('invalidProjectWorkspace');
|
|
81
|
+
throw messages.createError('invalidProjectWorkspace', [dir]);
|
|
82
82
|
}
|
|
83
83
|
return projectPath;
|
|
84
84
|
}
|
package/messages/config.md
CHANGED
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",
|
|
3
|
-
"version": "8.
|
|
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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"messageTransformer/messageTransformer.ts"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@jsforce/jsforce-node": "^3.
|
|
56
|
+
"@jsforce/jsforce-node": "^3.9.1",
|
|
57
57
|
"@salesforce/kit": "^3.2.2",
|
|
58
58
|
"@salesforce/schemas": "^1.9.0",
|
|
59
59
|
"@salesforce/ts-types": "^2.0.10",
|