updating-secrets 1.2.0 → 1.2.1

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.
@@ -63,7 +63,9 @@ export class SecretsJsonFileAdapter extends BaseSecretsAdapter {
63
63
  const secretValue = existingSecrets[key];
64
64
  const shapeDefinition = secrets[key]?.shapeDefinition;
65
65
  return shapeDefinition
66
- ? !checkValidShape(secretValue, shapeDefinition)
66
+ ? !checkValidShape(secretValue, shapeDefinition, {
67
+ allowExtraKeys: true,
68
+ })
67
69
  : !check.isString(secretValue);
68
70
  });
69
71
  if (invalidSecretKeys.length > 0) {
@@ -148,9 +148,7 @@ export class UpdatingSecrets {
148
148
  throw value;
149
149
  }
150
150
  else if (shapeDefinition) {
151
- assertValidShape(value, shapeDefinition,
152
- /** Allow extra keys for forwards compatibility. */
153
- {
151
+ assertValidShape(value, shapeDefinition, {
154
152
  allowExtraKeys: true,
155
153
  });
156
154
  }
@@ -158,7 +156,9 @@ export class UpdatingSecrets {
158
156
  }
159
157
  catch (caught) {
160
158
  if (shapeDefinition &&
161
- checkValidShape(undefined, shapeDefinition)) {
159
+ checkValidShape(undefined, shapeDefinition, {
160
+ allowExtraKeys: true,
161
+ })) {
162
162
  return undefined;
163
163
  }
164
164
  const error = new SecretLoadError(ensureError(caught), {
@@ -304,7 +304,9 @@ export class UpdatingSecrets {
304
304
  async loadDynamicSecret(secretKey, shapeRequirement) {
305
305
  const cached = this.dynamicCache[secretKey];
306
306
  if (cached &&
307
- checkValidShape(cached.value, shapeRequirement) &&
307
+ checkValidShape(cached.value, shapeRequirement, {
308
+ allowExtraKeys: true,
309
+ }) &&
308
310
  !isDateAfter({
309
311
  fullDate: getNowInUtcTimezone(),
310
312
  relativeTo: calculateRelativeDate(cached.cachedAt, this.options.updateInterval),
@@ -327,14 +329,18 @@ export class UpdatingSecrets {
327
329
  if (!value) {
328
330
  throw new Error('Secret is empty');
329
331
  }
330
- assertValidShape(value, shapeRequirement);
332
+ assertValidShape(value, shapeRequirement, {
333
+ allowExtraKeys: true,
334
+ });
331
335
  return value;
332
336
  }
333
337
  catch (error) {
334
338
  errors.push(ensureErrorAndPrependMessage(error, `Failed to load secret '${secretKey}' from adapter '${adapter.adapterName}'`));
335
339
  }
336
340
  }
337
- if (checkValidShape(undefined, shapeRequirement)) {
341
+ if (checkValidShape(undefined, shapeRequirement, {
342
+ allowExtraKeys: true,
343
+ })) {
338
344
  return undefined;
339
345
  }
340
346
  throw combineErrors(errors);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "updating-secrets",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Automatically update secrets on an interval with support for seamless secret rotation.",
5
5
  "keywords": [
6
6
  "secrets",
@@ -44,14 +44,14 @@
44
44
  "test:update": "npm run test update"
45
45
  },
46
46
  "dependencies": {
47
- "@augment-vir/assert": "^31.68.4",
48
- "@augment-vir/common": "^31.68.4",
47
+ "@augment-vir/assert": "^31.69.0",
48
+ "@augment-vir/common": "^31.69.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.68.4",
54
+ "@augment-vir/test": "^31.69.0",
55
55
  "@types/node": "^25.6.0",
56
56
  "c8": "^11.0.0",
57
57
  "istanbul-smart-text-reporter": "^1.1.5",