balena-settings-client
Advanced tools
Comparing version 5.0.1 to 5.0.2-build-flowzonify-f83a096015ccb7bdd6195c8cc0fbbe16ce62ae5f-1
@@ -0,1 +1,6 @@ | ||
/** | ||
* @summary Configuration settings | ||
* @namespace config | ||
* @private | ||
*/ | ||
declare const _default: { | ||
@@ -30,7 +35,2 @@ /** | ||
}; | ||
/** | ||
* @summary Configuration settings | ||
* @namespace config | ||
* @private | ||
*/ | ||
export = _default; |
@@ -31,3 +31,3 @@ "use strict"; | ||
*/ | ||
user: path_1.join(userHome, hidepath('balenarc.yml')), | ||
user: (0, path_1.join)(userHome, hidepath('balenarc.yml')), | ||
/** | ||
@@ -37,3 +37,3 @@ * @property {String} user - path to legacy user config | ||
*/ | ||
userLegacy: path_1.join(userHome, hidepath('resinrc.yml')), | ||
userLegacy: (0, path_1.join)(userHome, hidepath('resinrc.yml')), | ||
/** | ||
@@ -43,3 +43,3 @@ * @property {String} project - path to project config | ||
*/ | ||
project: path_1.join(process.cwd(), 'balenarc.yml'), | ||
project: (0, path_1.join)(process.cwd(), 'balenarc.yml'), | ||
/** | ||
@@ -49,5 +49,5 @@ * @property {String} project - path to legacy project config | ||
*/ | ||
projectLegacy: path_1.join(process.cwd(), 'resinrc.yml'), | ||
projectLegacy: (0, path_1.join)(process.cwd(), 'resinrc.yml'), | ||
}, | ||
}; | ||
//# sourceMappingURL=config.js.map |
@@ -0,1 +1,6 @@ | ||
/** | ||
* @summary Default settings | ||
* @namespace defaults | ||
* @protected | ||
*/ | ||
declare const _default: { | ||
@@ -83,7 +88,2 @@ /** | ||
}; | ||
/** | ||
* @summary Default settings | ||
* @namespace defaults | ||
* @protected | ||
*/ | ||
export = _default; |
@@ -31,3 +31,3 @@ "use strict"; | ||
apiUrl: function () { | ||
return "https://api." + this.balenaUrl; | ||
return "https://api.".concat(this.balenaUrl); | ||
}, | ||
@@ -39,3 +39,3 @@ /** | ||
vpnUrl: function () { | ||
return "vpn." + this.balenaUrl; | ||
return "vpn.".concat(this.balenaUrl); | ||
}, | ||
@@ -47,3 +47,3 @@ /** | ||
registryUrl: function () { | ||
return "registry." + this.balenaUrl; | ||
return "registry.".concat(this.balenaUrl); | ||
}, | ||
@@ -55,3 +55,3 @@ /** | ||
registry2Url: function () { | ||
return "registry2." + this.balenaUrl; | ||
return "registry2.".concat(this.balenaUrl); | ||
}, | ||
@@ -63,3 +63,3 @@ /** | ||
deltaUrl: function () { | ||
return "https://delta." + this.balenaUrl; | ||
return "https://delta.".concat(this.balenaUrl); | ||
}, | ||
@@ -71,3 +71,3 @@ /** | ||
dashboardUrl: function () { | ||
return "https://dashboard." + this.balenaUrl; | ||
return "https://dashboard.".concat(this.balenaUrl); | ||
}, | ||
@@ -88,3 +88,3 @@ /** | ||
} | ||
return "devices." + this.balenaUrl; | ||
return "devices.".concat(this.balenaUrl); | ||
}, | ||
@@ -96,3 +96,3 @@ /** | ||
tunnelUrl: function () { | ||
return "tunnel." + this.balenaUrl; | ||
return "tunnel.".concat(this.balenaUrl); | ||
}, | ||
@@ -103,3 +103,3 @@ /** | ||
*/ | ||
dataDirectory: path_1.join(userHome, hidepath('balena')), | ||
dataDirectory: (0, path_1.join)(userHome, hidepath('balena')), | ||
/** | ||
@@ -109,3 +109,3 @@ * @property {String} projectsDirectory - projects directory path | ||
*/ | ||
projectsDirectory: path_1.join(userHome, 'BalenaProjects'), | ||
projectsDirectory: (0, path_1.join)(userHome, 'BalenaProjects'), | ||
/** | ||
@@ -116,3 +116,3 @@ * @property {Function} cacheDirectory - cache directory path | ||
cacheDirectory: function () { | ||
return path_1.join(this.dataDirectory, 'cache'); | ||
return (0, path_1.join)(this.dataDirectory, 'cache'); | ||
}, | ||
@@ -124,3 +124,3 @@ /** | ||
binDirectory: function () { | ||
return path_1.join(this.dataDirectory, 'bin'); | ||
return (0, path_1.join)(this.dataDirectory, 'bin'); | ||
}, | ||
@@ -127,0 +127,0 @@ /** |
@@ -16,3 +16,3 @@ import * as _ from 'lodash'; | ||
*/ | ||
export declare const getSettingName: (variable?: string | undefined) => string; | ||
export declare const getSettingName: (variable?: string) => string; | ||
/** | ||
@@ -19,0 +19,0 @@ * @summary Determine if a variable is a configuration variable |
@@ -34,3 +34,3 @@ "use strict"; | ||
*/ | ||
exports.getSettingName = function (variable) { | ||
var getSettingName = function (variable) { | ||
variable = variable != null ? variable.trim() : undefined; | ||
@@ -44,2 +44,3 @@ if (!variable) { | ||
}; | ||
exports.getSettingName = getSettingName; | ||
/** | ||
@@ -61,5 +62,6 @@ * @summary Determine if a variable is a configuration variable | ||
*/ | ||
exports.isSettingVariable = function (variable) { | ||
var isSettingVariable = function (variable) { | ||
return /^(BALENARC_|RESINRC_)(.)+/i.test(variable); | ||
}; | ||
exports.isSettingVariable = isSettingVariable; | ||
/** | ||
@@ -82,8 +84,9 @@ * @summary Parse environment variables | ||
*/ | ||
exports.parse = function (environment) { | ||
var parse = function (environment) { | ||
return _.chain(environment) | ||
.pickBy(function (v, k) { return exports.isSettingVariable(k) && !!v; }) | ||
.mapKeys(function (_v, k) { return exports.getSettingName(k); }) | ||
.pickBy(function (v, k) { return (0, exports.isSettingVariable)(k) && !!v; }) | ||
.mapKeys(function (_v, k) { return (0, exports.getSettingName)(k); }) | ||
.value(); | ||
}; | ||
exports.parse = parse; | ||
//# sourceMappingURL=environment.js.map |
@@ -88,3 +88,3 @@ "use strict"; | ||
catch (error) { | ||
throw new Error("Error parsing config file " + file + ": " + error.message); | ||
throw new Error("Error parsing config file ".concat(file, ": ").concat(error.message)); | ||
} | ||
@@ -109,6 +109,7 @@ }; | ||
*/ | ||
exports.get = function (name) { | ||
var get = function (name) { | ||
var settings = getSettings(); | ||
return utils.evaluateSetting(settings, name); | ||
}; | ||
exports.get = get; | ||
/** | ||
@@ -124,6 +125,7 @@ * @summary Get all settings | ||
*/ | ||
exports.getAll = function () { | ||
var getAll = function () { | ||
var settings = getSettings(); | ||
return _.mapValues(settings, function (_setting, name) { return exports.get(name); }); | ||
return _.mapValues(settings, function (_setting, name) { return (0, exports.get)(name); }); | ||
}; | ||
exports.getAll = getAll; | ||
//# sourceMappingURL=settings.js.map |
@@ -77,7 +77,7 @@ "use strict"; | ||
*/ | ||
exports.evaluateSetting = function (settings, property) { | ||
var evaluateSetting = function (settings, property) { | ||
if (settings === void 0) { settings = {}; } | ||
var value = _.get(settings, property); | ||
if (value == null) { | ||
throw new Error("Setting not found: " + property); | ||
throw new Error("Setting not found: ".concat(property)); | ||
} | ||
@@ -91,2 +91,3 @@ if (_.isFunction(value)) { | ||
}; | ||
exports.evaluateSetting = evaluateSetting; | ||
//# sourceMappingURL=utils.js.map |
@@ -34,10 +34,11 @@ "use strict"; | ||
*/ | ||
exports.parse = function (yaml) { | ||
var parse = function (yaml) { | ||
var jsYaml = require('js-yaml'); | ||
var result = jsYaml.safeLoad(yaml); | ||
if (typeof result === 'string' || !result) { | ||
throw new Error("Invalid YAML: " + yaml); | ||
throw new Error("Invalid YAML: ".concat(yaml)); | ||
} | ||
return result; | ||
}; | ||
exports.parse = parse; | ||
//# sourceMappingURL=yaml.js.map |
@@ -7,2 +7,9 @@ # Change Log | ||
# v5.0.2 | ||
## (2023-04-20) | ||
* Update Typescript to v5.0.2 to fix master [Thodoris Greasidis] | ||
* Disable package-lock.json generation [Thodoris Greasidis] | ||
* Replace balenaCI with flowzone [Thodoris Greasidis] | ||
# v5.0.1 | ||
@@ -9,0 +16,0 @@ ## (2022-05-03) |
{ | ||
"name": "balena-settings-client", | ||
"version": "5.0.1", | ||
"version": "5.0.2-build-flowzonify-f83a096015ccb7bdd6195c8cc0fbbe16ce62ae5f-1", | ||
"description": "Balena client application shared settings", | ||
@@ -35,3 +35,3 @@ "main": "build/settings.js", | ||
"devDependencies": { | ||
"@balena/lint": "^5.0.4", | ||
"@balena/lint": "^6.2.2", | ||
"@resin.io/types-wary": "1.1.1", | ||
@@ -54,4 +54,4 @@ "@types/bluebird": "^3.5.30", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^8.9.0", | ||
"typescript": "^3.8.3", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.4", | ||
"wary": "^1.1.0" | ||
@@ -81,4 +81,4 @@ }, | ||
"versionist": { | ||
"publishedAt": "2022-05-03T07:26:00.167Z" | ||
"publishedAt": "2023-04-20T17:52:16.903Z" | ||
} | ||
} |
@@ -77,9 +77,9 @@ balena-settings-client | ||
* [settings](#module_settings) | ||
* [.get(name)](#module_settings.get) ⇒ <code>\*</code> | ||
* [.getAll()](#module_settings.getAll) ⇒ <code>Object</code> | ||
* [~get(name)](#module_settings..get) ⇒ <code>\*</code> | ||
* [~getAll()](#module_settings..getAll) ⇒ <code>Object</code> | ||
<a name="module_settings.get"></a> | ||
<a name="module_settings..get"></a> | ||
### settings.get(name) ⇒ <code>\*</code> | ||
**Kind**: static method of [<code>settings</code>](#module_settings) | ||
### settings~get(name) ⇒ <code>\*</code> | ||
**Kind**: inner method of [<code>settings</code>](#module_settings) | ||
**Summary**: Get a setting | ||
@@ -97,6 +97,6 @@ **Returns**: <code>\*</code> - setting value | ||
``` | ||
<a name="module_settings.getAll"></a> | ||
<a name="module_settings..getAll"></a> | ||
### settings.getAll() ⇒ <code>Object</code> | ||
**Kind**: static method of [<code>settings</code>](#module_settings) | ||
### settings~getAll() ⇒ <code>Object</code> | ||
**Kind**: inner method of [<code>settings</code>](#module_settings) | ||
**Summary**: Get all settings | ||
@@ -103,0 +103,0 @@ **Returns**: <code>Object</code> - all settings |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
99843
42
1952
1