{"_id":"@botmatic/js-redis-key-store","_rev":"2-b40b112e41f973fd605252afc8588e77","name":"@botmatic/js-redis-key-store","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@botmatic/js-redis-key-store","version":"1.0.0","description":"A module to manage id associations in @botmatic/js-contact in a redis database.   It implements the KeyStore interface defined by @botmatic/js-contact","main":"src/index.js","scripts":{"test":"jasmine"},"author":"","license":"ISC","dependencies":{"debug":"^3.1.0"},"devDependencies":{"chai":"^4.1.2","redis":"^2.8.0"},"gitHead":"dbcb68f409adeee32981ad1cf57fa7a705ec130a","_id":"@botmatic/js-redis-key-store@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.3.0","_npmUser":{"name":"botmatic","email":"kevin+botmatic-npm@botmatic.ai"},"dist":{"integrity":"sha512-4aPdfNcHffVIG0No5+xQrAsp6WkytBQKk0grz+B7YGv1Tnji7d2WUyr1K8hMbkltSwjAwv/FE16tTnf7uoeL8Q==","shasum":"a34a2c5950f56f6f1b76ba1338a89d35ccfd4e4f","tarball":"https://registry.npmjs.org/@botmatic/js-redis-key-store/-/js-redis-key-store-1.0.0.tgz","fileCount":6,"unpackedSize":13564,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/yP8VdbENyPi/vgwoDUUrFvp/aPytBrm5a7+3G8kiowIgOrKiSANHMgySJl8vXeEaUcBwqJQLj9+lDGky8dwdWwU="}]},"maintainers":[{"name":"botmatic","email":"kevin+botmatic-npm@botmatic.ai"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-redis-key-store_1.0.0_1521739922312_0.7530679839169307"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-22T17:32:02.261Z","1.0.0":"2018-03-22T17:32:02.595Z","modified":"2022-04-04T20:14:10.257Z"},"maintainers":[{"name":"botmatic","email":"kevin+botmatic-npm@botmatic.ai"}],"description":"A module to manage id associations in @botmatic/js-contact in a redis database.   It implements the KeyStore interface defined by @botmatic/js-contact","license":"ISC","readme":"# JS Redis KeyStore\nA module to manage id associations in @botmatic/js-contact in a redis database.  \nIt implements the KeyStore interface defined by @botmatic/js-contact\n\n## Installation\n```bash\nnpm install redis js-redis-key-store --save\n```\n\n## Usage\n\n### Initialisation\n```javascript\nconst redis = require('redis')\nconst client = redis.createClient(your_client_options)\n\nconst keyStore = require('js-redis-key-store')(client)\n```\n\n### Methods\nAs you'd typically use this module with js-contact, you'd normally do not have to call any of these methods directly.\n\n#### `saveIds(integrationId, botmaticId, externalId) -> Promise<boolean>`\nSaves a botmatic/external ids pair for an integration.\nCalled when a `CONTACT_CREATED `event is received, when `js-contact::createContact()` or `js-contact::importContacts()` are called.  \nReturns a `Promise` which resolves to `true` if the save was successful, `false` if it fails.\n\n##### Parameters\n\nparameter | type | description\n--- | --- | --- \nintegrationId | string | An identifier for the integration, makes this association unique\nbotmaticId | string | The resource id on Botmatic\nexternalId | string | The resource id on the external API\n\n\n##### Example using async / await\n```javascript\nconst saved = await keyStore.saveIds(integrationId, botmaticId, externalId)\n// saved == true if success, false if it fails\n```\n\n##### Example using Promises\n```javascript\n  keyStore.saveIds(integrationId, botmaticId, externalId)\n  .then(saved => {\n    // saved == true if success, false if it fails\n  })\n```\n\n#### `getBotmaticId(integrationId, externalId) -> Promise<string | null>`\nGives the resource id on Botmatic associated with the given integrationId and external id.  \nCalled when `js-contact::updateContact()` is called.  \nReturns a `Promise` which resolves to the botmatic id or `null` if none is found.\n\n##### Parameters\n\nparameter | type | description\n--- | --- | --- \nintegrationId | string | An identifier for the integration\nexternalId | string | The resource id on the external API\n\n##### Example using async / await\n```javascript\nconst botmaticId = await keyStore.getBotmaticId(integrationId, externalId)\n```\n\n##### Example using Promises\n```javascript\n  keyStore.getBotmaticId(integrationId, externalId)\n  .then(botmaticId => {\n    //\n  })\n```\n\n#### `getExtId(integrationId, botmaticId) -> Promise<string | null>`\nGives the external resource id associated with the given integrationId and botmatic id.  \nCalled when a `CONTACT_UPDATED` is received.  \nReturns a `Promise` which resolves to the external id or `null` if none is found.\n\n##### Parameters\n\nparameter | type | description\n--- | --- | --- \nintegrationId | string | An identifier for the integration\nbotmaticId | string | The resource id on Botmatic\n\n##### Example using async / await\n```javascript\nconst externalId = await keyStore.getExtId(integrationId, botmaticId)\n```\n\n##### Example using Promises\n```javascript\n  keyStore.getExtId(integrationId, botmaticId)\n  .then(externalId => {\n    //\n  })\n```\n\n#### `deleteIds(integrationId, botmaticId, extId) -> Promise<boolean>`\nRemove a botmatic/external id pair for a given integration id.  \nCalled when a `CONTACT_DELETED` event is received and when `js-contact::deleteContact()` is called.  \nReturns a `Promise` which resolves to `true` if the deletion was successful, `false` if it fails.\n\n##### Parameters\n\nparameter | type | description\n--- | --- | --- \nintegrationId | string | An identifier for the integration\nbotmaticId | string | The resource id on Botmatic\nexternalId | string | The resource id on the external API\n\n##### Example using async / await\n```javascript\nconst deleted = await keyStore.deleteIds(integrationId, botmaticId, externalId)\n// deleted == true if success, false if it fails\n```\n\n##### Example using Promises\n```javascript\n  keyStore.deleteIds(integrationId, botmaticId, externalId)\n  .then(deleted => {\n    // deleted == true if success, false if it fails\n  })\n```\n\n#### `deleteAllIds(integrationId) -> Promise<boolean>`\nRemove a botmatic/external id pair for a given integration id.\nCalled when a `UNINSTALL` event is received.  \nReturns a `Promise` which resolves to `true` if the deletion was successful, `false` if it fails.\n\n##### Parameters\n\nparameter | type | description\n--- | --- | --- \nintegrationId | string | An identifier for the integration\n\n##### Example using async / await\n```javascript\nconst deleted = await keyStore.deleteAllIds(integrationId)\n// deleted == true if success, false if it fails\n```\n\n##### Example using Promises\n```javascript\n  keyStore.deleteAllIds(integrationId)\n  .then(deleted => {\n    // deleted == true if success, false if it fails\n  })\n```\n\n#### `quit()`\nQuits the redis client\n","readmeFilename":"README.md"}