@bedrock/kms 16.1.0 → 16.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import * as brPackageManager from '@bedrock/package-manager';
|
|
5
5
|
|
|
@@ -9,15 +9,16 @@ import './config.js';
|
|
|
9
9
|
const importMap = new Map();
|
|
10
10
|
|
|
11
11
|
export class BedrockKmsModuleManager {
|
|
12
|
-
async get({id}) {
|
|
12
|
+
async get({id} = {}) {
|
|
13
13
|
const {packageName} = brPackageManager.get(
|
|
14
14
|
{alias: id, type: 'webkms-module'});
|
|
15
|
-
let
|
|
16
|
-
if(!
|
|
15
|
+
let mod = await importMap.get(packageName);
|
|
16
|
+
if(!mod) {
|
|
17
17
|
const promise = import(packageName);
|
|
18
18
|
importMap.set(packageName, promise);
|
|
19
|
-
|
|
19
|
+
mod = await promise;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
const api = await mod.getKmsModuleApi?.() ?? mod.default ?? mod;
|
|
22
|
+
return api;
|
|
22
23
|
}
|
|
23
24
|
}
|