mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
refactor: setup files (#8201)
This commit is contained in:
@@ -5,7 +5,7 @@ import type { Awareness } from 'y-protocols/awareness.js';
|
||||
|
||||
import { Entity } from '../../../framework';
|
||||
import { LiveData } from '../../../livedata';
|
||||
import { globalBlockSuiteSchema } from '../global-schema';
|
||||
import { getAFFiNEWorkspaceSchema } from '../global-schema';
|
||||
import type { WorkspaceScope } from '../scopes/workspace';
|
||||
import { WorkspaceEngineService } from '../services/engine';
|
||||
import { WorkspaceUpgradeService } from '../services/upgrade';
|
||||
@@ -33,7 +33,7 @@ export class Workspace extends Entity {
|
||||
main: this.engine.blob,
|
||||
},
|
||||
idGenerator: () => nanoid(),
|
||||
schema: globalBlockSuiteSchema,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
});
|
||||
this._docCollection.slots.docCreated.on(id => {
|
||||
this.engine.doc.markAsReady(id);
|
||||
|
||||
@@ -2,7 +2,13 @@ import { AffineSchemas } from '@blocksuite/blocks/schemas';
|
||||
import { AIChatBlockSchema } from '@blocksuite/presets';
|
||||
import { Schema } from '@blocksuite/store';
|
||||
|
||||
export const globalBlockSuiteSchema = new Schema();
|
||||
let _schema: Schema | null = null;
|
||||
export function getAFFiNEWorkspaceSchema() {
|
||||
if (!_schema) {
|
||||
_schema = new Schema();
|
||||
|
||||
const schemas = [...AffineSchemas, AIChatBlockSchema];
|
||||
globalBlockSuiteSchema.register(schemas);
|
||||
_schema.register([...AffineSchemas, AIChatBlockSchema]);
|
||||
}
|
||||
|
||||
return _schema;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export type { WorkspaceProfileInfo } from './entities/profile';
|
||||
export { Workspace } from './entities/workspace';
|
||||
export { WorkspaceEngineBeforeStart, WorkspaceInitialized } from './events';
|
||||
export { globalBlockSuiteSchema } from './global-schema';
|
||||
export { getAFFiNEWorkspaceSchema } from './global-schema';
|
||||
export type { WorkspaceMetadata } from './metadata';
|
||||
export type { WorkspaceOpenOptions } from './open-options';
|
||||
export type { WorkspaceEngineProvider } from './providers/flavour';
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { MemoryBlobStorage } from '../../../sync/blob/blob';
|
||||
import type { GlobalState } from '../../storage';
|
||||
import type { WorkspaceProfileInfo } from '../entities/profile';
|
||||
import { globalBlockSuiteSchema } from '../global-schema';
|
||||
import { getAFFiNEWorkspaceSchema } from '../global-schema';
|
||||
import type { WorkspaceMetadata } from '../metadata';
|
||||
import type {
|
||||
WorkspaceEngineProvider,
|
||||
@@ -57,7 +57,7 @@ export class TestingWorkspaceLocalProvider
|
||||
const docCollection = new DocCollection({
|
||||
id: id,
|
||||
idGenerator: () => nanoid(),
|
||||
schema: globalBlockSuiteSchema,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
blobSources: {
|
||||
main: blobStorage,
|
||||
},
|
||||
@@ -94,7 +94,7 @@ export class TestingWorkspaceLocalProvider
|
||||
|
||||
const bs = new DocCollection({
|
||||
id,
|
||||
schema: globalBlockSuiteSchema,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
});
|
||||
|
||||
applyUpdate(bs.doc, data);
|
||||
|
||||
Reference in New Issue
Block a user