From 1280b132d6d05553192c016947736557f11d3d6f Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Tue, 28 Nov 2023 13:09:18 +0900 Subject: [PATCH 01/21] Update protobuf and client --- buf.gen.yaml | 16 + package-lock.json | 232 + package.json | 8 +- src/api/yorkie/v1/resources.proto | 2 +- src/api/yorkie/v1/resources_pb.d.ts | 1644 --- src/api/yorkie/v1/resources_pb.js | 13502 -------------------- src/api/yorkie/v1/yorkie.proto | 2 +- 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 | 396 - src/api/yorkie/v1/yorkie_pb.js | 3289 ----- src/client/client.ts | 409 +- 12 files changed, 461 insertions(+), 19716 deletions(-) create mode 100644 buf.gen.yaml delete mode 100644 src/api/yorkie/v1/resources_pb.d.ts delete mode 100644 src/api/yorkie/v1/resources_pb.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 delete mode 100644 src/api/yorkie/v1/yorkie_pb.d.ts delete mode 100644 src/api/yorkie/v1/yorkie_pb.js diff --git a/buf.gen.yaml b/buf.gen.yaml new file mode 100644 index 000000000..a6abc0207 --- /dev/null +++ b/buf.gen.yaml @@ -0,0 +1,16 @@ +# buf.gen.yaml defines a local generation template. +# For details, see https://buf.build/docs/configuration/v1/buf-gen-yaml +version: v1 +plugins: + # This will invoke protoc-gen-es and write output to src/gen + - plugin: es + out: . + opt: + # Add more plugin options here + - target=ts + # This will invoke protoc-gen-connect-es + - plugin: connect-es + out: . + opt: + # Add more plugin options here + - target=ts diff --git a/package-lock.json b/package-lock.json index df80318ee..891871771 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,11 +13,17 @@ "tools/*" ], "dependencies": { + "@bufbuild/protobuf": "^1.4.2", + "@connectrpc/connect": "^1.1.3", + "@connectrpc/connect-web": "^1.1.3", "google-protobuf": "^3.19.4", "grpc-web": "^1.3.1", "long": "^5.2.0" }, "devDependencies": { + "@bufbuild/buf": "^1.28.1", + "@bufbuild/protoc-gen-es": "^1.4.2", + "@connectrpc/protoc-gen-connect-es": "^1.1.3", "@microsoft/api-documenter": "^7.15.1", "@microsoft/api-extractor": "^7.19.4", "@types/benchmark": "^2.1.1", @@ -1024,6 +1030,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.4.2", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.4.2.tgz", + "integrity": "sha512-JyEH8Z+OD5Sc2opSg86qMHn1EM1Sa+zj/Tc0ovxdwk56ByVNONJSabuCUbLQp+eKN3rWNfrho0X+3SEqEPXIow==" + }, + "node_modules/@bufbuild/protoc-gen-es": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.4.2.tgz", + "integrity": "sha512-/It7M2s8H1zTDvUMJu6vhBmtnzeFL2VS6e78RYIY38602pNXDK/vbteKUo4KrG0O07lOPFu87hHZ0Y+w5Ib6iw==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "^1.4.2", + "@bufbuild/protoplugin": "1.4.2" + }, + "bin": { + "protoc-gen-es": "bin/protoc-gen-es" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@bufbuild/protobuf": "1.4.2" + }, + "peerDependenciesMeta": { + "@bufbuild/protobuf": { + "optional": true + } + } + }, + "node_modules/@bufbuild/protoplugin": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.4.2.tgz", + "integrity": "sha512-5IwGC1ZRD2A+KydGXeaSOErwfILLqVtvMH/RkN+cOoHcQd4EYXFStcF7g7aR+yICRDEEjQVi5tQF/qPGBSr9vg==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "1.4.2", + "@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 +1502,51 @@ "w3c-keyname": "^2.2.4" } }, + "node_modules/@connectrpc/connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-1.1.3.tgz", + "integrity": "sha512-AXkbsLQe2Nm7VuoN5nqp05GEb9mPa/f5oFzDqTbHME4i8TghTrlY03uefbhuAq4wjsnfDnmuxHZvn6ndlgXmbg==", + "peerDependencies": { + "@bufbuild/protobuf": "^1.3.3" + } + }, + "node_modules/@connectrpc/connect-web": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@connectrpc/connect-web/-/connect-web-1.1.3.tgz", + "integrity": "sha512-WfShOZt91duJngqivYF4wJFRbeRa4bF/fPMfDVN0MAYSX3VuaTMn8o9qgKN7tsg2H2ZClyOVQwMkZx6IdcP7Zw==", + "peerDependencies": { + "@bufbuild/protobuf": "^1.3.3", + "@connectrpc/connect": "1.1.3" + } + }, + "node_modules/@connectrpc/protoc-gen-connect-es": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@connectrpc/protoc-gen-connect-es/-/protoc-gen-connect-es-1.1.3.tgz", + "integrity": "sha512-Irt1WM1o45KL0DNz8D8nraNfRrOyZfn7rzRsOyfrwbNzeVO1JV3rELFpARqGAvtVveYBoO9uwYtQ8TKLXsnrng==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "^1.3.3", + "@bufbuild/protoplugin": "^1.3.3" + }, + "bin": { + "protoc-gen-connect-es": "bin/protoc-gen-connect-es" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@bufbuild/protoc-gen-es": "^1.3.3", + "@connectrpc/connect": "1.1.3" + }, + "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 +4033,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..38ed3fd4f 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": "protoc ./src/api/yorkie/v1/*.proto", "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.4.2", + "@connectrpc/protoc-gen-connect-es": "^1.1.3", "@microsoft/api-documenter": "^7.15.1", "@microsoft/api-extractor": "^7.19.4", "@types/benchmark": "^2.1.1", @@ -85,6 +88,9 @@ "yargs": "^17.0.1" }, "dependencies": { + "@bufbuild/protobuf": "^1.4.2", + "@connectrpc/connect": "^1.1.3", + "@connectrpc/connect-web": "^1.1.3", "google-protobuf": "^3.19.4", "grpc-web": "^1.3.1", "long": "^5.2.0" diff --git a/src/api/yorkie/v1/resources.proto b/src/api/yorkie/v1/resources.proto index ad27ca5c8..889c96ed9 100644 --- a/src/api/yorkie/v1/resources.proto +++ b/src/api/yorkie/v1/resources.proto @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -syntax = "proto3"; + syntax = "proto3"; package yorkie.v1; diff --git a/src/api/yorkie/v1/resources_pb.d.ts b/src/api/yorkie/v1/resources_pb.d.ts deleted file mode 100644 index c5f96d0fd..000000000 --- a/src/api/yorkie/v1/resources_pb.d.ts +++ /dev/null @@ -1,1644 +0,0 @@ -import * as jspb from 'google-protobuf' - -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'; - - -export class Snapshot extends jspb.Message { - getRoot(): JSONElement | undefined; - setRoot(value?: JSONElement): Snapshot; - hasRoot(): boolean; - clearRoot(): Snapshot; - - getPresencesMap(): jspb.Map; - clearPresencesMap(): Snapshot; - - 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; -} - -export namespace Snapshot { - export type AsObject = { - root?: JSONElement.AsObject, - presencesMap: Array<[string, Presence.AsObject]>, - } -} - -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; -} - -export namespace ChangePack { - export type AsObject = { - documentKey: string, - checkpoint?: Checkpoint.AsObject, - snapshot: Uint8Array | string, - changesList: Array, - minSyncedTicket?: TimeTicket.AsObject, - isRemoved: boolean, - } -} - -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; -} - -export namespace Change { - export type AsObject = { - id?: ChangeID.AsObject, - message: string, - operationsList: Array, - presenceChange?: PresenceChange.AsObject, - } -} - -export class ChangeID extends jspb.Message { - getClientSeq(): number; - setClientSeq(value: number): ChangeID; - - getServerSeq(): string; - setServerSeq(value: string): ChangeID; - - getLamport(): string; - setLamport(value: string): ChangeID; - - getActorId(): Uint8Array | string; - getActorId_asU8(): Uint8Array; - getActorId_asB64(): string; - setActorId(value: Uint8Array | string): ChangeID; - - 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; -} - -export namespace ChangeID { - export type AsObject = { - clientSeq: number, - serverSeq: string, - lamport: string, - actorId: Uint8Array | string, - } -} - -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; -} - -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, - } -} - -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; -} - -export namespace JSONElementSimple { - export type AsObject = { - createdAt?: TimeTicket.AsObject, - movedAt?: TimeTicket.AsObject, - removedAt?: TimeTicket.AsObject, - type: ValueType, - value: Uint8Array | string, - } -} - -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; -} - -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, - } -} - -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; -} - -export namespace RHTNode { - export type AsObject = { - key: string, - element?: JSONElement.AsObject, - } -} - -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; -} - -export namespace RGANode { - export type AsObject = { - next?: RGANode.AsObject, - element?: JSONElement.AsObject, - } -} - -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; -} - -export namespace NodeAttr { - export type AsObject = { - value: string, - updatedAt?: TimeTicket.AsObject, - } -} - -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; -} - -export namespace TextNode { - export type AsObject = { - id?: TextNodeID.AsObject, - value: string, - removedAt?: TimeTicket.AsObject, - insPrevId?: TextNodeID.AsObject, - attributesMap: Array<[string, NodeAttr.AsObject]>, - } -} - -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; -} - -export namespace TextNodeID { - export type AsObject = { - createdAt?: TimeTicket.AsObject, - offset: number, - } -} - -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; -} - -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]>, - } -} - -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; -} - -export namespace TreeNodes { - export type AsObject = { - contentList: Array, - } -} - -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; -} - -export namespace TreeNodeID { - export type AsObject = { - createdAt?: TimeTicket.AsObject, - offset: number, - } -} - -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; -} - -export namespace TreePos { - export type AsObject = { - parentId?: TreeNodeID.AsObject, - leftSiblingId?: TreeNodeID.AsObject, - } -} - -export class User extends jspb.Message { - getId(): string; - setId(value: string): User; - - getUsername(): string; - setUsername(value: string): User; - - getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined; - setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): User; - hasCreatedAt(): boolean; - clearCreatedAt(): User; - - 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; -} - -export namespace User { - export type AsObject = { - id: string, - username: string, - createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject, - } -} - -export class Project extends jspb.Message { - getId(): string; - setId(value: string): Project; - - getName(): string; - setName(value: string): Project; - - getPublicKey(): string; - setPublicKey(value: string): Project; - - getSecretKey(): string; - setSecretKey(value: string): Project; - - getAuthWebhookUrl(): string; - setAuthWebhookUrl(value: string): Project; - - getAuthWebhookMethodsList(): Array; - setAuthWebhookMethodsList(value: Array): Project; - clearAuthWebhookMethodsList(): Project; - addAuthWebhookMethods(value: string, index?: number): Project; - - getClientDeactivateThreshold(): string; - setClientDeactivateThreshold(value: string): Project; - - getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined; - setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): Project; - hasCreatedAt(): boolean; - clearCreatedAt(): Project; - - getUpdatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined; - setUpdatedAt(value?: google_protobuf_timestamp_pb.Timestamp): Project; - hasUpdatedAt(): boolean; - clearUpdatedAt(): Project; - - 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; -} - -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, - } -} - -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; -} - -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, - } - } - -} - -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; -} - -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, - } -} - -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; -} - -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, - } -} - -export class Presence extends jspb.Message { - getDataMap(): jspb.Map; - clearDataMap(): Presence; - - 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; -} - -export namespace Presence { - export type AsObject = { - dataMap: Array<[string, string]>, - } -} - -export class Checkpoint extends jspb.Message { - getServerSeq(): string; - setServerSeq(value: string): Checkpoint; - - getClientSeq(): number; - setClientSeq(value: number): Checkpoint; - - 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; -} - -export namespace Checkpoint { - export type AsObject = { - serverSeq: string, - clientSeq: number, - } -} - -export class TextNodePos extends jspb.Message { - getCreatedAt(): TimeTicket | undefined; - setCreatedAt(value?: TimeTicket): TextNodePos; - hasCreatedAt(): boolean; - clearCreatedAt(): TextNodePos; - - getOffset(): number; - setOffset(value: number): TextNodePos; - - getRelativeOffset(): number; - setRelativeOffset(value: number): TextNodePos; - - 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; -} - -export namespace TextNodePos { - export type AsObject = { - createdAt?: TimeTicket.AsObject, - offset: number, - relativeOffset: number, - } -} - -export class TimeTicket extends jspb.Message { - getLamport(): string; - setLamport(value: string): TimeTicket; - - getDelimiter(): number; - setDelimiter(value: number): TimeTicket; - - getActorId(): Uint8Array | string; - getActorId_asU8(): Uint8Array; - getActorId_asB64(): string; - setActorId(value: Uint8Array | string): TimeTicket; - - 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; -} - -export namespace TimeTicket { - export type AsObject = { - lamport: string, - delimiter: number, - actorId: Uint8Array | string, - } -} - -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; -} - -export namespace DocEventBody { - export type AsObject = { - topic: string, - payload: Uint8Array | string, - } -} - -export class DocEvent extends jspb.Message { - getType(): DocEventType; - setType(value: DocEventType): DocEvent; - - getPublisher(): string; - setPublisher(value: string): DocEvent; - - getBody(): DocEventBody | undefined; - setBody(value?: DocEventBody): DocEvent; - hasBody(): boolean; - clearBody(): DocEvent; - - 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; -} - -export namespace DocEvent { - export type AsObject = { - type: DocEventType, - publisher: string, - body?: DocEventBody.AsObject, - } -} - -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, -} -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, -} diff --git a/src/api/yorkie/v1/resources_pb.js b/src/api/yorkie/v1/resources_pb.js deleted file mode 100644 index f97ef6105..000000000 --- a/src/api/yorkie/v1/resources_pb.js +++ /dev/null @@ -1,13502 +0,0 @@ -// 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! -/* 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 - */ -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); diff --git a/src/api/yorkie/v1/yorkie.proto b/src/api/yorkie/v1/yorkie.proto index da71d6a11..9b0c86d84 100644 --- a/src/api/yorkie/v1/yorkie.proto +++ b/src/api/yorkie/v1/yorkie.proto @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -syntax = "proto3"; + syntax = "proto3"; package yorkie.v1; 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 deleted file mode 100644 index 0a3992403..000000000 --- a/src/api/yorkie/v1/yorkie_pb.d.ts +++ /dev/null @@ -1,396 +0,0 @@ -import * as jspb from 'google-protobuf' - -import * as yorkie_v1_resources_pb from '../../yorkie/v1/resources_pb'; - - -export class ActivateClientRequest extends jspb.Message { - getClientKey(): string; - setClientKey(value: string): ActivateClientRequest; - - 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; -} - -export namespace ActivateClientRequest { - export type AsObject = { - clientKey: string, - } -} - -export class ActivateClientResponse extends jspb.Message { - getClientId(): string; - setClientId(value: string): ActivateClientResponse; - - 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; -} - -export namespace ActivateClientResponse { - export type AsObject = { - clientId: string, - } -} - -export class DeactivateClientRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): DeactivateClientRequest; - - 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; -} - -export namespace DeactivateClientRequest { - export type AsObject = { - clientId: string, - } -} - -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; -} - -export namespace DeactivateClientResponse { - export type AsObject = { - } -} - -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; -} - -export namespace AttachDocumentRequest { - export type AsObject = { - clientId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } -} - -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; -} - -export namespace AttachDocumentResponse { - export type AsObject = { - documentId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } -} - -export class DetachDocumentRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): DetachDocumentRequest; - - getDocumentId(): string; - setDocumentId(value: string): DetachDocumentRequest; - - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): DetachDocumentRequest; - hasChangePack(): boolean; - clearChangePack(): DetachDocumentRequest; - - getRemoveIfNotAttached(): boolean; - setRemoveIfNotAttached(value: boolean): DetachDocumentRequest; - - 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; -} - -export namespace DetachDocumentRequest { - export type AsObject = { - clientId: string, - documentId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - removeIfNotAttached: boolean, - } -} - -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; -} - -export namespace DetachDocumentResponse { - export type AsObject = { - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } -} - -export class WatchDocumentRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): WatchDocumentRequest; - - getDocumentId(): string; - setDocumentId(value: string): WatchDocumentRequest; - - 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; -} - -export namespace WatchDocumentRequest { - export type AsObject = { - clientId: string, - documentId: 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; -} - -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, - } -} - -export class RemoveDocumentRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): RemoveDocumentRequest; - - getDocumentId(): string; - setDocumentId(value: string): RemoveDocumentRequest; - - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): RemoveDocumentRequest; - hasChangePack(): boolean; - clearChangePack(): RemoveDocumentRequest; - - 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; -} - -export namespace RemoveDocumentRequest { - export type AsObject = { - clientId: string, - documentId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } -} - -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; -} - -export namespace RemoveDocumentResponse { - export type AsObject = { - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } -} - -export class PushPullChangesRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): PushPullChangesRequest; - - getDocumentId(): string; - setDocumentId(value: string): PushPullChangesRequest; - - getChangePack(): yorkie_v1_resources_pb.ChangePack | undefined; - setChangePack(value?: yorkie_v1_resources_pb.ChangePack): PushPullChangesRequest; - hasChangePack(): boolean; - clearChangePack(): PushPullChangesRequest; - - getPushOnly(): boolean; - setPushOnly(value: boolean): PushPullChangesRequest; - - 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; -} - -export namespace PushPullChangesRequest { - export type AsObject = { - clientId: string, - documentId: string, - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - pushOnly: 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; -} - -export namespace PushPullChangesResponse { - export type AsObject = { - changePack?: yorkie_v1_resources_pb.ChangePack.AsObject, - } -} - -export class BroadcastRequest extends jspb.Message { - getClientId(): string; - setClientId(value: string): BroadcastRequest; - - getDocumentId(): string; - setDocumentId(value: string): BroadcastRequest; - - getTopic(): string; - setTopic(value: string): BroadcastRequest; - - getPayload(): Uint8Array | string; - getPayload_asU8(): Uint8Array; - getPayload_asB64(): string; - setPayload(value: Uint8Array | string): BroadcastRequest; - - 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; -} - -export namespace BroadcastRequest { - export type AsObject = { - clientId: string, - documentId: string, - topic: string, - payload: Uint8Array | string, - } -} - -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; -} - -export namespace BroadcastResponse { - export type AsObject = { - } -} - diff --git a/src/api/yorkie/v1/yorkie_pb.js b/src/api/yorkie/v1/yorkie_pb.js deleted file mode 100644 index 553b34687..000000000 --- a/src/api/yorkie/v1/yorkie_pb.js +++ /dev/null @@ -1,3289 +0,0 @@ -// 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! -/* 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; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -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; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.AttachDocumentResponse} - */ -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; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.yorkie.v1.AttachDocumentResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.yorkie.v1.AttachDocumentResponse.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.AttachDocumentResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -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 - ); - } -}; - - -/** - * optional string document_id = 1; - * @return {string} - */ -proto.yorkie.v1.AttachDocumentResponse.prototype.getDocumentId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.yorkie.v1.AttachDocumentResponse} returns this - */ -proto.yorkie.v1.AttachDocumentResponse.prototype.setDocumentId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional ChangePack change_pack = 2; - * @return {?proto.yorkie.v1.ChangePack} - */ -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); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.yorkie.v1.AttachDocumentResponse} returns this - */ -proto.yorkie.v1.AttachDocumentResponse.prototype.clearChangePack = function() { - return this.setChangePack(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.yorkie.v1.AttachDocumentResponse.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.DetachDocumentRequest.prototype.toObject = function(opt_includeInstance) { - return proto.yorkie.v1.DetachDocumentRequest.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.DetachDocumentRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -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; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.yorkie.v1.DetachDocumentRequest} - */ -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); -}; - - -/** - * 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} - */ -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; -}; - - -/** - * 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(); -}; - - -/** - * 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; -}; - - -goog.object.extend(exports, proto.yorkie.v1); diff --git a/src/client/client.ts b/src/client/client.ts index 71a69c57a..d04c498a5 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -24,6 +24,9 @@ import { CompleteFn, NextFn, } from '@yorkie-js-sdk/src/util/observable'; +import { ConnectError, createPromiseClient, PromiseClient } from "@connectrpc/connect"; +import { createConnectTransport } from "@connectrpc/connect-web"; +import { YorkieService } from '../api/yorkie/v1/yorkie_connect'; import { ActivateClientRequest, DeactivateClientRequest, @@ -36,7 +39,7 @@ import { } 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 { 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'; @@ -309,7 +312,7 @@ export class Client implements Observable { private reconnectStreamDelay: number; private retrySyncLoopDelay: number; - private rpcClient: RPCClient; + private rpcClient: PromiseClient; private eventStream: Observable; private eventStreamObserver!: Observer; @@ -347,7 +350,20 @@ export class Client implements Observable { ); } - this.rpcClient = new RPCClient(rpcAddr, null, rpcOpts); + // The transport defines what type of endpoint we're hitting. + // In our example we'll be communicating with a Connect endpoint. + // If your endpoint only supports gRPC-web, make sure to use + // `createGrpcWebTransport` instead. + const transport = createConnectTransport({ + baseUrl: rpcAddr, + // skip interceptors for now because they are metric interceptors + //interceptors: rpcOpts.unaryInterceptors, + }); + + // Here we make the client itself, combining the service + // definition with the transport. + this.rpcClient = createPromiseClient(YorkieService, transport); + this.eventStream = createObservable((observer) => { this.eventStreamObserver = observer; }); @@ -364,32 +380,30 @@ export class Client implements Observable { } return new Promise((resolve, reject) => { - const req = new ActivateClientRequest(); - req.setClientKey(this.key); + const req = new ActivateClientRequest({ + clientKey: 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(); + { 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}"`); + resolve(); + }).catch((err) => { + logger.error(`[AC] c:"${this.getKey()}" err :`, err); + reject(err); + return; + }); }); } @@ -407,28 +421,25 @@ export class Client implements Observable { return new Promise((resolve, reject) => { const req = new DeactivateClientRequest(); - req.setClientId(this.id!); + req.clientId = 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, - }); + { headers: {"x-shard-key": this.apiKey}}, + ).then((res) => { + this.status = ClientStatus.Deactivated; + this.eventStreamObserver.next({ + type: ClientEventType.StatusChanged, + value: this.status, + }); - logger.info(`[DC] c"${this.getKey()}" deactivated`); - resolve(); - }, - ); + logger.info(`[DC] c"${this.getKey()}" deactivated`); + resolve(); + }).catch((err) => { + logger.error(`[DC] c:"${this.getKey()}" err :`, err); + reject(err); + return; + }); }); } @@ -459,42 +470,39 @@ export class Client implements Observable { return new Promise((resolve, reject) => { const req = new AttachDocumentRequest(); - req.setClientId(this.id!); - req.setChangePack(converter.toChangePack(doc.createChangePack())); + req.clientId = this.id!; + req.changePack = 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; - } + { 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.Attached); + this.attachmentMap.set( + doc.getKey(), + new Attachment( + this.reconnectStreamDelay, + doc, + res.documentId, + isRealtimeSync, + ), + ); - 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()); - } + if (isRealtimeSync) { + this.runWatchLoop(doc.getKey()); } + } - logger.info(`[AD] c:"${this.getKey()}" attaches d:"${doc.getKey()}"`); - resolve(doc); - }, - ); + logger.info(`[AD] c:"${this.getKey()}" attaches d:"${doc.getKey()}"`); + resolve(doc); + }).catch((err) => { + logger.error(`[AD] c:"${this.getKey()}" err :`, err); + reject(err); + return; + }); }); } @@ -526,32 +534,29 @@ export class Client implements Observable { 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); + req.clientId = this.id!; + req.documentId = attachment.docID; + req.changePack = converter.toChangePack(doc.createChangePack()); + req.removeIfNotAttached = 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()); + { 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()}"`); - resolve(doc); - }, - ); + logger.info(`[DD] c:"${this.getKey()}" detaches d:"${doc.getKey()}"`); + resolve(doc); + }).catch((err) => { + logger.error(`[DD] c:"${this.getKey()}" err :`, err); + reject(err); + return; + }); }); } @@ -709,33 +714,27 @@ 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); + req.clientId = this.id!; + req.documentId = attachment.docID; const pbChangePack = converter.toChangePack(doc.createChangePack()); - pbChangePack.setIsRemoved(true); - req.setChangePack(pbChangePack); + pbChangePack.isRemoved = true; + req.changePack = 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(); - }, - ); + { 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()}"`); + resolve(); + }).catch((err) => { + logger.error(`[RD] c:"${this.getKey()}" err :`, err); + reject(err); + return; + }); }); } @@ -832,10 +831,10 @@ export class Client implements Observable { } const req = new WatchDocumentRequest(); - req.setClientId(this.id!); - req.setDocumentId(attachment.docID); + req.clientId = this.id!; + req.documentId = attachment.docID; const stream = this.rpcClient.watchDocument(req, { - 'x-shard-key': `${this.apiKey}/${docKey}`, + headers: {"x-shard-key": `${this.apiKey}/${docKey}`} }); this.eventStreamObserver.next({ @@ -844,7 +843,7 @@ export class Client implements Observable { }); logger.info(`[WD] c:"${this.getKey()}" watches d:"${docKey}"`); - return new Promise((resolve) => { + return new Promise(async (resolve) => { const onStreamDisconnect = (): void => { this.eventStreamObserver.next({ type: ClientEventType.StreamConnectionStatusChanged, @@ -854,12 +853,16 @@ export class Client implements Observable { onDisconnect(); }; - stream.on('data', (resp: WatchDocumentResponse) => { - this.handleWatchDocumentsResponse(attachment, resp); - resolve(stream); - }); - stream.on('end', onStreamDisconnect); - stream.on('error', onStreamDisconnect); + try { + for await (const resp of stream) { + this.handleWatchDocumentsResponse(attachment, resp); + resolve(stream); + } + } catch(error) { + if(error instanceof ConnectError) { + onStreamDisconnect(); + } + } }); }, ); @@ -870,8 +873,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 +885,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; } } } @@ -953,56 +956,52 @@ export class Client implements Observable { const { doc, docID } = attachment; return new Promise((resolve, reject) => { const req = new PushPullChangesRequest(); - req.setClientId(this.id!); - req.setDocumentId(docID); + req.clientId = this.id!; + req.documentId = docID; const reqPack = doc.createChangePack(); const localSize = reqPack.getChangeSize(); - req.setChangePack(converter.toChangePack(reqPack)); - req.setPushOnly(syncMode === SyncMode.PushOnly); + req.changePack = converter.toChangePack(reqPack); + req.pushOnly = 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; - } + { headers: {"x-shard-key": `${this.apiKey}/${doc.getKey()}`}}, + ).then((res) => { + const respPack = converter.fromChangePack

(res.changePack!); - const respPack = converter.fromChangePack

(res.getChangePack()!); + // (chacha912, hackerwins): If syncLoop already executed with + // PushPull, ignore the response when the syncMode is PushOnly. + if (respPack.hasChanges() && syncMode === SyncMode.PushOnly) { + return; + } - // 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, + }); + // (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()); + } - 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 docKey = doc.getKey(); + const remoteSize = respPack.getChangeSize(); + logger.info( + `[PP] c:"${this.getKey()}" sync d:"${docKey}", push:${localSize} pull:${remoteSize} cp:${respPack + .getCheckpoint() + .toTestString()}`, + ); + }).catch((err) => { + logger.error(`[PP] c:"${this.getKey()}" err :`, err); - 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', () => { + isRejected = true; + reject(err); + return; + }).finally(() => { if (isRejected) { return; } From f75c4f81625f371736b3370ede57ef65389d5af3 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Wed, 29 Nov 2023 01:55:03 +0900 Subject: [PATCH 02/21] Update protobuf and converter --- buf.gen.yaml | 10 +- package.json | 2 +- public/index.html | 2 +- src/api/converter.ts | 888 ++++++++++++++++++++++--------------------- 4 files changed, 469 insertions(+), 433 deletions(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index a6abc0207..d827f7f4b 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -2,15 +2,11 @@ # For details, see https://buf.build/docs/configuration/v1/buf-gen-yaml version: v1 plugins: - # This will invoke protoc-gen-es and write output to src/gen - plugin: es out: . - opt: - # Add more plugin options here - - target=ts + opt: target=js+dts # This will invoke protoc-gen-connect-es - plugin: connect-es out: . - opt: - # Add more plugin options here - - target=ts + opt: + - target=js+dts diff --git a/package.json b/package.json index 38ed3fd4f..76cc6b06f 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 ./src/api/yorkie/v1/*.proto", + "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: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", diff --git a/public/index.html b/public/index.html index 965c83a71..3b7cfeedb 100644 --- a/public/index.html +++ b/public/index.html @@ -324,7 +324,7 @@

