From 4cc4c10f64e7c99571a11ac8315dfa45bedab082 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Sat, 2 Dec 2023 19:49:03 +0900 Subject: [PATCH] Update client runWatchLoop to avoid async promise executor --- src/api/converter.ts | 3 +- src/api/yorkie/v1/resources.proto | 715 +++++----- src/api/yorkie/v1/resources_pb.d.ts | 1897 +++++++++++++++++++++++++ src/api/yorkie/v1/resources_pb.js | 671 +++++++++ src/api/yorkie/v1/yorkie.proto | 213 +-- src/api/yorkie/v1/yorkie_connect.d.ts | 106 ++ src/api/yorkie/v1/yorkie_connect.js | 106 ++ src/api/yorkie/v1/yorkie_pb.d.ts | 504 +++++++ src/api/yorkie/v1/yorkie_pb.js | 205 +++ src/client/client.ts | 27 +- 10 files changed, 3971 insertions(+), 476 deletions(-) create mode 100644 src/api/yorkie/v1/resources_pb.d.ts create mode 100644 src/api/yorkie/v1/resources_pb.js create mode 100644 src/api/yorkie/v1/yorkie_connect.d.ts create mode 100644 src/api/yorkie/v1/yorkie_connect.js create mode 100644 src/api/yorkie/v1/yorkie_pb.d.ts create mode 100644 src/api/yorkie/v1/yorkie_pb.js diff --git a/src/api/converter.ts b/src/api/converter.ts index 39ceca628..163dc3d23 100644 --- a/src/api/converter.ts +++ b/src/api/converter.ts @@ -15,7 +15,6 @@ */ import Long from 'long'; -import * as jspb from 'google-protobuf'; import { Code, YorkieError } from '@yorkie-js-sdk/src/util/error'; import { Indexable } from '@yorkie-js-sdk/src/document/document'; import { @@ -1167,7 +1166,7 @@ function fromOperations(pbOperations: Array): Array { fromTreePos(pbTreeEditOperation!.from!), fromTreePos(pbTreeEditOperation!.to!), fromTreeNodesWhenEdit(pbTreeEditOperation!.contents), - pbTreeEditOperation!.getSplitLevel(), + pbTreeEditOperation!.splitLevel, createdAtMapByActor, fromTimeTicket(pbTreeEditOperation!.executedAt)!, ); diff --git a/src/api/yorkie/v1/resources.proto b/src/api/yorkie/v1/resources.proto index 889c96ed9..3186d6f75 100644 --- a/src/api/yorkie/v1/resources.proto +++ b/src/api/yorkie/v1/resources.proto @@ -15,360 +15,361 @@ */ syntax = "proto3"; -package yorkie.v1; - -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = ".;v1"; - -option java_multiple_files = true; -option java_package = "dev.yorkie.api.v1"; - -///////////////////////////////////////// -// Messages for Snapshot // -///////////////////////////////////////// -message Snapshot { - JSONElement root = 1; - map presences = 2; -} - -///////////////////////////////////////// -// Messages for ChangePack // -///////////////////////////////////////// - -// ChangePack is a message that contains all changes that occurred in a document. -// It is used to synchronize changes between clients and servers. -message ChangePack { - string document_key = 1; - Checkpoint checkpoint = 2; - bytes snapshot = 3; - repeated Change changes = 4; - TimeTicket min_synced_ticket = 5; - bool is_removed = 6; -} - -message Change { - ChangeID id = 1; - string message = 2; - repeated Operation operations = 3; - PresenceChange presence_change = 4; -} - -message ChangeID { - uint32 client_seq = 1; - int64 server_seq = 2 [jstype = JS_STRING]; - int64 lamport = 3 [jstype = JS_STRING]; - bytes actor_id = 4; -} - -message Operation { - message Set { - TimeTicket parent_created_at = 1; - string key = 2; - JSONElementSimple value = 3; - TimeTicket executed_at = 4; - } - message Add { - TimeTicket parent_created_at = 1; - TimeTicket prev_created_at = 2; - JSONElementSimple value = 3; - TimeTicket executed_at = 4; - } - message Move { - TimeTicket parent_created_at = 1; - TimeTicket prev_created_at = 2; - TimeTicket created_at = 3; - TimeTicket executed_at = 4; - } - message Remove { - TimeTicket parent_created_at = 1; - TimeTicket created_at = 2; - TimeTicket executed_at = 3; - } - message Edit { - TimeTicket parent_created_at = 1; - TextNodePos from = 2; - TextNodePos to = 3; - map created_at_map_by_actor = 4; - string content = 5; - TimeTicket executed_at = 6; - map attributes = 7; - } - // 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. - message Select { - TimeTicket parent_created_at = 1; - TextNodePos from = 2; - TextNodePos to = 3; - TimeTicket executed_at = 4; - } - message Style { - TimeTicket parent_created_at = 1; - TextNodePos from = 2; - TextNodePos to = 3; - map attributes = 4; - TimeTicket executed_at = 5; - map created_at_map_by_actor = 6; - } - message Increase { - TimeTicket parent_created_at = 1; - JSONElementSimple value = 2; - TimeTicket executed_at = 3; - } - message TreeEdit { - TimeTicket parent_created_at = 1; - TreePos from = 2; - TreePos to = 3; - map created_at_map_by_actor = 4; - repeated TreeNodes contents = 5; - int32 split_level = 7; - TimeTicket executed_at = 6; - } - message TreeStyle { - TimeTicket parent_created_at = 1; - TreePos from = 2; - TreePos to = 3; - map attributes = 4; - TimeTicket executed_at = 5; - } - - oneof body { - Set set = 1; - Add add = 2; - Move move = 3; - Remove remove = 4; - Edit edit = 5; - Select select = 6; - Style style = 7; - Increase increase = 8; - TreeEdit tree_edit = 9; - TreeStyle tree_style = 10; - } -} - -message JSONElementSimple { - TimeTicket created_at = 1; - TimeTicket moved_at = 2; - TimeTicket removed_at = 3; - ValueType type = 4; - bytes value = 5; -} - -///////////////////////////////////////// -// Messages for JSON // -///////////////////////////////////////// - -message JSONElement { - message JSONObject { - repeated RHTNode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - message JSONArray { - repeated RGANode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - message Primitive { - ValueType type = 1; - bytes value = 2; - TimeTicket created_at = 3; - TimeTicket moved_at = 4; - TimeTicket removed_at = 5; - } - message Text { - repeated TextNode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - message Counter { - ValueType type = 1; - bytes value = 2; - TimeTicket created_at = 3; - TimeTicket moved_at = 4; - TimeTicket removed_at = 5; - } - message Tree { - repeated TreeNode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - - oneof body { - JSONObject json_object = 1; - JSONArray json_array = 2; - Primitive primitive = 3; - Text text = 5; - Counter counter = 6; - Tree tree = 7; - } -} - -message RHTNode { - string key = 1; - JSONElement element = 2; -} - -message RGANode { - RGANode next = 1; - JSONElement element = 2; -} - -message NodeAttr { - string value = 1; - TimeTicket updated_at = 2; -} - -message TextNode { - TextNodeID id = 1; - string value = 2; - TimeTicket removed_at = 3; - TextNodeID ins_prev_id = 4; - map attributes = 5; -} - -message TextNodeID { - TimeTicket created_at = 1; - int32 offset = 2; -} - -message TreeNode { - TreeNodeID id = 1; - string type = 2; - string value = 3; - TimeTicket removed_at = 4; - TreeNodeID ins_prev_id = 5; - TreeNodeID ins_next_id = 6; - int32 depth = 7; - map attributes = 8; -} - -message TreeNodes { - repeated TreeNode content = 1; -} - -message TreeNodeID { - TimeTicket created_at = 1; - int32 offset = 2; -} - -message TreePos { - TreeNodeID parent_id = 1; - TreeNodeID left_sibling_id = 2; -} - -///////////////////////////////////////// -// Messages for Common // -///////////////////////////////////////// - -message User { - string id = 1; - string username = 2; - google.protobuf.Timestamp created_at = 3; -} - -message Project { - string id = 1; - string name = 2; - string public_key = 3; - string secret_key = 4; - string auth_webhook_url = 5; - repeated string auth_webhook_methods = 6; - string client_deactivate_threshold = 7; - google.protobuf.Timestamp created_at = 8; - google.protobuf.Timestamp updated_at = 9; -} - -message UpdatableProjectFields { - message AuthWebhookMethods { - repeated string methods = 1; - } - - google.protobuf.StringValue name = 1; - google.protobuf.StringValue auth_webhook_url = 2; - AuthWebhookMethods auth_webhook_methods = 3; - google.protobuf.StringValue client_deactivate_threshold = 4; -} - -message DocumentSummary { - string id = 1; - string key = 2; - string snapshot = 3; - google.protobuf.Timestamp created_at = 4; - google.protobuf.Timestamp accessed_at = 5; - google.protobuf.Timestamp updated_at = 6; -} - -message PresenceChange { - enum ChangeType { - CHANGE_TYPE_UNSPECIFIED = 0; - CHANGE_TYPE_PUT = 1; - CHANGE_TYPE_DELETE = 2; - CHANGE_TYPE_CLEAR = 3; - } - ChangeType type = 1; - Presence presence = 2; -} - -message Presence { - map data = 1; -} - -message Checkpoint { - int64 server_seq = 1 [jstype = JS_STRING]; - uint32 client_seq = 2; -} - -message TextNodePos { - TimeTicket created_at = 1; - int32 offset = 2; - int32 relative_offset = 3; -} - -message TimeTicket { - int64 lamport = 1 [jstype = JS_STRING]; - uint32 delimiter = 2; - bytes actor_id = 3; -} - -enum ValueType { - VALUE_TYPE_NULL = 0; - VALUE_TYPE_BOOLEAN = 1; - VALUE_TYPE_INTEGER = 2; - VALUE_TYPE_LONG = 3; - VALUE_TYPE_DOUBLE = 4; - VALUE_TYPE_STRING = 5; - VALUE_TYPE_BYTES = 6; - VALUE_TYPE_DATE = 7; - VALUE_TYPE_JSON_OBJECT = 8; - VALUE_TYPE_JSON_ARRAY = 9; - VALUE_TYPE_TEXT = 10; - VALUE_TYPE_INTEGER_CNT = 11; - VALUE_TYPE_LONG_CNT = 12; - VALUE_TYPE_TREE = 13; -} - -enum DocEventType { - DOC_EVENT_TYPE_DOCUMENT_CHANGED = 0; - DOC_EVENT_TYPE_DOCUMENT_WATCHED = 1; - DOC_EVENT_TYPE_DOCUMENT_UNWATCHED = 2; - DOC_EVENT_TYPE_DOCUMENT_BROADCAST = 3; -} - -message DocEventBody { - string topic = 1; - bytes payload = 2; -} - -message DocEvent { - DocEventType type = 1; - string publisher = 2; - DocEventBody body = 3; -} + package yorkie.v1; + + import "google/protobuf/timestamp.proto"; + import "google/protobuf/wrappers.proto"; + + option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; + + option java_multiple_files = true; + option java_package = "dev.yorkie.api.v1"; + + ///////////////////////////////////////// + // Messages for Snapshot // + ///////////////////////////////////////// + message Snapshot { + JSONElement root = 1; + map presences = 2; + } + + ///////////////////////////////////////// + // Messages for ChangePack // + ///////////////////////////////////////// + + // ChangePack is a message that contains all changes that occurred in a document. + // It is used to synchronize changes between clients and servers. + message ChangePack { + string document_key = 1; + Checkpoint checkpoint = 2; + bytes snapshot = 3; + repeated Change changes = 4; + TimeTicket min_synced_ticket = 5; + bool is_removed = 6; + } + + message Change { + ChangeID id = 1; + string message = 2; + repeated Operation operations = 3; + PresenceChange presence_change = 4; + } + + message ChangeID { + uint32 client_seq = 1; + int64 server_seq = 2 [jstype = JS_STRING]; + int64 lamport = 3 [jstype = JS_STRING]; + bytes actor_id = 4; + } + + message Operation { + message Set { + TimeTicket parent_created_at = 1; + string key = 2; + JSONElementSimple value = 3; + TimeTicket executed_at = 4; + } + message Add { + TimeTicket parent_created_at = 1; + TimeTicket prev_created_at = 2; + JSONElementSimple value = 3; + TimeTicket executed_at = 4; + } + message Move { + TimeTicket parent_created_at = 1; + TimeTicket prev_created_at = 2; + TimeTicket created_at = 3; + TimeTicket executed_at = 4; + } + message Remove { + TimeTicket parent_created_at = 1; + TimeTicket created_at = 2; + TimeTicket executed_at = 3; + } + message Edit { + TimeTicket parent_created_at = 1; + TextNodePos from = 2; + TextNodePos to = 3; + map created_at_map_by_actor = 4; + string content = 5; + TimeTicket executed_at = 6; + map attributes = 7; + } + // 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. + message Select { + TimeTicket parent_created_at = 1; + TextNodePos from = 2; + TextNodePos to = 3; + TimeTicket executed_at = 4; + } + message Style { + TimeTicket parent_created_at = 1; + TextNodePos from = 2; + TextNodePos to = 3; + map attributes = 4; + TimeTicket executed_at = 5; + map created_at_map_by_actor = 6; + } + message Increase { + TimeTicket parent_created_at = 1; + JSONElementSimple value = 2; + TimeTicket executed_at = 3; + } + message TreeEdit { + TimeTicket parent_created_at = 1; + TreePos from = 2; + TreePos to = 3; + map created_at_map_by_actor = 4; + repeated TreeNodes contents = 5; + int32 split_level = 7; + TimeTicket executed_at = 6; + } + message TreeStyle { + TimeTicket parent_created_at = 1; + TreePos from = 2; + TreePos to = 3; + map attributes = 4; + TimeTicket executed_at = 5; + } + + oneof body { + Set set = 1; + Add add = 2; + Move move = 3; + Remove remove = 4; + Edit edit = 5; + Select select = 6; + Style style = 7; + Increase increase = 8; + TreeEdit tree_edit = 9; + TreeStyle tree_style = 10; + } + } + + message JSONElementSimple { + TimeTicket created_at = 1; + TimeTicket moved_at = 2; + TimeTicket removed_at = 3; + ValueType type = 4; + bytes value = 5; + } + + ///////////////////////////////////////// + // Messages for JSON // + ///////////////////////////////////////// + + message JSONElement { + message JSONObject { + repeated RHTNode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + message JSONArray { + repeated RGANode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + message Primitive { + ValueType type = 1; + bytes value = 2; + TimeTicket created_at = 3; + TimeTicket moved_at = 4; + TimeTicket removed_at = 5; + } + message Text { + repeated TextNode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + message Counter { + ValueType type = 1; + bytes value = 2; + TimeTicket created_at = 3; + TimeTicket moved_at = 4; + TimeTicket removed_at = 5; + } + message Tree { + repeated TreeNode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + + oneof body { + JSONObject json_object = 1; + JSONArray json_array = 2; + Primitive primitive = 3; + Text text = 5; + Counter counter = 6; + Tree tree = 7; + } + } + + message RHTNode { + string key = 1; + JSONElement element = 2; + } + + message RGANode { + RGANode next = 1; + JSONElement element = 2; + } + + message NodeAttr { + string value = 1; + TimeTicket updated_at = 2; + } + + message TextNode { + TextNodeID id = 1; + string value = 2; + TimeTicket removed_at = 3; + TextNodeID ins_prev_id = 4; + map attributes = 5; + } + + message TextNodeID { + TimeTicket created_at = 1; + int32 offset = 2; + } + + message TreeNode { + TreeNodeID id = 1; + string type = 2; + string value = 3; + TimeTicket removed_at = 4; + TreeNodeID ins_prev_id = 5; + TreeNodeID ins_next_id = 6; + int32 depth = 7; + map attributes = 8; + } + + message TreeNodes { + repeated TreeNode content = 1; + } + + message TreeNodeID { + TimeTicket created_at = 1; + int32 offset = 2; + } + + message TreePos { + TreeNodeID parent_id = 1; + TreeNodeID left_sibling_id = 2; + } + + ///////////////////////////////////////// + // Messages for Common // + ///////////////////////////////////////// + + message User { + string id = 1; + string username = 2; + google.protobuf.Timestamp created_at = 3; + } + + message Project { + string id = 1; + string name = 2; + string public_key = 3; + string secret_key = 4; + string auth_webhook_url = 5; + repeated string auth_webhook_methods = 6; + string client_deactivate_threshold = 7; + google.protobuf.Timestamp created_at = 8; + google.protobuf.Timestamp updated_at = 9; + } + + message UpdatableProjectFields { + message AuthWebhookMethods { + repeated string methods = 1; + } + + google.protobuf.StringValue name = 1; + google.protobuf.StringValue auth_webhook_url = 2; + AuthWebhookMethods auth_webhook_methods = 3; + google.protobuf.StringValue client_deactivate_threshold = 4; + } + + message DocumentSummary { + string id = 1; + string key = 2; + string snapshot = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp accessed_at = 5; + google.protobuf.Timestamp updated_at = 6; + } + + message PresenceChange { + enum ChangeType { + CHANGE_TYPE_UNSPECIFIED = 0; + CHANGE_TYPE_PUT = 1; + CHANGE_TYPE_DELETE = 2; + CHANGE_TYPE_CLEAR = 3; + } + ChangeType type = 1; + Presence presence = 2; + } + + message Presence { + map data = 1; + } + + message Checkpoint { + int64 server_seq = 1 [jstype = JS_STRING]; + uint32 client_seq = 2; + } + + message TextNodePos { + TimeTicket created_at = 1; + int32 offset = 2; + int32 relative_offset = 3; + } + + message TimeTicket { + int64 lamport = 1 [jstype = JS_STRING]; + uint32 delimiter = 2; + bytes actor_id = 3; + } + + enum ValueType { + VALUE_TYPE_NULL = 0; + VALUE_TYPE_BOOLEAN = 1; + VALUE_TYPE_INTEGER = 2; + VALUE_TYPE_LONG = 3; + VALUE_TYPE_DOUBLE = 4; + VALUE_TYPE_STRING = 5; + VALUE_TYPE_BYTES = 6; + VALUE_TYPE_DATE = 7; + VALUE_TYPE_JSON_OBJECT = 8; + VALUE_TYPE_JSON_ARRAY = 9; + VALUE_TYPE_TEXT = 10; + VALUE_TYPE_INTEGER_CNT = 11; + VALUE_TYPE_LONG_CNT = 12; + VALUE_TYPE_TREE = 13; + } + + enum DocEventType { + DOC_EVENT_TYPE_DOCUMENT_CHANGED = 0; + DOC_EVENT_TYPE_DOCUMENT_WATCHED = 1; + DOC_EVENT_TYPE_DOCUMENT_UNWATCHED = 2; + DOC_EVENT_TYPE_DOCUMENT_BROADCAST = 3; + } + + message DocEventBody { + string topic = 1; + bytes payload = 2; + } + + message DocEvent { + DocEventType type = 1; + string publisher = 2; + DocEventBody body = 3; + } + \ No newline at end of file diff --git a/src/api/yorkie/v1/resources_pb.d.ts b/src/api/yorkie/v1/resources_pb.d.ts new file mode 100644 index 000000000..5be980931 --- /dev/null +++ b/src/api/yorkie/v1/resources_pb.d.ts @@ -0,0 +1,1897 @@ +// +// 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.4.2 with parameter "target=js+dts" +// @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, Timestamp } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum yorkie.v1.ValueType + */ +export declare 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, +} + +/** + * @generated from enum yorkie.v1.DocEventType + */ +export declare 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, +} + +/** + * /////////////////////////////////////// + * Messages for Snapshot // + * /////////////////////////////////////// + * + * @generated from message yorkie.v1.Snapshot + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Snapshot"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Snapshot; + + static fromJson(jsonValue: JsonValue, options?: Partial): Snapshot; + + static fromJsonString(jsonString: string, options?: Partial): Snapshot; + + static equals(a: Snapshot | PlainMessage | undefined, b: Snapshot | PlainMessage | undefined): boolean; +} + +/** + * 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 declare class ChangePack extends Message { + /** + * @generated from field: string document_key = 1; + */ + documentKey: string; + + /** + * @generated from field: yorkie.v1.Checkpoint checkpoint = 2; + */ + checkpoint?: Checkpoint; + + /** + * @generated from field: bytes snapshot = 3; + */ + snapshot: Uint8Array; + + /** + * @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: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ChangePack"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ChangePack; + + static fromJson(jsonValue: JsonValue, options?: Partial): ChangePack; + + static fromJsonString(jsonString: string, options?: Partial): ChangePack; + + static equals(a: ChangePack | PlainMessage | undefined, b: ChangePack | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Change + */ +export declare class Change extends Message { + /** + * @generated from field: yorkie.v1.ChangeID id = 1; + */ + id?: ChangeID; + + /** + * @generated from field: string message = 2; + */ + message: string; + + /** + * @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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Change"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Change; + + static fromJson(jsonValue: JsonValue, options?: Partial): Change; + + static fromJsonString(jsonString: string, options?: Partial): Change; + + static equals(a: Change | PlainMessage | undefined, b: Change | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.ChangeID + */ +export declare class ChangeID extends Message { + /** + * @generated from field: uint32 client_seq = 1; + */ + clientSeq: number; + + /** + * @generated from field: int64 server_seq = 2 [jstype = JS_STRING]; + */ + serverSeq: string; + + /** + * @generated from field: int64 lamport = 3 [jstype = JS_STRING]; + */ + lamport: string; + + /** + * @generated from field: bytes actor_id = 4; + */ + actorId: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ChangeID"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ChangeID; + + static fromJson(jsonValue: JsonValue, options?: Partial): ChangeID; + + static fromJsonString(jsonString: string, options?: Partial): ChangeID; + + static equals(a: ChangeID | PlainMessage | undefined, b: ChangeID | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation + */ +export declare 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"; + } | { case: undefined; value?: undefined }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation; + + static fromJsonString(jsonString: string, options?: Partial): Operation; + + static equals(a: Operation | PlainMessage | undefined, b: Operation | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Set + */ +export declare class Operation_Set extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: string key = 2; + */ + key: string; + + /** + * @generated from field: yorkie.v1.JSONElementSimple value = 3; + */ + value?: JSONElementSimple; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Set"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Set; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Set; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Set; + + static equals(a: Operation_Set | PlainMessage | undefined, b: Operation_Set | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Add + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Add"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Add; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Add; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Add; + + static equals(a: Operation_Add | PlainMessage | undefined, b: Operation_Add | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Move + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Move"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Move; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Move; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Move; + + static equals(a: Operation_Move | PlainMessage | undefined, b: Operation_Move | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Remove + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Remove"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Remove; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Remove; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Remove; + + static equals(a: Operation_Remove | PlainMessage | undefined, b: Operation_Remove | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Edit + */ +export declare 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: string; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 6; + */ + executedAt?: TimeTicket; + + /** + * @generated from field: map attributes = 7; + */ + attributes: { [key: string]: string }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Edit"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Edit; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Edit; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Edit; + + static equals(a: Operation_Edit | PlainMessage | undefined, b: Operation_Edit | PlainMessage | undefined): boolean; +} + +/** + * 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 declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Select"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Select; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Select; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Select; + + static equals(a: Operation_Select | PlainMessage | undefined, b: Operation_Select | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Style + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Style"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Style; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Style; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Style; + + static equals(a: Operation_Style | PlainMessage | undefined, b: Operation_Style | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Increase + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Increase"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Increase; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Increase; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Increase; + + static equals(a: Operation_Increase | PlainMessage | undefined, b: Operation_Increase | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.TreeEdit + */ +export declare 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: number; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 6; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.TreeEdit"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_TreeEdit; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_TreeEdit; + + static fromJsonString(jsonString: string, options?: Partial): Operation_TreeEdit; + + static equals(a: Operation_TreeEdit | PlainMessage | undefined, b: Operation_TreeEdit | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.TreeStyle + */ +export declare 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; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.TreeStyle"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_TreeStyle; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_TreeStyle; + + static fromJsonString(jsonString: string, options?: Partial): Operation_TreeStyle; + + static equals(a: Operation_TreeStyle | PlainMessage | undefined, b: Operation_TreeStyle | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElementSimple + */ +export declare 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; + + /** + * @generated from field: bytes value = 5; + */ + value: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElementSimple"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElementSimple; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElementSimple; + + static fromJsonString(jsonString: string, options?: Partial): JSONElementSimple; + + static equals(a: JSONElementSimple | PlainMessage | undefined, b: JSONElementSimple | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement + */ +export declare 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 }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement; + + static equals(a: JSONElement | PlainMessage | undefined, b: JSONElement | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.JSONObject + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.JSONObject"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_JSONObject; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_JSONObject; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_JSONObject; + + static equals(a: JSONElement_JSONObject | PlainMessage | undefined, b: JSONElement_JSONObject | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.JSONArray + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.JSONArray"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_JSONArray; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_JSONArray; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_JSONArray; + + static equals(a: JSONElement_JSONArray | PlainMessage | undefined, b: JSONElement_JSONArray | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.Primitive + */ +export declare class JSONElement_Primitive extends Message { + /** + * @generated from field: yorkie.v1.ValueType type = 1; + */ + type: ValueType; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; + + /** + * @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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.Primitive"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Primitive; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Primitive; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Primitive; + + static equals(a: JSONElement_Primitive | PlainMessage | undefined, b: JSONElement_Primitive | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.Text + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.Text"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Text; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Text; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Text; + + static equals(a: JSONElement_Text | PlainMessage | undefined, b: JSONElement_Text | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.Counter + */ +export declare class JSONElement_Counter extends Message { + /** + * @generated from field: yorkie.v1.ValueType type = 1; + */ + type: ValueType; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; + + /** + * @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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.Counter"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Counter; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Counter; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Counter; + + static equals(a: JSONElement_Counter | PlainMessage | undefined, b: JSONElement_Counter | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.Tree + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.Tree"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Tree; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Tree; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Tree; + + static equals(a: JSONElement_Tree | PlainMessage | undefined, b: JSONElement_Tree | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.RHTNode + */ +export declare class RHTNode extends Message { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: yorkie.v1.JSONElement element = 2; + */ + element?: JSONElement; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.RHTNode"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): RHTNode; + + static fromJson(jsonValue: JsonValue, options?: Partial): RHTNode; + + static fromJsonString(jsonString: string, options?: Partial): RHTNode; + + static equals(a: RHTNode | PlainMessage | undefined, b: RHTNode | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.RGANode + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.RGANode"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): RGANode; + + static fromJson(jsonValue: JsonValue, options?: Partial): RGANode; + + static fromJsonString(jsonString: string, options?: Partial): RGANode; + + static equals(a: RGANode | PlainMessage | undefined, b: RGANode | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.NodeAttr + */ +export declare class NodeAttr extends Message { + /** + * @generated from field: string value = 1; + */ + value: string; + + /** + * @generated from field: yorkie.v1.TimeTicket updated_at = 2; + */ + updatedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.NodeAttr"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): NodeAttr; + + static fromJson(jsonValue: JsonValue, options?: Partial): NodeAttr; + + static fromJsonString(jsonString: string, options?: Partial): NodeAttr; + + static equals(a: NodeAttr | PlainMessage | undefined, b: NodeAttr | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TextNode + */ +export declare class TextNode extends Message { + /** + * @generated from field: yorkie.v1.TextNodeID id = 1; + */ + id?: TextNodeID; + + /** + * @generated from field: string value = 2; + */ + value: string; + + /** + * @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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TextNode"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TextNode; + + static fromJson(jsonValue: JsonValue, options?: Partial): TextNode; + + static fromJsonString(jsonString: string, options?: Partial): TextNode; + + static equals(a: TextNode | PlainMessage | undefined, b: TextNode | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TextNodeID + */ +export declare class TextNodeID extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: int32 offset = 2; + */ + offset: number; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TextNodeID"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TextNodeID; + + static fromJson(jsonValue: JsonValue, options?: Partial): TextNodeID; + + static fromJsonString(jsonString: string, options?: Partial): TextNodeID; + + static equals(a: TextNodeID | PlainMessage | undefined, b: TextNodeID | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TreeNode + */ +export declare class TreeNode extends Message { + /** + * @generated from field: yorkie.v1.TreeNodeID id = 1; + */ + id?: TreeNodeID; + + /** + * @generated from field: string type = 2; + */ + type: string; + + /** + * @generated from field: string value = 3; + */ + value: string; + + /** + * @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: number; + + /** + * @generated from field: map attributes = 8; + */ + attributes: { [key: string]: NodeAttr }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TreeNode"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TreeNode; + + static fromJson(jsonValue: JsonValue, options?: Partial): TreeNode; + + static fromJsonString(jsonString: string, options?: Partial): TreeNode; + + static equals(a: TreeNode | PlainMessage | undefined, b: TreeNode | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TreeNodes + */ +export declare class TreeNodes extends Message { + /** + * @generated from field: repeated yorkie.v1.TreeNode content = 1; + */ + content: TreeNode[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TreeNodes"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TreeNodes; + + static fromJson(jsonValue: JsonValue, options?: Partial): TreeNodes; + + static fromJsonString(jsonString: string, options?: Partial): TreeNodes; + + static equals(a: TreeNodes | PlainMessage | undefined, b: TreeNodes | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TreeNodeID + */ +export declare class TreeNodeID extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: int32 offset = 2; + */ + offset: number; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TreeNodeID"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TreeNodeID; + + static fromJson(jsonValue: JsonValue, options?: Partial): TreeNodeID; + + static fromJsonString(jsonString: string, options?: Partial): TreeNodeID; + + static equals(a: TreeNodeID | PlainMessage | undefined, b: TreeNodeID | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TreePos + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TreePos"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TreePos; + + static fromJson(jsonValue: JsonValue, options?: Partial): TreePos; + + static fromJsonString(jsonString: string, options?: Partial): TreePos; + + static equals(a: TreePos | PlainMessage | undefined, b: TreePos | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.User + */ +export declare class User extends Message { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: string username = 2; + */ + username: string; + + /** + * @generated from field: google.protobuf.Timestamp created_at = 3; + */ + createdAt?: Timestamp; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.User"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): User; + + static fromJson(jsonValue: JsonValue, options?: Partial): User; + + static fromJsonString(jsonString: string, options?: Partial): User; + + static equals(a: User | PlainMessage | undefined, b: User | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Project + */ +export declare class Project extends Message { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: string name = 2; + */ + name: string; + + /** + * @generated from field: string public_key = 3; + */ + publicKey: string; + + /** + * @generated from field: string secret_key = 4; + */ + secretKey: string; + + /** + * @generated from field: string auth_webhook_url = 5; + */ + authWebhookUrl: string; + + /** + * @generated from field: repeated string auth_webhook_methods = 6; + */ + authWebhookMethods: string[]; + + /** + * @generated from field: string client_deactivate_threshold = 7; + */ + clientDeactivateThreshold: string; + + /** + * @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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Project"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Project; + + static fromJson(jsonValue: JsonValue, options?: Partial): Project; + + static fromJsonString(jsonString: string, options?: Partial): Project; + + static equals(a: Project | PlainMessage | undefined, b: Project | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.UpdatableProjectFields + */ +export declare 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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.UpdatableProjectFields"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdatableProjectFields; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdatableProjectFields; + + static fromJsonString(jsonString: string, options?: Partial): UpdatableProjectFields; + + static equals(a: UpdatableProjectFields | PlainMessage | undefined, b: UpdatableProjectFields | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.UpdatableProjectFields.AuthWebhookMethods + */ +export declare class UpdatableProjectFields_AuthWebhookMethods extends Message { + /** + * @generated from field: repeated string methods = 1; + */ + methods: string[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.UpdatableProjectFields.AuthWebhookMethods"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdatableProjectFields_AuthWebhookMethods; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdatableProjectFields_AuthWebhookMethods; + + static fromJsonString(jsonString: string, options?: Partial): UpdatableProjectFields_AuthWebhookMethods; + + static equals(a: UpdatableProjectFields_AuthWebhookMethods | PlainMessage | undefined, b: UpdatableProjectFields_AuthWebhookMethods | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DocumentSummary + */ +export declare class DocumentSummary extends Message { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: string key = 2; + */ + key: string; + + /** + * @generated from field: string snapshot = 3; + */ + snapshot: string; + + /** + * @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); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DocumentSummary"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DocumentSummary; + + static fromJson(jsonValue: JsonValue, options?: Partial): DocumentSummary; + + static fromJsonString(jsonString: string, options?: Partial): DocumentSummary; + + static equals(a: DocumentSummary | PlainMessage | undefined, b: DocumentSummary | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.PresenceChange + */ +export declare class PresenceChange extends Message { + /** + * @generated from field: yorkie.v1.PresenceChange.ChangeType type = 1; + */ + type: PresenceChange_ChangeType; + + /** + * @generated from field: yorkie.v1.Presence presence = 2; + */ + presence?: Presence; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.PresenceChange"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): PresenceChange; + + static fromJson(jsonValue: JsonValue, options?: Partial): PresenceChange; + + static fromJsonString(jsonString: string, options?: Partial): PresenceChange; + + static equals(a: PresenceChange | PlainMessage | undefined, b: PresenceChange | PlainMessage | undefined): boolean; +} + +/** + * @generated from enum yorkie.v1.PresenceChange.ChangeType + */ +export declare 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, +} + +/** + * @generated from message yorkie.v1.Presence + */ +export declare class Presence extends Message { + /** + * @generated from field: map data = 1; + */ + data: { [key: string]: string }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Presence"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Presence; + + static fromJson(jsonValue: JsonValue, options?: Partial): Presence; + + static fromJsonString(jsonString: string, options?: Partial): Presence; + + static equals(a: Presence | PlainMessage | undefined, b: Presence | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Checkpoint + */ +export declare class Checkpoint extends Message { + /** + * @generated from field: int64 server_seq = 1 [jstype = JS_STRING]; + */ + serverSeq: string; + + /** + * @generated from field: uint32 client_seq = 2; + */ + clientSeq: number; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Checkpoint"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Checkpoint; + + static fromJson(jsonValue: JsonValue, options?: Partial): Checkpoint; + + static fromJsonString(jsonString: string, options?: Partial): Checkpoint; + + static equals(a: Checkpoint | PlainMessage | undefined, b: Checkpoint | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TextNodePos + */ +export declare class TextNodePos extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: int32 offset = 2; + */ + offset: number; + + /** + * @generated from field: int32 relative_offset = 3; + */ + relativeOffset: number; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TextNodePos"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TextNodePos; + + static fromJson(jsonValue: JsonValue, options?: Partial): TextNodePos; + + static fromJsonString(jsonString: string, options?: Partial): TextNodePos; + + static equals(a: TextNodePos | PlainMessage | undefined, b: TextNodePos | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TimeTicket + */ +export declare class TimeTicket extends Message { + /** + * @generated from field: int64 lamport = 1 [jstype = JS_STRING]; + */ + lamport: string; + + /** + * @generated from field: uint32 delimiter = 2; + */ + delimiter: number; + + /** + * @generated from field: bytes actor_id = 3; + */ + actorId: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TimeTicket"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TimeTicket; + + static fromJson(jsonValue: JsonValue, options?: Partial): TimeTicket; + + static fromJsonString(jsonString: string, options?: Partial): TimeTicket; + + static equals(a: TimeTicket | PlainMessage | undefined, b: TimeTicket | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DocEventBody + */ +export declare class DocEventBody extends Message { + /** + * @generated from field: string topic = 1; + */ + topic: string; + + /** + * @generated from field: bytes payload = 2; + */ + payload: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DocEventBody"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DocEventBody; + + static fromJson(jsonValue: JsonValue, options?: Partial): DocEventBody; + + static fromJsonString(jsonString: string, options?: Partial): DocEventBody; + + static equals(a: DocEventBody | PlainMessage | undefined, b: DocEventBody | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DocEvent + */ +export declare class DocEvent extends Message { + /** + * @generated from field: yorkie.v1.DocEventType type = 1; + */ + type: DocEventType; + + /** + * @generated from field: string publisher = 2; + */ + publisher: string; + + /** + * @generated from field: yorkie.v1.DocEventBody body = 3; + */ + body?: DocEventBody; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DocEvent"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DocEvent; + + static fromJson(jsonValue: JsonValue, options?: Partial): DocEvent; + + static fromJsonString(jsonString: string, options?: Partial): DocEvent; + + static equals(a: DocEvent | PlainMessage | undefined, b: DocEvent | PlainMessage | undefined): boolean; +} + diff --git a/src/api/yorkie/v1/resources_pb.js b/src/api/yorkie/v1/resources_pb.js new file mode 100644 index 000000000..aabe2619c --- /dev/null +++ b/src/api/yorkie/v1/resources_pb.js @@ -0,0 +1,671 @@ +// +// 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.4.2 with parameter "target=js+dts" +// @generated from file src/api/yorkie/v1/resources.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3, StringValue, Timestamp } from "@bufbuild/protobuf"; + +/** + * @generated from enum yorkie.v1.ValueType + */ +export const ValueType = proto3.makeEnum( + "yorkie.v1.ValueType", + [ + {no: 0, name: "VALUE_TYPE_NULL", localName: "NULL"}, + {no: 1, name: "VALUE_TYPE_BOOLEAN", localName: "BOOLEAN"}, + {no: 2, name: "VALUE_TYPE_INTEGER", localName: "INTEGER"}, + {no: 3, name: "VALUE_TYPE_LONG", localName: "LONG"}, + {no: 4, name: "VALUE_TYPE_DOUBLE", localName: "DOUBLE"}, + {no: 5, name: "VALUE_TYPE_STRING", localName: "STRING"}, + {no: 6, name: "VALUE_TYPE_BYTES", localName: "BYTES"}, + {no: 7, name: "VALUE_TYPE_DATE", localName: "DATE"}, + {no: 8, name: "VALUE_TYPE_JSON_OBJECT", localName: "JSON_OBJECT"}, + {no: 9, name: "VALUE_TYPE_JSON_ARRAY", localName: "JSON_ARRAY"}, + {no: 10, name: "VALUE_TYPE_TEXT", localName: "TEXT"}, + {no: 11, name: "VALUE_TYPE_INTEGER_CNT", localName: "INTEGER_CNT"}, + {no: 12, name: "VALUE_TYPE_LONG_CNT", localName: "LONG_CNT"}, + {no: 13, name: "VALUE_TYPE_TREE", localName: "TREE"}, + ], +); + +/** + * @generated from enum yorkie.v1.DocEventType + */ +export const DocEventType = proto3.makeEnum( + "yorkie.v1.DocEventType", + [ + {no: 0, name: "DOC_EVENT_TYPE_DOCUMENT_CHANGED", localName: "DOCUMENT_CHANGED"}, + {no: 1, name: "DOC_EVENT_TYPE_DOCUMENT_WATCHED", localName: "DOCUMENT_WATCHED"}, + {no: 2, name: "DOC_EVENT_TYPE_DOCUMENT_UNWATCHED", localName: "DOCUMENT_UNWATCHED"}, + {no: 3, name: "DOC_EVENT_TYPE_DOCUMENT_BROADCAST", localName: "DOCUMENT_BROADCAST"}, + ], +); + +/** + * /////////////////////////////////////// + * Messages for Snapshot // + * /////////////////////////////////////// + * + * @generated from message yorkie.v1.Snapshot + */ +export const Snapshot = proto3.makeMessageType( + "yorkie.v1.Snapshot", + () => [ + { no: 1, name: "root", kind: "message", T: JSONElement }, + { no: 2, name: "presences", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Presence} }, + ], +); + +/** + * 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 const ChangePack = proto3.makeMessageType( + "yorkie.v1.ChangePack", + () => [ + { 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 */ }, + ], +); + +/** + * @generated from message yorkie.v1.Change + */ +export const Change = proto3.makeMessageType( + "yorkie.v1.Change", + () => [ + { 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 }, + ], +); + +/** + * @generated from message yorkie.v1.ChangeID + */ +export const ChangeID = proto3.makeMessageType( + "yorkie.v1.ChangeID", + () => [ + { no: 1, name: "client_seq", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 2, name: "server_seq", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, + { no: 3, name: "lamport", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, + { no: 4, name: "actor_id", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ], +); + +/** + * @generated from message yorkie.v1.Operation + */ +export const Operation = proto3.makeMessageType( + "yorkie.v1.Operation", + () => [ + { 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" }, + ], +); + +/** + * @generated from message yorkie.v1.Operation.Set + */ +export const Operation_Set = proto3.makeMessageType( + "yorkie.v1.Operation.Set", + () => [ + { 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 }, + ], + {localName: "Operation_Set"}, +); + +/** + * @generated from message yorkie.v1.Operation.Add + */ +export const Operation_Add = proto3.makeMessageType( + "yorkie.v1.Operation.Add", + () => [ + { 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 }, + ], + {localName: "Operation_Add"}, +); + +/** + * @generated from message yorkie.v1.Operation.Move + */ +export const Operation_Move = proto3.makeMessageType( + "yorkie.v1.Operation.Move", + () => [ + { 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 }, + ], + {localName: "Operation_Move"}, +); + +/** + * @generated from message yorkie.v1.Operation.Remove + */ +export const Operation_Remove = proto3.makeMessageType( + "yorkie.v1.Operation.Remove", + () => [ + { 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 }, + ], + {localName: "Operation_Remove"}, +); + +/** + * @generated from message yorkie.v1.Operation.Edit + */ +export const Operation_Edit = proto3.makeMessageType( + "yorkie.v1.Operation.Edit", + () => [ + { 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 */} }, + ], + {localName: "Operation_Edit"}, +); + +/** + * 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 const Operation_Select = proto3.makeMessageType( + "yorkie.v1.Operation.Select", + () => [ + { 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 }, + ], + {localName: "Operation_Select"}, +); + +/** + * @generated from message yorkie.v1.Operation.Style + */ +export const Operation_Style = proto3.makeMessageType( + "yorkie.v1.Operation.Style", + () => [ + { 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} }, + ], + {localName: "Operation_Style"}, +); + +/** + * @generated from message yorkie.v1.Operation.Increase + */ +export const Operation_Increase = proto3.makeMessageType( + "yorkie.v1.Operation.Increase", + () => [ + { 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 }, + ], + {localName: "Operation_Increase"}, +); + +/** + * @generated from message yorkie.v1.Operation.TreeEdit + */ +export const Operation_TreeEdit = proto3.makeMessageType( + "yorkie.v1.Operation.TreeEdit", + () => [ + { 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 }, + ], + {localName: "Operation_TreeEdit"}, +); + +/** + * @generated from message yorkie.v1.Operation.TreeStyle + */ +export const Operation_TreeStyle = proto3.makeMessageType( + "yorkie.v1.Operation.TreeStyle", + () => [ + { 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 }, + ], + {localName: "Operation_TreeStyle"}, +); + +/** + * @generated from message yorkie.v1.JSONElementSimple + */ +export const JSONElementSimple = proto3.makeMessageType( + "yorkie.v1.JSONElementSimple", + () => [ + { 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 */ }, + ], +); + +/** + * @generated from message yorkie.v1.JSONElement + */ +export const JSONElement = proto3.makeMessageType( + "yorkie.v1.JSONElement", + () => [ + { 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" }, + ], +); + +/** + * @generated from message yorkie.v1.JSONElement.JSONObject + */ +export const JSONElement_JSONObject = proto3.makeMessageType( + "yorkie.v1.JSONElement.JSONObject", + () => [ + { 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 }, + ], + {localName: "JSONElement_JSONObject"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.JSONArray + */ +export const JSONElement_JSONArray = proto3.makeMessageType( + "yorkie.v1.JSONElement.JSONArray", + () => [ + { 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 }, + ], + {localName: "JSONElement_JSONArray"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.Primitive + */ +export const JSONElement_Primitive = proto3.makeMessageType( + "yorkie.v1.JSONElement.Primitive", + () => [ + { 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 }, + ], + {localName: "JSONElement_Primitive"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.Text + */ +export const JSONElement_Text = proto3.makeMessageType( + "yorkie.v1.JSONElement.Text", + () => [ + { 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 }, + ], + {localName: "JSONElement_Text"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.Counter + */ +export const JSONElement_Counter = proto3.makeMessageType( + "yorkie.v1.JSONElement.Counter", + () => [ + { 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 }, + ], + {localName: "JSONElement_Counter"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.Tree + */ +export const JSONElement_Tree = proto3.makeMessageType( + "yorkie.v1.JSONElement.Tree", + () => [ + { 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 }, + ], + {localName: "JSONElement_Tree"}, +); + +/** + * @generated from message yorkie.v1.RHTNode + */ +export const RHTNode = proto3.makeMessageType( + "yorkie.v1.RHTNode", + () => [ + { no: 1, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "element", kind: "message", T: JSONElement }, + ], +); + +/** + * @generated from message yorkie.v1.RGANode + */ +export const RGANode = proto3.makeMessageType( + "yorkie.v1.RGANode", + () => [ + { no: 1, name: "next", kind: "message", T: RGANode }, + { no: 2, name: "element", kind: "message", T: JSONElement }, + ], +); + +/** + * @generated from message yorkie.v1.NodeAttr + */ +export const NodeAttr = proto3.makeMessageType( + "yorkie.v1.NodeAttr", + () => [ + { no: 1, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "updated_at", kind: "message", T: TimeTicket }, + ], +); + +/** + * @generated from message yorkie.v1.TextNode + */ +export const TextNode = proto3.makeMessageType( + "yorkie.v1.TextNode", + () => [ + { 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} }, + ], +); + +/** + * @generated from message yorkie.v1.TextNodeID + */ +export const TextNodeID = proto3.makeMessageType( + "yorkie.v1.TextNodeID", + () => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ], +); + +/** + * @generated from message yorkie.v1.TreeNode + */ +export const TreeNode = proto3.makeMessageType( + "yorkie.v1.TreeNode", + () => [ + { 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} }, + ], +); + +/** + * @generated from message yorkie.v1.TreeNodes + */ +export const TreeNodes = proto3.makeMessageType( + "yorkie.v1.TreeNodes", + () => [ + { no: 1, name: "content", kind: "message", T: TreeNode, repeated: true }, + ], +); + +/** + * @generated from message yorkie.v1.TreeNodeID + */ +export const TreeNodeID = proto3.makeMessageType( + "yorkie.v1.TreeNodeID", + () => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ], +); + +/** + * @generated from message yorkie.v1.TreePos + */ +export const TreePos = proto3.makeMessageType( + "yorkie.v1.TreePos", + () => [ + { no: 1, name: "parent_id", kind: "message", T: TreeNodeID }, + { no: 2, name: "left_sibling_id", kind: "message", T: TreeNodeID }, + ], +); + +/** + * @generated from message yorkie.v1.User + */ +export const User = proto3.makeMessageType( + "yorkie.v1.User", + () => [ + { 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 }, + ], +); + +/** + * @generated from message yorkie.v1.Project + */ +export const Project = proto3.makeMessageType( + "yorkie.v1.Project", + () => [ + { 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 }, + ], +); + +/** + * @generated from message yorkie.v1.UpdatableProjectFields + */ +export const UpdatableProjectFields = proto3.makeMessageType( + "yorkie.v1.UpdatableProjectFields", + () => [ + { 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 }, + ], +); + +/** + * @generated from message yorkie.v1.UpdatableProjectFields.AuthWebhookMethods + */ +export const UpdatableProjectFields_AuthWebhookMethods = proto3.makeMessageType( + "yorkie.v1.UpdatableProjectFields.AuthWebhookMethods", + () => [ + { no: 1, name: "methods", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ], + {localName: "UpdatableProjectFields_AuthWebhookMethods"}, +); + +/** + * @generated from message yorkie.v1.DocumentSummary + */ +export const DocumentSummary = proto3.makeMessageType( + "yorkie.v1.DocumentSummary", + () => [ + { 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 }, + ], +); + +/** + * @generated from message yorkie.v1.PresenceChange + */ +export const PresenceChange = proto3.makeMessageType( + "yorkie.v1.PresenceChange", + () => [ + { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(PresenceChange_ChangeType) }, + { no: 2, name: "presence", kind: "message", T: Presence }, + ], +); + +/** + * @generated from enum yorkie.v1.PresenceChange.ChangeType + */ +export const PresenceChange_ChangeType = proto3.makeEnum( + "yorkie.v1.PresenceChange.ChangeType", + [ + {no: 0, name: "CHANGE_TYPE_UNSPECIFIED", localName: "UNSPECIFIED"}, + {no: 1, name: "CHANGE_TYPE_PUT", localName: "PUT"}, + {no: 2, name: "CHANGE_TYPE_DELETE", localName: "DELETE"}, + {no: 3, name: "CHANGE_TYPE_CLEAR", localName: "CLEAR"}, + ], +); + +/** + * @generated from message yorkie.v1.Presence + */ +export const Presence = proto3.makeMessageType( + "yorkie.v1.Presence", + () => [ + { no: 1, name: "data", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, + ], +); + +/** + * @generated from message yorkie.v1.Checkpoint + */ +export const Checkpoint = proto3.makeMessageType( + "yorkie.v1.Checkpoint", + () => [ + { no: 1, name: "server_seq", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, + { no: 2, name: "client_seq", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ], +); + +/** + * @generated from message yorkie.v1.TextNodePos + */ +export const TextNodePos = proto3.makeMessageType( + "yorkie.v1.TextNodePos", + () => [ + { 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 */ }, + ], +); + +/** + * @generated from message yorkie.v1.TimeTicket + */ +export const TimeTicket = proto3.makeMessageType( + "yorkie.v1.TimeTicket", + () => [ + { no: 1, name: "lamport", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, + { no: 2, name: "delimiter", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 3, name: "actor_id", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ], +); + +/** + * @generated from message yorkie.v1.DocEventBody + */ +export const DocEventBody = proto3.makeMessageType( + "yorkie.v1.DocEventBody", + () => [ + { no: 1, name: "topic", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ], +); + +/** + * @generated from message yorkie.v1.DocEvent + */ +export const DocEvent = proto3.makeMessageType( + "yorkie.v1.DocEvent", + () => [ + { 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 }, + ], +); + diff --git a/src/api/yorkie/v1/yorkie.proto b/src/api/yorkie/v1/yorkie.proto index 9b0c86d84..4e799ffa1 100644 --- a/src/api/yorkie/v1/yorkie.proto +++ b/src/api/yorkie/v1/yorkie.proto @@ -15,109 +15,110 @@ */ syntax = "proto3"; -package yorkie.v1; - -import "yorkie/v1/resources.proto"; - -option go_package = ".;v1"; - -option java_multiple_files = true; -option java_package = "dev.yorkie.api.v1"; - -// Yorkie is a service that provides a API for SDKs. -service YorkieService { - rpc ActivateClient (ActivateClientRequest) returns (ActivateClientResponse) {} - rpc DeactivateClient (DeactivateClientRequest) returns (DeactivateClientResponse) {} - - rpc AttachDocument (AttachDocumentRequest) returns (AttachDocumentResponse) {} - rpc DetachDocument (DetachDocumentRequest) returns (DetachDocumentResponse) {} - rpc RemoveDocument (RemoveDocumentRequest) returns (RemoveDocumentResponse) {} - rpc PushPullChanges (PushPullChangesRequest) returns (PushPullChangesResponse) {} - - rpc WatchDocument (WatchDocumentRequest) returns (stream WatchDocumentResponse) {} - - rpc Broadcast (BroadcastRequest) returns (BroadcastResponse) {} -} - -message ActivateClientRequest { - string client_key = 1; -} - -message ActivateClientResponse { - string client_id = 1; -} - -message DeactivateClientRequest { - string client_id = 1; -} - -message DeactivateClientResponse { -} - -message AttachDocumentRequest { - string client_id = 1; - ChangePack change_pack = 2; -} - -message AttachDocumentResponse { - string document_id = 1; - ChangePack change_pack = 2; -} - -message DetachDocumentRequest { - string client_id = 1; - string document_id = 2; - ChangePack change_pack = 3; - bool remove_if_not_attached = 4; -} - -message DetachDocumentResponse { - ChangePack change_pack = 2; -} - -message WatchDocumentRequest { - string client_id = 1; - string document_id = 2; -} - -message WatchDocumentResponse { - message Initialization { - repeated string client_ids = 1; - } - - oneof body { - Initialization initialization = 1; - DocEvent event = 2; - } -} - -message RemoveDocumentRequest { - string client_id = 1; - string document_id = 2; - ChangePack change_pack = 3; -} - -message RemoveDocumentResponse { - ChangePack change_pack = 1; -} - -message PushPullChangesRequest { - string client_id = 1; - string document_id = 2; - ChangePack change_pack = 3; - bool push_only = 4; -} - -message PushPullChangesResponse { - ChangePack change_pack = 1; -} - -message BroadcastRequest { - string client_id = 1; - string document_id = 2; - string topic = 3; - bytes payload = 4; -} - -message BroadcastResponse { -} + package yorkie.v1; + + import "src/api/yorkie/v1/resources.proto"; + + 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. + service YorkieService { + rpc ActivateClient (ActivateClientRequest) returns (ActivateClientResponse) {} + rpc DeactivateClient (DeactivateClientRequest) returns (DeactivateClientResponse) {} + + rpc AttachDocument (AttachDocumentRequest) returns (AttachDocumentResponse) {} + rpc DetachDocument (DetachDocumentRequest) returns (DetachDocumentResponse) {} + rpc RemoveDocument (RemoveDocumentRequest) returns (RemoveDocumentResponse) {} + rpc PushPullChanges (PushPullChangesRequest) returns (PushPullChangesResponse) {} + + rpc WatchDocument (WatchDocumentRequest) returns (stream WatchDocumentResponse) {} + + rpc Broadcast (BroadcastRequest) returns (BroadcastResponse) {} + } + + message ActivateClientRequest { + string client_key = 1; + } + + message ActivateClientResponse { + string client_id = 1; + } + + message DeactivateClientRequest { + string client_id = 1; + } + + message DeactivateClientResponse { + } + + message AttachDocumentRequest { + string client_id = 1; + ChangePack change_pack = 2; + } + + message AttachDocumentResponse { + string document_id = 1; + ChangePack change_pack = 2; + } + + message DetachDocumentRequest { + string client_id = 1; + string document_id = 2; + ChangePack change_pack = 3; + bool remove_if_not_attached = 4; + } + + message DetachDocumentResponse { + ChangePack change_pack = 2; + } + + message WatchDocumentRequest { + string client_id = 1; + string document_id = 2; + } + + message WatchDocumentResponse { + message Initialization { + repeated string client_ids = 1; + } + + oneof body { + Initialization initialization = 1; + DocEvent event = 2; + } + } + + message RemoveDocumentRequest { + string client_id = 1; + string document_id = 2; + ChangePack change_pack = 3; + } + + message RemoveDocumentResponse { + ChangePack change_pack = 1; + } + + message PushPullChangesRequest { + string client_id = 1; + string document_id = 2; + ChangePack change_pack = 3; + bool push_only = 4; + } + + message PushPullChangesResponse { + ChangePack change_pack = 1; + } + + message BroadcastRequest { + string client_id = 1; + string document_id = 2; + string topic = 3; + bytes payload = 4; + } + + message BroadcastResponse { + } + \ No newline at end of file diff --git a/src/api/yorkie/v1/yorkie_connect.d.ts b/src/api/yorkie/v1/yorkie_connect.d.ts new file mode 100644 index 000000000..8bc957479 --- /dev/null +++ b/src/api/yorkie/v1/yorkie_connect.d.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.1.3 with parameter "target=js+dts" +// @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 a API for SDKs. + * + * @generated from service yorkie.v1.YorkieService + */ +export declare const YorkieService: { + readonly typeName: "yorkie.v1.YorkieService", + readonly methods: { + /** + * @generated from rpc yorkie.v1.YorkieService.ActivateClient + */ + readonly activateClient: { + readonly name: "ActivateClient", + readonly I: typeof ActivateClientRequest, + readonly O: typeof ActivateClientResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.DeactivateClient + */ + readonly deactivateClient: { + readonly name: "DeactivateClient", + readonly I: typeof DeactivateClientRequest, + readonly O: typeof DeactivateClientResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.AttachDocument + */ + readonly attachDocument: { + readonly name: "AttachDocument", + readonly I: typeof AttachDocumentRequest, + readonly O: typeof AttachDocumentResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.DetachDocument + */ + readonly detachDocument: { + readonly name: "DetachDocument", + readonly I: typeof DetachDocumentRequest, + readonly O: typeof DetachDocumentResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.RemoveDocument + */ + readonly removeDocument: { + readonly name: "RemoveDocument", + readonly I: typeof RemoveDocumentRequest, + readonly O: typeof RemoveDocumentResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.PushPullChanges + */ + readonly pushPullChanges: { + readonly name: "PushPullChanges", + readonly I: typeof PushPullChangesRequest, + readonly O: typeof PushPullChangesResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.WatchDocument + */ + readonly watchDocument: { + readonly name: "WatchDocument", + readonly I: typeof WatchDocumentRequest, + readonly O: typeof WatchDocumentResponse, + readonly kind: MethodKind.ServerStreaming, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.Broadcast + */ + readonly broadcast: { + readonly name: "Broadcast", + readonly I: typeof BroadcastRequest, + readonly O: typeof BroadcastResponse, + readonly kind: MethodKind.Unary, + }, + } +}; + diff --git a/src/api/yorkie/v1/yorkie_connect.js b/src/api/yorkie/v1/yorkie_connect.js new file mode 100644 index 000000000..dd6f3ec44 --- /dev/null +++ b/src/api/yorkie/v1/yorkie_connect.js @@ -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.1.3 with parameter "target=js+dts" +// @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 a 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, + }, + } +}; + diff --git a/src/api/yorkie/v1/yorkie_pb.d.ts b/src/api/yorkie/v1/yorkie_pb.d.ts new file mode 100644 index 000000000..7b61abc02 --- /dev/null +++ b/src/api/yorkie/v1/yorkie_pb.d.ts @@ -0,0 +1,504 @@ +// +// 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.4.2 with parameter "target=js+dts" +// @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 type { ChangePack, DocEvent } from "./resources_pb.js"; + +/** + * @generated from message yorkie.v1.ActivateClientRequest + */ +export declare class ActivateClientRequest extends Message { + /** + * @generated from field: string client_key = 1; + */ + clientKey: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ActivateClientRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ActivateClientRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): ActivateClientRequest; + + static fromJsonString(jsonString: string, options?: Partial): ActivateClientRequest; + + static equals(a: ActivateClientRequest | PlainMessage | undefined, b: ActivateClientRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.ActivateClientResponse + */ +export declare class ActivateClientResponse extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ActivateClientResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ActivateClientResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): ActivateClientResponse; + + static fromJsonString(jsonString: string, options?: Partial): ActivateClientResponse; + + static equals(a: ActivateClientResponse | PlainMessage | undefined, b: ActivateClientResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DeactivateClientRequest + */ +export declare class DeactivateClientRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DeactivateClientRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DeactivateClientRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): DeactivateClientRequest; + + static fromJsonString(jsonString: string, options?: Partial): DeactivateClientRequest; + + static equals(a: DeactivateClientRequest | PlainMessage | undefined, b: DeactivateClientRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DeactivateClientResponse + */ +export declare class DeactivateClientResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DeactivateClientResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DeactivateClientResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): DeactivateClientResponse; + + static fromJsonString(jsonString: string, options?: Partial): DeactivateClientResponse; + + static equals(a: DeactivateClientResponse | PlainMessage | undefined, b: DeactivateClientResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.AttachDocumentRequest + */ +export declare class AttachDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 2; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.AttachDocumentRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): AttachDocumentRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): AttachDocumentRequest; + + static fromJsonString(jsonString: string, options?: Partial): AttachDocumentRequest; + + static equals(a: AttachDocumentRequest | PlainMessage | undefined, b: AttachDocumentRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.AttachDocumentResponse + */ +export declare class AttachDocumentResponse extends Message { + /** + * @generated from field: string document_id = 1; + */ + documentId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 2; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.AttachDocumentResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): AttachDocumentResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): AttachDocumentResponse; + + static fromJsonString(jsonString: string, options?: Partial): AttachDocumentResponse; + + static equals(a: AttachDocumentResponse | PlainMessage | undefined, b: AttachDocumentResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DetachDocumentRequest + */ +export declare class DetachDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 3; + */ + changePack?: ChangePack; + + /** + * @generated from field: bool remove_if_not_attached = 4; + */ + removeIfNotAttached: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DetachDocumentRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DetachDocumentRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): DetachDocumentRequest; + + static fromJsonString(jsonString: string, options?: Partial): DetachDocumentRequest; + + static equals(a: DetachDocumentRequest | PlainMessage | undefined, b: DetachDocumentRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DetachDocumentResponse + */ +export declare class DetachDocumentResponse extends Message { + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 2; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DetachDocumentResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DetachDocumentResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): DetachDocumentResponse; + + static fromJsonString(jsonString: string, options?: Partial): DetachDocumentResponse; + + static equals(a: DetachDocumentResponse | PlainMessage | undefined, b: DetachDocumentResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.WatchDocumentRequest + */ +export declare class WatchDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.WatchDocumentRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): WatchDocumentRequest; + + static fromJsonString(jsonString: string, options?: Partial): WatchDocumentRequest; + + static equals(a: WatchDocumentRequest | PlainMessage | undefined, b: WatchDocumentRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.WatchDocumentResponse + */ +export declare 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 }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.WatchDocumentResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): WatchDocumentResponse; + + static fromJsonString(jsonString: string, options?: Partial): WatchDocumentResponse; + + static equals(a: WatchDocumentResponse | PlainMessage | undefined, b: WatchDocumentResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.WatchDocumentResponse.Initialization + */ +export declare class WatchDocumentResponse_Initialization extends Message { + /** + * @generated from field: repeated string client_ids = 1; + */ + clientIds: string[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.WatchDocumentResponse.Initialization"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentResponse_Initialization; + + static fromJson(jsonValue: JsonValue, options?: Partial): WatchDocumentResponse_Initialization; + + static fromJsonString(jsonString: string, options?: Partial): WatchDocumentResponse_Initialization; + + static equals(a: WatchDocumentResponse_Initialization | PlainMessage | undefined, b: WatchDocumentResponse_Initialization | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.RemoveDocumentRequest + */ +export declare class RemoveDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 3; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.RemoveDocumentRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): RemoveDocumentRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): RemoveDocumentRequest; + + static fromJsonString(jsonString: string, options?: Partial): RemoveDocumentRequest; + + static equals(a: RemoveDocumentRequest | PlainMessage | undefined, b: RemoveDocumentRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.RemoveDocumentResponse + */ +export declare class RemoveDocumentResponse extends Message { + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 1; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.RemoveDocumentResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): RemoveDocumentResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): RemoveDocumentResponse; + + static fromJsonString(jsonString: string, options?: Partial): RemoveDocumentResponse; + + static equals(a: RemoveDocumentResponse | PlainMessage | undefined, b: RemoveDocumentResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.PushPullChangesRequest + */ +export declare class PushPullChangesRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 3; + */ + changePack?: ChangePack; + + /** + * @generated from field: bool push_only = 4; + */ + pushOnly: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.PushPullChangesRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): PushPullChangesRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): PushPullChangesRequest; + + static fromJsonString(jsonString: string, options?: Partial): PushPullChangesRequest; + + static equals(a: PushPullChangesRequest | PlainMessage | undefined, b: PushPullChangesRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.PushPullChangesResponse + */ +export declare class PushPullChangesResponse extends Message { + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 1; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.PushPullChangesResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): PushPullChangesResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): PushPullChangesResponse; + + static fromJsonString(jsonString: string, options?: Partial): PushPullChangesResponse; + + static equals(a: PushPullChangesResponse | PlainMessage | undefined, b: PushPullChangesResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.BroadcastRequest + */ +export declare class BroadcastRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + /** + * @generated from field: string topic = 3; + */ + topic: string; + + /** + * @generated from field: bytes payload = 4; + */ + payload: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.BroadcastRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): BroadcastRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): BroadcastRequest; + + static fromJsonString(jsonString: string, options?: Partial): BroadcastRequest; + + static equals(a: BroadcastRequest | PlainMessage | undefined, b: BroadcastRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.BroadcastResponse + */ +export declare class BroadcastResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.BroadcastResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): BroadcastResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): BroadcastResponse; + + static fromJsonString(jsonString: string, options?: Partial): BroadcastResponse; + + static equals(a: BroadcastResponse | PlainMessage | undefined, b: BroadcastResponse | PlainMessage | undefined): boolean; +} + diff --git a/src/api/yorkie/v1/yorkie_pb.js b/src/api/yorkie/v1/yorkie_pb.js new file mode 100644 index 000000000..1b17a9113 --- /dev/null +++ b/src/api/yorkie/v1/yorkie_pb.js @@ -0,0 +1,205 @@ +// +// 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.4.2 with parameter "target=js+dts" +// @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3 } from "@bufbuild/protobuf"; +import { ChangePack, DocEvent } from "./resources_pb.js"; + +/** + * @generated from message yorkie.v1.ActivateClientRequest + */ +export const ActivateClientRequest = proto3.makeMessageType( + "yorkie.v1.ActivateClientRequest", + () => [ + { no: 1, name: "client_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message yorkie.v1.ActivateClientResponse + */ +export const ActivateClientResponse = proto3.makeMessageType( + "yorkie.v1.ActivateClientResponse", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message yorkie.v1.DeactivateClientRequest + */ +export const DeactivateClientRequest = proto3.makeMessageType( + "yorkie.v1.DeactivateClientRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message yorkie.v1.DeactivateClientResponse + */ +export const DeactivateClientResponse = proto3.makeMessageType( + "yorkie.v1.DeactivateClientResponse", + [], +); + +/** + * @generated from message yorkie.v1.AttachDocumentRequest + */ +export const AttachDocumentRequest = proto3.makeMessageType( + "yorkie.v1.AttachDocumentRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.AttachDocumentResponse + */ +export const AttachDocumentResponse = proto3.makeMessageType( + "yorkie.v1.AttachDocumentResponse", + () => [ + { no: 1, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.DetachDocumentRequest + */ +export const DetachDocumentRequest = proto3.makeMessageType( + "yorkie.v1.DetachDocumentRequest", + () => [ + { 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 */ }, + ], +); + +/** + * @generated from message yorkie.v1.DetachDocumentResponse + */ +export const DetachDocumentResponse = proto3.makeMessageType( + "yorkie.v1.DetachDocumentResponse", + () => [ + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.WatchDocumentRequest + */ +export const WatchDocumentRequest = proto3.makeMessageType( + "yorkie.v1.WatchDocumentRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message yorkie.v1.WatchDocumentResponse + */ +export const WatchDocumentResponse = proto3.makeMessageType( + "yorkie.v1.WatchDocumentResponse", + () => [ + { no: 1, name: "initialization", kind: "message", T: WatchDocumentResponse_Initialization, oneof: "body" }, + { no: 2, name: "event", kind: "message", T: DocEvent, oneof: "body" }, + ], +); + +/** + * @generated from message yorkie.v1.WatchDocumentResponse.Initialization + */ +export const WatchDocumentResponse_Initialization = proto3.makeMessageType( + "yorkie.v1.WatchDocumentResponse.Initialization", + () => [ + { no: 1, name: "client_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ], + {localName: "WatchDocumentResponse_Initialization"}, +); + +/** + * @generated from message yorkie.v1.RemoveDocumentRequest + */ +export const RemoveDocumentRequest = proto3.makeMessageType( + "yorkie.v1.RemoveDocumentRequest", + () => [ + { 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 }, + ], +); + +/** + * @generated from message yorkie.v1.RemoveDocumentResponse + */ +export const RemoveDocumentResponse = proto3.makeMessageType( + "yorkie.v1.RemoveDocumentResponse", + () => [ + { no: 1, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.PushPullChangesRequest + */ +export const PushPullChangesRequest = proto3.makeMessageType( + "yorkie.v1.PushPullChangesRequest", + () => [ + { 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 */ }, + ], +); + +/** + * @generated from message yorkie.v1.PushPullChangesResponse + */ +export const PushPullChangesResponse = proto3.makeMessageType( + "yorkie.v1.PushPullChangesResponse", + () => [ + { no: 1, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.BroadcastRequest + */ +export const BroadcastRequest = proto3.makeMessageType( + "yorkie.v1.BroadcastRequest", + () => [ + { 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 */ }, + ], +); + +/** + * @generated from message yorkie.v1.BroadcastResponse + */ +export const BroadcastResponse = proto3.makeMessageType( + "yorkie.v1.BroadcastResponse", + [], +); + diff --git a/src/client/client.ts b/src/client/client.ts index d04c498a5..f207c8f3d 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -426,7 +426,7 @@ export class Client implements Observable { this.rpcClient.deactivateClient( req, { headers: {"x-shard-key": this.apiKey}}, - ).then((res) => { + ).then(() => { this.status = ClientStatus.Deactivated; this.eventStreamObserver.next({ type: ClientEventType.StatusChanged, @@ -843,7 +843,7 @@ export class Client implements Observable { }); logger.info(`[WD] c:"${this.getKey()}" watches d:"${docKey}"`); - return new Promise(async (resolve) => { + return new Promise((resolve, reject) => { const onStreamDisconnect = (): void => { this.eventStreamObserver.next({ type: ClientEventType.StreamConnectionStatusChanged, @@ -853,16 +853,21 @@ export class Client implements Observable { onDisconnect(); }; - try { - for await (const resp of stream) { - this.handleWatchDocumentsResponse(attachment, resp); - resolve(stream); - } - } catch(error) { - if(error instanceof ConnectError) { - onStreamDisconnect(); + const handleStream = async () => { + try { + for await (const resp of stream) { + this.handleWatchDocumentsResponse(attachment, resp); + } + } catch (error) { + if (error instanceof ConnectError) { + onStreamDisconnect(); + } else { + reject(error); + } } - } + }; + + handleStream().then(() => resolve(stream)); }); }, );