@liveblocks/node 1.0.0-beta1 → 1.0.0

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.
@@ -0,0 +1 @@
1
+ 1f156258b058e0cca490d9498920a7fa33fdb678
package/dist/index.d.ts CHANGED
@@ -132,10 +132,11 @@ declare type AuthorizeOptions = {
132
132
  */
133
133
  room: string;
134
134
  /**
135
- * The id of the user that try to connect. It should be used to get information about the connected users in the room (name, avatar, etc).
136
- * 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
135
+ * 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).
136
+ * 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.
137
+ * Liveblocks uses the userId to calculate your account's Monthly Active Users.
137
138
  */
138
- userId?: string;
139
+ userId: string;
139
140
  /**
140
141
  * 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
141
142
  */
@@ -160,7 +161,7 @@ declare type AuthorizeResponse = {
160
161
  * const response = await authorize({
161
162
  * room,
162
163
  * secret,
163
- * userId: "123", // Optional
164
+ * userId: "123",
164
165
  * userInfo: { // Optional
165
166
  * name: "Ada Lovelace"
166
167
  * },
package/dist/index.js CHANGED
@@ -114,6 +114,11 @@ function authorize(options) {
114
114
  "Invalid room. Please provide a non-empty string as the room. For more information: https://liveblocks.io/docs/api-reference/liveblocks-node#authorize"
115
115
  );
116
116
  }
117
+ if (!(typeof userId === "string" && userId.length > 0)) {
118
+ throw new Error(
119
+ "Invalid userId. Please provide a non-empty string as the userId. For more information: https://liveblocks.io/docs/api-reference/liveblocks-node#authorize"
120
+ );
121
+ }
117
122
  const result = yield _nodefetch2.default.call(void 0,
118
123
  buildLiveblocksAuthorizeEndpoint(options, room),
119
124
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/node",
3
- "version": "1.0.0-beta1",
3
+ "version": "1.0.0",
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",