Skip to content

Commit 19f2885

Browse files
committed
FLAGINT-2731: add update command to plugin storage
1 parent 0a1214b commit 19f2885

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

lib/EnvoyPluginStorage.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ class EnvoyPluginStorage {
104104

105105
return this.pipeline().unset(key).executeSingle();
106106
}
107+
108+
/**
109+
* Wrapper for single pipeline update.
110+
*
111+
* @param {string} key
112+
* @param {*} value
113+
* @returns {Promise<PluginStorageItem>}
114+
*/
115+
update(key, value) {
116+
117+
return this.pipeline().update(key, value).executeSingle();
118+
}
107119
}
108120

109121
module.exports = EnvoyPluginStorage;

lib/EnvoyPluginStoragePipeline.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,19 @@ class EnvoyPluginStoragePipeline {
137137

138138
return this.addCommand({ action: 'unset', key });
139139
}
140+
141+
/**
142+
* Updates a value for a storage item,
143+
* and returns that item.
144+
*
145+
* @param {string} key
146+
* @param value
147+
* @returns {EnvoyPluginStoragePipeline}
148+
*/
149+
update(key, value) {
150+
151+
return this.addCommand({ action: 'update', key, value });
152+
}
140153
}
141154

142155
module.exports = EnvoyPluginStoragePipeline;

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@envoy/envoy-integrations-sdk",
3-
"version": "1.3.5",
3+
"version": "1.4.0",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)