updating-secrets 1.2.1 → 1.3.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.
@@ -1,5 +1,5 @@
1
1
  import { type PartialWithUndefined, type RequiredAndNotNull, type Values } from '@augment-vir/common';
2
- import { type AnyDuration, type FullDate } from 'date-vir';
2
+ import { type AnyDuration } from 'date-vir';
3
3
  import { type Shape } from 'object-shape-tester';
4
4
  import { type BaseSecretsAdapter } from './adapters/base.adapter.js';
5
5
  import { type ProcessedSecretDefinitions, type RotatableSecretValue, type SecretDefinitions, type SecretValues } from './secrets-definition/define-secrets.js';
@@ -96,12 +96,6 @@ export declare class UpdatingSecrets<const Secrets extends Readonly<SecretDefini
96
96
  */
97
97
  protected loadingSecretsPromise: Promise<SecretValues<Secrets>> | undefined;
98
98
  protected consecutiveFailureCount: number;
99
- protected dynamicCache: {
100
- [SecretName in string]: {
101
- value: any;
102
- cachedAt: FullDate;
103
- };
104
- };
105
99
  constructor(secrets: Readonly<Secrets>,
106
100
  /**
107
101
  * A list of adapters to load secrets from. Order here matters: all values loaded from the
@@ -1,6 +1,6 @@
1
1
  import { assert } from '@augment-vir/assert';
2
2
  import { combineErrors, DeferredPromise, ensureError, ensureErrorAndPrependMessage, extractErrorMessage, getObjectTypedEntries, log, makeWritable, mapObject, mapObjectValues, mergeDefinedProperties, } from '@augment-vir/common';
3
- import { calculateRelativeDate, convertDuration, getNowInUtcTimezone, isDateAfter, } from 'date-vir';
3
+ import { convertDuration } from 'date-vir';
4
4
  import { assertValidShape, checkValidShape, defineShape } from 'object-shape-tester';
5
5
  import { SecretLoadError } from './secret-load.error.js';
6
6
  const defaultOptions = {
@@ -59,7 +59,6 @@ export class UpdatingSecrets {
59
59
  */
60
60
  loadingSecretsPromise;
61
61
  consecutiveFailureCount = 0;
62
- dynamicCache = {};
63
62
  constructor(secrets,
64
63
  /**
65
64
  * A list of adapters to load secrets from. Order here matters: all values loaded from the
@@ -302,23 +301,7 @@ export class UpdatingSecrets {
302
301
  * based on the adapters in use.
303
302
  */
304
303
  async loadDynamicSecret(secretKey, shapeRequirement) {
305
- const cached = this.dynamicCache[secretKey];
306
- if (cached &&
307
- checkValidShape(cached.value, shapeRequirement, {
308
- allowExtraKeys: true,
309
- }) &&
310
- !isDateAfter({
311
- fullDate: getNowInUtcTimezone(),
312
- relativeTo: calculateRelativeDate(cached.cachedAt, this.options.updateInterval),
313
- })) {
314
- return cached.value;
315
- }
316
- const newValue = await this.loadSecretFromAdapters(secretKey, shapeRequirement);
317
- this.dynamicCache[secretKey] = {
318
- value: newValue,
319
- cachedAt: getNowInUtcTimezone(),
320
- };
321
- return newValue;
304
+ return await this.loadSecretFromAdapters(secretKey, shapeRequirement);
322
305
  }
323
306
  /** Try to load a single secret from any of the provided adapters. */
324
307
  async loadSecretFromAdapters(secretKey, shapeRequirement) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "updating-secrets",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Automatically update secrets on an interval with support for seamless secret rotation.",
5
5
  "keywords": [
6
6
  "secrets",
@@ -44,15 +44,15 @@
44
44
  "test:update": "npm run test update"
45
45
  },
46
46
  "dependencies": {
47
- "@augment-vir/assert": "^31.69.0",
48
- "@augment-vir/common": "^31.69.0",
47
+ "@augment-vir/assert": "^31.70.0",
48
+ "@augment-vir/common": "^31.70.0",
49
49
  "date-vir": "^8.3.2",
50
50
  "object-shape-tester": "^6.12.1",
51
51
  "type-fest": "^5.6.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@augment-vir/test": "^31.69.0",
55
- "@types/node": "^25.6.0",
54
+ "@augment-vir/test": "^31.70.0",
55
+ "@types/node": "^25.6.2",
56
56
  "c8": "^11.0.0",
57
57
  "istanbul-smart-text-reporter": "^1.1.5",
58
58
  "markdown-code-example-inserter": "^3.0.5",