updating-secrets 1.1.1 → 1.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/dist/secret-load.error.js +3 -1
- package/dist/updating-secrets.js +10 -3
- package/package.json +11 -11
|
@@ -13,7 +13,9 @@ export class SecretLoadError extends Error {
|
|
|
13
13
|
allErrors = [];
|
|
14
14
|
constructor(originalError, { adapterName, secretName, }) {
|
|
15
15
|
const message = `Failed to load secret '${secretName}' from adapter '${adapterName}': ${extractErrorMessage(originalError)}`;
|
|
16
|
-
super(message, {
|
|
16
|
+
super(message, {
|
|
17
|
+
cause: originalError,
|
|
18
|
+
});
|
|
17
19
|
this.allErrors.push(originalError);
|
|
18
20
|
}
|
|
19
21
|
}
|
package/dist/updating-secrets.js
CHANGED
|
@@ -141,14 +141,14 @@ export class UpdatingSecrets {
|
|
|
141
141
|
try {
|
|
142
142
|
const rawSecrets = await adapter.loadSecrets(this.processedSecrets);
|
|
143
143
|
return mapObjectValues(rawSecrets, async (secretName, loadedSecretValue) => {
|
|
144
|
+
const shapeDefinition = this.processedSecrets[secretName]?.shapeDefinition;
|
|
144
145
|
try {
|
|
145
146
|
const value = await loadedSecretValue;
|
|
146
147
|
if (value instanceof Error) {
|
|
147
148
|
throw value;
|
|
148
149
|
}
|
|
149
|
-
else if (
|
|
150
|
-
assertValidShape(value,
|
|
151
|
-
.shapeDefinition,
|
|
150
|
+
else if (shapeDefinition) {
|
|
151
|
+
assertValidShape(value, shapeDefinition,
|
|
152
152
|
/** Allow extra keys for forwards compatibility. */
|
|
153
153
|
{
|
|
154
154
|
allowExtraKeys: true,
|
|
@@ -157,6 +157,10 @@ export class UpdatingSecrets {
|
|
|
157
157
|
return value;
|
|
158
158
|
}
|
|
159
159
|
catch (caught) {
|
|
160
|
+
if (shapeDefinition &&
|
|
161
|
+
checkValidShape(undefined, shapeDefinition)) {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
160
164
|
const error = new SecretLoadError(ensureError(caught), {
|
|
161
165
|
adapterName: adapter.adapterName,
|
|
162
166
|
secretName,
|
|
@@ -330,6 +334,9 @@ export class UpdatingSecrets {
|
|
|
330
334
|
errors.push(ensureErrorAndPrependMessage(error, `Failed to load secret '${secretKey}' from adapter '${adapter.adapterName}'`));
|
|
331
335
|
}
|
|
332
336
|
}
|
|
337
|
+
if (checkValidShape(undefined, shapeRequirement)) {
|
|
338
|
+
return undefined;
|
|
339
|
+
}
|
|
333
340
|
throw combineErrors(errors);
|
|
334
341
|
}
|
|
335
342
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "updating-secrets",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Automatically update secrets on an interval with support for seamless secret rotation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"secrets",
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
"test:update": "npm run test update"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@augment-vir/assert": "^31.
|
|
48
|
-
"@augment-vir/common": "^31.
|
|
49
|
-
"date-vir": "^8.
|
|
50
|
-
"object-shape-tester": "^6.
|
|
51
|
-
"type-fest": "^5.
|
|
47
|
+
"@augment-vir/assert": "^31.68.4",
|
|
48
|
+
"@augment-vir/common": "^31.68.4",
|
|
49
|
+
"date-vir": "^8.3.2",
|
|
50
|
+
"object-shape-tester": "^6.12.1",
|
|
51
|
+
"type-fest": "^5.6.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@augment-vir/test": "^31.
|
|
55
|
-
"@types/node": "^25.0
|
|
56
|
-
"c8": "^
|
|
54
|
+
"@augment-vir/test": "^31.68.4",
|
|
55
|
+
"@types/node": "^25.6.0",
|
|
56
|
+
"c8": "^11.0.0",
|
|
57
57
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
58
|
-
"markdown-code-example-inserter": "^3.0.
|
|
59
|
-
"typedoc": "^0.28.
|
|
58
|
+
"markdown-code-example-inserter": "^3.0.5",
|
|
59
|
+
"typedoc": "^0.28.19",
|
|
60
60
|
"typescript": "^5.9.3"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|