@yorkie-js/sdk 0.6.40 → 0.6.41-rc2

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.
@@ -1,15 +1,8 @@
1
- import { BinaryReadOptions } from '@bufbuild/protobuf';
2
1
  import { default as default_2 } from 'long';
3
- import { FieldList } from '@bufbuild/protobuf';
4
- import { JsonReadOptions } from '@bufbuild/protobuf';
5
- import { JsonValue } from '@bufbuild/protobuf';
6
2
  import { default as Long_2 } from 'long';
7
3
  import { Message } from '@bufbuild/protobuf';
8
- import { PartialMessage } from '@bufbuild/protobuf';
9
- import { PlainMessage } from '@bufbuild/protobuf';
10
- import { proto3 } from '@bufbuild/protobuf';
11
4
  import { Rule } from '@yorkie-js/schema';
12
- import { Timestamp } from '@bufbuild/protobuf';
5
+ import { Timestamp } from '@bufbuild/protobuf/wkt';
13
6
 
14
7
  /**
15
8
  * `ActorID` is used to identify who is making changes to the document.
@@ -308,7 +301,7 @@ export declare class Change<P extends Indexable> {
308
301
  /**
309
302
  * @generated from message yorkie.v1.Change
310
303
  */
311
- declare class Change_2 extends Message<Change_2> {
304
+ declare type Change_2 = Message<"yorkie.v1.Change"> & {
312
305
  /**
313
306
  * @generated from field: yorkie.v1.ChangeID id = 1;
314
307
  */
@@ -325,15 +318,7 @@ declare class Change_2 extends Message<Change_2> {
325
318
  * @generated from field: yorkie.v1.PresenceChange presence_change = 4;
326
319
  */
327
320
  presenceChange?: PresenceChange_2;
328
- constructor(data?: PartialMessage<Change_2>);
329
- static readonly runtime: typeof proto3;
330
- static readonly typeName = "yorkie.v1.Change";
331
- static readonly fields: FieldList;
332
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Change_2;
333
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Change_2;
334
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Change_2;
335
- static equals(a: Change_2 | PlainMessage<Change_2> | undefined, b: Change_2 | PlainMessage<Change_2> | undefined): boolean;
336
- }
321
+ };
337
322
 
338
323
  /**
339
324
  * `ChangeContext` is used to record the context of modification when editing
@@ -506,7 +491,7 @@ declare class ChangeID {
506
491
  /**
507
492
  * @generated from message yorkie.v1.ChangeID
508
493
  */
509
- declare class ChangeID_2 extends Message<ChangeID_2> {
494
+ declare type ChangeID_2 = Message<"yorkie.v1.ChangeID"> & {
510
495
  /**
511
496
  * @generated from field: uint32 client_seq = 1;
512
497
  */
@@ -527,15 +512,7 @@ declare class ChangeID_2 extends Message<ChangeID_2> {
527
512
  * @generated from field: yorkie.v1.VersionVector version_vector = 5;
528
513
  */
529
514
  versionVector?: VersionVector_2;
530
- constructor(data?: PartialMessage<ChangeID_2>);
531
- static readonly runtime: typeof proto3;
532
- static readonly typeName = "yorkie.v1.ChangeID";
533
- static readonly fields: FieldList;
534
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ChangeID_2;
535
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ChangeID_2;
536
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ChangeID_2;
537
- static equals(a: ChangeID_2 | PlainMessage<ChangeID_2> | undefined, b: ChangeID_2 | PlainMessage<ChangeID_2> | undefined): boolean;
538
- }
515
+ };
539
516
 
540
517
  /**
541
518
  * `ChangeInfo` represents the modifications made during a document update
@@ -636,7 +613,7 @@ declare class ChangePack<P extends Indexable> {
636
613
  *
637
614
  * @generated from message yorkie.v1.ChangePack
638
615
  */
639
- declare class ChangePack_2 extends Message<ChangePack_2> {
616
+ declare type ChangePack_2 = Message<"yorkie.v1.ChangePack"> & {
640
617
  /**
641
618
  * @generated from field: string document_key = 1;
642
619
  */
@@ -667,15 +644,7 @@ declare class ChangePack_2 extends Message<ChangePack_2> {
667
644
  * @generated from field: yorkie.v1.VersionVector version_vector = 7;
668
645
  */
669
646
  versionVector?: VersionVector_2;
670
- constructor(data?: PartialMessage<ChangePack_2>);
671
- static readonly runtime: typeof proto3;
672
- static readonly typeName = "yorkie.v1.ChangePack";
673
- static readonly fields: FieldList;
674
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ChangePack_2;
675
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ChangePack_2;
676
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ChangePack_2;
677
- static equals(a: ChangePack_2 | PlainMessage<ChangePack_2> | undefined, b: ChangePack_2 | PlainMessage<ChangePack_2> | undefined): boolean;
678
- }
647
+ };
679
648
 
680
649
  /**
681
650
  * `ChangeStruct` represents the structure of Change.
@@ -926,7 +895,7 @@ declare class Checkpoint {
926
895
  /**
927
896
  * @generated from message yorkie.v1.Checkpoint
928
897
  */
929
- declare class Checkpoint_2 extends Message<Checkpoint_2> {
898
+ declare type Checkpoint_2 = Message<"yorkie.v1.Checkpoint"> & {
930
899
  /**
931
900
  * @generated from field: int64 server_seq = 1;
932
901
  */
@@ -935,15 +904,7 @@ declare class Checkpoint_2 extends Message<Checkpoint_2> {
935
904
  * @generated from field: uint32 client_seq = 2;
936
905
  */
937
906
  clientSeq: number;
938
- constructor(data?: PartialMessage<Checkpoint_2>);
939
- static readonly runtime: typeof proto3;
940
- static readonly typeName = "yorkie.v1.Checkpoint";
941
- static readonly fields: FieldList;
942
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Checkpoint_2;
943
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Checkpoint_2;
944
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Checkpoint_2;
945
- static equals(a: Checkpoint_2 | PlainMessage<Checkpoint_2> | undefined, b: Checkpoint_2 | PlainMessage<Checkpoint_2> | undefined): boolean;
946
- }
907
+ };
947
908
 
948
909
  /**
949
910
  * `Client` is a normal client that can communicate with the server.
@@ -1096,6 +1057,10 @@ export declare class Client {
1096
1057
  offset?: number;
1097
1058
  isForward?: boolean;
1098
1059
  }): Promise<Array<RevisionSummary>>;
1060
+ /**
1061
+ * `getRevision` retrieves a specific revision by its ID with full snapshot data.
1062
+ */
1063
+ getRevision<R, P extends Indexable>(doc: Document_2<R, P>, revisionID: string): Promise<RevisionSummary>;
1099
1064
  /**
1100
1065
  * `restoreRevision` restores the document to the given revision.
1101
1066
  */
@@ -1285,13 +1250,14 @@ export declare const converter: {
1285
1250
  toUint8Array: typeof toUint8Array;
1286
1251
  toOperation: typeof toOperation;
1287
1252
  toChangeID: typeof toChangeID;
1288
- PbChangeID: typeof ChangeID_2;
1289
1253
  bytesToChangeID: typeof bytesToChangeID;
1290
1254
  bytesToOperation: typeof bytesToOperation;
1291
1255
  versionVectorToHex: typeof versionVectorToHex;
1292
1256
  hexToVersionVector: typeof hexToVersionVector;
1293
1257
  fromSchemaRules: typeof fromSchemaRules;
1294
1258
  toRevisionSummary: typeof toRevisionSummary;
1259
+ changeIDToBinary: (changeID: ChangeID) => Uint8Array<ArrayBuffer>;
1260
+ operationToBinary: (op: Operation) => Uint8Array<ArrayBuffer>;
1295
1261
  };
1296
1262
 
1297
1263
  /**
@@ -2362,8 +2328,10 @@ declare const _default: {
2362
2328
  Text: typeof Text_2;
2363
2329
  Counter: typeof Counter;
2364
2330
  Tree: typeof Tree;
2331
+ Devtools: typeof Devtools;
2365
2332
  Channel: typeof Channel;
2366
2333
  ChannelEventType: typeof ChannelEventType;
2334
+ YSON: typeof YSON;
2367
2335
  LogLevel: typeof LogLevel;
2368
2336
  setLogLevel: typeof setLogLevel;
2369
2337
  IntType: CounterType;
@@ -2420,7 +2388,7 @@ declare type DocEvent_2<P extends Indexable_2 = Indexable_2, T = OpInfo_2> =
2420
2388
  /**
2421
2389
  * @generated from message yorkie.v1.DocEvent
2422
2390
  */
2423
- declare class DocEvent_3 extends Message<DocEvent_3> {
2391
+ declare type DocEvent_3 = Message<"yorkie.v1.DocEvent"> & {
2424
2392
  /**
2425
2393
  * @generated from field: yorkie.v1.DocEventType type = 1;
2426
2394
  */
@@ -2433,20 +2401,12 @@ declare class DocEvent_3 extends Message<DocEvent_3> {
2433
2401
  * @generated from field: yorkie.v1.DocEventBody body = 3;
2434
2402
  */
2435
2403
  body?: DocEventBody;
2436
- constructor(data?: PartialMessage<DocEvent_3>);
2437
- static readonly runtime: typeof proto3;
2438
- static readonly typeName = "yorkie.v1.DocEvent";
2439
- static readonly fields: FieldList;
2440
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DocEvent_3;
2441
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DocEvent_3;
2442
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DocEvent_3;
2443
- static equals(a: DocEvent_3 | PlainMessage<DocEvent_3> | undefined, b: DocEvent_3 | PlainMessage<DocEvent_3> | undefined): boolean;
2444
- }
2404
+ };
2445
2405
 
2446
2406
  /**
2447
2407
  * @generated from message yorkie.v1.DocEventBody
2448
2408
  */
2449
- declare class DocEventBody extends Message<DocEventBody> {
2409
+ declare type DocEventBody = Message<"yorkie.v1.DocEventBody"> & {
2450
2410
  /**
2451
2411
  * @generated from field: string topic = 1;
2452
2412
  */
@@ -2455,15 +2415,7 @@ declare class DocEventBody extends Message<DocEventBody> {
2455
2415
  * @generated from field: bytes payload = 2;
2456
2416
  */
2457
2417
  payload: Uint8Array;
2458
- constructor(data?: PartialMessage<DocEventBody>);
2459
- static readonly runtime: typeof proto3;
2460
- static readonly typeName = "yorkie.v1.DocEventBody";
2461
- static readonly fields: FieldList;
2462
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): DocEventBody;
2463
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): DocEventBody;
2464
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DocEventBody;
2465
- static equals(a: DocEventBody | PlainMessage<DocEventBody> | undefined, b: DocEventBody | PlainMessage<DocEventBody> | undefined): boolean;
2466
- }
2418
+ };
2467
2419
 
2468
2420
  declare type DocEventCallbackMap<P extends Indexable> = {
2469
2421
  default: NextFn<LocalChangeEvent<OpInfo, P> | RemoteChangeEvent<OpInfo, P> | SnapshotEvent>;
@@ -2872,7 +2824,7 @@ declare class Document_2<R, P extends Indexable = Indexable> implements Attachab
2872
2824
  */
2873
2825
  getClone(): {
2874
2826
  root: CRDTRoot;
2875
- presences: Map<string, P>;
2827
+ presences: Map<ActorID, P>;
2876
2828
  } | undefined;
2877
2829
  /**
2878
2830
  * `getCloneRoot` returns clone object.
@@ -3025,7 +2977,7 @@ declare class Document_2<R, P extends Indexable = Indexable> implements Attachab
3025
2977
  * `getOthersForTest` returns all the other clients in online, sorted by clientID.
3026
2978
  */
3027
2979
  getOthersForTest(): {
3028
- clientID: string;
2980
+ clientID: ActorID;
3029
2981
  presence: P;
3030
2982
  }[];
3031
2983
  /**
@@ -3548,6 +3500,42 @@ declare interface InitializedEvent_2<P extends Indexable_2> extends BaseDocEvent
3548
3500
  value: Array<{ clientID: ActorID_2; presence: P }>;
3549
3501
  }
3550
3502
 
3503
+ /**
3504
+ * `isBinData` checks if a value is a YSONBinData object.
3505
+ */
3506
+ declare function isBinData(value: any): value is YSONBinData {
3507
+ return (
3508
+ typeof value === 'object' &&
3509
+ value !== null &&
3510
+ value.type === 'BinData' &&
3511
+ typeof value.value === 'string'
3512
+ );
3513
+ }
3514
+
3515
+ /**
3516
+ * `isCounter` checks if a value is a YSONCounter object.
3517
+ */
3518
+ declare function isCounter(value: any): value is YSONCounter {
3519
+ return (
3520
+ typeof value === 'object' &&
3521
+ value !== null &&
3522
+ value.type === 'Counter' &&
3523
+ typeof value.value === 'object'
3524
+ );
3525
+ }
3526
+
3527
+ /**
3528
+ * `isDate` checks if a value is a YSONDate object.
3529
+ */
3530
+ declare function isDate(value: any): value is YSONDate {
3531
+ return (
3532
+ typeof value === 'object' &&
3533
+ value !== null &&
3534
+ value.type === 'Date' &&
3535
+ typeof value.value === 'string'
3536
+ );
3537
+ }
3538
+
3551
3539
  /**
3552
3540
  * `isDocEventForReplay` checks if an event can be used to replay a document.
3553
3541
  */
@@ -3577,6 +3565,72 @@ events: Array<DocEvent_2>,
3577
3565
  return events.every(isDocEventForReplay);
3578
3566
  }
3579
3567
 
3568
+ /**
3569
+ * `isInt` checks if a value is a YSONInt object.
3570
+ */
3571
+ declare function isInt(value: any): value is YSONInt {
3572
+ return (
3573
+ typeof value === 'object' &&
3574
+ value !== null &&
3575
+ value.type === 'Int' &&
3576
+ typeof value.value === 'number'
3577
+ );
3578
+ }
3579
+
3580
+ /**
3581
+ * `isLong` checks if a value is a YSONLong object.
3582
+ */
3583
+ declare function isLong(value: any): value is YSONLong {
3584
+ return (
3585
+ typeof value === 'object' &&
3586
+ value !== null &&
3587
+ value.type === 'Long' &&
3588
+ typeof value.value === 'number'
3589
+ );
3590
+ }
3591
+
3592
+ /**
3593
+ * `isObject` checks if a value is a plain YSON object (not a special type).
3594
+ */
3595
+ declare function isObject(value: any): value is { [key: string]: YSONValue } {
3596
+ return (
3597
+ typeof value === 'object' &&
3598
+ value !== null &&
3599
+ !Array.isArray(value) &&
3600
+ !isText(value) &&
3601
+ !isTree(value) &&
3602
+ !isInt(value) &&
3603
+ !isLong(value) &&
3604
+ !isDate(value) &&
3605
+ !isBinData(value) &&
3606
+ !isCounter(value)
3607
+ );
3608
+ }
3609
+
3610
+ /**
3611
+ * `isText` checks if a value is a YSONText object.
3612
+ */
3613
+ declare function isText(value: any): value is YSONText {
3614
+ return (
3615
+ typeof value === 'object' &&
3616
+ value !== null &&
3617
+ value.type === 'Text' &&
3618
+ Array.isArray(value.nodes)
3619
+ );
3620
+ }
3621
+
3622
+ /**
3623
+ * `isTree` checks if a value is a YSONTree object.
3624
+ */
3625
+ declare function isTree(value: any): value is YSONTree {
3626
+ return (
3627
+ typeof value === 'object' &&
3628
+ value !== null &&
3629
+ value.type === 'Tree' &&
3630
+ typeof value.root === 'object'
3631
+ );
3632
+ }
3633
+
3580
3634
  /**
3581
3635
  * `Json` represents the JSON data type. It is used to represent the data
3582
3636
  * structure of the document.
@@ -3688,7 +3742,7 @@ declare type JSONElement_2 = {
3688
3742
  /**
3689
3743
  * @generated from message yorkie.v1.JSONElementSimple
3690
3744
  */
3691
- declare class JSONElementSimple extends Message<JSONElementSimple> {
3745
+ declare type JSONElementSimple = Message<"yorkie.v1.JSONElementSimple"> & {
3692
3746
  /**
3693
3747
  * @generated from field: yorkie.v1.TimeTicket created_at = 1;
3694
3748
  */
@@ -3709,15 +3763,7 @@ declare class JSONElementSimple extends Message<JSONElementSimple> {
3709
3763
  * @generated from field: bytes value = 5;
3710
3764
  */
3711
3765
  value: Uint8Array;
3712
- constructor(data?: PartialMessage<JSONElementSimple>);
3713
- static readonly runtime: typeof proto3;
3714
- static readonly typeName = "yorkie.v1.JSONElementSimple";
3715
- static readonly fields: FieldList;
3716
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): JSONElementSimple;
3717
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): JSONElementSimple;
3718
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): JSONElementSimple;
3719
- static equals(a: JSONElementSimple | PlainMessage<JSONElementSimple> | undefined, b: JSONElementSimple | PlainMessage<JSONElementSimple> | undefined): boolean;
3720
- }
3766
+ };
3721
3767
 
3722
3768
  declare type JSONElementType =
3723
3769
  | 'YORKIE_PRIMITIVE'
@@ -3880,8 +3926,10 @@ export declare interface LocalChangeEvent<T = OpInfo, P extends Indexable = Inde
3880
3926
  * `LocalChangeEvent` is an event that occurs when the document is changed
3881
3927
  * by local changes.
3882
3928
  */
3883
- declare interface LocalChangeEvent_2<T = OpInfo_2, P extends Indexable_2 = Indexable_2>
3884
- extends BaseDocEvent {
3929
+ declare interface LocalChangeEvent_2<
3930
+ T = OpInfo_2,
3931
+ P extends Indexable_2 = Indexable_2,
3932
+ > extends BaseDocEvent {
3885
3933
  type: DocEventType_2.LocalChange;
3886
3934
  source: OpSource_2.Local | OpSource_2.UndoRedo;
3887
3935
  value: ChangeInfo_2<T>;
@@ -3922,7 +3970,7 @@ export declare type NextFn<T> = (value: T) => void;
3922
3970
  /**
3923
3971
  * @generated from message yorkie.v1.NodeAttr
3924
3972
  */
3925
- declare class NodeAttr extends Message<NodeAttr> {
3973
+ declare type NodeAttr = Message<"yorkie.v1.NodeAttr"> & {
3926
3974
  /**
3927
3975
  * @generated from field: string value = 1;
3928
3976
  */
@@ -3935,15 +3983,7 @@ declare class NodeAttr extends Message<NodeAttr> {
3935
3983
  * @generated from field: bool is_removed = 3;
3936
3984
  */
3937
3985
  isRemoved: boolean;
3938
- constructor(data?: PartialMessage<NodeAttr>);
3939
- static readonly runtime: typeof proto3;
3940
- static readonly typeName = "yorkie.v1.NodeAttr";
3941
- static readonly fields: FieldList;
3942
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): NodeAttr;
3943
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): NodeAttr;
3944
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): NodeAttr;
3945
- static equals(a: NodeAttr | PlainMessage<NodeAttr> | undefined, b: NodeAttr | PlainMessage<NodeAttr> | undefined): boolean;
3946
- }
3986
+ };
3947
3987
 
3948
3988
  /**
3949
3989
  * `ObjectOpInfo` represents the OperationInfo for the JSONObject.
@@ -4049,7 +4089,7 @@ declare abstract class Operation {
4049
4089
  /**
4050
4090
  * @generated from message yorkie.v1.Operation
4051
4091
  */
4052
- declare class Operation_2 extends Message<Operation_2> {
4092
+ declare type Operation_2 = Message<"yorkie.v1.Operation"> & {
4053
4093
  /**
4054
4094
  * @generated from oneof yorkie.v1.Operation.body
4055
4095
  */
@@ -4117,20 +4157,12 @@ declare class Operation_2 extends Message<Operation_2> {
4117
4157
  case: undefined;
4118
4158
  value?: undefined;
4119
4159
  };
4120
- constructor(data?: PartialMessage<Operation_2>);
4121
- static readonly runtime: typeof proto3;
4122
- static readonly typeName = "yorkie.v1.Operation";
4123
- static readonly fields: FieldList;
4124
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_2;
4125
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_2;
4126
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_2;
4127
- static equals(a: Operation_2 | PlainMessage<Operation_2> | undefined, b: Operation_2 | PlainMessage<Operation_2> | undefined): boolean;
4128
- }
4160
+ };
4129
4161
 
4130
4162
  /**
4131
4163
  * @generated from message yorkie.v1.Operation.Add
4132
4164
  */
4133
- declare class Operation_Add extends Message<Operation_Add> {
4165
+ declare type Operation_Add = Message<"yorkie.v1.Operation.Add"> & {
4134
4166
  /**
4135
4167
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4136
4168
  */
@@ -4147,20 +4179,12 @@ declare class Operation_Add extends Message<Operation_Add> {
4147
4179
  * @generated from field: yorkie.v1.TimeTicket executed_at = 4;
4148
4180
  */
4149
4181
  executedAt?: TimeTicket_2;
4150
- constructor(data?: PartialMessage<Operation_Add>);
4151
- static readonly runtime: typeof proto3;
4152
- static readonly typeName = "yorkie.v1.Operation.Add";
4153
- static readonly fields: FieldList;
4154
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_Add;
4155
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_Add;
4156
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_Add;
4157
- static equals(a: Operation_Add | PlainMessage<Operation_Add> | undefined, b: Operation_Add | PlainMessage<Operation_Add> | undefined): boolean;
4158
- }
4182
+ };
4159
4183
 
4160
4184
  /**
4161
4185
  * @generated from message yorkie.v1.Operation.ArraySet
4162
4186
  */
4163
- declare class Operation_ArraySet extends Message<Operation_ArraySet> {
4187
+ declare type Operation_ArraySet = Message<"yorkie.v1.Operation.ArraySet"> & {
4164
4188
  /**
4165
4189
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4166
4190
  */
@@ -4177,20 +4201,12 @@ declare class Operation_ArraySet extends Message<Operation_ArraySet> {
4177
4201
  * @generated from field: yorkie.v1.TimeTicket executed_at = 4;
4178
4202
  */
4179
4203
  executedAt?: TimeTicket_2;
4180
- constructor(data?: PartialMessage<Operation_ArraySet>);
4181
- static readonly runtime: typeof proto3;
4182
- static readonly typeName = "yorkie.v1.Operation.ArraySet";
4183
- static readonly fields: FieldList;
4184
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_ArraySet;
4185
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_ArraySet;
4186
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_ArraySet;
4187
- static equals(a: Operation_ArraySet | PlainMessage<Operation_ArraySet> | undefined, b: Operation_ArraySet | PlainMessage<Operation_ArraySet> | undefined): boolean;
4188
- }
4204
+ };
4189
4205
 
4190
4206
  /**
4191
4207
  * @generated from message yorkie.v1.Operation.Edit
4192
4208
  */
4193
- declare class Operation_Edit extends Message<Operation_Edit> {
4209
+ declare type Operation_Edit = Message<"yorkie.v1.Operation.Edit"> & {
4194
4210
  /**
4195
4211
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4196
4212
  */
@@ -4225,20 +4241,12 @@ declare class Operation_Edit extends Message<Operation_Edit> {
4225
4241
  attributes: {
4226
4242
  [key: string]: string;
4227
4243
  };
4228
- constructor(data?: PartialMessage<Operation_Edit>);
4229
- static readonly runtime: typeof proto3;
4230
- static readonly typeName = "yorkie.v1.Operation.Edit";
4231
- static readonly fields: FieldList;
4232
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_Edit;
4233
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_Edit;
4234
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_Edit;
4235
- static equals(a: Operation_Edit | PlainMessage<Operation_Edit> | undefined, b: Operation_Edit | PlainMessage<Operation_Edit> | undefined): boolean;
4236
- }
4244
+ };
4237
4245
 
4238
4246
  /**
4239
4247
  * @generated from message yorkie.v1.Operation.Increase
4240
4248
  */
4241
- declare class Operation_Increase extends Message<Operation_Increase> {
4249
+ declare type Operation_Increase = Message<"yorkie.v1.Operation.Increase"> & {
4242
4250
  /**
4243
4251
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4244
4252
  */
@@ -4251,20 +4259,12 @@ declare class Operation_Increase extends Message<Operation_Increase> {
4251
4259
  * @generated from field: yorkie.v1.TimeTicket executed_at = 3;
4252
4260
  */
4253
4261
  executedAt?: TimeTicket_2;
4254
- constructor(data?: PartialMessage<Operation_Increase>);
4255
- static readonly runtime: typeof proto3;
4256
- static readonly typeName = "yorkie.v1.Operation.Increase";
4257
- static readonly fields: FieldList;
4258
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_Increase;
4259
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_Increase;
4260
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_Increase;
4261
- static equals(a: Operation_Increase | PlainMessage<Operation_Increase> | undefined, b: Operation_Increase | PlainMessage<Operation_Increase> | undefined): boolean;
4262
- }
4262
+ };
4263
4263
 
4264
4264
  /**
4265
4265
  * @generated from message yorkie.v1.Operation.Move
4266
4266
  */
4267
- declare class Operation_Move extends Message<Operation_Move> {
4267
+ declare type Operation_Move = Message<"yorkie.v1.Operation.Move"> & {
4268
4268
  /**
4269
4269
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4270
4270
  */
@@ -4281,20 +4281,12 @@ declare class Operation_Move extends Message<Operation_Move> {
4281
4281
  * @generated from field: yorkie.v1.TimeTicket executed_at = 4;
4282
4282
  */
4283
4283
  executedAt?: TimeTicket_2;
4284
- constructor(data?: PartialMessage<Operation_Move>);
4285
- static readonly runtime: typeof proto3;
4286
- static readonly typeName = "yorkie.v1.Operation.Move";
4287
- static readonly fields: FieldList;
4288
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_Move;
4289
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_Move;
4290
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_Move;
4291
- static equals(a: Operation_Move | PlainMessage<Operation_Move> | undefined, b: Operation_Move | PlainMessage<Operation_Move> | undefined): boolean;
4292
- }
4284
+ };
4293
4285
 
4294
4286
  /**
4295
4287
  * @generated from message yorkie.v1.Operation.Remove
4296
4288
  */
4297
- declare class Operation_Remove extends Message<Operation_Remove> {
4289
+ declare type Operation_Remove = Message<"yorkie.v1.Operation.Remove"> & {
4298
4290
  /**
4299
4291
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4300
4292
  */
@@ -4307,20 +4299,12 @@ declare class Operation_Remove extends Message<Operation_Remove> {
4307
4299
  * @generated from field: yorkie.v1.TimeTicket executed_at = 3;
4308
4300
  */
4309
4301
  executedAt?: TimeTicket_2;
4310
- constructor(data?: PartialMessage<Operation_Remove>);
4311
- static readonly runtime: typeof proto3;
4312
- static readonly typeName = "yorkie.v1.Operation.Remove";
4313
- static readonly fields: FieldList;
4314
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_Remove;
4315
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_Remove;
4316
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_Remove;
4317
- static equals(a: Operation_Remove | PlainMessage<Operation_Remove> | undefined, b: Operation_Remove | PlainMessage<Operation_Remove> | undefined): boolean;
4318
- }
4302
+ };
4319
4303
 
4320
4304
  /**
4321
4305
  * @generated from message yorkie.v1.Operation.Set
4322
4306
  */
4323
- declare class Operation_Set extends Message<Operation_Set> {
4307
+ declare type Operation_Set = Message<"yorkie.v1.Operation.Set"> & {
4324
4308
  /**
4325
4309
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4326
4310
  */
@@ -4337,20 +4321,12 @@ declare class Operation_Set extends Message<Operation_Set> {
4337
4321
  * @generated from field: yorkie.v1.TimeTicket executed_at = 4;
4338
4322
  */
4339
4323
  executedAt?: TimeTicket_2;
4340
- constructor(data?: PartialMessage<Operation_Set>);
4341
- static readonly runtime: typeof proto3;
4342
- static readonly typeName = "yorkie.v1.Operation.Set";
4343
- static readonly fields: FieldList;
4344
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_Set;
4345
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_Set;
4346
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_Set;
4347
- static equals(a: Operation_Set | PlainMessage<Operation_Set> | undefined, b: Operation_Set | PlainMessage<Operation_Set> | undefined): boolean;
4348
- }
4324
+ };
4349
4325
 
4350
4326
  /**
4351
4327
  * @generated from message yorkie.v1.Operation.Style
4352
4328
  */
4353
- declare class Operation_Style extends Message<Operation_Style> {
4329
+ declare type Operation_Style = Message<"yorkie.v1.Operation.Style"> & {
4354
4330
  /**
4355
4331
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4356
4332
  */
@@ -4381,20 +4357,12 @@ declare class Operation_Style extends Message<Operation_Style> {
4381
4357
  createdAtMapByActor: {
4382
4358
  [key: string]: TimeTicket_2;
4383
4359
  };
4384
- constructor(data?: PartialMessage<Operation_Style>);
4385
- static readonly runtime: typeof proto3;
4386
- static readonly typeName = "yorkie.v1.Operation.Style";
4387
- static readonly fields: FieldList;
4388
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_Style;
4389
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_Style;
4390
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_Style;
4391
- static equals(a: Operation_Style | PlainMessage<Operation_Style> | undefined, b: Operation_Style | PlainMessage<Operation_Style> | undefined): boolean;
4392
- }
4360
+ };
4393
4361
 
4394
4362
  /**
4395
4363
  * @generated from message yorkie.v1.Operation.TreeEdit
4396
4364
  */
4397
- declare class Operation_TreeEdit extends Message<Operation_TreeEdit> {
4365
+ declare type Operation_TreeEdit = Message<"yorkie.v1.Operation.TreeEdit"> & {
4398
4366
  /**
4399
4367
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4400
4368
  */
@@ -4427,20 +4395,12 @@ declare class Operation_TreeEdit extends Message<Operation_TreeEdit> {
4427
4395
  * @generated from field: yorkie.v1.TimeTicket executed_at = 6;
4428
4396
  */
4429
4397
  executedAt?: TimeTicket_2;
4430
- constructor(data?: PartialMessage<Operation_TreeEdit>);
4431
- static readonly runtime: typeof proto3;
4432
- static readonly typeName = "yorkie.v1.Operation.TreeEdit";
4433
- static readonly fields: FieldList;
4434
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_TreeEdit;
4435
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_TreeEdit;
4436
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_TreeEdit;
4437
- static equals(a: Operation_TreeEdit | PlainMessage<Operation_TreeEdit> | undefined, b: Operation_TreeEdit | PlainMessage<Operation_TreeEdit> | undefined): boolean;
4438
- }
4398
+ };
4439
4399
 
4440
4400
  /**
4441
4401
  * @generated from message yorkie.v1.Operation.TreeStyle
4442
4402
  */
4443
- declare class Operation_TreeStyle extends Message<Operation_TreeStyle> {
4403
+ declare type Operation_TreeStyle = Message<"yorkie.v1.Operation.TreeStyle"> & {
4444
4404
  /**
4445
4405
  * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1;
4446
4406
  */
@@ -4475,15 +4435,7 @@ declare class Operation_TreeStyle extends Message<Operation_TreeStyle> {
4475
4435
  createdAtMapByActor: {
4476
4436
  [key: string]: TimeTicket_2;
4477
4437
  };
4478
- constructor(data?: PartialMessage<Operation_TreeStyle>);
4479
- static readonly runtime: typeof proto3;
4480
- static readonly typeName = "yorkie.v1.Operation.TreeStyle";
4481
- static readonly fields: FieldList;
4482
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Operation_TreeStyle;
4483
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Operation_TreeStyle;
4484
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Operation_TreeStyle;
4485
- static equals(a: Operation_TreeStyle | PlainMessage<Operation_TreeStyle> | undefined, b: Operation_TreeStyle | PlainMessage<Operation_TreeStyle> | undefined): boolean;
4486
- }
4438
+ };
4487
4439
 
4488
4440
  /**
4489
4441
  * `OpInfo` represents the information of an operation.
@@ -4566,6 +4518,42 @@ export declare type PanelToSDKMessage =
4566
4518
  docKey: string;
4567
4519
  };
4568
4520
 
4521
+ /**
4522
+ * `parse` parses a YSON string into a typed JavaScript object.
4523
+ *
4524
+ * YSON extends JSON to support Yorkie CRDT types:
4525
+ * - `Text([...])` for Text CRDT
4526
+ * - `Tree(...)` for Tree CRDT
4527
+ * - Standard JSON for primitives, objects, and arrays
4528
+ *
4529
+ * @param yson - YSON formatted string
4530
+ * @returns Parsed YSONValue
4531
+ * @throws YorkieError if parsing fails
4532
+ *
4533
+ * @example
4534
+ * ```typescript
4535
+ * const data = parse('{"content":Text([{"val":"Hi"}])}');
4536
+ * // { content: { type: 'Text', nodes: [{ val: 'Hi' }] } }
4537
+ * ```
4538
+ */
4539
+ declare function parse(yson: string): YSONValue {
4540
+ try {
4541
+ // Preprocess YSON string to handle special types
4542
+ const processed = preprocessYSON(yson);
4543
+
4544
+ // Parse as JSON
4545
+ const parsed = JSON.parse(processed);
4546
+
4547
+ // Post-process to restore type information
4548
+ return postprocessValue(parsed);
4549
+ } catch (err) {
4550
+ throw new YorkieError(
4551
+ Code.ErrInvalidArgument,
4552
+ `Failed to parse YSON: ${err instanceof Error ? err.message : String(err)}`,
4553
+ );
4554
+ }
4555
+ }
4556
+
4569
4557
  /**
4570
4558
  * `PathOf` represents the type of all possible paths in the Document.subscribe.
4571
4559
  */
@@ -4604,22 +4592,14 @@ export declare class Presence<P extends Indexable> {
4604
4592
  /**
4605
4593
  * @generated from message yorkie.v1.Presence
4606
4594
  */
4607
- declare class Presence_2 extends Message<Presence_2> {
4595
+ declare type Presence_2 = Message<"yorkie.v1.Presence"> & {
4608
4596
  /**
4609
4597
  * @generated from field: map<string, string> data = 1;
4610
4598
  */
4611
4599
  data: {
4612
4600
  [key: string]: string;
4613
4601
  };
4614
- constructor(data?: PartialMessage<Presence_2>);
4615
- static readonly runtime: typeof proto3;
4616
- static readonly typeName = "yorkie.v1.Presence";
4617
- static readonly fields: FieldList;
4618
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Presence_2;
4619
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Presence_2;
4620
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Presence_2;
4621
- static equals(a: Presence_2 | PlainMessage<Presence_2> | undefined, b: Presence_2 | PlainMessage<Presence_2> | undefined): boolean;
4622
- }
4602
+ };
4623
4603
 
4624
4604
  /**
4625
4605
  * `PresenceChange` represents the change of presence.
@@ -4634,7 +4614,7 @@ declare type PresenceChange<P extends Indexable> = {
4634
4614
  /**
4635
4615
  * @generated from message yorkie.v1.PresenceChange
4636
4616
  */
4637
- declare class PresenceChange_2 extends Message<PresenceChange_2> {
4617
+ declare type PresenceChange_2 = Message<"yorkie.v1.PresenceChange"> & {
4638
4618
  /**
4639
4619
  * @generated from field: yorkie.v1.PresenceChange.ChangeType type = 1;
4640
4620
  */
@@ -4643,15 +4623,7 @@ declare class PresenceChange_2 extends Message<PresenceChange_2> {
4643
4623
  * @generated from field: yorkie.v1.Presence presence = 2;
4644
4624
  */
4645
4625
  presence?: Presence_2;
4646
- constructor(data?: PartialMessage<PresenceChange_2>);
4647
- static readonly runtime: typeof proto3;
4648
- static readonly typeName = "yorkie.v1.PresenceChange";
4649
- static readonly fields: FieldList;
4650
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PresenceChange_2;
4651
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): PresenceChange_2;
4652
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): PresenceChange_2;
4653
- static equals(a: PresenceChange_2 | PlainMessage<PresenceChange_2> | undefined, b: PresenceChange_2 | PlainMessage<PresenceChange_2> | undefined): boolean;
4654
- }
4626
+ };
4655
4627
 
4656
4628
  /**
4657
4629
  * @generated from enum yorkie.v1.PresenceChange.ChangeType
@@ -4684,8 +4656,9 @@ export declare interface PresenceChangedEvent<P extends Indexable> extends BaseD
4684
4656
  };
4685
4657
  }
4686
4658
 
4687
- declare interface PresenceChangedEvent_2<P extends Indexable_2>
4688
- extends BaseDocEvent {
4659
+ declare interface PresenceChangedEvent_2<
4660
+ P extends Indexable_2,
4661
+ > extends BaseDocEvent {
4689
4662
  type: DocEventType_2.PresenceChanged;
4690
4663
  source: OpSource_2;
4691
4664
  value: { clientID: ActorID_2; presence: P };
@@ -4846,8 +4819,10 @@ export declare interface RemoteChangeEvent<T = OpInfo, P extends Indexable = Ind
4846
4819
  * `RemoteChangeEvent` is an event that occurs when the document is changed
4847
4820
  * by remote changes.
4848
4821
  */
4849
- declare interface RemoteChangeEvent_2<T = OpInfo_2, P extends Indexable_2 = Indexable_2>
4850
- extends BaseDocEvent {
4822
+ declare interface RemoteChangeEvent_2<
4823
+ T = OpInfo_2,
4824
+ P extends Indexable_2 = Indexable_2,
4825
+ > extends BaseDocEvent {
4851
4826
  type: DocEventType_2.RemoteChange;
4852
4827
  source: OpSource_2.Remote;
4853
4828
  value: ChangeInfo_2<T>;
@@ -4898,8 +4873,14 @@ export declare interface RevisionSummary {
4898
4873
  */
4899
4874
  description: string;
4900
4875
  /**
4901
- * `snapshot` is the serialized document content (JSON format) at this revision point.
4902
- * This contains only the pure data without CRDT metadata.
4876
+ * `snapshot` is the serialized document content in YSON format at this revision point.
4877
+ *
4878
+ * Use `YSON.parse()` to convert this string to a typed JavaScript object:
4879
+ *
4880
+ * ```javascript
4881
+ * import { YSON } from 'yorkie-js-sdk';
4882
+ * const snapshot = YSON.parse(revision.snapshot);
4883
+ * ```
4903
4884
  */
4904
4885
  snapshot: string;
4905
4886
  /**
@@ -4911,7 +4892,7 @@ export declare interface RevisionSummary {
4911
4892
  /**
4912
4893
  * @generated from message yorkie.v1.RevisionSummary
4913
4894
  */
4914
- declare class RevisionSummary_2 extends Message<RevisionSummary_2> {
4895
+ declare type RevisionSummary_2 = Message<"yorkie.v1.RevisionSummary"> & {
4915
4896
  /**
4916
4897
  * @generated from field: string id = 1;
4917
4898
  */
@@ -4932,15 +4913,7 @@ declare class RevisionSummary_2 extends Message<RevisionSummary_2> {
4932
4913
  * @generated from field: google.protobuf.Timestamp created_at = 5;
4933
4914
  */
4934
4915
  createdAt?: Timestamp;
4935
- constructor(data?: PartialMessage<RevisionSummary_2>);
4936
- static readonly runtime: typeof proto3;
4937
- static readonly typeName = "yorkie.v1.RevisionSummary";
4938
- static readonly fields: FieldList;
4939
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RevisionSummary_2;
4940
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): RevisionSummary_2;
4941
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): RevisionSummary_2;
4942
- static equals(a: RevisionSummary_2 | PlainMessage<RevisionSummary_2> | undefined, b: RevisionSummary_2 | PlainMessage<RevisionSummary_2> | undefined): boolean;
4943
- }
4916
+ };
4944
4917
 
4945
4918
  /**
4946
4919
  * `RGATreeSplit` is a block-based list with improved index-based lookup in RGA.
@@ -5422,7 +5395,7 @@ declare interface RootStats {
5422
5395
  /**
5423
5396
  * @generated from message yorkie.v1.Rule
5424
5397
  */
5425
- declare class Rule_2 extends Message<Rule_2> {
5398
+ declare type Rule_2 = Message<"yorkie.v1.Rule"> & {
5426
5399
  /**
5427
5400
  * @generated from field: string path = 1;
5428
5401
  */
@@ -5431,15 +5404,7 @@ declare class Rule_2 extends Message<Rule_2> {
5431
5404
  * @generated from field: string type = 2;
5432
5405
  */
5433
5406
  type: string;
5434
- constructor(data?: PartialMessage<Rule_2>);
5435
- static readonly runtime: typeof proto3;
5436
- static readonly typeName = "yorkie.v1.Rule";
5437
- static readonly fields: FieldList;
5438
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Rule_2;
5439
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Rule_2;
5440
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Rule_2;
5441
- static equals(a: Rule_2 | PlainMessage<Rule_2> | undefined, b: Rule_2 | PlainMessage<Rule_2> | undefined): boolean;
5442
- }
5407
+ };
5443
5408
 
5444
5409
  /**
5445
5410
  * Definition of all messages the SDK can send to the Devtools panel.
@@ -5942,7 +5907,7 @@ declare type TextNode_2 = {
5942
5907
  /**
5943
5908
  * @generated from message yorkie.v1.TextNodePos
5944
5909
  */
5945
- declare class TextNodePos extends Message<TextNodePos> {
5910
+ declare type TextNodePos = Message<"yorkie.v1.TextNodePos"> & {
5946
5911
  /**
5947
5912
  * @generated from field: yorkie.v1.TimeTicket created_at = 1;
5948
5913
  */
@@ -5955,15 +5920,7 @@ declare class TextNodePos extends Message<TextNodePos> {
5955
5920
  * @generated from field: int32 relative_offset = 3;
5956
5921
  */
5957
5922
  relativeOffset: number;
5958
- constructor(data?: PartialMessage<TextNodePos>);
5959
- static readonly runtime: typeof proto3;
5960
- static readonly typeName = "yorkie.v1.TextNodePos";
5961
- static readonly fields: FieldList;
5962
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TextNodePos;
5963
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TextNodePos;
5964
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TextNodePos;
5965
- static equals(a: TextNodePos | PlainMessage<TextNodePos> | undefined, b: TextNodePos | PlainMessage<TextNodePos> | undefined): boolean;
5966
- }
5923
+ };
5967
5924
 
5968
5925
  /**
5969
5926
  * `TextOpInfo` represents the OperationInfo for the yorkie.Text.
@@ -5993,6 +5950,22 @@ export declare type TextPosStruct = {
5993
5950
  */
5994
5951
  export declare type TextPosStructRange = [TextPosStruct, TextPosStruct];
5995
5952
 
5953
+ /**
5954
+ * `textToString` extracts plain text content from YSONText.
5955
+ *
5956
+ * @param text - YSONText object
5957
+ * @returns Plain text string
5958
+ *
5959
+ * @example
5960
+ * ```typescript
5961
+ * const text = { type: 'Text', nodes: [{val: 'H'}, {val: 'i'}] };
5962
+ * textToString(text); // "Hi"
5963
+ * ```
5964
+ */
5965
+ declare function textToString(text: YSONText): string {
5966
+ return text.nodes.map((node) => node.val).join('');
5967
+ }
5968
+
5996
5969
  /**
5997
5970
  * `TextValueType` is a value of Text
5998
5971
  * which has a attributes that expresses the text style.
@@ -6071,7 +6044,7 @@ export declare class TimeTicket {
6071
6044
  /**
6072
6045
  * @generated from message yorkie.v1.TimeTicket
6073
6046
  */
6074
- declare class TimeTicket_2 extends Message<TimeTicket_2> {
6047
+ declare type TimeTicket_2 = Message<"yorkie.v1.TimeTicket"> & {
6075
6048
  /**
6076
6049
  * @generated from field: int64 lamport = 1;
6077
6050
  */
@@ -6084,15 +6057,7 @@ declare class TimeTicket_2 extends Message<TimeTicket_2> {
6084
6057
  * @generated from field: bytes actor_id = 3;
6085
6058
  */
6086
6059
  actorId: Uint8Array;
6087
- constructor(data?: PartialMessage<TimeTicket_2>);
6088
- static readonly runtime: typeof proto3;
6089
- static readonly typeName = "yorkie.v1.TimeTicket";
6090
- static readonly fields: FieldList;
6091
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TimeTicket_2;
6092
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TimeTicket_2;
6093
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TimeTicket_2;
6094
- static equals(a: TimeTicket_2 | PlainMessage<TimeTicket_2> | undefined, b: TimeTicket_2 | PlainMessage<TimeTicket_2> | undefined): boolean;
6095
- }
6060
+ };
6096
6061
 
6097
6062
  /**
6098
6063
  * `TimeTicketStruct` is a structure represents the meta data of the ticket.
@@ -6372,7 +6337,7 @@ declare type TreeNode_2 = TextNode_2 | ElementNode_2;
6372
6337
  /**
6373
6338
  * @generated from message yorkie.v1.TreeNode
6374
6339
  */
6375
- declare class TreeNode_3 extends Message<TreeNode_3> {
6340
+ declare type TreeNode_3 = Message<"yorkie.v1.TreeNode"> & {
6376
6341
  /**
6377
6342
  * @generated from field: yorkie.v1.TreeNodeID id = 1;
6378
6343
  */
@@ -6407,15 +6372,7 @@ declare class TreeNode_3 extends Message<TreeNode_3> {
6407
6372
  attributes: {
6408
6373
  [key: string]: NodeAttr;
6409
6374
  };
6410
- constructor(data?: PartialMessage<TreeNode_3>);
6411
- static readonly runtime: typeof proto3;
6412
- static readonly typeName = "yorkie.v1.TreeNode";
6413
- static readonly fields: FieldList;
6414
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TreeNode_3;
6415
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TreeNode_3;
6416
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TreeNode_3;
6417
- static equals(a: TreeNode_3 | PlainMessage<TreeNode_3> | undefined, b: TreeNode_3 | PlainMessage<TreeNode_3> | undefined): boolean;
6418
- }
6375
+ };
6419
6376
 
6420
6377
  /**
6421
6378
  * `TreeNodeForTest` represents the JSON representation of a node in the tree.
@@ -6430,7 +6387,7 @@ declare type TreeNodeForTest = TreeNode & {
6430
6387
  /**
6431
6388
  * @generated from message yorkie.v1.TreeNodeID
6432
6389
  */
6433
- declare class TreeNodeID extends Message<TreeNodeID> {
6390
+ declare type TreeNodeID = Message<"yorkie.v1.TreeNodeID"> & {
6434
6391
  /**
6435
6392
  * @generated from field: yorkie.v1.TimeTicket created_at = 1;
6436
6393
  */
@@ -6439,15 +6396,7 @@ declare class TreeNodeID extends Message<TreeNodeID> {
6439
6396
  * @generated from field: int32 offset = 2;
6440
6397
  */
6441
6398
  offset: number;
6442
- constructor(data?: PartialMessage<TreeNodeID>);
6443
- static readonly runtime: typeof proto3;
6444
- static readonly typeName = "yorkie.v1.TreeNodeID";
6445
- static readonly fields: FieldList;
6446
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TreeNodeID;
6447
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TreeNodeID;
6448
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TreeNodeID;
6449
- static equals(a: TreeNodeID | PlainMessage<TreeNodeID> | undefined, b: TreeNodeID | PlainMessage<TreeNodeID> | undefined): boolean;
6450
- }
6399
+ };
6451
6400
 
6452
6401
  /**
6453
6402
  * `TreeNodeInfo` represents the crdt tree node information in devtools.
@@ -6479,20 +6428,12 @@ declare type TreeNodePair = [CRDTTreeNode, CRDTTreeNode];
6479
6428
  /**
6480
6429
  * @generated from message yorkie.v1.TreeNodes
6481
6430
  */
6482
- declare class TreeNodes extends Message<TreeNodes> {
6431
+ declare type TreeNodes = Message<"yorkie.v1.TreeNodes"> & {
6483
6432
  /**
6484
6433
  * @generated from field: repeated yorkie.v1.TreeNode content = 1;
6485
6434
  */
6486
6435
  content: TreeNode_3[];
6487
- constructor(data?: PartialMessage<TreeNodes>);
6488
- static readonly runtime: typeof proto3;
6489
- static readonly typeName = "yorkie.v1.TreeNodes";
6490
- static readonly fields: FieldList;
6491
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TreeNodes;
6492
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TreeNodes;
6493
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TreeNodes;
6494
- static equals(a: TreeNodes | PlainMessage<TreeNodes> | undefined, b: TreeNodes | PlainMessage<TreeNodes> | undefined): boolean;
6495
- }
6436
+ };
6496
6437
 
6497
6438
  /**
6498
6439
  * `NoteType` is the type of a node in the tree.
@@ -6529,7 +6470,7 @@ declare type TreePos<T extends IndexTreeNode<T>> = {
6529
6470
  /**
6530
6471
  * @generated from message yorkie.v1.TreePos
6531
6472
  */
6532
- declare class TreePos_2 extends Message<TreePos_2> {
6473
+ declare type TreePos_2 = Message<"yorkie.v1.TreePos"> & {
6533
6474
  /**
6534
6475
  * @generated from field: yorkie.v1.TreeNodeID parent_id = 1;
6535
6476
  */
@@ -6538,15 +6479,7 @@ declare class TreePos_2 extends Message<TreePos_2> {
6538
6479
  * @generated from field: yorkie.v1.TreeNodeID left_sibling_id = 2;
6539
6480
  */
6540
6481
  leftSiblingId?: TreeNodeID;
6541
- constructor(data?: PartialMessage<TreePos_2>);
6542
- static readonly runtime: typeof proto3;
6543
- static readonly typeName = "yorkie.v1.TreePos";
6544
- static readonly fields: FieldList;
6545
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): TreePos_2;
6546
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): TreePos_2;
6547
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): TreePos_2;
6548
- static equals(a: TreePos_2 | PlainMessage<TreePos_2> | undefined, b: TreePos_2 | PlainMessage<TreePos_2> | undefined): boolean;
6549
- }
6482
+ };
6550
6483
 
6551
6484
  /**
6552
6485
  * `TreePosRange` represents a pair of CRDTTreePos.
@@ -6596,6 +6529,16 @@ declare type TreeStyleOpInfo_2 = {
6596
6529
  */
6597
6530
  declare type TreeToken<T> = [T, TokenType];
6598
6531
 
6532
+ /**
6533
+ * `treeToXML` converts YSONTree to XML string representation.
6534
+ *
6535
+ * @param tree - YSONTree object
6536
+ * @returns XML string
6537
+ */
6538
+ declare function treeToXML(tree: YSONTree): string {
6539
+ return treeNodeToXML(tree.root);
6540
+ }
6541
+
6599
6542
  export declare type Unsubscribe = () => void;
6600
6543
 
6601
6544
  export declare interface UnwatchedEvent<P extends Indexable> extends BaseDocEvent_2 {
@@ -6737,22 +6680,14 @@ export declare class VersionVector {
6737
6680
  /**
6738
6681
  * @generated from message yorkie.v1.VersionVector
6739
6682
  */
6740
- declare class VersionVector_2 extends Message<VersionVector_2> {
6683
+ declare type VersionVector_2 = Message<"yorkie.v1.VersionVector"> & {
6741
6684
  /**
6742
6685
  * @generated from field: map<string, int64> vector = 1;
6743
6686
  */
6744
6687
  vector: {
6745
6688
  [key: string]: bigint;
6746
6689
  };
6747
- constructor(data?: PartialMessage<VersionVector_2>);
6748
- static readonly runtime: typeof proto3;
6749
- static readonly typeName = "yorkie.v1.VersionVector";
6750
- static readonly fields: FieldList;
6751
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): VersionVector_2;
6752
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): VersionVector_2;
6753
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): VersionVector_2;
6754
- static equals(a: VersionVector_2 | PlainMessage<VersionVector_2> | undefined, b: VersionVector_2 | PlainMessage<VersionVector_2> | undefined): boolean;
6755
- }
6690
+ };
6756
6691
 
6757
6692
  /**
6758
6693
  * `versionVectorToHex` converts the given VersionVector to bytes.
@@ -6762,7 +6697,7 @@ declare function versionVectorToHex(vector: VersionVector): string;
6762
6697
  /**
6763
6698
  * @generated from message yorkie.v1.WatchDocumentResponse
6764
6699
  */
6765
- declare class WatchDocumentResponse extends Message<WatchDocumentResponse> {
6700
+ declare type WatchDocumentResponse = Message<"yorkie.v1.WatchDocumentResponse"> & {
6766
6701
  /**
6767
6702
  * @generated from oneof yorkie.v1.WatchDocumentResponse.body
6768
6703
  */
@@ -6782,33 +6717,17 @@ declare class WatchDocumentResponse extends Message<WatchDocumentResponse> {
6782
6717
  case: undefined;
6783
6718
  value?: undefined;
6784
6719
  };
6785
- constructor(data?: PartialMessage<WatchDocumentResponse>);
6786
- static readonly runtime: typeof proto3;
6787
- static readonly typeName = "yorkie.v1.WatchDocumentResponse";
6788
- static readonly fields: FieldList;
6789
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchDocumentResponse;
6790
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WatchDocumentResponse;
6791
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WatchDocumentResponse;
6792
- static equals(a: WatchDocumentResponse | PlainMessage<WatchDocumentResponse> | undefined, b: WatchDocumentResponse | PlainMessage<WatchDocumentResponse> | undefined): boolean;
6793
- }
6720
+ };
6794
6721
 
6795
6722
  /**
6796
6723
  * @generated from message yorkie.v1.WatchDocumentResponse.Initialization
6797
6724
  */
6798
- declare class WatchDocumentResponse_Initialization extends Message<WatchDocumentResponse_Initialization> {
6725
+ declare type WatchDocumentResponse_Initialization = Message<"yorkie.v1.WatchDocumentResponse.Initialization"> & {
6799
6726
  /**
6800
6727
  * @generated from field: repeated string client_ids = 1;
6801
6728
  */
6802
6729
  clientIds: string[];
6803
- constructor(data?: PartialMessage<WatchDocumentResponse_Initialization>);
6804
- static readonly runtime: typeof proto3;
6805
- static readonly typeName = "yorkie.v1.WatchDocumentResponse.Initialization";
6806
- static readonly fields: FieldList;
6807
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchDocumentResponse_Initialization;
6808
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): WatchDocumentResponse_Initialization;
6809
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): WatchDocumentResponse_Initialization;
6810
- static equals(a: WatchDocumentResponse_Initialization | PlainMessage<WatchDocumentResponse_Initialization> | undefined, b: WatchDocumentResponse_Initialization | PlainMessage<WatchDocumentResponse_Initialization> | undefined): boolean;
6811
- }
6730
+ };
6812
6731
 
6813
6732
  export declare interface WatchedEvent<P extends Indexable> extends BaseDocEvent_2 {
6814
6733
  type: DocEventType.Watched;
@@ -6830,12 +6749,208 @@ declare interface WatchedEvent_2<P extends Indexable_2> extends BaseDocEvent {
6830
6749
  */
6831
6750
  export declare type WrappedElement<T = unknown, A extends Indexable = Indexable> = Primitive | JSONObject<T> | JSONArray<T> | Text_2<A> | Counter | Tree;
6832
6751
 
6752
+ declare namespace YSON {
6753
+ export {
6754
+ YSONValue,
6755
+ YSONText,
6756
+ YSONTree,
6757
+ YSONTextNode,
6758
+ YSONTreeNode,
6759
+ YSONInt,
6760
+ YSONLong,
6761
+ YSONDate,
6762
+ YSONBinData,
6763
+ YSONCounter,
6764
+ isText,
6765
+ isTree,
6766
+ isInt,
6767
+ isLong,
6768
+ isDate,
6769
+ isBinData,
6770
+ isCounter,
6771
+ isObject,
6772
+ parse,
6773
+ textToString,
6774
+ treeToXML
6775
+ }
6776
+ }
6777
+
6778
+ /**
6779
+ * `YSONBinData` represents Base64-encoded binary data.
6780
+ *
6781
+ * @example
6782
+ * ```typescript
6783
+ * { type: 'BinData', value: 'AQID' }
6784
+ * ```
6785
+ */
6786
+ declare interface YSONBinData {
6787
+ type: 'BinData';
6788
+ value: string;
6789
+ }
6790
+
6791
+ /**
6792
+ * `YSONCounter` represents a Counter CRDT for collaborative counting.
6793
+ *
6794
+ * @example
6795
+ * ```typescript
6796
+ * { type: 'Counter', value: { type: 'Int', value: 10 } }
6797
+ * ```
6798
+ */
6799
+ declare interface YSONCounter {
6800
+ type: 'Counter';
6801
+ value: YSONInt | YSONLong;
6802
+ }
6803
+
6804
+ /**
6805
+ * `YSONDate` represents an ISO 8601 timestamp.
6806
+ *
6807
+ * @example
6808
+ * ```typescript
6809
+ * { type: 'Date', value: '2025-01-02T15:04:05.058Z' }
6810
+ * ```
6811
+ */
6812
+ declare interface YSONDate {
6813
+ type: 'Date';
6814
+ value: string;
6815
+ }
6816
+
6817
+ /**
6818
+ * `YSONInt` represents a 32-bit integer.
6819
+ *
6820
+ * @example
6821
+ * ```typescript
6822
+ * { type: 'Int', value: 42 }
6823
+ * ```
6824
+ */
6825
+ declare interface YSONInt {
6826
+ type: 'Int';
6827
+ value: number;
6828
+ }
6829
+
6830
+ /**
6831
+ * `YSONLong` represents a 64-bit integer.
6832
+ *
6833
+ * @example
6834
+ * ```typescript
6835
+ * { type: 'Long', value: 64 }
6836
+ * ```
6837
+ */
6838
+ declare interface YSONLong {
6839
+ type: 'Long';
6840
+ value: number;
6841
+ }
6842
+
6843
+ /**
6844
+ * `YSONText` represents a Text CRDT structure.
6845
+ *
6846
+ * @example
6847
+ * ```typescript
6848
+ * {
6849
+ * type: 'Text',
6850
+ * nodes: [
6851
+ * { val: 'H' },
6852
+ * { val: 'i' }
6853
+ * ]
6854
+ * }
6855
+ * ```
6856
+ */
6857
+ declare interface YSONText {
6858
+ type: 'Text';
6859
+ nodes: Array<YSONTextNode>;
6860
+ }
6861
+
6862
+ /**
6863
+ * `YSONTextNode` represents a single character in a Text CRDT.
6864
+ *
6865
+ * @example
6866
+ * ```typescript
6867
+ * { val: 'H', attrs: { bold: true } }
6868
+ * ```
6869
+ */
6870
+ declare interface YSONTextNode {
6871
+ /**
6872
+ * The character value
6873
+ */
6874
+ val: string;
6875
+
6876
+ /**
6877
+ * Optional attributes (e.g., formatting)
6878
+ */
6879
+ attrs?: Record<string, any>;
6880
+ }
6881
+
6882
+ /**
6883
+ * `YSONTree` represents a Tree CRDT structure.
6884
+ *
6885
+ * @example
6886
+ * ```typescript
6887
+ * {
6888
+ * type: 'Tree',
6889
+ * root: {
6890
+ * type: 'doc',
6891
+ * children: [
6892
+ * { type: 'p', children: [{ type: 'text', value: 'Hello' }] }
6893
+ * ]
6894
+ * }
6895
+ * }
6896
+ * ```
6897
+ */
6898
+ declare interface YSONTree {
6899
+ type: 'Tree';
6900
+ root: YSONTreeNode;
6901
+ }
6902
+
6903
+ /**
6904
+ * `YSONTreeNode` represents a node in a Tree CRDT.
6905
+ *
6906
+ * For text nodes: `{ type: 'text', value: 'content' }`
6907
+ * For element nodes: `{ type: 'p', children: [...] }`
6908
+ */
6909
+ declare interface YSONTreeNode {
6910
+ /**
6911
+ * Node type (e.g., 'text', 'p', 'div')
6912
+ */
6913
+ type: string;
6914
+
6915
+ /**
6916
+ * Text content (for text nodes)
6917
+ */
6918
+ value?: string;
6919
+
6920
+ /**
6921
+ * Attributes (for element nodes)
6922
+ */
6923
+ attrs?: Record<string, string>;
6924
+
6925
+ /**
6926
+ * Child nodes (for element nodes)
6927
+ */
6928
+ children?: Array<YSONTreeNode>;
6929
+ }
6930
+
6931
+ /**
6932
+ * `YSONValue` represents any valid YSON value.
6933
+ *
6934
+ * Can be:
6935
+ * - Primitives: string, number, boolean, null
6936
+ * - Collections: arrays, objects
6937
+ * - CRDT types: Text, Tree, Counter
6938
+ * - Special types: Int, Long, Date, BinData
6939
+ */
6940
+ declare type YSONValue =
6941
+ | string
6942
+ | number
6943
+ | boolean
6944
+ // eslint-disable-next-line @typescript-eslint/no-restricted-types
6945
+ | null
6946
+ | YSONText
6947
+ | YSONTree
6948
+ | YSONInt
6949
+ | YSONLong
6950
+ | YSONDate
6951
+ | YSONBinData
6952
+ | YSONCounter
6953
+ | { [key: string]: YSONValue }
6954
+ | Array<YSONValue>;
6955
+
6833
6956
  export { }
6834
-
6835
-
6836
- declare global {
6837
- interface Window {
6838
- docEventsForReplayByDocKey: Map<string, Array<DocEventsForReplay>>;
6839
- }
6840
- }
6841
-