refactor: rename WorkspacePlugin to WorkspaceAdapter (#2330)

This commit is contained in:
Himself65
2023-05-12 01:43:39 +08:00
committed by GitHub
parent 39c83bd25b
commit 063ffda09d
28 changed files with 189 additions and 83 deletions

View File

@@ -80,13 +80,16 @@ export interface AffineWebSocketProvider extends BackgroundProvider {
export type Provider = BackgroundProvider | NecessaryProvider;
export interface AffineWorkspace extends RemoteWorkspace {
export interface AffineLegacyCloudWorkspace extends RemoteWorkspace {
flavour: WorkspaceFlavour.AFFINE;
// empty
blockSuiteWorkspace: BlockSuiteWorkspace;
providers: Provider[];
}
// todo: update type with nest.js
export type AffineCloudWorkspace = LocalWorkspace;
export interface LocalWorkspace {
flavour: WorkspaceFlavour.LOCAL;
id: string;
@@ -101,6 +104,12 @@ export interface AffinePublicWorkspace {
providers: Provider[];
}
export const enum ReleaseType {
// if workspace is not released yet, we will not show it in the workspace list
UNRELEASED = 'unreleased',
STABLE = 'stable',
}
export const enum LoadPriority {
HIGH = 1,
MEDIUM = 2,
@@ -108,7 +117,18 @@ export const enum LoadPriority {
}
export const enum WorkspaceFlavour {
/**
* AFFiNE Workspace is the workspace
* that hosted on the Legacy AFFiNE Cloud Server.
*
* @deprecated
* We no longer maintain this kind of workspace, please use AFFiNE-Cloud instead.
*/
AFFINE = 'affine',
/**
* New AFFiNE Cloud Workspace using Nest.js Server.
*/
AFFINE_CLOUD = 'affine-cloud',
LOCAL = 'local',
PUBLIC = 'affine-public',
}
@@ -125,9 +145,11 @@ export type SettingPanel = (typeof settingPanel)[keyof typeof settingPanel];
// built-in workspaces
export interface WorkspaceRegistry {
[WorkspaceFlavour.AFFINE]: AffineWorkspace;
[WorkspaceFlavour.AFFINE]: AffineLegacyCloudWorkspace;
[WorkspaceFlavour.LOCAL]: LocalWorkspace;
[WorkspaceFlavour.PUBLIC]: AffinePublicWorkspace;
// todo: update workspace type to new
[WorkspaceFlavour.AFFINE_CLOUD]: AffineCloudWorkspace;
}
export interface WorkspaceCRUD<Flavour extends keyof WorkspaceRegistry> {