fix(core): use uint53 as yjs client id (#7444)

This commit is contained in:
forehalo
2024-07-08 07:24:32 +00:00
parent ba356f4412
commit 7235779b02
9 changed files with 61 additions and 18 deletions
@@ -0,0 +1,39 @@
diff --git a/dist/yjs.cjs b/dist/yjs.cjs
index d2dc06ae11a6eb44f8c8445d4298c0e89c3e4da2..a30ab04fa9f3b77666939caa88335c68c40f194c 100644
--- a/dist/yjs.cjs
+++ b/dist/yjs.cjs
@@ -414,7 +414,7 @@ const equalDeleteSets = (ds1, ds2) => {
*/
-const generateNewClientId = random__namespace.uint32;
+const generateNewClientId = random__namespace.uint53;
/**
* @typedef {Object} DocOpts
diff --git a/dist/yjs.mjs b/dist/yjs.mjs
index 20c9e58c32bcb6bc714200a2561fd1f542c49523..14267e5e36d9781ca3810d5b70ff8c051dac779e 100644
--- a/dist/yjs.mjs
+++ b/dist/yjs.mjs
@@ -378,7 +378,7 @@ const equalDeleteSets = (ds1, ds2) => {
*/
-const generateNewClientId = random.uint32;
+const generateNewClientId = random.uint53;
/**
* @typedef {Object} DocOpts
diff --git a/src/utils/Doc.js b/src/utils/Doc.js
index 62643617c86e57c64dd9babdb792fa8888357ec0..4df5048ab12af1ae0f1154da67f06dce1fda7b49 100644
--- a/src/utils/Doc.js
+++ b/src/utils/Doc.js
@@ -20,7 +20,7 @@ import * as map from 'lib0/map'
import * as array from 'lib0/array'
import * as promise from 'lib0/promise'
-export const generateNewClientId = random.uint32
+export const generateNewClientId = random.uint53
/**
* @typedef {Object} DocOpts
+1 -1
View File
@@ -39,6 +39,6 @@
"nx-cloud": "^19.0.0",
"tiktoken": "^1.0.15",
"tinybench": "^2.8.0",
"yjs": "^13.6.14"
"yjs": "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch"
}
}
+1 -1
View File
@@ -95,7 +95,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"ws": "^8.16.0",
"yjs": "^13.6.14",
"yjs": "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch",
"zod": "^3.22.4"
},
"devDependencies": {
+1 -1
View File
@@ -27,7 +27,7 @@
"lodash-es": "^4.17.21",
"nanoid": "^5.0.7",
"react": "18.3.1",
"yjs": "^13.6.14",
"yjs": "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch",
"zod": "^3.22.4"
},
"devDependencies": {
+1 -2
View File
@@ -106,8 +106,7 @@
"storybook-dark-mode": "4.0.2",
"typescript": "^5.4.5",
"vite": "^5.2.8",
"vitest": "1.6.0",
"yjs": "^13.6.14"
"vitest": "1.6.0"
},
"version": "0.15.0"
}
+1 -1
View File
@@ -92,7 +92,7 @@
"uuid": "^10.0.0",
"valtio": "^1.13.2",
"y-protocols": "^1.0.6",
"yjs": "^13.6.14",
"yjs": "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch",
"zod": "^3.22.4"
},
"devDependencies": {
+1 -1
View File
@@ -80,7 +80,7 @@
"async-call-rpc": "^6.4.2",
"electron-updater": "^6.2.1",
"link-preview-js": "^3.0.5",
"yjs": "^13.6.14"
"yjs": "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch"
},
"build": {
"protocols": [
+1 -4
View File
@@ -1,4 +1,3 @@
import { createRequire } from 'node:module';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -24,8 +23,6 @@ const IN_CI = !!process.env.CI;
export const rootPath = join(fileURLToPath(import.meta.url), '..', '..');
export const workspaceRoot = join(rootPath, '..', '..', '..');
const require = createRequire(rootPath);
const OptimizeOptionOptions: (
buildFlags: BuildFlags
) => webpack.Configuration['optimization'] = buildFlags => ({
@@ -154,7 +151,7 @@ export const createConfiguration: (
events: false,
},
alias: {
yjs: require.resolve('yjs'),
yjs: join(workspaceRoot, 'node_modules', 'yjs'),
lit: join(workspaceRoot, 'node_modules', 'lit'),
'@blocksuite/block-std': blocksuiteBaseDir
? join(blocksuiteBaseDir, 'packages', 'framework', 'block-std', 'src')
+15 -7
View File
@@ -361,7 +361,6 @@ __metadata:
uuid: "npm:^10.0.0"
vite: "npm:^5.2.8"
vitest: "npm:1.6.0"
yjs: "npm:^13.6.14"
zod: "npm:^3.22.4"
peerDependencies:
"@blocksuite/blocks": "*"
@@ -473,7 +472,7 @@ __metadata:
valtio: "npm:^1.13.2"
vitest: "npm:1.6.0"
y-protocols: "npm:^1.0.6"
yjs: "npm:^13.6.14"
yjs: "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch"
zod: "npm:^3.22.4"
languageName: unknown
linkType: soft
@@ -565,7 +564,7 @@ __metadata:
uuid: "npm:^10.0.0"
vitest: "npm:1.6.0"
which: "npm:^4.0.0"
yjs: "npm:^13.6.14"
yjs: "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch"
zod: "npm:^3.22.4"
peerDependencies:
ts-node: "*"
@@ -718,7 +717,7 @@ __metadata:
nx-cloud: "npm:^19.0.0"
tiktoken: "npm:^1.0.15"
tinybench: "npm:^2.8.0"
yjs: "npm:^13.6.14"
yjs: "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch"
languageName: unknown
linkType: soft
@@ -826,7 +825,7 @@ __metadata:
ts-node: "npm:^10.9.2"
typescript: "npm:^5.4.5"
ws: "npm:^8.16.0"
yjs: "npm:^13.6.14"
yjs: "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch"
zod: "npm:^3.22.4"
bin:
run-test: ./scripts/run-test.ts
@@ -14753,7 +14752,7 @@ __metadata:
vite: "npm:^5.2.8"
vite-plugin-dts: "npm:3.9.1"
vitest: "npm:1.6.0"
yjs: "npm:^13.6.14"
yjs: "patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch"
zod: "npm:^3.22.4"
peerDependencies:
"@affine/templates": "*"
@@ -38799,7 +38798,7 @@ __metadata:
languageName: node
linkType: hard
"yjs@npm:^13.6.14":
"yjs@npm:13.6.18":
version: 13.6.18
resolution: "yjs@npm:13.6.18"
dependencies:
@@ -38808,6 +38807,15 @@ __metadata:
languageName: node
linkType: hard
"yjs@patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch":
version: 13.6.18
resolution: "yjs@patch:yjs@npm%3A13.6.18#~/.yarn/patches/yjs-npm-13.6.18-ad0d5f7c43.patch::version=13.6.18&hash=b51814"
dependencies:
lib0: "npm:^0.2.86"
checksum: 10/dda928b955501f6f7343d886c4ffdfff49bf728453510bc2c8125eadd3e6098f01c04dd009596521cedc6efc858b409670ce8e7868573bd5c8971b9065f030cd
languageName: node
linkType: hard
"yn@npm:3.1.1":
version: 3.1.1
resolution: "yn@npm:3.1.1"