@bedrock/kms 10.1.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # bedrock-kms ChangeLog
2
2
 
3
+ ## 10.2.0 - 2022-05-13
4
+
5
+ ### Added
6
+ - Expose `_disableClearCacheOnUpdate` for testing cache busting only; do not use in
7
+ production.
8
+
3
9
  ## 10.1.0 - 2022-05-13
4
10
 
5
11
  ### Added
package/lib/keystores.js CHANGED
@@ -16,6 +16,7 @@ import './config.js';
16
16
 
17
17
  const USAGE_COUNTER_MAX_CONCURRENCY = 100;
18
18
  let KEYSTORE_CONFIG_CACHE;
19
+ let DISABLE_CLEAR_CACHE_ON_UPDATE = false;
19
20
 
20
21
  // cache only exported for testing purposes
21
22
  export {KEYSTORE_CONFIG_CACHE as _KEYSTORE_CONFIG_CACHE};
@@ -198,8 +199,10 @@ export async function update({config, explain = false} = {}) {
198
199
  });
199
200
  }
200
201
 
201
- // delete record from cache
202
- KEYSTORE_CONFIG_CACHE.delete(config.id);
202
+ if(!DISABLE_CLEAR_CACHE_ON_UPDATE) {
203
+ // delete record from cache
204
+ KEYSTORE_CONFIG_CACHE.delete(config.id);
205
+ }
203
206
 
204
207
  return true;
205
208
  }
@@ -210,7 +213,7 @@ export async function update({config, explain = false} = {}) {
210
213
  * @param {object} options - The options to use.
211
214
  * @param {string} options.id - The ID of the keystore.
212
215
  * @param {boolean} [options.fresh=false] - False if it is safe to use a
213
- * potentially cached value, false to always get a fresh value.
216
+ * potentially cached value, true to always get a fresh value.
214
217
  *
215
218
  * @returns {Promise<object>} Resolves to `{config, meta}`.
216
219
  */
@@ -335,3 +338,8 @@ export async function _getUncachedRecord({id, explain = false} = {}) {
335
338
  }
336
339
  return record;
337
340
  }
341
+
342
+ // exported for testing purposes
343
+ export function _disableClearCacheOnUpdate(disable) {
344
+ DISABLE_CLEAR_CACHE_ON_UPDATE = disable;
345
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/kms",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "type": "module",
5
5
  "description": "Key management for Bedrock applications",
6
6
  "main": "./lib/index.js",