From 736845410649a8e24cf0ac8a57bde209ac2666da Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Fri, 15 Dec 2023 17:50:26 +0900 Subject: [PATCH] Migrate RPC to ConnectRPC (#698) With this support, we can resolve several issues: - Removes dependency with Envoy proxy to communicate with grpc-web - Reduces SDK bundle size by half bundle size of #434 - Standardizes API interfaces to powerful fetch API For more information about this migration, follow: yorkie#703 --------- Co-authored-by: Youngteac Hong --- CONTRIBUTING.md | 6 +- README.md | 14 - buf.gen.yaml | 12 + docker/docker-compose-ci.yml | 23 +- docker/docker-compose.yml | 24 +- docker/envoy-ci.yaml | 54 - docker/envoy.Dockerfile | 8 - docker/envoy.yaml | 59 - examples/nextjs-scheduler/README.md | 2 +- examples/profile-stack/README.md | 2 +- examples/react-tldraw/README.md | 2 +- .../src/hooks/useMultiplayerState.ts | 2 +- examples/react-todomvc/README.md | 2 +- examples/react-todomvc/src/App.tsx | 2 +- examples/simultaneous-cursors/README.md | 2 +- examples/vanilla-codemirror6/README.md | 2 +- examples/vanilla-codemirror6/src/main.ts | 2 +- examples/vanilla-quill/README.md | 2 +- examples/vanilla-quill/src/main.ts | 2 +- examples/vuejs-kanban/README.md | 2 +- package-lock.json | 238 +- package.json | 10 +- public/counter.html | 2 +- public/drawing.html | 2 +- public/index.html | 2 +- public/multi.html | 2 +- public/quill.html | 2 +- public/whiteboard.html | 2 +- src/api/converter.ts | 1054 +- src/api/yorkie/v1/resources.proto | 2 +- src/api/yorkie/v1/resources_pb.d.ts | 3275 ++-- src/api/yorkie/v1/resources_pb.js | 14216 +--------------- src/api/yorkie/v1/yorkie.proto | 4 +- src/api/yorkie/v1/yorkie_connect.d.ts | 106 + src/api/yorkie/v1/yorkie_connect.js | 111 + src/api/yorkie/v1/yorkie_grpc_web_pb.d.ts | 113 - src/api/yorkie/v1/yorkie_grpc_web_pb.js | 564 - src/api/yorkie/v1/yorkie_pb.d.ts | 756 +- src/api/yorkie/v1/yorkie_pb.js | 3419 +--- src/client/attachment.ts | 28 +- src/client/auth_interceptor.ts | 63 +- src/client/client.ts | 560 +- src/client/metric_interceptor.ts | 36 +- test/integration/client_test.ts | 47 +- test/integration/integration_helper.ts | 2 +- test/integration/presence_test.ts | 77 +- 46 files changed, 4488 insertions(+), 20429 deletions(-) create mode 100644 buf.gen.yaml delete mode 100644 docker/envoy-ci.yaml delete mode 100644 docker/envoy.Dockerfile delete mode 100644 docker/envoy.yaml create mode 100644 src/api/yorkie/v1/yorkie_connect.d.ts create mode 100644 src/api/yorkie/v1/yorkie_connect.js delete mode 100644 src/api/yorkie/v1/yorkie_grpc_web_pb.d.ts delete mode 100644 src/api/yorkie/v1/yorkie_grpc_web_pb.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fae44c4e7..b88557e22 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,9 +61,9 @@ $ npm run build:proto > Primary "source of truth" location of protobuf message is > in [yorkie](https://github.com/yorkie-team/yorkie/tree/main/api). We manage the messages in the repository. -### Testing yorkie-js-sdk with Envoy, Yorkie and MongoDB. +### Testing yorkie-js-sdk with Yorkie and MongoDB. -Start MongoDB, Yorkie and Envoy proxy in a terminal session. +Start MongoDB, Yorkie in a terminal session. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d @@ -112,7 +112,7 @@ $ npm run test {test file path} # e.g. npm run test integration/tree_test.ts ### Starting co-editing example with CodeMirror -Start MongoDB, Yorkie and Envoy proxy in a terminal session. +Start MongoDB and Yorkie in a terminal session. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d diff --git a/README.md b/README.md index e1e08b999..e22074834 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,6 @@ The Yorkie JavaScript SDK implements the client-side libraries. To get started using Yorkie JavaScript SDK, see: https://yorkie.dev/docs/js-sdk -## How yorkie-js-sdk works - -yorkie-js-sdk uses gRPC-web for communicating with Yorkie Server built on gRPC. - -``` - +--Browser--+ +--Envoy---------+ +--Yorkie-----+ - | | | | | | - | gRPC-web <- HTTP1.1 -> gRPC-web proxy <- HTTP2 -> gRPC server | - | | | | | | - +-----------+ +----------------+ +-------------+ -``` - -For more details: https://grpc.io/blog/state-of-grpc-web/ - ## Contributing See [CONTRIBUTING](CONTRIBUTING.md) for details on submitting patches and the contribution workflow. diff --git a/buf.gen.yaml b/buf.gen.yaml new file mode 100644 index 000000000..ea878f5e1 --- /dev/null +++ b/buf.gen.yaml @@ -0,0 +1,12 @@ +version: v1 +plugins: + - plugin: es + out: . + opt: + - target=js+dts + - js_import_style=legacy_commonjs + - plugin: connect-es + out: . + opt: + - target=js+dts + - js_import_style=legacy_commonjs diff --git a/docker/docker-compose-ci.yml b/docker/docker-compose-ci.yml index 0e733303d..5a852e492 100644 --- a/docker/docker-compose-ci.yml +++ b/docker/docker-compose-ci.yml @@ -1,31 +1,14 @@ version: '3.3' services: - envoy: - build: - context: ./ - dockerfile: ./envoy.Dockerfile - image: 'grpcweb:envoy' - container_name: 'envoy' - restart: always - ports: - - '8080:8080' - - '9901:9901' - command: ['/etc/envoy/envoy-ci.yaml'] - depends_on: - - yorkie yorkie: image: 'yorkieteam/yorkie:latest' container_name: 'yorkie' - command: [ - 'server', - '--mongo-connection-uri', - 'mongodb://mongo:27017', - ] + command: ['server', '--mongo-connection-uri', 'mongodb://mongo:27017'] restart: always ports: - - '11101:11101' - - '11102:11102' + - '8080:8080' + - '8081:8081' depends_on: - mongo mongo: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index adc68d021..c03eda524 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,31 +1,11 @@ version: '3.3' services: - envoy: - build: - context: ./ - dockerfile: ./envoy.Dockerfile - image: 'grpcweb:envoy' - container_name: 'envoy' - restart: always - ports: - - '8080:8080' - - '9901:9901' - command: ['/etc/envoy/envoy.yaml'] - depends_on: - - yorkie - # If you're using Mac or Windows, this special domain name("host.docker.internal" which makes containers able to connect to the host) - # is supported by default. - # But if you're using Linux and want an envoy container to communicate with the host, - # it may help to define "host.docker.internal" in extra_hosts. - # (Actually, other hostnames are available, but in that case you should update clusters[].host configurations of envoy.yaml) - extra_hosts: - - 'host.docker.internal:host-gateway' yorkie: image: 'yorkieteam/yorkie:latest' container_name: 'yorkie' command: ['server', '--enable-pprof'] restart: always ports: - - '11101:11101' - - '11102:11102' + - '8080:8080' + - '8081:8081' diff --git a/docker/envoy-ci.yaml b/docker/envoy-ci.yaml deleted file mode 100644 index 416e72a25..000000000 --- a/docker/envoy-ci.yaml +++ /dev/null @@ -1,54 +0,0 @@ -admin: - access_log_path: /tmp/admin_access.log - address: - socket_address: { address: 0.0.0.0, port_value: 9901 } - -static_resources: - listeners: - - name: yorkie_rpc_listener - address: - socket_address: { address: 0.0.0.0, port_value: 8080 } - filter_chains: - - filters: - - name: envoy.filters.network.http_connection_manager - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager - stat_prefix: ingress_http - route_config: - name: local_route - virtual_hosts: - - name: local_service - domains: ["*"] - routes: - - match: { prefix: "/" } - route: - cluster: yorkie_rpc_service - # https://github.com/grpc/grpc-web/issues/361 - max_stream_duration: - grpc_timeout_header_max: 0s - cors: - allow_origin_string_match: - - prefix: "*" - allow_methods: GET, PUT, DELETE, POST, OPTIONS - allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-api-key,x-shard-key,x-user-agent,x-grpc-web,grpc-timeout,authorization,x-yorkie-user-agent - max_age: "1728000" - expose_headers: custom-header-1,grpc-status,grpc-message - http_filters: - - name: envoy.filters.http.grpc_web - - name: envoy.filters.http.cors - - name: envoy.filters.http.router - clusters: - - name: yorkie_rpc_service - connect_timeout: 0.25s - type: logical_dns - http2_protocol_options: {} - lb_policy: round_robin - load_assignment: - cluster_name: yorkie_cluster - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: yorkie - port_value: 11101 diff --git a/docker/envoy.Dockerfile b/docker/envoy.Dockerfile deleted file mode 100644 index 60b660b76..000000000 --- a/docker/envoy.Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM envoyproxy/envoy:v1.19.0 - -COPY ./envoy.yaml /etc/envoy/envoy.yaml -COPY ./envoy-ci.yaml /etc/envoy/envoy-ci.yaml - -ENTRYPOINT ["/usr/local/bin/envoy", "-c"] - -CMD /etc/envoy/envoy.yaml diff --git a/docker/envoy.yaml b/docker/envoy.yaml deleted file mode 100644 index 69b92bcc5..000000000 --- a/docker/envoy.yaml +++ /dev/null @@ -1,59 +0,0 @@ -admin: - access_log_path: /tmp/admin_access.log - address: - socket_address: { address: 0.0.0.0, port_value: 9901 } - -static_resources: - listeners: - - name: yorkie_rpc_listener - address: - socket_address: { address: 0.0.0.0, port_value: 8080 } - filter_chains: - - filters: - - name: envoy.filters.network.http_connection_manager - typed_config: - "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager - stat_prefix: ingress_http - route_config: - name: local_route - virtual_hosts: - - name: local_service - domains: ["*"] - routes: - - match: { prefix: "/" } - route: - cluster: yorkie_rpc_service - # https://github.com/grpc/grpc-web/issues/361 - max_stream_duration: - grpc_timeout_header_max: 0s - cors: - allow_origin_string_match: - - prefix: "*" - allow_methods: GET, PUT, DELETE, POST, OPTIONS - allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-api-key,x-shard-key,x-user-agent,x-grpc-web,grpc-timeout,authorization,x-yorkie-user-agent - max_age: "1728000" - expose_headers: custom-header-1,grpc-status,grpc-message - http_filters: - - name: envoy.filters.http.grpc_web - - name: envoy.filters.http.cors - - name: envoy.filters.http.router - clusters: - - name: yorkie_rpc_service - connect_timeout: 0.25s - type: logical_dns - http2_protocol_options: {} - lb_policy: round_robin - # Input the address which envoy can connect to as a yorkie server. - # When you want envoy container to communicate with your host machine, you should set as the following - # - Windows/Mac: Input host.docker.internal - # - Linux: an IP address of the host machine or docker-0 interface or some addresses defined in extra hosts of docker-compose.yml - # you can simply use the yorkie container name(e.g. yorkie) in docker-compose whatever your OS is. - load_assignment: - cluster_name: yorkie_cluster - endpoints: - - lb_endpoints: - - endpoint: - address: - socket_address: - address: host.docker.internal - port_value: 11101 diff --git a/examples/nextjs-scheduler/README.md b/examples/nextjs-scheduler/README.md index a89828187..90e17186a 100644 --- a/examples/nextjs-scheduler/README.md +++ b/examples/nextjs-scheduler/README.md @@ -10,7 +10,7 @@ ## How to run demo -At project root, run below command to start Yorkie server and Envoy proxy. +At project root, run below command to start Yorkie server. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d diff --git a/examples/profile-stack/README.md b/examples/profile-stack/README.md index 5171a5df0..1c3540ffc 100644 --- a/examples/profile-stack/README.md +++ b/examples/profile-stack/README.md @@ -10,7 +10,7 @@ ## How to run demo -At project root, run below command to start Yorkie and Envoy proxy. +At project root, run below command to start Yorkie. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d diff --git a/examples/react-tldraw/README.md b/examples/react-tldraw/README.md index 7ef547b9f..8065e762e 100644 --- a/examples/react-tldraw/README.md +++ b/examples/react-tldraw/README.md @@ -10,7 +10,7 @@ ## How to run demo -At project root, run below command to start Yorkie server and Envoy proxy. +At project root, run below command to start Yorkie server. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d diff --git a/examples/react-tldraw/src/hooks/useMultiplayerState.ts b/examples/react-tldraw/src/hooks/useMultiplayerState.ts index db489d333..4329255ae 100644 --- a/examples/react-tldraw/src/hooks/useMultiplayerState.ts +++ b/examples/react-tldraw/src/hooks/useMultiplayerState.ts @@ -192,7 +192,7 @@ export function useMultiplayerState(roomId: string) { // Setup the document's storage and subscriptions async function setupDocument() { try { - // 01. Create client with RPCAddr(envoy) and options with apiKey if provided. + // 01. Create client with RPCAddr and options with apiKey if provided. // Then activate client. const options: Options = { apiKey: import.meta.env.VITE_YORKIE_API_KEY, diff --git a/examples/react-todomvc/README.md b/examples/react-todomvc/README.md index 85583e7fd..2dd89d93f 100644 --- a/examples/react-todomvc/README.md +++ b/examples/react-todomvc/README.md @@ -10,7 +10,7 @@ ## How to run demo -At project root, run below command to start Yorkie server and Envoy proxy. +At project root, run below command to start Yorkie server. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d diff --git a/examples/react-todomvc/src/App.tsx b/examples/react-todomvc/src/App.tsx index 6b8428b7b..64df6b0a3 100644 --- a/examples/react-todomvc/src/App.tsx +++ b/examples/react-todomvc/src/App.tsx @@ -118,7 +118,7 @@ export default function App() { doc: Document<{ todos: JSONArray }>, callback: (todos: any) => void, ) { - // 01. create client with RPCAddr(envoy) then activate it. + // 01. create client with RPCAddr then activate it. await client.activate(); // 02. attach the document into the client. diff --git a/examples/simultaneous-cursors/README.md b/examples/simultaneous-cursors/README.md index c07d50a5a..cb8264b10 100644 --- a/examples/simultaneous-cursors/README.md +++ b/examples/simultaneous-cursors/README.md @@ -41,7 +41,7 @@ Install dependencies $ npm install ``` -At project root, run below command to start Yorkie and Envoy proxy. +At project root, run below command to start Yorkie server. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d diff --git a/examples/vanilla-codemirror6/README.md b/examples/vanilla-codemirror6/README.md index 64eccc0ce..e1f1c74db 100644 --- a/examples/vanilla-codemirror6/README.md +++ b/examples/vanilla-codemirror6/README.md @@ -10,7 +10,7 @@ ## How to run demo -At project root, run below command to start Yorkie and Envoy proxy. +At project root, run below command to start Yorkie. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d diff --git a/examples/vanilla-codemirror6/src/main.ts b/examples/vanilla-codemirror6/src/main.ts index 8f043b1bc..a45a2ceac 100644 --- a/examples/vanilla-codemirror6/src/main.ts +++ b/examples/vanilla-codemirror6/src/main.ts @@ -20,7 +20,7 @@ const documentTextElem = document.getElementById('document-text')!; const networkStatusElem = document.getElementById('network-status')!; async function main() { - // 01. create client with RPCAddr(envoy) then activate it. + // 01. create client with RPCAddr then activate it. const client = new yorkie.Client(import.meta.env.VITE_YORKIE_API_ADDR, { apiKey: import.meta.env.VITE_YORKIE_API_KEY, }); diff --git a/examples/vanilla-quill/README.md b/examples/vanilla-quill/README.md index 6e9d5b54b..424d484f9 100644 --- a/examples/vanilla-quill/README.md +++ b/examples/vanilla-quill/README.md @@ -41,7 +41,7 @@ Install dependencies $ npm install ``` -At project root, run below command to start Yorkie and Envoy proxy. +At project root, run below command to start Yorkie. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d diff --git a/examples/vanilla-quill/src/main.ts b/examples/vanilla-quill/src/main.ts index d64f412b3..15bd03272 100644 --- a/examples/vanilla-quill/src/main.ts +++ b/examples/vanilla-quill/src/main.ts @@ -41,7 +41,7 @@ function toDeltaOperation( } async function main() { - // 01-1. create client with RPCAddr(envoy) then activate it. + // 01-1. create client with RPCAddr then activate it. const client = new yorkie.Client(import.meta.env.VITE_YORKIE_API_ADDR, { apiKey: import.meta.env.VITE_YORKIE_API_KEY, }); diff --git a/examples/vuejs-kanban/README.md b/examples/vuejs-kanban/README.md index 6e2a6ba18..9f42dcca7 100644 --- a/examples/vuejs-kanban/README.md +++ b/examples/vuejs-kanban/README.md @@ -10,7 +10,7 @@ ## How to run demo -At project root, run below command to start Yorkie and Envoy proxy. +At project root, run below command to start Yorkie server. ```bash $ docker-compose -f docker/docker-compose.yml up --build -d diff --git a/package-lock.json b/package-lock.json index df80318ee..920a39146 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,23 +1,27 @@ { "name": "yorkie-js-sdk", - "version": "0.4.9", + "version": "0.4.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "yorkie-js-sdk", - "version": "0.4.9", + "version": "0.4.10", "license": "Apache-2.0", "workspaces": [ "examples/*", "tools/*" ], "dependencies": { - "google-protobuf": "^3.19.4", - "grpc-web": "^1.3.1", + "@bufbuild/protobuf": "^1.6.0", + "@connectrpc/connect": "^1.2.0", + "@connectrpc/connect-web": "^1.2.0", "long": "^5.2.0" }, "devDependencies": { + "@bufbuild/buf": "^1.28.1", + "@bufbuild/protoc-gen-es": "^1.6.0", + "@connectrpc/protoc-gen-connect-es": "^1.2.0", "@microsoft/api-documenter": "^7.15.1", "@microsoft/api-extractor": "^7.19.4", "@types/benchmark": "^2.1.1", @@ -1024,6 +1028,178 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@bufbuild/buf": { + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/@bufbuild/buf/-/buf-1.28.1.tgz", + "integrity": "sha512-WRDagrf0uBjfV9s5eyrSPJDcdI4A5Q7JMCA4aMrHRR8fo/TTjniDBjJprszhaguqsDkn/LS4QIu92HVFZCrl9A==", + "dev": true, + "hasInstallScript": true, + "bin": { + "buf": "bin/buf", + "protoc-gen-buf-breaking": "bin/protoc-gen-buf-breaking", + "protoc-gen-buf-lint": "bin/protoc-gen-buf-lint" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@bufbuild/buf-darwin-arm64": "1.28.1", + "@bufbuild/buf-darwin-x64": "1.28.1", + "@bufbuild/buf-linux-aarch64": "1.28.1", + "@bufbuild/buf-linux-x64": "1.28.1", + "@bufbuild/buf-win32-arm64": "1.28.1", + "@bufbuild/buf-win32-x64": "1.28.1" + } + }, + "node_modules/@bufbuild/buf-darwin-arm64": { + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-darwin-arm64/-/buf-darwin-arm64-1.28.1.tgz", + "integrity": "sha512-nAyvwKkcd8qQTExCZo5MtSRhXLK7e3vzKFKHjXfkveRakSUST2HFlFZAHfErZimN4wBrPTN0V0hNRU8PPjkMpQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-darwin-x64": { + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-darwin-x64/-/buf-darwin-x64-1.28.1.tgz", + "integrity": "sha512-b0eT3xd3vX5a5lWAbo5h7FPuf9MsOJI4I39qs4TZnrlZ8BOuPfqzwzijiFf9UCwaX2vR1NQXexIoQ80Ci+fCHw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-linux-aarch64": { + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-aarch64/-/buf-linux-aarch64-1.28.1.tgz", + "integrity": "sha512-p5h9bZCVLMh8No9/7k7ulXzsFx5P7Lu6DiUMjSJ6aBXPMYo6Xl7r/6L2cQkpsZ53HMtIxCgMYS9a7zoS4K8wIw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-linux-x64": { + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-linux-x64/-/buf-linux-x64-1.28.1.tgz", + "integrity": "sha512-fVJ3DiRigIso06jgEl+JNp59Y5t2pxDHd10d3SA4r+14sXbZ2J7Gy/wBqVXPry4x/jW567KKlvmhg7M5ZBgCQQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-win32-arm64": { + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-win32-arm64/-/buf-win32-arm64-1.28.1.tgz", + "integrity": "sha512-KJiRJpugQRK/jXC46Xjlb68UydWhCZj2jHdWLIwNtgXd1WTJ3LngChZV7Y6pPK08pwBAVz0JYeVbD5IlTCD4TQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/buf-win32-x64": { + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/@bufbuild/buf-win32-x64/-/buf-win32-x64-1.28.1.tgz", + "integrity": "sha512-vMnc+7OVCkmlRWQsgYHgUqiBPRIjD8XeoRyApJ07YZzGs7DkRH4LhvmacJbLd3wORylbn6gLz3pQa8J/M61mzg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@bufbuild/protobuf": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.6.0.tgz", + "integrity": "sha512-hp19vSFgNw3wBBcVBx5qo5pufCqjaJ0Cfk5H/pfjNOfNWU+4/w0QVOmfAOZNRrNWRrVuaJWxcN8P2vhOkkzbBQ==" + }, + "node_modules/@bufbuild/protoc-gen-es": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.6.0.tgz", + "integrity": "sha512-m0akOPWeD5UBfGdZyudrbnmdjI8l/ZHlP8TyEIcj7qMCR4kh68tMtGvrjRzj5ynIpavrr6G7P06XP9F9f2MDRw==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "^1.6.0", + "@bufbuild/protoplugin": "1.6.0" + }, + "bin": { + "protoc-gen-es": "bin/protoc-gen-es" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@bufbuild/protobuf": "1.6.0" + }, + "peerDependenciesMeta": { + "@bufbuild/protobuf": { + "optional": true + } + } + }, + "node_modules/@bufbuild/protoplugin": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.6.0.tgz", + "integrity": "sha512-o53ZsvojHQkAPoC9v5sJifY2OfXdRU8DO3QpPoJ+QuvYcfB9Zb3DZkNMQRyfEbF4TVYiaQ0mZzZl1mESDdyCxA==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "1.6.0", + "@typescript/vfs": "^1.4.0", + "typescript": "4.5.2" + } + }, + "node_modules/@bufbuild/protoplugin/node_modules/typescript": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", + "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/@codemirror/autocomplete": { "version": "6.3.4", "license": "MIT", @@ -1324,6 +1500,51 @@ "w3c-keyname": "^2.2.4" } }, + "node_modules/@connectrpc/connect": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-1.2.0.tgz", + "integrity": "sha512-kHF30xAlXF2Y7S1I7XN/D3psKLfjxitgNRmF093KNP+cE9yAnqDAGop6aby3Z5k4XQw2ebjeX4E41db7R3FzaQ==", + "peerDependencies": { + "@bufbuild/protobuf": "^1.4.2" + } + }, + "node_modules/@connectrpc/connect-web": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@connectrpc/connect-web/-/connect-web-1.2.0.tgz", + "integrity": "sha512-vjFKTP/AzSnC8JvkGKRgpggZIB0v+Lv7U+/Tb/pRNGZI0WSElhGDXWgIn3xfcSNQWi079m45c5MlikszzIRsYg==", + "peerDependencies": { + "@bufbuild/protobuf": "^1.4.2", + "@connectrpc/connect": "1.2.0" + } + }, + "node_modules/@connectrpc/protoc-gen-connect-es": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@connectrpc/protoc-gen-connect-es/-/protoc-gen-connect-es-1.2.0.tgz", + "integrity": "sha512-VJ50wqjLJ4Thk6nOgARALCny+AMxHDS3fxAVEV1oveVXRbrCl5pb8ge/erKYyxuLKyBYe/I00MFa+ns6C3nN7g==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "^1.6.0", + "@bufbuild/protoplugin": "^1.6.0" + }, + "bin": { + "protoc-gen-connect-es": "bin/protoc-gen-connect-es" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@bufbuild/protoc-gen-es": "^1.6.0", + "@connectrpc/connect": "1.2.0" + }, + "peerDependenciesMeta": { + "@bufbuild/protoc-gen-es": { + "optional": true + }, + "@connectrpc/connect": { + "optional": true + } + } + }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "dev": true, @@ -3810,6 +4031,15 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript/vfs": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@typescript/vfs/-/vfs-1.5.0.tgz", + "integrity": "sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1" + } + }, "node_modules/@use-gesture/core": { "version": "10.2.23", "license": "MIT" diff --git a/package.json b/package.json index 057f239f5..c468833ee 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ ], "scripts": { "build": "webpack --config ./config/webpack.config.js && npm run api-report && npm run prune", - "build:proto": "protoc -I=./src/api --js_out=import_style=commonjs:./src/api --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:./src/api ./src/api/yorkie/v1/*.proto", + "build:proto": "npx buf generate", "build:docs": "npm run predoc && api-documenter markdown --input temp --output docs", "build:examples": "npm run build --workspace examples", "build:create-yorkie-app": "npm run build --workspace create-yorkie-app", @@ -46,6 +46,9 @@ }, "homepage": "https://github.com/yorkie-team/yorkie-js-sdk#readme", "devDependencies": { + "@bufbuild/buf": "^1.28.1", + "@bufbuild/protoc-gen-es": "^1.6.0", + "@connectrpc/protoc-gen-connect-es": "^1.2.0", "@microsoft/api-documenter": "^7.15.1", "@microsoft/api-extractor": "^7.19.4", "@types/benchmark": "^2.1.1", @@ -85,8 +88,9 @@ "yargs": "^17.0.1" }, "dependencies": { - "google-protobuf": "^3.19.4", - "grpc-web": "^1.3.1", + "@bufbuild/protobuf": "^1.6.0", + "@connectrpc/connect": "^1.2.0", + "@connectrpc/connect-web": "^1.2.0", "long": "^5.2.0" }, "husky": { diff --git a/public/counter.html b/public/counter.html index f53b7d6c5..2670b6d52 100644 --- a/public/counter.html +++ b/public/counter.html @@ -36,7 +36,7 @@ async function main() { try { - // 01. create client with RPCAddr(envoy) then activate it. + // 01. create client with RPCAddr then activate it. const client = new yorkie.Client('http://localhost:8080'); client.subscribe(network.statusListener(statusHolder)); await client.activate(); diff --git a/public/drawing.html b/public/drawing.html index f526ee09d..e12a30736 100644 --- a/public/drawing.html +++ b/public/drawing.html @@ -37,7 +37,7 @@ async function main() { try { - // 01. create client with RPCAddr(envoy) then activate it. + // 01. create client with RPCAddr then activate it. const client = new yorkie.Client('http://localhost:8080', { syncLoopDuration: 0, reconnectStreamDelay: 1000, diff --git a/public/index.html b/public/index.html index 965c83a71..f74075eba 100644 --- a/public/index.html +++ b/public/index.html @@ -323,7 +323,7 @@

}); devtool.setCodeMirror(codemirror); - // 02-1. create client with RPCAddr(envoy). + // 02-1. create client with RPCAddr. const client = new yorkie.Client('http://localhost:8080'); // 02-2. subscribe client event. client.subscribe(network.statusListener(statusHolder)); diff --git a/public/multi.html b/public/multi.html index 40a57cfab..c6fc3912a 100644 --- a/public/multi.html +++ b/public/multi.html @@ -78,7 +78,7 @@

yorkie document

async function main() { try { - // 01-1. create client with RPCAddr(envoy). + // 01-1. create client with RPCAddr. const client = new yorkie.Client('http://localhost:8080'); // 01-2. subscribe client event. client.subscribe(network.statusListener(statusHolder)); diff --git a/public/quill.html b/public/quill.html index 0e70728f4..314fb4d1b 100644 --- a/public/quill.html +++ b/public/quill.html @@ -64,7 +64,7 @@ async function main() { try { - // 01. create client with RPCAddr(envoy) then activate it. + // 01. create client with RPCAddr then activate it. const client = new yorkie.Client('http://localhost:8080'); await client.activate(); client.subscribe(network.statusListener(networkStatusElem)); diff --git a/public/whiteboard.html b/public/whiteboard.html index baaee3c89..71ebed24d 100644 --- a/public/whiteboard.html +++ b/public/whiteboard.html @@ -253,7 +253,7 @@

async function main() { try { - // 01. create client with RPCAddr(envoy) then activate it. + // 01. create client with RPCAddr then activate it. const client = new yorkie.Client('http://localhost:8080'); client.subscribe(network.statusListener(statusHolder)); await client.activate(); diff --git a/src/api/converter.ts b/src/api/converter.ts index 3ee828f1e..b0fab299f 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 { @@ -79,6 +78,22 @@ import { TreePos as PbTreePos, TreeNodeID as PbTreeNodeID, ValueType as PbValueType, + JSONElement_Tree as PbJSONElement_Tree, + JSONElement_Text as PbJSONElement_Text, + JSONElement_Primitive as PbJSONElement_Primitive, + JSONElement_Counter as PbJSONElement_Counter, + JSONElement_JSONObject as PbJSONElement_JSONObject, + JSONElement_JSONArray as PbJSONElement_JSONArray, + PresenceChange_ChangeType as PbPresenceChange_ChangeType, + Operation_Set as PbOperation_Set, + Operation_Add as PbOperation_Add, + Operation_Move as PbOperation_Move, + Operation_Remove as PbOperation_Remove, + Operation_Edit as PbOperation_Edit, + Operation_Style as PbOperation_Style, + Operation_Increase as PbOperation_Increase, + Operation_TreeEdit as PbOperation_TreeEdit, + Operation_TreeStyle as PbOperation_TreeStyle, } from '@yorkie-js-sdk/src/api/yorkie/v1/resources_pb'; import { IncreaseOperation } from '@yorkie-js-sdk/src/document/operation/increase_operation'; import { @@ -99,9 +114,9 @@ import { RHT } from '../document/crdt/rht'; */ function toPresence(presence: Indexable): PbPresence { const pbPresence = new PbPresence(); - const pbDataMap = pbPresence.getDataMap(); + const pbDataMap = pbPresence.data; for (const [key, value] of Object.entries(presence)) { - pbDataMap.set(key, JSON.stringify(value)); + pbDataMap[key] = JSON.stringify(value); } return pbPresence; } @@ -112,37 +127,40 @@ function toPresence(presence: Indexable): PbPresence { function toPresenceChange( presenceChange: PresenceChange, ): PbPresenceChange { - const pbPresenceChange = new PbPresenceChange(); - if (presenceChange.type === PresenceChangeType.Put) { - pbPresenceChange.setType(PbPresenceChange.ChangeType.CHANGE_TYPE_PUT); - pbPresenceChange.setPresence(toPresence(presenceChange.presence)); - } else if (presenceChange.type === PresenceChangeType.Clear) { - pbPresenceChange.setType(PbPresenceChange.ChangeType.CHANGE_TYPE_CLEAR); + return new PbPresenceChange({ + type: PbPresenceChange_ChangeType.PUT, + presence: toPresence(presenceChange.presence), + }); + } + if (presenceChange.type === PresenceChangeType.Clear) { + return new PbPresenceChange({ + type: PbPresenceChange_ChangeType.CLEAR, + }); } - return pbPresenceChange; + throw new YorkieError(Code.Unimplemented, `unimplemented type`); } /** * `toCheckpoint` converts the given model to Protobuf format. */ function toCheckpoint(checkpoint: Checkpoint): PbCheckpoint { - const pbCheckpoint = new PbCheckpoint(); - pbCheckpoint.setServerSeq(checkpoint.getServerSeqAsString()); - pbCheckpoint.setClientSeq(checkpoint.getClientSeq()); - return pbCheckpoint; + return new PbCheckpoint({ + serverSeq: checkpoint.getServerSeqAsString(), + clientSeq: checkpoint.getClientSeq(), + }); } /** * `toChangeID` converts the given model to Protobuf format. */ function toChangeID(changeID: ChangeID): PbChangeID { - const pbChangeID = new PbChangeID(); - pbChangeID.setClientSeq(changeID.getClientSeq()); - pbChangeID.setLamport(changeID.getLamportAsString()); - pbChangeID.setActorId(toUint8Array(changeID.getActorID()!)); - return pbChangeID; + return new PbChangeID({ + clientSeq: changeID.getClientSeq(), + lamport: changeID.getLamportAsString(), + actorId: toUint8Array(changeID.getActorID()!), + }); } /** @@ -153,11 +171,11 @@ function toTimeTicket(ticket?: TimeTicket): PbTimeTicket | undefined { return; } - const pbTimeTicket = new PbTimeTicket(); - pbTimeTicket.setLamport(ticket.getLamportAsString()); - pbTimeTicket.setDelimiter(ticket.getDelimiter()); - pbTimeTicket.setActorId(toUint8Array(ticket.getActorID()!)); - return pbTimeTicket; + return new PbTimeTicket({ + lamport: ticket.getLamportAsString(), + delimiter: ticket.getDelimiter(), + actorId: toUint8Array(ticket.getActorID()!), + }); } /** @@ -166,21 +184,21 @@ function toTimeTicket(ticket?: TimeTicket): PbTimeTicket | undefined { function toValueType(valueType: PrimitiveType): PbValueType { switch (valueType) { case PrimitiveType.Null: - return PbValueType.VALUE_TYPE_NULL; + return PbValueType.NULL; case PrimitiveType.Boolean: - return PbValueType.VALUE_TYPE_BOOLEAN; + return PbValueType.BOOLEAN; case PrimitiveType.Integer: - return PbValueType.VALUE_TYPE_INTEGER; + return PbValueType.INTEGER; case PrimitiveType.Long: - return PbValueType.VALUE_TYPE_LONG; + return PbValueType.LONG; case PrimitiveType.Double: - return PbValueType.VALUE_TYPE_DOUBLE; + return PbValueType.DOUBLE; case PrimitiveType.String: - return PbValueType.VALUE_TYPE_STRING; + return PbValueType.STRING; case PrimitiveType.Bytes: - return PbValueType.VALUE_TYPE_BYTES; + return PbValueType.BYTES; case PrimitiveType.Date: - return PbValueType.VALUE_TYPE_DATE; + return PbValueType.DATE; default: throw new YorkieError(Code.Unsupported, `unsupported type: ${valueType}`); } @@ -192,9 +210,9 @@ function toValueType(valueType: PrimitiveType): PbValueType { function toCounterType(valueType: CounterType): PbValueType { switch (valueType) { case CounterType.IntegerCnt: - return PbValueType.VALUE_TYPE_INTEGER_CNT; + return PbValueType.INTEGER_CNT; case CounterType.LongCnt: - return PbValueType.VALUE_TYPE_LONG_CNT; + return PbValueType.LONG_CNT; default: throw new YorkieError(Code.Unsupported, `unsupported type: ${valueType}`); } @@ -204,79 +222,90 @@ function toCounterType(valueType: CounterType): PbValueType { * `toElementSimple` converts the given model to Protobuf format. */ function toElementSimple(element: CRDTElement): PbJSONElementSimple { - const pbElementSimple = new PbJSONElementSimple(); if (element instanceof CRDTObject) { - pbElementSimple.setType(PbValueType.VALUE_TYPE_JSON_OBJECT); - pbElementSimple.setCreatedAt(toTimeTicket(element.getCreatedAt())); - pbElementSimple.setValue(objectToBytes(element)); - } else if (element instanceof CRDTArray) { - pbElementSimple.setType(PbValueType.VALUE_TYPE_JSON_ARRAY); - pbElementSimple.setCreatedAt(toTimeTicket(element.getCreatedAt())); - pbElementSimple.setValue(arrayToBytes(element)); - } else if (element instanceof CRDTText) { - pbElementSimple.setType(PbValueType.VALUE_TYPE_TEXT); - pbElementSimple.setCreatedAt(toTimeTicket(element.getCreatedAt())); - } else if (element instanceof Primitive) { - const primitive = element as Primitive; - pbElementSimple.setType(toValueType(primitive.getType())); - pbElementSimple.setCreatedAt(toTimeTicket(element.getCreatedAt())); - pbElementSimple.setValue(element.toBytes()); - } else if (element instanceof CRDTCounter) { - const counter = element as CRDTCounter; - pbElementSimple.setType(toCounterType(counter.getType())); - pbElementSimple.setCreatedAt(toTimeTicket(element.getCreatedAt())); - pbElementSimple.setValue(element.toBytes()); - } else if (element instanceof CRDTTree) { - const tree = element as CRDTTree; - pbElementSimple.setType(PbValueType.VALUE_TYPE_TREE); - pbElementSimple.setCreatedAt(toTimeTicket(element.getCreatedAt())); - pbElementSimple.setValue(treeToBytes(tree)); - } else { - throw new YorkieError(Code.Unimplemented, `unimplemented element`); + return new PbJSONElementSimple({ + type: PbValueType.JSON_OBJECT, + createdAt: toTimeTicket(element.getCreatedAt()), + value: objectToBytes(element), + }); + } + if (element instanceof CRDTArray) { + return new PbJSONElementSimple({ + type: PbValueType.JSON_ARRAY, + createdAt: toTimeTicket(element.getCreatedAt()), + value: arrayToBytes(element), + }); + } + if (element instanceof CRDTText) { + return new PbJSONElementSimple({ + type: PbValueType.TEXT, + createdAt: toTimeTicket(element.getCreatedAt()), + }); + } + if (element instanceof Primitive) { + return new PbJSONElementSimple({ + type: toValueType(element.getType()), + createdAt: toTimeTicket(element.getCreatedAt()), + value: element.toBytes(), + }); + } + if (element instanceof CRDTCounter) { + return new PbJSONElementSimple({ + type: toCounterType(element.getType()), + createdAt: toTimeTicket(element.getCreatedAt()), + value: element.toBytes(), + }); + } + if (element instanceof CRDTTree) { + return new PbJSONElementSimple({ + type: PbValueType.TREE, + createdAt: toTimeTicket(element.getCreatedAt()), + value: treeToBytes(element), + }); } - return pbElementSimple; + throw new YorkieError(Code.Unimplemented, `unimplemented element`); } /** * `toTextNodeID` converts the given model to Protobuf format. */ function toTextNodeID(id: RGATreeSplitNodeID): PbTextNodeID { - const pbTextNodeID = new PbTextNodeID(); - pbTextNodeID.setCreatedAt(toTimeTicket(id.getCreatedAt())); - pbTextNodeID.setOffset(id.getOffset()); - return pbTextNodeID; + return new PbTextNodeID({ + createdAt: toTimeTicket(id.getCreatedAt()), + offset: id.getOffset(), + }); } /** * `toTextNodePos` converts the given model to Protobuf format. */ function toTextNodePos(pos: RGATreeSplitPos): PbTextNodePos { - const pbTextNodePos = new PbTextNodePos(); - pbTextNodePos.setCreatedAt(toTimeTicket(pos.getID().getCreatedAt())); - pbTextNodePos.setOffset(pos.getID().getOffset()); - pbTextNodePos.setRelativeOffset(pos.getRelativeOffset()); - return pbTextNodePos; + return new PbTextNodePos({ + createdAt: toTimeTicket(pos.getID().getCreatedAt()), + offset: pos.getID().getOffset(), + relativeOffset: pos.getRelativeOffset(), + }); } /** * `toTreePos` converts the given model to Protobuf format. */ function toTreePos(pos: CRDTTreePos): PbTreePos { - const pbTreePos = new PbTreePos(); - pbTreePos.setParentId(toTreeNodeID(pos.getParentID())); - pbTreePos.setLeftSiblingId(toTreeNodeID(pos.getLeftSiblingID())); - return pbTreePos; + return new PbTreePos({ + parentId: toTreeNodeID(pos.getParentID()), + leftSiblingId: toTreeNodeID(pos.getLeftSiblingID()), + }); } /** * `toTreeNodeID` converts the given model to Protobuf format. */ function toTreeNodeID(treeNodeID: CRDTTreeNodeID): PbTreeNodeID { - const pbTreeNodeID = new PbTreeNodeID(); - pbTreeNodeID.setCreatedAt(toTimeTicket(treeNodeID.getCreatedAt())); - pbTreeNodeID.setOffset(treeNodeID.getOffset()); - return pbTreeNodeID; + return new PbTreeNodeID({ + createdAt: toTimeTicket(treeNodeID.getCreatedAt()), + offset: treeNodeID.getOffset(), + }); } /** @@ -287,141 +316,145 @@ function toOperation(operation: Operation): PbOperation { if (operation instanceof SetOperation) { const setOperation = operation as SetOperation; - const pbSetOperation = new PbOperation.Set(); - pbSetOperation.setParentCreatedAt( - toTimeTicket(setOperation.getParentCreatedAt()), + const pbSetOperation = new PbOperation_Set(); + pbSetOperation.parentCreatedAt = toTimeTicket( + setOperation.getParentCreatedAt(), ); - pbSetOperation.setKey(setOperation.getKey()); - pbSetOperation.setValue(toElementSimple(setOperation.getValue())); - pbSetOperation.setExecutedAt(toTimeTicket(setOperation.getExecutedAt())); - pbOperation.setSet(pbSetOperation); + pbSetOperation.key = setOperation.getKey(); + pbSetOperation.value = toElementSimple(setOperation.getValue()); + pbSetOperation.executedAt = toTimeTicket(setOperation.getExecutedAt()); + pbOperation.body.case = 'set'; + pbOperation.body.value = pbSetOperation; } else if (operation instanceof AddOperation) { const addOperation = operation as AddOperation; - const pbAddOperation = new PbOperation.Add(); - pbAddOperation.setParentCreatedAt( - toTimeTicket(addOperation.getParentCreatedAt()), + const pbAddOperation = new PbOperation_Add(); + pbAddOperation.parentCreatedAt = toTimeTicket( + addOperation.getParentCreatedAt(), ); - pbAddOperation.setPrevCreatedAt( - toTimeTicket(addOperation.getPrevCreatedAt()), + pbAddOperation.prevCreatedAt = toTimeTicket( + addOperation.getPrevCreatedAt(), ); - pbAddOperation.setValue(toElementSimple(addOperation.getValue())); - pbAddOperation.setExecutedAt(toTimeTicket(addOperation.getExecutedAt())); - pbOperation.setAdd(pbAddOperation); + pbAddOperation.value = toElementSimple(addOperation.getValue()); + pbAddOperation.executedAt = toTimeTicket(addOperation.getExecutedAt()); + pbOperation.body.case = 'add'; + pbOperation.body.value = pbAddOperation; } else if (operation instanceof MoveOperation) { const moveOperation = operation as MoveOperation; - const pbMoveOperation = new PbOperation.Move(); - pbMoveOperation.setParentCreatedAt( - toTimeTicket(moveOperation.getParentCreatedAt()), + const pbMoveOperation = new PbOperation_Move(); + pbMoveOperation.parentCreatedAt = toTimeTicket( + moveOperation.getParentCreatedAt(), ); - pbMoveOperation.setPrevCreatedAt( - toTimeTicket(moveOperation.getPrevCreatedAt()), + pbMoveOperation.prevCreatedAt = toTimeTicket( + moveOperation.getPrevCreatedAt(), ); - pbMoveOperation.setCreatedAt(toTimeTicket(moveOperation.getCreatedAt())); - pbMoveOperation.setExecutedAt(toTimeTicket(moveOperation.getExecutedAt())); - pbOperation.setMove(pbMoveOperation); + pbMoveOperation.createdAt = toTimeTicket(moveOperation.getCreatedAt()); + pbMoveOperation.executedAt = toTimeTicket(moveOperation.getExecutedAt()); + pbOperation.body.case = 'move'; + pbOperation.body.value = pbMoveOperation; } else if (operation instanceof RemoveOperation) { const removeOperation = operation as RemoveOperation; - const pbRemoveOperation = new PbOperation.Remove(); - pbRemoveOperation.setParentCreatedAt( - toTimeTicket(removeOperation.getParentCreatedAt()), - ); - pbRemoveOperation.setCreatedAt( - toTimeTicket(removeOperation.getCreatedAt()), + const pbRemoveOperation = new PbOperation_Remove(); + pbRemoveOperation.parentCreatedAt = toTimeTicket( + removeOperation.getParentCreatedAt(), ); - pbRemoveOperation.setExecutedAt( - toTimeTicket(removeOperation.getExecutedAt()), + pbRemoveOperation.createdAt = toTimeTicket(removeOperation.getCreatedAt()); + pbRemoveOperation.executedAt = toTimeTicket( + removeOperation.getExecutedAt(), ); - pbOperation.setRemove(pbRemoveOperation); + pbOperation.body.case = 'remove'; + pbOperation.body.value = pbRemoveOperation; } else if (operation instanceof EditOperation) { const editOperation = operation as EditOperation; - const pbEditOperation = new PbOperation.Edit(); - pbEditOperation.setParentCreatedAt( - toTimeTicket(editOperation.getParentCreatedAt()), + const pbEditOperation = new PbOperation_Edit(); + pbEditOperation.parentCreatedAt = toTimeTicket( + editOperation.getParentCreatedAt(), ); - pbEditOperation.setFrom(toTextNodePos(editOperation.getFromPos())); - pbEditOperation.setTo(toTextNodePos(editOperation.getToPos())); - const pbCreatedAtMapByActor = pbEditOperation.getCreatedAtMapByActorMap(); + pbEditOperation.from = toTextNodePos(editOperation.getFromPos()); + pbEditOperation.to = toTextNodePos(editOperation.getToPos()); + const pbCreatedAtMapByActor = pbEditOperation.createdAtMapByActor; for (const [key, value] of editOperation.getMaxCreatedAtMapByActor()) { - pbCreatedAtMapByActor.set(key, toTimeTicket(value)!); + pbCreatedAtMapByActor[key] = toTimeTicket(value)!; } - pbEditOperation.setContent(editOperation.getContent()); - const pbAttributes = pbEditOperation.getAttributesMap(); + pbEditOperation.content = editOperation.getContent(); + const pbAttributes = pbEditOperation.attributes; for (const [key, value] of editOperation.getAttributes()) { - pbAttributes.set(key, value); + pbAttributes[key] = value; } - pbEditOperation.setExecutedAt(toTimeTicket(editOperation.getExecutedAt())); - pbOperation.setEdit(pbEditOperation); + pbEditOperation.executedAt = toTimeTicket(editOperation.getExecutedAt()); + pbOperation.body.case = 'edit'; + pbOperation.body.value = pbEditOperation; } else if (operation instanceof StyleOperation) { const styleOperation = operation as StyleOperation; - const pbStyleOperation = new PbOperation.Style(); - pbStyleOperation.setParentCreatedAt( - toTimeTicket(styleOperation.getParentCreatedAt()), + const pbStyleOperation = new PbOperation_Style(); + pbStyleOperation.parentCreatedAt = toTimeTicket( + styleOperation.getParentCreatedAt(), ); - pbStyleOperation.setFrom(toTextNodePos(styleOperation.getFromPos())); - pbStyleOperation.setTo(toTextNodePos(styleOperation.getToPos())); - const pbCreatedAtMapByActor = pbStyleOperation.getCreatedAtMapByActorMap(); + pbStyleOperation.from = toTextNodePos(styleOperation.getFromPos()); + pbStyleOperation.to = toTextNodePos(styleOperation.getToPos()); + const pbCreatedAtMapByActor = pbStyleOperation.createdAtMapByActor; for (const [key, value] of styleOperation.getMaxCreatedAtMapByActor()) { - pbCreatedAtMapByActor.set(key, toTimeTicket(value)!); + pbCreatedAtMapByActor[key] = toTimeTicket(value)!; } - const pbAttributes = pbStyleOperation.getAttributesMap(); + const pbAttributes = pbStyleOperation.attributes; for (const [key, value] of styleOperation.getAttributes()) { - pbAttributes.set(key, value); + pbAttributes[key] = value; } - pbStyleOperation.setExecutedAt( - toTimeTicket(styleOperation.getExecutedAt()), - ); - pbOperation.setStyle(pbStyleOperation); + pbStyleOperation.executedAt = toTimeTicket(styleOperation.getExecutedAt()); + pbOperation.body.case = 'style'; + pbOperation.body.value = pbStyleOperation; } else if (operation instanceof IncreaseOperation) { const increaseOperation = operation as IncreaseOperation; - const pbIncreaseOperation = new PbOperation.Increase(); - pbIncreaseOperation.setParentCreatedAt( - toTimeTicket(increaseOperation.getParentCreatedAt()), + const pbIncreaseOperation = new PbOperation_Increase(); + pbIncreaseOperation.parentCreatedAt = toTimeTicket( + increaseOperation.getParentCreatedAt(), ); - pbIncreaseOperation.setValue(toElementSimple(increaseOperation.getValue())); - pbIncreaseOperation.setExecutedAt( - toTimeTicket(increaseOperation.getExecutedAt()), + pbIncreaseOperation.value = toElementSimple(increaseOperation.getValue()); + pbIncreaseOperation.executedAt = toTimeTicket( + increaseOperation.getExecutedAt(), ); - pbOperation.setIncrease(pbIncreaseOperation); + pbOperation.body.case = 'increase'; + pbOperation.body.value = pbIncreaseOperation; } else if (operation instanceof TreeEditOperation) { const treeEditOperation = operation as TreeEditOperation; - const pbTreeEditOperation = new PbOperation.TreeEdit(); - const pbCreatedAtMapByActor = - pbTreeEditOperation.getCreatedAtMapByActorMap(); + const pbTreeEditOperation = new PbOperation_TreeEdit(); + const pbCreatedAtMapByActor = pbTreeEditOperation.createdAtMapByActor; for (const [key, value] of treeEditOperation.getMaxCreatedAtMapByActor()) { - pbCreatedAtMapByActor.set(key, toTimeTicket(value)!); + pbCreatedAtMapByActor[key] = toTimeTicket(value)!; } - pbTreeEditOperation.setParentCreatedAt( - toTimeTicket(treeEditOperation.getParentCreatedAt()), + pbTreeEditOperation.parentCreatedAt = toTimeTicket( + treeEditOperation.getParentCreatedAt(), ); - pbTreeEditOperation.setFrom(toTreePos(treeEditOperation.getFromPos())); - pbTreeEditOperation.setTo(toTreePos(treeEditOperation.getToPos())); - pbTreeEditOperation.setContentsList( - toTreeNodesWhenEdit(treeEditOperation.getContents()!), + pbTreeEditOperation.from = toTreePos(treeEditOperation.getFromPos()); + pbTreeEditOperation.to = toTreePos(treeEditOperation.getToPos()); + pbTreeEditOperation.contents = toTreeNodesWhenEdit( + treeEditOperation.getContents()!, ); - pbTreeEditOperation.setSplitLevel(treeEditOperation.getSplitLevel()); + pbTreeEditOperation.splitLevel = treeEditOperation.getSplitLevel(); - pbTreeEditOperation.setExecutedAt( - toTimeTicket(treeEditOperation.getExecutedAt()), + pbTreeEditOperation.executedAt = toTimeTicket( + treeEditOperation.getExecutedAt(), ); - pbOperation.setTreeEdit(pbTreeEditOperation); + pbOperation.body.case = 'treeEdit'; + pbOperation.body.value = pbTreeEditOperation; } else if (operation instanceof TreeStyleOperation) { const treeStyleOperation = operation as TreeStyleOperation; - const pbTreeStyleOperation = new PbOperation.TreeStyle(); - pbTreeStyleOperation.setParentCreatedAt( - toTimeTicket(treeStyleOperation.getParentCreatedAt()), + const pbTreeStyleOperation = new PbOperation_TreeStyle(); + pbTreeStyleOperation.parentCreatedAt = toTimeTicket( + treeStyleOperation.getParentCreatedAt(), ); - pbTreeStyleOperation.setFrom(toTreePos(treeStyleOperation.getFromPos())); - pbTreeStyleOperation.setTo(toTreePos(treeStyleOperation.getToPos())); + pbTreeStyleOperation.from = toTreePos(treeStyleOperation.getFromPos()); + pbTreeStyleOperation.to = toTreePos(treeStyleOperation.getToPos()); - const attributesMap = pbTreeStyleOperation.getAttributesMap(); + const attributesMap = pbTreeStyleOperation.attributes; for (const [key, value] of treeStyleOperation.getAttributes()) { - attributesMap.set(key, value); + attributesMap[key] = value; } - pbTreeStyleOperation.setExecutedAt( - toTimeTicket(treeStyleOperation.getExecutedAt()), + pbTreeStyleOperation.executedAt = toTimeTicket( + treeStyleOperation.getExecutedAt(), ); - pbOperation.setTreeStyle(pbTreeStyleOperation); + pbOperation.body.case = 'treeStyle'; + pbOperation.body.value = pbTreeStyleOperation; } else { throw new YorkieError(Code.Unimplemented, 'unimplemented operation'); } @@ -444,14 +477,15 @@ function toOperations(operations: Array): Array { * `toChange` converts the given model to Protobuf format. */ function toChange(change: Change): PbChange { - const pbChange = new PbChange(); - pbChange.setId(toChangeID(change.getID())); - pbChange.setMessage(change.getMessage()!); + const pbChange = new PbChange({ + id: toChangeID(change.getID()!), + message: change.getMessage(), + }); if (change.hasOperations()) { - pbChange.setOperationsList(toOperations(change.getOperations())); + pbChange.operations = toOperations(change.getOperations()); } if (change.hasPresenceChange()) { - pbChange.setPresenceChange(toPresenceChange(change.getPresenceChange()!)); + pbChange.presenceChange = toPresenceChange(change.getPresenceChange()!); } return pbChange; } @@ -473,11 +507,12 @@ function toChanges(changes: Array>): Array { function toRHTNodes(rht: ElementRHT): Array { const pbRHTNodes = []; for (const rhtNode of rht) { - const pbRHTNode = new PbRHTNode(); - pbRHTNode.setKey(rhtNode.getStrKey()); - // eslint-disable-next-line - pbRHTNode.setElement(toElement(rhtNode.getValue())); - pbRHTNodes.push(pbRHTNode); + pbRHTNodes.push( + new PbRHTNode({ + key: rhtNode.getStrKey(), + element: toElement(rhtNode.getValue()), + }), + ); } return pbRHTNodes; @@ -489,10 +524,11 @@ function toRHTNodes(rht: ElementRHT): Array { function toRGANodes(rgaTreeList: RGATreeList): Array { const pbRGANodes = []; for (const rgaTreeListNode of rgaTreeList) { - const pbRGANode = new PbRGANode(); - // eslint-disable-next-line - pbRGANode.setElement(toElement(rgaTreeListNode.getValue())); - pbRGANodes.push(pbRGANode); + pbRGANodes.push( + new PbRGANode({ + element: toElement(rgaTreeListNode.getValue()), + }), + ); } return pbRGANodes; @@ -508,17 +544,17 @@ function toTextNodes( for (const textNode of rgaTreeSplit) { const pbTextNode = new PbTextNode(); - pbTextNode.setId(toTextNodeID(textNode.getID())); - pbTextNode.setValue(textNode.getValue().getContent()); - pbTextNode.setRemovedAt(toTimeTicket(textNode.getRemovedAt())); + pbTextNode.id = toTextNodeID(textNode.getID()); + pbTextNode.value = textNode.getValue().getContent(); + pbTextNode.removedAt = toTimeTicket(textNode.getRemovedAt()); - const pbNodeAttrsMap = pbTextNode.getAttributesMap(); + const pbNodeAttrsMap = pbTextNode.attributes; const attrs = textNode.getValue().getAttrs(); for (const attr of attrs) { const pbNodeAttr = new PbNodeAttr(); - pbNodeAttr.setValue(attr.getValue()); - pbNodeAttr.setUpdatedAt(toTimeTicket(attr.getUpdatedAt())); - pbNodeAttrsMap.set(attr.getKey(), pbNodeAttr); + pbNodeAttr.value = attr.getValue(); + pbNodeAttr.updatedAt = toTimeTicket(attr.getUpdatedAt()); + pbNodeAttrsMap[attr.getKey()] = pbNodeAttr; } pbTextNodes.push(pbTextNode); @@ -532,16 +568,17 @@ function toTextNodes( */ function toTreeNodesWhenEdit(nodes: Array): Array { const pbTreeNodesList: Array = []; - if (!nodes || !nodes.length) { return pbTreeNodesList; } - nodes.forEach((node) => { - const pbTreeNodes = new PbTreeNodes(); - pbTreeNodes.setContentList(toTreeNodes(node)); - pbTreeNodesList.push(pbTreeNodes); - }); + for (const node of nodes) { + pbTreeNodesList.push( + new PbTreeNodes({ + content: toTreeNodes(node), + }), + ); + } return pbTreeNodesList; } @@ -556,29 +593,29 @@ function toTreeNodes(node: CRDTTreeNode): Array { const pbTreeNodes: Array = []; traverse(node, (n, depth) => { - const pbTreeNode = new PbTreeNode(); - pbTreeNode.setId(toTreeNodeID(n.id)); - pbTreeNode.setType(n.type); + const pbTreeNode = new PbTreeNode({ + id: toTreeNodeID(n.id), + type: n.type, + removedAt: toTimeTicket(n.removedAt), + depth, + }); + if (n.isText) { - pbTreeNode.setValue(n.value); + pbTreeNode.value = n.value; } if (n.insPrevID) { - pbTreeNode.setInsPrevId(toTreeNodeID(n.insPrevID)); + pbTreeNode.insPrevId = toTreeNodeID(n.insPrevID); } if (n.insNextID) { - pbTreeNode.setInsNextId(toTreeNodeID(n.insNextID)); + pbTreeNode.insNextId = toTreeNodeID(n.insNextID); } - pbTreeNode.setRemovedAt(toTimeTicket(n.removedAt)); - pbTreeNode.setDepth(depth); - if (n.attrs) { - const pbNodeAttrsMap = pbTreeNode.getAttributesMap(); for (const attr of n.attrs) { - const pbNodeAttr = new PbNodeAttr(); - pbNodeAttr.setValue(attr.getValue()); - pbNodeAttr.setUpdatedAt(toTimeTicket(attr.getUpdatedAt())); - pbNodeAttrsMap.set(attr.getKey(), pbNodeAttr); + pbTreeNode.attributes[attr.getKey()] = new PbNodeAttr({ + value: attr.getValue(), + updatedAt: toTimeTicket(attr.getUpdatedAt()), + }); } } @@ -592,14 +629,14 @@ function toTreeNodes(node: CRDTTreeNode): Array { * `toObject` converts the given model to Protobuf format. */ function toObject(obj: CRDTObject): PbJSONElement { - const pbObject = new PbJSONElement.JSONObject(); - pbObject.setNodesList(toRHTNodes(obj.getRHT())); - pbObject.setCreatedAt(toTimeTicket(obj.getCreatedAt())); - pbObject.setMovedAt(toTimeTicket(obj.getMovedAt())); - pbObject.setRemovedAt(toTimeTicket(obj.getRemovedAt())); - const pbElement = new PbJSONElement(); - pbElement.setJsonObject(pbObject); + pbElement.body.case = 'jsonObject'; + pbElement.body.value = new PbJSONElement_JSONObject({ + nodes: toRHTNodes(obj.getRHT()), + createdAt: toTimeTicket(obj.getCreatedAt()), + movedAt: toTimeTicket(obj.getMovedAt()), + removedAt: toTimeTicket(obj.getRemovedAt()), + }); return pbElement; } @@ -607,14 +644,14 @@ function toObject(obj: CRDTObject): PbJSONElement { * `toArray` converts the given model to Protobuf format. */ function toArray(arr: CRDTArray): PbJSONElement { - const pbArray = new PbJSONElement.JSONArray(); - pbArray.setNodesList(toRGANodes(arr.getElements())); - pbArray.setCreatedAt(toTimeTicket(arr.getCreatedAt())); - pbArray.setMovedAt(toTimeTicket(arr.getMovedAt())); - pbArray.setRemovedAt(toTimeTicket(arr.getRemovedAt())); - const pbElement = new PbJSONElement(); - pbElement.setJsonArray(pbArray); + pbElement.body.case = 'jsonArray'; + pbElement.body.value = new PbJSONElement_JSONArray({ + nodes: toRGANodes(arr.getElements()), + createdAt: toTimeTicket(arr.getCreatedAt()), + movedAt: toTimeTicket(arr.getMovedAt()), + removedAt: toTimeTicket(arr.getRemovedAt()), + }); return pbElement; } @@ -622,15 +659,15 @@ function toArray(arr: CRDTArray): PbJSONElement { * `toPrimitive` converts the given model to Protobuf format. */ function toPrimitive(primitive: Primitive): PbJSONElement { - const pbPrimitive = new PbJSONElement.Primitive(); - pbPrimitive.setType(toValueType(primitive.getType())); - pbPrimitive.setValue(primitive.toBytes()); - pbPrimitive.setCreatedAt(toTimeTicket(primitive.getCreatedAt())); - pbPrimitive.setMovedAt(toTimeTicket(primitive.getMovedAt())); - pbPrimitive.setRemovedAt(toTimeTicket(primitive.getRemovedAt())); - const pbElement = new PbJSONElement(); - pbElement.setPrimitive(pbPrimitive); + pbElement.body.case = 'primitive'; + pbElement.body.value = new PbJSONElement_Primitive({ + type: toValueType(primitive.getType()), + value: primitive.toBytes(), + createdAt: toTimeTicket(primitive.getCreatedAt()), + movedAt: toTimeTicket(primitive.getMovedAt()), + removedAt: toTimeTicket(primitive.getRemovedAt()), + }); return pbElement; } @@ -638,14 +675,14 @@ function toPrimitive(primitive: Primitive): PbJSONElement { * `toText` converts the given model to Protobuf format. */ function toText(text: CRDTText>): PbJSONElement { - const pbText = new PbJSONElement.Text(); - pbText.setNodesList(toTextNodes(text.getRGATreeSplit())); - pbText.setCreatedAt(toTimeTicket(text.getCreatedAt())); - pbText.setMovedAt(toTimeTicket(text.getMovedAt())); - pbText.setRemovedAt(toTimeTicket(text.getRemovedAt())); - const pbElement = new PbJSONElement(); - pbElement.setText(pbText); + pbElement.body.case = 'text'; + pbElement.body.value = new PbJSONElement_Text({ + nodes: toTextNodes(text.getRGATreeSplit()), + createdAt: toTimeTicket(text.getCreatedAt()), + movedAt: toTimeTicket(text.getMovedAt()), + removedAt: toTimeTicket(text.getRemovedAt()), + }); return pbElement; } @@ -653,15 +690,15 @@ function toText(text: CRDTText>): PbJSONElement { * `toCounter` converts the given model to Protobuf format. */ function toCounter(counter: CRDTCounter): PbJSONElement { - const pbCounter = new PbJSONElement.Counter(); - pbCounter.setType(toCounterType(counter.getType())); - pbCounter.setValue(counter.toBytes()); - pbCounter.setCreatedAt(toTimeTicket(counter.getCreatedAt())); - pbCounter.setMovedAt(toTimeTicket(counter.getMovedAt())); - pbCounter.setRemovedAt(toTimeTicket(counter.getRemovedAt())); - const pbElement = new PbJSONElement(); - pbElement.setCounter(pbCounter); + pbElement.body.case = 'counter'; + pbElement.body.value = new PbJSONElement_Counter({ + type: toCounterType(counter.getType()), + value: counter.toBytes(), + createdAt: toTimeTicket(counter.getCreatedAt()), + movedAt: toTimeTicket(counter.getMovedAt()), + removedAt: toTimeTicket(counter.getRemovedAt()), + }); return pbElement; } @@ -669,14 +706,14 @@ function toCounter(counter: CRDTCounter): PbJSONElement { * `toTree` converts the given model to Protobuf format. */ function toTree(tree: CRDTTree): PbJSONElement { - const pbTree = new PbJSONElement.Tree(); - pbTree.setNodesList(toTreeNodes(tree.getRoot())); - pbTree.setCreatedAt(toTimeTicket(tree.getCreatedAt())); - pbTree.setMovedAt(toTimeTicket(tree.getMovedAt())); - pbTree.setRemovedAt(toTimeTicket(tree.getRemovedAt())); - const pbElement = new PbJSONElement(); - pbElement.setTree(pbTree); + pbElement.body.case = 'tree'; + pbElement.body.value = new PbJSONElement_Tree({ + nodes: toTreeNodes(tree.getRoot()), + createdAt: toTimeTicket(tree.getCreatedAt()), + movedAt: toTimeTicket(tree.getMovedAt()), + removedAt: toTimeTicket(tree.getRemovedAt()), + }); return pbElement; } @@ -686,33 +723,38 @@ function toTree(tree: CRDTTree): PbJSONElement { function toElement(element: CRDTElement): PbJSONElement { if (element instanceof CRDTObject) { return toObject(element); - } else if (element instanceof CRDTArray) { + } + if (element instanceof CRDTArray) { return toArray(element); - } else if (element instanceof Primitive) { + } + if (element instanceof Primitive) { return toPrimitive(element); - } else if (element instanceof CRDTText) { + } + if (element instanceof CRDTText) { return toText(element); - } else if (element instanceof CRDTCounter) { + } + if (element instanceof CRDTCounter) { return toCounter(element); - } else if (element instanceof CRDTTree) { + } + if (element instanceof CRDTTree) { return toTree(element); - } else { - throw new YorkieError(Code.Unimplemented, `unimplemented element`); } + + throw new YorkieError(Code.Unimplemented, `unimplemented element`); } /** * `toChangePack` converts the given model to Protobuf format. */ function toChangePack(pack: ChangePack): PbChangePack { - const pbChangePack = new PbChangePack(); - pbChangePack.setDocumentKey(pack.getDocumentKey()); - pbChangePack.setCheckpoint(toCheckpoint(pack.getCheckpoint())); - pbChangePack.setIsRemoved(pack.getIsRemoved()); - pbChangePack.setChangesList(toChanges(pack.getChanges())); - pbChangePack.setSnapshot(pack.getSnapshot()!); - pbChangePack.setMinSyncedTicket(toTimeTicket(pack.getMinSyncedTicket())); - return pbChangePack; + return new PbChangePack({ + documentKey: pack.getDocumentKey(), + checkpoint: toCheckpoint(pack.getCheckpoint()), + isRemoved: pack.getIsRemoved(), + changes: toChanges(pack.getChanges()), + snapshot: pack.getSnapshot(), + minSyncedTicket: toTimeTicket(pack.getMinSyncedTicket()), + }); } /** @@ -720,9 +762,9 @@ function toChangePack(pack: ChangePack): PbChangePack { */ function fromChangeID(pbChangeID: PbChangeID): ChangeID { return ChangeID.of( - pbChangeID.getClientSeq(), - Long.fromString(pbChangeID.getLamport(), true), - toHexString(pbChangeID.getActorId_asU8()), + pbChangeID.clientSeq, + Long.fromString(pbChangeID.lamport, true), + toHexString(pbChangeID.actorId), ); } @@ -735,9 +777,9 @@ function fromTimeTicket(pbTimeTicket?: PbTimeTicket): TimeTicket | undefined { } return TimeTicket.of( - Long.fromString(pbTimeTicket.getLamport(), true), - pbTimeTicket.getDelimiter(), - toHexString(pbTimeTicket.getActorId_asU8()), + Long.fromString(pbTimeTicket.lamport, true), + pbTimeTicket.delimiter, + toHexString(pbTimeTicket.actorId), ); } @@ -746,7 +788,7 @@ function fromTimeTicket(pbTimeTicket?: PbTimeTicket): TimeTicket | undefined { */ function fromPresence

(pbPresence: PbPresence): P { const data: Record = {}; - pbPresence.getDataMap().forEach((value: string, key: string) => { + Object.entries(pbPresence.data).forEach(([key, value]) => { data[key] = JSON.parse(value); }); @@ -759,31 +801,31 @@ function fromPresence

(pbPresence: PbPresence): P { function fromPresenceChange

( pbPresenceChange: PbPresenceChange, ): PresenceChange

{ - const type = pbPresenceChange.getType(); - - if (type === PbPresenceChange.ChangeType.CHANGE_TYPE_PUT) { - const presence = fromPresence

(pbPresenceChange.getPresence()!); + const type = pbPresenceChange.type; + if (type === PbPresenceChange_ChangeType.PUT) { + const presence = fromPresence

(pbPresenceChange.presence!); return { type: PresenceChangeType.Put, presence, }; - } else if (type === PbPresenceChange.ChangeType.CHANGE_TYPE_CLEAR) { + } + if (type === PbPresenceChange_ChangeType.CLEAR) { return { type: PresenceChangeType.Clear, }; - } else { - throw new YorkieError(Code.Unsupported, `unsupported type: ${type}`); } + + throw new YorkieError(Code.Unsupported, `unsupported type: ${type}`); } /** * `fromPresences` converts the given Protobuf format to model format. */ -function fromPresences

( - pbPresences: jspb.Map, -): Map { +function fromPresences

(pbPresences: { + [key: string]: PbPresence; +}): Map { const presences = new Map(); - pbPresences.forEach((pbPresence: PbPresence, actorID: string) => { + Object.entries(pbPresences).forEach(([actorID, pbPresence]) => { presences.set(actorID, fromPresence(pbPresence)); }); return presences; @@ -794,21 +836,21 @@ function fromPresences

( */ function fromValueType(pbValueType: PbValueType): PrimitiveType { switch (pbValueType) { - case PbValueType.VALUE_TYPE_NULL: + case PbValueType.NULL: return PrimitiveType.Null; - case PbValueType.VALUE_TYPE_BOOLEAN: + case PbValueType.BOOLEAN: return PrimitiveType.Boolean; - case PbValueType.VALUE_TYPE_INTEGER: + case PbValueType.INTEGER: return PrimitiveType.Integer; - case PbValueType.VALUE_TYPE_LONG: + case PbValueType.LONG: return PrimitiveType.Long; - case PbValueType.VALUE_TYPE_DOUBLE: + case PbValueType.DOUBLE: return PrimitiveType.Double; - case PbValueType.VALUE_TYPE_STRING: + case PbValueType.STRING: return PrimitiveType.String; - case PbValueType.VALUE_TYPE_BYTES: + case PbValueType.BYTES: return PrimitiveType.Bytes; - case PbValueType.VALUE_TYPE_DATE: + case PbValueType.DATE: return PrimitiveType.Date; } throw new YorkieError( @@ -822,9 +864,9 @@ function fromValueType(pbValueType: PbValueType): PrimitiveType { */ function fromCounterType(pbValueType: PbValueType): CounterType { switch (pbValueType) { - case PbValueType.VALUE_TYPE_INTEGER_CNT: + case PbValueType.INTEGER_CNT: return CounterType.IntegerCnt; - case PbValueType.VALUE_TYPE_LONG_CNT: + case PbValueType.LONG_CNT: return CounterType.LongCnt; } throw new YorkieError( @@ -837,52 +879,48 @@ function fromCounterType(pbValueType: PbValueType): CounterType { * `fromElementSimple` converts the given Protobuf format to model format. */ function fromElementSimple(pbElementSimple: PbJSONElementSimple): CRDTElement { - switch (pbElementSimple.getType()) { - case PbValueType.VALUE_TYPE_JSON_OBJECT: - if (!pbElementSimple.getValue()) { - return CRDTObject.create( - fromTimeTicket(pbElementSimple.getCreatedAt())!, - ); + switch (pbElementSimple.type) { + case PbValueType.JSON_OBJECT: + if (!pbElementSimple.value) { + return CRDTObject.create(fromTimeTicket(pbElementSimple.createdAt)!); } - return bytesToObject(pbElementSimple.getValue_asU8()); - case PbValueType.VALUE_TYPE_JSON_ARRAY: - if (!pbElementSimple.getValue()) { - return CRDTArray.create( - fromTimeTicket(pbElementSimple.getCreatedAt())!, - ); + return bytesToObject(pbElementSimple.value); + case PbValueType.JSON_ARRAY: + if (!pbElementSimple.value) { + return CRDTArray.create(fromTimeTicket(pbElementSimple.createdAt)!); } - return bytesToArray(pbElementSimple.getValue_asU8()); - case PbValueType.VALUE_TYPE_TEXT: + return bytesToArray(pbElementSimple.value); + case PbValueType.TEXT: return CRDTText.create( RGATreeSplit.create(), - fromTimeTicket(pbElementSimple.getCreatedAt())!, + fromTimeTicket(pbElementSimple.createdAt)!, ); - case PbValueType.VALUE_TYPE_TREE: - return bytesToTree(pbElementSimple.getValue_asU8())!; - case PbValueType.VALUE_TYPE_NULL: - case PbValueType.VALUE_TYPE_BOOLEAN: - case PbValueType.VALUE_TYPE_INTEGER: - case PbValueType.VALUE_TYPE_LONG: - case PbValueType.VALUE_TYPE_DOUBLE: - case PbValueType.VALUE_TYPE_STRING: - case PbValueType.VALUE_TYPE_BYTES: - case PbValueType.VALUE_TYPE_DATE: + case PbValueType.TREE: + return bytesToTree(pbElementSimple.value)!; + case PbValueType.NULL: + case PbValueType.BOOLEAN: + case PbValueType.INTEGER: + case PbValueType.LONG: + case PbValueType.DOUBLE: + case PbValueType.STRING: + case PbValueType.BYTES: + case PbValueType.DATE: return Primitive.of( Primitive.valueFromBytes( - fromValueType(pbElementSimple.getType()), - pbElementSimple.getValue_asU8(), + fromValueType(pbElementSimple.type), + pbElementSimple.value, ), - fromTimeTicket(pbElementSimple.getCreatedAt())!, + fromTimeTicket(pbElementSimple.createdAt)!, ); - case PbValueType.VALUE_TYPE_INTEGER_CNT: - case PbValueType.VALUE_TYPE_LONG_CNT: + case PbValueType.INTEGER_CNT: + case PbValueType.LONG_CNT: return CRDTCounter.create( - fromCounterType(pbElementSimple.getType()), + fromCounterType(pbElementSimple.type), CRDTCounter.valueFromBytes( - fromCounterType(pbElementSimple.getType()), - pbElementSimple.getValue_asU8(), + fromCounterType(pbElementSimple.type), + pbElementSimple.value, ), - fromTimeTicket(pbElementSimple.getCreatedAt())!, + fromTimeTicket(pbElementSimple.createdAt)!, ); } } @@ -893,10 +931,10 @@ function fromElementSimple(pbElementSimple: PbJSONElementSimple): CRDTElement { function fromTextNodePos(pbTextNodePos: PbTextNodePos): RGATreeSplitPos { return RGATreeSplitPos.of( RGATreeSplitNodeID.of( - fromTimeTicket(pbTextNodePos.getCreatedAt())!, - pbTextNodePos.getOffset(), + fromTimeTicket(pbTextNodePos.createdAt)!, + pbTextNodePos.offset, ), - pbTextNodePos.getRelativeOffset(), + pbTextNodePos.relativeOffset, ); } @@ -905,8 +943,8 @@ function fromTextNodePos(pbTextNodePos: PbTextNodePos): RGATreeSplitPos { */ function fromTextNodeID(pbTextNodeID: PbTextNodeID): RGATreeSplitNodeID { return RGATreeSplitNodeID.of( - fromTimeTicket(pbTextNodeID.getCreatedAt())!, - pbTextNodeID.getOffset(), + fromTimeTicket(pbTextNodeID.createdAt)!, + pbTextNodeID.offset, ); } @@ -914,20 +952,16 @@ function fromTextNodeID(pbTextNodeID: PbTextNodeID): RGATreeSplitNodeID { * `fromTextNode` converts the given Protobuf format to model format. */ function fromTextNode(pbTextNode: PbTextNode): RGATreeSplitNode { - const textValue = CRDTTextValue.create(pbTextNode.getValue()); - pbTextNode.getAttributesMap().forEach((value, key) => { - textValue.setAttr( - key, - value.getValue(), - fromTimeTicket(value.getUpdatedAt())!, - ); + const textValue = CRDTTextValue.create(pbTextNode.value); + Object.entries(pbTextNode.attributes).forEach(([key, value]) => { + textValue.setAttr(key, value.value, fromTimeTicket(value.updatedAt)!); }); const textNode = RGATreeSplitNode.create( - fromTextNodeID(pbTextNode.getId()!), + fromTextNodeID(pbTextNode.id!), textValue, ); - textNode.remove(fromTimeTicket(pbTextNode.getRemovedAt())); + textNode.remove(fromTimeTicket(pbTextNode.removedAt)); return textNode; } @@ -936,8 +970,8 @@ function fromTextNode(pbTextNode: PbTextNode): RGATreeSplitNode { */ function fromTreePos(pbTreePos: PbTreePos): CRDTTreePos { return CRDTTreePos.of( - fromTreeNodeID(pbTreePos.getParentId()!), - fromTreeNodeID(pbTreePos.getLeftSiblingId()!), + fromTreeNodeID(pbTreePos.parentId!), + fromTreeNodeID(pbTreePos.leftSiblingId!), ); } @@ -946,8 +980,8 @@ function fromTreePos(pbTreePos: PbTreePos): CRDTTreePos { */ function fromTreeNodeID(pbTreeNodeID: PbTreeNodeID): CRDTTreeNodeID { return CRDTTreeNodeID.of( - fromTimeTicket(pbTreeNodeID.getCreatedAt())!, - pbTreeNodeID.getOffset(), + fromTimeTicket(pbTreeNodeID.createdAt)!, + pbTreeNodeID.offset, ); } @@ -963,7 +997,7 @@ function fromTreeNodesWhenEdit( const treeNodes: Array = []; pbTreeNodes.forEach((node) => { - const treeNode = fromTreeNodes(node.getContentList()); + const treeNode = fromTreeNodes(node.content); treeNodes.push(treeNode!); }); @@ -989,7 +1023,7 @@ function fromTreeNodes( for (let i = nodes.length - 2; i >= 0; i--) { let parent: CRDTTreeNode; for (let j = i + 1; j < nodes.length; j++) { - if (pbTreeNodes[i].getDepth() - 1 === pbTreeNodes[j].getDepth()) { + if (pbTreeNodes[i].depth - 1 === pbTreeNodes[j].depth) { parent = nodes[j]; break; } @@ -1006,27 +1040,27 @@ function fromTreeNodes( * `fromTreeNode` converts the given Protobuf format to model format. */ function fromTreeNode(pbTreeNode: PbTreeNode): CRDTTreeNode { - const id = fromTreeNodeID(pbTreeNode.getId()!); - const node = CRDTTreeNode.create(id, pbTreeNode.getType()); + const id = fromTreeNodeID(pbTreeNode.id!); + const node = CRDTTreeNode.create(id, pbTreeNode.type); if (node.isText) { - node.value = pbTreeNode.getValue(); + node.value = pbTreeNode.value; } else { const attrs = RHT.create(); - pbTreeNode.getAttributesMap().forEach((value, key) => { - attrs.set(key, value.getValue(), fromTimeTicket(value.getUpdatedAt())!); + Object.entries(pbTreeNode.attributes).forEach(([key, value]) => { + attrs.set(key, value.value, fromTimeTicket(value.updatedAt)!); }); node.attrs = attrs; } - if (pbTreeNode.hasInsPrevId()) { - node.insPrevID = fromTreeNodeID(pbTreeNode.getInsPrevId()!); + if (pbTreeNode.insPrevId) { + node.insPrevID = fromTreeNodeID(pbTreeNode.insPrevId!); } - if (pbTreeNode.hasInsNextId()) { - node.insNextID = fromTreeNodeID(pbTreeNode.getInsNextId()!); + if (pbTreeNode.insPrevId) { + node.insNextID = fromTreeNodeID(pbTreeNode.insNextId!); } - node.removedAt = fromTimeTicket(pbTreeNode.getRemovedAt()); + node.removedAt = fromTimeTicket(pbTreeNode.removedAt); return node; } @@ -1039,112 +1073,120 @@ function fromOperations(pbOperations: Array): Array { for (const pbOperation of pbOperations) { let operation: Operation; - if (pbOperation.hasSet()) { - const pbSetOperation = pbOperation.getSet(); + if (pbOperation.body.case === 'set') { + const pbSetOperation = pbOperation.body.value; operation = SetOperation.create( - pbSetOperation!.getKey(), - fromElementSimple(pbSetOperation!.getValue()!), - fromTimeTicket(pbSetOperation!.getParentCreatedAt())!, - fromTimeTicket(pbSetOperation!.getExecutedAt())!, + pbSetOperation!.key, + fromElementSimple(pbSetOperation!.value!), + fromTimeTicket(pbSetOperation!.parentCreatedAt)!, + fromTimeTicket(pbSetOperation!.executedAt)!, ); - } else if (pbOperation.hasAdd()) { - const pbAddOperation = pbOperation.getAdd(); + } else if (pbOperation.body.case === 'add') { + const pbAddOperation = pbOperation.body.value; operation = AddOperation.create( - fromTimeTicket(pbAddOperation!.getParentCreatedAt())!, - fromTimeTicket(pbAddOperation!.getPrevCreatedAt())!, - fromElementSimple(pbAddOperation!.getValue()!), - fromTimeTicket(pbAddOperation!.getExecutedAt())!, + fromTimeTicket(pbAddOperation!.parentCreatedAt)!, + fromTimeTicket(pbAddOperation!.prevCreatedAt)!, + fromElementSimple(pbAddOperation!.value!), + fromTimeTicket(pbAddOperation!.executedAt)!, ); - } else if (pbOperation.hasMove()) { - const pbMoveOperation = pbOperation.getMove(); + } else if (pbOperation.body.case === 'move') { + const pbMoveOperation = pbOperation.body.value; operation = MoveOperation.create( - fromTimeTicket(pbMoveOperation!.getParentCreatedAt())!, - fromTimeTicket(pbMoveOperation!.getPrevCreatedAt())!, - fromTimeTicket(pbMoveOperation!.getCreatedAt())!, - fromTimeTicket(pbMoveOperation!.getExecutedAt())!, + fromTimeTicket(pbMoveOperation!.parentCreatedAt)!, + fromTimeTicket(pbMoveOperation!.prevCreatedAt)!, + fromTimeTicket(pbMoveOperation!.createdAt)!, + fromTimeTicket(pbMoveOperation!.executedAt)!, ); - } else if (pbOperation.hasRemove()) { - const pbRemoveOperation = pbOperation.getRemove(); + } else if (pbOperation.body.case === 'remove') { + const pbRemoveOperation = pbOperation.body.value; operation = RemoveOperation.create( - fromTimeTicket(pbRemoveOperation!.getParentCreatedAt())!, - fromTimeTicket(pbRemoveOperation!.getCreatedAt())!, - fromTimeTicket(pbRemoveOperation!.getExecutedAt())!, + fromTimeTicket(pbRemoveOperation!.parentCreatedAt)!, + fromTimeTicket(pbRemoveOperation!.createdAt)!, + fromTimeTicket(pbRemoveOperation!.executedAt)!, ); - } else if (pbOperation.hasEdit()) { - const pbEditOperation = pbOperation.getEdit(); + } else if (pbOperation.body.case === 'edit') { + const pbEditOperation = pbOperation.body.value; const createdAtMapByActor = new Map(); - pbEditOperation!.getCreatedAtMapByActorMap().forEach((value, key) => { - createdAtMapByActor.set(key, fromTimeTicket(value)); - }); + Object.entries(pbEditOperation!.createdAtMapByActor).forEach( + ([key, value]) => { + createdAtMapByActor.set(key, fromTimeTicket(value)); + }, + ); const attributes = new Map(); - pbEditOperation!.getAttributesMap().forEach((value, key) => { + Object.entries(pbEditOperation!.attributes).forEach(([key, value]) => { attributes.set(key, value); }); operation = EditOperation.create( - fromTimeTicket(pbEditOperation!.getParentCreatedAt())!, - fromTextNodePos(pbEditOperation!.getFrom()!), - fromTextNodePos(pbEditOperation!.getTo()!), + fromTimeTicket(pbEditOperation!.parentCreatedAt)!, + fromTextNodePos(pbEditOperation!.from!), + fromTextNodePos(pbEditOperation!.to!), createdAtMapByActor, - pbEditOperation!.getContent(), + pbEditOperation!.content, attributes, - fromTimeTicket(pbEditOperation!.getExecutedAt())!, + fromTimeTicket(pbEditOperation!.executedAt)!, ); - } else if (pbOperation.hasStyle()) { - const pbStyleOperation = pbOperation.getStyle(); + } else if (pbOperation.body.case === 'style') { + const pbStyleOperation = pbOperation.body.value; const createdAtMapByActor = new Map(); - pbStyleOperation!.getCreatedAtMapByActorMap().forEach((value, key) => { - createdAtMapByActor.set(key, fromTimeTicket(value)); - }); + Object.entries(pbStyleOperation!.createdAtMapByActor).forEach( + ([key, value]) => { + createdAtMapByActor.set(key, fromTimeTicket(value)); + }, + ); const attributes = new Map(); - pbStyleOperation!.getAttributesMap().forEach((value, key) => { + Object.entries(pbStyleOperation!.attributes).forEach(([key, value]) => { attributes.set(key, value); }); operation = StyleOperation.create( - fromTimeTicket(pbStyleOperation!.getParentCreatedAt())!, - fromTextNodePos(pbStyleOperation!.getFrom()!), - fromTextNodePos(pbStyleOperation!.getTo()!), + fromTimeTicket(pbStyleOperation!.parentCreatedAt)!, + fromTextNodePos(pbStyleOperation!.from!), + fromTextNodePos(pbStyleOperation!.to!), createdAtMapByActor, attributes, - fromTimeTicket(pbStyleOperation!.getExecutedAt())!, + fromTimeTicket(pbStyleOperation!.executedAt)!, ); - } else if (pbOperation.hasSelect()) { + } else if (pbOperation.body.case === 'select') { // TODO(hackerwins): Select is deprecated. continue; - } else if (pbOperation.hasIncrease()) { - const pbIncreaseOperation = pbOperation.getIncrease(); + } else if (pbOperation.body.case === 'increase') { + const pbIncreaseOperation = pbOperation.body.value; operation = IncreaseOperation.create( - fromTimeTicket(pbIncreaseOperation!.getParentCreatedAt())!, - fromElementSimple(pbIncreaseOperation!.getValue()!), - fromTimeTicket(pbIncreaseOperation!.getExecutedAt())!, + fromTimeTicket(pbIncreaseOperation!.parentCreatedAt)!, + fromElementSimple(pbIncreaseOperation!.value!), + fromTimeTicket(pbIncreaseOperation!.executedAt)!, ); - } else if (pbOperation.hasTreeEdit()) { - const pbTreeEditOperation = pbOperation.getTreeEdit(); + } else if (pbOperation.body.case === 'treeEdit') { + const pbTreeEditOperation = pbOperation.body.value; const createdAtMapByActor = new Map(); - pbTreeEditOperation!.getCreatedAtMapByActorMap().forEach((value, key) => { - createdAtMapByActor.set(key, fromTimeTicket(value)); - }); + Object.entries(pbTreeEditOperation!.createdAtMapByActor).forEach( + ([key, value]) => { + createdAtMapByActor.set(key, fromTimeTicket(value)); + }, + ); operation = TreeEditOperation.create( - fromTimeTicket(pbTreeEditOperation!.getParentCreatedAt())!, - fromTreePos(pbTreeEditOperation!.getFrom()!), - fromTreePos(pbTreeEditOperation!.getTo()!), - fromTreeNodesWhenEdit(pbTreeEditOperation!.getContentsList()), - pbTreeEditOperation!.getSplitLevel(), + fromTimeTicket(pbTreeEditOperation!.parentCreatedAt)!, + fromTreePos(pbTreeEditOperation!.from!), + fromTreePos(pbTreeEditOperation!.to!), + fromTreeNodesWhenEdit(pbTreeEditOperation!.contents), + pbTreeEditOperation!.splitLevel, createdAtMapByActor, - fromTimeTicket(pbTreeEditOperation!.getExecutedAt())!, + fromTimeTicket(pbTreeEditOperation!.executedAt)!, ); - } else if (pbOperation.hasTreeStyle()) { - const pbTreeStyleOperation = pbOperation.getTreeStyle(); + } else if (pbOperation.body.case === 'treeStyle') { + const pbTreeStyleOperation = pbOperation.body.value; const attributes = new Map(); - pbTreeStyleOperation!.getAttributesMap().forEach((value, key) => { - attributes.set(key, value); - }); + Object.entries(pbTreeStyleOperation!.attributes).forEach( + ([key, value]) => { + attributes.set(key, value); + }, + ); operation = TreeStyleOperation.create( - fromTimeTicket(pbTreeStyleOperation!.getParentCreatedAt())!, - fromTreePos(pbTreeStyleOperation!.getFrom()!), - fromTreePos(pbTreeStyleOperation!.getTo()!), + fromTimeTicket(pbTreeStyleOperation!.parentCreatedAt)!, + fromTreePos(pbTreeStyleOperation!.from!), + fromTreePos(pbTreeStyleOperation!.to!), attributes, - fromTimeTicket(pbTreeStyleOperation!.getExecutedAt())!, + fromTimeTicket(pbTreeStyleOperation!.executedAt)!, ); } else { throw new YorkieError(Code.Unimplemented, `unimplemented operation`); @@ -1167,12 +1209,12 @@ function fromChanges

( for (const pbChange of pbChanges) { changes.push( Change.create({ - id: fromChangeID(pbChange.getId()!), - operations: fromOperations(pbChange.getOperationsList()), - presenceChange: pbChange.hasPresenceChange() - ? fromPresenceChange(pbChange.getPresenceChange()!) + id: fromChangeID(pbChange.id!), + operations: fromOperations(pbChange.operations), + presenceChange: pbChange.presenceChange + ? fromPresenceChange(pbChange.presenceChange!) : undefined, - message: pbChange.getMessage(), + message: pbChange.message, }), ); } @@ -1185,8 +1227,8 @@ function fromChanges

( */ function fromCheckpoint(pbCheckpoint: PbCheckpoint): Checkpoint { return Checkpoint.of( - Long.fromString(pbCheckpoint.getServerSeq(), true), - pbCheckpoint.getClientSeq(), + Long.fromString(pbCheckpoint.serverSeq, true), + pbCheckpoint.clientSeq, ); } @@ -1197,63 +1239,60 @@ function fromChangePack

( pbPack: PbChangePack, ): ChangePack

{ return ChangePack.create

( - pbPack.getDocumentKey()!, - fromCheckpoint(pbPack.getCheckpoint()!), - pbPack.getIsRemoved(), - fromChanges(pbPack.getChangesList()), - pbPack.getSnapshot_asU8(), - fromTimeTicket(pbPack.getMinSyncedTicket()), + pbPack.documentKey!, + fromCheckpoint(pbPack.checkpoint!), + pbPack.isRemoved, + fromChanges(pbPack.changes), + pbPack.snapshot, + fromTimeTicket(pbPack.minSyncedTicket), ); } /** * `fromObject` converts the given Protobuf format to model format. */ -function fromObject(pbObject: PbJSONElement.JSONObject): CRDTObject { +function fromObject(pbObject: PbJSONElement_JSONObject): CRDTObject { const rht = new ElementRHT(); - for (const pbRHTNode of pbObject.getNodesList()) { - const value = fromElement(pbRHTNode.getElement()!); - rht.set(pbRHTNode.getKey(), value, value.getPositionedAt()); + for (const pbRHTNode of pbObject.nodes) { + const value = fromElement(pbRHTNode.element!); + rht.set(pbRHTNode.key, value, value.getPositionedAt()); } - const obj = new CRDTObject(fromTimeTicket(pbObject.getCreatedAt())!, rht); - obj.setMovedAt(fromTimeTicket(pbObject.getMovedAt())); - obj.setRemovedAt(fromTimeTicket(pbObject.getRemovedAt())); + const obj = new CRDTObject(fromTimeTicket(pbObject.createdAt)!, rht); + obj.setMovedAt(fromTimeTicket(pbObject.movedAt)); + obj.setRemovedAt(fromTimeTicket(pbObject.removedAt)); return obj; } /** * `fromArray` converts the given Protobuf format to model format. */ -function fromArray(pbArray: PbJSONElement.JSONArray): CRDTArray { +function fromArray(pbArray: PbJSONElement_JSONArray): CRDTArray { const rgaTreeList = new RGATreeList(); - for (const pbRGANode of pbArray.getNodesList()) { + for (const pbRGANode of pbArray.nodes) { // eslint-disable-next-line - rgaTreeList.insert(fromElement(pbRGANode.getElement()!)); + rgaTreeList.insert(fromElement(pbRGANode.element!)); } - const arr = new CRDTArray( - fromTimeTicket(pbArray.getCreatedAt())!, - rgaTreeList, - ); - arr.setMovedAt(fromTimeTicket(pbArray.getMovedAt())); - arr.setRemovedAt(fromTimeTicket(pbArray.getRemovedAt())); + const arr = new CRDTArray(fromTimeTicket(pbArray.createdAt)!, rgaTreeList); + arr.setMovedAt(fromTimeTicket(pbArray.movedAt)); + arr.setRemovedAt(fromTimeTicket(pbArray.removedAt)); return arr; } /** * `fromPrimitive` converts the given Protobuf format to model format. */ -function fromPrimitive(pbPrimitive: PbJSONElement.Primitive): Primitive { +function fromPrimitive(pbPrimitive: PbJSONElement_Primitive): Primitive { const primitive = Primitive.of( Primitive.valueFromBytes( - fromValueType(pbPrimitive.getType()), - pbPrimitive.getValue_asU8(), + fromValueType(pbPrimitive.type), + pbPrimitive.value, ), - fromTimeTicket(pbPrimitive.getCreatedAt())!, + fromTimeTicket(pbPrimitive.createdAt)!, ); - primitive.setMovedAt(fromTimeTicket(pbPrimitive.getMovedAt())); - primitive.setRemovedAt(fromTimeTicket(pbPrimitive.getRemovedAt())); + primitive.setMovedAt(fromTimeTicket(pbPrimitive.movedAt)); + primitive.setRemovedAt(fromTimeTicket(pbPrimitive.removedAt)); return primitive; } @@ -1261,70 +1300,67 @@ function fromPrimitive(pbPrimitive: PbJSONElement.Primitive): Primitive { * `fromText` converts the given Protobuf format to model format. */ function fromText( - pbText: PbJSONElement.Text, + pbText: PbJSONElement_Text, ): CRDTText { const rgaTreeSplit = new RGATreeSplit(); let prev = rgaTreeSplit.getHead(); - for (const pbNode of pbText.getNodesList()) { + for (const pbNode of pbText.nodes) { const current = rgaTreeSplit.insertAfter(prev, fromTextNode(pbNode)); - if (pbNode.hasInsPrevId()) { + if (pbNode.insPrevId) { current.setInsPrev( - rgaTreeSplit.findNode(fromTextNodeID(pbNode.getInsPrevId()!)), + rgaTreeSplit.findNode(fromTextNodeID(pbNode.insPrevId!)), ); } prev = current; } - const text = new CRDTText( - rgaTreeSplit, - fromTimeTicket(pbText.getCreatedAt())!, - ); - text.setMovedAt(fromTimeTicket(pbText.getMovedAt())); - text.setRemovedAt(fromTimeTicket(pbText.getRemovedAt())); + const text = new CRDTText(rgaTreeSplit, fromTimeTicket(pbText.createdAt)!); + text.setMovedAt(fromTimeTicket(pbText.movedAt)); + text.setRemovedAt(fromTimeTicket(pbText.removedAt)); return text; } /** * `fromCounter` converts the given Protobuf format to model format. */ -function fromCounter(pbCounter: PbJSONElement.Counter): CRDTCounter { +function fromCounter(pbCounter: PbJSONElement_Counter): CRDTCounter { const counter = CRDTCounter.create( - fromCounterType(pbCounter.getType()), + fromCounterType(pbCounter.type), CRDTCounter.valueFromBytes( - fromCounterType(pbCounter.getType()), - pbCounter.getValue_asU8(), + fromCounterType(pbCounter.type), + pbCounter.value, ), - fromTimeTicket(pbCounter.getCreatedAt())!, + fromTimeTicket(pbCounter.createdAt)!, ); - counter.setMovedAt(fromTimeTicket(pbCounter.getMovedAt())); - counter.setRemovedAt(fromTimeTicket(pbCounter.getRemovedAt())); + counter.setMovedAt(fromTimeTicket(pbCounter.movedAt)); + counter.setRemovedAt(fromTimeTicket(pbCounter.removedAt)); return counter; } /** * `fromTree` converts the given Protobuf format to model format. */ -function fromTree(pbTree: PbJSONElement.Tree): CRDTTree { - const root = fromTreeNodes(pbTree.getNodesList()); - return CRDTTree.create(root!, fromTimeTicket(pbTree.getCreatedAt())!); +function fromTree(pbTree: PbJSONElement_Tree): CRDTTree { + const root = fromTreeNodes(pbTree.nodes); + return CRDTTree.create(root!, fromTimeTicket(pbTree.createdAt)!); } /** * `fromElement` converts the given Protobuf format to model format. */ function fromElement(pbElement: PbJSONElement): CRDTElement { - if (pbElement.hasJsonObject()) { - return fromObject(pbElement.getJsonObject()!); - } else if (pbElement.hasJsonArray()) { - return fromArray(pbElement.getJsonArray()!); - } else if (pbElement.hasPrimitive()) { - return fromPrimitive(pbElement.getPrimitive()!); - } else if (pbElement.hasText()) { - return fromText(pbElement.getText()!); - } else if (pbElement.hasCounter()) { - return fromCounter(pbElement.getCounter()!); - } else if (pbElement.hasTree()) { - return fromTree(pbElement.getTree()!); + if (pbElement.body.case === 'jsonObject') { + return fromObject(pbElement.body.value!); + } else if (pbElement.body.case === 'jsonArray') { + return fromArray(pbElement.body.value!); + } else if (pbElement.body.case === 'primitive') { + return fromPrimitive(pbElement.body.value!); + } else if (pbElement.body.case === 'text') { + return fromText(pbElement.body.value!); + } else if (pbElement.body.case === 'counter') { + return fromCounter(pbElement.body.value!); + } else if (pbElement.body.case === 'tree') { + return fromTree(pbElement.body.value!); } else { throw new YorkieError(Code.Unimplemented, `unimplemented element`); } @@ -1346,10 +1382,10 @@ function bytesToSnapshot

( }; } - const snapshot = PbSnapshot.deserializeBinary(bytes); + const snapshot = PbSnapshot.fromBinary(bytes); return { - root: fromElement(snapshot.getRoot()!) as CRDTObject, - presences: fromPresences

(snapshot.getPresencesMap()), + root: fromElement(snapshot.root!) as CRDTObject, + presences: fromPresences

(snapshot.presences), }; } @@ -1361,15 +1397,15 @@ function bytesToObject(bytes?: Uint8Array): CRDTObject { throw new Error('bytes is empty'); } - const pbElement = PbJSONElement.deserializeBinary(bytes); - return fromObject(pbElement.getJsonObject()!); + const pbElement = PbJSONElement.fromBinary(bytes); + return fromObject(pbElement.body.value! as PbJSONElement_JSONObject); } /** * `objectToBytes` converts the given JSONObject to byte array. */ function objectToBytes(obj: CRDTObject): Uint8Array { - return toElement(obj).serializeBinary(); + return toElement(obj).toBinary(); } /** @@ -1380,15 +1416,15 @@ function bytesToArray(bytes?: Uint8Array): CRDTArray { throw new Error('bytes is empty'); } - const pbElement = PbJSONElement.deserializeBinary(bytes); - return fromArray(pbElement.getJsonArray()!); + const pbElement = PbJSONElement.fromBinary(bytes); + return fromArray(pbElement.body.value! as PbJSONElement_JSONArray); } /** * `arrayToBytes` converts the given CRDTArray to bytes. */ function arrayToBytes(array: CRDTArray): Uint8Array { - return toArray(array).serializeBinary(); + return toArray(array).toBinary(); } /** @@ -1399,15 +1435,15 @@ function bytesToTree(bytes?: Uint8Array): CRDTTree { throw new Error('bytes is empty'); } - const pbElement = PbJSONElement.deserializeBinary(bytes); - return fromTree(pbElement.getTree()!); + const pbElement = PbJSONElement.fromBinary(bytes); + return fromTree(pbElement.body.value! as PbJSONElement_Tree); } /** * `treeToBytes` converts the given tree to bytes. */ function treeToBytes(tree: CRDTTree): Uint8Array { - return toTree(tree).serializeBinary(); + return toTree(tree).toBinary(); } /** diff --git a/src/api/yorkie/v1/resources.proto b/src/api/yorkie/v1/resources.proto index ad27ca5c8..b98bd59bc 100644 --- a/src/api/yorkie/v1/resources.proto +++ b/src/api/yorkie/v1/resources.proto @@ -20,7 +20,7 @@ package yorkie.v1; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; -option go_package = ".;v1"; +option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; option java_multiple_files = true; option java_package = "dev.yorkie.api.v1"; diff --git a/src/api/yorkie/v1/resources_pb.d.ts b/src/api/yorkie/v1/resources_pb.d.ts index c5f96d0fd..6daefb702 100644 --- a/src/api/yorkie/v1/resources_pb.d.ts +++ b/src/api/yorkie/v1/resources_pb.d.ts @@ -1,1644 +1,1897 @@ -import * as jspb from 'google-protobuf' +// +// 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.6.0 with parameter "target=js+dts,js_import_style=legacy_commonjs" +// @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, +} -import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb'; -import * as google_protobuf_wrappers_pb from 'google-protobuf/google/protobuf/wrappers_pb'; +/** + * @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; -export class Snapshot extends jspb.Message { - getRoot(): JSONElement | undefined; - setRoot(value?: JSONElement): Snapshot; - hasRoot(): boolean; - clearRoot(): Snapshot; + /** + * @generated from field: map presences = 2; + */ + presences: { [key: string]: Presence }; - getPresencesMap(): jspb.Map; - clearPresencesMap(): Snapshot; + constructor(data?: PartialMessage); - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Snapshot.AsObject; - static toObject(includeInstance: boolean, msg: Snapshot): Snapshot.AsObject; - static serializeBinaryToWriter(message: Snapshot, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Snapshot; - static deserializeBinaryFromReader(message: Snapshot, reader: jspb.BinaryReader): Snapshot; -} + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Snapshot"; + static readonly fields: FieldList; -export namespace Snapshot { - export type AsObject = { - root?: JSONElement.AsObject, - presencesMap: Array<[string, Presence.AsObject]>, - } -} + static fromBinary(bytes: Uint8Array, options?: Partial): Snapshot; -export class ChangePack extends jspb.Message { - getDocumentKey(): string; - setDocumentKey(value: string): ChangePack; - - getCheckpoint(): Checkpoint | undefined; - setCheckpoint(value?: Checkpoint): ChangePack; - hasCheckpoint(): boolean; - clearCheckpoint(): ChangePack; - - getSnapshot(): Uint8Array | string; - getSnapshot_asU8(): Uint8Array; - getSnapshot_asB64(): string; - setSnapshot(value: Uint8Array | string): ChangePack; - - getChangesList(): Array; - setChangesList(value: Array): ChangePack; - clearChangesList(): ChangePack; - addChanges(value?: Change, index?: number): Change; - - getMinSyncedTicket(): TimeTicket | undefined; - setMinSyncedTicket(value?: TimeTicket): ChangePack; - hasMinSyncedTicket(): boolean; - clearMinSyncedTicket(): ChangePack; - - getIsRemoved(): boolean; - setIsRemoved(value: boolean): ChangePack; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ChangePack.AsObject; - static toObject(includeInstance: boolean, msg: ChangePack): ChangePack.AsObject; - static serializeBinaryToWriter(message: ChangePack, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ChangePack; - static deserializeBinaryFromReader(message: ChangePack, reader: jspb.BinaryReader): ChangePack; -} + static fromJson(jsonValue: JsonValue, options?: Partial): Snapshot; -export namespace ChangePack { - export type AsObject = { - documentKey: string, - checkpoint?: Checkpoint.AsObject, - snapshot: Uint8Array | string, - changesList: Array, - minSyncedTicket?: TimeTicket.AsObject, - isRemoved: boolean, - } -} + static fromJsonString(jsonString: string, options?: Partial): Snapshot; -export class Change extends jspb.Message { - getId(): ChangeID | undefined; - setId(value?: ChangeID): Change; - hasId(): boolean; - clearId(): Change; - - getMessage(): string; - setMessage(value: string): Change; - - getOperationsList(): Array; - setOperationsList(value: Array): Change; - clearOperationsList(): Change; - addOperations(value?: Operation, index?: number): Operation; - - getPresenceChange(): PresenceChange | undefined; - setPresenceChange(value?: PresenceChange): Change; - hasPresenceChange(): boolean; - clearPresenceChange(): Change; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Change.AsObject; - static toObject(includeInstance: boolean, msg: Change): Change.AsObject; - static serializeBinaryToWriter(message: Change, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Change; - static deserializeBinaryFromReader(message: Change, reader: jspb.BinaryReader): Change; + static equals(a: Snapshot | PlainMessage | undefined, b: Snapshot | PlainMessage | undefined): boolean; } -export namespace Change { - export type AsObject = { - id?: ChangeID.AsObject, - message: string, - operationsList: Array, - presenceChange?: PresenceChange.AsObject, - } -} +/** + * 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; -export class ChangeID extends jspb.Message { - getClientSeq(): number; - setClientSeq(value: number): ChangeID; + /** + * @generated from field: yorkie.v1.Checkpoint checkpoint = 2; + */ + checkpoint?: Checkpoint; - getServerSeq(): string; - setServerSeq(value: string): ChangeID; + /** + * @generated from field: bytes snapshot = 3; + */ + snapshot: Uint8Array; - getLamport(): string; - setLamport(value: string): ChangeID; + /** + * @generated from field: repeated yorkie.v1.Change changes = 4; + */ + changes: Change[]; - getActorId(): Uint8Array | string; - getActorId_asU8(): Uint8Array; - getActorId_asB64(): string; - setActorId(value: Uint8Array | string): ChangeID; + /** + * @generated from field: yorkie.v1.TimeTicket min_synced_ticket = 5; + */ + minSyncedTicket?: TimeTicket; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ChangeID.AsObject; - static toObject(includeInstance: boolean, msg: ChangeID): ChangeID.AsObject; - static serializeBinaryToWriter(message: ChangeID, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ChangeID; - static deserializeBinaryFromReader(message: ChangeID, reader: jspb.BinaryReader): ChangeID; -} + /** + * @generated from field: bool is_removed = 6; + */ + isRemoved: boolean; -export namespace ChangeID { - export type AsObject = { - clientSeq: number, - serverSeq: string, - lamport: string, - actorId: Uint8Array | string, - } -} + constructor(data?: PartialMessage); -export class Operation extends jspb.Message { - getSet(): Operation.Set | undefined; - setSet(value?: Operation.Set): Operation; - hasSet(): boolean; - clearSet(): Operation; - - getAdd(): Operation.Add | undefined; - setAdd(value?: Operation.Add): Operation; - hasAdd(): boolean; - clearAdd(): Operation; - - getMove(): Operation.Move | undefined; - setMove(value?: Operation.Move): Operation; - hasMove(): boolean; - clearMove(): Operation; - - getRemove(): Operation.Remove | undefined; - setRemove(value?: Operation.Remove): Operation; - hasRemove(): boolean; - clearRemove(): Operation; - - getEdit(): Operation.Edit | undefined; - setEdit(value?: Operation.Edit): Operation; - hasEdit(): boolean; - clearEdit(): Operation; - - getSelect(): Operation.Select | undefined; - setSelect(value?: Operation.Select): Operation; - hasSelect(): boolean; - clearSelect(): Operation; - - getStyle(): Operation.Style | undefined; - setStyle(value?: Operation.Style): Operation; - hasStyle(): boolean; - clearStyle(): Operation; - - getIncrease(): Operation.Increase | undefined; - setIncrease(value?: Operation.Increase): Operation; - hasIncrease(): boolean; - clearIncrease(): Operation; - - getTreeEdit(): Operation.TreeEdit | undefined; - setTreeEdit(value?: Operation.TreeEdit): Operation; - hasTreeEdit(): boolean; - clearTreeEdit(): Operation; - - getTreeStyle(): Operation.TreeStyle | undefined; - setTreeStyle(value?: Operation.TreeStyle): Operation; - hasTreeStyle(): boolean; - clearTreeStyle(): Operation; - - getBodyCase(): Operation.BodyCase; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Operation.AsObject; - static toObject(includeInstance: boolean, msg: Operation): Operation.AsObject; - static serializeBinaryToWriter(message: Operation, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Operation; - static deserializeBinaryFromReader(message: Operation, reader: jspb.BinaryReader): Operation; -} + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ChangePack"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ChangePack; -export namespace Operation { - export type AsObject = { - set?: Operation.Set.AsObject, - add?: Operation.Add.AsObject, - move?: Operation.Move.AsObject, - remove?: Operation.Remove.AsObject, - edit?: Operation.Edit.AsObject, - select?: Operation.Select.AsObject, - style?: Operation.Style.AsObject, - increase?: Operation.Increase.AsObject, - treeEdit?: Operation.TreeEdit.AsObject, - treeStyle?: Operation.TreeStyle.AsObject, - } - - export class Set extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): Set; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): Set; - - getKey(): string; - setKey(value: string): Set; - - getValue(): JSONElementSimple | undefined; - setValue(value?: JSONElementSimple): Set; - hasValue(): boolean; - clearValue(): Set; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): Set; - hasExecutedAt(): boolean; - clearExecutedAt(): Set; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Set.AsObject; - static toObject(includeInstance: boolean, msg: Set): Set.AsObject; - static serializeBinaryToWriter(message: Set, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Set; - static deserializeBinaryFromReader(message: Set, reader: jspb.BinaryReader): Set; - } - - export namespace Set { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - key: string, - value?: JSONElementSimple.AsObject, - executedAt?: TimeTicket.AsObject, - } - } - - - export class Add extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): Add; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): Add; - - getPrevCreatedAt(): TimeTicket | undefined; - setPrevCreatedAt(value?: TimeTicket): Add; - hasPrevCreatedAt(): boolean; - clearPrevCreatedAt(): Add; - - getValue(): JSONElementSimple | undefined; - setValue(value?: JSONElementSimple): Add; - hasValue(): boolean; - clearValue(): Add; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): Add; - hasExecutedAt(): boolean; - clearExecutedAt(): Add; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Add.AsObject; - static toObject(includeInstance: boolean, msg: Add): Add.AsObject; - static serializeBinaryToWriter(message: Add, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Add; - static deserializeBinaryFromReader(message: Add, reader: jspb.BinaryReader): Add; - } - - export namespace Add { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - prevCreatedAt?: TimeTicket.AsObject, - value?: JSONElementSimple.AsObject, - executedAt?: TimeTicket.AsObject, - } - } - - - export class Move extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): Move; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): Move; - - getPrevCreatedAt(): TimeTicket | undefined; - setPrevCreatedAt(value?: TimeTicket): Move; - hasPrevCreatedAt(): boolean; - clearPrevCreatedAt(): Move; - - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): Move; - hasCreatedAt(): boolean; - clearCreatedAt(): Move; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): Move; - hasExecutedAt(): boolean; - clearExecutedAt(): Move; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Move.AsObject; - static toObject(includeInstance: boolean, msg: Move): Move.AsObject; - static serializeBinaryToWriter(message: Move, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Move; - static deserializeBinaryFromReader(message: Move, reader: jspb.BinaryReader): Move; - } - - export namespace Move { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - prevCreatedAt?: TimeTicket.AsObject, - createdAt?: TimeTicket.AsObject, - executedAt?: TimeTicket.AsObject, - } - } - - - export class Remove extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): Remove; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): Remove; - - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): Remove; - hasCreatedAt(): boolean; - clearCreatedAt(): Remove; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): Remove; - hasExecutedAt(): boolean; - clearExecutedAt(): Remove; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Remove.AsObject; - static toObject(includeInstance: boolean, msg: Remove): Remove.AsObject; - static serializeBinaryToWriter(message: Remove, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Remove; - static deserializeBinaryFromReader(message: Remove, reader: jspb.BinaryReader): Remove; - } - - export namespace Remove { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - createdAt?: TimeTicket.AsObject, - executedAt?: TimeTicket.AsObject, - } - } - - - export class Edit extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): Edit; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): Edit; - - getFrom(): TextNodePos | undefined; - setFrom(value?: TextNodePos): Edit; - hasFrom(): boolean; - clearFrom(): Edit; - - getTo(): TextNodePos | undefined; - setTo(value?: TextNodePos): Edit; - hasTo(): boolean; - clearTo(): Edit; - - getCreatedAtMapByActorMap(): jspb.Map; - clearCreatedAtMapByActorMap(): Edit; - - getContent(): string; - setContent(value: string): Edit; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): Edit; - hasExecutedAt(): boolean; - clearExecutedAt(): Edit; - - getAttributesMap(): jspb.Map; - clearAttributesMap(): Edit; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Edit.AsObject; - static toObject(includeInstance: boolean, msg: Edit): Edit.AsObject; - static serializeBinaryToWriter(message: Edit, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Edit; - static deserializeBinaryFromReader(message: Edit, reader: jspb.BinaryReader): Edit; - } - - export namespace Edit { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - from?: TextNodePos.AsObject, - to?: TextNodePos.AsObject, - createdAtMapByActorMap: Array<[string, TimeTicket.AsObject]>, - content: string, - executedAt?: TimeTicket.AsObject, - attributesMap: Array<[string, string]>, - } - } - - - export class Select extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): Select; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): Select; - - getFrom(): TextNodePos | undefined; - setFrom(value?: TextNodePos): Select; - hasFrom(): boolean; - clearFrom(): Select; - - getTo(): TextNodePos | undefined; - setTo(value?: TextNodePos): Select; - hasTo(): boolean; - clearTo(): Select; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): Select; - hasExecutedAt(): boolean; - clearExecutedAt(): Select; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Select.AsObject; - static toObject(includeInstance: boolean, msg: Select): Select.AsObject; - static serializeBinaryToWriter(message: Select, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Select; - static deserializeBinaryFromReader(message: Select, reader: jspb.BinaryReader): Select; - } - - export namespace Select { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - from?: TextNodePos.AsObject, - to?: TextNodePos.AsObject, - executedAt?: TimeTicket.AsObject, - } - } - - - export class Style extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): Style; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): Style; - - getFrom(): TextNodePos | undefined; - setFrom(value?: TextNodePos): Style; - hasFrom(): boolean; - clearFrom(): Style; - - getTo(): TextNodePos | undefined; - setTo(value?: TextNodePos): Style; - hasTo(): boolean; - clearTo(): Style; - - getAttributesMap(): jspb.Map; - clearAttributesMap(): Style; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): Style; - hasExecutedAt(): boolean; - clearExecutedAt(): Style; - - getCreatedAtMapByActorMap(): jspb.Map; - clearCreatedAtMapByActorMap(): Style; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Style.AsObject; - static toObject(includeInstance: boolean, msg: Style): Style.AsObject; - static serializeBinaryToWriter(message: Style, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Style; - static deserializeBinaryFromReader(message: Style, reader: jspb.BinaryReader): Style; - } - - export namespace Style { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - from?: TextNodePos.AsObject, - to?: TextNodePos.AsObject, - attributesMap: Array<[string, string]>, - executedAt?: TimeTicket.AsObject, - createdAtMapByActorMap: Array<[string, TimeTicket.AsObject]>, - } - } - - - export class Increase extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): Increase; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): Increase; - - getValue(): JSONElementSimple | undefined; - setValue(value?: JSONElementSimple): Increase; - hasValue(): boolean; - clearValue(): Increase; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): Increase; - hasExecutedAt(): boolean; - clearExecutedAt(): Increase; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Increase.AsObject; - static toObject(includeInstance: boolean, msg: Increase): Increase.AsObject; - static serializeBinaryToWriter(message: Increase, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Increase; - static deserializeBinaryFromReader(message: Increase, reader: jspb.BinaryReader): Increase; - } - - export namespace Increase { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - value?: JSONElementSimple.AsObject, - executedAt?: TimeTicket.AsObject, - } - } - - - export class TreeEdit extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): TreeEdit; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): TreeEdit; - - getFrom(): TreePos | undefined; - setFrom(value?: TreePos): TreeEdit; - hasFrom(): boolean; - clearFrom(): TreeEdit; - - getTo(): TreePos | undefined; - setTo(value?: TreePos): TreeEdit; - hasTo(): boolean; - clearTo(): TreeEdit; - - getCreatedAtMapByActorMap(): jspb.Map; - clearCreatedAtMapByActorMap(): TreeEdit; - - getContentsList(): Array; - setContentsList(value: Array): TreeEdit; - clearContentsList(): TreeEdit; - addContents(value?: TreeNodes, index?: number): TreeNodes; - - getSplitLevel(): number; - setSplitLevel(value: number): TreeEdit; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): TreeEdit; - hasExecutedAt(): boolean; - clearExecutedAt(): TreeEdit; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TreeEdit.AsObject; - static toObject(includeInstance: boolean, msg: TreeEdit): TreeEdit.AsObject; - static serializeBinaryToWriter(message: TreeEdit, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TreeEdit; - static deserializeBinaryFromReader(message: TreeEdit, reader: jspb.BinaryReader): TreeEdit; - } - - export namespace TreeEdit { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - from?: TreePos.AsObject, - to?: TreePos.AsObject, - createdAtMapByActorMap: Array<[string, TimeTicket.AsObject]>, - contentsList: Array, - splitLevel: number, - executedAt?: TimeTicket.AsObject, - } - } - - - export class TreeStyle extends jspb.Message { - getParentCreatedAt(): TimeTicket | undefined; - setParentCreatedAt(value?: TimeTicket): TreeStyle; - hasParentCreatedAt(): boolean; - clearParentCreatedAt(): TreeStyle; - - getFrom(): TreePos | undefined; - setFrom(value?: TreePos): TreeStyle; - hasFrom(): boolean; - clearFrom(): TreeStyle; - - getTo(): TreePos | undefined; - setTo(value?: TreePos): TreeStyle; - hasTo(): boolean; - clearTo(): TreeStyle; - - getAttributesMap(): jspb.Map; - clearAttributesMap(): TreeStyle; - - getExecutedAt(): TimeTicket | undefined; - setExecutedAt(value?: TimeTicket): TreeStyle; - hasExecutedAt(): boolean; - clearExecutedAt(): TreeStyle; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TreeStyle.AsObject; - static toObject(includeInstance: boolean, msg: TreeStyle): TreeStyle.AsObject; - static serializeBinaryToWriter(message: TreeStyle, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TreeStyle; - static deserializeBinaryFromReader(message: TreeStyle, reader: jspb.BinaryReader): TreeStyle; - } - - export namespace TreeStyle { - export type AsObject = { - parentCreatedAt?: TimeTicket.AsObject, - from?: TreePos.AsObject, - to?: TreePos.AsObject, - attributesMap: Array<[string, string]>, - executedAt?: TimeTicket.AsObject, - } - } - - - export enum BodyCase { - BODY_NOT_SET = 0, - SET = 1, - ADD = 2, - MOVE = 3, - REMOVE = 4, - EDIT = 5, - SELECT = 6, - STYLE = 7, - INCREASE = 8, - TREE_EDIT = 9, - TREE_STYLE = 10, - } + 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; } -export class JSONElementSimple extends jspb.Message { - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): JSONElementSimple; - hasCreatedAt(): boolean; - clearCreatedAt(): JSONElementSimple; - - getMovedAt(): TimeTicket | undefined; - setMovedAt(value?: TimeTicket): JSONElementSimple; - hasMovedAt(): boolean; - clearMovedAt(): JSONElementSimple; - - getRemovedAt(): TimeTicket | undefined; - setRemovedAt(value?: TimeTicket): JSONElementSimple; - hasRemovedAt(): boolean; - clearRemovedAt(): JSONElementSimple; - - getType(): ValueType; - setType(value: ValueType): JSONElementSimple; - - getValue(): Uint8Array | string; - getValue_asU8(): Uint8Array; - getValue_asB64(): string; - setValue(value: Uint8Array | string): JSONElementSimple; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): JSONElementSimple.AsObject; - static toObject(includeInstance: boolean, msg: JSONElementSimple): JSONElementSimple.AsObject; - static serializeBinaryToWriter(message: JSONElementSimple, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): JSONElementSimple; - static deserializeBinaryFromReader(message: JSONElementSimple, reader: jspb.BinaryReader): JSONElementSimple; +/** + * @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; } -export namespace JSONElementSimple { - export type AsObject = { - createdAt?: TimeTicket.AsObject, - movedAt?: TimeTicket.AsObject, - removedAt?: TimeTicket.AsObject, - type: ValueType, - value: Uint8Array | string, - } +/** + * @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; } -export class JSONElement extends jspb.Message { - getJsonObject(): JSONElement.JSONObject | undefined; - setJsonObject(value?: JSONElement.JSONObject): JSONElement; - hasJsonObject(): boolean; - clearJsonObject(): JSONElement; - - getJsonArray(): JSONElement.JSONArray | undefined; - setJsonArray(value?: JSONElement.JSONArray): JSONElement; - hasJsonArray(): boolean; - clearJsonArray(): JSONElement; - - getPrimitive(): JSONElement.Primitive | undefined; - setPrimitive(value?: JSONElement.Primitive): JSONElement; - hasPrimitive(): boolean; - clearPrimitive(): JSONElement; - - getText(): JSONElement.Text | undefined; - setText(value?: JSONElement.Text): JSONElement; - hasText(): boolean; - clearText(): JSONElement; - - getCounter(): JSONElement.Counter | undefined; - setCounter(value?: JSONElement.Counter): JSONElement; - hasCounter(): boolean; - clearCounter(): JSONElement; - - getTree(): JSONElement.Tree | undefined; - setTree(value?: JSONElement.Tree): JSONElement; - hasTree(): boolean; - clearTree(): JSONElement; - - getBodyCase(): JSONElement.BodyCase; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): JSONElement.AsObject; - static toObject(includeInstance: boolean, msg: JSONElement): JSONElement.AsObject; - static serializeBinaryToWriter(message: JSONElement, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): JSONElement; - static deserializeBinaryFromReader(message: JSONElement, reader: jspb.BinaryReader): JSONElement; +/** + * @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; } -export namespace JSONElement { - export type AsObject = { - jsonObject?: JSONElement.JSONObject.AsObject, - jsonArray?: JSONElement.JSONArray.AsObject, - primitive?: JSONElement.Primitive.AsObject, - text?: JSONElement.Text.AsObject, - counter?: JSONElement.Counter.AsObject, - tree?: JSONElement.Tree.AsObject, - } - - export class JSONObject extends jspb.Message { - getNodesList(): Array; - setNodesList(value: Array): JSONObject; - clearNodesList(): JSONObject; - addNodes(value?: RHTNode, index?: number): RHTNode; - - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): JSONObject; - hasCreatedAt(): boolean; - clearCreatedAt(): JSONObject; - - getMovedAt(): TimeTicket | undefined; - setMovedAt(value?: TimeTicket): JSONObject; - hasMovedAt(): boolean; - clearMovedAt(): JSONObject; - - getRemovedAt(): TimeTicket | undefined; - setRemovedAt(value?: TimeTicket): JSONObject; - hasRemovedAt(): boolean; - clearRemovedAt(): JSONObject; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): JSONObject.AsObject; - static toObject(includeInstance: boolean, msg: JSONObject): JSONObject.AsObject; - static serializeBinaryToWriter(message: JSONObject, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): JSONObject; - static deserializeBinaryFromReader(message: JSONObject, reader: jspb.BinaryReader): JSONObject; - } - - export namespace JSONObject { - export type AsObject = { - nodesList: Array, - createdAt?: TimeTicket.AsObject, - movedAt?: TimeTicket.AsObject, - removedAt?: TimeTicket.AsObject, - } - } - - - export class JSONArray extends jspb.Message { - getNodesList(): Array; - setNodesList(value: Array): JSONArray; - clearNodesList(): JSONArray; - addNodes(value?: RGANode, index?: number): RGANode; - - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): JSONArray; - hasCreatedAt(): boolean; - clearCreatedAt(): JSONArray; - - getMovedAt(): TimeTicket | undefined; - setMovedAt(value?: TimeTicket): JSONArray; - hasMovedAt(): boolean; - clearMovedAt(): JSONArray; - - getRemovedAt(): TimeTicket | undefined; - setRemovedAt(value?: TimeTicket): JSONArray; - hasRemovedAt(): boolean; - clearRemovedAt(): JSONArray; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): JSONArray.AsObject; - static toObject(includeInstance: boolean, msg: JSONArray): JSONArray.AsObject; - static serializeBinaryToWriter(message: JSONArray, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): JSONArray; - static deserializeBinaryFromReader(message: JSONArray, reader: jspb.BinaryReader): JSONArray; - } - - export namespace JSONArray { - export type AsObject = { - nodesList: Array, - createdAt?: TimeTicket.AsObject, - movedAt?: TimeTicket.AsObject, - removedAt?: TimeTicket.AsObject, - } - } - - - export class Primitive extends jspb.Message { - getType(): ValueType; - setType(value: ValueType): Primitive; - - getValue(): Uint8Array | string; - getValue_asU8(): Uint8Array; - getValue_asB64(): string; - setValue(value: Uint8Array | string): Primitive; - - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): Primitive; - hasCreatedAt(): boolean; - clearCreatedAt(): Primitive; - - getMovedAt(): TimeTicket | undefined; - setMovedAt(value?: TimeTicket): Primitive; - hasMovedAt(): boolean; - clearMovedAt(): Primitive; - - getRemovedAt(): TimeTicket | undefined; - setRemovedAt(value?: TimeTicket): Primitive; - hasRemovedAt(): boolean; - clearRemovedAt(): Primitive; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Primitive.AsObject; - static toObject(includeInstance: boolean, msg: Primitive): Primitive.AsObject; - static serializeBinaryToWriter(message: Primitive, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Primitive; - static deserializeBinaryFromReader(message: Primitive, reader: jspb.BinaryReader): Primitive; - } - - export namespace Primitive { - export type AsObject = { - type: ValueType, - value: Uint8Array | string, - createdAt?: TimeTicket.AsObject, - movedAt?: TimeTicket.AsObject, - removedAt?: TimeTicket.AsObject, - } - } - - - export class Text extends jspb.Message { - getNodesList(): Array; - setNodesList(value: Array): Text; - clearNodesList(): Text; - addNodes(value?: TextNode, index?: number): TextNode; - - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): Text; - hasCreatedAt(): boolean; - clearCreatedAt(): Text; - - getMovedAt(): TimeTicket | undefined; - setMovedAt(value?: TimeTicket): Text; - hasMovedAt(): boolean; - clearMovedAt(): Text; - - getRemovedAt(): TimeTicket | undefined; - setRemovedAt(value?: TimeTicket): Text; - hasRemovedAt(): boolean; - clearRemovedAt(): Text; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Text.AsObject; - static toObject(includeInstance: boolean, msg: Text): Text.AsObject; - static serializeBinaryToWriter(message: Text, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Text; - static deserializeBinaryFromReader(message: Text, reader: jspb.BinaryReader): Text; - } - - export namespace Text { - export type AsObject = { - nodesList: Array, - createdAt?: TimeTicket.AsObject, - movedAt?: TimeTicket.AsObject, - removedAt?: TimeTicket.AsObject, - } - } - - - export class Counter extends jspb.Message { - getType(): ValueType; - setType(value: ValueType): Counter; - - getValue(): Uint8Array | string; - getValue_asU8(): Uint8Array; - getValue_asB64(): string; - setValue(value: Uint8Array | string): Counter; - - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): Counter; - hasCreatedAt(): boolean; - clearCreatedAt(): Counter; - - getMovedAt(): TimeTicket | undefined; - setMovedAt(value?: TimeTicket): Counter; - hasMovedAt(): boolean; - clearMovedAt(): Counter; - - getRemovedAt(): TimeTicket | undefined; - setRemovedAt(value?: TimeTicket): Counter; - hasRemovedAt(): boolean; - clearRemovedAt(): Counter; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Counter.AsObject; - static toObject(includeInstance: boolean, msg: Counter): Counter.AsObject; - static serializeBinaryToWriter(message: Counter, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Counter; - static deserializeBinaryFromReader(message: Counter, reader: jspb.BinaryReader): Counter; - } - - export namespace Counter { - export type AsObject = { - type: ValueType, - value: Uint8Array | string, - createdAt?: TimeTicket.AsObject, - movedAt?: TimeTicket.AsObject, - removedAt?: TimeTicket.AsObject, - } - } - - - export class Tree extends jspb.Message { - getNodesList(): Array; - setNodesList(value: Array): Tree; - clearNodesList(): Tree; - addNodes(value?: TreeNode, index?: number): TreeNode; - - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): Tree; - hasCreatedAt(): boolean; - clearCreatedAt(): Tree; - - getMovedAt(): TimeTicket | undefined; - setMovedAt(value?: TimeTicket): Tree; - hasMovedAt(): boolean; - clearMovedAt(): Tree; - - getRemovedAt(): TimeTicket | undefined; - setRemovedAt(value?: TimeTicket): Tree; - hasRemovedAt(): boolean; - clearRemovedAt(): Tree; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Tree.AsObject; - static toObject(includeInstance: boolean, msg: Tree): Tree.AsObject; - static serializeBinaryToWriter(message: Tree, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Tree; - static deserializeBinaryFromReader(message: Tree, reader: jspb.BinaryReader): Tree; - } - - export namespace Tree { - export type AsObject = { - nodesList: Array, - createdAt?: TimeTicket.AsObject, - movedAt?: TimeTicket.AsObject, - removedAt?: TimeTicket.AsObject, - } - } - - - export enum BodyCase { - BODY_NOT_SET = 0, - JSON_OBJECT = 1, - JSON_ARRAY = 2, - PRIMITIVE = 3, - TEXT = 5, - COUNTER = 6, - TREE = 7, - } +/** + * @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; } -export class RHTNode extends jspb.Message { - getKey(): string; - setKey(value: string): RHTNode; - - getElement(): JSONElement | undefined; - setElement(value?: JSONElement): RHTNode; - hasElement(): boolean; - clearElement(): RHTNode; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): RHTNode.AsObject; - static toObject(includeInstance: boolean, msg: RHTNode): RHTNode.AsObject; - static serializeBinaryToWriter(message: RHTNode, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): RHTNode; - static deserializeBinaryFromReader(message: RHTNode, reader: jspb.BinaryReader): RHTNode; +/** + * @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; } -export namespace RHTNode { - export type AsObject = { - key: string, - element?: JSONElement.AsObject, - } +/** + * @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; } -export class RGANode extends jspb.Message { - getNext(): RGANode | undefined; - setNext(value?: RGANode): RGANode; - hasNext(): boolean; - clearNext(): RGANode; - - getElement(): JSONElement | undefined; - setElement(value?: JSONElement): RGANode; - hasElement(): boolean; - clearElement(): RGANode; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): RGANode.AsObject; - static toObject(includeInstance: boolean, msg: RGANode): RGANode.AsObject; - static serializeBinaryToWriter(message: RGANode, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): RGANode; - static deserializeBinaryFromReader(message: RGANode, reader: jspb.BinaryReader): RGANode; +/** + * @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; } -export namespace RGANode { - export type AsObject = { - next?: RGANode.AsObject, - element?: JSONElement.AsObject, - } +/** + * @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; } -export class NodeAttr extends jspb.Message { - getValue(): string; - setValue(value: string): NodeAttr; - - getUpdatedAt(): TimeTicket | undefined; - setUpdatedAt(value?: TimeTicket): NodeAttr; - hasUpdatedAt(): boolean; - clearUpdatedAt(): NodeAttr; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): NodeAttr.AsObject; - static toObject(includeInstance: boolean, msg: NodeAttr): NodeAttr.AsObject; - static serializeBinaryToWriter(message: NodeAttr, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): NodeAttr; - static deserializeBinaryFromReader(message: NodeAttr, reader: jspb.BinaryReader): NodeAttr; +/** + * 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; } -export namespace NodeAttr { - export type AsObject = { - value: string, - updatedAt?: TimeTicket.AsObject, - } +/** + * @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; } -export class TextNode extends jspb.Message { - getId(): TextNodeID | undefined; - setId(value?: TextNodeID): TextNode; - hasId(): boolean; - clearId(): TextNode; - - getValue(): string; - setValue(value: string): TextNode; - - getRemovedAt(): TimeTicket | undefined; - setRemovedAt(value?: TimeTicket): TextNode; - hasRemovedAt(): boolean; - clearRemovedAt(): TextNode; - - getInsPrevId(): TextNodeID | undefined; - setInsPrevId(value?: TextNodeID): TextNode; - hasInsPrevId(): boolean; - clearInsPrevId(): TextNode; - - getAttributesMap(): jspb.Map; - clearAttributesMap(): TextNode; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TextNode.AsObject; - static toObject(includeInstance: boolean, msg: TextNode): TextNode.AsObject; - static serializeBinaryToWriter(message: TextNode, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TextNode; - static deserializeBinaryFromReader(message: TextNode, reader: jspb.BinaryReader): TextNode; +/** + * @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; } -export namespace TextNode { - export type AsObject = { - id?: TextNodeID.AsObject, - value: string, - removedAt?: TimeTicket.AsObject, - insPrevId?: TextNodeID.AsObject, - attributesMap: Array<[string, NodeAttr.AsObject]>, - } +/** + * @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; } -export class TextNodeID extends jspb.Message { - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): TextNodeID; - hasCreatedAt(): boolean; - clearCreatedAt(): TextNodeID; - - getOffset(): number; - setOffset(value: number): TextNodeID; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TextNodeID.AsObject; - static toObject(includeInstance: boolean, msg: TextNodeID): TextNodeID.AsObject; - static serializeBinaryToWriter(message: TextNodeID, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TextNodeID; - static deserializeBinaryFromReader(message: TextNodeID, reader: jspb.BinaryReader): TextNodeID; +/** + * @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; } -export namespace TextNodeID { - export type AsObject = { - createdAt?: TimeTicket.AsObject, - offset: number, - } +/** + * @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; } -export class TreeNode extends jspb.Message { - getId(): TreeNodeID | undefined; - setId(value?: TreeNodeID): TreeNode; - hasId(): boolean; - clearId(): TreeNode; - - getType(): string; - setType(value: string): TreeNode; - - getValue(): string; - setValue(value: string): TreeNode; - - getRemovedAt(): TimeTicket | undefined; - setRemovedAt(value?: TimeTicket): TreeNode; - hasRemovedAt(): boolean; - clearRemovedAt(): TreeNode; - - getInsPrevId(): TreeNodeID | undefined; - setInsPrevId(value?: TreeNodeID): TreeNode; - hasInsPrevId(): boolean; - clearInsPrevId(): TreeNode; - - getInsNextId(): TreeNodeID | undefined; - setInsNextId(value?: TreeNodeID): TreeNode; - hasInsNextId(): boolean; - clearInsNextId(): TreeNode; - - getDepth(): number; - setDepth(value: number): TreeNode; - - getAttributesMap(): jspb.Map; - clearAttributesMap(): TreeNode; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TreeNode.AsObject; - static toObject(includeInstance: boolean, msg: TreeNode): TreeNode.AsObject; - static serializeBinaryToWriter(message: TreeNode, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TreeNode; - static deserializeBinaryFromReader(message: TreeNode, reader: jspb.BinaryReader): TreeNode; +/** + * @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; } -export namespace TreeNode { - export type AsObject = { - id?: TreeNodeID.AsObject, - type: string, - value: string, - removedAt?: TimeTicket.AsObject, - insPrevId?: TreeNodeID.AsObject, - insNextId?: TreeNodeID.AsObject, - depth: number, - attributesMap: Array<[string, NodeAttr.AsObject]>, - } +/** + * @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; } -export class TreeNodes extends jspb.Message { - getContentList(): Array; - setContentList(value: Array): TreeNodes; - clearContentList(): TreeNodes; - addContent(value?: TreeNode, index?: number): TreeNode; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TreeNodes.AsObject; - static toObject(includeInstance: boolean, msg: TreeNodes): TreeNodes.AsObject; - static serializeBinaryToWriter(message: TreeNodes, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TreeNodes; - static deserializeBinaryFromReader(message: TreeNodes, reader: jspb.BinaryReader): TreeNodes; +/** + * @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; } -export namespace TreeNodes { - export type AsObject = { - contentList: Array, - } +/** + * @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; } -export class TreeNodeID extends jspb.Message { - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): TreeNodeID; - hasCreatedAt(): boolean; - clearCreatedAt(): TreeNodeID; - - getOffset(): number; - setOffset(value: number): TreeNodeID; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TreeNodeID.AsObject; - static toObject(includeInstance: boolean, msg: TreeNodeID): TreeNodeID.AsObject; - static serializeBinaryToWriter(message: TreeNodeID, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TreeNodeID; - static deserializeBinaryFromReader(message: TreeNodeID, reader: jspb.BinaryReader): TreeNodeID; +/** + * @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; } -export namespace TreeNodeID { - export type AsObject = { - createdAt?: TimeTicket.AsObject, - offset: number, - } +/** + * @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; } -export class TreePos extends jspb.Message { - getParentId(): TreeNodeID | undefined; - setParentId(value?: TreeNodeID): TreePos; - hasParentId(): boolean; - clearParentId(): TreePos; - - getLeftSiblingId(): TreeNodeID | undefined; - setLeftSiblingId(value?: TreeNodeID): TreePos; - hasLeftSiblingId(): boolean; - clearLeftSiblingId(): TreePos; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TreePos.AsObject; - static toObject(includeInstance: boolean, msg: TreePos): TreePos.AsObject; - static serializeBinaryToWriter(message: TreePos, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TreePos; - static deserializeBinaryFromReader(message: TreePos, reader: jspb.BinaryReader): TreePos; +/** + * @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; } -export namespace TreePos { - export type AsObject = { - parentId?: TreeNodeID.AsObject, - leftSiblingId?: TreeNodeID.AsObject, - } +/** + * @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; } -export class User extends jspb.Message { - getId(): string; - setId(value: string): User; +/** + * @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; - getUsername(): string; - setUsername(value: string): User; + static fromBinary(bytes: Uint8Array, options?: Partial): RGANode; - getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined; - setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): User; - hasCreatedAt(): boolean; - clearCreatedAt(): User; + static fromJson(jsonValue: JsonValue, options?: Partial): RGANode; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): User.AsObject; - static toObject(includeInstance: boolean, msg: User): User.AsObject; - static serializeBinaryToWriter(message: User, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): User; - static deserializeBinaryFromReader(message: User, reader: jspb.BinaryReader): User; + static fromJsonString(jsonString: string, options?: Partial): RGANode; + + static equals(a: RGANode | PlainMessage | undefined, b: RGANode | PlainMessage | undefined): boolean; } -export namespace User { - export type AsObject = { - id: string, - username: string, - createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject, - } +/** + * @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; } -export class Project extends jspb.Message { - getId(): string; - setId(value: string): Project; +/** + * @generated from message yorkie.v1.TextNode + */ +export declare class TextNode extends Message { + /** + * @generated from field: yorkie.v1.TextNodeID id = 1; + */ + id?: TextNodeID; - getName(): string; - setName(value: string): Project; + /** + * @generated from field: string value = 2; + */ + value: string; - getPublicKey(): string; - setPublicKey(value: string): Project; + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 3; + */ + removedAt?: TimeTicket; - getSecretKey(): string; - setSecretKey(value: string): Project; + /** + * @generated from field: yorkie.v1.TextNodeID ins_prev_id = 4; + */ + insPrevId?: TextNodeID; - getAuthWebhookUrl(): string; - setAuthWebhookUrl(value: string): Project; + /** + * @generated from field: map attributes = 5; + */ + attributes: { [key: string]: NodeAttr }; - getAuthWebhookMethodsList(): Array; - setAuthWebhookMethodsList(value: Array): Project; - clearAuthWebhookMethodsList(): Project; - addAuthWebhookMethods(value: string, index?: number): Project; + constructor(data?: PartialMessage); - getClientDeactivateThreshold(): string; - setClientDeactivateThreshold(value: string): Project; + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TextNode"; + static readonly fields: FieldList; - getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined; - setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): Project; - hasCreatedAt(): boolean; - clearCreatedAt(): Project; + static fromBinary(bytes: Uint8Array, options?: Partial): TextNode; - getUpdatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined; - setUpdatedAt(value?: google_protobuf_timestamp_pb.Timestamp): Project; - hasUpdatedAt(): boolean; - clearUpdatedAt(): Project; + static fromJson(jsonValue: JsonValue, options?: Partial): TextNode; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Project.AsObject; - static toObject(includeInstance: boolean, msg: Project): Project.AsObject; - static serializeBinaryToWriter(message: Project, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Project; - static deserializeBinaryFromReader(message: Project, reader: jspb.BinaryReader): Project; -} + static fromJsonString(jsonString: string, options?: Partial): TextNode; -export namespace Project { - export type AsObject = { - id: string, - name: string, - publicKey: string, - secretKey: string, - authWebhookUrl: string, - authWebhookMethodsList: Array, - clientDeactivateThreshold: string, - createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject, - updatedAt?: google_protobuf_timestamp_pb.Timestamp.AsObject, - } + static equals(a: TextNode | PlainMessage | undefined, b: TextNode | PlainMessage | undefined): boolean; } -export class UpdatableProjectFields extends jspb.Message { - getName(): google_protobuf_wrappers_pb.StringValue | undefined; - setName(value?: google_protobuf_wrappers_pb.StringValue): UpdatableProjectFields; - hasName(): boolean; - clearName(): UpdatableProjectFields; - - getAuthWebhookUrl(): google_protobuf_wrappers_pb.StringValue | undefined; - setAuthWebhookUrl(value?: google_protobuf_wrappers_pb.StringValue): UpdatableProjectFields; - hasAuthWebhookUrl(): boolean; - clearAuthWebhookUrl(): UpdatableProjectFields; - - getAuthWebhookMethods(): UpdatableProjectFields.AuthWebhookMethods | undefined; - setAuthWebhookMethods(value?: UpdatableProjectFields.AuthWebhookMethods): UpdatableProjectFields; - hasAuthWebhookMethods(): boolean; - clearAuthWebhookMethods(): UpdatableProjectFields; - - getClientDeactivateThreshold(): google_protobuf_wrappers_pb.StringValue | undefined; - setClientDeactivateThreshold(value?: google_protobuf_wrappers_pb.StringValue): UpdatableProjectFields; - hasClientDeactivateThreshold(): boolean; - clearClientDeactivateThreshold(): UpdatableProjectFields; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): UpdatableProjectFields.AsObject; - static toObject(includeInstance: boolean, msg: UpdatableProjectFields): UpdatableProjectFields.AsObject; - static serializeBinaryToWriter(message: UpdatableProjectFields, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): UpdatableProjectFields; - static deserializeBinaryFromReader(message: UpdatableProjectFields, reader: jspb.BinaryReader): UpdatableProjectFields; -} +/** + * @generated from message yorkie.v1.TextNodeID + */ +export declare class TextNodeID extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; -export namespace UpdatableProjectFields { - export type AsObject = { - name?: google_protobuf_wrappers_pb.StringValue.AsObject, - authWebhookUrl?: google_protobuf_wrappers_pb.StringValue.AsObject, - authWebhookMethods?: UpdatableProjectFields.AuthWebhookMethods.AsObject, - clientDeactivateThreshold?: google_protobuf_wrappers_pb.StringValue.AsObject, - } - - export class AuthWebhookMethods extends jspb.Message { - getMethodsList(): Array; - setMethodsList(value: Array): AuthWebhookMethods; - clearMethodsList(): AuthWebhookMethods; - addMethods(value: string, index?: number): AuthWebhookMethods; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): AuthWebhookMethods.AsObject; - static toObject(includeInstance: boolean, msg: AuthWebhookMethods): AuthWebhookMethods.AsObject; - static serializeBinaryToWriter(message: AuthWebhookMethods, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): AuthWebhookMethods; - static deserializeBinaryFromReader(message: AuthWebhookMethods, reader: jspb.BinaryReader): AuthWebhookMethods; - } - - export namespace AuthWebhookMethods { - export type AsObject = { - methodsList: Array, - } - } + /** + * @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; -export class DocumentSummary extends jspb.Message { - getId(): string; - setId(value: string): DocumentSummary; - - getKey(): string; - setKey(value: string): DocumentSummary; - - getSnapshot(): string; - setSnapshot(value: string): DocumentSummary; - - getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined; - setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): DocumentSummary; - hasCreatedAt(): boolean; - clearCreatedAt(): DocumentSummary; - - getAccessedAt(): google_protobuf_timestamp_pb.Timestamp | undefined; - setAccessedAt(value?: google_protobuf_timestamp_pb.Timestamp): DocumentSummary; - hasAccessedAt(): boolean; - clearAccessedAt(): DocumentSummary; - - getUpdatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined; - setUpdatedAt(value?: google_protobuf_timestamp_pb.Timestamp): DocumentSummary; - hasUpdatedAt(): boolean; - clearUpdatedAt(): DocumentSummary; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DocumentSummary.AsObject; - static toObject(includeInstance: boolean, msg: DocumentSummary): DocumentSummary.AsObject; - static serializeBinaryToWriter(message: DocumentSummary, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DocumentSummary; - static deserializeBinaryFromReader(message: DocumentSummary, reader: jspb.BinaryReader): DocumentSummary; + 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; } -export namespace DocumentSummary { - export type AsObject = { - id: string, - key: string, - snapshot: string, - createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject, - accessedAt?: google_protobuf_timestamp_pb.Timestamp.AsObject, - updatedAt?: google_protobuf_timestamp_pb.Timestamp.AsObject, - } +/** + * @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; } -export class PresenceChange extends jspb.Message { - getType(): PresenceChange.ChangeType; - setType(value: PresenceChange.ChangeType): PresenceChange; - - getPresence(): Presence | undefined; - setPresence(value?: Presence): PresenceChange; - hasPresence(): boolean; - clearPresence(): PresenceChange; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PresenceChange.AsObject; - static toObject(includeInstance: boolean, msg: PresenceChange): PresenceChange.AsObject; - static serializeBinaryToWriter(message: PresenceChange, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PresenceChange; - static deserializeBinaryFromReader(message: PresenceChange, reader: jspb.BinaryReader): PresenceChange; +/** + * @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; } -export namespace PresenceChange { - export type AsObject = { - type: PresenceChange.ChangeType, - presence?: Presence.AsObject, - } - - export enum ChangeType { - CHANGE_TYPE_UNSPECIFIED = 0, - CHANGE_TYPE_PUT = 1, - CHANGE_TYPE_DELETE = 2, - CHANGE_TYPE_CLEAR = 3, - } +/** + * @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; } -export class Presence extends jspb.Message { - getDataMap(): jspb.Map; - clearDataMap(): Presence; +/** + * @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; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Presence.AsObject; - static toObject(includeInstance: boolean, msg: Presence): Presence.AsObject; - static serializeBinaryToWriter(message: Presence, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Presence; - static deserializeBinaryFromReader(message: Presence, reader: jspb.BinaryReader): Presence; + 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; } -export namespace Presence { - export type AsObject = { - dataMap: Array<[string, string]>, - } +/** + * @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; } -export class Checkpoint extends jspb.Message { - getServerSeq(): string; - setServerSeq(value: string): Checkpoint; +/** + * @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; - getClientSeq(): number; - setClientSeq(value: number): Checkpoint; + constructor(data?: PartialMessage); - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Checkpoint.AsObject; - static toObject(includeInstance: boolean, msg: Checkpoint): Checkpoint.AsObject; - static serializeBinaryToWriter(message: Checkpoint, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Checkpoint; - static deserializeBinaryFromReader(message: Checkpoint, reader: jspb.BinaryReader): Checkpoint; + 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; } -export namespace Checkpoint { - export type AsObject = { - serverSeq: string, - clientSeq: number, - } +/** + * @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; } -export class TextNodePos extends jspb.Message { - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): TextNodePos; - hasCreatedAt(): boolean; - clearCreatedAt(): TextNodePos; +/** + * @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); - getOffset(): number; - setOffset(value: number): TextNodePos; + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.UpdatableProjectFields.AuthWebhookMethods"; + static readonly fields: FieldList; - getRelativeOffset(): number; - setRelativeOffset(value: number): TextNodePos; + static fromBinary(bytes: Uint8Array, options?: Partial): UpdatableProjectFields_AuthWebhookMethods; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TextNodePos.AsObject; - static toObject(includeInstance: boolean, msg: TextNodePos): TextNodePos.AsObject; - static serializeBinaryToWriter(message: TextNodePos, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TextNodePos; - static deserializeBinaryFromReader(message: TextNodePos, reader: jspb.BinaryReader): TextNodePos; + 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; } -export namespace TextNodePos { - export type AsObject = { - createdAt?: TimeTicket.AsObject, - offset: number, - relativeOffset: number, - } +/** + * @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; } -export class TimeTicket extends jspb.Message { - getLamport(): string; - setLamport(value: string): TimeTicket; +/** + * @generated from message yorkie.v1.PresenceChange + */ +export declare class PresenceChange extends Message { + /** + * @generated from field: yorkie.v1.PresenceChange.ChangeType type = 1; + */ + type: PresenceChange_ChangeType; - getDelimiter(): number; - setDelimiter(value: number): TimeTicket; + /** + * @generated from field: yorkie.v1.Presence presence = 2; + */ + presence?: Presence; - getActorId(): Uint8Array | string; - getActorId_asU8(): Uint8Array; - getActorId_asB64(): string; - setActorId(value: Uint8Array | string): TimeTicket; + constructor(data?: PartialMessage); - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): TimeTicket.AsObject; - static toObject(includeInstance: boolean, msg: TimeTicket): TimeTicket.AsObject; - static serializeBinaryToWriter(message: TimeTicket, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): TimeTicket; - static deserializeBinaryFromReader(message: TimeTicket, reader: jspb.BinaryReader): TimeTicket; + 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; } -export namespace TimeTicket { - export type AsObject = { - lamport: string, - delimiter: number, - actorId: Uint8Array | string, - } +/** + * @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, } -export class DocEventBody extends jspb.Message { - getTopic(): string; - setTopic(value: string): DocEventBody; - - getPayload(): Uint8Array | string; - getPayload_asU8(): Uint8Array; - getPayload_asB64(): string; - setPayload(value: Uint8Array | string): DocEventBody; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DocEventBody.AsObject; - static toObject(includeInstance: boolean, msg: DocEventBody): DocEventBody.AsObject; - static serializeBinaryToWriter(message: DocEventBody, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DocEventBody; - static deserializeBinaryFromReader(message: DocEventBody, reader: jspb.BinaryReader): DocEventBody; +/** + * @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; } -export namespace DocEventBody { - export type AsObject = { - topic: string, - payload: Uint8Array | string, - } +/** + * @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; } -export class DocEvent extends jspb.Message { - getType(): DocEventType; - setType(value: DocEventType): DocEvent; +/** + * @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; - getPublisher(): string; - setPublisher(value: string): DocEvent; + static fromBinary(bytes: Uint8Array, options?: Partial): TextNodePos; - getBody(): DocEventBody | undefined; - setBody(value?: DocEventBody): DocEvent; - hasBody(): boolean; - clearBody(): DocEvent; + static fromJson(jsonValue: JsonValue, options?: Partial): TextNodePos; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DocEvent.AsObject; - static toObject(includeInstance: boolean, msg: DocEvent): DocEvent.AsObject; - static serializeBinaryToWriter(message: DocEvent, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DocEvent; - static deserializeBinaryFromReader(message: DocEvent, reader: jspb.BinaryReader): DocEvent; + static fromJsonString(jsonString: string, options?: Partial): TextNodePos; + + static equals(a: TextNodePos | PlainMessage | undefined, b: TextNodePos | PlainMessage | undefined): boolean; } -export namespace DocEvent { - export type AsObject = { - type: DocEventType, - publisher: string, - body?: DocEventBody.AsObject, - } +/** + * @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; } -export 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, +/** + * @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; } -export 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, + +/** + * @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 index f97ef6105..dd58b9bc0 100644 --- a/src/api/yorkie/v1/resources_pb.js +++ b/src/api/yorkie/v1/resources_pb.js @@ -1,13502 +1,722 @@ -// source: yorkie/v1/resources.proto -/** - * @fileoverview - * @enhanceable - * @suppress {missingRequire} reports error on implicit type usages. - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! +// +// 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.6.0 with parameter "target=js+dts,js_import_style=legacy_commonjs" +// @generated from file src/api/yorkie/v1/resources.proto (package yorkie.v1, syntax proto3) /* eslint-disable */ // @ts-nocheck -var jspb = require('google-protobuf'); -var goog = jspb; -var global = - (typeof globalThis !== 'undefined' && globalThis) || - (typeof window !== 'undefined' && window) || - (typeof global !== 'undefined' && global) || - (typeof self !== 'undefined' && self) || - (function () { return this; }).call(null) || - Function('return this')(); - -var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); -goog.object.extend(proto, google_protobuf_timestamp_pb); -var google_protobuf_wrappers_pb = require('google-protobuf/google/protobuf/wrappers_pb.js'); -goog.object.extend(proto, google_protobuf_wrappers_pb); -goog.exportSymbol('proto.yorkie.v1.Change', null, global); -goog.exportSymbol('proto.yorkie.v1.ChangeID', null, global); -goog.exportSymbol('proto.yorkie.v1.ChangePack', null, global); -goog.exportSymbol('proto.yorkie.v1.Checkpoint', null, global); -goog.exportSymbol('proto.yorkie.v1.DocEvent', null, global); -goog.exportSymbol('proto.yorkie.v1.DocEventBody', null, global); -goog.exportSymbol('proto.yorkie.v1.DocEventType', null, global); -goog.exportSymbol('proto.yorkie.v1.DocumentSummary', null, global); -goog.exportSymbol('proto.yorkie.v1.JSONElement', null, global); -goog.exportSymbol('proto.yorkie.v1.JSONElement.BodyCase', null, global); -goog.exportSymbol('proto.yorkie.v1.JSONElement.Counter', null, global); -goog.exportSymbol('proto.yorkie.v1.JSONElement.JSONArray', null, global); -goog.exportSymbol('proto.yorkie.v1.JSONElement.JSONObject', null, global); -goog.exportSymbol('proto.yorkie.v1.JSONElement.Primitive', null, global); -goog.exportSymbol('proto.yorkie.v1.JSONElement.Text', null, global); -goog.exportSymbol('proto.yorkie.v1.JSONElement.Tree', null, global); -goog.exportSymbol('proto.yorkie.v1.JSONElementSimple', null, global); -goog.exportSymbol('proto.yorkie.v1.NodeAttr', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.Add', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.BodyCase', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.Edit', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.Increase', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.Move', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.Remove', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.Select', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.Set', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.Style', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.TreeEdit', null, global); -goog.exportSymbol('proto.yorkie.v1.Operation.TreeStyle', null, global); -goog.exportSymbol('proto.yorkie.v1.Presence', null, global); -goog.exportSymbol('proto.yorkie.v1.PresenceChange', null, global); -goog.exportSymbol('proto.yorkie.v1.PresenceChange.ChangeType', null, global); -goog.exportSymbol('proto.yorkie.v1.Project', null, global); -goog.exportSymbol('proto.yorkie.v1.RGANode', null, global); -goog.exportSymbol('proto.yorkie.v1.RHTNode', null, global); -goog.exportSymbol('proto.yorkie.v1.Snapshot', null, global); -goog.exportSymbol('proto.yorkie.v1.TextNode', null, global); -goog.exportSymbol('proto.yorkie.v1.TextNodeID', null, global); -goog.exportSymbol('proto.yorkie.v1.TextNodePos', null, global); -goog.exportSymbol('proto.yorkie.v1.TimeTicket', null, global); -goog.exportSymbol('proto.yorkie.v1.TreeNode', null, global); -goog.exportSymbol('proto.yorkie.v1.TreeNodeID', null, global); -goog.exportSymbol('proto.yorkie.v1.TreeNodes', null, global); -goog.exportSymbol('proto.yorkie.v1.TreePos', null, global); -goog.exportSymbol('proto.yorkie.v1.UpdatableProjectFields', null, global); -goog.exportSymbol('proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods', null, global); -goog.exportSymbol('proto.yorkie.v1.User', null, global); -goog.exportSymbol('proto.yorkie.v1.ValueType', null, global); -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Snapshot = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Snapshot, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Snapshot.displayName = 'proto.yorkie.v1.Snapshot'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.ChangePack = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.ChangePack.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.ChangePack, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.ChangePack.displayName = 'proto.yorkie.v1.ChangePack'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Change = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.Change.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.Change, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Change.displayName = 'proto.yorkie.v1.Change'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.ChangeID = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.ChangeID, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.ChangeID.displayName = 'proto.yorkie.v1.ChangeID'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.yorkie.v1.Operation.oneofGroups_); -}; -goog.inherits(proto.yorkie.v1.Operation, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.displayName = 'proto.yorkie.v1.Operation'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.Set = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Operation.Set, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.Set.displayName = 'proto.yorkie.v1.Operation.Set'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.Add = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Operation.Add, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.Add.displayName = 'proto.yorkie.v1.Operation.Add'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.Move = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Operation.Move, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.Move.displayName = 'proto.yorkie.v1.Operation.Move'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.Remove = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Operation.Remove, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.Remove.displayName = 'proto.yorkie.v1.Operation.Remove'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.Edit = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Operation.Edit, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.Edit.displayName = 'proto.yorkie.v1.Operation.Edit'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.Select = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Operation.Select, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.Select.displayName = 'proto.yorkie.v1.Operation.Select'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.Style = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Operation.Style, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.Style.displayName = 'proto.yorkie.v1.Operation.Style'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.Increase = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Operation.Increase, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.Increase.displayName = 'proto.yorkie.v1.Operation.Increase'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.TreeEdit = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.Operation.TreeEdit.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.Operation.TreeEdit, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.TreeEdit.displayName = 'proto.yorkie.v1.Operation.TreeEdit'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Operation.TreeStyle = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Operation.TreeStyle, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Operation.TreeStyle.displayName = 'proto.yorkie.v1.Operation.TreeStyle'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.JSONElementSimple = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.JSONElementSimple, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.JSONElementSimple.displayName = 'proto.yorkie.v1.JSONElementSimple'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.JSONElement = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.yorkie.v1.JSONElement.oneofGroups_); -}; -goog.inherits(proto.yorkie.v1.JSONElement, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.JSONElement.displayName = 'proto.yorkie.v1.JSONElement'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.JSONElement.JSONObject = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.JSONElement.JSONObject.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.JSONElement.JSONObject, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.JSONElement.JSONObject.displayName = 'proto.yorkie.v1.JSONElement.JSONObject'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.JSONElement.JSONArray = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.JSONElement.JSONArray.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.JSONElement.JSONArray, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.JSONElement.JSONArray.displayName = 'proto.yorkie.v1.JSONElement.JSONArray'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.JSONElement.Primitive = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.JSONElement.Primitive, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.JSONElement.Primitive.displayName = 'proto.yorkie.v1.JSONElement.Primitive'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.JSONElement.Text = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.JSONElement.Text.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.JSONElement.Text, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.JSONElement.Text.displayName = 'proto.yorkie.v1.JSONElement.Text'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.JSONElement.Counter = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.JSONElement.Counter, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.JSONElement.Counter.displayName = 'proto.yorkie.v1.JSONElement.Counter'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.JSONElement.Tree = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.JSONElement.Tree.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.JSONElement.Tree, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.JSONElement.Tree.displayName = 'proto.yorkie.v1.JSONElement.Tree'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.RHTNode = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.RHTNode, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.RHTNode.displayName = 'proto.yorkie.v1.RHTNode'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.RGANode = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.RGANode, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.RGANode.displayName = 'proto.yorkie.v1.RGANode'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.NodeAttr = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.NodeAttr, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.NodeAttr.displayName = 'proto.yorkie.v1.NodeAttr'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.TextNode = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.TextNode, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.TextNode.displayName = 'proto.yorkie.v1.TextNode'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.TextNodeID = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.TextNodeID, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.TextNodeID.displayName = 'proto.yorkie.v1.TextNodeID'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.TreeNode = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.TreeNode, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.TreeNode.displayName = 'proto.yorkie.v1.TreeNode'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.TreeNodes = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.TreeNodes.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.TreeNodes, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.TreeNodes.displayName = 'proto.yorkie.v1.TreeNodes'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.TreeNodeID = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.TreeNodeID, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.TreeNodeID.displayName = 'proto.yorkie.v1.TreeNodeID'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.TreePos = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.TreePos, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.TreePos.displayName = 'proto.yorkie.v1.TreePos'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.User = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.User, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.User.displayName = 'proto.yorkie.v1.User'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Project = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.Project.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.Project, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Project.displayName = 'proto.yorkie.v1.Project'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.UpdatableProjectFields = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.UpdatableProjectFields, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.UpdatableProjectFields.displayName = 'proto.yorkie.v1.UpdatableProjectFields'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.displayName = 'proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.DocumentSummary = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.DocumentSummary, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.DocumentSummary.displayName = 'proto.yorkie.v1.DocumentSummary'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.PresenceChange = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.PresenceChange, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.PresenceChange.displayName = 'proto.yorkie.v1.PresenceChange'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Presence = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Presence, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Presence.displayName = 'proto.yorkie.v1.Presence'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.Checkpoint = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.Checkpoint, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.Checkpoint.displayName = 'proto.yorkie.v1.Checkpoint'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.TextNodePos = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.TextNodePos, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.TextNodePos.displayName = 'proto.yorkie.v1.TextNodePos'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.TimeTicket = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.TimeTicket, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.TimeTicket.displayName = 'proto.yorkie.v1.TimeTicket'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.DocEventBody = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.DocEventBody, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.DocEventBody.displayName = 'proto.yorkie.v1.DocEventBody'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.DocEvent = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.DocEvent, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.DocEvent.displayName = 'proto.yorkie.v1.DocEvent'; -} - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Snapshot.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Snapshot.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Snapshot} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Snapshot.toObject = function(includeInstance, msg) { - var f, obj = { - root: (f = msg.getRoot()) && proto.yorkie.v1.JSONElement.toObject(includeInstance, f), - presencesMap: (f = msg.getPresencesMap()) ? f.toObject(includeInstance, proto.yorkie.v1.Presence.toObject) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Snapshot} - */ -proto.yorkie.v1.Snapshot.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Snapshot; - return proto.yorkie.v1.Snapshot.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Snapshot} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Snapshot} - */ -proto.yorkie.v1.Snapshot.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.JSONElement; - reader.readMessage(value,proto.yorkie.v1.JSONElement.deserializeBinaryFromReader); - msg.setRoot(value); - break; - case 2: - var value = msg.getPresencesMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.yorkie.v1.Presence.deserializeBinaryFromReader, "", new proto.yorkie.v1.Presence()); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Snapshot.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Snapshot.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Snapshot} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Snapshot.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getRoot(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.JSONElement.serializeBinaryToWriter - ); - } - f = message.getPresencesMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.yorkie.v1.Presence.serializeBinaryToWriter); - } -}; - - -/** - * optional JSONElement root = 1; - * @return {?proto.yorkie.v1.JSONElement} - */ -proto.yorkie.v1.Snapshot.prototype.getRoot = function() { - return /** @type{?proto.yorkie.v1.JSONElement} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElement, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElement|undefined} value - * @return {!proto.yorkie.v1.Snapshot} returns this -*/ -proto.yorkie.v1.Snapshot.prototype.setRoot = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Snapshot} returns this - */ -proto.yorkie.v1.Snapshot.prototype.clearRoot = function() { - return this.setRoot(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Snapshot.prototype.hasRoot = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * map presences = 2; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.Snapshot.prototype.getPresencesMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 2, opt_noLazyCreate, - proto.yorkie.v1.Presence)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.Snapshot} returns this - */ -proto.yorkie.v1.Snapshot.prototype.clearPresencesMap = function() { - this.getPresencesMap().clear(); - return this; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.ChangePack.repeatedFields_ = [4]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.ChangePack.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.ChangePack.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.ChangePack} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.ChangePack.toObject = function(includeInstance, msg) { - var f, obj = { - documentKey: jspb.Message.getFieldWithDefault(msg, 1, ""), - checkpoint: (f = msg.getCheckpoint()) && proto.yorkie.v1.Checkpoint.toObject(includeInstance, f), - snapshot: msg.getSnapshot_asB64(), - changesList: jspb.Message.toObjectList(msg.getChangesList(), - proto.yorkie.v1.Change.toObject, includeInstance), - minSyncedTicket: (f = msg.getMinSyncedTicket()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - isRemoved: jspb.Message.getBooleanFieldWithDefault(msg, 6, false) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.ChangePack} - */ -proto.yorkie.v1.ChangePack.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.ChangePack; - return proto.yorkie.v1.ChangePack.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.ChangePack} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.ChangePack} - */ -proto.yorkie.v1.ChangePack.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentKey(value); - break; - case 2: - var value = new proto.yorkie.v1.Checkpoint; - reader.readMessage(value,proto.yorkie.v1.Checkpoint.deserializeBinaryFromReader); - msg.setCheckpoint(value); - break; - case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setSnapshot(value); - break; - case 4: - var value = new proto.yorkie.v1.Change; - reader.readMessage(value,proto.yorkie.v1.Change.deserializeBinaryFromReader); - msg.addChanges(value); - break; - case 5: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setMinSyncedTicket(value); - break; - case 6: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setIsRemoved(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.ChangePack.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.ChangePack.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.ChangePack} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.ChangePack.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getDocumentKey(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getCheckpoint(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.Checkpoint.serializeBinaryToWriter - ); - } - f = message.getSnapshot_asU8(); - if (f.length > 0) { - writer.writeBytes( - 3, - f - ); - } - f = message.getChangesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 4, - f, - proto.yorkie.v1.Change.serializeBinaryToWriter - ); - } - f = message.getMinSyncedTicket(); - if (f != null) { - writer.writeMessage( - 5, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getIsRemoved(); - if (f) { - writer.writeBool( - 6, - f - ); - } -}; - - -/** - * optional string document_key = 1; - * @return {string} - */ -proto.yorkie.v1.ChangePack.prototype.getDocumentKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.ChangePack} returns this - */ -proto.yorkie.v1.ChangePack.prototype.setDocumentKey = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional Checkpoint checkpoint = 2; - * @return {?proto.yorkie.v1.Checkpoint} - */ -proto.yorkie.v1.ChangePack.prototype.getCheckpoint = function() { - return /** @type{?proto.yorkie.v1.Checkpoint} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Checkpoint, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.Checkpoint|undefined} value - * @return {!proto.yorkie.v1.ChangePack} returns this -*/ -proto.yorkie.v1.ChangePack.prototype.setCheckpoint = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.ChangePack} returns this - */ -proto.yorkie.v1.ChangePack.prototype.clearCheckpoint = function() { - return this.setCheckpoint(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.ChangePack.prototype.hasCheckpoint = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional bytes snapshot = 3; - * @return {string} - */ -proto.yorkie.v1.ChangePack.prototype.getSnapshot = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * optional bytes snapshot = 3; - * This is a type-conversion wrapper around `getSnapshot()` - * @return {string} - */ -proto.yorkie.v1.ChangePack.prototype.getSnapshot_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getSnapshot())); -}; - - -/** - * optional bytes snapshot = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getSnapshot()` - * @return {!Uint8Array} - */ -proto.yorkie.v1.ChangePack.prototype.getSnapshot_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getSnapshot())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.yorkie.v1.ChangePack} returns this - */ -proto.yorkie.v1.ChangePack.prototype.setSnapshot = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); -}; - - -/** - * repeated Change changes = 4; - * @return {!Array} - */ -proto.yorkie.v1.ChangePack.prototype.getChangesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.yorkie.v1.Change, 4)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.ChangePack} returns this -*/ -proto.yorkie.v1.ChangePack.prototype.setChangesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 4, value); -}; - - -/** - * @param {!proto.yorkie.v1.Change=} opt_value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.Change} - */ -proto.yorkie.v1.ChangePack.prototype.addChanges = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.yorkie.v1.Change, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.ChangePack} returns this +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + +const { proto3, StringValue, Timestamp } = require("@bufbuild/protobuf"); + +/** + * @generated from enum yorkie.v1.ValueType + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +const TreeNodes = proto3.makeMessageType( + "yorkie.v1.TreeNodes", + () => [ + { no: 1, name: "content", kind: "message", T: TreeNode, repeated: true }, + ], +); + +/** + * @generated from message yorkie.v1.TreeNodeID + */ +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 + */ +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 + */ +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 */ -proto.yorkie.v1.ChangePack.prototype.clearChangesList = function() { - return this.setChangesList([]); -}; - - -/** - * optional TimeTicket min_synced_ticket = 5; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.ChangePack.prototype.getMinSyncedTicket = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 5)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.ChangePack} returns this -*/ -proto.yorkie.v1.ChangePack.prototype.setMinSyncedTicket = function(value) { - return jspb.Message.setWrapperField(this, 5, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.ChangePack} returns this - */ -proto.yorkie.v1.ChangePack.prototype.clearMinSyncedTicket = function() { - return this.setMinSyncedTicket(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.ChangePack.prototype.hasMinSyncedTicket = function() { - return jspb.Message.getField(this, 5) != null; -}; - - -/** - * optional bool is_removed = 6; - * @return {boolean} - */ -proto.yorkie.v1.ChangePack.prototype.getIsRemoved = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.yorkie.v1.ChangePack} returns this - */ -proto.yorkie.v1.ChangePack.prototype.setIsRemoved = function(value) { - return jspb.Message.setProto3BooleanField(this, 6, value); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.Change.repeatedFields_ = [3]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Change.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Change.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Change} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Change.toObject = function(includeInstance, msg) { - var f, obj = { - id: (f = msg.getId()) && proto.yorkie.v1.ChangeID.toObject(includeInstance, f), - message: jspb.Message.getFieldWithDefault(msg, 2, ""), - operationsList: jspb.Message.toObjectList(msg.getOperationsList(), - proto.yorkie.v1.Operation.toObject, includeInstance), - presenceChange: (f = msg.getPresenceChange()) && proto.yorkie.v1.PresenceChange.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Change} - */ -proto.yorkie.v1.Change.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Change; - return proto.yorkie.v1.Change.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Change} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Change} - */ -proto.yorkie.v1.Change.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.ChangeID; - reader.readMessage(value,proto.yorkie.v1.ChangeID.deserializeBinaryFromReader); - msg.setId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setMessage(value); - break; - case 3: - var value = new proto.yorkie.v1.Operation; - reader.readMessage(value,proto.yorkie.v1.Operation.deserializeBinaryFromReader); - msg.addOperations(value); - break; - case 4: - var value = new proto.yorkie.v1.PresenceChange; - reader.readMessage(value,proto.yorkie.v1.PresenceChange.deserializeBinaryFromReader); - msg.setPresenceChange(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Change.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Change.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Change} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Change.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.ChangeID.serializeBinaryToWriter - ); - } - f = message.getMessage(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getOperationsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 3, - f, - proto.yorkie.v1.Operation.serializeBinaryToWriter - ); - } - f = message.getPresenceChange(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.PresenceChange.serializeBinaryToWriter - ); - } -}; - - -/** - * optional ChangeID id = 1; - * @return {?proto.yorkie.v1.ChangeID} - */ -proto.yorkie.v1.Change.prototype.getId = function() { - return /** @type{?proto.yorkie.v1.ChangeID} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.ChangeID, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.ChangeID|undefined} value - * @return {!proto.yorkie.v1.Change} returns this -*/ -proto.yorkie.v1.Change.prototype.setId = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Change} returns this - */ -proto.yorkie.v1.Change.prototype.clearId = function() { - return this.setId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Change.prototype.hasId = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional string message = 2; - * @return {string} - */ -proto.yorkie.v1.Change.prototype.getMessage = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Change} returns this - */ -proto.yorkie.v1.Change.prototype.setMessage = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * repeated Operation operations = 3; - * @return {!Array} - */ -proto.yorkie.v1.Change.prototype.getOperationsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.yorkie.v1.Operation, 3)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.Change} returns this -*/ -proto.yorkie.v1.Change.prototype.setOperationsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 3, value); -}; - - -/** - * @param {!proto.yorkie.v1.Operation=} opt_value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.Operation} - */ -proto.yorkie.v1.Change.prototype.addOperations = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.yorkie.v1.Operation, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.Change} returns this - */ -proto.yorkie.v1.Change.prototype.clearOperationsList = function() { - return this.setOperationsList([]); -}; - - -/** - * optional PresenceChange presence_change = 4; - * @return {?proto.yorkie.v1.PresenceChange} - */ -proto.yorkie.v1.Change.prototype.getPresenceChange = function() { - return /** @type{?proto.yorkie.v1.PresenceChange} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.PresenceChange, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.PresenceChange|undefined} value - * @return {!proto.yorkie.v1.Change} returns this -*/ -proto.yorkie.v1.Change.prototype.setPresenceChange = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Change} returns this - */ -proto.yorkie.v1.Change.prototype.clearPresenceChange = function() { - return this.setPresenceChange(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Change.prototype.hasPresenceChange = function() { - return jspb.Message.getField(this, 4) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.ChangeID.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.ChangeID.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.ChangeID} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.ChangeID.toObject = function(includeInstance, msg) { - var f, obj = { - clientSeq: jspb.Message.getFieldWithDefault(msg, 1, 0), - serverSeq: jspb.Message.getFieldWithDefault(msg, 2, "0"), - lamport: jspb.Message.getFieldWithDefault(msg, 3, "0"), - actorId: msg.getActorId_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.ChangeID} - */ -proto.yorkie.v1.ChangeID.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.ChangeID; - return proto.yorkie.v1.ChangeID.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.ChangeID} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.ChangeID} - */ -proto.yorkie.v1.ChangeID.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readUint32()); - msg.setClientSeq(value); - break; - case 2: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setServerSeq(value); - break; - case 3: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setLamport(value); - break; - case 4: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setActorId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.ChangeID.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.ChangeID.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.ChangeID} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.ChangeID.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientSeq(); - if (f !== 0) { - writer.writeUint32( - 1, - f - ); - } - f = message.getServerSeq(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 2, - f - ); - } - f = message.getLamport(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 3, - f - ); - } - f = message.getActorId_asU8(); - if (f.length > 0) { - writer.writeBytes( - 4, - f - ); - } -}; - - -/** - * optional uint32 client_seq = 1; - * @return {number} - */ -proto.yorkie.v1.ChangeID.prototype.getClientSeq = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.yorkie.v1.ChangeID} returns this - */ -proto.yorkie.v1.ChangeID.prototype.setClientSeq = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * optional int64 server_seq = 2; - * @return {string} - */ -proto.yorkie.v1.ChangeID.prototype.getServerSeq = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.ChangeID} returns this - */ -proto.yorkie.v1.ChangeID.prototype.setServerSeq = function(value) { - return jspb.Message.setProto3StringIntField(this, 2, value); -}; - - -/** - * optional int64 lamport = 3; - * @return {string} - */ -proto.yorkie.v1.ChangeID.prototype.getLamport = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.ChangeID} returns this - */ -proto.yorkie.v1.ChangeID.prototype.setLamport = function(value) { - return jspb.Message.setProto3StringIntField(this, 3, value); -}; - - -/** - * optional bytes actor_id = 4; - * @return {string} - */ -proto.yorkie.v1.ChangeID.prototype.getActorId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; - - -/** - * optional bytes actor_id = 4; - * This is a type-conversion wrapper around `getActorId()` - * @return {string} - */ -proto.yorkie.v1.ChangeID.prototype.getActorId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getActorId())); -}; - - -/** - * optional bytes actor_id = 4; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getActorId()` - * @return {!Uint8Array} - */ -proto.yorkie.v1.ChangeID.prototype.getActorId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getActorId())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.yorkie.v1.ChangeID} returns this - */ -proto.yorkie.v1.ChangeID.prototype.setActorId = function(value) { - return jspb.Message.setProto3BytesField(this, 4, value); -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.yorkie.v1.Operation.oneofGroups_ = [[1,2,3,4,5,6,7,8,9,10]]; - -/** - * @enum {number} - */ -proto.yorkie.v1.Operation.BodyCase = { - BODY_NOT_SET: 0, - SET: 1, - ADD: 2, - MOVE: 3, - REMOVE: 4, - EDIT: 5, - SELECT: 6, - STYLE: 7, - INCREASE: 8, - TREE_EDIT: 9, - TREE_STYLE: 10 -}; - -/** - * @return {proto.yorkie.v1.Operation.BodyCase} - */ -proto.yorkie.v1.Operation.prototype.getBodyCase = function() { - return /** @type {proto.yorkie.v1.Operation.BodyCase} */(jspb.Message.computeOneofCase(this, proto.yorkie.v1.Operation.oneofGroups_[0])); -}; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.toObject = function(includeInstance, msg) { - var f, obj = { - set: (f = msg.getSet()) && proto.yorkie.v1.Operation.Set.toObject(includeInstance, f), - add: (f = msg.getAdd()) && proto.yorkie.v1.Operation.Add.toObject(includeInstance, f), - move: (f = msg.getMove()) && proto.yorkie.v1.Operation.Move.toObject(includeInstance, f), - remove: (f = msg.getRemove()) && proto.yorkie.v1.Operation.Remove.toObject(includeInstance, f), - edit: (f = msg.getEdit()) && proto.yorkie.v1.Operation.Edit.toObject(includeInstance, f), - select: (f = msg.getSelect()) && proto.yorkie.v1.Operation.Select.toObject(includeInstance, f), - style: (f = msg.getStyle()) && proto.yorkie.v1.Operation.Style.toObject(includeInstance, f), - increase: (f = msg.getIncrease()) && proto.yorkie.v1.Operation.Increase.toObject(includeInstance, f), - treeEdit: (f = msg.getTreeEdit()) && proto.yorkie.v1.Operation.TreeEdit.toObject(includeInstance, f), - treeStyle: (f = msg.getTreeStyle()) && proto.yorkie.v1.Operation.TreeStyle.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation} - */ -proto.yorkie.v1.Operation.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation; - return proto.yorkie.v1.Operation.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation} - */ -proto.yorkie.v1.Operation.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.Operation.Set; - reader.readMessage(value,proto.yorkie.v1.Operation.Set.deserializeBinaryFromReader); - msg.setSet(value); - break; - case 2: - var value = new proto.yorkie.v1.Operation.Add; - reader.readMessage(value,proto.yorkie.v1.Operation.Add.deserializeBinaryFromReader); - msg.setAdd(value); - break; - case 3: - var value = new proto.yorkie.v1.Operation.Move; - reader.readMessage(value,proto.yorkie.v1.Operation.Move.deserializeBinaryFromReader); - msg.setMove(value); - break; - case 4: - var value = new proto.yorkie.v1.Operation.Remove; - reader.readMessage(value,proto.yorkie.v1.Operation.Remove.deserializeBinaryFromReader); - msg.setRemove(value); - break; - case 5: - var value = new proto.yorkie.v1.Operation.Edit; - reader.readMessage(value,proto.yorkie.v1.Operation.Edit.deserializeBinaryFromReader); - msg.setEdit(value); - break; - case 6: - var value = new proto.yorkie.v1.Operation.Select; - reader.readMessage(value,proto.yorkie.v1.Operation.Select.deserializeBinaryFromReader); - msg.setSelect(value); - break; - case 7: - var value = new proto.yorkie.v1.Operation.Style; - reader.readMessage(value,proto.yorkie.v1.Operation.Style.deserializeBinaryFromReader); - msg.setStyle(value); - break; - case 8: - var value = new proto.yorkie.v1.Operation.Increase; - reader.readMessage(value,proto.yorkie.v1.Operation.Increase.deserializeBinaryFromReader); - msg.setIncrease(value); - break; - case 9: - var value = new proto.yorkie.v1.Operation.TreeEdit; - reader.readMessage(value,proto.yorkie.v1.Operation.TreeEdit.deserializeBinaryFromReader); - msg.setTreeEdit(value); - break; - case 10: - var value = new proto.yorkie.v1.Operation.TreeStyle; - reader.readMessage(value,proto.yorkie.v1.Operation.TreeStyle.deserializeBinaryFromReader); - msg.setTreeStyle(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getSet(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.Operation.Set.serializeBinaryToWriter - ); - } - f = message.getAdd(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.Operation.Add.serializeBinaryToWriter - ); - } - f = message.getMove(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.Operation.Move.serializeBinaryToWriter - ); - } - f = message.getRemove(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.Operation.Remove.serializeBinaryToWriter - ); - } - f = message.getEdit(); - if (f != null) { - writer.writeMessage( - 5, - f, - proto.yorkie.v1.Operation.Edit.serializeBinaryToWriter - ); - } - f = message.getSelect(); - if (f != null) { - writer.writeMessage( - 6, - f, - proto.yorkie.v1.Operation.Select.serializeBinaryToWriter - ); - } - f = message.getStyle(); - if (f != null) { - writer.writeMessage( - 7, - f, - proto.yorkie.v1.Operation.Style.serializeBinaryToWriter - ); - } - f = message.getIncrease(); - if (f != null) { - writer.writeMessage( - 8, - f, - proto.yorkie.v1.Operation.Increase.serializeBinaryToWriter - ); - } - f = message.getTreeEdit(); - if (f != null) { - writer.writeMessage( - 9, - f, - proto.yorkie.v1.Operation.TreeEdit.serializeBinaryToWriter - ); - } - f = message.getTreeStyle(); - if (f != null) { - writer.writeMessage( - 10, - f, - proto.yorkie.v1.Operation.TreeStyle.serializeBinaryToWriter - ); - } -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.Set.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.Set.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.Set} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Set.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - key: jspb.Message.getFieldWithDefault(msg, 2, ""), - value: (f = msg.getValue()) && proto.yorkie.v1.JSONElementSimple.toObject(includeInstance, f), - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.Set} - */ -proto.yorkie.v1.Operation.Set.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.Set; - return proto.yorkie.v1.Operation.Set.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.Set} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.Set} - */ -proto.yorkie.v1.Operation.Set.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setKey(value); - break; - case 3: - var value = new proto.yorkie.v1.JSONElementSimple; - reader.readMessage(value,proto.yorkie.v1.JSONElementSimple.deserializeBinaryFromReader); - msg.setValue(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.Set.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.Set.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.Set} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Set.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getKey(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getValue(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.JSONElementSimple.serializeBinaryToWriter - ); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Set.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Set} returns this -*/ -proto.yorkie.v1.Operation.Set.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Set} returns this - */ -proto.yorkie.v1.Operation.Set.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Set.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional string key = 2; - * @return {string} - */ -proto.yorkie.v1.Operation.Set.prototype.getKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Operation.Set} returns this - */ -proto.yorkie.v1.Operation.Set.prototype.setKey = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional JSONElementSimple value = 3; - * @return {?proto.yorkie.v1.JSONElementSimple} - */ -proto.yorkie.v1.Operation.Set.prototype.getValue = function() { - return /** @type{?proto.yorkie.v1.JSONElementSimple} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElementSimple, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElementSimple|undefined} value - * @return {!proto.yorkie.v1.Operation.Set} returns this -*/ -proto.yorkie.v1.Operation.Set.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Set} returns this - */ -proto.yorkie.v1.Operation.Set.prototype.clearValue = function() { - return this.setValue(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Set.prototype.hasValue = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket executed_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Set.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Set} returns this -*/ -proto.yorkie.v1.Operation.Set.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Set} returns this - */ -proto.yorkie.v1.Operation.Set.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Set.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.Add.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.Add.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.Add} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Add.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - prevCreatedAt: (f = msg.getPrevCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - value: (f = msg.getValue()) && proto.yorkie.v1.JSONElementSimple.toObject(includeInstance, f), - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.Add} - */ -proto.yorkie.v1.Operation.Add.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.Add; - return proto.yorkie.v1.Operation.Add.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.Add} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.Add} - */ -proto.yorkie.v1.Operation.Add.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setPrevCreatedAt(value); - break; - case 3: - var value = new proto.yorkie.v1.JSONElementSimple; - reader.readMessage(value,proto.yorkie.v1.JSONElementSimple.deserializeBinaryFromReader); - msg.setValue(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.Add.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.Add.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.Add} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Add.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getPrevCreatedAt(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getValue(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.JSONElementSimple.serializeBinaryToWriter - ); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Add.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Add} returns this -*/ -proto.yorkie.v1.Operation.Add.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Add} returns this - */ -proto.yorkie.v1.Operation.Add.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Add.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TimeTicket prev_created_at = 2; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Add.prototype.getPrevCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Add} returns this -*/ -proto.yorkie.v1.Operation.Add.prototype.setPrevCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Add} returns this - */ -proto.yorkie.v1.Operation.Add.prototype.clearPrevCreatedAt = function() { - return this.setPrevCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Add.prototype.hasPrevCreatedAt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional JSONElementSimple value = 3; - * @return {?proto.yorkie.v1.JSONElementSimple} - */ -proto.yorkie.v1.Operation.Add.prototype.getValue = function() { - return /** @type{?proto.yorkie.v1.JSONElementSimple} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElementSimple, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElementSimple|undefined} value - * @return {!proto.yorkie.v1.Operation.Add} returns this -*/ -proto.yorkie.v1.Operation.Add.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Add} returns this - */ -proto.yorkie.v1.Operation.Add.prototype.clearValue = function() { - return this.setValue(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Add.prototype.hasValue = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket executed_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Add.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Add} returns this -*/ -proto.yorkie.v1.Operation.Add.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Add} returns this - */ -proto.yorkie.v1.Operation.Add.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Add.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.Move.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.Move.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.Move} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Move.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - prevCreatedAt: (f = msg.getPrevCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.Move} - */ -proto.yorkie.v1.Operation.Move.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.Move; - return proto.yorkie.v1.Operation.Move.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.Move} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.Move} - */ -proto.yorkie.v1.Operation.Move.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setPrevCreatedAt(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.Move.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.Move.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.Move} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Move.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getPrevCreatedAt(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Move.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Move} returns this -*/ -proto.yorkie.v1.Operation.Move.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Move} returns this - */ -proto.yorkie.v1.Operation.Move.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Move.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TimeTicket prev_created_at = 2; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Move.prototype.getPrevCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Move} returns this -*/ -proto.yorkie.v1.Operation.Move.prototype.setPrevCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Move} returns this - */ -proto.yorkie.v1.Operation.Move.prototype.clearPrevCreatedAt = function() { - return this.setPrevCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Move.prototype.hasPrevCreatedAt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TimeTicket created_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Move.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Move} returns this -*/ -proto.yorkie.v1.Operation.Move.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Move} returns this - */ -proto.yorkie.v1.Operation.Move.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Move.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket executed_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Move.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Move} returns this -*/ -proto.yorkie.v1.Operation.Move.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Move} returns this - */ -proto.yorkie.v1.Operation.Move.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Move.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.Remove.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.Remove.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.Remove} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Remove.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.Remove} - */ -proto.yorkie.v1.Operation.Remove.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.Remove; - return proto.yorkie.v1.Operation.Remove.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.Remove} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.Remove} - */ -proto.yorkie.v1.Operation.Remove.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.Remove.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.Remove.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.Remove} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Remove.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Remove.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Remove} returns this -*/ -proto.yorkie.v1.Operation.Remove.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Remove} returns this - */ -proto.yorkie.v1.Operation.Remove.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Remove.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TimeTicket created_at = 2; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Remove.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Remove} returns this -*/ -proto.yorkie.v1.Operation.Remove.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Remove} returns this - */ -proto.yorkie.v1.Operation.Remove.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Remove.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TimeTicket executed_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Remove.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Remove} returns this -*/ -proto.yorkie.v1.Operation.Remove.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Remove} returns this - */ -proto.yorkie.v1.Operation.Remove.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Remove.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.Edit.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.Edit.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.Edit} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Edit.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - from: (f = msg.getFrom()) && proto.yorkie.v1.TextNodePos.toObject(includeInstance, f), - to: (f = msg.getTo()) && proto.yorkie.v1.TextNodePos.toObject(includeInstance, f), - createdAtMapByActorMap: (f = msg.getCreatedAtMapByActorMap()) ? f.toObject(includeInstance, proto.yorkie.v1.TimeTicket.toObject) : [], - content: jspb.Message.getFieldWithDefault(msg, 5, ""), - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - attributesMap: (f = msg.getAttributesMap()) ? f.toObject(includeInstance, undefined) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.Edit} - */ -proto.yorkie.v1.Operation.Edit.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.Edit; - return proto.yorkie.v1.Operation.Edit.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.Edit} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.Edit} - */ -proto.yorkie.v1.Operation.Edit.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.TextNodePos; - reader.readMessage(value,proto.yorkie.v1.TextNodePos.deserializeBinaryFromReader); - msg.setFrom(value); - break; - case 3: - var value = new proto.yorkie.v1.TextNodePos; - reader.readMessage(value,proto.yorkie.v1.TextNodePos.deserializeBinaryFromReader); - msg.setTo(value); - break; - case 4: - var value = msg.getCreatedAtMapByActorMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader, "", new proto.yorkie.v1.TimeTicket()); - }); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.setContent(value); - break; - case 6: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - case 7: - var value = msg.getAttributesMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.Edit.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.Edit.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.Edit} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Edit.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getFrom(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TextNodePos.serializeBinaryToWriter - ); - } - f = message.getTo(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TextNodePos.serializeBinaryToWriter - ); - } - f = message.getCreatedAtMapByActorMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.yorkie.v1.TimeTicket.serializeBinaryToWriter); - } - f = message.getContent(); - if (f.length > 0) { - writer.writeString( - 5, - f - ); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 6, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getAttributesMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(7, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Edit.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Edit} returns this -*/ -proto.yorkie.v1.Operation.Edit.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Edit} returns this - */ -proto.yorkie.v1.Operation.Edit.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Edit.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TextNodePos from = 2; - * @return {?proto.yorkie.v1.TextNodePos} - */ -proto.yorkie.v1.Operation.Edit.prototype.getFrom = function() { - return /** @type{?proto.yorkie.v1.TextNodePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TextNodePos, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TextNodePos|undefined} value - * @return {!proto.yorkie.v1.Operation.Edit} returns this -*/ -proto.yorkie.v1.Operation.Edit.prototype.setFrom = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Edit} returns this - */ -proto.yorkie.v1.Operation.Edit.prototype.clearFrom = function() { - return this.setFrom(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Edit.prototype.hasFrom = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TextNodePos to = 3; - * @return {?proto.yorkie.v1.TextNodePos} - */ -proto.yorkie.v1.Operation.Edit.prototype.getTo = function() { - return /** @type{?proto.yorkie.v1.TextNodePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TextNodePos, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TextNodePos|undefined} value - * @return {!proto.yorkie.v1.Operation.Edit} returns this -*/ -proto.yorkie.v1.Operation.Edit.prototype.setTo = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Edit} returns this - */ -proto.yorkie.v1.Operation.Edit.prototype.clearTo = function() { - return this.setTo(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Edit.prototype.hasTo = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * map created_at_map_by_actor = 4; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.Operation.Edit.prototype.getCreatedAtMapByActorMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 4, opt_noLazyCreate, - proto.yorkie.v1.TimeTicket)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.Operation.Edit} returns this - */ -proto.yorkie.v1.Operation.Edit.prototype.clearCreatedAtMapByActorMap = function() { - this.getCreatedAtMapByActorMap().clear(); - return this; -}; - - -/** - * optional string content = 5; - * @return {string} - */ -proto.yorkie.v1.Operation.Edit.prototype.getContent = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Operation.Edit} returns this - */ -proto.yorkie.v1.Operation.Edit.prototype.setContent = function(value) { - return jspb.Message.setProto3StringField(this, 5, value); -}; - - -/** - * optional TimeTicket executed_at = 6; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Edit.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 6)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Edit} returns this -*/ -proto.yorkie.v1.Operation.Edit.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 6, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Edit} returns this - */ -proto.yorkie.v1.Operation.Edit.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Edit.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 6) != null; -}; - - -/** - * map attributes = 7; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.Operation.Edit.prototype.getAttributesMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 7, opt_noLazyCreate, - null)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.Operation.Edit} returns this - */ -proto.yorkie.v1.Operation.Edit.prototype.clearAttributesMap = function() { - this.getAttributesMap().clear(); - return this; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.Select.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.Select.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.Select} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Select.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - from: (f = msg.getFrom()) && proto.yorkie.v1.TextNodePos.toObject(includeInstance, f), - to: (f = msg.getTo()) && proto.yorkie.v1.TextNodePos.toObject(includeInstance, f), - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.Select} - */ -proto.yorkie.v1.Operation.Select.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.Select; - return proto.yorkie.v1.Operation.Select.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.Select} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.Select} - */ -proto.yorkie.v1.Operation.Select.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.TextNodePos; - reader.readMessage(value,proto.yorkie.v1.TextNodePos.deserializeBinaryFromReader); - msg.setFrom(value); - break; - case 3: - var value = new proto.yorkie.v1.TextNodePos; - reader.readMessage(value,proto.yorkie.v1.TextNodePos.deserializeBinaryFromReader); - msg.setTo(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.Select.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.Select.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.Select} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Select.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getFrom(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TextNodePos.serializeBinaryToWriter - ); - } - f = message.getTo(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TextNodePos.serializeBinaryToWriter - ); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Select.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Select} returns this -*/ -proto.yorkie.v1.Operation.Select.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Select} returns this - */ -proto.yorkie.v1.Operation.Select.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Select.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TextNodePos from = 2; - * @return {?proto.yorkie.v1.TextNodePos} - */ -proto.yorkie.v1.Operation.Select.prototype.getFrom = function() { - return /** @type{?proto.yorkie.v1.TextNodePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TextNodePos, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TextNodePos|undefined} value - * @return {!proto.yorkie.v1.Operation.Select} returns this -*/ -proto.yorkie.v1.Operation.Select.prototype.setFrom = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Select} returns this - */ -proto.yorkie.v1.Operation.Select.prototype.clearFrom = function() { - return this.setFrom(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Select.prototype.hasFrom = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TextNodePos to = 3; - * @return {?proto.yorkie.v1.TextNodePos} - */ -proto.yorkie.v1.Operation.Select.prototype.getTo = function() { - return /** @type{?proto.yorkie.v1.TextNodePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TextNodePos, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TextNodePos|undefined} value - * @return {!proto.yorkie.v1.Operation.Select} returns this -*/ -proto.yorkie.v1.Operation.Select.prototype.setTo = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Select} returns this - */ -proto.yorkie.v1.Operation.Select.prototype.clearTo = function() { - return this.setTo(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Select.prototype.hasTo = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket executed_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Select.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Select} returns this -*/ -proto.yorkie.v1.Operation.Select.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Select} returns this - */ -proto.yorkie.v1.Operation.Select.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Select.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.Style.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.Style.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.Style} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Style.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - from: (f = msg.getFrom()) && proto.yorkie.v1.TextNodePos.toObject(includeInstance, f), - to: (f = msg.getTo()) && proto.yorkie.v1.TextNodePos.toObject(includeInstance, f), - attributesMap: (f = msg.getAttributesMap()) ? f.toObject(includeInstance, undefined) : [], - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - createdAtMapByActorMap: (f = msg.getCreatedAtMapByActorMap()) ? f.toObject(includeInstance, proto.yorkie.v1.TimeTicket.toObject) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.Style} - */ -proto.yorkie.v1.Operation.Style.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.Style; - return proto.yorkie.v1.Operation.Style.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.Style} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.Style} - */ -proto.yorkie.v1.Operation.Style.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.TextNodePos; - reader.readMessage(value,proto.yorkie.v1.TextNodePos.deserializeBinaryFromReader); - msg.setFrom(value); - break; - case 3: - var value = new proto.yorkie.v1.TextNodePos; - reader.readMessage(value,proto.yorkie.v1.TextNodePos.deserializeBinaryFromReader); - msg.setTo(value); - break; - case 4: - var value = msg.getAttributesMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); - }); - break; - case 5: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - case 6: - var value = msg.getCreatedAtMapByActorMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader, "", new proto.yorkie.v1.TimeTicket()); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.Style.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.Style.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.Style} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Style.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getFrom(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TextNodePos.serializeBinaryToWriter - ); - } - f = message.getTo(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TextNodePos.serializeBinaryToWriter - ); - } - f = message.getAttributesMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 5, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getCreatedAtMapByActorMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(6, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.yorkie.v1.TimeTicket.serializeBinaryToWriter); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Style.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Style} returns this -*/ -proto.yorkie.v1.Operation.Style.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Style} returns this - */ -proto.yorkie.v1.Operation.Style.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Style.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TextNodePos from = 2; - * @return {?proto.yorkie.v1.TextNodePos} - */ -proto.yorkie.v1.Operation.Style.prototype.getFrom = function() { - return /** @type{?proto.yorkie.v1.TextNodePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TextNodePos, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TextNodePos|undefined} value - * @return {!proto.yorkie.v1.Operation.Style} returns this -*/ -proto.yorkie.v1.Operation.Style.prototype.setFrom = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Style} returns this - */ -proto.yorkie.v1.Operation.Style.prototype.clearFrom = function() { - return this.setFrom(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Style.prototype.hasFrom = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TextNodePos to = 3; - * @return {?proto.yorkie.v1.TextNodePos} - */ -proto.yorkie.v1.Operation.Style.prototype.getTo = function() { - return /** @type{?proto.yorkie.v1.TextNodePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TextNodePos, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TextNodePos|undefined} value - * @return {!proto.yorkie.v1.Operation.Style} returns this -*/ -proto.yorkie.v1.Operation.Style.prototype.setTo = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Style} returns this - */ -proto.yorkie.v1.Operation.Style.prototype.clearTo = function() { - return this.setTo(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Style.prototype.hasTo = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * map attributes = 4; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.Operation.Style.prototype.getAttributesMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 4, opt_noLazyCreate, - null)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.Operation.Style} returns this - */ -proto.yorkie.v1.Operation.Style.prototype.clearAttributesMap = function() { - this.getAttributesMap().clear(); - return this; -}; - - -/** - * optional TimeTicket executed_at = 5; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Style.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 5)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Style} returns this -*/ -proto.yorkie.v1.Operation.Style.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 5, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Style} returns this - */ -proto.yorkie.v1.Operation.Style.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Style.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 5) != null; -}; - - -/** - * map created_at_map_by_actor = 6; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.Operation.Style.prototype.getCreatedAtMapByActorMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 6, opt_noLazyCreate, - proto.yorkie.v1.TimeTicket)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.Operation.Style} returns this - */ -proto.yorkie.v1.Operation.Style.prototype.clearCreatedAtMapByActorMap = function() { - this.getCreatedAtMapByActorMap().clear(); - return this; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.Increase.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.Increase.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.Increase} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Increase.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - value: (f = msg.getValue()) && proto.yorkie.v1.JSONElementSimple.toObject(includeInstance, f), - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.Increase} - */ -proto.yorkie.v1.Operation.Increase.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.Increase; - return proto.yorkie.v1.Operation.Increase.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.Increase} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.Increase} - */ -proto.yorkie.v1.Operation.Increase.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.JSONElementSimple; - reader.readMessage(value,proto.yorkie.v1.JSONElementSimple.deserializeBinaryFromReader); - msg.setValue(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.Increase.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.Increase.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.Increase} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.Increase.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getValue(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.JSONElementSimple.serializeBinaryToWriter - ); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Increase.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Increase} returns this -*/ -proto.yorkie.v1.Operation.Increase.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Increase} returns this - */ -proto.yorkie.v1.Operation.Increase.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Increase.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional JSONElementSimple value = 2; - * @return {?proto.yorkie.v1.JSONElementSimple} - */ -proto.yorkie.v1.Operation.Increase.prototype.getValue = function() { - return /** @type{?proto.yorkie.v1.JSONElementSimple} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElementSimple, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElementSimple|undefined} value - * @return {!proto.yorkie.v1.Operation.Increase} returns this -*/ -proto.yorkie.v1.Operation.Increase.prototype.setValue = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Increase} returns this - */ -proto.yorkie.v1.Operation.Increase.prototype.clearValue = function() { - return this.setValue(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Increase.prototype.hasValue = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TimeTicket executed_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.Increase.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.Increase} returns this -*/ -proto.yorkie.v1.Operation.Increase.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.Increase} returns this - */ -proto.yorkie.v1.Operation.Increase.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.Increase.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.Operation.TreeEdit.repeatedFields_ = [5]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.TreeEdit.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.TreeEdit} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.TreeEdit.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - from: (f = msg.getFrom()) && proto.yorkie.v1.TreePos.toObject(includeInstance, f), - to: (f = msg.getTo()) && proto.yorkie.v1.TreePos.toObject(includeInstance, f), - createdAtMapByActorMap: (f = msg.getCreatedAtMapByActorMap()) ? f.toObject(includeInstance, proto.yorkie.v1.TimeTicket.toObject) : [], - contentsList: jspb.Message.toObjectList(msg.getContentsList(), - proto.yorkie.v1.TreeNodes.toObject, includeInstance), - splitLevel: jspb.Message.getFieldWithDefault(msg, 7, 0), - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.TreeEdit} - */ -proto.yorkie.v1.Operation.TreeEdit.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.TreeEdit; - return proto.yorkie.v1.Operation.TreeEdit.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.TreeEdit} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.TreeEdit} - */ -proto.yorkie.v1.Operation.TreeEdit.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.TreePos; - reader.readMessage(value,proto.yorkie.v1.TreePos.deserializeBinaryFromReader); - msg.setFrom(value); - break; - case 3: - var value = new proto.yorkie.v1.TreePos; - reader.readMessage(value,proto.yorkie.v1.TreePos.deserializeBinaryFromReader); - msg.setTo(value); - break; - case 4: - var value = msg.getCreatedAtMapByActorMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader, "", new proto.yorkie.v1.TimeTicket()); - }); - break; - case 5: - var value = new proto.yorkie.v1.TreeNodes; - reader.readMessage(value,proto.yorkie.v1.TreeNodes.deserializeBinaryFromReader); - msg.addContents(value); - break; - case 7: - var value = /** @type {number} */ (reader.readInt32()); - msg.setSplitLevel(value); - break; - case 6: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.TreeEdit.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.TreeEdit} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.TreeEdit.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getFrom(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TreePos.serializeBinaryToWriter - ); - } - f = message.getTo(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TreePos.serializeBinaryToWriter - ); - } - f = message.getCreatedAtMapByActorMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.yorkie.v1.TimeTicket.serializeBinaryToWriter); - } - f = message.getContentsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 5, - f, - proto.yorkie.v1.TreeNodes.serializeBinaryToWriter - ); - } - f = message.getSplitLevel(); - if (f !== 0) { - writer.writeInt32( - 7, - f - ); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 6, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this -*/ -proto.yorkie.v1.Operation.TreeEdit.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TreePos from = 2; - * @return {?proto.yorkie.v1.TreePos} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.getFrom = function() { - return /** @type{?proto.yorkie.v1.TreePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TreePos, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TreePos|undefined} value - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this -*/ -proto.yorkie.v1.Operation.TreeEdit.prototype.setFrom = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.clearFrom = function() { - return this.setFrom(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.hasFrom = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TreePos to = 3; - * @return {?proto.yorkie.v1.TreePos} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.getTo = function() { - return /** @type{?proto.yorkie.v1.TreePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TreePos, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TreePos|undefined} value - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this -*/ -proto.yorkie.v1.Operation.TreeEdit.prototype.setTo = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.clearTo = function() { - return this.setTo(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.hasTo = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * map created_at_map_by_actor = 4; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.getCreatedAtMapByActorMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 4, opt_noLazyCreate, - proto.yorkie.v1.TimeTicket)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.clearCreatedAtMapByActorMap = function() { - this.getCreatedAtMapByActorMap().clear(); - return this; -}; - - -/** - * repeated TreeNodes contents = 5; - * @return {!Array} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.getContentsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.yorkie.v1.TreeNodes, 5)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this -*/ -proto.yorkie.v1.Operation.TreeEdit.prototype.setContentsList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 5, value); -}; - - -/** - * @param {!proto.yorkie.v1.TreeNodes=} opt_value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.TreeNodes} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.addContents = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.yorkie.v1.TreeNodes, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.clearContentsList = function() { - return this.setContentsList([]); -}; - - -/** - * optional int32 split_level = 7; - * @return {number} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.getSplitLevel = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.setSplitLevel = function(value) { - return jspb.Message.setProto3IntField(this, 7, value); -}; - - -/** - * optional TimeTicket executed_at = 6; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 6)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this -*/ -proto.yorkie.v1.Operation.TreeEdit.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 6, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.TreeEdit} returns this - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.TreeEdit.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 6) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Operation.TreeStyle.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Operation.TreeStyle} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.TreeStyle.toObject = function(includeInstance, msg) { - var f, obj = { - parentCreatedAt: (f = msg.getParentCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - from: (f = msg.getFrom()) && proto.yorkie.v1.TreePos.toObject(includeInstance, f), - to: (f = msg.getTo()) && proto.yorkie.v1.TreePos.toObject(includeInstance, f), - attributesMap: (f = msg.getAttributesMap()) ? f.toObject(includeInstance, undefined) : [], - executedAt: (f = msg.getExecutedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Operation.TreeStyle} - */ -proto.yorkie.v1.Operation.TreeStyle.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Operation.TreeStyle; - return proto.yorkie.v1.Operation.TreeStyle.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Operation.TreeStyle} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Operation.TreeStyle} - */ -proto.yorkie.v1.Operation.TreeStyle.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setParentCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.TreePos; - reader.readMessage(value,proto.yorkie.v1.TreePos.deserializeBinaryFromReader); - msg.setFrom(value); - break; - case 3: - var value = new proto.yorkie.v1.TreePos; - reader.readMessage(value,proto.yorkie.v1.TreePos.deserializeBinaryFromReader); - msg.setTo(value); - break; - case 4: - var value = msg.getAttributesMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); - }); - break; - case 5: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setExecutedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Operation.TreeStyle.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Operation.TreeStyle} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Operation.TreeStyle.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getFrom(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TreePos.serializeBinaryToWriter - ); - } - f = message.getTo(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TreePos.serializeBinaryToWriter - ); - } - f = message.getAttributesMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); - } - f = message.getExecutedAt(); - if (f != null) { - writer.writeMessage( - 5, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TimeTicket parent_created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.getParentCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.TreeStyle} returns this -*/ -proto.yorkie.v1.Operation.TreeStyle.prototype.setParentCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.TreeStyle} returns this - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.clearParentCreatedAt = function() { - return this.setParentCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.hasParentCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TreePos from = 2; - * @return {?proto.yorkie.v1.TreePos} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.getFrom = function() { - return /** @type{?proto.yorkie.v1.TreePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TreePos, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TreePos|undefined} value - * @return {!proto.yorkie.v1.Operation.TreeStyle} returns this -*/ -proto.yorkie.v1.Operation.TreeStyle.prototype.setFrom = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.TreeStyle} returns this - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.clearFrom = function() { - return this.setFrom(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.hasFrom = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TreePos to = 3; - * @return {?proto.yorkie.v1.TreePos} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.getTo = function() { - return /** @type{?proto.yorkie.v1.TreePos} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TreePos, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TreePos|undefined} value - * @return {!proto.yorkie.v1.Operation.TreeStyle} returns this -*/ -proto.yorkie.v1.Operation.TreeStyle.prototype.setTo = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.TreeStyle} returns this - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.clearTo = function() { - return this.setTo(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.hasTo = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * map attributes = 4; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.getAttributesMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 4, opt_noLazyCreate, - null)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.Operation.TreeStyle} returns this - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.clearAttributesMap = function() { - this.getAttributesMap().clear(); - return this; -}; - - -/** - * optional TimeTicket executed_at = 5; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.getExecutedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 5)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.Operation.TreeStyle} returns this -*/ -proto.yorkie.v1.Operation.TreeStyle.prototype.setExecutedAt = function(value) { - return jspb.Message.setWrapperField(this, 5, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation.TreeStyle} returns this - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.clearExecutedAt = function() { - return this.setExecutedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.TreeStyle.prototype.hasExecutedAt = function() { - return jspb.Message.getField(this, 5) != null; -}; - - -/** - * optional Set set = 1; - * @return {?proto.yorkie.v1.Operation.Set} - */ -proto.yorkie.v1.Operation.prototype.getSet = function() { - return /** @type{?proto.yorkie.v1.Operation.Set} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.Set, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.Set|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setSet = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearSet = function() { - return this.setSet(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasSet = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional Add add = 2; - * @return {?proto.yorkie.v1.Operation.Add} - */ -proto.yorkie.v1.Operation.prototype.getAdd = function() { - return /** @type{?proto.yorkie.v1.Operation.Add} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.Add, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.Add|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setAdd = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearAdd = function() { - return this.setAdd(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasAdd = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional Move move = 3; - * @return {?proto.yorkie.v1.Operation.Move} - */ -proto.yorkie.v1.Operation.prototype.getMove = function() { - return /** @type{?proto.yorkie.v1.Operation.Move} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.Move, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.Move|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setMove = function(value) { - return jspb.Message.setOneofWrapperField(this, 3, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearMove = function() { - return this.setMove(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasMove = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional Remove remove = 4; - * @return {?proto.yorkie.v1.Operation.Remove} - */ -proto.yorkie.v1.Operation.prototype.getRemove = function() { - return /** @type{?proto.yorkie.v1.Operation.Remove} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.Remove, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.Remove|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setRemove = function(value) { - return jspb.Message.setOneofWrapperField(this, 4, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearRemove = function() { - return this.setRemove(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasRemove = function() { - return jspb.Message.getField(this, 4) != null; -}; - - -/** - * optional Edit edit = 5; - * @return {?proto.yorkie.v1.Operation.Edit} - */ -proto.yorkie.v1.Operation.prototype.getEdit = function() { - return /** @type{?proto.yorkie.v1.Operation.Edit} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.Edit, 5)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.Edit|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setEdit = function(value) { - return jspb.Message.setOneofWrapperField(this, 5, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearEdit = function() { - return this.setEdit(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasEdit = function() { - return jspb.Message.getField(this, 5) != null; -}; - - -/** - * optional Select select = 6; - * @return {?proto.yorkie.v1.Operation.Select} - */ -proto.yorkie.v1.Operation.prototype.getSelect = function() { - return /** @type{?proto.yorkie.v1.Operation.Select} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.Select, 6)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.Select|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setSelect = function(value) { - return jspb.Message.setOneofWrapperField(this, 6, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearSelect = function() { - return this.setSelect(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasSelect = function() { - return jspb.Message.getField(this, 6) != null; -}; - - -/** - * optional Style style = 7; - * @return {?proto.yorkie.v1.Operation.Style} - */ -proto.yorkie.v1.Operation.prototype.getStyle = function() { - return /** @type{?proto.yorkie.v1.Operation.Style} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.Style, 7)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.Style|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setStyle = function(value) { - return jspb.Message.setOneofWrapperField(this, 7, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearStyle = function() { - return this.setStyle(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasStyle = function() { - return jspb.Message.getField(this, 7) != null; -}; - - -/** - * optional Increase increase = 8; - * @return {?proto.yorkie.v1.Operation.Increase} - */ -proto.yorkie.v1.Operation.prototype.getIncrease = function() { - return /** @type{?proto.yorkie.v1.Operation.Increase} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.Increase, 8)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.Increase|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setIncrease = function(value) { - return jspb.Message.setOneofWrapperField(this, 8, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearIncrease = function() { - return this.setIncrease(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasIncrease = function() { - return jspb.Message.getField(this, 8) != null; -}; - - -/** - * optional TreeEdit tree_edit = 9; - * @return {?proto.yorkie.v1.Operation.TreeEdit} - */ -proto.yorkie.v1.Operation.prototype.getTreeEdit = function() { - return /** @type{?proto.yorkie.v1.Operation.TreeEdit} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.TreeEdit, 9)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.TreeEdit|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setTreeEdit = function(value) { - return jspb.Message.setOneofWrapperField(this, 9, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearTreeEdit = function() { - return this.setTreeEdit(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasTreeEdit = function() { - return jspb.Message.getField(this, 9) != null; -}; - - -/** - * optional TreeStyle tree_style = 10; - * @return {?proto.yorkie.v1.Operation.TreeStyle} - */ -proto.yorkie.v1.Operation.prototype.getTreeStyle = function() { - return /** @type{?proto.yorkie.v1.Operation.TreeStyle} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Operation.TreeStyle, 10)); -}; - - -/** - * @param {?proto.yorkie.v1.Operation.TreeStyle|undefined} value - * @return {!proto.yorkie.v1.Operation} returns this -*/ -proto.yorkie.v1.Operation.prototype.setTreeStyle = function(value) { - return jspb.Message.setOneofWrapperField(this, 10, proto.yorkie.v1.Operation.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Operation} returns this - */ -proto.yorkie.v1.Operation.prototype.clearTreeStyle = function() { - return this.setTreeStyle(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Operation.prototype.hasTreeStyle = function() { - return jspb.Message.getField(this, 10) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.JSONElementSimple.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.JSONElementSimple.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.JSONElementSimple} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElementSimple.toObject = function(includeInstance, msg) { - var f, obj = { - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - movedAt: (f = msg.getMovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - removedAt: (f = msg.getRemovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - type: jspb.Message.getFieldWithDefault(msg, 4, 0), - value: msg.getValue_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.JSONElementSimple} - */ -proto.yorkie.v1.JSONElementSimple.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.JSONElementSimple; - return proto.yorkie.v1.JSONElementSimple.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.JSONElementSimple} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.JSONElementSimple} - */ -proto.yorkie.v1.JSONElementSimple.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 2: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setMovedAt(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setRemovedAt(value); - break; - case 4: - var value = /** @type {!proto.yorkie.v1.ValueType} */ (reader.readEnum()); - msg.setType(value); - break; - case 5: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElementSimple.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.JSONElementSimple.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.JSONElementSimple} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElementSimple.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getMovedAt(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getRemovedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getType(); - if (f !== 0.0) { - writer.writeEnum( - 4, - f - ); - } - f = message.getValue_asU8(); - if (f.length > 0) { - writer.writeBytes( - 5, - f - ); - } -}; - - -/** - * optional TimeTicket created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElementSimple.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElementSimple} returns this -*/ -proto.yorkie.v1.JSONElementSimple.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElementSimple} returns this - */ -proto.yorkie.v1.JSONElementSimple.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElementSimple.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TimeTicket moved_at = 2; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElementSimple.prototype.getMovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElementSimple} returns this -*/ -proto.yorkie.v1.JSONElementSimple.prototype.setMovedAt = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElementSimple} returns this - */ -proto.yorkie.v1.JSONElementSimple.prototype.clearMovedAt = function() { - return this.setMovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElementSimple.prototype.hasMovedAt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TimeTicket removed_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElementSimple.prototype.getRemovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElementSimple} returns this -*/ -proto.yorkie.v1.JSONElementSimple.prototype.setRemovedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElementSimple} returns this - */ -proto.yorkie.v1.JSONElementSimple.prototype.clearRemovedAt = function() { - return this.setRemovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElementSimple.prototype.hasRemovedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional ValueType type = 4; - * @return {!proto.yorkie.v1.ValueType} - */ -proto.yorkie.v1.JSONElementSimple.prototype.getType = function() { - return /** @type {!proto.yorkie.v1.ValueType} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {!proto.yorkie.v1.ValueType} value - * @return {!proto.yorkie.v1.JSONElementSimple} returns this - */ -proto.yorkie.v1.JSONElementSimple.prototype.setType = function(value) { - return jspb.Message.setProto3EnumField(this, 4, value); -}; - - -/** - * optional bytes value = 5; - * @return {string} - */ -proto.yorkie.v1.JSONElementSimple.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); -}; - - -/** - * optional bytes value = 5; - * This is a type-conversion wrapper around `getValue()` - * @return {string} - */ -proto.yorkie.v1.JSONElementSimple.prototype.getValue_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); -}; - - -/** - * optional bytes value = 5; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElementSimple.prototype.getValue_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.yorkie.v1.JSONElementSimple} returns this - */ -proto.yorkie.v1.JSONElementSimple.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 5, value); -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.yorkie.v1.JSONElement.oneofGroups_ = [[1,2,3,5,6,7]]; - -/** - * @enum {number} - */ -proto.yorkie.v1.JSONElement.BodyCase = { - BODY_NOT_SET: 0, - JSON_OBJECT: 1, - JSON_ARRAY: 2, - PRIMITIVE: 3, - TEXT: 5, - COUNTER: 6, - TREE: 7 -}; - -/** - * @return {proto.yorkie.v1.JSONElement.BodyCase} - */ -proto.yorkie.v1.JSONElement.prototype.getBodyCase = function() { - return /** @type {proto.yorkie.v1.JSONElement.BodyCase} */(jspb.Message.computeOneofCase(this, proto.yorkie.v1.JSONElement.oneofGroups_[0])); -}; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.JSONElement.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.JSONElement.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.JSONElement} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.toObject = function(includeInstance, msg) { - var f, obj = { - jsonObject: (f = msg.getJsonObject()) && proto.yorkie.v1.JSONElement.JSONObject.toObject(includeInstance, f), - jsonArray: (f = msg.getJsonArray()) && proto.yorkie.v1.JSONElement.JSONArray.toObject(includeInstance, f), - primitive: (f = msg.getPrimitive()) && proto.yorkie.v1.JSONElement.Primitive.toObject(includeInstance, f), - text: (f = msg.getText()) && proto.yorkie.v1.JSONElement.Text.toObject(includeInstance, f), - counter: (f = msg.getCounter()) && proto.yorkie.v1.JSONElement.Counter.toObject(includeInstance, f), - tree: (f = msg.getTree()) && proto.yorkie.v1.JSONElement.Tree.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.JSONElement} - */ -proto.yorkie.v1.JSONElement.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.JSONElement; - return proto.yorkie.v1.JSONElement.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.JSONElement} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.JSONElement} - */ -proto.yorkie.v1.JSONElement.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.JSONElement.JSONObject; - reader.readMessage(value,proto.yorkie.v1.JSONElement.JSONObject.deserializeBinaryFromReader); - msg.setJsonObject(value); - break; - case 2: - var value = new proto.yorkie.v1.JSONElement.JSONArray; - reader.readMessage(value,proto.yorkie.v1.JSONElement.JSONArray.deserializeBinaryFromReader); - msg.setJsonArray(value); - break; - case 3: - var value = new proto.yorkie.v1.JSONElement.Primitive; - reader.readMessage(value,proto.yorkie.v1.JSONElement.Primitive.deserializeBinaryFromReader); - msg.setPrimitive(value); - break; - case 5: - var value = new proto.yorkie.v1.JSONElement.Text; - reader.readMessage(value,proto.yorkie.v1.JSONElement.Text.deserializeBinaryFromReader); - msg.setText(value); - break; - case 6: - var value = new proto.yorkie.v1.JSONElement.Counter; - reader.readMessage(value,proto.yorkie.v1.JSONElement.Counter.deserializeBinaryFromReader); - msg.setCounter(value); - break; - case 7: - var value = new proto.yorkie.v1.JSONElement.Tree; - reader.readMessage(value,proto.yorkie.v1.JSONElement.Tree.deserializeBinaryFromReader); - msg.setTree(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElement.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.JSONElement.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.JSONElement} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getJsonObject(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.JSONElement.JSONObject.serializeBinaryToWriter - ); - } - f = message.getJsonArray(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.JSONElement.JSONArray.serializeBinaryToWriter - ); - } - f = message.getPrimitive(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.JSONElement.Primitive.serializeBinaryToWriter - ); - } - f = message.getText(); - if (f != null) { - writer.writeMessage( - 5, - f, - proto.yorkie.v1.JSONElement.Text.serializeBinaryToWriter - ); - } - f = message.getCounter(); - if (f != null) { - writer.writeMessage( - 6, - f, - proto.yorkie.v1.JSONElement.Counter.serializeBinaryToWriter - ); - } - f = message.getTree(); - if (f != null) { - writer.writeMessage( - 7, - f, - proto.yorkie.v1.JSONElement.Tree.serializeBinaryToWriter - ); - } -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.JSONElement.JSONObject.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.JSONElement.JSONObject.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.JSONElement.JSONObject} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.JSONObject.toObject = function(includeInstance, msg) { - var f, obj = { - nodesList: jspb.Message.toObjectList(msg.getNodesList(), - proto.yorkie.v1.RHTNode.toObject, includeInstance), - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - movedAt: (f = msg.getMovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - removedAt: (f = msg.getRemovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.JSONElement.JSONObject} - */ -proto.yorkie.v1.JSONElement.JSONObject.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.JSONElement.JSONObject; - return proto.yorkie.v1.JSONElement.JSONObject.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.JSONElement.JSONObject} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.JSONElement.JSONObject} - */ -proto.yorkie.v1.JSONElement.JSONObject.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.RHTNode; - reader.readMessage(value,proto.yorkie.v1.RHTNode.deserializeBinaryFromReader); - msg.addNodes(value); - break; - case 2: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setMovedAt(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setRemovedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.JSONElement.JSONObject.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.JSONElement.JSONObject} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.JSONObject.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNodesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.yorkie.v1.RHTNode.serializeBinaryToWriter - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getMovedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getRemovedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated RHTNode nodes = 1; - * @return {!Array} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.getNodesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.yorkie.v1.RHTNode, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.JSONElement.JSONObject} returns this -*/ -proto.yorkie.v1.JSONElement.JSONObject.prototype.setNodesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.yorkie.v1.RHTNode=} opt_value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.RHTNode} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.addNodes = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.yorkie.v1.RHTNode, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.JSONElement.JSONObject} returns this - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.clearNodesList = function() { - return this.setNodesList([]); -}; - - -/** - * optional TimeTicket created_at = 2; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.JSONObject} returns this -*/ -proto.yorkie.v1.JSONElement.JSONObject.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.JSONObject} returns this - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TimeTicket moved_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.getMovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.JSONObject} returns this -*/ -proto.yorkie.v1.JSONElement.JSONObject.prototype.setMovedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.JSONObject} returns this - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.clearMovedAt = function() { - return this.setMovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.hasMovedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket removed_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.getRemovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.JSONObject} returns this -*/ -proto.yorkie.v1.JSONElement.JSONObject.prototype.setRemovedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.JSONObject} returns this - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.clearRemovedAt = function() { - return this.setRemovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.JSONObject.prototype.hasRemovedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.JSONElement.JSONArray.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.JSONElement.JSONArray.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.JSONElement.JSONArray} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.JSONArray.toObject = function(includeInstance, msg) { - var f, obj = { - nodesList: jspb.Message.toObjectList(msg.getNodesList(), - proto.yorkie.v1.RGANode.toObject, includeInstance), - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - movedAt: (f = msg.getMovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - removedAt: (f = msg.getRemovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.JSONElement.JSONArray} - */ -proto.yorkie.v1.JSONElement.JSONArray.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.JSONElement.JSONArray; - return proto.yorkie.v1.JSONElement.JSONArray.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.JSONElement.JSONArray} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.JSONElement.JSONArray} - */ -proto.yorkie.v1.JSONElement.JSONArray.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.RGANode; - reader.readMessage(value,proto.yorkie.v1.RGANode.deserializeBinaryFromReader); - msg.addNodes(value); - break; - case 2: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setMovedAt(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setRemovedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.JSONElement.JSONArray.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.JSONElement.JSONArray} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.JSONArray.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNodesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.yorkie.v1.RGANode.serializeBinaryToWriter - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getMovedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getRemovedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated RGANode nodes = 1; - * @return {!Array} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.getNodesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.yorkie.v1.RGANode, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.JSONElement.JSONArray} returns this -*/ -proto.yorkie.v1.JSONElement.JSONArray.prototype.setNodesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.yorkie.v1.RGANode=} opt_value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.RGANode} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.addNodes = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.yorkie.v1.RGANode, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.JSONElement.JSONArray} returns this - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.clearNodesList = function() { - return this.setNodesList([]); -}; - - -/** - * optional TimeTicket created_at = 2; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.JSONArray} returns this -*/ -proto.yorkie.v1.JSONElement.JSONArray.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.JSONArray} returns this - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TimeTicket moved_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.getMovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.JSONArray} returns this -*/ -proto.yorkie.v1.JSONElement.JSONArray.prototype.setMovedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.JSONArray} returns this - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.clearMovedAt = function() { - return this.setMovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.hasMovedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket removed_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.getRemovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.JSONArray} returns this -*/ -proto.yorkie.v1.JSONElement.JSONArray.prototype.setRemovedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.JSONArray} returns this - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.clearRemovedAt = function() { - return this.setRemovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.JSONArray.prototype.hasRemovedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.JSONElement.Primitive.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.JSONElement.Primitive} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.Primitive.toObject = function(includeInstance, msg) { - var f, obj = { - type: jspb.Message.getFieldWithDefault(msg, 1, 0), - value: msg.getValue_asB64(), - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - movedAt: (f = msg.getMovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - removedAt: (f = msg.getRemovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.JSONElement.Primitive} - */ -proto.yorkie.v1.JSONElement.Primitive.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.JSONElement.Primitive; - return proto.yorkie.v1.JSONElement.Primitive.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.JSONElement.Primitive} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.JSONElement.Primitive} - */ -proto.yorkie.v1.JSONElement.Primitive.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!proto.yorkie.v1.ValueType} */ (reader.readEnum()); - msg.setType(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setMovedAt(value); - break; - case 5: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setRemovedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.JSONElement.Primitive.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.JSONElement.Primitive} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.Primitive.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getType(); - if (f !== 0.0) { - writer.writeEnum( - 1, - f - ); - } - f = message.getValue_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getMovedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getRemovedAt(); - if (f != null) { - writer.writeMessage( - 5, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional ValueType type = 1; - * @return {!proto.yorkie.v1.ValueType} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.getType = function() { - return /** @type {!proto.yorkie.v1.ValueType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.yorkie.v1.ValueType} value - * @return {!proto.yorkie.v1.JSONElement.Primitive} returns this - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.setType = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional bytes value = 2; - * @return {string} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes value = 2; - * This is a type-conversion wrapper around `getValue()` - * @return {string} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.getValue_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); -}; - - -/** - * optional bytes value = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.getValue_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.yorkie.v1.JSONElement.Primitive} returns this - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; - - -/** - * optional TimeTicket created_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Primitive} returns this -*/ -proto.yorkie.v1.JSONElement.Primitive.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Primitive} returns this - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket moved_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.getMovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Primitive} returns this -*/ -proto.yorkie.v1.JSONElement.Primitive.prototype.setMovedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Primitive} returns this - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.clearMovedAt = function() { - return this.setMovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.hasMovedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - -/** - * optional TimeTicket removed_at = 5; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.getRemovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 5)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Primitive} returns this -*/ -proto.yorkie.v1.JSONElement.Primitive.prototype.setRemovedAt = function(value) { - return jspb.Message.setWrapperField(this, 5, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Primitive} returns this - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.clearRemovedAt = function() { - return this.setRemovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Primitive.prototype.hasRemovedAt = function() { - return jspb.Message.getField(this, 5) != null; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.JSONElement.Text.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.JSONElement.Text.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.JSONElement.Text.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.JSONElement.Text} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.Text.toObject = function(includeInstance, msg) { - var f, obj = { - nodesList: jspb.Message.toObjectList(msg.getNodesList(), - proto.yorkie.v1.TextNode.toObject, includeInstance), - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - movedAt: (f = msg.getMovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - removedAt: (f = msg.getRemovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.JSONElement.Text} - */ -proto.yorkie.v1.JSONElement.Text.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.JSONElement.Text; - return proto.yorkie.v1.JSONElement.Text.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.JSONElement.Text} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.JSONElement.Text} - */ -proto.yorkie.v1.JSONElement.Text.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TextNode; - reader.readMessage(value,proto.yorkie.v1.TextNode.deserializeBinaryFromReader); - msg.addNodes(value); - break; - case 2: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setMovedAt(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setRemovedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElement.Text.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.JSONElement.Text.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.JSONElement.Text} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.Text.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNodesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.yorkie.v1.TextNode.serializeBinaryToWriter - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getMovedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getRemovedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated TextNode nodes = 1; - * @return {!Array} - */ -proto.yorkie.v1.JSONElement.Text.prototype.getNodesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.yorkie.v1.TextNode, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.JSONElement.Text} returns this -*/ -proto.yorkie.v1.JSONElement.Text.prototype.setNodesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.yorkie.v1.TextNode=} opt_value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.TextNode} - */ -proto.yorkie.v1.JSONElement.Text.prototype.addNodes = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.yorkie.v1.TextNode, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.JSONElement.Text} returns this - */ -proto.yorkie.v1.JSONElement.Text.prototype.clearNodesList = function() { - return this.setNodesList([]); -}; - - -/** - * optional TimeTicket created_at = 2; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Text.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Text} returns this -*/ -proto.yorkie.v1.JSONElement.Text.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Text} returns this - */ -proto.yorkie.v1.JSONElement.Text.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Text.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TimeTicket moved_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Text.prototype.getMovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Text} returns this -*/ -proto.yorkie.v1.JSONElement.Text.prototype.setMovedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Text} returns this - */ -proto.yorkie.v1.JSONElement.Text.prototype.clearMovedAt = function() { - return this.setMovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Text.prototype.hasMovedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket removed_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Text.prototype.getRemovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Text} returns this -*/ -proto.yorkie.v1.JSONElement.Text.prototype.setRemovedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Text} returns this - */ -proto.yorkie.v1.JSONElement.Text.prototype.clearRemovedAt = function() { - return this.setRemovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Text.prototype.hasRemovedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.JSONElement.Counter.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.JSONElement.Counter} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.Counter.toObject = function(includeInstance, msg) { - var f, obj = { - type: jspb.Message.getFieldWithDefault(msg, 1, 0), - value: msg.getValue_asB64(), - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - movedAt: (f = msg.getMovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - removedAt: (f = msg.getRemovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.JSONElement.Counter} - */ -proto.yorkie.v1.JSONElement.Counter.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.JSONElement.Counter; - return proto.yorkie.v1.JSONElement.Counter.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.JSONElement.Counter} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.JSONElement.Counter} - */ -proto.yorkie.v1.JSONElement.Counter.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!proto.yorkie.v1.ValueType} */ (reader.readEnum()); - msg.setType(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setValue(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setMovedAt(value); - break; - case 5: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setRemovedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.JSONElement.Counter.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.JSONElement.Counter} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.Counter.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getType(); - if (f !== 0.0) { - writer.writeEnum( - 1, - f - ); - } - f = message.getValue_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getMovedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getRemovedAt(); - if (f != null) { - writer.writeMessage( - 5, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional ValueType type = 1; - * @return {!proto.yorkie.v1.ValueType} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.getType = function() { - return /** @type {!proto.yorkie.v1.ValueType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.yorkie.v1.ValueType} value - * @return {!proto.yorkie.v1.JSONElement.Counter} returns this - */ -proto.yorkie.v1.JSONElement.Counter.prototype.setType = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional bytes value = 2; - * @return {string} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes value = 2; - * This is a type-conversion wrapper around `getValue()` - * @return {string} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.getValue_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getValue())); -}; - - -/** - * optional bytes value = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getValue()` - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.getValue_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getValue())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.yorkie.v1.JSONElement.Counter} returns this - */ -proto.yorkie.v1.JSONElement.Counter.prototype.setValue = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; - - -/** - * optional TimeTicket created_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Counter} returns this -*/ -proto.yorkie.v1.JSONElement.Counter.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Counter} returns this - */ -proto.yorkie.v1.JSONElement.Counter.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket moved_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.getMovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Counter} returns this -*/ -proto.yorkie.v1.JSONElement.Counter.prototype.setMovedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Counter} returns this - */ -proto.yorkie.v1.JSONElement.Counter.prototype.clearMovedAt = function() { - return this.setMovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.hasMovedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - -/** - * optional TimeTicket removed_at = 5; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.getRemovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 5)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Counter} returns this -*/ -proto.yorkie.v1.JSONElement.Counter.prototype.setRemovedAt = function(value) { - return jspb.Message.setWrapperField(this, 5, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Counter} returns this - */ -proto.yorkie.v1.JSONElement.Counter.prototype.clearRemovedAt = function() { - return this.setRemovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Counter.prototype.hasRemovedAt = function() { - return jspb.Message.getField(this, 5) != null; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.JSONElement.Tree.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.JSONElement.Tree.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.JSONElement.Tree} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.Tree.toObject = function(includeInstance, msg) { - var f, obj = { - nodesList: jspb.Message.toObjectList(msg.getNodesList(), - proto.yorkie.v1.TreeNode.toObject, includeInstance), - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - movedAt: (f = msg.getMovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - removedAt: (f = msg.getRemovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.JSONElement.Tree} - */ -proto.yorkie.v1.JSONElement.Tree.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.JSONElement.Tree; - return proto.yorkie.v1.JSONElement.Tree.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.JSONElement.Tree} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.JSONElement.Tree} - */ -proto.yorkie.v1.JSONElement.Tree.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TreeNode; - reader.readMessage(value,proto.yorkie.v1.TreeNode.deserializeBinaryFromReader); - msg.addNodes(value); - break; - case 2: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setMovedAt(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setRemovedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.JSONElement.Tree.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.JSONElement.Tree} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.JSONElement.Tree.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNodesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.yorkie.v1.TreeNode.serializeBinaryToWriter - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getMovedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getRemovedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated TreeNode nodes = 1; - * @return {!Array} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.getNodesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.yorkie.v1.TreeNode, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.JSONElement.Tree} returns this -*/ -proto.yorkie.v1.JSONElement.Tree.prototype.setNodesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.yorkie.v1.TreeNode=} opt_value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.TreeNode} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.addNodes = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.yorkie.v1.TreeNode, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.JSONElement.Tree} returns this - */ -proto.yorkie.v1.JSONElement.Tree.prototype.clearNodesList = function() { - return this.setNodesList([]); -}; - - -/** - * optional TimeTicket created_at = 2; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Tree} returns this -*/ -proto.yorkie.v1.JSONElement.Tree.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Tree} returns this - */ -proto.yorkie.v1.JSONElement.Tree.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional TimeTicket moved_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.getMovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Tree} returns this -*/ -proto.yorkie.v1.JSONElement.Tree.prototype.setMovedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Tree} returns this - */ -proto.yorkie.v1.JSONElement.Tree.prototype.clearMovedAt = function() { - return this.setMovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.hasMovedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TimeTicket removed_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.getRemovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.JSONElement.Tree} returns this -*/ -proto.yorkie.v1.JSONElement.Tree.prototype.setRemovedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement.Tree} returns this - */ -proto.yorkie.v1.JSONElement.Tree.prototype.clearRemovedAt = function() { - return this.setRemovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.Tree.prototype.hasRemovedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - -/** - * optional JSONObject json_object = 1; - * @return {?proto.yorkie.v1.JSONElement.JSONObject} - */ -proto.yorkie.v1.JSONElement.prototype.getJsonObject = function() { - return /** @type{?proto.yorkie.v1.JSONElement.JSONObject} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElement.JSONObject, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElement.JSONObject|undefined} value - * @return {!proto.yorkie.v1.JSONElement} returns this -*/ -proto.yorkie.v1.JSONElement.prototype.setJsonObject = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.yorkie.v1.JSONElement.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement} returns this - */ -proto.yorkie.v1.JSONElement.prototype.clearJsonObject = function() { - return this.setJsonObject(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.prototype.hasJsonObject = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional JSONArray json_array = 2; - * @return {?proto.yorkie.v1.JSONElement.JSONArray} - */ -proto.yorkie.v1.JSONElement.prototype.getJsonArray = function() { - return /** @type{?proto.yorkie.v1.JSONElement.JSONArray} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElement.JSONArray, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElement.JSONArray|undefined} value - * @return {!proto.yorkie.v1.JSONElement} returns this -*/ -proto.yorkie.v1.JSONElement.prototype.setJsonArray = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.yorkie.v1.JSONElement.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement} returns this - */ -proto.yorkie.v1.JSONElement.prototype.clearJsonArray = function() { - return this.setJsonArray(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.prototype.hasJsonArray = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional Primitive primitive = 3; - * @return {?proto.yorkie.v1.JSONElement.Primitive} - */ -proto.yorkie.v1.JSONElement.prototype.getPrimitive = function() { - return /** @type{?proto.yorkie.v1.JSONElement.Primitive} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElement.Primitive, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElement.Primitive|undefined} value - * @return {!proto.yorkie.v1.JSONElement} returns this -*/ -proto.yorkie.v1.JSONElement.prototype.setPrimitive = function(value) { - return jspb.Message.setOneofWrapperField(this, 3, proto.yorkie.v1.JSONElement.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement} returns this - */ -proto.yorkie.v1.JSONElement.prototype.clearPrimitive = function() { - return this.setPrimitive(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.prototype.hasPrimitive = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional Text text = 5; - * @return {?proto.yorkie.v1.JSONElement.Text} - */ -proto.yorkie.v1.JSONElement.prototype.getText = function() { - return /** @type{?proto.yorkie.v1.JSONElement.Text} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElement.Text, 5)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElement.Text|undefined} value - * @return {!proto.yorkie.v1.JSONElement} returns this -*/ -proto.yorkie.v1.JSONElement.prototype.setText = function(value) { - return jspb.Message.setOneofWrapperField(this, 5, proto.yorkie.v1.JSONElement.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement} returns this - */ -proto.yorkie.v1.JSONElement.prototype.clearText = function() { - return this.setText(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.prototype.hasText = function() { - return jspb.Message.getField(this, 5) != null; -}; - - -/** - * optional Counter counter = 6; - * @return {?proto.yorkie.v1.JSONElement.Counter} - */ -proto.yorkie.v1.JSONElement.prototype.getCounter = function() { - return /** @type{?proto.yorkie.v1.JSONElement.Counter} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElement.Counter, 6)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElement.Counter|undefined} value - * @return {!proto.yorkie.v1.JSONElement} returns this -*/ -proto.yorkie.v1.JSONElement.prototype.setCounter = function(value) { - return jspb.Message.setOneofWrapperField(this, 6, proto.yorkie.v1.JSONElement.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement} returns this - */ -proto.yorkie.v1.JSONElement.prototype.clearCounter = function() { - return this.setCounter(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.prototype.hasCounter = function() { - return jspb.Message.getField(this, 6) != null; -}; - - -/** - * optional Tree tree = 7; - * @return {?proto.yorkie.v1.JSONElement.Tree} - */ -proto.yorkie.v1.JSONElement.prototype.getTree = function() { - return /** @type{?proto.yorkie.v1.JSONElement.Tree} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElement.Tree, 7)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElement.Tree|undefined} value - * @return {!proto.yorkie.v1.JSONElement} returns this -*/ -proto.yorkie.v1.JSONElement.prototype.setTree = function(value) { - return jspb.Message.setOneofWrapperField(this, 7, proto.yorkie.v1.JSONElement.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.JSONElement} returns this - */ -proto.yorkie.v1.JSONElement.prototype.clearTree = function() { - return this.setTree(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.JSONElement.prototype.hasTree = function() { - return jspb.Message.getField(this, 7) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.RHTNode.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.RHTNode.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.RHTNode} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.RHTNode.toObject = function(includeInstance, msg) { - var f, obj = { - key: jspb.Message.getFieldWithDefault(msg, 1, ""), - element: (f = msg.getElement()) && proto.yorkie.v1.JSONElement.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.RHTNode} - */ -proto.yorkie.v1.RHTNode.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.RHTNode; - return proto.yorkie.v1.RHTNode.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.RHTNode} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.RHTNode} - */ -proto.yorkie.v1.RHTNode.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setKey(value); - break; - case 2: - var value = new proto.yorkie.v1.JSONElement; - reader.readMessage(value,proto.yorkie.v1.JSONElement.deserializeBinaryFromReader); - msg.setElement(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.RHTNode.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.RHTNode.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.RHTNode} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.RHTNode.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getKey(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getElement(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.JSONElement.serializeBinaryToWriter - ); - } -}; - - -/** - * optional string key = 1; - * @return {string} - */ -proto.yorkie.v1.RHTNode.prototype.getKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.RHTNode} returns this - */ -proto.yorkie.v1.RHTNode.prototype.setKey = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional JSONElement element = 2; - * @return {?proto.yorkie.v1.JSONElement} - */ -proto.yorkie.v1.RHTNode.prototype.getElement = function() { - return /** @type{?proto.yorkie.v1.JSONElement} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElement, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElement|undefined} value - * @return {!proto.yorkie.v1.RHTNode} returns this -*/ -proto.yorkie.v1.RHTNode.prototype.setElement = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.RHTNode} returns this - */ -proto.yorkie.v1.RHTNode.prototype.clearElement = function() { - return this.setElement(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.RHTNode.prototype.hasElement = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.RGANode.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.RGANode.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.RGANode} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.RGANode.toObject = function(includeInstance, msg) { - var f, obj = { - next: (f = msg.getNext()) && proto.yorkie.v1.RGANode.toObject(includeInstance, f), - element: (f = msg.getElement()) && proto.yorkie.v1.JSONElement.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.RGANode} - */ -proto.yorkie.v1.RGANode.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.RGANode; - return proto.yorkie.v1.RGANode.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.RGANode} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.RGANode} - */ -proto.yorkie.v1.RGANode.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.RGANode; - reader.readMessage(value,proto.yorkie.v1.RGANode.deserializeBinaryFromReader); - msg.setNext(value); - break; - case 2: - var value = new proto.yorkie.v1.JSONElement; - reader.readMessage(value,proto.yorkie.v1.JSONElement.deserializeBinaryFromReader); - msg.setElement(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.RGANode.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.RGANode.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.RGANode} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.RGANode.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getNext(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.RGANode.serializeBinaryToWriter - ); - } - f = message.getElement(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.JSONElement.serializeBinaryToWriter - ); - } -}; - - -/** - * optional RGANode next = 1; - * @return {?proto.yorkie.v1.RGANode} - */ -proto.yorkie.v1.RGANode.prototype.getNext = function() { - return /** @type{?proto.yorkie.v1.RGANode} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.RGANode, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.RGANode|undefined} value - * @return {!proto.yorkie.v1.RGANode} returns this -*/ -proto.yorkie.v1.RGANode.prototype.setNext = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.RGANode} returns this - */ -proto.yorkie.v1.RGANode.prototype.clearNext = function() { - return this.setNext(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.RGANode.prototype.hasNext = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional JSONElement element = 2; - * @return {?proto.yorkie.v1.JSONElement} - */ -proto.yorkie.v1.RGANode.prototype.getElement = function() { - return /** @type{?proto.yorkie.v1.JSONElement} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.JSONElement, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.JSONElement|undefined} value - * @return {!proto.yorkie.v1.RGANode} returns this -*/ -proto.yorkie.v1.RGANode.prototype.setElement = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.RGANode} returns this - */ -proto.yorkie.v1.RGANode.prototype.clearElement = function() { - return this.setElement(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.RGANode.prototype.hasElement = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.NodeAttr.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.NodeAttr.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.NodeAttr} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.NodeAttr.toObject = function(includeInstance, msg) { - var f, obj = { - value: jspb.Message.getFieldWithDefault(msg, 1, ""), - updatedAt: (f = msg.getUpdatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.NodeAttr} - */ -proto.yorkie.v1.NodeAttr.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.NodeAttr; - return proto.yorkie.v1.NodeAttr.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.NodeAttr} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.NodeAttr} - */ -proto.yorkie.v1.NodeAttr.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setValue(value); - break; - case 2: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setUpdatedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.NodeAttr.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.NodeAttr.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.NodeAttr} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.NodeAttr.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getValue(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getUpdatedAt(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } -}; - - -/** - * optional string value = 1; - * @return {string} - */ -proto.yorkie.v1.NodeAttr.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.NodeAttr} returns this - */ -proto.yorkie.v1.NodeAttr.prototype.setValue = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional TimeTicket updated_at = 2; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.NodeAttr.prototype.getUpdatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.NodeAttr} returns this -*/ -proto.yorkie.v1.NodeAttr.prototype.setUpdatedAt = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.NodeAttr} returns this - */ -proto.yorkie.v1.NodeAttr.prototype.clearUpdatedAt = function() { - return this.setUpdatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.NodeAttr.prototype.hasUpdatedAt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.TextNode.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.TextNode.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.TextNode} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TextNode.toObject = function(includeInstance, msg) { - var f, obj = { - id: (f = msg.getId()) && proto.yorkie.v1.TextNodeID.toObject(includeInstance, f), - value: jspb.Message.getFieldWithDefault(msg, 2, ""), - removedAt: (f = msg.getRemovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - insPrevId: (f = msg.getInsPrevId()) && proto.yorkie.v1.TextNodeID.toObject(includeInstance, f), - attributesMap: (f = msg.getAttributesMap()) ? f.toObject(includeInstance, proto.yorkie.v1.NodeAttr.toObject) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.TextNode} - */ -proto.yorkie.v1.TextNode.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.TextNode; - return proto.yorkie.v1.TextNode.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.TextNode} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.TextNode} - */ -proto.yorkie.v1.TextNode.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TextNodeID; - reader.readMessage(value,proto.yorkie.v1.TextNodeID.deserializeBinaryFromReader); - msg.setId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setValue(value); - break; - case 3: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setRemovedAt(value); - break; - case 4: - var value = new proto.yorkie.v1.TextNodeID; - reader.readMessage(value,proto.yorkie.v1.TextNodeID.deserializeBinaryFromReader); - msg.setInsPrevId(value); - break; - case 5: - var value = msg.getAttributesMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.yorkie.v1.NodeAttr.deserializeBinaryFromReader, "", new proto.yorkie.v1.NodeAttr()); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.TextNode.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.TextNode.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.TextNode} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TextNode.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TextNodeID.serializeBinaryToWriter - ); - } - f = message.getValue(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getRemovedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getInsPrevId(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TextNodeID.serializeBinaryToWriter - ); - } - f = message.getAttributesMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.yorkie.v1.NodeAttr.serializeBinaryToWriter); - } -}; - - -/** - * optional TextNodeID id = 1; - * @return {?proto.yorkie.v1.TextNodeID} - */ -proto.yorkie.v1.TextNode.prototype.getId = function() { - return /** @type{?proto.yorkie.v1.TextNodeID} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TextNodeID, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TextNodeID|undefined} value - * @return {!proto.yorkie.v1.TextNode} returns this -*/ -proto.yorkie.v1.TextNode.prototype.setId = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TextNode} returns this - */ -proto.yorkie.v1.TextNode.prototype.clearId = function() { - return this.setId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TextNode.prototype.hasId = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional string value = 2; - * @return {string} - */ -proto.yorkie.v1.TextNode.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.TextNode} returns this - */ -proto.yorkie.v1.TextNode.prototype.setValue = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional TimeTicket removed_at = 3; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.TextNode.prototype.getRemovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.TextNode} returns this -*/ -proto.yorkie.v1.TextNode.prototype.setRemovedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TextNode} returns this - */ -proto.yorkie.v1.TextNode.prototype.clearRemovedAt = function() { - return this.setRemovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TextNode.prototype.hasRemovedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional TextNodeID ins_prev_id = 4; - * @return {?proto.yorkie.v1.TextNodeID} - */ -proto.yorkie.v1.TextNode.prototype.getInsPrevId = function() { - return /** @type{?proto.yorkie.v1.TextNodeID} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TextNodeID, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TextNodeID|undefined} value - * @return {!proto.yorkie.v1.TextNode} returns this -*/ -proto.yorkie.v1.TextNode.prototype.setInsPrevId = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TextNode} returns this - */ -proto.yorkie.v1.TextNode.prototype.clearInsPrevId = function() { - return this.setInsPrevId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TextNode.prototype.hasInsPrevId = function() { - return jspb.Message.getField(this, 4) != null; -}; - - -/** - * map attributes = 5; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.TextNode.prototype.getAttributesMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 5, opt_noLazyCreate, - proto.yorkie.v1.NodeAttr)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.TextNode} returns this - */ -proto.yorkie.v1.TextNode.prototype.clearAttributesMap = function() { - this.getAttributesMap().clear(); - return this; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.TextNodeID.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.TextNodeID.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.TextNodeID} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TextNodeID.toObject = function(includeInstance, msg) { - var f, obj = { - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - offset: jspb.Message.getFieldWithDefault(msg, 2, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.TextNodeID} - */ -proto.yorkie.v1.TextNodeID.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.TextNodeID; - return proto.yorkie.v1.TextNodeID.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.TextNodeID} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.TextNodeID} - */ -proto.yorkie.v1.TextNodeID.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt32()); - msg.setOffset(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.TextNodeID.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.TextNodeID.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.TextNodeID} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TextNodeID.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getOffset(); - if (f !== 0) { - writer.writeInt32( - 2, - f - ); - } -}; - - -/** - * optional TimeTicket created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.TextNodeID.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.TextNodeID} returns this -*/ -proto.yorkie.v1.TextNodeID.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TextNodeID} returns this - */ -proto.yorkie.v1.TextNodeID.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TextNodeID.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional int32 offset = 2; - * @return {number} - */ -proto.yorkie.v1.TextNodeID.prototype.getOffset = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.yorkie.v1.TextNodeID} returns this - */ -proto.yorkie.v1.TextNodeID.prototype.setOffset = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.TreeNode.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.TreeNode.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.TreeNode} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TreeNode.toObject = function(includeInstance, msg) { - var f, obj = { - id: (f = msg.getId()) && proto.yorkie.v1.TreeNodeID.toObject(includeInstance, f), - type: jspb.Message.getFieldWithDefault(msg, 2, ""), - value: jspb.Message.getFieldWithDefault(msg, 3, ""), - removedAt: (f = msg.getRemovedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - insPrevId: (f = msg.getInsPrevId()) && proto.yorkie.v1.TreeNodeID.toObject(includeInstance, f), - insNextId: (f = msg.getInsNextId()) && proto.yorkie.v1.TreeNodeID.toObject(includeInstance, f), - depth: jspb.Message.getFieldWithDefault(msg, 7, 0), - attributesMap: (f = msg.getAttributesMap()) ? f.toObject(includeInstance, proto.yorkie.v1.NodeAttr.toObject) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.TreeNode} - */ -proto.yorkie.v1.TreeNode.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.TreeNode; - return proto.yorkie.v1.TreeNode.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.TreeNode} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.TreeNode} - */ -proto.yorkie.v1.TreeNode.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TreeNodeID; - reader.readMessage(value,proto.yorkie.v1.TreeNodeID.deserializeBinaryFromReader); - msg.setId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setType(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setValue(value); - break; - case 4: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setRemovedAt(value); - break; - case 5: - var value = new proto.yorkie.v1.TreeNodeID; - reader.readMessage(value,proto.yorkie.v1.TreeNodeID.deserializeBinaryFromReader); - msg.setInsPrevId(value); - break; - case 6: - var value = new proto.yorkie.v1.TreeNodeID; - reader.readMessage(value,proto.yorkie.v1.TreeNodeID.deserializeBinaryFromReader); - msg.setInsNextId(value); - break; - case 7: - var value = /** @type {number} */ (reader.readInt32()); - msg.setDepth(value); - break; - case 8: - var value = msg.getAttributesMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.yorkie.v1.NodeAttr.deserializeBinaryFromReader, "", new proto.yorkie.v1.NodeAttr()); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.TreeNode.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.TreeNode.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.TreeNode} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TreeNode.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TreeNodeID.serializeBinaryToWriter - ); - } - f = message.getType(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getValue(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } - f = message.getRemovedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getInsPrevId(); - if (f != null) { - writer.writeMessage( - 5, - f, - proto.yorkie.v1.TreeNodeID.serializeBinaryToWriter - ); - } - f = message.getInsNextId(); - if (f != null) { - writer.writeMessage( - 6, - f, - proto.yorkie.v1.TreeNodeID.serializeBinaryToWriter - ); - } - f = message.getDepth(); - if (f !== 0) { - writer.writeInt32( - 7, - f - ); - } - f = message.getAttributesMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(8, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.yorkie.v1.NodeAttr.serializeBinaryToWriter); - } -}; - - -/** - * optional TreeNodeID id = 1; - * @return {?proto.yorkie.v1.TreeNodeID} - */ -proto.yorkie.v1.TreeNode.prototype.getId = function() { - return /** @type{?proto.yorkie.v1.TreeNodeID} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TreeNodeID, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TreeNodeID|undefined} value - * @return {!proto.yorkie.v1.TreeNode} returns this -*/ -proto.yorkie.v1.TreeNode.prototype.setId = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TreeNode} returns this - */ -proto.yorkie.v1.TreeNode.prototype.clearId = function() { - return this.setId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TreeNode.prototype.hasId = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional string type = 2; - * @return {string} - */ -proto.yorkie.v1.TreeNode.prototype.getType = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.TreeNode} returns this - */ -proto.yorkie.v1.TreeNode.prototype.setType = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string value = 3; - * @return {string} - */ -proto.yorkie.v1.TreeNode.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.TreeNode} returns this - */ -proto.yorkie.v1.TreeNode.prototype.setValue = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - -/** - * optional TimeTicket removed_at = 4; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.TreeNode.prototype.getRemovedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 4)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.TreeNode} returns this -*/ -proto.yorkie.v1.TreeNode.prototype.setRemovedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TreeNode} returns this - */ -proto.yorkie.v1.TreeNode.prototype.clearRemovedAt = function() { - return this.setRemovedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TreeNode.prototype.hasRemovedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - -/** - * optional TreeNodeID ins_prev_id = 5; - * @return {?proto.yorkie.v1.TreeNodeID} - */ -proto.yorkie.v1.TreeNode.prototype.getInsPrevId = function() { - return /** @type{?proto.yorkie.v1.TreeNodeID} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TreeNodeID, 5)); -}; - - -/** - * @param {?proto.yorkie.v1.TreeNodeID|undefined} value - * @return {!proto.yorkie.v1.TreeNode} returns this -*/ -proto.yorkie.v1.TreeNode.prototype.setInsPrevId = function(value) { - return jspb.Message.setWrapperField(this, 5, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TreeNode} returns this - */ -proto.yorkie.v1.TreeNode.prototype.clearInsPrevId = function() { - return this.setInsPrevId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TreeNode.prototype.hasInsPrevId = function() { - return jspb.Message.getField(this, 5) != null; -}; - - -/** - * optional TreeNodeID ins_next_id = 6; - * @return {?proto.yorkie.v1.TreeNodeID} - */ -proto.yorkie.v1.TreeNode.prototype.getInsNextId = function() { - return /** @type{?proto.yorkie.v1.TreeNodeID} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TreeNodeID, 6)); -}; - - -/** - * @param {?proto.yorkie.v1.TreeNodeID|undefined} value - * @return {!proto.yorkie.v1.TreeNode} returns this -*/ -proto.yorkie.v1.TreeNode.prototype.setInsNextId = function(value) { - return jspb.Message.setWrapperField(this, 6, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TreeNode} returns this - */ -proto.yorkie.v1.TreeNode.prototype.clearInsNextId = function() { - return this.setInsNextId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TreeNode.prototype.hasInsNextId = function() { - return jspb.Message.getField(this, 6) != null; -}; - - -/** - * optional int32 depth = 7; - * @return {number} - */ -proto.yorkie.v1.TreeNode.prototype.getDepth = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.yorkie.v1.TreeNode} returns this - */ -proto.yorkie.v1.TreeNode.prototype.setDepth = function(value) { - return jspb.Message.setProto3IntField(this, 7, value); -}; - - -/** - * map attributes = 8; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.TreeNode.prototype.getAttributesMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 8, opt_noLazyCreate, - proto.yorkie.v1.NodeAttr)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.TreeNode} returns this - */ -proto.yorkie.v1.TreeNode.prototype.clearAttributesMap = function() { - this.getAttributesMap().clear(); - return this; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.TreeNodes.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.TreeNodes.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.TreeNodes.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.TreeNodes} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TreeNodes.toObject = function(includeInstance, msg) { - var f, obj = { - contentList: jspb.Message.toObjectList(msg.getContentList(), - proto.yorkie.v1.TreeNode.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.TreeNodes} - */ -proto.yorkie.v1.TreeNodes.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.TreeNodes; - return proto.yorkie.v1.TreeNodes.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.TreeNodes} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.TreeNodes} - */ -proto.yorkie.v1.TreeNodes.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TreeNode; - reader.readMessage(value,proto.yorkie.v1.TreeNode.deserializeBinaryFromReader); - msg.addContent(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.TreeNodes.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.TreeNodes.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.TreeNodes} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TreeNodes.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getContentList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.yorkie.v1.TreeNode.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated TreeNode content = 1; - * @return {!Array} - */ -proto.yorkie.v1.TreeNodes.prototype.getContentList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.yorkie.v1.TreeNode, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.TreeNodes} returns this -*/ -proto.yorkie.v1.TreeNodes.prototype.setContentList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.yorkie.v1.TreeNode=} opt_value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.TreeNode} - */ -proto.yorkie.v1.TreeNodes.prototype.addContent = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.yorkie.v1.TreeNode, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.TreeNodes} returns this - */ -proto.yorkie.v1.TreeNodes.prototype.clearContentList = function() { - return this.setContentList([]); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.TreeNodeID.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.TreeNodeID.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.TreeNodeID} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TreeNodeID.toObject = function(includeInstance, msg) { - var f, obj = { - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - offset: jspb.Message.getFieldWithDefault(msg, 2, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.TreeNodeID} - */ -proto.yorkie.v1.TreeNodeID.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.TreeNodeID; - return proto.yorkie.v1.TreeNodeID.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.TreeNodeID} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.TreeNodeID} - */ -proto.yorkie.v1.TreeNodeID.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt32()); - msg.setOffset(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.TreeNodeID.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.TreeNodeID.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.TreeNodeID} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TreeNodeID.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getOffset(); - if (f !== 0) { - writer.writeInt32( - 2, - f - ); - } -}; - - -/** - * optional TimeTicket created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.TreeNodeID.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.TreeNodeID} returns this -*/ -proto.yorkie.v1.TreeNodeID.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TreeNodeID} returns this - */ -proto.yorkie.v1.TreeNodeID.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TreeNodeID.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional int32 offset = 2; - * @return {number} - */ -proto.yorkie.v1.TreeNodeID.prototype.getOffset = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.yorkie.v1.TreeNodeID} returns this - */ -proto.yorkie.v1.TreeNodeID.prototype.setOffset = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.TreePos.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.TreePos.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.TreePos} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TreePos.toObject = function(includeInstance, msg) { - var f, obj = { - parentId: (f = msg.getParentId()) && proto.yorkie.v1.TreeNodeID.toObject(includeInstance, f), - leftSiblingId: (f = msg.getLeftSiblingId()) && proto.yorkie.v1.TreeNodeID.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.TreePos} - */ -proto.yorkie.v1.TreePos.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.TreePos; - return proto.yorkie.v1.TreePos.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.TreePos} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.TreePos} - */ -proto.yorkie.v1.TreePos.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TreeNodeID; - reader.readMessage(value,proto.yorkie.v1.TreeNodeID.deserializeBinaryFromReader); - msg.setParentId(value); - break; - case 2: - var value = new proto.yorkie.v1.TreeNodeID; - reader.readMessage(value,proto.yorkie.v1.TreeNodeID.deserializeBinaryFromReader); - msg.setLeftSiblingId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.TreePos.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.TreePos.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.TreePos} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TreePos.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getParentId(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TreeNodeID.serializeBinaryToWriter - ); - } - f = message.getLeftSiblingId(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.TreeNodeID.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TreeNodeID parent_id = 1; - * @return {?proto.yorkie.v1.TreeNodeID} - */ -proto.yorkie.v1.TreePos.prototype.getParentId = function() { - return /** @type{?proto.yorkie.v1.TreeNodeID} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TreeNodeID, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TreeNodeID|undefined} value - * @return {!proto.yorkie.v1.TreePos} returns this -*/ -proto.yorkie.v1.TreePos.prototype.setParentId = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TreePos} returns this - */ -proto.yorkie.v1.TreePos.prototype.clearParentId = function() { - return this.setParentId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TreePos.prototype.hasParentId = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional TreeNodeID left_sibling_id = 2; - * @return {?proto.yorkie.v1.TreeNodeID} - */ -proto.yorkie.v1.TreePos.prototype.getLeftSiblingId = function() { - return /** @type{?proto.yorkie.v1.TreeNodeID} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TreeNodeID, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.TreeNodeID|undefined} value - * @return {!proto.yorkie.v1.TreePos} returns this -*/ -proto.yorkie.v1.TreePos.prototype.setLeftSiblingId = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TreePos} returns this - */ -proto.yorkie.v1.TreePos.prototype.clearLeftSiblingId = function() { - return this.setLeftSiblingId(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TreePos.prototype.hasLeftSiblingId = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.User.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.User.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.User} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.User.toObject = function(includeInstance, msg) { - var f, obj = { - id: jspb.Message.getFieldWithDefault(msg, 1, ""), - username: jspb.Message.getFieldWithDefault(msg, 2, ""), - createdAt: (f = msg.getCreatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.User} - */ -proto.yorkie.v1.User.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.User; - return proto.yorkie.v1.User.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.User} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.User} - */ -proto.yorkie.v1.User.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setUsername(value); - break; - case 3: - var value = new google_protobuf_timestamp_pb.Timestamp; - reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.User.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.User.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.User} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.User.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getUsername(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 3, - f, - google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter - ); - } -}; - - -/** - * optional string id = 1; - * @return {string} - */ -proto.yorkie.v1.User.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.User} returns this - */ -proto.yorkie.v1.User.prototype.setId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string username = 2; - * @return {string} - */ -proto.yorkie.v1.User.prototype.getUsername = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.User} returns this - */ -proto.yorkie.v1.User.prototype.setUsername = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional google.protobuf.Timestamp created_at = 3; - * @return {?proto.google.protobuf.Timestamp} - */ -proto.yorkie.v1.User.prototype.getCreatedAt = function() { - return /** @type{?proto.google.protobuf.Timestamp} */ ( - jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 3)); -}; - - -/** - * @param {?proto.google.protobuf.Timestamp|undefined} value - * @return {!proto.yorkie.v1.User} returns this -*/ -proto.yorkie.v1.User.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.User} returns this - */ -proto.yorkie.v1.User.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.User.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 3) != null; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.Project.repeatedFields_ = [6]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Project.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Project.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Project} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Project.toObject = function(includeInstance, msg) { - var f, obj = { - id: jspb.Message.getFieldWithDefault(msg, 1, ""), - name: jspb.Message.getFieldWithDefault(msg, 2, ""), - publicKey: jspb.Message.getFieldWithDefault(msg, 3, ""), - secretKey: jspb.Message.getFieldWithDefault(msg, 4, ""), - authWebhookUrl: jspb.Message.getFieldWithDefault(msg, 5, ""), - authWebhookMethodsList: (f = jspb.Message.getRepeatedField(msg, 6)) == null ? undefined : f, - clientDeactivateThreshold: jspb.Message.getFieldWithDefault(msg, 7, ""), - createdAt: (f = msg.getCreatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), - updatedAt: (f = msg.getUpdatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Project} - */ -proto.yorkie.v1.Project.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Project; - return proto.yorkie.v1.Project.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Project} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Project} - */ -proto.yorkie.v1.Project.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setPublicKey(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setSecretKey(value); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.setAuthWebhookUrl(value); - break; - case 6: - var value = /** @type {string} */ (reader.readString()); - msg.addAuthWebhookMethods(value); - break; - case 7: - var value = /** @type {string} */ (reader.readString()); - msg.setClientDeactivateThreshold(value); - break; - case 8: - var value = new google_protobuf_timestamp_pb.Timestamp; - reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 9: - var value = new google_protobuf_timestamp_pb.Timestamp; - reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); - msg.setUpdatedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Project.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Project.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Project} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Project.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getPublicKey(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } - f = message.getSecretKey(); - if (f.length > 0) { - writer.writeString( - 4, - f - ); - } - f = message.getAuthWebhookUrl(); - if (f.length > 0) { - writer.writeString( - 5, - f - ); - } - f = message.getAuthWebhookMethodsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 6, - f - ); - } - f = message.getClientDeactivateThreshold(); - if (f.length > 0) { - writer.writeString( - 7, - f - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 8, - f, - google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter - ); - } - f = message.getUpdatedAt(); - if (f != null) { - writer.writeMessage( - 9, - f, - google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter - ); - } -}; - - -/** - * optional string id = 1; - * @return {string} - */ -proto.yorkie.v1.Project.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.setId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string name = 2; - * @return {string} - */ -proto.yorkie.v1.Project.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.setName = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string public_key = 3; - * @return {string} - */ -proto.yorkie.v1.Project.prototype.getPublicKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.setPublicKey = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - -/** - * optional string secret_key = 4; - * @return {string} - */ -proto.yorkie.v1.Project.prototype.getSecretKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.setSecretKey = function(value) { - return jspb.Message.setProto3StringField(this, 4, value); -}; - - -/** - * optional string auth_webhook_url = 5; - * @return {string} - */ -proto.yorkie.v1.Project.prototype.getAuthWebhookUrl = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.setAuthWebhookUrl = function(value) { - return jspb.Message.setProto3StringField(this, 5, value); -}; - - -/** - * repeated string auth_webhook_methods = 6; - * @return {!Array} - */ -proto.yorkie.v1.Project.prototype.getAuthWebhookMethodsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 6)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.setAuthWebhookMethodsList = function(value) { - return jspb.Message.setField(this, 6, value || []); -}; - - -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.addAuthWebhookMethods = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 6, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.clearAuthWebhookMethodsList = function() { - return this.setAuthWebhookMethodsList([]); -}; - - -/** - * optional string client_deactivate_threshold = 7; - * @return {string} - */ -proto.yorkie.v1.Project.prototype.getClientDeactivateThreshold = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.setClientDeactivateThreshold = function(value) { - return jspb.Message.setProto3StringField(this, 7, value); -}; - - -/** - * optional google.protobuf.Timestamp created_at = 8; - * @return {?proto.google.protobuf.Timestamp} - */ -proto.yorkie.v1.Project.prototype.getCreatedAt = function() { - return /** @type{?proto.google.protobuf.Timestamp} */ ( - jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 8)); -}; - - -/** - * @param {?proto.google.protobuf.Timestamp|undefined} value - * @return {!proto.yorkie.v1.Project} returns this -*/ -proto.yorkie.v1.Project.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 8, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Project.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 8) != null; -}; - - -/** - * optional google.protobuf.Timestamp updated_at = 9; - * @return {?proto.google.protobuf.Timestamp} - */ -proto.yorkie.v1.Project.prototype.getUpdatedAt = function() { - return /** @type{?proto.google.protobuf.Timestamp} */ ( - jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 9)); -}; - - -/** - * @param {?proto.google.protobuf.Timestamp|undefined} value - * @return {!proto.yorkie.v1.Project} returns this -*/ -proto.yorkie.v1.Project.prototype.setUpdatedAt = function(value) { - return jspb.Message.setWrapperField(this, 9, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.Project} returns this - */ -proto.yorkie.v1.Project.prototype.clearUpdatedAt = function() { - return this.setUpdatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.Project.prototype.hasUpdatedAt = function() { - return jspb.Message.getField(this, 9) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.UpdatableProjectFields.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.UpdatableProjectFields} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.UpdatableProjectFields.toObject = function(includeInstance, msg) { - var f, obj = { - name: (f = msg.getName()) && google_protobuf_wrappers_pb.StringValue.toObject(includeInstance, f), - authWebhookUrl: (f = msg.getAuthWebhookUrl()) && google_protobuf_wrappers_pb.StringValue.toObject(includeInstance, f), - authWebhookMethods: (f = msg.getAuthWebhookMethods()) && proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.toObject(includeInstance, f), - clientDeactivateThreshold: (f = msg.getClientDeactivateThreshold()) && google_protobuf_wrappers_pb.StringValue.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.UpdatableProjectFields} - */ -proto.yorkie.v1.UpdatableProjectFields.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.UpdatableProjectFields; - return proto.yorkie.v1.UpdatableProjectFields.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.UpdatableProjectFields} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.UpdatableProjectFields} - */ -proto.yorkie.v1.UpdatableProjectFields.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new google_protobuf_wrappers_pb.StringValue; - reader.readMessage(value,google_protobuf_wrappers_pb.StringValue.deserializeBinaryFromReader); - msg.setName(value); - break; - case 2: - var value = new google_protobuf_wrappers_pb.StringValue; - reader.readMessage(value,google_protobuf_wrappers_pb.StringValue.deserializeBinaryFromReader); - msg.setAuthWebhookUrl(value); - break; - case 3: - var value = new proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods; - reader.readMessage(value,proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.deserializeBinaryFromReader); - msg.setAuthWebhookMethods(value); - break; - case 4: - var value = new google_protobuf_wrappers_pb.StringValue; - reader.readMessage(value,google_protobuf_wrappers_pb.StringValue.deserializeBinaryFromReader); - msg.setClientDeactivateThreshold(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.UpdatableProjectFields.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.UpdatableProjectFields} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.UpdatableProjectFields.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f != null) { - writer.writeMessage( - 1, - f, - google_protobuf_wrappers_pb.StringValue.serializeBinaryToWriter - ); - } - f = message.getAuthWebhookUrl(); - if (f != null) { - writer.writeMessage( - 2, - f, - google_protobuf_wrappers_pb.StringValue.serializeBinaryToWriter - ); - } - f = message.getAuthWebhookMethods(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.serializeBinaryToWriter - ); - } - f = message.getClientDeactivateThreshold(); - if (f != null) { - writer.writeMessage( - 4, - f, - google_protobuf_wrappers_pb.StringValue.serializeBinaryToWriter - ); - } -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.toObject = function(includeInstance, msg) { - var f, obj = { - methodsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods; - return proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.addMethods(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getMethodsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 1, - f - ); - } -}; - - -/** - * repeated string methods = 1; - * @return {!Array} - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.prototype.getMethodsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} returns this - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.prototype.setMethodsList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; - - -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} returns this - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.prototype.addMethods = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} returns this - */ -proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods.prototype.clearMethodsList = function() { - return this.setMethodsList([]); -}; - - -/** - * optional google.protobuf.StringValue name = 1; - * @return {?proto.google.protobuf.StringValue} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.getName = function() { - return /** @type{?proto.google.protobuf.StringValue} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.StringValue, 1)); -}; - - -/** - * @param {?proto.google.protobuf.StringValue|undefined} value - * @return {!proto.yorkie.v1.UpdatableProjectFields} returns this -*/ -proto.yorkie.v1.UpdatableProjectFields.prototype.setName = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.UpdatableProjectFields} returns this - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.clearName = function() { - return this.setName(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.hasName = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional google.protobuf.StringValue auth_webhook_url = 2; - * @return {?proto.google.protobuf.StringValue} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.getAuthWebhookUrl = function() { - return /** @type{?proto.google.protobuf.StringValue} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.StringValue, 2)); -}; - - -/** - * @param {?proto.google.protobuf.StringValue|undefined} value - * @return {!proto.yorkie.v1.UpdatableProjectFields} returns this -*/ -proto.yorkie.v1.UpdatableProjectFields.prototype.setAuthWebhookUrl = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.UpdatableProjectFields} returns this - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.clearAuthWebhookUrl = function() { - return this.setAuthWebhookUrl(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.hasAuthWebhookUrl = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional AuthWebhookMethods auth_webhook_methods = 3; - * @return {?proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.getAuthWebhookMethods = function() { - return /** @type{?proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.UpdatableProjectFields.AuthWebhookMethods|undefined} value - * @return {!proto.yorkie.v1.UpdatableProjectFields} returns this -*/ -proto.yorkie.v1.UpdatableProjectFields.prototype.setAuthWebhookMethods = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.UpdatableProjectFields} returns this - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.clearAuthWebhookMethods = function() { - return this.setAuthWebhookMethods(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.hasAuthWebhookMethods = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional google.protobuf.StringValue client_deactivate_threshold = 4; - * @return {?proto.google.protobuf.StringValue} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.getClientDeactivateThreshold = function() { - return /** @type{?proto.google.protobuf.StringValue} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.StringValue, 4)); -}; - - -/** - * @param {?proto.google.protobuf.StringValue|undefined} value - * @return {!proto.yorkie.v1.UpdatableProjectFields} returns this -*/ -proto.yorkie.v1.UpdatableProjectFields.prototype.setClientDeactivateThreshold = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.UpdatableProjectFields} returns this - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.clearClientDeactivateThreshold = function() { - return this.setClientDeactivateThreshold(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.UpdatableProjectFields.prototype.hasClientDeactivateThreshold = function() { - return jspb.Message.getField(this, 4) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.DocumentSummary.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.DocumentSummary.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.DocumentSummary} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DocumentSummary.toObject = function(includeInstance, msg) { - var f, obj = { - id: jspb.Message.getFieldWithDefault(msg, 1, ""), - key: jspb.Message.getFieldWithDefault(msg, 2, ""), - snapshot: jspb.Message.getFieldWithDefault(msg, 3, ""), - createdAt: (f = msg.getCreatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), - accessedAt: (f = msg.getAccessedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), - updatedAt: (f = msg.getUpdatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.DocumentSummary} - */ -proto.yorkie.v1.DocumentSummary.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.DocumentSummary; - return proto.yorkie.v1.DocumentSummary.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.DocumentSummary} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.DocumentSummary} - */ -proto.yorkie.v1.DocumentSummary.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setKey(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setSnapshot(value); - break; - case 4: - var value = new google_protobuf_timestamp_pb.Timestamp; - reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 5: - var value = new google_protobuf_timestamp_pb.Timestamp; - reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); - msg.setAccessedAt(value); - break; - case 6: - var value = new google_protobuf_timestamp_pb.Timestamp; - reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); - msg.setUpdatedAt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.DocumentSummary.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.DocumentSummary.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.DocumentSummary} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DocumentSummary.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getKey(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getSnapshot(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 4, - f, - google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter - ); - } - f = message.getAccessedAt(); - if (f != null) { - writer.writeMessage( - 5, - f, - google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter - ); - } - f = message.getUpdatedAt(); - if (f != null) { - writer.writeMessage( - 6, - f, - google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter - ); - } -}; - - -/** - * optional string id = 1; - * @return {string} - */ -proto.yorkie.v1.DocumentSummary.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.DocumentSummary} returns this - */ -proto.yorkie.v1.DocumentSummary.prototype.setId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string key = 2; - * @return {string} - */ -proto.yorkie.v1.DocumentSummary.prototype.getKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.DocumentSummary} returns this - */ -proto.yorkie.v1.DocumentSummary.prototype.setKey = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string snapshot = 3; - * @return {string} - */ -proto.yorkie.v1.DocumentSummary.prototype.getSnapshot = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.DocumentSummary} returns this - */ -proto.yorkie.v1.DocumentSummary.prototype.setSnapshot = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - -/** - * optional google.protobuf.Timestamp created_at = 4; - * @return {?proto.google.protobuf.Timestamp} - */ -proto.yorkie.v1.DocumentSummary.prototype.getCreatedAt = function() { - return /** @type{?proto.google.protobuf.Timestamp} */ ( - jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 4)); -}; - - -/** - * @param {?proto.google.protobuf.Timestamp|undefined} value - * @return {!proto.yorkie.v1.DocumentSummary} returns this -*/ -proto.yorkie.v1.DocumentSummary.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.DocumentSummary} returns this - */ -proto.yorkie.v1.DocumentSummary.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.DocumentSummary.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 4) != null; -}; - - -/** - * optional google.protobuf.Timestamp accessed_at = 5; - * @return {?proto.google.protobuf.Timestamp} - */ -proto.yorkie.v1.DocumentSummary.prototype.getAccessedAt = function() { - return /** @type{?proto.google.protobuf.Timestamp} */ ( - jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 5)); -}; - - -/** - * @param {?proto.google.protobuf.Timestamp|undefined} value - * @return {!proto.yorkie.v1.DocumentSummary} returns this -*/ -proto.yorkie.v1.DocumentSummary.prototype.setAccessedAt = function(value) { - return jspb.Message.setWrapperField(this, 5, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.DocumentSummary} returns this - */ -proto.yorkie.v1.DocumentSummary.prototype.clearAccessedAt = function() { - return this.setAccessedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.DocumentSummary.prototype.hasAccessedAt = function() { - return jspb.Message.getField(this, 5) != null; -}; - - -/** - * optional google.protobuf.Timestamp updated_at = 6; - * @return {?proto.google.protobuf.Timestamp} - */ -proto.yorkie.v1.DocumentSummary.prototype.getUpdatedAt = function() { - return /** @type{?proto.google.protobuf.Timestamp} */ ( - jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 6)); -}; - - -/** - * @param {?proto.google.protobuf.Timestamp|undefined} value - * @return {!proto.yorkie.v1.DocumentSummary} returns this -*/ -proto.yorkie.v1.DocumentSummary.prototype.setUpdatedAt = function(value) { - return jspb.Message.setWrapperField(this, 6, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.DocumentSummary} returns this - */ -proto.yorkie.v1.DocumentSummary.prototype.clearUpdatedAt = function() { - return this.setUpdatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.DocumentSummary.prototype.hasUpdatedAt = function() { - return jspb.Message.getField(this, 6) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.PresenceChange.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.PresenceChange.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.PresenceChange} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.PresenceChange.toObject = function(includeInstance, msg) { - var f, obj = { - type: jspb.Message.getFieldWithDefault(msg, 1, 0), - presence: (f = msg.getPresence()) && proto.yorkie.v1.Presence.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.PresenceChange} - */ -proto.yorkie.v1.PresenceChange.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.PresenceChange; - return proto.yorkie.v1.PresenceChange.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.PresenceChange} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.PresenceChange} - */ -proto.yorkie.v1.PresenceChange.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!proto.yorkie.v1.PresenceChange.ChangeType} */ (reader.readEnum()); - msg.setType(value); - break; - case 2: - var value = new proto.yorkie.v1.Presence; - reader.readMessage(value,proto.yorkie.v1.Presence.deserializeBinaryFromReader); - msg.setPresence(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.PresenceChange.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.PresenceChange.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.PresenceChange} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.PresenceChange.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getType(); - if (f !== 0.0) { - writer.writeEnum( - 1, - f - ); - } - f = message.getPresence(); - if (f != null) { - writer.writeMessage( - 2, - f, - proto.yorkie.v1.Presence.serializeBinaryToWriter - ); - } -}; - - -/** - * @enum {number} - */ -proto.yorkie.v1.PresenceChange.ChangeType = { - CHANGE_TYPE_UNSPECIFIED: 0, - CHANGE_TYPE_PUT: 1, - CHANGE_TYPE_DELETE: 2, - CHANGE_TYPE_CLEAR: 3 -}; - -/** - * optional ChangeType type = 1; - * @return {!proto.yorkie.v1.PresenceChange.ChangeType} - */ -proto.yorkie.v1.PresenceChange.prototype.getType = function() { - return /** @type {!proto.yorkie.v1.PresenceChange.ChangeType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.yorkie.v1.PresenceChange.ChangeType} value - * @return {!proto.yorkie.v1.PresenceChange} returns this - */ -proto.yorkie.v1.PresenceChange.prototype.setType = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional Presence presence = 2; - * @return {?proto.yorkie.v1.Presence} - */ -proto.yorkie.v1.PresenceChange.prototype.getPresence = function() { - return /** @type{?proto.yorkie.v1.Presence} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.Presence, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.Presence|undefined} value - * @return {!proto.yorkie.v1.PresenceChange} returns this -*/ -proto.yorkie.v1.PresenceChange.prototype.setPresence = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.PresenceChange} returns this - */ -proto.yorkie.v1.PresenceChange.prototype.clearPresence = function() { - return this.setPresence(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.PresenceChange.prototype.hasPresence = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Presence.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Presence.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Presence} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Presence.toObject = function(includeInstance, msg) { - var f, obj = { - dataMap: (f = msg.getDataMap()) ? f.toObject(includeInstance, undefined) : [] - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Presence} - */ -proto.yorkie.v1.Presence.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Presence; - return proto.yorkie.v1.Presence.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Presence} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Presence} - */ -proto.yorkie.v1.Presence.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = msg.getDataMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Presence.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Presence.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Presence} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Presence.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getDataMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); - } -}; - - -/** - * map data = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -proto.yorkie.v1.Presence.prototype.getDataMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - null)); -}; - - -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.yorkie.v1.Presence} returns this - */ -proto.yorkie.v1.Presence.prototype.clearDataMap = function() { - this.getDataMap().clear(); - return this; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.Checkpoint.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.Checkpoint.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.Checkpoint} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Checkpoint.toObject = function(includeInstance, msg) { - var f, obj = { - serverSeq: jspb.Message.getFieldWithDefault(msg, 1, "0"), - clientSeq: jspb.Message.getFieldWithDefault(msg, 2, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.Checkpoint} - */ -proto.yorkie.v1.Checkpoint.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.Checkpoint; - return proto.yorkie.v1.Checkpoint.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.Checkpoint} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.Checkpoint} - */ -proto.yorkie.v1.Checkpoint.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setServerSeq(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setClientSeq(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.Checkpoint.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.Checkpoint.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.Checkpoint} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.Checkpoint.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getServerSeq(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 1, - f - ); - } - f = message.getClientSeq(); - if (f !== 0) { - writer.writeUint32( - 2, - f - ); - } -}; - - -/** - * optional int64 server_seq = 1; - * @return {string} - */ -proto.yorkie.v1.Checkpoint.prototype.getServerSeq = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.Checkpoint} returns this - */ -proto.yorkie.v1.Checkpoint.prototype.setServerSeq = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); -}; - - -/** - * optional uint32 client_seq = 2; - * @return {number} - */ -proto.yorkie.v1.Checkpoint.prototype.getClientSeq = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.yorkie.v1.Checkpoint} returns this - */ -proto.yorkie.v1.Checkpoint.prototype.setClientSeq = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.TextNodePos.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.TextNodePos.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.TextNodePos} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TextNodePos.toObject = function(includeInstance, msg) { - var f, obj = { - createdAt: (f = msg.getCreatedAt()) && proto.yorkie.v1.TimeTicket.toObject(includeInstance, f), - offset: jspb.Message.getFieldWithDefault(msg, 2, 0), - relativeOffset: jspb.Message.getFieldWithDefault(msg, 3, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.TextNodePos} - */ -proto.yorkie.v1.TextNodePos.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.TextNodePos; - return proto.yorkie.v1.TextNodePos.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.TextNodePos} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.TextNodePos} - */ -proto.yorkie.v1.TextNodePos.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.TimeTicket; - reader.readMessage(value,proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader); - msg.setCreatedAt(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt32()); - msg.setOffset(value); - break; - case 3: - var value = /** @type {number} */ (reader.readInt32()); - msg.setRelativeOffset(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.TextNodePos.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.TextNodePos.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.TextNodePos} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TextNodePos.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getCreatedAt(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter - ); - } - f = message.getOffset(); - if (f !== 0) { - writer.writeInt32( - 2, - f - ); - } - f = message.getRelativeOffset(); - if (f !== 0) { - writer.writeInt32( - 3, - f - ); - } -}; - - -/** - * optional TimeTicket created_at = 1; - * @return {?proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.TextNodePos.prototype.getCreatedAt = function() { - return /** @type{?proto.yorkie.v1.TimeTicket} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.TimeTicket, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.TimeTicket|undefined} value - * @return {!proto.yorkie.v1.TextNodePos} returns this -*/ -proto.yorkie.v1.TextNodePos.prototype.setCreatedAt = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.TextNodePos} returns this - */ -proto.yorkie.v1.TextNodePos.prototype.clearCreatedAt = function() { - return this.setCreatedAt(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.TextNodePos.prototype.hasCreatedAt = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional int32 offset = 2; - * @return {number} - */ -proto.yorkie.v1.TextNodePos.prototype.getOffset = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.yorkie.v1.TextNodePos} returns this - */ -proto.yorkie.v1.TextNodePos.prototype.setOffset = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional int32 relative_offset = 3; - * @return {number} - */ -proto.yorkie.v1.TextNodePos.prototype.getRelativeOffset = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.yorkie.v1.TextNodePos} returns this - */ -proto.yorkie.v1.TextNodePos.prototype.setRelativeOffset = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.TimeTicket.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.TimeTicket.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.TimeTicket} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TimeTicket.toObject = function(includeInstance, msg) { - var f, obj = { - lamport: jspb.Message.getFieldWithDefault(msg, 1, "0"), - delimiter: jspb.Message.getFieldWithDefault(msg, 2, 0), - actorId: msg.getActorId_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.TimeTicket.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.TimeTicket; - return proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.TimeTicket} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.TimeTicket} - */ -proto.yorkie.v1.TimeTicket.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readInt64String()); - msg.setLamport(value); - break; - case 2: - var value = /** @type {number} */ (reader.readUint32()); - msg.setDelimiter(value); - break; - case 3: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setActorId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.TimeTicket.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.TimeTicket.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.TimeTicket} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.TimeTicket.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getLamport(); - if (parseInt(f, 10) !== 0) { - writer.writeInt64String( - 1, - f - ); - } - f = message.getDelimiter(); - if (f !== 0) { - writer.writeUint32( - 2, - f - ); - } - f = message.getActorId_asU8(); - if (f.length > 0) { - writer.writeBytes( - 3, - f - ); - } -}; - - -/** - * optional int64 lamport = 1; - * @return {string} - */ -proto.yorkie.v1.TimeTicket.prototype.getLamport = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.TimeTicket} returns this - */ -proto.yorkie.v1.TimeTicket.prototype.setLamport = function(value) { - return jspb.Message.setProto3StringIntField(this, 1, value); -}; - - -/** - * optional uint32 delimiter = 2; - * @return {number} - */ -proto.yorkie.v1.TimeTicket.prototype.getDelimiter = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.yorkie.v1.TimeTicket} returns this - */ -proto.yorkie.v1.TimeTicket.prototype.setDelimiter = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional bytes actor_id = 3; - * @return {string} - */ -proto.yorkie.v1.TimeTicket.prototype.getActorId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * optional bytes actor_id = 3; - * This is a type-conversion wrapper around `getActorId()` - * @return {string} - */ -proto.yorkie.v1.TimeTicket.prototype.getActorId_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getActorId())); -}; - - -/** - * optional bytes actor_id = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getActorId()` - * @return {!Uint8Array} - */ -proto.yorkie.v1.TimeTicket.prototype.getActorId_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getActorId())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.yorkie.v1.TimeTicket} returns this - */ -proto.yorkie.v1.TimeTicket.prototype.setActorId = function(value) { - return jspb.Message.setProto3BytesField(this, 3, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.DocEventBody.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.DocEventBody.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.DocEventBody} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DocEventBody.toObject = function(includeInstance, msg) { - var f, obj = { - topic: jspb.Message.getFieldWithDefault(msg, 1, ""), - payload: msg.getPayload_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.DocEventBody} - */ -proto.yorkie.v1.DocEventBody.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.DocEventBody; - return proto.yorkie.v1.DocEventBody.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.DocEventBody} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.DocEventBody} - */ -proto.yorkie.v1.DocEventBody.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setTopic(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPayload(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.DocEventBody.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.DocEventBody.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.DocEventBody} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DocEventBody.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getTopic(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getPayload_asU8(); - if (f.length > 0) { - writer.writeBytes( - 2, - f - ); - } -}; - - -/** - * optional string topic = 1; - * @return {string} - */ -proto.yorkie.v1.DocEventBody.prototype.getTopic = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.DocEventBody} returns this - */ -proto.yorkie.v1.DocEventBody.prototype.setTopic = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional bytes payload = 2; - * @return {string} - */ -proto.yorkie.v1.DocEventBody.prototype.getPayload = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * optional bytes payload = 2; - * This is a type-conversion wrapper around `getPayload()` - * @return {string} - */ -proto.yorkie.v1.DocEventBody.prototype.getPayload_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPayload())); -}; - - -/** - * optional bytes payload = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPayload()` - * @return {!Uint8Array} - */ -proto.yorkie.v1.DocEventBody.prototype.getPayload_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPayload())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.yorkie.v1.DocEventBody} returns this - */ -proto.yorkie.v1.DocEventBody.prototype.setPayload = function(value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.DocEvent.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.DocEvent.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.DocEvent} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DocEvent.toObject = function(includeInstance, msg) { - var f, obj = { - type: jspb.Message.getFieldWithDefault(msg, 1, 0), - publisher: jspb.Message.getFieldWithDefault(msg, 2, ""), - body: (f = msg.getBody()) && proto.yorkie.v1.DocEventBody.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.DocEvent} - */ -proto.yorkie.v1.DocEvent.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.DocEvent; - return proto.yorkie.v1.DocEvent.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.DocEvent} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.DocEvent} - */ -proto.yorkie.v1.DocEvent.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!proto.yorkie.v1.DocEventType} */ (reader.readEnum()); - msg.setType(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setPublisher(value); - break; - case 3: - var value = new proto.yorkie.v1.DocEventBody; - reader.readMessage(value,proto.yorkie.v1.DocEventBody.deserializeBinaryFromReader); - msg.setBody(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.DocEvent.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.DocEvent.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.DocEvent} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DocEvent.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getType(); - if (f !== 0.0) { - writer.writeEnum( - 1, - f - ); - } - f = message.getPublisher(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getBody(); - if (f != null) { - writer.writeMessage( - 3, - f, - proto.yorkie.v1.DocEventBody.serializeBinaryToWriter - ); - } -}; - - -/** - * optional DocEventType type = 1; - * @return {!proto.yorkie.v1.DocEventType} - */ -proto.yorkie.v1.DocEvent.prototype.getType = function() { - return /** @type {!proto.yorkie.v1.DocEventType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {!proto.yorkie.v1.DocEventType} value - * @return {!proto.yorkie.v1.DocEvent} returns this - */ -proto.yorkie.v1.DocEvent.prototype.setType = function(value) { - return jspb.Message.setProto3EnumField(this, 1, value); -}; - - -/** - * optional string publisher = 2; - * @return {string} - */ -proto.yorkie.v1.DocEvent.prototype.getPublisher = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.DocEvent} returns this - */ -proto.yorkie.v1.DocEvent.prototype.setPublisher = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional DocEventBody body = 3; - * @return {?proto.yorkie.v1.DocEventBody} - */ -proto.yorkie.v1.DocEvent.prototype.getBody = function() { - return /** @type{?proto.yorkie.v1.DocEventBody} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.DocEventBody, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.DocEventBody|undefined} value - * @return {!proto.yorkie.v1.DocEvent} returns this -*/ -proto.yorkie.v1.DocEvent.prototype.setBody = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.DocEvent} returns this - */ -proto.yorkie.v1.DocEvent.prototype.clearBody = function() { - return this.setBody(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.DocEvent.prototype.hasBody = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * @enum {number} - */ -proto.yorkie.v1.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 {number} - */ -proto.yorkie.v1.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 -}; - -goog.object.extend(exports, proto.yorkie.v1); +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 + */ +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 }, + ], +); + + +exports.ValueType = ValueType; +exports.DocEventType = DocEventType; +exports.Snapshot = Snapshot; +exports.ChangePack = ChangePack; +exports.Change = Change; +exports.ChangeID = ChangeID; +exports.Operation = Operation; +exports.Operation_Set = Operation_Set; +exports.Operation_Add = Operation_Add; +exports.Operation_Move = Operation_Move; +exports.Operation_Remove = Operation_Remove; +exports.Operation_Edit = Operation_Edit; +exports.Operation_Select = Operation_Select; +exports.Operation_Style = Operation_Style; +exports.Operation_Increase = Operation_Increase; +exports.Operation_TreeEdit = Operation_TreeEdit; +exports.Operation_TreeStyle = Operation_TreeStyle; +exports.JSONElementSimple = JSONElementSimple; +exports.JSONElement = JSONElement; +exports.JSONElement_JSONObject = JSONElement_JSONObject; +exports.JSONElement_JSONArray = JSONElement_JSONArray; +exports.JSONElement_Primitive = JSONElement_Primitive; +exports.JSONElement_Text = JSONElement_Text; +exports.JSONElement_Counter = JSONElement_Counter; +exports.JSONElement_Tree = JSONElement_Tree; +exports.RHTNode = RHTNode; +exports.RGANode = RGANode; +exports.NodeAttr = NodeAttr; +exports.TextNode = TextNode; +exports.TextNodeID = TextNodeID; +exports.TreeNode = TreeNode; +exports.TreeNodes = TreeNodes; +exports.TreeNodeID = TreeNodeID; +exports.TreePos = TreePos; +exports.User = User; +exports.Project = Project; +exports.UpdatableProjectFields = UpdatableProjectFields; +exports.UpdatableProjectFields_AuthWebhookMethods = UpdatableProjectFields_AuthWebhookMethods; +exports.DocumentSummary = DocumentSummary; +exports.PresenceChange = PresenceChange; +exports.PresenceChange_ChangeType = PresenceChange_ChangeType; +exports.Presence = Presence; +exports.Checkpoint = Checkpoint; +exports.TextNodePos = TextNodePos; +exports.TimeTicket = TimeTicket; +exports.DocEventBody = DocEventBody; +exports.DocEvent = DocEvent; diff --git a/src/api/yorkie/v1/yorkie.proto b/src/api/yorkie/v1/yorkie.proto index da71d6a11..279f96f98 100644 --- a/src/api/yorkie/v1/yorkie.proto +++ b/src/api/yorkie/v1/yorkie.proto @@ -17,9 +17,9 @@ syntax = "proto3"; package yorkie.v1; -import "yorkie/v1/resources.proto"; +import "src/api/yorkie/v1/resources.proto"; -option go_package = ".;v1"; +option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; option java_multiple_files = true; option java_package = "dev.yorkie.api.v1"; 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..89315b90a --- /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.2.0 with parameter "target=js+dts,js_import_style=legacy_commonjs" +// @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..2e1be4fdb --- /dev/null +++ b/src/api/yorkie/v1/yorkie_connect.js @@ -0,0 +1,111 @@ +// +// 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.2.0 with parameter "target=js+dts,js_import_style=legacy_commonjs" +// @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + +const { ActivateClientRequest, ActivateClientResponse, AttachDocumentRequest, AttachDocumentResponse, BroadcastRequest, BroadcastResponse, DeactivateClientRequest, DeactivateClientResponse, DetachDocumentRequest, DetachDocumentResponse, PushPullChangesRequest, PushPullChangesResponse, RemoveDocumentRequest, RemoveDocumentResponse, WatchDocumentRequest, WatchDocumentResponse } = require("./yorkie_pb.js"); +const { MethodKind } = require("@bufbuild/protobuf"); + +/** + * Yorkie is a service that provides a API for SDKs. + * + * @generated from service yorkie.v1.YorkieService + */ +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, + }, + } +}; + + +exports.YorkieService = YorkieService; diff --git a/src/api/yorkie/v1/yorkie_grpc_web_pb.d.ts b/src/api/yorkie/v1/yorkie_grpc_web_pb.d.ts deleted file mode 100644 index 11089c8da..000000000 --- a/src/api/yorkie/v1/yorkie_grpc_web_pb.d.ts +++ /dev/null @@ -1,113 +0,0 @@ -import * as grpcWeb from 'grpc-web'; - -import * as yorkie_v1_yorkie_pb from '../../yorkie/v1/yorkie_pb'; - - -export class YorkieServiceClient { - constructor (hostname: string, - credentials?: null | { [index: string]: string; }, - options?: null | { [index: string]: any; }); - - activateClient( - request: yorkie_v1_yorkie_pb.ActivateClientRequest, - metadata: grpcWeb.Metadata | undefined, - callback: (err: grpcWeb.RpcError, - response: yorkie_v1_yorkie_pb.ActivateClientResponse) => void - ): grpcWeb.ClientReadableStream; - - deactivateClient( - request: yorkie_v1_yorkie_pb.DeactivateClientRequest, - metadata: grpcWeb.Metadata | undefined, - callback: (err: grpcWeb.RpcError, - response: yorkie_v1_yorkie_pb.DeactivateClientResponse) => void - ): grpcWeb.ClientReadableStream; - - attachDocument( - request: yorkie_v1_yorkie_pb.AttachDocumentRequest, - metadata: grpcWeb.Metadata | undefined, - callback: (err: grpcWeb.RpcError, - response: yorkie_v1_yorkie_pb.AttachDocumentResponse) => void - ): grpcWeb.ClientReadableStream; - - detachDocument( - request: yorkie_v1_yorkie_pb.DetachDocumentRequest, - metadata: grpcWeb.Metadata | undefined, - callback: (err: grpcWeb.RpcError, - response: yorkie_v1_yorkie_pb.DetachDocumentResponse) => void - ): grpcWeb.ClientReadableStream; - - removeDocument( - request: yorkie_v1_yorkie_pb.RemoveDocumentRequest, - metadata: grpcWeb.Metadata | undefined, - callback: (err: grpcWeb.RpcError, - response: yorkie_v1_yorkie_pb.RemoveDocumentResponse) => void - ): grpcWeb.ClientReadableStream; - - pushPullChanges( - request: yorkie_v1_yorkie_pb.PushPullChangesRequest, - metadata: grpcWeb.Metadata | undefined, - callback: (err: grpcWeb.RpcError, - response: yorkie_v1_yorkie_pb.PushPullChangesResponse) => void - ): grpcWeb.ClientReadableStream; - - watchDocument( - request: yorkie_v1_yorkie_pb.WatchDocumentRequest, - metadata?: grpcWeb.Metadata - ): grpcWeb.ClientReadableStream; - - broadcast( - request: yorkie_v1_yorkie_pb.BroadcastRequest, - metadata: grpcWeb.Metadata | undefined, - callback: (err: grpcWeb.RpcError, - response: yorkie_v1_yorkie_pb.BroadcastResponse) => void - ): grpcWeb.ClientReadableStream; - -} - -export class YorkieServicePromiseClient { - constructor (hostname: string, - credentials?: null | { [index: string]: string; }, - options?: null | { [index: string]: any; }); - - activateClient( - request: yorkie_v1_yorkie_pb.ActivateClientRequest, - metadata?: grpcWeb.Metadata - ): Promise; - - deactivateClient( - request: yorkie_v1_yorkie_pb.DeactivateClientRequest, - metadata?: grpcWeb.Metadata - ): Promise; - - attachDocument( - request: yorkie_v1_yorkie_pb.AttachDocumentRequest, - metadata?: grpcWeb.Metadata - ): Promise; - - detachDocument( - request: yorkie_v1_yorkie_pb.DetachDocumentRequest, - metadata?: grpcWeb.Metadata - ): Promise; - - removeDocument( - request: yorkie_v1_yorkie_pb.RemoveDocumentRequest, - metadata?: grpcWeb.Metadata - ): Promise; - - pushPullChanges( - request: yorkie_v1_yorkie_pb.PushPullChangesRequest, - metadata?: grpcWeb.Metadata - ): Promise; - - watchDocument( - request: yorkie_v1_yorkie_pb.WatchDocumentRequest, - metadata?: grpcWeb.Metadata - ): grpcWeb.ClientReadableStream; - - broadcast( - request: yorkie_v1_yorkie_pb.BroadcastRequest, - metadata?: grpcWeb.Metadata - ): Promise; - -} - diff --git a/src/api/yorkie/v1/yorkie_grpc_web_pb.js b/src/api/yorkie/v1/yorkie_grpc_web_pb.js deleted file mode 100644 index 89725d283..000000000 --- a/src/api/yorkie/v1/yorkie_grpc_web_pb.js +++ /dev/null @@ -1,564 +0,0 @@ -/** - * @fileoverview gRPC-Web generated client stub for yorkie.v1 - * @enhanceable - * @public - */ - -// Code generated by protoc-gen-grpc-web. DO NOT EDIT. -// versions: -// protoc-gen-grpc-web v1.4.2 -// protoc v4.24.4 -// source: yorkie/v1/yorkie.proto - - -/* eslint-disable */ -// @ts-nocheck - - - -const grpc = {}; -grpc.web = require('grpc-web'); - - -var yorkie_v1_resources_pb = require('../../yorkie/v1/resources_pb.js') -const proto = {}; -proto.yorkie = {}; -proto.yorkie.v1 = require('./yorkie_pb.js'); - -/** - * @param {string} hostname - * @param {?Object} credentials - * @param {?grpc.web.ClientOptions} options - * @constructor - * @struct - * @final - */ -proto.yorkie.v1.YorkieServiceClient = - function(hostname, credentials, options) { - if (!options) options = {}; - options.format = 'text'; - - /** - * @private @const {!grpc.web.GrpcWebClientBase} The client - */ - this.client_ = new grpc.web.GrpcWebClientBase(options); - - /** - * @private @const {string} The hostname - */ - this.hostname_ = hostname.replace(/\/+$/, ''); - -}; - - -/** - * @param {string} hostname - * @param {?Object} credentials - * @param {?grpc.web.ClientOptions} options - * @constructor - * @struct - * @final - */ -proto.yorkie.v1.YorkieServicePromiseClient = - function(hostname, credentials, options) { - if (!options) options = {}; - options.format = 'text'; - - /** - * @private @const {!grpc.web.GrpcWebClientBase} The client - */ - this.client_ = new grpc.web.GrpcWebClientBase(options); - - /** - * @private @const {string} The hostname - */ - this.hostname_ = hostname.replace(/\/+$/, ''); - -}; - - -/** - * @const - * @type {!grpc.web.MethodDescriptor< - * !proto.yorkie.v1.ActivateClientRequest, - * !proto.yorkie.v1.ActivateClientResponse>} - */ -const methodDescriptor_YorkieService_ActivateClient = new grpc.web.MethodDescriptor( - '/yorkie.v1.YorkieService/ActivateClient', - grpc.web.MethodType.UNARY, - proto.yorkie.v1.ActivateClientRequest, - proto.yorkie.v1.ActivateClientResponse, - /** - * @param {!proto.yorkie.v1.ActivateClientRequest} request - * @return {!Uint8Array} - */ - function(request) { - return request.serializeBinary(); - }, - proto.yorkie.v1.ActivateClientResponse.deserializeBinary -); - - -/** - * @param {!proto.yorkie.v1.ActivateClientRequest} request The - * request proto - * @param {?Object} metadata User defined - * call metadata - * @param {function(?grpc.web.RpcError, ?proto.yorkie.v1.ActivateClientResponse)} - * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} - * The XHR Node Readable Stream - */ -proto.yorkie.v1.YorkieServiceClient.prototype.activateClient = - function(request, metadata, callback) { - return this.client_.rpcCall(this.hostname_ + - '/yorkie.v1.YorkieService/ActivateClient', - request, - metadata || {}, - methodDescriptor_YorkieService_ActivateClient, - callback); -}; - - -/** - * @param {!proto.yorkie.v1.ActivateClientRequest} request The - * request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!Promise} - * Promise that resolves to the response - */ -proto.yorkie.v1.YorkieServicePromiseClient.prototype.activateClient = - function(request, metadata) { - return this.client_.unaryCall(this.hostname_ + - '/yorkie.v1.YorkieService/ActivateClient', - request, - metadata || {}, - methodDescriptor_YorkieService_ActivateClient); -}; - - -/** - * @const - * @type {!grpc.web.MethodDescriptor< - * !proto.yorkie.v1.DeactivateClientRequest, - * !proto.yorkie.v1.DeactivateClientResponse>} - */ -const methodDescriptor_YorkieService_DeactivateClient = new grpc.web.MethodDescriptor( - '/yorkie.v1.YorkieService/DeactivateClient', - grpc.web.MethodType.UNARY, - proto.yorkie.v1.DeactivateClientRequest, - proto.yorkie.v1.DeactivateClientResponse, - /** - * @param {!proto.yorkie.v1.DeactivateClientRequest} request - * @return {!Uint8Array} - */ - function(request) { - return request.serializeBinary(); - }, - proto.yorkie.v1.DeactivateClientResponse.deserializeBinary -); - - -/** - * @param {!proto.yorkie.v1.DeactivateClientRequest} request The - * request proto - * @param {?Object} metadata User defined - * call metadata - * @param {function(?grpc.web.RpcError, ?proto.yorkie.v1.DeactivateClientResponse)} - * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} - * The XHR Node Readable Stream - */ -proto.yorkie.v1.YorkieServiceClient.prototype.deactivateClient = - function(request, metadata, callback) { - return this.client_.rpcCall(this.hostname_ + - '/yorkie.v1.YorkieService/DeactivateClient', - request, - metadata || {}, - methodDescriptor_YorkieService_DeactivateClient, - callback); -}; - - -/** - * @param {!proto.yorkie.v1.DeactivateClientRequest} request The - * request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!Promise} - * Promise that resolves to the response - */ -proto.yorkie.v1.YorkieServicePromiseClient.prototype.deactivateClient = - function(request, metadata) { - return this.client_.unaryCall(this.hostname_ + - '/yorkie.v1.YorkieService/DeactivateClient', - request, - metadata || {}, - methodDescriptor_YorkieService_DeactivateClient); -}; - - -/** - * @const - * @type {!grpc.web.MethodDescriptor< - * !proto.yorkie.v1.AttachDocumentRequest, - * !proto.yorkie.v1.AttachDocumentResponse>} - */ -const methodDescriptor_YorkieService_AttachDocument = new grpc.web.MethodDescriptor( - '/yorkie.v1.YorkieService/AttachDocument', - grpc.web.MethodType.UNARY, - proto.yorkie.v1.AttachDocumentRequest, - proto.yorkie.v1.AttachDocumentResponse, - /** - * @param {!proto.yorkie.v1.AttachDocumentRequest} request - * @return {!Uint8Array} - */ - function(request) { - return request.serializeBinary(); - }, - proto.yorkie.v1.AttachDocumentResponse.deserializeBinary -); - - -/** - * @param {!proto.yorkie.v1.AttachDocumentRequest} request The - * request proto - * @param {?Object} metadata User defined - * call metadata - * @param {function(?grpc.web.RpcError, ?proto.yorkie.v1.AttachDocumentResponse)} - * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} - * The XHR Node Readable Stream - */ -proto.yorkie.v1.YorkieServiceClient.prototype.attachDocument = - function(request, metadata, callback) { - return this.client_.rpcCall(this.hostname_ + - '/yorkie.v1.YorkieService/AttachDocument', - request, - metadata || {}, - methodDescriptor_YorkieService_AttachDocument, - callback); -}; - - -/** - * @param {!proto.yorkie.v1.AttachDocumentRequest} request The - * request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!Promise} - * Promise that resolves to the response - */ -proto.yorkie.v1.YorkieServicePromiseClient.prototype.attachDocument = - function(request, metadata) { - return this.client_.unaryCall(this.hostname_ + - '/yorkie.v1.YorkieService/AttachDocument', - request, - metadata || {}, - methodDescriptor_YorkieService_AttachDocument); -}; - - -/** - * @const - * @type {!grpc.web.MethodDescriptor< - * !proto.yorkie.v1.DetachDocumentRequest, - * !proto.yorkie.v1.DetachDocumentResponse>} - */ -const methodDescriptor_YorkieService_DetachDocument = new grpc.web.MethodDescriptor( - '/yorkie.v1.YorkieService/DetachDocument', - grpc.web.MethodType.UNARY, - proto.yorkie.v1.DetachDocumentRequest, - proto.yorkie.v1.DetachDocumentResponse, - /** - * @param {!proto.yorkie.v1.DetachDocumentRequest} request - * @return {!Uint8Array} - */ - function(request) { - return request.serializeBinary(); - }, - proto.yorkie.v1.DetachDocumentResponse.deserializeBinary -); - - -/** - * @param {!proto.yorkie.v1.DetachDocumentRequest} request The - * request proto - * @param {?Object} metadata User defined - * call metadata - * @param {function(?grpc.web.RpcError, ?proto.yorkie.v1.DetachDocumentResponse)} - * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} - * The XHR Node Readable Stream - */ -proto.yorkie.v1.YorkieServiceClient.prototype.detachDocument = - function(request, metadata, callback) { - return this.client_.rpcCall(this.hostname_ + - '/yorkie.v1.YorkieService/DetachDocument', - request, - metadata || {}, - methodDescriptor_YorkieService_DetachDocument, - callback); -}; - - -/** - * @param {!proto.yorkie.v1.DetachDocumentRequest} request The - * request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!Promise} - * Promise that resolves to the response - */ -proto.yorkie.v1.YorkieServicePromiseClient.prototype.detachDocument = - function(request, metadata) { - return this.client_.unaryCall(this.hostname_ + - '/yorkie.v1.YorkieService/DetachDocument', - request, - metadata || {}, - methodDescriptor_YorkieService_DetachDocument); -}; - - -/** - * @const - * @type {!grpc.web.MethodDescriptor< - * !proto.yorkie.v1.RemoveDocumentRequest, - * !proto.yorkie.v1.RemoveDocumentResponse>} - */ -const methodDescriptor_YorkieService_RemoveDocument = new grpc.web.MethodDescriptor( - '/yorkie.v1.YorkieService/RemoveDocument', - grpc.web.MethodType.UNARY, - proto.yorkie.v1.RemoveDocumentRequest, - proto.yorkie.v1.RemoveDocumentResponse, - /** - * @param {!proto.yorkie.v1.RemoveDocumentRequest} request - * @return {!Uint8Array} - */ - function(request) { - return request.serializeBinary(); - }, - proto.yorkie.v1.RemoveDocumentResponse.deserializeBinary -); - - -/** - * @param {!proto.yorkie.v1.RemoveDocumentRequest} request The - * request proto - * @param {?Object} metadata User defined - * call metadata - * @param {function(?grpc.web.RpcError, ?proto.yorkie.v1.RemoveDocumentResponse)} - * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} - * The XHR Node Readable Stream - */ -proto.yorkie.v1.YorkieServiceClient.prototype.removeDocument = - function(request, metadata, callback) { - return this.client_.rpcCall(this.hostname_ + - '/yorkie.v1.YorkieService/RemoveDocument', - request, - metadata || {}, - methodDescriptor_YorkieService_RemoveDocument, - callback); -}; - - -/** - * @param {!proto.yorkie.v1.RemoveDocumentRequest} request The - * request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!Promise} - * Promise that resolves to the response - */ -proto.yorkie.v1.YorkieServicePromiseClient.prototype.removeDocument = - function(request, metadata) { - return this.client_.unaryCall(this.hostname_ + - '/yorkie.v1.YorkieService/RemoveDocument', - request, - metadata || {}, - methodDescriptor_YorkieService_RemoveDocument); -}; - - -/** - * @const - * @type {!grpc.web.MethodDescriptor< - * !proto.yorkie.v1.PushPullChangesRequest, - * !proto.yorkie.v1.PushPullChangesResponse>} - */ -const methodDescriptor_YorkieService_PushPullChanges = new grpc.web.MethodDescriptor( - '/yorkie.v1.YorkieService/PushPullChanges', - grpc.web.MethodType.UNARY, - proto.yorkie.v1.PushPullChangesRequest, - proto.yorkie.v1.PushPullChangesResponse, - /** - * @param {!proto.yorkie.v1.PushPullChangesRequest} request - * @return {!Uint8Array} - */ - function(request) { - return request.serializeBinary(); - }, - proto.yorkie.v1.PushPullChangesResponse.deserializeBinary -); - - -/** - * @param {!proto.yorkie.v1.PushPullChangesRequest} request The - * request proto - * @param {?Object} metadata User defined - * call metadata - * @param {function(?grpc.web.RpcError, ?proto.yorkie.v1.PushPullChangesResponse)} - * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} - * The XHR Node Readable Stream - */ -proto.yorkie.v1.YorkieServiceClient.prototype.pushPullChanges = - function(request, metadata, callback) { - return this.client_.rpcCall(this.hostname_ + - '/yorkie.v1.YorkieService/PushPullChanges', - request, - metadata || {}, - methodDescriptor_YorkieService_PushPullChanges, - callback); -}; - - -/** - * @param {!proto.yorkie.v1.PushPullChangesRequest} request The - * request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!Promise} - * Promise that resolves to the response - */ -proto.yorkie.v1.YorkieServicePromiseClient.prototype.pushPullChanges = - function(request, metadata) { - return this.client_.unaryCall(this.hostname_ + - '/yorkie.v1.YorkieService/PushPullChanges', - request, - metadata || {}, - methodDescriptor_YorkieService_PushPullChanges); -}; - - -/** - * @const - * @type {!grpc.web.MethodDescriptor< - * !proto.yorkie.v1.WatchDocumentRequest, - * !proto.yorkie.v1.WatchDocumentResponse>} - */ -const methodDescriptor_YorkieService_WatchDocument = new grpc.web.MethodDescriptor( - '/yorkie.v1.YorkieService/WatchDocument', - grpc.web.MethodType.SERVER_STREAMING, - proto.yorkie.v1.WatchDocumentRequest, - proto.yorkie.v1.WatchDocumentResponse, - /** - * @param {!proto.yorkie.v1.WatchDocumentRequest} request - * @return {!Uint8Array} - */ - function(request) { - return request.serializeBinary(); - }, - proto.yorkie.v1.WatchDocumentResponse.deserializeBinary -); - - -/** - * @param {!proto.yorkie.v1.WatchDocumentRequest} request The request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!grpc.web.ClientReadableStream} - * The XHR Node Readable Stream - */ -proto.yorkie.v1.YorkieServiceClient.prototype.watchDocument = - function(request, metadata) { - return this.client_.serverStreaming(this.hostname_ + - '/yorkie.v1.YorkieService/WatchDocument', - request, - metadata || {}, - methodDescriptor_YorkieService_WatchDocument); -}; - - -/** - * @param {!proto.yorkie.v1.WatchDocumentRequest} request The request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!grpc.web.ClientReadableStream} - * The XHR Node Readable Stream - */ -proto.yorkie.v1.YorkieServicePromiseClient.prototype.watchDocument = - function(request, metadata) { - return this.client_.serverStreaming(this.hostname_ + - '/yorkie.v1.YorkieService/WatchDocument', - request, - metadata || {}, - methodDescriptor_YorkieService_WatchDocument); -}; - - -/** - * @const - * @type {!grpc.web.MethodDescriptor< - * !proto.yorkie.v1.BroadcastRequest, - * !proto.yorkie.v1.BroadcastResponse>} - */ -const methodDescriptor_YorkieService_Broadcast = new grpc.web.MethodDescriptor( - '/yorkie.v1.YorkieService/Broadcast', - grpc.web.MethodType.UNARY, - proto.yorkie.v1.BroadcastRequest, - proto.yorkie.v1.BroadcastResponse, - /** - * @param {!proto.yorkie.v1.BroadcastRequest} request - * @return {!Uint8Array} - */ - function(request) { - return request.serializeBinary(); - }, - proto.yorkie.v1.BroadcastResponse.deserializeBinary -); - - -/** - * @param {!proto.yorkie.v1.BroadcastRequest} request The - * request proto - * @param {?Object} metadata User defined - * call metadata - * @param {function(?grpc.web.RpcError, ?proto.yorkie.v1.BroadcastResponse)} - * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} - * The XHR Node Readable Stream - */ -proto.yorkie.v1.YorkieServiceClient.prototype.broadcast = - function(request, metadata, callback) { - return this.client_.rpcCall(this.hostname_ + - '/yorkie.v1.YorkieService/Broadcast', - request, - metadata || {}, - methodDescriptor_YorkieService_Broadcast, - callback); -}; - - -/** - * @param {!proto.yorkie.v1.BroadcastRequest} request The - * request proto - * @param {?Object=} metadata User defined - * call metadata - * @return {!Promise} - * Promise that resolves to the response - */ -proto.yorkie.v1.YorkieServicePromiseClient.prototype.broadcast = - function(request, metadata) { - return this.client_.unaryCall(this.hostname_ + - '/yorkie.v1.YorkieService/Broadcast', - request, - metadata || {}, - methodDescriptor_YorkieService_Broadcast); -}; - - -module.exports = proto.yorkie.v1; - diff --git a/src/api/yorkie/v1/yorkie_pb.d.ts b/src/api/yorkie/v1/yorkie_pb.d.ts index 0a3992403..0c685f6ad 100644 --- a/src/api/yorkie/v1/yorkie_pb.d.ts +++ b/src/api/yorkie/v1/yorkie_pb.d.ts @@ -1,396 +1,504 @@ -import * as jspb from 'google-protobuf' +// +// 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. -import * as yorkie_v1_resources_pb from '../../yorkie/v1/resources_pb'; +// @generated by protoc-gen-es v1.6.0 with parameter "target=js+dts,js_import_style=legacy_commonjs" +// @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"; -export class ActivateClientRequest extends jspb.Message { - getClientKey(): string; - setClientKey(value: string): ActivateClientRequest; +/** + * @generated from message yorkie.v1.ActivateClientRequest + */ +export declare class ActivateClientRequest extends Message { + /** + * @generated from field: string client_key = 1; + */ + clientKey: string; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ActivateClientRequest.AsObject; - static toObject(includeInstance: boolean, msg: ActivateClientRequest): ActivateClientRequest.AsObject; - static serializeBinaryToWriter(message: ActivateClientRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ActivateClientRequest; - static deserializeBinaryFromReader(message: ActivateClientRequest, reader: jspb.BinaryReader): ActivateClientRequest; -} + constructor(data?: PartialMessage); -export namespace ActivateClientRequest { - export type AsObject = { - clientKey: string, - } -} + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ActivateClientRequest"; + static readonly fields: FieldList; -export class ActivateClientResponse extends jspb.Message { - getClientId(): string; - setClientId(value: string): ActivateClientResponse; + static fromBinary(bytes: Uint8Array, options?: Partial): ActivateClientRequest; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ActivateClientResponse.AsObject; - static toObject(includeInstance: boolean, msg: ActivateClientResponse): ActivateClientResponse.AsObject; - static serializeBinaryToWriter(message: ActivateClientResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ActivateClientResponse; - static deserializeBinaryFromReader(message: ActivateClientResponse, reader: jspb.BinaryReader): ActivateClientResponse; -} + static fromJson(jsonValue: JsonValue, options?: Partial): ActivateClientRequest; -export namespace ActivateClientResponse { - export type AsObject = { - clientId: string, - } + static fromJsonString(jsonString: string, options?: Partial): ActivateClientRequest; + + static equals(a: ActivateClientRequest | PlainMessage | undefined, b: ActivateClientRequest | PlainMessage | undefined): boolean; } -export class DeactivateClientRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): DeactivateClientRequest; +/** + * @generated from message yorkie.v1.ActivateClientResponse + */ +export declare class ActivateClientResponse extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DeactivateClientRequest.AsObject; - static toObject(includeInstance: boolean, msg: DeactivateClientRequest): DeactivateClientRequest.AsObject; - static serializeBinaryToWriter(message: DeactivateClientRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DeactivateClientRequest; - static deserializeBinaryFromReader(message: DeactivateClientRequest, reader: jspb.BinaryReader): DeactivateClientRequest; -} + constructor(data?: PartialMessage); -export namespace DeactivateClientRequest { - export type AsObject = { - clientId: string, - } -} + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ActivateClientResponse"; + static readonly fields: FieldList; -export class DeactivateClientResponse extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DeactivateClientResponse.AsObject; - static toObject(includeInstance: boolean, msg: DeactivateClientResponse): DeactivateClientResponse.AsObject; - static serializeBinaryToWriter(message: DeactivateClientResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DeactivateClientResponse; - static deserializeBinaryFromReader(message: DeactivateClientResponse, reader: jspb.BinaryReader): DeactivateClientResponse; -} + static fromBinary(bytes: Uint8Array, options?: Partial): ActivateClientResponse; -export namespace DeactivateClientResponse { - export type AsObject = { - } -} + static fromJson(jsonValue: JsonValue, options?: Partial): ActivateClientResponse; -export class AttachDocumentRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): AttachDocumentRequest; - - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): AttachDocumentRequest; - hasChangePack(): boolean; - clearChangePack(): AttachDocumentRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): AttachDocumentRequest.AsObject; - static toObject(includeInstance: boolean, msg: AttachDocumentRequest): AttachDocumentRequest.AsObject; - static serializeBinaryToWriter(message: AttachDocumentRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): AttachDocumentRequest; - static deserializeBinaryFromReader(message: AttachDocumentRequest, reader: jspb.BinaryReader): AttachDocumentRequest; -} + static fromJsonString(jsonString: string, options?: Partial): ActivateClientResponse; -export namespace AttachDocumentRequest { - export type AsObject = { - clientId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } + static equals(a: ActivateClientResponse | PlainMessage | undefined, b: ActivateClientResponse | PlainMessage | undefined): boolean; } -export class AttachDocumentResponse extends jspb.Message { - getDocumentId(): string; - setDocumentId(value: string): AttachDocumentResponse; - - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): AttachDocumentResponse; - hasChangePack(): boolean; - clearChangePack(): AttachDocumentResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): AttachDocumentResponse.AsObject; - static toObject(includeInstance: boolean, msg: AttachDocumentResponse): AttachDocumentResponse.AsObject; - static serializeBinaryToWriter(message: AttachDocumentResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): AttachDocumentResponse; - static deserializeBinaryFromReader(message: AttachDocumentResponse, reader: jspb.BinaryReader): AttachDocumentResponse; -} +/** + * @generated from message yorkie.v1.DeactivateClientRequest + */ +export declare class DeactivateClientRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; -export namespace AttachDocumentResponse { - export type AsObject = { - documentId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } -} + constructor(data?: PartialMessage); -export class DetachDocumentRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): DetachDocumentRequest; + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DeactivateClientRequest"; + static readonly fields: FieldList; - getDocumentId(): string; - setDocumentId(value: string): DetachDocumentRequest; + static fromBinary(bytes: Uint8Array, options?: Partial): DeactivateClientRequest; - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): DetachDocumentRequest; - hasChangePack(): boolean; - clearChangePack(): DetachDocumentRequest; + static fromJson(jsonValue: JsonValue, options?: Partial): DeactivateClientRequest; - getRemoveIfNotAttached(): boolean; - setRemoveIfNotAttached(value: boolean): DetachDocumentRequest; + static fromJsonString(jsonString: string, options?: Partial): DeactivateClientRequest; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DetachDocumentRequest.AsObject; - static toObject(includeInstance: boolean, msg: DetachDocumentRequest): DetachDocumentRequest.AsObject; - static serializeBinaryToWriter(message: DetachDocumentRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DetachDocumentRequest; - static deserializeBinaryFromReader(message: DetachDocumentRequest, reader: jspb.BinaryReader): DetachDocumentRequest; + static equals(a: DeactivateClientRequest | PlainMessage | undefined, b: DeactivateClientRequest | PlainMessage | undefined): boolean; } -export namespace DetachDocumentRequest { - export type AsObject = { - clientId: string, - documentId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - removeIfNotAttached: boolean, - } -} +/** + * @generated from message yorkie.v1.DeactivateClientResponse + */ +export declare class DeactivateClientResponse extends Message { + constructor(data?: PartialMessage); -export class DetachDocumentResponse extends jspb.Message { - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): DetachDocumentResponse; - hasChangePack(): boolean; - clearChangePack(): DetachDocumentResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DetachDocumentResponse.AsObject; - static toObject(includeInstance: boolean, msg: DetachDocumentResponse): DetachDocumentResponse.AsObject; - static serializeBinaryToWriter(message: DetachDocumentResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DetachDocumentResponse; - static deserializeBinaryFromReader(message: DetachDocumentResponse, reader: jspb.BinaryReader): DetachDocumentResponse; -} + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DeactivateClientResponse"; + static readonly fields: FieldList; -export namespace DetachDocumentResponse { - export type AsObject = { - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } -} + static fromBinary(bytes: Uint8Array, options?: Partial): DeactivateClientResponse; -export class WatchDocumentRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): WatchDocumentRequest; + static fromJson(jsonValue: JsonValue, options?: Partial): DeactivateClientResponse; - getDocumentId(): string; - setDocumentId(value: string): WatchDocumentRequest; + static fromJsonString(jsonString: string, options?: Partial): DeactivateClientResponse; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): WatchDocumentRequest.AsObject; - static toObject(includeInstance: boolean, msg: WatchDocumentRequest): WatchDocumentRequest.AsObject; - static serializeBinaryToWriter(message: WatchDocumentRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): WatchDocumentRequest; - static deserializeBinaryFromReader(message: WatchDocumentRequest, reader: jspb.BinaryReader): WatchDocumentRequest; + static equals(a: DeactivateClientResponse | PlainMessage | undefined, b: DeactivateClientResponse | PlainMessage | undefined): boolean; } -export namespace WatchDocumentRequest { - export type AsObject = { - clientId: string, - documentId: string, - } -} +/** + * @generated from message yorkie.v1.AttachDocumentRequest + */ +export declare class AttachDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; -export class WatchDocumentResponse extends jspb.Message { - getInitialization(): WatchDocumentResponse.Initialization | undefined; - setInitialization(value?: WatchDocumentResponse.Initialization): WatchDocumentResponse; - hasInitialization(): boolean; - clearInitialization(): WatchDocumentResponse; - - getEvent(): yorkie_v1_resources_pb.DocEvent | undefined; - setEvent(value?: yorkie_v1_resources_pb.DocEvent): WatchDocumentResponse; - hasEvent(): boolean; - clearEvent(): WatchDocumentResponse; - - getBodyCase(): WatchDocumentResponse.BodyCase; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): WatchDocumentResponse.AsObject; - static toObject(includeInstance: boolean, msg: WatchDocumentResponse): WatchDocumentResponse.AsObject; - static serializeBinaryToWriter(message: WatchDocumentResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): WatchDocumentResponse; - static deserializeBinaryFromReader(message: WatchDocumentResponse, reader: jspb.BinaryReader): WatchDocumentResponse; -} + /** + * @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; -export namespace WatchDocumentResponse { - export type AsObject = { - initialization?: WatchDocumentResponse.Initialization.AsObject, - event?: yorkie_v1_resources_pb.DocEvent.AsObject, - } - - export class Initialization extends jspb.Message { - getClientIdsList(): Array; - setClientIdsList(value: Array): Initialization; - clearClientIdsList(): Initialization; - addClientIds(value: string, index?: number): Initialization; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Initialization.AsObject; - static toObject(includeInstance: boolean, msg: Initialization): Initialization.AsObject; - static serializeBinaryToWriter(message: Initialization, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Initialization; - static deserializeBinaryFromReader(message: Initialization, reader: jspb.BinaryReader): Initialization; - } - - export namespace Initialization { - export type AsObject = { - clientIdsList: Array, - } - } - - - export enum BodyCase { - BODY_NOT_SET = 0, - INITIALIZATION = 1, - EVENT = 2, - } + 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; } -export class RemoveDocumentRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): RemoveDocumentRequest; +/** + * @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; - getDocumentId(): string; - setDocumentId(value: string): RemoveDocumentRequest; + static fromBinary(bytes: Uint8Array, options?: Partial): AttachDocumentResponse; - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): RemoveDocumentRequest; - hasChangePack(): boolean; - clearChangePack(): RemoveDocumentRequest; + static fromJson(jsonValue: JsonValue, options?: Partial): AttachDocumentResponse; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): RemoveDocumentRequest.AsObject; - static toObject(includeInstance: boolean, msg: RemoveDocumentRequest): RemoveDocumentRequest.AsObject; - static serializeBinaryToWriter(message: RemoveDocumentRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): RemoveDocumentRequest; - static deserializeBinaryFromReader(message: RemoveDocumentRequest, reader: jspb.BinaryReader): RemoveDocumentRequest; + static fromJsonString(jsonString: string, options?: Partial): AttachDocumentResponse; + + static equals(a: AttachDocumentResponse | PlainMessage | undefined, b: AttachDocumentResponse | PlainMessage | undefined): boolean; } -export namespace RemoveDocumentRequest { - export type AsObject = { - clientId: string, - documentId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } +/** + * @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; } -export class RemoveDocumentResponse extends jspb.Message { - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): RemoveDocumentResponse; - hasChangePack(): boolean; - clearChangePack(): RemoveDocumentResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): RemoveDocumentResponse.AsObject; - static toObject(includeInstance: boolean, msg: RemoveDocumentResponse): RemoveDocumentResponse.AsObject; - static serializeBinaryToWriter(message: RemoveDocumentResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): RemoveDocumentResponse; - static deserializeBinaryFromReader(message: RemoveDocumentResponse, reader: jspb.BinaryReader): RemoveDocumentResponse; +/** + * @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; } -export namespace RemoveDocumentResponse { - export type AsObject = { - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } +/** + * @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; } -export class PushPullChangesRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): PushPullChangesRequest; +/** + * @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 }; - getDocumentId(): string; - setDocumentId(value: string): PushPullChangesRequest; + constructor(data?: PartialMessage); - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): PushPullChangesRequest; - hasChangePack(): boolean; - clearChangePack(): PushPullChangesRequest; + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.WatchDocumentResponse"; + static readonly fields: FieldList; - getPushOnly(): boolean; - setPushOnly(value: boolean): PushPullChangesRequest; + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentResponse; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PushPullChangesRequest.AsObject; - static toObject(includeInstance: boolean, msg: PushPullChangesRequest): PushPullChangesRequest.AsObject; - static serializeBinaryToWriter(message: PushPullChangesRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PushPullChangesRequest; - static deserializeBinaryFromReader(message: PushPullChangesRequest, reader: jspb.BinaryReader): PushPullChangesRequest; + 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; } -export namespace PushPullChangesRequest { - export type AsObject = { - clientId: string, - documentId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - pushOnly: 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; } -export class PushPullChangesResponse extends jspb.Message { - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): PushPullChangesResponse; - hasChangePack(): boolean; - clearChangePack(): PushPullChangesResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PushPullChangesResponse.AsObject; - static toObject(includeInstance: boolean, msg: PushPullChangesResponse): PushPullChangesResponse.AsObject; - static serializeBinaryToWriter(message: PushPullChangesResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PushPullChangesResponse; - static deserializeBinaryFromReader(message: PushPullChangesResponse, reader: jspb.BinaryReader): PushPullChangesResponse; +/** + * @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; } -export namespace PushPullChangesResponse { - export type AsObject = { - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } +/** + * @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; } -export class BroadcastRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): BroadcastRequest; +/** + * @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; - getDocumentId(): string; - setDocumentId(value: string): BroadcastRequest; + /** + * @generated from field: bool push_only = 4; + */ + pushOnly: boolean; - getTopic(): string; - setTopic(value: string): BroadcastRequest; + constructor(data?: PartialMessage); - getPayload(): Uint8Array | string; - getPayload_asU8(): Uint8Array; - getPayload_asB64(): string; - setPayload(value: Uint8Array | string): BroadcastRequest; + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.PushPullChangesRequest"; + static readonly fields: FieldList; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): BroadcastRequest.AsObject; - static toObject(includeInstance: boolean, msg: BroadcastRequest): BroadcastRequest.AsObject; - static serializeBinaryToWriter(message: BroadcastRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): BroadcastRequest; - static deserializeBinaryFromReader(message: BroadcastRequest, reader: jspb.BinaryReader): BroadcastRequest; + 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; } -export namespace BroadcastRequest { - export type AsObject = { - clientId: string, - documentId: string, - topic: string, - payload: Uint8Array | string, - } +/** + * @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; } -export class BroadcastResponse extends jspb.Message { - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): BroadcastResponse.AsObject; - static toObject(includeInstance: boolean, msg: BroadcastResponse): BroadcastResponse.AsObject; - static serializeBinaryToWriter(message: BroadcastResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): BroadcastResponse; - static deserializeBinaryFromReader(message: BroadcastResponse, reader: jspb.BinaryReader): BroadcastResponse; +/** + * @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; } -export namespace BroadcastResponse { - export type AsObject = { - } +/** + * @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 index 553b34687..97b8ad6e8 100644 --- a/src/api/yorkie/v1/yorkie_pb.js +++ b/src/api/yorkie/v1/yorkie_pb.js @@ -1,3289 +1,226 @@ -// source: yorkie/v1/yorkie.proto -/** - * @fileoverview - * @enhanceable - * @suppress {missingRequire} reports error on implicit type usages. - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! +// +// 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.6.0 with parameter "target=js+dts,js_import_style=legacy_commonjs" +// @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) /* eslint-disable */ // @ts-nocheck -var jspb = require('google-protobuf'); -var goog = jspb; -var global = - (typeof globalThis !== 'undefined' && globalThis) || - (typeof window !== 'undefined' && window) || - (typeof global !== 'undefined' && global) || - (typeof self !== 'undefined' && self) || - (function () { return this; }).call(null) || - Function('return this')(); - -var yorkie_v1_resources_pb = require('../../yorkie/v1/resources_pb.js'); -goog.object.extend(proto, yorkie_v1_resources_pb); -goog.exportSymbol('proto.yorkie.v1.ActivateClientRequest', null, global); -goog.exportSymbol('proto.yorkie.v1.ActivateClientResponse', null, global); -goog.exportSymbol('proto.yorkie.v1.AttachDocumentRequest', null, global); -goog.exportSymbol('proto.yorkie.v1.AttachDocumentResponse', null, global); -goog.exportSymbol('proto.yorkie.v1.BroadcastRequest', null, global); -goog.exportSymbol('proto.yorkie.v1.BroadcastResponse', null, global); -goog.exportSymbol('proto.yorkie.v1.DeactivateClientRequest', null, global); -goog.exportSymbol('proto.yorkie.v1.DeactivateClientResponse', null, global); -goog.exportSymbol('proto.yorkie.v1.DetachDocumentRequest', null, global); -goog.exportSymbol('proto.yorkie.v1.DetachDocumentResponse', null, global); -goog.exportSymbol('proto.yorkie.v1.PushPullChangesRequest', null, global); -goog.exportSymbol('proto.yorkie.v1.PushPullChangesResponse', null, global); -goog.exportSymbol('proto.yorkie.v1.RemoveDocumentRequest', null, global); -goog.exportSymbol('proto.yorkie.v1.RemoveDocumentResponse', null, global); -goog.exportSymbol('proto.yorkie.v1.WatchDocumentRequest', null, global); -goog.exportSymbol('proto.yorkie.v1.WatchDocumentResponse', null, global); -goog.exportSymbol('proto.yorkie.v1.WatchDocumentResponse.BodyCase', null, global); -goog.exportSymbol('proto.yorkie.v1.WatchDocumentResponse.Initialization', null, global); -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.ActivateClientRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.ActivateClientRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.ActivateClientRequest.displayName = 'proto.yorkie.v1.ActivateClientRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.ActivateClientResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.ActivateClientResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.ActivateClientResponse.displayName = 'proto.yorkie.v1.ActivateClientResponse'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.DeactivateClientRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.DeactivateClientRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.DeactivateClientRequest.displayName = 'proto.yorkie.v1.DeactivateClientRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.DeactivateClientResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.DeactivateClientResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.DeactivateClientResponse.displayName = 'proto.yorkie.v1.DeactivateClientResponse'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.AttachDocumentRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.AttachDocumentRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.AttachDocumentRequest.displayName = 'proto.yorkie.v1.AttachDocumentRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.AttachDocumentResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.AttachDocumentResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.AttachDocumentResponse.displayName = 'proto.yorkie.v1.AttachDocumentResponse'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.DetachDocumentRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.DetachDocumentRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.DetachDocumentRequest.displayName = 'proto.yorkie.v1.DetachDocumentRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.DetachDocumentResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.DetachDocumentResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.DetachDocumentResponse.displayName = 'proto.yorkie.v1.DetachDocumentResponse'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.WatchDocumentRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.WatchDocumentRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.WatchDocumentRequest.displayName = 'proto.yorkie.v1.WatchDocumentRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.WatchDocumentResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, proto.yorkie.v1.WatchDocumentResponse.oneofGroups_); -}; -goog.inherits(proto.yorkie.v1.WatchDocumentResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.WatchDocumentResponse.displayName = 'proto.yorkie.v1.WatchDocumentResponse'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.yorkie.v1.WatchDocumentResponse.Initialization.repeatedFields_, null); -}; -goog.inherits(proto.yorkie.v1.WatchDocumentResponse.Initialization, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.WatchDocumentResponse.Initialization.displayName = 'proto.yorkie.v1.WatchDocumentResponse.Initialization'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.RemoveDocumentRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.RemoveDocumentRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.RemoveDocumentRequest.displayName = 'proto.yorkie.v1.RemoveDocumentRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.RemoveDocumentResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.RemoveDocumentResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.RemoveDocumentResponse.displayName = 'proto.yorkie.v1.RemoveDocumentResponse'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.PushPullChangesRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.PushPullChangesRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.PushPullChangesRequest.displayName = 'proto.yorkie.v1.PushPullChangesRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.PushPullChangesResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.PushPullChangesResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.PushPullChangesResponse.displayName = 'proto.yorkie.v1.PushPullChangesResponse'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.BroadcastRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.BroadcastRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.BroadcastRequest.displayName = 'proto.yorkie.v1.BroadcastRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.yorkie.v1.BroadcastResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.yorkie.v1.BroadcastResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.yorkie.v1.BroadcastResponse.displayName = 'proto.yorkie.v1.BroadcastResponse'; -} - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.ActivateClientRequest.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.ActivateClientRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.ActivateClientRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.ActivateClientRequest.toObject = function(includeInstance, msg) { - var f, obj = { - clientKey: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.ActivateClientRequest} - */ -proto.yorkie.v1.ActivateClientRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.ActivateClientRequest; - return proto.yorkie.v1.ActivateClientRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.ActivateClientRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.ActivateClientRequest} - */ -proto.yorkie.v1.ActivateClientRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setClientKey(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.ActivateClientRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.ActivateClientRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.ActivateClientRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.ActivateClientRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientKey(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string client_key = 1; - * @return {string} - */ -proto.yorkie.v1.ActivateClientRequest.prototype.getClientKey = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.ActivateClientRequest} returns this - */ -proto.yorkie.v1.ActivateClientRequest.prototype.setClientKey = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.ActivateClientResponse.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.ActivateClientResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.ActivateClientResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.ActivateClientResponse.toObject = function(includeInstance, msg) { - var f, obj = { - clientId: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.ActivateClientResponse} - */ -proto.yorkie.v1.ActivateClientResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.ActivateClientResponse; - return proto.yorkie.v1.ActivateClientResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.ActivateClientResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.ActivateClientResponse} - */ -proto.yorkie.v1.ActivateClientResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setClientId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.ActivateClientResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.ActivateClientResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.ActivateClientResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.ActivateClientResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string client_id = 1; - * @return {string} - */ -proto.yorkie.v1.ActivateClientResponse.prototype.getClientId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.ActivateClientResponse} returns this - */ -proto.yorkie.v1.ActivateClientResponse.prototype.setClientId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.DeactivateClientRequest.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.DeactivateClientRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.DeactivateClientRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DeactivateClientRequest.toObject = function(includeInstance, msg) { - var f, obj = { - clientId: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.DeactivateClientRequest} - */ -proto.yorkie.v1.DeactivateClientRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.DeactivateClientRequest; - return proto.yorkie.v1.DeactivateClientRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.DeactivateClientRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.DeactivateClientRequest} - */ -proto.yorkie.v1.DeactivateClientRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setClientId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.DeactivateClientRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.DeactivateClientRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.DeactivateClientRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DeactivateClientRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string client_id = 1; - * @return {string} - */ -proto.yorkie.v1.DeactivateClientRequest.prototype.getClientId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.DeactivateClientRequest} returns this - */ -proto.yorkie.v1.DeactivateClientRequest.prototype.setClientId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.DeactivateClientResponse.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.DeactivateClientResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.DeactivateClientResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DeactivateClientResponse.toObject = function(includeInstance, msg) { - var f, obj = { - - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.DeactivateClientResponse} - */ -proto.yorkie.v1.DeactivateClientResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.DeactivateClientResponse; - return proto.yorkie.v1.DeactivateClientResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.DeactivateClientResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.DeactivateClientResponse} - */ -proto.yorkie.v1.DeactivateClientResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.DeactivateClientResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.DeactivateClientResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.DeactivateClientResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DeactivateClientResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.AttachDocumentRequest.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.AttachDocumentRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.AttachDocumentRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.AttachDocumentRequest.toObject = function(includeInstance, msg) { - var f, obj = { - clientId: jspb.Message.getFieldWithDefault(msg, 1, ""), - changePack: (f = msg.getChangePack()) && yorkie_v1_resources_pb.ChangePack.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.AttachDocumentRequest} - */ -proto.yorkie.v1.AttachDocumentRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.AttachDocumentRequest; - return proto.yorkie.v1.AttachDocumentRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.AttachDocumentRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.AttachDocumentRequest} - */ -proto.yorkie.v1.AttachDocumentRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setClientId(value); - break; - case 2: - var value = new yorkie_v1_resources_pb.ChangePack; - reader.readMessage(value,yorkie_v1_resources_pb.ChangePack.deserializeBinaryFromReader); - msg.setChangePack(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const { proto3 } = require("@bufbuild/protobuf"); +const { ChangePack, DocEvent } = require("./resources_pb.js"); /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * @generated from message yorkie.v1.ActivateClientRequest */ -proto.yorkie.v1.AttachDocumentRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.AttachDocumentRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.AttachDocumentRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.AttachDocumentRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getChangePack(); - if (f != null) { - writer.writeMessage( - 2, - f, - yorkie_v1_resources_pb.ChangePack.serializeBinaryToWriter - ); - } -}; - - -/** - * optional string client_id = 1; - * @return {string} - */ -proto.yorkie.v1.AttachDocumentRequest.prototype.getClientId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.AttachDocumentRequest} returns this - */ -proto.yorkie.v1.AttachDocumentRequest.prototype.setClientId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional ChangePack change_pack = 2; - * @return {?proto.yorkie.v1.ChangePack} - */ -proto.yorkie.v1.AttachDocumentRequest.prototype.getChangePack = function() { - return /** @type{?proto.yorkie.v1.ChangePack} */ ( - jspb.Message.getWrapperField(this, yorkie_v1_resources_pb.ChangePack, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.ChangePack|undefined} value - * @return {!proto.yorkie.v1.AttachDocumentRequest} returns this -*/ -proto.yorkie.v1.AttachDocumentRequest.prototype.setChangePack = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.AttachDocumentRequest} returns this - */ -proto.yorkie.v1.AttachDocumentRequest.prototype.clearChangePack = function() { - return this.setChangePack(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.AttachDocumentRequest.prototype.hasChangePack = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.AttachDocumentResponse.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.AttachDocumentResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.AttachDocumentResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.AttachDocumentResponse.toObject = function(includeInstance, msg) { - var f, obj = { - documentId: jspb.Message.getFieldWithDefault(msg, 1, ""), - changePack: (f = msg.getChangePack()) && yorkie_v1_resources_pb.ChangePack.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - +const ActivateClientRequest = proto3.makeMessageType( + "yorkie.v1.ActivateClientRequest", + () => [ + { no: 1, name: "client_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.AttachDocumentResponse} + * @generated from message yorkie.v1.ActivateClientResponse */ -proto.yorkie.v1.AttachDocumentResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.AttachDocumentResponse; - return proto.yorkie.v1.AttachDocumentResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.AttachDocumentResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.AttachDocumentResponse} - */ -proto.yorkie.v1.AttachDocumentResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentId(value); - break; - case 2: - var value = new yorkie_v1_resources_pb.ChangePack; - reader.readMessage(value,yorkie_v1_resources_pb.ChangePack.deserializeBinaryFromReader); - msg.setChangePack(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - +const ActivateClientResponse = proto3.makeMessageType( + "yorkie.v1.ActivateClientResponse", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * @generated from message yorkie.v1.DeactivateClientRequest */ -proto.yorkie.v1.AttachDocumentResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.AttachDocumentResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - +const DeactivateClientRequest = proto3.makeMessageType( + "yorkie.v1.DeactivateClientRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.AttachDocumentResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @generated from message yorkie.v1.DeactivateClientResponse */ -proto.yorkie.v1.AttachDocumentResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getDocumentId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getChangePack(); - if (f != null) { - writer.writeMessage( - 2, - f, - yorkie_v1_resources_pb.ChangePack.serializeBinaryToWriter - ); - } -}; - +const DeactivateClientResponse = proto3.makeMessageType( + "yorkie.v1.DeactivateClientResponse", + [], +); /** - * optional string document_id = 1; - * @return {string} + * @generated from message yorkie.v1.AttachDocumentRequest */ -proto.yorkie.v1.AttachDocumentResponse.prototype.getDocumentId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - +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 }, + ], +); /** - * @param {string} value - * @return {!proto.yorkie.v1.AttachDocumentResponse} returns this + * @generated from message yorkie.v1.AttachDocumentResponse */ -proto.yorkie.v1.AttachDocumentResponse.prototype.setDocumentId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - +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 }, + ], +); /** - * optional ChangePack change_pack = 2; - * @return {?proto.yorkie.v1.ChangePack} + * @generated from message yorkie.v1.DetachDocumentRequest */ -proto.yorkie.v1.AttachDocumentResponse.prototype.getChangePack = function() { - return /** @type{?proto.yorkie.v1.ChangePack} */ ( - jspb.Message.getWrapperField(this, yorkie_v1_resources_pb.ChangePack, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.ChangePack|undefined} value - * @return {!proto.yorkie.v1.AttachDocumentResponse} returns this -*/ -proto.yorkie.v1.AttachDocumentResponse.prototype.setChangePack = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - +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 */ }, + ], +); /** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.AttachDocumentResponse} returns this + * @generated from message yorkie.v1.DetachDocumentResponse */ -proto.yorkie.v1.AttachDocumentResponse.prototype.clearChangePack = function() { - return this.setChangePack(undefined); -}; - +const DetachDocumentResponse = proto3.makeMessageType( + "yorkie.v1.DetachDocumentResponse", + () => [ + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ], +); /** - * Returns whether this field is set. - * @return {boolean} + * @generated from message yorkie.v1.WatchDocumentRequest */ -proto.yorkie.v1.AttachDocumentResponse.prototype.hasChangePack = function() { - return jspb.Message.getField(this, 2) != null; -}; - - +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 */ }, + ], +); - - -if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} + * @generated from message yorkie.v1.WatchDocumentResponse */ -proto.yorkie.v1.DetachDocumentRequest.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.DetachDocumentRequest.toObject(opt_includeInstance, this); -}; - +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" }, + ], +); /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.DetachDocumentRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages + * @generated from message yorkie.v1.WatchDocumentResponse.Initialization */ -proto.yorkie.v1.DetachDocumentRequest.toObject = function(includeInstance, msg) { - var f, obj = { - clientId: jspb.Message.getFieldWithDefault(msg, 1, ""), - documentId: jspb.Message.getFieldWithDefault(msg, 2, ""), - changePack: (f = msg.getChangePack()) && yorkie_v1_resources_pb.ChangePack.toObject(includeInstance, f), - removeIfNotAttached: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - +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"}, +); /** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.DetachDocumentRequest} + * @generated from message yorkie.v1.RemoveDocumentRequest */ -proto.yorkie.v1.DetachDocumentRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.DetachDocumentRequest; - return proto.yorkie.v1.DetachDocumentRequest.deserializeBinaryFromReader(msg, reader); -}; - +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 }, + ], +); /** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.DetachDocumentRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.DetachDocumentRequest} + * @generated from message yorkie.v1.RemoveDocumentResponse */ -proto.yorkie.v1.DetachDocumentRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setClientId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentId(value); - break; - case 3: - var value = new yorkie_v1_resources_pb.ChangePack; - reader.readMessage(value,yorkie_v1_resources_pb.ChangePack.deserializeBinaryFromReader); - msg.setChangePack(value); - break; - case 4: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setRemoveIfNotAttached(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - +const RemoveDocumentResponse = proto3.makeMessageType( + "yorkie.v1.RemoveDocumentResponse", + () => [ + { no: 1, name: "change_pack", kind: "message", T: ChangePack }, + ], +); /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.DetachDocumentRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + * @generated from message yorkie.v1.PushPullChangesRequest + */ +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 + */ +const PushPullChangesResponse = proto3.makeMessageType( + "yorkie.v1.PushPullChangesResponse", + () => [ + { no: 1, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.BroadcastRequest + */ +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 */ }, + ], +); - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.DetachDocumentRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DetachDocumentRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getDocumentId(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getChangePack(); - if (f != null) { - writer.writeMessage( - 3, - f, - yorkie_v1_resources_pb.ChangePack.serializeBinaryToWriter - ); - } - f = message.getRemoveIfNotAttached(); - if (f) { - writer.writeBool( - 4, - f - ); - } -}; - - -/** - * optional string client_id = 1; - * @return {string} - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.getClientId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.DetachDocumentRequest} returns this - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.setClientId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string document_id = 2; - * @return {string} - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.getDocumentId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.DetachDocumentRequest} returns this - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.setDocumentId = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional ChangePack change_pack = 3; - * @return {?proto.yorkie.v1.ChangePack} - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.getChangePack = function() { - return /** @type{?proto.yorkie.v1.ChangePack} */ ( - jspb.Message.getWrapperField(this, yorkie_v1_resources_pb.ChangePack, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.ChangePack|undefined} value - * @return {!proto.yorkie.v1.DetachDocumentRequest} returns this -*/ -proto.yorkie.v1.DetachDocumentRequest.prototype.setChangePack = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.DetachDocumentRequest} returns this - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.clearChangePack = function() { - return this.setChangePack(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.hasChangePack = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional bool remove_if_not_attached = 4; - * @return {boolean} - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.getRemoveIfNotAttached = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.yorkie.v1.DetachDocumentRequest} returns this - */ -proto.yorkie.v1.DetachDocumentRequest.prototype.setRemoveIfNotAttached = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.DetachDocumentResponse.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.DetachDocumentResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.DetachDocumentResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DetachDocumentResponse.toObject = function(includeInstance, msg) { - var f, obj = { - changePack: (f = msg.getChangePack()) && yorkie_v1_resources_pb.ChangePack.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.DetachDocumentResponse} - */ -proto.yorkie.v1.DetachDocumentResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.DetachDocumentResponse; - return proto.yorkie.v1.DetachDocumentResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.DetachDocumentResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.DetachDocumentResponse} - */ -proto.yorkie.v1.DetachDocumentResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 2: - var value = new yorkie_v1_resources_pb.ChangePack; - reader.readMessage(value,yorkie_v1_resources_pb.ChangePack.deserializeBinaryFromReader); - msg.setChangePack(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.DetachDocumentResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.DetachDocumentResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.DetachDocumentResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.DetachDocumentResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getChangePack(); - if (f != null) { - writer.writeMessage( - 2, - f, - yorkie_v1_resources_pb.ChangePack.serializeBinaryToWriter - ); - } -}; - - -/** - * optional ChangePack change_pack = 2; - * @return {?proto.yorkie.v1.ChangePack} - */ -proto.yorkie.v1.DetachDocumentResponse.prototype.getChangePack = function() { - return /** @type{?proto.yorkie.v1.ChangePack} */ ( - jspb.Message.getWrapperField(this, yorkie_v1_resources_pb.ChangePack, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.ChangePack|undefined} value - * @return {!proto.yorkie.v1.DetachDocumentResponse} returns this -*/ -proto.yorkie.v1.DetachDocumentResponse.prototype.setChangePack = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.DetachDocumentResponse} returns this - */ -proto.yorkie.v1.DetachDocumentResponse.prototype.clearChangePack = function() { - return this.setChangePack(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.DetachDocumentResponse.prototype.hasChangePack = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.WatchDocumentRequest.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.WatchDocumentRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.WatchDocumentRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.WatchDocumentRequest.toObject = function(includeInstance, msg) { - var f, obj = { - clientId: jspb.Message.getFieldWithDefault(msg, 1, ""), - documentId: jspb.Message.getFieldWithDefault(msg, 2, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.WatchDocumentRequest} - */ -proto.yorkie.v1.WatchDocumentRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.WatchDocumentRequest; - return proto.yorkie.v1.WatchDocumentRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.WatchDocumentRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.WatchDocumentRequest} - */ -proto.yorkie.v1.WatchDocumentRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setClientId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.WatchDocumentRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.WatchDocumentRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.WatchDocumentRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.WatchDocumentRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getDocumentId(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } -}; - - -/** - * optional string client_id = 1; - * @return {string} - */ -proto.yorkie.v1.WatchDocumentRequest.prototype.getClientId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.WatchDocumentRequest} returns this - */ -proto.yorkie.v1.WatchDocumentRequest.prototype.setClientId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string document_id = 2; - * @return {string} - */ -proto.yorkie.v1.WatchDocumentRequest.prototype.getDocumentId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.WatchDocumentRequest} returns this - */ -proto.yorkie.v1.WatchDocumentRequest.prototype.setDocumentId = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - - -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -proto.yorkie.v1.WatchDocumentResponse.oneofGroups_ = [[1,2]]; - -/** - * @enum {number} - */ -proto.yorkie.v1.WatchDocumentResponse.BodyCase = { - BODY_NOT_SET: 0, - INITIALIZATION: 1, - EVENT: 2 -}; - -/** - * @return {proto.yorkie.v1.WatchDocumentResponse.BodyCase} - */ -proto.yorkie.v1.WatchDocumentResponse.prototype.getBodyCase = function() { - return /** @type {proto.yorkie.v1.WatchDocumentResponse.BodyCase} */(jspb.Message.computeOneofCase(this, proto.yorkie.v1.WatchDocumentResponse.oneofGroups_[0])); -}; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.WatchDocumentResponse.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.WatchDocumentResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.WatchDocumentResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.WatchDocumentResponse.toObject = function(includeInstance, msg) { - var f, obj = { - initialization: (f = msg.getInitialization()) && proto.yorkie.v1.WatchDocumentResponse.Initialization.toObject(includeInstance, f), - event: (f = msg.getEvent()) && yorkie_v1_resources_pb.DocEvent.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.WatchDocumentResponse} - */ -proto.yorkie.v1.WatchDocumentResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.WatchDocumentResponse; - return proto.yorkie.v1.WatchDocumentResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.WatchDocumentResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.WatchDocumentResponse} - */ -proto.yorkie.v1.WatchDocumentResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.yorkie.v1.WatchDocumentResponse.Initialization; - reader.readMessage(value,proto.yorkie.v1.WatchDocumentResponse.Initialization.deserializeBinaryFromReader); - msg.setInitialization(value); - break; - case 2: - var value = new yorkie_v1_resources_pb.DocEvent; - reader.readMessage(value,yorkie_v1_resources_pb.DocEvent.deserializeBinaryFromReader); - msg.setEvent(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.WatchDocumentResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.WatchDocumentResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.WatchDocumentResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.WatchDocumentResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getInitialization(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.yorkie.v1.WatchDocumentResponse.Initialization.serializeBinaryToWriter - ); - } - f = message.getEvent(); - if (f != null) { - writer.writeMessage( - 2, - f, - yorkie_v1_resources_pb.DocEvent.serializeBinaryToWriter - ); - } -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.WatchDocumentResponse.Initialization.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.WatchDocumentResponse.Initialization} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.toObject = function(includeInstance, msg) { - var f, obj = { - clientIdsList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.WatchDocumentResponse.Initialization} - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.WatchDocumentResponse.Initialization; - return proto.yorkie.v1.WatchDocumentResponse.Initialization.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.WatchDocumentResponse.Initialization} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.WatchDocumentResponse.Initialization} - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.addClientIds(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.WatchDocumentResponse.Initialization.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.WatchDocumentResponse.Initialization} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientIdsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 1, - f - ); - } -}; - - -/** - * repeated string client_ids = 1; - * @return {!Array} - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.prototype.getClientIdsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.yorkie.v1.WatchDocumentResponse.Initialization} returns this - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.prototype.setClientIdsList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; - - -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.yorkie.v1.WatchDocumentResponse.Initialization} returns this - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.prototype.addClientIds = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.yorkie.v1.WatchDocumentResponse.Initialization} returns this - */ -proto.yorkie.v1.WatchDocumentResponse.Initialization.prototype.clearClientIdsList = function() { - return this.setClientIdsList([]); -}; - - -/** - * optional Initialization initialization = 1; - * @return {?proto.yorkie.v1.WatchDocumentResponse.Initialization} - */ -proto.yorkie.v1.WatchDocumentResponse.prototype.getInitialization = function() { - return /** @type{?proto.yorkie.v1.WatchDocumentResponse.Initialization} */ ( - jspb.Message.getWrapperField(this, proto.yorkie.v1.WatchDocumentResponse.Initialization, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.WatchDocumentResponse.Initialization|undefined} value - * @return {!proto.yorkie.v1.WatchDocumentResponse} returns this -*/ -proto.yorkie.v1.WatchDocumentResponse.prototype.setInitialization = function(value) { - return jspb.Message.setOneofWrapperField(this, 1, proto.yorkie.v1.WatchDocumentResponse.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.WatchDocumentResponse} returns this - */ -proto.yorkie.v1.WatchDocumentResponse.prototype.clearInitialization = function() { - return this.setInitialization(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.WatchDocumentResponse.prototype.hasInitialization = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional DocEvent event = 2; - * @return {?proto.yorkie.v1.DocEvent} - */ -proto.yorkie.v1.WatchDocumentResponse.prototype.getEvent = function() { - return /** @type{?proto.yorkie.v1.DocEvent} */ ( - jspb.Message.getWrapperField(this, yorkie_v1_resources_pb.DocEvent, 2)); -}; - - -/** - * @param {?proto.yorkie.v1.DocEvent|undefined} value - * @return {!proto.yorkie.v1.WatchDocumentResponse} returns this -*/ -proto.yorkie.v1.WatchDocumentResponse.prototype.setEvent = function(value) { - return jspb.Message.setOneofWrapperField(this, 2, proto.yorkie.v1.WatchDocumentResponse.oneofGroups_[0], value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.WatchDocumentResponse} returns this - */ -proto.yorkie.v1.WatchDocumentResponse.prototype.clearEvent = function() { - return this.setEvent(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.WatchDocumentResponse.prototype.hasEvent = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.RemoveDocumentRequest.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.RemoveDocumentRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.RemoveDocumentRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.RemoveDocumentRequest.toObject = function(includeInstance, msg) { - var f, obj = { - clientId: jspb.Message.getFieldWithDefault(msg, 1, ""), - documentId: jspb.Message.getFieldWithDefault(msg, 2, ""), - changePack: (f = msg.getChangePack()) && yorkie_v1_resources_pb.ChangePack.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.RemoveDocumentRequest} - */ -proto.yorkie.v1.RemoveDocumentRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.RemoveDocumentRequest; - return proto.yorkie.v1.RemoveDocumentRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.RemoveDocumentRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.RemoveDocumentRequest} - */ -proto.yorkie.v1.RemoveDocumentRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setClientId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentId(value); - break; - case 3: - var value = new yorkie_v1_resources_pb.ChangePack; - reader.readMessage(value,yorkie_v1_resources_pb.ChangePack.deserializeBinaryFromReader); - msg.setChangePack(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.RemoveDocumentRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.RemoveDocumentRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.RemoveDocumentRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.RemoveDocumentRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getDocumentId(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getChangePack(); - if (f != null) { - writer.writeMessage( - 3, - f, - yorkie_v1_resources_pb.ChangePack.serializeBinaryToWriter - ); - } -}; - - -/** - * optional string client_id = 1; - * @return {string} - */ -proto.yorkie.v1.RemoveDocumentRequest.prototype.getClientId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.RemoveDocumentRequest} returns this - */ -proto.yorkie.v1.RemoveDocumentRequest.prototype.setClientId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string document_id = 2; - * @return {string} - */ -proto.yorkie.v1.RemoveDocumentRequest.prototype.getDocumentId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.RemoveDocumentRequest} returns this - */ -proto.yorkie.v1.RemoveDocumentRequest.prototype.setDocumentId = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional ChangePack change_pack = 3; - * @return {?proto.yorkie.v1.ChangePack} - */ -proto.yorkie.v1.RemoveDocumentRequest.prototype.getChangePack = function() { - return /** @type{?proto.yorkie.v1.ChangePack} */ ( - jspb.Message.getWrapperField(this, yorkie_v1_resources_pb.ChangePack, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.ChangePack|undefined} value - * @return {!proto.yorkie.v1.RemoveDocumentRequest} returns this -*/ -proto.yorkie.v1.RemoveDocumentRequest.prototype.setChangePack = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.RemoveDocumentRequest} returns this - */ -proto.yorkie.v1.RemoveDocumentRequest.prototype.clearChangePack = function() { - return this.setChangePack(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.RemoveDocumentRequest.prototype.hasChangePack = function() { - return jspb.Message.getField(this, 3) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.RemoveDocumentResponse.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.RemoveDocumentResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.RemoveDocumentResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.RemoveDocumentResponse.toObject = function(includeInstance, msg) { - var f, obj = { - changePack: (f = msg.getChangePack()) && yorkie_v1_resources_pb.ChangePack.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.RemoveDocumentResponse} - */ -proto.yorkie.v1.RemoveDocumentResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.RemoveDocumentResponse; - return proto.yorkie.v1.RemoveDocumentResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.RemoveDocumentResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.RemoveDocumentResponse} - */ -proto.yorkie.v1.RemoveDocumentResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new yorkie_v1_resources_pb.ChangePack; - reader.readMessage(value,yorkie_v1_resources_pb.ChangePack.deserializeBinaryFromReader); - msg.setChangePack(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.RemoveDocumentResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.RemoveDocumentResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.RemoveDocumentResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.RemoveDocumentResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getChangePack(); - if (f != null) { - writer.writeMessage( - 1, - f, - yorkie_v1_resources_pb.ChangePack.serializeBinaryToWriter - ); - } -}; - - -/** - * optional ChangePack change_pack = 1; - * @return {?proto.yorkie.v1.ChangePack} - */ -proto.yorkie.v1.RemoveDocumentResponse.prototype.getChangePack = function() { - return /** @type{?proto.yorkie.v1.ChangePack} */ ( - jspb.Message.getWrapperField(this, yorkie_v1_resources_pb.ChangePack, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.ChangePack|undefined} value - * @return {!proto.yorkie.v1.RemoveDocumentResponse} returns this -*/ -proto.yorkie.v1.RemoveDocumentResponse.prototype.setChangePack = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.RemoveDocumentResponse} returns this - */ -proto.yorkie.v1.RemoveDocumentResponse.prototype.clearChangePack = function() { - return this.setChangePack(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.RemoveDocumentResponse.prototype.hasChangePack = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.PushPullChangesRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.PushPullChangesRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.PushPullChangesRequest.toObject = function(includeInstance, msg) { - var f, obj = { - clientId: jspb.Message.getFieldWithDefault(msg, 1, ""), - documentId: jspb.Message.getFieldWithDefault(msg, 2, ""), - changePack: (f = msg.getChangePack()) && yorkie_v1_resources_pb.ChangePack.toObject(includeInstance, f), - pushOnly: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.PushPullChangesRequest} - */ -proto.yorkie.v1.PushPullChangesRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.PushPullChangesRequest; - return proto.yorkie.v1.PushPullChangesRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.PushPullChangesRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.PushPullChangesRequest} - */ -proto.yorkie.v1.PushPullChangesRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setClientId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentId(value); - break; - case 3: - var value = new yorkie_v1_resources_pb.ChangePack; - reader.readMessage(value,yorkie_v1_resources_pb.ChangePack.deserializeBinaryFromReader); - msg.setChangePack(value); - break; - case 4: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setPushOnly(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.PushPullChangesRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.PushPullChangesRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.PushPullChangesRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getDocumentId(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getChangePack(); - if (f != null) { - writer.writeMessage( - 3, - f, - yorkie_v1_resources_pb.ChangePack.serializeBinaryToWriter - ); - } - f = message.getPushOnly(); - if (f) { - writer.writeBool( - 4, - f - ); - } -}; - - -/** - * optional string client_id = 1; - * @return {string} - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.getClientId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.PushPullChangesRequest} returns this - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.setClientId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string document_id = 2; - * @return {string} - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.getDocumentId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.PushPullChangesRequest} returns this - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.setDocumentId = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional ChangePack change_pack = 3; - * @return {?proto.yorkie.v1.ChangePack} - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.getChangePack = function() { - return /** @type{?proto.yorkie.v1.ChangePack} */ ( - jspb.Message.getWrapperField(this, yorkie_v1_resources_pb.ChangePack, 3)); -}; - - -/** - * @param {?proto.yorkie.v1.ChangePack|undefined} value - * @return {!proto.yorkie.v1.PushPullChangesRequest} returns this -*/ -proto.yorkie.v1.PushPullChangesRequest.prototype.setChangePack = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.PushPullChangesRequest} returns this - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.clearChangePack = function() { - return this.setChangePack(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.hasChangePack = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional bool push_only = 4; - * @return {boolean} - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.getPushOnly = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); -}; - - -/** - * @param {boolean} value - * @return {!proto.yorkie.v1.PushPullChangesRequest} returns this - */ -proto.yorkie.v1.PushPullChangesRequest.prototype.setPushOnly = function(value) { - return jspb.Message.setProto3BooleanField(this, 4, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.PushPullChangesResponse.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.PushPullChangesResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.PushPullChangesResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.PushPullChangesResponse.toObject = function(includeInstance, msg) { - var f, obj = { - changePack: (f = msg.getChangePack()) && yorkie_v1_resources_pb.ChangePack.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.PushPullChangesResponse} - */ -proto.yorkie.v1.PushPullChangesResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.PushPullChangesResponse; - return proto.yorkie.v1.PushPullChangesResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.PushPullChangesResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.PushPullChangesResponse} - */ -proto.yorkie.v1.PushPullChangesResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new yorkie_v1_resources_pb.ChangePack; - reader.readMessage(value,yorkie_v1_resources_pb.ChangePack.deserializeBinaryFromReader); - msg.setChangePack(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.PushPullChangesResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.PushPullChangesResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.PushPullChangesResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.PushPullChangesResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getChangePack(); - if (f != null) { - writer.writeMessage( - 1, - f, - yorkie_v1_resources_pb.ChangePack.serializeBinaryToWriter - ); - } -}; - - -/** - * optional ChangePack change_pack = 1; - * @return {?proto.yorkie.v1.ChangePack} - */ -proto.yorkie.v1.PushPullChangesResponse.prototype.getChangePack = function() { - return /** @type{?proto.yorkie.v1.ChangePack} */ ( - jspb.Message.getWrapperField(this, yorkie_v1_resources_pb.ChangePack, 1)); -}; - - -/** - * @param {?proto.yorkie.v1.ChangePack|undefined} value - * @return {!proto.yorkie.v1.PushPullChangesResponse} returns this -*/ -proto.yorkie.v1.PushPullChangesResponse.prototype.setChangePack = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.PushPullChangesResponse} returns this - */ -proto.yorkie.v1.PushPullChangesResponse.prototype.clearChangePack = function() { - return this.setChangePack(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.PushPullChangesResponse.prototype.hasChangePack = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.BroadcastRequest.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.BroadcastRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.BroadcastRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.BroadcastRequest.toObject = function(includeInstance, msg) { - var f, obj = { - clientId: jspb.Message.getFieldWithDefault(msg, 1, ""), - documentId: jspb.Message.getFieldWithDefault(msg, 2, ""), - topic: jspb.Message.getFieldWithDefault(msg, 3, ""), - payload: msg.getPayload_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.BroadcastRequest} - */ -proto.yorkie.v1.BroadcastRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.BroadcastRequest; - return proto.yorkie.v1.BroadcastRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.BroadcastRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.BroadcastRequest} - */ -proto.yorkie.v1.BroadcastRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setClientId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDocumentId(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setTopic(value); - break; - case 4: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPayload(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.BroadcastRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.BroadcastRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.BroadcastRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.BroadcastRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getClientId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getDocumentId(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getTopic(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } - f = message.getPayload_asU8(); - if (f.length > 0) { - writer.writeBytes( - 4, - f - ); - } -}; - - -/** - * optional string client_id = 1; - * @return {string} - */ -proto.yorkie.v1.BroadcastRequest.prototype.getClientId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.BroadcastRequest} returns this - */ -proto.yorkie.v1.BroadcastRequest.prototype.setClientId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string document_id = 2; - * @return {string} - */ -proto.yorkie.v1.BroadcastRequest.prototype.getDocumentId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.BroadcastRequest} returns this - */ -proto.yorkie.v1.BroadcastRequest.prototype.setDocumentId = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string topic = 3; - * @return {string} - */ -proto.yorkie.v1.BroadcastRequest.prototype.getTopic = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.BroadcastRequest} returns this - */ -proto.yorkie.v1.BroadcastRequest.prototype.setTopic = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - -/** - * optional bytes payload = 4; - * @return {string} - */ -proto.yorkie.v1.BroadcastRequest.prototype.getPayload = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; - - -/** - * optional bytes payload = 4; - * This is a type-conversion wrapper around `getPayload()` - * @return {string} - */ -proto.yorkie.v1.BroadcastRequest.prototype.getPayload_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPayload())); -}; - - -/** - * optional bytes payload = 4; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPayload()` - * @return {!Uint8Array} - */ -proto.yorkie.v1.BroadcastRequest.prototype.getPayload_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPayload())); -}; - - -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.yorkie.v1.BroadcastRequest} returns this - */ -proto.yorkie.v1.BroadcastRequest.prototype.setPayload = function(value) { - return jspb.Message.setProto3BytesField(this, 4, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.yorkie.v1.BroadcastResponse.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.BroadcastResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.yorkie.v1.BroadcastResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.BroadcastResponse.toObject = function(includeInstance, msg) { - var f, obj = { - - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.BroadcastResponse} - */ -proto.yorkie.v1.BroadcastResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.yorkie.v1.BroadcastResponse; - return proto.yorkie.v1.BroadcastResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.yorkie.v1.BroadcastResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.yorkie.v1.BroadcastResponse} - */ -proto.yorkie.v1.BroadcastResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.BroadcastResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.BroadcastResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.yorkie.v1.BroadcastResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.yorkie.v1.BroadcastResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; +/** + * @generated from message yorkie.v1.BroadcastResponse + */ +const BroadcastResponse = proto3.makeMessageType( + "yorkie.v1.BroadcastResponse", + [], +); -goog.object.extend(exports, proto.yorkie.v1); +exports.ActivateClientRequest = ActivateClientRequest; +exports.ActivateClientResponse = ActivateClientResponse; +exports.DeactivateClientRequest = DeactivateClientRequest; +exports.DeactivateClientResponse = DeactivateClientResponse; +exports.AttachDocumentRequest = AttachDocumentRequest; +exports.AttachDocumentResponse = AttachDocumentResponse; +exports.DetachDocumentRequest = DetachDocumentRequest; +exports.DetachDocumentResponse = DetachDocumentResponse; +exports.WatchDocumentRequest = WatchDocumentRequest; +exports.WatchDocumentResponse = WatchDocumentResponse; +exports.WatchDocumentResponse_Initialization = WatchDocumentResponse_Initialization; +exports.RemoveDocumentRequest = RemoveDocumentRequest; +exports.RemoveDocumentResponse = RemoveDocumentResponse; +exports.PushPullChangesRequest = PushPullChangesRequest; +exports.PushPullChangesResponse = PushPullChangesResponse; +exports.BroadcastRequest = BroadcastRequest; +exports.BroadcastResponse = BroadcastResponse; diff --git a/src/client/attachment.ts b/src/client/attachment.ts index 1eef50694..12cc58228 100644 --- a/src/client/attachment.ts +++ b/src/client/attachment.ts @@ -20,6 +20,7 @@ export class Attachment { watchStream?: WatchStream; watchLoopTimerID?: ReturnType; + watchAbortController?: AbortController; constructor( reconnectStreamDelay: number, @@ -85,12 +86,22 @@ export class Attachment { this.watchLoopTimerID = undefined; } - const onDisconnect = () => { - this.watchStream = undefined; - this.watchLoopTimerID = setTimeout(doLoop, this.reconnectStreamDelay); - }; - - this.watchStream = await watchStreamCreator(onDisconnect); + try { + [this.watchStream, this.watchAbortController] = + await watchStreamCreator(() => { + this.watchStream = undefined; + this.watchAbortController = undefined; + this.watchLoopTimerID = setTimeout( + doLoop, + this.reconnectStreamDelay, + ); + }); + } catch (err) { + // TODO(hackerwins): For now, if the creation of the watch stream fails, + // it is considered normal and the watch loop is executed again after a + // certain period of time. + // In the future, we need to find a better way to handle this. + } }; await doLoop(); @@ -100,9 +111,10 @@ export class Attachment { * `cancelWatchStream` cancels the watch stream. */ public cancelWatchStream(): void { - if (this.watchStream) { - this.watchStream.cancel(); + if (this.watchStream && this.watchAbortController) { + this.watchAbortController.abort(); this.watchStream = undefined; + this.watchAbortController = undefined; } clearTimeout(this.watchLoopTimerID); this.watchLoopTimerID = undefined; diff --git a/src/client/auth_interceptor.ts b/src/client/auth_interceptor.ts index b536afc90..81b41c029 100644 --- a/src/client/auth_interceptor.ts +++ b/src/client/auth_interceptor.ts @@ -14,60 +14,23 @@ * limitations under the License. */ -/** - * `AuthUnaryInterceptor` is a unary interceptor to add the Authorization header for each - * request. - */ -export class AuthUnaryInterceptor { - private apiKey?: string; - private token?: string; - - constructor(apiKey?: string, token?: string) { - this.apiKey = apiKey; - this.token = token; - } - - /** - * `intercept` intercepts the request and adds the token to the metadata. - */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - public intercept(request: any, invoker: any): any { - const metadata = request.getMetadata(); - if (this.apiKey) { - metadata['x-api-key'] = this.apiKey; - } - if (this.token) { - metadata['authorization'] = this.token; - } - return invoker(request); - } -} +import { Interceptor } from '@connectrpc/connect'; /** - * `AuthStreamInterceptor` is a stream interceptor to add the Authorization header for each + * `createAuthInterceptor` creates an interceptor to add the Authorization header for each * request. */ -export class AuthStreamInterceptor { - private apiKey?: string; - private token?: string; - - constructor(apiKey?: string, token?: string) { - this.apiKey = apiKey; - this.token = token; - } - - /** - * `intercept` intercepts the request and adds the token to the metadata. - */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - public intercept(request: any, invoker: any): any { - const metadata = request.getMetadata(); - if (this.apiKey) { - metadata['x-api-key'] = this.apiKey; +export function createAuthInterceptor( + apiKey?: string, + token?: string, +): Interceptor { + return (next) => async (req) => { + if (apiKey) { + req.header.set('x-api-key', apiKey); } - if (this.token) { - metadata['authorization'] = this.token; + if (token) { + req.header.set('authorization', token); } - return invoker(request); - } + return await next(req); + }; } diff --git a/src/client/client.ts b/src/client/client.ts index 71a69c57a..87e784cc0 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -24,19 +24,12 @@ import { CompleteFn, NextFn, } from '@yorkie-js-sdk/src/util/observable'; -import { - ActivateClientRequest, - DeactivateClientRequest, - AttachDocumentRequest, - DetachDocumentRequest, - PushPullChangesRequest, - RemoveDocumentRequest, - WatchDocumentRequest, - WatchDocumentResponse, -} from '@yorkie-js-sdk/src/api/yorkie/v1/yorkie_pb'; +import { createPromiseClient, PromiseClient } from '@connectrpc/connect'; +import { createGrpcWebTransport } from '@connectrpc/connect-web'; +import { YorkieService } from '../api/yorkie/v1/yorkie_connect'; +import { WatchDocumentResponse } from '@yorkie-js-sdk/src/api/yorkie/v1/yorkie_pb'; import { DocEventType as PbDocEventType } from '@yorkie-js-sdk/src/api/yorkie/v1/resources_pb'; import { converter } from '@yorkie-js-sdk/src/api/converter'; -import { YorkieServiceClient as RPCClient } from '@yorkie-js-sdk/src/api/yorkie/v1/yorkie_grpc_web_pb'; import { Code, YorkieError } from '@yorkie-js-sdk/src/util/error'; import { logger } from '@yorkie-js-sdk/src/util/logger'; import { uuid } from '@yorkie-js-sdk/src/util/uuid'; @@ -46,14 +39,8 @@ import { DocumentKey, DocumentStatus, } from '@yorkie-js-sdk/src/document/document'; -import { - AuthUnaryInterceptor, - AuthStreamInterceptor, -} from '@yorkie-js-sdk/src/client/auth_interceptor'; -import { - MetricUnaryInterceptor, - MetricStreamInterceptor, -} from '@yorkie-js-sdk/src/client/metric_interceptor'; +import { createAuthInterceptor } from '@yorkie-js-sdk/src/client/auth_interceptor'; +import { createMetricInterceptor } from '@yorkie-js-sdk/src/client/metric_interceptor'; import { Indexable, DocEventType } from '@yorkie-js-sdk/src/document/document'; /** @@ -309,7 +296,7 @@ export class Client implements Observable { private reconnectStreamDelay: number; private retrySyncLoopDelay: number; - private rpcClient: RPCClient; + private rpcClient: PromiseClient; private eventStream: Observable; private eventStreamObserver!: Observer; @@ -333,21 +320,19 @@ export class Client implements Observable { this.retrySyncLoopDelay = opts.retrySyncLoopDelay || DefaultClientOptions.retrySyncLoopDelay; - const rpcOpts = { - unaryInterceptors: [new MetricUnaryInterceptor()], - streamInterceptors: [new MetricStreamInterceptor()], - }; - - if (opts.apiKey || opts.token) { - rpcOpts.unaryInterceptors.push( - new AuthUnaryInterceptor(opts.apiKey, opts.token), - ); - rpcOpts.streamInterceptors.push( - new AuthStreamInterceptor(opts.apiKey, opts.token), - ); - } + // Here we make the client itself, combining the service + // definition with the transport. + this.rpcClient = createPromiseClient( + YorkieService, + createGrpcWebTransport({ + baseUrl: rpcAddr, + interceptors: [ + createAuthInterceptor(opts.apiKey, opts.token), + createMetricInterceptor(), + ], + }), + ); - this.rpcClient = new RPCClient(rpcAddr, null, rpcOpts); this.eventStream = createObservable((observer) => { this.eventStreamObserver = observer; }); @@ -363,34 +348,29 @@ export class Client implements Observable { return Promise.resolve(); } - return new Promise((resolve, reject) => { - const req = new ActivateClientRequest(); - req.setClientKey(this.key); - - this.rpcClient.activateClient( - req, - { 'x-shard-key': this.apiKey }, - async (err, res) => { - if (err) { - logger.error(`[AC] c:"${this.getKey()}" err :`, err); - reject(err); - return; - } - - this.id = res.getClientId(); - this.status = ClientStatus.Activated; - this.runSyncLoop(); + return this.rpcClient + .activateClient( + { + clientKey: this.key, + }, + { headers: { 'x-shard-key': this.apiKey } }, + ) + .then((res) => { + this.id = res.clientId; + this.status = ClientStatus.Activated; + this.runSyncLoop(); - this.eventStreamObserver.next({ - type: ClientEventType.StatusChanged, - value: this.status, - }); + this.eventStreamObserver.next({ + type: ClientEventType.StatusChanged, + value: this.status, + }); - logger.info(`[AC] c:"${this.getKey()}" activated, id:"${this.id}"`); - resolve(); - }, - ); - }); + logger.info(`[AC] c:"${this.getKey()}" activated, id:"${this.id}"`); + }) + .catch((err) => { + logger.error(`[AC] c:"${this.getKey()}" err :`, err); + throw err; + }); } /** @@ -405,31 +385,26 @@ export class Client implements Observable { this.detachInternal(key); } - return new Promise((resolve, reject) => { - const req = new DeactivateClientRequest(); - req.setClientId(this.id!); - - this.rpcClient.deactivateClient( - req, - { 'x-shard-key': this.apiKey }, - (err) => { - if (err) { - logger.error(`[DC] c:"${this.getKey()}" err :`, err); - reject(err); - return; - } - - this.status = ClientStatus.Deactivated; - this.eventStreamObserver.next({ - type: ClientEventType.StatusChanged, - value: this.status, - }); - - logger.info(`[DC] c"${this.getKey()}" deactivated`); - resolve(); + return this.rpcClient + .deactivateClient( + { + clientId: this.id!, }, - ); - }); + { headers: { 'x-shard-key': this.apiKey } }, + ) + .then(() => { + this.status = ClientStatus.Deactivated; + this.eventStreamObserver.next({ + type: ClientEventType.StatusChanged, + value: this.status, + }); + + logger.info(`[DC] c"${this.getKey()}" deactivated`); + }) + .catch((err) => { + logger.error(`[DC] c:"${this.getKey()}" err :`, err); + throw err; + }); } /** @@ -457,45 +432,45 @@ export class Client implements Observable { const isRealtimeSync = options.isRealtimeSync ?? true; - return new Promise((resolve, reject) => { - const req = new AttachDocumentRequest(); - req.setClientId(this.id!); - req.setChangePack(converter.toChangePack(doc.createChangePack())); - - this.rpcClient.attachDocument( - req, - { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, - async (err, res) => { - if (err) { - logger.error(`[AD] c:"${this.getKey()}" err :`, err); - reject(err); - return; - } + return this.rpcClient + .attachDocument( + { + clientId: this.id!, + changePack: converter.toChangePack(doc.createChangePack()), + }, + { + headers: { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, + }, + ) + .then(async (res) => { + const pack = converter.fromChangePack

(res.changePack!); + doc.applyChangePack(pack); + if (doc.getStatus() === DocumentStatus.Removed) { + return doc; + } - const pack = converter.fromChangePack

(res.getChangePack()!); - doc.applyChangePack(pack); - if (doc.getStatus() !== DocumentStatus.Removed) { - doc.setStatus(DocumentStatus.Attached); - this.attachmentMap.set( - doc.getKey(), - new Attachment( - this.reconnectStreamDelay, - doc, - res.getDocumentId(), - isRealtimeSync, - ), - ); - - if (isRealtimeSync) { - await this.runWatchLoop(doc.getKey()); - } - } + doc.setStatus(DocumentStatus.Attached); + this.attachmentMap.set( + doc.getKey(), + new Attachment( + this.reconnectStreamDelay, + doc, + res.documentId, + isRealtimeSync, + ), + ); - logger.info(`[AD] c:"${this.getKey()}" attaches d:"${doc.getKey()}"`); - resolve(doc); - }, - ); - }); + if (isRealtimeSync) { + await this.runWatchLoop(doc.getKey()); + } + + logger.info(`[AD] c:"${this.getKey()}" attaches d:"${doc.getKey()}"`); + return doc; + }) + .catch((err) => { + logger.error(`[AD] c:"${this.getKey()}" err :`, err); + throw err; + }); } /** @@ -524,35 +499,33 @@ export class Client implements Observable { } doc.update((_, p) => p.clear()); - return new Promise((resolve, reject) => { - const req = new DetachDocumentRequest(); - req.setClientId(this.id!); - req.setDocumentId(attachment.docID); - req.setChangePack(converter.toChangePack(doc.createChangePack())); - req.setRemoveIfNotAttached(options.removeIfNotAttached ?? false); - - this.rpcClient.detachDocument( - req, - { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, - async (err, res) => { - if (err) { - logger.error(`[DD] c:"${this.getKey()}" err :`, err); - reject(err); - return; - } - - const pack = converter.fromChangePack

(res.getChangePack()!); - doc.applyChangePack(pack); - if (doc.getStatus() !== DocumentStatus.Removed) { - doc.setStatus(DocumentStatus.Detached); - } - this.detachInternal(doc.getKey()); - - logger.info(`[DD] c:"${this.getKey()}" detaches d:"${doc.getKey()}"`); - resolve(doc); + return this.rpcClient + .detachDocument( + { + clientId: this.id!, + documentId: attachment.docID, + changePack: converter.toChangePack(doc.createChangePack()), + removeIfNotAttached: options.removeIfNotAttached ?? false, }, - ); - }); + { + headers: { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, + }, + ) + .then((res) => { + const pack = converter.fromChangePack

(res.changePack!); + doc.applyChangePack(pack); + if (doc.getStatus() !== DocumentStatus.Removed) { + doc.setStatus(DocumentStatus.Detached); + } + this.detachInternal(doc.getKey()); + + logger.info(`[DD] c:"${this.getKey()}" detaches d:"${doc.getKey()}"`); + return doc; + }) + .catch((err) => { + logger.error(`[DD] c:"${this.getKey()}" err :`, err); + throw err; + }); } /** @@ -707,36 +680,31 @@ export class Client implements Observable { ); } doc.setActor(this.id!); - return new Promise((resolve, reject) => { - const req = new RemoveDocumentRequest(); - req.setClientId(this.id!); - req.setDocumentId(attachment.docID); - const pbChangePack = converter.toChangePack(doc.createChangePack()); - pbChangePack.setIsRemoved(true); - req.setChangePack(pbChangePack); - - this.rpcClient.removeDocument( - req, - { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, - async (err, res) => { - if (err) { - logger.error( - `[RD] c:"${this.getKey()}" d:"${doc.getKey()}" err :`, - err, - ); - reject(err); - return; - } - - const pack = converter.fromChangePack

(res.getChangePack()!); - doc.applyChangePack(pack); - this.detachInternal(doc.getKey()); - logger.info(`[RD] c:"${this.getKey()}" removes d:"${doc.getKey()}"`); - resolve(); + const pbChangePack = converter.toChangePack(doc.createChangePack()); + pbChangePack.isRemoved = true; + return this.rpcClient + .removeDocument( + { + clientId: this.id!, + documentId: attachment.docID, + changePack: pbChangePack, }, - ); - }); + { + headers: { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, + }, + ) + .then((res) => { + const pack = converter.fromChangePack

(res.changePack!); + doc.applyChangePack(pack); + this.detachInternal(doc.getKey()); + + logger.info(`[RD] c:"${this.getKey()}" removes d:"${doc.getKey()}"`); + }) + .catch((err) => { + logger.error(`[RD] c:"${this.getKey()}" err :`, err); + throw err; + }); } /** @@ -823,20 +791,24 @@ export class Client implements Observable { } return attachment.runWatchLoop( - (onDisconnect: () => void): Promise => { + (onDisconnect: () => void): Promise<[WatchStream, AbortController]> => { if (!this.isActive()) { - throw new YorkieError( - Code.ClientNotActive, - `${this.key} is not active`, + return Promise.reject( + new YorkieError(Code.ClientNotActive, `${this.key} is not active`), ); } - const req = new WatchDocumentRequest(); - req.setClientId(this.id!); - req.setDocumentId(attachment.docID); - const stream = this.rpcClient.watchDocument(req, { - 'x-shard-key': `${this.apiKey}/${docKey}`, - }); + const ac = new AbortController(); + const stream = this.rpcClient.watchDocument( + { + clientId: this.id!, + documentId: attachment.docID, + }, + { + headers: { 'x-shard-key': `${this.apiKey}/${docKey}` }, + signal: ac.signal, + }, + ); this.eventStreamObserver.next({ type: ClientEventType.StreamConnectionStatusChanged, @@ -844,22 +816,31 @@ export class Client implements Observable { }); logger.info(`[WD] c:"${this.getKey()}" watches d:"${docKey}"`); - return new Promise((resolve) => { - const onStreamDisconnect = (): void => { - this.eventStreamObserver.next({ - type: ClientEventType.StreamConnectionStatusChanged, - value: StreamConnectionStatus.Disconnected, - }); - logger.debug(`[WD] c:"${this.getKey()}" unwatches`); - onDisconnect(); + return new Promise((resolve, reject) => { + const handleStream = async () => { + try { + for await (const resp of stream) { + this.handleWatchDocumentsResponse(attachment, resp); + + // NOTE(hackerwins): When the first response is received, we need to + // resolve the promise to notify that the watch stream is ready. + if (resp.body.case === 'initialization') { + resolve([stream, ac]); + } + } + } catch (err) { + this.eventStreamObserver.next({ + type: ClientEventType.StreamConnectionStatusChanged, + value: StreamConnectionStatus.Disconnected, + }); + logger.debug(`[WD] c:"${this.getKey()}" unwatches`); + onDisconnect(); + + reject(err); + } }; - stream.on('data', (resp: WatchDocumentResponse) => { - this.handleWatchDocumentsResponse(attachment, resp); - resolve(stream); - }); - stream.on('end', onStreamDisconnect); - stream.on('error', onStreamDisconnect); + handleStream(); }); }, ); @@ -870,8 +851,8 @@ export class Client implements Observable { resp: WatchDocumentResponse, ) { const docKey = attachment.doc.getKey(); - if (resp.hasInitialization()) { - const clientIDs = resp.getInitialization()!.getClientIdsList(); + if (resp.body.case === 'initialization') { + const clientIDs = resp.body.value.clientIds; const onlineClients: Set = new Set(); for (const clientID of clientIDs) { onlineClients.add(clientID); @@ -882,45 +863,45 @@ export class Client implements Observable { value: attachment.doc.getPresences(), }); return; - } - - const pbWatchEvent = resp.getEvent()!; - const eventType = pbWatchEvent.getType(); - const publisher = pbWatchEvent.getPublisher(); - switch (eventType) { - case PbDocEventType.DOC_EVENT_TYPE_DOCUMENT_CHANGED: - attachment.remoteChangeEventReceived = true; - this.eventStreamObserver.next({ - type: ClientEventType.DocumentChanged, - value: [docKey], - }); - break; - case PbDocEventType.DOC_EVENT_TYPE_DOCUMENT_WATCHED: - attachment.doc.addOnlineClient(publisher); - // NOTE(chacha912): We added to onlineClients, but we won't trigger watched event - // unless we also know their initial presence data at this point. - if (attachment.doc.hasPresence(publisher)) { - attachment.doc.publish({ - type: DocEventType.Watched, - value: { - clientID: publisher, - presence: attachment.doc.getPresence(publisher)!, - }, - }); - } - break; - case PbDocEventType.DOC_EVENT_TYPE_DOCUMENT_UNWATCHED: { - const presence = attachment.doc.getPresence(publisher); - attachment.doc.removeOnlineClient(publisher); - // NOTE(chacha912): There is no presence, when PresenceChange(clear) is applied before unwatching. - // In that case, the 'unwatched' event is triggered while handling the PresenceChange. - if (presence) { - attachment.doc.publish({ - type: DocEventType.Unwatched, - value: { clientID: publisher, presence }, + } else if (resp.body.case === 'event') { + const pbWatchEvent = resp.body.value; + const eventType = pbWatchEvent.type; + const publisher = pbWatchEvent.publisher; + switch (eventType) { + case PbDocEventType.DOCUMENT_CHANGED: + attachment.remoteChangeEventReceived = true; + this.eventStreamObserver.next({ + type: ClientEventType.DocumentChanged, + value: [docKey], }); + break; + case PbDocEventType.DOCUMENT_WATCHED: + attachment.doc.addOnlineClient(publisher); + // NOTE(chacha912): We added to onlineClients, but we won't trigger watched event + // unless we also know their initial presence data at this point. + if (attachment.doc.hasPresence(publisher)) { + attachment.doc.publish({ + type: DocEventType.Watched, + value: { + clientID: publisher, + presence: attachment.doc.getPresence(publisher)!, + }, + }); + } + break; + case PbDocEventType.DOCUMENT_UNWATCHED: { + const presence = attachment.doc.getPresence(publisher); + attachment.doc.removeOnlineClient(publisher); + // NOTE(chacha912): There is no presence, when PresenceChange(clear) is applied before unwatching. + // In that case, the 'unwatched' event is triggered while handling the PresenceChange. + if (presence) { + attachment.doc.publish({ + type: DocEventType.Unwatched, + value: { clientID: publisher, presence }, + }); + } + break; } - break; } } } @@ -951,63 +932,52 @@ export class Client implements Observable { syncMode: SyncMode, ): Promise> { const { doc, docID } = attachment; - return new Promise((resolve, reject) => { - const req = new PushPullChangesRequest(); - req.setClientId(this.id!); - req.setDocumentId(docID); - const reqPack = doc.createChangePack(); - const localSize = reqPack.getChangeSize(); - req.setChangePack(converter.toChangePack(reqPack)); - req.setPushOnly(syncMode === SyncMode.PushOnly); - - let isRejected = false; - this.rpcClient - .pushPullChanges( - req, - { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, - (err, res) => { - if (err) { - logger.error(`[PP] c:"${this.getKey()}" err :`, err); - - isRejected = true; - reject(err); - return; - } - - const respPack = converter.fromChangePack

(res.getChangePack()!); - - // NOTE(chacha912, hackerwins): If syncLoop already executed with - // PushPull, ignore the response when the syncMode is PushOnly. - if (respPack.hasChanges() && syncMode === SyncMode.PushOnly) { - return; - } - doc.applyChangePack(respPack); - this.eventStreamObserver.next({ - type: ClientEventType.DocumentSynced, - value: DocumentSyncResultType.Synced, - }); - // NOTE(chacha912): If a document has been removed, watchStream should - // be disconnected to not receive an event for that document. - if (doc.getStatus() === DocumentStatus.Removed) { - this.detachInternal(doc.getKey()); - } + const reqPack = doc.createChangePack(); + return this.rpcClient + .pushPullChanges( + { + clientId: this.id!, + documentId: docID, + changePack: converter.toChangePack(reqPack), + pushOnly: syncMode === SyncMode.PushOnly, + }, + { + headers: { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, + }, + ) + .then((res) => { + const respPack = converter.fromChangePack

(res.changePack!); + + // (chacha912, hackerwins): If syncLoop already executed with + // PushPull, ignore the response when the syncMode is PushOnly. + if (respPack.hasChanges() && syncMode === SyncMode.PushOnly) { + return doc; + } - const docKey = doc.getKey(); - const remoteSize = respPack.getChangeSize(); - logger.info( - `[PP] c:"${this.getKey()}" sync d:"${docKey}", push:${localSize} pull:${remoteSize} cp:${respPack - .getCheckpoint() - .toTestString()}`, - ); - }, - ) - .on('end', () => { - if (isRejected) { - return; - } - resolve(doc); + doc.applyChangePack(respPack); + this.eventStreamObserver.next({ + type: ClientEventType.DocumentSynced, + value: DocumentSyncResultType.Synced, }); - }); + // (chacha912): If a document has been removed, watchStream should + // be disconnected to not receive an event for that document. + if (doc.getStatus() === DocumentStatus.Removed) { + this.detachInternal(doc.getKey()); + } + + const docKey = doc.getKey(); + const remoteSize = respPack.getChangeSize(); + logger.info( + `[PP] c:"${this.getKey()}" sync d:"${docKey}", push:${reqPack.getChangeSize()} pull:${remoteSize} cp:${respPack + .getCheckpoint() + .toTestString()}`, + ); + return doc; + }) + .catch((err) => { + logger.error(`[PP] c:"${this.getKey()}" err :`, err); + throw err; + }); } } diff --git a/src/client/metric_interceptor.ts b/src/client/metric_interceptor.ts index 80414dd54..969e53809 100644 --- a/src/client/metric_interceptor.ts +++ b/src/client/metric_interceptor.ts @@ -15,35 +15,15 @@ */ import pkg from '../../package.json'; +import { Interceptor } from '@connectrpc/connect'; /** - * `MetricUnaryInterceptor` is a unary interceptor to add the yorkie user agent header - * for each request. + * `createMetricInterceptor` creates an interceptor to add the x-yorkie-user-agent header for each + * request. */ -export class MetricUnaryInterceptor { - /** - * `intercept` intercepts the request and adds the token to the metadata. - */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - public intercept(request: any, invoker: any): any { - const metadata = request.getMetadata(); - metadata['x-yorkie-user-agent'] = pkg.name + '/' + pkg.version; - return invoker(request); - } -} - -/** - * `MetricStreamInterceptor` is a stream interceptor to add the yorkie user agent header - * for each request. - */ -export class MetricStreamInterceptor { - /** - * `intercept` intercepts the request and adds the token to the metadata. - */ - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - public intercept(request: any, invoker: any): any { - const metadata = request.getMetadata(); - metadata['x-yorkie-user-agent'] = pkg.name + '/' + pkg.version; - return invoker(request); - } +export function createMetricInterceptor(): Interceptor { + return (next) => async (req) => { + req.header.set('x-yorkie-user-agent', pkg.name + '/' + pkg.version); + return await next(req); + }; } diff --git a/test/integration/client_test.ts b/test/integration/client_test.ts index 6e2b4eb37..78e2cc802 100644 --- a/test/integration/client_test.ts +++ b/test/integration/client_test.ts @@ -89,31 +89,22 @@ describe.sequential('Client', function () { await c1.sync(); assert.equal(d1.toSortedJSON(), d2.toSortedJSON()); - vi.stubGlobal( - 'XMLHttpRequest', - vi.fn(() => ({ - send: (req: any) => { - req.respond( - 400, - { 'Content-Type': 'application/grpc-web-text+proto' }, - '', - ); - }, - abort: vi.fn(() => { - throw new Error('INVALID_STATE_ERR - 0'); - }), - })), - ); + // Simulate network error with fetch + vi.stubGlobal('fetch', () => { + return Promise.resolve().then(() => { + throw new Error('Failed to fetch'); + }); + }); d2.update((root) => { root['k1'] = 'v1'; }); await c2.sync().catch((err) => { - assert.equal(err.message, 'INVALID_STATE_ERR - 0'); + assert.equal(err.message, '[unknown] Failed to fetch'); }); await c1.sync().catch((err) => { - assert.equal(err.message, 'INVALID_STATE_ERR - 0'); + assert.equal(err.message, '[unknown] Failed to fetch'); }); assert.equal(d1.toSortedJSON(), '{"k1":"undefined"}'); assert.equal(d2.toSortedJSON(), '{"k1":"v1"}'); @@ -186,21 +177,11 @@ describe.sequential('Client', function () { eventCollectorC2.reset(); // Simulate network error - vi.stubGlobal( - 'XMLHttpRequest', - vi.fn(() => ({ - send: (req: any) => { - req.respond( - 400, - { 'Content-Type': 'application/grpc-web-text+proto' }, - '', - ); - }, - abort: vi.fn(() => { - throw new Error('INVALID_STATE_ERR - 0'); - }), - })), - ); + vi.stubGlobal('fetch', () => { + return Promise.resolve().then(() => { + throw new Error('Failed to fetch'); + }); + }); d2.update((root) => { root['k1'] = 'v1'; @@ -210,7 +191,7 @@ describe.sequential('Client', function () { await eventCollectorC2.waitFor(DocumentSyncResultType.SyncFailed); // c2 should fail to sync await c1.sync().catch((err) => { - assert.equal(err.message, 'INVALID_STATE_ERR - 0'); // c1 should also fail to sync + assert.equal(err.message, '[unknown] Failed to fetch'); // c1 should also fail to sync }); await eventCollectorC1.waitFor(DocumentSyncResultType.SyncFailed); assert.equal(d1.toSortedJSON(), '{"k1":"undefined"}'); diff --git a/test/integration/integration_helper.ts b/test/integration/integration_helper.ts index 63e6cc856..ceda8c8d4 100644 --- a/test/integration/integration_helper.ts +++ b/test/integration/integration_helper.ts @@ -4,7 +4,7 @@ import { Client } from '@yorkie-js-sdk/src/client/client'; import { Document } from '@yorkie-js-sdk/src/document/document'; import { Indexable } from '@yorkie-js-sdk/test/helper/helper'; -export const testRPCAddr = process.env.TEST_RPC_ADDR || 'http://localhost:8080'; +export const testRPCAddr = process.env.TEST_RPC_ADDR || 'http://127.0.0.1:8080'; export function toDocKey(title: string): string { return title diff --git a/test/integration/presence_test.ts b/test/integration/presence_test.ts index c45f2dc41..cd1949ac2 100644 --- a/test/integration/presence_test.ts +++ b/test/integration/presence_test.ts @@ -114,43 +114,38 @@ describe('Presence', function () { const c2ID = c2.getID()!; const docKey = toDocKey(`${task.name}-${new Date().getTime()}`); - const eventCollectorP1 = new EventCollector(); - const eventCollectorP2 = new EventCollector(); - type PresenceType = { name: string }; - const doc1 = new yorkie.Document<{}, PresenceType>(docKey); + const events1 = new EventCollector(); + const events2 = new EventCollector(); + + const doc1 = new yorkie.Document<{}, { name: string }>(docKey); await c1.attach(doc1, { initialPresence: { name: 'a' } }); - const stub1 = vi.fn().mockImplementation((event) => { - eventCollectorP1.add(event); - }); - const unsub1 = doc1.subscribe('presence', stub1); + const unsub1 = doc1.subscribe('presence', (event) => events1.add(event)); - const doc2 = new yorkie.Document<{}, PresenceType>(docKey); + const doc2 = new yorkie.Document<{}, { name: string }>(docKey); await c2.attach(doc2, { initialPresence: { name: 'b' } }); - const stub2 = vi.fn().mockImplementation((event) => { - eventCollectorP2.add(event); - }); - const unsub2 = doc2.subscribe('presence', stub2); - await eventCollectorP1.waitAndVerifyNthEvent(1, { + const unsub2 = doc2.subscribe('presence', (event) => events2.add(event)); + + await events1.waitAndVerifyNthEvent(1, { type: DocEventType.Watched, value: { clientID: c2ID, presence: { name: 'b' } }, }); - doc1.update((root, p) => p.set({ name: 'A' })); - doc2.update((root, p) => p.set({ name: 'B' })); + doc1.update((r, p) => p.set({ name: 'A' })); + doc2.update((r, p) => p.set({ name: 'B' })); - await eventCollectorP1.waitAndVerifyNthEvent(2, { + await events1.waitAndVerifyNthEvent(2, { type: DocEventType.PresenceChanged, value: { clientID: c1ID, presence: { name: 'A' } }, }); - await eventCollectorP1.waitAndVerifyNthEvent(3, { + await events1.waitAndVerifyNthEvent(3, { type: DocEventType.PresenceChanged, value: { clientID: c2ID, presence: { name: 'B' } }, }); - await eventCollectorP2.waitAndVerifyNthEvent(1, { + await events2.waitAndVerifyNthEvent(1, { type: DocEventType.PresenceChanged, value: { clientID: c2ID, presence: { name: 'B' } }, }); - await eventCollectorP2.waitAndVerifyNthEvent(2, { + await events2.waitAndVerifyNthEvent(2, { type: DocEventType.PresenceChanged, value: { clientID: c1ID, presence: { name: 'A' } }, }); @@ -423,6 +418,9 @@ describe(`Document.Subscribe('presence')`, function () { it(`Can receive presence-related event only when using realtime sync`, async function ({ task, }) { + type PresenceType = { name: string; cursor: { x: number; y: number } }; + const docKey = toDocKey(`${task.name}-${new Date().getTime()}`); + const c1 = new yorkie.Client(testRPCAddr); const c2 = new yorkie.Client(testRPCAddr); const c3 = new yorkie.Client(testRPCAddr); @@ -432,17 +430,12 @@ describe(`Document.Subscribe('presence')`, function () { const c2ID = c2.getID()!; const c3ID = c3.getID()!; - const docKey = toDocKey(`${task.name}-${new Date().getTime()}`); - type PresenceType = { name: string; cursor: { x: number; y: number } }; const doc1 = new yorkie.Document<{}, PresenceType>(docKey); await c1.attach(doc1, { initialPresence: { name: 'a1', cursor: { x: 0, y: 0 } }, }); - const eventCollector = new EventCollector(); - const stub = vi.fn().mockImplementation((event) => { - eventCollector.add(event); - }); - const unsub = doc1.subscribe('presence', stub); + const events = new EventCollector(); + const unsub = doc1.subscribe('presence', (event) => events.add(event)); // 01. c2 attaches doc in realtime sync, and c3 attached doc in manual sync. // c1 receives the watched event from c2. @@ -455,7 +448,7 @@ describe(`Document.Subscribe('presence')`, function () { initialPresence: { name: 'c1', cursor: { x: 0, y: 0 } }, isRealtimeSync: false, }); - await eventCollector.waitAndVerifyNthEvent(1, { + await events.waitAndVerifyNthEvent(1, { type: DocEventType.Watched, value: { clientID: c2ID, @@ -465,13 +458,9 @@ describe(`Document.Subscribe('presence')`, function () { // 02. c2 and c3 update the presence. // c1 receives the presence-changed event from c2. - doc2.update((_, presence) => { - presence.set({ name: 'b2' }); - }); - doc3.update((_, presence) => { - presence.set({ name: 'c2' }); - }); - await eventCollector.waitAndVerifyNthEvent(2, { + doc2.update((_, p) => p.set({ name: 'b2' })); + doc3.update((_, p) => p.set({ name: 'c2' })); + await events.waitAndVerifyNthEvent(2, { type: DocEventType.PresenceChanged, value: { clientID: c2ID, @@ -481,7 +470,7 @@ describe(`Document.Subscribe('presence')`, function () { // 03-1. c2 pauses the document, c1 receives an unwatched event from c2. await c2.pause(doc2); - await eventCollector.waitAndVerifyNthEvent(3, { + await events.waitAndVerifyNthEvent(3, { type: DocEventType.Unwatched, value: { clientID: c2ID, @@ -496,7 +485,7 @@ describe(`Document.Subscribe('presence')`, function () { await c3.sync(); await c1.sync(); await c3.resume(doc3); - await eventCollector.waitAndVerifyNthEvent(4, { + await events.waitAndVerifyNthEvent(4, { type: DocEventType.Watched, value: { clientID: c3ID, @@ -506,13 +495,9 @@ describe(`Document.Subscribe('presence')`, function () { // 04. c2 and c3 update the presence. // c1 receives the presence-changed event from c3. - doc2.update((_, presence) => { - presence.set({ name: 'b3' }); - }); - doc3.update((_, presence) => { - presence.set({ name: 'c3' }); - }); - await eventCollector.waitAndVerifyNthEvent(5, { + doc2.update((_, p) => p.set({ name: 'b3' })); + doc3.update((_, p) => p.set({ name: 'c3' })); + await events.waitAndVerifyNthEvent(5, { type: DocEventType.PresenceChanged, value: { clientID: c3ID, @@ -522,7 +507,7 @@ describe(`Document.Subscribe('presence')`, function () { // 05-1. c3 pauses the document, c1 receives an unwatched event from c3. await c3.pause(doc3); - await eventCollector.waitAndVerifyNthEvent(6, { + await events.waitAndVerifyNthEvent(6, { type: DocEventType.Unwatched, value: { clientID: c3ID, @@ -534,7 +519,7 @@ describe(`Document.Subscribe('presence')`, function () { await c2.sync(); await c1.sync(); await c2.resume(doc2); - await eventCollector.waitAndVerifyNthEvent(7, { + await events.waitAndVerifyNthEvent(7, { type: DocEventType.Watched, value: { clientID: c2ID,