devtool.setCodeMirror(codemirror); // 02-1. create client with RPCAddr(envoy). - const client = new yorkie.Client('http://localhost:8080'); + const client = new yorkie.Client('http://localhost:11101'); // 02-2. subscribe client event. client.subscribe(network.statusListener(statusHolder)); diff --git a/src/api/converter.ts b/src/api/converter.ts index 3ee828f1e..39ceca628 100644 --- a/src/api/converter.ts +++ b/src/api/converter.ts @@ -79,6 +79,23 @@ import { TreePos as PbTreePos, TreeNodeID as PbTreeNodeID, ValueType as PbValueType, + JSONElement_Tree, + JSONElement_Text, + JSONElement_Primitive, + JSONElement_Counter, + JSONElement_JSONObject, + JSONElement_JSONArray, + PresenceChange_ChangeType, + Operation_Set, + Operation_Add, + Operation_Move, + Operation_Remove, + Operation_Edit, + Operation_Style, + Operation_Increase, + Operation_TreeEdit, + Operation_TreeStyle, + Presence, } from '@yorkie-js-sdk/src/api/yorkie/v1/resources_pb'; import { IncreaseOperation } from '@yorkie-js-sdk/src/document/operation/increase_operation'; import { @@ -99,9 +116,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; } @@ -115,10 +132,10 @@ function toPresenceChange( const pbPresenceChange = new PbPresenceChange(); if (presenceChange.type === PresenceChangeType.Put) { - pbPresenceChange.setType(PbPresenceChange.ChangeType.CHANGE_TYPE_PUT); - pbPresenceChange.setPresence(toPresence(presenceChange.presence)); + pbPresenceChange.type = PresenceChange_ChangeType.PUT; + pbPresenceChange.presence = toPresence(presenceChange.presence); } else if (presenceChange.type === PresenceChangeType.Clear) { - pbPresenceChange.setType(PbPresenceChange.ChangeType.CHANGE_TYPE_CLEAR); + pbPresenceChange.type = PresenceChange_ChangeType.CLEAR; } return pbPresenceChange; @@ -129,8 +146,8 @@ function toPresenceChange( */ function toCheckpoint(checkpoint: Checkpoint): PbCheckpoint { const pbCheckpoint = new PbCheckpoint(); - pbCheckpoint.setServerSeq(checkpoint.getServerSeqAsString()); - pbCheckpoint.setClientSeq(checkpoint.getClientSeq()); + pbCheckpoint.serverSeq = checkpoint.getServerSeqAsString(); + pbCheckpoint.clientSeq = checkpoint.getClientSeq(); return pbCheckpoint; } @@ -139,9 +156,9 @@ function toCheckpoint(checkpoint: Checkpoint): PbCheckpoint { */ function toChangeID(changeID: ChangeID): PbChangeID { const pbChangeID = new PbChangeID(); - pbChangeID.setClientSeq(changeID.getClientSeq()); - pbChangeID.setLamport(changeID.getLamportAsString()); - pbChangeID.setActorId(toUint8Array(changeID.getActorID()!)); + pbChangeID.clientSeq = changeID.getClientSeq(); + pbChangeID.lamport = changeID.getLamportAsString(); + pbChangeID.actorId = toUint8Array(changeID.getActorID()!); return pbChangeID; } @@ -154,9 +171,9 @@ function toTimeTicket(ticket?: TimeTicket): PbTimeTicket | undefined { } const pbTimeTicket = new PbTimeTicket(); - pbTimeTicket.setLamport(ticket.getLamportAsString()); - pbTimeTicket.setDelimiter(ticket.getDelimiter()); - pbTimeTicket.setActorId(toUint8Array(ticket.getActorID()!)); + pbTimeTicket.lamport = ticket.getLamportAsString(); + pbTimeTicket.delimiter = ticket.getDelimiter(); + pbTimeTicket.actorId = toUint8Array(ticket.getActorID()!); return pbTimeTicket; } @@ -166,21 +183,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 +209,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}`); } @@ -206,31 +223,31 @@ function toCounterType(valueType: CounterType): PbValueType { 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)); + pbElementSimple.type = PbValueType.JSON_OBJECT; + pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); + pbElementSimple.value = objectToBytes(element); } else if (element instanceof CRDTArray) { - pbElementSimple.setType(PbValueType.VALUE_TYPE_JSON_ARRAY); - pbElementSimple.setCreatedAt(toTimeTicket(element.getCreatedAt())); - pbElementSimple.setValue(arrayToBytes(element)); + pbElementSimple.type = PbValueType.JSON_ARRAY; + pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); + pbElementSimple.value = arrayToBytes(element); } else if (element instanceof CRDTText) { - pbElementSimple.setType(PbValueType.VALUE_TYPE_TEXT); - pbElementSimple.setCreatedAt(toTimeTicket(element.getCreatedAt())); + pbElementSimple.type = PbValueType.TEXT; + pbElementSimple.createdAt = 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()); + pbElementSimple.type = toValueType(primitive.getType()); + pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); + pbElementSimple.value = 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()); + pbElementSimple.type = toCounterType(counter.getType()); + pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); + pbElementSimple.value = 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)); + pbElementSimple.type = PbValueType.TREE; + pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); + pbElementSimple.value = treeToBytes(tree); } else { throw new YorkieError(Code.Unimplemented, `unimplemented element`); } @@ -243,8 +260,8 @@ function toElementSimple(element: CRDTElement): PbJSONElementSimple { */ function toTextNodeID(id: RGATreeSplitNodeID): PbTextNodeID { const pbTextNodeID = new PbTextNodeID(); - pbTextNodeID.setCreatedAt(toTimeTicket(id.getCreatedAt())); - pbTextNodeID.setOffset(id.getOffset()); + pbTextNodeID.createdAt = toTimeTicket(id.getCreatedAt()); + pbTextNodeID.offset = id.getOffset(); return pbTextNodeID; } @@ -253,9 +270,9 @@ function toTextNodeID(id: RGATreeSplitNodeID): PbTextNodeID { */ function toTextNodePos(pos: RGATreeSplitPos): PbTextNodePos { const pbTextNodePos = new PbTextNodePos(); - pbTextNodePos.setCreatedAt(toTimeTicket(pos.getID().getCreatedAt())); - pbTextNodePos.setOffset(pos.getID().getOffset()); - pbTextNodePos.setRelativeOffset(pos.getRelativeOffset()); + pbTextNodePos.createdAt = toTimeTicket(pos.getID().getCreatedAt()); + pbTextNodePos.offset = pos.getID().getOffset(); + pbTextNodePos.relativeOffset = pos.getRelativeOffset(); return pbTextNodePos; } @@ -264,8 +281,8 @@ function toTextNodePos(pos: RGATreeSplitPos): PbTextNodePos { */ function toTreePos(pos: CRDTTreePos): PbTreePos { const pbTreePos = new PbTreePos(); - pbTreePos.setParentId(toTreeNodeID(pos.getParentID())); - pbTreePos.setLeftSiblingId(toTreeNodeID(pos.getLeftSiblingID())); + pbTreePos.parentId = toTreeNodeID(pos.getParentID()); + pbTreePos.leftSiblingId = toTreeNodeID(pos.getLeftSiblingID()); return pbTreePos; } @@ -274,8 +291,8 @@ function toTreePos(pos: CRDTTreePos): PbTreePos { */ function toTreeNodeID(treeNodeID: CRDTTreeNodeID): PbTreeNodeID { const pbTreeNodeID = new PbTreeNodeID(); - pbTreeNodeID.setCreatedAt(toTimeTicket(treeNodeID.getCreatedAt())); - pbTreeNodeID.setOffset(treeNodeID.getOffset()); + pbTreeNodeID.createdAt = toTimeTicket(treeNodeID.getCreatedAt()); + pbTreeNodeID.offset = treeNodeID.getOffset(); return pbTreeNodeID; } @@ -287,141 +304,152 @@ 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 Operation_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 Operation_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 Operation_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()), + const pbRemoveOperation = new Operation_Remove(); + pbRemoveOperation.parentCreatedAt = toTimeTicket( + removeOperation.getParentCreatedAt(), ); - pbRemoveOperation.setCreatedAt( - toTimeTicket(removeOperation.getCreatedAt()), + pbRemoveOperation.createdAt = toTimeTicket( + removeOperation.getCreatedAt(), ); - pbRemoveOperation.setExecutedAt( - toTimeTicket(removeOperation.getExecutedAt()), + 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 Operation_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 Operation_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()), + pbStyleOperation.executedAt = toTimeTicket( + styleOperation.getExecutedAt(), ); - pbOperation.setStyle(pbStyleOperation); + 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 Operation_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 pbTreeEditOperation = new Operation_TreeEdit(); const pbCreatedAtMapByActor = - pbTreeEditOperation.getCreatedAtMapByActorMap(); + 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 Operation_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'); } @@ -445,13 +473,13 @@ function toOperations(operations: Array): Array { */ function toChange(change: Change): PbChange { const pbChange = new PbChange(); - pbChange.setId(toChangeID(change.getID())); - pbChange.setMessage(change.getMessage()!); + pbChange.id = toChangeID(change.getID()); + pbChange.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; } @@ -474,9 +502,9 @@ function toRHTNodes(rht: ElementRHT): Array { const pbRHTNodes = []; for (const rhtNode of rht) { const pbRHTNode = new PbRHTNode(); - pbRHTNode.setKey(rhtNode.getStrKey()); + pbRHTNode.key = rhtNode.getStrKey(); // eslint-disable-next-line - pbRHTNode.setElement(toElement(rhtNode.getValue())); + pbRHTNode.element = toElement(rhtNode.getValue()); pbRHTNodes.push(pbRHTNode); } @@ -491,7 +519,7 @@ function toRGANodes(rgaTreeList: RGATreeList): Array { for (const rgaTreeListNode of rgaTreeList) { const pbRGANode = new PbRGANode(); // eslint-disable-next-line - pbRGANode.setElement(toElement(rgaTreeListNode.getValue())); + pbRGANode.element = toElement(rgaTreeListNode.getValue()); pbRGANodes.push(pbRGANode); } @@ -508,17 +536,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); @@ -539,7 +567,7 @@ function toTreeNodesWhenEdit(nodes: Array): Array { nodes.forEach((node) => { const pbTreeNodes = new PbTreeNodes(); - pbTreeNodes.setContentList(toTreeNodes(node)); + pbTreeNodes.content = toTreeNodes(node); pbTreeNodesList.push(pbTreeNodes); }); @@ -557,28 +585,28 @@ 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); + pbTreeNode.id = toTreeNodeID(n.id); + pbTreeNode.type = n.type; 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); + pbTreeNode.removedAt = toTimeTicket(n.removedAt); + pbTreeNode.depth = depth; if (n.attrs) { - const pbNodeAttrsMap = pbTreeNode.getAttributesMap(); + const pbNodeAttrsMap = pbTreeNode.attributes; for (const attr of n.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; } } @@ -592,14 +620,15 @@ 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 pbObject = new JSONElement_JSONObject(); + pbObject.nodes = toRHTNodes(obj.getRHT()); + pbObject.createdAt = toTimeTicket(obj.getCreatedAt()); + pbObject.movedAt = toTimeTicket(obj.getMovedAt()); + pbObject.removedAt = toTimeTicket(obj.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.setJsonObject(pbObject); + pbElement.body.case = "jsonObject"; + pbElement.body.value = pbObject; return pbElement; } @@ -607,14 +636,15 @@ 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 pbArray = new JSONElement_JSONArray(); + pbArray.nodes = toRGANodes(arr.getElements()); + pbArray.createdAt = toTimeTicket(arr.getCreatedAt()); + pbArray.movedAt = toTimeTicket(arr.getMovedAt()); + pbArray.removedAt = toTimeTicket(arr.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.setJsonArray(pbArray); + pbElement.body.case = "jsonArray"; + pbElement.body.value = pbArray; return pbElement; } @@ -622,15 +652,16 @@ 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 pbPrimitive = new JSONElement_Primitive(); + pbPrimitive.type = toValueType(primitive.getType()); + pbPrimitive.value = primitive.toBytes(); + pbPrimitive.createdAt = toTimeTicket(primitive.getCreatedAt()); + pbPrimitive.movedAt = toTimeTicket(primitive.getMovedAt()); + pbPrimitive.removedAt = toTimeTicket(primitive.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.setPrimitive(pbPrimitive); + pbElement.body.case = "primitive"; + pbElement.body.value = pbPrimitive; return pbElement; } @@ -638,14 +669,15 @@ 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 pbText = new JSONElement_Text(); + pbText.nodes = toTextNodes(text.getRGATreeSplit()); + pbText.createdAt = toTimeTicket(text.getCreatedAt()); + pbText.movedAt = toTimeTicket(text.getMovedAt()); + pbText.removedAt = toTimeTicket(text.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.setText(pbText); + pbElement.body.case = "text"; + pbElement.body.value = pbText; return pbElement; } @@ -653,15 +685,16 @@ 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 pbCounter = new JSONElement_Counter(); + pbCounter.type = toCounterType(counter.getType()); + pbCounter.value = counter.toBytes(); + pbCounter.createdAt = toTimeTicket(counter.getCreatedAt()); + pbCounter.movedAt = toTimeTicket(counter.getMovedAt()); + pbCounter.removedAt = toTimeTicket(counter.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.setCounter(pbCounter); + pbElement.body.case = "counter" + pbElement.body.value = pbCounter; return pbElement; } @@ -669,14 +702,15 @@ 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 pbTree = new JSONElement_Tree(); + pbTree.nodes = toTreeNodes(tree.getRoot()); + pbTree.createdAt = toTimeTicket(tree.getCreatedAt()); + pbTree.movedAt = toTimeTicket(tree.getMovedAt()); + pbTree.removedAt = toTimeTicket(tree.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.setTree(pbTree); + pbElement.body.case = "tree"; + pbElement.body.value = pbTree; return pbElement; } @@ -706,12 +740,12 @@ function toElement(element: CRDTElement): PbJSONElement { */ 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())); + pbChangePack.documentKey = pack.getDocumentKey(); + pbChangePack.checkpoint = toCheckpoint(pack.getCheckpoint()); + pbChangePack.isRemoved = pack.getIsRemoved(); + pbChangePack.changes = toChanges(pack.getChanges()); + pbChangePack.snapshot = pack.getSnapshot()!; + pbChangePack.minSyncedTicket = toTimeTicket(pack.getMinSyncedTicket()); return pbChangePack; } @@ -720,9 +754,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 +769,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 +780,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,15 +793,15 @@ function fromPresence

