@app-config/extensions
Advanced tools
Comparing version 2.7.1 to 2.7.2
@@ -10,4 +10,4 @@ "use strict"; | ||
const metadata = { shouldOverride: true }; | ||
return extension_utils_1.named('$env', extension_utils_1.forKey('$env', extension_utils_1.validateOptions((SchemaBuilder) => SchemaBuilder.emptySchema().addAdditionalProperties(), (value, _, parentKeys, context) => (parse) => { | ||
const environment = node_1.currentEnvFromContext(context, node_1.asEnvOptions(environmentOverride, aliases, environmentSourceNames)); | ||
return (0, extension_utils_1.named)('$env', (0, extension_utils_1.forKey)('$env', (0, extension_utils_1.validateOptions)((SchemaBuilder) => SchemaBuilder.emptySchema().addAdditionalProperties(), (value, _, parentKeys, context) => (parse) => { | ||
const environment = (0, node_1.currentEnvFromContext)(context, (0, node_1.asEnvOptions)(environmentOverride, aliases, environmentSourceNames)); | ||
if (!environment) { | ||
@@ -20,3 +20,3 @@ if ('none' in value) { | ||
} | ||
const path = extension_utils_1.keysToPath(parentKeys); | ||
const path = (0, extension_utils_1.keysToPath)(parentKeys); | ||
throw new core_1.AppConfigError(`An $env directive was used (in ${path}), but current environment (eg. NODE_ENV) is undefined`); | ||
@@ -33,3 +33,3 @@ } | ||
const found = Object.keys(value).join(', '); | ||
const path = extension_utils_1.keysToPath(parentKeys); | ||
const path = (0, extension_utils_1.keysToPath)(parentKeys); | ||
throw new core_1.AppConfigError(`An $env directive was used (in ${path}), but none matched the current environment (wanted ${environment}, saw [${found}])`); | ||
@@ -36,0 +36,0 @@ }, |
@@ -10,3 +10,3 @@ "use strict"; | ||
function envVarDirective(aliases = node_1.defaultAliases, environmentOverride, environmentSourceNames) { | ||
return extension_utils_1.named('$envVar', extension_utils_1.forKey('$envVar', (value, key, parentKeys, context) => async (parse) => { | ||
return (0, extension_utils_1.named)('$envVar', (0, extension_utils_1.forKey)('$envVar', (value, key, parentKeys, context) => async (parse) => { | ||
let name; | ||
@@ -65,3 +65,3 @@ let parseInt = false; | ||
if (name === 'APP_CONFIG_ENV') { | ||
const environment = node_1.currentEnvFromContext(context, node_1.asEnvOptions(environmentOverride, aliases, environmentSourceNames)); | ||
const environment = (0, node_1.currentEnvFromContext)(context, (0, node_1.asEnvOptions)(environmentOverride, aliases, environmentSourceNames)); | ||
resolvedValue = environment; | ||
@@ -93,5 +93,5 @@ } | ||
exports.envVarDirective = envVarDirective; | ||
const validateObject = extension_utils_1.validationFunction(({ emptySchema }) => emptySchema().addAdditionalProperties()); | ||
const validateString = extension_utils_1.validationFunction(({ stringSchema }) => stringSchema()); | ||
const validateStringOrNull = extension_utils_1.validationFunction(({ fromJsonSchema }) => fromJsonSchema({ type: ['null', 'string'] })); | ||
const validateObject = (0, extension_utils_1.validationFunction)(({ emptySchema }) => emptySchema().addAdditionalProperties()); | ||
const validateString = (0, extension_utils_1.validationFunction)(({ stringSchema }) => stringSchema()); | ||
const validateStringOrNull = (0, extension_utils_1.validationFunction)(({ fromJsonSchema }) => fromJsonSchema({ type: ['null', 'string'] })); | ||
//# sourceMappingURL=env-var-directive.js.map |
@@ -11,3 +11,3 @@ "use strict"; | ||
function eqDirective() { | ||
return extension_utils_1.named('$eq', extension_utils_1.forKey('$eq', extension_utils_1.validateOptions((SchemaBuilder) => SchemaBuilder.arraySchema(SchemaBuilder.fromJsonSchema({})), (values) => async (parse) => { | ||
return (0, extension_utils_1.named)('$eq', (0, extension_utils_1.forKey)('$eq', (0, extension_utils_1.validateOptions)((SchemaBuilder) => SchemaBuilder.arraySchema(SchemaBuilder.fromJsonSchema({})), (values) => async (parse) => { | ||
for (const a of values) { | ||
@@ -17,3 +17,3 @@ for (const b of values) { | ||
continue; | ||
if (lodash_isequal_1.default(a, b)) | ||
if ((0, lodash_isequal_1.default)(a, b)) | ||
continue; | ||
@@ -20,0 +20,0 @@ return parse(false, { shouldFlatten: true }); |
@@ -10,3 +10,3 @@ "use strict"; | ||
function fileReferenceDirective(keyName, meta) { | ||
return extension_utils_1.forKey(keyName, extension_utils_1.validateOptions((SchemaBuilder) => { | ||
return (0, extension_utils_1.forKey)(keyName, (0, extension_utils_1.validateOptions)((SchemaBuilder) => { | ||
const reference = SchemaBuilder.oneOf(SchemaBuilder.stringSchema(), SchemaBuilder.emptySchema() | ||
@@ -20,6 +20,6 @@ .addString('path') | ||
const retrieveFile = async (filepath, subselector, isOptional = false, env) => { | ||
const resolvedPath = node_1.resolveFilepath(source, filepath); | ||
const resolvedPath = (0, node_1.resolveFilepath)(source, filepath); | ||
logging_1.logger.verbose(`Loading file for ${keyName}: ${resolvedPath}`); | ||
const resolvedSource = new node_1.FileSource(resolvedPath); | ||
const environmentOptions = Object.assign({}, node_1.environmentOptionsFromContext(context)); | ||
const environmentOptions = Object.assign({}, (0, node_1.environmentOptionsFromContext)(context)); | ||
if (env) { | ||
@@ -70,3 +70,3 @@ environmentOptions.override = env; | ||
function overrideDirective() { | ||
return extension_utils_1.named('$override', fileReferenceDirective('$override', { shouldOverride: true })); | ||
return (0, extension_utils_1.named)('$override', fileReferenceDirective('$override', { shouldOverride: true })); | ||
} | ||
@@ -76,3 +76,3 @@ exports.overrideDirective = overrideDirective; | ||
function extendsDirective() { | ||
return extension_utils_1.named('$extends', fileReferenceDirective('$extends', { shouldMerge: true })); | ||
return (0, extension_utils_1.named)('$extends', fileReferenceDirective('$extends', { shouldMerge: true })); | ||
} | ||
@@ -82,4 +82,4 @@ exports.extendsDirective = extendsDirective; | ||
function extendsSelfDirective() { | ||
const validate = extension_utils_1.validationFunction(({ oneOf, stringSchema, emptySchema }) => oneOf(stringSchema(), emptySchema().addString('select').addString('env', {}, false))); | ||
return extension_utils_1.named('$extendsSelf', extension_utils_1.forKey('$extendsSelf', (input, key, parentKeys, ctx) => async (parse, _, __, ___, root) => { | ||
const validate = (0, extension_utils_1.validationFunction)(({ oneOf, stringSchema, emptySchema }) => oneOf(stringSchema(), emptySchema().addString('select').addString('env', {}, false))); | ||
return (0, extension_utils_1.named)('$extendsSelf', (0, extension_utils_1.forKey)('$extendsSelf', (input, key, parentKeys, ctx) => async (parse, _, __, ___, root) => { | ||
let select; | ||
@@ -95,3 +95,3 @@ let env; | ||
} | ||
const environmentOptions = Object.assign(Object.assign({}, node_1.environmentOptionsFromContext(ctx)), { override: env }); | ||
const environmentOptions = Object.assign(Object.assign({}, (0, node_1.environmentOptionsFromContext)(ctx)), { override: env }); | ||
// we temporarily use a ParsedValue literal so that we get the same property lookup semantics | ||
@@ -98,0 +98,0 @@ const selected = core_1.ParsedValue.literal(root).property(select.split('.')); |
@@ -7,3 +7,3 @@ "use strict"; |
function hiddenDirective() { |
return extension_utils_1.named('$hidden', extension_utils_1.forKey('$hidden', () => async (parse) => { |
return (0, extension_utils_1.named)('$hidden', (0, extension_utils_1.forKey)('$hidden', () => async (parse) => { |
return parse({}, { shouldMerge: true }); |
@@ -10,0 +10,0 @@ })); |
@@ -7,3 +7,3 @@ "use strict"; | ||
function ifDirective() { | ||
return extension_utils_1.named('$if', extension_utils_1.forKey('$if', extension_utils_1.validateOptions((SchemaBuilder) => SchemaBuilder.emptySchema() | ||
return (0, extension_utils_1.named)('$if', (0, extension_utils_1.forKey)('$if', (0, extension_utils_1.validateOptions)((SchemaBuilder) => SchemaBuilder.emptySchema() | ||
.addProperty('$check', SchemaBuilder.fromJsonSchema({})) | ||
@@ -10,0 +10,0 @@ .addProperty('$then', SchemaBuilder.fromJsonSchema({})) |
@@ -31,3 +31,3 @@ "use strict"; | ||
function markAllValuesAsSecret() { | ||
return extension_utils_1.named('markAllValuesAsSecret', (value) => (parse) => parse(value, { fromSecrets: true })); | ||
return (0, extension_utils_1.named)('markAllValuesAsSecret', (value) => (parse) => parse(value, { fromSecrets: true })); | ||
} | ||
@@ -37,3 +37,3 @@ exports.markAllValuesAsSecret = markAllValuesAsSecret; | ||
function unescape$Directives() { | ||
return extension_utils_1.named('unescape$', (value, [_, key]) => { | ||
return (0, extension_utils_1.named)('unescape$', (value, [_, key]) => { | ||
if (typeof key === 'string' && key.startsWith('$$')) { | ||
@@ -40,0 +40,0 @@ return async (parse) => { |
@@ -8,4 +8,4 @@ "use strict"; | ||
function parseDirective() { | ||
return extension_utils_1.named('$parse', extension_utils_1.composeExtensions([ | ||
extension_utils_1.forKey('$parseBool', (value) => async (parse) => { | ||
return (0, extension_utils_1.named)('$parse', (0, extension_utils_1.composeExtensions)([ | ||
(0, extension_utils_1.forKey)('$parseBool', (value) => async (parse) => { | ||
const parsed = await parse(value); | ||
@@ -20,3 +20,3 @@ const primitive = parsed.asPrimitive(); | ||
}), | ||
extension_utils_1.forKey('$parseFloat', (value) => async (parse) => { | ||
(0, extension_utils_1.forKey)('$parseFloat', (value) => async (parse) => { | ||
const parsed = await parse(value); | ||
@@ -36,3 +36,3 @@ const primitive = parsed.asPrimitive(); | ||
}), | ||
extension_utils_1.forKey('$parseInt', (value) => async (parse) => { | ||
(0, extension_utils_1.forKey)('$parseInt', (value) => async (parse) => { | ||
const parsed = await parse(value); | ||
@@ -39,0 +39,0 @@ const primitive = parsed.asPrimitive(); |
@@ -10,4 +10,4 @@ "use strict"; | ||
function substituteDirective(aliases = node_1.defaultAliases, environmentOverride, environmentSourceNames) { | ||
return extension_utils_1.named('$substitute', extension_utils_1.forKey(['$substitute', '$subs'], (value, key, parentKeys, context) => async (parse) => { | ||
const environment = node_1.currentEnvFromContext(context, node_1.asEnvOptions(environmentOverride, aliases, environmentSourceNames)); | ||
return (0, extension_utils_1.named)('$substitute', (0, extension_utils_1.forKey)(['$substitute', '$subs'], (value, key, parentKeys, context) => async (parse) => { | ||
const environment = (0, node_1.currentEnvFromContext)(context, (0, node_1.asEnvOptions)(environmentOverride, aliases, environmentSourceNames)); | ||
if (typeof value === 'string') { | ||
@@ -138,5 +138,5 @@ return parse(performAllSubstitutions(value, environment), { shouldFlatten: true }); | ||
} | ||
const validateObject = extension_utils_1.validationFunction(({ emptySchema }) => emptySchema().addAdditionalProperties()); | ||
const validateString = extension_utils_1.validationFunction(({ stringSchema }) => stringSchema()); | ||
const validateStringOrNull = extension_utils_1.validationFunction(({ fromJsonSchema }) => fromJsonSchema({ type: ['null', 'string'] })); | ||
const validateObject = (0, extension_utils_1.validationFunction)(({ emptySchema }) => emptySchema().addAdditionalProperties()); | ||
const validateString = (0, extension_utils_1.validationFunction)(({ stringSchema }) => stringSchema()); | ||
const validateStringOrNull = (0, extension_utils_1.validationFunction)(({ fromJsonSchema }) => fromJsonSchema({ type: ['null', 'string'] })); | ||
//# sourceMappingURL=substitute-directive.js.map |
@@ -19,3 +19,3 @@ "use strict"; | ||
function timestampDirective(dateSource = () => new Date()) { | ||
return extension_utils_1.named('$timestamp', extension_utils_1.forKey('$timestamp', extension_utils_1.validateOptions((SchemaBuilder) => SchemaBuilder.oneOf(SchemaBuilder.booleanSchema(), SchemaBuilder.emptySchema() | ||
return (0, extension_utils_1.named)('$timestamp', (0, extension_utils_1.forKey)('$timestamp', (0, extension_utils_1.validateOptions)((SchemaBuilder) => SchemaBuilder.oneOf(SchemaBuilder.booleanSchema(), SchemaBuilder.emptySchema() | ||
.addString('day', {}, false) | ||
@@ -22,0 +22,0 @@ .addString('month', {}, false) |
@@ -8,3 +8,3 @@ "use strict"; | ||
function tryDirective() { | ||
return extension_utils_1.named('$try', extension_utils_1.forKey('$try', extension_utils_1.validateOptions((SchemaBuilder) => SchemaBuilder.emptySchema() | ||
return (0, extension_utils_1.named)('$try', (0, extension_utils_1.forKey)('$try', (0, extension_utils_1.validateOptions)((SchemaBuilder) => SchemaBuilder.emptySchema() | ||
.addProperty('$value', SchemaBuilder.fromJsonSchema({})) | ||
@@ -11,0 +11,0 @@ .addProperty('$fallback', SchemaBuilder.fromJsonSchema({})) |
{ | ||
"name": "@app-config/extensions", | ||
"description": "Common parsing extensions for @app-config", | ||
"version": "2.7.1", | ||
"version": "2.7.2", | ||
"license": "MPL-2.0", | ||
@@ -33,11 +33,11 @@ "author": { | ||
"dependencies": { | ||
"@app-config/core": "^2.7.1", | ||
"@app-config/extension-utils": "^2.7.1", | ||
"@app-config/logging": "^2.7.1", | ||
"@app-config/node": "^2.7.1", | ||
"@app-config/utils": "^2.7.1", | ||
"@app-config/core": "^2.7.2", | ||
"@app-config/extension-utils": "^2.7.2", | ||
"@app-config/logging": "^2.7.2", | ||
"@app-config/node": "^2.7.2", | ||
"@app-config/utils": "^2.7.2", | ||
"lodash.isequal": "4" | ||
}, | ||
"devDependencies": { | ||
"@app-config/test-utils": "^2.7.1", | ||
"@app-config/test-utils": "^2.7.2", | ||
"@types/lodash.isequal": "4" | ||
@@ -44,0 +44,0 @@ }, |
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
111810
2086
Updated@app-config/core@^2.7.2
Updated@app-config/logging@^2.7.2
Updated@app-config/node@^2.7.2
Updated@app-config/utils@^2.7.2