@liveblocks/core 3.11.1 → 3.12.1-enums1

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.cts CHANGED
@@ -331,16 +331,28 @@ type ContextualPromptContext = {
331
331
  afterSelection: string;
332
332
  };
333
333
 
334
- declare enum OpCode {
335
- INIT = 0,
336
- SET_PARENT_KEY = 1,
337
- CREATE_LIST = 2,
338
- UPDATE_OBJECT = 3,
339
- CREATE_OBJECT = 4,
340
- DELETE_CRDT = 5,
341
- DELETE_OBJECT_KEY = 6,
342
- CREATE_MAP = 7,
343
- CREATE_REGISTER = 8
334
+ type OpCode = (typeof OpCode)[keyof typeof OpCode];
335
+ declare const OpCode: Readonly<{
336
+ INIT: 0;
337
+ SET_PARENT_KEY: 1;
338
+ CREATE_LIST: 2;
339
+ UPDATE_OBJECT: 3;
340
+ CREATE_OBJECT: 4;
341
+ DELETE_CRDT: 5;
342
+ DELETE_OBJECT_KEY: 6;
343
+ CREATE_MAP: 7;
344
+ CREATE_REGISTER: 8;
345
+ }>;
346
+ declare namespace OpCode {
347
+ type INIT = typeof OpCode.INIT;
348
+ type SET_PARENT_KEY = typeof OpCode.SET_PARENT_KEY;
349
+ type CREATE_LIST = typeof OpCode.CREATE_LIST;
350
+ type UPDATE_OBJECT = typeof OpCode.UPDATE_OBJECT;
351
+ type CREATE_OBJECT = typeof OpCode.CREATE_OBJECT;
352
+ type DELETE_CRDT = typeof OpCode.DELETE_CRDT;
353
+ type DELETE_OBJECT_KEY = typeof OpCode.DELETE_OBJECT_KEY;
354
+ type CREATE_MAP = typeof OpCode.CREATE_MAP;
355
+ type CREATE_REGISTER = typeof OpCode.CREATE_REGISTER;
344
356
  }
345
357
  /**
346
358
  * These operations are the payload for {@link UpdateStorageServerMsg} messages
@@ -434,13 +446,22 @@ type DeleteObjectKeyOp = {
434
446
  readonly key: string;
435
447
  };
436
448
 
437
- declare enum ClientMsgCode {
438
- UPDATE_PRESENCE = 100,
439
- BROADCAST_EVENT = 103,
440
- FETCH_STORAGE = 200,
441
- UPDATE_STORAGE = 201,
442
- FETCH_YDOC = 300,
443
- UPDATE_YDOC = 301
449
+ type ClientMsgCode = (typeof ClientMsgCode)[keyof typeof ClientMsgCode];
450
+ declare const ClientMsgCode: Readonly<{
451
+ UPDATE_PRESENCE: 100;
452
+ BROADCAST_EVENT: 103;
453
+ FETCH_STORAGE: 200;
454
+ UPDATE_STORAGE: 201;
455
+ FETCH_YDOC: 300;
456
+ UPDATE_YDOC: 301;
457
+ }>;
458
+ declare namespace ClientMsgCode {
459
+ type UPDATE_PRESENCE = typeof ClientMsgCode.UPDATE_PRESENCE;
460
+ type BROADCAST_EVENT = typeof ClientMsgCode.BROADCAST_EVENT;
461
+ type FETCH_STORAGE = typeof ClientMsgCode.FETCH_STORAGE;
462
+ type UPDATE_STORAGE = typeof ClientMsgCode.UPDATE_STORAGE;
463
+ type FETCH_YDOC = typeof ClientMsgCode.FETCH_YDOC;
464
+ type UPDATE_YDOC = typeof ClientMsgCode.UPDATE_YDOC;
444
465
  }
445
466
  /**
446
467
  * Messages that can be sent from the client to the server.
@@ -573,11 +594,18 @@ type PlainLsonList = {
573
594
  type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
574
595
 
575
596
  type IdTuple<T> = [id: string, value: T];
576
- declare enum CrdtType {
577
- OBJECT = 0,
578
- LIST = 1,
579
- MAP = 2,
580
- REGISTER = 3
597
+ type CrdtType = (typeof CrdtType)[keyof typeof CrdtType];
598
+ declare const CrdtType: Readonly<{
599
+ OBJECT: 0;
600
+ LIST: 1;
601
+ MAP: 2;
602
+ REGISTER: 3;
603
+ }>;
604
+ declare namespace CrdtType {
605
+ type OBJECT = typeof CrdtType.OBJECT;
606
+ type LIST = typeof CrdtType.LIST;
607
+ type MAP = typeof CrdtType.MAP;
608
+ type REGISTER = typeof CrdtType.REGISTER;
581
609
  }
582
610
  type SerializedCrdt = SerializedRootObject | SerializedChild;
583
611
  type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
@@ -1516,6 +1544,7 @@ declare enum TextEditorType {
1516
1544
  TipTap = "tiptap",
1517
1545
  BlockNote = "blocknote"
1518
1546
  }
1547
+ type BadgeLocation = "top-right" | "bottom-right" | "bottom-left" | "top-left";
1519
1548
 
1520
1549
  type OptionalKeys<T> = {
1521
1550
  [K in keyof T]-?: undefined extends T[K] ? K : never;
@@ -2318,6 +2347,11 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
2318
2347
  * the server yet.
2319
2348
  */
2320
2349
  preventUnsavedChanges?: boolean;
2350
+ /**
2351
+ * The location where the brand badge should be displayed when using a free plan.
2352
+ * Default is "bottom-right".
2353
+ */
2354
+ badgeLocation?: BadgeLocation;
2321
2355
  } & Relax<{
2322
2356
  publicApiKey: string;
2323
2357
  } | {
@@ -2462,25 +2496,46 @@ type Delegates<T extends BaseAuthResult> = {
2462
2496
  canZombie: () => boolean;
2463
2497
  };
2464
2498
 
2465
- declare enum ServerMsgCode {
2466
- UPDATE_PRESENCE = 100,
2467
- USER_JOINED = 101,
2468
- USER_LEFT = 102,
2469
- BROADCASTED_EVENT = 103,
2470
- ROOM_STATE = 104,
2471
- INITIAL_STORAGE_STATE = 200,
2472
- UPDATE_STORAGE = 201,
2473
- UPDATE_YDOC = 300,
2474
- THREAD_CREATED = 400,
2475
- THREAD_DELETED = 407,
2476
- THREAD_METADATA_UPDATED = 401,
2477
- THREAD_UPDATED = 408,
2478
- COMMENT_CREATED = 402,
2479
- COMMENT_EDITED = 403,
2480
- COMMENT_DELETED = 404,
2481
- COMMENT_REACTION_ADDED = 405,
2482
- COMMENT_REACTION_REMOVED = 406,
2483
- REJECT_STORAGE_OP = 299
2499
+ type ServerMsgCode = (typeof ServerMsgCode)[keyof typeof ServerMsgCode];
2500
+ declare const ServerMsgCode: Readonly<{
2501
+ UPDATE_PRESENCE: 100;
2502
+ USER_JOINED: 101;
2503
+ USER_LEFT: 102;
2504
+ BROADCASTED_EVENT: 103;
2505
+ ROOM_STATE: 104;
2506
+ INITIAL_STORAGE_STATE: 200;
2507
+ UPDATE_STORAGE: 201;
2508
+ UPDATE_YDOC: 300;
2509
+ THREAD_CREATED: 400;
2510
+ THREAD_DELETED: 407;
2511
+ THREAD_METADATA_UPDATED: 401;
2512
+ THREAD_UPDATED: 408;
2513
+ COMMENT_CREATED: 402;
2514
+ COMMENT_EDITED: 403;
2515
+ COMMENT_DELETED: 404;
2516
+ COMMENT_REACTION_ADDED: 405;
2517
+ COMMENT_REACTION_REMOVED: 406;
2518
+ REJECT_STORAGE_OP: 299;
2519
+ }>;
2520
+ declare namespace ServerMsgCode {
2521
+ type UPDATE_PRESENCE = typeof ServerMsgCode.UPDATE_PRESENCE;
2522
+ type USER_JOINED = typeof ServerMsgCode.USER_JOINED;
2523
+ type USER_LEFT = typeof ServerMsgCode.USER_LEFT;
2524
+ type BROADCASTED_EVENT = typeof ServerMsgCode.BROADCASTED_EVENT;
2525
+ type ROOM_STATE = typeof ServerMsgCode.ROOM_STATE;
2526
+ type INITIAL_STORAGE_STATE = typeof ServerMsgCode.INITIAL_STORAGE_STATE;
2527
+ type UPDATE_STORAGE = typeof ServerMsgCode.UPDATE_STORAGE;
2528
+ type UPDATE_YDOC = typeof ServerMsgCode.UPDATE_YDOC;
2529
+ type THREAD_CREATED = typeof ServerMsgCode.THREAD_CREATED;
2530
+ type THREAD_DELETED = typeof ServerMsgCode.THREAD_DELETED;
2531
+ type THREAD_METADATA_UPDATED = typeof ServerMsgCode.THREAD_METADATA_UPDATED;
2532
+ type THREAD_UPDATED = typeof ServerMsgCode.THREAD_UPDATED;
2533
+ type COMMENT_CREATED = typeof ServerMsgCode.COMMENT_CREATED;
2534
+ type COMMENT_EDITED = typeof ServerMsgCode.COMMENT_EDITED;
2535
+ type COMMENT_DELETED = typeof ServerMsgCode.COMMENT_DELETED;
2536
+ type COMMENT_REACTION_ADDED = typeof ServerMsgCode.COMMENT_REACTION_ADDED;
2537
+ type COMMENT_REACTION_REMOVED = typeof ServerMsgCode.COMMENT_REACTION_REMOVED;
2538
+ type REJECT_STORAGE_OP = typeof ServerMsgCode.REJECT_STORAGE_OP;
2484
2539
  }
2485
2540
  /**
2486
2541
  * Messages that can be sent from the server to the client.
@@ -2669,6 +2724,10 @@ type RoomStateServerMsg<U extends BaseUserMeta> = {
2669
2724
  scopes: string[];
2670
2725
  };
2671
2726
  };
2727
+ /**
2728
+ * Metadata sent from the server to the client.
2729
+ */
2730
+ readonly meta: JsonObject;
2672
2731
  };
2673
2732
  /**
2674
2733
  * Sent by the WebSocket server to a single client in response to the client
@@ -3554,6 +3613,7 @@ type DynamicSessionInfo = {
3554
3613
  readonly actor: number;
3555
3614
  readonly nonce: string;
3556
3615
  readonly scopes: string[];
3616
+ readonly meta: JsonObject;
3557
3617
  };
3558
3618
  type Polyfills = {
3559
3619
  atob?: (data: string) => string;
package/dist/index.d.ts CHANGED
@@ -331,16 +331,28 @@ type ContextualPromptContext = {
331
331
  afterSelection: string;
332
332
  };
333
333
 
334
- declare enum OpCode {
335
- INIT = 0,
336
- SET_PARENT_KEY = 1,
337
- CREATE_LIST = 2,
338
- UPDATE_OBJECT = 3,
339
- CREATE_OBJECT = 4,
340
- DELETE_CRDT = 5,
341
- DELETE_OBJECT_KEY = 6,
342
- CREATE_MAP = 7,
343
- CREATE_REGISTER = 8
334
+ type OpCode = (typeof OpCode)[keyof typeof OpCode];
335
+ declare const OpCode: Readonly<{
336
+ INIT: 0;
337
+ SET_PARENT_KEY: 1;
338
+ CREATE_LIST: 2;
339
+ UPDATE_OBJECT: 3;
340
+ CREATE_OBJECT: 4;
341
+ DELETE_CRDT: 5;
342
+ DELETE_OBJECT_KEY: 6;
343
+ CREATE_MAP: 7;
344
+ CREATE_REGISTER: 8;
345
+ }>;
346
+ declare namespace OpCode {
347
+ type INIT = typeof OpCode.INIT;
348
+ type SET_PARENT_KEY = typeof OpCode.SET_PARENT_KEY;
349
+ type CREATE_LIST = typeof OpCode.CREATE_LIST;
350
+ type UPDATE_OBJECT = typeof OpCode.UPDATE_OBJECT;
351
+ type CREATE_OBJECT = typeof OpCode.CREATE_OBJECT;
352
+ type DELETE_CRDT = typeof OpCode.DELETE_CRDT;
353
+ type DELETE_OBJECT_KEY = typeof OpCode.DELETE_OBJECT_KEY;
354
+ type CREATE_MAP = typeof OpCode.CREATE_MAP;
355
+ type CREATE_REGISTER = typeof OpCode.CREATE_REGISTER;
344
356
  }
345
357
  /**
346
358
  * These operations are the payload for {@link UpdateStorageServerMsg} messages
@@ -434,13 +446,22 @@ type DeleteObjectKeyOp = {
434
446
  readonly key: string;
435
447
  };
436
448
 
437
- declare enum ClientMsgCode {
438
- UPDATE_PRESENCE = 100,
439
- BROADCAST_EVENT = 103,
440
- FETCH_STORAGE = 200,
441
- UPDATE_STORAGE = 201,
442
- FETCH_YDOC = 300,
443
- UPDATE_YDOC = 301
449
+ type ClientMsgCode = (typeof ClientMsgCode)[keyof typeof ClientMsgCode];
450
+ declare const ClientMsgCode: Readonly<{
451
+ UPDATE_PRESENCE: 100;
452
+ BROADCAST_EVENT: 103;
453
+ FETCH_STORAGE: 200;
454
+ UPDATE_STORAGE: 201;
455
+ FETCH_YDOC: 300;
456
+ UPDATE_YDOC: 301;
457
+ }>;
458
+ declare namespace ClientMsgCode {
459
+ type UPDATE_PRESENCE = typeof ClientMsgCode.UPDATE_PRESENCE;
460
+ type BROADCAST_EVENT = typeof ClientMsgCode.BROADCAST_EVENT;
461
+ type FETCH_STORAGE = typeof ClientMsgCode.FETCH_STORAGE;
462
+ type UPDATE_STORAGE = typeof ClientMsgCode.UPDATE_STORAGE;
463
+ type FETCH_YDOC = typeof ClientMsgCode.FETCH_YDOC;
464
+ type UPDATE_YDOC = typeof ClientMsgCode.UPDATE_YDOC;
444
465
  }
445
466
  /**
446
467
  * Messages that can be sent from the client to the server.
@@ -573,11 +594,18 @@ type PlainLsonList = {
573
594
  type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
574
595
 
575
596
  type IdTuple<T> = [id: string, value: T];
576
- declare enum CrdtType {
577
- OBJECT = 0,
578
- LIST = 1,
579
- MAP = 2,
580
- REGISTER = 3
597
+ type CrdtType = (typeof CrdtType)[keyof typeof CrdtType];
598
+ declare const CrdtType: Readonly<{
599
+ OBJECT: 0;
600
+ LIST: 1;
601
+ MAP: 2;
602
+ REGISTER: 3;
603
+ }>;
604
+ declare namespace CrdtType {
605
+ type OBJECT = typeof CrdtType.OBJECT;
606
+ type LIST = typeof CrdtType.LIST;
607
+ type MAP = typeof CrdtType.MAP;
608
+ type REGISTER = typeof CrdtType.REGISTER;
581
609
  }
582
610
  type SerializedCrdt = SerializedRootObject | SerializedChild;
583
611
  type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
@@ -1516,6 +1544,7 @@ declare enum TextEditorType {
1516
1544
  TipTap = "tiptap",
1517
1545
  BlockNote = "blocknote"
1518
1546
  }
1547
+ type BadgeLocation = "top-right" | "bottom-right" | "bottom-left" | "top-left";
1519
1548
 
1520
1549
  type OptionalKeys<T> = {
1521
1550
  [K in keyof T]-?: undefined extends T[K] ? K : never;
@@ -2318,6 +2347,11 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
2318
2347
  * the server yet.
2319
2348
  */
2320
2349
  preventUnsavedChanges?: boolean;
2350
+ /**
2351
+ * The location where the brand badge should be displayed when using a free plan.
2352
+ * Default is "bottom-right".
2353
+ */
2354
+ badgeLocation?: BadgeLocation;
2321
2355
  } & Relax<{
2322
2356
  publicApiKey: string;
2323
2357
  } | {
@@ -2462,25 +2496,46 @@ type Delegates<T extends BaseAuthResult> = {
2462
2496
  canZombie: () => boolean;
2463
2497
  };
2464
2498
 
2465
- declare enum ServerMsgCode {
2466
- UPDATE_PRESENCE = 100,
2467
- USER_JOINED = 101,
2468
- USER_LEFT = 102,
2469
- BROADCASTED_EVENT = 103,
2470
- ROOM_STATE = 104,
2471
- INITIAL_STORAGE_STATE = 200,
2472
- UPDATE_STORAGE = 201,
2473
- UPDATE_YDOC = 300,
2474
- THREAD_CREATED = 400,
2475
- THREAD_DELETED = 407,
2476
- THREAD_METADATA_UPDATED = 401,
2477
- THREAD_UPDATED = 408,
2478
- COMMENT_CREATED = 402,
2479
- COMMENT_EDITED = 403,
2480
- COMMENT_DELETED = 404,
2481
- COMMENT_REACTION_ADDED = 405,
2482
- COMMENT_REACTION_REMOVED = 406,
2483
- REJECT_STORAGE_OP = 299
2499
+ type ServerMsgCode = (typeof ServerMsgCode)[keyof typeof ServerMsgCode];
2500
+ declare const ServerMsgCode: Readonly<{
2501
+ UPDATE_PRESENCE: 100;
2502
+ USER_JOINED: 101;
2503
+ USER_LEFT: 102;
2504
+ BROADCASTED_EVENT: 103;
2505
+ ROOM_STATE: 104;
2506
+ INITIAL_STORAGE_STATE: 200;
2507
+ UPDATE_STORAGE: 201;
2508
+ UPDATE_YDOC: 300;
2509
+ THREAD_CREATED: 400;
2510
+ THREAD_DELETED: 407;
2511
+ THREAD_METADATA_UPDATED: 401;
2512
+ THREAD_UPDATED: 408;
2513
+ COMMENT_CREATED: 402;
2514
+ COMMENT_EDITED: 403;
2515
+ COMMENT_DELETED: 404;
2516
+ COMMENT_REACTION_ADDED: 405;
2517
+ COMMENT_REACTION_REMOVED: 406;
2518
+ REJECT_STORAGE_OP: 299;
2519
+ }>;
2520
+ declare namespace ServerMsgCode {
2521
+ type UPDATE_PRESENCE = typeof ServerMsgCode.UPDATE_PRESENCE;
2522
+ type USER_JOINED = typeof ServerMsgCode.USER_JOINED;
2523
+ type USER_LEFT = typeof ServerMsgCode.USER_LEFT;
2524
+ type BROADCASTED_EVENT = typeof ServerMsgCode.BROADCASTED_EVENT;
2525
+ type ROOM_STATE = typeof ServerMsgCode.ROOM_STATE;
2526
+ type INITIAL_STORAGE_STATE = typeof ServerMsgCode.INITIAL_STORAGE_STATE;
2527
+ type UPDATE_STORAGE = typeof ServerMsgCode.UPDATE_STORAGE;
2528
+ type UPDATE_YDOC = typeof ServerMsgCode.UPDATE_YDOC;
2529
+ type THREAD_CREATED = typeof ServerMsgCode.THREAD_CREATED;
2530
+ type THREAD_DELETED = typeof ServerMsgCode.THREAD_DELETED;
2531
+ type THREAD_METADATA_UPDATED = typeof ServerMsgCode.THREAD_METADATA_UPDATED;
2532
+ type THREAD_UPDATED = typeof ServerMsgCode.THREAD_UPDATED;
2533
+ type COMMENT_CREATED = typeof ServerMsgCode.COMMENT_CREATED;
2534
+ type COMMENT_EDITED = typeof ServerMsgCode.COMMENT_EDITED;
2535
+ type COMMENT_DELETED = typeof ServerMsgCode.COMMENT_DELETED;
2536
+ type COMMENT_REACTION_ADDED = typeof ServerMsgCode.COMMENT_REACTION_ADDED;
2537
+ type COMMENT_REACTION_REMOVED = typeof ServerMsgCode.COMMENT_REACTION_REMOVED;
2538
+ type REJECT_STORAGE_OP = typeof ServerMsgCode.REJECT_STORAGE_OP;
2484
2539
  }
2485
2540
  /**
2486
2541
  * Messages that can be sent from the server to the client.
@@ -2669,6 +2724,10 @@ type RoomStateServerMsg<U extends BaseUserMeta> = {
2669
2724
  scopes: string[];
2670
2725
  };
2671
2726
  };
2727
+ /**
2728
+ * Metadata sent from the server to the client.
2729
+ */
2730
+ readonly meta: JsonObject;
2672
2731
  };
2673
2732
  /**
2674
2733
  * Sent by the WebSocket server to a single client in response to the client
@@ -3554,6 +3613,7 @@ type DynamicSessionInfo = {
3554
3613
  readonly actor: number;
3555
3614
  readonly nonce: string;
3556
3615
  readonly scopes: string[];
3616
+ readonly meta: JsonObject;
3557
3617
  };
3558
3618
  type Polyfills = {
3559
3619
  atob?: (data: string) => string;