@liveblocks/core 2.4.0 → 2.4.1-test2
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.mts +28 -2
- package/dist/index.d.ts +28 -2
- package/dist/index.js +50 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2119,6 +2119,11 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2119
2119
|
*/
|
|
2120
2120
|
markInboxNotificationAsRead(notificationId: string): Promise<void>;
|
|
2121
2121
|
} & CommentsApi<M>;
|
|
2122
|
+
declare type Provider = {
|
|
2123
|
+
synced: boolean;
|
|
2124
|
+
on(event: "sync", listener: (synced: boolean) => void): void;
|
|
2125
|
+
off(event: "sync", listener: (synced: boolean) => void): void;
|
|
2126
|
+
};
|
|
2122
2127
|
/**
|
|
2123
2128
|
* @private
|
|
2124
2129
|
*
|
|
@@ -2131,6 +2136,9 @@ declare type PrivateRoomApi = {
|
|
|
2131
2136
|
presenceBuffer: Json | undefined;
|
|
2132
2137
|
undoStack: readonly (readonly Readonly<HistoryOp<JsonObject>>[])[];
|
|
2133
2138
|
nodeCount: number;
|
|
2139
|
+
getProvider(): Provider | undefined;
|
|
2140
|
+
setProvider(provider: Provider | undefined): void;
|
|
2141
|
+
onProviderUpdate: Observable<void>;
|
|
2134
2142
|
getSelf_forDevTools(): UserTreeNode | null;
|
|
2135
2143
|
getOthers_forDevTools(): readonly UserTreeNode[];
|
|
2136
2144
|
reportTextEditor(editor: "lexical", rootKey: string): void;
|
|
@@ -2409,13 +2417,31 @@ declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS>
|
|
|
2409
2417
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2410
2418
|
* will probably happen if you do.
|
|
2411
2419
|
*/
|
|
2412
|
-
declare type PrivateClientApi<U extends BaseUserMeta> = {
|
|
2420
|
+
declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
2413
2421
|
readonly currentUserIdStore: Store<string | null>;
|
|
2414
2422
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
2415
2423
|
readonly cacheStore: CacheStore<BaseMetadata>;
|
|
2416
2424
|
readonly usersStore: BatchStore<U["info"] | undefined, string>;
|
|
2417
2425
|
readonly roomsInfoStore: BatchStore<DRI | undefined, string>;
|
|
2418
2426
|
readonly getRoomIds: () => string[];
|
|
2427
|
+
readonly getThreads: () => Promise<{
|
|
2428
|
+
threads: ThreadData<M>[];
|
|
2429
|
+
inboxNotifications: InboxNotificationData[];
|
|
2430
|
+
requestedAt: Date;
|
|
2431
|
+
}>;
|
|
2432
|
+
readonly getThreadsSince: (options: {
|
|
2433
|
+
since: Date;
|
|
2434
|
+
}) => Promise<{
|
|
2435
|
+
inboxNotifications: {
|
|
2436
|
+
updated: InboxNotificationData[];
|
|
2437
|
+
deleted: InboxNotificationDeleteInfo[];
|
|
2438
|
+
};
|
|
2439
|
+
threads: {
|
|
2440
|
+
updated: ThreadData<M>[];
|
|
2441
|
+
deleted: ThreadDeleteInfo[];
|
|
2442
|
+
};
|
|
2443
|
+
requestedAt: Date;
|
|
2444
|
+
}>;
|
|
2419
2445
|
};
|
|
2420
2446
|
declare type NotificationsApi<M extends BaseMetadata> = {
|
|
2421
2447
|
/**
|
|
@@ -2531,7 +2557,7 @@ declare type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> =
|
|
|
2531
2557
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2532
2558
|
* will probably happen if you do.
|
|
2533
2559
|
*/
|
|
2534
|
-
readonly [kInternal]: PrivateClientApi<U>;
|
|
2560
|
+
readonly [kInternal]: PrivateClientApi<U, M>;
|
|
2535
2561
|
} & NotificationsApi<M>;
|
|
2536
2562
|
declare type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
|
|
2537
2563
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2119,6 +2119,11 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2119
2119
|
*/
|
|
2120
2120
|
markInboxNotificationAsRead(notificationId: string): Promise<void>;
|
|
2121
2121
|
} & CommentsApi<M>;
|
|
2122
|
+
declare type Provider = {
|
|
2123
|
+
synced: boolean;
|
|
2124
|
+
on(event: "sync", listener: (synced: boolean) => void): void;
|
|
2125
|
+
off(event: "sync", listener: (synced: boolean) => void): void;
|
|
2126
|
+
};
|
|
2122
2127
|
/**
|
|
2123
2128
|
* @private
|
|
2124
2129
|
*
|
|
@@ -2131,6 +2136,9 @@ declare type PrivateRoomApi = {
|
|
|
2131
2136
|
presenceBuffer: Json | undefined;
|
|
2132
2137
|
undoStack: readonly (readonly Readonly<HistoryOp<JsonObject>>[])[];
|
|
2133
2138
|
nodeCount: number;
|
|
2139
|
+
getProvider(): Provider | undefined;
|
|
2140
|
+
setProvider(provider: Provider | undefined): void;
|
|
2141
|
+
onProviderUpdate: Observable<void>;
|
|
2134
2142
|
getSelf_forDevTools(): UserTreeNode | null;
|
|
2135
2143
|
getOthers_forDevTools(): readonly UserTreeNode[];
|
|
2136
2144
|
reportTextEditor(editor: "lexical", rootKey: string): void;
|
|
@@ -2409,13 +2417,31 @@ declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS>
|
|
|
2409
2417
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2410
2418
|
* will probably happen if you do.
|
|
2411
2419
|
*/
|
|
2412
|
-
declare type PrivateClientApi<U extends BaseUserMeta> = {
|
|
2420
|
+
declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
2413
2421
|
readonly currentUserIdStore: Store<string | null>;
|
|
2414
2422
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
2415
2423
|
readonly cacheStore: CacheStore<BaseMetadata>;
|
|
2416
2424
|
readonly usersStore: BatchStore<U["info"] | undefined, string>;
|
|
2417
2425
|
readonly roomsInfoStore: BatchStore<DRI | undefined, string>;
|
|
2418
2426
|
readonly getRoomIds: () => string[];
|
|
2427
|
+
readonly getThreads: () => Promise<{
|
|
2428
|
+
threads: ThreadData<M>[];
|
|
2429
|
+
inboxNotifications: InboxNotificationData[];
|
|
2430
|
+
requestedAt: Date;
|
|
2431
|
+
}>;
|
|
2432
|
+
readonly getThreadsSince: (options: {
|
|
2433
|
+
since: Date;
|
|
2434
|
+
}) => Promise<{
|
|
2435
|
+
inboxNotifications: {
|
|
2436
|
+
updated: InboxNotificationData[];
|
|
2437
|
+
deleted: InboxNotificationDeleteInfo[];
|
|
2438
|
+
};
|
|
2439
|
+
threads: {
|
|
2440
|
+
updated: ThreadData<M>[];
|
|
2441
|
+
deleted: ThreadDeleteInfo[];
|
|
2442
|
+
};
|
|
2443
|
+
requestedAt: Date;
|
|
2444
|
+
}>;
|
|
2419
2445
|
};
|
|
2420
2446
|
declare type NotificationsApi<M extends BaseMetadata> = {
|
|
2421
2447
|
/**
|
|
@@ -2531,7 +2557,7 @@ declare type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> =
|
|
|
2531
2557
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2532
2558
|
* will probably happen if you do.
|
|
2533
2559
|
*/
|
|
2534
|
-
readonly [kInternal]: PrivateClientApi<U>;
|
|
2560
|
+
readonly [kInternal]: PrivateClientApi<U, M>;
|
|
2535
2561
|
} & NotificationsApi<M>;
|
|
2536
2562
|
declare type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
|
|
2537
2563
|
/**
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "2.4.
|
|
9
|
+
var PKG_VERSION = "2.4.1-test2";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -2152,6 +2152,34 @@ function createNotificationsApi({
|
|
|
2152
2152
|
}
|
|
2153
2153
|
);
|
|
2154
2154
|
}
|
|
2155
|
+
async function getThreads() {
|
|
2156
|
+
const json = await fetchJson("/threads", void 0, {});
|
|
2157
|
+
return {
|
|
2158
|
+
threads: json.threads.map(convertToThreadData),
|
|
2159
|
+
inboxNotifications: json.inboxNotifications.map(
|
|
2160
|
+
convertToInboxNotificationData
|
|
2161
|
+
),
|
|
2162
|
+
requestedAt: new Date(json.meta.requestedAt)
|
|
2163
|
+
};
|
|
2164
|
+
}
|
|
2165
|
+
async function getThreadsSince(options) {
|
|
2166
|
+
const json = await fetchJson("/threads", void 0, {
|
|
2167
|
+
since: options.since.toISOString()
|
|
2168
|
+
});
|
|
2169
|
+
return {
|
|
2170
|
+
threads: {
|
|
2171
|
+
updated: json.threads.map(convertToThreadData),
|
|
2172
|
+
deleted: json.deletedThreads.map(convertToThreadDeleteInfo)
|
|
2173
|
+
},
|
|
2174
|
+
inboxNotifications: {
|
|
2175
|
+
updated: json.inboxNotifications.map(convertToInboxNotificationData),
|
|
2176
|
+
deleted: json.deletedInboxNotifications.map(
|
|
2177
|
+
convertToInboxNotificationDeleteInfo
|
|
2178
|
+
)
|
|
2179
|
+
},
|
|
2180
|
+
requestedAt: new Date(json.meta.requestedAt)
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2155
2183
|
return {
|
|
2156
2184
|
getInboxNotifications,
|
|
2157
2185
|
getInboxNotificationsSince,
|
|
@@ -2159,7 +2187,9 @@ function createNotificationsApi({
|
|
|
2159
2187
|
markAllInboxNotificationsAsRead,
|
|
2160
2188
|
markInboxNotificationAsRead,
|
|
2161
2189
|
deleteAllInboxNotifications,
|
|
2162
|
-
deleteInboxNotification
|
|
2190
|
+
deleteInboxNotification,
|
|
2191
|
+
getThreads,
|
|
2192
|
+
getThreadsSince
|
|
2163
2193
|
};
|
|
2164
2194
|
}
|
|
2165
2195
|
|
|
@@ -5476,6 +5506,9 @@ function createRoom(options, config) {
|
|
|
5476
5506
|
others: new OthersRef(),
|
|
5477
5507
|
initialStorage,
|
|
5478
5508
|
idFactory: null,
|
|
5509
|
+
// Y.js
|
|
5510
|
+
provider: void 0,
|
|
5511
|
+
onProviderUpdate: makeEventSource(),
|
|
5479
5512
|
// Storage
|
|
5480
5513
|
clock: 0,
|
|
5481
5514
|
opClock: 0,
|
|
@@ -6651,6 +6684,14 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6651
6684
|
return context.nodes.size;
|
|
6652
6685
|
},
|
|
6653
6686
|
// prettier-ignore
|
|
6687
|
+
getProvider() {
|
|
6688
|
+
return context.provider;
|
|
6689
|
+
},
|
|
6690
|
+
setProvider(provider) {
|
|
6691
|
+
context.provider = provider;
|
|
6692
|
+
context.onProviderUpdate.notify();
|
|
6693
|
+
},
|
|
6694
|
+
onProviderUpdate: context.onProviderUpdate.observable,
|
|
6654
6695
|
// send metadata when using a text editor
|
|
6655
6696
|
reportTextEditor,
|
|
6656
6697
|
// create a text mention when using a text editor
|
|
@@ -7484,7 +7525,9 @@ function createClient(options) {
|
|
|
7484
7525
|
markAllInboxNotificationsAsRead,
|
|
7485
7526
|
markInboxNotificationAsRead,
|
|
7486
7527
|
deleteAllInboxNotifications,
|
|
7487
|
-
deleteInboxNotification
|
|
7528
|
+
deleteInboxNotification,
|
|
7529
|
+
getThreads,
|
|
7530
|
+
getThreadsSince
|
|
7488
7531
|
} = createNotificationsApi({
|
|
7489
7532
|
baseUrl,
|
|
7490
7533
|
fetcher: _optionalChain([clientOptions, 'access', _167 => _167.polyfills, 'optionalAccess', _168 => _168.fetch]) || /* istanbul ignore next */
|
|
@@ -7533,6 +7576,7 @@ function createClient(options) {
|
|
|
7533
7576
|
markInboxNotificationAsRead,
|
|
7534
7577
|
deleteAllInboxNotifications,
|
|
7535
7578
|
deleteInboxNotification,
|
|
7579
|
+
getThreads,
|
|
7536
7580
|
// Internal
|
|
7537
7581
|
[kInternal]: {
|
|
7538
7582
|
currentUserIdStore,
|
|
@@ -7542,7 +7586,9 @@ function createClient(options) {
|
|
|
7542
7586
|
roomsInfoStore,
|
|
7543
7587
|
getRoomIds() {
|
|
7544
7588
|
return Array.from(roomsById.keys());
|
|
7545
|
-
}
|
|
7589
|
+
},
|
|
7590
|
+
getThreads,
|
|
7591
|
+
getThreadsSince
|
|
7546
7592
|
}
|
|
7547
7593
|
},
|
|
7548
7594
|
kInternal,
|