diff --git a/src/Collections/CollectionChangeEntries.tsx b/src/Collections/CollectionChangeEntries.tsx index 79edcc6..7427f7d 100644 --- a/src/Collections/CollectionChangeEntries.tsx +++ b/src/Collections/CollectionChangeEntries.tsx @@ -26,13 +26,13 @@ import { CachedCollection } from "../Pim/helpers"; import LoadingIndicator from "../widgets/LoadingIndicator"; export interface CachedItem { - item: Etebase.CollectionItem; - metadata: Etebase.CollectionItemMetadata; + item: Etebase.Item; + metadata: Etebase.ItemMetadata; content: string; } // FIXME: use the ones used by e.g. Contacts/Main so ew share the cache -async function decryptItems(items: Map>) { +async function decryptItems(items: Map>) { const entries: Map> = new Map(); for (const [colUid, col] of items.entries()) { const cur = new Map(); diff --git a/src/Pim/helpers.tsx b/src/Pim/helpers.tsx index c6ae616..2c128f3 100644 --- a/src/Pim/helpers.tsx +++ b/src/Pim/helpers.tsx @@ -51,7 +51,7 @@ export function getDecryptCollectionsFunction(_colType?: string) { export function getDecryptItemsFunction(_colType: string, parseFunc: (str: string) => T) { return memoize( - async function (items: Map>) { + async function (items: Map>) { const entries: Map> = new Map(); if (items) { for (const [colUid, col] of items.entries()) { @@ -76,7 +76,7 @@ export function getDecryptItemsFunction(_colType: string, par ); } -export async function itemSave(etebase: Etebase.Account, collection: Etebase.Collection, items: Map>, item: PimType, collectionUid: string, originalItem?: PimType): Promise { +export async function itemSave(etebase: Etebase.Account, collection: Etebase.Collection, items: Map>, item: PimType, collectionUid: string, originalItem?: PimType): Promise { const itemUid = originalItem?.itemUid; const colMgr = getCollectionManager(etebase); const itemMgr = colMgr.getItemManager(collection); @@ -94,7 +94,7 @@ export async function itemSave(etebase: Etebase.Account, collection: Etebase.Col await eteItem.setMeta(meta); } else { // New - const meta: Etebase.CollectionItemMetadata = { + const meta: Etebase.ItemMetadata = { mtime, name: item.uid, }; @@ -104,7 +104,7 @@ export async function itemSave(etebase: Etebase.Account, collection: Etebase.Col await asyncDispatch(itemBatch(collection, itemMgr, [eteItem])); } -export async function itemDelete(etebase: Etebase.Account, collection: Etebase.Collection, items: Map>, item: PimType, collectionUid: string) { +export async function itemDelete(etebase: Etebase.Account, collection: Etebase.Collection, items: Map>, item: PimType, collectionUid: string) { const itemUid = item.itemUid!; const colMgr = getCollectionManager(etebase); const itemMgr = colMgr.getItemManager(collection); diff --git a/src/etebase-helpers.ts b/src/etebase-helpers.ts index e9fd80a..f15db0e 100644 --- a/src/etebase-helpers.ts +++ b/src/etebase-helpers.ts @@ -28,8 +28,8 @@ export const getCollectionsByType = memoize(async function (cachedCollections: C return ret; }, { length: 2 }); -export const getItems = memoize(async function (cachedItems: CacheItems, itemMgr: Etebase.CollectionItemManager) { - const ret = new Map(); +export const getItems = memoize(async function (cachedItems: CacheItems, itemMgr: Etebase.ItemManager) { + const ret = new Map(); for (const cached of cachedItems.values()) { const item = await itemMgr.cacheLoad(cached); ret.set(item.uid, item); @@ -40,7 +40,7 @@ export const getItems = memoize(async function (cachedItems: CacheItems, itemMgr export const getItemsByType = memoize(async function (cachedCollections: CacheCollectionsData, cachedItems: CacheItemsData, colType: string, etebase: Etebase.Account) { const colMgr = getCollectionManager(etebase); const collections = await getCollectionsByType(cachedCollections, colType, etebase); - const ret = new Map>(); + const ret = new Map>(); for (const col of collections) { const itemMgr = colMgr.getItemManager(col); const cachedColItems = cachedItems.get(col.uid); diff --git a/src/store/actions.ts b/src/store/actions.ts index 9e2ec39..2f965b4 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -81,10 +81,10 @@ export const collectionUpload = createAction( export const setCacheItem = createAction( "SET_CACHE_ITEM", - async (_col: Etebase.Collection, itemMgr: Etebase.CollectionItemManager, item: Etebase.CollectionItem) => { + async (_col: Etebase.Collection, itemMgr: Etebase.ItemManager, item: Etebase.Item) => { return await itemMgr.cacheSave(item); }, - (col: Etebase.Collection, _itemMgr: Etebase.CollectionItemManager, item: Etebase.CollectionItem) => { + (col: Etebase.Collection, _itemMgr: Etebase.ItemManager, item: Etebase.Item) => { return { colUid: col.uid, itemUid: item.uid, @@ -95,10 +95,10 @@ export const setCacheItem = createAction( export const unsetCacheItem = createAction( "UNSET_CACHE_ITEM", - (_colUid: string, _itemMgr: Etebase.CollectionItemManager, itemUid: string) => { + (_colUid: string, _itemMgr: Etebase.ItemManager, itemUid: string) => { return itemUid; }, - (colUid: string, _itemMgr: Etebase.CollectionItemManager, itemUid: string) => { + (colUid: string, _itemMgr: Etebase.ItemManager, itemUid: string) => { return { colUid, itemUid, @@ -109,14 +109,14 @@ export const unsetCacheItem = createAction( export const setCacheItemMulti = createAction( "SET_CACHE_ITEM_MULTI", - async (_colUid: string, itemMgr: Etebase.CollectionItemManager, items: Etebase.CollectionItem[]) => { + async (_colUid: string, itemMgr: Etebase.ItemManager, items: Etebase.Item[]) => { const ret = []; for (const item of items) { ret.push(await itemMgr.cacheSave(item)); } return ret; }, - (colUid: string, _itemMgr: Etebase.CollectionItemManager, items: Etebase.CollectionItem[], _deps?: Etebase.CollectionItem[]) => { + (colUid: string, _itemMgr: Etebase.ItemManager, items: Etebase.Item[], _deps?: Etebase.Item[]) => { return { colUid, items: items, @@ -126,7 +126,7 @@ export const setCacheItemMulti = createAction( export const itemBatch = createAction( "ITEM_BATCH", - async (_col: Etebase.Collection, itemMgr: Etebase.CollectionItemManager, items: Etebase.CollectionItem[], deps?: Etebase.CollectionItem[]) => { + async (_col: Etebase.Collection, itemMgr: Etebase.ItemManager, items: Etebase.Item[], deps?: Etebase.Item[]) => { await itemMgr.batch(items, deps); const ret = []; for (const item of items) { @@ -134,7 +134,7 @@ export const itemBatch = createAction( } return ret; }, - (col: Etebase.Collection, _itemMgr: Etebase.CollectionItemManager, items: Etebase.CollectionItem[], _deps?: Etebase.CollectionItem[]) => { + (col: Etebase.Collection, _itemMgr: Etebase.ItemManager, items: Etebase.Item[], _deps?: Etebase.Item[]) => { return { colUid: col.uid, items: items, diff --git a/src/store/reducers.ts b/src/store/reducers.ts index 6aba920..7eb2ec3 100644 --- a/src/store/reducers.ts +++ b/src/store/reducers.ts @@ -137,7 +137,7 @@ export const items = handleActions( actions.setCacheItemMulti ).toString()]: (state: CacheItemsData, action_: any) => { // Fails without it for some reason - const action = action_ as ActionMeta; + const action = action_ as ActionMeta; if (action.payload !== undefined) { return state.withMutations((state) => { let i = 0;