diff --git a/lib/EnvoyPluginStorage.js b/lib/EnvoyPluginStorage.js index 083e8ba..8f8bde4 100644 --- a/lib/EnvoyPluginStorage.js +++ b/lib/EnvoyPluginStorage.js @@ -104,6 +104,18 @@ class EnvoyPluginStorage { return this.pipeline().unset(key).executeSingle(); } + + /** + * Wrapper for single pipeline update. + * + * @param {string} key + * @param {*} value + * @returns {Promise} + */ + update(key, value) { + + return this.pipeline().update(key, value).executeSingle(); + } } module.exports = EnvoyPluginStorage; diff --git a/lib/EnvoyPluginStoragePipeline.js b/lib/EnvoyPluginStoragePipeline.js index 9f6b622..eadad1c 100644 --- a/lib/EnvoyPluginStoragePipeline.js +++ b/lib/EnvoyPluginStoragePipeline.js @@ -137,6 +137,19 @@ class EnvoyPluginStoragePipeline { return this.addCommand({ action: 'unset', key }); } + + /** + * Updates a value for a storage item, + * and returns that item. + * + * @param {string} key + * @param value + * @returns {EnvoyPluginStoragePipeline} + */ + update(key, value) { + + return this.addCommand({ action: 'update', key, value }); + } } module.exports = EnvoyPluginStoragePipeline; diff --git a/package-lock.json b/package-lock.json index 3fa1d2e..277ecb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@envoy/envoy-integrations-sdk", - "version": "1.3.2", + "version": "1.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@envoy/envoy-integrations-sdk", - "version": "1.3.2", + "version": "1.4.0", "license": "ISC", "dependencies": { "axios": "^1.4.0", diff --git a/package.json b/package.json index 3d8828a..d9e8eca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@envoy/envoy-integrations-sdk", - "version": "1.3.5", + "version": "1.4.0", "description": "", "main": "index.js", "scripts": {