feat(nbstore): adapt op pattern (#8808)

This commit is contained in:
forehalo
2024-11-22 03:13:04 +00:00
parent 4125038ff8
commit 64656d198c
6 changed files with 275 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
import type { Storage } from '../storage';
type StorageConstructor = new (...args: any[]) => Storage;
export const storages: StorageConstructor[] = [];
// in next pr
// eslint-disable-next-line sonarjs/no-empty-collection
const AvailableStorageImplementations = storages.reduce(
(acc, curr) => {
acc[curr.name] = curr;
return acc;
},
{} as Record<string, StorageConstructor>
);
export const getAvailableStorageImplementations = (name: string) => {
return AvailableStorageImplementations[name];
};