{"id":18862186,"url":"https://github.com/hapinessjs/etcd3-module","last_synced_at":"2026-02-09T22:30:20.290Z","repository":{"id":57115147,"uuid":"105887871","full_name":"hapinessjs/etcd3-module","owner":"hapinessjs","description":"ETCD3 client integration for Hapiness framework","archived":false,"fork":false,"pushed_at":"2018-03-29T12:58:51.000Z","size":185,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-30T23:03:29.713Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hapinessjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-05T12:35:30.000Z","updated_at":"2018-03-29T12:58:01.000Z","dependencies_parsed_at":"2022-08-22T11:41:13.073Z","dependency_job_id":null,"html_url":"https://github.com/hapinessjs/etcd3-module","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapinessjs%2Fetcd3-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapinessjs%2Fetcd3-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapinessjs%2Fetcd3-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapinessjs%2Fetcd3-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hapinessjs","download_url":"https://codeload.github.com/hapinessjs/etcd3-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239803162,"owners_count":19699622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T04:33:36.903Z","updated_at":"2026-02-09T22:30:20.209Z","avatar_url":"https://github.com/hapinessjs.png","language":"TypeScript","readme":"\u003cimg src=\"http://bit.ly/2mxmKKI\" width=\"500\" alt=\"Hapiness\" /\u003e\n\n\u003cdiv style=\"margin-bottom:20px;\"\u003e\n\u003cdiv style=\"line-height:60px\"\u003e\n    \u003ca href=\"https://travis-ci.org/hapinessjs/etcd3-module.svg?branch=master\"\u003e\n        \u003cimg src=\"https://travis-ci.org/hapinessjs/etcd3-module.svg?branch=master\" alt=\"build\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://coveralls.io/github/hapinessjs/etcd3-module?branch=master\"\u003e\n        \u003cimg src=\"https://coveralls.io/repos/github/hapinessjs/etcd3-module/badge.svg?branch=master\" alt=\"coveralls\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://david-dm.org/hapinessjs/etcd3-module\"\u003e\n        \u003cimg src=\"https://david-dm.org/hapinessjs/etcd3-module.svg\" alt=\"dependencies\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://david-dm.org/hapinessjs/etcd3-module?type=dev\"\u003e\n        \u003cimg src=\"https://david-dm.org/hapinessjs/etcd3-module/dev-status.svg\" alt=\"devDependencies\" /\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n    \u003ca href=\"https://www.typescriptlang.org/docs/tutorial.html\"\u003e\n        \u003cimg src=\"https://cdn-images-1.medium.com/max/800/1*8lKzkDJVWuVbqumysxMRYw.png\"\n             align=\"right\" alt=\"Typescript logo\" width=\"50\" height=\"50\" style=\"border:none;\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://reactivex.io/rxjs\"\u003e\n        \u003cimg src=\"http://reactivex.io/assets/Rx_Logo_S.png\"\n             align=\"right\" alt=\"ReactiveX logo\" width=\"50\" height=\"50\" style=\"border:none;\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://hapijs.com\"\u003e\n        \u003cimg src=\"http://bit.ly/2lYPYPw\"\n             align=\"right\" alt=\"Hapijs logo\" width=\"75\" style=\"border:none;\" /\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n# Etcd3 Module\n\n```Etcd3``` module for the Hapiness framework.\n\n## Table of contents\n\n\n* [Using your module inside Hapiness application](#using-your-module-inside-hapiness-application)\n\t* [`yarn` or `npm` it in your `package.json`](#yarn-or-npm-it-in-your-package)\n    * [Importing `Etcd3Module` from the library](#importing-etcd3module-from-the-library)\n    * [Using `Etcd3` inside your application](#using-etcd3-inside-your-application)\n* [`Etcd3Service` api](#etcd3service-api)\n\n## Using your module inside Hapiness application\n\n\n### `yarn` or `npm` it in your `package.json`\n\n```bash\n$ npm install --save @hapiness/etcd3 @hapiness/core rxjs\n\nor\n\n$ yarn add @hapiness/etcd3 @hapiness/core rxjs\n```\n\n```javascript\n\"dependencies\": {\n    \"@hapiness/core\": \"^1.3.0\",\n    \"@hapiness/etcd3\": \"^1.0.3\",\n    \"rxjs\", \"^5.5.5\"\n    //...\n}\n//...\n```\n\n[Back to top](#table-of-contents)\n\n\n### Importing `Etcd3Module` from the library\n\nThis module provide an Hapiness extension for Etcd3.\nTo use it, simply register it during the ```bootstrap``` step of your project and provide the ```Etcd3Ext``` with its config\n\n```javascript\n\n@HapinessModule({\n    version: '1.0.0',\n    providers: [],\n    declarations: [],\n    imports: [Etcd3Module]\n})\nclass MyApp implements OnStart {\n    constructor() {}\n    onStart() {}\n}\n\nHapiness\n    .bootstrap(\n        MyApp,\n        [\n            /* ... */\n            Etcd3Ext.setConfig(\n                {\n                    basePath: '/project/root';\n                    client: \u003cIOptions\u003e { /* options comes here */};\n                }\n            )\n        ]\n    )\n    .catch(err =\u003e {\n        /* ... */\n    });\n\n```\n\nThe `basePath` key is optional and represents the prefix of all future keys. The default value is `/`.\n\nThe `IOptions` interface let you provide config to connect etcd. Allowed fields are:\n\n```javascript\n/**\n * Optional client cert credentials for talking to etcd. Describe more\n * {@link https://coreos.com/etcd/docs/latest/op-guide/security.html here},\n * passed into the createSsl function in GRPC\n * {@link http://www.grpc.io/grpc/node/module-src_credentials.html#.createSsl here}.\n */\ncredentials?: {\n    rootCertificate: Buffer;\n    privateKey?: Buffer;\n    certChain?: Buffer;\n},\n\n/**\n * Internal options to configure the GRPC client. These are channel options\n * as enumerated in their [C++ documentation](https://grpc.io/grpc/cpp/group__grpc__arg__keys.html).\n */\ngrpcOptions?: ChannelOptions,\n\n/**\n * Etcd password auth, if using.\n */\nauth?: {\n    username: string;\n    password: string;\n},\n\n/**\n * A list of hosts to connect to. Hosts should include the `https?://` prefix.\n */\nhosts: string[] | string,\n\n/**\n * Duration in milliseconds to wait while connecting before timing out.\n * Defaults to 30 seconds.\n */\ndialTimeout?: number,\n\n/**\n * Backoff strategy to use for connecting to hosts. Defaults to an\n * exponential strategy, starting at a 500 millisecond\n * retry with a 30 second max.\n */\nbackoffStrategy?: IBackoffStrategy,\n\n/**\n * Whether, if a query fails as a result of a primitive GRPC error, to retry\n * it on a different server (provided one is available). This can make\n * service disruptions less-severe but can cause a domino effect if a\n * particular operation causes a failure that grpc reports as some sort of\n * internal or network error.\n *\n * Defaults to false.\n */\nretry?: boolean\n\n```\n\n[Back to top](#table-of-contents)\n\n\n### Using `Etcd3` inside your application\n\nTo use the `etcd3` module, you need to inject inside your providers the ```Etcd3Service```.\n\n```javascript\n\nclass FooProvider {\n\n    constructor(private _etcd3: Etcd3Service) {}\n\n    getValueForKey(key: string): Observable\u003cstring | object | Buffer | null | Error\u003e {\n    \treturn this._etcd3.get(key);\n    }\n\n}\n\n```\n\n[Back to top](#table-of-contents)\n\n\n## ```Etcd3Service``` api\n\n```javascript\n\n/**\n *\n * @returns {string} The value of the base path\n *\n */\npublic get basePath(): string;\n\n/**\n *\n * Retrieve the client without basePath consideration\n *\n * @returns {Namespace} the client for the namespace\n *\n */\npublic get client(): Namespace;\n\n/**\n *\n * Retrieve the client without basePath consideration\n *\n * @returns {Etcd3} the normal client (without namespace consideration)\n *\n */\npublic etcd3Client(): Etcd3;\n\n/**\n *\n * Get the value stored at path `key`.\n *\n * @param {string} key The key you want to retrieve the value\n * @param {ResponseFormat} format The format you want for the result (default is string)\n *\n * @returns {string | object | number | Buffer | null | Error} The value of the object stored\n *\n */\npublic get(key: string, format: ResponseFormat = ResponseFormat.String): Observable\u003cstring | object | Buffer | null | Error\u003e;\n\n/**\n *\n * Get all keys and values stored under the given `prefix`.\n *\n * @param {string} prefix The prefix under which you want to start looking\n *\n * @returns { { [key: string]: string } } An object having all path as keys and all values stored under them\n *\n */\npublic getWithPrefix(_prefix: string): Observable\u003c{ [key: string]: string }\u003e;\n\n/**\n *\n * Append the value `value` at path `key`.\n *\n * @param {string} key The key you want to retrieve the value\n * @param {string | Buffer | number} value The format you want for the result (default is string)\n *\n * @returns {IPutResponse} The result of the operation\n *\n */\npublic put(key: string, value: string | number | Object | Buffer): Observable\u003cIPutResponse\u003e;\n\n/**\n *\n * Delete the key `key`.\n *\n * @param {string} key The key you want to delete\n *\n * @returns {IDeleteRangeResponse} The result of the operation\n *\n */\npublic delete(key: string): Observable\u003cIDeleteRangeResponse\u003e;\n\n/**\n *\n * Delete all registered keys for the etcd3 client.\n *\n * @returns {IDeleteRangeResponse} The result of the operation\n *\n */\npublic deleteAll(): Observable\u003cIDeleteRangeResponse\u003e;\n\n/**\n *\n * Create a watcher for a specific key.\n *\n * @param {string} key The key you want to watch\n * @param {string} prefix The prefix you want to watch\n *\n * @returns {Watcher} The watcher instance created\n *\n */\npublic createWatcher(key: string, prefix?: boolean = false): Observable\u003cWatcher\u003e;\n\n/**\n *\n * Create and acquire a lock for a key `key` specifying a ttl.\n * It will automatically contact etcd to keep the connection live.\n * When the connection is broken (end of process or lock released),\n * the TTL is the time after when the lock will be released.\n *\n * @param {string} key The key\n * @param {number} ttl The TTL value in seconds. Default value is 1\n *\n * @returns {Lock} The lock instance created\n *\n */\npublic acquireLock(key: string, ttl: number = 1): Observable\u003cLock\u003e;\n\n/******************************************************************************************\n *\n * Lease Operations\n *\n ******************************************************************************************/\n\n/**\n *\n * Create a lease object with a ttl.\n * The lease is automatically keeping alive until it is close.\n *\n * @param {number} ttl The TTL value in seconds. Default value is 1\n *\n * @returns {Lease} The lease instance created\n *\n */\npublic createLease(ttl: number = 1): Observable\u003cLease\u003e;\n\n/**\n *\n * Create a lease object with a ttl and attach directly a key-value to it.\n * The lease is automatically keeping alive until it is close.\n *\n * NOTE: Once the lease is closed, the key-value will be destroyed by etcd.\n *\n * @param {string} key The key where to store the value\n * @param {string | Buffer | number} value The value that will be stored at `key` path\n * @param {number} ttl The TTL value in seconds. Default value is 1\n *\n * @returns {Lease} The lease instance created\n *\n */\npublic createLeaseWithValue(key: string, value: string | Buffer, ttl: number = 1): Observable\u003cLease\u003e;\n\n```\n\n[Back to top](#table-of-contents)\n\n\n## Maintainers\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd colspan=\"4\" align=\"center\"\u003e\u003ca href=\"https://www.tadaweb.com\"\u003e\u003cimg src=\"http://bit.ly/2xHQkTi\" width=\"117\" alt=\"tadaweb\" /\u003e\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/Juneil\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/6546204?v=3\u0026s=117\" width=\"117\"/\u003e\u003c/a\u003e\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/antoinegomez\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/997028?v=3\u0026s=117\" width=\"117\"/\u003e\u003c/a\u003e\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/reptilbud\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/6841511?v=3\u0026s=117\" width=\"117\"/\u003e\u003c/a\u003e\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/njl07\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/1673977?v=3\u0026s=117\" width=\"117\"/\u003e\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/Juneil\"\u003eJulien Fauville\u003c/a\u003e\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/antoinegomez\"\u003eAntoine Gomez\u003c/a\u003e\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/reptilbud\"\u003eSébastien Ritz\u003c/a\u003e\u003c/td\u003e\n        \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/njl07\"\u003eNicolas Jessel\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n[Back to top](#table-of-contents)\n\n## License\n\nCopyright (c) 2017 **Hapiness** Licensed under the [MIT license](https://github.com/hapinessjs/minio-module/blob/master/LICENSE.md).\n\n[Back to top](#table-of-contents)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhapinessjs%2Fetcd3-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhapinessjs%2Fetcd3-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhapinessjs%2Fetcd3-module/lists"}