@liveblocks/node 3.8.0 → 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 +29 -182
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -70
- package/dist/index.d.ts +36 -70
- package/dist/index.js +9 -162
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -107,9 +107,7 @@ type CreateThreadOptions<M extends BaseMetadata> = {
|
|
|
107
107
|
}>;
|
|
108
108
|
};
|
|
109
109
|
type RoomPermission = [] | ["room:write"] | ["room:read", "room:presence:write"];
|
|
110
|
-
type RoomAccesses = Record<string, [
|
|
111
|
-
"room:write"
|
|
112
|
-
] | ["room:read", "room:presence:write"]>;
|
|
110
|
+
type RoomAccesses = Record<string, ["room:write"] | ["room:read", "room:presence:write"] | ["room:read", "room:presence:write", "comments:write"]>;
|
|
113
111
|
type RoomMetadata = Record<string, string | string[]>;
|
|
114
112
|
type QueryRoomMetadata = Record<string, string>;
|
|
115
113
|
type RoomData = {
|
|
@@ -136,23 +134,31 @@ type AiCopilotProviderSettings = {
|
|
|
136
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";
|
|
137
135
|
type OpenAiProviderOptions = {
|
|
138
136
|
openai: {
|
|
139
|
-
reasoningEffort
|
|
137
|
+
reasoningEffort?: "low" | "medium" | "high";
|
|
138
|
+
webSearch?: {
|
|
139
|
+
allowedDomains?: string[];
|
|
140
|
+
};
|
|
140
141
|
};
|
|
141
142
|
};
|
|
142
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";
|
|
143
144
|
type AnthropicProviderOptions = {
|
|
144
145
|
anthropic: {
|
|
145
|
-
thinking
|
|
146
|
-
type: "enabled"
|
|
146
|
+
thinking?: {
|
|
147
|
+
type: "enabled";
|
|
147
148
|
budgetTokens: number;
|
|
149
|
+
} | {
|
|
150
|
+
type: "disabled";
|
|
151
|
+
};
|
|
152
|
+
webSearch?: {
|
|
153
|
+
allowedDomains?: string[];
|
|
148
154
|
};
|
|
149
155
|
};
|
|
150
156
|
};
|
|
151
157
|
type GoogleModel = "gemini-2.5-flash" | "gemini-2.5-pro" | "gemini-2.0-flash-001" | "gemini-1.5-flash" | "gemini-1.5-pro";
|
|
152
158
|
type GoogleProviderOptions = {
|
|
153
159
|
google: {
|
|
154
|
-
thinkingConfig
|
|
155
|
-
thinkingBudget
|
|
160
|
+
thinkingConfig?: {
|
|
161
|
+
thinkingBudget?: number;
|
|
156
162
|
};
|
|
157
163
|
};
|
|
158
164
|
};
|
|
@@ -191,14 +197,6 @@ type RoomUser<U extends BaseUserMeta = DU> = {
|
|
|
191
197
|
connectionId: number;
|
|
192
198
|
info: U["info"];
|
|
193
199
|
};
|
|
194
|
-
type Schema = {
|
|
195
|
-
id: string;
|
|
196
|
-
name: string;
|
|
197
|
-
version: number;
|
|
198
|
-
body: string;
|
|
199
|
-
createdAt: Date;
|
|
200
|
-
updatedAt: Date;
|
|
201
|
-
};
|
|
202
200
|
type MutateStorageCallback = (context: {
|
|
203
201
|
root: LiveObject<S>;
|
|
204
202
|
}) => Awaitable<void>;
|
|
@@ -339,24 +337,45 @@ type UpdateAiCopilotOptions = {
|
|
|
339
337
|
providerApiKey?: string;
|
|
340
338
|
} & ({
|
|
341
339
|
provider?: "openai";
|
|
340
|
+
/**
|
|
341
|
+
* The provider model to use.
|
|
342
|
+
*/
|
|
342
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
|
+
*/
|
|
343
347
|
providerOptions?: OpenAiProviderOptions | null;
|
|
344
348
|
compatibleProviderName?: never;
|
|
345
349
|
providerBaseUrl?: never;
|
|
346
350
|
} | {
|
|
347
351
|
provider?: "anthropic";
|
|
352
|
+
/**
|
|
353
|
+
* The provider model to use.
|
|
354
|
+
*/
|
|
348
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
|
+
*/
|
|
349
359
|
providerOptions?: AnthropicProviderOptions | null;
|
|
350
360
|
compatibleProviderName?: never;
|
|
351
361
|
providerBaseUrl?: never;
|
|
352
362
|
} | {
|
|
353
363
|
provider?: "google";
|
|
364
|
+
/**
|
|
365
|
+
* The provider model to use.
|
|
366
|
+
*/
|
|
354
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
|
+
*/
|
|
355
371
|
providerOptions?: GoogleProviderOptions | null;
|
|
356
372
|
compatibleProviderName?: never;
|
|
357
373
|
providerBaseUrl?: never;
|
|
358
374
|
} | {
|
|
359
375
|
provider?: "openai-compatible";
|
|
376
|
+
/**
|
|
377
|
+
* The provider model to use.
|
|
378
|
+
*/
|
|
360
379
|
providerModel?: string;
|
|
361
380
|
compatibleProviderName?: string;
|
|
362
381
|
providerBaseUrl?: string;
|
|
@@ -664,59 +683,6 @@ declare class Liveblocks {
|
|
|
664
683
|
getYjsDocumentAsBinaryUpdate(roomId: string, params?: {
|
|
665
684
|
guid?: string;
|
|
666
685
|
}, options?: RequestOptions): Promise<ArrayBuffer>;
|
|
667
|
-
/**
|
|
668
|
-
* Creates a new schema which can be referenced later to enforce a room’s Storage data structure.
|
|
669
|
-
* @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
|
|
670
|
-
* @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).
|
|
671
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
672
|
-
* @returns The created schema.
|
|
673
|
-
*/
|
|
674
|
-
createSchema(name: string, body: string, options?: RequestOptions): Promise<Schema>;
|
|
675
|
-
/**
|
|
676
|
-
* Returns a schema by its id.
|
|
677
|
-
* @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`.
|
|
678
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
679
|
-
* @returns The schema with the given id.
|
|
680
|
-
*/
|
|
681
|
-
getSchema(schemaId: string, options?: RequestOptions): Promise<Schema>;
|
|
682
|
-
/**
|
|
683
|
-
* Updates the body for the schema. A schema can only be updated if it is not used by any room.
|
|
684
|
-
* @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`.
|
|
685
|
-
* @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).
|
|
686
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
687
|
-
* @returns The updated schema. The version of the schema will be incremented.
|
|
688
|
-
*/
|
|
689
|
-
updateSchema(schemaId: string, body: string, options?: RequestOptions): Promise<Schema>;
|
|
690
|
-
/**
|
|
691
|
-
* Deletes a schema by its id. A schema can only be deleted if it is not used by any room.
|
|
692
|
-
* @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`.
|
|
693
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
694
|
-
*/
|
|
695
|
-
deleteSchema(schemaId: string, options?: RequestOptions): Promise<void>;
|
|
696
|
-
/**
|
|
697
|
-
* Returns the schema attached to a room.
|
|
698
|
-
* @param roomId The id of the room to get the schema from.
|
|
699
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
700
|
-
* @returns
|
|
701
|
-
*/
|
|
702
|
-
getSchemaByRoomId(roomId: string, options?: RequestOptions): Promise<Schema>;
|
|
703
|
-
/**
|
|
704
|
-
* Attaches a schema to a room, and instantly enables runtime schema validation for the room.
|
|
705
|
-
* 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.
|
|
706
|
-
* @param roomId The id of the room to attach the schema to.
|
|
707
|
-
* @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`.
|
|
708
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
709
|
-
* @returns The schema id as JSON.
|
|
710
|
-
*/
|
|
711
|
-
attachSchemaToRoom(roomId: string, schemaId: string, options?: RequestOptions): Promise<{
|
|
712
|
-
schema: string;
|
|
713
|
-
}>;
|
|
714
|
-
/**
|
|
715
|
-
* Detaches a schema from a room, and disables runtime schema validation for the room.
|
|
716
|
-
* @param roomId The id of the room to detach the schema from.
|
|
717
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
718
|
-
*/
|
|
719
|
-
detachSchemaFromRoom(roomId: string, options?: RequestOptions): Promise<void>;
|
|
720
686
|
/**
|
|
721
687
|
* Gets all the threads in a room.
|
|
722
688
|
*
|
|
@@ -1759,4 +1725,4 @@ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is T
|
|
|
1759
1725
|
*/
|
|
1760
1726
|
declare function isCustomNotificationEvent(event: WebhookEvent): event is CustomNotificationEvent;
|
|
1761
1727
|
|
|
1762
|
-
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
|
@@ -107,9 +107,7 @@ type CreateThreadOptions<M extends BaseMetadata> = {
|
|
|
107
107
|
}>;
|
|
108
108
|
};
|
|
109
109
|
type RoomPermission = [] | ["room:write"] | ["room:read", "room:presence:write"];
|
|
110
|
-
type RoomAccesses = Record<string, [
|
|
111
|
-
"room:write"
|
|
112
|
-
] | ["room:read", "room:presence:write"]>;
|
|
110
|
+
type RoomAccesses = Record<string, ["room:write"] | ["room:read", "room:presence:write"] | ["room:read", "room:presence:write", "comments:write"]>;
|
|
113
111
|
type RoomMetadata = Record<string, string | string[]>;
|
|
114
112
|
type QueryRoomMetadata = Record<string, string>;
|
|
115
113
|
type RoomData = {
|
|
@@ -136,23 +134,31 @@ type AiCopilotProviderSettings = {
|
|
|
136
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";
|
|
137
135
|
type OpenAiProviderOptions = {
|
|
138
136
|
openai: {
|
|
139
|
-
reasoningEffort
|
|
137
|
+
reasoningEffort?: "low" | "medium" | "high";
|
|
138
|
+
webSearch?: {
|
|
139
|
+
allowedDomains?: string[];
|
|
140
|
+
};
|
|
140
141
|
};
|
|
141
142
|
};
|
|
142
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";
|
|
143
144
|
type AnthropicProviderOptions = {
|
|
144
145
|
anthropic: {
|
|
145
|
-
thinking
|
|
146
|
-
type: "enabled"
|
|
146
|
+
thinking?: {
|
|
147
|
+
type: "enabled";
|
|
147
148
|
budgetTokens: number;
|
|
149
|
+
} | {
|
|
150
|
+
type: "disabled";
|
|
151
|
+
};
|
|
152
|
+
webSearch?: {
|
|
153
|
+
allowedDomains?: string[];
|
|
148
154
|
};
|
|
149
155
|
};
|
|
150
156
|
};
|
|
151
157
|
type GoogleModel = "gemini-2.5-flash" | "gemini-2.5-pro" | "gemini-2.0-flash-001" | "gemini-1.5-flash" | "gemini-1.5-pro";
|
|
152
158
|
type GoogleProviderOptions = {
|
|
153
159
|
google: {
|
|
154
|
-
thinkingConfig
|
|
155
|
-
thinkingBudget
|
|
160
|
+
thinkingConfig?: {
|
|
161
|
+
thinkingBudget?: number;
|
|
156
162
|
};
|
|
157
163
|
};
|
|
158
164
|
};
|
|
@@ -191,14 +197,6 @@ type RoomUser<U extends BaseUserMeta = DU> = {
|
|
|
191
197
|
connectionId: number;
|
|
192
198
|
info: U["info"];
|
|
193
199
|
};
|
|
194
|
-
type Schema = {
|
|
195
|
-
id: string;
|
|
196
|
-
name: string;
|
|
197
|
-
version: number;
|
|
198
|
-
body: string;
|
|
199
|
-
createdAt: Date;
|
|
200
|
-
updatedAt: Date;
|
|
201
|
-
};
|
|
202
200
|
type MutateStorageCallback = (context: {
|
|
203
201
|
root: LiveObject<S>;
|
|
204
202
|
}) => Awaitable<void>;
|
|
@@ -339,24 +337,45 @@ type UpdateAiCopilotOptions = {
|
|
|
339
337
|
providerApiKey?: string;
|
|
340
338
|
} & ({
|
|
341
339
|
provider?: "openai";
|
|
340
|
+
/**
|
|
341
|
+
* The provider model to use.
|
|
342
|
+
*/
|
|
342
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
|
+
*/
|
|
343
347
|
providerOptions?: OpenAiProviderOptions | null;
|
|
344
348
|
compatibleProviderName?: never;
|
|
345
349
|
providerBaseUrl?: never;
|
|
346
350
|
} | {
|
|
347
351
|
provider?: "anthropic";
|
|
352
|
+
/**
|
|
353
|
+
* The provider model to use.
|
|
354
|
+
*/
|
|
348
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
|
+
*/
|
|
349
359
|
providerOptions?: AnthropicProviderOptions | null;
|
|
350
360
|
compatibleProviderName?: never;
|
|
351
361
|
providerBaseUrl?: never;
|
|
352
362
|
} | {
|
|
353
363
|
provider?: "google";
|
|
364
|
+
/**
|
|
365
|
+
* The provider model to use.
|
|
366
|
+
*/
|
|
354
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
|
+
*/
|
|
355
371
|
providerOptions?: GoogleProviderOptions | null;
|
|
356
372
|
compatibleProviderName?: never;
|
|
357
373
|
providerBaseUrl?: never;
|
|
358
374
|
} | {
|
|
359
375
|
provider?: "openai-compatible";
|
|
376
|
+
/**
|
|
377
|
+
* The provider model to use.
|
|
378
|
+
*/
|
|
360
379
|
providerModel?: string;
|
|
361
380
|
compatibleProviderName?: string;
|
|
362
381
|
providerBaseUrl?: string;
|
|
@@ -664,59 +683,6 @@ declare class Liveblocks {
|
|
|
664
683
|
getYjsDocumentAsBinaryUpdate(roomId: string, params?: {
|
|
665
684
|
guid?: string;
|
|
666
685
|
}, options?: RequestOptions): Promise<ArrayBuffer>;
|
|
667
|
-
/**
|
|
668
|
-
* Creates a new schema which can be referenced later to enforce a room’s Storage data structure.
|
|
669
|
-
* @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
|
|
670
|
-
* @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).
|
|
671
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
672
|
-
* @returns The created schema.
|
|
673
|
-
*/
|
|
674
|
-
createSchema(name: string, body: string, options?: RequestOptions): Promise<Schema>;
|
|
675
|
-
/**
|
|
676
|
-
* Returns a schema by its id.
|
|
677
|
-
* @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`.
|
|
678
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
679
|
-
* @returns The schema with the given id.
|
|
680
|
-
*/
|
|
681
|
-
getSchema(schemaId: string, options?: RequestOptions): Promise<Schema>;
|
|
682
|
-
/**
|
|
683
|
-
* Updates the body for the schema. A schema can only be updated if it is not used by any room.
|
|
684
|
-
* @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`.
|
|
685
|
-
* @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).
|
|
686
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
687
|
-
* @returns The updated schema. The version of the schema will be incremented.
|
|
688
|
-
*/
|
|
689
|
-
updateSchema(schemaId: string, body: string, options?: RequestOptions): Promise<Schema>;
|
|
690
|
-
/**
|
|
691
|
-
* Deletes a schema by its id. A schema can only be deleted if it is not used by any room.
|
|
692
|
-
* @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`.
|
|
693
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
694
|
-
*/
|
|
695
|
-
deleteSchema(schemaId: string, options?: RequestOptions): Promise<void>;
|
|
696
|
-
/**
|
|
697
|
-
* Returns the schema attached to a room.
|
|
698
|
-
* @param roomId The id of the room to get the schema from.
|
|
699
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
700
|
-
* @returns
|
|
701
|
-
*/
|
|
702
|
-
getSchemaByRoomId(roomId: string, options?: RequestOptions): Promise<Schema>;
|
|
703
|
-
/**
|
|
704
|
-
* Attaches a schema to a room, and instantly enables runtime schema validation for the room.
|
|
705
|
-
* 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.
|
|
706
|
-
* @param roomId The id of the room to attach the schema to.
|
|
707
|
-
* @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`.
|
|
708
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
709
|
-
* @returns The schema id as JSON.
|
|
710
|
-
*/
|
|
711
|
-
attachSchemaToRoom(roomId: string, schemaId: string, options?: RequestOptions): Promise<{
|
|
712
|
-
schema: string;
|
|
713
|
-
}>;
|
|
714
|
-
/**
|
|
715
|
-
* Detaches a schema from a room, and disables runtime schema validation for the room.
|
|
716
|
-
* @param roomId The id of the room to detach the schema from.
|
|
717
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
718
|
-
*/
|
|
719
|
-
detachSchemaFromRoom(roomId: string, options?: RequestOptions): Promise<void>;
|
|
720
686
|
/**
|
|
721
687
|
* Gets all the threads in a room.
|
|
722
688
|
*
|
|
@@ -1759,4 +1725,4 @@ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is T
|
|
|
1759
1725
|
*/
|
|
1760
1726
|
declare function isCustomNotificationEvent(event: WebhookEvent): event is CustomNotificationEvent;
|
|
1761
1727
|
|
|
1762
|
-
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 = {
|
|
@@ -567,7 +553,13 @@ var Liveblocks = class {
|
|
|
567
553
|
* @returns The created room.
|
|
568
554
|
*/
|
|
569
555
|
async createRoom(roomId, params, options) {
|
|
570
|
-
const {
|
|
556
|
+
const {
|
|
557
|
+
defaultAccesses,
|
|
558
|
+
groupsAccesses,
|
|
559
|
+
usersAccesses,
|
|
560
|
+
metadata,
|
|
561
|
+
tenantId
|
|
562
|
+
} = params;
|
|
571
563
|
const res = await this.#post(
|
|
572
564
|
options?.idempotent ? url2`/v2/rooms?idempotent` : url2`/v2/rooms`,
|
|
573
565
|
{
|
|
@@ -575,6 +567,7 @@ var Liveblocks = class {
|
|
|
575
567
|
defaultAccesses,
|
|
576
568
|
groupsAccesses,
|
|
577
569
|
usersAccesses,
|
|
570
|
+
tenantId,
|
|
578
571
|
metadata
|
|
579
572
|
},
|
|
580
573
|
options
|
|
@@ -863,152 +856,6 @@ var Liveblocks = class {
|
|
|
863
856
|
}
|
|
864
857
|
return res.arrayBuffer();
|
|
865
858
|
}
|
|
866
|
-
/* -------------------------------------------------------------------------------------------------
|
|
867
|
-
* Schema Validation
|
|
868
|
-
* -----------------------------------------------------------------------------------------------*/
|
|
869
|
-
/**
|
|
870
|
-
* Creates a new schema which can be referenced later to enforce a room’s Storage data structure.
|
|
871
|
-
* @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
|
|
872
|
-
* @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).
|
|
873
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
874
|
-
* @returns The created schema.
|
|
875
|
-
*/
|
|
876
|
-
async createSchema(name, body, options) {
|
|
877
|
-
const res = await this.#post(url2`/v2/schemas`, { name, body }, options);
|
|
878
|
-
if (!res.ok) {
|
|
879
|
-
throw await LiveblocksError.from(res);
|
|
880
|
-
}
|
|
881
|
-
const data = await res.json();
|
|
882
|
-
const createdAt = new Date(data.createdAt);
|
|
883
|
-
const updatedAt = new Date(data.updatedAt);
|
|
884
|
-
return {
|
|
885
|
-
...data,
|
|
886
|
-
createdAt,
|
|
887
|
-
updatedAt
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* Returns a schema by its id.
|
|
892
|
-
* @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`.
|
|
893
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
894
|
-
* @returns The schema with the given id.
|
|
895
|
-
*/
|
|
896
|
-
async getSchema(schemaId, options) {
|
|
897
|
-
const res = await this.#get(
|
|
898
|
-
url2`/v2/schemas/${schemaId}`,
|
|
899
|
-
void 0,
|
|
900
|
-
options
|
|
901
|
-
);
|
|
902
|
-
if (!res.ok) {
|
|
903
|
-
throw await LiveblocksError.from(res);
|
|
904
|
-
}
|
|
905
|
-
const data = await res.json();
|
|
906
|
-
const createdAt = new Date(data.createdAt);
|
|
907
|
-
const updatedAt = new Date(data.updatedAt);
|
|
908
|
-
return {
|
|
909
|
-
...data,
|
|
910
|
-
createdAt,
|
|
911
|
-
updatedAt
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
/**
|
|
915
|
-
* Updates the body for the schema. A schema can only be updated if it is not used by any room.
|
|
916
|
-
* @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`.
|
|
917
|
-
* @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).
|
|
918
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
919
|
-
* @returns The updated schema. The version of the schema will be incremented.
|
|
920
|
-
*/
|
|
921
|
-
async updateSchema(schemaId, body, options) {
|
|
922
|
-
const res = await this.#put(
|
|
923
|
-
url2`/v2/schemas/${schemaId}`,
|
|
924
|
-
{ body },
|
|
925
|
-
options
|
|
926
|
-
);
|
|
927
|
-
if (!res.ok) {
|
|
928
|
-
throw await LiveblocksError.from(res);
|
|
929
|
-
}
|
|
930
|
-
const data = await res.json();
|
|
931
|
-
const createdAt = new Date(data.createdAt);
|
|
932
|
-
const updatedAt = new Date(data.updatedAt);
|
|
933
|
-
return {
|
|
934
|
-
...data,
|
|
935
|
-
createdAt,
|
|
936
|
-
updatedAt
|
|
937
|
-
};
|
|
938
|
-
}
|
|
939
|
-
/**
|
|
940
|
-
* Deletes a schema by its id. A schema can only be deleted if it is not used by any room.
|
|
941
|
-
* @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`.
|
|
942
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
943
|
-
*/
|
|
944
|
-
async deleteSchema(schemaId, options) {
|
|
945
|
-
const res = await this.#delete(
|
|
946
|
-
url2`/v2/schemas/${schemaId}`,
|
|
947
|
-
void 0,
|
|
948
|
-
options
|
|
949
|
-
);
|
|
950
|
-
if (!res.ok) {
|
|
951
|
-
throw await LiveblocksError.from(res);
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
/**
|
|
955
|
-
* Returns the schema attached to a room.
|
|
956
|
-
* @param roomId The id of the room to get the schema from.
|
|
957
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
958
|
-
* @returns
|
|
959
|
-
*/
|
|
960
|
-
async getSchemaByRoomId(roomId, options) {
|
|
961
|
-
const res = await this.#get(
|
|
962
|
-
url2`/v2/rooms/${roomId}/schema`,
|
|
963
|
-
void 0,
|
|
964
|
-
options
|
|
965
|
-
);
|
|
966
|
-
if (!res.ok) {
|
|
967
|
-
throw await LiveblocksError.from(res);
|
|
968
|
-
}
|
|
969
|
-
const data = await res.json();
|
|
970
|
-
const createdAt = new Date(data.createdAt);
|
|
971
|
-
const updatedAt = new Date(data.updatedAt);
|
|
972
|
-
return {
|
|
973
|
-
...data,
|
|
974
|
-
createdAt,
|
|
975
|
-
updatedAt
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
/**
|
|
979
|
-
* Attaches a schema to a room, and instantly enables runtime schema validation for the room.
|
|
980
|
-
* 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.
|
|
981
|
-
* @param roomId The id of the room to attach the schema to.
|
|
982
|
-
* @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`.
|
|
983
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
984
|
-
* @returns The schema id as JSON.
|
|
985
|
-
*/
|
|
986
|
-
async attachSchemaToRoom(roomId, schemaId, options) {
|
|
987
|
-
const res = await this.#post(
|
|
988
|
-
url2`/v2/rooms/${roomId}/schema`,
|
|
989
|
-
{ schema: schemaId },
|
|
990
|
-
options
|
|
991
|
-
);
|
|
992
|
-
if (!res.ok) {
|
|
993
|
-
throw await LiveblocksError.from(res);
|
|
994
|
-
}
|
|
995
|
-
return await res.json();
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* Detaches a schema from a room, and disables runtime schema validation for the room.
|
|
999
|
-
* @param roomId The id of the room to detach the schema from.
|
|
1000
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1001
|
-
*/
|
|
1002
|
-
async detachSchemaFromRoom(roomId, options) {
|
|
1003
|
-
const res = await this.#delete(
|
|
1004
|
-
url2`/v2/rooms/${roomId}/schema`,
|
|
1005
|
-
void 0,
|
|
1006
|
-
options
|
|
1007
|
-
);
|
|
1008
|
-
if (!res.ok) {
|
|
1009
|
-
throw await LiveblocksError.from(res);
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
859
|
/* -------------------------------------------------------------------------------------------------
|
|
1013
860
|
* Comments
|
|
1014
861
|
* -----------------------------------------------------------------------------------------------*/
|