mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
chore: bump blocksuite (#7075)
## Features - toeverything/blocksuite#6937 @Flrande ## Bugfix - toeverything/blocksuite#7137 @fundon - toeverything/blocksuite#7126 @golok727 - toeverything/blocksuite#7128 @CatsJuice - toeverything/blocksuite#7130 @fundon ## Refactor ## Misc - toeverything/blocksuite#7131 @fundon ## Additional changes Adjust the awareness provider so that it only obtains awareness instances when connect, and fixes the dependencies between workspace components.
This commit is contained in:
@@ -34,7 +34,7 @@ export class WorkspaceEngine extends Entity<{
|
||||
|
||||
start() {
|
||||
this.doc.start();
|
||||
this.awareness.connect();
|
||||
this.awareness.connect(this.workspaceService.workspace.awareness);
|
||||
this.blob.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,11 +78,11 @@ export class WorkspaceUpgrade extends Entity {
|
||||
this.workspaceService.workspace.docCollection.schema
|
||||
);
|
||||
const blobList =
|
||||
await this.workspaceService.workspace.docCollection.blob.list();
|
||||
await this.workspaceService.workspace.docCollection.blobSync.list();
|
||||
|
||||
for (const blobKey of blobList) {
|
||||
const blob =
|
||||
await this.workspaceService.workspace.docCollection.blob.get(
|
||||
await this.workspaceService.workspace.docCollection.blobSync.get(
|
||||
blobKey
|
||||
);
|
||||
if (blob) {
|
||||
|
||||
@@ -29,24 +29,9 @@ export class Workspace extends Entity {
|
||||
if (!this._docCollection) {
|
||||
this._docCollection = new DocCollection({
|
||||
id: this.openOptions.metadata.id,
|
||||
blobStorages: [
|
||||
() => ({
|
||||
crud: {
|
||||
get: key => {
|
||||
return this.engine.blob.get(key);
|
||||
},
|
||||
set: (key, value) => {
|
||||
return this.engine.blob.set(key, value);
|
||||
},
|
||||
list: () => {
|
||||
return this.engine.blob.list();
|
||||
},
|
||||
delete: key => {
|
||||
return this.engine.blob.delete(key);
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
blobSources: {
|
||||
main: this.engine.blob,
|
||||
},
|
||||
idGenerator: () => nanoid(),
|
||||
schema: globalBlockSuiteSchema,
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@ export function configureWorkspaceModule(framework: Framework) {
|
||||
.scope(WorkspaceScope)
|
||||
.service(WorkspaceService)
|
||||
.entity(Workspace, [WorkspaceScope])
|
||||
.service(WorkspaceEngineService, [WorkspaceService])
|
||||
.service(WorkspaceEngineService, [WorkspaceScope])
|
||||
.entity(WorkspaceEngine, [WorkspaceService])
|
||||
.service(WorkspaceUpgradeService)
|
||||
.entity(WorkspaceUpgrade, [
|
||||
|
||||
@@ -10,7 +10,6 @@ import type {
|
||||
DocStorage,
|
||||
} from '../../../sync';
|
||||
import type { WorkspaceProfileInfo } from '../entities/profile';
|
||||
import type { Workspace } from '../entities/workspace';
|
||||
import type { WorkspaceMetadata } from '../metadata';
|
||||
|
||||
export interface WorkspaceEngineProvider {
|
||||
@@ -54,7 +53,7 @@ export interface WorkspaceFlavourProvider {
|
||||
|
||||
getWorkspaceBlob(id: string, blob: string): Promise<Blob | null>;
|
||||
|
||||
getEngineProvider(workspace: Workspace): WorkspaceEngineProvider;
|
||||
getEngineProvider(workspaceId: string): WorkspaceEngineProvider;
|
||||
}
|
||||
|
||||
export const WorkspaceFlavourProvider =
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Service } from '../../../framework';
|
||||
import { WorkspaceEngine } from '../entities/engine';
|
||||
import type { WorkspaceService } from './workspace';
|
||||
import type { WorkspaceScope } from '../scopes/workspace';
|
||||
|
||||
export class WorkspaceEngineService extends Service {
|
||||
private _engine: WorkspaceEngine | null = null;
|
||||
@@ -8,15 +8,15 @@ export class WorkspaceEngineService extends Service {
|
||||
if (!this._engine) {
|
||||
this._engine = this.framework.createEntity(WorkspaceEngine, {
|
||||
engineProvider:
|
||||
this.workspaceService.workspace.flavourProvider.getEngineProvider(
|
||||
this.workspaceService.workspace
|
||||
this.workspaceScope.props.flavourProvider.getEngineProvider(
|
||||
this.workspaceScope.props.openOptions.metadata.id
|
||||
),
|
||||
});
|
||||
}
|
||||
return this._engine;
|
||||
}
|
||||
|
||||
constructor(private readonly workspaceService: WorkspaceService) {
|
||||
constructor(private readonly workspaceScope: WorkspaceScope) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import { type BlobStorage, MemoryDocStorage } from '../../../sync';
|
||||
import { MemoryBlobStorage } from '../../../sync/blob/blob';
|
||||
import type { GlobalState } from '../../storage';
|
||||
import type { WorkspaceProfileInfo } from '../entities/profile';
|
||||
import type { Workspace } from '../entities/workspace';
|
||||
import { globalBlockSuiteSchema } from '../global-schema';
|
||||
import type { WorkspaceMetadata } from '../metadata';
|
||||
import type {
|
||||
@@ -54,13 +53,9 @@ export class TestingWorkspaceLocalProvider
|
||||
id: id,
|
||||
idGenerator: () => nanoid(),
|
||||
schema: globalBlockSuiteSchema,
|
||||
blobStorages: [
|
||||
() => {
|
||||
return {
|
||||
crud: blobStorage,
|
||||
};
|
||||
},
|
||||
],
|
||||
blobSources: {
|
||||
main: blobStorage,
|
||||
},
|
||||
});
|
||||
|
||||
// apply initial state
|
||||
@@ -110,7 +105,7 @@ export class TestingWorkspaceLocalProvider
|
||||
blob
|
||||
);
|
||||
}
|
||||
getEngineProvider(workspace: Workspace): WorkspaceEngineProvider {
|
||||
getEngineProvider(workspaceId: string): WorkspaceEngineProvider {
|
||||
return {
|
||||
getDocStorage: () => {
|
||||
return this.docStorage;
|
||||
@@ -123,7 +118,7 @@ export class TestingWorkspaceLocalProvider
|
||||
},
|
||||
getLocalBlobStorage: () => {
|
||||
return new MemoryBlobStorage(
|
||||
wrapMemento(this.store, workspace.id + '/blobs/')
|
||||
wrapMemento(this.store, workspaceId + '/blobs/')
|
||||
);
|
||||
},
|
||||
getRemoteBlobStorages() {
|
||||
|
||||
Reference in New Issue
Block a user