@bedrock/kms 15.0.0 → 15.0.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.
- package/lib/keystores.js +7 -7
- package/package.json +1 -1
package/lib/keystores.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2025 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import * as bedrock from '@bedrock/core';
|
|
5
5
|
import * as database from '@bedrock/mongodb';
|
|
@@ -34,12 +34,12 @@ bedrock.events.on('bedrock-mongodb.ready', async () => {
|
|
|
34
34
|
// cover queries keystore by ID
|
|
35
35
|
collection: 'kms-keystore',
|
|
36
36
|
fields: {'config.id': 1},
|
|
37
|
-
options: {unique: true
|
|
37
|
+
options: {unique: true}
|
|
38
38
|
}, {
|
|
39
39
|
// cover config queries by controller
|
|
40
40
|
collection: 'kms-keystore',
|
|
41
41
|
fields: {'config.controller': 1},
|
|
42
|
-
options: {unique: false
|
|
42
|
+
options: {unique: false}
|
|
43
43
|
}, {
|
|
44
44
|
// cover counting keystores in use by meter ID, if present
|
|
45
45
|
collection: 'kms-keystore',
|
|
@@ -48,7 +48,7 @@ bedrock.events.on('bedrock-mongodb.ready', async () => {
|
|
|
48
48
|
partialFilterExpression: {
|
|
49
49
|
'config.meterId': {$exists: true}
|
|
50
50
|
},
|
|
51
|
-
unique: false
|
|
51
|
+
unique: false
|
|
52
52
|
}
|
|
53
53
|
}]);
|
|
54
54
|
});
|
|
@@ -91,8 +91,8 @@ export async function insert({config} = {}) {
|
|
|
91
91
|
config
|
|
92
92
|
};
|
|
93
93
|
try {
|
|
94
|
-
|
|
95
|
-
return
|
|
94
|
+
await database.collections['kms-keystore'].insertOne(record);
|
|
95
|
+
return record;
|
|
96
96
|
} catch(e) {
|
|
97
97
|
if(!database.isDuplicateError(e)) {
|
|
98
98
|
throw e;
|
|
@@ -172,7 +172,7 @@ export async function update({config, explain = false} = {}) {
|
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
|
|
175
|
-
if(result.
|
|
175
|
+
if(result.modifiedCount === 0) {
|
|
176
176
|
// no records changed...
|
|
177
177
|
throw new BedrockError(
|
|
178
178
|
'Could not update keystore configuration. ' +
|