(pbPresence: PbPresence): P { function fromPresenceChange

( pbPresenceChange: PbPresenceChange, ): PresenceChange

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

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

(pbPresenceChange.presence!); return { type: PresenceChangeType.Put, presence, }; - } else if (type === PbPresenceChange.ChangeType.CHANGE_TYPE_CLEAR) { + } else if (type === PresenceChange_ChangeType.CLEAR) { return { type: PresenceChangeType.Clear, }; @@ -780,10 +814,10 @@ function fromPresenceChange

( * `fromPresences` converts the given Protobuf format to model format. */ function fromPresences

( - pbPresences: jspb.Map, + pbPresences: { [key: string]: Presence }, ): 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 +828,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 +856,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 +871,52 @@ 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()) { + switch (pbElementSimple.type) { + case PbValueType.JSON_OBJECT: + if (!pbElementSimple.value) { return CRDTObject.create( - fromTimeTicket(pbElementSimple.getCreatedAt())!, + fromTimeTicket(pbElementSimple.createdAt)!, ); } - return bytesToObject(pbElementSimple.getValue_asU8()); - case PbValueType.VALUE_TYPE_JSON_ARRAY: - if (!pbElementSimple.getValue()) { + return bytesToObject(pbElementSimple.value); + case PbValueType.JSON_ARRAY: + if (!pbElementSimple.value) { return CRDTArray.create( - fromTimeTicket(pbElementSimple.getCreatedAt())!, + 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 +927,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 +939,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 +948,20 @@ 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) => { + const textValue = CRDTTextValue.create(pbTextNode.value); + Object.entries(pbTextNode.attributes).forEach(([key, value]) => { textValue.setAttr( key, - value.getValue(), - fromTimeTicket(value.getUpdatedAt())!, + 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,118 @@ 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()), + fromTimeTicket(pbTreeEditOperation!.parentCreatedAt)!, + fromTreePos(pbTreeEditOperation!.from!), + fromTreePos(pbTreeEditOperation!.to!), + fromTreeNodesWhenEdit(pbTreeEditOperation!.contents), pbTreeEditOperation!.getSplitLevel(), 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) => { + 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 +1207,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 +1225,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 +1237,63 @@ 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: JSONElement_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: JSONElement_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())!, + fromTimeTicket(pbArray.createdAt)!, rgaTreeList, ); - arr.setMovedAt(fromTimeTicket(pbArray.getMovedAt())); - arr.setRemovedAt(fromTimeTicket(pbArray.getRemovedAt())); + 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: JSONElement_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 +1301,70 @@ function fromPrimitive(pbPrimitive: PbJSONElement.Primitive): Primitive { * `fromText` converts the given Protobuf format to model format. */ function fromText( - pbText: PbJSONElement.Text, + pbText: JSONElement_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())!, + fromTimeTicket(pbText.createdAt)!, ); - text.setMovedAt(fromTimeTicket(pbText.getMovedAt())); - text.setRemovedAt(fromTimeTicket(pbText.getRemovedAt())); + 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: JSONElement_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: JSONElement_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 +1386,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 +1401,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 JSONElement_JSONObject); } /** * `objectToBytes` converts the given JSONObject to byte array. */ function objectToBytes(obj: CRDTObject): Uint8Array { - return toElement(obj).serializeBinary(); + return toElement(obj).toBinary(); } /** @@ -1380,15 +1420,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 JSONElement_JSONArray); } /** * `arrayToBytes` converts the given CRDTArray to bytes. */ function arrayToBytes(array: CRDTArray): Uint8Array { - return toArray(array).serializeBinary(); + return toArray(array).toBinary(); } /** @@ -1399,15 +1439,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 JSONElement_Tree); } /** * `treeToBytes` converts the given tree to bytes. */ function treeToBytes(tree: CRDTTree): Uint8Array { - return toTree(tree).serializeBinary(); + return toTree(tree).toBinary(); } /** From 6f9df3ac336a006171abaffbfa1e34ee1aaf98f0 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Wed, 29 Nov 2023 12:41:39 +0900 Subject: [PATCH 03/21] Update rpc ports to http ports & remove envoy --- docker/docker-compose-ci.yml | 17 ++--------- docker/docker-compose.yml | 24 ++------------- docker/envoy-ci.yaml | 54 --------------------------------- docker/envoy.Dockerfile | 8 ----- docker/envoy.yaml | 59 ------------------------------------ public/index.html | 2 +- 6 files changed, 5 insertions(+), 159 deletions(-) delete mode 100644 docker/envoy-ci.yaml delete mode 100644 docker/envoy.Dockerfile delete mode 100644 docker/envoy.yaml diff --git a/docker/docker-compose-ci.yml b/docker/docker-compose-ci.yml index 0e733303d..49662a164 100644 --- a/docker/docker-compose-ci.yml +++ b/docker/docker-compose-ci.yml @@ -1,19 +1,6 @@ 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' @@ -24,8 +11,8 @@ services: ] 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/public/index.html b/public/index.html index 3b7cfeedb..965c83a71 100644 --- a/public/index.html +++ b/public/index.html @@ -324,7 +324,7 @@

devtool.setCodeMirror(codemirror); // 02-1. create client with RPCAddr(envoy). - const client = new yorkie.Client('http://localhost:11101'); + const client = new yorkie.Client('http://localhost:8080'); // 02-2. subscribe client event. client.subscribe(network.statusListener(statusHolder)); From 4cc4c10f64e7c99571a11ac8315dfa45bedab082 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Sat, 2 Dec 2023 19:49:03 +0900 Subject: [PATCH 04/21] Update client runWatchLoop to avoid async promise executor --- src/api/converter.ts | 3 +- src/api/yorkie/v1/resources.proto | 715 +++++----- src/api/yorkie/v1/resources_pb.d.ts | 1897 +++++++++++++++++++++++++ src/api/yorkie/v1/resources_pb.js | 671 +++++++++ src/api/yorkie/v1/yorkie.proto | 213 +-- src/api/yorkie/v1/yorkie_connect.d.ts | 106 ++ src/api/yorkie/v1/yorkie_connect.js | 106 ++ src/api/yorkie/v1/yorkie_pb.d.ts | 504 +++++++ src/api/yorkie/v1/yorkie_pb.js | 205 +++ src/client/client.ts | 27 +- 10 files changed, 3971 insertions(+), 476 deletions(-) create mode 100644 src/api/yorkie/v1/resources_pb.d.ts create mode 100644 src/api/yorkie/v1/resources_pb.js create mode 100644 src/api/yorkie/v1/yorkie_connect.d.ts create mode 100644 src/api/yorkie/v1/yorkie_connect.js create mode 100644 src/api/yorkie/v1/yorkie_pb.d.ts create mode 100644 src/api/yorkie/v1/yorkie_pb.js diff --git a/src/api/converter.ts b/src/api/converter.ts index 39ceca628..163dc3d23 100644 --- a/src/api/converter.ts +++ b/src/api/converter.ts @@ -15,7 +15,6 @@ */ import Long from 'long'; -import * as jspb from 'google-protobuf'; import { Code, YorkieError } from '@yorkie-js-sdk/src/util/error'; import { Indexable } from '@yorkie-js-sdk/src/document/document'; import { @@ -1167,7 +1166,7 @@ function fromOperations(pbOperations: Array): Array { fromTreePos(pbTreeEditOperation!.from!), fromTreePos(pbTreeEditOperation!.to!), fromTreeNodesWhenEdit(pbTreeEditOperation!.contents), - pbTreeEditOperation!.getSplitLevel(), + pbTreeEditOperation!.splitLevel, createdAtMapByActor, fromTimeTicket(pbTreeEditOperation!.executedAt)!, ); diff --git a/src/api/yorkie/v1/resources.proto b/src/api/yorkie/v1/resources.proto index 889c96ed9..3186d6f75 100644 --- a/src/api/yorkie/v1/resources.proto +++ b/src/api/yorkie/v1/resources.proto @@ -15,360 +15,361 @@ */ syntax = "proto3"; -package yorkie.v1; - -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = ".;v1"; - -option java_multiple_files = true; -option java_package = "dev.yorkie.api.v1"; - -///////////////////////////////////////// -// Messages for Snapshot // -///////////////////////////////////////// -message Snapshot { - JSONElement root = 1; - map presences = 2; -} - -///////////////////////////////////////// -// Messages for ChangePack // -///////////////////////////////////////// - -// ChangePack is a message that contains all changes that occurred in a document. -// It is used to synchronize changes between clients and servers. -message ChangePack { - string document_key = 1; - Checkpoint checkpoint = 2; - bytes snapshot = 3; - repeated Change changes = 4; - TimeTicket min_synced_ticket = 5; - bool is_removed = 6; -} - -message Change { - ChangeID id = 1; - string message = 2; - repeated Operation operations = 3; - PresenceChange presence_change = 4; -} - -message ChangeID { - uint32 client_seq = 1; - int64 server_seq = 2 [jstype = JS_STRING]; - int64 lamport = 3 [jstype = JS_STRING]; - bytes actor_id = 4; -} - -message Operation { - message Set { - TimeTicket parent_created_at = 1; - string key = 2; - JSONElementSimple value = 3; - TimeTicket executed_at = 4; - } - message Add { - TimeTicket parent_created_at = 1; - TimeTicket prev_created_at = 2; - JSONElementSimple value = 3; - TimeTicket executed_at = 4; - } - message Move { - TimeTicket parent_created_at = 1; - TimeTicket prev_created_at = 2; - TimeTicket created_at = 3; - TimeTicket executed_at = 4; - } - message Remove { - TimeTicket parent_created_at = 1; - TimeTicket created_at = 2; - TimeTicket executed_at = 3; - } - message Edit { - TimeTicket parent_created_at = 1; - TextNodePos from = 2; - TextNodePos to = 3; - map created_at_map_by_actor = 4; - string content = 5; - TimeTicket executed_at = 6; - map attributes = 7; - } - // NOTE(hackerwins): Select Operation is not used in the current version. - // In the previous version, it was used to represent selection of Text. - // However, it has been replaced by Presence now. It is retained for backward - // compatibility purposes. - message Select { - TimeTicket parent_created_at = 1; - TextNodePos from = 2; - TextNodePos to = 3; - TimeTicket executed_at = 4; - } - message Style { - TimeTicket parent_created_at = 1; - TextNodePos from = 2; - TextNodePos to = 3; - map attributes = 4; - TimeTicket executed_at = 5; - map created_at_map_by_actor = 6; - } - message Increase { - TimeTicket parent_created_at = 1; - JSONElementSimple value = 2; - TimeTicket executed_at = 3; - } - message TreeEdit { - TimeTicket parent_created_at = 1; - TreePos from = 2; - TreePos to = 3; - map created_at_map_by_actor = 4; - repeated TreeNodes contents = 5; - int32 split_level = 7; - TimeTicket executed_at = 6; - } - message TreeStyle { - TimeTicket parent_created_at = 1; - TreePos from = 2; - TreePos to = 3; - map attributes = 4; - TimeTicket executed_at = 5; - } - - oneof body { - Set set = 1; - Add add = 2; - Move move = 3; - Remove remove = 4; - Edit edit = 5; - Select select = 6; - Style style = 7; - Increase increase = 8; - TreeEdit tree_edit = 9; - TreeStyle tree_style = 10; - } -} - -message JSONElementSimple { - TimeTicket created_at = 1; - TimeTicket moved_at = 2; - TimeTicket removed_at = 3; - ValueType type = 4; - bytes value = 5; -} - -///////////////////////////////////////// -// Messages for JSON // -///////////////////////////////////////// - -message JSONElement { - message JSONObject { - repeated RHTNode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - message JSONArray { - repeated RGANode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - message Primitive { - ValueType type = 1; - bytes value = 2; - TimeTicket created_at = 3; - TimeTicket moved_at = 4; - TimeTicket removed_at = 5; - } - message Text { - repeated TextNode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - message Counter { - ValueType type = 1; - bytes value = 2; - TimeTicket created_at = 3; - TimeTicket moved_at = 4; - TimeTicket removed_at = 5; - } - message Tree { - repeated TreeNode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - - oneof body { - JSONObject json_object = 1; - JSONArray json_array = 2; - Primitive primitive = 3; - Text text = 5; - Counter counter = 6; - Tree tree = 7; - } -} - -message RHTNode { - string key = 1; - JSONElement element = 2; -} - -message RGANode { - RGANode next = 1; - JSONElement element = 2; -} - -message NodeAttr { - string value = 1; - TimeTicket updated_at = 2; -} - -message TextNode { - TextNodeID id = 1; - string value = 2; - TimeTicket removed_at = 3; - TextNodeID ins_prev_id = 4; - map attributes = 5; -} - -message TextNodeID { - TimeTicket created_at = 1; - int32 offset = 2; -} - -message TreeNode { - TreeNodeID id = 1; - string type = 2; - string value = 3; - TimeTicket removed_at = 4; - TreeNodeID ins_prev_id = 5; - TreeNodeID ins_next_id = 6; - int32 depth = 7; - map attributes = 8; -} - -message TreeNodes { - repeated TreeNode content = 1; -} - -message TreeNodeID { - TimeTicket created_at = 1; - int32 offset = 2; -} - -message TreePos { - TreeNodeID parent_id = 1; - TreeNodeID left_sibling_id = 2; -} - -///////////////////////////////////////// -// Messages for Common // -///////////////////////////////////////// - -message User { - string id = 1; - string username = 2; - google.protobuf.Timestamp created_at = 3; -} - -message Project { - string id = 1; - string name = 2; - string public_key = 3; - string secret_key = 4; - string auth_webhook_url = 5; - repeated string auth_webhook_methods = 6; - string client_deactivate_threshold = 7; - google.protobuf.Timestamp created_at = 8; - google.protobuf.Timestamp updated_at = 9; -} - -message UpdatableProjectFields { - message AuthWebhookMethods { - repeated string methods = 1; - } - - google.protobuf.StringValue name = 1; - google.protobuf.StringValue auth_webhook_url = 2; - AuthWebhookMethods auth_webhook_methods = 3; - google.protobuf.StringValue client_deactivate_threshold = 4; -} - -message DocumentSummary { - string id = 1; - string key = 2; - string snapshot = 3; - google.protobuf.Timestamp created_at = 4; - google.protobuf.Timestamp accessed_at = 5; - google.protobuf.Timestamp updated_at = 6; -} - -message PresenceChange { - enum ChangeType { - CHANGE_TYPE_UNSPECIFIED = 0; - CHANGE_TYPE_PUT = 1; - CHANGE_TYPE_DELETE = 2; - CHANGE_TYPE_CLEAR = 3; - } - ChangeType type = 1; - Presence presence = 2; -} - -message Presence { - map data = 1; -} - -message Checkpoint { - int64 server_seq = 1 [jstype = JS_STRING]; - uint32 client_seq = 2; -} - -message TextNodePos { - TimeTicket created_at = 1; - int32 offset = 2; - int32 relative_offset = 3; -} - -message TimeTicket { - int64 lamport = 1 [jstype = JS_STRING]; - uint32 delimiter = 2; - bytes actor_id = 3; -} - -enum ValueType { - VALUE_TYPE_NULL = 0; - VALUE_TYPE_BOOLEAN = 1; - VALUE_TYPE_INTEGER = 2; - VALUE_TYPE_LONG = 3; - VALUE_TYPE_DOUBLE = 4; - VALUE_TYPE_STRING = 5; - VALUE_TYPE_BYTES = 6; - VALUE_TYPE_DATE = 7; - VALUE_TYPE_JSON_OBJECT = 8; - VALUE_TYPE_JSON_ARRAY = 9; - VALUE_TYPE_TEXT = 10; - VALUE_TYPE_INTEGER_CNT = 11; - VALUE_TYPE_LONG_CNT = 12; - VALUE_TYPE_TREE = 13; -} - -enum DocEventType { - DOC_EVENT_TYPE_DOCUMENT_CHANGED = 0; - DOC_EVENT_TYPE_DOCUMENT_WATCHED = 1; - DOC_EVENT_TYPE_DOCUMENT_UNWATCHED = 2; - DOC_EVENT_TYPE_DOCUMENT_BROADCAST = 3; -} - -message DocEventBody { - string topic = 1; - bytes payload = 2; -} - -message DocEvent { - DocEventType type = 1; - string publisher = 2; - DocEventBody body = 3; -} + package yorkie.v1; + + import "google/protobuf/timestamp.proto"; + import "google/protobuf/wrappers.proto"; + + option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; + + option java_multiple_files = true; + option java_package = "dev.yorkie.api.v1"; + + ///////////////////////////////////////// + // Messages for Snapshot // + ///////////////////////////////////////// + message Snapshot { + JSONElement root = 1; + map presences = 2; + } + + ///////////////////////////////////////// + // Messages for ChangePack // + ///////////////////////////////////////// + + // ChangePack is a message that contains all changes that occurred in a document. + // It is used to synchronize changes between clients and servers. + message ChangePack { + string document_key = 1; + Checkpoint checkpoint = 2; + bytes snapshot = 3; + repeated Change changes = 4; + TimeTicket min_synced_ticket = 5; + bool is_removed = 6; + } + + message Change { + ChangeID id = 1; + string message = 2; + repeated Operation operations = 3; + PresenceChange presence_change = 4; + } + + message ChangeID { + uint32 client_seq = 1; + int64 server_seq = 2 [jstype = JS_STRING]; + int64 lamport = 3 [jstype = JS_STRING]; + bytes actor_id = 4; + } + + message Operation { + message Set { + TimeTicket parent_created_at = 1; + string key = 2; + JSONElementSimple value = 3; + TimeTicket executed_at = 4; + } + message Add { + TimeTicket parent_created_at = 1; + TimeTicket prev_created_at = 2; + JSONElementSimple value = 3; + TimeTicket executed_at = 4; + } + message Move { + TimeTicket parent_created_at = 1; + TimeTicket prev_created_at = 2; + TimeTicket created_at = 3; + TimeTicket executed_at = 4; + } + message Remove { + TimeTicket parent_created_at = 1; + TimeTicket created_at = 2; + TimeTicket executed_at = 3; + } + message Edit { + TimeTicket parent_created_at = 1; + TextNodePos from = 2; + TextNodePos to = 3; + map created_at_map_by_actor = 4; + string content = 5; + TimeTicket executed_at = 6; + map attributes = 7; + } + // NOTE(hackerwins): Select Operation is not used in the current version. + // In the previous version, it was used to represent selection of Text. + // However, it has been replaced by Presence now. It is retained for backward + // compatibility purposes. + message Select { + TimeTicket parent_created_at = 1; + TextNodePos from = 2; + TextNodePos to = 3; + TimeTicket executed_at = 4; + } + message Style { + TimeTicket parent_created_at = 1; + TextNodePos from = 2; + TextNodePos to = 3; + map attributes = 4; + TimeTicket executed_at = 5; + map created_at_map_by_actor = 6; + } + message Increase { + TimeTicket parent_created_at = 1; + JSONElementSimple value = 2; + TimeTicket executed_at = 3; + } + message TreeEdit { + TimeTicket parent_created_at = 1; + TreePos from = 2; + TreePos to = 3; + map created_at_map_by_actor = 4; + repeated TreeNodes contents = 5; + int32 split_level = 7; + TimeTicket executed_at = 6; + } + message TreeStyle { + TimeTicket parent_created_at = 1; + TreePos from = 2; + TreePos to = 3; + map attributes = 4; + TimeTicket executed_at = 5; + } + + oneof body { + Set set = 1; + Add add = 2; + Move move = 3; + Remove remove = 4; + Edit edit = 5; + Select select = 6; + Style style = 7; + Increase increase = 8; + TreeEdit tree_edit = 9; + TreeStyle tree_style = 10; + } + } + + message JSONElementSimple { + TimeTicket created_at = 1; + TimeTicket moved_at = 2; + TimeTicket removed_at = 3; + ValueType type = 4; + bytes value = 5; + } + + ///////////////////////////////////////// + // Messages for JSON // + ///////////////////////////////////////// + + message JSONElement { + message JSONObject { + repeated RHTNode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + message JSONArray { + repeated RGANode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + message Primitive { + ValueType type = 1; + bytes value = 2; + TimeTicket created_at = 3; + TimeTicket moved_at = 4; + TimeTicket removed_at = 5; + } + message Text { + repeated TextNode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + message Counter { + ValueType type = 1; + bytes value = 2; + TimeTicket created_at = 3; + TimeTicket moved_at = 4; + TimeTicket removed_at = 5; + } + message Tree { + repeated TreeNode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + + oneof body { + JSONObject json_object = 1; + JSONArray json_array = 2; + Primitive primitive = 3; + Text text = 5; + Counter counter = 6; + Tree tree = 7; + } + } + + message RHTNode { + string key = 1; + JSONElement element = 2; + } + + message RGANode { + RGANode next = 1; + JSONElement element = 2; + } + + message NodeAttr { + string value = 1; + TimeTicket updated_at = 2; + } + + message TextNode { + TextNodeID id = 1; + string value = 2; + TimeTicket removed_at = 3; + TextNodeID ins_prev_id = 4; + map attributes = 5; + } + + message TextNodeID { + TimeTicket created_at = 1; + int32 offset = 2; + } + + message TreeNode { + TreeNodeID id = 1; + string type = 2; + string value = 3; + TimeTicket removed_at = 4; + TreeNodeID ins_prev_id = 5; + TreeNodeID ins_next_id = 6; + int32 depth = 7; + map attributes = 8; + } + + message TreeNodes { + repeated TreeNode content = 1; + } + + message TreeNodeID { + TimeTicket created_at = 1; + int32 offset = 2; + } + + message TreePos { + TreeNodeID parent_id = 1; + TreeNodeID left_sibling_id = 2; + } + + ///////////////////////////////////////// + // Messages for Common // + ///////////////////////////////////////// + + message User { + string id = 1; + string username = 2; + google.protobuf.Timestamp created_at = 3; + } + + message Project { + string id = 1; + string name = 2; + string public_key = 3; + string secret_key = 4; + string auth_webhook_url = 5; + repeated string auth_webhook_methods = 6; + string client_deactivate_threshold = 7; + google.protobuf.Timestamp created_at = 8; + google.protobuf.Timestamp updated_at = 9; + } + + message UpdatableProjectFields { + message AuthWebhookMethods { + repeated string methods = 1; + } + + google.protobuf.StringValue name = 1; + google.protobuf.StringValue auth_webhook_url = 2; + AuthWebhookMethods auth_webhook_methods = 3; + google.protobuf.StringValue client_deactivate_threshold = 4; + } + + message DocumentSummary { + string id = 1; + string key = 2; + string snapshot = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp accessed_at = 5; + google.protobuf.Timestamp updated_at = 6; + } + + message PresenceChange { + enum ChangeType { + CHANGE_TYPE_UNSPECIFIED = 0; + CHANGE_TYPE_PUT = 1; + CHANGE_TYPE_DELETE = 2; + CHANGE_TYPE_CLEAR = 3; + } + ChangeType type = 1; + Presence presence = 2; + } + + message Presence { + map data = 1; + } + + message Checkpoint { + int64 server_seq = 1 [jstype = JS_STRING]; + uint32 client_seq = 2; + } + + message TextNodePos { + TimeTicket created_at = 1; + int32 offset = 2; + int32 relative_offset = 3; + } + + message TimeTicket { + int64 lamport = 1 [jstype = JS_STRING]; + uint32 delimiter = 2; + bytes actor_id = 3; + } + + enum ValueType { + VALUE_TYPE_NULL = 0; + VALUE_TYPE_BOOLEAN = 1; + VALUE_TYPE_INTEGER = 2; + VALUE_TYPE_LONG = 3; + VALUE_TYPE_DOUBLE = 4; + VALUE_TYPE_STRING = 5; + VALUE_TYPE_BYTES = 6; + VALUE_TYPE_DATE = 7; + VALUE_TYPE_JSON_OBJECT = 8; + VALUE_TYPE_JSON_ARRAY = 9; + VALUE_TYPE_TEXT = 10; + VALUE_TYPE_INTEGER_CNT = 11; + VALUE_TYPE_LONG_CNT = 12; + VALUE_TYPE_TREE = 13; + } + + enum DocEventType { + DOC_EVENT_TYPE_DOCUMENT_CHANGED = 0; + DOC_EVENT_TYPE_DOCUMENT_WATCHED = 1; + DOC_EVENT_TYPE_DOCUMENT_UNWATCHED = 2; + DOC_EVENT_TYPE_DOCUMENT_BROADCAST = 3; + } + + message DocEventBody { + string topic = 1; + bytes payload = 2; + } + + message DocEvent { + DocEventType type = 1; + string publisher = 2; + DocEventBody body = 3; + } + \ No newline at end of file diff --git a/src/api/yorkie/v1/resources_pb.d.ts b/src/api/yorkie/v1/resources_pb.d.ts new file mode 100644 index 000000000..5be980931 --- /dev/null +++ b/src/api/yorkie/v1/resources_pb.d.ts @@ -0,0 +1,1897 @@ +// +// Copyright 2022 The Yorkie Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v1.4.2 with parameter "target=js+dts" +// @generated from file src/api/yorkie/v1/resources.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage, Timestamp } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum yorkie.v1.ValueType + */ +export declare enum ValueType { + /** + * @generated from enum value: VALUE_TYPE_NULL = 0; + */ + NULL = 0, + + /** + * @generated from enum value: VALUE_TYPE_BOOLEAN = 1; + */ + BOOLEAN = 1, + + /** + * @generated from enum value: VALUE_TYPE_INTEGER = 2; + */ + INTEGER = 2, + + /** + * @generated from enum value: VALUE_TYPE_LONG = 3; + */ + LONG = 3, + + /** + * @generated from enum value: VALUE_TYPE_DOUBLE = 4; + */ + DOUBLE = 4, + + /** + * @generated from enum value: VALUE_TYPE_STRING = 5; + */ + STRING = 5, + + /** + * @generated from enum value: VALUE_TYPE_BYTES = 6; + */ + BYTES = 6, + + /** + * @generated from enum value: VALUE_TYPE_DATE = 7; + */ + DATE = 7, + + /** + * @generated from enum value: VALUE_TYPE_JSON_OBJECT = 8; + */ + JSON_OBJECT = 8, + + /** + * @generated from enum value: VALUE_TYPE_JSON_ARRAY = 9; + */ + JSON_ARRAY = 9, + + /** + * @generated from enum value: VALUE_TYPE_TEXT = 10; + */ + TEXT = 10, + + /** + * @generated from enum value: VALUE_TYPE_INTEGER_CNT = 11; + */ + INTEGER_CNT = 11, + + /** + * @generated from enum value: VALUE_TYPE_LONG_CNT = 12; + */ + LONG_CNT = 12, + + /** + * @generated from enum value: VALUE_TYPE_TREE = 13; + */ + TREE = 13, +} + +/** + * @generated from enum yorkie.v1.DocEventType + */ +export declare enum DocEventType { + /** + * @generated from enum value: DOC_EVENT_TYPE_DOCUMENT_CHANGED = 0; + */ + DOCUMENT_CHANGED = 0, + + /** + * @generated from enum value: DOC_EVENT_TYPE_DOCUMENT_WATCHED = 1; + */ + DOCUMENT_WATCHED = 1, + + /** + * @generated from enum value: DOC_EVENT_TYPE_DOCUMENT_UNWATCHED = 2; + */ + DOCUMENT_UNWATCHED = 2, + + /** + * @generated from enum value: DOC_EVENT_TYPE_DOCUMENT_BROADCAST = 3; + */ + DOCUMENT_BROADCAST = 3, +} + +/** + * /////////////////////////////////////// + * Messages for Snapshot // + * /////////////////////////////////////// + * + * @generated from message yorkie.v1.Snapshot + */ +export declare class Snapshot extends Message { + /** + * @generated from field: yorkie.v1.JSONElement root = 1; + */ + root?: JSONElement; + + /** + * @generated from field: map presences = 2; + */ + presences: { [key: string]: Presence }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Snapshot"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Snapshot; + + static fromJson(jsonValue: JsonValue, options?: Partial): Snapshot; + + static fromJsonString(jsonString: string, options?: Partial): Snapshot; + + static equals(a: Snapshot | PlainMessage | undefined, b: Snapshot | PlainMessage | undefined): boolean; +} + +/** + * ChangePack is a message that contains all changes that occurred in a document. + * It is used to synchronize changes between clients and servers. + * + * @generated from message yorkie.v1.ChangePack + */ +export declare class ChangePack extends Message { + /** + * @generated from field: string document_key = 1; + */ + documentKey: string; + + /** + * @generated from field: yorkie.v1.Checkpoint checkpoint = 2; + */ + checkpoint?: Checkpoint; + + /** + * @generated from field: bytes snapshot = 3; + */ + snapshot: Uint8Array; + + /** + * @generated from field: repeated yorkie.v1.Change changes = 4; + */ + changes: Change[]; + + /** + * @generated from field: yorkie.v1.TimeTicket min_synced_ticket = 5; + */ + minSyncedTicket?: TimeTicket; + + /** + * @generated from field: bool is_removed = 6; + */ + isRemoved: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ChangePack"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ChangePack; + + static fromJson(jsonValue: JsonValue, options?: Partial): ChangePack; + + static fromJsonString(jsonString: string, options?: Partial): ChangePack; + + static equals(a: ChangePack | PlainMessage | undefined, b: ChangePack | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Change + */ +export declare class Change extends Message { + /** + * @generated from field: yorkie.v1.ChangeID id = 1; + */ + id?: ChangeID; + + /** + * @generated from field: string message = 2; + */ + message: string; + + /** + * @generated from field: repeated yorkie.v1.Operation operations = 3; + */ + operations: Operation[]; + + /** + * @generated from field: yorkie.v1.PresenceChange presence_change = 4; + */ + presenceChange?: PresenceChange; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Change"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Change; + + static fromJson(jsonValue: JsonValue, options?: Partial): Change; + + static fromJsonString(jsonString: string, options?: Partial): Change; + + static equals(a: Change | PlainMessage | undefined, b: Change | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.ChangeID + */ +export declare class ChangeID extends Message { + /** + * @generated from field: uint32 client_seq = 1; + */ + clientSeq: number; + + /** + * @generated from field: int64 server_seq = 2 [jstype = JS_STRING]; + */ + serverSeq: string; + + /** + * @generated from field: int64 lamport = 3 [jstype = JS_STRING]; + */ + lamport: string; + + /** + * @generated from field: bytes actor_id = 4; + */ + actorId: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ChangeID"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ChangeID; + + static fromJson(jsonValue: JsonValue, options?: Partial): ChangeID; + + static fromJsonString(jsonString: string, options?: Partial): ChangeID; + + static equals(a: ChangeID | PlainMessage | undefined, b: ChangeID | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation + */ +export declare class Operation extends Message { + /** + * @generated from oneof yorkie.v1.Operation.body + */ + body: { + /** + * @generated from field: yorkie.v1.Operation.Set set = 1; + */ + value: Operation_Set; + case: "set"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Add add = 2; + */ + value: Operation_Add; + case: "add"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Move move = 3; + */ + value: Operation_Move; + case: "move"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Remove remove = 4; + */ + value: Operation_Remove; + case: "remove"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Edit edit = 5; + */ + value: Operation_Edit; + case: "edit"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Select select = 6; + */ + value: Operation_Select; + case: "select"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Style style = 7; + */ + value: Operation_Style; + case: "style"; + } | { + /** + * @generated from field: yorkie.v1.Operation.Increase increase = 8; + */ + value: Operation_Increase; + case: "increase"; + } | { + /** + * @generated from field: yorkie.v1.Operation.TreeEdit tree_edit = 9; + */ + value: Operation_TreeEdit; + case: "treeEdit"; + } | { + /** + * @generated from field: yorkie.v1.Operation.TreeStyle tree_style = 10; + */ + value: Operation_TreeStyle; + case: "treeStyle"; + } | { case: undefined; value?: undefined }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation; + + static fromJsonString(jsonString: string, options?: Partial): Operation; + + static equals(a: Operation | PlainMessage | undefined, b: Operation | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Set + */ +export declare class Operation_Set extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: string key = 2; + */ + key: string; + + /** + * @generated from field: yorkie.v1.JSONElementSimple value = 3; + */ + value?: JSONElementSimple; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Set"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Set; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Set; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Set; + + static equals(a: Operation_Set | PlainMessage | undefined, b: Operation_Set | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Add + */ +export declare class Operation_Add extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket prev_created_at = 2; + */ + prevCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.JSONElementSimple value = 3; + */ + value?: JSONElementSimple; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Add"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Add; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Add; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Add; + + static equals(a: Operation_Add | PlainMessage | undefined, b: Operation_Add | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Move + */ +export declare class Operation_Move extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket prev_created_at = 2; + */ + prevCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 3; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Move"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Move; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Move; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Move; + + static equals(a: Operation_Move | PlainMessage | undefined, b: Operation_Move | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Remove + */ +export declare class Operation_Remove extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 3; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Remove"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Remove; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Remove; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Remove; + + static equals(a: Operation_Remove | PlainMessage | undefined, b: Operation_Remove | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Edit + */ +export declare class Operation_Edit extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TextNodePos from = 2; + */ + from?: TextNodePos; + + /** + * @generated from field: yorkie.v1.TextNodePos to = 3; + */ + to?: TextNodePos; + + /** + * @generated from field: map created_at_map_by_actor = 4; + */ + createdAtMapByActor: { [key: string]: TimeTicket }; + + /** + * @generated from field: string content = 5; + */ + content: string; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 6; + */ + executedAt?: TimeTicket; + + /** + * @generated from field: map attributes = 7; + */ + attributes: { [key: string]: string }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Edit"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Edit; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Edit; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Edit; + + static equals(a: Operation_Edit | PlainMessage | undefined, b: Operation_Edit | PlainMessage | undefined): boolean; +} + +/** + * NOTE(hackerwins): Select Operation is not used in the current version. + * In the previous version, it was used to represent selection of Text. + * However, it has been replaced by Presence now. It is retained for backward + * compatibility purposes. + * + * @generated from message yorkie.v1.Operation.Select + */ +export declare class Operation_Select extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TextNodePos from = 2; + */ + from?: TextNodePos; + + /** + * @generated from field: yorkie.v1.TextNodePos to = 3; + */ + to?: TextNodePos; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 4; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Select"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Select; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Select; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Select; + + static equals(a: Operation_Select | PlainMessage | undefined, b: Operation_Select | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Style + */ +export declare class Operation_Style extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TextNodePos from = 2; + */ + from?: TextNodePos; + + /** + * @generated from field: yorkie.v1.TextNodePos to = 3; + */ + to?: TextNodePos; + + /** + * @generated from field: map attributes = 4; + */ + attributes: { [key: string]: string }; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 5; + */ + executedAt?: TimeTicket; + + /** + * @generated from field: map created_at_map_by_actor = 6; + */ + createdAtMapByActor: { [key: string]: TimeTicket }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Style"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Style; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Style; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Style; + + static equals(a: Operation_Style | PlainMessage | undefined, b: Operation_Style | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.Increase + */ +export declare class Operation_Increase extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.JSONElementSimple value = 2; + */ + value?: JSONElementSimple; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 3; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.Increase"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_Increase; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_Increase; + + static fromJsonString(jsonString: string, options?: Partial): Operation_Increase; + + static equals(a: Operation_Increase | PlainMessage | undefined, b: Operation_Increase | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.TreeEdit + */ +export declare class Operation_TreeEdit extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TreePos from = 2; + */ + from?: TreePos; + + /** + * @generated from field: yorkie.v1.TreePos to = 3; + */ + to?: TreePos; + + /** + * @generated from field: map created_at_map_by_actor = 4; + */ + createdAtMapByActor: { [key: string]: TimeTicket }; + + /** + * @generated from field: repeated yorkie.v1.TreeNodes contents = 5; + */ + contents: TreeNodes[]; + + /** + * @generated from field: int32 split_level = 7; + */ + splitLevel: number; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 6; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.TreeEdit"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_TreeEdit; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_TreeEdit; + + static fromJsonString(jsonString: string, options?: Partial): Operation_TreeEdit; + + static equals(a: Operation_TreeEdit | PlainMessage | undefined, b: Operation_TreeEdit | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Operation.TreeStyle + */ +export declare class Operation_TreeStyle extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket parent_created_at = 1; + */ + parentCreatedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TreePos from = 2; + */ + from?: TreePos; + + /** + * @generated from field: yorkie.v1.TreePos to = 3; + */ + to?: TreePos; + + /** + * @generated from field: map attributes = 4; + */ + attributes: { [key: string]: string }; + + /** + * @generated from field: yorkie.v1.TimeTicket executed_at = 5; + */ + executedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Operation.TreeStyle"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Operation_TreeStyle; + + static fromJson(jsonValue: JsonValue, options?: Partial): Operation_TreeStyle; + + static fromJsonString(jsonString: string, options?: Partial): Operation_TreeStyle; + + static equals(a: Operation_TreeStyle | PlainMessage | undefined, b: Operation_TreeStyle | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElementSimple + */ +export declare class JSONElementSimple extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 2; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 3; + */ + removedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.ValueType type = 4; + */ + type: ValueType; + + /** + * @generated from field: bytes value = 5; + */ + value: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElementSimple"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElementSimple; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElementSimple; + + static fromJsonString(jsonString: string, options?: Partial): JSONElementSimple; + + static equals(a: JSONElementSimple | PlainMessage | undefined, b: JSONElementSimple | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement + */ +export declare class JSONElement extends Message { + /** + * @generated from oneof yorkie.v1.JSONElement.body + */ + body: { + /** + * @generated from field: yorkie.v1.JSONElement.JSONObject json_object = 1; + */ + value: JSONElement_JSONObject; + case: "jsonObject"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.JSONArray json_array = 2; + */ + value: JSONElement_JSONArray; + case: "jsonArray"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.Primitive primitive = 3; + */ + value: JSONElement_Primitive; + case: "primitive"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.Text text = 5; + */ + value: JSONElement_Text; + case: "text"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.Counter counter = 6; + */ + value: JSONElement_Counter; + case: "counter"; + } | { + /** + * @generated from field: yorkie.v1.JSONElement.Tree tree = 7; + */ + value: JSONElement_Tree; + case: "tree"; + } | { case: undefined; value?: undefined }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement; + + static equals(a: JSONElement | PlainMessage | undefined, b: JSONElement | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.JSONObject + */ +export declare class JSONElement_JSONObject extends Message { + /** + * @generated from field: repeated yorkie.v1.RHTNode nodes = 1; + */ + nodes: RHTNode[]; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 3; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.JSONObject"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_JSONObject; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_JSONObject; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_JSONObject; + + static equals(a: JSONElement_JSONObject | PlainMessage | undefined, b: JSONElement_JSONObject | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.JSONArray + */ +export declare class JSONElement_JSONArray extends Message { + /** + * @generated from field: repeated yorkie.v1.RGANode nodes = 1; + */ + nodes: RGANode[]; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 3; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.JSONArray"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_JSONArray; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_JSONArray; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_JSONArray; + + static equals(a: JSONElement_JSONArray | PlainMessage | undefined, b: JSONElement_JSONArray | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.Primitive + */ +export declare class JSONElement_Primitive extends Message { + /** + * @generated from field: yorkie.v1.ValueType type = 1; + */ + type: ValueType; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 3; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 4; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 5; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.Primitive"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Primitive; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Primitive; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Primitive; + + static equals(a: JSONElement_Primitive | PlainMessage | undefined, b: JSONElement_Primitive | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.Text + */ +export declare class JSONElement_Text extends Message { + /** + * @generated from field: repeated yorkie.v1.TextNode nodes = 1; + */ + nodes: TextNode[]; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 3; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.Text"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Text; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Text; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Text; + + static equals(a: JSONElement_Text | PlainMessage | undefined, b: JSONElement_Text | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.Counter + */ +export declare class JSONElement_Counter extends Message { + /** + * @generated from field: yorkie.v1.ValueType type = 1; + */ + type: ValueType; + + /** + * @generated from field: bytes value = 2; + */ + value: Uint8Array; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 3; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 4; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 5; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.Counter"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Counter; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Counter; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Counter; + + static equals(a: JSONElement_Counter | PlainMessage | undefined, b: JSONElement_Counter | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.JSONElement.Tree + */ +export declare class JSONElement_Tree extends Message { + /** + * @generated from field: repeated yorkie.v1.TreeNode nodes = 1; + */ + nodes: TreeNode[]; + + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 2; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket moved_at = 3; + */ + movedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.JSONElement.Tree"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): JSONElement_Tree; + + static fromJson(jsonValue: JsonValue, options?: Partial): JSONElement_Tree; + + static fromJsonString(jsonString: string, options?: Partial): JSONElement_Tree; + + static equals(a: JSONElement_Tree | PlainMessage | undefined, b: JSONElement_Tree | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.RHTNode + */ +export declare class RHTNode extends Message { + /** + * @generated from field: string key = 1; + */ + key: string; + + /** + * @generated from field: yorkie.v1.JSONElement element = 2; + */ + element?: JSONElement; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.RHTNode"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): RHTNode; + + static fromJson(jsonValue: JsonValue, options?: Partial): RHTNode; + + static fromJsonString(jsonString: string, options?: Partial): RHTNode; + + static equals(a: RHTNode | PlainMessage | undefined, b: RHTNode | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.RGANode + */ +export declare class RGANode extends Message { + /** + * @generated from field: yorkie.v1.RGANode next = 1; + */ + next?: RGANode; + + /** + * @generated from field: yorkie.v1.JSONElement element = 2; + */ + element?: JSONElement; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.RGANode"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): RGANode; + + static fromJson(jsonValue: JsonValue, options?: Partial): RGANode; + + static fromJsonString(jsonString: string, options?: Partial): RGANode; + + static equals(a: RGANode | PlainMessage | undefined, b: RGANode | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.NodeAttr + */ +export declare class NodeAttr extends Message { + /** + * @generated from field: string value = 1; + */ + value: string; + + /** + * @generated from field: yorkie.v1.TimeTicket updated_at = 2; + */ + updatedAt?: TimeTicket; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.NodeAttr"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): NodeAttr; + + static fromJson(jsonValue: JsonValue, options?: Partial): NodeAttr; + + static fromJsonString(jsonString: string, options?: Partial): NodeAttr; + + static equals(a: NodeAttr | PlainMessage | undefined, b: NodeAttr | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TextNode + */ +export declare class TextNode extends Message { + /** + * @generated from field: yorkie.v1.TextNodeID id = 1; + */ + id?: TextNodeID; + + /** + * @generated from field: string value = 2; + */ + value: string; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 3; + */ + removedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TextNodeID ins_prev_id = 4; + */ + insPrevId?: TextNodeID; + + /** + * @generated from field: map attributes = 5; + */ + attributes: { [key: string]: NodeAttr }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TextNode"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TextNode; + + static fromJson(jsonValue: JsonValue, options?: Partial): TextNode; + + static fromJsonString(jsonString: string, options?: Partial): TextNode; + + static equals(a: TextNode | PlainMessage | undefined, b: TextNode | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TextNodeID + */ +export declare class TextNodeID extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: int32 offset = 2; + */ + offset: number; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TextNodeID"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TextNodeID; + + static fromJson(jsonValue: JsonValue, options?: Partial): TextNodeID; + + static fromJsonString(jsonString: string, options?: Partial): TextNodeID; + + static equals(a: TextNodeID | PlainMessage | undefined, b: TextNodeID | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TreeNode + */ +export declare class TreeNode extends Message { + /** + * @generated from field: yorkie.v1.TreeNodeID id = 1; + */ + id?: TreeNodeID; + + /** + * @generated from field: string type = 2; + */ + type: string; + + /** + * @generated from field: string value = 3; + */ + value: string; + + /** + * @generated from field: yorkie.v1.TimeTicket removed_at = 4; + */ + removedAt?: TimeTicket; + + /** + * @generated from field: yorkie.v1.TreeNodeID ins_prev_id = 5; + */ + insPrevId?: TreeNodeID; + + /** + * @generated from field: yorkie.v1.TreeNodeID ins_next_id = 6; + */ + insNextId?: TreeNodeID; + + /** + * @generated from field: int32 depth = 7; + */ + depth: number; + + /** + * @generated from field: map attributes = 8; + */ + attributes: { [key: string]: NodeAttr }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TreeNode"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TreeNode; + + static fromJson(jsonValue: JsonValue, options?: Partial): TreeNode; + + static fromJsonString(jsonString: string, options?: Partial): TreeNode; + + static equals(a: TreeNode | PlainMessage | undefined, b: TreeNode | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TreeNodes + */ +export declare class TreeNodes extends Message { + /** + * @generated from field: repeated yorkie.v1.TreeNode content = 1; + */ + content: TreeNode[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TreeNodes"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TreeNodes; + + static fromJson(jsonValue: JsonValue, options?: Partial): TreeNodes; + + static fromJsonString(jsonString: string, options?: Partial): TreeNodes; + + static equals(a: TreeNodes | PlainMessage | undefined, b: TreeNodes | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TreeNodeID + */ +export declare class TreeNodeID extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: int32 offset = 2; + */ + offset: number; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TreeNodeID"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TreeNodeID; + + static fromJson(jsonValue: JsonValue, options?: Partial): TreeNodeID; + + static fromJsonString(jsonString: string, options?: Partial): TreeNodeID; + + static equals(a: TreeNodeID | PlainMessage | undefined, b: TreeNodeID | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TreePos + */ +export declare class TreePos extends Message { + /** + * @generated from field: yorkie.v1.TreeNodeID parent_id = 1; + */ + parentId?: TreeNodeID; + + /** + * @generated from field: yorkie.v1.TreeNodeID left_sibling_id = 2; + */ + leftSiblingId?: TreeNodeID; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TreePos"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TreePos; + + static fromJson(jsonValue: JsonValue, options?: Partial): TreePos; + + static fromJsonString(jsonString: string, options?: Partial): TreePos; + + static equals(a: TreePos | PlainMessage | undefined, b: TreePos | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.User + */ +export declare class User extends Message { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: string username = 2; + */ + username: string; + + /** + * @generated from field: google.protobuf.Timestamp created_at = 3; + */ + createdAt?: Timestamp; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.User"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): User; + + static fromJson(jsonValue: JsonValue, options?: Partial): User; + + static fromJsonString(jsonString: string, options?: Partial): User; + + static equals(a: User | PlainMessage | undefined, b: User | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Project + */ +export declare class Project extends Message { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: string name = 2; + */ + name: string; + + /** + * @generated from field: string public_key = 3; + */ + publicKey: string; + + /** + * @generated from field: string secret_key = 4; + */ + secretKey: string; + + /** + * @generated from field: string auth_webhook_url = 5; + */ + authWebhookUrl: string; + + /** + * @generated from field: repeated string auth_webhook_methods = 6; + */ + authWebhookMethods: string[]; + + /** + * @generated from field: string client_deactivate_threshold = 7; + */ + clientDeactivateThreshold: string; + + /** + * @generated from field: google.protobuf.Timestamp created_at = 8; + */ + createdAt?: Timestamp; + + /** + * @generated from field: google.protobuf.Timestamp updated_at = 9; + */ + updatedAt?: Timestamp; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Project"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Project; + + static fromJson(jsonValue: JsonValue, options?: Partial): Project; + + static fromJsonString(jsonString: string, options?: Partial): Project; + + static equals(a: Project | PlainMessage | undefined, b: Project | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.UpdatableProjectFields + */ +export declare class UpdatableProjectFields extends Message { + /** + * @generated from field: google.protobuf.StringValue name = 1; + */ + name?: string; + + /** + * @generated from field: google.protobuf.StringValue auth_webhook_url = 2; + */ + authWebhookUrl?: string; + + /** + * @generated from field: yorkie.v1.UpdatableProjectFields.AuthWebhookMethods auth_webhook_methods = 3; + */ + authWebhookMethods?: UpdatableProjectFields_AuthWebhookMethods; + + /** + * @generated from field: google.protobuf.StringValue client_deactivate_threshold = 4; + */ + clientDeactivateThreshold?: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.UpdatableProjectFields"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdatableProjectFields; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdatableProjectFields; + + static fromJsonString(jsonString: string, options?: Partial): UpdatableProjectFields; + + static equals(a: UpdatableProjectFields | PlainMessage | undefined, b: UpdatableProjectFields | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.UpdatableProjectFields.AuthWebhookMethods + */ +export declare class UpdatableProjectFields_AuthWebhookMethods extends Message { + /** + * @generated from field: repeated string methods = 1; + */ + methods: string[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.UpdatableProjectFields.AuthWebhookMethods"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdatableProjectFields_AuthWebhookMethods; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdatableProjectFields_AuthWebhookMethods; + + static fromJsonString(jsonString: string, options?: Partial): UpdatableProjectFields_AuthWebhookMethods; + + static equals(a: UpdatableProjectFields_AuthWebhookMethods | PlainMessage | undefined, b: UpdatableProjectFields_AuthWebhookMethods | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DocumentSummary + */ +export declare class DocumentSummary extends Message { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: string key = 2; + */ + key: string; + + /** + * @generated from field: string snapshot = 3; + */ + snapshot: string; + + /** + * @generated from field: google.protobuf.Timestamp created_at = 4; + */ + createdAt?: Timestamp; + + /** + * @generated from field: google.protobuf.Timestamp accessed_at = 5; + */ + accessedAt?: Timestamp; + + /** + * @generated from field: google.protobuf.Timestamp updated_at = 6; + */ + updatedAt?: Timestamp; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DocumentSummary"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DocumentSummary; + + static fromJson(jsonValue: JsonValue, options?: Partial): DocumentSummary; + + static fromJsonString(jsonString: string, options?: Partial): DocumentSummary; + + static equals(a: DocumentSummary | PlainMessage | undefined, b: DocumentSummary | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.PresenceChange + */ +export declare class PresenceChange extends Message { + /** + * @generated from field: yorkie.v1.PresenceChange.ChangeType type = 1; + */ + type: PresenceChange_ChangeType; + + /** + * @generated from field: yorkie.v1.Presence presence = 2; + */ + presence?: Presence; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.PresenceChange"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): PresenceChange; + + static fromJson(jsonValue: JsonValue, options?: Partial): PresenceChange; + + static fromJsonString(jsonString: string, options?: Partial): PresenceChange; + + static equals(a: PresenceChange | PlainMessage | undefined, b: PresenceChange | PlainMessage | undefined): boolean; +} + +/** + * @generated from enum yorkie.v1.PresenceChange.ChangeType + */ +export declare enum PresenceChange_ChangeType { + /** + * @generated from enum value: CHANGE_TYPE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: CHANGE_TYPE_PUT = 1; + */ + PUT = 1, + + /** + * @generated from enum value: CHANGE_TYPE_DELETE = 2; + */ + DELETE = 2, + + /** + * @generated from enum value: CHANGE_TYPE_CLEAR = 3; + */ + CLEAR = 3, +} + +/** + * @generated from message yorkie.v1.Presence + */ +export declare class Presence extends Message { + /** + * @generated from field: map data = 1; + */ + data: { [key: string]: string }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Presence"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Presence; + + static fromJson(jsonValue: JsonValue, options?: Partial): Presence; + + static fromJsonString(jsonString: string, options?: Partial): Presence; + + static equals(a: Presence | PlainMessage | undefined, b: Presence | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.Checkpoint + */ +export declare class Checkpoint extends Message { + /** + * @generated from field: int64 server_seq = 1 [jstype = JS_STRING]; + */ + serverSeq: string; + + /** + * @generated from field: uint32 client_seq = 2; + */ + clientSeq: number; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.Checkpoint"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Checkpoint; + + static fromJson(jsonValue: JsonValue, options?: Partial): Checkpoint; + + static fromJsonString(jsonString: string, options?: Partial): Checkpoint; + + static equals(a: Checkpoint | PlainMessage | undefined, b: Checkpoint | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TextNodePos + */ +export declare class TextNodePos extends Message { + /** + * @generated from field: yorkie.v1.TimeTicket created_at = 1; + */ + createdAt?: TimeTicket; + + /** + * @generated from field: int32 offset = 2; + */ + offset: number; + + /** + * @generated from field: int32 relative_offset = 3; + */ + relativeOffset: number; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TextNodePos"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TextNodePos; + + static fromJson(jsonValue: JsonValue, options?: Partial): TextNodePos; + + static fromJsonString(jsonString: string, options?: Partial): TextNodePos; + + static equals(a: TextNodePos | PlainMessage | undefined, b: TextNodePos | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.TimeTicket + */ +export declare class TimeTicket extends Message { + /** + * @generated from field: int64 lamport = 1 [jstype = JS_STRING]; + */ + lamport: string; + + /** + * @generated from field: uint32 delimiter = 2; + */ + delimiter: number; + + /** + * @generated from field: bytes actor_id = 3; + */ + actorId: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.TimeTicket"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): TimeTicket; + + static fromJson(jsonValue: JsonValue, options?: Partial): TimeTicket; + + static fromJsonString(jsonString: string, options?: Partial): TimeTicket; + + static equals(a: TimeTicket | PlainMessage | undefined, b: TimeTicket | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DocEventBody + */ +export declare class DocEventBody extends Message { + /** + * @generated from field: string topic = 1; + */ + topic: string; + + /** + * @generated from field: bytes payload = 2; + */ + payload: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DocEventBody"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DocEventBody; + + static fromJson(jsonValue: JsonValue, options?: Partial): DocEventBody; + + static fromJsonString(jsonString: string, options?: Partial): DocEventBody; + + static equals(a: DocEventBody | PlainMessage | undefined, b: DocEventBody | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DocEvent + */ +export declare class DocEvent extends Message { + /** + * @generated from field: yorkie.v1.DocEventType type = 1; + */ + type: DocEventType; + + /** + * @generated from field: string publisher = 2; + */ + publisher: string; + + /** + * @generated from field: yorkie.v1.DocEventBody body = 3; + */ + body?: DocEventBody; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DocEvent"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DocEvent; + + static fromJson(jsonValue: JsonValue, options?: Partial): DocEvent; + + static fromJsonString(jsonString: string, options?: Partial): DocEvent; + + static equals(a: DocEvent | PlainMessage | undefined, b: DocEvent | PlainMessage | undefined): boolean; +} + diff --git a/src/api/yorkie/v1/resources_pb.js b/src/api/yorkie/v1/resources_pb.js new file mode 100644 index 000000000..aabe2619c --- /dev/null +++ b/src/api/yorkie/v1/resources_pb.js @@ -0,0 +1,671 @@ +// +// Copyright 2022 The Yorkie Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v1.4.2 with parameter "target=js+dts" +// @generated from file src/api/yorkie/v1/resources.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3, StringValue, Timestamp } from "@bufbuild/protobuf"; + +/** + * @generated from enum yorkie.v1.ValueType + */ +export const ValueType = proto3.makeEnum( + "yorkie.v1.ValueType", + [ + {no: 0, name: "VALUE_TYPE_NULL", localName: "NULL"}, + {no: 1, name: "VALUE_TYPE_BOOLEAN", localName: "BOOLEAN"}, + {no: 2, name: "VALUE_TYPE_INTEGER", localName: "INTEGER"}, + {no: 3, name: "VALUE_TYPE_LONG", localName: "LONG"}, + {no: 4, name: "VALUE_TYPE_DOUBLE", localName: "DOUBLE"}, + {no: 5, name: "VALUE_TYPE_STRING", localName: "STRING"}, + {no: 6, name: "VALUE_TYPE_BYTES", localName: "BYTES"}, + {no: 7, name: "VALUE_TYPE_DATE", localName: "DATE"}, + {no: 8, name: "VALUE_TYPE_JSON_OBJECT", localName: "JSON_OBJECT"}, + {no: 9, name: "VALUE_TYPE_JSON_ARRAY", localName: "JSON_ARRAY"}, + {no: 10, name: "VALUE_TYPE_TEXT", localName: "TEXT"}, + {no: 11, name: "VALUE_TYPE_INTEGER_CNT", localName: "INTEGER_CNT"}, + {no: 12, name: "VALUE_TYPE_LONG_CNT", localName: "LONG_CNT"}, + {no: 13, name: "VALUE_TYPE_TREE", localName: "TREE"}, + ], +); + +/** + * @generated from enum yorkie.v1.DocEventType + */ +export const DocEventType = proto3.makeEnum( + "yorkie.v1.DocEventType", + [ + {no: 0, name: "DOC_EVENT_TYPE_DOCUMENT_CHANGED", localName: "DOCUMENT_CHANGED"}, + {no: 1, name: "DOC_EVENT_TYPE_DOCUMENT_WATCHED", localName: "DOCUMENT_WATCHED"}, + {no: 2, name: "DOC_EVENT_TYPE_DOCUMENT_UNWATCHED", localName: "DOCUMENT_UNWATCHED"}, + {no: 3, name: "DOC_EVENT_TYPE_DOCUMENT_BROADCAST", localName: "DOCUMENT_BROADCAST"}, + ], +); + +/** + * /////////////////////////////////////// + * Messages for Snapshot // + * /////////////////////////////////////// + * + * @generated from message yorkie.v1.Snapshot + */ +export const Snapshot = proto3.makeMessageType( + "yorkie.v1.Snapshot", + () => [ + { no: 1, name: "root", kind: "message", T: JSONElement }, + { no: 2, name: "presences", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Presence} }, + ], +); + +/** + * ChangePack is a message that contains all changes that occurred in a document. + * It is used to synchronize changes between clients and servers. + * + * @generated from message yorkie.v1.ChangePack + */ +export const ChangePack = proto3.makeMessageType( + "yorkie.v1.ChangePack", + () => [ + { no: 1, name: "document_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "checkpoint", kind: "message", T: Checkpoint }, + { no: 3, name: "snapshot", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + { no: 4, name: "changes", kind: "message", T: Change, repeated: true }, + { no: 5, name: "min_synced_ticket", kind: "message", T: TimeTicket }, + { no: 6, name: "is_removed", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ], +); + +/** + * @generated from message yorkie.v1.Change + */ +export const Change = proto3.makeMessageType( + "yorkie.v1.Change", + () => [ + { no: 1, name: "id", kind: "message", T: ChangeID }, + { no: 2, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "operations", kind: "message", T: Operation, repeated: true }, + { no: 4, name: "presence_change", kind: "message", T: PresenceChange }, + ], +); + +/** + * @generated from message yorkie.v1.ChangeID + */ +export const ChangeID = proto3.makeMessageType( + "yorkie.v1.ChangeID", + () => [ + { no: 1, name: "client_seq", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 2, name: "server_seq", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, + { no: 3, name: "lamport", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, + { no: 4, name: "actor_id", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ], +); + +/** + * @generated from message yorkie.v1.Operation + */ +export const Operation = proto3.makeMessageType( + "yorkie.v1.Operation", + () => [ + { no: 1, name: "set", kind: "message", T: Operation_Set, oneof: "body" }, + { no: 2, name: "add", kind: "message", T: Operation_Add, oneof: "body" }, + { no: 3, name: "move", kind: "message", T: Operation_Move, oneof: "body" }, + { no: 4, name: "remove", kind: "message", T: Operation_Remove, oneof: "body" }, + { no: 5, name: "edit", kind: "message", T: Operation_Edit, oneof: "body" }, + { no: 6, name: "select", kind: "message", T: Operation_Select, oneof: "body" }, + { no: 7, name: "style", kind: "message", T: Operation_Style, oneof: "body" }, + { no: 8, name: "increase", kind: "message", T: Operation_Increase, oneof: "body" }, + { no: 9, name: "tree_edit", kind: "message", T: Operation_TreeEdit, oneof: "body" }, + { no: 10, name: "tree_style", kind: "message", T: Operation_TreeStyle, oneof: "body" }, + ], +); + +/** + * @generated from message yorkie.v1.Operation.Set + */ +export const Operation_Set = proto3.makeMessageType( + "yorkie.v1.Operation.Set", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "value", kind: "message", T: JSONElementSimple }, + { no: 4, name: "executed_at", kind: "message", T: TimeTicket }, + ], + {localName: "Operation_Set"}, +); + +/** + * @generated from message yorkie.v1.Operation.Add + */ +export const Operation_Add = proto3.makeMessageType( + "yorkie.v1.Operation.Add", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "prev_created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "value", kind: "message", T: JSONElementSimple }, + { no: 4, name: "executed_at", kind: "message", T: TimeTicket }, + ], + {localName: "Operation_Add"}, +); + +/** + * @generated from message yorkie.v1.Operation.Move + */ +export const Operation_Move = proto3.makeMessageType( + "yorkie.v1.Operation.Move", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "prev_created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "created_at", kind: "message", T: TimeTicket }, + { no: 4, name: "executed_at", kind: "message", T: TimeTicket }, + ], + {localName: "Operation_Move"}, +); + +/** + * @generated from message yorkie.v1.Operation.Remove + */ +export const Operation_Remove = proto3.makeMessageType( + "yorkie.v1.Operation.Remove", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "executed_at", kind: "message", T: TimeTicket }, + ], + {localName: "Operation_Remove"}, +); + +/** + * @generated from message yorkie.v1.Operation.Edit + */ +export const Operation_Edit = proto3.makeMessageType( + "yorkie.v1.Operation.Edit", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TextNodePos }, + { no: 3, name: "to", kind: "message", T: TextNodePos }, + { no: 4, name: "created_at_map_by_actor", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: TimeTicket} }, + { no: 5, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "executed_at", kind: "message", T: TimeTicket }, + { no: 7, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, + ], + {localName: "Operation_Edit"}, +); + +/** + * NOTE(hackerwins): Select Operation is not used in the current version. + * In the previous version, it was used to represent selection of Text. + * However, it has been replaced by Presence now. It is retained for backward + * compatibility purposes. + * + * @generated from message yorkie.v1.Operation.Select + */ +export const Operation_Select = proto3.makeMessageType( + "yorkie.v1.Operation.Select", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TextNodePos }, + { no: 3, name: "to", kind: "message", T: TextNodePos }, + { no: 4, name: "executed_at", kind: "message", T: TimeTicket }, + ], + {localName: "Operation_Select"}, +); + +/** + * @generated from message yorkie.v1.Operation.Style + */ +export const Operation_Style = proto3.makeMessageType( + "yorkie.v1.Operation.Style", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TextNodePos }, + { no: 3, name: "to", kind: "message", T: TextNodePos }, + { no: 4, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, + { no: 5, name: "executed_at", kind: "message", T: TimeTicket }, + { no: 6, name: "created_at_map_by_actor", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: TimeTicket} }, + ], + {localName: "Operation_Style"}, +); + +/** + * @generated from message yorkie.v1.Operation.Increase + */ +export const Operation_Increase = proto3.makeMessageType( + "yorkie.v1.Operation.Increase", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "value", kind: "message", T: JSONElementSimple }, + { no: 3, name: "executed_at", kind: "message", T: TimeTicket }, + ], + {localName: "Operation_Increase"}, +); + +/** + * @generated from message yorkie.v1.Operation.TreeEdit + */ +export const Operation_TreeEdit = proto3.makeMessageType( + "yorkie.v1.Operation.TreeEdit", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TreePos }, + { no: 3, name: "to", kind: "message", T: TreePos }, + { no: 4, name: "created_at_map_by_actor", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: TimeTicket} }, + { no: 5, name: "contents", kind: "message", T: TreeNodes, repeated: true }, + { no: 7, name: "split_level", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 6, name: "executed_at", kind: "message", T: TimeTicket }, + ], + {localName: "Operation_TreeEdit"}, +); + +/** + * @generated from message yorkie.v1.Operation.TreeStyle + */ +export const Operation_TreeStyle = proto3.makeMessageType( + "yorkie.v1.Operation.TreeStyle", + () => [ + { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "from", kind: "message", T: TreePos }, + { no: 3, name: "to", kind: "message", T: TreePos }, + { no: 4, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, + { no: 5, name: "executed_at", kind: "message", T: TimeTicket }, + ], + {localName: "Operation_TreeStyle"}, +); + +/** + * @generated from message yorkie.v1.JSONElementSimple + */ +export const JSONElementSimple = proto3.makeMessageType( + "yorkie.v1.JSONElementSimple", + () => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 3, name: "removed_at", kind: "message", T: TimeTicket }, + { no: 4, name: "type", kind: "enum", T: proto3.getEnumType(ValueType) }, + { no: 5, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ], +); + +/** + * @generated from message yorkie.v1.JSONElement + */ +export const JSONElement = proto3.makeMessageType( + "yorkie.v1.JSONElement", + () => [ + { no: 1, name: "json_object", kind: "message", T: JSONElement_JSONObject, oneof: "body" }, + { no: 2, name: "json_array", kind: "message", T: JSONElement_JSONArray, oneof: "body" }, + { no: 3, name: "primitive", kind: "message", T: JSONElement_Primitive, oneof: "body" }, + { no: 5, name: "text", kind: "message", T: JSONElement_Text, oneof: "body" }, + { no: 6, name: "counter", kind: "message", T: JSONElement_Counter, oneof: "body" }, + { no: 7, name: "tree", kind: "message", T: JSONElement_Tree, oneof: "body" }, + ], +); + +/** + * @generated from message yorkie.v1.JSONElement.JSONObject + */ +export const JSONElement_JSONObject = proto3.makeMessageType( + "yorkie.v1.JSONElement.JSONObject", + () => [ + { no: 1, name: "nodes", kind: "message", T: RHTNode, repeated: true }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + ], + {localName: "JSONElement_JSONObject"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.JSONArray + */ +export const JSONElement_JSONArray = proto3.makeMessageType( + "yorkie.v1.JSONElement.JSONArray", + () => [ + { no: 1, name: "nodes", kind: "message", T: RGANode, repeated: true }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + ], + {localName: "JSONElement_JSONArray"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.Primitive + */ +export const JSONElement_Primitive = proto3.makeMessageType( + "yorkie.v1.JSONElement.Primitive", + () => [ + { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(ValueType) }, + { no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + { no: 3, name: "created_at", kind: "message", T: TimeTicket }, + { no: 4, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 5, name: "removed_at", kind: "message", T: TimeTicket }, + ], + {localName: "JSONElement_Primitive"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.Text + */ +export const JSONElement_Text = proto3.makeMessageType( + "yorkie.v1.JSONElement.Text", + () => [ + { no: 1, name: "nodes", kind: "message", T: TextNode, repeated: true }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + ], + {localName: "JSONElement_Text"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.Counter + */ +export const JSONElement_Counter = proto3.makeMessageType( + "yorkie.v1.JSONElement.Counter", + () => [ + { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(ValueType) }, + { no: 2, name: "value", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + { no: 3, name: "created_at", kind: "message", T: TimeTicket }, + { no: 4, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 5, name: "removed_at", kind: "message", T: TimeTicket }, + ], + {localName: "JSONElement_Counter"}, +); + +/** + * @generated from message yorkie.v1.JSONElement.Tree + */ +export const JSONElement_Tree = proto3.makeMessageType( + "yorkie.v1.JSONElement.Tree", + () => [ + { no: 1, name: "nodes", kind: "message", T: TreeNode, repeated: true }, + { no: 2, name: "created_at", kind: "message", T: TimeTicket }, + { no: 3, name: "moved_at", kind: "message", T: TimeTicket }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + ], + {localName: "JSONElement_Tree"}, +); + +/** + * @generated from message yorkie.v1.RHTNode + */ +export const RHTNode = proto3.makeMessageType( + "yorkie.v1.RHTNode", + () => [ + { no: 1, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "element", kind: "message", T: JSONElement }, + ], +); + +/** + * @generated from message yorkie.v1.RGANode + */ +export const RGANode = proto3.makeMessageType( + "yorkie.v1.RGANode", + () => [ + { no: 1, name: "next", kind: "message", T: RGANode }, + { no: 2, name: "element", kind: "message", T: JSONElement }, + ], +); + +/** + * @generated from message yorkie.v1.NodeAttr + */ +export const NodeAttr = proto3.makeMessageType( + "yorkie.v1.NodeAttr", + () => [ + { no: 1, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "updated_at", kind: "message", T: TimeTicket }, + ], +); + +/** + * @generated from message yorkie.v1.TextNode + */ +export const TextNode = proto3.makeMessageType( + "yorkie.v1.TextNode", + () => [ + { no: 1, name: "id", kind: "message", T: TextNodeID }, + { no: 2, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "removed_at", kind: "message", T: TimeTicket }, + { no: 4, name: "ins_prev_id", kind: "message", T: TextNodeID }, + { no: 5, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: NodeAttr} }, + ], +); + +/** + * @generated from message yorkie.v1.TextNodeID + */ +export const TextNodeID = proto3.makeMessageType( + "yorkie.v1.TextNodeID", + () => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ], +); + +/** + * @generated from message yorkie.v1.TreeNode + */ +export const TreeNode = proto3.makeMessageType( + "yorkie.v1.TreeNode", + () => [ + { no: 1, name: "id", kind: "message", T: TreeNodeID }, + { no: 2, name: "type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "removed_at", kind: "message", T: TimeTicket }, + { no: 5, name: "ins_prev_id", kind: "message", T: TreeNodeID }, + { no: 6, name: "ins_next_id", kind: "message", T: TreeNodeID }, + { no: 7, name: "depth", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 8, name: "attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: NodeAttr} }, + ], +); + +/** + * @generated from message yorkie.v1.TreeNodes + */ +export const TreeNodes = proto3.makeMessageType( + "yorkie.v1.TreeNodes", + () => [ + { no: 1, name: "content", kind: "message", T: TreeNode, repeated: true }, + ], +); + +/** + * @generated from message yorkie.v1.TreeNodeID + */ +export const TreeNodeID = proto3.makeMessageType( + "yorkie.v1.TreeNodeID", + () => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ], +); + +/** + * @generated from message yorkie.v1.TreePos + */ +export const TreePos = proto3.makeMessageType( + "yorkie.v1.TreePos", + () => [ + { no: 1, name: "parent_id", kind: "message", T: TreeNodeID }, + { no: 2, name: "left_sibling_id", kind: "message", T: TreeNodeID }, + ], +); + +/** + * @generated from message yorkie.v1.User + */ +export const User = proto3.makeMessageType( + "yorkie.v1.User", + () => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "created_at", kind: "message", T: Timestamp }, + ], +); + +/** + * @generated from message yorkie.v1.Project + */ +export const Project = proto3.makeMessageType( + "yorkie.v1.Project", + () => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "public_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "secret_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "auth_webhook_url", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "auth_webhook_methods", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 7, name: "client_deactivate_threshold", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "created_at", kind: "message", T: Timestamp }, + { no: 9, name: "updated_at", kind: "message", T: Timestamp }, + ], +); + +/** + * @generated from message yorkie.v1.UpdatableProjectFields + */ +export const UpdatableProjectFields = proto3.makeMessageType( + "yorkie.v1.UpdatableProjectFields", + () => [ + { no: 1, name: "name", kind: "message", T: StringValue }, + { no: 2, name: "auth_webhook_url", kind: "message", T: StringValue }, + { no: 3, name: "auth_webhook_methods", kind: "message", T: UpdatableProjectFields_AuthWebhookMethods }, + { no: 4, name: "client_deactivate_threshold", kind: "message", T: StringValue }, + ], +); + +/** + * @generated from message yorkie.v1.UpdatableProjectFields.AuthWebhookMethods + */ +export const UpdatableProjectFields_AuthWebhookMethods = proto3.makeMessageType( + "yorkie.v1.UpdatableProjectFields.AuthWebhookMethods", + () => [ + { no: 1, name: "methods", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ], + {localName: "UpdatableProjectFields_AuthWebhookMethods"}, +); + +/** + * @generated from message yorkie.v1.DocumentSummary + */ +export const DocumentSummary = proto3.makeMessageType( + "yorkie.v1.DocumentSummary", + () => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "snapshot", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "created_at", kind: "message", T: Timestamp }, + { no: 5, name: "accessed_at", kind: "message", T: Timestamp }, + { no: 6, name: "updated_at", kind: "message", T: Timestamp }, + ], +); + +/** + * @generated from message yorkie.v1.PresenceChange + */ +export const PresenceChange = proto3.makeMessageType( + "yorkie.v1.PresenceChange", + () => [ + { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(PresenceChange_ChangeType) }, + { no: 2, name: "presence", kind: "message", T: Presence }, + ], +); + +/** + * @generated from enum yorkie.v1.PresenceChange.ChangeType + */ +export const PresenceChange_ChangeType = proto3.makeEnum( + "yorkie.v1.PresenceChange.ChangeType", + [ + {no: 0, name: "CHANGE_TYPE_UNSPECIFIED", localName: "UNSPECIFIED"}, + {no: 1, name: "CHANGE_TYPE_PUT", localName: "PUT"}, + {no: 2, name: "CHANGE_TYPE_DELETE", localName: "DELETE"}, + {no: 3, name: "CHANGE_TYPE_CLEAR", localName: "CLEAR"}, + ], +); + +/** + * @generated from message yorkie.v1.Presence + */ +export const Presence = proto3.makeMessageType( + "yorkie.v1.Presence", + () => [ + { no: 1, name: "data", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, + ], +); + +/** + * @generated from message yorkie.v1.Checkpoint + */ +export const Checkpoint = proto3.makeMessageType( + "yorkie.v1.Checkpoint", + () => [ + { no: 1, name: "server_seq", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, + { no: 2, name: "client_seq", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ], +); + +/** + * @generated from message yorkie.v1.TextNodePos + */ +export const TextNodePos = proto3.makeMessageType( + "yorkie.v1.TextNodePos", + () => [ + { no: 1, name: "created_at", kind: "message", T: TimeTicket }, + { no: 2, name: "offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + { no: 3, name: "relative_offset", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, + ], +); + +/** + * @generated from message yorkie.v1.TimeTicket + */ +export const TimeTicket = proto3.makeMessageType( + "yorkie.v1.TimeTicket", + () => [ + { no: 1, name: "lamport", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, + { no: 2, name: "delimiter", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 3, name: "actor_id", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ], +); + +/** + * @generated from message yorkie.v1.DocEventBody + */ +export const DocEventBody = proto3.makeMessageType( + "yorkie.v1.DocEventBody", + () => [ + { no: 1, name: "topic", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ], +); + +/** + * @generated from message yorkie.v1.DocEvent + */ +export const DocEvent = proto3.makeMessageType( + "yorkie.v1.DocEvent", + () => [ + { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(DocEventType) }, + { no: 2, name: "publisher", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "body", kind: "message", T: DocEventBody }, + ], +); + diff --git a/src/api/yorkie/v1/yorkie.proto b/src/api/yorkie/v1/yorkie.proto index 9b0c86d84..4e799ffa1 100644 --- a/src/api/yorkie/v1/yorkie.proto +++ b/src/api/yorkie/v1/yorkie.proto @@ -15,109 +15,110 @@ */ syntax = "proto3"; -package yorkie.v1; - -import "yorkie/v1/resources.proto"; - -option go_package = ".;v1"; - -option java_multiple_files = true; -option java_package = "dev.yorkie.api.v1"; - -// Yorkie is a service that provides a API for SDKs. -service YorkieService { - rpc ActivateClient (ActivateClientRequest) returns (ActivateClientResponse) {} - rpc DeactivateClient (DeactivateClientRequest) returns (DeactivateClientResponse) {} - - rpc AttachDocument (AttachDocumentRequest) returns (AttachDocumentResponse) {} - rpc DetachDocument (DetachDocumentRequest) returns (DetachDocumentResponse) {} - rpc RemoveDocument (RemoveDocumentRequest) returns (RemoveDocumentResponse) {} - rpc PushPullChanges (PushPullChangesRequest) returns (PushPullChangesResponse) {} - - rpc WatchDocument (WatchDocumentRequest) returns (stream WatchDocumentResponse) {} - - rpc Broadcast (BroadcastRequest) returns (BroadcastResponse) {} -} - -message ActivateClientRequest { - string client_key = 1; -} - -message ActivateClientResponse { - string client_id = 1; -} - -message DeactivateClientRequest { - string client_id = 1; -} - -message DeactivateClientResponse { -} - -message AttachDocumentRequest { - string client_id = 1; - ChangePack change_pack = 2; -} - -message AttachDocumentResponse { - string document_id = 1; - ChangePack change_pack = 2; -} - -message DetachDocumentRequest { - string client_id = 1; - string document_id = 2; - ChangePack change_pack = 3; - bool remove_if_not_attached = 4; -} - -message DetachDocumentResponse { - ChangePack change_pack = 2; -} - -message WatchDocumentRequest { - string client_id = 1; - string document_id = 2; -} - -message WatchDocumentResponse { - message Initialization { - repeated string client_ids = 1; - } - - oneof body { - Initialization initialization = 1; - DocEvent event = 2; - } -} - -message RemoveDocumentRequest { - string client_id = 1; - string document_id = 2; - ChangePack change_pack = 3; -} - -message RemoveDocumentResponse { - ChangePack change_pack = 1; -} - -message PushPullChangesRequest { - string client_id = 1; - string document_id = 2; - ChangePack change_pack = 3; - bool push_only = 4; -} - -message PushPullChangesResponse { - ChangePack change_pack = 1; -} - -message BroadcastRequest { - string client_id = 1; - string document_id = 2; - string topic = 3; - bytes payload = 4; -} - -message BroadcastResponse { -} + package yorkie.v1; + + import "src/api/yorkie/v1/resources.proto"; + + option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; + + option java_multiple_files = true; + option java_package = "dev.yorkie.api.v1"; + + // Yorkie is a service that provides a API for SDKs. + service YorkieService { + rpc ActivateClient (ActivateClientRequest) returns (ActivateClientResponse) {} + rpc DeactivateClient (DeactivateClientRequest) returns (DeactivateClientResponse) {} + + rpc AttachDocument (AttachDocumentRequest) returns (AttachDocumentResponse) {} + rpc DetachDocument (DetachDocumentRequest) returns (DetachDocumentResponse) {} + rpc RemoveDocument (RemoveDocumentRequest) returns (RemoveDocumentResponse) {} + rpc PushPullChanges (PushPullChangesRequest) returns (PushPullChangesResponse) {} + + rpc WatchDocument (WatchDocumentRequest) returns (stream WatchDocumentResponse) {} + + rpc Broadcast (BroadcastRequest) returns (BroadcastResponse) {} + } + + message ActivateClientRequest { + string client_key = 1; + } + + message ActivateClientResponse { + string client_id = 1; + } + + message DeactivateClientRequest { + string client_id = 1; + } + + message DeactivateClientResponse { + } + + message AttachDocumentRequest { + string client_id = 1; + ChangePack change_pack = 2; + } + + message AttachDocumentResponse { + string document_id = 1; + ChangePack change_pack = 2; + } + + message DetachDocumentRequest { + string client_id = 1; + string document_id = 2; + ChangePack change_pack = 3; + bool remove_if_not_attached = 4; + } + + message DetachDocumentResponse { + ChangePack change_pack = 2; + } + + message WatchDocumentRequest { + string client_id = 1; + string document_id = 2; + } + + message WatchDocumentResponse { + message Initialization { + repeated string client_ids = 1; + } + + oneof body { + Initialization initialization = 1; + DocEvent event = 2; + } + } + + message RemoveDocumentRequest { + string client_id = 1; + string document_id = 2; + ChangePack change_pack = 3; + } + + message RemoveDocumentResponse { + ChangePack change_pack = 1; + } + + message PushPullChangesRequest { + string client_id = 1; + string document_id = 2; + ChangePack change_pack = 3; + bool push_only = 4; + } + + message PushPullChangesResponse { + ChangePack change_pack = 1; + } + + message BroadcastRequest { + string client_id = 1; + string document_id = 2; + string topic = 3; + bytes payload = 4; + } + + message BroadcastResponse { + } + \ No newline at end of file diff --git a/src/api/yorkie/v1/yorkie_connect.d.ts b/src/api/yorkie/v1/yorkie_connect.d.ts new file mode 100644 index 000000000..8bc957479 --- /dev/null +++ b/src/api/yorkie/v1/yorkie_connect.d.ts @@ -0,0 +1,106 @@ +// +// Copyright 2020 The Yorkie Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-connect-es v1.1.3 with parameter "target=js+dts" +// @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { ActivateClientRequest, ActivateClientResponse, AttachDocumentRequest, AttachDocumentResponse, BroadcastRequest, BroadcastResponse, DeactivateClientRequest, DeactivateClientResponse, DetachDocumentRequest, DetachDocumentResponse, PushPullChangesRequest, PushPullChangesResponse, RemoveDocumentRequest, RemoveDocumentResponse, WatchDocumentRequest, WatchDocumentResponse } from "./yorkie_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * Yorkie is a service that provides a API for SDKs. + * + * @generated from service yorkie.v1.YorkieService + */ +export declare const YorkieService: { + readonly typeName: "yorkie.v1.YorkieService", + readonly methods: { + /** + * @generated from rpc yorkie.v1.YorkieService.ActivateClient + */ + readonly activateClient: { + readonly name: "ActivateClient", + readonly I: typeof ActivateClientRequest, + readonly O: typeof ActivateClientResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.DeactivateClient + */ + readonly deactivateClient: { + readonly name: "DeactivateClient", + readonly I: typeof DeactivateClientRequest, + readonly O: typeof DeactivateClientResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.AttachDocument + */ + readonly attachDocument: { + readonly name: "AttachDocument", + readonly I: typeof AttachDocumentRequest, + readonly O: typeof AttachDocumentResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.DetachDocument + */ + readonly detachDocument: { + readonly name: "DetachDocument", + readonly I: typeof DetachDocumentRequest, + readonly O: typeof DetachDocumentResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.RemoveDocument + */ + readonly removeDocument: { + readonly name: "RemoveDocument", + readonly I: typeof RemoveDocumentRequest, + readonly O: typeof RemoveDocumentResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.PushPullChanges + */ + readonly pushPullChanges: { + readonly name: "PushPullChanges", + readonly I: typeof PushPullChangesRequest, + readonly O: typeof PushPullChangesResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.WatchDocument + */ + readonly watchDocument: { + readonly name: "WatchDocument", + readonly I: typeof WatchDocumentRequest, + readonly O: typeof WatchDocumentResponse, + readonly kind: MethodKind.ServerStreaming, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.Broadcast + */ + readonly broadcast: { + readonly name: "Broadcast", + readonly I: typeof BroadcastRequest, + readonly O: typeof BroadcastResponse, + readonly kind: MethodKind.Unary, + }, + } +}; + diff --git a/src/api/yorkie/v1/yorkie_connect.js b/src/api/yorkie/v1/yorkie_connect.js new file mode 100644 index 000000000..dd6f3ec44 --- /dev/null +++ b/src/api/yorkie/v1/yorkie_connect.js @@ -0,0 +1,106 @@ +// +// Copyright 2020 The Yorkie Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-connect-es v1.1.3 with parameter "target=js+dts" +// @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { ActivateClientRequest, ActivateClientResponse, AttachDocumentRequest, AttachDocumentResponse, BroadcastRequest, BroadcastResponse, DeactivateClientRequest, DeactivateClientResponse, DetachDocumentRequest, DetachDocumentResponse, PushPullChangesRequest, PushPullChangesResponse, RemoveDocumentRequest, RemoveDocumentResponse, WatchDocumentRequest, WatchDocumentResponse } from "./yorkie_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * Yorkie is a service that provides a API for SDKs. + * + * @generated from service yorkie.v1.YorkieService + */ +export const YorkieService = { + typeName: "yorkie.v1.YorkieService", + methods: { + /** + * @generated from rpc yorkie.v1.YorkieService.ActivateClient + */ + activateClient: { + name: "ActivateClient", + I: ActivateClientRequest, + O: ActivateClientResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.DeactivateClient + */ + deactivateClient: { + name: "DeactivateClient", + I: DeactivateClientRequest, + O: DeactivateClientResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.AttachDocument + */ + attachDocument: { + name: "AttachDocument", + I: AttachDocumentRequest, + O: AttachDocumentResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.DetachDocument + */ + detachDocument: { + name: "DetachDocument", + I: DetachDocumentRequest, + O: DetachDocumentResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.RemoveDocument + */ + removeDocument: { + name: "RemoveDocument", + I: RemoveDocumentRequest, + O: RemoveDocumentResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.PushPullChanges + */ + pushPullChanges: { + name: "PushPullChanges", + I: PushPullChangesRequest, + O: PushPullChangesResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.WatchDocument + */ + watchDocument: { + name: "WatchDocument", + I: WatchDocumentRequest, + O: WatchDocumentResponse, + kind: MethodKind.ServerStreaming, + }, + /** + * @generated from rpc yorkie.v1.YorkieService.Broadcast + */ + broadcast: { + name: "Broadcast", + I: BroadcastRequest, + O: BroadcastResponse, + kind: MethodKind.Unary, + }, + } +}; + diff --git a/src/api/yorkie/v1/yorkie_pb.d.ts b/src/api/yorkie/v1/yorkie_pb.d.ts new file mode 100644 index 000000000..7b61abc02 --- /dev/null +++ b/src/api/yorkie/v1/yorkie_pb.d.ts @@ -0,0 +1,504 @@ +// +// Copyright 2020 The Yorkie Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v1.4.2 with parameter "target=js+dts" +// @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import type { ChangePack, DocEvent } from "./resources_pb.js"; + +/** + * @generated from message yorkie.v1.ActivateClientRequest + */ +export declare class ActivateClientRequest extends Message { + /** + * @generated from field: string client_key = 1; + */ + clientKey: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ActivateClientRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ActivateClientRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): ActivateClientRequest; + + static fromJsonString(jsonString: string, options?: Partial): ActivateClientRequest; + + static equals(a: ActivateClientRequest | PlainMessage | undefined, b: ActivateClientRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.ActivateClientResponse + */ +export declare class ActivateClientResponse extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.ActivateClientResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): ActivateClientResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): ActivateClientResponse; + + static fromJsonString(jsonString: string, options?: Partial): ActivateClientResponse; + + static equals(a: ActivateClientResponse | PlainMessage | undefined, b: ActivateClientResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DeactivateClientRequest + */ +export declare class DeactivateClientRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DeactivateClientRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DeactivateClientRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): DeactivateClientRequest; + + static fromJsonString(jsonString: string, options?: Partial): DeactivateClientRequest; + + static equals(a: DeactivateClientRequest | PlainMessage | undefined, b: DeactivateClientRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DeactivateClientResponse + */ +export declare class DeactivateClientResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DeactivateClientResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DeactivateClientResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): DeactivateClientResponse; + + static fromJsonString(jsonString: string, options?: Partial): DeactivateClientResponse; + + static equals(a: DeactivateClientResponse | PlainMessage | undefined, b: DeactivateClientResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.AttachDocumentRequest + */ +export declare class AttachDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 2; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.AttachDocumentRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): AttachDocumentRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): AttachDocumentRequest; + + static fromJsonString(jsonString: string, options?: Partial): AttachDocumentRequest; + + static equals(a: AttachDocumentRequest | PlainMessage | undefined, b: AttachDocumentRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.AttachDocumentResponse + */ +export declare class AttachDocumentResponse extends Message { + /** + * @generated from field: string document_id = 1; + */ + documentId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 2; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.AttachDocumentResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): AttachDocumentResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): AttachDocumentResponse; + + static fromJsonString(jsonString: string, options?: Partial): AttachDocumentResponse; + + static equals(a: AttachDocumentResponse | PlainMessage | undefined, b: AttachDocumentResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DetachDocumentRequest + */ +export declare class DetachDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 3; + */ + changePack?: ChangePack; + + /** + * @generated from field: bool remove_if_not_attached = 4; + */ + removeIfNotAttached: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DetachDocumentRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DetachDocumentRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): DetachDocumentRequest; + + static fromJsonString(jsonString: string, options?: Partial): DetachDocumentRequest; + + static equals(a: DetachDocumentRequest | PlainMessage | undefined, b: DetachDocumentRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.DetachDocumentResponse + */ +export declare class DetachDocumentResponse extends Message { + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 2; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.DetachDocumentResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): DetachDocumentResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): DetachDocumentResponse; + + static fromJsonString(jsonString: string, options?: Partial): DetachDocumentResponse; + + static equals(a: DetachDocumentResponse | PlainMessage | undefined, b: DetachDocumentResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.WatchDocumentRequest + */ +export declare class WatchDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.WatchDocumentRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): WatchDocumentRequest; + + static fromJsonString(jsonString: string, options?: Partial): WatchDocumentRequest; + + static equals(a: WatchDocumentRequest | PlainMessage | undefined, b: WatchDocumentRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.WatchDocumentResponse + */ +export declare class WatchDocumentResponse extends Message { + /** + * @generated from oneof yorkie.v1.WatchDocumentResponse.body + */ + body: { + /** + * @generated from field: yorkie.v1.WatchDocumentResponse.Initialization initialization = 1; + */ + value: WatchDocumentResponse_Initialization; + case: "initialization"; + } | { + /** + * @generated from field: yorkie.v1.DocEvent event = 2; + */ + value: DocEvent; + case: "event"; + } | { case: undefined; value?: undefined }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.WatchDocumentResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): WatchDocumentResponse; + + static fromJsonString(jsonString: string, options?: Partial): WatchDocumentResponse; + + static equals(a: WatchDocumentResponse | PlainMessage | undefined, b: WatchDocumentResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.WatchDocumentResponse.Initialization + */ +export declare class WatchDocumentResponse_Initialization extends Message { + /** + * @generated from field: repeated string client_ids = 1; + */ + clientIds: string[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.WatchDocumentResponse.Initialization"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): WatchDocumentResponse_Initialization; + + static fromJson(jsonValue: JsonValue, options?: Partial): WatchDocumentResponse_Initialization; + + static fromJsonString(jsonString: string, options?: Partial): WatchDocumentResponse_Initialization; + + static equals(a: WatchDocumentResponse_Initialization | PlainMessage | undefined, b: WatchDocumentResponse_Initialization | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.RemoveDocumentRequest + */ +export declare class RemoveDocumentRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 3; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.RemoveDocumentRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): RemoveDocumentRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): RemoveDocumentRequest; + + static fromJsonString(jsonString: string, options?: Partial): RemoveDocumentRequest; + + static equals(a: RemoveDocumentRequest | PlainMessage | undefined, b: RemoveDocumentRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.RemoveDocumentResponse + */ +export declare class RemoveDocumentResponse extends Message { + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 1; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.RemoveDocumentResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): RemoveDocumentResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): RemoveDocumentResponse; + + static fromJsonString(jsonString: string, options?: Partial): RemoveDocumentResponse; + + static equals(a: RemoveDocumentResponse | PlainMessage | undefined, b: RemoveDocumentResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.PushPullChangesRequest + */ +export declare class PushPullChangesRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 3; + */ + changePack?: ChangePack; + + /** + * @generated from field: bool push_only = 4; + */ + pushOnly: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.PushPullChangesRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): PushPullChangesRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): PushPullChangesRequest; + + static fromJsonString(jsonString: string, options?: Partial): PushPullChangesRequest; + + static equals(a: PushPullChangesRequest | PlainMessage | undefined, b: PushPullChangesRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.PushPullChangesResponse + */ +export declare class PushPullChangesResponse extends Message { + /** + * @generated from field: yorkie.v1.ChangePack change_pack = 1; + */ + changePack?: ChangePack; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.PushPullChangesResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): PushPullChangesResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): PushPullChangesResponse; + + static fromJsonString(jsonString: string, options?: Partial): PushPullChangesResponse; + + static equals(a: PushPullChangesResponse | PlainMessage | undefined, b: PushPullChangesResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.BroadcastRequest + */ +export declare class BroadcastRequest extends Message { + /** + * @generated from field: string client_id = 1; + */ + clientId: string; + + /** + * @generated from field: string document_id = 2; + */ + documentId: string; + + /** + * @generated from field: string topic = 3; + */ + topic: string; + + /** + * @generated from field: bytes payload = 4; + */ + payload: Uint8Array; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.BroadcastRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): BroadcastRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): BroadcastRequest; + + static fromJsonString(jsonString: string, options?: Partial): BroadcastRequest; + + static equals(a: BroadcastRequest | PlainMessage | undefined, b: BroadcastRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message yorkie.v1.BroadcastResponse + */ +export declare class BroadcastResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "yorkie.v1.BroadcastResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): BroadcastResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): BroadcastResponse; + + static fromJsonString(jsonString: string, options?: Partial): BroadcastResponse; + + static equals(a: BroadcastResponse | PlainMessage | undefined, b: BroadcastResponse | PlainMessage | undefined): boolean; +} + diff --git a/src/api/yorkie/v1/yorkie_pb.js b/src/api/yorkie/v1/yorkie_pb.js new file mode 100644 index 000000000..1b17a9113 --- /dev/null +++ b/src/api/yorkie/v1/yorkie_pb.js @@ -0,0 +1,205 @@ +// +// Copyright 2020 The Yorkie Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v1.4.2 with parameter "target=js+dts" +// @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3 } from "@bufbuild/protobuf"; +import { ChangePack, DocEvent } from "./resources_pb.js"; + +/** + * @generated from message yorkie.v1.ActivateClientRequest + */ +export const ActivateClientRequest = proto3.makeMessageType( + "yorkie.v1.ActivateClientRequest", + () => [ + { no: 1, name: "client_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message yorkie.v1.ActivateClientResponse + */ +export const ActivateClientResponse = proto3.makeMessageType( + "yorkie.v1.ActivateClientResponse", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message yorkie.v1.DeactivateClientRequest + */ +export const DeactivateClientRequest = proto3.makeMessageType( + "yorkie.v1.DeactivateClientRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message yorkie.v1.DeactivateClientResponse + */ +export const DeactivateClientResponse = proto3.makeMessageType( + "yorkie.v1.DeactivateClientResponse", + [], +); + +/** + * @generated from message yorkie.v1.AttachDocumentRequest + */ +export const AttachDocumentRequest = proto3.makeMessageType( + "yorkie.v1.AttachDocumentRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.AttachDocumentResponse + */ +export const AttachDocumentResponse = proto3.makeMessageType( + "yorkie.v1.AttachDocumentResponse", + () => [ + { no: 1, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.DetachDocumentRequest + */ +export const DetachDocumentRequest = proto3.makeMessageType( + "yorkie.v1.DetachDocumentRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "change_pack", kind: "message", T: ChangePack }, + { no: 4, name: "remove_if_not_attached", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ], +); + +/** + * @generated from message yorkie.v1.DetachDocumentResponse + */ +export const DetachDocumentResponse = proto3.makeMessageType( + "yorkie.v1.DetachDocumentResponse", + () => [ + { no: 2, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.WatchDocumentRequest + */ +export const WatchDocumentRequest = proto3.makeMessageType( + "yorkie.v1.WatchDocumentRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message yorkie.v1.WatchDocumentResponse + */ +export const WatchDocumentResponse = proto3.makeMessageType( + "yorkie.v1.WatchDocumentResponse", + () => [ + { no: 1, name: "initialization", kind: "message", T: WatchDocumentResponse_Initialization, oneof: "body" }, + { no: 2, name: "event", kind: "message", T: DocEvent, oneof: "body" }, + ], +); + +/** + * @generated from message yorkie.v1.WatchDocumentResponse.Initialization + */ +export const WatchDocumentResponse_Initialization = proto3.makeMessageType( + "yorkie.v1.WatchDocumentResponse.Initialization", + () => [ + { no: 1, name: "client_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ], + {localName: "WatchDocumentResponse_Initialization"}, +); + +/** + * @generated from message yorkie.v1.RemoveDocumentRequest + */ +export const RemoveDocumentRequest = proto3.makeMessageType( + "yorkie.v1.RemoveDocumentRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.RemoveDocumentResponse + */ +export const RemoveDocumentResponse = proto3.makeMessageType( + "yorkie.v1.RemoveDocumentResponse", + () => [ + { no: 1, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.PushPullChangesRequest + */ +export const PushPullChangesRequest = proto3.makeMessageType( + "yorkie.v1.PushPullChangesRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "change_pack", kind: "message", T: ChangePack }, + { no: 4, name: "push_only", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ], +); + +/** + * @generated from message yorkie.v1.PushPullChangesResponse + */ +export const PushPullChangesResponse = proto3.makeMessageType( + "yorkie.v1.PushPullChangesResponse", + () => [ + { no: 1, name: "change_pack", kind: "message", T: ChangePack }, + ], +); + +/** + * @generated from message yorkie.v1.BroadcastRequest + */ +export const BroadcastRequest = proto3.makeMessageType( + "yorkie.v1.BroadcastRequest", + () => [ + { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "topic", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "payload", kind: "scalar", T: 12 /* ScalarType.BYTES */ }, + ], +); + +/** + * @generated from message yorkie.v1.BroadcastResponse + */ +export const BroadcastResponse = proto3.makeMessageType( + "yorkie.v1.BroadcastResponse", + [], +); + diff --git a/src/client/client.ts b/src/client/client.ts index d04c498a5..f207c8f3d 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -426,7 +426,7 @@ export class Client implements Observable { this.rpcClient.deactivateClient( req, { headers: {"x-shard-key": this.apiKey}}, - ).then((res) => { + ).then(() => { this.status = ClientStatus.Deactivated; this.eventStreamObserver.next({ type: ClientEventType.StatusChanged, @@ -843,7 +843,7 @@ export class Client implements Observable { }); logger.info(`[WD] c:"${this.getKey()}" watches d:"${docKey}"`); - return new Promise(async (resolve) => { + return new Promise((resolve, reject) => { const onStreamDisconnect = (): void => { this.eventStreamObserver.next({ type: ClientEventType.StreamConnectionStatusChanged, @@ -853,16 +853,21 @@ export class Client implements Observable { onDisconnect(); }; - try { - for await (const resp of stream) { - this.handleWatchDocumentsResponse(attachment, resp); - resolve(stream); - } - } catch(error) { - if(error instanceof ConnectError) { - onStreamDisconnect(); + const handleStream = async () => { + try { + for await (const resp of stream) { + this.handleWatchDocumentsResponse(attachment, resp); + } + } catch (error) { + if (error instanceof ConnectError) { + onStreamDisconnect(); + } else { + reject(error); + } } - } + }; + + handleStream().then(() => resolve(stream)); }); }, ); From 21411c17911a10aaa2ff5c1b365e1cd87917f320 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Thu, 7 Dec 2023 15:13:18 +0900 Subject: [PATCH 05/21] Temporary set docker image to connectRPC based yorkie server --- docker/docker-compose-ci.yml | 2 +- docker/docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/docker-compose-ci.yml b/docker/docker-compose-ci.yml index 49662a164..b988a838d 100644 --- a/docker/docker-compose-ci.yml +++ b/docker/docker-compose-ci.yml @@ -2,7 +2,7 @@ version: '3.3' services: yorkie: - image: 'yorkieteam/yorkie:latest' + image: 'krapi0314/yorkie:test' container_name: 'yorkie' command: [ 'server', diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index c03eda524..a2cca235f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.3' services: yorkie: - image: 'yorkieteam/yorkie:latest' + image: 'krapi0314/yorkie:test' container_name: 'yorkie' command: ['server', '--enable-pprof'] restart: always From 0539f595f32ee6cad956656301297dcc6c7040f4 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Tue, 12 Dec 2023 13:05:14 +0900 Subject: [PATCH 06/21] Replace XHR mock with fetch mock --- test/integration/client_test.ts | 49 ++++++++++--------------------- test/integration/presence_test.ts | 6 ++-- 2 files changed, 18 insertions(+), 37 deletions(-) diff --git a/test/integration/client_test.ts b/test/integration/client_test.ts index 6e2b4eb37..86d6ae990 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"}'); @@ -238,7 +219,7 @@ describe.sequential('Client', function () { await c2.deactivate(); }); - it('Can change realtime sync', async function ({ task }) { + it.skip('Can change realtime sync', async function ({ task }) { const c1 = new yorkie.Client(testRPCAddr); const c2 = new yorkie.Client(testRPCAddr); await c1.activate(); diff --git a/test/integration/presence_test.ts b/test/integration/presence_test.ts index c45f2dc41..660c41572 100644 --- a/test/integration/presence_test.ts +++ b/test/integration/presence_test.ts @@ -10,7 +10,7 @@ import { } from '@yorkie-js-sdk/test/integration/integration_helper'; import { EventCollector, deepSort } from '@yorkie-js-sdk/test/helper/helper'; -describe('Presence', function () { +describe.skip('Presence', function () { afterEach(() => { vi.restoreAllMocks(); }); @@ -313,7 +313,7 @@ describe('Presence', function () { }); }); -describe(`Document.Subscribe('presence')`, function () { +describe.skip(`Document.Subscribe('presence')`, function () { it(`Should receive presence-changed event for final presence if there are multiple presence changes within doc.update`, async function ({ task, }) { @@ -549,7 +549,7 @@ describe(`Document.Subscribe('presence')`, function () { }); }); -describe('Undo/Redo', function () { +describe.skip('Undo/Redo', function () { it('Can undo/redo with presence', async function ({ task }) { type TestDoc = { counter: Counter }; type Presence = { color: string }; From 870c35cf613674dabba77256797ca0f2ec2dd643 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Tue, 12 Dec 2023 13:55:05 +0900 Subject: [PATCH 07/21] Update proto related codes --- buf.gen.yaml | 3 --- package-lock.json | 32 ++++++++++++++--------------- package.json | 4 ++-- src/api/yorkie/v1/resources_pb.d.ts | 2 +- src/api/yorkie/v1/resources_pb.js | 2 +- src/api/yorkie/v1/yorkie_pb.d.ts | 2 +- src/api/yorkie/v1/yorkie_pb.js | 2 +- 7 files changed, 22 insertions(+), 25 deletions(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index d827f7f4b..50e19aeca 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,11 +1,8 @@ -# buf.gen.yaml defines a local generation template. -# For details, see https://buf.build/docs/configuration/v1/buf-gen-yaml version: v1 plugins: - plugin: es out: . opt: target=js+dts - # This will invoke protoc-gen-connect-es - plugin: connect-es out: . opt: diff --git a/package-lock.json b/package-lock.json index 891871771..56eedbdf1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "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/*", @@ -22,7 +22,7 @@ }, "devDependencies": { "@bufbuild/buf": "^1.28.1", - "@bufbuild/protoc-gen-es": "^1.4.2", + "@bufbuild/protoc-gen-es": "^1.5.1", "@connectrpc/protoc-gen-connect-es": "^1.1.3", "@microsoft/api-documenter": "^7.15.1", "@microsoft/api-extractor": "^7.19.4", @@ -1150,18 +1150,18 @@ } }, "node_modules/@bufbuild/protobuf": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.4.2.tgz", - "integrity": "sha512-JyEH8Z+OD5Sc2opSg86qMHn1EM1Sa+zj/Tc0ovxdwk56ByVNONJSabuCUbLQp+eKN3rWNfrho0X+3SEqEPXIow==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.5.1.tgz", + "integrity": "sha512-LX+MeB1AzlbqgJXkq83lilQpLGnPvsAMj7SH8KtJAmQfBc55ee78Stxuff/HMw0xLMYJN3P1FBh5TENgjJof1w==" }, "node_modules/@bufbuild/protoc-gen-es": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.4.2.tgz", - "integrity": "sha512-/It7M2s8H1zTDvUMJu6vhBmtnzeFL2VS6e78RYIY38602pNXDK/vbteKUo4KrG0O07lOPFu87hHZ0Y+w5Ib6iw==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.5.1.tgz", + "integrity": "sha512-o4NNOf49QEjowhpQxm3fq/yv+LstO9aMmNlEE3fz4WlD5fBE8OZ7q38O+WMUVoB4Y41joxk24v7IIm61trwRyg==", "dev": true, "dependencies": { - "@bufbuild/protobuf": "^1.4.2", - "@bufbuild/protoplugin": "1.4.2" + "@bufbuild/protobuf": "^1.5.1", + "@bufbuild/protoplugin": "1.5.1" }, "bin": { "protoc-gen-es": "bin/protoc-gen-es" @@ -1170,7 +1170,7 @@ "node": ">=14" }, "peerDependencies": { - "@bufbuild/protobuf": "1.4.2" + "@bufbuild/protobuf": "1.5.1" }, "peerDependenciesMeta": { "@bufbuild/protobuf": { @@ -1179,12 +1179,12 @@ } }, "node_modules/@bufbuild/protoplugin": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.4.2.tgz", - "integrity": "sha512-5IwGC1ZRD2A+KydGXeaSOErwfILLqVtvMH/RkN+cOoHcQd4EYXFStcF7g7aR+yICRDEEjQVi5tQF/qPGBSr9vg==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.5.1.tgz", + "integrity": "sha512-4qQD3UIEXflPYCEPZxyvi9yoQiX3ONWgLw24uLJrw9AnbY7Pw1xT5v8yIMXIVccBEZNSpvIF6qD/JXfIapjRtw==", "dev": true, "dependencies": { - "@bufbuild/protobuf": "1.4.2", + "@bufbuild/protobuf": "1.5.1", "@typescript/vfs": "^1.4.0", "typescript": "4.5.2" } diff --git a/package.json b/package.json index 76cc6b06f..72e125354 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", @@ -47,7 +47,7 @@ "homepage": "https://github.com/yorkie-team/yorkie-js-sdk#readme", "devDependencies": { "@bufbuild/buf": "^1.28.1", - "@bufbuild/protoc-gen-es": "^1.4.2", + "@bufbuild/protoc-gen-es": "^1.5.1", "@connectrpc/protoc-gen-connect-es": "^1.1.3", "@microsoft/api-documenter": "^7.15.1", "@microsoft/api-extractor": "^7.19.4", diff --git a/src/api/yorkie/v1/resources_pb.d.ts b/src/api/yorkie/v1/resources_pb.d.ts index 5be980931..13158befd 100644 --- a/src/api/yorkie/v1/resources_pb.d.ts +++ b/src/api/yorkie/v1/resources_pb.d.ts @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.4.2 with parameter "target=js+dts" +// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts" // @generated from file src/api/yorkie/v1/resources.proto (package yorkie.v1, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/src/api/yorkie/v1/resources_pb.js b/src/api/yorkie/v1/resources_pb.js index aabe2619c..f84388d48 100644 --- a/src/api/yorkie/v1/resources_pb.js +++ b/src/api/yorkie/v1/resources_pb.js @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.4.2 with parameter "target=js+dts" +// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts" // @generated from file src/api/yorkie/v1/resources.proto (package yorkie.v1, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/src/api/yorkie/v1/yorkie_pb.d.ts b/src/api/yorkie/v1/yorkie_pb.d.ts index 7b61abc02..ba3e402fc 100644 --- a/src/api/yorkie/v1/yorkie_pb.d.ts +++ b/src/api/yorkie/v1/yorkie_pb.d.ts @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.4.2 with parameter "target=js+dts" +// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts" // @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/src/api/yorkie/v1/yorkie_pb.js b/src/api/yorkie/v1/yorkie_pb.js index 1b17a9113..697b4ddc7 100644 --- a/src/api/yorkie/v1/yorkie_pb.js +++ b/src/api/yorkie/v1/yorkie_pb.js @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.4.2 with parameter "target=js+dts" +// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts" // @generated from file src/api/yorkie/v1/yorkie.proto (package yorkie.v1, syntax proto3) /* eslint-disable */ // @ts-nocheck From e3f31715d7bfe2d4fc82c462816e48dcdccc7ce7 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Tue, 12 Dec 2023 20:06:40 +0900 Subject: [PATCH 08/21] Update watch stream handling & cancellation --- src/client/attachment.ts | 10 ++++++---- src/client/client.ts | 14 ++++++++------ test/integration/client_test.ts | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/client/attachment.ts b/src/client/attachment.ts index 1eef50694..a7eb85785 100644 --- a/src/client/attachment.ts +++ b/src/client/attachment.ts @@ -20,6 +20,7 @@ export class Attachment { watchStream?: WatchStream; watchLoopTimerID?: ReturnType; + watchAbort: AbortController; constructor( reconnectStreamDelay: number, @@ -33,6 +34,7 @@ export class Attachment { this.isRealtimeSync = isRealtimeSync; this.syncMode = SyncMode.PushPull; this.remoteChangeEventReceived = false; + this.watchAbort = new AbortController(); } /** @@ -74,7 +76,7 @@ export class Attachment { * `runWatchLoop` runs the watch loop. */ public async runWatchLoop( - watchStreamCreator: (onDisconnect: () => void) => Promise, + watchStreamCreator: (onDisconnect: () => void, abort: AbortController) => Promise, ): Promise { const doLoop = async (): Promise => { if (this.watchStream) { @@ -90,7 +92,7 @@ export class Attachment { this.watchLoopTimerID = setTimeout(doLoop, this.reconnectStreamDelay); }; - this.watchStream = await watchStreamCreator(onDisconnect); + this.watchStream = await watchStreamCreator(onDisconnect, this.watchAbort); }; await doLoop(); @@ -100,8 +102,8 @@ export class Attachment { * `cancelWatchStream` cancels the watch stream. */ public cancelWatchStream(): void { - if (this.watchStream) { - this.watchStream.cancel(); + if (this.watchStream && this.watchAbort) { + this.watchAbort.abort(); this.watchStream = undefined; } clearTimeout(this.watchLoopTimerID); diff --git a/src/client/client.ts b/src/client/client.ts index f207c8f3d..066a2f9b8 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -822,7 +822,7 @@ export class Client implements Observable { } return attachment.runWatchLoop( - (onDisconnect: () => void): Promise => { + (onDisconnect: () => void, abort: AbortController): Promise => { if (!this.isActive()) { throw new YorkieError( Code.ClientNotActive, @@ -834,7 +834,8 @@ export class Client implements Observable { req.clientId = this.id!; req.documentId = attachment.docID; const stream = this.rpcClient.watchDocument(req, { - headers: {"x-shard-key": `${this.apiKey}/${docKey}`} + headers: {"x-shard-key": `${this.apiKey}/${docKey}`}, + signal: abort.signal, }); this.eventStreamObserver.next({ @@ -857,17 +858,18 @@ export class Client implements Observable { try { for await (const resp of stream) { this.handleWatchDocumentsResponse(attachment, resp); + resolve(stream); } - } catch (error) { - if (error instanceof ConnectError) { + } catch (err) { + if (err instanceof ConnectError) { onStreamDisconnect(); } else { - reject(error); + reject(err); } } }; - handleStream().then(() => resolve(stream)); + handleStream(); }); }, ); diff --git a/test/integration/client_test.ts b/test/integration/client_test.ts index 86d6ae990..78e2cc802 100644 --- a/test/integration/client_test.ts +++ b/test/integration/client_test.ts @@ -219,7 +219,7 @@ describe.sequential('Client', function () { await c2.deactivate(); }); - it.skip('Can change realtime sync', async function ({ task }) { + it('Can change realtime sync', async function ({ task }) { const c1 = new yorkie.Client(testRPCAddr); const c2 = new yorkie.Client(testRPCAddr); await c1.activate(); From d6eca55c71f8c76c6118685c973533de847a33e8 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Tue, 12 Dec 2023 20:20:21 +0900 Subject: [PATCH 09/21] Change test RPC addr to explicit IP address 127.0.0.1 --- test/integration/integration_helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From ba52d6a06cc407d1ca4c3f231cd28b66ec4792e3 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Tue, 12 Dec 2023 23:37:14 +0900 Subject: [PATCH 10/21] Temporary revert to envoy setting with gRPC-web --- docker/docker-compose-ci.yml | 19 ++++++++++-- docker/envoy-ci.yaml | 54 +++++++++++++++++++++++++++++++++ docker/envoy.Dockerfile | 8 +++++ docker/envoy.yaml | 59 ++++++++++++++++++++++++++++++++++++ src/client/client.ts | 4 +-- 5 files changed, 139 insertions(+), 5 deletions(-) create mode 100644 docker/envoy-ci.yaml create mode 100644 docker/envoy.Dockerfile create mode 100644 docker/envoy.yaml diff --git a/docker/docker-compose-ci.yml b/docker/docker-compose-ci.yml index b988a838d..0e733303d 100644 --- a/docker/docker-compose-ci.yml +++ b/docker/docker-compose-ci.yml @@ -1,8 +1,21 @@ 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: 'krapi0314/yorkie:test' + image: 'yorkieteam/yorkie:latest' container_name: 'yorkie' command: [ 'server', @@ -11,8 +24,8 @@ services: ] restart: always ports: - - '8080:8080' - - '8081:8081' + - '11101:11101' + - '11102:11102' depends_on: - mongo mongo: diff --git a/docker/envoy-ci.yaml b/docker/envoy-ci.yaml new file mode 100644 index 000000000..416e72a25 --- /dev/null +++ b/docker/envoy-ci.yaml @@ -0,0 +1,54 @@ +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 new file mode 100644 index 000000000..60b660b76 --- /dev/null +++ b/docker/envoy.Dockerfile @@ -0,0 +1,8 @@ +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 new file mode 100644 index 000000000..69b92bcc5 --- /dev/null +++ b/docker/envoy.yaml @@ -0,0 +1,59 @@ +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/src/client/client.ts b/src/client/client.ts index 066a2f9b8..092ba5647 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -25,7 +25,7 @@ import { NextFn, } from '@yorkie-js-sdk/src/util/observable'; import { ConnectError, createPromiseClient, PromiseClient } from "@connectrpc/connect"; -import { createConnectTransport } from "@connectrpc/connect-web"; +import { createGrpcWebTransport } from "@connectrpc/connect-web"; import { YorkieService } from '../api/yorkie/v1/yorkie_connect'; import { ActivateClientRequest, @@ -354,7 +354,7 @@ export class Client implements Observable { // In our example we'll be communicating with a Connect endpoint. // If your endpoint only supports gRPC-web, make sure to use // `createGrpcWebTransport` instead. - const transport = createConnectTransport({ + const transport = createGrpcWebTransport({ baseUrl: rpcAddr, // skip interceptors for now because they are metric interceptors //interceptors: rpcOpts.unaryInterceptors, From 7f756eec0d107f9557e1895027a004e1cc655470 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Wed, 13 Dec 2023 02:18:14 +0900 Subject: [PATCH 11/21] Simplify client RPC --- src/client/client.ts | 314 +++++++++++++++++++++---------------------- 1 file changed, 153 insertions(+), 161 deletions(-) diff --git a/src/client/client.ts b/src/client/client.ts index 092ba5647..aa632c304 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -24,22 +24,16 @@ import { CompleteFn, NextFn, } from '@yorkie-js-sdk/src/util/observable'; -import { ConnectError, createPromiseClient, PromiseClient } from "@connectrpc/connect"; -import { createGrpcWebTransport } from "@connectrpc/connect-web"; -import { YorkieService } from '../api/yorkie/v1/yorkie_connect'; import { - ActivateClientRequest, - DeactivateClientRequest, - AttachDocumentRequest, - DetachDocumentRequest, - PushPullChangesRequest, - RemoveDocumentRequest, - WatchDocumentRequest, - WatchDocumentResponse, -} from '@yorkie-js-sdk/src/api/yorkie/v1/yorkie_pb'; + ConnectError, + 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'; @@ -379,15 +373,14 @@ export class Client implements Observable { return Promise.resolve(); } - return new Promise((resolve, reject) => { - const req = new ActivateClientRequest({ - clientKey: this.key, - }); - - this.rpcClient.activateClient( - req, - { headers: {"x-shard-key": this.apiKey}}, - ).then((res) => { + 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(); @@ -398,13 +391,11 @@ export class Client implements Observable { }); logger.info(`[AC] c:"${this.getKey()}" activated, id:"${this.id}"`); - resolve(); - }).catch((err) => { + }) + .catch((err) => { logger.error(`[AC] c:"${this.getKey()}" err :`, err); - reject(err); - return; + throw err; }); - }); } /** @@ -419,14 +410,14 @@ export class Client implements Observable { this.detachInternal(key); } - return new Promise((resolve, reject) => { - const req = new DeactivateClientRequest(); - req.clientId = this.id!; - - this.rpcClient.deactivateClient( - req, - { headers: {"x-shard-key": this.apiKey}}, - ).then(() => { + return this.rpcClient + .deactivateClient( + { + clientId: this.id!, + }, + { headers: { 'x-shard-key': this.apiKey } }, + ) + .then(() => { this.status = ClientStatus.Deactivated; this.eventStreamObserver.next({ type: ClientEventType.StatusChanged, @@ -434,13 +425,11 @@ export class Client implements Observable { }); logger.info(`[DC] c"${this.getKey()}" deactivated`); - resolve(); - }).catch((err) => { + }) + .catch((err) => { logger.error(`[DC] c:"${this.getKey()}" err :`, err); - reject(err); - return; + throw err; }); - }); } /** @@ -468,15 +457,17 @@ export class Client implements Observable { const isRealtimeSync = options.isRealtimeSync ?? true; - return new Promise((resolve, reject) => { - const req = new AttachDocumentRequest(); - req.clientId = this.id!; - req.changePack = converter.toChangePack(doc.createChangePack()); - - this.rpcClient.attachDocument( - req, - { headers: {"x-shard-key": `${this.apiKey}/${doc.getKey()}`}}, - ).then((res) => { + return this.rpcClient + .attachDocument( + { + clientId: this.id!, + changePack: converter.toChangePack(doc.createChangePack()), + }, + { + headers: { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, + }, + ) + .then((res) => { const pack = converter.fromChangePack

(res.changePack!); doc.applyChangePack(pack); if (doc.getStatus() !== DocumentStatus.Removed) { @@ -497,13 +488,12 @@ export class Client implements Observable { } logger.info(`[AD] c:"${this.getKey()}" attaches d:"${doc.getKey()}"`); - resolve(doc); - }).catch((err) => { + return doc; + }) + .catch((err) => { logger.error(`[AD] c:"${this.getKey()}" err :`, err); - reject(err); - return; + throw err; }); - }); } /** @@ -532,17 +522,19 @@ export class Client implements Observable { } doc.update((_, p) => p.clear()); - return new Promise((resolve, reject) => { - const req = new DetachDocumentRequest(); - req.clientId = this.id!; - req.documentId = attachment.docID; - req.changePack = converter.toChangePack(doc.createChangePack()); - req.removeIfNotAttached = options.removeIfNotAttached ?? false; - - this.rpcClient.detachDocument( - req, - { headers: {"x-shard-key": `${this.apiKey}/${doc.getKey()}`}}, - ).then((res) => { + 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) { @@ -551,13 +543,12 @@ export class Client implements Observable { this.detachInternal(doc.getKey()); logger.info(`[DD] c:"${this.getKey()}" detaches d:"${doc.getKey()}"`); - resolve(doc); - }).catch((err) => { + return doc; + }) + .catch((err) => { logger.error(`[DD] c:"${this.getKey()}" err :`, err); - reject(err); - return; + throw err; }); - }); } /** @@ -712,30 +703,31 @@ export class Client implements Observable { ); } doc.setActor(this.id!); - return new Promise((resolve, reject) => { - const req = new RemoveDocumentRequest(); - req.clientId = this.id!; - req.documentId = attachment.docID; - const pbChangePack = converter.toChangePack(doc.createChangePack()); - pbChangePack.isRemoved = true; - req.changePack = pbChangePack; - - this.rpcClient.removeDocument( - req, - { headers: {"x-shard-key": `${this.apiKey}/${doc.getKey()}`}}, - ).then((res) => { + + 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()}"`); - resolve(); - }).catch((err) => { + }) + .catch((err) => { logger.error(`[RD] c:"${this.getKey()}" err :`, err); - reject(err); - return; + throw err; }); - }); } /** @@ -822,7 +814,10 @@ export class Client implements Observable { } return attachment.runWatchLoop( - (onDisconnect: () => void, abort: AbortController): Promise => { + ( + onDisconnect: () => void, + abort: AbortController, + ): Promise => { if (!this.isActive()) { throw new YorkieError( Code.ClientNotActive, @@ -830,13 +825,16 @@ export class Client implements Observable { ); } - const req = new WatchDocumentRequest(); - req.clientId = this.id!; - req.documentId = attachment.docID; - const stream = this.rpcClient.watchDocument(req, { - headers: {"x-shard-key": `${this.apiKey}/${docKey}`}, - signal: abort.signal, - }); + const stream = this.rpcClient.watchDocument( + { + clientId: this.id!, + documentId: attachment.docID, + }, + { + headers: { 'x-shard-key': `${this.apiKey}/${docKey}` }, + signal: abort.signal, + }, + ); this.eventStreamObserver.next({ type: ClientEventType.StreamConnectionStatusChanged, @@ -845,27 +843,28 @@ export class Client implements Observable { logger.info(`[WD] c:"${this.getKey()}" watches d:"${docKey}"`); return new Promise((resolve, reject) => { - const onStreamDisconnect = (): void => { - this.eventStreamObserver.next({ - type: ClientEventType.StreamConnectionStatusChanged, - value: StreamConnectionStatus.Disconnected, - }); - logger.debug(`[WD] c:"${this.getKey()}" unwatches`); - onDisconnect(); - }; - const handleStream = async () => { try { for await (const resp of stream) { this.handleWatchDocumentsResponse(attachment, resp); - resolve(stream); + + // TODO(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); + } } } catch (err) { if (err instanceof ConnectError) { - onStreamDisconnect(); - } else { - reject(err); + this.eventStreamObserver.next({ + type: ClientEventType.StreamConnectionStatusChanged, + value: StreamConnectionStatus.Disconnected, + }); + logger.debug(`[WD] c:"${this.getKey()}" unwatches`); + onDisconnect(); } + + reject(err); } }; @@ -880,7 +879,7 @@ export class Client implements Observable { resp: WatchDocumentResponse, ) { const docKey = attachment.doc.getKey(); - if (resp.body.case === "initialization") { + if (resp.body.case === 'initialization') { const clientIDs = resp.body.value.clientIds; const onlineClients: Set = new Set(); for (const clientID of clientIDs) { @@ -892,7 +891,7 @@ export class Client implements Observable { value: attachment.doc.getPresences(), }); return; - } else if(resp.body.case === "event") { + } else if (resp.body.case === 'event') { const pbWatchEvent = resp.body.value; const eventType = pbWatchEvent.type; const publisher = pbWatchEvent.publisher; @@ -961,59 +960,52 @@ export class Client implements Observable { syncMode: SyncMode, ): Promise> { const { doc, docID } = attachment; - return new Promise((resolve, reject) => { - const req = new PushPullChangesRequest(); - req.clientId = this.id!; - req.documentId = docID; - const reqPack = doc.createChangePack(); - const localSize = reqPack.getChangeSize(); - req.changePack = converter.toChangePack(reqPack); - req.pushOnly = syncMode === SyncMode.PushOnly; - - let isRejected = false; - this.rpcClient - .pushPullChanges( - req, - { 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.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 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()}`, - ); - }).catch((err) => { - logger.error(`[PP] c:"${this.getKey()}" err :`, err); - - isRejected = true; - reject(err); - return; - }).finally(() => { - 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; + }); } } From ca54c149cc31fcbf308f0eef54e5f6e933395fd5 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Wed, 13 Dec 2023 09:53:35 +0900 Subject: [PATCH 12/21] Fix failures in presence tests --- src/api/converter.ts | 119 ++++++++++++------------------ src/client/attachment.ts | 32 +++++--- src/client/client.ts | 69 ++++++++--------- test/integration/presence_test.ts | 83 +++++++++------------ 4 files changed, 135 insertions(+), 168 deletions(-) diff --git a/src/api/converter.ts b/src/api/converter.ts index 163dc3d23..0ab8e60cc 100644 --- a/src/api/converter.ts +++ b/src/api/converter.ts @@ -310,7 +310,7 @@ function toOperation(operation: Operation): PbOperation { pbSetOperation.key = setOperation.getKey(); pbSetOperation.value = toElementSimple(setOperation.getValue()); pbSetOperation.executedAt = toTimeTicket(setOperation.getExecutedAt()); - pbOperation.body.case = "set"; + pbOperation.body.case = 'set'; pbOperation.body.value = pbSetOperation; } else if (operation instanceof AddOperation) { const addOperation = operation as AddOperation; @@ -323,7 +323,7 @@ function toOperation(operation: Operation): PbOperation { ); pbAddOperation.value = toElementSimple(addOperation.getValue()); pbAddOperation.executedAt = toTimeTicket(addOperation.getExecutedAt()); - pbOperation.body.case = "add"; + pbOperation.body.case = 'add'; pbOperation.body.value = pbAddOperation; } else if (operation instanceof MoveOperation) { const moveOperation = operation as MoveOperation; @@ -336,7 +336,7 @@ function toOperation(operation: Operation): PbOperation { ); pbMoveOperation.createdAt = toTimeTicket(moveOperation.getCreatedAt()); pbMoveOperation.executedAt = toTimeTicket(moveOperation.getExecutedAt()); - pbOperation.body.case = "move"; + pbOperation.body.case = 'move'; pbOperation.body.value = pbMoveOperation; } else if (operation instanceof RemoveOperation) { const removeOperation = operation as RemoveOperation; @@ -344,13 +344,11 @@ function toOperation(operation: Operation): PbOperation { pbRemoveOperation.parentCreatedAt = toTimeTicket( removeOperation.getParentCreatedAt(), ); - pbRemoveOperation.createdAt = toTimeTicket( - removeOperation.getCreatedAt(), - ); + pbRemoveOperation.createdAt = toTimeTicket(removeOperation.getCreatedAt()); pbRemoveOperation.executedAt = toTimeTicket( removeOperation.getExecutedAt(), ); - pbOperation.body.case = "remove"; + pbOperation.body.case = 'remove'; pbOperation.body.value = pbRemoveOperation; } else if (operation instanceof EditOperation) { const editOperation = operation as EditOperation; @@ -358,9 +356,7 @@ function toOperation(operation: Operation): PbOperation { pbEditOperation.parentCreatedAt = toTimeTicket( editOperation.getParentCreatedAt(), ); - pbEditOperation.from = toTextNodePos( - editOperation.getFromPos(), - ); + pbEditOperation.from = toTextNodePos(editOperation.getFromPos()); pbEditOperation.to = toTextNodePos(editOperation.getToPos()); const pbCreatedAtMapByActor = pbEditOperation.createdAtMapByActor; for (const [key, value] of editOperation.getMaxCreatedAtMapByActor()) { @@ -372,7 +368,7 @@ function toOperation(operation: Operation): PbOperation { pbAttributes[key] = value; } pbEditOperation.executedAt = toTimeTicket(editOperation.getExecutedAt()); - pbOperation.body.case = "edit"; + pbOperation.body.case = 'edit'; pbOperation.body.value = pbEditOperation; } else if (operation instanceof StyleOperation) { const styleOperation = operation as StyleOperation; @@ -390,10 +386,8 @@ function toOperation(operation: Operation): PbOperation { for (const [key, value] of styleOperation.getAttributes()) { pbAttributes[key] = value; } - pbStyleOperation.executedAt = toTimeTicket( - styleOperation.getExecutedAt(), - ); - pbOperation.body.case = "style"; + pbStyleOperation.executedAt = toTimeTicket(styleOperation.getExecutedAt()); + pbOperation.body.case = 'style'; pbOperation.body.value = pbStyleOperation; } else if (operation instanceof IncreaseOperation) { const increaseOperation = operation as IncreaseOperation; @@ -405,13 +399,12 @@ function toOperation(operation: Operation): PbOperation { pbIncreaseOperation.executedAt = toTimeTicket( increaseOperation.getExecutedAt(), ); - pbOperation.body.case = "increase"; + pbOperation.body.case = 'increase'; pbOperation.body.value = pbIncreaseOperation; } else if (operation instanceof TreeEditOperation) { const treeEditOperation = operation as TreeEditOperation; const pbTreeEditOperation = new Operation_TreeEdit(); - const pbCreatedAtMapByActor = - pbTreeEditOperation.createdAtMapByActor; + const pbCreatedAtMapByActor = pbTreeEditOperation.createdAtMapByActor; for (const [key, value] of treeEditOperation.getMaxCreatedAtMapByActor()) { pbCreatedAtMapByActor[key] = toTimeTicket(value)!; } @@ -428,7 +421,7 @@ function toOperation(operation: Operation): PbOperation { pbTreeEditOperation.executedAt = toTimeTicket( treeEditOperation.getExecutedAt(), ); - pbOperation.body.case = "treeEdit"; + pbOperation.body.case = 'treeEdit'; pbOperation.body.value = pbTreeEditOperation; } else if (operation instanceof TreeStyleOperation) { const treeStyleOperation = operation as TreeStyleOperation; @@ -447,7 +440,7 @@ function toOperation(operation: Operation): PbOperation { pbTreeStyleOperation.executedAt = toTimeTicket( treeStyleOperation.getExecutedAt(), ); - pbOperation.body.case = "treeStyle"; + pbOperation.body.case = 'treeStyle'; pbOperation.body.value = pbTreeStyleOperation; } else { throw new YorkieError(Code.Unimplemented, 'unimplemented operation'); @@ -626,7 +619,7 @@ function toObject(obj: CRDTObject): PbJSONElement { pbObject.removedAt = toTimeTicket(obj.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.body.case = "jsonObject"; + pbElement.body.case = 'jsonObject'; pbElement.body.value = pbObject; return pbElement; } @@ -642,7 +635,7 @@ function toArray(arr: CRDTArray): PbJSONElement { pbArray.removedAt = toTimeTicket(arr.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.body.case = "jsonArray"; + pbElement.body.case = 'jsonArray'; pbElement.body.value = pbArray; return pbElement; } @@ -659,7 +652,7 @@ function toPrimitive(primitive: Primitive): PbJSONElement { pbPrimitive.removedAt = toTimeTicket(primitive.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.body.case = "primitive"; + pbElement.body.case = 'primitive'; pbElement.body.value = pbPrimitive; return pbElement; } @@ -675,7 +668,7 @@ function toText(text: CRDTText>): PbJSONElement { pbText.removedAt = toTimeTicket(text.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.body.case = "text"; + pbElement.body.case = 'text'; pbElement.body.value = pbText; return pbElement; } @@ -692,7 +685,7 @@ function toCounter(counter: CRDTCounter): PbJSONElement { pbCounter.removedAt = toTimeTicket(counter.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.body.case = "counter" + pbElement.body.case = 'counter'; pbElement.body.value = pbCounter; return pbElement; } @@ -708,7 +701,7 @@ function toTree(tree: CRDTTree): PbJSONElement { pbTree.removedAt = toTimeTicket(tree.getRemovedAt()); const pbElement = new PbJSONElement(); - pbElement.body.case = "tree"; + pbElement.body.case = 'tree'; pbElement.body.value = pbTree; return pbElement; } @@ -812,9 +805,9 @@ function fromPresenceChange

( /** * `fromPresences` converts the given Protobuf format to model format. */ -function fromPresences

( - pbPresences: { [key: string]: Presence }, -): Map { +function fromPresences

(pbPresences: { + [key: string]: Presence; +}): Map { const presences = new Map(); Object.entries(pbPresences).forEach(([actorID, pbPresence]) => { presences.set(actorID, fromPresence(pbPresence)); @@ -873,16 +866,12 @@ function fromElementSimple(pbElementSimple: PbJSONElementSimple): CRDTElement { switch (pbElementSimple.type) { case PbValueType.JSON_OBJECT: if (!pbElementSimple.value) { - return CRDTObject.create( - fromTimeTicket(pbElementSimple.createdAt)!, - ); + return CRDTObject.create(fromTimeTicket(pbElementSimple.createdAt)!); } return bytesToObject(pbElementSimple.value); case PbValueType.JSON_ARRAY: if (!pbElementSimple.value) { - return CRDTArray.create( - fromTimeTicket(pbElementSimple.createdAt)!, - ); + return CRDTArray.create(fromTimeTicket(pbElementSimple.createdAt)!); } return bytesToArray(pbElementSimple.value); case PbValueType.TEXT: @@ -949,11 +938,7 @@ function fromTextNodeID(pbTextNodeID: PbTextNodeID): RGATreeSplitNodeID { function fromTextNode(pbTextNode: PbTextNode): RGATreeSplitNode { const textValue = CRDTTextValue.create(pbTextNode.value); Object.entries(pbTextNode.attributes).forEach(([key, value]) => { - textValue.setAttr( - key, - value.value, - fromTimeTicket(value.updatedAt)!, - ); + textValue.setAttr(key, value.value, fromTimeTicket(value.updatedAt)!); }); const textNode = RGATreeSplitNode.create( @@ -1072,7 +1057,7 @@ function fromOperations(pbOperations: Array): Array { for (const pbOperation of pbOperations) { let operation: Operation; - if (pbOperation.body.case === "set") { + if (pbOperation.body.case === 'set') { const pbSetOperation = pbOperation.body.value; operation = SetOperation.create( pbSetOperation!.key, @@ -1080,7 +1065,7 @@ function fromOperations(pbOperations: Array): Array { fromTimeTicket(pbSetOperation!.parentCreatedAt)!, fromTimeTicket(pbSetOperation!.executedAt)!, ); - } else if (pbOperation.body.case === "add") { + } else if (pbOperation.body.case === 'add') { const pbAddOperation = pbOperation.body.value; operation = AddOperation.create( fromTimeTicket(pbAddOperation!.parentCreatedAt)!, @@ -1088,7 +1073,7 @@ function fromOperations(pbOperations: Array): Array { fromElementSimple(pbAddOperation!.value!), fromTimeTicket(pbAddOperation!.executedAt)!, ); - } else if (pbOperation.body.case === "move") { + } else if (pbOperation.body.case === 'move') { const pbMoveOperation = pbOperation.body.value; operation = MoveOperation.create( fromTimeTicket(pbMoveOperation!.parentCreatedAt)!, @@ -1096,14 +1081,14 @@ function fromOperations(pbOperations: Array): Array { fromTimeTicket(pbMoveOperation!.createdAt)!, fromTimeTicket(pbMoveOperation!.executedAt)!, ); - } else if (pbOperation.body.case === "remove") { + } else if (pbOperation.body.case === 'remove') { const pbRemoveOperation = pbOperation.body.value; operation = RemoveOperation.create( fromTimeTicket(pbRemoveOperation!.parentCreatedAt)!, fromTimeTicket(pbRemoveOperation!.createdAt)!, fromTimeTicket(pbRemoveOperation!.executedAt)!, ); - } else if (pbOperation.body.case === "edit") { + } else if (pbOperation.body.case === 'edit') { const pbEditOperation = pbOperation.body.value; const createdAtMapByActor = new Map(); Object.entries(pbEditOperation!.createdAtMapByActor).forEach( @@ -1124,7 +1109,7 @@ function fromOperations(pbOperations: Array): Array { attributes, fromTimeTicket(pbEditOperation!.executedAt)!, ); - } else if (pbOperation.body.case === "style") { + } else if (pbOperation.body.case === 'style') { const pbStyleOperation = pbOperation.body.value; const createdAtMapByActor = new Map(); Object.entries(pbStyleOperation!.createdAtMapByActor).forEach( @@ -1144,23 +1129,24 @@ function fromOperations(pbOperations: Array): Array { attributes, fromTimeTicket(pbStyleOperation!.executedAt)!, ); - } else if (pbOperation.body.case === "select") { + } else if (pbOperation.body.case === 'select') { // TODO(hackerwins): Select is deprecated. continue; - } else if (pbOperation.body.case === "increase") { + } else if (pbOperation.body.case === 'increase') { const pbIncreaseOperation = pbOperation.body.value; operation = IncreaseOperation.create( fromTimeTicket(pbIncreaseOperation!.parentCreatedAt)!, fromElementSimple(pbIncreaseOperation!.value!), fromTimeTicket(pbIncreaseOperation!.executedAt)!, ); - } else if (pbOperation.body.case === "treeEdit") { + } else if (pbOperation.body.case === 'treeEdit') { const pbTreeEditOperation = pbOperation.body.value; const createdAtMapByActor = new Map(); Object.entries(pbTreeEditOperation!.createdAtMapByActor).forEach( ([key, value]) => { createdAtMapByActor.set(key, fromTimeTicket(value)); - }); + }, + ); operation = TreeEditOperation.create( fromTimeTicket(pbTreeEditOperation!.parentCreatedAt)!, fromTreePos(pbTreeEditOperation!.from!), @@ -1170,14 +1156,15 @@ function fromOperations(pbOperations: Array): Array { createdAtMapByActor, fromTimeTicket(pbTreeEditOperation!.executedAt)!, ); - } else if (pbOperation.body.case === "treeStyle") { + } else if (pbOperation.body.case === 'treeStyle') { const pbTreeStyleOperation = pbOperation.body.value; const attributes = new Map(); Object.entries(pbTreeStyleOperation!.attributes).forEach( ([key, value]) => { - attributes.set(key, value); - }); + attributes.set(key, value); + }, + ); operation = TreeStyleOperation.create( fromTimeTicket(pbTreeStyleOperation!.parentCreatedAt)!, fromTreePos(pbTreeStyleOperation!.from!), @@ -1271,10 +1258,7 @@ function fromArray(pbArray: JSONElement_JSONArray): CRDTArray { rgaTreeList.insert(fromElement(pbRGANode.element!)); } - const arr = new CRDTArray( - fromTimeTicket(pbArray.createdAt)!, - rgaTreeList, - ); + const arr = new CRDTArray(fromTimeTicket(pbArray.createdAt)!, rgaTreeList); arr.setMovedAt(fromTimeTicket(pbArray.movedAt)); arr.setRemovedAt(fromTimeTicket(pbArray.removedAt)); return arr; @@ -1299,9 +1283,7 @@ function fromPrimitive(pbPrimitive: JSONElement_Primitive): Primitive { /** * `fromText` converts the given Protobuf format to model format. */ -function fromText( - pbText: JSONElement_Text, -): CRDTText { +function fromText(pbText: JSONElement_Text): CRDTText { const rgaTreeSplit = new RGATreeSplit(); let prev = rgaTreeSplit.getHead(); @@ -1314,10 +1296,7 @@ function fromText( } prev = current; } - const text = new CRDTText( - rgaTreeSplit, - fromTimeTicket(pbText.createdAt)!, - ); + const text = new CRDTText(rgaTreeSplit, fromTimeTicket(pbText.createdAt)!); text.setMovedAt(fromTimeTicket(pbText.movedAt)); text.setRemovedAt(fromTimeTicket(pbText.removedAt)); return text; @@ -1352,17 +1331,17 @@ function fromTree(pbTree: JSONElement_Tree): CRDTTree { * `fromElement` converts the given Protobuf format to model format. */ function fromElement(pbElement: PbJSONElement): CRDTElement { - if (pbElement.body.case === "jsonObject") { + if (pbElement.body.case === 'jsonObject') { return fromObject(pbElement.body.value!); - } else if (pbElement.body.case === "jsonArray") { + } else if (pbElement.body.case === 'jsonArray') { return fromArray(pbElement.body.value!); - } else if (pbElement.body.case === "primitive") { + } else if (pbElement.body.case === 'primitive') { return fromPrimitive(pbElement.body.value!); - } else if (pbElement.body.case === "text") { + } else if (pbElement.body.case === 'text') { return fromText(pbElement.body.value!); - } else if (pbElement.body.case === "counter") { + } else if (pbElement.body.case === 'counter') { return fromCounter(pbElement.body.value!); - } else if (pbElement.body.case === "tree") { + } else if (pbElement.body.case === 'tree') { return fromTree(pbElement.body.value!); } else { throw new YorkieError(Code.Unimplemented, `unimplemented element`); diff --git a/src/client/attachment.ts b/src/client/attachment.ts index a7eb85785..12cc58228 100644 --- a/src/client/attachment.ts +++ b/src/client/attachment.ts @@ -20,7 +20,7 @@ export class Attachment { watchStream?: WatchStream; watchLoopTimerID?: ReturnType; - watchAbort: AbortController; + watchAbortController?: AbortController; constructor( reconnectStreamDelay: number, @@ -34,7 +34,6 @@ export class Attachment { this.isRealtimeSync = isRealtimeSync; this.syncMode = SyncMode.PushPull; this.remoteChangeEventReceived = false; - this.watchAbort = new AbortController(); } /** @@ -76,7 +75,7 @@ export class Attachment { * `runWatchLoop` runs the watch loop. */ public async runWatchLoop( - watchStreamCreator: (onDisconnect: () => void, abort: AbortController) => Promise, + watchStreamCreator: (onDisconnect: () => void) => Promise, ): Promise { const doLoop = async (): Promise => { if (this.watchStream) { @@ -87,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, this.watchAbort); + 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(); @@ -102,9 +111,10 @@ export class Attachment { * `cancelWatchStream` cancels the watch stream. */ public cancelWatchStream(): void { - if (this.watchStream && this.watchAbort) { - this.watchAbort.abort(); + 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/client.ts b/src/client/client.ts index aa632c304..2be963abd 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -24,11 +24,7 @@ import { CompleteFn, NextFn, } from '@yorkie-js-sdk/src/util/observable'; -import { - ConnectError, - createPromiseClient, - PromiseClient, -} from '@connectrpc/connect'; +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'; @@ -467,24 +463,26 @@ export class Client implements Observable { headers: { 'x-shard-key': `${this.apiKey}/${doc.getKey()}` }, }, ) - .then((res) => { + .then(async (res) => { const pack = converter.fromChangePack

(res.changePack!); doc.applyChangePack(pack); - if (doc.getStatus() !== DocumentStatus.Removed) { - doc.setStatus(DocumentStatus.Attached); - this.attachmentMap.set( - doc.getKey(), - new Attachment( - this.reconnectStreamDelay, - doc, - res.documentId, - isRealtimeSync, - ), - ); + if (doc.getStatus() === DocumentStatus.Removed) { + return doc; + } - if (isRealtimeSync) { - this.runWatchLoop(doc.getKey()); - } + doc.setStatus(DocumentStatus.Attached); + this.attachmentMap.set( + doc.getKey(), + new Attachment( + this.reconnectStreamDelay, + doc, + res.documentId, + isRealtimeSync, + ), + ); + + if (isRealtimeSync) { + await this.runWatchLoop(doc.getKey()); } logger.info(`[AD] c:"${this.getKey()}" attaches d:"${doc.getKey()}"`); @@ -814,17 +812,14 @@ export class Client implements Observable { } return attachment.runWatchLoop( - ( - onDisconnect: () => void, - abort: AbortController, - ): 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 ac = new AbortController(); const stream = this.rpcClient.watchDocument( { clientId: this.id!, @@ -832,7 +827,7 @@ export class Client implements Observable { }, { headers: { 'x-shard-key': `${this.apiKey}/${docKey}` }, - signal: abort.signal, + signal: ac.signal, }, ); @@ -848,21 +843,19 @@ export class Client implements Observable { for await (const resp of stream) { this.handleWatchDocumentsResponse(attachment, resp); - // TODO(hackerwins): When the first response is received, we need to + // 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); + resolve([stream, ac]); } } } catch (err) { - if (err instanceof ConnectError) { - this.eventStreamObserver.next({ - type: ClientEventType.StreamConnectionStatusChanged, - value: StreamConnectionStatus.Disconnected, - }); - logger.debug(`[WD] c:"${this.getKey()}" unwatches`); - onDisconnect(); - } + this.eventStreamObserver.next({ + type: ClientEventType.StreamConnectionStatusChanged, + value: StreamConnectionStatus.Disconnected, + }); + logger.debug(`[WD] c:"${this.getKey()}" unwatches`); + onDisconnect(); reject(err); } diff --git a/test/integration/presence_test.ts b/test/integration/presence_test.ts index 660c41572..cd1949ac2 100644 --- a/test/integration/presence_test.ts +++ b/test/integration/presence_test.ts @@ -10,7 +10,7 @@ import { } from '@yorkie-js-sdk/test/integration/integration_helper'; import { EventCollector, deepSort } from '@yorkie-js-sdk/test/helper/helper'; -describe.skip('Presence', function () { +describe('Presence', function () { afterEach(() => { vi.restoreAllMocks(); }); @@ -114,43 +114,38 @@ describe.skip('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' } }, }); @@ -313,7 +308,7 @@ describe.skip('Presence', function () { }); }); -describe.skip(`Document.Subscribe('presence')`, function () { +describe(`Document.Subscribe('presence')`, function () { it(`Should receive presence-changed event for final presence if there are multiple presence changes within doc.update`, async function ({ task, }) { @@ -423,6 +418,9 @@ describe.skip(`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.skip(`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.skip(`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.skip(`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.skip(`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.skip(`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.skip(`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.skip(`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.skip(`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, @@ -549,7 +534,7 @@ describe.skip(`Document.Subscribe('presence')`, function () { }); }); -describe.skip('Undo/Redo', function () { +describe('Undo/Redo', function () { it('Can undo/redo with presence', async function ({ task }) { type TestDoc = { counter: Counter }; type Presence = { color: string }; From 82eb28ba74a38fa8e7ede8fde82ca94841d33d19 Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Wed, 13 Dec 2023 12:34:07 +0900 Subject: [PATCH 13/21] Temporary set envoy setting with gRPC-web on ConnectRPC server --- docker/docker-compose-ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/docker-compose-ci.yml b/docker/docker-compose-ci.yml index 0e733303d..bbc2a665f 100644 --- a/docker/docker-compose-ci.yml +++ b/docker/docker-compose-ci.yml @@ -15,10 +15,14 @@ services: depends_on: - yorkie yorkie: - image: 'yorkieteam/yorkie:latest' + image: 'krapi0314/yorkie:test' container_name: 'yorkie' command: [ 'server', + "--rpc-port", + '11101', + "--profiling-port", + '11102', '--mongo-connection-uri', 'mongodb://mongo:27017', ] From db3386b1e416e130e471d212b6865cc14335f64b Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Wed, 13 Dec 2023 13:08:57 +0900 Subject: [PATCH 14/21] Revert to ConnectRPC server settings --- docker/docker-compose-ci.yml | 21 ++----------- docker/envoy-ci.yaml | 54 --------------------------------- docker/envoy.Dockerfile | 8 ----- docker/envoy.yaml | 59 ------------------------------------ 4 files changed, 2 insertions(+), 140 deletions(-) delete mode 100644 docker/envoy-ci.yaml delete mode 100644 docker/envoy.Dockerfile delete mode 100644 docker/envoy.yaml diff --git a/docker/docker-compose-ci.yml b/docker/docker-compose-ci.yml index bbc2a665f..b988a838d 100644 --- a/docker/docker-compose-ci.yml +++ b/docker/docker-compose-ci.yml @@ -1,35 +1,18 @@ 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: 'krapi0314/yorkie:test' container_name: 'yorkie' command: [ 'server', - "--rpc-port", - '11101', - "--profiling-port", - '11102', '--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/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 From 2b52110a5664f20682ebba0a6e57dcc943426657 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Wed, 13 Dec 2023 14:35:07 +0900 Subject: [PATCH 15/21] Clean up yorkie.proto and remove grpc-web from package.json --- package-lock.json | 2 - package.json | 2 - src/api/yorkie/v1/resources.proto | 719 +++++++++++++++--------------- src/api/yorkie/v1/yorkie.proto | 217 +++++---- 4 files changed, 467 insertions(+), 473 deletions(-) diff --git a/package-lock.json b/package-lock.json index 56eedbdf1..bd950b041 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,8 +16,6 @@ "@bufbuild/protobuf": "^1.4.2", "@connectrpc/connect": "^1.1.3", "@connectrpc/connect-web": "^1.1.3", - "google-protobuf": "^3.19.4", - "grpc-web": "^1.3.1", "long": "^5.2.0" }, "devDependencies": { diff --git a/package.json b/package.json index 72e125354..1fd5ff638 100644 --- a/package.json +++ b/package.json @@ -91,8 +91,6 @@ "@bufbuild/protobuf": "^1.4.2", "@connectrpc/connect": "^1.1.3", "@connectrpc/connect-web": "^1.1.3", - "google-protobuf": "^3.19.4", - "grpc-web": "^1.3.1", "long": "^5.2.0" }, "husky": { diff --git a/src/api/yorkie/v1/resources.proto b/src/api/yorkie/v1/resources.proto index 3186d6f75..b98bd59bc 100644 --- a/src/api/yorkie/v1/resources.proto +++ b/src/api/yorkie/v1/resources.proto @@ -13,363 +13,362 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - syntax = "proto3"; - - package yorkie.v1; - - import "google/protobuf/timestamp.proto"; - import "google/protobuf/wrappers.proto"; - - option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; - - option java_multiple_files = true; - option java_package = "dev.yorkie.api.v1"; - - ///////////////////////////////////////// - // Messages for Snapshot // - ///////////////////////////////////////// - message Snapshot { - JSONElement root = 1; - map presences = 2; - } - - ///////////////////////////////////////// - // Messages for ChangePack // - ///////////////////////////////////////// - - // ChangePack is a message that contains all changes that occurred in a document. - // It is used to synchronize changes between clients and servers. - message ChangePack { - string document_key = 1; - Checkpoint checkpoint = 2; - bytes snapshot = 3; - repeated Change changes = 4; - TimeTicket min_synced_ticket = 5; - bool is_removed = 6; - } - - message Change { - ChangeID id = 1; - string message = 2; - repeated Operation operations = 3; - PresenceChange presence_change = 4; - } - - message ChangeID { - uint32 client_seq = 1; - int64 server_seq = 2 [jstype = JS_STRING]; - int64 lamport = 3 [jstype = JS_STRING]; - bytes actor_id = 4; - } - - message Operation { - message Set { - TimeTicket parent_created_at = 1; - string key = 2; - JSONElementSimple value = 3; - TimeTicket executed_at = 4; - } - message Add { - TimeTicket parent_created_at = 1; - TimeTicket prev_created_at = 2; - JSONElementSimple value = 3; - TimeTicket executed_at = 4; - } - message Move { - TimeTicket parent_created_at = 1; - TimeTicket prev_created_at = 2; - TimeTicket created_at = 3; - TimeTicket executed_at = 4; - } - message Remove { - TimeTicket parent_created_at = 1; - TimeTicket created_at = 2; - TimeTicket executed_at = 3; - } - message Edit { - TimeTicket parent_created_at = 1; - TextNodePos from = 2; - TextNodePos to = 3; - map created_at_map_by_actor = 4; - string content = 5; - TimeTicket executed_at = 6; - map attributes = 7; - } - // NOTE(hackerwins): Select Operation is not used in the current version. - // In the previous version, it was used to represent selection of Text. - // However, it has been replaced by Presence now. It is retained for backward - // compatibility purposes. - message Select { - TimeTicket parent_created_at = 1; - TextNodePos from = 2; - TextNodePos to = 3; - TimeTicket executed_at = 4; - } - message Style { - TimeTicket parent_created_at = 1; - TextNodePos from = 2; - TextNodePos to = 3; - map attributes = 4; - TimeTicket executed_at = 5; - map created_at_map_by_actor = 6; - } - message Increase { - TimeTicket parent_created_at = 1; - JSONElementSimple value = 2; - TimeTicket executed_at = 3; - } - message TreeEdit { - TimeTicket parent_created_at = 1; - TreePos from = 2; - TreePos to = 3; - map created_at_map_by_actor = 4; - repeated TreeNodes contents = 5; - int32 split_level = 7; - TimeTicket executed_at = 6; - } - message TreeStyle { - TimeTicket parent_created_at = 1; - TreePos from = 2; - TreePos to = 3; - map attributes = 4; - TimeTicket executed_at = 5; - } - - oneof body { - Set set = 1; - Add add = 2; - Move move = 3; - Remove remove = 4; - Edit edit = 5; - Select select = 6; - Style style = 7; - Increase increase = 8; - TreeEdit tree_edit = 9; - TreeStyle tree_style = 10; - } - } - - message JSONElementSimple { - TimeTicket created_at = 1; - TimeTicket moved_at = 2; - TimeTicket removed_at = 3; - ValueType type = 4; - bytes value = 5; - } - - ///////////////////////////////////////// - // Messages for JSON // - ///////////////////////////////////////// - - message JSONElement { - message JSONObject { - repeated RHTNode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - message JSONArray { - repeated RGANode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - message Primitive { - ValueType type = 1; - bytes value = 2; - TimeTicket created_at = 3; - TimeTicket moved_at = 4; - TimeTicket removed_at = 5; - } - message Text { - repeated TextNode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - message Counter { - ValueType type = 1; - bytes value = 2; - TimeTicket created_at = 3; - TimeTicket moved_at = 4; - TimeTicket removed_at = 5; - } - message Tree { - repeated TreeNode nodes = 1; - TimeTicket created_at = 2; - TimeTicket moved_at = 3; - TimeTicket removed_at = 4; - } - - oneof body { - JSONObject json_object = 1; - JSONArray json_array = 2; - Primitive primitive = 3; - Text text = 5; - Counter counter = 6; - Tree tree = 7; - } - } - - message RHTNode { - string key = 1; - JSONElement element = 2; - } - - message RGANode { - RGANode next = 1; - JSONElement element = 2; - } - - message NodeAttr { - string value = 1; - TimeTicket updated_at = 2; - } - - message TextNode { - TextNodeID id = 1; - string value = 2; - TimeTicket removed_at = 3; - TextNodeID ins_prev_id = 4; - map attributes = 5; - } - - message TextNodeID { - TimeTicket created_at = 1; - int32 offset = 2; - } - - message TreeNode { - TreeNodeID id = 1; - string type = 2; - string value = 3; - TimeTicket removed_at = 4; - TreeNodeID ins_prev_id = 5; - TreeNodeID ins_next_id = 6; - int32 depth = 7; - map attributes = 8; - } - - message TreeNodes { - repeated TreeNode content = 1; - } - - message TreeNodeID { - TimeTicket created_at = 1; - int32 offset = 2; - } - - message TreePos { - TreeNodeID parent_id = 1; - TreeNodeID left_sibling_id = 2; - } - - ///////////////////////////////////////// - // Messages for Common // - ///////////////////////////////////////// - - message User { - string id = 1; - string username = 2; - google.protobuf.Timestamp created_at = 3; - } - - message Project { - string id = 1; - string name = 2; - string public_key = 3; - string secret_key = 4; - string auth_webhook_url = 5; - repeated string auth_webhook_methods = 6; - string client_deactivate_threshold = 7; - google.protobuf.Timestamp created_at = 8; - google.protobuf.Timestamp updated_at = 9; - } - - message UpdatableProjectFields { - message AuthWebhookMethods { - repeated string methods = 1; - } - - google.protobuf.StringValue name = 1; - google.protobuf.StringValue auth_webhook_url = 2; - AuthWebhookMethods auth_webhook_methods = 3; - google.protobuf.StringValue client_deactivate_threshold = 4; - } - - message DocumentSummary { - string id = 1; - string key = 2; - string snapshot = 3; - google.protobuf.Timestamp created_at = 4; - google.protobuf.Timestamp accessed_at = 5; - google.protobuf.Timestamp updated_at = 6; - } - - message PresenceChange { - enum ChangeType { - CHANGE_TYPE_UNSPECIFIED = 0; - CHANGE_TYPE_PUT = 1; - CHANGE_TYPE_DELETE = 2; - CHANGE_TYPE_CLEAR = 3; - } - ChangeType type = 1; - Presence presence = 2; - } - - message Presence { - map data = 1; - } - - message Checkpoint { - int64 server_seq = 1 [jstype = JS_STRING]; - uint32 client_seq = 2; - } - - message TextNodePos { - TimeTicket created_at = 1; - int32 offset = 2; - int32 relative_offset = 3; - } - - message TimeTicket { - int64 lamport = 1 [jstype = JS_STRING]; - uint32 delimiter = 2; - bytes actor_id = 3; - } - - enum ValueType { - VALUE_TYPE_NULL = 0; - VALUE_TYPE_BOOLEAN = 1; - VALUE_TYPE_INTEGER = 2; - VALUE_TYPE_LONG = 3; - VALUE_TYPE_DOUBLE = 4; - VALUE_TYPE_STRING = 5; - VALUE_TYPE_BYTES = 6; - VALUE_TYPE_DATE = 7; - VALUE_TYPE_JSON_OBJECT = 8; - VALUE_TYPE_JSON_ARRAY = 9; - VALUE_TYPE_TEXT = 10; - VALUE_TYPE_INTEGER_CNT = 11; - VALUE_TYPE_LONG_CNT = 12; - VALUE_TYPE_TREE = 13; - } - - enum DocEventType { - DOC_EVENT_TYPE_DOCUMENT_CHANGED = 0; - DOC_EVENT_TYPE_DOCUMENT_WATCHED = 1; - DOC_EVENT_TYPE_DOCUMENT_UNWATCHED = 2; - DOC_EVENT_TYPE_DOCUMENT_BROADCAST = 3; - } - - message DocEventBody { - string topic = 1; - bytes payload = 2; - } - - message DocEvent { - DocEventType type = 1; - string publisher = 2; - DocEventBody body = 3; - } - \ No newline at end of file +syntax = "proto3"; + +package yorkie.v1; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; + +option java_multiple_files = true; +option java_package = "dev.yorkie.api.v1"; + +///////////////////////////////////////// +// Messages for Snapshot // +///////////////////////////////////////// +message Snapshot { + JSONElement root = 1; + map presences = 2; +} + +///////////////////////////////////////// +// Messages for ChangePack // +///////////////////////////////////////// + +// ChangePack is a message that contains all changes that occurred in a document. +// It is used to synchronize changes between clients and servers. +message ChangePack { + string document_key = 1; + Checkpoint checkpoint = 2; + bytes snapshot = 3; + repeated Change changes = 4; + TimeTicket min_synced_ticket = 5; + bool is_removed = 6; +} + +message Change { + ChangeID id = 1; + string message = 2; + repeated Operation operations = 3; + PresenceChange presence_change = 4; +} + +message ChangeID { + uint32 client_seq = 1; + int64 server_seq = 2 [jstype = JS_STRING]; + int64 lamport = 3 [jstype = JS_STRING]; + bytes actor_id = 4; +} + +message Operation { + message Set { + TimeTicket parent_created_at = 1; + string key = 2; + JSONElementSimple value = 3; + TimeTicket executed_at = 4; + } + message Add { + TimeTicket parent_created_at = 1; + TimeTicket prev_created_at = 2; + JSONElementSimple value = 3; + TimeTicket executed_at = 4; + } + message Move { + TimeTicket parent_created_at = 1; + TimeTicket prev_created_at = 2; + TimeTicket created_at = 3; + TimeTicket executed_at = 4; + } + message Remove { + TimeTicket parent_created_at = 1; + TimeTicket created_at = 2; + TimeTicket executed_at = 3; + } + message Edit { + TimeTicket parent_created_at = 1; + TextNodePos from = 2; + TextNodePos to = 3; + map created_at_map_by_actor = 4; + string content = 5; + TimeTicket executed_at = 6; + map attributes = 7; + } + // NOTE(hackerwins): Select Operation is not used in the current version. + // In the previous version, it was used to represent selection of Text. + // However, it has been replaced by Presence now. It is retained for backward + // compatibility purposes. + message Select { + TimeTicket parent_created_at = 1; + TextNodePos from = 2; + TextNodePos to = 3; + TimeTicket executed_at = 4; + } + message Style { + TimeTicket parent_created_at = 1; + TextNodePos from = 2; + TextNodePos to = 3; + map attributes = 4; + TimeTicket executed_at = 5; + map created_at_map_by_actor = 6; + } + message Increase { + TimeTicket parent_created_at = 1; + JSONElementSimple value = 2; + TimeTicket executed_at = 3; + } + message TreeEdit { + TimeTicket parent_created_at = 1; + TreePos from = 2; + TreePos to = 3; + map created_at_map_by_actor = 4; + repeated TreeNodes contents = 5; + int32 split_level = 7; + TimeTicket executed_at = 6; + } + message TreeStyle { + TimeTicket parent_created_at = 1; + TreePos from = 2; + TreePos to = 3; + map attributes = 4; + TimeTicket executed_at = 5; + } + + oneof body { + Set set = 1; + Add add = 2; + Move move = 3; + Remove remove = 4; + Edit edit = 5; + Select select = 6; + Style style = 7; + Increase increase = 8; + TreeEdit tree_edit = 9; + TreeStyle tree_style = 10; + } +} + +message JSONElementSimple { + TimeTicket created_at = 1; + TimeTicket moved_at = 2; + TimeTicket removed_at = 3; + ValueType type = 4; + bytes value = 5; +} + +///////////////////////////////////////// +// Messages for JSON // +///////////////////////////////////////// + +message JSONElement { + message JSONObject { + repeated RHTNode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + message JSONArray { + repeated RGANode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + message Primitive { + ValueType type = 1; + bytes value = 2; + TimeTicket created_at = 3; + TimeTicket moved_at = 4; + TimeTicket removed_at = 5; + } + message Text { + repeated TextNode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + message Counter { + ValueType type = 1; + bytes value = 2; + TimeTicket created_at = 3; + TimeTicket moved_at = 4; + TimeTicket removed_at = 5; + } + message Tree { + repeated TreeNode nodes = 1; + TimeTicket created_at = 2; + TimeTicket moved_at = 3; + TimeTicket removed_at = 4; + } + + oneof body { + JSONObject json_object = 1; + JSONArray json_array = 2; + Primitive primitive = 3; + Text text = 5; + Counter counter = 6; + Tree tree = 7; + } +} + +message RHTNode { + string key = 1; + JSONElement element = 2; +} + +message RGANode { + RGANode next = 1; + JSONElement element = 2; +} + +message NodeAttr { + string value = 1; + TimeTicket updated_at = 2; +} + +message TextNode { + TextNodeID id = 1; + string value = 2; + TimeTicket removed_at = 3; + TextNodeID ins_prev_id = 4; + map attributes = 5; +} + +message TextNodeID { + TimeTicket created_at = 1; + int32 offset = 2; +} + +message TreeNode { + TreeNodeID id = 1; + string type = 2; + string value = 3; + TimeTicket removed_at = 4; + TreeNodeID ins_prev_id = 5; + TreeNodeID ins_next_id = 6; + int32 depth = 7; + map attributes = 8; +} + +message TreeNodes { + repeated TreeNode content = 1; +} + +message TreeNodeID { + TimeTicket created_at = 1; + int32 offset = 2; +} + +message TreePos { + TreeNodeID parent_id = 1; + TreeNodeID left_sibling_id = 2; +} + +///////////////////////////////////////// +// Messages for Common // +///////////////////////////////////////// + +message User { + string id = 1; + string username = 2; + google.protobuf.Timestamp created_at = 3; +} + +message Project { + string id = 1; + string name = 2; + string public_key = 3; + string secret_key = 4; + string auth_webhook_url = 5; + repeated string auth_webhook_methods = 6; + string client_deactivate_threshold = 7; + google.protobuf.Timestamp created_at = 8; + google.protobuf.Timestamp updated_at = 9; +} + +message UpdatableProjectFields { + message AuthWebhookMethods { + repeated string methods = 1; + } + + google.protobuf.StringValue name = 1; + google.protobuf.StringValue auth_webhook_url = 2; + AuthWebhookMethods auth_webhook_methods = 3; + google.protobuf.StringValue client_deactivate_threshold = 4; +} + +message DocumentSummary { + string id = 1; + string key = 2; + string snapshot = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp accessed_at = 5; + google.protobuf.Timestamp updated_at = 6; +} + +message PresenceChange { + enum ChangeType { + CHANGE_TYPE_UNSPECIFIED = 0; + CHANGE_TYPE_PUT = 1; + CHANGE_TYPE_DELETE = 2; + CHANGE_TYPE_CLEAR = 3; + } + ChangeType type = 1; + Presence presence = 2; +} + +message Presence { + map data = 1; +} + +message Checkpoint { + int64 server_seq = 1 [jstype = JS_STRING]; + uint32 client_seq = 2; +} + +message TextNodePos { + TimeTicket created_at = 1; + int32 offset = 2; + int32 relative_offset = 3; +} + +message TimeTicket { + int64 lamport = 1 [jstype = JS_STRING]; + uint32 delimiter = 2; + bytes actor_id = 3; +} + +enum ValueType { + VALUE_TYPE_NULL = 0; + VALUE_TYPE_BOOLEAN = 1; + VALUE_TYPE_INTEGER = 2; + VALUE_TYPE_LONG = 3; + VALUE_TYPE_DOUBLE = 4; + VALUE_TYPE_STRING = 5; + VALUE_TYPE_BYTES = 6; + VALUE_TYPE_DATE = 7; + VALUE_TYPE_JSON_OBJECT = 8; + VALUE_TYPE_JSON_ARRAY = 9; + VALUE_TYPE_TEXT = 10; + VALUE_TYPE_INTEGER_CNT = 11; + VALUE_TYPE_LONG_CNT = 12; + VALUE_TYPE_TREE = 13; +} + +enum DocEventType { + DOC_EVENT_TYPE_DOCUMENT_CHANGED = 0; + DOC_EVENT_TYPE_DOCUMENT_WATCHED = 1; + DOC_EVENT_TYPE_DOCUMENT_UNWATCHED = 2; + DOC_EVENT_TYPE_DOCUMENT_BROADCAST = 3; +} + +message DocEventBody { + string topic = 1; + bytes payload = 2; +} + +message DocEvent { + DocEventType type = 1; + string publisher = 2; + DocEventBody body = 3; +} diff --git a/src/api/yorkie/v1/yorkie.proto b/src/api/yorkie/v1/yorkie.proto index 4e799ffa1..8ca20e120 100644 --- a/src/api/yorkie/v1/yorkie.proto +++ b/src/api/yorkie/v1/yorkie.proto @@ -13,112 +13,111 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - syntax = "proto3"; - - package yorkie.v1; - - import "src/api/yorkie/v1/resources.proto"; - - option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; - - option java_multiple_files = true; - option java_package = "dev.yorkie.api.v1"; - - // Yorkie is a service that provides a API for SDKs. - service YorkieService { - rpc ActivateClient (ActivateClientRequest) returns (ActivateClientResponse) {} - rpc DeactivateClient (DeactivateClientRequest) returns (DeactivateClientResponse) {} - - rpc AttachDocument (AttachDocumentRequest) returns (AttachDocumentResponse) {} - rpc DetachDocument (DetachDocumentRequest) returns (DetachDocumentResponse) {} - rpc RemoveDocument (RemoveDocumentRequest) returns (RemoveDocumentResponse) {} - rpc PushPullChanges (PushPullChangesRequest) returns (PushPullChangesResponse) {} - - rpc WatchDocument (WatchDocumentRequest) returns (stream WatchDocumentResponse) {} - - rpc Broadcast (BroadcastRequest) returns (BroadcastResponse) {} - } - - message ActivateClientRequest { - string client_key = 1; - } - - message ActivateClientResponse { - string client_id = 1; - } - - message DeactivateClientRequest { - string client_id = 1; - } - - message DeactivateClientResponse { - } - - message AttachDocumentRequest { - string client_id = 1; - ChangePack change_pack = 2; - } - - message AttachDocumentResponse { - string document_id = 1; - ChangePack change_pack = 2; - } - - message DetachDocumentRequest { - string client_id = 1; - string document_id = 2; - ChangePack change_pack = 3; - bool remove_if_not_attached = 4; - } - - message DetachDocumentResponse { - ChangePack change_pack = 2; - } - - message WatchDocumentRequest { - string client_id = 1; - string document_id = 2; - } - - message WatchDocumentResponse { - message Initialization { - repeated string client_ids = 1; - } - - oneof body { - Initialization initialization = 1; - DocEvent event = 2; - } - } - - message RemoveDocumentRequest { - string client_id = 1; - string document_id = 2; - ChangePack change_pack = 3; - } - - message RemoveDocumentResponse { - ChangePack change_pack = 1; - } - - message PushPullChangesRequest { - string client_id = 1; - string document_id = 2; - ChangePack change_pack = 3; - bool push_only = 4; - } - - message PushPullChangesResponse { - ChangePack change_pack = 1; - } - - message BroadcastRequest { - string client_id = 1; - string document_id = 2; - string topic = 3; - bytes payload = 4; - } - - message BroadcastResponse { - } - \ No newline at end of file +syntax = "proto3"; + +package yorkie.v1; + +import "yorkie/v1/resources.proto"; + +option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; + +option java_multiple_files = true; +option java_package = "dev.yorkie.api.v1"; + +// Yorkie is a service that provides a API for SDKs. +service YorkieService { + rpc ActivateClient (ActivateClientRequest) returns (ActivateClientResponse) {} + rpc DeactivateClient (DeactivateClientRequest) returns (DeactivateClientResponse) {} + + rpc AttachDocument (AttachDocumentRequest) returns (AttachDocumentResponse) {} + rpc DetachDocument (DetachDocumentRequest) returns (DetachDocumentResponse) {} + rpc RemoveDocument (RemoveDocumentRequest) returns (RemoveDocumentResponse) {} + rpc PushPullChanges (PushPullChangesRequest) returns (PushPullChangesResponse) {} + + rpc WatchDocument (WatchDocumentRequest) returns (stream WatchDocumentResponse) {} + + rpc Broadcast (BroadcastRequest) returns (BroadcastResponse) {} +} + +message ActivateClientRequest { + string client_key = 1; +} + +message ActivateClientResponse { + string client_id = 1; +} + +message DeactivateClientRequest { + string client_id = 1; +} + +message DeactivateClientResponse { +} + +message AttachDocumentRequest { + string client_id = 1; + ChangePack change_pack = 2; +} + +message AttachDocumentResponse { + string document_id = 1; + ChangePack change_pack = 2; +} + +message DetachDocumentRequest { + string client_id = 1; + string document_id = 2; + ChangePack change_pack = 3; + bool remove_if_not_attached = 4; +} + +message DetachDocumentResponse { + ChangePack change_pack = 2; +} + +message WatchDocumentRequest { + string client_id = 1; + string document_id = 2; +} + +message WatchDocumentResponse { + message Initialization { + repeated string client_ids = 1; + } + + oneof body { + Initialization initialization = 1; + DocEvent event = 2; + } +} + +message RemoveDocumentRequest { + string client_id = 1; + string document_id = 2; + ChangePack change_pack = 3; +} + +message RemoveDocumentResponse { + ChangePack change_pack = 1; +} + +message PushPullChangesRequest { + string client_id = 1; + string document_id = 2; + ChangePack change_pack = 3; + bool push_only = 4; +} + +message PushPullChangesResponse { + ChangePack change_pack = 1; +} + +message BroadcastRequest { + string client_id = 1; + string document_id = 2; + string topic = 3; + bytes payload = 4; +} + +message BroadcastResponse { +} From f3672228e75d8d1bedf4fd0311271d6d645ef227 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Wed, 13 Dec 2023 14:50:43 +0900 Subject: [PATCH 16/21] Disable benchmark --- .github/workflows/ci.yml | 58 +++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1db9a11c3..1cc09bc90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,30 +35,34 @@ jobs: with: file: ./coverage/lcov.info - - name: Run benchmark - run: npm run benchmark | tee output.txt - # Download previous benchmark result from cache (if exists) - - name: Download previous benchmark data - uses: actions/cache@v1 - with: - path: ./cache - key: ${{ runner.os }}-benchmark - # Run `github-action-benchmark` action - - name: Store benchmark result - uses: benchmark-action/github-action-benchmark@v1 - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} - with: - # What benchmark tool the output.txt came from - tool: 'benchmarkjs' - # Where the output from the benchmark tool is stored - output-file-path: output.txt - # Where the previous data file is stored - external-data-json-path: ./cache/benchmark-data.json - # Workflow will fail when an alert happens - fail-on-alert: false - # GitHub API token to make a commit comment - github-token: ${{ secrets.GITHUB_TOKEN }} - # Enable comment always - comment-always: true - # Save only on the main to compare the benchmarks between PR and base branch - save-data-file: ${{ github.ref == 'refs/heads/main' }} + # TODO(hackerwins): Enable benchmark. While introducing connect-rpc, `npm run benchmark` + # is failing with the following error: SyntaxError: Cannot use import statement outside a module + # Ref: https://github.com/bufbuild/protobuf-es/issues/587#issuecomment-1853180685 + # For now, we are disabling benchmark. + # - name: Run benchmark + # run: npm run benchmark | tee output.txt + # # Download previous benchmark result from cache (if exists) + # - name: Download previous benchmark data + # uses: actions/cache@v1 + # with: + # path: ./cache + # key: ${{ runner.os }}-benchmark + # # Run `github-action-benchmark` action + # - name: Store benchmark result + # uses: benchmark-action/github-action-benchmark@v1 + # if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + # with: + # # What benchmark tool the output.txt came from + # tool: 'benchmarkjs' + # # Where the output from the benchmark tool is stored + # output-file-path: output.txt + # # Where the previous data file is stored + # external-data-json-path: ./cache/benchmark-data.json + # # Workflow will fail when an alert happens + # fail-on-alert: false + # # GitHub API token to make a commit comment + # github-token: ${{ secrets.GITHUB_TOKEN }} + # # Enable comment always + # comment-always: true + # # Save only on the main to compare the benchmarks between PR and base branch + # save-data-file: ${{ github.ref == 'refs/heads/main' }} From b804a7348f8cadfb42bdf275a2a2461b24268dee Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Wed, 13 Dec 2023 15:13:27 +0900 Subject: [PATCH 17/21] Clean up converter.ts --- src/api/converter.ts | 410 ++++++++++++++++++++++--------------------- 1 file changed, 214 insertions(+), 196 deletions(-) diff --git a/src/api/converter.ts b/src/api/converter.ts index 0ab8e60cc..b0fab299f 100644 --- a/src/api/converter.ts +++ b/src/api/converter.ts @@ -78,23 +78,22 @@ import { TreePos as PbTreePos, TreeNodeID as PbTreeNodeID, ValueType as PbValueType, - JSONElement_Tree, - JSONElement_Text, - JSONElement_Primitive, - JSONElement_Counter, - JSONElement_JSONObject, - JSONElement_JSONArray, - PresenceChange_ChangeType, - Operation_Set, - Operation_Add, - Operation_Move, - Operation_Remove, - Operation_Edit, - Operation_Style, - Operation_Increase, - Operation_TreeEdit, - Operation_TreeStyle, - Presence, + 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 { @@ -128,37 +127,40 @@ function toPresence(presence: Indexable): PbPresence { function toPresenceChange( presenceChange: PresenceChange, ): PbPresenceChange { - const pbPresenceChange = new PbPresenceChange(); - if (presenceChange.type === PresenceChangeType.Put) { - pbPresenceChange.type = PresenceChange_ChangeType.PUT; - pbPresenceChange.presence = toPresence(presenceChange.presence); - } else if (presenceChange.type === PresenceChangeType.Clear) { - pbPresenceChange.type = PresenceChange_ChangeType.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.serverSeq = checkpoint.getServerSeqAsString(); - pbCheckpoint.clientSeq = 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.clientSeq = changeID.getClientSeq(); - pbChangeID.lamport = changeID.getLamportAsString(); - pbChangeID.actorId = toUint8Array(changeID.getActorID()!); - return pbChangeID; + return new PbChangeID({ + clientSeq: changeID.getClientSeq(), + lamport: changeID.getLamportAsString(), + actorId: toUint8Array(changeID.getActorID()!), + }); } /** @@ -169,11 +171,11 @@ function toTimeTicket(ticket?: TimeTicket): PbTimeTicket | undefined { return; } - const pbTimeTicket = new PbTimeTicket(); - pbTimeTicket.lamport = ticket.getLamportAsString(); - pbTimeTicket.delimiter = ticket.getDelimiter(); - pbTimeTicket.actorId = toUint8Array(ticket.getActorID()!); - return pbTimeTicket; + return new PbTimeTicket({ + lamport: ticket.getLamportAsString(), + delimiter: ticket.getDelimiter(), + actorId: toUint8Array(ticket.getActorID()!), + }); } /** @@ -220,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.type = PbValueType.JSON_OBJECT; - pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); - pbElementSimple.value = objectToBytes(element); - } else if (element instanceof CRDTArray) { - pbElementSimple.type = PbValueType.JSON_ARRAY; - pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); - pbElementSimple.value = arrayToBytes(element); - } else if (element instanceof CRDTText) { - pbElementSimple.type = PbValueType.TEXT; - pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); - } else if (element instanceof Primitive) { - const primitive = element as Primitive; - pbElementSimple.type = toValueType(primitive.getType()); - pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); - pbElementSimple.value = element.toBytes(); - } else if (element instanceof CRDTCounter) { - const counter = element as CRDTCounter; - pbElementSimple.type = toCounterType(counter.getType()); - pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); - pbElementSimple.value = element.toBytes(); - } else if (element instanceof CRDTTree) { - const tree = element as CRDTTree; - pbElementSimple.type = PbValueType.TREE; - pbElementSimple.createdAt = toTimeTicket(element.getCreatedAt()); - pbElementSimple.value = 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.createdAt = toTimeTicket(id.getCreatedAt()); - pbTextNodeID.offset = 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.createdAt = toTimeTicket(pos.getID().getCreatedAt()); - pbTextNodePos.offset = pos.getID().getOffset(); - pbTextNodePos.relativeOffset = 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.parentId = toTreeNodeID(pos.getParentID()); - pbTreePos.leftSiblingId = 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.createdAt = toTimeTicket(treeNodeID.getCreatedAt()); - pbTreeNodeID.offset = treeNodeID.getOffset(); - return pbTreeNodeID; + return new PbTreeNodeID({ + createdAt: toTimeTicket(treeNodeID.getCreatedAt()), + offset: treeNodeID.getOffset(), + }); } /** @@ -303,7 +316,7 @@ function toOperation(operation: Operation): PbOperation { if (operation instanceof SetOperation) { const setOperation = operation as SetOperation; - const pbSetOperation = new Operation_Set(); + const pbSetOperation = new PbOperation_Set(); pbSetOperation.parentCreatedAt = toTimeTicket( setOperation.getParentCreatedAt(), ); @@ -314,7 +327,7 @@ function toOperation(operation: Operation): PbOperation { pbOperation.body.value = pbSetOperation; } else if (operation instanceof AddOperation) { const addOperation = operation as AddOperation; - const pbAddOperation = new Operation_Add(); + const pbAddOperation = new PbOperation_Add(); pbAddOperation.parentCreatedAt = toTimeTicket( addOperation.getParentCreatedAt(), ); @@ -327,7 +340,7 @@ function toOperation(operation: Operation): PbOperation { pbOperation.body.value = pbAddOperation; } else if (operation instanceof MoveOperation) { const moveOperation = operation as MoveOperation; - const pbMoveOperation = new Operation_Move(); + const pbMoveOperation = new PbOperation_Move(); pbMoveOperation.parentCreatedAt = toTimeTicket( moveOperation.getParentCreatedAt(), ); @@ -340,7 +353,7 @@ function toOperation(operation: Operation): PbOperation { pbOperation.body.value = pbMoveOperation; } else if (operation instanceof RemoveOperation) { const removeOperation = operation as RemoveOperation; - const pbRemoveOperation = new Operation_Remove(); + const pbRemoveOperation = new PbOperation_Remove(); pbRemoveOperation.parentCreatedAt = toTimeTicket( removeOperation.getParentCreatedAt(), ); @@ -352,7 +365,7 @@ function toOperation(operation: Operation): PbOperation { pbOperation.body.value = pbRemoveOperation; } else if (operation instanceof EditOperation) { const editOperation = operation as EditOperation; - const pbEditOperation = new Operation_Edit(); + const pbEditOperation = new PbOperation_Edit(); pbEditOperation.parentCreatedAt = toTimeTicket( editOperation.getParentCreatedAt(), ); @@ -372,7 +385,7 @@ function toOperation(operation: Operation): PbOperation { pbOperation.body.value = pbEditOperation; } else if (operation instanceof StyleOperation) { const styleOperation = operation as StyleOperation; - const pbStyleOperation = new Operation_Style(); + const pbStyleOperation = new PbOperation_Style(); pbStyleOperation.parentCreatedAt = toTimeTicket( styleOperation.getParentCreatedAt(), ); @@ -391,7 +404,7 @@ function toOperation(operation: Operation): PbOperation { pbOperation.body.value = pbStyleOperation; } else if (operation instanceof IncreaseOperation) { const increaseOperation = operation as IncreaseOperation; - const pbIncreaseOperation = new Operation_Increase(); + const pbIncreaseOperation = new PbOperation_Increase(); pbIncreaseOperation.parentCreatedAt = toTimeTicket( increaseOperation.getParentCreatedAt(), ); @@ -403,7 +416,7 @@ function toOperation(operation: Operation): PbOperation { pbOperation.body.value = pbIncreaseOperation; } else if (operation instanceof TreeEditOperation) { const treeEditOperation = operation as TreeEditOperation; - const pbTreeEditOperation = new Operation_TreeEdit(); + const pbTreeEditOperation = new PbOperation_TreeEdit(); const pbCreatedAtMapByActor = pbTreeEditOperation.createdAtMapByActor; for (const [key, value] of treeEditOperation.getMaxCreatedAtMapByActor()) { pbCreatedAtMapByActor[key] = toTimeTicket(value)!; @@ -425,7 +438,7 @@ function toOperation(operation: Operation): PbOperation { pbOperation.body.value = pbTreeEditOperation; } else if (operation instanceof TreeStyleOperation) { const treeStyleOperation = operation as TreeStyleOperation; - const pbTreeStyleOperation = new Operation_TreeStyle(); + const pbTreeStyleOperation = new PbOperation_TreeStyle(); pbTreeStyleOperation.parentCreatedAt = toTimeTicket( treeStyleOperation.getParentCreatedAt(), ); @@ -464,9 +477,10 @@ function toOperations(operations: Array): Array { * `toChange` converts the given model to Protobuf format. */ function toChange(change: Change): PbChange { - const pbChange = new PbChange(); - pbChange.id = toChangeID(change.getID()); - pbChange.message = change.getMessage()!; + const pbChange = new PbChange({ + id: toChangeID(change.getID()!), + message: change.getMessage(), + }); if (change.hasOperations()) { pbChange.operations = toOperations(change.getOperations()); } @@ -493,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.key = rhtNode.getStrKey(); - // eslint-disable-next-line - pbRHTNode.element = toElement(rhtNode.getValue()); - pbRHTNodes.push(pbRHTNode); + pbRHTNodes.push( + new PbRHTNode({ + key: rhtNode.getStrKey(), + element: toElement(rhtNode.getValue()), + }), + ); } return pbRHTNodes; @@ -509,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.element = toElement(rgaTreeListNode.getValue()); - pbRGANodes.push(pbRGANode); + pbRGANodes.push( + new PbRGANode({ + element: toElement(rgaTreeListNode.getValue()), + }), + ); } return pbRGANodes; @@ -552,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.content = toTreeNodes(node); - pbTreeNodesList.push(pbTreeNodes); - }); + for (const node of nodes) { + pbTreeNodesList.push( + new PbTreeNodes({ + content: toTreeNodes(node), + }), + ); + } return pbTreeNodesList; } @@ -576,9 +593,13 @@ function toTreeNodes(node: CRDTTreeNode): Array { const pbTreeNodes: Array = []; traverse(node, (n, depth) => { - const pbTreeNode = new PbTreeNode(); - pbTreeNode.id = toTreeNodeID(n.id); - pbTreeNode.type = n.type; + const pbTreeNode = new PbTreeNode({ + id: toTreeNodeID(n.id), + type: n.type, + removedAt: toTimeTicket(n.removedAt), + depth, + }); + if (n.isText) { pbTreeNode.value = n.value; } @@ -589,16 +610,12 @@ function toTreeNodes(node: CRDTTreeNode): Array { pbTreeNode.insNextId = toTreeNodeID(n.insNextID); } - pbTreeNode.removedAt = toTimeTicket(n.removedAt); - pbTreeNode.depth = depth; - if (n.attrs) { - const pbNodeAttrsMap = pbTreeNode.attributes; for (const attr of n.attrs) { - const pbNodeAttr = new PbNodeAttr(); - pbNodeAttr.value = attr.getValue(); - pbNodeAttr.updatedAt = toTimeTicket(attr.getUpdatedAt()); - pbNodeAttrsMap[attr.getKey()] = pbNodeAttr; + pbTreeNode.attributes[attr.getKey()] = new PbNodeAttr({ + value: attr.getValue(), + updatedAt: toTimeTicket(attr.getUpdatedAt()), + }); } } @@ -612,15 +629,14 @@ function toTreeNodes(node: CRDTTreeNode): Array { * `toObject` converts the given model to Protobuf format. */ function toObject(obj: CRDTObject): PbJSONElement { - const pbObject = new JSONElement_JSONObject(); - pbObject.nodes = toRHTNodes(obj.getRHT()); - pbObject.createdAt = toTimeTicket(obj.getCreatedAt()); - pbObject.movedAt = toTimeTicket(obj.getMovedAt()); - pbObject.removedAt = toTimeTicket(obj.getRemovedAt()); - const pbElement = new PbJSONElement(); pbElement.body.case = 'jsonObject'; - pbElement.body.value = pbObject; + pbElement.body.value = new PbJSONElement_JSONObject({ + nodes: toRHTNodes(obj.getRHT()), + createdAt: toTimeTicket(obj.getCreatedAt()), + movedAt: toTimeTicket(obj.getMovedAt()), + removedAt: toTimeTicket(obj.getRemovedAt()), + }); return pbElement; } @@ -628,15 +644,14 @@ function toObject(obj: CRDTObject): PbJSONElement { * `toArray` converts the given model to Protobuf format. */ function toArray(arr: CRDTArray): PbJSONElement { - const pbArray = new JSONElement_JSONArray(); - pbArray.nodes = toRGANodes(arr.getElements()); - pbArray.createdAt = toTimeTicket(arr.getCreatedAt()); - pbArray.movedAt = toTimeTicket(arr.getMovedAt()); - pbArray.removedAt = toTimeTicket(arr.getRemovedAt()); - const pbElement = new PbJSONElement(); pbElement.body.case = 'jsonArray'; - pbElement.body.value = pbArray; + pbElement.body.value = new PbJSONElement_JSONArray({ + nodes: toRGANodes(arr.getElements()), + createdAt: toTimeTicket(arr.getCreatedAt()), + movedAt: toTimeTicket(arr.getMovedAt()), + removedAt: toTimeTicket(arr.getRemovedAt()), + }); return pbElement; } @@ -644,16 +659,15 @@ function toArray(arr: CRDTArray): PbJSONElement { * `toPrimitive` converts the given model to Protobuf format. */ function toPrimitive(primitive: Primitive): PbJSONElement { - const pbPrimitive = new JSONElement_Primitive(); - pbPrimitive.type = toValueType(primitive.getType()); - pbPrimitive.value = primitive.toBytes(); - pbPrimitive.createdAt = toTimeTicket(primitive.getCreatedAt()); - pbPrimitive.movedAt = toTimeTicket(primitive.getMovedAt()); - pbPrimitive.removedAt = toTimeTicket(primitive.getRemovedAt()); - const pbElement = new PbJSONElement(); pbElement.body.case = 'primitive'; - pbElement.body.value = pbPrimitive; + 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; } @@ -661,15 +675,14 @@ function toPrimitive(primitive: Primitive): PbJSONElement { * `toText` converts the given model to Protobuf format. */ function toText(text: CRDTText>): PbJSONElement { - const pbText = new JSONElement_Text(); - pbText.nodes = toTextNodes(text.getRGATreeSplit()); - pbText.createdAt = toTimeTicket(text.getCreatedAt()); - pbText.movedAt = toTimeTicket(text.getMovedAt()); - pbText.removedAt = toTimeTicket(text.getRemovedAt()); - const pbElement = new PbJSONElement(); pbElement.body.case = 'text'; - pbElement.body.value = pbText; + pbElement.body.value = new PbJSONElement_Text({ + nodes: toTextNodes(text.getRGATreeSplit()), + createdAt: toTimeTicket(text.getCreatedAt()), + movedAt: toTimeTicket(text.getMovedAt()), + removedAt: toTimeTicket(text.getRemovedAt()), + }); return pbElement; } @@ -677,16 +690,15 @@ function toText(text: CRDTText>): PbJSONElement { * `toCounter` converts the given model to Protobuf format. */ function toCounter(counter: CRDTCounter): PbJSONElement { - const pbCounter = new JSONElement_Counter(); - pbCounter.type = toCounterType(counter.getType()); - pbCounter.value = counter.toBytes(); - pbCounter.createdAt = toTimeTicket(counter.getCreatedAt()); - pbCounter.movedAt = toTimeTicket(counter.getMovedAt()); - pbCounter.removedAt = toTimeTicket(counter.getRemovedAt()); - const pbElement = new PbJSONElement(); pbElement.body.case = 'counter'; - pbElement.body.value = pbCounter; + 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; } @@ -694,15 +706,14 @@ function toCounter(counter: CRDTCounter): PbJSONElement { * `toTree` converts the given model to Protobuf format. */ function toTree(tree: CRDTTree): PbJSONElement { - const pbTree = new JSONElement_Tree(); - pbTree.nodes = toTreeNodes(tree.getRoot()); - pbTree.createdAt = toTimeTicket(tree.getCreatedAt()); - pbTree.movedAt = toTimeTicket(tree.getMovedAt()); - pbTree.removedAt = toTimeTicket(tree.getRemovedAt()); - const pbElement = new PbJSONElement(); pbElement.body.case = 'tree'; - pbElement.body.value = pbTree; + pbElement.body.value = new PbJSONElement_Tree({ + nodes: toTreeNodes(tree.getRoot()), + createdAt: toTimeTicket(tree.getCreatedAt()), + movedAt: toTimeTicket(tree.getMovedAt()), + removedAt: toTimeTicket(tree.getRemovedAt()), + }); return pbElement; } @@ -712,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.documentKey = pack.getDocumentKey(); - pbChangePack.checkpoint = toCheckpoint(pack.getCheckpoint()); - pbChangePack.isRemoved = pack.getIsRemoved(); - pbChangePack.changes = toChanges(pack.getChanges()); - pbChangePack.snapshot = pack.getSnapshot()!; - pbChangePack.minSyncedTicket = 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()), + }); } /** @@ -786,27 +802,27 @@ function fromPresenceChange

( pbPresenceChange: PbPresenceChange, ): PresenceChange

{ const type = pbPresenceChange.type; - - if (type === PresenceChange_ChangeType.PUT) { + if (type === PbPresenceChange_ChangeType.PUT) { const presence = fromPresence

(pbPresenceChange.presence!); return { type: PresenceChangeType.Put, presence, }; - } else if (type === PresenceChange_ChangeType.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: { - [key: string]: Presence; + [key: string]: PbPresence; }): Map { const presences = new Map(); Object.entries(pbPresences).forEach(([actorID, pbPresence]) => { @@ -1235,7 +1251,7 @@ function fromChangePack

( /** * `fromObject` converts the given Protobuf format to model format. */ -function fromObject(pbObject: JSONElement_JSONObject): CRDTObject { +function fromObject(pbObject: PbJSONElement_JSONObject): CRDTObject { const rht = new ElementRHT(); for (const pbRHTNode of pbObject.nodes) { const value = fromElement(pbRHTNode.element!); @@ -1251,7 +1267,7 @@ function fromObject(pbObject: JSONElement_JSONObject): CRDTObject { /** * `fromArray` converts the given Protobuf format to model format. */ -function fromArray(pbArray: JSONElement_JSONArray): CRDTArray { +function fromArray(pbArray: PbJSONElement_JSONArray): CRDTArray { const rgaTreeList = new RGATreeList(); for (const pbRGANode of pbArray.nodes) { // eslint-disable-next-line @@ -1267,7 +1283,7 @@ function fromArray(pbArray: JSONElement_JSONArray): CRDTArray { /** * `fromPrimitive` converts the given Protobuf format to model format. */ -function fromPrimitive(pbPrimitive: JSONElement_Primitive): Primitive { +function fromPrimitive(pbPrimitive: PbJSONElement_Primitive): Primitive { const primitive = Primitive.of( Primitive.valueFromBytes( fromValueType(pbPrimitive.type), @@ -1283,7 +1299,9 @@ function fromPrimitive(pbPrimitive: JSONElement_Primitive): Primitive { /** * `fromText` converts the given Protobuf format to model format. */ -function fromText(pbText: JSONElement_Text): CRDTText { +function fromText( + pbText: PbJSONElement_Text, +): CRDTText { const rgaTreeSplit = new RGATreeSplit(); let prev = rgaTreeSplit.getHead(); @@ -1305,7 +1323,7 @@ function fromText(pbText: JSONElement_Text): CRDTText { /** * `fromCounter` converts the given Protobuf format to model format. */ -function fromCounter(pbCounter: JSONElement_Counter): CRDTCounter { +function fromCounter(pbCounter: PbJSONElement_Counter): CRDTCounter { const counter = CRDTCounter.create( fromCounterType(pbCounter.type), CRDTCounter.valueFromBytes( @@ -1322,7 +1340,7 @@ function fromCounter(pbCounter: JSONElement_Counter): CRDTCounter { /** * `fromTree` converts the given Protobuf format to model format. */ -function fromTree(pbTree: JSONElement_Tree): CRDTTree { +function fromTree(pbTree: PbJSONElement_Tree): CRDTTree { const root = fromTreeNodes(pbTree.nodes); return CRDTTree.create(root!, fromTimeTicket(pbTree.createdAt)!); } @@ -1380,7 +1398,7 @@ function bytesToObject(bytes?: Uint8Array): CRDTObject { } const pbElement = PbJSONElement.fromBinary(bytes); - return fromObject(pbElement.body.value! as JSONElement_JSONObject); + return fromObject(pbElement.body.value! as PbJSONElement_JSONObject); } /** @@ -1399,7 +1417,7 @@ function bytesToArray(bytes?: Uint8Array): CRDTArray { } const pbElement = PbJSONElement.fromBinary(bytes); - return fromArray(pbElement.body.value! as JSONElement_JSONArray); + return fromArray(pbElement.body.value! as PbJSONElement_JSONArray); } /** @@ -1418,7 +1436,7 @@ function bytesToTree(bytes?: Uint8Array): CRDTTree { } const pbElement = PbJSONElement.fromBinary(bytes); - return fromTree(pbElement.body.value! as JSONElement_Tree); + return fromTree(pbElement.body.value! as PbJSONElement_Tree); } /** From 6e8150c6c4df5c4a26be39df8b6d6ff4b9e5e89c Mon Sep 17 00:00:00 2001 From: Kevin Park Date: Thu, 14 Dec 2023 12:26:24 +0900 Subject: [PATCH 18/21] Set connect-es js import style to commonjs & enable benchmark --- .github/workflows/ci.yml | 58 +++++----- buf.gen.yaml | 5 +- package-lock.json | 68 ++++++------ package.json | 10 +- src/api/yorkie/v1/resources_pb.d.ts | 2 +- src/api/yorkie/v1/resources_pb.js | 149 +++++++++++++++++--------- src/api/yorkie/v1/yorkie.proto | 2 +- src/api/yorkie/v1/yorkie_connect.d.ts | 2 +- src/api/yorkie/v1/yorkie_connect.js | 13 ++- src/api/yorkie/v1/yorkie_pb.d.ts | 2 +- src/api/yorkie/v1/yorkie_pb.js | 61 +++++++---- 11 files changed, 224 insertions(+), 148 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cc09bc90..1db9a11c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,34 +35,30 @@ jobs: with: file: ./coverage/lcov.info - # TODO(hackerwins): Enable benchmark. While introducing connect-rpc, `npm run benchmark` - # is failing with the following error: SyntaxError: Cannot use import statement outside a module - # Ref: https://github.com/bufbuild/protobuf-es/issues/587#issuecomment-1853180685 - # For now, we are disabling benchmark. - # - name: Run benchmark - # run: npm run benchmark | tee output.txt - # # Download previous benchmark result from cache (if exists) - # - name: Download previous benchmark data - # uses: actions/cache@v1 - # with: - # path: ./cache - # key: ${{ runner.os }}-benchmark - # # Run `github-action-benchmark` action - # - name: Store benchmark result - # uses: benchmark-action/github-action-benchmark@v1 - # if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} - # with: - # # What benchmark tool the output.txt came from - # tool: 'benchmarkjs' - # # Where the output from the benchmark tool is stored - # output-file-path: output.txt - # # Where the previous data file is stored - # external-data-json-path: ./cache/benchmark-data.json - # # Workflow will fail when an alert happens - # fail-on-alert: false - # # GitHub API token to make a commit comment - # github-token: ${{ secrets.GITHUB_TOKEN }} - # # Enable comment always - # comment-always: true - # # Save only on the main to compare the benchmarks between PR and base branch - # save-data-file: ${{ github.ref == 'refs/heads/main' }} + - name: Run benchmark + run: npm run benchmark | tee output.txt + # Download previous benchmark result from cache (if exists) + - name: Download previous benchmark data + uses: actions/cache@v1 + with: + path: ./cache + key: ${{ runner.os }}-benchmark + # Run `github-action-benchmark` action + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + with: + # What benchmark tool the output.txt came from + tool: 'benchmarkjs' + # Where the output from the benchmark tool is stored + output-file-path: output.txt + # Where the previous data file is stored + external-data-json-path: ./cache/benchmark-data.json + # Workflow will fail when an alert happens + fail-on-alert: false + # GitHub API token to make a commit comment + github-token: ${{ secrets.GITHUB_TOKEN }} + # Enable comment always + comment-always: true + # Save only on the main to compare the benchmarks between PR and base branch + save-data-file: ${{ github.ref == 'refs/heads/main' }} diff --git a/buf.gen.yaml b/buf.gen.yaml index 50e19aeca..ea878f5e1 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -2,8 +2,11 @@ version: v1 plugins: - plugin: es out: . - opt: target=js+dts + 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/package-lock.json b/package-lock.json index bd950b041..920a39146 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,15 +13,15 @@ "tools/*" ], "dependencies": { - "@bufbuild/protobuf": "^1.4.2", - "@connectrpc/connect": "^1.1.3", - "@connectrpc/connect-web": "^1.1.3", + "@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.5.1", - "@connectrpc/protoc-gen-connect-es": "^1.1.3", + "@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", @@ -1148,18 +1148,18 @@ } }, "node_modules/@bufbuild/protobuf": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.5.1.tgz", - "integrity": "sha512-LX+MeB1AzlbqgJXkq83lilQpLGnPvsAMj7SH8KtJAmQfBc55ee78Stxuff/HMw0xLMYJN3P1FBh5TENgjJof1w==" + "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.5.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.5.1.tgz", - "integrity": "sha512-o4NNOf49QEjowhpQxm3fq/yv+LstO9aMmNlEE3fz4WlD5fBE8OZ7q38O+WMUVoB4Y41joxk24v7IIm61trwRyg==", + "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.5.1", - "@bufbuild/protoplugin": "1.5.1" + "@bufbuild/protobuf": "^1.6.0", + "@bufbuild/protoplugin": "1.6.0" }, "bin": { "protoc-gen-es": "bin/protoc-gen-es" @@ -1168,7 +1168,7 @@ "node": ">=14" }, "peerDependencies": { - "@bufbuild/protobuf": "1.5.1" + "@bufbuild/protobuf": "1.6.0" }, "peerDependenciesMeta": { "@bufbuild/protobuf": { @@ -1177,12 +1177,12 @@ } }, "node_modules/@bufbuild/protoplugin": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@bufbuild/protoplugin/-/protoplugin-1.5.1.tgz", - "integrity": "sha512-4qQD3UIEXflPYCEPZxyvi9yoQiX3ONWgLw24uLJrw9AnbY7Pw1xT5v8yIMXIVccBEZNSpvIF6qD/JXfIapjRtw==", + "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.5.1", + "@bufbuild/protobuf": "1.6.0", "@typescript/vfs": "^1.4.0", "typescript": "4.5.2" } @@ -1501,30 +1501,30 @@ } }, "node_modules/@connectrpc/connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-1.1.3.tgz", - "integrity": "sha512-AXkbsLQe2Nm7VuoN5nqp05GEb9mPa/f5oFzDqTbHME4i8TghTrlY03uefbhuAq4wjsnfDnmuxHZvn6ndlgXmbg==", + "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.3.3" + "@bufbuild/protobuf": "^1.4.2" } }, "node_modules/@connectrpc/connect-web": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@connectrpc/connect-web/-/connect-web-1.1.3.tgz", - "integrity": "sha512-WfShOZt91duJngqivYF4wJFRbeRa4bF/fPMfDVN0MAYSX3VuaTMn8o9qgKN7tsg2H2ZClyOVQwMkZx6IdcP7Zw==", + "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.3.3", - "@connectrpc/connect": "1.1.3" + "@bufbuild/protobuf": "^1.4.2", + "@connectrpc/connect": "1.2.0" } }, "node_modules/@connectrpc/protoc-gen-connect-es": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@connectrpc/protoc-gen-connect-es/-/protoc-gen-connect-es-1.1.3.tgz", - "integrity": "sha512-Irt1WM1o45KL0DNz8D8nraNfRrOyZfn7rzRsOyfrwbNzeVO1JV3rELFpARqGAvtVveYBoO9uwYtQ8TKLXsnrng==", + "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.3.3", - "@bufbuild/protoplugin": "^1.3.3" + "@bufbuild/protobuf": "^1.6.0", + "@bufbuild/protoplugin": "^1.6.0" }, "bin": { "protoc-gen-connect-es": "bin/protoc-gen-connect-es" @@ -1533,8 +1533,8 @@ "node": ">=16.0.0" }, "peerDependencies": { - "@bufbuild/protoc-gen-es": "^1.3.3", - "@connectrpc/connect": "1.1.3" + "@bufbuild/protoc-gen-es": "^1.6.0", + "@connectrpc/connect": "1.2.0" }, "peerDependenciesMeta": { "@bufbuild/protoc-gen-es": { diff --git a/package.json b/package.json index 1fd5ff638..c468833ee 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,8 @@ "homepage": "https://github.com/yorkie-team/yorkie-js-sdk#readme", "devDependencies": { "@bufbuild/buf": "^1.28.1", - "@bufbuild/protoc-gen-es": "^1.5.1", - "@connectrpc/protoc-gen-connect-es": "^1.1.3", + "@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", @@ -88,9 +88,9 @@ "yargs": "^17.0.1" }, "dependencies": { - "@bufbuild/protobuf": "^1.4.2", - "@connectrpc/connect": "^1.1.3", - "@connectrpc/connect-web": "^1.1.3", + "@bufbuild/protobuf": "^1.6.0", + "@connectrpc/connect": "^1.2.0", + "@connectrpc/connect-web": "^1.2.0", "long": "^5.2.0" }, "husky": { diff --git a/src/api/yorkie/v1/resources_pb.d.ts b/src/api/yorkie/v1/resources_pb.d.ts index 13158befd..6daefb702 100644 --- a/src/api/yorkie/v1/resources_pb.d.ts +++ b/src/api/yorkie/v1/resources_pb.d.ts @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts" +// @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 diff --git a/src/api/yorkie/v1/resources_pb.js b/src/api/yorkie/v1/resources_pb.js index f84388d48..dd58b9bc0 100644 --- a/src/api/yorkie/v1/resources_pb.js +++ b/src/api/yorkie/v1/resources_pb.js @@ -13,17 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts" +// @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 { proto3, StringValue, Timestamp } from "@bufbuild/protobuf"; +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + +const { proto3, StringValue, Timestamp } = require("@bufbuild/protobuf"); /** * @generated from enum yorkie.v1.ValueType */ -export const ValueType = proto3.makeEnum( +const ValueType = proto3.makeEnum( "yorkie.v1.ValueType", [ {no: 0, name: "VALUE_TYPE_NULL", localName: "NULL"}, @@ -46,7 +49,7 @@ export const ValueType = proto3.makeEnum( /** * @generated from enum yorkie.v1.DocEventType */ -export const DocEventType = proto3.makeEnum( +const DocEventType = proto3.makeEnum( "yorkie.v1.DocEventType", [ {no: 0, name: "DOC_EVENT_TYPE_DOCUMENT_CHANGED", localName: "DOCUMENT_CHANGED"}, @@ -63,7 +66,7 @@ export const DocEventType = proto3.makeEnum( * * @generated from message yorkie.v1.Snapshot */ -export const Snapshot = proto3.makeMessageType( +const Snapshot = proto3.makeMessageType( "yorkie.v1.Snapshot", () => [ { no: 1, name: "root", kind: "message", T: JSONElement }, @@ -77,7 +80,7 @@ export const Snapshot = proto3.makeMessageType( * * @generated from message yorkie.v1.ChangePack */ -export const ChangePack = proto3.makeMessageType( +const ChangePack = proto3.makeMessageType( "yorkie.v1.ChangePack", () => [ { no: 1, name: "document_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -92,7 +95,7 @@ export const ChangePack = proto3.makeMessageType( /** * @generated from message yorkie.v1.Change */ -export const Change = proto3.makeMessageType( +const Change = proto3.makeMessageType( "yorkie.v1.Change", () => [ { no: 1, name: "id", kind: "message", T: ChangeID }, @@ -105,7 +108,7 @@ export const Change = proto3.makeMessageType( /** * @generated from message yorkie.v1.ChangeID */ -export const ChangeID = proto3.makeMessageType( +const ChangeID = proto3.makeMessageType( "yorkie.v1.ChangeID", () => [ { no: 1, name: "client_seq", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, @@ -118,7 +121,7 @@ export const ChangeID = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation */ -export const Operation = proto3.makeMessageType( +const Operation = proto3.makeMessageType( "yorkie.v1.Operation", () => [ { no: 1, name: "set", kind: "message", T: Operation_Set, oneof: "body" }, @@ -137,7 +140,7 @@ export const Operation = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation.Set */ -export const Operation_Set = proto3.makeMessageType( +const Operation_Set = proto3.makeMessageType( "yorkie.v1.Operation.Set", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -151,7 +154,7 @@ export const Operation_Set = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation.Add */ -export const Operation_Add = proto3.makeMessageType( +const Operation_Add = proto3.makeMessageType( "yorkie.v1.Operation.Add", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -165,7 +168,7 @@ export const Operation_Add = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation.Move */ -export const Operation_Move = proto3.makeMessageType( +const Operation_Move = proto3.makeMessageType( "yorkie.v1.Operation.Move", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -179,7 +182,7 @@ export const Operation_Move = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation.Remove */ -export const Operation_Remove = proto3.makeMessageType( +const Operation_Remove = proto3.makeMessageType( "yorkie.v1.Operation.Remove", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -192,7 +195,7 @@ export const Operation_Remove = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation.Edit */ -export const Operation_Edit = proto3.makeMessageType( +const Operation_Edit = proto3.makeMessageType( "yorkie.v1.Operation.Edit", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -214,7 +217,7 @@ export const Operation_Edit = proto3.makeMessageType( * * @generated from message yorkie.v1.Operation.Select */ -export const Operation_Select = proto3.makeMessageType( +const Operation_Select = proto3.makeMessageType( "yorkie.v1.Operation.Select", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -228,7 +231,7 @@ export const Operation_Select = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation.Style */ -export const Operation_Style = proto3.makeMessageType( +const Operation_Style = proto3.makeMessageType( "yorkie.v1.Operation.Style", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -244,7 +247,7 @@ export const Operation_Style = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation.Increase */ -export const Operation_Increase = proto3.makeMessageType( +const Operation_Increase = proto3.makeMessageType( "yorkie.v1.Operation.Increase", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -257,7 +260,7 @@ export const Operation_Increase = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation.TreeEdit */ -export const Operation_TreeEdit = proto3.makeMessageType( +const Operation_TreeEdit = proto3.makeMessageType( "yorkie.v1.Operation.TreeEdit", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -274,7 +277,7 @@ export const Operation_TreeEdit = proto3.makeMessageType( /** * @generated from message yorkie.v1.Operation.TreeStyle */ -export const Operation_TreeStyle = proto3.makeMessageType( +const Operation_TreeStyle = proto3.makeMessageType( "yorkie.v1.Operation.TreeStyle", () => [ { no: 1, name: "parent_created_at", kind: "message", T: TimeTicket }, @@ -289,7 +292,7 @@ export const Operation_TreeStyle = proto3.makeMessageType( /** * @generated from message yorkie.v1.JSONElementSimple */ -export const JSONElementSimple = proto3.makeMessageType( +const JSONElementSimple = proto3.makeMessageType( "yorkie.v1.JSONElementSimple", () => [ { no: 1, name: "created_at", kind: "message", T: TimeTicket }, @@ -303,7 +306,7 @@ export const JSONElementSimple = proto3.makeMessageType( /** * @generated from message yorkie.v1.JSONElement */ -export const JSONElement = proto3.makeMessageType( +const JSONElement = proto3.makeMessageType( "yorkie.v1.JSONElement", () => [ { no: 1, name: "json_object", kind: "message", T: JSONElement_JSONObject, oneof: "body" }, @@ -318,7 +321,7 @@ export const JSONElement = proto3.makeMessageType( /** * @generated from message yorkie.v1.JSONElement.JSONObject */ -export const JSONElement_JSONObject = proto3.makeMessageType( +const JSONElement_JSONObject = proto3.makeMessageType( "yorkie.v1.JSONElement.JSONObject", () => [ { no: 1, name: "nodes", kind: "message", T: RHTNode, repeated: true }, @@ -332,7 +335,7 @@ export const JSONElement_JSONObject = proto3.makeMessageType( /** * @generated from message yorkie.v1.JSONElement.JSONArray */ -export const JSONElement_JSONArray = proto3.makeMessageType( +const JSONElement_JSONArray = proto3.makeMessageType( "yorkie.v1.JSONElement.JSONArray", () => [ { no: 1, name: "nodes", kind: "message", T: RGANode, repeated: true }, @@ -346,7 +349,7 @@ export const JSONElement_JSONArray = proto3.makeMessageType( /** * @generated from message yorkie.v1.JSONElement.Primitive */ -export const JSONElement_Primitive = proto3.makeMessageType( +const JSONElement_Primitive = proto3.makeMessageType( "yorkie.v1.JSONElement.Primitive", () => [ { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(ValueType) }, @@ -361,7 +364,7 @@ export const JSONElement_Primitive = proto3.makeMessageType( /** * @generated from message yorkie.v1.JSONElement.Text */ -export const JSONElement_Text = proto3.makeMessageType( +const JSONElement_Text = proto3.makeMessageType( "yorkie.v1.JSONElement.Text", () => [ { no: 1, name: "nodes", kind: "message", T: TextNode, repeated: true }, @@ -375,7 +378,7 @@ export const JSONElement_Text = proto3.makeMessageType( /** * @generated from message yorkie.v1.JSONElement.Counter */ -export const JSONElement_Counter = proto3.makeMessageType( +const JSONElement_Counter = proto3.makeMessageType( "yorkie.v1.JSONElement.Counter", () => [ { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(ValueType) }, @@ -390,7 +393,7 @@ export const JSONElement_Counter = proto3.makeMessageType( /** * @generated from message yorkie.v1.JSONElement.Tree */ -export const JSONElement_Tree = proto3.makeMessageType( +const JSONElement_Tree = proto3.makeMessageType( "yorkie.v1.JSONElement.Tree", () => [ { no: 1, name: "nodes", kind: "message", T: TreeNode, repeated: true }, @@ -404,7 +407,7 @@ export const JSONElement_Tree = proto3.makeMessageType( /** * @generated from message yorkie.v1.RHTNode */ -export const RHTNode = proto3.makeMessageType( +const RHTNode = proto3.makeMessageType( "yorkie.v1.RHTNode", () => [ { no: 1, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -415,7 +418,7 @@ export const RHTNode = proto3.makeMessageType( /** * @generated from message yorkie.v1.RGANode */ -export const RGANode = proto3.makeMessageType( +const RGANode = proto3.makeMessageType( "yorkie.v1.RGANode", () => [ { no: 1, name: "next", kind: "message", T: RGANode }, @@ -426,7 +429,7 @@ export const RGANode = proto3.makeMessageType( /** * @generated from message yorkie.v1.NodeAttr */ -export const NodeAttr = proto3.makeMessageType( +const NodeAttr = proto3.makeMessageType( "yorkie.v1.NodeAttr", () => [ { no: 1, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -437,7 +440,7 @@ export const NodeAttr = proto3.makeMessageType( /** * @generated from message yorkie.v1.TextNode */ -export const TextNode = proto3.makeMessageType( +const TextNode = proto3.makeMessageType( "yorkie.v1.TextNode", () => [ { no: 1, name: "id", kind: "message", T: TextNodeID }, @@ -451,7 +454,7 @@ export const TextNode = proto3.makeMessageType( /** * @generated from message yorkie.v1.TextNodeID */ -export const TextNodeID = proto3.makeMessageType( +const TextNodeID = proto3.makeMessageType( "yorkie.v1.TextNodeID", () => [ { no: 1, name: "created_at", kind: "message", T: TimeTicket }, @@ -462,7 +465,7 @@ export const TextNodeID = proto3.makeMessageType( /** * @generated from message yorkie.v1.TreeNode */ -export const TreeNode = proto3.makeMessageType( +const TreeNode = proto3.makeMessageType( "yorkie.v1.TreeNode", () => [ { no: 1, name: "id", kind: "message", T: TreeNodeID }, @@ -479,7 +482,7 @@ export const TreeNode = proto3.makeMessageType( /** * @generated from message yorkie.v1.TreeNodes */ -export const TreeNodes = proto3.makeMessageType( +const TreeNodes = proto3.makeMessageType( "yorkie.v1.TreeNodes", () => [ { no: 1, name: "content", kind: "message", T: TreeNode, repeated: true }, @@ -489,7 +492,7 @@ export const TreeNodes = proto3.makeMessageType( /** * @generated from message yorkie.v1.TreeNodeID */ -export const TreeNodeID = proto3.makeMessageType( +const TreeNodeID = proto3.makeMessageType( "yorkie.v1.TreeNodeID", () => [ { no: 1, name: "created_at", kind: "message", T: TimeTicket }, @@ -500,7 +503,7 @@ export const TreeNodeID = proto3.makeMessageType( /** * @generated from message yorkie.v1.TreePos */ -export const TreePos = proto3.makeMessageType( +const TreePos = proto3.makeMessageType( "yorkie.v1.TreePos", () => [ { no: 1, name: "parent_id", kind: "message", T: TreeNodeID }, @@ -511,7 +514,7 @@ export const TreePos = proto3.makeMessageType( /** * @generated from message yorkie.v1.User */ -export const User = proto3.makeMessageType( +const User = proto3.makeMessageType( "yorkie.v1.User", () => [ { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -523,7 +526,7 @@ export const User = proto3.makeMessageType( /** * @generated from message yorkie.v1.Project */ -export const Project = proto3.makeMessageType( +const Project = proto3.makeMessageType( "yorkie.v1.Project", () => [ { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -541,7 +544,7 @@ export const Project = proto3.makeMessageType( /** * @generated from message yorkie.v1.UpdatableProjectFields */ -export const UpdatableProjectFields = proto3.makeMessageType( +const UpdatableProjectFields = proto3.makeMessageType( "yorkie.v1.UpdatableProjectFields", () => [ { no: 1, name: "name", kind: "message", T: StringValue }, @@ -554,7 +557,7 @@ export const UpdatableProjectFields = proto3.makeMessageType( /** * @generated from message yorkie.v1.UpdatableProjectFields.AuthWebhookMethods */ -export const UpdatableProjectFields_AuthWebhookMethods = proto3.makeMessageType( +const UpdatableProjectFields_AuthWebhookMethods = proto3.makeMessageType( "yorkie.v1.UpdatableProjectFields.AuthWebhookMethods", () => [ { no: 1, name: "methods", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, @@ -565,7 +568,7 @@ export const UpdatableProjectFields_AuthWebhookMethods = proto3.makeMessageType( /** * @generated from message yorkie.v1.DocumentSummary */ -export const DocumentSummary = proto3.makeMessageType( +const DocumentSummary = proto3.makeMessageType( "yorkie.v1.DocumentSummary", () => [ { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -580,7 +583,7 @@ export const DocumentSummary = proto3.makeMessageType( /** * @generated from message yorkie.v1.PresenceChange */ -export const PresenceChange = proto3.makeMessageType( +const PresenceChange = proto3.makeMessageType( "yorkie.v1.PresenceChange", () => [ { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(PresenceChange_ChangeType) }, @@ -591,7 +594,7 @@ export const PresenceChange = proto3.makeMessageType( /** * @generated from enum yorkie.v1.PresenceChange.ChangeType */ -export const PresenceChange_ChangeType = proto3.makeEnum( +const PresenceChange_ChangeType = proto3.makeEnum( "yorkie.v1.PresenceChange.ChangeType", [ {no: 0, name: "CHANGE_TYPE_UNSPECIFIED", localName: "UNSPECIFIED"}, @@ -604,7 +607,7 @@ export const PresenceChange_ChangeType = proto3.makeEnum( /** * @generated from message yorkie.v1.Presence */ -export const Presence = proto3.makeMessageType( +const Presence = proto3.makeMessageType( "yorkie.v1.Presence", () => [ { no: 1, name: "data", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, @@ -614,7 +617,7 @@ export const Presence = proto3.makeMessageType( /** * @generated from message yorkie.v1.Checkpoint */ -export const Checkpoint = proto3.makeMessageType( +const Checkpoint = proto3.makeMessageType( "yorkie.v1.Checkpoint", () => [ { no: 1, name: "server_seq", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, @@ -625,7 +628,7 @@ export const Checkpoint = proto3.makeMessageType( /** * @generated from message yorkie.v1.TextNodePos */ -export const TextNodePos = proto3.makeMessageType( +const TextNodePos = proto3.makeMessageType( "yorkie.v1.TextNodePos", () => [ { no: 1, name: "created_at", kind: "message", T: TimeTicket }, @@ -637,7 +640,7 @@ export const TextNodePos = proto3.makeMessageType( /** * @generated from message yorkie.v1.TimeTicket */ -export const TimeTicket = proto3.makeMessageType( +const TimeTicket = proto3.makeMessageType( "yorkie.v1.TimeTicket", () => [ { no: 1, name: "lamport", kind: "scalar", T: 3 /* ScalarType.INT64 */, L: 1 /* LongType.STRING */ }, @@ -649,7 +652,7 @@ export const TimeTicket = proto3.makeMessageType( /** * @generated from message yorkie.v1.DocEventBody */ -export const DocEventBody = proto3.makeMessageType( +const DocEventBody = proto3.makeMessageType( "yorkie.v1.DocEventBody", () => [ { no: 1, name: "topic", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -660,7 +663,7 @@ export const DocEventBody = proto3.makeMessageType( /** * @generated from message yorkie.v1.DocEvent */ -export const DocEvent = proto3.makeMessageType( +const DocEvent = proto3.makeMessageType( "yorkie.v1.DocEvent", () => [ { no: 1, name: "type", kind: "enum", T: proto3.getEnumType(DocEventType) }, @@ -669,3 +672,51 @@ export const DocEvent = proto3.makeMessageType( ], ); + +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 8ca20e120..279f96f98 100644 --- a/src/api/yorkie/v1/yorkie.proto +++ b/src/api/yorkie/v1/yorkie.proto @@ -17,7 +17,7 @@ syntax = "proto3"; package yorkie.v1; -import "yorkie/v1/resources.proto"; +import "src/api/yorkie/v1/resources.proto"; option go_package = "github.com/yorkie-team/yorkie/api/yorkie/v1;v1"; diff --git a/src/api/yorkie/v1/yorkie_connect.d.ts b/src/api/yorkie/v1/yorkie_connect.d.ts index 8bc957479..89315b90a 100644 --- a/src/api/yorkie/v1/yorkie_connect.d.ts +++ b/src/api/yorkie/v1/yorkie_connect.d.ts @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-connect-es v1.1.3 with parameter "target=js+dts" +// @generated 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 diff --git a/src/api/yorkie/v1/yorkie_connect.js b/src/api/yorkie/v1/yorkie_connect.js index dd6f3ec44..2e1be4fdb 100644 --- a/src/api/yorkie/v1/yorkie_connect.js +++ b/src/api/yorkie/v1/yorkie_connect.js @@ -13,20 +13,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-connect-es v1.1.3 with parameter "target=js+dts" +// @generated 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"; +"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 */ -export const YorkieService = { +const YorkieService = { typeName: "yorkie.v1.YorkieService", methods: { /** @@ -104,3 +107,5 @@ export const YorkieService = { } }; + +exports.YorkieService = YorkieService; diff --git a/src/api/yorkie/v1/yorkie_pb.d.ts b/src/api/yorkie/v1/yorkie_pb.d.ts index ba3e402fc..0c685f6ad 100644 --- a/src/api/yorkie/v1/yorkie_pb.d.ts +++ b/src/api/yorkie/v1/yorkie_pb.d.ts @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts" +// @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 diff --git a/src/api/yorkie/v1/yorkie_pb.js b/src/api/yorkie/v1/yorkie_pb.js index 697b4ddc7..97b8ad6e8 100644 --- a/src/api/yorkie/v1/yorkie_pb.js +++ b/src/api/yorkie/v1/yorkie_pb.js @@ -13,18 +13,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -// @generated by protoc-gen-es v1.5.1 with parameter "target=js+dts" +// @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 { proto3 } from "@bufbuild/protobuf"; -import { ChangePack, DocEvent } from "./resources_pb.js"; +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + +const { proto3 } = require("@bufbuild/protobuf"); +const { ChangePack, DocEvent } = require("./resources_pb.js"); /** * @generated from message yorkie.v1.ActivateClientRequest */ -export const ActivateClientRequest = proto3.makeMessageType( +const ActivateClientRequest = proto3.makeMessageType( "yorkie.v1.ActivateClientRequest", () => [ { no: 1, name: "client_key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -34,7 +37,7 @@ export const ActivateClientRequest = proto3.makeMessageType( /** * @generated from message yorkie.v1.ActivateClientResponse */ -export const ActivateClientResponse = proto3.makeMessageType( +const ActivateClientResponse = proto3.makeMessageType( "yorkie.v1.ActivateClientResponse", () => [ { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -44,7 +47,7 @@ export const ActivateClientResponse = proto3.makeMessageType( /** * @generated from message yorkie.v1.DeactivateClientRequest */ -export const DeactivateClientRequest = proto3.makeMessageType( +const DeactivateClientRequest = proto3.makeMessageType( "yorkie.v1.DeactivateClientRequest", () => [ { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -54,7 +57,7 @@ export const DeactivateClientRequest = proto3.makeMessageType( /** * @generated from message yorkie.v1.DeactivateClientResponse */ -export const DeactivateClientResponse = proto3.makeMessageType( +const DeactivateClientResponse = proto3.makeMessageType( "yorkie.v1.DeactivateClientResponse", [], ); @@ -62,7 +65,7 @@ export const DeactivateClientResponse = proto3.makeMessageType( /** * @generated from message yorkie.v1.AttachDocumentRequest */ -export const AttachDocumentRequest = proto3.makeMessageType( +const AttachDocumentRequest = proto3.makeMessageType( "yorkie.v1.AttachDocumentRequest", () => [ { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -73,7 +76,7 @@ export const AttachDocumentRequest = proto3.makeMessageType( /** * @generated from message yorkie.v1.AttachDocumentResponse */ -export const AttachDocumentResponse = proto3.makeMessageType( +const AttachDocumentResponse = proto3.makeMessageType( "yorkie.v1.AttachDocumentResponse", () => [ { no: 1, name: "document_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -84,7 +87,7 @@ export const AttachDocumentResponse = proto3.makeMessageType( /** * @generated from message yorkie.v1.DetachDocumentRequest */ -export const DetachDocumentRequest = proto3.makeMessageType( +const DetachDocumentRequest = proto3.makeMessageType( "yorkie.v1.DetachDocumentRequest", () => [ { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -97,7 +100,7 @@ export const DetachDocumentRequest = proto3.makeMessageType( /** * @generated from message yorkie.v1.DetachDocumentResponse */ -export const DetachDocumentResponse = proto3.makeMessageType( +const DetachDocumentResponse = proto3.makeMessageType( "yorkie.v1.DetachDocumentResponse", () => [ { no: 2, name: "change_pack", kind: "message", T: ChangePack }, @@ -107,7 +110,7 @@ export const DetachDocumentResponse = proto3.makeMessageType( /** * @generated from message yorkie.v1.WatchDocumentRequest */ -export const WatchDocumentRequest = proto3.makeMessageType( +const WatchDocumentRequest = proto3.makeMessageType( "yorkie.v1.WatchDocumentRequest", () => [ { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -118,7 +121,7 @@ export const WatchDocumentRequest = proto3.makeMessageType( /** * @generated from message yorkie.v1.WatchDocumentResponse */ -export const WatchDocumentResponse = proto3.makeMessageType( +const WatchDocumentResponse = proto3.makeMessageType( "yorkie.v1.WatchDocumentResponse", () => [ { no: 1, name: "initialization", kind: "message", T: WatchDocumentResponse_Initialization, oneof: "body" }, @@ -129,7 +132,7 @@ export const WatchDocumentResponse = proto3.makeMessageType( /** * @generated from message yorkie.v1.WatchDocumentResponse.Initialization */ -export const WatchDocumentResponse_Initialization = proto3.makeMessageType( +const WatchDocumentResponse_Initialization = proto3.makeMessageType( "yorkie.v1.WatchDocumentResponse.Initialization", () => [ { no: 1, name: "client_ids", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, @@ -140,7 +143,7 @@ export const WatchDocumentResponse_Initialization = proto3.makeMessageType( /** * @generated from message yorkie.v1.RemoveDocumentRequest */ -export const RemoveDocumentRequest = proto3.makeMessageType( +const RemoveDocumentRequest = proto3.makeMessageType( "yorkie.v1.RemoveDocumentRequest", () => [ { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -152,7 +155,7 @@ export const RemoveDocumentRequest = proto3.makeMessageType( /** * @generated from message yorkie.v1.RemoveDocumentResponse */ -export const RemoveDocumentResponse = proto3.makeMessageType( +const RemoveDocumentResponse = proto3.makeMessageType( "yorkie.v1.RemoveDocumentResponse", () => [ { no: 1, name: "change_pack", kind: "message", T: ChangePack }, @@ -162,7 +165,7 @@ export const RemoveDocumentResponse = proto3.makeMessageType( /** * @generated from message yorkie.v1.PushPullChangesRequest */ -export const PushPullChangesRequest = proto3.makeMessageType( +const PushPullChangesRequest = proto3.makeMessageType( "yorkie.v1.PushPullChangesRequest", () => [ { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -175,7 +178,7 @@ export const PushPullChangesRequest = proto3.makeMessageType( /** * @generated from message yorkie.v1.PushPullChangesResponse */ -export const PushPullChangesResponse = proto3.makeMessageType( +const PushPullChangesResponse = proto3.makeMessageType( "yorkie.v1.PushPullChangesResponse", () => [ { no: 1, name: "change_pack", kind: "message", T: ChangePack }, @@ -185,7 +188,7 @@ export const PushPullChangesResponse = proto3.makeMessageType( /** * @generated from message yorkie.v1.BroadcastRequest */ -export const BroadcastRequest = proto3.makeMessageType( +const BroadcastRequest = proto3.makeMessageType( "yorkie.v1.BroadcastRequest", () => [ { no: 1, name: "client_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, @@ -198,8 +201,26 @@ export const BroadcastRequest = proto3.makeMessageType( /** * @generated from message yorkie.v1.BroadcastResponse */ -export const BroadcastResponse = proto3.makeMessageType( +const BroadcastResponse = proto3.makeMessageType( "yorkie.v1.BroadcastResponse", [], ); + +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; From b0f50c68f04e092b65e6da3e5ff8c3cc86726e30 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Fri, 15 Dec 2023 16:22:00 +0900 Subject: [PATCH 19/21] Replace interceptors with connect.Interceptor --- src/client/auth_interceptor.ts | 63 +++++++------------------------- src/client/client.ts | 45 ++++++----------------- src/client/metric_interceptor.ts | 36 ++++-------------- 3 files changed, 33 insertions(+), 111 deletions(-) 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 2be963abd..87e784cc0 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -39,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'; /** @@ -326,33 +320,18 @@ 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), - ); - } - - // The transport defines what type of endpoint we're hitting. - // In our example we'll be communicating with a Connect endpoint. - // If your endpoint only supports gRPC-web, make sure to use - // `createGrpcWebTransport` instead. - const transport = createGrpcWebTransport({ - baseUrl: rpcAddr, - // skip interceptors for now because they are metric interceptors - //interceptors: rpcOpts.unaryInterceptors, - }); - // Here we make the client itself, combining the service // definition with the transport. - this.rpcClient = createPromiseClient(YorkieService, transport); + this.rpcClient = createPromiseClient( + YorkieService, + createGrpcWebTransport({ + baseUrl: rpcAddr, + interceptors: [ + createAuthInterceptor(opts.apiKey, opts.token), + createMetricInterceptor(), + ], + }), + ); this.eventStream = createObservable((observer) => { this.eventStreamObserver = observer; 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); + }; } From 8bcca6c552031b0c500244d20d0ff7ea285f5d29 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Fri, 15 Dec 2023 16:45:34 +0900 Subject: [PATCH 20/21] Rollback docker images --- docker/docker-compose-ci.yml | 8 ++------ docker/docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/docker/docker-compose-ci.yml b/docker/docker-compose-ci.yml index b988a838d..5a852e492 100644 --- a/docker/docker-compose-ci.yml +++ b/docker/docker-compose-ci.yml @@ -2,13 +2,9 @@ version: '3.3' services: yorkie: - image: 'krapi0314/yorkie:test' + 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: - '8080:8080' diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index a2cca235f..c03eda524 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.3' services: yorkie: - image: 'krapi0314/yorkie:test' + image: 'yorkieteam/yorkie:latest' container_name: 'yorkie' command: ['server', '--enable-pprof'] restart: always From 97a0845cfc766fa8c81d22b94901d622a19332c5 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Fri, 15 Dec 2023 16:54:46 +0900 Subject: [PATCH 21/21] Remove envoy --- CONTRIBUTING.md | 6 +++--- README.md | 14 -------------- examples/nextjs-scheduler/README.md | 2 +- examples/profile-stack/README.md | 2 +- examples/react-tldraw/README.md | 2 +- .../react-tldraw/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 +- public/counter.html | 2 +- public/drawing.html | 2 +- public/index.html | 2 +- public/multi.html | 2 +- public/quill.html | 2 +- public/whiteboard.html | 2 +- 20 files changed, 21 insertions(+), 35 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0cad78d15..0244b25c2 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 @@ -84,7 +84,7 @@ $ docker-compose -f docker/docker-compose.yml up --build -d ### 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/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/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();