Skip to content

Commit

Permalink
Merge pull request #48 from envoy/FLAGINT-2731-plugin-storage-update-…
Browse files Browse the repository at this point in the history
…command-2

FLAGINT-2731: add update command to plugin storage
  • Loading branch information
johnmarrero authored Nov 15, 2023
2 parents 0a1214b + 19f2885 commit e28e0ed
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
12 changes: 12 additions & 0 deletions lib/EnvoyPluginStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ class EnvoyPluginStorage {

return this.pipeline().unset(key).executeSingle();
}

/**
* Wrapper for single pipeline update.
*
* @param {string} key
* @param {*} value
* @returns {Promise<PluginStorageItem>}
*/
update(key, value) {

return this.pipeline().update(key, value).executeSingle();
}
}

module.exports = EnvoyPluginStorage;
13 changes: 13 additions & 0 deletions lib/EnvoyPluginStoragePipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@envoy/envoy-integrations-sdk",
"version": "1.3.5",
"version": "1.4.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit e28e0ed

Please sign in to comment.