Update etebase dep and adjust according to the async changes.

master
Tom Hacohen 4 years ago
parent e9cbb9bf37
commit 990f693da8

@ -9,7 +9,7 @@
"@material-ui/lab": "^4.0.0-alpha.56", "@material-ui/lab": "^4.0.0-alpha.56",
"@material-ui/pickers": "^3.2.10", "@material-ui/pickers": "^3.2.10",
"@material-ui/styles": "^4.10.0", "@material-ui/styles": "^4.10.0",
"etebase": "^0.20.0", "etebase": "^0.30.0",
"fuse.js": "^5.0.9-beta", "fuse.js": "^5.0.9-beta",
"ical.js": "^1.4.0", "ical.js": "^1.4.0",
"immutable": "^4.0.0-rc.12", "immutable": "^4.0.0-rc.12",

@ -29,7 +29,7 @@ async function decryptItems(items: Map<string, Map<string, Etebase.Item>>) {
for (const item of col.values()) { for (const item of col.values()) {
cur.set(item.uid, { cur.set(item.uid, {
item, item,
metadata: await item.getMeta(), metadata: item.getMeta(),
content: await item.getContent(Etebase.OutputFormat.String), content: await item.getContent(Etebase.OutputFormat.String),
}); });
} }

@ -98,7 +98,7 @@ export default function CollectionEdit(props: PropsType) {
let collection; let collection;
if (props.collection) { if (props.collection) {
collection = props.collection.collection; collection = props.collection.collection;
await collection.setMeta(meta); collection.setMeta(meta);
} else { } else {
collection = await colMgr.create(colType, meta, ""); collection = await colMgr.create(colType, meta, "");
} }

@ -56,9 +56,9 @@ export default function CollectionsMain() {
async function onDelete(collection: Etebase.Collection) { async function onDelete(collection: Etebase.Collection) {
const colMgr = getCollectionManager(etebase); const colMgr = getCollectionManager(etebase);
const mtime = (new Date()).getTime(); const mtime = (new Date()).getTime();
const meta = await collection.getMeta(); const meta = collection.getMeta();
await collection.setMeta({ ...meta, mtime }); collection.setMeta({ ...meta, mtime });
await collection.delete(true); collection.delete(true);
await dispatch(collectionUpload(colMgr, collection)); await dispatch(collectionUpload(colMgr, collection));
dispatch(pushMessage({ message: "Collection deleted", severity: "success" })); dispatch(pushMessage({ message: "Collection deleted", severity: "success" }));

@ -71,7 +71,7 @@ export default function Debug() {
console.log(wantAll, colItems.size); console.log(wantAll, colItems.size);
for (const cached of colItems.values()) { for (const cached of colItems.values()) {
const item = itemMgr.cacheLoad(cached); const item = itemMgr.cacheLoad(cached);
const meta = await item.getMeta(); const meta = item.getMeta();
const content = await item.getContent(Etebase.OutputFormat.String); const content = await item.getContent(Etebase.OutputFormat.String);
if (wantAll || wantedEntries[item.uid]) { if (wantAll || wantedEntries[item.uid]) {
retEntries.push(`${JSON.stringify(meta)}\n${content}`); retEntries.push(`${JSON.stringify(meta)}\n${content}`);

@ -39,7 +39,7 @@ async function loadRevisions(etebase: Etebase.Account, col: Etebase.Collection,
for (const item of revisions.data) { for (const item of revisions.data) {
ret.push({ ret.push({
item, item,
metadata: await item.getMeta(), metadata: item.getMeta(),
content: await item.getContent(Etebase.OutputFormat.String), content: await item.getContent(Etebase.OutputFormat.String),
}); });
} }

@ -40,8 +40,8 @@ export function getDecryptCollectionsFunction(_colType?: string) {
try { try {
entries.push({ entries.push({
collection, collection,
metadata: await collection.getMeta(), metadata: collection.getMeta(),
collectionType: await collection.getCollectionType(), collectionType: collection.getCollectionType(),
}); });
} catch (e) { } catch (e) {
store.dispatch(appendError(e)); store.dispatch(appendError(e));
@ -98,9 +98,9 @@ export async function itemSave(etebase: Etebase.Account, collection: Etebase.Col
// Existing item // Existing item
eteItem = items!.get(collectionUid)?.get(itemUid)!; eteItem = items!.get(collectionUid)?.get(itemUid)!;
await eteItem.setContent(content); await eteItem.setContent(content);
const meta = await eteItem.getMeta(); const meta = eteItem.getMeta();
meta.mtime = mtime; meta.mtime = mtime;
await eteItem.setMeta(meta); eteItem.setMeta(meta);
} else { } else {
// New // New
const meta: Etebase.ItemMetadata = { const meta: Etebase.ItemMetadata = {
@ -120,10 +120,10 @@ export async function itemDelete(etebase: Etebase.Account, collection: Etebase.C
const eteItem = items!.get(collectionUid)?.get(itemUid)!; const eteItem = items!.get(collectionUid)?.get(itemUid)!;
const mtime = (new Date()).getTime(); const mtime = (new Date()).getTime();
const meta = await eteItem.getMeta(); const meta = eteItem.getMeta();
meta.mtime = mtime; meta.mtime = mtime;
await eteItem.setMeta(meta); eteItem.setMeta(meta);
await eteItem.delete(true); eteItem.delete(true);
await asyncDispatch(itemBatch(collection, itemMgr, [eteItem])); await asyncDispatch(itemBatch(collection, itemMgr, [eteItem]));
} }

@ -20,7 +20,7 @@ export const getCollectionsByType = memoize(async function (cachedCollections: C
const collections = await getCollections(cachedCollections, etebase); const collections = await getCollections(cachedCollections, etebase);
const ret: Etebase.Collection[] = []; const ret: Etebase.Collection[] = [];
for (const col of collections) { for (const col of collections) {
const collectionType = await col.getCollectionType(); const collectionType = col.getCollectionType();
if (collectionType === colType) { if (collectionType === colType) {
ret.push(col); ret.push(col);
} }

@ -66,7 +66,7 @@ export class SyncManager {
while (!done) { while (!done) {
const collections = await colMgr.list(this.COLLECTION_TYPES, { stoken, limit }); const collections = await colMgr.list(this.COLLECTION_TYPES, { stoken, limit });
for (const col of collections.data) { for (const col of collections.data) {
const collectionType = await col.getCollectionType(); const collectionType = col.getCollectionType();
if (this.COLLECTION_TYPES.includes(collectionType)) { if (this.COLLECTION_TYPES.includes(collectionType)) {
store.dispatch(setCacheCollection(colMgr, col)); store.dispatch(setCacheCollection(colMgr, col));
await this.fetchCollection(col); await this.fetchCollection(col);

@ -4644,10 +4644,10 @@ etag@~1.8.1:
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=
etebase@^0.20.0: etebase@^0.30.0:
version "0.20.0" version "0.30.0"
resolved "https://registry.yarnpkg.com/etebase/-/etebase-0.20.0.tgz#53537d76d71d356d2538c85292ee40ed32fde625" resolved "https://registry.yarnpkg.com/etebase/-/etebase-0.30.0.tgz#60c33e0acaefcf02704ce31d0b831f0874de4f2a"
integrity sha512-jmrrflrSG0kLe1ud3FjDishQ93Jx8s72r9xgkDxlVioxRJamJ0mE/+9KjfDRAFjWAzui8LIblOcIDw+NYPfbsA== integrity sha512-MUQi04iQfDHaGhmx7b/JdouX2JZTEqnkqWUX+eedg1KHpa+se+kra/byQvrY7zzAbUueJiLnEdGfuFGCL/8ohw==
dependencies: dependencies:
"@msgpack/msgpack" "^1.12.2" "@msgpack/msgpack" "^1.12.2"
libsodium-wrappers "0.7.6" libsodium-wrappers "0.7.6"

Loading…
Cancel
Save