@salesforce/core
Version:
Core libraries to interact with SFDX projects, orgs, and APIs.
130 lines • 9.42 kB
JavaScript
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = void 0;
const node_path_1 = require("node:path");
const ts_types_1 = require("@salesforce/ts-types");
const messages_1 = require("../messages");
const sfdcUrl_1 = require("../util/sfdcUrl");
const sfdc_1 = require("../util/sfdc");
;
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", "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."]]));
var OrgConfigProperties;
(function (OrgConfigProperties) {
/**
* Username associate with the default org.
*/
OrgConfigProperties["TARGET_ORG"] = "target-org";
/**
* Username associated with the default dev hub org.
*/
OrgConfigProperties["TARGET_DEV_HUB"] = "target-dev-hub";
/**
* The api version
*/
OrgConfigProperties["ORG_API_VERSION"] = "org-api-version";
/**
* Custom templates repo or local location.
*/
OrgConfigProperties["ORG_CUSTOM_METADATA_TEMPLATES"] = "org-custom-metadata-templates";
/**
* Allows users to override the 10,000 result query limit.
*/
OrgConfigProperties["ORG_MAX_QUERY_LIMIT"] = "org-max-query-limit";
/**
* The instance url of the org.
*/
OrgConfigProperties["ORG_INSTANCE_URL"] = "org-instance-url";
/**
* The sid for the debugger configuration.
*/
OrgConfigProperties["ORG_ISV_DEBUGGER_SID"] = "org-isv-debugger-sid";
/**
* The url for the debugger configuration.
*/
OrgConfigProperties["ORG_ISV_DEBUGGER_URL"] = "org-isv-debugger-url";
/**
* Capitalize record types when deploying scratch org settings
*/
OrgConfigProperties["ORG_CAPITALIZE_RECORD_TYPES"] = "org-capitalize-record-types";
})(OrgConfigProperties || (exports.OrgConfigProperties = OrgConfigProperties = {}));
exports.ORG_CONFIG_ALLOWED_PROPERTIES = [
{
key: OrgConfigProperties.ORG_CAPITALIZE_RECORD_TYPES,
description: messages.getMessage(OrgConfigProperties.ORG_CAPITALIZE_RECORD_TYPES),
},
{
key: OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES,
description: messages.getMessage(OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES),
},
{
key: OrgConfigProperties.TARGET_ORG,
description: messages.getMessage(OrgConfigProperties.TARGET_ORG),
},
{
key: OrgConfigProperties.TARGET_DEV_HUB,
description: messages.getMessage(OrgConfigProperties.TARGET_DEV_HUB),
},
{
key: OrgConfigProperties.ORG_INSTANCE_URL,
description: messages.getMessage(OrgConfigProperties.ORG_INSTANCE_URL),
input: {
// If a value is provided validate it otherwise no value is unset.
validator: (value) => {
if (value == null)
return true;
// validate if the value is a string and is a valid url and is either a salesforce domain
// or an internal url.
return ((0, ts_types_1.isString)(value) &&
sfdcUrl_1.SfdcUrl.isValidUrl(value) &&
(new sfdcUrl_1.SfdcUrl(value).isSalesforceDomain() || new sfdcUrl_1.SfdcUrl(value).isInternalUrl()));
},
failedMessage: messages.getMessage('invalidInstanceUrl'),
},
},
{
key: OrgConfigProperties.ORG_API_VERSION,
description: messages.getMessage(OrgConfigProperties.ORG_API_VERSION),
hidden: true,
input: {
// If a value is provided validate it otherwise no value is unset.
validator: (value) => value == null || ((0, ts_types_1.isString)(value) && (0, sfdc_1.validateApiVersion)(value)),
failedMessage: messages.getMessage('invalidApiVersion'),
},
},
{
key: OrgConfigProperties.ORG_ISV_DEBUGGER_SID,
description: messages.getMessage(OrgConfigProperties.ORG_ISV_DEBUGGER_SID),
encrypted: true,
input: {
// If a value is provided validate it otherwise no value is unset.
validator: (value) => value == null || (0, ts_types_1.isString)(value),
failedMessage: messages.getMessage('invalidIsvDebuggerSid'),
},
},
{
key: OrgConfigProperties.ORG_ISV_DEBUGGER_URL,
description: messages.getMessage(OrgConfigProperties.ORG_ISV_DEBUGGER_URL),
input: {
// If a value is provided validate it otherwise no value is unset.
validator: (value) => value == null || (0, ts_types_1.isString)(value),
failedMessage: messages.getMessage('invalidIsvDebuggerUrl'),
},
},
{
key: OrgConfigProperties.ORG_MAX_QUERY_LIMIT,
description: messages.getMessage(OrgConfigProperties.ORG_MAX_QUERY_LIMIT),
input: {
// the bit shift will remove the negative bit, and any decimal numbers
// then the parseFloat will handle converting it to a number from a string
validator: (value) => value >>> 0 === parseFloat(value) && value > 0,
failedMessage: messages.getMessage('invalidNumberConfigValue'),
},
},
];
//# sourceMappingURL=orgConfigProperties.js.map
;