refactor: place y-websocket in data-service

This commit is contained in:
alt0
2022-12-22 22:09:12 +08:00
parent 825851c7d6
commit 1cf6cc03c0
7 changed files with 11 additions and 29 deletions
+1 -3
View File
@@ -28,7 +28,6 @@
"css-spring": "^4.1.0",
"dayjs": "^1.11.7",
"i18next": "^21.9.1",
"lib0": "^0.2.58",
"lit": "^2.3.1",
"next": "13.0.1",
"prettier": "^2.7.1",
@@ -36,8 +35,7 @@
"quill-cursors": "^4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "^11.18.4",
"y-protocols": "^1.0.5"
"react-i18next": "^11.18.4"
},
"devDependencies": {
"@types/node": "18.7.18",
@@ -13,27 +13,7 @@ import type {
LoadWorkspaceHandler,
CreateEditorHandler,
} from './context';
import { token } from '@pathfinder/data-services';
import { WebsocketProvider } from './y-websocket';
const getEditorParams = (workspaceId: string) => {
const providers = [];
const params = new URLSearchParams(location.search);
// const room = params.get('room') ?? 'AFFINE-pathfinder';
// if (params.get('syncMode') === 'websocket') {
// const WebsocketDocProvider = createWebsocketDocProvider(
// `ws://${window.location.host}/collaboration/`
// );
// providers.push(WebsocketDocProvider);
// }
providers.push(IndexedDBDocProvider);
return {
room: workspaceId,
providers,
};
};
import { token, WebsocketProvider } from '@pathfinder/data-services';
interface Props {
setLoadWorkspaceHandler: (handler: LoadWorkspaceHandler) => void;
+3 -1
View File
@@ -26,6 +26,8 @@
"encoding": "^0.1.13",
"firebase": "^9.13.0",
"ky": "^0.33.0",
"swr": "^2.0.0"
"swr": "^2.0.0",
"lib0": "^0.2.58",
"y-protocols": "^1.0.5"
}
}
+1
View File
@@ -1,3 +1,4 @@
export { signInWithGoogle, onAuthStateChanged } from './auth';
export * from './request';
export * from './sdks';
export * from './websocket';
@@ -0,0 +1 @@
export { WebsocketProvider } from './y-websocket';
+4 -4
View File
@@ -62,7 +62,6 @@ importers:
eslint-config-prettier: ^8.5.0
eslint-plugin-prettier: ^4.2.1
i18next: ^21.9.1
lib0: ^0.2.58
lit: ^2.3.1
next: 13.0.1
prettier: ^2.7.1
@@ -72,7 +71,6 @@ importers:
react-dom: 18.2.0
react-i18next: ^11.18.4
typescript: 4.8.3
y-protocols: ^1.0.5
dependencies:
'@blocksuite/blocks': 0.3.0-20221222060715-f897f05
'@blocksuite/editor': 0.3.0-20221222060715-f897f05
@@ -93,7 +91,6 @@ importers:
css-spring: 4.1.0
dayjs: 1.11.7
i18next: 21.10.0
lib0: 0.2.58
lit: 2.4.0
next: 13.0.1_biqbaboplfbrettd7655fr4n2y
prettier: 2.7.1
@@ -102,7 +99,6 @@ importers:
react: 18.2.0
react-dom: 18.2.0_react@18.2.0
react-i18next: 11.18.6_vfm63zmruocgezzfl2v26zlzpy
y-protocols: 1.0.5
devDependencies:
'@types/node': 18.7.18
'@types/react': 18.0.20
@@ -119,14 +115,18 @@ importers:
encoding: ^0.1.13
firebase: ^9.13.0
ky: ^0.33.0
lib0: ^0.2.58
swr: ^2.0.0
typescript: ^4.8.4
y-protocols: ^1.0.5
dependencies:
axios: 1.2.0
encoding: 0.1.13
firebase: 9.13.0_encoding@0.1.13
ky: 0.33.0
lib0: 0.2.58
swr: 2.0.0
y-protocols: 1.0.5
devDependencies:
typescript: 4.9.3