@salesforce/core
Advanced tools
Comparing version 0.24.5 to 0.24.6
@@ -87,5 +87,5 @@ /** | ||
}; | ||
export declare enum SFDC_URLS { | ||
sandbox = "https://test.salesforce.com", | ||
production = "https://login.salesforce.com" | ||
export declare enum SfdcUrl { | ||
SANDBOX = "https://test.salesforce.com", | ||
PRODUCTION = "https://login.salesforce.com" | ||
} | ||
@@ -92,0 +92,0 @@ /** |
@@ -128,7 +128,7 @@ "use strict"; | ||
} | ||
var SFDC_URLS; | ||
(function (SFDC_URLS) { | ||
SFDC_URLS["sandbox"] = "https://test.salesforce.com"; | ||
SFDC_URLS["production"] = "https://login.salesforce.com"; | ||
})(SFDC_URLS = exports.SFDC_URLS || (exports.SFDC_URLS = {})); | ||
var SfdcUrl; | ||
(function (SfdcUrl) { | ||
SfdcUrl["SANDBOX"] = "https://test.salesforce.com"; | ||
SfdcUrl["PRODUCTION"] = "https://login.salesforce.com"; | ||
})(SfdcUrl = exports.SfdcUrl || (exports.SfdcUrl = {})); | ||
const INTERNAL_URL_PARTS = [ | ||
@@ -146,3 +146,3 @@ '.internal.', | ||
// default audience must be... | ||
let audienceUrl = SFDC_URLS.production; | ||
let audienceUrl = SfdcUrl.PRODUCTION; | ||
const loginUrl = ts_types_1.getString(options, 'loginUrl', ''); | ||
@@ -160,3 +160,3 @@ const createdOrgInstance = ts_types_1.getString(options, 'createdOrgInstance', '') | ||
else if (createdOrgInstance.startsWith('cs') || url_1.parse(loginUrl).hostname === 'test.salesforce.com') { | ||
audienceUrl = SFDC_URLS.sandbox; | ||
audienceUrl = SfdcUrl.SANDBOX; | ||
} | ||
@@ -486,3 +486,3 @@ else if (createdOrgInstance.startsWith('gs1')) { | ||
const aggregator = await configAggregator_1.ConfigAggregator.create(); | ||
const instanceUrl = aggregator.getPropertyValue('instanceUrl') || SFDC_URLS.production; | ||
const instanceUrl = aggregator.getPropertyValue('instanceUrl') || SfdcUrl.PRODUCTION; | ||
this.update({ | ||
@@ -489,0 +489,0 @@ accessToken: this.options.username, |
@@ -70,5 +70,3 @@ "use strict"; | ||
if (split.length !== 2) { | ||
throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'InvalidFormat', [ | ||
arg | ||
]); | ||
throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'InvalidFormat', [arg]); | ||
} | ||
@@ -75,0 +73,0 @@ const [name, value] = split; |
@@ -143,5 +143,3 @@ "use strict"; | ||
if (!property) { | ||
throw sfdxError_1.SfdxError.create('@salesforce/core', 'config', 'UnknownConfigKey', [ | ||
key | ||
]); | ||
throw sfdxError_1.SfdxError.create('@salesforce/core', 'config', 'UnknownConfigKey', [key]); | ||
} | ||
@@ -236,5 +234,3 @@ if (property.input) { | ||
if (!prop) { | ||
throw sfdxError_1.SfdxError.create('@salesforce/core', 'config', 'UnknownConfigKey', [ | ||
propertyName | ||
]); | ||
throw sfdxError_1.SfdxError.create('@salesforce/core', 'config', 'UnknownConfigKey', [propertyName]); | ||
} | ||
@@ -241,0 +237,0 @@ return prop; |
/** | ||
* An enum of all possible locations for a config value. | ||
* @typedef LOCATIONS | ||
* @typedef Location | ||
* @property {string} GLOBAL Represents the global config. | ||
@@ -13,7 +13,7 @@ * @property {string} LOCAL Represents the local project config. | ||
* @property {string | boolean} value The config value. | ||
* @property {LOCATIONS} location The location of the config property. | ||
* @property {Location} location The location of the config property. | ||
* @property {string} path The path of the config value. | ||
* @property {function} isLocal `() => boolean` Location is `LOCATIONS.LOCAL`. | ||
* @property {function} isGlobal `() => boolean` Location is `LOCATIONS.GLOBAL`. | ||
* @property {function} isEnvVar `() => boolean` Location is `LOCATIONS.ENVIRONMENT`. | ||
* @property {function} isLocal `() => boolean` Location is `Location.LOCAL`. | ||
* @property {function} isGlobal `() => boolean` Location is `Location.GLOBAL`. | ||
* @property {function} isEnvVar `() => boolean` Location is `Location.ENVIRONMENT`. | ||
*/ | ||
@@ -23,3 +23,3 @@ import { AsyncOptionalCreatable } from '@salesforce/kit'; | ||
import { Config } from './config'; | ||
export declare const enum LOCATIONS { | ||
export declare const enum Location { | ||
GLOBAL = "Global", | ||
@@ -34,3 +34,3 @@ LOCAL = "Local", | ||
key: string; | ||
location?: LOCATIONS; | ||
location?: Location; | ||
value: string | boolean; | ||
@@ -107,10 +107,10 @@ path?: string; | ||
* For example, `getLocation('logLevel')` will return: | ||
* 1. `LOCATIONS.GLOBAL` if resolved to an environment variable. | ||
* 1. `LOCATIONS.LOCAL` if resolved to local project config. | ||
* 1. `LOCATIONS.ENVIRONMENT` if resolved to the global config. | ||
* 1. `Location.GLOBAL` if resolved to an environment variable. | ||
* 1. `Location.LOCAL` if resolved to local project config. | ||
* 1. `Location.ENVIRONMENT` if resolved to the global config. | ||
* | ||
* @param {string} key The key of the property. | ||
* @returns {Optional<LOCATIONS>} | ||
* @returns {Optional<Location>} | ||
*/ | ||
getLocation(key: string): Optional<LOCATIONS>; | ||
getLocation(key: string): Optional<Location>; | ||
/** | ||
@@ -117,0 +117,0 @@ * Get a resolved file path or environment variable name of the property. |
@@ -10,3 +10,3 @@ "use strict"; | ||
* An enum of all possible locations for a config value. | ||
* @typedef LOCATIONS | ||
* @typedef Location | ||
* @property {string} GLOBAL Represents the global config. | ||
@@ -21,7 +21,7 @@ * @property {string} LOCAL Represents the local project config. | ||
* @property {string | boolean} value The config value. | ||
* @property {LOCATIONS} location The location of the config property. | ||
* @property {Location} location The location of the config property. | ||
* @property {string} path The path of the config value. | ||
* @property {function} isLocal `() => boolean` Location is `LOCATIONS.LOCAL`. | ||
* @property {function} isGlobal `() => boolean` Location is `LOCATIONS.GLOBAL`. | ||
* @property {function} isEnvVar `() => boolean` Location is `LOCATIONS.ENVIRONMENT`. | ||
* @property {function} isLocal `() => boolean` Location is `Location.LOCAL`. | ||
* @property {function} isGlobal `() => boolean` Location is `Location.GLOBAL`. | ||
* @property {function} isEnvVar `() => boolean` Location is `Location.ENVIRONMENT`. | ||
*/ | ||
@@ -108,8 +108,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
* For example, `getLocation('logLevel')` will return: | ||
* 1. `LOCATIONS.GLOBAL` if resolved to an environment variable. | ||
* 1. `LOCATIONS.LOCAL` if resolved to local project config. | ||
* 1. `LOCATIONS.ENVIRONMENT` if resolved to the global config. | ||
* 1. `Location.GLOBAL` if resolved to an environment variable. | ||
* 1. `Location.LOCAL` if resolved to local project config. | ||
* 1. `Location.ENVIRONMENT` if resolved to the global config. | ||
* | ||
* @param {string} key The key of the property. | ||
* @returns {Optional<LOCATIONS>} | ||
* @returns {Optional<Location>} | ||
*/ | ||
@@ -245,5 +245,3 @@ getLocation(key) { | ||
configs.push(this.envVars); | ||
const reduced = configs | ||
.filter(ts_types_1.isObject) | ||
.reduce((result, configElement) => kit_1.merge(result, configElement), {}); | ||
const reduced = configs.filter(ts_types_1.isObject).reduce((result, configElement) => kit_1.merge(result, configElement), {}); | ||
this.setConfig(reduced); | ||
@@ -250,0 +248,0 @@ } |
@@ -9,4 +9,12 @@ import { ConfigFile } from './configFile'; | ||
static getFileName(): string; | ||
static getDefaultOptions(isGlobal?: boolean, filename?: string): ConfigFile.Options; | ||
/** | ||
* Gets default options for the KeychainConfig | ||
*/ | ||
static getDefaultOptions(): ConfigFile.Options; | ||
/** | ||
* Retrieves the global config state of the keychain | ||
* @param options Option override otherwise the default options are used. | ||
*/ | ||
static retrieve<T extends ConfigFile<ConfigFile.Options>>(options?: ConfigFile.Options): Promise<T>; | ||
/** | ||
* Write the config file with new contents. If no new contents are passed in | ||
@@ -13,0 +21,0 @@ * it will write this.contents that was set from read(). |
@@ -21,10 +21,18 @@ "use strict"; | ||
} | ||
static getDefaultOptions(isGlobal = true, filename) { | ||
const config = super.getDefaultOptions(isGlobal); | ||
// The key file is ALWAYS in the global space. | ||
config.isGlobal = true; | ||
config.filename = filename; | ||
return config; | ||
/** | ||
* Gets default options for the KeychainConfig | ||
*/ | ||
static getDefaultOptions() { | ||
return configFile_1.ConfigFile.getDefaultOptions(true, KeychainConfig.getFileName()); | ||
} | ||
/** | ||
* Retrieves the global config state of the keychain | ||
* @param options Option override otherwise the default options are used. | ||
*/ | ||
static async retrieve(options) { | ||
const keychainConfig = await KeychainConfig.create(options || KeychainConfig.getDefaultOptions()); | ||
await keychainConfig.read(); | ||
return keychainConfig; | ||
} | ||
/** | ||
* Write the config file with new contents. If no new contents are passed in | ||
@@ -31,0 +39,0 @@ * it will write this.contents that was set from read(). |
@@ -117,5 +117,3 @@ "use strict"; | ||
catch (e) { | ||
const errMsg = this.messages.getMessage('AuthDecryptError', [ | ||
e.message | ||
]); | ||
const errMsg = this.messages.getMessage('AuthDecryptError', [e.message]); | ||
throw new sfdxError_1.SfdxError(errMsg, 'AuthDecryptError'); | ||
@@ -140,3 +138,4 @@ } | ||
try { | ||
this._key.consume(Buffer.from((await keychainPromises.getPassword(await this.getKeyChain(this.options.platform), KEY_NAME, ACCOUNT)).password, 'utf8')); | ||
this._key.consume(Buffer.from((await keychainPromises.getPassword(await this.getKeyChain(this.options.platform), KEY_NAME, ACCOUNT)) | ||
.password, 'utf8')); | ||
} | ||
@@ -143,0 +142,0 @@ catch (err) { |
@@ -8,4 +8,4 @@ export { Aliases, AliasGroup } from './config/aliases'; | ||
export { ConfigPropertyMeta, ConfigPropertyMetaInput, ORG_DEFAULT, Config } from './config/config'; | ||
export { ConfigInfo, LOCATIONS, ConfigAggregator } from './config/configAggregator'; | ||
export { AuthFields, AuthInfo, SFDC_URLS } from './authInfo'; | ||
export { ConfigInfo, Location, ConfigAggregator } from './config/configAggregator'; | ||
export { AuthFields, AuthInfo, SfdcUrl } from './authInfo'; | ||
export { Connection, SFDX_HTTP_HEADERS } from './connection'; | ||
@@ -24,3 +24,2 @@ export { Mode, Global } from './global'; | ||
export { MyDomainResolver } from './status/myDomainResolver'; | ||
export { Time, TIME_UNIT } from './util/time'; | ||
export { DefaultUserFields, REQUIRED_FIELDS, User, UserFields } from './user'; | ||
@@ -27,0 +26,0 @@ import * as fs from './util/fs'; |
@@ -31,3 +31,3 @@ "use strict"; | ||
exports.AuthInfo = authInfo_1.AuthInfo; | ||
exports.SFDC_URLS = authInfo_1.SFDC_URLS; | ||
exports.SfdcUrl = authInfo_1.SfdcUrl; | ||
var connection_1 = require("./connection"); | ||
@@ -64,5 +64,2 @@ exports.Connection = connection_1.Connection; | ||
exports.MyDomainResolver = myDomainResolver_1.MyDomainResolver; | ||
var time_1 = require("./util/time"); | ||
exports.Time = time_1.Time; | ||
exports.TIME_UNIT = time_1.TIME_UNIT; | ||
var user_1 = require("./user"); | ||
@@ -69,0 +66,0 @@ exports.DefaultUserFields = user_1.DefaultUserFields; |
@@ -313,5 +313,5 @@ "use strict"; | ||
const config = await keychainConfig_1.KeychainConfig.create(keychainConfig_1.KeychainConfig.getDefaultOptions()); | ||
config.set(SecretFields.ACCOUNT, opts.account); | ||
config.set(SecretFields.KEY, opts.password || ''); | ||
config.set(SecretFields.SERVICE, opts.service); | ||
config.set(SecretField.ACCOUNT, opts.account); | ||
config.set(SecretField.KEY, opts.password || ''); | ||
config.set(SecretField.SERVICE, opts.service); | ||
await config.write(); | ||
@@ -324,8 +324,8 @@ fn(null, config.getContents()); | ||
} | ||
var SecretFields; | ||
(function (SecretFields) { | ||
SecretFields["SERVICE"] = "service"; | ||
SecretFields["ACCOUNT"] = "account"; | ||
SecretFields["KEY"] = "key"; | ||
})(SecretFields || (SecretFields = {})); | ||
var SecretField; | ||
(function (SecretField) { | ||
SecretField["SERVICE"] = "service"; | ||
SecretField["ACCOUNT"] = "account"; | ||
SecretField["KEY"] = "key"; | ||
})(SecretField || (SecretField = {})); | ||
/** | ||
@@ -342,8 +342,8 @@ * @private | ||
// read it's contents | ||
return keychainConfig_1.KeychainConfig.create(keychainConfig_1.KeychainConfig.getDefaultOptions()) | ||
return keychainConfig_1.KeychainConfig.retrieve() | ||
.then((config) => { | ||
// validate service name and account just because | ||
if (opts.service === config.get(SecretFields.SERVICE) && | ||
opts.account === config.get(SecretFields.ACCOUNT)) { | ||
const key = config.get(SecretFields.KEY); | ||
if (opts.service === config.get(SecretField.SERVICE) && | ||
opts.account === config.get(SecretField.ACCOUNT)) { | ||
const key = config.get(SecretField.KEY); | ||
// @ts-ignore TODO: Remove this ignore if we ever factor out `object` from `ConfigValue` | ||
@@ -350,0 +350,0 @@ fn(null, ts_types_1.asString(key)); |
@@ -178,4 +178,3 @@ "use strict"; | ||
// disable log file writing, if applicable | ||
if (process.env.SFDX_DISABLE_LOG_FILE !== 'true' && | ||
global_1.Global.getEnvironmentMode() !== global_1.Mode.TEST) { | ||
if (process.env.SFDX_DISABLE_LOG_FILE !== 'true' && global_1.Global.getEnvironmentMode() !== global_1.Mode.TEST) { | ||
await rootLogger.addLogFileStream(global_1.Global.LOG_FILE_PATH); | ||
@@ -333,5 +332,3 @@ } | ||
if (level == null) { | ||
level = process.env.SFDX_LOG_LEVEL | ||
? Logger.getLevelByName(process.env.SFDX_LOG_LEVEL) | ||
: Logger.DEFAULT_LEVEL; | ||
level = process.env.SFDX_LOG_LEVEL ? Logger.getLevelByName(process.env.SFDX_LOG_LEVEL) : Logger.DEFAULT_LEVEL; | ||
} | ||
@@ -440,5 +437,3 @@ this.bunyan.level(level); | ||
// close file streams, flush buffer to disk | ||
if (entry.type === 'file' && | ||
entry.stream && | ||
ts_types_1.isFunction(entry.stream.end)) { | ||
if (entry.type === 'file' && entry.stream && ts_types_1.isFunction(entry.stream.end)) { | ||
entry.stream.end(); | ||
@@ -445,0 +440,0 @@ } |
@@ -156,4 +156,3 @@ "use strict"; | ||
static importMessageFile(packageName, filePath) { | ||
if (path.extname(filePath) !== '.json' && | ||
path.extname(filePath) !== '.js') { | ||
if (path.extname(filePath) !== '.json' && path.extname(filePath) !== '.js') { | ||
throw new Error(`Only json and js message files are allowed, not ${path.extname(filePath)}`); | ||
@@ -160,0 +159,0 @@ } |
@@ -55,5 +55,3 @@ "use strict"; | ||
} | ||
const result = await this.org | ||
.getConnection() | ||
.query(query); | ||
const result = await this.org.getConnection().query(query); | ||
const permissionSetId = ts_types_1.getString(result, 'records[0].Id'); | ||
@@ -60,0 +58,0 @@ if (!permissionSetId) { |
@@ -150,5 +150,3 @@ "use strict"; | ||
add(` ${property.renderArrayHeader()}`); | ||
if (property.items && | ||
property.items.type === 'object' && | ||
property.items.properties) { | ||
if (property.items && property.items.type === 'object' && property.items.properties) { | ||
Object.keys(property.items.properties).forEach(key => { | ||
@@ -155,0 +153,0 @@ const items = ts_types_1.asJsonMap(property.items); |
@@ -142,4 +142,3 @@ "use strict"; | ||
const enumSchema = ts_types_1.asJsonMap(getPropValue('enum')); | ||
return ((enumSchema && ts_types_1.getJsonArray(enumSchema, 'enum', []).join(', ')) || | ||
''); | ||
return (enumSchema && ts_types_1.getJsonArray(enumSchema, 'enum', []).join(', ')) || ''; | ||
}; | ||
@@ -146,0 +145,0 @@ switch (error.keyword) { |
@@ -68,6 +68,3 @@ "use strict"; | ||
const cipher = crypto.createCipheriv(cipherName, this.key, this.iv); | ||
this.secret = Buffer.concat([ | ||
cipher.update(Buffer.from('')), | ||
cipher.final() | ||
]); | ||
this.secret = Buffer.concat([cipher.update(Buffer.from('')), cipher.final()]); | ||
} | ||
@@ -74,0 +71,0 @@ /** |
@@ -49,6 +49,3 @@ "use strict"; | ||
if (upperCaseKey) { | ||
throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'InvalidJsonCasing', [ | ||
upperCaseKey, | ||
this.getPath() | ||
]); | ||
throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'InvalidJsonCasing', [upperCaseKey, this.getPath()]); | ||
} | ||
@@ -55,0 +52,0 @@ return contents; |
/// <reference types="node" /> | ||
import { URL } from 'url'; | ||
import { AsyncOptionalCreatable } from '@salesforce/kit'; | ||
import { Time } from '../util/time'; | ||
import { AsyncOptionalCreatable, Duration } from '@salesforce/kit'; | ||
/** | ||
@@ -14,4 +13,4 @@ * A class used to resolve MyDomains. After a ScratchOrg is created it's host name my not be propagated to the | ||
* url: new URL('http://mydomain.salesforce.com'), | ||
* timeout: new Time(5, TIME_UNIT.MINUTES), | ||
* frequency: new Time(10, TIME_UNIT.SECONDS) | ||
* timeout: Duration.minutes(5), | ||
* frequency: Duration.seconds(10) | ||
* }; | ||
@@ -52,8 +51,8 @@ * | ||
*/ | ||
timeout?: Time; | ||
timeout?: Duration; | ||
/** | ||
* The retry timeout | ||
*/ | ||
frequency?: Time; | ||
frequency?: Duration; | ||
} | ||
} |
@@ -15,3 +15,2 @@ "use strict"; | ||
const logger_1 = require("../logger"); | ||
const time_1 = require("../util/time"); | ||
const pollingClient_1 = require("./pollingClient"); | ||
@@ -27,4 +26,4 @@ /** | ||
* url: new URL('http://mydomain.salesforce.com'), | ||
* timeout: new Time(5, TIME_UNIT.MINUTES), | ||
* frequency: new Time(10, TIME_UNIT.SECONDS) | ||
* timeout: Duration.minutes(5), | ||
* frequency: Duration.seconds(10) | ||
* }; | ||
@@ -77,4 +76,4 @@ * | ||
}, | ||
timeout: this.options.timeout || new time_1.Time(30, time_1.TIME_UNIT.SECONDS), | ||
frequency: this.options.frequency || new time_1.Time(10, time_1.TIME_UNIT.SECONDS), | ||
timeout: this.options.timeout || kit_1.Duration.seconds(30), | ||
frequency: this.options.frequency || kit_1.Duration.seconds(10), | ||
timeoutErrorName: 'MyDomainResolverTimeoutError' | ||
@@ -81,0 +80,0 @@ }; |
@@ -1,5 +0,4 @@ | ||
import { AsyncOptionalCreatable } from '@salesforce/kit'; | ||
import { AsyncOptionalCreatable, Duration } from '@salesforce/kit'; | ||
import { AnyJson } from '@salesforce/ts-types'; | ||
import { Logger } from '../logger'; | ||
import { Time } from '../util/time'; | ||
import { StatusResult } from './client'; | ||
@@ -16,4 +15,4 @@ /** | ||
* }, | ||
* frequency: new Time(10, TIME_UNIT.MILLISECONDS), | ||
* timeout: new Time(1, TIME_UNIT.MINUTES) | ||
* frequency: Duration.milliseconds(10), | ||
* timeout: Duration.minutes(1) | ||
* }; | ||
@@ -59,4 +58,4 @@ * const client = await PollingClient.create(options); | ||
poll: () => Promise<StatusResult>; | ||
frequency: Time; | ||
timeout: Time; | ||
frequency: Duration; | ||
timeout: Duration; | ||
timeoutErrorName?: string; | ||
@@ -69,5 +68,5 @@ } | ||
class DefaultPollingOptions implements PollingClient.Options { | ||
frequency: Time; | ||
frequency: Duration; | ||
poll: () => Promise<StatusResult>; | ||
timeout: Time; | ||
timeout: Duration; | ||
/** | ||
@@ -74,0 +73,0 @@ * constructor |
@@ -14,3 +14,2 @@ "use strict"; | ||
const sfdxError_1 = require("../sfdxError"); | ||
const time_1 = require("../util/time"); | ||
/** | ||
@@ -26,4 +25,4 @@ * This is a polling client that can be used to poll the status of long running tasks. It can be used as a replacement | ||
* }, | ||
* frequency: new Time(10, TIME_UNIT.MILLISECONDS), | ||
* timeout: new Time(1, TIME_UNIT.MINUTES) | ||
* frequency: Duration.milliseconds(10), | ||
* timeout: Duration.minutes(1) | ||
* }; | ||
@@ -136,4 +135,4 @@ * const client = await PollingClient.create(options); | ||
this.poll = poll; | ||
this.timeout = new time_1.Time(3, time_1.TIME_UNIT.MINUTES); | ||
this.frequency = new time_1.Time(15, time_1.TIME_UNIT.SECONDS); | ||
this.timeout = kit_1.Duration.minutes(3); | ||
this.frequency = kit_1.Duration.seconds(15); | ||
} | ||
@@ -140,0 +139,0 @@ } |
/// <reference types="node" /> | ||
import { AsyncOptionalCreatable, Env } from '@salesforce/kit'; | ||
import { AsyncOptionalCreatable, Duration, Env } from '@salesforce/kit'; | ||
import { AnyFunction, AnyJson, JsonMap } from '@salesforce/ts-types'; | ||
import { EventEmitter } from 'events'; | ||
import { Org } from '../org'; | ||
import { Time } from '../util/time'; | ||
import { StatusResult } from './client'; | ||
@@ -205,4 +204,4 @@ /** | ||
org: Org; | ||
subscribeTimeout: Time; | ||
handshakeTimeout: Time; | ||
subscribeTimeout: Duration; | ||
handshakeTimeout: Duration; | ||
channel: string; | ||
@@ -219,9 +218,9 @@ apiVersion: string; | ||
static readonly SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING = "SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING"; | ||
static readonly DEFAULT_SUBSCRIBE_TIMEOUT: Time; | ||
static readonly DEFAULT_HANDSHAKE_TIMEOUT: Time; | ||
static readonly DEFAULT_SUBSCRIBE_TIMEOUT: Duration; | ||
static readonly DEFAULT_HANDSHAKE_TIMEOUT: Duration; | ||
apiVersion: string; | ||
org: Org; | ||
streamProcessor: StreamProcessor; | ||
subscribeTimeout: Time; | ||
handshakeTimeout: Time; | ||
subscribeTimeout: Duration; | ||
handshakeTimeout: Duration; | ||
channel: string; | ||
@@ -244,3 +243,3 @@ streamingImpl: StreamingClientIfc; | ||
*/ | ||
setSubscribeTimeout(newTime: Time): void; | ||
setSubscribeTimeout(newTime: Duration): void; | ||
/** | ||
@@ -251,3 +250,3 @@ * Setter for the handshake timeout. | ||
*/ | ||
setHandshakeTimeout(newTime: Time): void; | ||
setHandshakeTimeout(newTime: Duration): void; | ||
} | ||
@@ -267,3 +266,3 @@ /** | ||
* @property HANDSHAKE - To indicate the error occurred on handshake | ||
* @property SUBSCRIBE - To indicate the error occured on subscribe | ||
* @property SUBSCRIBE - To indicate the error occurred on subscribe | ||
*/ | ||
@@ -270,0 +269,0 @@ enum TimeoutErrorType { |
@@ -16,3 +16,2 @@ "use strict"; | ||
const sfdxError_1 = require("../sfdxError"); | ||
const time_1 = require("../util/time"); | ||
const url_1 = require("url"); | ||
@@ -29,3 +28,3 @@ /** | ||
* Validation helper | ||
* @param newTime New Time to validate. | ||
* @param newTime New Duration to validate. | ||
* @param existingTime Existing time to validate. | ||
@@ -393,4 +392,4 @@ */ | ||
DefaultOptions.SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING = 'SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING'; | ||
DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT = new time_1.Time(3, time_1.TIME_UNIT.MINUTES); | ||
DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT = new time_1.Time(30, time_1.TIME_UNIT.SECONDS); | ||
DefaultOptions.DEFAULT_SUBSCRIBE_TIMEOUT = kit_1.Duration.minutes(3); | ||
DefaultOptions.DEFAULT_HANDSHAKE_TIMEOUT = kit_1.Duration.seconds(30); | ||
StreamingClient.DefaultOptions = DefaultOptions; | ||
@@ -411,3 +410,3 @@ /** | ||
* @property HANDSHAKE - To indicate the error occurred on handshake | ||
* @property SUBSCRIBE - To indicate the error occured on subscribe | ||
* @property SUBSCRIBE - To indicate the error occurred on subscribe | ||
*/ | ||
@@ -414,0 +413,0 @@ let TimeoutErrorType; |
/// <reference types="node" /> | ||
import * as sinon from 'sinon'; | ||
import * as sinonType from 'sinon'; | ||
import { AnyJson, JsonMap, Optional } from '@salesforce/ts-types'; | ||
@@ -31,3 +31,3 @@ import { EventEmitter } from 'events'; | ||
export interface TestContext { | ||
SANDBOX: sinon.SinonSandbox; | ||
SANDBOX: sinonType.SinonSandbox; | ||
SANDBOXES: SandboxTypes; | ||
@@ -121,3 +121,3 @@ TEST_LOGGER: Logger; | ||
*/ | ||
export declare const testSetup: (sinonInstance?: any) => TestContext; | ||
export declare const testSetup: (sinon?: any) => TestContext; | ||
/** | ||
@@ -124,0 +124,0 @@ * A pre-canned error for try/catch testing. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
* Copyright (c) 2018, salesforce.com, inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
const sinon = require("sinon"); | ||
const kit_1 = require("@salesforce/kit"); | ||
@@ -109,6 +102,6 @@ const ts_types_1 = require("@salesforce/ts-types"); | ||
// tslint:disable-next-line:no-any | ||
exports.testSetup = kit_1.once((sinonInstance) => { | ||
if (!sinonInstance) { | ||
exports.testSetup = kit_1.once((sinon) => { | ||
if (!sinon) { | ||
try { | ||
sinonInstance = require('sinon'); | ||
sinon = require('sinon'); | ||
} | ||
@@ -115,0 +108,0 @@ catch (e) { |
@@ -37,9 +37,5 @@ "use strict"; | ||
]; | ||
const whitelistOfSalesforceHosts = [ | ||
'developer.salesforce.com', | ||
'trailhead.salesforce.com' | ||
]; | ||
const whitelistOfSalesforceHosts = ['developer.salesforce.com', 'trailhead.salesforce.com']; | ||
return whitelistOfSalesforceDomainPatterns.some(pattern => { | ||
return (url.hostname.endsWith(pattern) || | ||
whitelistOfSalesforceHosts.includes(url.hostname)); | ||
return url.hostname.endsWith(pattern) || whitelistOfSalesforceHosts.includes(url.hostname); | ||
}); | ||
@@ -87,4 +83,3 @@ } | ||
function validateSalesforceId(value) { | ||
return (/[a-zA-Z0-9]{18}|[a-zA-Z0-9]{15}/.test(value) && | ||
(value.length === 15 || value.length === 18)); | ||
return /[a-zA-Z0-9]{18}|[a-zA-Z0-9]{15}/.test(value) && (value.length === 15 || value.length === 18); | ||
} | ||
@@ -91,0 +86,0 @@ exports.validateSalesforceId = validateSalesforceId; |
{ | ||
"name": "@salesforce/core", | ||
"version": "0.24.5", | ||
"version": "0.24.6", | ||
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.", | ||
@@ -51,3 +51,3 @@ "main": "lib/exported", | ||
"devDependencies": { | ||
"@salesforce/dev-scripts": "^0.3.1", | ||
"@salesforce/dev-scripts": "0.3.7", | ||
"@salesforce/ts-sinon": "0.2.7", | ||
@@ -54,0 +54,0 @@ "@types/debug": "0.0.30", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
16
31342421
188
12250