@liveblocks/core 2.8.0-beta3 → 2.8.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.
- package/dist/index.d.mts +26 -7
- package/dist/index.d.ts +26 -7
- package/dist/index.js +189 -199
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +145 -155
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1045,20 +1045,22 @@ declare const kInternal: unique symbol;
|
|
|
1045
1045
|
declare type RenameDataField<T, TFieldName extends string> = T extends any ? {
|
|
1046
1046
|
[K in keyof T as K extends "data" ? TFieldName : K]: T[K];
|
|
1047
1047
|
} : never;
|
|
1048
|
-
declare type
|
|
1048
|
+
declare type AsyncLoading<F extends string = "data"> = RenameDataField<{
|
|
1049
1049
|
readonly isLoading: true;
|
|
1050
1050
|
readonly data?: never;
|
|
1051
1051
|
readonly error?: never;
|
|
1052
|
-
}
|
|
1052
|
+
}, F>;
|
|
1053
|
+
declare type AsyncSuccess<T, F extends string = "data"> = RenameDataField<{
|
|
1053
1054
|
readonly isLoading: false;
|
|
1054
1055
|
readonly data: T;
|
|
1055
1056
|
readonly error?: never;
|
|
1056
|
-
}
|
|
1057
|
+
}, F>;
|
|
1058
|
+
declare type AsyncError<F extends string = "data"> = RenameDataField<{
|
|
1057
1059
|
readonly isLoading: false;
|
|
1058
1060
|
readonly data?: never;
|
|
1059
1061
|
readonly error: Error;
|
|
1060
|
-
}
|
|
1061
|
-
declare type
|
|
1062
|
+
}, F>;
|
|
1063
|
+
declare type AsyncResult<T, F extends string = "data"> = AsyncLoading<F> | AsyncSuccess<T, F> | AsyncError<F>;
|
|
1062
1064
|
|
|
1063
1065
|
declare type BatchStore<O, I> = Observable<void> & {
|
|
1064
1066
|
get: (input: I) => Promise<void>;
|
|
@@ -2760,8 +2762,9 @@ declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
|
2760
2762
|
* @param promiseFn The promise factory to execute
|
|
2761
2763
|
* @param maxTries The number of total tries (must be >=1)
|
|
2762
2764
|
* @param backoff An array of timings to inject between each promise attempt
|
|
2765
|
+
* @param throwError An optional function to not auto-retry on certain errors
|
|
2763
2766
|
*/
|
|
2764
|
-
declare function autoRetry<T>(promiseFn: () => Promise<T>, maxTries: number, backoff: number[],
|
|
2767
|
+
declare function autoRetry<T>(promiseFn: () => Promise<T>, maxTries: number, backoff: number[], throwError?: (err: any) => boolean): Promise<T>;
|
|
2765
2768
|
|
|
2766
2769
|
declare function chunk<T>(array: T[], size: number): T[][];
|
|
2767
2770
|
|
|
@@ -2991,6 +2994,22 @@ declare function shallow(a: unknown, b: unknown): boolean;
|
|
|
2991
2994
|
declare type OmitFirstTupleElement<T extends any[]> = T extends [any, ...infer R] ? R : never;
|
|
2992
2995
|
declare function stringify(object: Parameters<typeof JSON.stringify>[0], ...args: OmitFirstTupleElement<Parameters<typeof JSON.stringify>>): string;
|
|
2993
2996
|
|
|
2997
|
+
declare type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
|
|
2998
|
+
/**
|
|
2999
|
+
* Concatenates a path to an existing URL.
|
|
3000
|
+
*/
|
|
3001
|
+
declare function urljoin(baseUrl: string | URL, path: string, params?: QueryParams): string;
|
|
3002
|
+
/**
|
|
3003
|
+
* A string that is guaranteed to be URL safe (where all arguments are properly
|
|
3004
|
+
* encoded), only obtainable as the result of using `url` template strings.
|
|
3005
|
+
*/
|
|
3006
|
+
declare type URLSafeString = Brand<string, "URLSafeString">;
|
|
3007
|
+
/**
|
|
3008
|
+
* Builds a URL where each "hole" in the template string will automatically be
|
|
3009
|
+
* encodeURIComponent()-escaped, so it's impossible to build invalid URLs.
|
|
3010
|
+
*/
|
|
3011
|
+
declare function url(strings: TemplateStringsArray, ...values: string[]): URLSafeString;
|
|
3012
|
+
|
|
2994
3013
|
declare type HistoryVersion = {
|
|
2995
3014
|
type: "historyVersion";
|
|
2996
3015
|
kind: "yjs";
|
|
@@ -3133,4 +3152,4 @@ declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (En
|
|
|
3133
3152
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
3134
3153
|
};
|
|
3135
3154
|
|
|
3136
|
-
export { type AckOp, type ActivityData, type AsyncResult, type
|
|
3155
|
+
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, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, 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 Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PrivateClientApi, type PrivateRoomApi, 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, type Status, type StorageStatus, type StorageUpdate, type Store, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, 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, ackOp, asPos, assert, assertNever, autoRetry, b64decode, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentId, createInboxNotificationId, createStore, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -1045,20 +1045,22 @@ declare const kInternal: unique symbol;
|
|
|
1045
1045
|
declare type RenameDataField<T, TFieldName extends string> = T extends any ? {
|
|
1046
1046
|
[K in keyof T as K extends "data" ? TFieldName : K]: T[K];
|
|
1047
1047
|
} : never;
|
|
1048
|
-
declare type
|
|
1048
|
+
declare type AsyncLoading<F extends string = "data"> = RenameDataField<{
|
|
1049
1049
|
readonly isLoading: true;
|
|
1050
1050
|
readonly data?: never;
|
|
1051
1051
|
readonly error?: never;
|
|
1052
|
-
}
|
|
1052
|
+
}, F>;
|
|
1053
|
+
declare type AsyncSuccess<T, F extends string = "data"> = RenameDataField<{
|
|
1053
1054
|
readonly isLoading: false;
|
|
1054
1055
|
readonly data: T;
|
|
1055
1056
|
readonly error?: never;
|
|
1056
|
-
}
|
|
1057
|
+
}, F>;
|
|
1058
|
+
declare type AsyncError<F extends string = "data"> = RenameDataField<{
|
|
1057
1059
|
readonly isLoading: false;
|
|
1058
1060
|
readonly data?: never;
|
|
1059
1061
|
readonly error: Error;
|
|
1060
|
-
}
|
|
1061
|
-
declare type
|
|
1062
|
+
}, F>;
|
|
1063
|
+
declare type AsyncResult<T, F extends string = "data"> = AsyncLoading<F> | AsyncSuccess<T, F> | AsyncError<F>;
|
|
1062
1064
|
|
|
1063
1065
|
declare type BatchStore<O, I> = Observable<void> & {
|
|
1064
1066
|
get: (input: I) => Promise<void>;
|
|
@@ -2760,8 +2762,9 @@ declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
|
2760
2762
|
* @param promiseFn The promise factory to execute
|
|
2761
2763
|
* @param maxTries The number of total tries (must be >=1)
|
|
2762
2764
|
* @param backoff An array of timings to inject between each promise attempt
|
|
2765
|
+
* @param throwError An optional function to not auto-retry on certain errors
|
|
2763
2766
|
*/
|
|
2764
|
-
declare function autoRetry<T>(promiseFn: () => Promise<T>, maxTries: number, backoff: number[],
|
|
2767
|
+
declare function autoRetry<T>(promiseFn: () => Promise<T>, maxTries: number, backoff: number[], throwError?: (err: any) => boolean): Promise<T>;
|
|
2765
2768
|
|
|
2766
2769
|
declare function chunk<T>(array: T[], size: number): T[][];
|
|
2767
2770
|
|
|
@@ -2991,6 +2994,22 @@ declare function shallow(a: unknown, b: unknown): boolean;
|
|
|
2991
2994
|
declare type OmitFirstTupleElement<T extends any[]> = T extends [any, ...infer R] ? R : never;
|
|
2992
2995
|
declare function stringify(object: Parameters<typeof JSON.stringify>[0], ...args: OmitFirstTupleElement<Parameters<typeof JSON.stringify>>): string;
|
|
2993
2996
|
|
|
2997
|
+
declare type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
|
|
2998
|
+
/**
|
|
2999
|
+
* Concatenates a path to an existing URL.
|
|
3000
|
+
*/
|
|
3001
|
+
declare function urljoin(baseUrl: string | URL, path: string, params?: QueryParams): string;
|
|
3002
|
+
/**
|
|
3003
|
+
* A string that is guaranteed to be URL safe (where all arguments are properly
|
|
3004
|
+
* encoded), only obtainable as the result of using `url` template strings.
|
|
3005
|
+
*/
|
|
3006
|
+
declare type URLSafeString = Brand<string, "URLSafeString">;
|
|
3007
|
+
/**
|
|
3008
|
+
* Builds a URL where each "hole" in the template string will automatically be
|
|
3009
|
+
* encodeURIComponent()-escaped, so it's impossible to build invalid URLs.
|
|
3010
|
+
*/
|
|
3011
|
+
declare function url(strings: TemplateStringsArray, ...values: string[]): URLSafeString;
|
|
3012
|
+
|
|
2994
3013
|
declare type HistoryVersion = {
|
|
2995
3014
|
type: "historyVersion";
|
|
2996
3015
|
kind: "yjs";
|
|
@@ -3133,4 +3152,4 @@ declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (En
|
|
|
3133
3152
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
3134
3153
|
};
|
|
3135
3154
|
|
|
3136
|
-
export { type AckOp, type ActivityData, type AsyncResult, type
|
|
3155
|
+
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, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, 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 Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PrivateClientApi, type PrivateRoomApi, 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, type Status, type StorageStatus, type StorageUpdate, type Store, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, 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, ackOp, asPos, assert, assertNever, autoRetry, b64decode, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentId, createInboxNotificationId, createStore, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|