mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix(electron): export and import (#9767)
This commit is contained in:
@@ -41,12 +41,6 @@ export class SqliteV1BlobStorage extends BlobStorageBase {
|
||||
};
|
||||
}
|
||||
|
||||
override async delete(key: string, permanently: boolean) {
|
||||
if (permanently) {
|
||||
await this.db.deleteBlob(this.options.type, this.options.id, key);
|
||||
}
|
||||
}
|
||||
|
||||
override async list() {
|
||||
const keys = await this.db.getBlobKeys(this.options.type, this.options.id);
|
||||
|
||||
@@ -57,6 +51,9 @@ export class SqliteV1BlobStorage extends BlobStorageBase {
|
||||
createdAt: new Date(),
|
||||
}));
|
||||
}
|
||||
override async delete() {
|
||||
// no more deletes
|
||||
}
|
||||
|
||||
override async set() {
|
||||
// no more writes
|
||||
|
||||
@@ -6,17 +6,16 @@ interface NativeDBV1Apis {
|
||||
workspaceId: string,
|
||||
key: string
|
||||
) => Promise<Buffer | null>;
|
||||
deleteBlob: (
|
||||
spaceType: SpaceType,
|
||||
workspaceId: string,
|
||||
key: string
|
||||
) => Promise<void>;
|
||||
getBlobKeys: (spaceType: SpaceType, workspaceId: string) => Promise<string[]>;
|
||||
getDocAsUpdates: (
|
||||
spaceType: SpaceType,
|
||||
workspaceId: string,
|
||||
subdocId: string
|
||||
) => Promise<Uint8Array>;
|
||||
getDocTimestamps: (
|
||||
spaceType: SpaceType,
|
||||
workspaceId: string
|
||||
) => Promise<{ docId?: string; timestamp: Date }[]>;
|
||||
}
|
||||
|
||||
export let apis: NativeDBV1Apis | null = null;
|
||||
|
||||
@@ -56,6 +56,27 @@ export class SqliteV1DocStorage extends DocStorageBase<{
|
||||
};
|
||||
}
|
||||
|
||||
override async getDocTimestamps() {
|
||||
const timestamps = await this.db.getDocTimestamps(
|
||||
this.options.type,
|
||||
this.options.id
|
||||
);
|
||||
|
||||
if (!timestamps) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const idConverter = await this.getIdConverter();
|
||||
|
||||
return timestamps.reduce(
|
||||
(ret, { docId, timestamp }) => {
|
||||
ret[idConverter.oldIdToNewId(docId ?? this.options.id)] = timestamp;
|
||||
return ret;
|
||||
},
|
||||
{} as Record<string, Date>
|
||||
);
|
||||
}
|
||||
|
||||
override async deleteDoc() {
|
||||
return;
|
||||
}
|
||||
@@ -64,10 +85,6 @@ export class SqliteV1DocStorage extends DocStorageBase<{
|
||||
return null;
|
||||
}
|
||||
|
||||
override async getDocTimestamps() {
|
||||
return {};
|
||||
}
|
||||
|
||||
override async getDocTimestamp() {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user