mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
feat: seperate createDoc and createStore (#11182)
This commit is contained in:
@@ -1127,8 +1127,9 @@ export class Store {
|
||||
schema: this.schema,
|
||||
blobCRUD: this.workspace.blobSync,
|
||||
docCRUD: {
|
||||
create: (id: string) => this.workspace.createDoc({ id }),
|
||||
get: (id: string) => this.workspace.getDoc(id),
|
||||
create: (id: string) => this.workspace.createDoc(id).getStore({ id }),
|
||||
get: (id: string) =>
|
||||
this.workspace.getDoc(id)?.getStore({ id }) ?? null,
|
||||
delete: (id: string) => this.workspace.removeDoc(id),
|
||||
},
|
||||
middlewares,
|
||||
|
||||
@@ -4,8 +4,7 @@ import type { Awareness } from 'y-protocols/awareness.js';
|
||||
import type * as Y from 'yjs';
|
||||
|
||||
import type { IdGenerator } from '../utils/id-generator.js';
|
||||
import type { CreateBlocksOptions, Doc, GetBlocksOptions } from './doc.js';
|
||||
import type { Store } from './store/store.js';
|
||||
import type { Doc } from './doc.js';
|
||||
import type { WorkspaceMeta } from './workspace-meta.js';
|
||||
|
||||
export interface Workspace {
|
||||
@@ -25,8 +24,8 @@ export interface Workspace {
|
||||
docRemoved: Subject<string>;
|
||||
};
|
||||
|
||||
createDoc(options?: CreateBlocksOptions): Store;
|
||||
getDoc(docId: string, options?: GetBlocksOptions): Store | null;
|
||||
createDoc(docId?: string): Doc;
|
||||
getDoc(docId: string): Doc | null;
|
||||
removeDoc(docId: string): void;
|
||||
|
||||
dispose(): void;
|
||||
|
||||
Reference in New Issue
Block a user