@liveblocks/node 3.20.0-perm5 → 3.20.0-perm7
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.cjs +8 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -11
- package/dist/index.d.ts +10 -11
- package/dist/index.js +12 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveObject, LiveStructure, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs,
|
|
1
|
+
import { Permission, Json, DFMD, FeedCreateMetadata, RoomPermissions, RoomAccesses, OptionalTupleUnless, BaseUserMeta, DU, PartialUnless, UpdateRoomAccesses, DE, JsonObject, PlainLsonObject, ToJson, DS, QueryMetadata, DTM, ThreadData, DCM, UserSubscriptionData, CommentData, BaseMetadata, CommentBody, Patchable, SubscriptionData, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, LiveObject, Awaitable, DFM, Feed, FeedUpdateMetadata, FeedMessage, NotificationChannel } from '@liveblocks/core';
|
|
2
|
+
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveObject, LiveStructure, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -31,7 +31,7 @@ declare class Session {
|
|
|
31
31
|
#private;
|
|
32
32
|
readonly FULL_ACCESS: readonly ["*:write"];
|
|
33
33
|
readonly READ_ACCESS: readonly ["*:read"];
|
|
34
|
-
allow(roomIdOrPattern: string, newPerms:
|
|
34
|
+
allow(roomIdOrPattern: string, newPerms: readonly Permission[]): this;
|
|
35
35
|
/**
|
|
36
36
|
* Call this to authorize the session to access Liveblocks. Note that this
|
|
37
37
|
* will return a Liveblocks "access token". Anyone that obtains such access
|
|
@@ -118,7 +118,6 @@ type CreateCommentOptions<CM extends BaseMetadata> = {
|
|
|
118
118
|
metadata: CM;
|
|
119
119
|
}>;
|
|
120
120
|
};
|
|
121
|
-
|
|
122
121
|
type RoomMetadata = Record<string, string | string[]>;
|
|
123
122
|
type QueryRoomMetadata = Record<string, string>;
|
|
124
123
|
type RoomData = {
|
|
@@ -127,7 +126,7 @@ type RoomData = {
|
|
|
127
126
|
createdAt: Date;
|
|
128
127
|
lastConnectionAt?: Date;
|
|
129
128
|
organizationId: string;
|
|
130
|
-
defaultAccesses:
|
|
129
|
+
defaultAccesses: RoomPermissions;
|
|
131
130
|
usersAccesses: RoomAccesses;
|
|
132
131
|
groupsAccesses: RoomAccesses;
|
|
133
132
|
metadata: RoomMetadata;
|
|
@@ -305,9 +304,9 @@ type Page<T> = {
|
|
|
305
304
|
type GetRoomsOptions = RoomsQueryCriteria & PaginationOptions;
|
|
306
305
|
type GetInboxNotificationsOptions = InboxNotificationsQueryCriteria & PaginationOptions;
|
|
307
306
|
type CreateRoomOptions = {
|
|
308
|
-
defaultAccesses:
|
|
309
|
-
groupsAccesses?:
|
|
310
|
-
usersAccesses?:
|
|
307
|
+
defaultAccesses: RoomPermissions;
|
|
308
|
+
groupsAccesses?: RoomAccesses;
|
|
309
|
+
usersAccesses?: RoomAccesses;
|
|
311
310
|
metadata?: RoomMetadata;
|
|
312
311
|
/**
|
|
313
312
|
* @deprecated Use `organizationId` instead.
|
|
@@ -321,9 +320,9 @@ type CreateRoomOptions = {
|
|
|
321
320
|
engine?: 1 | 2;
|
|
322
321
|
};
|
|
323
322
|
type UpdateRoomOptions = {
|
|
324
|
-
defaultAccesses?:
|
|
325
|
-
groupsAccesses?:
|
|
326
|
-
usersAccesses?:
|
|
323
|
+
defaultAccesses?: RoomPermissions | null;
|
|
324
|
+
groupsAccesses?: UpdateRoomAccesses;
|
|
325
|
+
usersAccesses?: UpdateRoomAccesses;
|
|
327
326
|
metadata?: Record<string, string | string[] | null>;
|
|
328
327
|
};
|
|
329
328
|
type UpsertRoomOptions = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveObject, LiveStructure, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs,
|
|
1
|
+
import { Permission, Json, DFMD, FeedCreateMetadata, RoomPermissions, RoomAccesses, OptionalTupleUnless, BaseUserMeta, DU, PartialUnless, UpdateRoomAccesses, DE, JsonObject, PlainLsonObject, ToJson, DS, QueryMetadata, DTM, ThreadData, DCM, UserSubscriptionData, CommentData, BaseMetadata, CommentBody, Patchable, SubscriptionData, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, LiveObject, Awaitable, DFM, Feed, FeedUpdateMetadata, FeedMessage, NotificationChannel } from '@liveblocks/core';
|
|
2
|
+
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveObject, LiveStructure, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -31,7 +31,7 @@ declare class Session {
|
|
|
31
31
|
#private;
|
|
32
32
|
readonly FULL_ACCESS: readonly ["*:write"];
|
|
33
33
|
readonly READ_ACCESS: readonly ["*:read"];
|
|
34
|
-
allow(roomIdOrPattern: string, newPerms:
|
|
34
|
+
allow(roomIdOrPattern: string, newPerms: readonly Permission[]): this;
|
|
35
35
|
/**
|
|
36
36
|
* Call this to authorize the session to access Liveblocks. Note that this
|
|
37
37
|
* will return a Liveblocks "access token". Anyone that obtains such access
|
|
@@ -118,7 +118,6 @@ type CreateCommentOptions<CM extends BaseMetadata> = {
|
|
|
118
118
|
metadata: CM;
|
|
119
119
|
}>;
|
|
120
120
|
};
|
|
121
|
-
|
|
122
121
|
type RoomMetadata = Record<string, string | string[]>;
|
|
123
122
|
type QueryRoomMetadata = Record<string, string>;
|
|
124
123
|
type RoomData = {
|
|
@@ -127,7 +126,7 @@ type RoomData = {
|
|
|
127
126
|
createdAt: Date;
|
|
128
127
|
lastConnectionAt?: Date;
|
|
129
128
|
organizationId: string;
|
|
130
|
-
defaultAccesses:
|
|
129
|
+
defaultAccesses: RoomPermissions;
|
|
131
130
|
usersAccesses: RoomAccesses;
|
|
132
131
|
groupsAccesses: RoomAccesses;
|
|
133
132
|
metadata: RoomMetadata;
|
|
@@ -305,9 +304,9 @@ type Page<T> = {
|
|
|
305
304
|
type GetRoomsOptions = RoomsQueryCriteria & PaginationOptions;
|
|
306
305
|
type GetInboxNotificationsOptions = InboxNotificationsQueryCriteria & PaginationOptions;
|
|
307
306
|
type CreateRoomOptions = {
|
|
308
|
-
defaultAccesses:
|
|
309
|
-
groupsAccesses?:
|
|
310
|
-
usersAccesses?:
|
|
307
|
+
defaultAccesses: RoomPermissions;
|
|
308
|
+
groupsAccesses?: RoomAccesses;
|
|
309
|
+
usersAccesses?: RoomAccesses;
|
|
311
310
|
metadata?: RoomMetadata;
|
|
312
311
|
/**
|
|
313
312
|
* @deprecated Use `organizationId` instead.
|
|
@@ -321,9 +320,9 @@ type CreateRoomOptions = {
|
|
|
321
320
|
engine?: 1 | 2;
|
|
322
321
|
};
|
|
323
322
|
type UpdateRoomOptions = {
|
|
324
|
-
defaultAccesses?:
|
|
325
|
-
groupsAccesses?:
|
|
326
|
-
usersAccesses?:
|
|
323
|
+
defaultAccesses?: RoomPermissions | null;
|
|
324
|
+
groupsAccesses?: UpdateRoomAccesses;
|
|
325
|
+
usersAccesses?: UpdateRoomAccesses;
|
|
327
326
|
metadata?: Record<string, string | string[] | null>;
|
|
328
327
|
};
|
|
329
328
|
type UpsertRoomOptions = {
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { detectDupes } from "@liveblocks/core";
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/node";
|
|
6
|
-
var PKG_VERSION = "3.20.0-
|
|
6
|
+
var PKG_VERSION = "3.20.0-perm7";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
isPlainObject,
|
|
23
23
|
LiveObject,
|
|
24
24
|
makeAbortController,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
normalizeRoomAccesses,
|
|
26
|
+
normalizeRoomPermissions as normalizeRoomPermissions2,
|
|
27
|
+
normalizeUpdateRoomAccesses,
|
|
28
28
|
objectToQuery,
|
|
29
29
|
tryParseJson,
|
|
30
30
|
url as url2,
|
|
@@ -109,11 +109,7 @@ function xwarn(resp, method, path) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// src/Session.ts
|
|
112
|
-
import {
|
|
113
|
-
normalizeRoomPermissionInput,
|
|
114
|
-
Permission,
|
|
115
|
-
url
|
|
116
|
-
} from "@liveblocks/core";
|
|
112
|
+
import { normalizeRoomPermissions, Permission, url } from "@liveblocks/core";
|
|
117
113
|
|
|
118
114
|
// src/utils.ts
|
|
119
115
|
var DEFAULT_BASE_URL = "https://api.liveblocks.io";
|
|
@@ -216,7 +212,7 @@ var Session = class {
|
|
|
216
212
|
if (!roomPatternRegex.test(roomIdOrPattern)) {
|
|
217
213
|
throw new Error("Invalid room name or pattern");
|
|
218
214
|
}
|
|
219
|
-
const normalizedPermissions =
|
|
215
|
+
const normalizedPermissions = normalizeRoomPermissions(newPerms);
|
|
220
216
|
if (normalizedPermissions.length === 0) {
|
|
221
217
|
throw new Error("Permission list cannot be empty");
|
|
222
218
|
}
|
|
@@ -299,17 +295,17 @@ function inflateRoomData(room) {
|
|
|
299
295
|
function normalizeCreateRoomOptions(options) {
|
|
300
296
|
return {
|
|
301
297
|
...options,
|
|
302
|
-
defaultAccesses:
|
|
303
|
-
groupsAccesses:
|
|
304
|
-
usersAccesses:
|
|
298
|
+
defaultAccesses: normalizeRoomPermissions2(options.defaultAccesses),
|
|
299
|
+
groupsAccesses: normalizeRoomAccesses(options.groupsAccesses),
|
|
300
|
+
usersAccesses: normalizeRoomAccesses(options.usersAccesses)
|
|
305
301
|
};
|
|
306
302
|
}
|
|
307
303
|
function normalizeUpdateRoomOptions(options) {
|
|
308
304
|
return {
|
|
309
305
|
...options,
|
|
310
|
-
defaultAccesses: options.defaultAccesses === void 0 || options.defaultAccesses === null ? options.defaultAccesses :
|
|
311
|
-
groupsAccesses:
|
|
312
|
-
usersAccesses:
|
|
306
|
+
defaultAccesses: options.defaultAccesses === void 0 || options.defaultAccesses === null ? options.defaultAccesses : normalizeRoomPermissions2(options.defaultAccesses),
|
|
307
|
+
groupsAccesses: normalizeUpdateRoomAccesses(options.groupsAccesses),
|
|
308
|
+
usersAccesses: normalizeUpdateRoomAccesses(options.usersAccesses)
|
|
313
309
|
};
|
|
314
310
|
}
|
|
315
311
|
function inflateAiCopilot(copilot) {
|