@liveblocks/node 1.0.8 → 1.1.0-fsm1

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
@@ -2,25 +2,47 @@ import { IncomingHttpHeaders } from 'http';
2
2
 
3
3
  declare type AuthorizeOptions = {
4
4
  /**
5
- * The secret api provided at https://liveblocks.io/dashboard/apikeys
5
+ * The secret API key for your Liveblocks account. You can find it on
6
+ * https://liveblocks.io/dashboard/apikeys
6
7
  */
7
8
  secret: string;
8
9
  /**
9
- * The room provided in the authorization request body
10
+ * The room ID for which to authorize the user. This will authorize the user
11
+ * to enter the Liveblocks room.
10
12
  */
11
13
  room: string;
12
14
  /**
13
- * The id of the user that try to connect. It can be used to get information about the connected users in the room (name, avatar, etc).
14
- * It can also be used to generate a token that gives access to a private room where the userId is configured in the room accesses.
15
- * Liveblocks uses the userId to calculate your account's Monthly Active Users.
15
+ * Associates a user ID to the session that is being authorized. The user ID
16
+ * is typically set to the user ID from your own database.
17
+ *
18
+ * It can also be used to generate a token that gives access to a private
19
+ * room where the userId is configured in the room accesses.
20
+ *
21
+ * This user ID will be used as the unique identifier to compute your
22
+ * Liveblocks account's Monthly Active Users.
16
23
  */
17
24
  userId: string;
18
25
  /**
19
- * The info associated to the user. Can be used to store the name or the profile picture to implement avatar for example. Can't exceed 1KB when serialized as JSON
26
+ * Arbitrary metadata associated to this user session.
27
+ *
28
+ * You can use it to store a small amount of static metadata for a user
29
+ * session. It is public information, that will be visible to other users in
30
+ * the same room, like name, avatar URL, etc.
31
+ *
32
+ * It's only suitable for static info that won't change during a session. If
33
+ * you want to store dynamic metadata on a user session, don't keep that in
34
+ * the session token, but use Presence instead.
35
+ *
36
+ * Can't exceed 1KB when serialized as JSON.
20
37
  */
21
38
  userInfo?: unknown;
22
39
  /**
23
- * The ids of the groups to which the user belongs. It should be used to generate a token that gives access to a private room and at least one of the group is configured in the room accesses.
40
+ * Tell Liveblocks which group IDs this user belongs to. This will authorize
41
+ * the user session to access private rooms that have at least one of these
42
+ * group IDs listed in their room access configuration.
43
+ *
44
+ * See https://liveblocks.io/docs/guides/managing-rooms-users-permissions#permissions
45
+ * for how to configure your room's permissions to use this feature.
24
46
  */
25
47
  groupIds?: string[];
26
48
  };
@@ -30,6 +52,10 @@ declare type AuthorizeResponse = {
30
52
  error?: Error;
31
53
  };
32
54
  /**
55
+ * Tells Liveblocks that a user should be allowed access to a room, which user
56
+ * this session is for, and what metadata to associate with the user (like
57
+ * name, avatar, etc.)
58
+ *
33
59
  * @example
34
60
  * export default async function auth(req, res) {
35
61
  *
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ function authorize(options) {
62
62
  };
63
63
  } catch (er) {
64
64
  return {
65
- status: 403,
65
+ status: 503,
66
66
  body: 'Call to "https://api.liveblocks.io/v2/rooms/:roomId/authorize" failed. See "error" for more information.',
67
67
  error: er
68
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/node",
3
- "version": "1.0.8",
3
+ "version": "1.1.0-fsm1",
4
4
  "description": "A server-side utility that lets you set up a Liveblocks authentication endpoint. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",