|
|
@ -27,6 +27,7 @@ const storeCallbacks: Record<string, ((data: any) => void)[]> = {}; |
|
|
|
const stores: Record<string, [StoreRet<any>, InternalStoreData]> = {}; |
|
|
|
const stores: Record<string, [StoreRet<any>, InternalStoreData]> = {}; |
|
|
|
|
|
|
|
|
|
|
|
export async function initializeOldStores() { |
|
|
|
export async function initializeOldStores() { |
|
|
|
|
|
|
|
console.log(stores); |
|
|
|
// migrate all stores
|
|
|
|
// migrate all stores
|
|
|
|
for (const [store, internal] of Object.values(stores)) { |
|
|
|
for (const [store, internal] of Object.values(stores)) { |
|
|
|
const versions = internal.versions.sort((a, b) => a.version - b.version); |
|
|
|
const versions = internal.versions.sort((a, b) => a.version - b.version); |
|
|
@ -168,6 +169,7 @@ export function createVersionedStore<T>(): StoreBuilder<T> { |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
}, |
|
|
|
}, |
|
|
|
build() { |
|
|
|
build() { |
|
|
|
|
|
|
|
console.log(_data.key); |
|
|
|
assertStore(_data); |
|
|
|
assertStore(_data); |
|
|
|
const storageObject = buildStorageObject<T>(_data); |
|
|
|
const storageObject = buildStorageObject<T>(_data); |
|
|
|
stores[_data.key ?? ""] = [storageObject, _data]; |
|
|
|
stores[_data.key ?? ""] = [storageObject, _data]; |
|
|
|