forked from decentralized-identity/dwn-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added plugin support (decentralized-identity#145)
- Added plugin support for `MessageStore`, `DataStore`, `ResumableDataStore`, `EventLog` and `EventStream`. - Exposed config for `EventStream`. - Exposed config for `ResumableTaskStore`. - Refactored/consolidated repeated test code. - Various renames.
- Loading branch information
1 parent
6e45f03
commit 92549e5
Showing
20 changed files
with
526 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* A utility class for dynamically loading plugins from file paths. | ||
*/ | ||
export class PluginLoader { | ||
/** | ||
* Dynamically loads a plugin from a file path by invoking the argument-less constructor of the default exported class. | ||
*/ | ||
public static async loadPlugin<T>(filePath: string): Promise<T> { | ||
try { | ||
const module = await import(filePath); | ||
const instance: T = new module.default() as T; | ||
return instance; | ||
} catch (error) { | ||
throw new Error(`Failed to load component at ${filePath}: ${error.message}`); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.