@liveblocks/core 2.13.3-emails2 → 2.14.0-lexical1
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 +102 -29
- package/dist/index.d.ts +102 -29
- package/dist/index.js +908 -744
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +858 -694
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -104,21 +104,22 @@ declare type EventSource<T> = Observable<T> & {
|
|
|
104
104
|
* Returns the number of active subscribers.
|
|
105
105
|
*/
|
|
106
106
|
count(): number;
|
|
107
|
-
/**
|
|
108
|
-
* Pauses event delivery until unpaused. Any .notify() calls made while
|
|
109
|
-
* paused will get buffered into memory and emitted later.
|
|
110
|
-
*/
|
|
111
|
-
pause(): void;
|
|
112
|
-
/**
|
|
113
|
-
* Emits all in-memory buffered events, and unpauses. Any .notify() calls
|
|
114
|
-
* made after this will be synchronously delivered again.
|
|
115
|
-
*/
|
|
116
|
-
unpause(): void;
|
|
117
107
|
/**
|
|
118
108
|
* Observable instance, which can be used to subscribe to this event source
|
|
119
109
|
* in a readonly fashion. Safe to publicly expose.
|
|
120
110
|
*/
|
|
121
111
|
observable: Observable<T>;
|
|
112
|
+
/**
|
|
113
|
+
* Disposes of this event source.
|
|
114
|
+
*
|
|
115
|
+
* Will clears all registered event listeners. None of the registered
|
|
116
|
+
* functions will ever get called again.
|
|
117
|
+
*
|
|
118
|
+
* WARNING!
|
|
119
|
+
* Be careful when using this API, because the subscribers may not have any
|
|
120
|
+
* idea they won't be notified anymore.
|
|
121
|
+
*/
|
|
122
|
+
[Symbol.dispose](): void;
|
|
122
123
|
};
|
|
123
124
|
/**
|
|
124
125
|
* makeEventSource allows you to generate a subscribe/notify pair of functions
|
|
@@ -473,6 +474,7 @@ declare type LiveMapUpdates<TKey extends string, TValue extends Lson> = {
|
|
|
473
474
|
* If multiple clients update the same property simultaneously, the last modification received by the Liveblocks servers is the winner.
|
|
474
475
|
*/
|
|
475
476
|
declare class LiveMap<TKey extends string, TValue extends Lson> extends AbstractCrdt {
|
|
477
|
+
#private;
|
|
476
478
|
constructor(entries?: readonly (readonly [TKey, TValue])[] | undefined);
|
|
477
479
|
/**
|
|
478
480
|
* Returns a specified element from the LiveMap.
|
|
@@ -538,6 +540,7 @@ declare type LiveListUpdate = LiveListUpdates<Lson>;
|
|
|
538
540
|
declare type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate;
|
|
539
541
|
|
|
540
542
|
declare abstract class AbstractCrdt {
|
|
543
|
+
#private;
|
|
541
544
|
get roomId(): string | null;
|
|
542
545
|
/**
|
|
543
546
|
* Return an immutable snapshot of this Live node and its children.
|
|
@@ -581,6 +584,7 @@ declare type LiveListUpdates<TItem extends Lson> = {
|
|
|
581
584
|
* The LiveList class represents an ordered collection of items that is synchronized across clients.
|
|
582
585
|
*/
|
|
583
586
|
declare class LiveList<TItem extends Lson> extends AbstractCrdt {
|
|
587
|
+
#private;
|
|
584
588
|
constructor(items: TItem[]);
|
|
585
589
|
/**
|
|
586
590
|
* Returns the number of elements.
|
|
@@ -684,6 +688,7 @@ declare class LiveList<TItem extends Lson> extends AbstractCrdt {
|
|
|
684
688
|
* INTERNAL
|
|
685
689
|
*/
|
|
686
690
|
declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
|
|
691
|
+
#private;
|
|
687
692
|
constructor(data: TValue);
|
|
688
693
|
get data(): TValue;
|
|
689
694
|
clone(): TValue;
|
|
@@ -750,6 +755,7 @@ declare type LiveObjectUpdates<TData extends LsonObject> = {
|
|
|
750
755
|
* If multiple clients update the same property simultaneously, the last modification received by the Liveblocks servers is the winner.
|
|
751
756
|
*/
|
|
752
757
|
declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
|
|
758
|
+
#private;
|
|
753
759
|
constructor(obj?: O);
|
|
754
760
|
/**
|
|
755
761
|
* Transform the LiveObject into a javascript object
|
|
@@ -2578,24 +2584,93 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
2578
2584
|
}
|
|
2579
2585
|
|
|
2580
2586
|
/**
|
|
2581
|
-
*
|
|
2587
|
+
* Back-port of TypeScript 5.4's built-in NoInfer utility type.
|
|
2588
|
+
* See https://stackoverflow.com/a/56688073/148872
|
|
2582
2589
|
*/
|
|
2583
|
-
declare type
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
subscribe: (callback: () => void) => () => void;
|
|
2587
|
-
batch: (callback: () => void) => void;
|
|
2588
|
-
};
|
|
2590
|
+
declare type NoInfr<A> = [A][A extends any ? 0 : never];
|
|
2591
|
+
|
|
2592
|
+
declare const kTrigger: unique symbol;
|
|
2589
2593
|
/**
|
|
2590
|
-
*
|
|
2594
|
+
* Runs a callback function that is allowed to change multiple signals. At the
|
|
2595
|
+
* end of the batch, all changed signals will be notified (at most once).
|
|
2596
|
+
*
|
|
2597
|
+
* Nesting batches is supported.
|
|
2591
2598
|
*/
|
|
2592
|
-
declare function
|
|
2593
|
-
|
|
2599
|
+
declare function batch(callback: Callback<void>): void;
|
|
2600
|
+
declare type SignalType<S extends ISignal<any>> = S extends ISignal<infer T> ? T : never;
|
|
2601
|
+
interface ISignal<T> {
|
|
2602
|
+
get(): T;
|
|
2603
|
+
subscribe(callback: Callback<void>): UnsubscribeCallback;
|
|
2604
|
+
addSink(sink: DerivedSignal<unknown>): void;
|
|
2605
|
+
removeSink(sink: DerivedSignal<unknown>): void;
|
|
2606
|
+
}
|
|
2594
2607
|
/**
|
|
2595
|
-
*
|
|
2596
|
-
|
|
2608
|
+
* Base functionality every Signal implementation needs.
|
|
2609
|
+
*/
|
|
2610
|
+
declare abstract class AbstractSignal<T> implements ISignal<T>, Observable<void> {
|
|
2611
|
+
#private;
|
|
2612
|
+
constructor(equals?: (a: T, b: T) => boolean);
|
|
2613
|
+
[Symbol.dispose](): void;
|
|
2614
|
+
abstract get(): T;
|
|
2615
|
+
get hasWatchers(): boolean;
|
|
2616
|
+
[kTrigger](): void;
|
|
2617
|
+
subscribe(callback: Callback<void>): UnsubscribeCallback;
|
|
2618
|
+
subscribeOnce(callback: Callback<void>): UnsubscribeCallback;
|
|
2619
|
+
waitUntil(): never;
|
|
2620
|
+
markSinksDirty(): void;
|
|
2621
|
+
addSink(sink: DerivedSignal<unknown>): void;
|
|
2622
|
+
removeSink(sink: DerivedSignal<unknown>): void;
|
|
2623
|
+
}
|
|
2624
|
+
declare class Signal<T> extends AbstractSignal<T> {
|
|
2625
|
+
#private;
|
|
2626
|
+
constructor(value: T, equals?: (a: T, b: T) => boolean);
|
|
2627
|
+
[Symbol.dispose](): void;
|
|
2628
|
+
get(): T;
|
|
2629
|
+
set(newValue: T | ((oldValue: T) => T)): void;
|
|
2630
|
+
}
|
|
2631
|
+
declare class DerivedSignal<T> extends AbstractSignal<T> {
|
|
2632
|
+
#private;
|
|
2633
|
+
static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
|
|
2634
|
+
[K in keyof Ts]: ISignal<Ts[K]>;
|
|
2635
|
+
}, transform: (...values: Ts) => V]): DerivedSignal<V>;
|
|
2636
|
+
static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
|
|
2637
|
+
[K in keyof Ts]: ISignal<Ts[K]>;
|
|
2638
|
+
}, transform: (...values: Ts) => V, equals: (a: V, b: V) => boolean]): DerivedSignal<V>;
|
|
2639
|
+
private constructor();
|
|
2640
|
+
[Symbol.dispose](): void;
|
|
2641
|
+
get isDirty(): boolean;
|
|
2642
|
+
markDirty(): void;
|
|
2643
|
+
get(): T;
|
|
2644
|
+
/**
|
|
2645
|
+
* Called by the Signal system if one or more of the dependent signals have
|
|
2646
|
+
* changed. In the case of a DerivedSignal, we'll only want to re-evaluate
|
|
2647
|
+
* the actual value if it's being watched, or any of their sinks are being
|
|
2648
|
+
* watched actively.
|
|
2649
|
+
*/
|
|
2650
|
+
[kTrigger](): void;
|
|
2651
|
+
}
|
|
2652
|
+
/**
|
|
2653
|
+
* A MutableSignal is a bit like Signal, except its state is managed by
|
|
2654
|
+
* a single value whose reference does not change but is mutated.
|
|
2655
|
+
*
|
|
2656
|
+
* Similar to how useSyncExternalState() works in React, there is a way to read
|
|
2657
|
+
* the current state at any point in time synchronously, and a way to update
|
|
2658
|
+
* its reference.
|
|
2597
2659
|
*/
|
|
2598
|
-
declare
|
|
2660
|
+
declare class MutableSignal<T extends object> extends AbstractSignal<T> {
|
|
2661
|
+
#private;
|
|
2662
|
+
constructor(initialState: T);
|
|
2663
|
+
[Symbol.dispose](): void;
|
|
2664
|
+
get(): T;
|
|
2665
|
+
/**
|
|
2666
|
+
* Invokes a callback function that is allowed to mutate the given state
|
|
2667
|
+
* value. Do not change the value outside of the callback.
|
|
2668
|
+
*
|
|
2669
|
+
* If the callback explicitly returns `false`, it's assumed that the state
|
|
2670
|
+
* was not changed.
|
|
2671
|
+
*/
|
|
2672
|
+
mutate(callback?: (state: T) => unknown): void;
|
|
2673
|
+
}
|
|
2599
2674
|
|
|
2600
2675
|
declare type OptionalPromise<T> = T | Promise<T>;
|
|
2601
2676
|
|
|
@@ -2668,7 +2743,7 @@ declare type InternalSyncStatus = SyncStatus | "has-local-changes";
|
|
|
2668
2743
|
* will probably happen if you do.
|
|
2669
2744
|
*/
|
|
2670
2745
|
declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
2671
|
-
readonly
|
|
2746
|
+
readonly currentUserId: Signal<string | undefined>;
|
|
2672
2747
|
readonly mentionSuggestionsCache: Map<string, string[]>;
|
|
2673
2748
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
2674
2749
|
readonly usersStore: BatchStore<U["info"] | undefined, string>;
|
|
@@ -3027,8 +3102,7 @@ declare function getMentionedIdsFromCommentBody(body: CommentBody): string[];
|
|
|
3027
3102
|
declare function resolveUsersInCommentBody<U extends BaseUserMeta>(body: CommentBody, resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>): Promise<Map<string, U["info"]>>;
|
|
3028
3103
|
declare function htmlSafe(value: string): HtmlSafeString;
|
|
3029
3104
|
declare class HtmlSafeString {
|
|
3030
|
-
private
|
|
3031
|
-
private _values;
|
|
3105
|
+
#private;
|
|
3032
3106
|
constructor(strings: readonly string[], values: readonly (string | string[] | HtmlSafeString | HtmlSafeString[])[]);
|
|
3033
3107
|
toString(): string;
|
|
3034
3108
|
}
|
|
@@ -3463,8 +3537,7 @@ declare function shallow(a: unknown, b: unknown): boolean;
|
|
|
3463
3537
|
* [{ id: 1 }, { id: 4 }, { id: 5 }, { id: 9 }])
|
|
3464
3538
|
*/
|
|
3465
3539
|
declare class SortedList<T> {
|
|
3466
|
-
private
|
|
3467
|
-
private _lt;
|
|
3540
|
+
#private;
|
|
3468
3541
|
private constructor();
|
|
3469
3542
|
static from<T>(arr: T[], lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
3470
3543
|
static fromAlreadySorted<T>(alreadySorted: T[], lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
@@ -3647,4 +3720,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3647
3720
|
/** @deprecated Use HttpError instead. */
|
|
3648
3721
|
declare const NotificationsApiError: typeof HttpError;
|
|
3649
3722
|
|
|
3650
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, SortedList, type Status, type StorageStatus, type StorageUpdate, type
|
|
3723
|
+
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -104,21 +104,22 @@ declare type EventSource<T> = Observable<T> & {
|
|
|
104
104
|
* Returns the number of active subscribers.
|
|
105
105
|
*/
|
|
106
106
|
count(): number;
|
|
107
|
-
/**
|
|
108
|
-
* Pauses event delivery until unpaused. Any .notify() calls made while
|
|
109
|
-
* paused will get buffered into memory and emitted later.
|
|
110
|
-
*/
|
|
111
|
-
pause(): void;
|
|
112
|
-
/**
|
|
113
|
-
* Emits all in-memory buffered events, and unpauses. Any .notify() calls
|
|
114
|
-
* made after this will be synchronously delivered again.
|
|
115
|
-
*/
|
|
116
|
-
unpause(): void;
|
|
117
107
|
/**
|
|
118
108
|
* Observable instance, which can be used to subscribe to this event source
|
|
119
109
|
* in a readonly fashion. Safe to publicly expose.
|
|
120
110
|
*/
|
|
121
111
|
observable: Observable<T>;
|
|
112
|
+
/**
|
|
113
|
+
* Disposes of this event source.
|
|
114
|
+
*
|
|
115
|
+
* Will clears all registered event listeners. None of the registered
|
|
116
|
+
* functions will ever get called again.
|
|
117
|
+
*
|
|
118
|
+
* WARNING!
|
|
119
|
+
* Be careful when using this API, because the subscribers may not have any
|
|
120
|
+
* idea they won't be notified anymore.
|
|
121
|
+
*/
|
|
122
|
+
[Symbol.dispose](): void;
|
|
122
123
|
};
|
|
123
124
|
/**
|
|
124
125
|
* makeEventSource allows you to generate a subscribe/notify pair of functions
|
|
@@ -473,6 +474,7 @@ declare type LiveMapUpdates<TKey extends string, TValue extends Lson> = {
|
|
|
473
474
|
* If multiple clients update the same property simultaneously, the last modification received by the Liveblocks servers is the winner.
|
|
474
475
|
*/
|
|
475
476
|
declare class LiveMap<TKey extends string, TValue extends Lson> extends AbstractCrdt {
|
|
477
|
+
#private;
|
|
476
478
|
constructor(entries?: readonly (readonly [TKey, TValue])[] | undefined);
|
|
477
479
|
/**
|
|
478
480
|
* Returns a specified element from the LiveMap.
|
|
@@ -538,6 +540,7 @@ declare type LiveListUpdate = LiveListUpdates<Lson>;
|
|
|
538
540
|
declare type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate;
|
|
539
541
|
|
|
540
542
|
declare abstract class AbstractCrdt {
|
|
543
|
+
#private;
|
|
541
544
|
get roomId(): string | null;
|
|
542
545
|
/**
|
|
543
546
|
* Return an immutable snapshot of this Live node and its children.
|
|
@@ -581,6 +584,7 @@ declare type LiveListUpdates<TItem extends Lson> = {
|
|
|
581
584
|
* The LiveList class represents an ordered collection of items that is synchronized across clients.
|
|
582
585
|
*/
|
|
583
586
|
declare class LiveList<TItem extends Lson> extends AbstractCrdt {
|
|
587
|
+
#private;
|
|
584
588
|
constructor(items: TItem[]);
|
|
585
589
|
/**
|
|
586
590
|
* Returns the number of elements.
|
|
@@ -684,6 +688,7 @@ declare class LiveList<TItem extends Lson> extends AbstractCrdt {
|
|
|
684
688
|
* INTERNAL
|
|
685
689
|
*/
|
|
686
690
|
declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
|
|
691
|
+
#private;
|
|
687
692
|
constructor(data: TValue);
|
|
688
693
|
get data(): TValue;
|
|
689
694
|
clone(): TValue;
|
|
@@ -750,6 +755,7 @@ declare type LiveObjectUpdates<TData extends LsonObject> = {
|
|
|
750
755
|
* If multiple clients update the same property simultaneously, the last modification received by the Liveblocks servers is the winner.
|
|
751
756
|
*/
|
|
752
757
|
declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
|
|
758
|
+
#private;
|
|
753
759
|
constructor(obj?: O);
|
|
754
760
|
/**
|
|
755
761
|
* Transform the LiveObject into a javascript object
|
|
@@ -2578,24 +2584,93 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
2578
2584
|
}
|
|
2579
2585
|
|
|
2580
2586
|
/**
|
|
2581
|
-
*
|
|
2587
|
+
* Back-port of TypeScript 5.4's built-in NoInfer utility type.
|
|
2588
|
+
* See https://stackoverflow.com/a/56688073/148872
|
|
2582
2589
|
*/
|
|
2583
|
-
declare type
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
subscribe: (callback: () => void) => () => void;
|
|
2587
|
-
batch: (callback: () => void) => void;
|
|
2588
|
-
};
|
|
2590
|
+
declare type NoInfr<A> = [A][A extends any ? 0 : never];
|
|
2591
|
+
|
|
2592
|
+
declare const kTrigger: unique symbol;
|
|
2589
2593
|
/**
|
|
2590
|
-
*
|
|
2594
|
+
* Runs a callback function that is allowed to change multiple signals. At the
|
|
2595
|
+
* end of the batch, all changed signals will be notified (at most once).
|
|
2596
|
+
*
|
|
2597
|
+
* Nesting batches is supported.
|
|
2591
2598
|
*/
|
|
2592
|
-
declare function
|
|
2593
|
-
|
|
2599
|
+
declare function batch(callback: Callback<void>): void;
|
|
2600
|
+
declare type SignalType<S extends ISignal<any>> = S extends ISignal<infer T> ? T : never;
|
|
2601
|
+
interface ISignal<T> {
|
|
2602
|
+
get(): T;
|
|
2603
|
+
subscribe(callback: Callback<void>): UnsubscribeCallback;
|
|
2604
|
+
addSink(sink: DerivedSignal<unknown>): void;
|
|
2605
|
+
removeSink(sink: DerivedSignal<unknown>): void;
|
|
2606
|
+
}
|
|
2594
2607
|
/**
|
|
2595
|
-
*
|
|
2596
|
-
|
|
2608
|
+
* Base functionality every Signal implementation needs.
|
|
2609
|
+
*/
|
|
2610
|
+
declare abstract class AbstractSignal<T> implements ISignal<T>, Observable<void> {
|
|
2611
|
+
#private;
|
|
2612
|
+
constructor(equals?: (a: T, b: T) => boolean);
|
|
2613
|
+
[Symbol.dispose](): void;
|
|
2614
|
+
abstract get(): T;
|
|
2615
|
+
get hasWatchers(): boolean;
|
|
2616
|
+
[kTrigger](): void;
|
|
2617
|
+
subscribe(callback: Callback<void>): UnsubscribeCallback;
|
|
2618
|
+
subscribeOnce(callback: Callback<void>): UnsubscribeCallback;
|
|
2619
|
+
waitUntil(): never;
|
|
2620
|
+
markSinksDirty(): void;
|
|
2621
|
+
addSink(sink: DerivedSignal<unknown>): void;
|
|
2622
|
+
removeSink(sink: DerivedSignal<unknown>): void;
|
|
2623
|
+
}
|
|
2624
|
+
declare class Signal<T> extends AbstractSignal<T> {
|
|
2625
|
+
#private;
|
|
2626
|
+
constructor(value: T, equals?: (a: T, b: T) => boolean);
|
|
2627
|
+
[Symbol.dispose](): void;
|
|
2628
|
+
get(): T;
|
|
2629
|
+
set(newValue: T | ((oldValue: T) => T)): void;
|
|
2630
|
+
}
|
|
2631
|
+
declare class DerivedSignal<T> extends AbstractSignal<T> {
|
|
2632
|
+
#private;
|
|
2633
|
+
static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
|
|
2634
|
+
[K in keyof Ts]: ISignal<Ts[K]>;
|
|
2635
|
+
}, transform: (...values: Ts) => V]): DerivedSignal<V>;
|
|
2636
|
+
static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
|
|
2637
|
+
[K in keyof Ts]: ISignal<Ts[K]>;
|
|
2638
|
+
}, transform: (...values: Ts) => V, equals: (a: V, b: V) => boolean]): DerivedSignal<V>;
|
|
2639
|
+
private constructor();
|
|
2640
|
+
[Symbol.dispose](): void;
|
|
2641
|
+
get isDirty(): boolean;
|
|
2642
|
+
markDirty(): void;
|
|
2643
|
+
get(): T;
|
|
2644
|
+
/**
|
|
2645
|
+
* Called by the Signal system if one or more of the dependent signals have
|
|
2646
|
+
* changed. In the case of a DerivedSignal, we'll only want to re-evaluate
|
|
2647
|
+
* the actual value if it's being watched, or any of their sinks are being
|
|
2648
|
+
* watched actively.
|
|
2649
|
+
*/
|
|
2650
|
+
[kTrigger](): void;
|
|
2651
|
+
}
|
|
2652
|
+
/**
|
|
2653
|
+
* A MutableSignal is a bit like Signal, except its state is managed by
|
|
2654
|
+
* a single value whose reference does not change but is mutated.
|
|
2655
|
+
*
|
|
2656
|
+
* Similar to how useSyncExternalState() works in React, there is a way to read
|
|
2657
|
+
* the current state at any point in time synchronously, and a way to update
|
|
2658
|
+
* its reference.
|
|
2597
2659
|
*/
|
|
2598
|
-
declare
|
|
2660
|
+
declare class MutableSignal<T extends object> extends AbstractSignal<T> {
|
|
2661
|
+
#private;
|
|
2662
|
+
constructor(initialState: T);
|
|
2663
|
+
[Symbol.dispose](): void;
|
|
2664
|
+
get(): T;
|
|
2665
|
+
/**
|
|
2666
|
+
* Invokes a callback function that is allowed to mutate the given state
|
|
2667
|
+
* value. Do not change the value outside of the callback.
|
|
2668
|
+
*
|
|
2669
|
+
* If the callback explicitly returns `false`, it's assumed that the state
|
|
2670
|
+
* was not changed.
|
|
2671
|
+
*/
|
|
2672
|
+
mutate(callback?: (state: T) => unknown): void;
|
|
2673
|
+
}
|
|
2599
2674
|
|
|
2600
2675
|
declare type OptionalPromise<T> = T | Promise<T>;
|
|
2601
2676
|
|
|
@@ -2668,7 +2743,7 @@ declare type InternalSyncStatus = SyncStatus | "has-local-changes";
|
|
|
2668
2743
|
* will probably happen if you do.
|
|
2669
2744
|
*/
|
|
2670
2745
|
declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
2671
|
-
readonly
|
|
2746
|
+
readonly currentUserId: Signal<string | undefined>;
|
|
2672
2747
|
readonly mentionSuggestionsCache: Map<string, string[]>;
|
|
2673
2748
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
2674
2749
|
readonly usersStore: BatchStore<U["info"] | undefined, string>;
|
|
@@ -3027,8 +3102,7 @@ declare function getMentionedIdsFromCommentBody(body: CommentBody): string[];
|
|
|
3027
3102
|
declare function resolveUsersInCommentBody<U extends BaseUserMeta>(body: CommentBody, resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>): Promise<Map<string, U["info"]>>;
|
|
3028
3103
|
declare function htmlSafe(value: string): HtmlSafeString;
|
|
3029
3104
|
declare class HtmlSafeString {
|
|
3030
|
-
private
|
|
3031
|
-
private _values;
|
|
3105
|
+
#private;
|
|
3032
3106
|
constructor(strings: readonly string[], values: readonly (string | string[] | HtmlSafeString | HtmlSafeString[])[]);
|
|
3033
3107
|
toString(): string;
|
|
3034
3108
|
}
|
|
@@ -3463,8 +3537,7 @@ declare function shallow(a: unknown, b: unknown): boolean;
|
|
|
3463
3537
|
* [{ id: 1 }, { id: 4 }, { id: 5 }, { id: 9 }])
|
|
3464
3538
|
*/
|
|
3465
3539
|
declare class SortedList<T> {
|
|
3466
|
-
private
|
|
3467
|
-
private _lt;
|
|
3540
|
+
#private;
|
|
3468
3541
|
private constructor();
|
|
3469
3542
|
static from<T>(arr: T[], lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
3470
3543
|
static fromAlreadySorted<T>(alreadySorted: T[], lt: (a: T, b: T) => boolean): SortedList<T>;
|
|
@@ -3647,4 +3720,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3647
3720
|
/** @deprecated Use HttpError instead. */
|
|
3648
3721
|
declare const NotificationsApiError: typeof HttpError;
|
|
3649
3722
|
|
|
3650
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, SortedList, type Status, type StorageStatus, type StorageUpdate, type
|
|
3723
|
+
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|