From e2380153608b3c05cab79f73e0de76a5478d1500 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Mon, 21 Oct 2024 11:14:52 +0900 Subject: [PATCH] Update target to ES2020 and replace Long with bigint --- packages/sdk/src/api/converter.ts | 23 +- .../sdk/src/api/yorkie/v1/resources.proto | 15 +- .../sdk/src/api/yorkie/v1/resources_pb.ts | 2711 +++++++++++++++++ packages/sdk/src/api/yorkie/v1/yorkie.proto | 2 +- .../sdk/src/api/yorkie/v1/yorkie_connect.ts | 106 + packages/sdk/src/api/yorkie/v1/yorkie_pb.ts | 738 +++++ packages/sdk/src/document/change/change_id.ts | 29 +- .../sdk/src/document/change/checkpoint.ts | 20 +- packages/sdk/src/document/document.ts | 8 +- packages/sdk/src/document/time/ticket.ts | 25 +- packages/sdk/test/integration/client_test.ts | 8 +- packages/sdk/test/integration/object_test.ts | 20 +- packages/sdk/tsconfig.json | 4 +- 13 files changed, 3621 insertions(+), 88 deletions(-) create mode 100644 packages/sdk/src/api/yorkie/v1/resources_pb.ts create mode 100644 packages/sdk/src/api/yorkie/v1/yorkie_connect.ts create mode 100644 packages/sdk/src/api/yorkie/v1/yorkie_pb.ts diff --git a/packages/sdk/src/api/converter.ts b/packages/sdk/src/api/converter.ts index e5a1e1752..9f102e1d9 100644 --- a/packages/sdk/src/api/converter.ts +++ b/packages/sdk/src/api/converter.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import Long from 'long'; import { ConnectError } from '@connectrpc/connect'; import { ErrorInfo } from '@buf/googleapis_googleapis.bufbuild_es/google/rpc/error_details_pb'; import { Code, YorkieError } from '@yorkie-js-sdk/src/util/error'; @@ -149,7 +148,7 @@ function toPresenceChange( */ function toCheckpoint(checkpoint: Checkpoint): PbCheckpoint { return new PbCheckpoint({ - serverSeq: checkpoint.getServerSeqAsString(), + serverSeq: checkpoint.getServerSeq(), clientSeq: checkpoint.getClientSeq(), }); } @@ -160,7 +159,7 @@ function toCheckpoint(checkpoint: Checkpoint): PbCheckpoint { function toChangeID(changeID: ChangeID): PbChangeID { return new PbChangeID({ clientSeq: changeID.getClientSeq(), - lamport: changeID.getLamportAsString(), + lamport: changeID.getLamport(), actorId: toUint8Array(changeID.getActorID()), }); } @@ -174,7 +173,7 @@ function toTimeTicket(ticket?: TimeTicket): PbTimeTicket | undefined { } return new PbTimeTicket({ - lamport: ticket.getLamportAsString(), + lamport: ticket.getLamport(), delimiter: ticket.getDelimiter(), actorId: toUint8Array(ticket.getActorID()), }); @@ -805,16 +804,11 @@ export function errorCodeOf(error: ConnectError): string { * `fromChangeID` converts the given Protobuf format to model format. */ function fromChangeID(pbChangeID: PbChangeID): ChangeID { - let serverSeq: Long | undefined; - if (pbChangeID.serverSeq) { - serverSeq = Long.fromString(pbChangeID.serverSeq, true); - } - return ChangeID.of( pbChangeID.clientSeq, - Long.fromString(pbChangeID.lamport, true), + BigInt(pbChangeID.lamport), toHexString(pbChangeID.actorId), - serverSeq, + BigInt(pbChangeID.serverSeq), ); } @@ -827,7 +821,7 @@ function fromTimeTicket(pbTimeTicket?: PbTimeTicket): TimeTicket | undefined { } return TimeTicket.of( - Long.fromString(pbTimeTicket.lamport, true), + BigInt(pbTimeTicket.lamport), pbTimeTicket.delimiter, toHexString(pbTimeTicket.actorId), ); @@ -1314,10 +1308,7 @@ function fromChanges

( * `fromCheckpoint` converts the given Protobuf format to model format. */ function fromCheckpoint(pbCheckpoint: PbCheckpoint): Checkpoint { - return Checkpoint.of( - Long.fromString(pbCheckpoint.serverSeq, true), - pbCheckpoint.clientSeq, - ); + return Checkpoint.of(BigInt(pbCheckpoint.serverSeq), pbCheckpoint.clientSeq); } /** diff --git a/packages/sdk/src/api/yorkie/v1/resources.proto b/packages/sdk/src/api/yorkie/v1/resources.proto index d1a8c3776..9f31d95b0 100644 --- a/packages/sdk/src/api/yorkie/v1/resources.proto +++ b/packages/sdk/src/api/yorkie/v1/resources.proto @@ -57,8 +57,8 @@ message Change { message ChangeID { uint32 client_seq = 1; - int64 server_seq = 2 [jstype = JS_STRING]; - int64 lamport = 3 [jstype = JS_STRING]; + int64 server_seq = 2; + int64 lamport = 3; bytes actor_id = 4; } @@ -136,6 +136,12 @@ message Operation { repeated string attributes_to_remove = 6; map created_at_map_by_actor = 7; } + message ArraySet { + TimeTicket parent_created_at = 1; + TimeTicket created_at = 2; + JSONElementSimple value = 3; + TimeTicket executed_at = 4; + } oneof body { Set set = 1; @@ -148,6 +154,7 @@ message Operation { Increase increase = 8; TreeEdit tree_edit = 9; TreeStyle tree_style = 10; + ArraySet array_set = 11; } } @@ -325,7 +332,7 @@ message Presence { } message Checkpoint { - int64 server_seq = 1 [jstype = JS_STRING]; + int64 server_seq = 1; uint32 client_seq = 2; } @@ -336,7 +343,7 @@ message TextNodePos { } message TimeTicket { - int64 lamport = 1 [jstype = JS_STRING]; + int64 lamport = 1; uint32 delimiter = 2; bytes actor_id = 3; } diff --git a/packages/sdk/src/api/yorkie/v1/resources_pb.ts b/packages/sdk/src/api/yorkie/v1/resources_pb.ts new file mode 100644 index 000000000..c646d98b9 --- /dev/null +++ b/packages/sdk/src/api/yorkie/v1/resources_pb.ts @@ -0,0 +1,2711 @@ +// +// Copyright 2022 The Yorkie Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v1.10.0 with parameter "target=ts,js_import_style=module" +// @generated from file src/api/yorkie/v1/resources.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3, protoInt64, StringValue, Timestamp } from "@bufbuild/protobuf"; + +/** + * @generated from enum yorkie.v1.ValueType + */ +export enum ValueType { + /** + * @generated from enum value: VALUE_TYPE_NULL = 0; + */ + NULL = 0, + + /** + * @generated from enum value: VALUE_TYPE_BOOLEAN = 1; + */ + BOOLEAN = 1, + + /** + * @generated from enum value: VALUE_TYPE_INTEGER = 2; + */ + INTEGER = 2, + + /** + * @generated from enum value: VALUE_TYPE_LONG = 3; + */ + LONG = 3, + + /** + * @generated from enum value: VALUE_TYPE_DOUBLE = 4; + */ + DOUBLE = 4, + + /** + * @generated from enum value: VALUE_TYPE_STRING = 5; + */ + STRING = 5, + + /** + * @generated from enum value: VALUE_TYPE_BYTES = 6; + */ + BYTES = 6, + + /** + * @generated from enum value: VALUE_TYPE_DATE = 7; + */ + DATE = 7, + + /** + * @generated from enum value: VALUE_TYPE_JSON_OBJECT = 8; + */ + JSON_OBJECT = 8, + + /** + * @generated from enum value: VALUE_TYPE_JSON_ARRAY = 9; + */ + JSON_ARRAY = 9, + + /** + * @generated from enum value: VALUE_TYPE_TEXT = 10; + */ + TEXT = 10, + + /** + * @generated from enum value: VALUE_TYPE_INTEGER_CNT = 11; + */ + INTEGER_CNT = 11, + + /** + * @generated from enum value: VALUE_TYPE_LONG_CNT = 12; + */ + LONG_CNT = 12, + + /** + * @generated from enum value: VALUE_TYPE_TREE = 13; + */ + TREE = 13, +} +// Retrieve enum metadata with: proto3.getEnumType(ValueType) +proto3.util.setEnumType(ValueType, "yorkie.v1.ValueType", [ + { no: 0, name: "VALUE_TYPE_NULL" }, + { no: 1, name: "VALUE_TYPE_BOOLEAN" }, + { no: 2, name: "VALUE_TYPE_INTEGER" }, + { no: 3, name: "VALUE_TYPE_LONG" }, + { no: 4, name: "VALUE_TYPE_DOUBLE" }, + { no: 5, name: "VALUE_TYPE_STRING" }, + { no: 6, name: "VALUE_TYPE_BYTES" }, + { no: 7, name: "VALUE_TYPE_DATE" }, + { no: 8, name: "VALUE_TYPE_JSON_OBJECT" }, + { no: 9, name: "VALUE_TYPE_JSON_ARRAY" }, + { no: 10, name: "VALUE_TYPE_TEXT" }, + { no: 11, name: "VALUE_TYPE_INTEGER_CNT" }, + { no: 12, name: "VALUE_TYPE_LONG_CNT" }, + { no: 13, name: "VALUE_TYPE_TREE" }, +]); + +/** + * @generated from enum yorkie.v1.DocEventType + */ +export enum DocEventType { + /** + * @generated from enum value: DOC_EVENT_TYPE_DOCUMENT_CHANGED = 0; + */ + DOCUMENT_CHANGED = 0, + + /** + * @generated from enum value: DOC_EVENT_TYPE_DOCUMENT_WATCHED = 1; + */ + DOCUMENT_WATCHED = 1, + + /** + * @generated from enum value: DOC_EVENT_TYPE_DOCUMENT_UNWATCHED = 2; + */ + DOCUMENT_UNWATCHED = 2, + + /** + * @generated from enum value: DOC_EVENT_TYPE_DOCUMENT_BROADCAST = 3; + */ + DOCUMENT_BROADCAST = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(DocEventType) +proto3.util.setEnumType(DocEventType, "yorkie.v1.DocEventType", [ + { no: 0, name: "DOC_EVENT_TYPE_DOCUMENT_CHANGED" }, + { no: 1, name: "DOC_EVENT_TYPE_DOCUMENT_WATCHED" }, + { no: 2, name: "DOC_EVENT_TYPE_DOCUMENT_UNWATCHED" }, + { no: 3, name: "DOC_EVENT_TYPE_DOCUMENT_BROADCAST" }, +]); + +/** + * /////////////////////////////////////// + * Messages for Snapshot // + * /////////////////////////////////////// + * + * @generated from message yorkie.v1.Snapshot + */ +export class Snapshot extends Message { + /** + * @generated from field: yorkie.v1.JSONElement root = 1; + */ + root?: JSONElement; + + /** + * @generated from field: map presences = 2; + */ + presences: { [key: string]: Presence } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Snapshot"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "root", kind: "message", T: JSONElement }, + { no: 2, name: "presences", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Presence} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Snapshot { + return new Snapshot().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Snapshot { + return new Snapshot().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Snapshot { + return new Snapshot().fromJsonString(jsonString, options); + } + + static equals(a: Snapshot | PlainMessage | undefined, b: Snapshot | PlainMessage | undefined): boolean { + return proto3.util.equals(Snapshot, a, b); + } +} + +/** + * ChangePack is a message that contains all changes that occurred in a document. + * It is used to synchronize changes between clients and servers. + * + * @generated from message yorkie.v1.ChangePack + */ +export class ChangePack extends Message { + /** + * @generated from field: string document_key = 1; + */ + documentKey = ""; + + /** + * @generated from field: yorkie.v1.Checkpoint checkpoint = 2; + */ + checkpoint?: Checkpoint; + + /** + * @generated from field: bytes snapshot = 3; + */ + snapshot = new Uint8Array(0); + + /** + * @generated from field: repeated yorkie.v1.Change changes = 4; + */ + changes: Change[] = []; + + /** + * @generated from field: yorkie.v1.TimeTicket min_synced_ticket = 5; + */ + minSyncedTicket?: TimeTicket; + + /** + * @generated from field: bool is_removed = 6; + */ + isRemoved = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.ChangePack"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "document_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "checkpoint", kind: "message", T: Checkpoint }, + { no: 3, name: "snapshot", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + { no: 4, name: "changes", kind: "message", T: Change, repeated: true }, + { no: 5, name: "min_synced_ticket", kind: "message", T: TimeTicket }, + { no: 6, name: "is_removed", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ChangePack { + return new ChangePack().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ChangePack { + return new ChangePack().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ChangePack { + return new ChangePack().fromJsonString(jsonString, options); + } + + static equals(a: ChangePack | PlainMessage | undefined, b: ChangePack | PlainMessage | undefined): boolean { + return proto3.util.equals(ChangePack, a, b); + } +} + +/** + * @generated from message yorkie.v1.Change + */ +export class Change extends Message { + /** + * @generated from field: yorkie.v1.ChangeID id = 1; + */ + id?: ChangeID; + + /** + * @generated from field: string message = 2; + */ + message = ""; + + /** + * @generated from field: repeated yorkie.v1.Operation operations = 3; + */ + operations: Operation[] = []; + + /** + * @generated from field: yorkie.v1.PresenceChange presence_change = 4; + */ + presenceChange?: PresenceChange; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Change"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "message", T: ChangeID }, + { no: 2, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "operations", kind: "message", T: Operation, repeated: true }, + { no: 4, name: "presence_change", kind: "message", T: PresenceChange }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Change { + return new Change().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Change { + return new Change().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Change { + return new Change().fromJsonString(jsonString, options); + } + + static equals(a: Change | PlainMessage | undefined, b: Change | PlainMessage | undefined): boolean { + return proto3.util.equals(Change, a, b); + } +} + +/** + * @generated from message yorkie.v1.ChangeID + */ +export class ChangeID extends Message { + /** + * @generated from field: uint32 client_seq = 1; + */ + clientSeq = 0; + + /** + * @generated from field: int64 server_seq = 2; + */ + serverSeq = protoInt64.zero; + + /** + * @generated from field: int64 lamport = 3; + */ + lamport = protoInt64.zero; + + /** + * @generated from field: bytes actor_id = 4; + */ + actorId = new Uint8Array(0); + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.ChangeID"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_seq", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 2, name: "server_seq", kind: "scalar", T: 3 /* ScalarType.INT64 */ }, + { no: 3, name: "lamport", kind: "scalar", T: 3 /* ScalarType.INT64 */ }, + { no: 4, name: "actor_id", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ChangeID { + return new ChangeID().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ChangeID { + return new ChangeID().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ChangeID { + return new ChangeID().fromJsonString(jsonString, options); + } + + static equals(a: ChangeID | PlainMessage | undefined, b: ChangeID | PlainMessage | undefined): boolean { + return proto3.util.equals(ChangeID, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation + */ +export class Operation extends Message { + /** + * @generated from oneof yorkie.v1.Operation.body + */ + body: { + /** + * @generated from field: yorkie.v1.Operation.Set set = 1; + */ + value: Operation_Set; + case: "set"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Add add = 2; + */ + value: Operation_Add; + case: "add"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Move move = 3; + */ + value: Operation_Move; + case: "move"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Remove remove = 4; + */ + value: Operation_Remove; + case: "remove"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Edit edit = 5; + */ + value: Operation_Edit; + case: "edit"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Select select = 6; + */ + value: Operation_Select; + case: "select"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Style style = 7; + */ + value: Operation_Style; + case: "style"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Increase increase = 8; + */ + value: Operation_Increase; + case: "increase"; + } | { + /** + * @generated from field: yorkie.v1.Operation.TreeEdit tree_edit = 9; + */ + value: Operation_TreeEdit; + case: "treeEdit"; + } | { + /** + * @generated from field: yorkie.v1.Operation.TreeStyle tree_style = 10; + */ + value: Operation_TreeStyle; + case: "treeStyle"; + } | { + /** + * @generated from field: yorkie.v1.Operation.ArraySet array_set = 11; + */ + value: Operation_ArraySet; + case: "arraySet"; + } | { case: undefined; value?: undefined } = { case: undefined }; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "set", kind: "message", T: Operation_Set, oneof: "body" }, + { no: 2, name: "add", kind: "message", T: Operation_Add, oneof: "body" }, + { no: 3, name: "move", kind: "message", T: Operation_Move, oneof: "body" }, + { no: 4, name: "remove", kind: "message", T: Operation_Remove, oneof: "body" }, + { no: 5, name: "edit", kind: "message", T: Operation_Edit, oneof: "body" }, + { no: 6, name: "select", kind: "message", T: Operation_Select, oneof: "body" }, + { no: 7, name: "style", kind: "message", T: Operation_Style, oneof: "body" }, + { no: 8, name: "increase", kind: "message", T: Operation_Increase, oneof: "body" }, + { no: 9, name: "tree_edit", kind: "message", T: Operation_TreeEdit, oneof: "body" }, + { no: 10, name: "tree_style", kind: "message", T: Operation_TreeStyle, oneof: "body" }, + { no: 11, name: "array_set", kind: "message", T: Operation_ArraySet, oneof: "body" }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation { + return new Operation().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation { + return new Operation().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation { + return new Operation().fromJsonString(jsonString, options); + } + + static equals(a: Operation | PlainMessage | undefined, b: Operation | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.Set + */ +export class Operation_Set extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: string key = 2; + */ + key = ""; + + /** + * @generated from field: yorkie.v1.JSONElementSimple value = 3; + */ + value?: JSONElementSimple; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.Set"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "value", kind: "message", T: JSONElementSimple }, + { no: 4, name: "executed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Set { + return new Operation_Set().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Set { + return new Operation_Set().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_Set { + return new Operation_Set().fromJsonString(jsonString, options); + } + + static equals(a: Operation_Set | PlainMessage | undefined, b: Operation_Set | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_Set, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.Add + */ +export class Operation_Add extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket prev_created_at = 2; + */ + prevCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.JSONElementSimple value = 3; + */ + value?: JSONElementSimple; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.Add"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "prev_created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "value", kind: "message", T: JSONElementSimple }, + { no: 4, name: "executed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Add { + return new Operation_Add().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Add { + return new Operation_Add().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_Add { + return new Operation_Add().fromJsonString(jsonString, options); + } + + static equals(a: Operation_Add | PlainMessage | undefined, b: Operation_Add | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_Add, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.Move + */ +export class Operation_Move extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket prev_created_at = 2; + */ + prevCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 3; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.Move"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "prev_created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "created_at", kind: "message", T: TimeTicket }, + { no: 4, name: "executed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Move { + return new Operation_Move().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Move { + return new Operation_Move().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_Move { + return new Operation_Move().fromJsonString(jsonString, options); + } + + static equals(a: Operation_Move | PlainMessage | undefined, b: Operation_Move | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_Move, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.Remove + */ +export class Operation_Remove extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 3; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.Remove"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "executed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Remove { + return new Operation_Remove().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Remove { + return new Operation_Remove().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_Remove { + return new Operation_Remove().fromJsonString(jsonString, options); + } + + static equals(a: Operation_Remove | PlainMessage | undefined, b: Operation_Remove | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_Remove, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.Edit + */ +export class Operation_Edit extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TextNodePos from = 2; + */ + from?: TextNodePos; + + /** + * @generated from field: yorkie.v1.TextNodePos to = 3; + */ + to?: TextNodePos; + + /** + * @generated from field: map created_at_map_by_actor = 4; + */ + createdAtMapByActor: { [key: string]: TimeTicket } = {}; + + /** + * @generated from field: string content = 5; + */ + content = ""; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 6; + */ + executedAt?: TimeTicket; + + /** + * @generated from field: map attributes = 7; + */ + attributes: { [key: string]: string } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.Edit"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TextNodePos }, + { no: 3, name: "to", kind: "message", T: TextNodePos }, + { no: 4, name: "created_at_map_by_actor", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: TimeTicket} }, + { no: 5, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "executed_at", kind: "message", T: TimeTicket }, + { no: 7, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Edit { + return new Operation_Edit().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Edit { + return new Operation_Edit().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_Edit { + return new Operation_Edit().fromJsonString(jsonString, options); + } + + static equals(a: Operation_Edit | PlainMessage | undefined, b: Operation_Edit | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_Edit, a, b); + } +} + +/** + * NOTE(hackerwins): Select Operation is not used in the current version. + * In the previous version, it was used to represent selection of Text. + * However, it has been replaced by Presence now. It is retained for backward + * compatibility purposes. + * + * @generated from message yorkie.v1.Operation.Select + */ +export class Operation_Select extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TextNodePos from = 2; + */ + from?: TextNodePos; + + /** + * @generated from field: yorkie.v1.TextNodePos to = 3; + */ + to?: TextNodePos; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.Select"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TextNodePos }, + { no: 3, name: "to", kind: "message", T: TextNodePos }, + { no: 4, name: "executed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Select { + return new Operation_Select().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Select { + return new Operation_Select().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_Select { + return new Operation_Select().fromJsonString(jsonString, options); + } + + static equals(a: Operation_Select | PlainMessage | undefined, b: Operation_Select | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_Select, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.Style + */ +export class Operation_Style extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TextNodePos from = 2; + */ + from?: TextNodePos; + + /** + * @generated from field: yorkie.v1.TextNodePos to = 3; + */ + to?: TextNodePos; + + /** + * @generated from field: map attributes = 4; + */ + attributes: { [key: string]: string } = {}; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 5; + */ + executedAt?: TimeTicket; + + /** + * @generated from field: map created_at_map_by_actor = 6; + */ + createdAtMapByActor: { [key: string]: TimeTicket } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.Style"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TextNodePos }, + { no: 3, name: "to", kind: "message", T: TextNodePos }, + { no: 4, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, + { no: 5, name: "executed_at", kind: "message", T: TimeTicket }, + { no: 6, name: "created_at_map_by_actor", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: TimeTicket} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Style { + return new Operation_Style().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Style { + return new Operation_Style().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_Style { + return new Operation_Style().fromJsonString(jsonString, options); + } + + static equals(a: Operation_Style | PlainMessage | undefined, b: Operation_Style | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_Style, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.Increase + */ +export class Operation_Increase extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.JSONElementSimple value = 2; + */ + value?: JSONElementSimple; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 3; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.Increase"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "value", kind: "message", T: JSONElementSimple }, + { no: 3, name: "executed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Increase { + return new Operation_Increase().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Increase { + return new Operation_Increase().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_Increase { + return new Operation_Increase().fromJsonString(jsonString, options); + } + + static equals(a: Operation_Increase | PlainMessage | undefined, b: Operation_Increase | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_Increase, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.TreeEdit + */ +export class Operation_TreeEdit extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TreePos from = 2; + */ + from?: TreePos; + + /** + * @generated from field: yorkie.v1.TreePos to = 3; + */ + to?: TreePos; + + /** + * @generated from field: map created_at_map_by_actor = 4; + */ + createdAtMapByActor: { [key: string]: TimeTicket } = {}; + + /** + * @generated from field: repeated yorkie.v1.TreeNodes contents = 5; + */ + contents: TreeNodes[] = []; + + /** + * @generated from field: int32 split_level = 7; + */ + splitLevel = 0; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 6; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.TreeEdit"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TreePos }, + { no: 3, name: "to", kind: "message", T: TreePos }, + { no: 4, name: "created_at_map_by_actor", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: TimeTicket} }, + { no: 5, name: "contents", kind: "message", T: TreeNodes, repeated: true }, + { no: 7, name: "split_level", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 6, name: "executed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_TreeEdit { + return new Operation_TreeEdit().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_TreeEdit { + return new Operation_TreeEdit().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_TreeEdit { + return new Operation_TreeEdit().fromJsonString(jsonString, options); + } + + static equals(a: Operation_TreeEdit | PlainMessage | undefined, b: Operation_TreeEdit | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_TreeEdit, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.TreeStyle + */ +export class Operation_TreeStyle extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TreePos from = 2; + */ + from?: TreePos; + + /** + * @generated from field: yorkie.v1.TreePos to = 3; + */ + to?: TreePos; + + /** + * @generated from field: map attributes = 4; + */ + attributes: { [key: string]: string } = {}; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 5; + */ + executedAt?: TimeTicket; + + /** + * @generated from field: repeated string attributes_to_remove = 6; + */ + attributesToRemove: string[] = []; + + /** + * @generated from field: map created_at_map_by_actor = 7; + */ + createdAtMapByActor: { [key: string]: TimeTicket } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.TreeStyle"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TreePos }, + { no: 3, name: "to", kind: "message", T: TreePos }, + { no: 4, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, + { no: 5, name: "executed_at", kind: "message", T: TimeTicket }, + { no: 6, name: "attributes_to_remove", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 7, name: "created_at_map_by_actor", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: TimeTicket} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_TreeStyle { + return new Operation_TreeStyle().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_TreeStyle { + return new Operation_TreeStyle().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_TreeStyle { + return new Operation_TreeStyle().fromJsonString(jsonString, options); + } + + static equals(a: Operation_TreeStyle | PlainMessage | undefined, b: Operation_TreeStyle | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_TreeStyle, a, b); + } +} + +/** + * @generated from message yorkie.v1.Operation.ArraySet + */ +export class Operation_ArraySet extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.JSONElementSimple value = 3; + */ + value?: JSONElementSimple; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Operation.ArraySet"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "value", kind: "message", T: JSONElementSimple }, + { no: 4, name: "executed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_ArraySet { + return new Operation_ArraySet().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_ArraySet { + return new Operation_ArraySet().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Operation_ArraySet { + return new Operation_ArraySet().fromJsonString(jsonString, options); + } + + static equals(a: Operation_ArraySet | PlainMessage | undefined, b: Operation_ArraySet | PlainMessage | undefined): boolean { + return proto3.util.equals(Operation_ArraySet, a, b); + } +} + +/** + * @generated from message yorkie.v1.JSONElementSimple + */ +export class JSONElementSimple extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 2; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 3; + */ + removedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.ValueType type = 4; + */ + type = ValueType.NULL; + + /** + * @generated from field: bytes value = 5; + */ + value = new Uint8Array(0); + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.JSONElementSimple"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 3, name: "removed_at", kind: "message", T: TimeTicket }, + { no: 4, name: "type", kind: "enum", T: proto3.getEnumType(ValueType) }, + { no: 5, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElementSimple { + return new JSONElementSimple().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElementSimple { + return new JSONElementSimple().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): JSONElementSimple { + return new JSONElementSimple().fromJsonString(jsonString, options); + } + + static equals(a: JSONElementSimple | PlainMessage | undefined, b: JSONElementSimple | PlainMessage | undefined): boolean { + return proto3.util.equals(JSONElementSimple, a, b); + } +} + +/** + * @generated from message yorkie.v1.JSONElement + */ +export class JSONElement extends Message { + /** + * @generated from oneof yorkie.v1.JSONElement.body + */ + body: { + /** + * @generated from field: yorkie.v1.JSONElement.JSONObject json_object = 1; + */ + value: JSONElement_JSONObject; + case: "jsonObject"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.JSONArray json_array = 2; + */ + value: JSONElement_JSONArray; + case: "jsonArray"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.Primitive primitive = 3; + */ + value: JSONElement_Primitive; + case: "primitive"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.Text text = 5; + */ + value: JSONElement_Text; + case: "text"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.Counter counter = 6; + */ + value: JSONElement_Counter; + case: "counter"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.Tree tree = 7; + */ + value: JSONElement_Tree; + case: "tree"; + } | { case: undefined; value?: undefined } = { case: undefined }; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.JSONElement"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "json_object", kind: "message", T: JSONElement_JSONObject, oneof: "body" }, + { no: 2, name: "json_array", kind: "message", T: JSONElement_JSONArray, oneof: "body" }, + { no: 3, name: "primitive", kind: "message", T: JSONElement_Primitive, oneof: "body" }, + { no: 5, name: "text", kind: "message", T: JSONElement_Text, oneof: "body" }, + { no: 6, name: "counter", kind: "message", T: JSONElement_Counter, oneof: "body" }, + { no: 7, name: "tree", kind: "message", T: JSONElement_Tree, oneof: "body" }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement { + return new JSONElement().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement { + return new JSONElement().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): JSONElement { + return new JSONElement().fromJsonString(jsonString, options); + } + + static equals(a: JSONElement | PlainMessage | undefined, b: JSONElement | PlainMessage | undefined): boolean { + return proto3.util.equals(JSONElement, a, b); + } +} + +/** + * @generated from message yorkie.v1.JSONElement.JSONObject + */ +export class JSONElement_JSONObject extends Message { + /** + * @generated from field: repeated yorkie.v1.RHTNode nodes = 1; + */ + nodes: RHTNode[] = []; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 3; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.JSONElement.JSONObject"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "nodes", kind: "message", T: RHTNode, repeated: true }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_JSONObject { + return new JSONElement_JSONObject().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_JSONObject { + return new JSONElement_JSONObject().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_JSONObject { + return new JSONElement_JSONObject().fromJsonString(jsonString, options); + } + + static equals(a: JSONElement_JSONObject | PlainMessage | undefined, b: JSONElement_JSONObject | PlainMessage | undefined): boolean { + return proto3.util.equals(JSONElement_JSONObject, a, b); + } +} + +/** + * @generated from message yorkie.v1.JSONElement.JSONArray + */ +export class JSONElement_JSONArray extends Message { + /** + * @generated from field: repeated yorkie.v1.RGANode nodes = 1; + */ + nodes: RGANode[] = []; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 3; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.JSONElement.JSONArray"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "nodes", kind: "message", T: RGANode, repeated: true }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_JSONArray { + return new JSONElement_JSONArray().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_JSONArray { + return new JSONElement_JSONArray().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_JSONArray { + return new JSONElement_JSONArray().fromJsonString(jsonString, options); + } + + static equals(a: JSONElement_JSONArray | PlainMessage | undefined, b: JSONElement_JSONArray | PlainMessage | undefined): boolean { + return proto3.util.equals(JSONElement_JSONArray, a, b); + } +} + +/** + * @generated from message yorkie.v1.JSONElement.Primitive + */ +export class JSONElement_Primitive extends Message { + /** + * @generated from field: yorkie.v1.ValueType type = 1; + */ + type = ValueType.NULL; + + /** + * @generated from field: bytes value = 2; + */ + value = new Uint8Array(0); + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 3; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 4; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 5; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.JSONElement.Primitive"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(ValueType) }, + { no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + { no: 3, name: "created_at", kind: "message", T: TimeTicket }, + { no: 4, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 5, name: "removed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Primitive { + return new JSONElement_Primitive().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Primitive { + return new JSONElement_Primitive().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Primitive { + return new JSONElement_Primitive().fromJsonString(jsonString, options); + } + + static equals(a: JSONElement_Primitive | PlainMessage | undefined, b: JSONElement_Primitive | PlainMessage | undefined): boolean { + return proto3.util.equals(JSONElement_Primitive, a, b); + } +} + +/** + * @generated from message yorkie.v1.JSONElement.Text + */ +export class JSONElement_Text extends Message { + /** + * @generated from field: repeated yorkie.v1.TextNode nodes = 1; + */ + nodes: TextNode[] = []; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 3; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.JSONElement.Text"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "nodes", kind: "message", T: TextNode, repeated: true }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Text { + return new JSONElement_Text().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Text { + return new JSONElement_Text().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Text { + return new JSONElement_Text().fromJsonString(jsonString, options); + } + + static equals(a: JSONElement_Text | PlainMessage | undefined, b: JSONElement_Text | PlainMessage | undefined): boolean { + return proto3.util.equals(JSONElement_Text, a, b); + } +} + +/** + * @generated from message yorkie.v1.JSONElement.Counter + */ +export class JSONElement_Counter extends Message { + /** + * @generated from field: yorkie.v1.ValueType type = 1; + */ + type = ValueType.NULL; + + /** + * @generated from field: bytes value = 2; + */ + value = new Uint8Array(0); + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 3; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 4; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 5; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.JSONElement.Counter"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(ValueType) }, + { no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + { no: 3, name: "created_at", kind: "message", T: TimeTicket }, + { no: 4, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 5, name: "removed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Counter { + return new JSONElement_Counter().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Counter { + return new JSONElement_Counter().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Counter { + return new JSONElement_Counter().fromJsonString(jsonString, options); + } + + static equals(a: JSONElement_Counter | PlainMessage | undefined, b: JSONElement_Counter | PlainMessage | undefined): boolean { + return proto3.util.equals(JSONElement_Counter, a, b); + } +} + +/** + * @generated from message yorkie.v1.JSONElement.Tree + */ +export class JSONElement_Tree extends Message { + /** + * @generated from field: repeated yorkie.v1.TreeNode nodes = 1; + */ + nodes: TreeNode[] = []; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 3; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.JSONElement.Tree"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "nodes", kind: "message", T: TreeNode, repeated: true }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Tree { + return new JSONElement_Tree().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Tree { + return new JSONElement_Tree().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Tree { + return new JSONElement_Tree().fromJsonString(jsonString, options); + } + + static equals(a: JSONElement_Tree | PlainMessage | undefined, b: JSONElement_Tree | PlainMessage | undefined): boolean { + return proto3.util.equals(JSONElement_Tree, a, b); + } +} + +/** + * @generated from message yorkie.v1.RHTNode + */ +export class RHTNode extends Message { + /** + * @generated from field: string key = 1; + */ + key = ""; + + /** + * @generated from field: yorkie.v1.JSONElement element = 2; + */ + element?: JSONElement; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.RHTNode"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "element", kind: "message", T: JSONElement }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): RHTNode { + return new RHTNode().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): RHTNode { + return new RHTNode().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): RHTNode { + return new RHTNode().fromJsonString(jsonString, options); + } + + static equals(a: RHTNode | PlainMessage | undefined, b: RHTNode | PlainMessage | undefined): boolean { + return proto3.util.equals(RHTNode, a, b); + } +} + +/** + * @generated from message yorkie.v1.RGANode + */ +export class RGANode extends Message { + /** + * @generated from field: yorkie.v1.RGANode next = 1; + */ + next?: RGANode; + + /** + * @generated from field: yorkie.v1.JSONElement element = 2; + */ + element?: JSONElement; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.RGANode"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "next", kind: "message", T: RGANode }, + { no: 2, name: "element", kind: "message", T: JSONElement }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): RGANode { + return new RGANode().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): RGANode { + return new RGANode().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): RGANode { + return new RGANode().fromJsonString(jsonString, options); + } + + static equals(a: RGANode | PlainMessage | undefined, b: RGANode | PlainMessage | undefined): boolean { + return proto3.util.equals(RGANode, a, b); + } +} + +/** + * @generated from message yorkie.v1.NodeAttr + */ +export class NodeAttr extends Message { + /** + * @generated from field: string value = 1; + */ + value = ""; + + /** + * @generated from field: yorkie.v1.TimeTicket updated_at = 2; + */ + updatedAt?: TimeTicket; + + /** + * @generated from field: bool is_removed = 3; + */ + isRemoved = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.NodeAttr"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "updated_at", kind: "message", T: TimeTicket }, + { no: 3, name: "is_removed", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): NodeAttr { + return new NodeAttr().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): NodeAttr { + return new NodeAttr().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): NodeAttr { + return new NodeAttr().fromJsonString(jsonString, options); + } + + static equals(a: NodeAttr | PlainMessage | undefined, b: NodeAttr | PlainMessage | undefined): boolean { + return proto3.util.equals(NodeAttr, a, b); + } +} + +/** + * @generated from message yorkie.v1.TextNode + */ +export class TextNode extends Message { + /** + * @generated from field: yorkie.v1.TextNodeID id = 1; + */ + id?: TextNodeID; + + /** + * @generated from field: string value = 2; + */ + value = ""; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 3; + */ + removedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TextNodeID ins_prev_id = 4; + */ + insPrevId?: TextNodeID; + + /** + * @generated from field: map attributes = 5; + */ + attributes: { [key: string]: NodeAttr } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.TextNode"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "message", T: TextNodeID }, + { no: 2, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "removed_at", kind: "message", T: TimeTicket }, + { no: 4, name: "ins_prev_id", kind: "message", T: TextNodeID }, + { no: 5, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: NodeAttr} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TextNode { + return new TextNode().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TextNode { + return new TextNode().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TextNode { + return new TextNode().fromJsonString(jsonString, options); + } + + static equals(a: TextNode | PlainMessage | undefined, b: TextNode | PlainMessage | undefined): boolean { + return proto3.util.equals(TextNode, a, b); + } +} + +/** + * @generated from message yorkie.v1.TextNodeID + */ +export class TextNodeID extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: int32 offset = 2; + */ + offset = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.TextNodeID"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TextNodeID { + return new TextNodeID().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TextNodeID { + return new TextNodeID().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TextNodeID { + return new TextNodeID().fromJsonString(jsonString, options); + } + + static equals(a: TextNodeID | PlainMessage | undefined, b: TextNodeID | PlainMessage | undefined): boolean { + return proto3.util.equals(TextNodeID, a, b); + } +} + +/** + * @generated from message yorkie.v1.TreeNode + */ +export class TreeNode extends Message { + /** + * @generated from field: yorkie.v1.TreeNodeID id = 1; + */ + id?: TreeNodeID; + + /** + * @generated from field: string type = 2; + */ + type = ""; + + /** + * @generated from field: string value = 3; + */ + value = ""; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TreeNodeID ins_prev_id = 5; + */ + insPrevId?: TreeNodeID; + + /** + * @generated from field: yorkie.v1.TreeNodeID ins_next_id = 6; + */ + insNextId?: TreeNodeID; + + /** + * @generated from field: int32 depth = 7; + */ + depth = 0; + + /** + * @generated from field: map attributes = 8; + */ + attributes: { [key: string]: NodeAttr } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.TreeNode"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "message", T: TreeNodeID }, + { no: 2, name: "type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + { no: 5, name: "ins_prev_id", kind: "message", T: TreeNodeID }, + { no: 6, name: "ins_next_id", kind: "message", T: TreeNodeID }, + { no: 7, name: "depth", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 8, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: NodeAttr} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TreeNode { + return new TreeNode().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TreeNode { + return new TreeNode().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TreeNode { + return new TreeNode().fromJsonString(jsonString, options); + } + + static equals(a: TreeNode | PlainMessage | undefined, b: TreeNode | PlainMessage | undefined): boolean { + return proto3.util.equals(TreeNode, a, b); + } +} + +/** + * @generated from message yorkie.v1.TreeNodes + */ +export class TreeNodes extends Message { + /** + * @generated from field: repeated yorkie.v1.TreeNode content = 1; + */ + content: TreeNode[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.TreeNodes"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "content", kind: "message", T: TreeNode, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TreeNodes { + return new TreeNodes().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TreeNodes { + return new TreeNodes().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TreeNodes { + return new TreeNodes().fromJsonString(jsonString, options); + } + + static equals(a: TreeNodes | PlainMessage | undefined, b: TreeNodes | PlainMessage | undefined): boolean { + return proto3.util.equals(TreeNodes, a, b); + } +} + +/** + * @generated from message yorkie.v1.TreeNodeID + */ +export class TreeNodeID extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: int32 offset = 2; + */ + offset = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.TreeNodeID"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TreeNodeID { + return new TreeNodeID().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TreeNodeID { + return new TreeNodeID().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TreeNodeID { + return new TreeNodeID().fromJsonString(jsonString, options); + } + + static equals(a: TreeNodeID | PlainMessage | undefined, b: TreeNodeID | PlainMessage | undefined): boolean { + return proto3.util.equals(TreeNodeID, a, b); + } +} + +/** + * @generated from message yorkie.v1.TreePos + */ +export class TreePos extends Message { + /** + * @generated from field: yorkie.v1.TreeNodeID parent_id = 1; + */ + parentId?: TreeNodeID; + + /** + * @generated from field: yorkie.v1.TreeNodeID left_sibling_id = 2; + */ + leftSiblingId?: TreeNodeID; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.TreePos"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parent_id", kind: "message", T: TreeNodeID }, + { no: 2, name: "left_sibling_id", kind: "message", T: TreeNodeID }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TreePos { + return new TreePos().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TreePos { + return new TreePos().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TreePos { + return new TreePos().fromJsonString(jsonString, options); + } + + static equals(a: TreePos | PlainMessage | undefined, b: TreePos | PlainMessage | undefined): boolean { + return proto3.util.equals(TreePos, a, b); + } +} + +/** + * @generated from message yorkie.v1.User + */ +export class User extends Message { + /** + * @generated from field: string id = 1; + */ + id = ""; + + /** + * @generated from field: string username = 2; + */ + username = ""; + + /** + * @generated from field: google.protobuf.Timestamp created_at = 3; + */ + createdAt?: Timestamp; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.User"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "created_at", kind: "message", T: Timestamp }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): User { + return new User().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): User { + return new User().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): User { + return new User().fromJsonString(jsonString, options); + } + + static equals(a: User | PlainMessage | undefined, b: User | PlainMessage | undefined): boolean { + return proto3.util.equals(User, a, b); + } +} + +/** + * @generated from message yorkie.v1.Project + */ +export class Project extends Message { + /** + * @generated from field: string id = 1; + */ + id = ""; + + /** + * @generated from field: string name = 2; + */ + name = ""; + + /** + * @generated from field: string public_key = 3; + */ + publicKey = ""; + + /** + * @generated from field: string secret_key = 4; + */ + secretKey = ""; + + /** + * @generated from field: string auth_webhook_url = 5; + */ + authWebhookUrl = ""; + + /** + * @generated from field: repeated string auth_webhook_methods = 6; + */ + authWebhookMethods: string[] = []; + + /** + * @generated from field: string client_deactivate_threshold = 7; + */ + clientDeactivateThreshold = ""; + + /** + * @generated from field: google.protobuf.Timestamp created_at = 8; + */ + createdAt?: Timestamp; + + /** + * @generated from field: google.protobuf.Timestamp updated_at = 9; + */ + updatedAt?: Timestamp; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Project"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "public_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "secret_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "auth_webhook_url", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "auth_webhook_methods", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 7, name: "client_deactivate_threshold", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "created_at", kind: "message", T: Timestamp }, + { no: 9, name: "updated_at", kind: "message", T: Timestamp }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Project { + return new Project().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Project { + return new Project().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Project { + return new Project().fromJsonString(jsonString, options); + } + + static equals(a: Project | PlainMessage | undefined, b: Project | PlainMessage | undefined): boolean { + return proto3.util.equals(Project, a, b); + } +} + +/** + * @generated from message yorkie.v1.UpdatableProjectFields + */ +export class UpdatableProjectFields extends Message { + /** + * @generated from field: google.protobuf.StringValue name = 1; + */ + name?: string; + + /** + * @generated from field: google.protobuf.StringValue auth_webhook_url = 2; + */ + authWebhookUrl?: string; + + /** + * @generated from field: yorkie.v1.UpdatableProjectFields.AuthWebhookMethods auth_webhook_methods = 3; + */ + authWebhookMethods?: UpdatableProjectFields_AuthWebhookMethods; + + /** + * @generated from field: google.protobuf.StringValue client_deactivate_threshold = 4; + */ + clientDeactivateThreshold?: string; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.UpdatableProjectFields"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "name", kind: "message", T: StringValue }, + { no: 2, name: "auth_webhook_url", kind: "message", T: StringValue }, + { no: 3, name: "auth_webhook_methods", kind: "message", T: UpdatableProjectFields_AuthWebhookMethods }, + { no: 4, name: "client_deactivate_threshold", kind: "message", T: StringValue }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdatableProjectFields { + return new UpdatableProjectFields().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdatableProjectFields { + return new UpdatableProjectFields().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): UpdatableProjectFields { + return new UpdatableProjectFields().fromJsonString(jsonString, options); + } + + static equals(a: UpdatableProjectFields | PlainMessage | undefined, b: UpdatableProjectFields | PlainMessage | undefined): boolean { + return proto3.util.equals(UpdatableProjectFields, a, b); + } +} + +/** + * @generated from message yorkie.v1.UpdatableProjectFields.AuthWebhookMethods + */ +export class UpdatableProjectFields_AuthWebhookMethods extends Message { + /** + * @generated from field: repeated string methods = 1; + */ + methods: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.UpdatableProjectFields.AuthWebhookMethods"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "methods", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdatableProjectFields_AuthWebhookMethods { + return new UpdatableProjectFields_AuthWebhookMethods().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdatableProjectFields_AuthWebhookMethods { + return new UpdatableProjectFields_AuthWebhookMethods().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): UpdatableProjectFields_AuthWebhookMethods { + return new UpdatableProjectFields_AuthWebhookMethods().fromJsonString(jsonString, options); + } + + static equals(a: UpdatableProjectFields_AuthWebhookMethods | PlainMessage | undefined, b: UpdatableProjectFields_AuthWebhookMethods | PlainMessage | undefined): boolean { + return proto3.util.equals(UpdatableProjectFields_AuthWebhookMethods, a, b); + } +} + +/** + * @generated from message yorkie.v1.DocumentSummary + */ +export class DocumentSummary extends Message { + /** + * @generated from field: string id = 1; + */ + id = ""; + + /** + * @generated from field: string key = 2; + */ + key = ""; + + /** + * @generated from field: string snapshot = 3; + */ + snapshot = ""; + + /** + * @generated from field: google.protobuf.Timestamp created_at = 4; + */ + createdAt?: Timestamp; + + /** + * @generated from field: google.protobuf.Timestamp accessed_at = 5; + */ + accessedAt?: Timestamp; + + /** + * @generated from field: google.protobuf.Timestamp updated_at = 6; + */ + updatedAt?: Timestamp; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.DocumentSummary"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "snapshot", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "created_at", kind: "message", T: Timestamp }, + { no: 5, name: "accessed_at", kind: "message", T: Timestamp }, + { no: 6, name: "updated_at", kind: "message", T: Timestamp }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): DocumentSummary { + return new DocumentSummary().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): DocumentSummary { + return new DocumentSummary().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): DocumentSummary { + return new DocumentSummary().fromJsonString(jsonString, options); + } + + static equals(a: DocumentSummary | PlainMessage | undefined, b: DocumentSummary | PlainMessage | undefined): boolean { + return proto3.util.equals(DocumentSummary, a, b); + } +} + +/** + * @generated from message yorkie.v1.PresenceChange + */ +export class PresenceChange extends Message { + /** + * @generated from field: yorkie.v1.PresenceChange.ChangeType type = 1; + */ + type = PresenceChange_ChangeType.UNSPECIFIED; + + /** + * @generated from field: yorkie.v1.Presence presence = 2; + */ + presence?: Presence; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.PresenceChange"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(PresenceChange_ChangeType) }, + { no: 2, name: "presence", kind: "message", T: Presence }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): PresenceChange { + return new PresenceChange().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): PresenceChange { + return new PresenceChange().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): PresenceChange { + return new PresenceChange().fromJsonString(jsonString, options); + } + + static equals(a: PresenceChange | PlainMessage | undefined, b: PresenceChange | PlainMessage | undefined): boolean { + return proto3.util.equals(PresenceChange, a, b); + } +} + +/** + * @generated from enum yorkie.v1.PresenceChange.ChangeType + */ +export enum PresenceChange_ChangeType { + /** + * @generated from enum value: CHANGE_TYPE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: CHANGE_TYPE_PUT = 1; + */ + PUT = 1, + + /** + * @generated from enum value: CHANGE_TYPE_DELETE = 2; + */ + DELETE = 2, + + /** + * @generated from enum value: CHANGE_TYPE_CLEAR = 3; + */ + CLEAR = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(PresenceChange_ChangeType) +proto3.util.setEnumType(PresenceChange_ChangeType, "yorkie.v1.PresenceChange.ChangeType", [ + { no: 0, name: "CHANGE_TYPE_UNSPECIFIED" }, + { no: 1, name: "CHANGE_TYPE_PUT" }, + { no: 2, name: "CHANGE_TYPE_DELETE" }, + { no: 3, name: "CHANGE_TYPE_CLEAR" }, +]); + +/** + * @generated from message yorkie.v1.Presence + */ +export class Presence extends Message { + /** + * @generated from field: map data = 1; + */ + data: { [key: string]: string } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Presence"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "data", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Presence { + return new Presence().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Presence { + return new Presence().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Presence { + return new Presence().fromJsonString(jsonString, options); + } + + static equals(a: Presence | PlainMessage | undefined, b: Presence | PlainMessage | undefined): boolean { + return proto3.util.equals(Presence, a, b); + } +} + +/** + * @generated from message yorkie.v1.Checkpoint + */ +export class Checkpoint extends Message { + /** + * @generated from field: int64 server_seq = 1; + */ + serverSeq = protoInt64.zero; + + /** + * @generated from field: uint32 client_seq = 2; + */ + clientSeq = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.Checkpoint"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "server_seq", kind: "scalar", T: 3 /* ScalarType.INT64 */ }, + { no: 2, name: "client_seq", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Checkpoint { + return new Checkpoint().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Checkpoint { + return new Checkpoint().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Checkpoint { + return new Checkpoint().fromJsonString(jsonString, options); + } + + static equals(a: Checkpoint | PlainMessage | undefined, b: Checkpoint | PlainMessage | undefined): boolean { + return proto3.util.equals(Checkpoint, a, b); + } +} + +/** + * @generated from message yorkie.v1.TextNodePos + */ +export class TextNodePos extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: int32 offset = 2; + */ + offset = 0; + + /** + * @generated from field: int32 relative_offset = 3; + */ + relativeOffset = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.TextNodePos"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 3, name: "relative_offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TextNodePos { + return new TextNodePos().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TextNodePos { + return new TextNodePos().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TextNodePos { + return new TextNodePos().fromJsonString(jsonString, options); + } + + static equals(a: TextNodePos | PlainMessage | undefined, b: TextNodePos | PlainMessage | undefined): boolean { + return proto3.util.equals(TextNodePos, a, b); + } +} + +/** + * @generated from message yorkie.v1.TimeTicket + */ +export class TimeTicket extends Message { + /** + * @generated from field: int64 lamport = 1; + */ + lamport = protoInt64.zero; + + /** + * @generated from field: uint32 delimiter = 2; + */ + delimiter = 0; + + /** + * @generated from field: bytes actor_id = 3; + */ + actorId = new Uint8Array(0); + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.TimeTicket"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "lamport", kind: "scalar", T: 3 /* ScalarType.INT64 */ }, + { no: 2, name: "delimiter", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 3, name: "actor_id", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TimeTicket { + return new TimeTicket().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TimeTicket { + return new TimeTicket().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TimeTicket { + return new TimeTicket().fromJsonString(jsonString, options); + } + + static equals(a: TimeTicket | PlainMessage | undefined, b: TimeTicket | PlainMessage | undefined): boolean { + return proto3.util.equals(TimeTicket, a, b); + } +} + +/** + * @generated from message yorkie.v1.DocEventBody + */ +export class DocEventBody extends Message { + /** + * @generated from field: string topic = 1; + */ + topic = ""; + + /** + * @generated from field: bytes payload = 2; + */ + payload = new Uint8Array(0); + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.DocEventBody"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "topic", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): DocEventBody { + return new DocEventBody().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): DocEventBody { + return new DocEventBody().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): DocEventBody { + return new DocEventBody().fromJsonString(jsonString, options); + } + + static equals(a: DocEventBody | PlainMessage | undefined, b: DocEventBody | PlainMessage | undefined): boolean { + return proto3.util.equals(DocEventBody, a, b); + } +} + +/** + * @generated from message yorkie.v1.DocEvent + */ +export class DocEvent extends Message { + /** + * @generated from field: yorkie.v1.DocEventType type = 1; + */ + type = DocEventType.DOCUMENT_CHANGED; + + /** + * @generated from field: string publisher = 2; + */ + publisher = ""; + + /** + * @generated from field: yorkie.v1.DocEventBody body = 3; + */ + body?: DocEventBody; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.DocEvent"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(DocEventType) }, + { no: 2, name: "publisher", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "body", kind: "message", T: DocEventBody }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): DocEvent { + return new DocEvent().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): DocEvent { + return new DocEvent().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): DocEvent { + return new DocEvent().fromJsonString(jsonString, options); + } + + static equals(a: DocEvent | PlainMessage | undefined, b: DocEvent | PlainMessage | undefined): boolean { + return proto3.util.equals(DocEvent, a, b); + } +} + diff --git a/packages/sdk/src/api/yorkie/v1/yorkie.proto b/packages/sdk/src/api/yorkie/v1/yorkie.proto index 279f96f98..34281d342 100644 --- a/packages/sdk/src/api/yorkie/v1/yorkie.proto +++ b/packages/sdk/src/api/yorkie/v1/yorkie.proto @@ -24,7 +24,7 @@ option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; option java_multiple_files = true; option java_package = "dev.yorkie.api.v1"; -// Yorkie is a service that provides a API for SDKs. +// Yorkie is a service that provides an API for SDKs. service YorkieService { rpc ActivateClient (ActivateClientRequest) returns (ActivateClientResponse) {} rpc DeactivateClient (DeactivateClientRequest) returns (DeactivateClientResponse) {} diff --git a/packages/sdk/src/api/yorkie/v1/yorkie_connect.ts b/packages/sdk/src/api/yorkie/v1/yorkie_connect.ts new file mode 100644 index 000000000..8c8340254 --- /dev/null +++ b/packages/sdk/src/api/yorkie/v1/yorkie_connect.ts @@ -0,0 +1,106 @@ +// +// Copyright 2020 The Yorkie Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts,js_import_style=module" +// @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { ActivateClientRequest, ActivateClientResponse, AttachDocumentRequest, AttachDocumentResponse, BroadcastRequest, BroadcastResponse, DeactivateClientRequest, DeactivateClientResponse, DetachDocumentRequest, DetachDocumentResponse, PushPullChangesRequest, PushPullChangesResponse, RemoveDocumentRequest, RemoveDocumentResponse, WatchDocumentRequest, WatchDocumentResponse } from "./yorkie_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * Yorkie is a service that provides an API for SDKs. + * + * @generated from service yorkie.v1.YorkieService + */ +export const YorkieService = { + typeName: "yorkie.v1.YorkieService", + methods: { + /** + * @generated from rpc yorkie.v1.YorkieService.ActivateClient + */ + activateClient: { + name: "ActivateClient", + I: ActivateClientRequest, + O: ActivateClientResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.DeactivateClient + */ + deactivateClient: { + name: "DeactivateClient", + I: DeactivateClientRequest, + O: DeactivateClientResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.AttachDocument + */ + attachDocument: { + name: "AttachDocument", + I: AttachDocumentRequest, + O: AttachDocumentResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.DetachDocument + */ + detachDocument: { + name: "DetachDocument", + I: DetachDocumentRequest, + O: DetachDocumentResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.RemoveDocument + */ + removeDocument: { + name: "RemoveDocument", + I: RemoveDocumentRequest, + O: RemoveDocumentResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.PushPullChanges + */ + pushPullChanges: { + name: "PushPullChanges", + I: PushPullChangesRequest, + O: PushPullChangesResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.WatchDocument + */ + watchDocument: { + name: "WatchDocument", + I: WatchDocumentRequest, + O: WatchDocumentResponse, + kind: MethodKind.ServerStreaming, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.Broadcast + */ + broadcast: { + name: "Broadcast", + I: BroadcastRequest, + O: BroadcastResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/sdk/src/api/yorkie/v1/yorkie_pb.ts b/packages/sdk/src/api/yorkie/v1/yorkie_pb.ts new file mode 100644 index 000000000..231b5adcb --- /dev/null +++ b/packages/sdk/src/api/yorkie/v1/yorkie_pb.ts @@ -0,0 +1,738 @@ +// +// Copyright 2020 The Yorkie Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v1.10.0 with parameter "target=ts,js_import_style=module" +// @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { ChangePack, DocEvent } from "./resources_pb.js"; + +/** + * @generated from message yorkie.v1.ActivateClientRequest + */ +export class ActivateClientRequest extends Message { + /** + * @generated from field: string client_key = 1; + */ + clientKey = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.ActivateClientRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ActivateClientRequest { + return new ActivateClientRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ActivateClientRequest { + return new ActivateClientRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ActivateClientRequest { + return new ActivateClientRequest().fromJsonString(jsonString, options); + } + + static equals(a: ActivateClientRequest | PlainMessage | undefined, b: ActivateClientRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(ActivateClientRequest, a, b); + } +} + +/** + * @generated from message yorkie.v1.ActivateClientResponse + */ +export class ActivateClientResponse extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.ActivateClientResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ActivateClientResponse { + return new ActivateClientResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ActivateClientResponse { + return new ActivateClientResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ActivateClientResponse { + return new ActivateClientResponse().fromJsonString(jsonString, options); + } + + static equals(a: ActivateClientResponse | PlainMessage | undefined, b: ActivateClientResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(ActivateClientResponse, a, b); + } +} + +/** + * @generated from message yorkie.v1.DeactivateClientRequest + */ +export class DeactivateClientRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.DeactivateClientRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): DeactivateClientRequest { + return new DeactivateClientRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): DeactivateClientRequest { + return new DeactivateClientRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): DeactivateClientRequest { + return new DeactivateClientRequest().fromJsonString(jsonString, options); + } + + static equals(a: DeactivateClientRequest | PlainMessage | undefined, b: DeactivateClientRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(DeactivateClientRequest, a, b); + } +} + +/** + * @generated from message yorkie.v1.DeactivateClientResponse + */ +export class DeactivateClientResponse extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.DeactivateClientResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): DeactivateClientResponse { + return new DeactivateClientResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): DeactivateClientResponse { + return new DeactivateClientResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): DeactivateClientResponse { + return new DeactivateClientResponse().fromJsonString(jsonString, options); + } + + static equals(a: DeactivateClientResponse | PlainMessage | undefined, b: DeactivateClientResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(DeactivateClientResponse, a, b); + } +} + +/** + * @generated from message yorkie.v1.AttachDocumentRequest + */ +export class AttachDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId = ""; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 2; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.AttachDocumentRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AttachDocumentRequest { + return new AttachDocumentRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AttachDocumentRequest { + return new AttachDocumentRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AttachDocumentRequest { + return new AttachDocumentRequest().fromJsonString(jsonString, options); + } + + static equals(a: AttachDocumentRequest | PlainMessage | undefined, b: AttachDocumentRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(AttachDocumentRequest, a, b); + } +} + +/** + * @generated from message yorkie.v1.AttachDocumentResponse + */ +export class AttachDocumentResponse extends Message { + /** + * @generated from field: string document_id = 1; + */ + documentId = ""; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 2; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.AttachDocumentResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AttachDocumentResponse { + return new AttachDocumentResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AttachDocumentResponse { + return new AttachDocumentResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AttachDocumentResponse { + return new AttachDocumentResponse().fromJsonString(jsonString, options); + } + + static equals(a: AttachDocumentResponse | PlainMessage | undefined, b: AttachDocumentResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(AttachDocumentResponse, a, b); + } +} + +/** + * @generated from message yorkie.v1.DetachDocumentRequest + */ +export class DetachDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId = ""; + + /** + * @generated from field: string document_id = 2; + */ + documentId = ""; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 3; + */ + changePack?: ChangePack; + + /** + * @generated from field: bool remove_if_not_attached = 4; + */ + removeIfNotAttached = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.DetachDocumentRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "change_pack", kind: "message", T: ChangePack }, + { no: 4, name: "remove_if_not_attached", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): DetachDocumentRequest { + return new DetachDocumentRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): DetachDocumentRequest { + return new DetachDocumentRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): DetachDocumentRequest { + return new DetachDocumentRequest().fromJsonString(jsonString, options); + } + + static equals(a: DetachDocumentRequest | PlainMessage | undefined, b: DetachDocumentRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(DetachDocumentRequest, a, b); + } +} + +/** + * @generated from message yorkie.v1.DetachDocumentResponse + */ +export class DetachDocumentResponse extends Message { + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 2; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.DetachDocumentResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): DetachDocumentResponse { + return new DetachDocumentResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): DetachDocumentResponse { + return new DetachDocumentResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): DetachDocumentResponse { + return new DetachDocumentResponse().fromJsonString(jsonString, options); + } + + static equals(a: DetachDocumentResponse | PlainMessage | undefined, b: DetachDocumentResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(DetachDocumentResponse, a, b); + } +} + +/** + * @generated from message yorkie.v1.WatchDocumentRequest + */ +export class WatchDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId = ""; + + /** + * @generated from field: string document_id = 2; + */ + documentId = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.WatchDocumentRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentRequest { + return new WatchDocumentRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): WatchDocumentRequest { + return new WatchDocumentRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): WatchDocumentRequest { + return new WatchDocumentRequest().fromJsonString(jsonString, options); + } + + static equals(a: WatchDocumentRequest | PlainMessage | undefined, b: WatchDocumentRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(WatchDocumentRequest, a, b); + } +} + +/** + * @generated from message yorkie.v1.WatchDocumentResponse + */ +export class WatchDocumentResponse extends Message { + /** + * @generated from oneof yorkie.v1.WatchDocumentResponse.body + */ + body: { + /** + * @generated from field: yorkie.v1.WatchDocumentResponse.Initialization initialization = 1; + */ + value: WatchDocumentResponse_Initialization; + case: "initialization"; + } | { + /** + * @generated from field: yorkie.v1.DocEvent event = 2; + */ + value: DocEvent; + case: "event"; + } | { case: undefined; value?: undefined } = { case: undefined }; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.WatchDocumentResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "initialization", kind: "message", T: WatchDocumentResponse_Initialization, oneof: "body" }, + { no: 2, name: "event", kind: "message", T: DocEvent, oneof: "body" }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentResponse { + return new WatchDocumentResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): WatchDocumentResponse { + return new WatchDocumentResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): WatchDocumentResponse { + return new WatchDocumentResponse().fromJsonString(jsonString, options); + } + + static equals(a: WatchDocumentResponse | PlainMessage | undefined, b: WatchDocumentResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(WatchDocumentResponse, a, b); + } +} + +/** + * @generated from message yorkie.v1.WatchDocumentResponse.Initialization + */ +export class WatchDocumentResponse_Initialization extends Message { + /** + * @generated from field: repeated string client_ids = 1; + */ + clientIds: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.WatchDocumentResponse.Initialization"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentResponse_Initialization { + return new WatchDocumentResponse_Initialization().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): WatchDocumentResponse_Initialization { + return new WatchDocumentResponse_Initialization().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): WatchDocumentResponse_Initialization { + return new WatchDocumentResponse_Initialization().fromJsonString(jsonString, options); + } + + static equals(a: WatchDocumentResponse_Initialization | PlainMessage | undefined, b: WatchDocumentResponse_Initialization | PlainMessage | undefined): boolean { + return proto3.util.equals(WatchDocumentResponse_Initialization, a, b); + } +} + +/** + * @generated from message yorkie.v1.RemoveDocumentRequest + */ +export class RemoveDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId = ""; + + /** + * @generated from field: string document_id = 2; + */ + documentId = ""; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 3; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.RemoveDocumentRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "change_pack", kind: "message", T: ChangePack }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): RemoveDocumentRequest { + return new RemoveDocumentRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): RemoveDocumentRequest { + return new RemoveDocumentRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): RemoveDocumentRequest { + return new RemoveDocumentRequest().fromJsonString(jsonString, options); + } + + static equals(a: RemoveDocumentRequest | PlainMessage | undefined, b: RemoveDocumentRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(RemoveDocumentRequest, a, b); + } +} + +/** + * @generated from message yorkie.v1.RemoveDocumentResponse + */ +export class RemoveDocumentResponse extends Message { + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 1; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.RemoveDocumentResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "change_pack", kind: "message", T: ChangePack }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): RemoveDocumentResponse { + return new RemoveDocumentResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): RemoveDocumentResponse { + return new RemoveDocumentResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): RemoveDocumentResponse { + return new RemoveDocumentResponse().fromJsonString(jsonString, options); + } + + static equals(a: RemoveDocumentResponse | PlainMessage | undefined, b: RemoveDocumentResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(RemoveDocumentResponse, a, b); + } +} + +/** + * @generated from message yorkie.v1.PushPullChangesRequest + */ +export class PushPullChangesRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId = ""; + + /** + * @generated from field: string document_id = 2; + */ + documentId = ""; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 3; + */ + changePack?: ChangePack; + + /** + * @generated from field: bool push_only = 4; + */ + pushOnly = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.PushPullChangesRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "change_pack", kind: "message", T: ChangePack }, + { no: 4, name: "push_only", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): PushPullChangesRequest { + return new PushPullChangesRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): PushPullChangesRequest { + return new PushPullChangesRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): PushPullChangesRequest { + return new PushPullChangesRequest().fromJsonString(jsonString, options); + } + + static equals(a: PushPullChangesRequest | PlainMessage | undefined, b: PushPullChangesRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(PushPullChangesRequest, a, b); + } +} + +/** + * @generated from message yorkie.v1.PushPullChangesResponse + */ +export class PushPullChangesResponse extends Message { + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 1; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.PushPullChangesResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "change_pack", kind: "message", T: ChangePack }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): PushPullChangesResponse { + return new PushPullChangesResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): PushPullChangesResponse { + return new PushPullChangesResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): PushPullChangesResponse { + return new PushPullChangesResponse().fromJsonString(jsonString, options); + } + + static equals(a: PushPullChangesResponse | PlainMessage | undefined, b: PushPullChangesResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(PushPullChangesResponse, a, b); + } +} + +/** + * @generated from message yorkie.v1.BroadcastRequest + */ +export class BroadcastRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId = ""; + + /** + * @generated from field: string document_id = 2; + */ + documentId = ""; + + /** + * @generated from field: string topic = 3; + */ + topic = ""; + + /** + * @generated from field: bytes payload = 4; + */ + payload = new Uint8Array(0); + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.BroadcastRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "topic", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): BroadcastRequest { + return new BroadcastRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): BroadcastRequest { + return new BroadcastRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): BroadcastRequest { + return new BroadcastRequest().fromJsonString(jsonString, options); + } + + static equals(a: BroadcastRequest | PlainMessage | undefined, b: BroadcastRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(BroadcastRequest, a, b); + } +} + +/** + * @generated from message yorkie.v1.BroadcastResponse + */ +export class BroadcastResponse extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "yorkie.v1.BroadcastResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): BroadcastResponse { + return new BroadcastResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): BroadcastResponse { + return new BroadcastResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): BroadcastResponse { + return new BroadcastResponse().fromJsonString(jsonString, options); + } + + static equals(a: BroadcastResponse | PlainMessage | undefined, b: BroadcastResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(BroadcastResponse, a, b); + } +} + diff --git a/packages/sdk/src/document/change/change_id.ts b/packages/sdk/src/document/change/change_id.ts index d797eb602..142a52817 100644 --- a/packages/sdk/src/document/change/change_id.ts +++ b/packages/sdk/src/document/change/change_id.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import Long from 'long'; import { ActorID, InitialActorID, @@ -28,16 +27,16 @@ export class ChangeID { private clientSeq: number; // `serverSeq` is optional and only present for changes stored on the server. - private serverSeq?: Long; + private serverSeq?: bigint; - private lamport: Long; + private lamport: bigint; private actor: ActorID; constructor( clientSeq: number, - lamport: Long, + lamport: bigint, actor: ActorID, - serverSeq?: Long, + serverSeq?: bigint, ) { this.clientSeq = clientSeq; this.serverSeq = serverSeq; @@ -50,9 +49,9 @@ export class ChangeID { */ public static of( clientSeq: number, - lamport: Long, + lamport: bigint, actor: ActorID, - serverSeq?: Long, + serverSeq?: bigint, ): ChangeID { return new ChangeID(clientSeq, lamport, actor, serverSeq); } @@ -61,7 +60,7 @@ export class ChangeID { * `next` creates a next ID of this ID. */ public next(): ChangeID { - return new ChangeID(this.clientSeq + 1, this.lamport.add(1), this.actor); + return new ChangeID(this.clientSeq + 1, this.lamport + 1n, this.actor); } /** @@ -69,12 +68,12 @@ export class ChangeID { * * {@link https://en.wikipedia.org/wiki/Lamport_timestamps#Algorithm} */ - public syncLamport(otherLamport: Long): ChangeID { - if (otherLamport.greaterThan(this.lamport)) { + public syncLamport(otherLamport: bigint): ChangeID { + if (otherLamport > this.lamport) { return new ChangeID(this.clientSeq, otherLamport, this.actor); } - return new ChangeID(this.clientSeq, this.lamport.add(1), this.actor); + return new ChangeID(this.clientSeq, this.lamport + 1n, this.actor); } /** @@ -111,7 +110,7 @@ export class ChangeID { /** * `getLamport` returns the lamport clock of this ID. */ - public getLamport(): Long { + public getLamport(): bigint { return this.lamport; } @@ -143,8 +142,4 @@ export class ChangeID { * `InitialChangeID` represents the initial state ID. Usually this is used to * represent a state where nothing has been edited. */ -export const InitialChangeID = new ChangeID( - 0, - Long.fromInt(0, true), - InitialActorID, -); +export const InitialChangeID = new ChangeID(0, 0n, InitialActorID); diff --git a/packages/sdk/src/document/change/checkpoint.ts b/packages/sdk/src/document/change/checkpoint.ts index 13077a7a7..50a4a7357 100644 --- a/packages/sdk/src/document/change/checkpoint.ts +++ b/packages/sdk/src/document/change/checkpoint.ts @@ -14,18 +14,16 @@ * limitations under the License. */ -import Long from 'long'; - /** * `Checkpoint` is used to determine the changes sent and received by the * client. This is immutable. * **/ export class Checkpoint { - private serverSeq: Long; + private serverSeq: bigint; private clientSeq: number; - constructor(serverSeq: Long, clientSeq: number) { + constructor(serverSeq: bigint, clientSeq: number) { this.serverSeq = serverSeq; this.clientSeq = clientSeq; } @@ -33,7 +31,7 @@ export class Checkpoint { /** * `of` creates a new instance of Checkpoint. */ - public static of(serverSeq: Long, clientSeq: number): Checkpoint { + public static of(serverSeq: bigint, clientSeq: number): Checkpoint { return new Checkpoint(serverSeq, clientSeq); } @@ -57,9 +55,8 @@ export class Checkpoint { return this; } - const serverSeq = this.serverSeq.greaterThan(other.serverSeq) - ? this.serverSeq - : other.serverSeq; + const serverSeq = + this.serverSeq > other.serverSeq ? this.serverSeq : other.serverSeq; const clientSeq = Math.max(this.clientSeq, other.clientSeq); return Checkpoint.of(serverSeq, clientSeq); } @@ -82,7 +79,7 @@ export class Checkpoint { /** * `getServerSeq` returns the server seq of this checkpoint. */ - public getServerSeq(): Long { + public getServerSeq(): bigint { return this.serverSeq; } @@ -92,8 +89,7 @@ export class Checkpoint { */ public equals(other: Checkpoint): boolean { return ( - this.clientSeq === other.clientSeq && - this.serverSeq.equals(other.serverSeq) + this.clientSeq === other.clientSeq && this.serverSeq == other.serverSeq ); } @@ -109,4 +105,4 @@ export class Checkpoint { /** * `InitialCheckpoint` is the initial value of the checkpoint. */ -export const InitialCheckpoint = new Checkpoint(Long.fromInt(0, true), 0); +export const InitialCheckpoint = new Checkpoint(0n, 0); diff --git a/packages/sdk/src/document/document.ts b/packages/sdk/src/document/document.ts index b0452c83e..c2fb51d9d 100644 --- a/packages/sdk/src/document/document.ts +++ b/packages/sdk/src/document/document.ts @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import Long from 'long'; import type { WatchDocumentResponse } from '@yorkie-js-sdk/src/api/yorkie/v1/yorkie_pb'; import { DocEventType as PbDocEventType } from '@yorkie-js-sdk/src/api/yorkie/v1/resources_pb'; import { logger, LogLevel } from '@yorkie-js-sdk/src/util/logger'; @@ -1382,7 +1381,7 @@ export class Document { /** * `applySnapshot` applies the given snapshot into this document. */ - public applySnapshot(serverSeq: Long, snapshot?: Uint8Array) { + public applySnapshot(serverSeq: bigint, snapshot?: Uint8Array) { const { root, presences } = converter.bytesToSnapshot

(snapshot); this.root = new CRDTRoot(root); this.presences = presences; @@ -1654,10 +1653,7 @@ export class Document { if (event.type === DocEventType.Snapshot) { const { snapshot, serverSeq } = event.value; if (!snapshot) return; - this.applySnapshot( - Long.fromString(serverSeq), - converter.hexToBytes(snapshot), - ); + this.applySnapshot(BigInt(serverSeq), converter.hexToBytes(snapshot)); return; } diff --git a/packages/sdk/src/document/time/ticket.ts b/packages/sdk/src/document/time/ticket.ts index fc4ae15be..f4bad2873 100644 --- a/packages/sdk/src/document/time/ticket.ts +++ b/packages/sdk/src/document/time/ticket.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import Long from 'long'; import { Comparator } from '@yorkie-js-sdk/src/util/comparator'; import { ActorID, @@ -46,11 +45,11 @@ export type TimeTicketStruct = { * @public */ export class TimeTicket { - private lamport: Long; + private lamport: bigint; private delimiter: number; private actorID: ActorID; - constructor(lamport: Long, delimiter: number, actorID: string) { + constructor(lamport: bigint, delimiter: number, actorID: string) { this.lamport = lamport; this.delimiter = delimiter; this.actorID = actorID; @@ -60,7 +59,7 @@ export class TimeTicket { * `of` creates an instance of Ticket. */ public static of( - lamport: Long, + lamport: bigint, delimiter: number, actorID: string, ): TimeTicket { @@ -72,7 +71,7 @@ export class TimeTicket { */ public static fromStruct(struct: TimeTicketStruct): TimeTicket { return TimeTicket.of( - Long.fromString(struct.lamport, true), + BigInt(struct.lamport), struct.delimiter, struct.actorID, ); @@ -123,7 +122,7 @@ export class TimeTicket { /** * `getLamport` returns the lamport. */ - public getLamport(): Long { + public getLamport(): bigint { return this.lamport; } @@ -161,9 +160,9 @@ export class TimeTicket { * If the receiver or argument is nil, it would panic at runtime. */ public compare(other: TimeTicket): number { - if (this.lamport.greaterThan(other.lamport)) { + if (this.lamport > other.lamport) { return 1; - } else if (other.lamport.greaterThan(this.lamport)) { + } else if (other.lamport > this.lamport) { return -1; } @@ -184,20 +183,14 @@ export class TimeTicket { export const InitialDelimiter = 0; export const MaxDelemiter = 4294967295; // UInt32 MAX_VALUE -export const MaxLamport = Long.MAX_VALUE; +export const MaxLamport = 9223372036854775807n; // Int64 MAX_VALUE export const InitialTimeTicket = new TimeTicket( - Long.fromNumber(0), + 0n, InitialDelimiter, InitialActorID, ); -export const NextTimeTicket = new TimeTicket( - Long.fromNumber(1), - InitialDelimiter + 1, - InitialActorID, -); - export const MaxTimeTicket = new TimeTicket( MaxLamport, MaxDelemiter, diff --git a/packages/sdk/test/integration/client_test.ts b/packages/sdk/test/integration/client_test.ts index cf325c647..33cb5952a 100644 --- a/packages/sdk/test/integration/client_test.ts +++ b/packages/sdk/test/integration/client_test.ts @@ -522,12 +522,12 @@ describe.sequential('Client', function () { let checkpoint = d1.getCheckpoint(); assert.equal(checkpoint.getClientSeq(), 1); - assert.equal(checkpoint.getServerSeq().toInt(), 1); + assert.equal(checkpoint.getServerSeq(), 1n); await c1.sync(); checkpoint = d1.getCheckpoint(); assert.equal(checkpoint.getClientSeq(), 2); - assert.equal(checkpoint.getServerSeq().toInt(), 2); + assert.equal(checkpoint.getServerSeq(), 2n); // 03. cli update the document with increasing the counter(0 -> 1) // and sync with push-only mode: CP(2, 2) -> CP(3, 2) @@ -544,7 +544,7 @@ describe.sequential('Client', function () { await eventCollector.waitFor(DocumentSyncStatus.Synced); checkpoint = d1.getCheckpoint(); assert.equal(checkpoint.getClientSeq(), 3); - assert.equal(checkpoint.getServerSeq().toInt(), 2); + assert.equal(checkpoint.getServerSeq(), 2n); await c1.changeSyncMode(d1, SyncMode.Manual); // 04. cli update the document with increasing the counter(1 -> 2) @@ -561,7 +561,7 @@ describe.sequential('Client', function () { await c1.sync(); checkpoint = d1.getCheckpoint(); assert.equal(checkpoint.getClientSeq(), 4); - assert.equal(checkpoint.getServerSeq().toInt(), 4); + assert.equal(checkpoint.getServerSeq(), 4n); assert.equal(d1.getRoot().counter.getValue(), 2); unsub(); diff --git a/packages/sdk/test/integration/object_test.ts b/packages/sdk/test/integration/object_test.ts index b033e100e..77ead77f5 100644 --- a/packages/sdk/test/integration/object_test.ts +++ b/packages/sdk/test/integration/object_test.ts @@ -656,7 +656,7 @@ describe('Object', function () { let doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 1); assert.equal(doc1Checkpoint.getClientSeq(), 1); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 1); + assert.equal(doc1Checkpoint.getServerSeq(), 1n); doc1.update((root) => { root.shape = { color: 'black' }; @@ -667,7 +667,7 @@ describe('Object', function () { doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 2); assert.equal(doc1Checkpoint.getClientSeq(), 2); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 2); + assert.equal(doc1Checkpoint.getServerSeq(), 2n); await client2.attach(doc2, { syncMode: SyncMode.Manual }); assert.equal(doc2.toSortedJSON(), '{"shape":{"color":"black"}}'); @@ -683,7 +683,7 @@ describe('Object', function () { doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 2); assert.equal(doc1Checkpoint.getClientSeq(), 2); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 4); + assert.equal(doc1Checkpoint.getServerSeq(), 4n); // c2 deleted the shape, so the reverse operation cannot be applied doc1.history.undo(); @@ -698,7 +698,7 @@ describe('Object', function () { doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 2); assert.equal(doc1Checkpoint.getClientSeq(), 2); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 4); + assert.equal(doc1Checkpoint.getServerSeq(), 4n); doc1.update((root) => { root.shape = { color: 'red' }; @@ -709,7 +709,7 @@ describe('Object', function () { doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 3); assert.equal(doc1Checkpoint.getClientSeq(), 3); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 5); + assert.equal(doc1Checkpoint.getServerSeq(), 5n); }); it(`Should not propagate changes when there is no applied undo operation`, async function ({ @@ -732,7 +732,7 @@ describe('Object', function () { let doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 1); assert.equal(doc1Checkpoint.getClientSeq(), 1); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 1); + assert.equal(doc1Checkpoint.getServerSeq(), 1n); doc1.update((root) => { root.shape = { color: 'black' }; @@ -743,7 +743,7 @@ describe('Object', function () { doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 2); assert.equal(doc1Checkpoint.getClientSeq(), 2); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 2); + assert.equal(doc1Checkpoint.getServerSeq(), 2n); await client2.attach(doc2, { syncMode: SyncMode.Manual }); assert.equal(doc2.toSortedJSON(), '{"shape":{"color":"black"}}'); @@ -759,7 +759,7 @@ describe('Object', function () { doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 2); assert.equal(doc1Checkpoint.getClientSeq(), 2); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 4); + assert.equal(doc1Checkpoint.getServerSeq(), 4n); // c2 deleted the shape, so the reverse operation cannot be applied doc1.history.undo(); @@ -774,7 +774,7 @@ describe('Object', function () { doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 2); assert.equal(doc1Checkpoint.getClientSeq(), 2); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 4); + assert.equal(doc1Checkpoint.getServerSeq(), 4n); doc1.update((root) => { root.shape = { color: 'red' }; @@ -785,7 +785,7 @@ describe('Object', function () { doc1Checkpoint = doc1.getCheckpoint(); assert.equal(doc1ChangeID.getClientSeq(), 3); assert.equal(doc1Checkpoint.getClientSeq(), 3); - assert.equal(doc1Checkpoint.getServerSeq().toInt(), 5); + assert.equal(doc1Checkpoint.getServerSeq(), 5n); }); it('Can handle concurrent undo/redo: local undo & global redo', async function ({ diff --git a/packages/sdk/tsconfig.json b/packages/sdk/tsconfig.json index 6053b43d6..c1181df3e 100644 --- a/packages/sdk/tsconfig.json +++ b/packages/sdk/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { - "target": "ES2019", + "target": "ES2020", "useDefineForClassFields": true, "module": "ESNext", - "lib": ["ES2019", "dom"], + "lib": ["ES2020", "dom"], "skipLibCheck": true, "outDir": "./lib",