@salesforce/core
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -0,1 +1,13 @@ | ||
## [1.3.3](https://github.com/forcedotcom/sfdx-core/compare/v1.3.2...v1.3.3) (2019-04-04) | ||
### Bug Fixes | ||
* allow aliases with dots ([e8b17af](https://github.com/forcedotcom/sfdx-core/commit/e8b17af)) | ||
* allow packageAliases in sfdx-project.json ([8d7b1fe](https://github.com/forcedotcom/sfdx-core/commit/8d7b1fe)) | ||
* hide sensitive values from being logged ([8505f04](https://github.com/forcedotcom/sfdx-core/commit/8505f04)) | ||
* move generating the secretfile path to the catch block ([2b9e57d](https://github.com/forcedotcom/sfdx-core/commit/2b9e57d)) | ||
* potential missing key.json file on windows ([f94f127](https://github.com/forcedotcom/sfdx-core/commit/f94f127)) | ||
* properly invoke callbacks ([f03838c](https://github.com/forcedotcom/sfdx-core/commit/f03838c)) | ||
## [1.3.2](https://github.com/forcedotcom/sfdx-core/compare/v1.3.1...v1.3.2) (2019-03-25) | ||
@@ -2,0 +14,0 @@ |
import { JsonMap, Optional } from '@salesforce/ts-types'; | ||
import { ConfigGroup } from './configGroup'; | ||
import { ConfigContents, ConfigValue } from './configStore'; | ||
/** | ||
@@ -58,2 +59,3 @@ * Different groups of aliases. Currently only support orgs. | ||
constructor(options: ConfigGroup.Options); | ||
protected setMethod(contents: ConfigContents, key: string, value?: ConfigValue): void; | ||
} |
@@ -93,4 +93,8 @@ "use strict"; | ||
} | ||
// Don't use kit's set to prevent nested object save | ||
setMethod(contents, key, value) { | ||
contents[key] = value; | ||
} | ||
} | ||
exports.Aliases = Aliases; | ||
//# sourceMappingURL=aliases.js.map |
@@ -30,3 +30,3 @@ import { Dictionary, JsonMap, Optional } from '@salesforce/ts-types'; | ||
static getOptions(defaultGroup: string, filename?: string): ConfigGroup.Options; | ||
private defaultGroup; | ||
protected defaultGroup: string; | ||
/** | ||
@@ -33,0 +33,0 @@ * Sets the default group for all {@link BaseConfigStore} methods to use. |
@@ -9,3 +9,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const kit_1 = require("@salesforce/kit"); | ||
const ts_types_1 = require("@salesforce/ts-types"); | ||
@@ -199,3 +198,3 @@ const sfdxError_1 = require("../sfdxError"); | ||
content = this.getGroup(group) || {}; | ||
kit_1.set(content, key, value); | ||
this.setMethod(content, key, value); | ||
return content; | ||
@@ -202,0 +201,0 @@ } |
@@ -131,2 +131,3 @@ import { AsyncCreatable } from '@salesforce/kit'; | ||
setContentsFromObject<U extends object>(obj: U): void; | ||
protected setMethod(contents: ConfigContents, key: string, value?: ConfigValue): void; | ||
} | ||
@@ -133,0 +134,0 @@ /** |
@@ -69,3 +69,3 @@ "use strict"; | ||
set(key, value) { | ||
kit_1.set(this.contents, key, value); | ||
this.setMethod(this.contents, key, value); | ||
return this.contents; | ||
@@ -153,7 +153,12 @@ } | ||
Object.entries(obj).forEach(([key, value]) => { | ||
kit_1.set(this.contents, key, value); | ||
this.setMethod(this.contents, key, value); | ||
}); | ||
} | ||
// Allows extended classes the ability to override the set method. i.e. maybe they don't want | ||
// nexted object set from kit. | ||
setMethod(contents, key, value) { | ||
kit_1.set(contents, key, value); | ||
} | ||
} | ||
exports.BaseConfigStore = BaseConfigStore; | ||
//# sourceMappingURL=configStore.js.map |
@@ -86,2 +86,3 @@ /// <reference types="node" /> | ||
export declare class GenericWindowsKeychainAccess extends GenericKeychainAccess { | ||
protected isValidFileAccess(cb: (error: Nullable<Error>) => Promise<void>): Promise<void>; | ||
} | ||
@@ -88,0 +89,0 @@ /** |
@@ -409,2 +409,19 @@ "use strict"; | ||
class GenericWindowsKeychainAccess extends GenericKeychainAccess { | ||
async isValidFileAccess(cb) { | ||
await super.isValidFileAccess(async (err) => { | ||
if (err != null) { | ||
await cb(err); | ||
} | ||
else { | ||
try { | ||
const secretFile = path.join(await configFile_1.ConfigFile.resolveRootFolder(true), global_1.Global.STATE_FOLDER, ts_types_1.ensure(keychainConfig_1.KeychainConfig.getDefaultOptions().filename)); | ||
await fs_1.fs.access(secretFile, fs_1.fs.constants.R_OK | fs_1.fs.constants.W_OK); | ||
await cb(null); | ||
} | ||
catch (e) { | ||
await cb(err); | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
@@ -411,0 +428,0 @@ exports.GenericWindowsKeychainAccess = GenericWindowsKeychainAccess; |
@@ -489,2 +489,3 @@ "use strict"; | ||
'sid', | ||
'Authorization', | ||
// Any json attribute that contains the words "access" and "token" will have the attribute/value hidden | ||
@@ -491,0 +492,0 @@ { name: 'access_token', regex: 'access[^\'"]*token' }, |
@@ -21,2 +21,3 @@ import { ConfigFile } from './config/configFile'; | ||
export declare class SfdxProjectJson extends ConfigFile<ConfigFile.Options> { | ||
static BLACKLIST: string[]; | ||
static getFileName(): string; | ||
@@ -26,2 +27,3 @@ static getDefaultOptions(isGlobal?: boolean): ConfigFile.Options; | ||
read(): Promise<ConfigContents>; | ||
write(newContents?: ConfigContents): Promise<ConfigContents>; | ||
getDefaultOptions(options?: ConfigFile.Options): ConfigFile.Options; | ||
@@ -28,0 +30,0 @@ } |
@@ -32,2 +32,5 @@ "use strict"; | ||
class SfdxProjectJson extends configFile_1.ConfigFile { | ||
constructor(options) { | ||
super(options); | ||
} | ||
static getFileName() { | ||
@@ -41,9 +44,6 @@ return internal_1.SFDX_PROJECT_JSON; | ||
} | ||
constructor(options) { | ||
super(options); | ||
} | ||
async read() { | ||
const contents = await super.read(); | ||
// Verify that the configObject does not have upper case keys; throw if it does. Must be heads down camel case. | ||
const upperCaseKey = sfdc_1.sfdc.findUpperCaseKeys(this.toObject()); | ||
const upperCaseKey = sfdc_1.sfdc.findUpperCaseKeys(this.toObject(), SfdxProjectJson.BLACKLIST); | ||
if (upperCaseKey) { | ||
@@ -54,2 +54,10 @@ throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'InvalidJsonCasing', [upperCaseKey, this.getPath()]); | ||
} | ||
async write(newContents) { | ||
// Verify that the configObject does not have upper case keys; throw if it does. Must be heads down camel case. | ||
const upperCaseKey = sfdc_1.sfdc.findUpperCaseKeys(newContents, SfdxProjectJson.BLACKLIST); | ||
if (upperCaseKey) { | ||
throw sfdxError_1.SfdxError.create('@salesforce/core', 'core', 'InvalidJsonCasing', [upperCaseKey, this.getPath()]); | ||
} | ||
return super.write(newContents); | ||
} | ||
getDefaultOptions(options) { | ||
@@ -63,2 +71,3 @@ const defaultOptions = { | ||
} | ||
SfdxProjectJson.BLACKLIST = ['packageAliases']; | ||
exports.SfdxProjectJson = SfdxProjectJson; | ||
@@ -65,0 +74,0 @@ /** |
@@ -34,3 +34,3 @@ /// <reference types="node" /> | ||
*/ | ||
writeFn?: () => Promise<void>; | ||
writeFn?: (contents: AnyJson) => Promise<void>; | ||
/** | ||
@@ -37,0 +37,0 @@ * The contents that are used when @{link ConfigFile.read} unless retrieveContents is set. This will also contain the |
@@ -41,4 +41,5 @@ import { JsonMap, Optional } from '@salesforce/ts-types'; | ||
* @param data The object in which to check key casing. | ||
* @param sectionBlacklist properties in the object to exclude from the search. e.g. a blacklist of `["a"]` and data of `{ "a": { "B" : "b"}}` would ignore `B` because it is in the object value under `a`. | ||
*/ | ||
findUpperCaseKeys: (data?: Optional<JsonMap>) => string | undefined; | ||
findUpperCaseKeys: (data?: Optional<JsonMap>, sectionBlacklist?: string[]) => string | undefined; | ||
}; |
@@ -84,4 +84,5 @@ "use strict"; | ||
* @param data The object in which to check key casing. | ||
* @param sectionBlacklist properties in the object to exclude from the search. e.g. a blacklist of `["a"]` and data of `{ "a": { "B" : "b"}}` would ignore `B` because it is in the object value under `a`. | ||
*/ | ||
findUpperCaseKeys: (data) => { | ||
findUpperCaseKeys: (data, sectionBlacklist = []) => { | ||
let key; | ||
@@ -93,2 +94,5 @@ kit_1.findKey(data, (val, k) => { | ||
else if (ts_types_1.isJsonMap(val)) { | ||
if (sectionBlacklist.includes(k)) { | ||
return key; | ||
} | ||
key = exports.sfdc.findUpperCaseKeys(ts_types_1.asJsonMap(val)); | ||
@@ -95,0 +99,0 @@ } |
{ | ||
"name": "@salesforce/core", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.", | ||
@@ -5,0 +5,0 @@ "main": "lib/exported", |
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
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
428357
10811