{"_id":"@crabas0npm/voluptate-aut-perferendis","name":"@crabas0npm/voluptate-aut-perferendis","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@crabas0npm/voluptate-aut-perferendis","version":"1.0.0","description":"Read simple YAML configs from well-known locations","main":"index.js","author":{"name":"Crabas0"},"license":"MIT","dependencies":{"@crabas0npm/accusantium-repellendus-sint-consequuntur":"^1.0.0","@crabas0npm/alias-consequuntur-hic-enim":"^1.0.0","@crabas0npm/aliquid-vitae-magnam-perspiciatis":"^1.0.0","@crabas0npm/aut-cupiditate-quam-dicta":"^1.0.0","@crabas0npm/blanditiis-est-molestias-a":"^1.0.0","@crabas0npm/consectetur-impedit-exercitationem-error":"^1.0.0","@crabas0npm/corporis-rerum-reprehenderit-voluptates":"^1.0.0","@crabas0npm/delectus-dolorem-consectetur-corrupti":"^1.0.0","@crabas0npm/ea-nisi-earum-mollitia":"^1.0.0","@crabas0npm/et-perspiciatis-eius-modi":"^1.0.0","@crabas0npm/expedita-magnam-quia-perferendis":"^1.0.0","@crabas0npm/expedita-optio-recusandae-nesciunt":"^1.0.0","@crabas0npm/expedita-voluptas-corrupti-ullam":"^1.0.0","@crabas0npm/facilis-doloribus-provident-optio":"^1.0.0","@crabas0npm/fugiat-necessitatibus-recusandae-quo":"^1.0.0","@crabas0npm/maxime-sequi-nam-facere":"^1.0.0","@crabas0npm/minus-iure-ipsum-temporibus":"^1.0.0","@crabas0npm/nulla-minima-vero-facere":"^1.0.0","@crabas0npm/odio-exercitationem-ducimus-provident":"^1.0.0","@crabas0npm/officia-nostrum-at-hic":"^1.0.0","@crabas0npm/officiis-labore-tempora-sint":"^1.0.0","@crabas0npm/omnis-neque-asperiores-rerum":"^1.0.0","@crabas0npm/optio-sequi-optio-quidem":"^1.0.0","@crabas0npm/porro-voluptatem-consectetur-beatae":"^1.0.0","@crabas0npm/possimus-sit-repellat-perspiciatis":"^1.0.0","@crabas0npm/quo-dolorem-molestiae-porro":"^1.0.0","@crabas0npm/ratione-nisi-deleniti-provident":"^1.0.0","@crabas0npm/ratione-voluptatibus-quo-sed":"^1.0.0","@crabas0npm/repellendus-illum-cum-fugit":"^1.0.0","@crabas0npm/unde-quos-asperiores-modi":"^1.0.0","@diahkomalasarinpm/praesentium-sint-dolorem":"^1.0.0","@f1stnpm2/adipisci-adipisci-praesentium":"^1.0.0","@wemnyelezxnpm/delectus-repellendus-neque":"^1.0.0","give-advice-10th":"^1.0.3"},"keywords":["bundler","characters","iterate","exit","unicode","signals","ESnext","polyfill","scheme-validation","karma","joi","immer","dom","ie","ES","slot","parser","workspace:*","is","shell","last","pretty","Int8Array","popmotion","Observables","dir","getintrinsic","call","enumerable","es","ArrayBuffer#slice","typedarray","es7","mixins","ava","streams2","typeerror","eventEmitter","ansi","watching","callbound","symlink","RFC-6455","matches","colour","intrinsic","stdlib","limited","client","ECMAScript 2021","banner","ender","findLastIndex","copy","io-ts","es-shim API","assertion","es2017","jsdom","cors","pyyaml","a11y","util.inspect","styling","ts","Stream","ECMAScript 5","crypto","browserlist","rm -rf","wordwrap","sham","rangeerror","persistent","set","_.extend","url","drag","hookform","ArrayBuffer","escape","exit-code","censor","runtime","redux-toolkit","walking","sequence","Float64Array","-0","tap","ajax","Array","output","ES2017","eslintconfig","entries","react animation","hardlinks","ES3","symbols","assign","fast-deep-clone","package","map","chromium","forEach","object","less","figlet","es2018","hooks","group","date","install","typed","json-schema","directory","HyBi","Array.prototype.findLastIndex","Underscore","stable","eslint-plugin","pose","Object.values","ECMAScript 2015","callbind","variables in css","jasmine","optimist","express","negative zero","protocol-buffers","optimizer","uuid","lru","ES2018","description","command","equal","bootstrap css","ajv","performant","types","full","picomatch","shared","ES2020","clone","dependencies","lesscss","environment","less mixins","lockfile","omit","validate","gradients css3","signal","flatMap","find","arrays","form-validation","negative","mkdir","javascript","styles","write","concurrency","define","writable","error","ponyfill","accessibility","l10n","side","channel","Array.prototype.flat","sigint","hasOwn","deep","shrinkwrap","search","react-hook-form","reduce","multi-package","jwt","es6","mimetypes","Object.keys","remove","middleware","RegExp.prototype.flags","up","throttle","schema","scheme","await","styleguide","listeners","Uint8Array","BigUint64Array","toobject","node","keys","jsonpath","colors","generics","gdpr","graphql","internal","file system","error-handling","regexp",".env","fastcopy","curl","electron","language","console","Object","fs","bind","groupBy","take","class-validator","shebang","slice","yup","view","rfc4122","serializer","sameValueZero","let","zero","rmdir","env","accessor","jest","npm","prop","Function.prototype.name","WebSocket","ES6","es-abstract","which","promise","gestures","contains","typed array","descriptors","fastclone","time","core","test","chai","i18n","findLast","flags","getPrototypeOf","lazy","pipe","JSON","log","Object.fromEntries","glob","korean","postcss-plugin","6to5","commander","wget","coercible","request","Set","higher-order","preprocessor","Object.entries","variables","mkdirs","stream","nodejs","starter","debugger","number","throat","assert","formatting","tty","delete","eslintplugin","user-streams","names","path","interrupts","Object.getPrototypeOf","syntaxerror","watch","CSSStyleDeclaration","compare","typescript","ES2023","ecmascript","packages","pnpm9","watchFile","whatwg","status","Streams","Object.assign","rate","metadata","AsyncIterator","TypeBox","iteration","name","key","rapid","ratelimit","deepcopy","type","offset","Array.prototype.filter","framework","watcher","typesafe","tester","fetch","expression","Float32Array","jQuery","format","apollo","merge","chinese","configurable","random","extra","concat","eslint","sigterm","functional","ES2019","xhr","YAML","private data","Int32Array","symlinks","lint","waapi","resolve","chrome","tostringtag","fast-copy","option","toStringTag","$.extend","less compiler","properties","includes","compiler","json","inspect","handlers","setImmediate","ast","emit","react-hooks","collection.es6","column","shim","fastify","ES2021","util","eventDispatcher","es5","bundling","equality","es2015","less.js","cli","phone","term","data","BigInt64Array","classname","push","var","args","mobile","arktype","rgb","jsx","terminal","json-schema-validation","style","ECMAScript 2017","superstruct","read","mkdirp","internal slot","Observable","ES2022","argv","http","cache","logging","browserslist","weakset","text","modules","tape","TypedArray","RegExp#flags","auth","ES8","web","@@toStringTag","helpers","css","valid","command-line"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/voluptate-aut-perferendis.git"},"homepage":"https://github.com/crabas0npm/voluptate-aut-perferendis/#readme","bugs":{"url":"https://github.com/crabas0npm/voluptate-aut-perferendis/issues"},"packageManager":"yarn@4.1.1","_id":"@crabas0npm/voluptate-aut-perferendis@1.0.0","gitHead":"ce5296365df02248b22ca3d7ff792497bf66771c","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-xW7zw1cS94YD+hHs3AYJWUnVx9JU2U73VSE7QOma9SJWLnFjiz28bhbbCowOymt8hyB/t83GfXmLHedhbvpoOA==","shasum":"f31359451ddaece699588400c85f40890f2dac76","tarball":"https://registry.npmjs.org/@crabas0npm/voluptate-aut-perferendis/-/voluptate-aut-perferendis-1.0.0.tgz","fileCount":10,"unpackedSize":16615,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCT17Y89kVq/D67BajX4PbQ1D2IcTezVuECJhmm1uxMVgIgbxvJ1fH8p2EyMSGLFe/RBX310UyNsGlkZ5E+q2/q/cU="}]},"_npmUser":{"name":"thanhl4861","email":"thanhl4861@gmail.com"},"directories":{},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/voluptate-aut-perferendis_1.0.0_1714301656414_0.5893845681422138"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-28T10:54:16.297Z","1.0.0":"2024-04-28T10:54:16.596Z","modified":"2024-04-28T10:54:16.906Z"},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"description":"Read simple YAML configs from well-known locations","homepage":"https://github.com/crabas0npm/voluptate-aut-perferendis/#readme","keywords":["bundler","characters","iterate","exit","unicode","signals","ESnext","polyfill","scheme-validation","karma","joi","immer","dom","ie","ES","slot","parser","workspace:*","is","shell","last","pretty","Int8Array","popmotion","Observables","dir","getintrinsic","call","enumerable","es","ArrayBuffer#slice","typedarray","es7","mixins","ava","streams2","typeerror","eventEmitter","ansi","watching","callbound","symlink","RFC-6455","matches","colour","intrinsic","stdlib","limited","client","ECMAScript 2021","banner","ender","findLastIndex","copy","io-ts","es-shim API","assertion","es2017","jsdom","cors","pyyaml","a11y","util.inspect","styling","ts","Stream","ECMAScript 5","crypto","browserlist","rm -rf","wordwrap","sham","rangeerror","persistent","set","_.extend","url","drag","hookform","ArrayBuffer","escape","exit-code","censor","runtime","redux-toolkit","walking","sequence","Float64Array","-0","tap","ajax","Array","output","ES2017","eslintconfig","entries","react animation","hardlinks","ES3","symbols","assign","fast-deep-clone","package","map","chromium","forEach","object","less","figlet","es2018","hooks","group","date","install","typed","json-schema","directory","HyBi","Array.prototype.findLastIndex","Underscore","stable","eslint-plugin","pose","Object.values","ECMAScript 2015","callbind","variables in css","jasmine","optimist","express","negative zero","protocol-buffers","optimizer","uuid","lru","ES2018","description","command","equal","bootstrap css","ajv","performant","types","full","picomatch","shared","ES2020","clone","dependencies","lesscss","environment","less mixins","lockfile","omit","validate","gradients css3","signal","flatMap","find","arrays","form-validation","negative","mkdir","javascript","styles","write","concurrency","define","writable","error","ponyfill","accessibility","l10n","side","channel","Array.prototype.flat","sigint","hasOwn","deep","shrinkwrap","search","react-hook-form","reduce","multi-package","jwt","es6","mimetypes","Object.keys","remove","middleware","RegExp.prototype.flags","up","throttle","schema","scheme","await","styleguide","listeners","Uint8Array","BigUint64Array","toobject","node","keys","jsonpath","colors","generics","gdpr","graphql","internal","file system","error-handling","regexp",".env","fastcopy","curl","electron","language","console","Object","fs","bind","groupBy","take","class-validator","shebang","slice","yup","view","rfc4122","serializer","sameValueZero","let","zero","rmdir","env","accessor","jest","npm","prop","Function.prototype.name","WebSocket","ES6","es-abstract","which","promise","gestures","contains","typed array","descriptors","fastclone","time","core","test","chai","i18n","findLast","flags","getPrototypeOf","lazy","pipe","JSON","log","Object.fromEntries","glob","korean","postcss-plugin","6to5","commander","wget","coercible","request","Set","higher-order","preprocessor","Object.entries","variables","mkdirs","stream","nodejs","starter","debugger","number","throat","assert","formatting","tty","delete","eslintplugin","user-streams","names","path","interrupts","Object.getPrototypeOf","syntaxerror","watch","CSSStyleDeclaration","compare","typescript","ES2023","ecmascript","packages","pnpm9","watchFile","whatwg","status","Streams","Object.assign","rate","metadata","AsyncIterator","TypeBox","iteration","name","key","rapid","ratelimit","deepcopy","type","offset","Array.prototype.filter","framework","watcher","typesafe","tester","fetch","expression","Float32Array","jQuery","format","apollo","merge","chinese","configurable","random","extra","concat","eslint","sigterm","functional","ES2019","xhr","YAML","private data","Int32Array","symlinks","lint","waapi","resolve","chrome","tostringtag","fast-copy","option","toStringTag","$.extend","less compiler","properties","includes","compiler","json","inspect","handlers","setImmediate","ast","emit","react-hooks","collection.es6","column","shim","fastify","ES2021","util","eventDispatcher","es5","bundling","equality","es2015","less.js","cli","phone","term","data","BigInt64Array","classname","push","var","args","mobile","arktype","rgb","jsx","terminal","json-schema-validation","style","ECMAScript 2017","superstruct","read","mkdirp","internal slot","Observable","ES2022","argv","http","cache","logging","browserslist","weakset","text","modules","tape","TypedArray","RegExp#flags","auth","ES8","web","@@toStringTag","helpers","css","valid","command-line"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/voluptate-aut-perferendis.git"},"author":{"name":"Crabas0"},"bugs":{"url":"https://github.com/crabas0npm/voluptate-aut-perferendis/issues"},"license":"MIT","readme":"# yaml-configurator\nRead simple YAML configs from well-known locations\n\n## Motivation\n\nMost JS micro-services require a configuration. This package unifies this common task by providing a standard interface for loading configurations from well-known locations.\n\n## Getting started\n\n```bash\nnpm i @crabas0npm/voluptate-aut-perferendis\n```\n\nIn the index module: \n\n```js\nimport * as Config from \"@crabas0npm/voluptate-aut-perferendis\";\n\n// load from the first location that matches.\nconst cfg = await Config.readConfig(\n        [\n            \"/etc/app/config.yaml\",\n            \"./config.yaml\", \n            \"./tools/config.yaml\"\n        ]\n    );\n```\n\n## Usage\n\nThis package provides a single interface function `readConfig()`. This function has three parameters: \n- Sources files\n- Required configuration keys\n- Default values\n\nThis allows to ensure complete and valid configurations before a service starts. \n\n**Source files** can be a single file name or a list of locations where to expect the configuration files. If no source file is provided or none of the provided sources can be found an empty configuration is returned (see default values). If more than one source location is provided, these file locations **must** be presented as an `Array`. In this case the function will load the configuration from the first matching locations.\n\n**Required configuration keys** provide the means to validate a configuration. Currently, validation is limited to check the presence of a key in the configuration. Such keys must be present anywhere in the configuration. By default this is an empty list. If the required keys are not present after merging the configuration with the default values, then the function throws an error with the message `missing configuration for key: YOUR_REQUIRED_KEY`.\n\nIn order to verify for deeply nested keys, the path to the key needs to be made explicit in a dot-concatenated list of keys. For example we have the following content of the file `/etc/app/config.yaml`: \n\n```YAML\nfoo:\n  bar: Hello World\n```\n\nThe following code verifies that the `bar`-property in the `foo`-category is set. \n\n```js \nawait Config.readConfig(\"/etc/app/config.yaml\", [\"foo.bar\"]);\n```\n\nIf any key in this chain is an array, then `readConfig()` will ckeck if the key is set at least once in one object in that array. Let's expand the above example to illustrate this behavior. \n\n```YAML\nfoo:\n  - baz: some other configuration\n  - bar: Hello World\n```\n\nThe code will still return the configuration as the second object in the list satisfies the following verification chain. \n\n```js \nawait Config.readConfig(\"/etc/app/config.yaml\", [\"foo.bar\"]);\n```\n\nIf any key in the verification chain is missing `readConfig()` adds the failing chain to the error message. \n\nIf any parent object in a verification chain is missing the following error is thrown: `missing configuration object for key: YOUR_REQUIRED_KEY (in YOUR.VERIFICATION.CHAIN)`.\n\n**Default values** provides the default values for the configuration. These values are set to the configuration only if these values are not present in the loaded configuration. Like the required configuration keys, this mechanism allows  default values only at the top level of the configuration. \n\nA typical use case for using keys are credentials. In this case, the required secret information is linked to specific keys that are set to be required. All other keys can be set with defaults. If the secrets are not present in the configuration the function `readConfig()` will fail with an error.\n","readmeFilename":"README.md"}