@liveblocks/node 3.8.1 → 3.9.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.cjs +21 -181
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -67
- package/dist/index.d.ts +35 -67
- package/dist/index.js +1 -161
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -134,23 +134,31 @@ type AiCopilotProviderSettings = {
|
|
|
134
134
|
type OpenAiModel = "o1" | "o1-mini" | "o3" | "o3-mini" | "o4-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini" | "gpt-4-turbo" | "gpt-4";
|
|
135
135
|
type OpenAiProviderOptions = {
|
|
136
136
|
openai: {
|
|
137
|
-
reasoningEffort
|
|
137
|
+
reasoningEffort?: "low" | "medium" | "high";
|
|
138
|
+
webSearch?: {
|
|
139
|
+
allowedDomains?: string[];
|
|
140
|
+
};
|
|
138
141
|
};
|
|
139
142
|
};
|
|
140
143
|
type AnthropicModel = "claude-4-opus-20250514" | "claude-4-sonnet-20250514" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-latest" | "claude-3-5-haiku-latest" | "claude-3-opus-latest";
|
|
141
144
|
type AnthropicProviderOptions = {
|
|
142
145
|
anthropic: {
|
|
143
|
-
thinking
|
|
144
|
-
type: "enabled"
|
|
146
|
+
thinking?: {
|
|
147
|
+
type: "enabled";
|
|
145
148
|
budgetTokens: number;
|
|
149
|
+
} | {
|
|
150
|
+
type: "disabled";
|
|
151
|
+
};
|
|
152
|
+
webSearch?: {
|
|
153
|
+
allowedDomains?: string[];
|
|
146
154
|
};
|
|
147
155
|
};
|
|
148
156
|
};
|
|
149
157
|
type GoogleModel = "gemini-2.5-flash" | "gemini-2.5-pro" | "gemini-2.0-flash-001" | "gemini-1.5-flash" | "gemini-1.5-pro";
|
|
150
158
|
type GoogleProviderOptions = {
|
|
151
159
|
google: {
|
|
152
|
-
thinkingConfig
|
|
153
|
-
thinkingBudget
|
|
160
|
+
thinkingConfig?: {
|
|
161
|
+
thinkingBudget?: number;
|
|
154
162
|
};
|
|
155
163
|
};
|
|
156
164
|
};
|
|
@@ -189,14 +197,6 @@ type RoomUser<U extends BaseUserMeta = DU> = {
|
|
|
189
197
|
connectionId: number;
|
|
190
198
|
info: U["info"];
|
|
191
199
|
};
|
|
192
|
-
type Schema = {
|
|
193
|
-
id: string;
|
|
194
|
-
name: string;
|
|
195
|
-
version: number;
|
|
196
|
-
body: string;
|
|
197
|
-
createdAt: Date;
|
|
198
|
-
updatedAt: Date;
|
|
199
|
-
};
|
|
200
200
|
type MutateStorageCallback = (context: {
|
|
201
201
|
root: LiveObject<S>;
|
|
202
202
|
}) => Awaitable<void>;
|
|
@@ -337,24 +337,45 @@ type UpdateAiCopilotOptions = {
|
|
|
337
337
|
providerApiKey?: string;
|
|
338
338
|
} & ({
|
|
339
339
|
provider?: "openai";
|
|
340
|
+
/**
|
|
341
|
+
* The provider model to use.
|
|
342
|
+
*/
|
|
340
343
|
providerModel?: OpenAiModel;
|
|
344
|
+
/**
|
|
345
|
+
* The provider options to use. Replaces the entire existing provider options; no deep merge of the nested fields occurs.
|
|
346
|
+
*/
|
|
341
347
|
providerOptions?: OpenAiProviderOptions | null;
|
|
342
348
|
compatibleProviderName?: never;
|
|
343
349
|
providerBaseUrl?: never;
|
|
344
350
|
} | {
|
|
345
351
|
provider?: "anthropic";
|
|
352
|
+
/**
|
|
353
|
+
* The provider model to use.
|
|
354
|
+
*/
|
|
346
355
|
providerModel?: AnthropicModel;
|
|
356
|
+
/**
|
|
357
|
+
* The provider options to use. Replaces the entire existing provider options; no deep merge of the nested fields occurs..
|
|
358
|
+
*/
|
|
347
359
|
providerOptions?: AnthropicProviderOptions | null;
|
|
348
360
|
compatibleProviderName?: never;
|
|
349
361
|
providerBaseUrl?: never;
|
|
350
362
|
} | {
|
|
351
363
|
provider?: "google";
|
|
364
|
+
/**
|
|
365
|
+
* The provider model to use.
|
|
366
|
+
*/
|
|
352
367
|
providerModel?: GoogleModel;
|
|
368
|
+
/**
|
|
369
|
+
* The provider options to use. Replaces the entire existing provider options; no deep merge of the nested fields occurs.
|
|
370
|
+
*/
|
|
353
371
|
providerOptions?: GoogleProviderOptions | null;
|
|
354
372
|
compatibleProviderName?: never;
|
|
355
373
|
providerBaseUrl?: never;
|
|
356
374
|
} | {
|
|
357
375
|
provider?: "openai-compatible";
|
|
376
|
+
/**
|
|
377
|
+
* The provider model to use.
|
|
378
|
+
*/
|
|
358
379
|
providerModel?: string;
|
|
359
380
|
compatibleProviderName?: string;
|
|
360
381
|
providerBaseUrl?: string;
|
|
@@ -662,59 +683,6 @@ declare class Liveblocks {
|
|
|
662
683
|
getYjsDocumentAsBinaryUpdate(roomId: string, params?: {
|
|
663
684
|
guid?: string;
|
|
664
685
|
}, options?: RequestOptions): Promise<ArrayBuffer>;
|
|
665
|
-
/**
|
|
666
|
-
* Creates a new schema which can be referenced later to enforce a room’s Storage data structure.
|
|
667
|
-
* @param name The name used to reference the schema. Must be a non-empty string with less than 65 characters and only contain lowercase letters, numbers and dashes
|
|
668
|
-
* @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax).
|
|
669
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
670
|
-
* @returns The created schema.
|
|
671
|
-
*/
|
|
672
|
-
createSchema(name: string, body: string, options?: RequestOptions): Promise<Schema>;
|
|
673
|
-
/**
|
|
674
|
-
* Returns a schema by its id.
|
|
675
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
676
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
677
|
-
* @returns The schema with the given id.
|
|
678
|
-
*/
|
|
679
|
-
getSchema(schemaId: string, options?: RequestOptions): Promise<Schema>;
|
|
680
|
-
/**
|
|
681
|
-
* Updates the body for the schema. A schema can only be updated if it is not used by any room.
|
|
682
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
683
|
-
* @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax).
|
|
684
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
685
|
-
* @returns The updated schema. The version of the schema will be incremented.
|
|
686
|
-
*/
|
|
687
|
-
updateSchema(schemaId: string, body: string, options?: RequestOptions): Promise<Schema>;
|
|
688
|
-
/**
|
|
689
|
-
* Deletes a schema by its id. A schema can only be deleted if it is not used by any room.
|
|
690
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
691
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
692
|
-
*/
|
|
693
|
-
deleteSchema(schemaId: string, options?: RequestOptions): Promise<void>;
|
|
694
|
-
/**
|
|
695
|
-
* Returns the schema attached to a room.
|
|
696
|
-
* @param roomId The id of the room to get the schema from.
|
|
697
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
698
|
-
* @returns
|
|
699
|
-
*/
|
|
700
|
-
getSchemaByRoomId(roomId: string, options?: RequestOptions): Promise<Schema>;
|
|
701
|
-
/**
|
|
702
|
-
* Attaches a schema to a room, and instantly enables runtime schema validation for the room.
|
|
703
|
-
* If the current contents of the room’s Storage do not match the schema, attaching will fail and the error message will give details on why the schema failed to attach.
|
|
704
|
-
* @param roomId The id of the room to attach the schema to.
|
|
705
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
706
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
707
|
-
* @returns The schema id as JSON.
|
|
708
|
-
*/
|
|
709
|
-
attachSchemaToRoom(roomId: string, schemaId: string, options?: RequestOptions): Promise<{
|
|
710
|
-
schema: string;
|
|
711
|
-
}>;
|
|
712
|
-
/**
|
|
713
|
-
* Detaches a schema from a room, and disables runtime schema validation for the room.
|
|
714
|
-
* @param roomId The id of the room to detach the schema from.
|
|
715
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
716
|
-
*/
|
|
717
|
-
detachSchemaFromRoom(roomId: string, options?: RequestOptions): Promise<void>;
|
|
718
686
|
/**
|
|
719
687
|
* Gets all the threads in a room.
|
|
720
688
|
*
|
|
@@ -1757,4 +1725,4 @@ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is T
|
|
|
1757
1725
|
*/
|
|
1758
1726
|
declare function isCustomNotificationEvent(event: WebhookEvent): event is CustomNotificationEvent;
|
|
1759
1727
|
|
|
1760
|
-
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type
|
|
1728
|
+
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -134,23 +134,31 @@ type AiCopilotProviderSettings = {
|
|
|
134
134
|
type OpenAiModel = "o1" | "o1-mini" | "o3" | "o3-mini" | "o4-mini" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini" | "gpt-4-turbo" | "gpt-4";
|
|
135
135
|
type OpenAiProviderOptions = {
|
|
136
136
|
openai: {
|
|
137
|
-
reasoningEffort
|
|
137
|
+
reasoningEffort?: "low" | "medium" | "high";
|
|
138
|
+
webSearch?: {
|
|
139
|
+
allowedDomains?: string[];
|
|
140
|
+
};
|
|
138
141
|
};
|
|
139
142
|
};
|
|
140
143
|
type AnthropicModel = "claude-4-opus-20250514" | "claude-4-sonnet-20250514" | "claude-3-7-sonnet-20250219" | "claude-3-5-sonnet-latest" | "claude-3-5-haiku-latest" | "claude-3-opus-latest";
|
|
141
144
|
type AnthropicProviderOptions = {
|
|
142
145
|
anthropic: {
|
|
143
|
-
thinking
|
|
144
|
-
type: "enabled"
|
|
146
|
+
thinking?: {
|
|
147
|
+
type: "enabled";
|
|
145
148
|
budgetTokens: number;
|
|
149
|
+
} | {
|
|
150
|
+
type: "disabled";
|
|
151
|
+
};
|
|
152
|
+
webSearch?: {
|
|
153
|
+
allowedDomains?: string[];
|
|
146
154
|
};
|
|
147
155
|
};
|
|
148
156
|
};
|
|
149
157
|
type GoogleModel = "gemini-2.5-flash" | "gemini-2.5-pro" | "gemini-2.0-flash-001" | "gemini-1.5-flash" | "gemini-1.5-pro";
|
|
150
158
|
type GoogleProviderOptions = {
|
|
151
159
|
google: {
|
|
152
|
-
thinkingConfig
|
|
153
|
-
thinkingBudget
|
|
160
|
+
thinkingConfig?: {
|
|
161
|
+
thinkingBudget?: number;
|
|
154
162
|
};
|
|
155
163
|
};
|
|
156
164
|
};
|
|
@@ -189,14 +197,6 @@ type RoomUser<U extends BaseUserMeta = DU> = {
|
|
|
189
197
|
connectionId: number;
|
|
190
198
|
info: U["info"];
|
|
191
199
|
};
|
|
192
|
-
type Schema = {
|
|
193
|
-
id: string;
|
|
194
|
-
name: string;
|
|
195
|
-
version: number;
|
|
196
|
-
body: string;
|
|
197
|
-
createdAt: Date;
|
|
198
|
-
updatedAt: Date;
|
|
199
|
-
};
|
|
200
200
|
type MutateStorageCallback = (context: {
|
|
201
201
|
root: LiveObject<S>;
|
|
202
202
|
}) => Awaitable<void>;
|
|
@@ -337,24 +337,45 @@ type UpdateAiCopilotOptions = {
|
|
|
337
337
|
providerApiKey?: string;
|
|
338
338
|
} & ({
|
|
339
339
|
provider?: "openai";
|
|
340
|
+
/**
|
|
341
|
+
* The provider model to use.
|
|
342
|
+
*/
|
|
340
343
|
providerModel?: OpenAiModel;
|
|
344
|
+
/**
|
|
345
|
+
* The provider options to use. Replaces the entire existing provider options; no deep merge of the nested fields occurs.
|
|
346
|
+
*/
|
|
341
347
|
providerOptions?: OpenAiProviderOptions | null;
|
|
342
348
|
compatibleProviderName?: never;
|
|
343
349
|
providerBaseUrl?: never;
|
|
344
350
|
} | {
|
|
345
351
|
provider?: "anthropic";
|
|
352
|
+
/**
|
|
353
|
+
* The provider model to use.
|
|
354
|
+
*/
|
|
346
355
|
providerModel?: AnthropicModel;
|
|
356
|
+
/**
|
|
357
|
+
* The provider options to use. Replaces the entire existing provider options; no deep merge of the nested fields occurs..
|
|
358
|
+
*/
|
|
347
359
|
providerOptions?: AnthropicProviderOptions | null;
|
|
348
360
|
compatibleProviderName?: never;
|
|
349
361
|
providerBaseUrl?: never;
|
|
350
362
|
} | {
|
|
351
363
|
provider?: "google";
|
|
364
|
+
/**
|
|
365
|
+
* The provider model to use.
|
|
366
|
+
*/
|
|
352
367
|
providerModel?: GoogleModel;
|
|
368
|
+
/**
|
|
369
|
+
* The provider options to use. Replaces the entire existing provider options; no deep merge of the nested fields occurs.
|
|
370
|
+
*/
|
|
353
371
|
providerOptions?: GoogleProviderOptions | null;
|
|
354
372
|
compatibleProviderName?: never;
|
|
355
373
|
providerBaseUrl?: never;
|
|
356
374
|
} | {
|
|
357
375
|
provider?: "openai-compatible";
|
|
376
|
+
/**
|
|
377
|
+
* The provider model to use.
|
|
378
|
+
*/
|
|
358
379
|
providerModel?: string;
|
|
359
380
|
compatibleProviderName?: string;
|
|
360
381
|
providerBaseUrl?: string;
|
|
@@ -662,59 +683,6 @@ declare class Liveblocks {
|
|
|
662
683
|
getYjsDocumentAsBinaryUpdate(roomId: string, params?: {
|
|
663
684
|
guid?: string;
|
|
664
685
|
}, options?: RequestOptions): Promise<ArrayBuffer>;
|
|
665
|
-
/**
|
|
666
|
-
* Creates a new schema which can be referenced later to enforce a room’s Storage data structure.
|
|
667
|
-
* @param name The name used to reference the schema. Must be a non-empty string with less than 65 characters and only contain lowercase letters, numbers and dashes
|
|
668
|
-
* @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax).
|
|
669
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
670
|
-
* @returns The created schema.
|
|
671
|
-
*/
|
|
672
|
-
createSchema(name: string, body: string, options?: RequestOptions): Promise<Schema>;
|
|
673
|
-
/**
|
|
674
|
-
* Returns a schema by its id.
|
|
675
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
676
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
677
|
-
* @returns The schema with the given id.
|
|
678
|
-
*/
|
|
679
|
-
getSchema(schemaId: string, options?: RequestOptions): Promise<Schema>;
|
|
680
|
-
/**
|
|
681
|
-
* Updates the body for the schema. A schema can only be updated if it is not used by any room.
|
|
682
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
683
|
-
* @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax).
|
|
684
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
685
|
-
* @returns The updated schema. The version of the schema will be incremented.
|
|
686
|
-
*/
|
|
687
|
-
updateSchema(schemaId: string, body: string, options?: RequestOptions): Promise<Schema>;
|
|
688
|
-
/**
|
|
689
|
-
* Deletes a schema by its id. A schema can only be deleted if it is not used by any room.
|
|
690
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
691
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
692
|
-
*/
|
|
693
|
-
deleteSchema(schemaId: string, options?: RequestOptions): Promise<void>;
|
|
694
|
-
/**
|
|
695
|
-
* Returns the schema attached to a room.
|
|
696
|
-
* @param roomId The id of the room to get the schema from.
|
|
697
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
698
|
-
* @returns
|
|
699
|
-
*/
|
|
700
|
-
getSchemaByRoomId(roomId: string, options?: RequestOptions): Promise<Schema>;
|
|
701
|
-
/**
|
|
702
|
-
* Attaches a schema to a room, and instantly enables runtime schema validation for the room.
|
|
703
|
-
* If the current contents of the room’s Storage do not match the schema, attaching will fail and the error message will give details on why the schema failed to attach.
|
|
704
|
-
* @param roomId The id of the room to attach the schema to.
|
|
705
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
706
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
707
|
-
* @returns The schema id as JSON.
|
|
708
|
-
*/
|
|
709
|
-
attachSchemaToRoom(roomId: string, schemaId: string, options?: RequestOptions): Promise<{
|
|
710
|
-
schema: string;
|
|
711
|
-
}>;
|
|
712
|
-
/**
|
|
713
|
-
* Detaches a schema from a room, and disables runtime schema validation for the room.
|
|
714
|
-
* @param roomId The id of the room to detach the schema from.
|
|
715
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
716
|
-
*/
|
|
717
|
-
detachSchemaFromRoom(roomId: string, options?: RequestOptions): Promise<void>;
|
|
718
686
|
/**
|
|
719
687
|
* Gets all the threads in a room.
|
|
720
688
|
*
|
|
@@ -1757,4 +1725,4 @@ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is T
|
|
|
1757
1725
|
*/
|
|
1758
1726
|
declare function isCustomNotificationEvent(event: WebhookEvent): event is CustomNotificationEvent;
|
|
1759
1727
|
|
|
1760
|
-
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type
|
|
1728
|
+
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
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.
|
|
6
|
+
var PKG_VERSION = "3.9.0";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -337,20 +337,6 @@ var Liveblocks = class {
|
|
|
337
337
|
});
|
|
338
338
|
return res;
|
|
339
339
|
}
|
|
340
|
-
async #put(path, json, options) {
|
|
341
|
-
const url3 = urljoin(this.#baseUrl, path);
|
|
342
|
-
const headers = {
|
|
343
|
-
Authorization: `Bearer ${this.#secret}`,
|
|
344
|
-
"Content-Type": "application/json"
|
|
345
|
-
};
|
|
346
|
-
const fetch = await fetchPolyfill();
|
|
347
|
-
return await fetch(url3, {
|
|
348
|
-
method: "PUT",
|
|
349
|
-
headers,
|
|
350
|
-
body: JSON.stringify(json),
|
|
351
|
-
signal: options?.signal
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
340
|
async #putBinary(path, body, params, options) {
|
|
355
341
|
const url3 = urljoin(this.#baseUrl, path, params);
|
|
356
342
|
const headers = {
|
|
@@ -870,152 +856,6 @@ var Liveblocks = class {
|
|
|
870
856
|
}
|
|
871
857
|
return res.arrayBuffer();
|
|
872
858
|
}
|
|
873
|
-
/* -------------------------------------------------------------------------------------------------
|
|
874
|
-
* Schema Validation
|
|
875
|
-
* -----------------------------------------------------------------------------------------------*/
|
|
876
|
-
/**
|
|
877
|
-
* Creates a new schema which can be referenced later to enforce a room’s Storage data structure.
|
|
878
|
-
* @param name The name used to reference the schema. Must be a non-empty string with less than 65 characters and only contain lowercase letters, numbers and dashes
|
|
879
|
-
* @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax).
|
|
880
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
881
|
-
* @returns The created schema.
|
|
882
|
-
*/
|
|
883
|
-
async createSchema(name, body, options) {
|
|
884
|
-
const res = await this.#post(url2`/v2/schemas`, { name, body }, options);
|
|
885
|
-
if (!res.ok) {
|
|
886
|
-
throw await LiveblocksError.from(res);
|
|
887
|
-
}
|
|
888
|
-
const data = await res.json();
|
|
889
|
-
const createdAt = new Date(data.createdAt);
|
|
890
|
-
const updatedAt = new Date(data.updatedAt);
|
|
891
|
-
return {
|
|
892
|
-
...data,
|
|
893
|
-
createdAt,
|
|
894
|
-
updatedAt
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
/**
|
|
898
|
-
* Returns a schema by its id.
|
|
899
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
900
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
901
|
-
* @returns The schema with the given id.
|
|
902
|
-
*/
|
|
903
|
-
async getSchema(schemaId, options) {
|
|
904
|
-
const res = await this.#get(
|
|
905
|
-
url2`/v2/schemas/${schemaId}`,
|
|
906
|
-
void 0,
|
|
907
|
-
options
|
|
908
|
-
);
|
|
909
|
-
if (!res.ok) {
|
|
910
|
-
throw await LiveblocksError.from(res);
|
|
911
|
-
}
|
|
912
|
-
const data = await res.json();
|
|
913
|
-
const createdAt = new Date(data.createdAt);
|
|
914
|
-
const updatedAt = new Date(data.updatedAt);
|
|
915
|
-
return {
|
|
916
|
-
...data,
|
|
917
|
-
createdAt,
|
|
918
|
-
updatedAt
|
|
919
|
-
};
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* Updates the body for the schema. A schema can only be updated if it is not used by any room.
|
|
923
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
924
|
-
* @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax).
|
|
925
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
926
|
-
* @returns The updated schema. The version of the schema will be incremented.
|
|
927
|
-
*/
|
|
928
|
-
async updateSchema(schemaId, body, options) {
|
|
929
|
-
const res = await this.#put(
|
|
930
|
-
url2`/v2/schemas/${schemaId}`,
|
|
931
|
-
{ body },
|
|
932
|
-
options
|
|
933
|
-
);
|
|
934
|
-
if (!res.ok) {
|
|
935
|
-
throw await LiveblocksError.from(res);
|
|
936
|
-
}
|
|
937
|
-
const data = await res.json();
|
|
938
|
-
const createdAt = new Date(data.createdAt);
|
|
939
|
-
const updatedAt = new Date(data.updatedAt);
|
|
940
|
-
return {
|
|
941
|
-
...data,
|
|
942
|
-
createdAt,
|
|
943
|
-
updatedAt
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
/**
|
|
947
|
-
* Deletes a schema by its id. A schema can only be deleted if it is not used by any room.
|
|
948
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
949
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
950
|
-
*/
|
|
951
|
-
async deleteSchema(schemaId, options) {
|
|
952
|
-
const res = await this.#delete(
|
|
953
|
-
url2`/v2/schemas/${schemaId}`,
|
|
954
|
-
void 0,
|
|
955
|
-
options
|
|
956
|
-
);
|
|
957
|
-
if (!res.ok) {
|
|
958
|
-
throw await LiveblocksError.from(res);
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
/**
|
|
962
|
-
* Returns the schema attached to a room.
|
|
963
|
-
* @param roomId The id of the room to get the schema from.
|
|
964
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
965
|
-
* @returns
|
|
966
|
-
*/
|
|
967
|
-
async getSchemaByRoomId(roomId, options) {
|
|
968
|
-
const res = await this.#get(
|
|
969
|
-
url2`/v2/rooms/${roomId}/schema`,
|
|
970
|
-
void 0,
|
|
971
|
-
options
|
|
972
|
-
);
|
|
973
|
-
if (!res.ok) {
|
|
974
|
-
throw await LiveblocksError.from(res);
|
|
975
|
-
}
|
|
976
|
-
const data = await res.json();
|
|
977
|
-
const createdAt = new Date(data.createdAt);
|
|
978
|
-
const updatedAt = new Date(data.updatedAt);
|
|
979
|
-
return {
|
|
980
|
-
...data,
|
|
981
|
-
createdAt,
|
|
982
|
-
updatedAt
|
|
983
|
-
};
|
|
984
|
-
}
|
|
985
|
-
/**
|
|
986
|
-
* Attaches a schema to a room, and instantly enables runtime schema validation for the room.
|
|
987
|
-
* If the current contents of the room’s Storage do not match the schema, attaching will fail and the error message will give details on why the schema failed to attach.
|
|
988
|
-
* @param roomId The id of the room to attach the schema to.
|
|
989
|
-
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
990
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
991
|
-
* @returns The schema id as JSON.
|
|
992
|
-
*/
|
|
993
|
-
async attachSchemaToRoom(roomId, schemaId, options) {
|
|
994
|
-
const res = await this.#post(
|
|
995
|
-
url2`/v2/rooms/${roomId}/schema`,
|
|
996
|
-
{ schema: schemaId },
|
|
997
|
-
options
|
|
998
|
-
);
|
|
999
|
-
if (!res.ok) {
|
|
1000
|
-
throw await LiveblocksError.from(res);
|
|
1001
|
-
}
|
|
1002
|
-
return await res.json();
|
|
1003
|
-
}
|
|
1004
|
-
/**
|
|
1005
|
-
* Detaches a schema from a room, and disables runtime schema validation for the room.
|
|
1006
|
-
* @param roomId The id of the room to detach the schema from.
|
|
1007
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1008
|
-
*/
|
|
1009
|
-
async detachSchemaFromRoom(roomId, options) {
|
|
1010
|
-
const res = await this.#delete(
|
|
1011
|
-
url2`/v2/rooms/${roomId}/schema`,
|
|
1012
|
-
void 0,
|
|
1013
|
-
options
|
|
1014
|
-
);
|
|
1015
|
-
if (!res.ok) {
|
|
1016
|
-
throw await LiveblocksError.from(res);
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
859
|
/* -------------------------------------------------------------------------------------------------
|
|
1020
860
|
* Comments
|
|
1021
861
|
* -----------------------------------------------------------------------------------------------*/
|