@liveblocks/core 0.18.4 → 0.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -357,6 +357,9 @@ declare class LiveList<TItem extends Lson> extends AbstractCrdt {
357
357
  toImmutable(): readonly ToImmutable<TItem>[];
358
358
  }
359
359
 
360
+ /**
361
+ * This type is used by clients to define the metadata for a user.
362
+ */
360
363
  declare type BaseUserMeta = {
361
364
  /**
362
365
  * The id of the user that has been set in the authentication endpoint.
@@ -367,10 +370,6 @@ declare type BaseUserMeta = {
367
370
  * Additional user information that has been set in the authentication endpoint.
368
371
  */
369
372
  info?: Json;
370
- /**
371
- * Permissions that the user has in the room.
372
- */
373
- scopes: string[];
374
373
  };
375
374
 
376
375
  declare enum OpCode {
@@ -680,7 +679,9 @@ declare type BroadcastedEventServerMsg<TRoomEvent extends Json> = {
680
679
  declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
681
680
  type: ServerMsgCode.ROOM_STATE;
682
681
  users: {
683
- [actor: number]: TUserMeta;
682
+ [actor: number]: TUserMeta & {
683
+ scopes: string[];
684
+ };
684
685
  };
685
686
  };
686
687
  /**
package/dist/index.js CHANGED
@@ -3091,7 +3091,7 @@ function makeStateMachine(state, config, mockedEffects) {
3091
3091
  });
3092
3092
  }
3093
3093
  }
3094
- function isReadOnly(scopes) {
3094
+ function isStorageReadOnly(scopes) {
3095
3095
  return scopes.includes("room:read" /* Read */) && scopes.includes("room:presence:write" /* PresenceWrite */) && !scopes.includes("room:write" /* Write */);
3096
3096
  }
3097
3097
  function authenticationSuccess(token, socket) {
@@ -3105,7 +3105,7 @@ function makeStateMachine(state, config, mockedEffects) {
3105
3105
  id: token.actor,
3106
3106
  userInfo: token.info,
3107
3107
  userId: token.id,
3108
- isReadOnly: isReadOnly(token.scopes)
3108
+ isReadOnly: isStorageReadOnly(token.scopes)
3109
3109
  },
3110
3110
  batchUpdates
3111
3111
  );
@@ -3165,7 +3165,7 @@ function makeStateMachine(state, config, mockedEffects) {
3165
3165
  connectionId,
3166
3166
  user.id,
3167
3167
  user.info,
3168
- isReadOnly(user.scopes)
3168
+ isStorageReadOnly(user.scopes)
3169
3169
  );
3170
3170
  }
3171
3171
  return { type: "reset" };
@@ -3186,7 +3186,7 @@ function makeStateMachine(state, config, mockedEffects) {
3186
3186
  message.actor,
3187
3187
  message.id,
3188
3188
  message.info,
3189
- isReadOnly(message.scopes)
3189
+ isStorageReadOnly(message.scopes)
3190
3190
  );
3191
3191
  state.buffer.messages.push({
3192
3192
  type: 100 /* UPDATE_PRESENCE */,
@@ -3793,7 +3793,7 @@ function prepareCreateWebSocket(liveblocksServer, WebSocketPolyfill) {
3793
3793
  const ws = WebSocketPolyfill || WebSocket;
3794
3794
  return (token) => {
3795
3795
  return new ws(
3796
- `${liveblocksServer}/?token=${token}&version=${true ? "0.18.4" : "dev"}`
3796
+ `${liveblocksServer}/?token=${token}&version=${true ? "0.18.5" : "dev"}`
3797
3797
  );
3798
3798
  };
3799
3799
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/core",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "description": "Shared code and foundational internals for Liveblocks",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -19,35 +19,23 @@
19
19
  "url": "https://github.com/liveblocks/liveblocks/issues"
20
20
  },
21
21
  "scripts": {
22
+ "dev": "tsup --watch --onSuccess ../../scripts/build.sh",
22
23
  "build": "tsup && ../../scripts/build.sh",
23
24
  "format": "eslint --fix src/ && prettier --write src/",
24
25
  "lint": "eslint src/",
25
- "test": "jest --watch --silent --verbose --config=./jest.config.js",
26
- "test-ci": "jest --silent --verbose",
26
+ "test": "jest --silent --verbose",
27
+ "test:watch": "jest --silent --verbose --watch",
27
28
  "test-e2e": "jest --silent --verbose --config=./jest.config.e2e.js"
28
29
  },
29
30
  "license": "Apache-2.0",
30
31
  "devDependencies": {
31
- "@types/jest": "^29.1.2",
32
- "@types/node-fetch": "^2.6.1",
32
+ "@liveblocks/eslint-config": "*",
33
+ "@liveblocks/jest-config": "*",
33
34
  "@types/ws": "^8.5.3",
34
- "@typescript-eslint/eslint-plugin": "^5.26.0",
35
- "@typescript-eslint/parser": "^5.26.0",
36
35
  "dotenv": "^16.0.3",
37
- "eslint": "^8.12.0",
38
- "eslint-plugin-import": "^2.26.0",
39
36
  "eslint-plugin-rulesdir": "^0.2.1",
40
- "eslint-plugin-simple-import-sort": "^7.0.0",
41
37
  "fast-check": "^3.0.1",
42
- "jest": "^29.1.2",
43
- "jest-environment-jsdom": "^29.1.2",
44
- "msw": "^0.39.1",
45
- "node-fetch": "2.6.7",
46
- "prettier": "^2.7.1",
47
- "ts-jest": "^29.0.3",
48
- "tsup": "^6.2.2",
49
- "typescript": "^4.7.2",
50
- "whatwg-fetch": "^3.6.2",
38
+ "msw": "^0.47.4",
51
39
  "ws": "^8.5.0"
52
40
  },
53
41
  "repository": {