UNPKG

@creditkarma/dynamic-config

Version:

Dynamic Config for Node.js backed by Consul and Vault

123 lines 5.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MissingPackageProperty = exports.MissingProcessVariable = exports.MissingEnvironmentVariable = exports.InvalidCharacter = exports.ResolverUnavailable = exports.ConsulFailed = exports.ConsulNotConfigured = exports.HVFailed = exports.HVNotConfigured = exports.UnknownError = exports.DynamicConfigInvalidResolver = exports.DynamicConfigInvalidType = exports.DynamicConfigInvalidObject = exports.DynamicConfigMissingKey = exports.DynamicConfigMissingDefault = exports.MissingConfigPlaceholder = exports.InvalidConfigValue = void 0; class InvalidConfigValue extends Error { constructor(key, msg) { super(`Unable to resolve config at key[${key}]. ${msg}`); this.type = "InvalidConfigValue" /* InvalidConfigValue */; } } exports.InvalidConfigValue = InvalidConfigValue; class MissingConfigPlaceholder extends Error { constructor(key) { super(`Unable to resolve placeholder with key[${key}].`); this.type = "MissingConfigPlaceholder" /* MissingConfigPlaceholder */; } } exports.MissingConfigPlaceholder = MissingConfigPlaceholder; class DynamicConfigMissingDefault extends Error { constructor(path) { super(`Unable to load default config at path[${path}]`); this.type = "DynamicConfigMissingDefault" /* DynamicConfigMissingDefault */; } } exports.DynamicConfigMissingDefault = DynamicConfigMissingDefault; class DynamicConfigMissingKey extends Error { constructor(key) { super(`Unable to find value for key[${key}].`); this.type = "DynamicConfigMissingKey" /* DynamicConfigMissingKey */; } } exports.DynamicConfigMissingKey = DynamicConfigMissingKey; class DynamicConfigInvalidObject extends Error { constructor(key) { super(`Object does not match expected schema[${key}].`); this.type = "DynamicConfigInvalidObject" /* DynamicConfigInvalidObject */; } } exports.DynamicConfigInvalidObject = DynamicConfigInvalidObject; class DynamicConfigInvalidType extends Error { constructor(key, type) { super(`Value for key[${key}] cannot parse as expected type[${type}]`); this.type = "DynamicConfigInvalidType" /* DynamicConfigInvalidType */; } } exports.DynamicConfigInvalidType = DynamicConfigInvalidType; class DynamicConfigInvalidResolver extends Error { constructor(type) { super(`Requested resolver type[${type}] is invalid.`); this.type = "DynamicConfigInvalidResolver" /* DynamicConfigInvalidResolver */; } } exports.DynamicConfigInvalidResolver = DynamicConfigInvalidResolver; class UnknownError extends Error { constructor(msg) { super(msg); this.type = "UnkownError" /* UnknownError */; } } exports.UnknownError = UnknownError; class HVNotConfigured extends Error { constructor(key) { super(`Unable to retrieve key: ${key}. Hashicorp Vault is not configured.`); this.type = "HVNotConfigured" /* HVNotConfigured */; } } exports.HVNotConfigured = HVNotConfigured; class HVFailed extends Error { constructor(message) { super(`Vault failed with error: ${message}.`); this.type = "HVFailed" /* HVFailed */; } } exports.HVFailed = HVFailed; class ConsulNotConfigured extends Error { constructor(key) { super(`Unable to retrieve key: ${key}. Hashicorp Consul is not configured.`); this.type = "ConsulNotConfigured" /* ConsulNotConfigured */; } } exports.ConsulNotConfigured = ConsulNotConfigured; class ConsulFailed extends Error { constructor(key, message) { super(`Unable to retrieve key[${key}] from Consul. Consul failed with error: ${message}.`); this.type = "ConsulFailed" /* ConsulFailed */; } } exports.ConsulFailed = ConsulFailed; class ResolverUnavailable extends Error { constructor(key) { super(`Unable to retrieve key[${key}]. No resolver found.`); this.type = "ResolverUnavailable" /* ResolverUnavailable */; } } exports.ResolverUnavailable = ResolverUnavailable; class InvalidCharacter extends Error { constructor(char) { super(`Environment variable must contain only characters A-Z and '_', found '${char}'`); this.type = "InvalidCharacter" /* InvalidCharacter */; } } exports.InvalidCharacter = InvalidCharacter; class MissingEnvironmentVariable extends Error { constructor(key) { super(`Environment variable '${key}' not set.`); this.type = "MissingEnvironmentVariable" /* MissingEnvironmentVariable */; } } exports.MissingEnvironmentVariable = MissingEnvironmentVariable; class MissingProcessVariable extends Error { constructor(key) { super(`Unable to retrieve key[${key}]. Argument not provided.`); this.type = "MissingProcessVariable" /* MissingProcessVariable */; } } exports.MissingProcessVariable = MissingProcessVariable; class MissingPackageProperty extends Error { constructor(key) { super(`Unable to retrieve key[${key}] from package.json.`); this.type = "MissingPackageProperty" /* MissingPackageProperty */; } } exports.MissingPackageProperty = MissingPackageProperty; //# sourceMappingURL=index.js.map